contensis-cli 1.5.1-beta.7 → 1.5.1-beta.9

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.
@@ -140,15 +140,16 @@ const printEntriesMigrateResult = (service, migrateResult, {
140
140
  migrateResult.entriesToMigrate.entryIds
141
141
  )) {
142
142
  for (const [originalId, entryStatus] of Object.entries(entryRes)) {
143
- if (showAll || showChanged && Object.entries(
143
+ const projectStatus = Object.entries(
144
144
  Object.entries(entryStatus[currentProject])[0]
145
- )[1][1].status !== "no change") {
145
+ )[1][1];
146
+ if (showAll || showChanged && projectStatus.status !== "no change" && projectStatus.status !== "ignore") {
146
147
  console.log(
147
148
  log.infoText(
148
- `${Object.entries(entryStatus || {}).filter((x) => x[0] !== "entryTitle").map(([projectId, projectStatus]) => {
149
+ `${Object.entries(entryStatus || {}).filter((x) => x[0] !== "entryTitle").map(([projectId, projectStatus2]) => {
149
150
  var _a2;
150
151
  const [targetGuid, { status }] = ((_a2 = Object.entries(
151
- projectStatus || {}
152
+ projectStatus2 || {}
152
153
  )) == null ? void 0 : _a2[0]) || [
153
154
  "",
154
155
  { x: { status: void 0 } }
@@ -160,11 +161,11 @@ const printEntriesMigrateResult = (service, migrateResult, {
160
161
  })}`
161
162
  ) + `${log.helpText(contentTypeId)} ${entryStatus.entryTitle}`
162
163
  );
163
- for (const [projectId, projectStatus] of Object.entries(
164
+ for (const [projectId, projectStatus2] of Object.entries(
164
165
  entryStatus
165
166
  ).filter(([key]) => key !== "entryTitle")) {
166
167
  const [targetGuid, { error, diff, status }] = Object.entries(
167
- projectStatus
168
+ projectStatus2
168
169
  )[0];
169
170
  if (error) log.error(error);
170
171
  if (diff && showDiff) {
@@ -193,7 +194,7 @@ const printEntriesMigrateResult = (service, migrateResult, {
193
194
  const migrateStatusAndCount = migrateResult.entriesToMigrate[currentProject][contentTypeId];
194
195
  const existingCount = ((_b = (_a = migrateResult.existing) == null ? void 0 : _a[currentProject]) == null ? void 0 : _b[contentTypeId]) || 0;
195
196
  const existingPercent = (existingCount / count * 100).toFixed(0);
196
- const noChangeOrTotalEntriesCount = typeof migrateStatusAndCount !== "number" ? (migrateStatusAndCount == null ? void 0 : migrateStatusAndCount["no change"]) || 0 : migrateStatusAndCount;
197
+ const noChangeOrTotalEntriesCount = typeof migrateStatusAndCount !== "number" ? ((migrateStatusAndCount == null ? void 0 : migrateStatusAndCount["no change"]) || 0) + ((migrateStatusAndCount == null ? void 0 : migrateStatusAndCount["ignore"]) || 0) : migrateStatusAndCount;
197
198
  const changedPercentage = (noChangeOrTotalEntriesCount / count * 100).toFixed(0);
198
199
  const existingColor = existingPercent === "0" || action === "delete" ? log.warningText : log.infoText;
199
200
  const changedColor = isTotalCountRow ? log.helpText : changedPercentage === "100" ? log.successText : log.warningText;
@@ -311,7 +312,7 @@ const printModelMigrationAnalysis = ({ log, messages }, result = {}) => {
311
312
  )}`;
312
313
  if (projectDetails.error)
313
314
  errorOutput += ` ${log.highlightText(
314
- `error::`
315
+ `error:`
315
316
  )} ${log.errorText(projectDetails.error)}`;
316
317
  }
317
318
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/util/console.printer.ts"],
4
- "sourcesContent": ["import { Node } from 'contensis-delivery-api/lib/models';\nimport dayjs from 'dayjs';\nimport { deconstructApiError } from './error';\nimport { Logger, addNewLines } from './logger';\nimport {\n BlockVersion,\n CopyFieldResult,\n EntriesMigrationResult,\n EntriesResult,\n MigrateModelsResult,\n MigrateNodesTree,\n MigrateStatus,\n NodesResult,\n ProjectNodesToMigrate,\n} from 'migratortron';\nimport ContensisCli from '~/services/ContensisCliService';\n\nconst formatDate = (date: Date | string, format = 'DD/MM/YYYY HH:mm') =>\n dayjs(date).format(format);\n\nexport const printBlockVersion = (\n { log, messages }: ContensisCli,\n block: BlockVersion,\n printOptions = {\n showSource: true,\n showStatus: true,\n showStaticPaths: true,\n showImage: true,\n }\n) => {\n console.log(\n ` ${log.standardText(`v${block.version.versionNo}`)} ${block.id}`\n );\n console.log(\n ` state: ${messages.blocks.runningStatus(\n block.status.broken ? 'broken' : block.status.running.global\n )}`\n );\n console.log(\n ` released: ${log.infoText(\n block.version.released\n ? `[${formatDate(block.version.released)}] ${block.version.releasedBy}`\n : 'no'\n )}`\n );\n if (block.version.madeLive)\n console.log(\n ` live: ${log.infoText(\n `[${formatDate(block.version.madeLive)}] ${block.version.madeLiveBy}`\n )}`\n );\n if (printOptions.showStatus) {\n console.log(` status:`);\n console.log(` deployment: ${log.infoText(block.status.deployment)}`);\n console.log(` workflow: ${log.infoText(block.status.workflow)}`);\n console.log(\n ` running status: ${messages.blocks.runningStatus(\n block.status.running.global\n )}`\n );\n console.log(` datacentres:`);\n console.log(\n ` hq: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.hq\n )}`\n );\n console.log(\n ` london: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.london\n )}`\n );\n console.log(\n ` manchester: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.manchester\n )}`\n );\n }\n if (printOptions.showSource) {\n console.log(` source:`);\n console.log(` commit: ${log.helpText(block.source.commit.id)}`);\n console.log(\n ` message: ${log.infoText(\n block.source.commit.message\n ?.replaceAll('\\n', '\\\\n')\n .replaceAll('\\\\n\\\\n', '\\\\n')\n .replaceAll('\\\\n', '; ')\n )}`\n );\n console.log(\n ` committed: ${log.infoText(\n `[${formatDate(block.source.commit.dateTime)}] ${\n block.source.commit.authorEmail\n }`\n )}`\n );\n console.log(\n ` pushed: ${log.infoText(\n `[${formatDate(block.version.pushed)}] ${block.version.pushedBy}`\n )}`\n );\n console.log(` ${log.infoText(block.source.commit.commitUrl)}`);\n }\n if (printOptions.showImage) {\n console.log(` image:`);\n console.log(` uri: ${log.infoText(block.image.uri)}`);\n console.log(` tag: ${log.helpText(block.image.tag)}`);\n }\n if (printOptions.showStaticPaths) {\n if (block.staticPaths?.length) {\n console.log(` static paths:`);\n for (const path of block.staticPaths) console.log(` - ${path}`);\n }\n }\n if (block.stagingUrl)\n console.log(` staging url: ${log.infoText(block.stagingUrl)}`);\n console.log('');\n};\n\nexport const printEntriesMigrateResult = (\n service: ContensisCli,\n migrateResult: EntriesMigrationResult | EntriesResult | CopyFieldResult,\n {\n action = 'import',\n showDiff = false,\n showAll = false,\n showChanged = false,\n }: {\n action?: 'import' | 'update' | 'delete';\n showDiff?: boolean;\n showAll?: boolean;\n showChanged?: boolean;\n } = {}\n) => {\n console.log(``);\n const { log, messages, currentProject } = service;\n for (const [contentTypeId, entryRes] of Object.entries(\n migrateResult.entriesToMigrate.entryIds\n ) as [string, any]) {\n for (const [originalId, entryStatus] of Object.entries(entryRes) as [\n string,\n any,\n ][]) {\n if (\n showAll ||\n (showChanged &&\n (\n Object.entries(\n Object.entries(entryStatus[currentProject])[0]\n )[1][1] as any\n ).status !== 'no change')\n ) {\n console.log(\n log.infoText(\n `${Object.entries(entryStatus || {})\n .filter(x => x[0] !== 'entryTitle')\n .map(([projectId, projectStatus]) => {\n const [targetGuid, { status }] = (Object.entries(\n projectStatus || {}\n )?.[0] as [string, { status: MigrateStatus }]) || [\n '',\n { x: { status: undefined } },\n ];\n return `${messages.migrate.status(status)(\n `${status}`\n )} ${originalId}${\n targetGuid !== originalId ? ` -> ${targetGuid}\\n ` : ' '\n }`;\n })}`\n ) + `${log.helpText(contentTypeId)} ${entryStatus.entryTitle}`\n );\n\n for (const [projectId, projectStatus] of Object.entries(\n entryStatus\n ).filter(([key]) => key !== 'entryTitle') as [string, any][]) {\n const [targetGuid, { error, diff, status }] = Object.entries(\n projectStatus\n )[0] as [string, any];\n if (error) log.error(error);\n if (diff && showDiff) {\n console.log(\n ` ${log.infoText(`diff: ${highlightDiffText(diff)}`)}\\n`\n );\n }\n }\n }\n }\n }\n if (showAll || showChanged) console.log(``);\n\n for (const [projectId, contentTypeCounts] of Object.entries(\n migrateResult.entries || {}\n ) as [string, any][]) {\n log.help(\n action === 'update'\n ? `update entries in project ${log.boldText(\n log.warningText(currentProject)\n )}`\n : `${action}${\n action === 'delete'\n ? ` from project ${log.warningText(currentProject)}`\n : `${projectId ? ` from project ${log.highlightText(projectId)}` : ''} to ${log.boldText(\n log.warningText(currentProject)\n )}`\n }`\n );\n for (const [contentTypeId, count] of Object.entries(contentTypeCounts) as [\n string,\n number,\n ][]) {\n const isTotalCountRow = contentTypeId === 'totalCount';\n const migrateStatusAndCount =\n migrateResult.entriesToMigrate[currentProject][contentTypeId];\n const existingCount =\n migrateResult.existing?.[currentProject]?.[contentTypeId] || 0;\n const existingPercent = ((existingCount / count) * 100).toFixed(0);\n const noChangeOrTotalEntriesCount =\n typeof migrateStatusAndCount !== 'number'\n ? migrateStatusAndCount?.['no change'] || 0\n : migrateStatusAndCount;\n\n const changedPercentage = (\n (noChangeOrTotalEntriesCount / count) *\n 100\n ).toFixed(0);\n\n const existingColor =\n existingPercent === '0' || action === 'delete'\n ? log.warningText\n : log.infoText;\n\n const changedColor = isTotalCountRow\n ? log.helpText\n : changedPercentage === '100'\n ? log.successText\n : log.warningText;\n\n if (isTotalCountRow && 'nodes' in migrateResult) {\n printNodesMigrateResult(service, migrateResult, {\n showAll,\n showDiff,\n showChanged,\n isEntriesMigration: true,\n });\n }\n console.log(\n ` - ${\n isTotalCountRow\n ? log.highlightText(\n `${contentTypeId}: ${noChangeOrTotalEntriesCount}`\n )\n : `${contentTypeId}: ${log.helpText(count)}`\n }${\n changedPercentage === '100' || isTotalCountRow\n ? ''\n : existingColor(` [existing: ${`${existingPercent}%`}]`)\n }${\n existingPercent === '0' || (action === 'import' && isTotalCountRow)\n ? ''\n : changedColor(\n ` ${\n isTotalCountRow\n ? `[to ${action}: ${noChangeOrTotalEntriesCount}]`\n : changedPercentage === '100'\n ? 'up to date'\n : `[needs update: ${100 - Number(changedPercentage)}%]`\n }`\n )\n }`\n );\n }\n }\n if (migrateResult.errors?.length) {\n console.log(\n ` - ${log.errorText(`errors: ${migrateResult.errors.length}`)}\\n`\n );\n // for (const error of migrateResult.errors)\n // log.error(error.message, null, '');\n }\n};\n\nexport const printNodesMigrateResult = (\n { log, currentProject }: ContensisCli,\n migrateResult: EntriesMigrationResult | NodesResult,\n {\n action = 'import',\n logLimit = 50,\n showDiff = false,\n showAll = false,\n showChanged = false,\n isEntriesMigration = false,\n }: {\n action?: 'import' | 'delete';\n logLimit?: number;\n showDiff?: boolean;\n showAll?: boolean;\n showChanged?: boolean;\n isEntriesMigration?: boolean;\n } = {}\n) => {\n if (!isEntriesMigration) log.raw(``);\n for (const [projectId, counts] of Object.entries(migrateResult.nodes || {})) {\n const importTitle =\n action === 'delete'\n ? `Delete from project ${log.warningText(currentProject)}`\n : `Import ${\n projectId && projectId !== 'null'\n ? `from project ${log.highlightText(projectId)} `\n : ''\n }to ${log.boldText(log.warningText(currentProject))}`;\n if (!isEntriesMigration) log.help(importTitle);\n\n const migrateStatusAndCount = migrateResult.nodesToMigrate[\n currentProject\n ] as ProjectNodesToMigrate;\n\n const existingCount = migrateResult.nodes?.[projectId]?.totalCount || 0;\n\n const totalCount = Object.keys(migrateResult.nodesToMigrate.nodeIds).length;\n const existingPercent = counts.totalCount\n ? ((existingCount / totalCount) * 100).toFixed(0)\n : '0';\n\n const noChangeCount = migrateStatusAndCount?.['no change'] || 0;\n\n const changedPercentage = counts.totalCount\n ? ((noChangeCount / totalCount) * 100).toFixed(0)\n : '0';\n\n const existingColor =\n existingPercent === '0' || action === 'delete'\n ? log.warningText\n : log.infoText;\n\n const changedColor =\n changedPercentage === '100' ? log.successText : log.warningText;\n\n if (!isEntriesMigration || migrateStatusAndCount.totalCount > 0)\n console.log(\n ` - ${log.highlightText(\n `${isEntriesMigration ? ' + nodes' : 'totalCount'}: ${\n migrateStatusAndCount.totalCount\n }`\n )}${\n changedPercentage === '100'\n ? ''\n : existingColor(` [existing: ${`${existingPercent}%`}]`)\n }${\n existingPercent === '0'\n ? ''\n : changedColor(\n ` ${\n changedPercentage === '100'\n ? 'up to date'\n : `[needs update: ${100 - Number(changedPercentage)}%]`\n }`\n )\n }`\n );\n }\n if (migrateResult.errors?.length) {\n console.log(\n ` - ${log.errorText(`errors: ${migrateResult.errors.length}`)}\\n`\n );\n\n log.limits(\n migrateResult.errors\n .map(error => {\n return log.errorText(deconstructApiError(error));\n })\n .join('\\n'),\n logLimit\n );\n }\n};\n\nconst highlightDiffText = (str: string) => {\n const addedRegex = new RegExp(/<<\\+>>(.*?)<<\\/\\+>>/, 'g');\n const removedRegex = new RegExp(/<<->>(.*?)<<\\/->>/, 'g');\n return str\n .replace(addedRegex, match => {\n return Logger.successText(\n match.replace(/<<\\+>>/g, '<+>').replace(/<<\\/\\+>>/g, '</+>')\n );\n })\n .replace(removedRegex, match => {\n return Logger.errorText(\n match.replace(/<<->>/g, '<->').replace(/<<\\/->>/g, '</->')\n );\n });\n};\n\nexport const printModelMigrationAnalysis = (\n { log, messages }: ContensisCli,\n result: any = {}\n) => {\n for (const [contentTypeId, model] of Object.entries(result) as [\n string,\n any,\n ][]) {\n let mainOutput = log.standardText(\n ` - ${contentTypeId}${\n model.contentTypeId ? ` ${log.helpText(model.contentTypeId)}` : ''\n }`\n );\n let extraOutput = '';\n let errorOutput = '';\n let diffOutput = '';\n for (const [key, details] of Object.entries(model) as [string, any][]) {\n if (key === 'dependencies') {\n extraOutput += log.infoText(\n ` references: [${details?.join(', ')}]\\n`\n );\n }\n if (key === 'dependencyOf') {\n extraOutput += log.infoText(\n ` required by: [${details?.join(', ')}]\\n`\n );\n }\n if (key === 'projects') {\n for (const [projectId, projectDetails] of Object.entries(details) as [\n string,\n any,\n ][]) {\n mainOutput += log.infoText(\n ` [${messages.migrate.status(projectDetails.status)(\n `${projectId}: ${projectDetails.status}`\n )}]${\n projectDetails.versionNo ? ` v${projectDetails.versionNo}` : ''\n }`\n );\n if (projectDetails.diff)\n diffOutput += ` ${log.highlightText(`diff:`)} ${log.infoText(\n highlightDiffText(projectDetails.diff)\n )}`;\n if (projectDetails.error)\n errorOutput += ` ${log.highlightText(\n `error::`\n )} ${log.errorText(projectDetails.error)}`;\n }\n }\n }\n console.log(mainOutput);\n if (extraOutput) {\n const search = '\\n';\n const replace = '';\n console.log(\n extraOutput.replace(\n new RegExp(search + '([^' + search + ']*)$'),\n replace + '$1'\n )\n );\n }\n if (diffOutput) console.log(diffOutput);\n if (errorOutput) console.log(errorOutput);\n }\n};\n\ntype MigrateResultSummary = MigrateModelsResult['']['contentTypes'];\ntype MigrateResultStatus = keyof MigrateResultSummary;\n\nexport const printModelMigrationResult = (\n { log, messages }: ContensisCli,\n result: MigrateResultSummary\n) => {\n for (const [status, ids] of Object.entries(result) as [\n MigrateResultStatus,\n string[],\n ][]) {\n if (ids?.length) {\n if (status === 'errors') {\n const errors: [string, MappedError][] = ids as any;\n log.raw(\n ` - ${status}: [ ${messages.migrate.models.result(status)(\n ids.map(id => id[0]).join(', ')\n )} ]\\n`\n );\n for (const [contentTypeId, error] of errors)\n log.error(\n `${log.highlightText(contentTypeId)}: ${error.message}`,\n error\n );\n } else\n log.raw(\n ` - ${status}: [ ${messages.migrate.models.result(status)(\n ids.join(', ')\n )} ]`\n );\n }\n }\n};\n\nexport const printNodeTreeOutput = (\n { log, messages }: ContensisCli,\n root: Node | Partial<MigrateNodesTree> | undefined,\n logDetail = 'errors',\n logLimit = 1000\n) => {\n log.raw('');\n const statusColour = messages.migrate.status;\n\n if (root && 'status' in root)\n log.info(\n `Migrate status: ${statusColour('no change')(\n 'N'\n )} [no change]; ${statusColour('create')('C')} [create]; ${statusColour(\n 'update'\n )('U')} [update]; ${statusColour('delete')('D')} [delete]; ${statusColour(\n 'error'\n )('E')} [error];`\n );\n log.info(\n `Node properties: ${log.highlightText(\n 'e'\n )} = has entry; ${log.highlightText('c')} = canonical; ${log.highlightText(\n 'm'\n )} = include in menu`\n );\n\n log.line();\n\n const outputNode = (\n node: Partial<Node | MigrateNodesTree>,\n spaces: string,\n isRoot = false\n ) => {\n const errorOutput =\n 'error' in node && node.error && deconstructApiError(node.error);\n const fullOutput = logDetail === 'all';\n const changesOutput =\n logDetail === 'changes' &&\n 'status' in node &&\n node.status &&\n ['create', 'update'].includes(node.status);\n\n const diffOutput =\n (fullOutput || changesOutput || errorOutput) &&\n 'diff' in node &&\n node.diff?.replaceAll('\\n', '');\n\n return `${\n 'status' in node && node.status\n ? `${statusColour(node.status)(\n node.status.substring(0, 1).toUpperCase()\n )} `\n : ''\n }${node.entry ? log.highlightText('e') : log.infoText('-')}${\n 'isCanonical' in node && node.isCanonical\n ? log.highlightText('c')\n : log.infoText('-')\n }${\n node.includeInMenu ? log.highlightText('m') : log.infoText('-')\n }${spaces}${log[\n 'status' in node && node.status === 'no change'\n ? 'infoText'\n : 'standardText'\n ](\n 'isCanonical' in node && node.isCanonical\n ? log.boldText(\n fullOutput || isRoot || !node.slug ? node.path : `/${node.slug}`\n )\n : fullOutput || isRoot || !node.slug\n ? node.path\n : `/${node.slug}`\n )}${node.entry ? ` ${log.helpText(node.entry.sys.contentTypeId)}` : ''}${\n node.childCount ? ` +${node.childCount}` : ``\n } ${'displayName' in node ? log.infoText(node.displayName) : ''}${\n fullOutput || (changesOutput && node.id !== node.originalId)\n ? `~n ${log.infoText(`id:`)} ${\n !('originalId' in node) || node.id === node.originalId\n ? node.id\n : `${node.id} ${log.infoText(`<= ${node.originalId}`)}`\n }`\n : ''\n }${\n (fullOutput ||\n (changesOutput && node.parentId !== node.originalParentId)) &&\n node.parentId\n ? `~n ${log.infoText(\n `parentId: ${\n !('originalParentId' in node) ||\n node.parentId === node.originalParentId\n ? node.parentId\n : `${node.parentId} <= ${node.originalParentId}`\n }`\n )}`\n : ''\n }${\n fullOutput && node.entry?.sys.id\n ? `~n ${log.infoText(`entryId: ${node.entry.sys.id}`)}`\n : ''\n }${\n errorOutput\n ? `~n${addNewLines(` ${log.errorText(errorOutput)}`, '~n')}`\n : ''\n }${\n diffOutput\n ? `~n${addNewLines(\n ` ${log.infoText(`diff: ${highlightDiffText(diffOutput)}`)}`,\n '~n'\n )}`\n : ''\n }`;\n };\n\n const outputChildren = (\n node: Partial<Node | MigrateNodesTree> | undefined,\n depth = 2\n ) => {\n let str = '';\n for (const child of ((node as any)?.children || []) as Node[]) {\n str += `${outputNode(child, Array(depth + 1).join(' '))}\\n`;\n if ('children' in child) str += outputChildren(child, depth + 1);\n }\n return str;\n };\n\n const children = outputChildren(root);\n log.limits(\n `${outputNode(root || {}, ' ', true)}${children ? `\\n${children}` : ''}`,\n logLimit\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,mBAAoC;AACpC,oBAAoC;AAcpC,MAAM,aAAa,CAAC,MAAqB,SAAS,2BAChD,aAAAA,SAAM,IAAI,EAAE,OAAO,MAAM;AAEpB,MAAM,oBAAoB,CAC/B,EAAE,KAAK,SAAS,GAChB,OACA,eAAe;AAAA,EACb,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,WAAW;AACb,MACG;AA7BL;AA8BE,UAAQ;AAAA,IACN,KAAK,IAAI,aAAa,IAAI,MAAM,QAAQ,SAAS,EAAE,CAAC,IAAI,MAAM,EAAE;AAAA,EAClE;AACA,UAAQ;AAAA,IACN,cAAc,SAAS,OAAO;AAAA,MAC5B,MAAM,OAAO,SAAS,WAAW,MAAM,OAAO,QAAQ;AAAA,IACxD,CAAC;AAAA,EACH;AACA,UAAQ;AAAA,IACN,iBAAiB,IAAI;AAAA,MACnB,MAAM,QAAQ,WACV,IAAI,WAAW,MAAM,QAAQ,QAAQ,CAAC,KAAK,MAAM,QAAQ,UAAU,KACnE;AAAA,IACN,CAAC;AAAA,EACH;AACA,MAAI,MAAM,QAAQ;AAChB,YAAQ;AAAA,MACN,aAAa,IAAI;AAAA,QACf,IAAI,WAAW,MAAM,QAAQ,QAAQ,CAAC,KAAK,MAAM,QAAQ,UAAU;AAAA,MACrE,CAAC;AAAA,IACH;A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KAAK,aACxC,KAAK,KACL,GAAG,KAAK,EAAE,IAAI,IAAI,SAAS,MAAM,KAAK,UAAU,EAAE,CAAC,EACzD,KACA,EACN,IACG,cACE,iBAAiB,KAAK,aAAa,KAAK,qBAC3C,KAAK,WACD,OAAO,IAAI;AAAA,MACT,aACE,EAAE,sBAAsB,SACxB,KAAK,aAAa,KAAK,mBACnB,KAAK,WACL,GAAG,KAAK,QAAQ,OAAO,KAAK,gBAAgB,EAClD;AAAA,IACF,CAAC,KACD,EACN,GACE,gBAAc,UAAK,UAAL,mBAAY,IAAI,MAC1B,OAAO,IAAI,SAAS,YAAY,KAAK,MAAM,IAAI,EAAE,EAAE,CAAC,KACpD,EACN,GACE,cACI,SAAK,2BAAY,KAAK,IAAI,UAAU,WAAW,CAAC,IAAI,IAAI,CAAC,KACzD,EACN,GACE,aACI,SAAK;AAAA,MACH,KAAK,IAAI,SAAS,SAAS,kBAAkB,UAAU,CAAC,EAAE,CAAC;AAAA,MAC3D;AAAA,IACF,CAAC,KACD,EACN;AAAA,EACF;AAEA,QAAM,iBAAiB,CACrB,MACA,QAAQ,MACL;AACH,QAAI,MAAM;AACV,eAAW,UAAW,6BAAc,aAAY,CAAC,GAAc;AAC7D,aAAO,GAAG,WAAW,OAAO,MAAM,QAAQ,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC;AAAA;AACxD,UAAI,cAAc,MAAO,QAAO,eAAe,OAAO,QAAQ,CAAC;AAAA,IACjE;AACA,WAAO;AAAA,EACT;AAEA,QAAM,WAAW,eAAe,IAAI;AACpC,MAAI;AAAA,IACF,GAAG,WAAW,QAAQ,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,WAAW;AAAA,EAAK,QAAQ,KAAK,EAAE;AAAA,IACtE;AAAA,EACF;AACF;",
6
- "names": ["dayjs", "_a"]
4
+ "sourcesContent": ["import { Node } from 'contensis-delivery-api/lib/models';\nimport dayjs from 'dayjs';\nimport { deconstructApiError } from './error';\nimport { Logger, addNewLines } from './logger';\nimport {\n BlockVersion,\n CopyFieldResult,\n EntriesMigrationResult,\n EntriesResult,\n MigrateModelsResult,\n MigrateNodesTree,\n MigrateStatus,\n NodesResult,\n ProjectNodesToMigrate,\n} from 'migratortron';\nimport ContensisCli from '~/services/ContensisCliService';\n\nconst formatDate = (date: Date | string, format = 'DD/MM/YYYY HH:mm') =>\n dayjs(date).format(format);\n\nexport const printBlockVersion = (\n { log, messages }: ContensisCli,\n block: BlockVersion,\n printOptions = {\n showSource: true,\n showStatus: true,\n showStaticPaths: true,\n showImage: true,\n }\n) => {\n console.log(\n ` ${log.standardText(`v${block.version.versionNo}`)} ${block.id}`\n );\n console.log(\n ` state: ${messages.blocks.runningStatus(\n block.status.broken ? 'broken' : block.status.running.global\n )}`\n );\n console.log(\n ` released: ${log.infoText(\n block.version.released\n ? `[${formatDate(block.version.released)}] ${block.version.releasedBy}`\n : 'no'\n )}`\n );\n if (block.version.madeLive)\n console.log(\n ` live: ${log.infoText(\n `[${formatDate(block.version.madeLive)}] ${block.version.madeLiveBy}`\n )}`\n );\n if (printOptions.showStatus) {\n console.log(` status:`);\n console.log(` deployment: ${log.infoText(block.status.deployment)}`);\n console.log(` workflow: ${log.infoText(block.status.workflow)}`);\n console.log(\n ` running status: ${messages.blocks.runningStatus(\n block.status.running.global\n )}`\n );\n console.log(` datacentres:`);\n console.log(\n ` hq: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.hq\n )}`\n );\n console.log(\n ` london: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.london\n )}`\n );\n console.log(\n ` manchester: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.manchester\n )}`\n );\n }\n if (printOptions.showSource) {\n console.log(` source:`);\n console.log(` commit: ${log.helpText(block.source.commit.id)}`);\n console.log(\n ` message: ${log.infoText(\n block.source.commit.message\n ?.replaceAll('\\n', '\\\\n')\n .replaceAll('\\\\n\\\\n', '\\\\n')\n .replaceAll('\\\\n', '; ')\n )}`\n );\n console.log(\n ` committed: ${log.infoText(\n `[${formatDate(block.source.commit.dateTime)}] ${\n block.source.commit.authorEmail\n }`\n )}`\n );\n console.log(\n ` pushed: ${log.infoText(\n `[${formatDate(block.version.pushed)}] ${block.version.pushedBy}`\n )}`\n );\n console.log(` ${log.infoText(block.source.commit.commitUrl)}`);\n }\n if (printOptions.showImage) {\n console.log(` image:`);\n console.log(` uri: ${log.infoText(block.image.uri)}`);\n console.log(` tag: ${log.helpText(block.image.tag)}`);\n }\n if (printOptions.showStaticPaths) {\n if (block.staticPaths?.length) {\n console.log(` static paths:`);\n for (const path of block.staticPaths) console.log(` - ${path}`);\n }\n }\n if (block.stagingUrl)\n console.log(` staging url: ${log.infoText(block.stagingUrl)}`);\n console.log('');\n};\n\nexport const printEntriesMigrateResult = (\n service: ContensisCli,\n migrateResult: EntriesMigrationResult | EntriesResult | CopyFieldResult,\n {\n action = 'import',\n showDiff = false,\n showAll = false,\n showChanged = false,\n }: {\n action?: 'import' | 'update' | 'delete';\n showDiff?: boolean;\n showAll?: boolean;\n showChanged?: boolean;\n } = {}\n) => {\n console.log(``);\n const { log, messages, currentProject } = service;\n for (const [contentTypeId, entryRes] of Object.entries(\n migrateResult.entriesToMigrate.entryIds\n ) as [string, any]) {\n for (const [originalId, entryStatus] of Object.entries(entryRes) as [\n string,\n any,\n ][]) {\n const projectStatus = Object.entries(\n Object.entries(entryStatus[currentProject])[0]\n )[1][1] as any;\n if (\n showAll ||\n (showChanged &&\n projectStatus.status !== 'no change' &&\n projectStatus.status !== 'ignore')\n ) {\n console.log(\n log.infoText(\n `${Object.entries(entryStatus || {})\n .filter(x => x[0] !== 'entryTitle')\n .map(([projectId, projectStatus]) => {\n const [targetGuid, { status }] = (Object.entries(\n projectStatus || {}\n )?.[0] as [string, { status: MigrateStatus }]) || [\n '',\n { x: { status: undefined } },\n ];\n return `${messages.migrate.status(status)(\n `${status}`\n )} ${originalId}${\n targetGuid !== originalId ? ` -> ${targetGuid}\\n ` : ' '\n }`;\n })}`\n ) + `${log.helpText(contentTypeId)} ${entryStatus.entryTitle}`\n );\n\n for (const [projectId, projectStatus] of Object.entries(\n entryStatus\n ).filter(([key]) => key !== 'entryTitle') as [string, any][]) {\n const [targetGuid, { error, diff, status }] = Object.entries(\n projectStatus\n )[0] as [string, any];\n if (error) log.error(error);\n if (diff && showDiff) {\n console.log(\n ` ${log.infoText(`diff: ${highlightDiffText(diff)}`)}\\n`\n );\n }\n }\n }\n }\n }\n if (showAll || showChanged) console.log(``);\n\n for (const [projectId, contentTypeCounts] of Object.entries(\n migrateResult.entries || {}\n ) as [string, any][]) {\n log.help(\n action === 'update'\n ? `update entries in project ${log.boldText(\n log.warningText(currentProject)\n )}`\n : `${action}${\n action === 'delete'\n ? ` from project ${log.warningText(currentProject)}`\n : `${projectId ? ` from project ${log.highlightText(projectId)}` : ''} to ${log.boldText(\n log.warningText(currentProject)\n )}`\n }`\n );\n for (const [contentTypeId, count] of Object.entries(contentTypeCounts) as [\n string,\n number,\n ][]) {\n const isTotalCountRow = contentTypeId === 'totalCount';\n const migrateStatusAndCount =\n migrateResult.entriesToMigrate[currentProject][contentTypeId];\n const existingCount =\n migrateResult.existing?.[currentProject]?.[contentTypeId] || 0;\n const existingPercent = ((existingCount / count) * 100).toFixed(0);\n const noChangeOrTotalEntriesCount =\n typeof migrateStatusAndCount !== 'number'\n ? (migrateStatusAndCount?.['no change'] || 0) +\n (migrateStatusAndCount?.['ignore'] || 0)\n : migrateStatusAndCount;\n\n const changedPercentage = (\n (noChangeOrTotalEntriesCount / count) *\n 100\n ).toFixed(0);\n\n const existingColor =\n existingPercent === '0' || action === 'delete'\n ? log.warningText\n : log.infoText;\n\n const changedColor = isTotalCountRow\n ? log.helpText\n : changedPercentage === '100'\n ? log.successText\n : log.warningText;\n\n if (isTotalCountRow && 'nodes' in migrateResult) {\n printNodesMigrateResult(service, migrateResult, {\n showAll,\n showDiff,\n showChanged,\n isEntriesMigration: true,\n });\n }\n console.log(\n ` - ${\n isTotalCountRow\n ? log.highlightText(\n `${contentTypeId}: ${noChangeOrTotalEntriesCount}`\n )\n : `${contentTypeId}: ${log.helpText(count)}`\n }${\n changedPercentage === '100' || isTotalCountRow\n ? ''\n : existingColor(` [existing: ${`${existingPercent}%`}]`)\n }${\n existingPercent === '0' || (action === 'import' && isTotalCountRow)\n ? ''\n : changedColor(\n ` ${\n isTotalCountRow\n ? `[to ${action}: ${noChangeOrTotalEntriesCount}]`\n : changedPercentage === '100'\n ? 'up to date'\n : `[needs update: ${100 - Number(changedPercentage)}%]`\n }`\n )\n }`\n );\n }\n }\n if (migrateResult.errors?.length) {\n console.log(\n ` - ${log.errorText(`errors: ${migrateResult.errors.length}`)}\\n`\n );\n // for (const error of migrateResult.errors)\n // log.error(error.message, null, '');\n }\n};\n\nexport const printNodesMigrateResult = (\n { log, currentProject }: ContensisCli,\n migrateResult: EntriesMigrationResult | NodesResult,\n {\n action = 'import',\n logLimit = 50,\n showDiff = false,\n showAll = false,\n showChanged = false,\n isEntriesMigration = false,\n }: {\n action?: 'import' | 'delete';\n logLimit?: number;\n showDiff?: boolean;\n showAll?: boolean;\n showChanged?: boolean;\n isEntriesMigration?: boolean;\n } = {}\n) => {\n if (!isEntriesMigration) log.raw(``);\n for (const [projectId, counts] of Object.entries(migrateResult.nodes || {})) {\n const importTitle =\n action === 'delete'\n ? `Delete from project ${log.warningText(currentProject)}`\n : `Import ${\n projectId && projectId !== 'null'\n ? `from project ${log.highlightText(projectId)} `\n : ''\n }to ${log.boldText(log.warningText(currentProject))}`;\n if (!isEntriesMigration) log.help(importTitle);\n\n const migrateStatusAndCount = migrateResult.nodesToMigrate[\n currentProject\n ] as ProjectNodesToMigrate;\n\n const existingCount = migrateResult.nodes?.[projectId]?.totalCount || 0;\n\n const totalCount = Object.keys(migrateResult.nodesToMigrate.nodeIds).length;\n const existingPercent = counts.totalCount\n ? ((existingCount / totalCount) * 100).toFixed(0)\n : '0';\n\n const noChangeCount = migrateStatusAndCount?.['no change'] || 0;\n\n const changedPercentage = counts.totalCount\n ? ((noChangeCount / totalCount) * 100).toFixed(0)\n : '0';\n\n const existingColor =\n existingPercent === '0' || action === 'delete'\n ? log.warningText\n : log.infoText;\n\n const changedColor =\n changedPercentage === '100' ? log.successText : log.warningText;\n\n if (!isEntriesMigration || migrateStatusAndCount.totalCount > 0)\n console.log(\n ` - ${log.highlightText(\n `${isEntriesMigration ? ' + nodes' : 'totalCount'}: ${\n migrateStatusAndCount.totalCount\n }`\n )}${\n changedPercentage === '100'\n ? ''\n : existingColor(` [existing: ${`${existingPercent}%`}]`)\n }${\n existingPercent === '0'\n ? ''\n : changedColor(\n ` ${\n changedPercentage === '100'\n ? 'up to date'\n : `[needs update: ${100 - Number(changedPercentage)}%]`\n }`\n )\n }`\n );\n }\n if (migrateResult.errors?.length) {\n console.log(\n ` - ${log.errorText(`errors: ${migrateResult.errors.length}`)}\\n`\n );\n\n log.limits(\n migrateResult.errors\n .map(error => {\n return log.errorText(deconstructApiError(error));\n })\n .join('\\n'),\n logLimit\n );\n }\n};\n\nconst highlightDiffText = (str: string) => {\n const addedRegex = new RegExp(/<<\\+>>(.*?)<<\\/\\+>>/, 'g');\n const removedRegex = new RegExp(/<<->>(.*?)<<\\/->>/, 'g');\n return str\n .replace(addedRegex, match => {\n return Logger.successText(\n match.replace(/<<\\+>>/g, '<+>').replace(/<<\\/\\+>>/g, '</+>')\n );\n })\n .replace(removedRegex, match => {\n return Logger.errorText(\n match.replace(/<<->>/g, '<->').replace(/<<\\/->>/g, '</->')\n );\n });\n};\n\nexport const printModelMigrationAnalysis = (\n { log, messages }: ContensisCli,\n result: any = {}\n) => {\n for (const [contentTypeId, model] of Object.entries(result) as [\n string,\n any,\n ][]) {\n let mainOutput = log.standardText(\n ` - ${contentTypeId}${\n model.contentTypeId ? ` ${log.helpText(model.contentTypeId)}` : ''\n }`\n );\n let extraOutput = '';\n let errorOutput = '';\n let diffOutput = '';\n for (const [key, details] of Object.entries(model) as [string, any][]) {\n if (key === 'dependencies') {\n extraOutput += log.infoText(\n ` references: [${details?.join(', ')}]\\n`\n );\n }\n if (key === 'dependencyOf') {\n extraOutput += log.infoText(\n ` required by: [${details?.join(', ')}]\\n`\n );\n }\n if (key === 'projects') {\n for (const [projectId, projectDetails] of Object.entries(details) as [\n string,\n any,\n ][]) {\n mainOutput += log.infoText(\n ` [${messages.migrate.status(projectDetails.status)(\n `${projectId}: ${projectDetails.status}`\n )}]${\n projectDetails.versionNo ? ` v${projectDetails.versionNo}` : ''\n }`\n );\n if (projectDetails.diff)\n diffOutput += ` ${log.highlightText(`diff:`)} ${log.infoText(\n highlightDiffText(projectDetails.diff)\n )}`;\n if (projectDetails.error)\n errorOutput += ` ${log.highlightText(\n `error:`\n )} ${log.errorText(projectDetails.error)}`;\n }\n }\n }\n console.log(mainOutput);\n if (extraOutput) {\n const search = '\\n';\n const replace = '';\n console.log(\n extraOutput.replace(\n new RegExp(search + '([^' + search + ']*)$'),\n replace + '$1'\n )\n );\n }\n if (diffOutput) console.log(diffOutput);\n if (errorOutput) console.log(errorOutput);\n }\n};\n\ntype MigrateResultSummary = MigrateModelsResult['']['contentTypes'];\ntype MigrateResultStatus = keyof MigrateResultSummary;\n\nexport const printModelMigrationResult = (\n { log, messages }: ContensisCli,\n result: MigrateResultSummary\n) => {\n for (const [status, ids] of Object.entries(result) as [\n MigrateResultStatus,\n string[],\n ][]) {\n if (ids?.length) {\n if (status === 'errors') {\n const errors: [string, MappedError][] = ids as any;\n log.raw(\n ` - ${status}: [ ${messages.migrate.models.result(status)(\n ids.map(id => id[0]).join(', ')\n )} ]\\n`\n );\n for (const [contentTypeId, error] of errors)\n log.error(\n `${log.highlightText(contentTypeId)}: ${error.message}`,\n error\n );\n } else\n log.raw(\n ` - ${status}: [ ${messages.migrate.models.result(status)(\n ids.join(', ')\n )} ]`\n );\n }\n }\n};\n\nexport const printNodeTreeOutput = (\n { log, messages }: ContensisCli,\n root: Node | Partial<MigrateNodesTree> | undefined,\n logDetail = 'errors',\n logLimit = 1000\n) => {\n log.raw('');\n const statusColour = messages.migrate.status;\n\n if (root && 'status' in root)\n log.info(\n `Migrate status: ${statusColour('no change')(\n 'N'\n )} [no change]; ${statusColour('create')('C')} [create]; ${statusColour(\n 'update'\n )('U')} [update]; ${statusColour('delete')('D')} [delete]; ${statusColour(\n 'error'\n )('E')} [error];`\n );\n log.info(\n `Node properties: ${log.highlightText(\n 'e'\n )} = has entry; ${log.highlightText('c')} = canonical; ${log.highlightText(\n 'm'\n )} = include in menu`\n );\n\n log.line();\n\n const outputNode = (\n node: Partial<Node | MigrateNodesTree>,\n spaces: string,\n isRoot = false\n ) => {\n const errorOutput =\n 'error' in node && node.error && deconstructApiError(node.error);\n const fullOutput = logDetail === 'all';\n const changesOutput =\n logDetail === 'changes' &&\n 'status' in node &&\n node.status &&\n ['create', 'update'].includes(node.status);\n\n const diffOutput =\n (fullOutput || changesOutput || errorOutput) &&\n 'diff' in node &&\n node.diff?.replaceAll('\\n', '');\n\n return `${\n 'status' in node && node.status\n ? `${statusColour(node.status)(\n node.status.substring(0, 1).toUpperCase()\n )} `\n : ''\n }${node.entry ? log.highlightText('e') : log.infoText('-')}${\n 'isCanonical' in node && node.isCanonical\n ? log.highlightText('c')\n : log.infoText('-')\n }${\n node.includeInMenu ? log.highlightText('m') : log.infoText('-')\n }${spaces}${log[\n 'status' in node && node.status === 'no change'\n ? 'infoText'\n : 'standardText'\n ](\n 'isCanonical' in node && node.isCanonical\n ? log.boldText(\n fullOutput || isRoot || !node.slug ? node.path : `/${node.slug}`\n )\n : fullOutput || isRoot || !node.slug\n ? node.path\n : `/${node.slug}`\n )}${node.entry ? ` ${log.helpText(node.entry.sys.contentTypeId)}` : ''}${\n node.childCount ? ` +${node.childCount}` : ``\n } ${'displayName' in node ? log.infoText(node.displayName) : ''}${\n fullOutput || (changesOutput && node.id !== node.originalId)\n ? `~n ${log.infoText(`id:`)} ${\n !('originalId' in node) || node.id === node.originalId\n ? node.id\n : `${node.id} ${log.infoText(`<= ${node.originalId}`)}`\n }`\n : ''\n }${\n (fullOutput ||\n (changesOutput && node.parentId !== node.originalParentId)) &&\n node.parentId\n ? `~n ${log.infoText(\n `parentId: ${\n !('originalParentId' in node) ||\n node.parentId === node.originalParentId\n ? node.parentId\n : `${node.parentId} <= ${node.originalParentId}`\n }`\n )}`\n : ''\n }${\n fullOutput && node.entry?.sys.id\n ? `~n ${log.infoText(`entryId: ${node.entry.sys.id}`)}`\n : ''\n }${\n errorOutput\n ? `~n${addNewLines(` ${log.errorText(errorOutput)}`, '~n')}`\n : ''\n }${\n diffOutput\n ? `~n${addNewLines(\n ` ${log.infoText(`diff: ${highlightDiffText(diffOutput)}`)}`,\n '~n'\n )}`\n : ''\n }`;\n };\n\n const outputChildren = (\n node: Partial<Node | MigrateNodesTree> | undefined,\n depth = 2\n ) => {\n let str = '';\n for (const child of ((node as any)?.children || []) as Node[]) {\n str += `${outputNode(child, Array(depth + 1).join(' '))}\\n`;\n if ('children' in child) str += outputChildren(child, depth + 1);\n }\n return str;\n };\n\n const children = outputChildren(root);\n log.limits(\n `${outputNode(root || {}, ' ', true)}${children ? `\\n${children}` : ''}`,\n logLimit\n );\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,mBAAoC;AACpC,oBAAoC;AAcpC,MAAM,aAAa,CAAC,MAAqB,SAAS,2BAChD,aAAAA,SAAM,IAAI,EAAE,OAAO,MAAM;AAEpB,MAAM,oBAAoB,CAC/B,EAAE,KAAK,SAAS,GAChB,OACA,eAAe;AAAA,EACb,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,WAAW;AACb,MACG;AA7BL;AA8BE,UAAQ;AAAA,IACN,KAAK,IAAI,aAAa,IAAI,MAAM,QAAQ,SAAS,EAAE,CAAC,IAAI,MAAM,EAAE;AAAA,EAClE;AACA,UAAQ;AAAA,IACN,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aAAY,CAAC,GAAc;AAC7D,aAAO,GAAG,WAAW,OAAO,MAAM,QAAQ,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC;AAAA;AACxD,UAAI,cAAc,MAAO,QAAO,eAAe,OAAO,QAAQ,CAAC;AAAA,IACjE;AACA,WAAO;AAAA,EACT;AAEA,QAAM,WAAW,eAAe,IAAI;AACpC,MAAI;AAAA,IACF,GAAG,WAAW,QAAQ,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,WAAW;AAAA,EAAK,QAAQ,KAAK,EAAE;AAAA,IACtE;AAAA,EACF;AACF;",
6
+ "names": ["dayjs", "projectStatus", "_a"]
7
7
  }
@@ -29,15 +29,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  var util_exports = {};
30
30
  __export(util_exports, {
31
31
  Logging: () => Logging,
32
- splitTagGroupsInModels: () => splitTagGroupsInModels,
33
- splitTagsAndGroups: () => splitTagsAndGroups,
34
32
  url: () => url
35
33
  });
36
34
  module.exports = __toCommonJS(util_exports);
37
35
  var import_mergeWith = __toESM(require("lodash/mergeWith"));
38
36
  var import_logger = require("./logger");
39
37
  var import_en_GB = require("../localisation/en-GB.js");
40
- var import_lodash = require("lodash");
41
38
  const url = (alias, project) => {
42
39
  const projectAndAlias = project && project.toLowerCase() !== "website" ? `${project.toLowerCase()}-${alias}` : alias;
43
40
  return {
@@ -63,27 +60,9 @@ const Logging = async (language = "en-GB") => {
63
60
  Log: import_logger.Logger
64
61
  };
65
62
  };
66
- const splitTagsAndGroups = (tagsAndGroups = [], tags = [], groups = []) => {
67
- for (const item of tagsAndGroups) {
68
- if ((0, import_lodash.isObject)(item) && "id" in item) {
69
- if ("name" in item) groups.push(item);
70
- else tags.push(item);
71
- }
72
- }
73
- };
74
- const splitTagGroupsInModels = (mixedData = [], models = [], groups = []) => {
75
- for (const item of mixedData) {
76
- if ((0, import_lodash.isObject)(item) && "id" in item) {
77
- if (!("dataFormat" in item)) groups.push(item);
78
- else models.push(item);
79
- }
80
- }
81
- };
82
63
  // Annotate the CommonJS export names for ESM import in node:
83
64
  0 && (module.exports = {
84
65
  Logging,
85
- splitTagGroupsInModels,
86
- splitTagsAndGroups,
87
66
  url
88
67
  });
89
68
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/util/index.ts"],
4
- "sourcesContent": ["import { ContentType, Component } from 'contensis-core-api';\nimport { ICreateTag, ICreateTagGroup } from 'contensis-management-api';\nimport mergeWith from 'lodash/mergeWith';\nimport { Logger } from './logger';\nimport { LogMessages as enGB } from '../localisation/en-GB.js';\nimport { isObject } from 'lodash';\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 const 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\nexport const splitTagsAndGroups = (\n tagsAndGroups: unknown[] = [],\n tags: ICreateTag[] = [],\n groups: ICreateTagGroup[] = []\n) => {\n for (const item of tagsAndGroups) {\n if (isObject(item) && 'id' in item) {\n if ('name' in item) groups.push(item as ICreateTagGroup);\n else tags.push(item as ICreateTag);\n }\n }\n};\n\nexport const splitTagGroupsInModels = (\n mixedData: unknown[] = [],\n models: (ContentType | Component)[] = [],\n groups: ICreateTagGroup[] = []\n) => {\n for (const item of mixedData) {\n if (isObject(item) && 'id' in item) {\n if (!('dataFormat' in item)) groups.push(item as ICreateTagGroup);\n else models.push(item as ContentType | Component);\n }\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,uBAAsB;AACtB,oBAAuB;AACvB,mBAAoC;AACpC,oBAAyB;AAElB,MAAM,MAAM,CAAC,OAAe,YAAoB;AACrD,QAAM,kBACJ,WAAW,QAAQ,YAAY,MAAM,YACjC,GAAG,QAAQ,YAAY,CAAC,IAAI,KAAK,KACjC;AACN,SAAO;AAAA,IACL,KAAK,eAAe,KAAK;AAAA,IACzB,KAAK,eAAe,KAAK;AAAA,IACzB,SAAS,gBAAgB,eAAe;AAAA,IACxC,YAAY,mBAAmB,eAAe;AAAA,IAC9C,QAAQ,oBAAoB,eAAe;AAAA,IAC3C,eAAe,uBAAuB,eAAe;AAAA,EACvD;AACF;AAEO,MAAM,UAAU,OAAO,WAAW,YAAY;AACnD,QAAM,kBAAkB,aAAAA;AAIxB,QAAM,oBAAoB;AAE1B,MAAI,aAAa,SAAS;AAAA,EAI1B;AACA,SAAO;AAAA,IACL,cAAU,iBAAAC;AAAA,MACR;AAAA,MACA;AAAA,MACA,CAAC,GAAG,MAAM,KAAK;AAAA,IACjB;AAAA,IACA,KAAK;AAAA,EACP;AACF;AAEO,MAAM,qBAAqB,CAChC,gBAA2B,CAAC,GAC5B,OAAqB,CAAC,GACtB,SAA4B,CAAC,MAC1B;AACH,aAAW,QAAQ,eAAe;AAChC,YAAI,wBAAS,IAAI,KAAK,QAAQ,MAAM;AAClC,UAAI,UAAU,KAAM,QAAO,KAAK,IAAuB;AAAA,UAClD,MAAK,KAAK,IAAkB;AAAA,IACnC;AAAA,EACF;AACF;AAEO,MAAM,yBAAyB,CACpC,YAAuB,CAAC,GACxB,SAAsC,CAAC,GACvC,SAA4B,CAAC,MAC1B;AACH,aAAW,QAAQ,WAAW;AAC5B,YAAI,wBAAS,IAAI,KAAK,QAAQ,MAAM;AAClC,UAAI,EAAE,gBAAgB,MAAO,QAAO,KAAK,IAAuB;AAAA,UAC3D,QAAO,KAAK,IAA+B;AAAA,IAClD;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { ContentType, Component } from 'contensis-core-api';\nimport { ICreateTag, ICreateTagGroup } from 'contensis-management-api';\nimport mergeWith from 'lodash/mergeWith';\nimport { Logger } from './logger';\nimport { LogMessages as enGB } from '../localisation/en-GB.js';\nimport { isObject } from 'lodash';\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 const 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
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,uBAAsB;AACtB,oBAAuB;AACvB,mBAAoC;AAG7B,MAAM,MAAM,CAAC,OAAe,YAAoB;AACrD,QAAM,kBACJ,WAAW,QAAQ,YAAY,MAAM,YACjC,GAAG,QAAQ,YAAY,CAAC,IAAI,KAAK,KACjC;AACN,SAAO;AAAA,IACL,KAAK,eAAe,KAAK;AAAA,IACzB,KAAK,eAAe,KAAK;AAAA,IACzB,SAAS,gBAAgB,eAAe;AAAA,IACxC,YAAY,mBAAmB,eAAe;AAAA,IAC9C,QAAQ,oBAAoB,eAAe;AAAA,IAC3C,eAAe,uBAAuB,eAAe;AAAA,EACvD;AACF;AAEO,MAAM,UAAU,OAAO,WAAW,YAAY;AACnD,QAAM,kBAAkB,aAAAA;AAIxB,QAAM,oBAAoB;AAE1B,MAAI,aAAa,SAAS;AAAA,EAI1B;AACA,SAAO;AAAA,IACL,cAAU,iBAAAC;AAAA,MACR;AAAA,MACA;AAAA,MACA,CAAC,GAAG,MAAM,KAAK;AAAA,IACjB;AAAA,IACA,KAAK;AAAA,EACP;AACF;",
6
6
  "names": ["enGB", "mergeWith"]
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.5.1-beta.7";
24
+ const LIB_VERSION = "1.5.1-beta.9";
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.5.1-beta.7\";\n"],
4
+ "sourcesContent": ["export const LIB_VERSION = \"1.5.1-beta.9\";\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.5.1-beta.7",
3
+ "version": "1.5.1-beta.9",
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",
@@ -39,7 +39,7 @@
39
39
  "inquirer-command-prompt": "^0.1.0",
40
40
  "keytar": "^7.9.0",
41
41
  "lodash": "^4.17.21",
42
- "migratortron": "^1.0.0-beta.78",
42
+ "migratortron": "^1.0.0-beta.79",
43
43
  "nanospinner": "^1.2.0",
44
44
  "node-fetch": "^2.6.7",
45
45
  "parse-git-config": "^3.0.0",
@@ -49,6 +49,7 @@ export const mapContensisOpts = (opts: any = {}): MigrateRequest => ({
49
49
  ignoreErrors: opts.ignoreErrors,
50
50
  noCache: !opts.cache, // arg is inverted automatically from `--no-cache` to `cache: false`
51
51
  includeDefaults: opts.defaults, // arg is inverted automatically from `--no-defaults` to `defaults: false`
52
+ includeValidations: opts.validations, // arg is inverted automatically from `--no-validations` to `validations: false`
52
53
  concurrency: opts.concurrency ? Number(opts.concurrency) : undefined,
53
54
  noPublish: !opts.publish, // arg is inverted automatically from `--no-publish` to `publish: false`
54
55
  outputLogs: opts.logLevel,
@@ -36,6 +36,10 @@ export const makeImportCommand = () => {
36
36
  '-nod --no-defaults',
37
37
  'ignore any default entries or nodes attached to content types or fields'
38
38
  )
39
+ .option(
40
+ '-nov --no-validations',
41
+ 'import fields with validations removed'
42
+ )
39
43
  .option(
40
44
  '-preserve --preserve-guids',
41
45
  'import any default entries or nodes using the same id as the source'
@@ -227,10 +227,17 @@ export const LogMessages = {
227
227
  `No Contensis environment set, connect to your Contensis cloud instance using "contensis connect {cms alias}"`,
228
228
  },
229
229
  entries: {
230
- imported: (env: string, commit: boolean, entries: number, nodes = 0) =>
230
+ imported: (
231
+ env: string,
232
+ commit: boolean,
233
+ entries: number,
234
+ nodes = 0,
235
+ tags = 0
236
+ ) =>
231
237
  LogMessages.migrate.imported(env, commit, {
232
238
  entry: entries,
233
239
  node: nodes,
240
+ tag: tags,
234
241
  }),
235
242
  failedImport: (env: string) => `[${env}] Unable to import entries`,
236
243
  update: {
@@ -0,0 +1,80 @@
1
+ import { Component, ContentType, Project } from 'contensis-core-api';
2
+ import {
3
+ Entry,
4
+ ICreateNode,
5
+ ICreateTag,
6
+ ICreateTagGroup,
7
+ Tag,
8
+ TagGroup,
9
+ } from 'contensis-management-api';
10
+ import { MigrateRequest } from 'migratortron';
11
+ import { readFileAsJSON } from '~/providers/file-provider';
12
+
13
+ export class MixedFileData
14
+ implements
15
+ Pick<MigrateRequest, 'models' | 'entries' | 'nodes' | 'tagGroups' | 'tags'>
16
+ {
17
+ models: (ContentType | Component)[] = [];
18
+ entries: Entry[] = [];
19
+ nodes: ICreateNode[] = [];
20
+ tagGroups: (TagGroup | ICreateTagGroup)[] = [];
21
+ tags: (Tag | ICreateTag)[] = [];
22
+
23
+ constructor(fileData?: any[]) {
24
+ if (Array.isArray(fileData)) this.init(fileData);
25
+ }
26
+ init = (fileData: any[]) => {
27
+ for (const item of fileData) {
28
+ if (
29
+ this.#isContentType(item) ||
30
+ this.#isComponent(item) ||
31
+ this.#isForm(item)
32
+ )
33
+ this.models.push(item);
34
+ if (this.#isEntry(item) || this.#isAsset(item)) this.entries.push(item);
35
+ if (this.#isNode(item)) this.nodes.push(item);
36
+ if (this.#isTagGroup(item)) this.tagGroups.push(item);
37
+ if (this.#isTag(item)) this.tags.push(item);
38
+ }
39
+ };
40
+ async readFile(filePath: string): Promise<any> {
41
+ const fileData = await readFileAsJSON(filePath);
42
+ if (typeof fileData === 'string')
43
+ throw new Error(`Import file format must be of type JSON`);
44
+ if (Array.isArray(fileData)) this.init(fileData);
45
+ return this;
46
+ }
47
+
48
+ #isProject = (item: any): item is Project =>
49
+ 'id' in item && 'name' in item && 'primaryLanguage' in item;
50
+
51
+ #isContentType = (item: any): item is ContentType =>
52
+ 'dataFormat' in item && item.dataFormat === 'entry';
53
+
54
+ #isComponent = (item: any): item is Component =>
55
+ 'dataFormat' in item && item.dataFormat === 'component';
56
+
57
+ #isForm = (item: any): item is ContentType =>
58
+ 'dataFormat' in item && item.dataFormat === 'form';
59
+
60
+ #isAsset = (item: any): item is Entry =>
61
+ 'sys' in item &&
62
+ 'contentTypeId' in item.sys &&
63
+ 'dataFormat' in item.sys &&
64
+ item.sys.dataFormat === 'asset';
65
+
66
+ #isEntry = (item: any): item is Entry =>
67
+ 'sys' in item &&
68
+ 'contentTypeId' in item.sys &&
69
+ 'dataFormat' in item.sys &&
70
+ item.sys.dataFormat === 'entry';
71
+
72
+ #isNode = (item: any): item is ICreateNode =>
73
+ ('slug' in item || 'path' in item) && 'displayName' in item;
74
+
75
+ #isTag = (item: any): item is ICreateTag =>
76
+ 'id' in item && 'groupId' in item && 'label' in item;
77
+
78
+ #isTagGroup = (item: any): item is ICreateTagGroup =>
79
+ 'id' in item && 'name' in item && 'tagCount' in item;
80
+ }