contensis-cli 1.6.1-beta.8 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/LICENSE +674 -0
- package/dist/index.js +58362 -11
- package/dist/index.js.map +4 -4
- package/dist/shell.js +58100 -52
- package/dist/shell.js.map +4 -4
- package/docs/copy_field_templates.md +112 -0
- package/esbuild.config.js +8 -13
- package/package.json +3 -3
- package/src/commands/create.ts +48 -0
- package/src/commands/dev.ts +6 -0
- package/src/commands/push.ts +38 -6
- package/src/commands/set.ts +70 -1
- package/src/factories/RequestHandlerFactory.ts +6 -3
- package/src/localisation/en-GB.ts +12 -0
- package/src/mappers/DevRequests-to-RequestHanderCliArgs.ts +3 -0
- package/src/models/CliService.d.ts +5 -1
- package/src/providers/GitHubCliModuleProvider.ts +8 -8
- package/src/services/ContensisCliService.ts +189 -7
- package/src/shell.ts +6 -1
- package/src/util/logger.ts +3 -4
- package/src/util/os.ts +5 -3
- package/src/version.ts +1 -1
- package/dist/commands/connect.js +0 -44
- package/dist/commands/connect.js.map +0 -7
- package/dist/commands/copy.js +0 -78
- package/dist/commands/copy.js.map +0 -7
- package/dist/commands/create.js +0 -170
- package/dist/commands/create.js.map +0 -7
- package/dist/commands/dev.js +0 -81
- package/dist/commands/dev.js.map +0 -7
- package/dist/commands/diff.js +0 -57
- package/dist/commands/diff.js.map +0 -7
- package/dist/commands/execute.js +0 -103
- package/dist/commands/execute.js.map +0 -7
- package/dist/commands/get.js +0 -330
- package/dist/commands/get.js.map +0 -7
- package/dist/commands/globalOptions.js +0 -252
- package/dist/commands/globalOptions.js.map +0 -7
- package/dist/commands/import.js +0 -256
- package/dist/commands/import.js.map +0 -7
- package/dist/commands/index.js +0 -107
- package/dist/commands/index.js.map +0 -7
- package/dist/commands/list.js +0 -195
- package/dist/commands/list.js.map +0 -7
- package/dist/commands/login.js +0 -55
- package/dist/commands/login.js.map +0 -7
- package/dist/commands/push.js +0 -234
- package/dist/commands/push.js.map +0 -7
- package/dist/commands/remove.js +0 -193
- package/dist/commands/remove.js.map +0 -7
- package/dist/commands/set.js +0 -180
- package/dist/commands/set.js.map +0 -7
- package/dist/commands/update.js +0 -70
- package/dist/commands/update.js.map +0 -7
- package/dist/factories/RequestHandlerFactory.js +0 -227
- package/dist/factories/RequestHandlerFactory.js.map +0 -7
- package/dist/localisation/en-GB.js +0 -559
- package/dist/localisation/en-GB.js.map +0 -7
- package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js +0 -56
- package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js.map +0 -7
- package/dist/mappers/DevInit-to-CIWorkflow.js +0 -409
- package/dist/mappers/DevInit-to-CIWorkflow.js.map +0 -7
- package/dist/mappers/DevInit-to-RolePermissions.js +0 -56
- package/dist/mappers/DevInit-to-RolePermissions.js.map +0 -7
- package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js +0 -168
- package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js.map +0 -7
- package/dist/mappers/MixedFileData.js +0 -83
- package/dist/mappers/MixedFileData.js.map +0 -7
- package/dist/models/AppError.d.js +0 -2
- package/dist/models/AppError.d.js.map +0 -7
- package/dist/models/Cache.d.js +0 -2
- package/dist/models/Cache.d.js.map +0 -7
- package/dist/models/CliService.d.js +0 -17
- package/dist/models/CliService.d.js.map +0 -7
- package/dist/models/DevService.d.js +0 -17
- package/dist/models/DevService.d.js.map +0 -7
- package/dist/models/JsModules.d.js +0 -2
- package/dist/models/JsModules.d.js.map +0 -7
- package/dist/providers/CredentialProvider.js +0 -126
- package/dist/providers/CredentialProvider.js.map +0 -7
- package/dist/providers/GitHubCliModuleProvider.js +0 -115
- package/dist/providers/GitHubCliModuleProvider.js.map +0 -7
- package/dist/providers/HttpProvider.js +0 -73
- package/dist/providers/HttpProvider.js.map +0 -7
- package/dist/providers/ManifestProvider.js +0 -50
- package/dist/providers/ManifestProvider.js.map +0 -7
- package/dist/providers/SessionCacheProvider.js +0 -132
- package/dist/providers/SessionCacheProvider.js.map +0 -7
- package/dist/providers/file-provider.js +0 -177
- package/dist/providers/file-provider.js.map +0 -7
- package/dist/services/ContensisAuthService.js +0 -88
- package/dist/services/ContensisAuthService.js.map +0 -7
- package/dist/services/ContensisCliService.js +0 -2661
- package/dist/services/ContensisCliService.js.map +0 -7
- package/dist/services/ContensisDevService.js +0 -435
- package/dist/services/ContensisDevService.js.map +0 -7
- package/dist/services/ContensisRoleService.js +0 -112
- package/dist/services/ContensisRoleService.js.map +0 -7
- package/dist/util/api-ids.js +0 -110
- package/dist/util/api-ids.js.map +0 -7
- package/dist/util/assert.js +0 -62
- package/dist/util/assert.js.map +0 -7
- package/dist/util/console.printer.js +0 -461
- package/dist/util/console.printer.js.map +0 -7
- package/dist/util/csv.formatter.js +0 -118
- package/dist/util/csv.formatter.js.map +0 -7
- package/dist/util/debug.js +0 -29
- package/dist/util/debug.js.map +0 -7
- package/dist/util/diff.js +0 -118
- package/dist/util/diff.js.map +0 -7
- package/dist/util/dotenv.js +0 -56
- package/dist/util/dotenv.js.map +0 -7
- package/dist/util/error.js +0 -36
- package/dist/util/error.js.map +0 -7
- package/dist/util/fetch.js +0 -69
- package/dist/util/fetch.js.map +0 -7
- package/dist/util/find.js +0 -39
- package/dist/util/find.js.map +0 -7
- package/dist/util/git.js +0 -145
- package/dist/util/git.js.map +0 -7
- package/dist/util/gitignore.js +0 -61
- package/dist/util/gitignore.js.map +0 -7
- package/dist/util/html.formatter.js +0 -70
- package/dist/util/html.formatter.js.map +0 -7
- package/dist/util/index.js +0 -68
- package/dist/util/index.js.map +0 -7
- package/dist/util/json.formatter.js +0 -66
- package/dist/util/json.formatter.js.map +0 -7
- package/dist/util/logger.js +0 -304
- package/dist/util/logger.js.map +0 -7
- package/dist/util/os.js +0 -46
- package/dist/util/os.js.map +0 -7
- package/dist/util/timers.js +0 -49
- package/dist/util/timers.js.map +0 -7
- package/dist/util/xml.formatter.js +0 -62
- package/dist/util/xml.formatter.js.map +0 -7
- package/dist/util/yaml.js +0 -44
- package/dist/util/yaml.js.map +0 -7
- package/dist/version.js +0 -29
- package/dist/version.js.map +0 -7
|
@@ -5,11 +5,14 @@ import inquirer from 'inquirer';
|
|
|
5
5
|
import fetch from 'node-fetch';
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import clone from 'rfdc';
|
|
8
|
+
import type { CommanderError } from 'commander';
|
|
8
9
|
|
|
9
10
|
import { Component, ContentType, Project } from 'contensis-core-api';
|
|
10
11
|
import {
|
|
12
|
+
ICreateNode,
|
|
11
13
|
ICreateTag,
|
|
12
14
|
ICreateTagGroup,
|
|
15
|
+
Node,
|
|
13
16
|
Role,
|
|
14
17
|
Tag,
|
|
15
18
|
TagGroup,
|
|
@@ -23,6 +26,7 @@ import {
|
|
|
23
26
|
Model,
|
|
24
27
|
BlockActionType,
|
|
25
28
|
logEntitiesTable,
|
|
29
|
+
Renderer,
|
|
26
30
|
} from 'migratortron';
|
|
27
31
|
|
|
28
32
|
import ContensisAuthService from './ContensisAuthService';
|
|
@@ -71,9 +75,9 @@ import { GetTagGroupsArgs } from 'migratortron/dist/services/TagGroupsMigrationS
|
|
|
71
75
|
let insecurePasswordWarningShown = false;
|
|
72
76
|
|
|
73
77
|
class ContensisCli {
|
|
74
|
-
static quit = (error?:
|
|
78
|
+
static quit = (error?: CommanderError) => {
|
|
75
79
|
process.removeAllListeners('exit');
|
|
76
|
-
const exitCode = error ? 1 : 0;
|
|
80
|
+
const exitCode = error?.exitCode ?? (error ? 1 : 0);
|
|
77
81
|
|
|
78
82
|
// console.info(`\nExiting contensis-cli with exit code: ${exitCode}\n`);
|
|
79
83
|
process.exit(exitCode);
|
|
@@ -94,6 +98,9 @@ class ContensisCli {
|
|
|
94
98
|
targetEnv?: string;
|
|
95
99
|
urls: CliUrls;
|
|
96
100
|
log = Logger;
|
|
101
|
+
/** Currently used to pass to other modules such as migratortron and request handler
|
|
102
|
+
* and less-so in the CLI service itself */
|
|
103
|
+
logLevel?: 'debug' | 'info' | 'warning' | 'error' | 'none';
|
|
97
104
|
messages = LogMessages;
|
|
98
105
|
|
|
99
106
|
verb: string;
|
|
@@ -157,6 +164,7 @@ class ContensisCli {
|
|
|
157
164
|
);
|
|
158
165
|
}
|
|
159
166
|
|
|
167
|
+
this.logLevel = outputOpts?.logLevel;
|
|
160
168
|
this.format = outputOpts?.format;
|
|
161
169
|
this.output = outputOpts?.output
|
|
162
170
|
? path.isAbsolute(outputOpts.output)
|
|
@@ -2398,7 +2406,12 @@ class ContensisCli {
|
|
|
2398
2406
|
!result?.errors?.length &&
|
|
2399
2407
|
((!commit && result?.entriesToMigrate[currentProject].totalCount) ||
|
|
2400
2408
|
(commit &&
|
|
2401
|
-
(result?.migrateResult?.created ||
|
|
2409
|
+
(result?.migrateResult?.created ||
|
|
2410
|
+
result?.migrateResult?.updated ||
|
|
2411
|
+
result?.nodesResult?.created ||
|
|
2412
|
+
result?.nodesResult?.updated ||
|
|
2413
|
+
result?.tagsResult?.created ||
|
|
2414
|
+
result?.tagsResult?.updated)))
|
|
2402
2415
|
) {
|
|
2403
2416
|
log.success(
|
|
2404
2417
|
messages.entries.imported(
|
|
@@ -2770,6 +2783,168 @@ class ContensisCli {
|
|
|
2770
2783
|
}
|
|
2771
2784
|
};
|
|
2772
2785
|
|
|
2786
|
+
CreateOrUpdateNode = async (
|
|
2787
|
+
nodePathOrId: string,
|
|
2788
|
+
nodeUpdates: Partial<Node>,
|
|
2789
|
+
displayName?: string | undefined,
|
|
2790
|
+
slug?: string | undefined,
|
|
2791
|
+
language?: string | undefined
|
|
2792
|
+
) => {
|
|
2793
|
+
const { currentEnv, currentProject, log, messages } = this;
|
|
2794
|
+
const contensis = await this.ConnectContensis();
|
|
2795
|
+
|
|
2796
|
+
const nodePath = nodePathOrId.startsWith('/') ? nodePathOrId : undefined;
|
|
2797
|
+
let nodeId = isUuid(nodePathOrId) ? nodePathOrId : undefined;
|
|
2798
|
+
|
|
2799
|
+
let existingNode: Node | undefined;
|
|
2800
|
+
let parentNode: Node | undefined;
|
|
2801
|
+
let updateNode: Node | undefined;
|
|
2802
|
+
|
|
2803
|
+
if (contensis) {
|
|
2804
|
+
// Retrieve node
|
|
2805
|
+
if (nodePath) {
|
|
2806
|
+
const [, nodesByPath] = await to(contensis.nodes.GetNodes(nodePath, 0));
|
|
2807
|
+
|
|
2808
|
+
if (Array.isArray(nodesByPath) && nodesByPath[0]?.id) {
|
|
2809
|
+
nodeId = nodesByPath[0].id;
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2812
|
+
|
|
2813
|
+
if (nodeId) {
|
|
2814
|
+
// Get the management node so we can update it
|
|
2815
|
+
const [, nodeById] = await to(
|
|
2816
|
+
contensis.source.repo.GetNodeById(nodeId)
|
|
2817
|
+
);
|
|
2818
|
+
|
|
2819
|
+
if (nodeById) existingNode = nodeById;
|
|
2820
|
+
}
|
|
2821
|
+
|
|
2822
|
+
// Resolve a friendly renderer id/name to its uuid for ease of use
|
|
2823
|
+
const rendererRef = nodeUpdates.renderer?.id;
|
|
2824
|
+
if (rendererRef && !isUuid(rendererRef)) {
|
|
2825
|
+
const [, renderers] = await contensis.renderers.GetRenderers();
|
|
2826
|
+
const match = renderers?.find(
|
|
2827
|
+
r =>
|
|
2828
|
+
r.id?.toLowerCase() === rendererRef.toLowerCase() ||
|
|
2829
|
+
r.name?.toLowerCase() === rendererRef.toLowerCase()
|
|
2830
|
+
);
|
|
2831
|
+
if (match) {
|
|
2832
|
+
log.info(
|
|
2833
|
+
messages.renderers.resolved(
|
|
2834
|
+
currentEnv,
|
|
2835
|
+
rendererRef,
|
|
2836
|
+
match.uuid
|
|
2837
|
+
)
|
|
2838
|
+
);
|
|
2839
|
+
nodeUpdates.renderer.id = match.uuid;
|
|
2840
|
+
} else {
|
|
2841
|
+
log.error(
|
|
2842
|
+
messages.renderers.failedGet(currentEnv, rendererRef, currentProject)
|
|
2843
|
+
);
|
|
2844
|
+
return;
|
|
2845
|
+
}
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2848
|
+
if (!existingNode) {
|
|
2849
|
+
// Build a node object to create or reject if there is not enough data
|
|
2850
|
+
|
|
2851
|
+
if (!language) {
|
|
2852
|
+
const project =
|
|
2853
|
+
await contensis.source.repo.GetProject(currentProject);
|
|
2854
|
+
language = project?.primaryLanguage || 'en-GB';
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2857
|
+
if (!nodeUpdates.parentId) {
|
|
2858
|
+
// Find the node's parentId from the path if possible
|
|
2859
|
+
if (!nodePath)
|
|
2860
|
+
throw new Error(
|
|
2861
|
+
`A node with id "${nodeId}" does not exist, and a path was not provided to find the parent node.`
|
|
2862
|
+
);
|
|
2863
|
+
|
|
2864
|
+
const parentPath =
|
|
2865
|
+
nodePath.substring(0, nodePath.lastIndexOf('/')) || '/';
|
|
2866
|
+
const [, parentNodesByPath] = await to(
|
|
2867
|
+
contensis.nodes.GetNodes(parentPath, 0)
|
|
2868
|
+
);
|
|
2869
|
+
|
|
2870
|
+
if (!parentNodesByPath?.[0]?.id)
|
|
2871
|
+
throw new Error(
|
|
2872
|
+
`A node with id "${nodeId}" does not exist, and the parent node could not be found at path "${parentPath}".`
|
|
2873
|
+
);
|
|
2874
|
+
else parentNode = parentNodesByPath[0] as unknown as Node;
|
|
2875
|
+
}
|
|
2876
|
+
const pathSlug = nodePath?.substring(nodePath.lastIndexOf('/') + 1);
|
|
2877
|
+
|
|
2878
|
+
const createNode: ICreateNode = {
|
|
2879
|
+
id: nodeId,
|
|
2880
|
+
parentId: nodeUpdates.parentId || parentNode?.id,
|
|
2881
|
+
projectId: currentProject,
|
|
2882
|
+
displayName: displayName
|
|
2883
|
+
? {
|
|
2884
|
+
[language]: displayName,
|
|
2885
|
+
}
|
|
2886
|
+
: nodeUpdates.displayName
|
|
2887
|
+
? nodeUpdates.displayName
|
|
2888
|
+
: pathSlug
|
|
2889
|
+
? {
|
|
2890
|
+
[language]: pathSlug,
|
|
2891
|
+
}
|
|
2892
|
+
: (undefined as any),
|
|
2893
|
+
slug: slug
|
|
2894
|
+
? {
|
|
2895
|
+
[language]: slug,
|
|
2896
|
+
}
|
|
2897
|
+
: nodeUpdates.slug
|
|
2898
|
+
? nodeUpdates.slug
|
|
2899
|
+
: pathSlug
|
|
2900
|
+
? {
|
|
2901
|
+
[language]: pathSlug,
|
|
2902
|
+
}
|
|
2903
|
+
: (undefined as any),
|
|
2904
|
+
entryId: nodeUpdates.entryId,
|
|
2905
|
+
isCanonical: nodeUpdates.isCanonical,
|
|
2906
|
+
renderer: nodeUpdates.renderer,
|
|
2907
|
+
proxy: nodeUpdates.proxy,
|
|
2908
|
+
includeInMenu: nodeUpdates.includeInMenu,
|
|
2909
|
+
};
|
|
2910
|
+
|
|
2911
|
+
// Validate createNode
|
|
2912
|
+
updateNode = createNode as Node;
|
|
2913
|
+
} else {
|
|
2914
|
+
updateNode = { ...existingNode, ...nodeUpdates };
|
|
2915
|
+
}
|
|
2916
|
+
|
|
2917
|
+
if (updateNode) {
|
|
2918
|
+
log.info(messages.nodes.setPayload());
|
|
2919
|
+
log.object(updateNode);
|
|
2920
|
+
log.raw('');
|
|
2921
|
+
const [err, newNode] = await contensis.source.repo.UpdateOrCreateNode(
|
|
2922
|
+
existingNode as Node,
|
|
2923
|
+
updateNode
|
|
2924
|
+
);
|
|
2925
|
+
|
|
2926
|
+
if (err)
|
|
2927
|
+
log.error(
|
|
2928
|
+
messages.nodes[existingNode ? 'failedSet' : 'failedCreate'](
|
|
2929
|
+
currentEnv,
|
|
2930
|
+
nodePathOrId
|
|
2931
|
+
),
|
|
2932
|
+
err
|
|
2933
|
+
);
|
|
2934
|
+
else if (newNode) {
|
|
2935
|
+
log.success(
|
|
2936
|
+
messages.nodes[existingNode ? 'set' : 'created'](
|
|
2937
|
+
currentEnv,
|
|
2938
|
+
newNode.id
|
|
2939
|
+
)
|
|
2940
|
+
);
|
|
2941
|
+
|
|
2942
|
+
await this.HandleFormattingAndOutput(newNode, log.object);
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
};
|
|
2947
|
+
|
|
2773
2948
|
PrintWebhookSubscriptions = async (subscriptionIdsOrNames?: string[]) => {
|
|
2774
2949
|
const { currentEnv, log, messages } = this;
|
|
2775
2950
|
const contensis = await this.ConnectContensis();
|
|
@@ -3368,7 +3543,6 @@ class ContensisCli {
|
|
|
3368
3543
|
}
|
|
3369
3544
|
};
|
|
3370
3545
|
|
|
3371
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3372
3546
|
PrintRenderers = async (rendererId?: string) => {
|
|
3373
3547
|
const { currentEnv, env, log, messages } = this;
|
|
3374
3548
|
const contensis = await this.ConnectContensis();
|
|
@@ -3377,19 +3551,27 @@ class ContensisCli {
|
|
|
3377
3551
|
const [err, renderers] = await contensis.renderers.GetRenderers();
|
|
3378
3552
|
|
|
3379
3553
|
if (Array.isArray(renderers)) {
|
|
3380
|
-
|
|
3554
|
+
const result = rendererId
|
|
3555
|
+
? ([renderers.find(r => r.id === rendererId)].filter(
|
|
3556
|
+
Boolean
|
|
3557
|
+
) as Renderer[])
|
|
3558
|
+
: renderers || [];
|
|
3559
|
+
|
|
3560
|
+
await this.HandleFormattingAndOutput(result, () => {
|
|
3381
3561
|
// print the renderers to console
|
|
3382
3562
|
log.success(messages.renderers.list(currentEnv, env.currentProject));
|
|
3383
3563
|
for (const {
|
|
3564
|
+
uuid,
|
|
3384
3565
|
id,
|
|
3385
3566
|
description,
|
|
3386
3567
|
assignedContentTypes,
|
|
3387
3568
|
rules,
|
|
3388
3569
|
version,
|
|
3389
|
-
} of
|
|
3570
|
+
} of result) {
|
|
3390
3571
|
console.log(
|
|
3391
3572
|
` - ${id} [${version.versionNo}] ${log.infoText`${description}`}`
|
|
3392
3573
|
);
|
|
3574
|
+
console.log(log.infoText` uuid: ${uuid}`);
|
|
3393
3575
|
if (assignedContentTypes?.length)
|
|
3394
3576
|
console.log(
|
|
3395
3577
|
log.infoText` assignedContentTypes: ${assignedContentTypes.join(
|
|
@@ -3405,7 +3587,7 @@ class ContensisCli {
|
|
|
3405
3587
|
);
|
|
3406
3588
|
}
|
|
3407
3589
|
});
|
|
3408
|
-
return
|
|
3590
|
+
return result;
|
|
3409
3591
|
}
|
|
3410
3592
|
|
|
3411
3593
|
if (err) {
|
package/src/shell.ts
CHANGED
|
@@ -142,12 +142,15 @@ class ContensisShell {
|
|
|
142
142
|
'login',
|
|
143
143
|
'list projects',
|
|
144
144
|
'set project',
|
|
145
|
-
...(this.env?.projects || []).map(
|
|
145
|
+
...(this.env?.projects || []).map(
|
|
146
|
+
project => `set project ${project.id}`
|
|
147
|
+
)
|
|
146
148
|
);
|
|
147
149
|
if (userId)
|
|
148
150
|
availableCommands.push(
|
|
149
151
|
'copy field',
|
|
150
152
|
'create key',
|
|
153
|
+
'create node',
|
|
151
154
|
'create project',
|
|
152
155
|
'create role',
|
|
153
156
|
'create tag',
|
|
@@ -208,6 +211,8 @@ class ContensisShell {
|
|
|
208
211
|
'remove tags',
|
|
209
212
|
'remove tags in',
|
|
210
213
|
'remove taggroup',
|
|
214
|
+
'set node entry',
|
|
215
|
+
'set node renderer',
|
|
211
216
|
'set project name',
|
|
212
217
|
'set project description',
|
|
213
218
|
'set role name',
|
package/src/util/logger.ts
CHANGED
|
@@ -322,11 +322,10 @@ export const logError: LogErrorFunc = (
|
|
|
322
322
|
export const addNewLines = (
|
|
323
323
|
message = '',
|
|
324
324
|
newLineSeparater = '\n',
|
|
325
|
-
atPosition = process.stdout.columns
|
|
325
|
+
atPosition = process.stdout.columns || 0
|
|
326
326
|
) => {
|
|
327
|
-
if (message === ''
|
|
328
|
-
|
|
329
|
-
}
|
|
327
|
+
if (message === '') return '';
|
|
328
|
+
if (atPosition === 0) return message;
|
|
330
329
|
|
|
331
330
|
let result = '';
|
|
332
331
|
let lengthCounter = 0;
|
package/src/util/os.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import os from 'os';
|
|
2
2
|
|
|
3
|
+
export const isWindows = () => os.platform() === 'win32';
|
|
4
|
+
|
|
3
5
|
export const winSlash = (str: string) =>
|
|
4
|
-
|
|
6
|
+
isWindows() ? str.replaceAll('/', '\\') : str;
|
|
5
7
|
|
|
6
8
|
export const linuxSlash = (str: string) =>
|
|
7
|
-
|
|
9
|
+
!isWindows() ? str.replaceAll('\\', '/') : str;
|
|
8
10
|
|
|
9
11
|
export const normaliseLineEndings = (
|
|
10
12
|
str: string,
|
|
11
|
-
lineEnd =
|
|
13
|
+
lineEnd = isWindows() ? '\r\n' : '\n'
|
|
12
14
|
) => str.replace(/\r?\n/g, lineEnd);
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "1.6.1-beta.
|
|
1
|
+
export const LIB_VERSION = "1.6.1-beta.25";
|
package/dist/commands/connect.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
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 connect_exports = {};
|
|
20
|
-
__export(connect_exports, {
|
|
21
|
-
makeConnectCommand: () => makeConnectCommand
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(connect_exports);
|
|
24
|
-
var import_commander = require("commander");
|
|
25
|
-
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
26
|
-
var import_shell = require("../shell");
|
|
27
|
-
var import_globalOptions = require("./globalOptions");
|
|
28
|
-
const makeConnectCommand = () => {
|
|
29
|
-
const connect = new import_commander.Command().command("connect").description("connect to a Contensis instance").argument("<alias>", "the Contensis Cloud alias to connect with").addOption(import_globalOptions.project).usage("<alias>").addHelpText(
|
|
30
|
-
"after",
|
|
31
|
-
`
|
|
32
|
-
Example call:
|
|
33
|
-
> connect example-dev`
|
|
34
|
-
).action(async (alias, opts) => {
|
|
35
|
-
await (0, import_ContensisCliService.cliCommand)(["connect", alias], { ...opts, alias }).Connect(alias);
|
|
36
|
-
await (0, import_shell.shell)().restart();
|
|
37
|
-
});
|
|
38
|
-
return connect;
|
|
39
|
-
};
|
|
40
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
-
0 && (module.exports = {
|
|
42
|
-
makeConnectCommand
|
|
43
|
-
});
|
|
44
|
-
//# sourceMappingURL=connect.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/commands/connect.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { shell } from '~/shell';\nimport { project } from './globalOptions';\n\nexport const makeConnectCommand = () => {\n const connect = new Command()\n .command('connect')\n .description('connect to a Contensis instance')\n .argument('<alias>', 'the Contensis Cloud alias to connect with')\n .addOption(project)\n .usage('<alias>')\n .addHelpText(\n 'after',\n `\nExample call:\n > connect example-dev`\n )\n .action(async (alias, opts) => {\n await cliCommand(['connect', alias], { ...opts, alias }).Connect(alias);\n await shell().restart();\n });\n return connect;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,iCAA2B;AAC3B,mBAAsB;AACtB,2BAAwB;AAEjB,MAAM,qBAAqB,MAAM;AACtC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ,SAAS,EACjB,YAAY,iCAAiC,EAC7C,SAAS,WAAW,2CAA2C,EAC/D,UAAU,4BAAO,EACjB,MAAM,SAAS,EACf;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA,EAGF,EACC,OAAO,OAAO,OAAO,SAAS;AAC7B,cAAM,uCAAW,CAAC,WAAW,KAAK,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,EAAE,QAAQ,KAAK;AACtE,cAAM,oBAAM,EAAE,QAAQ;AAAA,EACxB,CAAC;AACH,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/commands/copy.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
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 copy_exports = {};
|
|
20
|
-
__export(copy_exports, {
|
|
21
|
-
makeCopyCommand: () => makeCopyCommand
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(copy_exports);
|
|
24
|
-
var import_commander = require("commander");
|
|
25
|
-
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
26
|
-
var import_globalOptions = require("./globalOptions");
|
|
27
|
-
const makeCopyCommand = () => {
|
|
28
|
-
const copy = new import_commander.Command().command("copy").description("copy command").addHelpText("after", `
|
|
29
|
-
`).showHelpAfterError(true).exitOverride();
|
|
30
|
-
copy.command("field").description("copy the contents of one content type field to another").argument(
|
|
31
|
-
"<contentTypeId>",
|
|
32
|
-
"the api id of the content type containing the fields to copy"
|
|
33
|
-
).argument("<fieldId>", "the id of the field to copy from").argument("<destinationId>", "the id of the field to copy to").option(
|
|
34
|
-
"-t --template <template>",
|
|
35
|
-
"apply a liquidjs template (surrounded by double quotes) to modify the copied field content"
|
|
36
|
-
).option(
|
|
37
|
-
"--root-uri <rootUri>",
|
|
38
|
-
"prefix your public uri to relative links in canvas content"
|
|
39
|
-
).addOption(import_globalOptions.commit).addOption(import_globalOptions.concurrency).addOption(import_globalOptions.ignoreErrors).addOption(import_globalOptions.outputDetail).addOption(import_globalOptions.noCache).addOption(import_globalOptions.noPublish).option(
|
|
40
|
-
"--search <phrase>",
|
|
41
|
-
"get entries with the search phrase, use quotes for multiple words"
|
|
42
|
-
).addOption(import_globalOptions.entryId).addOption(import_globalOptions.zenql).addOption(import_globalOptions.latest).addOption(import_globalOptions.versionStatus).addOption(import_globalOptions.saveEntries).usage("<contentTypeId> <fieldId> <destinationId> (all arguments required)").addHelpText(
|
|
43
|
-
"after",
|
|
44
|
-
`
|
|
45
|
-
Example call:
|
|
46
|
-
> copy field blog authorName contributors
|
|
47
|
-
|
|
48
|
-
> copy field blog description kicker --template "<h2>{{ source_value }}</h2>"
|
|
49
|
-
`
|
|
50
|
-
).action(
|
|
51
|
-
async (contentTypeId, fieldId, destinationId, opts) => {
|
|
52
|
-
const { template, ...restOpts } = opts;
|
|
53
|
-
const copyField = {
|
|
54
|
-
contentTypeId,
|
|
55
|
-
fieldId,
|
|
56
|
-
destinationId,
|
|
57
|
-
template,
|
|
58
|
-
rootUri: opts.rootUri
|
|
59
|
-
};
|
|
60
|
-
return await (0, import_ContensisCliService.cliCommand)(
|
|
61
|
-
["copy", "project", contentTypeId, fieldId, destinationId],
|
|
62
|
-
opts,
|
|
63
|
-
(0, import_globalOptions.mapContensisOpts)({ copyField, ...restOpts })
|
|
64
|
-
).CopyEntryField({
|
|
65
|
-
commit: opts.commit,
|
|
66
|
-
fromFile: opts.fromFile,
|
|
67
|
-
logOutput: opts.outputDetail,
|
|
68
|
-
saveEntries: opts.saveEntries
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
return copy;
|
|
73
|
-
};
|
|
74
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
-
0 && (module.exports = {
|
|
76
|
-
makeCopyCommand
|
|
77
|
-
});
|
|
78
|
-
//# sourceMappingURL=copy.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/commands/copy.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { CopyField } from 'migratortron';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport {\n commit,\n concurrency,\n entryId,\n ignoreErrors,\n latest,\n mapContensisOpts,\n noCache,\n noPublish,\n outputDetail,\n saveEntries,\n versionStatus,\n zenql,\n} from './globalOptions';\n\nexport const makeCopyCommand = () => {\n const copy = new Command()\n .command('copy')\n .description('copy command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n copy\n .command('field')\n .description('copy the contents of one content type field to another')\n .argument(\n '<contentTypeId>',\n 'the api id of the content type containing the fields to copy'\n )\n .argument('<fieldId>', 'the id of the field to copy from')\n .argument('<destinationId>', 'the id of the field to copy to')\n .option(\n '-t --template <template>',\n 'apply a liquidjs template (surrounded by double quotes) to modify the copied field content'\n )\n .option(\n '--root-uri <rootUri>',\n 'prefix your public uri to relative links in canvas content'\n )\n .addOption(commit)\n .addOption(concurrency)\n .addOption(ignoreErrors)\n .addOption(outputDetail)\n .addOption(noCache)\n .addOption(noPublish)\n .option(\n '--search <phrase>',\n 'get entries with the search phrase, use quotes for multiple words'\n )\n .addOption(entryId)\n .addOption(zenql)\n .addOption(latest)\n .addOption(versionStatus)\n .addOption(saveEntries)\n .usage('<contentTypeId> <fieldId> <destinationId> (all arguments required)')\n .addHelpText(\n 'after',\n `\nExample call:\n > copy field blog authorName contributors\\n\n > copy field blog description kicker --template \"<h2>{{ source_value }}</h2>\"\\n`\n )\n .action(\n async (\n contentTypeId: string,\n fieldId: string,\n destinationId: string,\n opts: any\n ) => {\n const { template, ...restOpts } = opts;\n const copyField: CopyField = {\n contentTypeId,\n fieldId,\n destinationId,\n template,\n rootUri: opts.rootUri,\n };\n\n return await cliCommand(\n ['copy', 'project', contentTypeId, fieldId, destinationId],\n opts,\n mapContensisOpts({ copyField, ...restOpts })\n ).CopyEntryField({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputDetail,\n saveEntries: opts.saveEntries,\n });\n }\n );\n\n return copy;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AAExB,iCAA2B;AAC3B,2BAaO;AAEA,MAAM,kBAAkB,MAAM;AACnC,QAAM,OAAO,IAAI,yBAAQ,EACtB,QAAQ,MAAM,EACd,YAAY,cAAc,EAC1B,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,OACG,QAAQ,OAAO,EACf,YAAY,wDAAwD,EACpE;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,SAAS,aAAa,kCAAkC,EACxD,SAAS,mBAAmB,gCAAgC,EAC5D;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,UAAU,2BAAM,EAChB,UAAU,gCAAW,EACrB,UAAU,iCAAY,EACtB,UAAU,iCAAY,EACtB,UAAU,4BAAO,EACjB,UAAU,8BAAS,EACnB;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,UAAU,4BAAO,EACjB,UAAU,0BAAK,EACf,UAAU,2BAAM,EAChB,UAAU,kCAAa,EACvB,UAAU,gCAAW,EACrB,MAAM,oEAAoE,EAC1E;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC;AAAA,IACC,OACE,eACA,SACA,eACA,SACG;AACH,YAAM,EAAE,UAAU,GAAG,SAAS,IAAI;AAClC,YAAM,YAAuB;AAAA,QAC3B;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,SAAS,KAAK;AAAA,MAChB;AAEA,aAAO,UAAM;AAAA,QACX,CAAC,QAAQ,WAAW,eAAe,SAAS,aAAa;AAAA,QACzD;AAAA,YACA,uCAAiB,EAAE,WAAW,GAAG,SAAS,CAAC;AAAA,MAC7C,EAAE,eAAe;AAAA,QACf,QAAQ,KAAK;AAAA,QACb,UAAU,KAAK;AAAA,QACf,WAAW,KAAK;AAAA,QAChB,aAAa,KAAK;AAAA,MACpB,CAAC;AAAA,IACH;AAAA,EACF;AAEF,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/commands/create.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
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 create_exports = {};
|
|
20
|
-
__export(create_exports, {
|
|
21
|
-
makeCreateCommand: () => makeCreateCommand
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(create_exports);
|
|
24
|
-
var import_commander = require("commander");
|
|
25
|
-
var import_globalOptions = require("./globalOptions");
|
|
26
|
-
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
27
|
-
var import_shell = require("../shell");
|
|
28
|
-
var import_api_ids = require("../util/api-ids");
|
|
29
|
-
const makeCreateCommand = () => {
|
|
30
|
-
const create = new import_commander.Command().command("create").description("create command").addHelpText("after", `
|
|
31
|
-
`).showHelpAfterError(true).enablePositionalOptions().exitOverride();
|
|
32
|
-
create.command("project").description("create a new project").argument("<projectId>", "the id of the project to create").argument("<name>", "the name of the project to create").argument("[description]", "optional description of the project").option(
|
|
33
|
-
"-l --language <language>",
|
|
34
|
-
"the default language of the project to create",
|
|
35
|
-
"en-GB"
|
|
36
|
-
).option(
|
|
37
|
-
"-langs --supported-languages <langs...>",
|
|
38
|
-
"space separated list of other supported languages"
|
|
39
|
-
).usage(
|
|
40
|
-
'projectId "Project name" ["Description of project"] --language en-GB --supported-languages es-ES de-DE nl-NL'
|
|
41
|
-
).addHelpText("after", `
|
|
42
|
-
`).action(
|
|
43
|
-
async (projectId, name, description = "", opts) => {
|
|
44
|
-
const createProject = {
|
|
45
|
-
id: projectId,
|
|
46
|
-
name,
|
|
47
|
-
description,
|
|
48
|
-
primaryLanguage: opts.language,
|
|
49
|
-
supportedLanguages: opts.supportedLanguages || [],
|
|
50
|
-
deliverySysExclusions: []
|
|
51
|
-
};
|
|
52
|
-
const project = await (0, import_ContensisCliService.cliCommand)(
|
|
53
|
-
["create", "project", projectId],
|
|
54
|
-
opts
|
|
55
|
-
).CreateProject(createProject);
|
|
56
|
-
if (project) await (0, import_shell.shell)().restart();
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
create.command("key").description("create a new api key").argument('<"key name">', "the name of the key to create").argument('["description"]', "provide a description for the key (optional)").usage('<"key name"> ["description"] (both args in "double quotes")').addHelpText(
|
|
60
|
-
"after",
|
|
61
|
-
`
|
|
62
|
-
Example call:
|
|
63
|
-
> create key "my new key" "Created key for demonstration"
|
|
64
|
-
`
|
|
65
|
-
).action(async (name, description, opts) => {
|
|
66
|
-
await (0, import_ContensisCliService.cliCommand)(["create", "key", name], opts).CreateApiKey(
|
|
67
|
-
name,
|
|
68
|
-
description
|
|
69
|
-
);
|
|
70
|
-
});
|
|
71
|
-
create.command("role").description("create a new role").argument('<"Role name">', "the name of the role to create").argument('["Role description">', "the description of the role").option("--disabled", "do not enable the created role", false).addHelpText(
|
|
72
|
-
"after",
|
|
73
|
-
`
|
|
74
|
-
Example call:
|
|
75
|
-
> create role "My role" "This role is for testing" --disabled
|
|
76
|
-
`
|
|
77
|
-
).action(async (roleName, description, opts) => {
|
|
78
|
-
await (0, import_ContensisCliService.cliCommand)(["create", "role", roleName], opts).CreateRole({
|
|
79
|
-
name: roleName,
|
|
80
|
-
description,
|
|
81
|
-
enabled: !opts.disabled,
|
|
82
|
-
assignments: { apiKeys: [], groups: [], users: [] },
|
|
83
|
-
permissions: { contentTypes: [], entries: [] }
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
create.command("taggroup").description("create a new tag group").argument("<groupId>", "the API id of the tag group to create").argument('<"Name">', "the name of the tag group to create").argument('["Description"]', "a description for the tag group").option(
|
|
87
|
-
"--tags <tagNames...>",
|
|
88
|
-
"a list of tag names to create under the new tag group"
|
|
89
|
-
).addOption(import_globalOptions.commit).addHelpText(
|
|
90
|
-
"after",
|
|
91
|
-
`
|
|
92
|
-
Example call:
|
|
93
|
-
> create taggroup example "Example tags" "This group is a test"
|
|
94
|
-
> create taggroup topics "Topics" --tags Books Faces History Places Spelling
|
|
95
|
-
`
|
|
96
|
-
).action(
|
|
97
|
-
async (groupId, name, description, opts) => {
|
|
98
|
-
var _a;
|
|
99
|
-
const tagGroup = {
|
|
100
|
-
id: groupId,
|
|
101
|
-
name,
|
|
102
|
-
description
|
|
103
|
-
};
|
|
104
|
-
await (0, import_ContensisCliService.cliCommand)(
|
|
105
|
-
["create", "taggroup", groupId, name],
|
|
106
|
-
opts
|
|
107
|
-
).ImportTagGroups({
|
|
108
|
-
commit: opts.commit,
|
|
109
|
-
data: [tagGroup],
|
|
110
|
-
tags: (_a = opts.tags) == null ? void 0 : _a.map((label) => ({
|
|
111
|
-
groupId,
|
|
112
|
-
label: { "en-GB": label },
|
|
113
|
-
value: (0, import_api_ids.toApiId)(label, "camelCase", true)
|
|
114
|
-
}))
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
);
|
|
118
|
-
const tags = create.command("tags").description("create new tags in a tag group").argument('<"Label"...>', "create tag(s) with label(s)").passThroughOptions().option("-in --group <groupId>", "create tags in this tag group").addOption(import_globalOptions.commit).addHelpText(
|
|
119
|
-
"after",
|
|
120
|
-
`
|
|
121
|
-
Example call:
|
|
122
|
-
> create tags "Test tag" --group example
|
|
123
|
-
> create tags Books Faces History Places Spelling -in topics
|
|
124
|
-
`
|
|
125
|
-
).action(async (tagLabels, opts) => {
|
|
126
|
-
var _a;
|
|
127
|
-
const groupId = opts.group;
|
|
128
|
-
const cli = (0, import_ContensisCliService.cliCommand)(["create", "tags", ...tagLabels], opts);
|
|
129
|
-
const language = ((_a = cli.env.projects.find((p) => p.id === cli.env.currentProject)) == null ? void 0 : _a.primaryLanguage) || "en-GB";
|
|
130
|
-
await cli.ImportTags({
|
|
131
|
-
commit: opts.commit,
|
|
132
|
-
data: tagLabels.map((label) => ({
|
|
133
|
-
groupId,
|
|
134
|
-
label: { [language]: label },
|
|
135
|
-
value: (0, import_api_ids.toApiId)(label, "camelCase", true)
|
|
136
|
-
}))
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
tags.command("in").description("create new tags in a tag group").argument("<groupId>", "create tag(s) in this tag group").argument('<"Label"...>', "create tag(s) with label(s)").addOption(import_globalOptions.commit).addHelpText(
|
|
140
|
-
"after",
|
|
141
|
-
`
|
|
142
|
-
Example call:
|
|
143
|
-
> create tags in example "Tag 1" "Second Tag" Third
|
|
144
|
-
> create tags ih topics Books Faces History Places Spelling
|
|
145
|
-
`
|
|
146
|
-
).action(async (groupId, tagLabels, opts, cmd) => {
|
|
147
|
-
var _a;
|
|
148
|
-
const parentOptions = cmd.optsWithGlobals();
|
|
149
|
-
const cli = (0, import_ContensisCliService.cliCommand)(["create", "tags", "in", groupId, ...tagLabels], {
|
|
150
|
-
...opts,
|
|
151
|
-
...parentOptions
|
|
152
|
-
});
|
|
153
|
-
const language = ((_a = cli.env.projects.find((p) => p.id === cli.env.currentProject)) == null ? void 0 : _a.primaryLanguage) || "en-GB";
|
|
154
|
-
await cli.ImportTags({
|
|
155
|
-
commit: parentOptions.commit,
|
|
156
|
-
data: tagLabels.map((label) => ({
|
|
157
|
-
groupId,
|
|
158
|
-
label: { [language]: label },
|
|
159
|
-
value: (0, import_api_ids.toApiId)(label, "camelCase", true)
|
|
160
|
-
}))
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
(0, import_globalOptions.addGlobalOptions)(tags);
|
|
164
|
-
return create;
|
|
165
|
-
};
|
|
166
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
167
|
-
0 && (module.exports = {
|
|
168
|
-
makeCreateCommand
|
|
169
|
-
});
|
|
170
|
-
//# sourceMappingURL=create.js.map
|