tractr / directus-sync

A CLI tool for synchronizing the schema and configuration of Directus across various environments.
GNU General Public License v3.0
259 stars 10 forks source link

Preserve Ids - Policies Not Allowed #105

Closed NilsBaumgartner1994 closed 2 months ago

NilsBaumgartner1994 commented 2 months ago

Describe the bug I was using --preserve-ids "...,policies" which resulted in an error:

[17:17:59.222] ERROR (14192): Options parsing: [preserveIds] Invalid input
    err: {
      "type": "Error",
      "message": "Options parsing: [preserveIds] Invalid input",
      "stack":
          Error: Options parsing: [preserveIds] Invalid input
              at zodParse (/Users/nilsbaumgartner/.npm/_npx/b3eec9179d2eb85f/node_modules/directus-sync/dist/lib/helpers.js:73:15)
              at ConfigService.flattenOptions (/Users/nilsbaumgartner/.npm/_npx/b3eec9179d2eb85f/node_modules/directus-sync/dist/lib/services/config/config.js:145:39)
              at ConfigService.cacheOriginalMethod (/Users/nilsbaumgartner/.npm/_npx/b3eec9179d2eb85f/node_modules/typescript-cacheable/dist/Cacheable.js:107:53)
              at ConfigService.<anonymous> (/Users/nilsbaumgartner/.npm/_npx/b3eec9179d2eb85f/node_modules/typescript-cacheable/dist/Cacheable.js:97:36)
              at ConfigService.getOptions (/Users/nilsbaumgartner/.npm/_npx/b3eec9179d2eb85f/node_modules/directus-sync/dist/lib/services/config/config.js:120:30)
              at ConfigService.requireOptions (/Users/nilsbaumgartner/.npm/_npx/b3eec9179d2eb85f/node_modules/directus-sync/dist/lib/services/config/config.js:124:28)
              at ConfigService.getLoggerConfig (/Users/nilsbaumgartner/.npm/_npx/b3eec9179d2eb85f/node_modules/directus-sync/dist/lib/services/config/config.js:31:25)
              at ConfigService.cacheOriginalMethod (/Users/nilsbaumgartner/.npm/_npx/b3eec9179d2eb85f/node_modules/typescript-cacheable/dist/Cacheable.js:107:53)
              at ConfigService.<anonymous> (/Users/nilsbaumgartner/.npm/_npx/b3eec9179d2eb85f/node_modules/typescript-cacheable/dist/Cacheable.js:97:36)
              at /Users/nilsbaumgartner/.npm/_npx/b3eec9179d2eb85f/node_modules/directus-sync/dist/lib/loader.js:36:27
    }

here is my used code:

const getDirectusSyncParams = () => {
    // Properly escape the password for shell command
    const preserverIds = "dashboards,operations,panels,policies,roles,translations";
    const preserveOption = "--preserve-ids "+preserverIds;
    return '--directus-url ' + directus_url + ' --directus-email ' + admin_email + ' --directus-password "' + admin_password + '" --dump-path ' + dumpPath+ " "+preserveOption
}
EdouardDem commented 2 months ago

Hi. Which version of directus-syncare you using ?

NilsBaumgartner1994 commented 2 months ago
"directus-sync": "3.1.3",
NilsBaumgartner1994 commented 2 months ago

My bad...