contensis-cli 1.1.1 → 1.1.2-beta.1

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.
Files changed (47) hide show
  1. package/dist/factories/RequestHandlerFactory.js +203 -0
  2. package/dist/factories/RequestHandlerFactory.js.map +7 -0
  3. package/dist/localisation/en-GB.js +28 -5
  4. package/dist/localisation/en-GB.js.map +2 -2
  5. package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js +119 -0
  6. package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js.map +7 -0
  7. package/dist/providers/GitHubCliModuleProvider.js +107 -0
  8. package/dist/providers/GitHubCliModuleProvider.js.map +7 -0
  9. package/dist/providers/HttpProvider.js +72 -0
  10. package/dist/providers/HttpProvider.js.map +7 -0
  11. package/dist/providers/ManifestProvider.js +53 -0
  12. package/dist/providers/ManifestProvider.js.map +7 -0
  13. package/dist/providers/file-provider.js +11 -0
  14. package/dist/providers/file-provider.js.map +2 -2
  15. package/dist/services/ContensisAuthService.js +19 -11
  16. package/dist/services/ContensisAuthService.js.map +2 -2
  17. package/dist/services/ContensisCliService.js +27 -14
  18. package/dist/services/ContensisCliService.js.map +2 -2
  19. package/dist/services/ContensisDevService.js +10 -59
  20. package/dist/services/ContensisDevService.js.map +3 -3
  21. package/dist/util/debug.js +29 -0
  22. package/dist/util/debug.js.map +7 -0
  23. package/dist/util/fetch.js +65 -0
  24. package/dist/util/fetch.js.map +7 -0
  25. package/dist/util/index.js.map +1 -1
  26. package/dist/util/logger.js.map +2 -2
  27. package/dist/version.js +1 -1
  28. package/dist/version.js.map +1 -1
  29. package/package.json +4 -1
  30. package/src/factories/RequestHandlerFactory.ts +225 -0
  31. package/src/localisation/en-GB.ts +54 -12
  32. package/src/mappers/DevRequests-to-RequestHanderCliArgs.ts +145 -0
  33. package/src/providers/GitHubCliModuleProvider.ts +114 -0
  34. package/src/providers/HttpProvider.ts +50 -0
  35. package/src/providers/ManifestProvider.ts +43 -0
  36. package/src/providers/file-provider.ts +9 -0
  37. package/src/services/ContensisAuthService.ts +23 -14
  38. package/src/services/ContensisCliService.ts +30 -15
  39. package/src/services/ContensisDevService.ts +19 -85
  40. package/src/util/debug.ts +1 -0
  41. package/src/util/fetch.ts +74 -0
  42. package/src/util/index.ts +1 -1
  43. package/src/util/logger.ts +0 -1
  44. package/src/version.ts +1 -1
  45. package/dist/mappers/DevRequests-to-RequestHanderSiteConfigYaml.js +0 -56
  46. package/dist/mappers/DevRequests-to-RequestHanderSiteConfigYaml.js.map +0 -7
  47. package/src/mappers/DevRequests-to-RequestHanderSiteConfigYaml.ts +0 -44
