@contentstack/cli-cm-seed 1.3.0 → 1.4.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.
|
@@ -7,7 +7,7 @@ class SeedCommand extends cli_command_1.Command {
|
|
|
7
7
|
async run() {
|
|
8
8
|
try {
|
|
9
9
|
const { flags: seedFlags } = await this.parse(SeedCommand);
|
|
10
|
-
if (!
|
|
10
|
+
if (!(0, cli_utilities_1.isAuthenticated)()) {
|
|
11
11
|
this.error('You need to login, first. See: auth:login --help', {
|
|
12
12
|
exit: 2,
|
|
13
13
|
suggestions: ['https://www.contentstack.com/docs/developers/cli/authentication/'],
|
|
@@ -17,13 +17,13 @@ class SeedCommand extends cli_command_1.Command {
|
|
|
17
17
|
parent: this,
|
|
18
18
|
cdaHost: this.cdaHost,
|
|
19
19
|
cmaHost: this.cmaHost,
|
|
20
|
-
authToken: this.authToken,
|
|
21
20
|
gitHubPath: seedFlags.repo,
|
|
22
21
|
orgUid: seedFlags.org,
|
|
23
22
|
stackUid: seedFlags['stack-api-key'] || seedFlags.stack,
|
|
24
23
|
stackName: seedFlags['stack-name'],
|
|
25
24
|
fetchLimit: seedFlags['fetch-limit'],
|
|
26
25
|
skipStackConfirmation: seedFlags['yes'],
|
|
26
|
+
isAuthenticated: (0, cli_utilities_1.isAuthenticated)(),
|
|
27
27
|
};
|
|
28
28
|
const seeder = new seed_1.default(options);
|
|
29
29
|
const result = await seeder.run();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// @ts-nocheck
|
|
3
4
|
const error_1 = require("./error");
|
|
4
5
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
5
6
|
class ContentstackClient {
|
|
@@ -60,7 +61,15 @@ class ContentstackClient {
|
|
|
60
61
|
async getStacks(org_uid, skip = 0, stacks = []) {
|
|
61
62
|
try {
|
|
62
63
|
const client = await this.instance;
|
|
63
|
-
const response = await client
|
|
64
|
+
const response = await client
|
|
65
|
+
.stack({ organization_uid: org_uid })
|
|
66
|
+
.query({
|
|
67
|
+
limit: this.limit,
|
|
68
|
+
include_count: true,
|
|
69
|
+
skip: skip,
|
|
70
|
+
query: {}
|
|
71
|
+
})
|
|
72
|
+
.find();
|
|
64
73
|
stacks = stacks.concat(response.items.map((s) => {
|
|
65
74
|
return {
|
|
66
75
|
uid: s.uid,
|
package/lib/seed/importer.d.ts
CHANGED
package/lib/seed/importer.js
CHANGED
|
@@ -9,6 +9,6 @@ async function run(options) {
|
|
|
9
9
|
process.chdir(options.tmpPath);
|
|
10
10
|
// moving here to fix jest testing bug
|
|
11
11
|
const { parametersWithAuthToken } = require('@contentstack/cli-cm-import/src/lib/util/import-flags');
|
|
12
|
-
await parametersWithAuthToken(options.
|
|
12
|
+
await parametersWithAuthToken(options.api_key, importPath, '', options.cmaHost, '', {});
|
|
13
13
|
}
|
|
14
14
|
exports.run = run;
|
package/lib/seed/index.d.ts
CHANGED
|
@@ -5,13 +5,13 @@ export interface ContentModelSeederOptions {
|
|
|
5
5
|
parent?: any;
|
|
6
6
|
cdaHost: string;
|
|
7
7
|
cmaHost: string;
|
|
8
|
-
authToken: string;
|
|
9
8
|
gitHubPath: string | undefined;
|
|
10
9
|
orgUid: string | undefined;
|
|
11
10
|
stackUid: string | undefined;
|
|
12
11
|
stackName: string | undefined;
|
|
13
12
|
fetchLimit: string | undefined;
|
|
14
13
|
skipStackConfirmation: string | undefined;
|
|
14
|
+
isAuthenticated: boolean | false;
|
|
15
15
|
}
|
|
16
16
|
export default class ContentModelSeeder {
|
|
17
17
|
options: ContentModelSeederOptions;
|
package/lib/seed/index.js
CHANGED
|
@@ -46,11 +46,11 @@ class ContentModelSeeder {
|
|
|
46
46
|
cli_utilities_1.cliux.print(`Importing into '${stackResponse.name}'.`);
|
|
47
47
|
await importer.run({
|
|
48
48
|
api_key: api_key,
|
|
49
|
-
authToken: this.options.authToken,
|
|
50
49
|
cdaHost: this.options.cdaHost,
|
|
51
50
|
cmaHost: this.options.cmaHost,
|
|
52
51
|
master_locale: exports.ENGLISH_LOCALE,
|
|
53
52
|
tmpPath: tmpPath,
|
|
53
|
+
isAuthenticated: this.options.isAuthenticated,
|
|
54
54
|
});
|
|
55
55
|
return { api_key };
|
|
56
56
|
}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-seed",
|
|
3
3
|
"description": "create a Stack from existing content types, entries, assets, etc.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.1",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@contentstack/cli-cm-import": "^1.
|
|
9
|
-
"@contentstack/cli-command": "^1.2.
|
|
10
|
-
"@contentstack/cli-utilities": "^1.
|
|
8
|
+
"@contentstack/cli-cm-import": "^1.5.1",
|
|
9
|
+
"@contentstack/cli-command": "^1.2.2",
|
|
10
|
+
"@contentstack/cli-utilities": "^1.3.1",
|
|
11
11
|
"@contentstack/management": "^1.6.1",
|
|
12
12
|
"@oclif/core": "^2.3.0",
|
|
13
13
|
"axios": "1.3.4",
|
|
@@ -58,6 +58,10 @@
|
|
|
58
58
|
"csdxConfig": {
|
|
59
59
|
"expiredCommands": {
|
|
60
60
|
"cm:seed": "csdx cm:stacks:seed"
|
|
61
|
+
},
|
|
62
|
+
"shortCommandName": {
|
|
63
|
+
"cm:stacks:seed": "SEED",
|
|
64
|
+
"cm:seed": "O-SEED"
|
|
61
65
|
}
|
|
62
66
|
},
|
|
63
67
|
"repository": "contentstack/cli",
|