@takeshape/cli 8.246.2 → 8.249.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.
@@ -1 +1 @@
1
- {"version":3,"file":"schema-import.d.ts","sourceRoot":"","sources":["../../../../src/commands/import/schema-import.ts"],"names":[],"mappings":";AAoBA,wBA8BG"}
1
+ {"version":3,"file":"schema-import.d.ts","sourceRoot":"","sources":["../../../../src/commands/import/schema-import.ts"],"names":[],"mappings":";AAqBA,wBAkCG"}
@@ -33,7 +33,8 @@ takeshape import --schema --from ./path/to/schema.json
33
33
  Replace your project's schema by uploading a new one
34
34
 
35
35
  Flags:
36
- --from Directory containing a schema.json or path to schema.json file
36
+ --from Directory containing a schema.json or path to schema.json file
37
+ --preserveAuth Do not overwrite service authentication
37
38
  */
38
39
  var _default = (0, _linkedCommand.linkedCommand)(async (cli, params) => {
39
40
  const {
@@ -60,14 +61,16 @@ var _default = (0, _linkedCommand.linkedCommand)(async (cli, params) => {
60
61
 
61
62
  try {
62
63
  const newSchema = JSON.parse(_fsExtra.default.readFileSync(file).toString());
63
- const validationString = (0, _formatValidationResult.formatValidationResult)((0, _schema.validateSchema)(newSchema));
64
+ const validationString = (0, _formatValidationResult.formatValidationResult)((0, _schema.validateSchema)(newSchema, {
65
+ suppressErrorPaths: [..._schema.projectSchemaImportOptionalProps]
66
+ }));
64
67
 
65
68
  if (validationString) {
66
69
  return (0, _fatalError.fatalError)(validationString);
67
70
  }
68
71
 
69
72
  (0, _log.default)(`Uploading schema from ${file}…\n`);
70
- const schemaImportPath = `${(0, _branches.getBranchBasePath)(branchParams, projectId)}/schema?force=true`;
73
+ const schemaImportPath = `${(0, _branches.getBranchBasePath)(branchParams, projectId)}/schema?force=true&preserveAuth=${Boolean(flags.preserveAuth)}`;
71
74
  const uploaded = await (0, _api.default)(params, 'POST', schemaImportPath, newSchema);
72
75
  (0, _log.default)(_chalk.default.green('Success!'), `Schema updated to version ${uploaded.version}.`);
73
76
  process.exit(0);
package/dist/index.js CHANGED
@@ -74,9 +74,10 @@ const help = `
74
74
  --schema import a takeshape schema from a directory or JSON file to the currently linked project
75
75
  --roles import roles from a directory or JSON file to the currently linked project
76
76
 
77
- --from specifies the file, directory, zip or url to import (required)
78
- --to either "new-project" or "current-project" (default "new-project")
79
- --name for use with --project specifies a new name for the imported project
77
+ --from specifies the file, directory, zip or url to import (required)
78
+ --to either "new-project" or "current-project" (default "new-project")
79
+ --name for use with --project specifies a new name for the imported project
80
+ --preserveAuth do not overwrite service authentication
80
81
 
81
82
  export Options
82
83
  One of
package/dist/options.d.ts CHANGED
@@ -69,6 +69,9 @@ export declare const options: {
69
69
  readonly scratch: {
70
70
  readonly type: "boolean";
71
71
  };
72
+ readonly preserveAuth: {
73
+ readonly type: "boolean";
74
+ };
72
75
  };
73
76
  };
74
77
  export declare type Flags = typeof options.flags;
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,MAAM,CAAC;AAE5B,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuEV,CAAC;AAEX,oBAAY,KAAK,GAAG,OAAO,OAAO,CAAC,KAAK,CAAC;AACzC,oBAAY,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,GAAG;IAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;CAAC,CAAC"}
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,MAAM,CAAC;AAE5B,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0EV,CAAC;AAEX,oBAAY,KAAK,GAAG,OAAO,OAAO,CAAC,KAAK,CAAC;AACzC,oBAAY,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,GAAG;IAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;CAAC,CAAC"}
package/dist/options.js CHANGED
@@ -73,6 +73,9 @@ const options = {
73
73
  },
74
74
  scratch: {
75
75
  type: 'boolean'
76
+ },
77
+ preserveAuth: {
78
+ type: 'boolean'
76
79
  }
77
80
  }
78
81
  };
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/util/api.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AAanC,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAG1C;AAED,wBAAgB,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMxE;AAED,wBAA8B,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CA0B3G"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/util/api.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AAanC,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAG1C;AAED,wBAAgB,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMxE;AAED,wBAA8B,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CA6B3G"}
package/dist/util/api.js CHANGED
@@ -59,10 +59,14 @@ async function api(params, method, path, body) {
59
59
  const res = await (0, _nodeFetch.default)(endpoint, requestParams);
60
60
 
61
61
  if (res.ok) {
62
- const contentLength = parseInt(res.headers.get('content-length') ?? '0', 10);
62
+ const contentLengthHeader = res.headers.get('content-length');
63
63
 
64
- if (contentLength === 0) {
65
- return;
64
+ if (contentLengthHeader !== null) {
65
+ const contentLength = parseInt(contentLengthHeader, 10);
66
+
67
+ if (contentLength === 0) {
68
+ return;
69
+ }
66
70
  }
67
71
 
68
72
  return res.json();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeshape/cli",
3
- "version": "8.246.2",
3
+ "version": "8.249.0",
4
4
  "description": "TakeShape CLI",
5
5
  "homepage": "https://www.takeshape.io",
6
6
  "repository": {
@@ -25,10 +25,10 @@
25
25
  "@graphql-codegen/typescript": "^2.4.5",
26
26
  "@graphql-tools/graphql-file-loader": "^7.3.3",
27
27
  "@graphql-tools/load": "^7.5.1",
28
- "@takeshape/schema": "8.246.2",
29
- "@takeshape/ssg": "8.246.2",
30
- "@takeshape/streams": "8.246.2",
31
- "@takeshape/util": "8.246.2",
28
+ "@takeshape/schema": "8.249.0",
29
+ "@takeshape/ssg": "8.249.0",
30
+ "@takeshape/streams": "8.249.0",
31
+ "@takeshape/util": "8.249.0",
32
32
  "archiver": "^1.3.0",
33
33
  "async-retry": "^1.2.1",
34
34
  "bluebird": "^3.4.6",