@@ -30,13 +30,12 @@ __export(ContensisDevService_exports, {
30
30
  module.exports = __toCommonJS(ContensisDevService_exports);
31
31
  var import_ansi_escapes = __toESM(require("ansi-escapes"));
32
32
  var import_await_to_js = __toESM(require("await-to-js"));
33
- var import_child_process = require("child_process");
34
33
  var import_inquirer = __toESM(require("inquirer"));
35
34
  var import_nanospinner = require("nanospinner");
36
- var import_path = __toESM(require("path"));
37
35
  var import_ContensisRoleService = __toESM(require("./ContensisRoleService"));
38
- var import_DevRequests_to_RequestHanderSiteConfigYaml = require("../mappers/DevRequests-to-RequestHanderSiteConfigYaml");
36
+ var import_RequestHandlerFactory = require("../factories/RequestHandlerFactory");
39
37
  var import_DevInit_to_CIWorkflow = require("../mappers/DevInit-to-CIWorkflow");
38
+ var import_DevRequests_to_RequestHanderCliArgs = require("../mappers/DevRequests-to-RequestHanderCliArgs");
40
39
  var import_DevInit_to_RolePermissions = require("../mappers/DevInit-to-RolePermissions");
41
40
  var import_file_provider = require("../providers/file-provider");
42
41
  var import_diff = require("../util/diff");
@@ -45,7 +44,6 @@ var import_find = require("../util/find");
45
44
  var import_git = require("../util/git");
46
45
  var import_json = require("../util/json.formatter");
47
46
  var import_os = require("../util/os");
48
- var import_yaml = require("../util/yaml");
49
47
  var import_gitignore = require("../util/gitignore");
50
48
  class ContensisDev extends import_ContensisRoleService.default {
51
49
  git;
@@ -346,61 +344,14 @@ ${mappedWorkflow.diff}`
346
344
  }
347
345
  }
348
346
  };
349
- ExecRequestHandler = async (blockIds, overrideArgs) => {
350
- var _a, _b;
351
- const { log } = this;
352
- const exeHome = import_path.default.join(import_file_provider.appRootDir, "reqhan");
353
- const exe = "Zengenti.Contensis.RequestHandler.LocalDevelopment";
354
- const exePath = import_path.default.join(exeHome, exe);
355
- const siteConfigPath = import_path.default.join(import_file_provider.appRootDir, "site_config.yaml");
356
- const siteConfig = await (0, import_DevRequests_to_RequestHanderSiteConfigYaml.mapSiteConfigYaml)(this);
357
- (0, import_file_provider.writeFile)("site_config.yaml", (0, import_yaml.stringifyYaml)(siteConfig));
358
- const args = overrideArgs ? typeof (overrideArgs == null ? void 0 : overrideArgs[0]) === "string" && overrideArgs[0].includes(" ", 2) ? overrideArgs[0].split(" ") : overrideArgs : [];
359
- if (!args.find((a) => a === "-c"))
360
- args.push("-c", siteConfigPath);
361
- const child = (0, import_child_process.spawn)(exePath, args, { stdio: "inherit" });
362
- log.info(`Launching request handler...`);
363
- if (overrideArgs == null ? void 0 : overrideArgs.length)
364
- this.log.warning(
365
- `Spawning process with supplied args: ${JSON.stringify(
366
- child.spawnargs,
367
- null,
368
- 2
369
- )}`
370
- );
371
- let isRunning = false;
372
- (_a = child == null ? void 0 : child.stdout) == null ? void 0 : _a.on("data", (data) => {
373
- isRunning = true;
374
- log.raw(data);
375
- });
376
- (_b = child == null ? void 0 : child.stderr) == null ? void 0 : _b.on("data", (data) => {
377
- log.error(data);
378
- });
379
- child.on("spawn", () => {
380
- isRunning = true;
381
- log.help(
382
- `You may see a firewall popup requesting network access, it is safe to approve`
383
- );
384
- });
385
- child.on("exit", (code) => {
386
- isRunning = false;
387
- log[code === 0 ? "success" : "warning"](
388
- `Request handler exited with code ${code}
389
- `
390
- );
391
- });
392
- child.on("error", (error) => {
393
- isRunning = false;
394
- log.error(`Could not launch request handler due to error
395
- ${error}`);
396
- });
397
- await new Promise((resolve) => setTimeout(resolve, 2e3));
398
- while (true) {
399
- if (!isRunning) {
400
- return;
401
- }
402
- await new Promise((resolve) => setTimeout(resolve, 1e3));
403
- }
347
+ ExecRequestHandler = async (blockIds, overrideArgs = []) => {
348
+ const { debug, log, messages } = this;
349
+ const spinner = !debug ? (0, import_nanospinner.createSpinner)(messages.devrequests.launch()) : log.info(messages.devrequests.launch());
350
+ const requestHandler = await (0, import_RequestHandlerFactory.createRequestHandler)();
351
+ spinner == null ? void 0 : spinner.start();
352
+ const args = await (0, import_DevRequests_to_RequestHanderCliArgs.requestHandlerCliArgs)(this, overrideArgs);
353
+ spinner == null ? void 0 : spinner.success();
354
+ await requestHandler(args);
404
355
  };
405
356
  }
406
357
  const devCommand = (commandArgs, outputOpts, contensisOpts = {}) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/services/ContensisDevService.ts"],
4
- "sourcesContent": ["import ansiEscapes from 'ansi-escapes';\nimport to from 'await-to-js';\nimport { spawn } from 'child_process';\nimport inquirer from 'inquirer';\nimport { createSpinner } from 'nanospinner';\nimport path from 'path';\n\nimport { Role } from 'contensis-management-api/lib/models';\nimport { MigrateRequest } from 'migratortron';\n\nimport ContensisRole from './ContensisRoleService';\nimport { OutputOptionsConstructorArg } from '~/models/CliService';\nimport { EnvContentsToAdd } from '~/models/DevService';\nimport { mapSiteConfigYaml } from '~/mappers/DevRequests-to-RequestHanderSiteConfigYaml';\nimport { mapCIWorkflowContent } from '~/mappers/DevInit-to-CIWorkflow';\nimport { deployKeyRole } from '~/mappers/DevInit-to-RolePermissions';\nimport { appRootDir, readFile, writeFile } from '~/providers/file-provider';\nimport { diffFileContent } from '~/util/diff';\nimport { mergeDotEnvFileContents } from '~/util/dotenv';\nimport { findByIdOrName } from '~/util/find';\nimport { GitHelper } from '~/util/git';\nimport { jsonFormatter } from '~/util/json.formatter';\nimport { winSlash } from '~/util/os';\nimport { stringifyYaml } from '~/util/yaml';\nimport { mergeContentsToAddWithGitignore } from '~/util/gitignore';\n\nclass ContensisDev extends ContensisRole {\n git!: GitHelper;\n blockId!: string;\n\n deployCredentials = {\n clientId: '',\n clientSecret: '',\n };\n\n constructor(\n args: string[],\n outputOpts?: OutputOptionsConstructorArg,\n contensisOpts: Partial<MigrateRequest> = {}\n ) {\n super(args, outputOpts, contensisOpts);\n }\n\n DevelopmentInit = async (projectHome: string, opts: any) => {\n // Retrieve git info\n const git = (this.git = new GitHelper(projectHome));\n // Check if we are in a git repo\n const isRepo = git.checkIsRepo();\n if (!isRepo) return;\n\n const { dryRun = false } = opts || {};\n const { currentEnv, currentProject, log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // First we need to get the block id from the user\n const validateBlockId = (blockId: string) => {\n const pattern = /^[0-9a-z](-?[0-9a-z])*$/;\n if (blockId.length >= 1 && blockId.length <= 225) {\n return pattern.test(blockId);\n } else return false;\n };\n let { blockId } = await inquirer.prompt({\n name: 'blockId',\n type: 'input',\n prefix: '\uD83E\uDDF1',\n message: messages.devinit.blockIdQuestion,\n validate: validateBlockId,\n default: git.name,\n });\n // make sure block id is lowercase\n this.blockId = blockId.toLowerCase();\n log.success(`Valid block id: ${blockId.toLowerCase()}`);\n\n // Retrieve keys list for env\n const [keysErr, apiKeys] = await contensis.apiKeys.GetKeys();\n if (keysErr) {\n log.error(messages.keys.noList(currentEnv));\n log.error(jsonFormatter(keysErr));\n return;\n }\n const apiKeyExists = (findKey: string) =>\n apiKeys?.find(\n k => k.name.trim().toLowerCase() === findKey?.trim().toLowerCase()\n );\n\n // Retrieve ci workflow info\n const workflowFiles = git.workflows;\n\n // Set variables for performing operations and logging etc.\n let ciFileName = git.ciFileName;\n\n const apiKeyName = `block-${currentProject}-${blockId}`.toLowerCase();\n\n const devKeyName = `${apiKeyName}`;\n const devKeyDescription = `Created by Contensis to allow API access from the running block`;\n let existingDevKey = apiKeyExists(devKeyName);\n\n const deployKeyName = `${apiKeyName}-ci`;\n const deployKeyDescription = `Created by the Contensis CLI for use in continuous integration`;\n\n let existingDeployKey = apiKeyExists(deployKeyName);\n\n // const blockId = git.name;\n const errors = [] as AppError[];\n\n // Start render console output\n log.raw('');\n log.success(messages.devinit.intro());\n log.raw(\n log.infoText(\n messages.devinit.projectDetails(\n git.name,\n currentEnv,\n currentProject,\n blockId,\n git\n )\n )\n );\n log.raw(\n log.infoText(\n messages.devinit.developmentKey(devKeyName, !!existingDevKey)\n )\n );\n log.raw(\n log.infoText(\n messages.devinit.deploymentKey(deployKeyName, !!existingDeployKey)\n )\n );\n log.raw('');\n\n if (Array.isArray(workflowFiles) && workflowFiles.length > 1) {\n // Choose GitHub workflow file (if multiple)\n ({ ciFileName } = await inquirer.prompt([\n {\n type: 'list',\n prefix: '\u29F0',\n message: messages.devinit.ciMultipleChoices(),\n name: 'ciFileName',\n choices: workflowFiles,\n default: workflowFiles.find(f => f.includes('docker')),\n },\n ]));\n log.raw('');\n git.ciFileName = ciFileName;\n }\n\n log.raw(log.infoText(messages.devinit.ciDetails(ciFileName)));\n\n // Location for Client ID / Secret.\n const { loc } = await inquirer.prompt({\n name: 'loc',\n type: 'list',\n prefix: '\uD83D\uDD11',\n // Where would you like to store your client id/secret?\n message: messages.devinit.clientDetailsLocation(),\n choices: [\n {\n name: messages.devinit.clientDetailsInGit(git),\n value: 'git',\n },\n {\n name: messages.devinit.clientDetailsInEnv(),\n value: 'env',\n },\n ],\n });\n\n log.raw('');\n log.help(messages.devinit.ciIntro(git, loc));\n\n if (!dryRun) {\n // Confirm prompt\n const { confirm } = await inquirer.prompt([\n {\n type: 'confirm',\n message: messages.devinit.confirm(),\n name: 'confirm',\n default: false,\n },\n ]);\n log.raw('');\n if (!confirm) return;\n }\n\n // Fetching access token\n let accessToken: string | undefined = undefined;\n\n const spinner = createSpinner(messages.devinit.accessTokenFetch());\n spinner.start();\n\n const token = await this.GetDeliveryApiKey();\n\n if (token) {\n accessToken = token;\n spinner.success({ text: messages.devinit.accessTokenSuccess(token) });\n log.raw('');\n } else {\n spinner.error();\n this.log.error(messages.devinit.accessTokenFailed());\n return;\n }\n\n // Magic happens...\n const checkpoint = (op: string) => {\n if (errors.length) throw errors[0];\n else log.debug(`${op} completed ok`);\n return true;\n };\n\n // Arrange API keys for development and deployment\n const [getRolesErr, roles] = await to(contensis.roles.GetRoles());\n if (!roles && getRolesErr) errors.push(getRolesErr);\n checkpoint(`fetched ${roles?.length} roles`);\n\n if (dryRun) {\n checkpoint(`skip api key creation (dry-run)`);\n } else {\n // if dev api key doesn't exist go and create it (we need this for local development, we will store these details in the .env file).\n const devKeyExisted = !!existingDevKey;\n if (!existingDevKey) {\n existingDevKey = await this.CreateOrUpdateApiKey(\n existingDevKey,\n devKeyName,\n devKeyDescription\n );\n log.success(messages.devinit.createDevKey(devKeyName, devKeyExisted));\n }\n // NF 24/11/23 Added this commented code back in as we are not assigning the dev key to any role here\n // // Ensure dev API key is assigned to a role\n // let existingDevRole = findByIdOrName(roles || [], devKeyName, true) as\n // | Role\n // | undefined;\n // existingDevRole = await this.CreateOrUpdateRole(\n // existingDevRole,\n // devKeyRole(devKeyName, devKeyDescription)\n // );\n // checkpoint('dev key role assigned');\n\n // if deploy api key doesn't exist go and create it (we need this for yml file).\n const deployKeyExisted = !!existingDeployKey;\n if (!existingDeployKey) {\n existingDeployKey = await this.CreateOrUpdateApiKey(\n existingDeployKey,\n deployKeyName,\n deployKeyDescription\n );\n }\n\n // check we have the deploy key so we can assign them to this values\n if (existingDeployKey) {\n // Add client id and secret to credentials\n this.deployCredentials.clientId = existingDeployKey?.id;\n this.deployCredentials.clientSecret = existingDeployKey?.sharedSecret;\n }\n\n // Ensure deploy API key is assigned to a role with the right permissions\n const deployRoleName = `Role for CI push of block '${blockId}'`;\n const deplyRoleDescription = `Created by the Contensis CLI for use in continuous integration`;\n let existingDeployRole = findByIdOrName(\n roles || [],\n deployRoleName,\n true\n ) as Role | undefined;\n existingDeployRole = await this.CreateOrUpdateRole(\n existingDeployRole,\n deployKeyRole(deployKeyName, deployRoleName, deplyRoleDescription)\n );\n\n checkpoint('deploy key role assigned');\n log.success(\n messages.devinit.createDeployKey(deployRoleName, deployKeyExisted)\n );\n checkpoint('api keys done');\n }\n\n const envFilePath = `${projectHome}/.env`;\n const existingEnvFile = readFile(envFilePath);\n let existingEnvFileArray = (existingEnvFile || '')\n .split('\\n')\n .filter(l => !!l);\n\n // Update or create a file called .env in project home\n const envContentsToAdd: EnvContentsToAdd = {\n ALIAS: currentEnv,\n PROJECT_API_ID: currentProject,\n BLOCK_ID: blockId,\n };\n if (accessToken) envContentsToAdd['ACCESS_TOKEN'] = accessToken;\n // add client id and secret to the env file\n if (loc === 'env') {\n envContentsToAdd['CONTENSIS_CLIENT_ID'] =\n existingDevKey?.id || messages.devinit.dryRunKeyMessage(dryRun);\n envContentsToAdd['CONTENSIS_CLIENT_SECRET'] =\n existingDevKey?.sharedSecret ||\n messages.devinit.dryRunKeyMessage(dryRun);\n }\n\n // if we have client id / secret in our env remove it\n const removeEnvItems = (items: string[]) => {\n const indexesToRemove = [];\n\n for (let i = 0; i < existingEnvFileArray.length; i++) {\n for (const item of items) {\n if (existingEnvFileArray[i].includes(item)) {\n indexesToRemove.push(i);\n break;\n }\n }\n }\n\n for (let i = indexesToRemove.length - 1; i >= 0; i--) {\n existingEnvFileArray.splice(indexesToRemove[i], 1);\n }\n };\n\n // remove client id and secret from env file\n if (loc === 'git') {\n removeEnvItems(['CONTENSIS_CLIENT_ID', 'CONTENSIS_CLIENT_SECRET']);\n }\n\n const envFileLines = mergeDotEnvFileContents(\n existingEnvFileArray,\n envContentsToAdd\n );\n const newEnvFileContent = envFileLines.join('\\n');\n const envDiff = diffFileContent(existingEnvFile || '', newEnvFileContent);\n\n if (dryRun) {\n if (envDiff) {\n log.info(`Updating .env file ${winSlash(envFilePath)}:\\n${envDiff}`);\n log.raw('');\n }\n checkpoint('skip .env file update (dry-run)');\n } else {\n if (envDiff) log.info(`Updating .env file ${winSlash(envFilePath)}`);\n writeFile(envFilePath, envFileLines.join('\\n'));\n checkpoint('.env file updated');\n log.success(messages.devinit.writeEnvFile());\n // log.help(messages.devinit.useEnvFileTip());\n }\n\n // Update git ignore\n if (dryRun) {\n checkpoint('skip .gitignore file update (dry-run)');\n } else {\n mergeContentsToAddWithGitignore(`${projectHome}/.gitignore`, ['.env']);\n log.raw('');\n }\n\n // Update CI Workflow\n const mappedWorkflow = await mapCIWorkflowContent(this, loc);\n\n // Update CI file -- different for GH/GL\n if (mappedWorkflow?.diff) {\n log.info(\n `Updating ${winSlash(ciFileName)} file:\\n${mappedWorkflow.diff}`\n );\n log.raw('');\n }\n if (dryRun) {\n checkpoint('skip CI file update (dry-run)');\n //log.object(ciFileLines);\n } else {\n if (mappedWorkflow?.newWorkflow) {\n if (mappedWorkflow?.diff) {\n writeFile(git.ciFilePath, mappedWorkflow.newWorkflow);\n log.success(messages.devinit.writeCiFile(`./${ciFileName}`));\n log.info(\n messages.devinit.ciBlockTip(blockId, currentEnv, currentProject)\n );\n } else {\n log.info(messages.devinit.ciFileNoChanges(`./${ciFileName}`));\n }\n log.raw('');\n checkpoint('CI file updated');\n }\n }\n\n if (loc === 'git') {\n // Echo Deployment API key to console, ask user to add secrets to repo\n log.warning(messages.devinit.addGitSecretsIntro());\n log.help(\n messages.devinit.addGitSecretsHelp(\n git,\n existingDeployKey?.id || messages.devinit.dryRunKeyMessage(dryRun),\n existingDeployKey?.sharedSecret ||\n messages.devinit.dryRunKeyMessage(dryRun)\n )\n );\n }\n\n if (dryRun) {\n log.success(messages.devinit.dryRun());\n log.help(messages.devinit.noChanges());\n } else {\n log.success(messages.devinit.success());\n log.help(messages.devinit.startProjectTip());\n // open the cms link -- if no classic token just return the cms url\n\n // go and fetch the classic token from auth service\n const classicToken = await this.auth?.ClassicToken();\n log.help(\n ansiEscapes.link(\n `Open Contensis`,\n `${this.urls?.cms}${\n classicToken ? `?SecurityToken=${classicToken}` : ''\n }`\n )\n );\n }\n }\n };\n\n ExecRequestHandler = async (blockIds: string[], overrideArgs?: string[]) => {\n // if no request handler exe\n // download it.\n\n // if update arg, redownload it\n\n const { log } = this;\n // const getPrefixOld = log.getPrefix;\n const exeHome = path.join(appRootDir, 'reqhan');\n const exe = 'Zengenti.Contensis.RequestHandler.LocalDevelopment';\n const exePath = path.join(exeHome, exe);\n const siteConfigPath = path.join(appRootDir, 'site_config.yaml');\n\n const siteConfig = await mapSiteConfigYaml(this);\n writeFile('site_config.yaml', stringifyYaml(siteConfig));\n\n const args = overrideArgs\n ? typeof overrideArgs?.[0] === 'string' &&\n overrideArgs[0].includes(' ', 2)\n ? overrideArgs[0].split(' ')\n : overrideArgs\n : []; // args could be [ '-c .\\\\site_config.yaml' ] or [ '-c', '.\\\\site_config.yaml' ]\n\n // Add required args\n if (!args.find(a => a === '-c')) args.push('-c', siteConfigPath);\n\n // const child = execFile(exePath, args);\n\n const child = spawn(exePath, args, { stdio: 'inherit' });\n\n // log.raw('');\n log.info(`Launching request handler...`);\n if (overrideArgs?.length)\n this.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(\n `You may see a firewall popup requesting network access, it is safe to approve`\n );\n // log.getPrefix = () => Logger.infoText(`[rqh]`);\n });\n\n child.on('exit', code => {\n isRunning = false;\n\n log[code === 0 ? 'success' : 'warning'](\n `Request handler exited with code ${code}\\n`\n );\n });\n\n child.on('error', error => {\n isRunning = false;\n log.error(`Could not launch request handler due to error \\n${error}`);\n });\n\n await new Promise(resolve => setTimeout(resolve, 2000));\n\n // keep the method running until we can return\n while (true === true) {\n if (!isRunning) {\n // log.getPrefix = getPrefixOld; // restore logger state\n return;\n }\n await new Promise(resolve => setTimeout(resolve, 1000));\n }\n };\n}\nexport const devCommand = (\n commandArgs: string[],\n outputOpts: OutputOptionsConstructorArg,\n contensisOpts: Partial<MigrateRequest> = {}\n) => {\n return new ContensisDev(['', '', ...commandArgs], outputOpts, contensisOpts);\n};\n\nexport default ContensisDev;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAwB;AACxB,yBAAe;AACf,2BAAsB;AACtB,sBAAqB;AACrB,yBAA8B;AAC9B,kBAAiB;AAKjB,kCAA0B;AAG1B,wDAAkC;AAClC,mCAAqC;AACrC,wCAA8B;AAC9B,2BAAgD;AAChD,kBAAgC;AAChC,oBAAwC;AACxC,kBAA+B;AAC/B,iBAA0B;AAC1B,kBAA8B;AAC9B,gBAAyB;AACzB,kBAA8B;AAC9B,uBAAgD;AAEhD,MAAM,qBAAqB,4BAAAA,QAAc;AAAA,EACvC;AAAA,EACA;AAAA,EAEA,oBAAoB;AAAA,IAClB,UAAU;AAAA,IACV,cAAc;AAAA,EAChB;AAAA,EAEA,YACE,MACA,YACA,gBAAyC,CAAC,GAC1C;AACA,UAAM,MAAM,YAAY,aAAa;AAAA,EACvC;AAAA,EAEA,kBAAkB,OAAO,aAAqB,SAAc;AA3C9D;AA6CI,UAAM,MAAO,KAAK,MAAM,IAAI,qBAAU,WAAW;AAEjD,UAAM,SAAS,IAAI,YAAY;AAC/B,QAAI,CAAC;AAAQ;AAEb,UAAM,EAAE,SAAS,MAAM,IAAI,QAAQ,CAAC;AACpC,UAAM,EAAE,YAAY,gBAAgB,KAAK,SAAS,IAAI;AACtD,UAAM,YAAY,MAAM,KAAK,iBAAiB;AAE9C,QAAI,WAAW;AAEb,YAAM,kBAAkB,CAACC,aAAoB;AAC3C,cAAM,UAAU;AAChB,YAAIA,SAAQ,UAAU,KAAKA,SAAQ,UAAU,KAAK;AAChD,iBAAO,QAAQ,KAAKA,QAAO;AAAA,QAC7B;AAAO,iBAAO;AAAA,MAChB;AACA,UAAI,EAAE,QAAQ,IAAI,MAA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8B;AACvC,QAAI,6CAAc;AAChB,WAAK,IAAI;AAAA,QACP,wCAAwC,KAAK;AAAA,UAC3C,MAAM;AAAA,UACN;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAEF,QAAI,YAAY;AAGhB,yCAAO,WAAP,mBAAe,GAAG,QAAQ,UAAQ;AAChC,kBAAY;AACZ,UAAI,IAAI,IAAI;AAAA,IACd;AAEA,yCAAO,WAAP,mBAAe,GAAG,QAAQ,UAAQ;AAChC,UAAI,MAAM,IAAI;AAAA,IAChB;AAEA,UAAM,GAAG,SAAS,MAAM;AACtB,kBAAY;AACZ,UAAI;AAAA,QACF;AAAA,MACF;AAAA,IAEF,CAAC;AAED,UAAM,GAAG,QAAQ,UAAQ;AACvB,kBAAY;AAEZ,UAAI,SAAS,IAAI,YAAY;AAAA,QAC3B,oCAAoC;AAAA;AAAA,MACtC;AAAA,IACF,CAAC;AAED,UAAM,GAAG,SAAS,WAAS;AACzB,kBAAY;AACZ,UAAI,MAAM;AAAA,EAAmD,OAAO;AAAA,IACtE,CAAC;AAED,UAAM,IAAI,QAAQ,aAAW,WAAW,SAAS,GAAI,CAAC;AAGtD,WAAO,MAAe;AACpB,UAAI,CAAC,WAAW;AAEd;AAAA,MACF;AACA,YAAM,IAAI,QAAQ,aAAW,WAAW,SAAS,GAAI,CAAC;AAAA,IACxD;AAAA,EACF;AACF;AACO,MAAM,aAAa,CACxB,aACA,YACA,gBAAyC,CAAC,MACvC;AACH,SAAO,IAAI,aAAa,CAAC,IAAI,IAAI,GAAG,WAAW,GAAG,YAAY,aAAa;AAC7E;AAEA,IAAO,8BAAQ;",
6
- "names": ["ContensisRole", "blockId", "inquirer", "to", "ansiEscapes", "path"]
4
+ "sourcesContent": ["import ansiEscapes from 'ansi-escapes';\nimport to from 'await-to-js';\nimport inquirer from 'inquirer';\nimport { createSpinner } from 'nanospinner';\n\nimport { Role } from 'contensis-management-api/lib/models';\nimport { MigrateRequest } from 'migratortron';\n\nimport ContensisRole from './ContensisRoleService';\nimport { createRequestHandler } from '~/factories/RequestHandlerFactory';\nimport { OutputOptionsConstructorArg } from '~/models/CliService';\nimport { EnvContentsToAdd } from '~/models/DevService';\nimport { mapCIWorkflowContent } from '~/mappers/DevInit-to-CIWorkflow';\nimport { requestHandlerCliArgs } from '~/mappers/DevRequests-to-RequestHanderCliArgs';\nimport { deployKeyRole } from '~/mappers/DevInit-to-RolePermissions';\nimport { readFile, writeFile } from '~/providers/file-provider';\nimport { diffFileContent } from '~/util/diff';\nimport { mergeDotEnvFileContents } from '~/util/dotenv';\nimport { findByIdOrName } from '~/util/find';\nimport { GitHelper } from '~/util/git';\nimport { jsonFormatter } from '~/util/json.formatter';\nimport { winSlash } from '~/util/os';\nimport { mergeContentsToAddWithGitignore } from '~/util/gitignore';\n\nclass ContensisDev extends ContensisRole {\n git!: GitHelper;\n blockId!: string;\n\n deployCredentials = {\n clientId: '',\n clientSecret: '',\n };\n\n constructor(\n args: string[],\n outputOpts?: OutputOptionsConstructorArg,\n contensisOpts: Partial<MigrateRequest> = {}\n ) {\n super(args, outputOpts, contensisOpts);\n }\n\n DevelopmentInit = async (projectHome: string, opts: any) => {\n // Retrieve git info\n const git = (this.git = new GitHelper(projectHome));\n // Check if we are in a git repo\n const isRepo = git.checkIsRepo();\n if (!isRepo) return;\n\n const { dryRun = false } = opts || {};\n const { currentEnv, currentProject, log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // First we need to get the block id from the user\n const validateBlockId = (blockId: string) => {\n const pattern = /^[0-9a-z](-?[0-9a-z])*$/;\n if (blockId.length >= 1 && blockId.length <= 225) {\n return pattern.test(blockId);\n } else return false;\n };\n let { blockId } = await inquirer.prompt({\n name: 'blockId',\n type: 'input',\n prefix: '\uD83E\uDDF1',\n message: messages.devinit.blockIdQuestion,\n validate: validateBlockId,\n default: git.name,\n });\n // make sure block id is lowercase\n this.blockId = blockId.toLowerCase();\n log.success(`Valid block id: ${blockId.toLowerCase()}`);\n\n // Retrieve keys list for env\n const [keysErr, apiKeys] = await contensis.apiKeys.GetKeys();\n if (keysErr) {\n log.error(messages.keys.noList(currentEnv));\n log.error(jsonFormatter(keysErr));\n return;\n }\n const apiKeyExists = (findKey: string) =>\n apiKeys?.find(\n k => k.name.trim().toLowerCase() === findKey?.trim().toLowerCase()\n );\n\n // Retrieve ci workflow info\n const workflowFiles = git.workflows;\n\n // Set variables for performing operations and logging etc.\n let ciFileName = git.ciFileName;\n\n const apiKeyName = `block-${currentProject}-${blockId}`.toLowerCase();\n\n const devKeyName = `${apiKeyName}`;\n const devKeyDescription = `Created by Contensis to allow API access from the running block`;\n let existingDevKey = apiKeyExists(devKeyName);\n\n const deployKeyName = `${apiKeyName}-ci`;\n const deployKeyDescription = `Created by the Contensis CLI for use in continuous integration`;\n\n let existingDeployKey = apiKeyExists(deployKeyName);\n\n // const blockId = git.name;\n const errors = [] as AppError[];\n\n // Start render console output\n log.raw('');\n log.success(messages.devinit.intro());\n log.raw(\n log.infoText(\n messages.devinit.projectDetails(\n git.name,\n currentEnv,\n currentProject,\n blockId,\n git\n )\n )\n );\n log.raw(\n log.infoText(\n messages.devinit.developmentKey(devKeyName, !!existingDevKey)\n )\n );\n log.raw(\n log.infoText(\n messages.devinit.deploymentKey(deployKeyName, !!existingDeployKey)\n )\n );\n log.raw('');\n\n if (Array.isArray(workflowFiles) && workflowFiles.length > 1) {\n // Choose GitHub workflow file (if multiple)\n ({ ciFileName } = await inquirer.prompt([\n {\n type: 'list',\n prefix: '\u29F0',\n message: messages.devinit.ciMultipleChoices(),\n name: 'ciFileName',\n choices: workflowFiles,\n default: workflowFiles.find(f => f.includes('docker')),\n },\n ]));\n log.raw('');\n git.ciFileName = ciFileName;\n }\n\n log.raw(log.infoText(messages.devinit.ciDetails(ciFileName)));\n\n // Location for Client ID / Secret.\n const { loc } = await inquirer.prompt({\n name: 'loc',\n type: 'list',\n prefix: '\uD83D\uDD11',\n // Where would you like to store your client id/secret?\n message: messages.devinit.clientDetailsLocation(),\n choices: [\n {\n name: messages.devinit.clientDetailsInGit(git),\n value: 'git',\n },\n {\n name: messages.devinit.clientDetailsInEnv(),\n value: 'env',\n },\n ],\n });\n\n log.raw('');\n log.help(messages.devinit.ciIntro(git, loc));\n\n if (!dryRun) {\n // Confirm prompt\n const { confirm } = await inquirer.prompt([\n {\n type: 'confirm',\n message: messages.devinit.confirm(),\n name: 'confirm',\n default: false,\n },\n ]);\n log.raw('');\n if (!confirm) return;\n }\n\n // Fetching access token\n let accessToken: string | undefined = undefined;\n\n const spinner = createSpinner(messages.devinit.accessTokenFetch());\n spinner.start();\n\n const token = await this.GetDeliveryApiKey();\n\n if (token) {\n accessToken = token;\n spinner.success({ text: messages.devinit.accessTokenSuccess(token) });\n log.raw('');\n } else {\n spinner.error();\n this.log.error(messages.devinit.accessTokenFailed());\n return;\n }\n\n // Magic happens...\n const checkpoint = (op: string) => {\n if (errors.length) throw errors[0];\n else log.debug(`${op} completed ok`);\n return true;\n };\n\n // Arrange API keys for development and deployment\n const [getRolesErr, roles] = await to(contensis.roles.GetRoles());\n if (!roles && getRolesErr) errors.push(getRolesErr);\n checkpoint(`fetched ${roles?.length} roles`);\n\n if (dryRun) {\n checkpoint(`skip api key creation (dry-run)`);\n } else {\n // if dev api key doesn't exist go and create it (we need this for local development, we will store these details in the .env file).\n const devKeyExisted = !!existingDevKey;\n if (!existingDevKey) {\n existingDevKey = await this.CreateOrUpdateApiKey(\n existingDevKey,\n devKeyName,\n devKeyDescription\n );\n log.success(messages.devinit.createDevKey(devKeyName, devKeyExisted));\n }\n // NF 24/11/23 Added this commented code back in as we are not assigning the dev key to any role here\n // // Ensure dev API key is assigned to a role\n // let existingDevRole = findByIdOrName(roles || [], devKeyName, true) as\n // | Role\n // | undefined;\n // existingDevRole = await this.CreateOrUpdateRole(\n // existingDevRole,\n // devKeyRole(devKeyName, devKeyDescription)\n // );\n // checkpoint('dev key role assigned');\n\n // if deploy api key doesn't exist go and create it (we need this for yml file).\n const deployKeyExisted = !!existingDeployKey;\n if (!existingDeployKey) {\n existingDeployKey = await this.CreateOrUpdateApiKey(\n existingDeployKey,\n deployKeyName,\n deployKeyDescription\n );\n }\n\n // check we have the deploy key so we can assign them to this values\n if (existingDeployKey) {\n // Add client id and secret to credentials\n this.deployCredentials.clientId = existingDeployKey?.id;\n this.deployCredentials.clientSecret = existingDeployKey?.sharedSecret;\n }\n\n // Ensure deploy API key is assigned to a role with the right permissions\n const deployRoleName = `Role for CI push of block '${blockId}'`;\n const deplyRoleDescription = `Created by the Contensis CLI for use in continuous integration`;\n let existingDeployRole = findByIdOrName(\n roles || [],\n deployRoleName,\n true\n ) as Role | undefined;\n existingDeployRole = await this.CreateOrUpdateRole(\n existingDeployRole,\n deployKeyRole(deployKeyName, deployRoleName, deplyRoleDescription)\n );\n\n checkpoint('deploy key role assigned');\n log.success(\n messages.devinit.createDeployKey(deployRoleName, deployKeyExisted)\n );\n checkpoint('api keys done');\n }\n\n const envFilePath = `${projectHome}/.env`;\n const existingEnvFile = readFile(envFilePath);\n let existingEnvFileArray = (existingEnvFile || '')\n .split('\\n')\n .filter(l => !!l);\n\n // Update or create a file called .env in project home\n const envContentsToAdd: EnvContentsToAdd = {\n ALIAS: currentEnv,\n PROJECT_API_ID: currentProject,\n BLOCK_ID: blockId,\n };\n if (accessToken) envContentsToAdd['ACCESS_TOKEN'] = accessToken;\n // add client id and secret to the env file\n if (loc === 'env') {\n envContentsToAdd['CONTENSIS_CLIENT_ID'] =\n existingDevKey?.id || messages.devinit.dryRunKeyMessage(dryRun);\n envContentsToAdd['CONTENSIS_CLIENT_SECRET'] =\n existingDevKey?.sharedSecret ||\n messages.devinit.dryRunKeyMessage(dryRun);\n }\n\n // if we have client id / secret in our env remove it\n const removeEnvItems = (items: string[]) => {\n const indexesToRemove = [];\n\n for (let i = 0; i < existingEnvFileArray.length; i++) {\n for (const item of items) {\n if (existingEnvFileArray[i].includes(item)) {\n indexesToRemove.push(i);\n break;\n }\n }\n }\n\n for (let i = indexesToRemove.length - 1; i >= 0; i--) {\n existingEnvFileArray.splice(indexesToRemove[i], 1);\n }\n };\n\n // remove client id and secret from env file\n if (loc === 'git') {\n removeEnvItems(['CONTENSIS_CLIENT_ID', 'CONTENSIS_CLIENT_SECRET']);\n }\n\n const envFileLines = mergeDotEnvFileContents(\n existingEnvFileArray,\n envContentsToAdd\n );\n const newEnvFileContent = envFileLines.join('\\n');\n const envDiff = diffFileContent(existingEnvFile || '', newEnvFileContent);\n\n if (dryRun) {\n if (envDiff) {\n log.info(`Updating .env file ${winSlash(envFilePath)}:\\n${envDiff}`);\n log.raw('');\n }\n checkpoint('skip .env file update (dry-run)');\n } else {\n if (envDiff) log.info(`Updating .env file ${winSlash(envFilePath)}`);\n writeFile(envFilePath, envFileLines.join('\\n'));\n checkpoint('.env file updated');\n log.success(messages.devinit.writeEnvFile());\n // log.help(messages.devinit.useEnvFileTip());\n }\n\n // Update git ignore\n if (dryRun) {\n checkpoint('skip .gitignore file update (dry-run)');\n } else {\n mergeContentsToAddWithGitignore(`${projectHome}/.gitignore`, ['.env']);\n log.raw('');\n }\n\n // Update CI Workflow\n const mappedWorkflow = await mapCIWorkflowContent(this, loc);\n\n // Update CI file -- different for GH/GL\n if (mappedWorkflow?.diff) {\n log.info(\n `Updating ${winSlash(ciFileName)} file:\\n${mappedWorkflow.diff}`\n );\n log.raw('');\n }\n if (dryRun) {\n checkpoint('skip CI file update (dry-run)');\n //log.object(ciFileLines);\n } else {\n if (mappedWorkflow?.newWorkflow) {\n if (mappedWorkflow?.diff) {\n writeFile(git.ciFilePath, mappedWorkflow.newWorkflow);\n log.success(messages.devinit.writeCiFile(`./${ciFileName}`));\n log.info(\n messages.devinit.ciBlockTip(blockId, currentEnv, currentProject)\n );\n } else {\n log.info(messages.devinit.ciFileNoChanges(`./${ciFileName}`));\n }\n log.raw('');\n checkpoint('CI file updated');\n }\n }\n\n if (loc === 'git') {\n // Echo Deployment API key to console, ask user to add secrets to repo\n log.warning(messages.devinit.addGitSecretsIntro());\n log.help(\n messages.devinit.addGitSecretsHelp(\n git,\n existingDeployKey?.id || messages.devinit.dryRunKeyMessage(dryRun),\n existingDeployKey?.sharedSecret ||\n messages.devinit.dryRunKeyMessage(dryRun)\n )\n );\n }\n\n if (dryRun) {\n log.success(messages.devinit.dryRun());\n log.help(messages.devinit.noChanges());\n } else {\n log.success(messages.devinit.success());\n log.help(messages.devinit.startProjectTip());\n // open the cms link -- if no classic token just return the cms url\n\n // go and fetch the classic token from auth service\n const classicToken = await this.auth?.ClassicToken();\n log.help(\n ansiEscapes.link(\n `Open Contensis`,\n `${this.urls?.cms}${\n classicToken ? `?SecurityToken=${classicToken}` : ''\n }`\n )\n );\n }\n }\n };\n\n ExecRequestHandler = async (\n blockIds: string[],\n overrideArgs: string[] = []\n ) => {\n const { debug, log, messages } = this;\n\n const spinner = !debug\n ? createSpinner(messages.devrequests.launch())\n : log.info(messages.devrequests.launch());\n\n // Ensure request handler is available to use\n const requestHandler = await createRequestHandler();\n\n // Generate args for request handler using CLI methods\n spinner?.start();\n const args = await requestHandlerCliArgs(this, overrideArgs);\n spinner?.success();\n\n // Launch request handler\n await requestHandler(args);\n };\n}\nexport const devCommand = (\n commandArgs: string[],\n outputOpts: OutputOptionsConstructorArg,\n contensisOpts: Partial<MigrateRequest> = {}\n) => {\n return new ContensisDev(['', '', ...commandArgs], outputOpts, contensisOpts);\n};\n\nexport default ContensisDev;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAwB;AACxB,yBAAe;AACf,sBAAqB;AACrB,yBAA8B;AAK9B,kCAA0B;AAC1B,mCAAqC;AAGrC,mCAAqC;AACrC,iDAAsC;AACtC,wCAA8B;AAC9B,2BAAoC;AACpC,kBAAgC;AAChC,oBAAwC;AACxC,kBAA+B;AAC/B,iBAA0B;AAC1B,kBAA8B;AAC9B,gBAAyB;AACzB,uBAAgD;AAEhD,MAAM,qBAAqB,4BAA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AAe,kBAAkB,iBAAiB;AAAA,UAEtD;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,qBAAqB,OACnB,UACA,eAAyB,CAAC,MACvB;AACH,UAAM,EAAE,OAAO,KAAK,SAAS,IAAI;AAEjC,UAAM,UAAU,CAAC,YACb,kCAAc,SAAS,YAAY,OAAO,CAAC,IAC3C,IAAI,KAAK,SAAS,YAAY,OAAO,CAAC;AAG1C,UAAM,iBAAiB,UAAM,mDAAqB;AAGlD,uCAAS;AACT,UAAM,OAAO,UAAM,kEAAsB,MAAM,YAAY;AAC3D,uCAAS;AAGT,UAAM,eAAe,IAAI;AAAA,EAC3B;AACF;AACO,MAAM,aAAa,CACxB,aACA,YACA,gBAAyC,CAAC,MACvC;AACH,SAAO,IAAI,aAAa,CAAC,IAAI,IAAI,GAAG,WAAW,GAAG,YAAY,aAAa;AAC7E;AAEA,IAAO,8BAAQ;",
6
+ "names": ["ContensisRole", "blockId", "inquirer", "to", "ansiEscapes"]
7
7
  }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var debug_exports = {};
20
+ __export(debug_exports, {
21
+ isDebug: () => isDebug
22
+ });
23
+ module.exports = __toCommonJS(debug_exports);
24
+ const isDebug = () => ["true", "1"].includes(process.env.debug || "");
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ isDebug
28
+ });
29
+ //# sourceMappingURL=debug.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/util/debug.ts"],
4
+ "sourcesContent": ["export const isDebug = () => ['true', '1'].includes(process.env.debug || '');\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,UAAU,MAAM,CAAC,QAAQ,GAAG,EAAE,SAAS,QAAQ,IAAI,SAAS,EAAE;",
6
+ "names": []
7
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var fetch_exports = {};
20
+ __export(fetch_exports, {
21
+ doRetry: () => doRetry,
22
+ enhancedFetch: () => enhancedFetch
23
+ });
24
+ module.exports = __toCommonJS(fetch_exports);
25
+ var import_enterprise_fetch = require("enterprise-fetch");
26
+ var import_logger = require("./logger");
27
+ const retryPolicy = {
28
+ retries: 2,
29
+ minTimeout: 400,
30
+ factor: 2
31
+ };
32
+ const applyTimeout = (s) => process.env.NODE_ENV === "test" ? 2 * 1e3 : s * 1e3;
33
+ const doRetry = ({ silent = false } = {}) => {
34
+ const fn = async (attempt, res, { url, options } = { url: "", options: {} }) => {
35
+ const { retry = retryPolicy } = options || {};
36
+ let shouldRetry = false;
37
+ if (!res.status || res.status >= 400 && ![400, 404, 409, 422, 500].includes(res.status)) {
38
+ if (!("message" in res) || "message" in res && !res.message.includes("Nock: No match"))
39
+ shouldRetry = true;
40
+ }
41
+ if (attempt <= retry.retries) {
42
+ const errorMessage = !res.status ? `${"name" in res && res.name || "type" in res && res.type}: ${"message" in res && res.message}` : `${res.status}: ${res.statusText}`;
43
+ if (!silent)
44
+ import_logger.Logger.warning(
45
+ `[fetch] ${shouldRetry ? `attempt ${attempt}/${retry.retries}` : "non-retriable"} ${errorMessage} ${url || ""}`
46
+ );
47
+ } else {
48
+ shouldRetry = false;
49
+ }
50
+ return await Promise.resolve(shouldRetry);
51
+ };
52
+ return fn;
53
+ };
54
+ const fetchDefaults = {
55
+ timeout: applyTimeout(60),
56
+ retry: retryPolicy,
57
+ doRetry: doRetry()
58
+ };
59
+ const enhancedFetch = (0, import_enterprise_fetch.fetchWithDefaults)(fetchDefaults);
60
+ // Annotate the CommonJS export names for ESM import in node:
61
+ 0 && (module.exports = {
62
+ doRetry,
63
+ enhancedFetch
64
+ });
65
+ //# sourceMappingURL=fetch.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/util/fetch.ts"],
4
+ "sourcesContent": ["import { DoRetry, FetchInit, fetchWithDefaults } from 'enterprise-fetch';\nimport { Logger } from './logger';\n\nconst retryPolicy = {\n retries: 2,\n minTimeout: 400,\n factor: 2,\n};\n\nconst applyTimeout = (s: number) =>\n process.env.NODE_ENV === 'test' ? 2 * 1000 : s * 1000;\n\nexport const doRetry = ({ silent = false } = {}) => {\n const fn: DoRetry = async (\n attempt: number,\n res: Response | AppError,\n { url, options } = { url: '', options: {} }\n ) => {\n // Get the retry policy from options or fetchDefaults\n const { retry = retryPolicy } = options || ({} as any);\n let shouldRetry = false;\n\n // Retry request on any network error, or 4xx or 5xx status codes\n if (\n !res.status ||\n (res.status >= 400 && ![400, 404, 409, 422, 500].includes(res.status))\n )\n if (\n !('message' in res) ||\n ('message' in res &&\n !(res.message as string).includes('Nock: No match'))\n )\n shouldRetry = true;\n\n if (attempt <= retry.retries) {\n // If a res has a status it is a HTTP error\n // With no status it could be a fetch error or app error\n const errorMessage = !res.status\n ? `${('name' in res && res.name) || ('type' in res && res.type)}: ${\n 'message' in res && res.message\n }`\n : `${res.status}: ${res.statusText}`;\n\n if (!silent)\n Logger.warning(\n `[fetch] ${\n shouldRetry\n ? `attempt ${attempt}/${retry.retries}`\n : 'non-retriable'\n } ${errorMessage} ${url || ''}`\n );\n } else {\n shouldRetry = false;\n }\n return await Promise.resolve(shouldRetry);\n };\n return fn;\n};\n\nconst fetchDefaults = {\n // The timeout to apply to requests that do not supply a timeout option\n timeout: applyTimeout(60),\n // Retry policy for all fetch requests\n retry: retryPolicy,\n // Do retry function to examine failures and apply custom retry logic\n // return true to retry the fetch call\n doRetry: doRetry(),\n} as FetchInit;\n\nexport const enhancedFetch = fetchWithDefaults(fetchDefaults);\n// export const assetFetch = fetchWithDefaults({\n// ...fetchDefaults,\n// timeout: applyTimeout(1200),\n// });\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAsD;AACtD,oBAAuB;AAEvB,MAAM,cAAc;AAAA,EAClB,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,QAAQ;AACV;AAEA,MAAM,eAAe,CAAC,MACpB,QAAQ,IAAI,aAAa,SAAS,IAAI,MAAO,IAAI;AAE5C,MAAM,UAAU,CAAC,EAAE,SAAS,MAAM,IAAI,CAAC,MAAM;AAClD,QAAM,KAAc,OAClB,SACA,KACA,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,IAAI,SAAS,CAAC,EAAE,MACvC;AAEH,UAAM,EAAE,QAAQ,YAAY,IAAI,WAAY,CAAC;AAC7C,QAAI,cAAc;AAGlB,QACE,CAAC,IAAI,UACJ,IAAI,UAAU,OAAO,CAAC,CAAC,KAAK,KAAK,KAAK,KAAK,GAAG,EAAE,SAAS,IAAI,MAAM;AAEpE,UACE,EAAE,aAAa,QACd,aAAa,OACZ,CAAE,IAAI,QAAmB,SAAS,gBAAgB;AAEpD,sBAAc;AAAA;AAElB,QAAI,WAAW,MAAM,SAAS;AAG5B,YAAM,eAAe,CAAC,IAAI,SACtB,GAAI,UAAU,OAAO,IAAI,QAAU,UAAU,OAAO,IAAI,SACtD,aAAa,OAAO,IAAI,YAE1B,GAAG,IAAI,WAAW,IAAI;AAE1B,UAAI,CAAC;AACH,6BAAO;AAAA,UACL,WACE,cACI,WAAW,WAAW,MAAM,YAC5B,mBACF,gBAAgB,OAAO;AAAA,QAC7B;AAAA,IACJ,OAAO;AACL,oBAAc;AAAA,IAChB;AACA,WAAO,MAAM,QAAQ,QAAQ,WAAW;AAAA,EAC1C;AACA,SAAO;AACT;AAEA,MAAM,gBAAgB;AAAA,EAEpB,SAAS,aAAa,EAAE;AAAA,EAExB,OAAO;AAAA,EAGP,SAAS,QAAQ;AACnB;AAEO,MAAM,oBAAgB,2CAAkB,aAAa;",
6
+ "names": []
7
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/util/index.ts"],
4
- "sourcesContent": ["import mergeWith from 'lodash/mergeWith';\nimport { Logger } from './logger';\nimport { LogMessages as enGB } from '../localisation/en-GB.js';\n\nexport const isSharedSecret = (str = '') =>\n str.length > 80 && str.split('-').length === 3 ? str : undefined;\n\nexport const isPassword = (str = '') =>\n !isSharedSecret(str) ? str : undefined;\n\nexport const tryParse = (str: any) => {\n try {\n return typeof str === 'object' ? str : JSON.parse(str);\n } catch (e) {\n return false;\n }\n};\n\nexport const isJson = (str: string) =>\n typeof str === 'object' || !!tryParse(str);\n\nexport const tryStringify = (obj: any) => {\n try {\n return typeof obj === 'object' ? JSON.stringify(obj) : obj;\n } catch (e) {\n return obj;\n }\n};\n\nexport const isSysError = (error: any): error is Error =>\n error?.message !== undefined && error.stack;\n\nexport const isUuid = (str: string) => {\n // Regular expression to check if string is a valid UUID\n const regexExp =\n /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/gi;\n\n return regexExp.test(str);\n};\n\nexport const url = (alias: string, project: string) => {\n const projectAndAlias =\n project && project.toLowerCase() !== 'website'\n ? `${project.toLowerCase()}-${alias}`\n : alias;\n return {\n api: `https://api-${alias}.cloud.contensis.com`,\n cms: `https://cms-${alias}.cloud.contensis.com`,\n liveWeb: `https://live-${projectAndAlias}.cloud.contensis.com`,\n previewWeb: `https://preview-${projectAndAlias}.cloud.contensis.com`,\n iisWeb: `https://iis-live-${projectAndAlias}.cloud.contensis.com`,\n iisPreviewWeb: `https://iis-preview-${projectAndAlias}.cloud.contensis.com`,\n };\n};\n\nexport const Logging = async (language = 'en-GB') => {\n const defaultMessages = enGB;\n // const { LogMessages: defaultMessages } = await import(\n // `../localisation/en-GB.js`\n // );\n let localisedMessages = defaultMessages;\n\n if (language === 'en-GB') {\n // Using a variable import e.g. `import(`../localisation/${language}.js`);`\n // does not play well with packaged executables\n // So we have to hard code the import for each language individually\n }\n return {\n messages: mergeWith(\n localisedMessages,\n defaultMessages,\n (v, s) => v || s\n ) as typeof defaultMessages,\n Log: Logger,\n };\n};\n"],
4
+ "sourcesContent": ["import mergeWith from 'lodash/mergeWith';\nimport { Logger } from './logger';\nimport { LogMessages as enGB } from '../localisation/en-GB.js';\n\nexport const isSharedSecret = (str = '') =>\n str.length > 80 && str.split('-').length === 3 ? str : undefined;\n\nexport const isPassword = (str = '') =>\n !isSharedSecret(str) ? str : undefined;\n\nexport const tryParse = (str: any) => {\n try {\n return typeof str === 'object' ? str : JSON.parse(str);\n } catch (e) {\n return false;\n }\n};\n\nexport const isJson = (str?: string) =>\n typeof str === 'object' || !!tryParse(str);\n\nexport const tryStringify = (obj: any) => {\n try {\n return typeof obj === 'object' ? JSON.stringify(obj) : obj;\n } catch (e) {\n return obj;\n }\n};\n\nexport const isSysError = (error: any): error is Error =>\n error?.message !== undefined && error.stack;\n\nexport const isUuid = (str: string) => {\n // Regular expression to check if string is a valid UUID\n const regexExp =\n /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/gi;\n\n return regexExp.test(str);\n};\n\nexport const url = (alias: string, project: string) => {\n const projectAndAlias =\n project && project.toLowerCase() !== 'website'\n ? `${project.toLowerCase()}-${alias}`\n : alias;\n return {\n api: `https://api-${alias}.cloud.contensis.com`,\n cms: `https://cms-${alias}.cloud.contensis.com`,\n liveWeb: `https://live-${projectAndAlias}.cloud.contensis.com`,\n previewWeb: `https://preview-${projectAndAlias}.cloud.contensis.com`,\n iisWeb: `https://iis-live-${projectAndAlias}.cloud.contensis.com`,\n iisPreviewWeb: `https://iis-preview-${projectAndAlias}.cloud.contensis.com`,\n };\n};\n\nexport const Logging = async (language = 'en-GB') => {\n const defaultMessages = enGB;\n // const { LogMessages: defaultMessages } = await import(\n // `../localisation/en-GB.js`\n // );\n let localisedMessages = defaultMessages;\n\n if (language === 'en-GB') {\n // Using a variable import e.g. `import(`../localisation/${language}.js`);`\n // does not play well with packaged executables\n // So we have to hard code the import for each language individually\n }\n return {\n messages: mergeWith(\n localisedMessages,\n defaultMessages,\n (v, s) => v || s\n ) as typeof defaultMessages,\n Log: Logger,\n };\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB;AACtB,oBAAuB;AACvB,mBAAoC;AAE7B,MAAM,iBAAiB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names": ["enGB", "mergeWith"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/util/logger.ts"],
4
- "sourcesContent": ["/* eslint-disable no-console */\nimport chalk from 'chalk';\nimport dateFormat from 'dateformat';\nimport deepCleaner from 'deep-cleaner';\nimport {\n ansiEscapeCodes,\n first,\n partition,\n strlen,\n} from 'printable-characters';\n// import ProgressBar from 'progress';\nimport { isSysError, tryStringify } from '.';\n\ntype LogMethod = (content: string) => void;\ntype LogErrorMethod = (content: string, err?: any, newline?: string) => void;\ntype LogJsonMethod = (content: any, depth?: number, indent?: string) => void;\ntype LogJsonDepthMethod = (content: any, depth?: number) => void;\ntype LogArrayMethod = (contentArray: string[]) => void;\ntype LogErrorFunc = (\n err: any,\n msg?: string,\n level?: 'error' | 'critical'\n) => void;\n\nexport class Logger {\n static isUserTerminal = !!process.stdout.columns;\n static getPrefix = () => {\n return Logger.isUserTerminal\n ? Logger.infoText(`[cli]`)\n : `[${dateFormat(new Date(), 'dd/mm HH:MM:ss')}]`;\n };\n static errorText = chalk.bold.red;\n static warningText = chalk.keyword('orange');\n static successText = chalk.keyword('green');\n static helpText = chalk.blue;\n static highlightText = chalk.yellow;\n static infoText = chalk.keyword('grey');\n static standardText = chalk.keyword('white');\n static boldText = chalk.bold;\n static critical: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.errorText(\n '[CRITICAL]'\n )} ${content}`;\n console.log(message);\n };\n static error: LogErrorMethod = (content, err, newline = '\\n') => {\n const message = `${Logger.getPrefix()} ${Logger.errorText(\n `${Logger.isUserTerminal ? '\u274C' : '[ERROR]'} ${content}${\n err\n ? `\\n\\n${Logger.infoText(\n isSysError(err) ? err.toString() : JSON.stringify(err, null, 2)\n )}`\n : ''\n }`\n )}${newline}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static warning: LogMethod = content => {\n // if (process.env.DEBUG === 'true') {\n const message = `${Logger.getPrefix()} ${Logger.warningText(\n `${Logger.isUserTerminal ? '\u26A0\uFE0F ' : '[WARN]'} ${content}`\n )}\\n`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n // }\n };\n static success: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.successText(\n `${Logger.isUserTerminal ? '\u2705' : '[OK]'} ${content}`\n )}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static info: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? chalk.bgCyan(' \u2139 ') : '[INFO]'\n } ${Logger.infoText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static help: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${chalk.blue(\n `${Logger.isUserTerminal ? '\u23E9' : '[HELP]'} ${content}`\n )}\\n`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static standard: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? '\u25FB\uFE0F' : '[STD]'\n } \\n${Logger.standardText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n progress.current.interrupt(message);\n };\n static debug: LogMethod = content => {\n if (['true', '1'].includes(process.env.debug || '')) {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? chalk.bgGrey(' \u2699 ') : '[DEBUG]'\n } ${Logger.infoText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n }\n };\n static json: LogJsonDepthMethod = (content, depth = 9) =>\n console.dir(deepCleaner(content), { colors: true, depth });\n static mixed: LogArrayMethod = contentArray =>\n console.log(`${Logger.getPrefix()} ${contentArray.join(' ')}`);\n static line = () =>\n Logger.raw(` ${Logger.infoText(`-------------------------------------`)}`);\n\n static object: LogJsonMethod = content => {\n for (const [key, value] of Object.entries(content || {})) {\n if (value && typeof value === 'object') {\n Logger.raw(` ${chalk.bold.grey(key)}:`);\n if (key === 'fields' && Array.isArray(value)) {\n for (const field of value || []) {\n Logger.raw(\n ` ${chalk.bold(field.id)}${\n field.id === content.entryTitleField\n ? '**'\n : field.validations.minCount?.value ||\n typeof field.validations.required?.message !== 'undefined'\n ? '*'\n : ''\n }: ${chalk.grey(\n `${field.dataType}${\n field.dataFormat\n ? `<${\n Array.isArray(\n field.validations.allowedFieldTypes?.fields\n )\n ? `composer[${field.validations.allowedFieldTypes.fields\n .map((f: any) => f.id)\n .join(' | ')}]`\n : field.dataFormat\n }${\n field.dataFormat === 'entry'\n ? `, ${field.validations.allowedContentTypes.contentTypes.join(\n ' | '\n )}`\n : ''\n }>`\n : ''\n }${\n field.validations.maxLength?.value\n ? `(${field.validations.maxLength.value})`\n : ''\n }`\n )}`\n );\n }\n } else if (key === 'groups' && Array.isArray(value)) {\n for (const group of value || []) {\n const description =\n Object.keys(group.description).length &&\n Object.values(group.description)?.[0];\n Logger.raw(\n ` ${chalk.bold(group.id)}${\n description\n ? `: ${chalk.grey(Object.values(group.description)?.[0])}`\n : ''\n }`\n );\n }\n } else {\n Logger.objectRecurse(value, 3, ' ');\n // for (const [innerkey, innervalue] of Object.entries(value)) {\n // if (innervalue && typeof innervalue === 'object') {\n // Logger.raw(` ${chalk.bold.grey(innerkey)}:`);\n // console.table(innervalue);\n // } else if (\n // typeof innervalue !== 'undefined' &&\n // innervalue !== null\n // ) {\n // Logger.raw(` ${chalk.bold.grey(innerkey)}: ${innervalue}`);\n // }\n // }\n }\n } else if (typeof value !== 'undefined' && value !== null) {\n const valueText =\n key === 'id' && typeof value === 'string'\n ? Logger.highlightText(value)\n : value;\n Logger.raw(` ${chalk.bold.grey(key)}: ${valueText}`);\n }\n }\n };\n\n static objectRecurse: LogJsonMethod = (content, depth = 3, indent = '') => {\n if (Array.isArray(content)) {\n for (const item of content) {\n if (item && typeof item === 'object') {\n if (Array.isArray(item) && depth > 3)\n Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));\n else Logger.objectRecurse(item, depth + 1, `${indent} `);\n } else Logger.raw(`${indent}${item}`);\n }\n } else {\n let pos = 0;\n for (const [key, value] of Object.entries(content)) {\n const thisIndent =\n pos === 0 ? `${indent.substring(0, indent.length - 2)}- ` : indent;\n if (Array.isArray(value)) {\n if (value.length) Logger.raw(`${thisIndent}${chalk.bold.grey(key)}:`);\n for (const item of value) {\n if (item && typeof item === 'object') {\n if (Array.isArray(item) && depth > 3)\n Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));\n else Logger.objectRecurse(item, depth + 1, `${indent} `);\n } else {\n Logger.raw(`${indent} ${item}`);\n }\n }\n } else if (value && typeof value === 'object') {\n Logger.raw(`${indent}${chalk.bold.grey(key)}:`);\n\n Logger.objectRecurse(value, depth + 1, `${indent} `);\n // console.table(value);\n } else if (typeof value !== 'undefined' && value !== null) {\n Logger.raw(`${thisIndent}${chalk.bold.grey(key)}: ${value}`);\n }\n pos++;\n }\n }\n };\n static raw: LogMethod = (content: string) => {\n if (progress.active) progress.current.interrupt(content);\n else console.log(content);\n };\n\n static limits = (\n content: string,\n displayLength = 30,\n consoleWidth = process.stdout.columns,\n logMethod: Function = console.info\n ) => {\n if (consoleWidth) {\n const contentArray = content.endsWith('\\n')\n ? content.split('\\n').slice(0, -1)\n : content.split('\\n');\n const contentLines = contentArray.slice(\n 0,\n consoleWidth ? displayLength : undefined\n );\n for (const line of contentLines)\n logMethod(\n line\n .split('~n')\n .map(l =>\n consoleWidth && strlen(l) > consoleWidth\n ? first(l, consoleWidth)\n : l\n )\n .join('\\n')\n );\n } else {\n logMethod(content.replace(ansiEscapeCodes, '').replaceAll('~n', '\\n'));\n }\n\n const tableArray = content.split('\\n');\n if (consoleWidth && tableArray.length > displayLength)\n console.info(\n `\\n`,\n `- and ${tableArray.length - displayLength} more...\\n`\n );\n };\n}\n\nexport const logError: LogErrorFunc = (\n err = new Error('Undefined error'),\n msg,\n level = 'error'\n) => {\n Logger[level](msg || err.message || err?.data?.message || err.Message);\n (Array.isArray(err) ? err : [err]).map((error: AppError) => {\n if (typeof error === 'string') {\n Logger.raw(`${Logger.infoText(error)}\\n`);\n return;\n }\n if ('stack' in error) Logger.raw(` ${Logger.infoText(error.stack)}\\n`);\n if ('data' in error)\n Logger.raw(` ${Logger.infoText(tryStringify(error.data))}\\n`);\n });\n //Logger.line();\n return null;\n};\n\nexport const addNewLines = (\n message = '',\n newLineSeparater = '\\n',\n atPosition = process.stdout.columns\n) => {\n if (message === '' || atPosition === 0) {\n return '';\n }\n\n let result = '';\n let lengthCounter = 0;\n\n // Partition the message string into an array of\n // [nonPrintable, printable][]\n const partitioned = partition(message);\n const addSeparater = () => {\n // If line length counter has exceeded the console width\n // add a new line separater and reset the line length counter\n if (lengthCounter >= atPosition) {\n result += newLineSeparater;\n lengthCounter = 0;\n }\n };\n\n // Loop through the partitioned message parts\n for (const [nonPrintable, printable] of partitioned) {\n // Convert string to array as this will provide accurate\n // lengths and splicing methods with all unicode chars\n const textParts = Array.from(printable);\n // Splice the remaining allowable line length from the text parts array\n const text = textParts.splice(0, atPosition - lengthCounter);\n // In the first iteration append the non printable unicode chars\n // to the beginning of the spliced text\n result += nonPrintable + text.join('');\n // Keep a count of the current line length\n // as one line of output could span multiple \"partitions\"\n lengthCounter += text.length;\n addSeparater();\n\n // Handle any remaining text in this \"partition\"\n while (textParts.length) {\n // Splice the remaining allowable line length from the text parts array\n const text = textParts.splice(0, atPosition - lengthCounter);\n // Append the spliced text to the result\n result += text.join('');\n // Increase line length counter\n lengthCounter += text.length;\n addSeparater();\n }\n }\n return result;\n};\n\nexport const progress = {\n current: { interrupt: (x: string) => {} },\n active: false,\n // done: () => new ProgressBar('', 0),\n // colours: { green: '\\u001b[42m \\u001b[0m', red: '\\u001b[41m \\u001b[0m' },\n // current: new ProgressBar(`:bar`, {\n // complete: '=',\n // incomplete: ' ',\n // width: 20,\n // total: 100,\n // }),\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,w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,OAAO,YACzB;AACH,MAAI,YAAY,MAAM,eAAe,GAAG;AACtC,WAAO;AAAA,EACT;AAEA,MAAI,SAAS;AACb,MAAI,gBAAgB;AAIpB,QAAM,kBAAc,uCAAU,OAAO;AACrC,QAAM,eAAe,MAAM;AAGzB,QAAI,iBAAiB,YAAY;AAC/B,gBAAU;AACV,sBAAgB;AAAA,IAClB;AAAA,EACF;AAGA,aAAW,CAAC,cAAc,SAAS,KAAK,aAAa;AAGnD,UAAM,YAAY,MAAM,KAAK,SAAS;AAEtC,UAAM,OAAO,UAAU,OAAO,GAAG,aAAa,aAAa;AAG3D,cAAU,eAAe,KAAK,KAAK,EAAE;AAGrC,qBAAiB,KAAK;AACtB,iBAAa;AAGb,WAAO,UAAU,QAAQ;AAEvB,YAAME,QAAO,UAAU,OAAO,GAAG,aAAa,aAAa;AAE3D,gBAAUA,MAAK,KAAK,EAAE;AAEtB,uBAAiBA,MAAK;AACtB,mBAAa;AAAA,IACf;AAAA,EACF;AACA,SAAO;AACT;AAEO,MAAM,WAAW;AAAA,EACtB,SAAS,EAAE,WAAW,CAAC,MAAc;AAAA,EAAC,EAAE;AAAA,EACxC,QAAQ;AASV;",
4
+ "sourcesContent": ["/* eslint-disable no-console */\nimport chalk from 'chalk';\nimport dateFormat from 'dateformat';\nimport deepCleaner from 'deep-cleaner';\nimport {\n ansiEscapeCodes,\n first,\n partition,\n strlen,\n} from 'printable-characters';\n// import ProgressBar from 'progress';\nimport { isSysError, tryStringify } from '.';\n\ntype LogMethod = (content: string) => void;\ntype LogErrorMethod = (content: string, err?: any, newline?: string) => void;\ntype LogJsonMethod = (content: any, depth?: number, indent?: string) => void;\ntype LogJsonDepthMethod = (content: any, depth?: number) => void;\ntype LogArrayMethod = (contentArray: string[]) => void;\ntype LogErrorFunc = (\n err: any,\n msg?: string,\n level?: 'error' | 'critical'\n) => void;\n\nexport class Logger {\n static isUserTerminal = !!process.stdout.columns;\n static getPrefix = () => {\n return Logger.isUserTerminal\n ? Logger.infoText(`[cli]`)\n : `[${dateFormat(new Date(), 'dd/mm HH:MM:ss')}]`;\n };\n static errorText = chalk.bold.red;\n static warningText = chalk.keyword('orange');\n static successText = chalk.keyword('green');\n static helpText = chalk.blue;\n static highlightText = chalk.yellow;\n static infoText = chalk.keyword('grey');\n static standardText = chalk.keyword('white');\n static boldText = chalk.bold;\n static critical: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.errorText(\n '[CRITICAL]'\n )} ${content}`;\n console.log(message);\n };\n static error: LogErrorMethod = (content, err, newline = '\\n') => {\n const message = `${Logger.getPrefix()} ${Logger.errorText(\n `${Logger.isUserTerminal ? '\u274C' : '[ERROR]'} ${content}${\n err\n ? `\\n\\n${Logger.infoText(\n isSysError(err) ? err.toString() : JSON.stringify(err, null, 2)\n )}`\n : ''\n }`\n )}${newline}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static warning: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.warningText(\n `${Logger.isUserTerminal ? '\u26A0\uFE0F ' : '[WARN]'} ${content}`\n )}\\n`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n // }\n };\n static success: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.successText(\n `${Logger.isUserTerminal ? '\u2705' : '[OK]'} ${content}`\n )}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static info: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? chalk.bgCyan(' \u2139 ') : '[INFO]'\n } ${Logger.infoText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static help: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${chalk.blue(\n `${Logger.isUserTerminal ? '\u23E9' : '[HELP]'} ${content}`\n )}\\n`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static standard: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? '\u25FB\uFE0F' : '[STD]'\n } \\n${Logger.standardText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n progress.current.interrupt(message);\n };\n static debug: LogMethod = content => {\n if (['true', '1'].includes(process.env.debug || '')) {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? chalk.bgGrey(' \u2699 ') : '[DEBUG]'\n } ${Logger.infoText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n }\n };\n static json: LogJsonDepthMethod = (content, depth = 9) =>\n console.dir(deepCleaner(content), { colors: true, depth });\n static mixed: LogArrayMethod = contentArray =>\n console.log(`${Logger.getPrefix()} ${contentArray.join(' ')}`);\n static line = () =>\n Logger.raw(` ${Logger.infoText(`-------------------------------------`)}`);\n\n static object: LogJsonMethod = content => {\n for (const [key, value] of Object.entries(content || {})) {\n if (value && typeof value === 'object') {\n Logger.raw(` ${chalk.bold.grey(key)}:`);\n if (key === 'fields' && Array.isArray(value)) {\n for (const field of value || []) {\n Logger.raw(\n ` ${chalk.bold(field.id)}${\n field.id === content.entryTitleField\n ? '**'\n : field.validations.minCount?.value ||\n typeof field.validations.required?.message !== 'undefined'\n ? '*'\n : ''\n }: ${chalk.grey(\n `${field.dataType}${\n field.dataFormat\n ? `<${\n Array.isArray(\n field.validations.allowedFieldTypes?.fields\n )\n ? `composer[${field.validations.allowedFieldTypes.fields\n .map((f: any) => f.id)\n .join(' | ')}]`\n : field.dataFormat\n }${\n field.dataFormat === 'entry'\n ? `, ${field.validations.allowedContentTypes.contentTypes.join(\n ' | '\n )}`\n : ''\n }>`\n : ''\n }${\n field.validations.maxLength?.value\n ? `(${field.validations.maxLength.value})`\n : ''\n }`\n )}`\n );\n }\n } else if (key === 'groups' && Array.isArray(value)) {\n for (const group of value || []) {\n const description =\n Object.keys(group.description).length &&\n Object.values(group.description)?.[0];\n Logger.raw(\n ` ${chalk.bold(group.id)}${\n description\n ? `: ${chalk.grey(Object.values(group.description)?.[0])}`\n : ''\n }`\n );\n }\n } else {\n Logger.objectRecurse(value, 3, ' ');\n // for (const [innerkey, innervalue] of Object.entries(value)) {\n // if (innervalue && typeof innervalue === 'object') {\n // Logger.raw(` ${chalk.bold.grey(innerkey)}:`);\n // console.table(innervalue);\n // } else if (\n // typeof innervalue !== 'undefined' &&\n // innervalue !== null\n // ) {\n // Logger.raw(` ${chalk.bold.grey(innerkey)}: ${innervalue}`);\n // }\n // }\n }\n } else if (typeof value !== 'undefined' && value !== null) {\n const valueText =\n key === 'id' && typeof value === 'string'\n ? Logger.highlightText(value)\n : value;\n Logger.raw(` ${chalk.bold.grey(key)}: ${valueText}`);\n }\n }\n };\n\n static objectRecurse: LogJsonMethod = (content, depth = 3, indent = '') => {\n if (Array.isArray(content)) {\n for (const item of content) {\n if (item && typeof item === 'object') {\n if (Array.isArray(item) && depth > 3)\n Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));\n else Logger.objectRecurse(item, depth + 1, `${indent} `);\n } else Logger.raw(`${indent}${item}`);\n }\n } else {\n let pos = 0;\n for (const [key, value] of Object.entries(content)) {\n const thisIndent =\n pos === 0 ? `${indent.substring(0, indent.length - 2)}- ` : indent;\n if (Array.isArray(value)) {\n if (value.length) Logger.raw(`${thisIndent}${chalk.bold.grey(key)}:`);\n for (const item of value) {\n if (item && typeof item === 'object') {\n if (Array.isArray(item) && depth > 3)\n Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));\n else Logger.objectRecurse(item, depth + 1, `${indent} `);\n } else {\n Logger.raw(`${indent} ${item}`);\n }\n }\n } else if (value && typeof value === 'object') {\n Logger.raw(`${indent}${chalk.bold.grey(key)}:`);\n\n Logger.objectRecurse(value, depth + 1, `${indent} `);\n // console.table(value);\n } else if (typeof value !== 'undefined' && value !== null) {\n Logger.raw(`${thisIndent}${chalk.bold.grey(key)}: ${value}`);\n }\n pos++;\n }\n }\n };\n static raw: LogMethod = (content: string) => {\n if (progress.active) progress.current.interrupt(content);\n else console.log(content);\n };\n\n static limits = (\n content: string,\n displayLength = 30,\n consoleWidth = process.stdout.columns,\n logMethod: Function = console.info\n ) => {\n if (consoleWidth) {\n const contentArray = content.endsWith('\\n')\n ? content.split('\\n').slice(0, -1)\n : content.split('\\n');\n const contentLines = contentArray.slice(\n 0,\n consoleWidth ? displayLength : undefined\n );\n for (const line of contentLines)\n logMethod(\n line\n .split('~n')\n .map(l =>\n consoleWidth && strlen(l) > consoleWidth\n ? first(l, consoleWidth)\n : l\n )\n .join('\\n')\n );\n } else {\n logMethod(content.replace(ansiEscapeCodes, '').replaceAll('~n', '\\n'));\n }\n\n const tableArray = content.split('\\n');\n if (consoleWidth && tableArray.length > displayLength)\n console.info(\n `\\n`,\n `- and ${tableArray.length - displayLength} more...\\n`\n );\n };\n}\n\nexport const logError: LogErrorFunc = (\n err = new Error('Undefined error'),\n msg,\n level = 'error'\n) => {\n Logger[level](msg || err.message || err?.data?.message || err.Message);\n (Array.isArray(err) ? err : [err]).map((error: AppError) => {\n if (typeof error === 'string') {\n Logger.raw(`${Logger.infoText(error)}\\n`);\n return;\n }\n if ('stack' in error) Logger.raw(` ${Logger.infoText(error.stack)}\\n`);\n if ('data' in error)\n Logger.raw(` ${Logger.infoText(tryStringify(error.data))}\\n`);\n });\n //Logger.line();\n return null;\n};\n\nexport const addNewLines = (\n message = '',\n newLineSeparater = '\\n',\n atPosition = process.stdout.columns\n) => {\n if (message === '' || atPosition === 0) {\n return '';\n }\n\n let result = '';\n let lengthCounter = 0;\n\n // Partition the message string into an array of\n // [nonPrintable, printable][]\n const partitioned = partition(message);\n const addSeparater = () => {\n // If line length counter has exceeded the console width\n // add a new line separater and reset the line length counter\n if (lengthCounter >= atPosition) {\n result += newLineSeparater;\n lengthCounter = 0;\n }\n };\n\n // Loop through the partitioned message parts\n for (const [nonPrintable, printable] of partitioned) {\n // Convert string to array as this will provide accurate\n // lengths and splicing methods with all unicode chars\n const textParts = Array.from(printable);\n // Splice the remaining allowable line length from the text parts array\n const text = textParts.splice(0, atPosition - lengthCounter);\n // In the first iteration append the non printable unicode chars\n // to the beginning of the spliced text\n result += nonPrintable + text.join('');\n // Keep a count of the current line length\n // as one line of output could span multiple \"partitions\"\n lengthCounter += text.length;\n addSeparater();\n\n // Handle any remaining text in this \"partition\"\n while (textParts.length) {\n // Splice the remaining allowable line length from the text parts array\n const text = textParts.splice(0, atPosition - lengthCounter);\n // Append the spliced text to the result\n result += text.join('');\n // Increase line length counter\n lengthCounter += text.length;\n addSeparater();\n }\n }\n return result;\n};\n\nexport const progress = {\n current: { interrupt: (x: string) => {} },\n active: false,\n // done: () => new ProgressBar('', 0),\n // colours: { green: '\\u001b[42m \\u001b[0m', red: '\\u001b[41m \\u001b[0m' },\n // current: new ProgressBar(`:bar`, {\n // complete: '=',\n // incomplete: ' ',\n // width: 20,\n // total: 100,\n // }),\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,wBAAuB;AACvB,0BAAwB;AACxB,kCAKO;AAEP,eAAyC;AAalC,MAAM,OAAO;AAAA,EAClB,OAAO,iBAAiB,CAAC,CAAC,QAAQ,OAAO;AAAA,EACzC,OAAO,YAAY,MAAM;AACvB,WAAO,OAAO,iBACV,OAAO,SAAS,OAAO,IACvB,QAAI,kBAAAA,SAAW,IAAI,KAAK,GAAG,gBAAgB;AAAA,EACjD;AAAA,EACA,OAAO,YAAY,aAAAC,QAAM,KAAK;AAAA,EAC9B,OAAO,cAAc,aAAAA,QAAM,QAAQ,QAAQ;AAAA,EAC3C,OAAO,cAAc,aAAAA,QAAM,QAAQ,OAAO;AAAA,EAC1C,OAAO,WAAW,aAAAA,QAAM;AAAA,EACxB,OAAO,gBAAgB,aAAAA,QAAM;AAAA,EAC7B,OAAO,WAAW,aAAAA,QAAM,QAAQ,MAAM;AAAA,EACtC,OAAO,eAAe,aAAAA,QAAM,QAAQ,OAAO;AAAA,EAC3C,OAAO,WAAW,aAAAA,QAAM;A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;AACT;AAEO,MAAM,WAAW;AAAA,EACtB,SAAS,EAAE,WAAW,CAAC,MAAc;AAAA,EAAC,EAAE;AAAA,EACxC,QAAQ;AASV;",
6
6
  "names": ["dateFormat", "chalk", "deepCleaner", "text"]
7
7
  }
package/dist/version.js CHANGED
@@ -21,7 +21,7 @@ __export(version_exports, {
21
21
  LIB_VERSION: () => LIB_VERSION
22
22
  });
23
23
  module.exports = __toCommonJS(version_exports);
24
- const LIB_VERSION = "1.1.1";
24
+ const LIB_VERSION = "1.1.2-beta.1";
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
27
  LIB_VERSION
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/version.ts"],
4
- "sourcesContent": ["export const LIB_VERSION = \"1.1.1\";\n"],
4
+ "sourcesContent": ["export const LIB_VERSION = \"1.1.2-beta.1\";\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contensis-cli",
3
- "version": "1.1.1",
3
+ "version": "1.1.2-beta.1",
4
4
  "description": "A fully featured Contensis command line interface with a shell UI provides simple and intuitive ways to manage or profile your content in any NodeJS terminal.",
5
5
  "repository": "https://github.com/contensis/cli",
6
6
  "homepage": "https://github.com/contensis/cli/tree/main/packages/contensis-cli#readme",
@@ -24,6 +24,7 @@
24
24
  "license": "ISC",
25
25
  "dependencies": {
26
26
  "@action-validator/core": "^0.5.3",
27
+ "adm-zip": "^0.5.10",
27
28
  "app-root-path": "^3.1.0",
28
29
  "chalk": "^4.1.2",
29
30
  "commander": "^9.4.1",
@@ -49,6 +50,8 @@
49
50
  "yaml": "^2.3.1"
50
51
  },
51
52
  "devDependencies": {
53
+ "@octokit/types": "^12.4.0",
54
+ "@types/adm-zip": "^0.5.5",
52
55
  "@types/figlet": "^1.5.4",
53
56
  "@types/flat": "^5.0.2",
54
57
  "@types/hosted-git-info": "^3.0.2",