contensis-cli 1.6.0 → 1.6.1-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/dev.js +9 -1
- package/dist/commands/dev.js.map +2 -2
- package/dist/commands/globalOptions.js +1 -1
- package/dist/commands/globalOptions.js.map +2 -2
- package/dist/commands/import.js +33 -6
- package/dist/commands/import.js.map +2 -2
- package/dist/commands/push.js +5 -0
- package/dist/commands/push.js.map +2 -2
- package/dist/factories/RequestHandlerFactory.js +15 -6
- package/dist/factories/RequestHandlerFactory.js.map +2 -2
- package/dist/localisation/en-GB.js +11 -4
- package/dist/localisation/en-GB.js.map +2 -2
- package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js +26 -17
- package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js.map +3 -3
- package/dist/models/CliService.d.js.map +1 -1
- package/dist/providers/GitHubCliModuleProvider.js +7 -7
- package/dist/providers/GitHubCliModuleProvider.js.map +3 -3
- package/dist/providers/HttpProvider.js +1 -1
- package/dist/providers/HttpProvider.js.map +2 -2
- package/dist/providers/file-provider.js +3 -0
- package/dist/providers/file-provider.js.map +2 -2
- package/dist/services/ContensisCliService.js +79 -12
- package/dist/services/ContensisCliService.js.map +2 -2
- package/dist/services/ContensisDevService.js +77 -29
- package/dist/services/ContensisDevService.js.map +3 -3
- package/dist/shell.js +1 -0
- package/dist/shell.js.map +2 -2
- package/dist/util/console.printer.js +38 -2
- package/dist/util/console.printer.js.map +2 -2
- package/dist/util/os.js +6 -3
- package/dist/util/os.js.map +2 -2
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +9 -5
- package/src/commands/dev.ts +12 -2
- package/src/commands/globalOptions.ts +5 -3
- package/src/commands/import.ts +46 -5
- package/src/commands/push.ts +6 -0
- package/src/factories/RequestHandlerFactory.ts +19 -8
- package/src/localisation/en-GB.ts +14 -4
- package/src/mappers/DevRequests-to-RequestHanderCliArgs.ts +25 -17
- package/src/models/CliService.d.ts +5 -1
- package/src/providers/GitHubCliModuleProvider.ts +8 -8
- package/src/providers/HttpProvider.ts +2 -2
- package/src/providers/file-provider.ts +3 -0
- package/src/services/ContensisCliService.ts +109 -19
- package/src/services/ContensisDevService.ts +99 -35
- package/src/shell.ts +1 -0
- package/src/util/console.printer.ts +52 -0
- package/src/util/os.ts +5 -3
- package/src/version.ts +1 -1
package/dist/commands/dev.js
CHANGED
|
@@ -56,6 +56,14 @@ Example call:
|
|
|
56
56
|
).option("--args <args...>", "override or add additional args").option(
|
|
57
57
|
"--release <release>",
|
|
58
58
|
"launch a specific release version of the request handler"
|
|
59
|
+
).option(
|
|
60
|
+
"--override [override...]",
|
|
61
|
+
"override configurations for other blocks"
|
|
62
|
+
).addOption(
|
|
63
|
+
new import_commander.Option(
|
|
64
|
+
"-ll --log-level <logLevel>",
|
|
65
|
+
"set the request handler logging level"
|
|
66
|
+
).choices(["debug", "information", "warning", "error", "none"])
|
|
59
67
|
).usage("[block-id] [local-uri]").addHelpText(
|
|
60
68
|
"after",
|
|
61
69
|
`
|
|
@@ -67,7 +75,7 @@ Example call:
|
|
|
67
75
|
await (0, import_ContensisDevService.devCommand)(
|
|
68
76
|
["dev", "requests", blockId.join(" ")],
|
|
69
77
|
opts
|
|
70
|
-
).ExecRequestHandler(blockId, opts == null ? void 0 : opts.args, opts.release);
|
|
78
|
+
).ExecRequestHandler(blockId, opts == null ? void 0 : opts.override, opts == null ? void 0 : opts.args, opts.release);
|
|
71
79
|
});
|
|
72
80
|
return dev;
|
|
73
81
|
};
|
package/dist/commands/dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/dev.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { devCommand } from '~/services/ContensisDevService';\n\nexport const makeDevCommand = () => {\n const dev = new Command()\n .command('dev')\n .description('dev command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n dev\n .command('init')\n .description(\n 'initialise a git clone directory to connect and deploy to Contensis'\n )\n .argument(\n '[projectHome]',\n 'the path of the folder to initialise',\n process.cwd()\n )\n .option(\n '--url <url>',\n 'override the git url or add one to initialise a non-git folder'\n )\n .option(\n '-d --dry-run',\n 'perform a dry run of the project initialisation where no changes are made'\n )\n // .option(\n // '--commit',\n // 'commit change (will eventually be deprecated in favour of --dry-run)',\n // true\n // )\n .addHelpText(\n 'after',\n `\nExample call:\n > dev init\\n`\n )\n .action(async (projectHome: string, opts) => {\n // TODO: add opts for overriding project name and git url\n await devCommand(['dev', 'init', projectHome], opts).DevelopmentInit(\n projectHome,\n { ...opts, dryRun: opts.dryRun }\n );\n });\n\n dev\n .command('requests')\n .description('launch request handler for local development')\n .argument(\n '[block-id...]',\n 'id of block to develop locally and the local uri to pass requests for this block onto'\n )\n .option('--args <args...>', 'override or add additional args')\n .option(\n '--release <release>',\n 'launch a specific release version of the request handler'\n )\n .usage('[block-id] [local-uri]')\n .addHelpText(\n 'after',\n `\nExample call:\n > dev requests test-block-one\n > dev requests my-website http://localhost:8080\\n`\n )\n .action(async (blockId: string[] = [], opts) => {\n await devCommand(\n ['dev', 'requests', blockId.join(' ')],\n opts\n ).ExecRequestHandler(blockId, opts?.args, opts.release);\n });\n\n return dev;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import { Command, Option } from 'commander';\nimport { devCommand } from '~/services/ContensisDevService';\n\nexport const makeDevCommand = () => {\n const dev = new Command()\n .command('dev')\n .description('dev command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n dev\n .command('init')\n .description(\n 'initialise a git clone directory to connect and deploy to Contensis'\n )\n .argument(\n '[projectHome]',\n 'the path of the folder to initialise',\n process.cwd()\n )\n .option(\n '--url <url>',\n 'override the git url or add one to initialise a non-git folder'\n )\n .option(\n '-d --dry-run',\n 'perform a dry run of the project initialisation where no changes are made'\n )\n // .option(\n // '--commit',\n // 'commit change (will eventually be deprecated in favour of --dry-run)',\n // true\n // )\n .addHelpText(\n 'after',\n `\nExample call:\n > dev init\\n`\n )\n .action(async (projectHome: string, opts) => {\n // TODO: add opts for overriding project name and git url\n await devCommand(['dev', 'init', projectHome], opts).DevelopmentInit(\n projectHome,\n { ...opts, dryRun: opts.dryRun }\n );\n });\n\n dev\n .command('requests')\n .description('launch request handler for local development')\n .argument(\n '[block-id...]',\n 'id of block to develop locally and the local uri to pass requests for this block onto'\n )\n .option('--args <args...>', 'override or add additional args')\n .option(\n '--release <release>',\n 'launch a specific release version of the request handler'\n )\n .option(\n '--override [override...]',\n 'override configurations for other blocks'\n )\n .addOption(\n new Option(\n '-ll --log-level <logLevel>',\n 'set the request handler logging level'\n ).choices(['debug', 'information', 'warning', 'error', 'none'])\n )\n .usage('[block-id] [local-uri]')\n .addHelpText(\n 'after',\n `\nExample call:\n > dev requests test-block-one\n > dev requests my-website http://localhost:8080\\n`\n )\n .action(async (blockId: string[] = [], opts) => {\n await devCommand(\n ['dev', 'requests', blockId.join(' ')],\n opts\n ).ExecRequestHandler(blockId, opts?.override, opts?.args, opts.release);\n });\n\n return dev;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAChC,iCAA2B;AAEpB,MAAM,iBAAiB,MAAM;AAClC,QAAM,MAAM,IAAI,yBAAQ,EACrB,QAAQ,KAAK,EACb,YAAY,aAAa,EACzB,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,MACG,QAAQ,MAAM,EACd;AAAA,IACC;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,IACA,QAAQ,IAAI;AAAA,EACd,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EAMC;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAGF,EACC,OAAO,OAAO,aAAqB,SAAS;AAE3C,cAAM,uCAAW,CAAC,OAAO,QAAQ,WAAW,GAAG,IAAI,EAAE;AAAA,MACnD;AAAA,MACA,EAAE,GAAG,MAAM,QAAQ,KAAK,OAAO;AAAA,IACjC;AAAA,EACF,CAAC;AAEH,MACG,QAAQ,UAAU,EAClB,YAAY,8CAA8C,EAC1D;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,oBAAoB,iCAAiC,EAC5D;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF,EAAE,QAAQ,CAAC,SAAS,eAAe,WAAW,SAAS,MAAM,CAAC;AAAA,EAChE,EACC,MAAM,wBAAwB,EAC9B;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAO,UAAoB,CAAC,GAAG,SAAS;AAC9C,cAAM;AAAA,MACJ,CAAC,OAAO,YAAY,QAAQ,KAAK,GAAG,CAAC;AAAA,MACrC;AAAA,IACF,EAAE,mBAAmB,SAAS,6BAAM,UAAU,6BAAM,MAAM,KAAK,OAAO;AAAA,EACxE,CAAC;AAEH,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -84,7 +84,7 @@ const mapContensisOpts = (opts = {}) => ({
|
|
|
84
84
|
noPublish: !opts.publish,
|
|
85
85
|
// arg is inverted automatically from `--no-publish` to `publish: false`
|
|
86
86
|
outputLogs: opts.logLevel,
|
|
87
|
-
stopLevel: typeof opts.stopLevel === "number" ? Number(opts.stopLevel) : typeof opts.dependents === "number" ? Number(opts.dependents) : void 0
|
|
87
|
+
stopLevel: typeof opts.stopLevel === "number" ? Number(opts.stopLevel) : typeof opts.dependents === "number" ? Number(opts.dependents) : typeof opts.depth === "number" ? Number(opts.depth) : void 0
|
|
88
88
|
});
|
|
89
89
|
const output = new import_commander.Option(
|
|
90
90
|
"-o --output <output>",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/globalOptions.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command, Option } from 'commander';\nimport { MigrateRequest } from 'migratortron';\nimport { url } from '~/util';\n\n// Map various input options into a request to be processed\n// by Migratortron / Contensis import library\nexport const mapContensisOpts = (opts: any = {}): MigrateRequest => ({\n source:\n opts.sourceAlias || opts.sourceProjectId\n ? {\n url: opts.sourceAlias\n ? url(opts.sourceAlias, 'website').cms\n : (undefined as any),\n project: opts.sourceProjectId || (undefined as any),\n }\n : undefined,\n models: opts.modelIds,\n copyField: opts.copyField,\n updateField: opts.updateField,\n // convert various cli options into MigrateRequest.query format\n query:\n opts.id ||\n opts.entryIds ||\n opts.search ||\n opts.fields ||\n opts.orderBy ||\n opts.paths ||\n opts.assetType ||\n opts.contentType ||\n opts.dataFormat ||\n opts.deliveryApi ||\n opts.latest ||\n opts.versionStatus\n ? {\n assetTypes: opts.assetType,\n contentTypeIds: opts.contentType,\n dataFormats: opts.dataFormat ? [opts.dataFormat] : undefined,\n fields: opts.fields,\n includeIds: opts.id || opts.entryIds,\n includePaths: opts.paths,\n orderBy: opts.orderBy,\n searchTerm: opts.search,\n useDelivery: opts.deliveryApi,\n versionStatus: opts.latest ? 'latest' : opts.versionStatus,\n }\n : undefined,\n zenQL: opts.zenql,\n transformGuids: !opts.preserveGuids,\n ignoreErrors: opts.ignoreErrors,\n noCache: !opts.cache, // arg is inverted automatically from `--no-cache` to `cache: false`\n includeDefaults: opts.defaults, // arg is inverted automatically from `--no-defaults` to `defaults: false`\n includeValidations: opts.validations, // arg is inverted automatically from `--no-validations` to `validations: false`\n concurrency: opts.concurrency ? Number(opts.concurrency) : undefined,\n noPublish: !opts.publish, // arg is inverted automatically from `--no-publish` to `publish: false`\n outputLogs: opts.logLevel,\n stopLevel:\n typeof opts.stopLevel === 'number'
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAEhC,kBAAoB;AAIb,MAAM,mBAAmB,CAAC,OAAY,CAAC,OAAuB;AAAA,EACnE,QACE,KAAK,eAAe,KAAK,kBACrB;AAAA,IACE,KAAK,KAAK,kBACN,iBAAI,KAAK,aAAa,SAAS,EAAE,MAChC;AAAA,IACL,SAAS,KAAK,mBAAoB;AAAA,EACpC,IACA;AAAA,EACN,QAAQ,KAAK;AAAA,EACb,WAAW,KAAK;AAAA,EAChB,aAAa,KAAK;AAAA;AAAA,EAElB,OACE,KAAK,MACL,KAAK,YACL,KAAK,UACL,KAAK,UACL,KAAK,WACL,KAAK,SACL,KAAK,aACL,KAAK,eACL,KAAK,cACL,KAAK,eACL,KAAK,UACL,KAAK,gBACD;AAAA,IACE,YAAY,KAAK;AAAA,IACjB,gBAAgB,KAAK;AAAA,IACrB,aAAa,KAAK,aAAa,CAAC,KAAK,UAAU,IAAI;AAAA,IACnD,QAAQ,KAAK;AAAA,IACb,YAAY,KAAK,MAAM,KAAK;AAAA,IAC5B,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK;AAAA,IACd,YAAY,KAAK;AAAA,IACjB,aAAa,KAAK;AAAA,IAClB,eAAe,KAAK,SAAS,WAAW,KAAK;AAAA,EAC/C,IACA;AAAA,EACN,OAAO,KAAK;AAAA,EACZ,gBAAgB,CAAC,KAAK;AAAA,EACtB,cAAc,KAAK;AAAA,EACnB,SAAS,CAAC,KAAK;AAAA;AAAA,EACf,iBAAiB,KAAK;AAAA;AAAA,EACtB,oBAAoB,KAAK;AAAA;AAAA,EACzB,aAAa,KAAK,cAAc,OAAO,KAAK,WAAW,IAAI;AAAA,EAC3D,WAAW,CAAC,KAAK;AAAA;AAAA,EACjB,YAAY,KAAK;AAAA,EACjB,WACE,OAAO,KAAK,cAAc,WACtB,OAAO,KAAK,SAAS,IACrB,OAAO,KAAK,eAAe,WACzB,OAAO,KAAK,UAAU,IACtB;
|
|
4
|
+
"sourcesContent": ["import { Command, Option } from 'commander';\nimport { MigrateRequest } from 'migratortron';\nimport { url } from '~/util';\n\n// Map various input options into a request to be processed\n// by Migratortron / Contensis import library\nexport const mapContensisOpts = (opts: any = {}): MigrateRequest => ({\n source:\n opts.sourceAlias || opts.sourceProjectId\n ? {\n url: opts.sourceAlias\n ? url(opts.sourceAlias, 'website').cms\n : (undefined as any),\n project: opts.sourceProjectId || (undefined as any),\n }\n : undefined,\n models: opts.modelIds,\n copyField: opts.copyField,\n updateField: opts.updateField,\n // convert various cli options into MigrateRequest.query format\n query:\n opts.id ||\n opts.entryIds ||\n opts.search ||\n opts.fields ||\n opts.orderBy ||\n opts.paths ||\n opts.assetType ||\n opts.contentType ||\n opts.dataFormat ||\n opts.deliveryApi ||\n opts.latest ||\n opts.versionStatus\n ? {\n assetTypes: opts.assetType,\n contentTypeIds: opts.contentType,\n dataFormats: opts.dataFormat ? [opts.dataFormat] : undefined,\n fields: opts.fields,\n includeIds: opts.id || opts.entryIds,\n includePaths: opts.paths,\n orderBy: opts.orderBy,\n searchTerm: opts.search,\n useDelivery: opts.deliveryApi,\n versionStatus: opts.latest ? 'latest' : opts.versionStatus,\n }\n : undefined,\n zenQL: opts.zenql,\n transformGuids: !opts.preserveGuids,\n ignoreErrors: opts.ignoreErrors,\n noCache: !opts.cache, // arg is inverted automatically from `--no-cache` to `cache: false`\n includeDefaults: opts.defaults, // arg is inverted automatically from `--no-defaults` to `defaults: false`\n includeValidations: opts.validations, // arg is inverted automatically from `--no-validations` to `validations: false`\n concurrency: opts.concurrency ? Number(opts.concurrency) : undefined,\n noPublish: !opts.publish, // arg is inverted automatically from `--no-publish` to `publish: false`\n outputLogs: opts.logLevel,\n stopLevel:\n typeof opts.stopLevel === 'number' // stopLevel is used with `import entries`\n ? Number(opts.stopLevel)\n : typeof opts.dependents === 'number' // dependents is used with `get entries`\n ? Number(opts.dependents)\n : typeof opts.depth === 'number' // depth is used with `import nodes`\n ? Number(opts.depth)\n : undefined,\n});\n\n/* Output options */\nconst output = new Option(\n '-o --output <output>',\n 'save output to a file e.g. --output ./output.txt'\n);\n\nconst format = new Option(\n '-f --format <format>',\n 'format output as csv, json, html, xml or default'\n).choices(['csv', 'json', 'html', 'xml', 'table']);\n\n/* Connect options */\nconst alias = new Option(\n '-a --alias <alias>',\n 'the cloud CMS alias to connect your request with'\n);\n\nexport const project = new Option(\n '-p --project-id <projectId>',\n 'the projectId to make your request with'\n);\n\n/* Authentication options */\nconst user = new Option(\n '-u --user <user>',\n 'the username to authenticate your request with'\n);\nconst password = new Option(\n '-pw --password <password>',\n 'the password to use to login with (optional/insecure)'\n);\nconst clientId = new Option(\n '-id --client-id <clientId>',\n 'the clientId to authenticate your request with'\n);\nconst sharedSecret = new Option(\n '-s --shared-secret <sharedSecret>',\n 'the shared secret to use when logging in with a client id'\n);\n\n/* Model get options */\nexport const requiredBy = new Option(\n '--required-by',\n 'shows the id(s) that created each dependency'\n);\nexport const exportOption = new Option(\n '--export',\n 'export the raw resources that make up the content model(s) (used with --output)'\n);\n\n/* Entry get options */\nexport const delivery = new Option(\n '-delivery --delivery-api',\n 'use delivery api to get the entries'\n);\nexport const search = new Option(\n '--search <phrase>',\n 'get entries with the search phrase, use quotes for multiple words'\n);\nexport const zenql = new Option(\n '-q --zenql <zenql>',\n 'get entries with a supplied ZenQL statement'\n);\n\nexport const entryId = new Option('-i --id <id...>', 'the entry id(s) to get');\nexport const contentTypes = new Option(\n '-c --content-type <contentType...>',\n 'get entries of these content type(s)'\n);\nexport const assetTypes = new Option(\n '-at --asset-type <assetType...>',\n 'get assets of given content type(s) e.g. image word pdf'\n);\nexport const versionStatus = new Option(\n '-vs --version-status <versionStatus>',\n 'the entry versions to get'\n)\n .choices(['latest', 'published'])\n .default('published');\n\nexport const latest = new Option('--latest', 'get the latest entry versions');\n\n/* Import options */\nexport const fromFile = new Option(\n '-file --from-file <fromFile>',\n 'file path to import asset(s) from'\n);\n\nexport const fromCms = new Option(\n '-source --source-alias <fromCms>',\n 'the cloud CMS alias to import asset(s) from'\n);\nexport const fromProject = new Option(\n '-sp --source-project-id <fromProject>',\n 'the id of the Contensis project to import asset(s) from (Default: [last connected project])'\n);\n\nexport const commit = new Option(\n '--commit',\n 'add this flag only after you have run a preview of the import and agree with the analysis'\n).default(false);\n\nexport const ignoreErrors = new Option(\n '-ignore --ignore-errors',\n 'commit the import ignoring any reported errors'\n).default(false);\n\nexport const logLevel = new Option(\n '-ll --log-level <logLevel>',\n 'set the logging level to output more detailed logs'\n)\n .choices(['debug', 'info', 'warning', 'error', 'none'])\n .default('warning');\n\nexport const outputDetail = new Option(\n '-od --output-detail <outputDetail>',\n 'how much detail to output from the import'\n)\n .choices(['errors', 'changes', 'all'])\n .default('errors');\n\nexport const saveEntries = new Option(\n '-save --save-entries',\n \"save the entries we're migrating instead of the migration preview (used with --output)\"\n);\n\nexport const concurrency = new Option(\n '-conc --concurrency <concurrency>',\n 'the number of entries to load in parallel'\n).default(2);\n\nexport const noCache = new Option(\n '--no-cache',\n 'ignore internal cache and rebuild all resources from scratch'\n);\n\nexport const noPublish = new Option(\n '--no-publish',\n \"don't publish created or updated entries\"\n);\n\nexport const stopLevel = new Option(\n '-d --stop-level <stopLevel>',\n 'the level at which to stop resolving dependent entries (may result in incomplete entries)'\n).argParser(parseInt);\n\nexport const addConnectOptions = (program: Command) =>\n program.addOption(alias.hideHelp()).addOption(project.hideHelp());\n\nexport const addAuthenticationOptions = (program: Command) =>\n program\n .addOption(user.hideHelp())\n .addOption(password.hideHelp())\n .addOption(clientId.hideHelp())\n .addOption(sharedSecret.hideHelp());\n\nconst addOutputAndFormatOptions = (program: Command) =>\n program.addOption(output).addOption(format);\n\nexport const addImportOptions = (program: Command) => {\n for (const command of program.commands) {\n command.addOption(fromCms).addOption(fromProject).addOption(fromFile);\n }\n return program;\n};\n\nexport const addGlobalOptions = (program: Command) => {\n for (const command of program.commands) {\n command.addOption(logLevel.hideHelp());\n addOutputAndFormatOptions(command);\n addConnectOptions(command);\n addAuthenticationOptions(command);\n }\n return program;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAEhC,kBAAoB;AAIb,MAAM,mBAAmB,CAAC,OAAY,CAAC,OAAuB;AAAA,EACnE,QACE,KAAK,eAAe,KAAK,kBACrB;AAAA,IACE,KAAK,KAAK,kBACN,iBAAI,KAAK,aAAa,SAAS,EAAE,MAChC;AAAA,IACL,SAAS,KAAK,mBAAoB;AAAA,EACpC,IACA;AAAA,EACN,QAAQ,KAAK;AAAA,EACb,WAAW,KAAK;AAAA,EAChB,aAAa,KAAK;AAAA;AAAA,EAElB,OACE,KAAK,MACL,KAAK,YACL,KAAK,UACL,KAAK,UACL,KAAK,WACL,KAAK,SACL,KAAK,aACL,KAAK,eACL,KAAK,cACL,KAAK,eACL,KAAK,UACL,KAAK,gBACD;AAAA,IACE,YAAY,KAAK;AAAA,IACjB,gBAAgB,KAAK;AAAA,IACrB,aAAa,KAAK,aAAa,CAAC,KAAK,UAAU,IAAI;AAAA,IACnD,QAAQ,KAAK;AAAA,IACb,YAAY,KAAK,MAAM,KAAK;AAAA,IAC5B,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK;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,oBAAoB,CAAC,YAChC,QAAQ,UAAU,MAAM,SAAS,CAAC,EAAE,UAAU,QAAQ,SAAS,CAAC;AAE3D,MAAM,2BAA2B,CAAC,YACvC,QACG,UAAU,KAAK,SAAS,CAAC,EACzB,UAAU,SAAS,SAAS,CAAC,EAC7B,UAAU,SAAS,SAAS,CAAC,EAC7B,UAAU,aAAa,SAAS,CAAC;AAEtC,MAAM,4BAA4B,CAAC,YACjC,QAAQ,UAAU,MAAM,EAAE,UAAU,MAAM;AAErC,MAAM,mBAAmB,CAAC,YAAqB;AACpD,aAAW,WAAW,QAAQ,UAAU;AACtC,YAAQ,UAAU,OAAO,EAAE,UAAU,WAAW,EAAE,UAAU,QAAQ;AAAA,EACtE;AACA,SAAO;AACT;AAEO,MAAM,mBAAmB,CAAC,YAAqB;AACpD,aAAW,WAAW,QAAQ,UAAU;AACtC,YAAQ,UAAU,SAAS,SAAS,CAAC;AACrC,8BAA0B,OAAO;AACjC,sBAAkB,OAAO;AACzB,6BAAyB,OAAO;AAAA,EAClC;AACA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/commands/import.js
CHANGED
|
@@ -31,10 +31,7 @@ const makeImportCommand = () => {
|
|
|
31
31
|
program.command("models").description("import complete content models").argument("[modelIds...]", "ids of the content models to import (optional)").addOption(import_globalOptions.noCache).addOption(import_globalOptions.commit).option(
|
|
32
32
|
"-nod --no-defaults",
|
|
33
33
|
"ignore any default entries or nodes attached to content types or fields"
|
|
34
|
-
).option(
|
|
35
|
-
"-nov --no-validations",
|
|
36
|
-
"import fields with validations removed"
|
|
37
|
-
).option(
|
|
34
|
+
).option("-nov --no-validations", "import fields with validations removed").option(
|
|
38
35
|
"-preserve --preserve-guids",
|
|
39
36
|
"import any default entries or nodes using the same id as the source"
|
|
40
37
|
).addOption(import_globalOptions.ignoreErrors).addHelpText(
|
|
@@ -110,7 +107,7 @@ Example call:
|
|
|
110
107
|
"after",
|
|
111
108
|
`
|
|
112
109
|
Example call:
|
|
113
|
-
> import entries --source-
|
|
110
|
+
> import entries --source-alias example-dev --source-project-id microsite --zenql "sys.contentTypeId = blog"
|
|
114
111
|
> import entries --from-file myImportData.json --preserve-guids
|
|
115
112
|
`
|
|
116
113
|
).action(async (search, opts, cmd) => {
|
|
@@ -125,7 +122,12 @@ Example call:
|
|
|
125
122
|
saveEntries: opts.saveEntries
|
|
126
123
|
});
|
|
127
124
|
});
|
|
128
|
-
program.command("nodes").description("import nodes").argument("[root]", "import nodes from the specified path e.g. /blog", "/").
|
|
125
|
+
program.command("nodes").description("import nodes").argument("[root]", "import nodes from the specified path e.g. /blog", "/").addOption(
|
|
126
|
+
new import_commander.Option(
|
|
127
|
+
"-d --depth <depth>",
|
|
128
|
+
"import nodes with children to a specified depth"
|
|
129
|
+
).argParser(parseInt)
|
|
130
|
+
).option(
|
|
129
131
|
"-preserve --preserve-guids",
|
|
130
132
|
"include this flag when you are importing nodes that you have previously exported and wish to update"
|
|
131
133
|
).addOption(import_globalOptions.ignoreErrors).addOption(import_globalOptions.commit).addOption(
|
|
@@ -218,6 +220,31 @@ Example call:
|
|
|
218
220
|
save: opts.save
|
|
219
221
|
});
|
|
220
222
|
});
|
|
223
|
+
program.command("webhooks").description("import webhooks").argument("[name]", "import webhooks with this name").option("-i --id <ids...>", "limit to the supplied webhook id(s)").option("--enabled", "import enabled webhooks only").option("--disabled", "import disabled webhooks only").addOption(import_globalOptions.commit).addOption(
|
|
224
|
+
new import_commander.Option(
|
|
225
|
+
"-od --output-detail <outputDetail>",
|
|
226
|
+
"how much detail to output from the import"
|
|
227
|
+
).choices(["errors", "changes", "all"]).default("changes")
|
|
228
|
+
).addHelpText(
|
|
229
|
+
"after",
|
|
230
|
+
`
|
|
231
|
+
Example call:
|
|
232
|
+
> import webhooks --source-cms example-dev --source-project-id microsite
|
|
233
|
+
> import webhooks --from-file myImportData.json
|
|
234
|
+
`
|
|
235
|
+
).action(async (name, opts) => {
|
|
236
|
+
await (0, import_ContensisCliService.cliCommand)(
|
|
237
|
+
["import", "webhooks"],
|
|
238
|
+
opts,
|
|
239
|
+
(0, import_globalOptions.mapContensisOpts)({ ...opts, id: opts.ids, search: name })
|
|
240
|
+
).ImportWebhooks({
|
|
241
|
+
commit: opts.commit,
|
|
242
|
+
fromFile: opts.fromFile,
|
|
243
|
+
logOutput: opts.outputDetail,
|
|
244
|
+
enabled: opts.enabled,
|
|
245
|
+
disabled: opts.disabled
|
|
246
|
+
});
|
|
247
|
+
});
|
|
221
248
|
return program;
|
|
222
249
|
};
|
|
223
250
|
const get = makeImportCommand();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/import.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command, Option } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n assetTypes,\n commit,\n concurrency,\n contentTypes,\n entryId,\n ignoreErrors,\n latest,\n mapContensisOpts,\n noCache,\n noPublish,\n outputDetail,\n saveEntries,\n stopLevel,\n versionStatus,\n zenql,\n} from './globalOptions';\n\nexport const makeImportCommand = () => {\n const program = new Command()\n .command('import')\n .description('import command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n program\n .command('models')\n .description('import complete content models')\n .argument('[modelIds...]', 'ids of the content models to import (optional)')\n .addOption(noCache)\n .addOption(commit)\n .option(\n '-nod --no-defaults',\n 'ignore any default entries or nodes attached to content types or fields'\n )\n .option(\n '-nov --no-validations',\n 'import fields with validations removed'\n )\n .option(\n '-preserve --preserve-guids',\n 'import any default entries or nodes using the same id as the source'\n )\n .addOption(ignoreErrors)\n .addHelpText(\n 'after',\n `\nExample call:\n > import models blogPost --from-file contentmodels-backup.json\n > import models --source-alias example-dev\n`\n )\n .action(async (modelIds: string[], opts) => {\n await cliCommand(\n ['import', 'models', modelIds.join(' ')],\n opts,\n mapContensisOpts({ modelIds, ...opts })\n ).ImportContentModels({\n fromFile: opts.fromFile,\n commit: opts.commit,\n });\n });\n\n program\n .command('contenttypes')\n .description('import content types')\n .argument(\n '[contentTypeIds...]',\n 'Optional list of API id(s) of the content type(s) to import'\n )\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import contenttypes {contentTypeIds} --from-file contenttypes-backup.json\n > import contenttypes {contentTypeIds} --source-alias example-dev\n`\n )\n .action(async (contentTypeIds: string[], opts) => {\n await cliCommand(\n ['import', 'contenttypes'],\n opts,\n mapContensisOpts({ contentTypeIds, ...opts })\n ).ImportContentTypes(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n contentTypeIds\n );\n });\n\n program\n .command('components')\n .description('import components')\n .argument(\n '[componentIds...]',\n 'Optional list of API id(s) of the component(s) to import'\n )\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import components {componentIds} --from-file component-backup.json\n > import components {componentIds} --source-alias example-dev\n`\n )\n .action(async (componentIds: string[], opts) => {\n await cliCommand(\n ['import', 'component'],\n opts,\n mapContensisOpts({ componentIds, ...opts })\n ).ImportComponents(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n componentIds\n );\n });\n\n program\n .command('entries')\n .description('import entries')\n .argument(\n '[search phrase]',\n 'get entries with the search phrase, use quotes for multiple words'\n )\n .addOption(entryId)\n .addOption(zenql)\n .addOption(contentTypes)\n .addOption(assetTypes)\n .addOption(latest)\n .addOption(versionStatus)\n .addOption(stopLevel)\n .addOption(commit)\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing entries that you have previously exported and wish to update'\n )\n .addOption(concurrency)\n .addOption(outputDetail)\n .addOption(ignoreErrors)\n .addOption(noCache)\n .addOption(noPublish)\n .addOption(saveEntries)\n .addHelpText(\n 'after',\n `\nExample call:\n > import entries --source-cms example-dev --source-project-id microsite --zenql \"sys.contentTypeId = blog\"\n > import entries --from-file myImportData.json --preserve-guids\n`\n )\n .action(async (search: string, opts, cmd) => {\n await cliCommand(\n ['import', 'entries'],\n opts,\n mapContensisOpts({ search, ...opts })\n ).ImportEntries({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputDetail,\n saveEntries: opts.saveEntries,\n });\n });\n\n // TODO: add options to import one an array of nodes? nodeIds: string[]\n program\n .command('nodes')\n .description('import nodes')\n .argument('[root]', 'import nodes from the specified path e.g. /blog', '/')\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing nodes that you have previously exported and wish to update'\n )\n .addOption(ignoreErrors)\n .addOption(commit)\n .addOption(\n new Option(\n '-od --output-detail <outputDetail>',\n 'how much detail to output from the import'\n )\n .choices(['errors', 'changes', 'all'])\n .default('errors')\n )\n .option(\n '-ol --output-limit <outputLimit>',\n 'expand or limit the number of records output to the console',\n '200'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > import nodes /blog --source-alias example-alias --source-project-id example-project\n > import nodes --from-file site-backup.json --preserve-guids\n`\n )\n .action(async (root: string, opts) => {\n await cliCommand(\n ['import', 'nodes'],\n opts,\n mapContensisOpts({ paths: root.split(' '), ...opts })\n ).ImportNodes({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputDetail,\n logLimit: Number(opts.outputLimit),\n });\n });\n\n program\n .command('taggroups')\n .description('import taggroups')\n .argument('[query]', 'apply a filter')\n .option('-i --id <ids...>', 'limit to the supplied tag group id(s)')\n .addOption(commit)\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing tags that you have previously exported and wish to update'\n )\n .addOption(concurrency)\n .addOption(ignoreErrors)\n .option(\n '--save',\n \"save the tag groups we're migrating instead of the migration preview (used with --output)\"\n )\n .addHelpText(\n 'after',\n `\n Example call:\n > import taggroups --source-cms example-dev --source-project-id microsite --zenql \"sys.contentTypeId = blog\"\n > import taggroups --from-file myImportData.json --preserve-guids\n `\n )\n .action(async (query: string, opts) => {\n await cliCommand(\n ['import', 'taggroups'],\n opts,\n mapContensisOpts(opts)\n ).ImportTagGroups({\n commit: opts.commit,\n fromFile: opts.fromFile,\n getBy: {\n id: opts.id?.length === 1 ? opts.id[0] : undefined,\n ids: opts.id?.length > 1 ? opts.id : undefined,\n q: query,\n },\n save: opts.save,\n });\n });\n\n program\n .command('tags')\n .description('import tags')\n .option('-in --group <groupId>', 'id of the tag group containing tags')\n .option('--label <label>', 'filter by tags that match this label')\n .option('-l --language <language>', 'find tags in the supplied language')\n .option('-i --id <ids...>', 'limit to the supplied tag group id(s)')\n .addOption(commit)\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing tags that you have previously exported and wish to update'\n )\n .addOption(concurrency)\n .addOption(ignoreErrors)\n .option(\n '--save',\n \"save the tags we're migrating instead of the migration preview (used with --output)\"\n )\n .addHelpText(\n 'after',\n `\n Example call:\n > import tags --source-cms example-dev --source-project-id microsite --group example\n > import tags --from-file myImportData.json --preserve-guids\n `\n )\n .action(async opts => {\n await cliCommand(\n ['import', 'tags'],\n opts,\n mapContensisOpts(opts)\n ).ImportTags({\n commit: opts.commit,\n fromFile: opts.fromFile,\n getBy: {\n groupId: opts.group,\n id: opts.id?.length === 1 ? opts.id[0] : undefined,\n ids: opts.id?.length > 1 ? opts.id : undefined,\n label: opts.label,\n language: opts.language,\n },\n save: opts.save,\n });\n });\n\n return program;\n};\n\nexport const get = makeImportCommand();\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAChC,iCAA2B;AAC3B,2BAgBO;AAEA,MAAM,oBAAoB,MAAM;AACrC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ,QAAQ,EAChB,YAAY,gBAAgB,EAC5B,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,UACG,QAAQ,QAAQ,EAChB,YAAY,gCAAgC,EAC5C,SAAS,iBAAiB,gDAAgD,EAC1E,UAAU,4BAAO,EACjB,UAAU,2BAAM,EAChB;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC
|
|
4
|
+
"sourcesContent": ["import { Command, Option } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n assetTypes,\n commit,\n concurrency,\n contentTypes,\n entryId,\n ignoreErrors,\n latest,\n mapContensisOpts,\n noCache,\n noPublish,\n outputDetail,\n saveEntries,\n stopLevel,\n versionStatus,\n zenql,\n} from './globalOptions';\n\nexport const makeImportCommand = () => {\n const program = new Command()\n .command('import')\n .description('import command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n program\n .command('models')\n .description('import complete content models')\n .argument('[modelIds...]', 'ids of the content models to import (optional)')\n .addOption(noCache)\n .addOption(commit)\n .option(\n '-nod --no-defaults',\n 'ignore any default entries or nodes attached to content types or fields'\n )\n .option('-nov --no-validations', 'import fields with validations removed')\n .option(\n '-preserve --preserve-guids',\n 'import any default entries or nodes using the same id as the source'\n )\n .addOption(ignoreErrors)\n .addHelpText(\n 'after',\n `\nExample call:\n > import models blogPost --from-file contentmodels-backup.json\n > import models --source-alias example-dev\n`\n )\n .action(async (modelIds: string[], opts) => {\n await cliCommand(\n ['import', 'models', modelIds.join(' ')],\n opts,\n mapContensisOpts({ modelIds, ...opts })\n ).ImportContentModels({\n fromFile: opts.fromFile,\n commit: opts.commit,\n });\n });\n\n program\n .command('contenttypes')\n .description('import content types')\n .argument(\n '[contentTypeIds...]',\n 'Optional list of API id(s) of the content type(s) to import'\n )\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import contenttypes {contentTypeIds} --from-file contenttypes-backup.json\n > import contenttypes {contentTypeIds} --source-alias example-dev\n`\n )\n .action(async (contentTypeIds: string[], opts) => {\n await cliCommand(\n ['import', 'contenttypes'],\n opts,\n mapContensisOpts({ contentTypeIds, ...opts })\n ).ImportContentTypes(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n contentTypeIds\n );\n });\n\n program\n .command('components')\n .description('import components')\n .argument(\n '[componentIds...]',\n 'Optional list of API id(s) of the component(s) to import'\n )\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import components {componentIds} --from-file component-backup.json\n > import components {componentIds} --source-alias example-dev\n`\n )\n .action(async (componentIds: string[], opts) => {\n await cliCommand(\n ['import', 'component'],\n opts,\n mapContensisOpts({ componentIds, ...opts })\n ).ImportComponents(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n componentIds\n );\n });\n\n program\n .command('entries')\n .description('import entries')\n .argument(\n '[search phrase]',\n 'get entries with the search phrase, use quotes for multiple words'\n )\n .addOption(entryId)\n .addOption(zenql)\n .addOption(contentTypes)\n .addOption(assetTypes)\n .addOption(latest)\n .addOption(versionStatus)\n .addOption(stopLevel)\n .addOption(commit)\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing entries that you have previously exported and wish to update'\n )\n .addOption(concurrency)\n .addOption(outputDetail)\n .addOption(ignoreErrors)\n .addOption(noCache)\n .addOption(noPublish)\n .addOption(saveEntries)\n .addHelpText(\n 'after',\n `\nExample call:\n > import entries --source-alias example-dev --source-project-id microsite --zenql \"sys.contentTypeId = blog\"\n > import entries --from-file myImportData.json --preserve-guids\n`\n )\n .action(async (search: string, opts, cmd) => {\n await cliCommand(\n ['import', 'entries'],\n opts,\n mapContensisOpts({ search, ...opts })\n ).ImportEntries({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputDetail,\n saveEntries: opts.saveEntries,\n });\n });\n\n // TODO: add options to import one an array of nodes? nodeIds: string[]\n program\n .command('nodes')\n .description('import nodes')\n .argument('[root]', 'import nodes from the specified path e.g. /blog', '/')\n .addOption(\n new Option(\n '-d --depth <depth>',\n 'import nodes with children to a specified depth'\n ).argParser(parseInt)\n )\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing nodes that you have previously exported and wish to update'\n )\n .addOption(ignoreErrors)\n .addOption(commit)\n .addOption(\n new Option(\n '-od --output-detail <outputDetail>',\n 'how much detail to output from the import'\n )\n .choices(['errors', 'changes', 'all'])\n .default('errors')\n )\n .option(\n '-ol --output-limit <outputLimit>',\n 'expand or limit the number of records output to the console',\n '200'\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > import nodes /blog --source-alias example-alias --source-project-id example-project\n > import nodes --from-file site-backup.json --preserve-guids\n`\n )\n .action(async (root: string, opts) => {\n await cliCommand(\n ['import', 'nodes'],\n opts,\n mapContensisOpts({ paths: root.split(' '), ...opts })\n ).ImportNodes({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputDetail,\n logLimit: Number(opts.outputLimit),\n });\n });\n\n program\n .command('taggroups')\n .description('import taggroups')\n .argument('[query]', 'apply a filter')\n .option('-i --id <ids...>', 'limit to the supplied tag group id(s)')\n .addOption(commit)\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing tags that you have previously exported and wish to update'\n )\n .addOption(concurrency)\n .addOption(ignoreErrors)\n .option(\n '--save',\n \"save the tag groups we're migrating instead of the migration preview (used with --output)\"\n )\n .addHelpText(\n 'after',\n `\n Example call:\n > import taggroups --source-cms example-dev --source-project-id microsite --zenql \"sys.contentTypeId = blog\"\n > import taggroups --from-file myImportData.json --preserve-guids\n `\n )\n .action(async (query: string, opts) => {\n await cliCommand(\n ['import', 'taggroups'],\n opts,\n mapContensisOpts(opts)\n ).ImportTagGroups({\n commit: opts.commit,\n fromFile: opts.fromFile,\n getBy: {\n id: opts.id?.length === 1 ? opts.id[0] : undefined,\n ids: opts.id?.length > 1 ? opts.id : undefined,\n q: query,\n },\n save: opts.save,\n });\n });\n\n program\n .command('tags')\n .description('import tags')\n .option('-in --group <groupId>', 'id of the tag group containing tags')\n .option('--label <label>', 'filter by tags that match this label')\n .option('-l --language <language>', 'find tags in the supplied language')\n .option('-i --id <ids...>', 'limit to the supplied tag group id(s)')\n .addOption(commit)\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing tags that you have previously exported and wish to update'\n )\n .addOption(concurrency)\n .addOption(ignoreErrors)\n .option(\n '--save',\n \"save the tags we're migrating instead of the migration preview (used with --output)\"\n )\n .addHelpText(\n 'after',\n `\n Example call:\n > import tags --source-cms example-dev --source-project-id microsite --group example\n > import tags --from-file myImportData.json --preserve-guids\n `\n )\n .action(async opts => {\n await cliCommand(\n ['import', 'tags'],\n opts,\n mapContensisOpts(opts)\n ).ImportTags({\n commit: opts.commit,\n fromFile: opts.fromFile,\n getBy: {\n groupId: opts.group,\n id: opts.id?.length === 1 ? opts.id[0] : undefined,\n ids: opts.id?.length > 1 ? opts.id : undefined,\n label: opts.label,\n language: opts.language,\n },\n save: opts.save,\n });\n });\n\n program\n .command('webhooks')\n .description('import webhooks')\n .argument('[name]', 'import webhooks with this name')\n .option('-i --id <ids...>', 'limit to the supplied webhook id(s)')\n .option('--enabled', 'import enabled webhooks only')\n .option('--disabled', 'import disabled webhooks only')\n .addOption(commit)\n .addOption(\n new Option(\n '-od --output-detail <outputDetail>',\n 'how much detail to output from the import'\n )\n .choices(['errors', 'changes', 'all'])\n .default('changes')\n )\n .addHelpText(\n 'after',\n `\n Example call:\n > import webhooks --source-cms example-dev --source-project-id microsite\n > import webhooks --from-file myImportData.json\n `\n )\n .action(async (name, opts) => {\n await cliCommand(\n ['import', 'webhooks'],\n opts,\n mapContensisOpts({ ...opts, id: opts.ids, search: name })\n ).ImportWebhooks({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputDetail,\n enabled: opts.enabled,\n disabled: opts.disabled,\n });\n });\n\n return program;\n};\n\nexport const get = makeImportCommand();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAChC,iCAA2B;AAC3B,2BAgBO;AAEA,MAAM,oBAAoB,MAAM;AACrC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ,QAAQ,EAChB,YAAY,gBAAgB,EAC5B,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,UACG,QAAQ,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,UAAU,UAAU;AAAA,MACrB;AAAA,UACA,uCAAiB,EAAE,GAAG,MAAM,IAAI,KAAK,KAAK,QAAQ,KAAK,CAAC;AAAA,IAC1D,EAAE,eAAe;AAAA,MACf,QAAQ,KAAK;AAAA,MACb,UAAU,KAAK;AAAA,MACf,WAAW,KAAK;AAAA,MAChB,SAAS,KAAK;AAAA,MACd,UAAU,KAAK;AAAA,IACjB,CAAC;AAAA,EACH,CAAC;AAEH,SAAO;AACT;AAEO,MAAM,MAAM,kBAAkB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/commands/push.js
CHANGED
|
@@ -133,6 +133,10 @@ Example call:
|
|
|
133
133
|
"-r --release",
|
|
134
134
|
"whether to release the pushed block version",
|
|
135
135
|
false
|
|
136
|
+
).option(
|
|
137
|
+
"--make-live",
|
|
138
|
+
"whether to make the pushed block version live immediately",
|
|
139
|
+
false
|
|
136
140
|
).option(
|
|
137
141
|
"-cid --commit-id <commitId>",
|
|
138
142
|
"the id of the source git commit for the supplied image uri"
|
|
@@ -171,6 +175,7 @@ Example call:
|
|
|
171
175
|
};
|
|
172
176
|
const blockRequest = (0, import_jsonpath_mapper.default)(mapSourceVars, {
|
|
173
177
|
release: { $path: "release", $default: () => false },
|
|
178
|
+
makeLive: { $path: "makeLive", $default: () => false },
|
|
174
179
|
id: ["blockId"],
|
|
175
180
|
image: () => {
|
|
176
181
|
const lastIndexOfColon = imageUri.lastIndexOf(":");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/push.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport mapJson from 'jsonpath-mapper';\nimport { generateGuid, PushBlockParams } from 'migratortron';\nimport path from 'path';\nimport { Asset } from 'contensis-delivery-api';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n commit,\n mapContensisOpts,\n noPublish,\n outputDetail,\n saveEntries,\n} from './globalOptions';\nimport { jsonFormatter } from '~/util/json.formatter';\nimport { cwdPath } from '~/providers/file-provider';\n\nexport const makePushCommand = () => {\n const push = new Command()\n .command('push')\n .description('push command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n push\n .command('asset')\n .description('push an asset')\n .argument('<content-type-id>', 'the content type id of the asset to push')\n .argument(\n '<title>',\n 'the title of the asset as it appears in the cms (use quotes)'\n )\n .argument(\n '[description]',\n 'the description or altText of the asset (use quotes)'\n )\n .option(\n '-from --from-file <fromFile>',\n 'the local file path of the source asset'\n )\n .option('-url --from-url <fromUrl>', 'the full url of the source asset')\n .option(\n '-to --target-file-path <targetFilePath>',\n 'the file path in the cms project to push the asset to e.g. \"/asset-library/\"'\n )\n .option(\n '-name --target-file-name <targetFileName>',\n 'set the file name in the cms project'\n )\n .option('-i --id <id>', 'push the asset with a specific guid')\n .addOption(commit)\n .addOption(noPublish)\n .addOption(outputDetail)\n .addOption(saveEntries)\n .usage('<content-type-id> <title> [description] [options]')\n .addHelpText(\n 'after',\n `\nExample call:\n > push asset pdf \"Example file\" \"An example of a PDF asset\" --from-file example.pdf --target-file-path /asset-library/pdf/\\n`\n )\n .action(\n async (\n contentTypeId: string,\n title: string,\n description: string,\n opts\n ) => {\n const cli = cliCommand(\n ['push', 'asset', contentTypeId, title, description],\n opts,\n mapContensisOpts({ preserveGuids: true, ...opts, id: undefined })\n );\n const mapSourceVars = {\n contentTypeId,\n title,\n description,\n ...opts,\n };\n\n const assetEntry: Asset = mapJson(mapSourceVars, {\n entryTitle: 'title',\n title: 'title',\n entryDescription: 'description',\n description: 'description',\n altText: ({ contentTypeId, description }) =>\n contentTypeId === 'image' ? description : undefined,\n sys: {\n dataFormat: () => 'asset',\n contentTypeId: 'contentTypeId',\n id: 'id',\n isPublished: () => true, // can be overridden by !opts.publish\n properties: {\n filename: {\n $path: ['targetFileName', 'fromFile', 'fromUrl'],\n $formatting: (nameOrPath: string) => {\n return path.basename(nameOrPath);\n },\n },\n filePath: {\n $path: 'targetFilePath',\n $default: (_, { fromFile, fromUrl }) => {\n const toPosixPath = (windowsPath: string) =>\n windowsPath.replace(/^(\\w):|\\\\+/g, '/$1');\n\n return path.dirname(\n toPosixPath(fromFile || fromUrl.split(':/')[1])\n );\n },\n },\n },\n uri: {\n $path: ['fromFile', 'fromUrl'],\n $formatting: (from: string) =>\n from?.startsWith('http') ? from : cwdPath(from),\n },\n },\n });\n\n if (!assetEntry.sys.id)\n assetEntry.sys.id = generateGuid(\n cli.currentEnv,\n cli.currentProject,\n `${assetEntry.sys.contentTypeId}-${assetEntry.sys.properties.filePath.replaceAll('/', '').toLowerCase()}-${assetEntry.sys.properties.filename.toLowerCase()}`\n );\n\n console.log(jsonFormatter(assetEntry));\n\n await cli.ImportEntries({\n commit: opts.commit,\n logOutput: opts.outputDetail,\n saveEntries: opts.saveEntries,\n data: [assetEntry],\n });\n }\n );\n\n push\n .command('block')\n .description('push a block')\n .argument('<block-id>', 'the name of the block to push to')\n .argument(\n '<image uri:tag>',\n 'the uri and tag of the container image to push as a block (tag default: latest)'\n )\n .argument('[branch]', 'the branch we are pushing to')\n .option(\n '-r --release',\n 'whether to release the pushed block version',\n false\n )\n .option(\n '-cid --commit-id <commitId>',\n 'the id of the source git commit for the supplied image uri'\n )\n .option(\n '-cmsg --commit-message <commitMessage>',\n 'the git commit message for the supplied commit id'\n )\n .option(\n '-cdt --commit-datetime <commitDateTime>',\n 'the timestamp of the source git commit for the supplied image uri'\n )\n .option(\n '-author --author-email <authorEmail>',\n 'the git email address of the author of the source git commit'\n )\n .option(\n '-committer --committer-email <committerEmail>',\n 'the git email address of the commiter of the source git commit'\n )\n .option(\n '-repo --repository-url <repositoryUrl>',\n 'the url of the source repository for the supplied image uri'\n )\n .option(\n '-pr --provider <sourceProvider>',\n 'the source repository provider of the supplied image uri'\n )\n .usage('<block-id> <image uri> [branch] [options]')\n .addHelpText(\n 'after',\n `\nExample call:\n > push block contensis-app ghcr.io/contensis/contensis-app/app:build-4359 master --release\\n`\n )\n .action(async (blockId: string, imageUri: string, branch: string, opts) => {\n const cli = cliCommand(['push', 'block', blockId], opts);\n const mapSourceVars = {\n blockId,\n imageUri,\n branch,\n ...opts,\n ...process.env,\n };\n\n const blockRequest = mapJson(mapSourceVars, {\n release: { $path: 'release', $default: () => false },\n id: ['blockId'],\n image: () => {\n const lastIndexOfColon = imageUri.lastIndexOf(':');\n return {\n uri: imageUri.slice(0, lastIndexOfColon),\n tag: imageUri.slice(lastIndexOfColon + 1) || 'latest',\n };\n },\n projectId: () => cli.env.currentProject || '',\n source: {\n provider: {\n $path: ['provider'],\n $return: (provider: string, { GITHUB_ACTIONS, GITLAB_CI }) => {\n if (provider) return provider;\n if (GITHUB_ACTIONS) return 'Github';\n else if (GITLAB_CI) return 'GitlabSelfHosted';\n },\n },\n repositoryUrl: {\n $path: ['repositoryUrl', 'CI_PROJECT_URL', 'GITHUB_REPOSITORY'],\n $formatting: (url: string, { GITHUB_ACTIONS }) => {\n if (GITHUB_ACTIONS) url = `https://github.com/${url}`;\n\n if (url && !url.endsWith('.git')) return `${url}.git`;\n return url;\n },\n },\n branch: ['branch', 'CI_COMMIT_REF_NAME', 'GITHUB_REF_NAME'],\n commit: {\n id: ['commitId', 'CI_COMMIT_SHORT_SHA', 'GITHUB_SHA'],\n message: {\n $path: ['commitMessage', 'CI_COMMIT_MESSAGE'], // ${{ github.event.head_commit.message }}\n $formatting: (msg?: string) =>\n msg?.replace(/\\\\n/g, ' ').replace(/\\\\n/g, ' ').trim(),\n },\n dateTime: ['commitDatetime', 'CI_COMMIT_TIMESTAMP'], // ${{ github.event.head_commit.timestamp }}\n authorEmail: ['authorEmail', 'GITLAB_USER_EMAIL', 'GITHUB_ACTOR'], // ${{ github.event.head_commit.author.email }}\n committerEmail: [\n 'committerEmail',\n 'GITLAB_USER_EMAIL',\n 'GITHUB_TRIGGERING_ACTOR',\n ], // ${{ github.event.head_commit.committer.email }}\n },\n },\n }) as PushBlockParams;\n\n await cli.PushBlock(blockRequest);\n\n // console.log(process.env);\n });\n\n return push;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,6BAAoB;AACpB,0BAA8C;AAC9C,kBAAiB;AAEjB,iCAA2B;AAC3B,2BAMO;AACP,kBAA8B;AAC9B,2BAAwB;AAEjB,MAAM,kBAAkB,MAAM;AACnC,QAAM,OAAO,IAAI,yBAAQ,EACtB,QAAQ,MAAM,EACd,YAAY,cAAc,EAC1B,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,OACG,QAAQ,OAAO,EACf,YAAY,eAAe,EAC3B,SAAS,qBAAqB,0CAA0C,EACxE;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,6BAA6B,kCAAkC,EACtE;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,gBAAgB,qCAAqC,EAC5D,UAAU,2BAAM,EAChB,UAAU,8BAAS,EACnB,UAAU,iCAAY,EACtB,UAAU,gCAAW,EACrB,MAAM,mDAAmD,EACzD;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAGF,EACC;AAAA,IACC,OACE,eACA,OACA,aACA,SACG;AACH,YAAM,UAAM;AAAA,QACV,CAAC,QAAQ,SAAS,eAAe,OAAO,WAAW;AAAA,QACnD;AAAA,YACA,uCAAiB,EAAE,eAAe,MAAM,GAAG,MAAM,IAAI,OAAU,CAAC;AAAA,MAClE;AACA,YAAM,gBAAgB;AAAA,QACpB;AAAA,QACA;AAAA,QACA;AAAA,QACA,GAAG;AAAA,MACL;AAEA,YAAM,iBAAoB,uBAAAA,SAAQ,eAAe;AAAA,QAC/C,YAAY;AAAA,QACZ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AAAA,UAClB,SAAS,CAAC,UAAkB,EAAE,gBAAgB,UAAU,MAAM;AAC5D,gBAAI,SAAU,QAAO;AACrB,gBAAI,eAAgB,QAAO;AAAA,qBAClB,UAAW,QAAO;AAAA,UAC7B;AAAA,QACF;AAAA,QACA,eAAe;AAAA,UACb,OAAO,CAAC,iBAAiB,kBAAkB,mBAAmB;AAAA,UAC9D,aAAa,CAAC,KAAa,EAAE,eAAe,MAAM;AAChD,gBAAI,eAAgB,OAAM,sBAAsB,GAAG;AAEnD,gBAAI,OAAO,CAAC,IAAI,SAAS,MAAM,EAAG,QAAO,GAAG,GAAG;AAC/C,mBAAO;AAAA,UACT;AAAA,QACF;AAAA,QACA,QAAQ,CAAC,UAAU,sBAAsB,iBAAiB;AAAA,QAC1D,QAAQ;AAAA,UACN,IAAI,CAAC,YAAY,uBAAuB,YAAY;AAAA,UACpD,SAAS;AAAA,YACP,OAAO,CAAC,iBAAiB,mBAAmB;AAAA;AAAA,YAC5C,aAAa,CAAC,QACZ,2BAAK,QAAQ,QAAQ,KAAK,QAAQ,QAAQ,KAAK;AAAA,UACnD;AAAA,UACA,UAAU,CAAC,kBAAkB,qBAAqB;AAAA;AAAA,UAClD,aAAa,CAAC,eAAe,qBAAqB,cAAc;AAAA;AAAA,UAChE,gBAAgB;AAAA,YACd;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAED,UAAM,IAAI,UAAU,YAAY;AAAA,EAGlC,CAAC;AAEH,SAAO;AACT;",
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport mapJson from 'jsonpath-mapper';\nimport { generateGuid, PushBlockParams } from 'migratortron';\nimport path from 'path';\nimport { Asset } from 'contensis-delivery-api';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n commit,\n mapContensisOpts,\n noPublish,\n outputDetail,\n saveEntries,\n} from './globalOptions';\nimport { jsonFormatter } from '~/util/json.formatter';\nimport { cwdPath } from '~/providers/file-provider';\n\nexport const makePushCommand = () => {\n const push = new Command()\n .command('push')\n .description('push command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n push\n .command('asset')\n .description('push an asset')\n .argument('<content-type-id>', 'the content type id of the asset to push')\n .argument(\n '<title>',\n 'the title of the asset as it appears in the cms (use quotes)'\n )\n .argument(\n '[description]',\n 'the description or altText of the asset (use quotes)'\n )\n .option(\n '-from --from-file <fromFile>',\n 'the local file path of the source asset'\n )\n .option('-url --from-url <fromUrl>', 'the full url of the source asset')\n .option(\n '-to --target-file-path <targetFilePath>',\n 'the file path in the cms project to push the asset to e.g. \"/asset-library/\"'\n )\n .option(\n '-name --target-file-name <targetFileName>',\n 'set the file name in the cms project'\n )\n .option('-i --id <id>', 'push the asset with a specific guid')\n .addOption(commit)\n .addOption(noPublish)\n .addOption(outputDetail)\n .addOption(saveEntries)\n .usage('<content-type-id> <title> [description] [options]')\n .addHelpText(\n 'after',\n `\nExample call:\n > push asset pdf \"Example file\" \"An example of a PDF asset\" --from-file example.pdf --target-file-path /asset-library/pdf/\\n`\n )\n .action(\n async (\n contentTypeId: string,\n title: string,\n description: string,\n opts\n ) => {\n const cli = cliCommand(\n ['push', 'asset', contentTypeId, title, description],\n opts,\n mapContensisOpts({ preserveGuids: true, ...opts, id: undefined })\n );\n const mapSourceVars = {\n contentTypeId,\n title,\n description,\n ...opts,\n };\n\n const assetEntry: Asset = mapJson(mapSourceVars, {\n entryTitle: 'title',\n title: 'title',\n entryDescription: 'description',\n description: 'description',\n altText: ({ contentTypeId, description }) =>\n contentTypeId === 'image' ? description : undefined,\n sys: {\n dataFormat: () => 'asset',\n contentTypeId: 'contentTypeId',\n id: 'id',\n isPublished: () => true, // can be overridden by !opts.publish\n properties: {\n filename: {\n $path: ['targetFileName', 'fromFile', 'fromUrl'],\n $formatting: (nameOrPath: string) => {\n return path.basename(nameOrPath);\n },\n },\n filePath: {\n $path: 'targetFilePath',\n $default: (_, { fromFile, fromUrl }) => {\n const toPosixPath = (windowsPath: string) =>\n windowsPath.replace(/^(\\w):|\\\\+/g, '/$1');\n\n return path.dirname(\n toPosixPath(fromFile || fromUrl.split(':/')[1])\n );\n },\n },\n },\n uri: {\n $path: ['fromFile', 'fromUrl'],\n $formatting: (from: string) =>\n from?.startsWith('http') ? from : cwdPath(from),\n },\n },\n });\n\n if (!assetEntry.sys.id)\n assetEntry.sys.id = generateGuid(\n cli.currentEnv,\n cli.currentProject,\n `${assetEntry.sys.contentTypeId}-${assetEntry.sys.properties.filePath.replaceAll('/', '').toLowerCase()}-${assetEntry.sys.properties.filename.toLowerCase()}`\n );\n\n console.log(jsonFormatter(assetEntry));\n\n await cli.ImportEntries({\n commit: opts.commit,\n logOutput: opts.outputDetail,\n saveEntries: opts.saveEntries,\n data: [assetEntry],\n });\n }\n );\n\n push\n .command('block')\n .description('push a block')\n .argument('<block-id>', 'the name of the block to push to')\n .argument(\n '<image uri:tag>',\n 'the uri and tag of the container image to push as a block (tag default: latest)'\n )\n .argument('[branch]', 'the branch we are pushing to')\n .option(\n '-r --release',\n 'whether to release the pushed block version',\n false\n )\n .option(\n '--make-live',\n 'whether to make the pushed block version live immediately',\n false\n )\n .option(\n '-cid --commit-id <commitId>',\n 'the id of the source git commit for the supplied image uri'\n )\n .option(\n '-cmsg --commit-message <commitMessage>',\n 'the git commit message for the supplied commit id'\n )\n .option(\n '-cdt --commit-datetime <commitDateTime>',\n 'the timestamp of the source git commit for the supplied image uri'\n )\n .option(\n '-author --author-email <authorEmail>',\n 'the git email address of the author of the source git commit'\n )\n .option(\n '-committer --committer-email <committerEmail>',\n 'the git email address of the commiter of the source git commit'\n )\n .option(\n '-repo --repository-url <repositoryUrl>',\n 'the url of the source repository for the supplied image uri'\n )\n .option(\n '-pr --provider <sourceProvider>',\n 'the source repository provider of the supplied image uri'\n )\n .usage('<block-id> <image uri> [branch] [options]')\n .addHelpText(\n 'after',\n `\nExample call:\n > push block contensis-app ghcr.io/contensis/contensis-app/app:build-4359 master --release\\n`\n )\n .action(async (blockId: string, imageUri: string, branch: string, opts) => {\n const cli = cliCommand(['push', 'block', blockId], opts);\n const mapSourceVars = {\n blockId,\n imageUri,\n branch,\n ...opts,\n ...process.env,\n };\n\n const blockRequest = mapJson(mapSourceVars, {\n release: { $path: 'release', $default: () => false },\n makeLive: { $path: 'makeLive', $default: () => false },\n id: ['blockId'],\n image: () => {\n const lastIndexOfColon = imageUri.lastIndexOf(':');\n return {\n uri: imageUri.slice(0, lastIndexOfColon),\n tag: imageUri.slice(lastIndexOfColon + 1) || 'latest',\n };\n },\n projectId: () => cli.env.currentProject || '',\n source: {\n provider: {\n $path: ['provider'],\n $return: (provider: string, { GITHUB_ACTIONS, GITLAB_CI }) => {\n if (provider) return provider;\n if (GITHUB_ACTIONS) return 'Github';\n else if (GITLAB_CI) return 'GitlabSelfHosted';\n },\n },\n repositoryUrl: {\n $path: ['repositoryUrl', 'CI_PROJECT_URL', 'GITHUB_REPOSITORY'],\n $formatting: (url: string, { GITHUB_ACTIONS }) => {\n if (GITHUB_ACTIONS) url = `https://github.com/${url}`;\n\n if (url && !url.endsWith('.git')) return `${url}.git`;\n return url;\n },\n },\n branch: ['branch', 'CI_COMMIT_REF_NAME', 'GITHUB_REF_NAME'],\n commit: {\n id: ['commitId', 'CI_COMMIT_SHORT_SHA', 'GITHUB_SHA'],\n message: {\n $path: ['commitMessage', 'CI_COMMIT_MESSAGE'], // ${{ github.event.head_commit.message }}\n $formatting: (msg?: string) =>\n msg?.replace(/\\\\n/g, ' ').replace(/\\\\n/g, ' ').trim(),\n },\n dateTime: ['commitDatetime', 'CI_COMMIT_TIMESTAMP'], // ${{ github.event.head_commit.timestamp }}\n authorEmail: ['authorEmail', 'GITLAB_USER_EMAIL', 'GITHUB_ACTOR'], // ${{ github.event.head_commit.author.email }}\n committerEmail: [\n 'committerEmail',\n 'GITLAB_USER_EMAIL',\n 'GITHUB_TRIGGERING_ACTOR',\n ], // ${{ github.event.head_commit.committer.email }}\n },\n },\n }) as PushBlockParams;\n\n await cli.PushBlock(blockRequest);\n\n // console.log(process.env);\n });\n\n return push;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,6BAAoB;AACpB,0BAA8C;AAC9C,kBAAiB;AAEjB,iCAA2B;AAC3B,2BAMO;AACP,kBAA8B;AAC9B,2BAAwB;AAEjB,MAAM,kBAAkB,MAAM;AACnC,QAAM,OAAO,IAAI,yBAAQ,EACtB,QAAQ,MAAM,EACd,YAAY,cAAc,EAC1B,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,OACG,QAAQ,OAAO,EACf,YAAY,eAAe,EAC3B,SAAS,qBAAqB,0CAA0C,EACxE;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,6BAA6B,kCAAkC,EACtE;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,gBAAgB,qCAAqC,EAC5D,UAAU,2BAAM,EAChB,UAAU,8BAAS,EACnB,UAAU,iCAAY,EACtB,UAAU,gCAAW,EACrB,MAAM,mDAAmD,EACzD;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAGF,EACC;AAAA,IACC,OACE,eACA,OACA,aACA,SACG;AACH,YAAM,UAAM;AAAA,QACV,CAAC,QAAQ,SAAS,eAAe,OAAO,WAAW;AAAA,QACnD;AAAA,YACA,uCAAiB,EAAE,eAAe,MAAM,GAAG,MAAM,IAAI,OAAU,CAAC;AAAA,MAClE;AACA,YAAM,gBAAgB;AAAA,QACpB;AAAA,QACA;AAAA,QACA;AAAA,QACA,GAAG;AAAA,MACL;AAEA,YAAM,iBAAoB,uBAAAA,SAAQ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AAK;AAAA,QAC/C;AAAA,MACF;AAAA,MACA,WAAW,MAAM,IAAI,IAAI,kBAAkB;AAAA,MAC3C,QAAQ;AAAA,QACN,UAAU;AAAA,UACR,OAAO,CAAC,UAAU;AAAA,UAClB,SAAS,CAAC,UAAkB,EAAE,gBAAgB,UAAU,MAAM;AAC5D,gBAAI,SAAU,QAAO;AACrB,gBAAI,eAAgB,QAAO;AAAA,qBAClB,UAAW,QAAO;AAAA,UAC7B;AAAA,QACF;AAAA,QACA,eAAe;AAAA,UACb,OAAO,CAAC,iBAAiB,kBAAkB,mBAAmB;AAAA,UAC9D,aAAa,CAAC,KAAa,EAAE,eAAe,MAAM;AAChD,gBAAI,eAAgB,OAAM,sBAAsB,GAAG;AAEnD,gBAAI,OAAO,CAAC,IAAI,SAAS,MAAM,EAAG,QAAO,GAAG,GAAG;AAC/C,mBAAO;AAAA,UACT;AAAA,QACF;AAAA,QACA,QAAQ,CAAC,UAAU,sBAAsB,iBAAiB;AAAA,QAC1D,QAAQ;AAAA,UACN,IAAI,CAAC,YAAY,uBAAuB,YAAY;AAAA,UACpD,SAAS;AAAA,YACP,OAAO,CAAC,iBAAiB,mBAAmB;AAAA;AAAA,YAC5C,aAAa,CAAC,QACZ,2BAAK,QAAQ,QAAQ,KAAK,QAAQ,QAAQ,KAAK;AAAA,UACnD;AAAA,UACA,UAAU,CAAC,kBAAkB,qBAAqB;AAAA;AAAA,UAClD,aAAa,CAAC,eAAe,qBAAqB,cAAc;AAAA;AAAA,UAChE,gBAAgB;AAAA,YACd;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAED,UAAM,IAAI,UAAU,YAAY;AAAA,EAGlC,CAAC;AAEH,SAAO;AACT;",
|
|
6
6
|
"names": ["mapJson", "contentTypeId", "description", "path"]
|
|
7
7
|
}
|
|
@@ -116,10 +116,10 @@ class RequestHandlerFactory {
|
|
|
116
116
|
log.error(messages.devrequests.errored(error));
|
|
117
117
|
});
|
|
118
118
|
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
119
|
-
while (
|
|
120
|
-
if (!isRunning) return;
|
|
119
|
+
while (isRunning) {
|
|
121
120
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
122
121
|
}
|
|
122
|
+
return;
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
125
|
async CheckUpdate({
|
|
@@ -140,7 +140,7 @@ ${release.html_url}`
|
|
|
140
140
|
);
|
|
141
141
|
else
|
|
142
142
|
log.warning(messages.devrequests.install.notFound(moduleInfo.github));
|
|
143
|
-
const downloadSpecificRelease = version &&
|
|
143
|
+
const downloadSpecificRelease = version && (release == null ? void 0 : release.tag_name);
|
|
144
144
|
if ((release == null ? void 0 : release.tag_name) && ![moduleInfo.version, moduleInfo.install].includes(release.tag_name) || downloadSpecificRelease) {
|
|
145
145
|
const downloadPath = import_path.default.join(
|
|
146
146
|
this.basePath,
|
|
@@ -161,9 +161,12 @@ ${release.html_url}`
|
|
|
161
161
|
path: downloadPath,
|
|
162
162
|
// Map NodeJS os platform to release asset name
|
|
163
163
|
platforms: [
|
|
164
|
-
["win32", "win-
|
|
165
|
-
["
|
|
166
|
-
["
|
|
164
|
+
["win32", "arm64", "win-arm64"],
|
|
165
|
+
["win32", "x64", "win-x64"],
|
|
166
|
+
["darwin", "arm64", "osx-arm64"],
|
|
167
|
+
["darwin", "x64", "osx-x64"],
|
|
168
|
+
["linux", "arm64", "linux-arm64"],
|
|
169
|
+
["linux", "x64", "linux-x64"]
|
|
167
170
|
]
|
|
168
171
|
});
|
|
169
172
|
} catch (ex) {
|
|
@@ -209,6 +212,12 @@ ${release.html_url}`
|
|
|
209
212
|
delete moduleInfo.install;
|
|
210
213
|
manifest.writeModule(this.name, this.moduleInfo);
|
|
211
214
|
}
|
|
215
|
+
} else if (moduleInfo.version) {
|
|
216
|
+
if (!(0, import_file_provider.pathExists)(this.exePath)) {
|
|
217
|
+
import_logger.Logger.warning(messages.devrequests.missingBinary(moduleInfo.version));
|
|
218
|
+
this.version = moduleInfo.version;
|
|
219
|
+
await this.Create();
|
|
220
|
+
}
|
|
212
221
|
}
|
|
213
222
|
}
|
|
214
223
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/factories/RequestHandlerFactory.ts"],
|
|
4
|
-
"sourcesContent": ["import { spawn } from 'child_process';\nimport inquirer from 'inquirer';\nimport { createSpinner } from 'nanospinner';\nimport path from 'path';\nimport { LogMessages } from '~/localisation/en-GB';\nimport GitHubCliModuleProvider from '~/providers/GitHubCliModuleProvider';\n\nimport ManifestProvider from '~/providers/ManifestProvider';\nimport { appRootDir,
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAsB;AACtB,sBAAqB;AACrB,yBAA8B;AAC9B,kBAAiB;AACjB,mBAA4B;AAC5B,qCAAoC;AAEpC,8BAA6B;AAC7B,
|
|
4
|
+
"sourcesContent": ["import { spawn } from 'child_process';\nimport inquirer from 'inquirer';\nimport { createSpinner } from 'nanospinner';\nimport path from 'path';\nimport { LogMessages } from '~/localisation/en-GB';\nimport GitHubCliModuleProvider from '~/providers/GitHubCliModuleProvider';\n\nimport ManifestProvider from '~/providers/ManifestProvider';\nimport { appRootDir, joinPath, pathExists } from '~/providers/file-provider';\nimport { isDebug } from '~/util/debug';\nimport { Logger } from '~/util/logger';\n\nexport class RequestHandlerFactory {\n debug = isDebug();\n log = Logger;\n messages = LogMessages;\n manifest = new ManifestProvider(); // Load cli-manifest.json\n\n basePath = path.join(appRootDir);\n name = 'request-handler-localdevelopment';\n cmd = 'Zengenti.Contensis.RequestHandler.LocalDevelopment';\n\n prerelease;\n version; // pass in a specific release version to run\n\n get exePath() {\n return path.join(this.basePath, `${this.name}-${this.moduleInfo.version}`);\n }\n\n get moduleInfo() {\n return (\n this.manifest.getModule(this.name) || {\n github: 'contensis/request-handler-localdevelopment',\n version: '*',\n }\n );\n }\n\n constructor(version?: string, prerelease = false) {\n this.prerelease = prerelease;\n this.version = version;\n }\n\n // Use the factory to create a request handler instance\n // handling the download and updating of the external binary\n async Create() {\n const { moduleInfo, version } = this;\n const downloadImmediately =\n !moduleInfo?.version || moduleInfo?.version === '*' || this.version;\n\n if (downloadImmediately) {\n // Create cli-manifest.json\n this.manifest.writeModule(this.name, this.moduleInfo);\n\n // Download for first time use (await)\n await this.CheckUpdate({ verbose: true, version });\n }\n\n // Apply any downloaded/pending update so we launch that version\n await this.ApplyUpdate();\n\n // Fire an async update check and continue working in the background (do not await)\n if (!downloadImmediately) this.CheckUpdate();\n\n // Return a RequestHandler ready to invoke\n return this.CreateInvoke(this);\n }\n\n CreateInvoke(self = this) {\n // Hoist the vars we need from `this` as we lose scope\n // when the function is returned from the Create() method\n const { debug, log, messages, cmd, exePath } = self;\n\n // Invoke request handler method\n return async (args: string[]) => {\n const child = spawn(joinPath(exePath, cmd), args, { stdio: 'inherit' });\n\n if (args?.length && debug)\n log.warning(\n `Spawning process with supplied args: ${JSON.stringify(\n child.spawnargs,\n null,\n 2\n )}`\n );\n\n let isRunning = false;\n\n // Log child output through event listeners\n child?.stdout?.on('data', data => {\n isRunning = true;\n log.raw(data);\n });\n\n child?.stderr?.on('data', data => {\n log.error(data);\n });\n\n child.on('spawn', () => {\n isRunning = true;\n log.help(messages.devrequests.spawn());\n });\n\n child.on('exit', code => {\n isRunning = false;\n\n log[code === 0 ? 'success' : 'warning'](\n messages.devrequests.exited(code)\n );\n });\n\n child.on('error', error => {\n isRunning = false;\n log.error(messages.devrequests.errored(error));\n });\n\n await new Promise(resolve => setTimeout(resolve, 2000));\n\n // keep the method running until we can return\n while (isRunning) {\n await new Promise(resolve => setTimeout(resolve, 1000));\n }\n return;\n };\n }\n\n async CheckUpdate({\n verbose = false,\n version,\n }: { verbose?: boolean; version?: string } = {}) {\n const { cmd, debug, log, manifest, messages, moduleInfo } = this;\n\n const github = new GitHubCliModuleProvider(moduleInfo.github);\n\n // Find latest version\n const release = await github.FindLatestRelease(version);\n\n if (verbose || debug)\n if (release)\n log.info(\n `${messages.devrequests.install.download(\n moduleInfo.github,\n release.tag_name\n )}\\n${release.html_url}`\n );\n else\n log.warning(messages.devrequests.install.notFound(moduleInfo.github));\n\n // checkDir(this.exePath);\n const downloadSpecificRelease = version && release?.tag_name;\n\n // Should we download an update?\n if (\n (release?.tag_name &&\n ![moduleInfo.version, moduleInfo.install].includes(release.tag_name)) ||\n downloadSpecificRelease\n ) {\n // Download platform-specific release asset\n const downloadPath = path.join(\n this.basePath,\n `${this.name}-${release.tag_name}`\n );\n\n // add spinner while downloading\n const spinner = createSpinner(\n messages.devrequests.install.downloading(\n moduleInfo.github,\n release.tag_name\n )\n );\n if (verbose || debug) {\n spinner.start();\n }\n try {\n await github.DownloadRelease(release, {\n cmd,\n path: downloadPath,\n // Map NodeJS os platform to release asset name\n platforms: [\n ['win32', 'arm64', 'win-arm64'],\n ['win32', 'x64', 'win-x64'],\n ['darwin', 'arm64', 'osx-arm64'],\n ['darwin', 'x64', 'osx-x64'],\n ['linux', 'arm64', 'linux-arm64'],\n ['linux', 'x64', 'linux-x64'],\n ],\n });\n } catch (ex: any) {\n spinner.error();\n log.error(\n messages.devrequests.install.downloadFail(\n moduleInfo.github,\n release.tag_name\n ),\n ex\n );\n } finally {\n if (verbose || debug)\n spinner.success({\n text: messages.devrequests.install.downloaded(\n moduleInfo.github,\n release.tag_name\n ),\n });\n\n if (!version) {\n // Update module info with downloaded release\n this.moduleInfo.install = release.tag_name;\n // Write module info update to manifest so it installs on next invoke\n manifest.writeModule(this.name, this.moduleInfo);\n } else {\n // Set module version in memory so the request handler\n // will be invoked with this version this time only\n this.moduleInfo.version = release.tag_name;\n }\n }\n }\n }\n\n async ApplyUpdate() {\n const { manifest, messages, moduleInfo } = this;\n\n if (moduleInfo.install && moduleInfo.version !== moduleInfo.install) {\n const { apply } =\n moduleInfo.version === '*'\n ? { apply: true }\n : await inquirer.prompt({\n name: 'apply',\n type: 'confirm',\n message: messages.devrequests.install.applyUpdate(\n moduleInfo.install,\n moduleInfo.version\n ),\n default: 'Y',\n });\n\n if (apply) {\n moduleInfo.version = moduleInfo.install;\n delete moduleInfo.install;\n manifest.writeModule(this.name, this.moduleInfo);\n\n // TODO: clean up user folder by deleting old version(s)}\n }\n } else if (moduleInfo.version) {\n // Validate the installed version exists\n if (!pathExists(this.exePath)) {\n // If not, set the version to force re-download and recreate\n Logger.warning(messages.devrequests.missingBinary(moduleInfo.version));\n this.version = moduleInfo.version;\n await this.Create();\n }\n }\n }\n}\n\nexport const createRequestHandler = (version?: string) =>\n new RequestHandlerFactory(version).Create();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAsB;AACtB,sBAAqB;AACrB,yBAA8B;AAC9B,kBAAiB;AACjB,mBAA4B;AAC5B,qCAAoC;AAEpC,8BAA6B;AAC7B,2BAAiD;AACjD,mBAAwB;AACxB,oBAAuB;AAEhB,MAAM,sBAAsB;AAAA,EACjC,YAAQ,sBAAQ;AAAA,EAChB,MAAM;AAAA,EACN,WAAW;AAAA,EACX,WAAW,IAAI,wBAAAA,QAAiB;AAAA;AAAA,EAEhC,WAAW,YAAAC,QAAK,KAAK,+BAAU;AAAA,EAC/B,OAAO;AAAA,EACP,MAAM;AAAA,EAEN;AAAA,EACA;AAAA;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,YAAAA,QAAK,KAAK,KAAK,UAAU,GAAG,KAAK,IAAI,IAAI,KAAK,WAAW,OAAO,EAAE;AAAA,EAC3E;AAAA,EAEA,IAAI,aAAa;AACf,WACE,KAAK,SAAS,UAAU,KAAK,IAAI,KAAK;AAAA,MACpC,QAAQ;AAAA,MACR,SAAS;AAAA,IACX;AAAA,EAEJ;AAAA,EAEA,YAAY,SAAkB,aAA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K,UAAU;AAAA,MAGjD;AAAA,IACF,WAAW,WAAW,SAAS;AAE7B,UAAI,KAAC,iCAAW,KAAK,OAAO,GAAG;AAE7B,6BAAO,QAAQ,SAAS,YAAY,cAAc,WAAW,OAAO,CAAC;AACrE,aAAK,UAAU,WAAW;AAC1B,cAAM,KAAK,OAAO;AAAA,MACpB;AAAA,IACF;AAAA,EACF;AACF;AAEO,MAAM,uBAAuB,CAAC,YACnC,IAAI,sBAAsB,OAAO,EAAE,OAAO;",
|
|
6
6
|
"names": ["ManifestProvider", "path", "GitHubCliModuleProvider", "inquirer"]
|
|
7
7
|
}
|
|
@@ -411,10 +411,14 @@ ${import_logger.Logger.errorText(">>")} Available commands:`,
|
|
|
411
411
|
list: (env) => `[${env}] Webhook subscriptions:`,
|
|
412
412
|
noList: (env) => `[${env}] Cannot retrieve webhook subscriptions`,
|
|
413
413
|
noneExist: () => `No webhook subscriptions exist`,
|
|
414
|
+
imported: (env, commit, webhooks) => LogMessages.migrate.imported(env, commit, { webhook: webhooks }),
|
|
415
|
+
noChange: (env) => `[${env}] No changes to be made`,
|
|
414
416
|
created: (env, name) => `[${env}] Created Webhook subscription ${import_logger.Logger.highlightText(name)}`,
|
|
415
|
-
failedCreate: (env, name) => `[${env}] Unable to create
|
|
416
|
-
|
|
417
|
-
|
|
417
|
+
failedCreate: (env, name) => `[${env}] Unable to create ${name ? `webhook ${import_logger.Logger.highlightText(name)}` : "webhooks"}`,
|
|
418
|
+
// failedCreate: (env: string, name: string) =>
|
|
419
|
+
// `[${env}] Unable to create Webhook subscription ${Logger.highlightText(
|
|
420
|
+
// name
|
|
421
|
+
// )}`,
|
|
418
422
|
deleted: (env, id) => `[${env}] Deleted Webhook subscription ${import_logger.Logger.highlightText(id)}`,
|
|
419
423
|
failedDelete: (env, id) => `[${env}] Unable to delete Webhook subscription ${import_logger.Logger.highlightText(
|
|
420
424
|
id
|
|
@@ -538,11 +542,14 @@ ${git.type === "github" ? `Add a "New repository secret"` : `Expand "Variables"
|
|
|
538
542
|
launch: () => `Launching request handler for local development`,
|
|
539
543
|
overrideBlock: () => `Which block will you be running?`,
|
|
540
544
|
overrideUri: () => `How to access your development site`,
|
|
545
|
+
overrideBlocks: () => `Which blocks will you be overriding?`,
|
|
546
|
+
overrideBranch: (blockId) => `Which branch would you like ${blockId} to target?`,
|
|
541
547
|
spawn: () => `If you see a firewall popup requesting network access, it is safe to approve`,
|
|
542
548
|
exited: (code) => `Request handler exited with code ${code}
|
|
543
549
|
`,
|
|
544
550
|
errored: (error) => `Could not launch request handler due to error
|
|
545
|
-
${error}
|
|
551
|
+
${error}`,
|
|
552
|
+
missingBinary: (version) => `Could not locate request handler module ${version}, attempting to reinstall`
|
|
546
553
|
}
|
|
547
554
|
};
|
|
548
555
|
// Annotate the CommonJS export names for ESM import in node:
|