@ama-sdk/core 11.0.0-prerelease.3 → 11.0.0-prerelease.6
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/cjs/fwk/core/base-api-constructor.js +5 -1
- package/cjs/plugins/abort/abort.fetch.js +5 -1
- package/cjs/utils/generators.js +25 -0
- package/cjs/utils/index.js +1 -0
- package/cli/update-spec-from-npm.cjs +13 -7
- package/esm2015/fwk/core/base-api-constructor.js +5 -1
- package/esm2015/plugins/abort/abort.fetch.js +5 -1
- package/esm2015/utils/generators.js +5 -0
- package/esm2015/utils/index.js +1 -0
- package/package.json +8 -8
- package/src/utils/generators.d.ts +7 -0
- package/src/utils/generators.d.ts.map +1 -0
- package/src/utils/generators.js +9 -0
- package/src/utils/generators.js.map +1 -0
- package/src/utils/index.d.ts +1 -0
- package/src/utils/index.d.ts.map +1 -1
- package/src/utils/index.js +1 -0
- package/src/utils/index.js.map +1 -1
|
@@ -8,6 +8,10 @@ Object.defineProperty(exports, "isConstructorObject", {
|
|
|
8
8
|
return isConstructorObject;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
function _type_of(obj) {
|
|
12
|
+
"@swc/helpers - typeof";
|
|
13
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
14
|
+
}
|
|
11
15
|
function isConstructorObject(args) {
|
|
12
|
-
return !!args && args.length === 1 && !!args[0] &&
|
|
16
|
+
return !!args && args.length === 1 && !!args[0] && _type_of(args[0]) === 'object';
|
|
13
17
|
}
|
|
@@ -40,8 +40,12 @@ function _define_property(obj, key, value) {
|
|
|
40
40
|
}
|
|
41
41
|
return obj;
|
|
42
42
|
}
|
|
43
|
+
function _type_of(obj) {
|
|
44
|
+
"@swc/helpers - typeof";
|
|
45
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
46
|
+
}
|
|
43
47
|
var isPromise = function(result) {
|
|
44
|
-
if (typeof result !== 'object') {
|
|
48
|
+
if ((typeof result === "undefined" ? "undefined" : _type_of(result)) !== 'object') {
|
|
45
49
|
return false;
|
|
46
50
|
}
|
|
47
51
|
return true;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// TODO: Change to `openapi` in v11 (ref: #1745)
|
|
2
|
+
/** Name of the specification file copied locally (without extension) */ "use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
LOCAL_SPEC_FILENAME: function() {
|
|
14
|
+
return LOCAL_SPEC_FILENAME;
|
|
15
|
+
},
|
|
16
|
+
SPEC_JSON_EXTENSION: function() {
|
|
17
|
+
return SPEC_JSON_EXTENSION;
|
|
18
|
+
},
|
|
19
|
+
SPEC_YAML_EXTENSION: function() {
|
|
20
|
+
return SPEC_YAML_EXTENSION;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
var LOCAL_SPEC_FILENAME = 'swagger-spec';
|
|
24
|
+
var SPEC_YAML_EXTENSION = 'yaml';
|
|
25
|
+
var SPEC_JSON_EXTENSION = 'yaml';
|
package/cjs/utils/index.js
CHANGED
|
@@ -8,6 +8,7 @@ _export_star(require("./ie11"), exports);
|
|
|
8
8
|
_export_star(require("./json-token"), exports);
|
|
9
9
|
_export_star(require("./mime-types"), exports);
|
|
10
10
|
_export_star(require("./generic-api"), exports);
|
|
11
|
+
_export_star(require("./generators"), exports);
|
|
11
12
|
function _export_star(from, to) {
|
|
12
13
|
Object.keys(from).forEach(function(k) {
|
|
13
14
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -9,13 +9,16 @@ const node_fs_1 = require("node:fs");
|
|
|
9
9
|
const node_module_1 = require("node:module");
|
|
10
10
|
const node_path_1 = require("node:path");
|
|
11
11
|
const promises_1 = require("node:fs/promises");
|
|
12
|
+
const core_1 = require("@ama-sdk/core");
|
|
12
13
|
const argv = minimist(process.argv.slice(2));
|
|
13
14
|
const packageName = argv._[0];
|
|
14
15
|
const { help, output, 'package-path': packagePath, quiet } = argv;
|
|
15
16
|
const openApiConfigDefaultPath = './openapitools.json';
|
|
16
|
-
const supportedExtensions = ['json', 'yaml', 'yml'];
|
|
17
17
|
const noop = () => undefined;
|
|
18
18
|
const logger = quiet ? { error: noop, warn: noop, log: noop, info: noop, debug: noop } : console;
|
|
19
|
+
const SPEC_YML_EXTENSION = 'yml';
|
|
20
|
+
const DEFAULT_SPEC_EXPORT_PATH_IN_NPM_MODULE = 'openapi';
|
|
21
|
+
const supportedExtensions = [core_1.SPEC_JSON_EXTENSION, core_1.SPEC_YAML_EXTENSION, SPEC_YML_EXTENSION];
|
|
19
22
|
if (help) {
|
|
20
23
|
// eslint-disable-next-line no-console
|
|
21
24
|
console.log(`This script can be used to update your local spec file from a given locally installed npm package.
|
|
@@ -23,7 +26,7 @@ if (help) {
|
|
|
23
26
|
|
|
24
27
|
package-name The full identifier of the npm package (e.g. @my-scope/my-package)
|
|
25
28
|
--package-path The relative path inside the npm package where to find the spec file (default: './openapi.yml')
|
|
26
|
-
--output The path where the spec file should be copied (default: '
|
|
29
|
+
--output The path where the spec file should be copied (default: './${core_1.LOCAL_SPEC_FILENAME}.${core_1.SPEC_YAML_EXTENSION}')
|
|
27
30
|
--quiet Don't log anything
|
|
28
31
|
`);
|
|
29
32
|
process.exit(0);
|
|
@@ -34,14 +37,14 @@ if (!packageName) {
|
|
|
34
37
|
}
|
|
35
38
|
void (async () => {
|
|
36
39
|
let specSourcePath;
|
|
37
|
-
const appRequire = (0, node_module_1.createRequire)(
|
|
40
|
+
const appRequire = (0, node_module_1.createRequire)(node_path_1.posix.join(process.cwd(), 'package.json'));
|
|
38
41
|
const packageJsonPath = appRequire.resolve(`${packageName}/package.json`);
|
|
39
42
|
if (!packagePath) {
|
|
40
43
|
const packageJson = JSON.parse(await (0, promises_1.readFile)(packageJsonPath, { encoding: 'utf8' }));
|
|
41
|
-
const exportMatcher = new RegExp(
|
|
44
|
+
const exportMatcher = new RegExp(`^\\./${DEFAULT_SPEC_EXPORT_PATH_IN_NPM_MODULE}\\.(?:${supportedExtensions.join('|')})$`);
|
|
42
45
|
const matchingExport = packageJson.exports && Object.keys(packageJson.exports).find((exportPath) => exportMatcher.test(exportPath));
|
|
43
46
|
if (matchingExport) {
|
|
44
|
-
specSourcePath = appRequire.resolve(
|
|
47
|
+
specSourcePath = appRequire.resolve(node_path_1.posix.join(packageName, matchingExport));
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
else {
|
|
@@ -53,8 +56,11 @@ void (async () => {
|
|
|
53
56
|
}
|
|
54
57
|
let specDestinationPath = output;
|
|
55
58
|
if (!specDestinationPath) {
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
let specSourceExtension = (0, node_path_1.extname)(specSourcePath);
|
|
60
|
+
if (specSourceExtension === `.${SPEC_YML_EXTENSION}`) {
|
|
61
|
+
specSourceExtension = `.${core_1.SPEC_YAML_EXTENSION}`;
|
|
62
|
+
}
|
|
63
|
+
specDestinationPath = `./${core_1.LOCAL_SPEC_FILENAME}${specSourceExtension}`;
|
|
58
64
|
if ((0, node_fs_1.existsSync)(openApiConfigDefaultPath)) {
|
|
59
65
|
const openApiConfig = JSON.parse(await (0, promises_1.readFile)(openApiConfigDefaultPath, { encoding: 'utf8' }));
|
|
60
66
|
const generators = Object.values(openApiConfig['generator-cli']?.generators ?? {});
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
function _type_of(obj) {
|
|
2
|
+
"@swc/helpers - typeof";
|
|
3
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
4
|
+
}
|
|
1
5
|
/**
|
|
2
6
|
* Determine if object passed to the constructor is valid
|
|
3
7
|
* @param args
|
|
4
8
|
*/ export function isConstructorObject(args) {
|
|
5
|
-
return !!args && args.length === 1 && !!args[0] &&
|
|
9
|
+
return !!args && args.length === 1 && !!args[0] && _type_of(args[0]) === 'object';
|
|
6
10
|
}
|
|
@@ -30,8 +30,12 @@ function _define_property(obj, key, value) {
|
|
|
30
30
|
}
|
|
31
31
|
return obj;
|
|
32
32
|
}
|
|
33
|
+
function _type_of(obj) {
|
|
34
|
+
"@swc/helpers - typeof";
|
|
35
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
36
|
+
}
|
|
33
37
|
var isPromise = function(result) {
|
|
34
|
-
if (typeof result !== 'object') {
|
|
38
|
+
if ((typeof result === "undefined" ? "undefined" : _type_of(result)) !== 'object') {
|
|
35
39
|
return false;
|
|
36
40
|
}
|
|
37
41
|
return true;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// TODO: Change to `openapi` in v11 (ref: #1745)
|
|
2
|
+
/** Name of the specification file copied locally (without extension) */ export var LOCAL_SPEC_FILENAME = 'swagger-spec';
|
|
3
|
+
/** Extension of the Specification file in YAML format */ export var SPEC_YAML_EXTENSION = 'yaml';
|
|
4
|
+
// TODO: Change to `json` in v11 (ref: #1745)
|
|
5
|
+
/** Extension of the Specification file in JSON format */ export var SPEC_JSON_EXTENSION = 'yaml';
|
package/esm2015/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ama-sdk/core",
|
|
3
|
-
"version": "11.0.0-prerelease.
|
|
3
|
+
"version": "11.0.0-prerelease.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"prepare:publish": "prepare-publish ./dist"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@swc/helpers": "
|
|
75
|
+
"@swc/helpers": "~0.5.0",
|
|
76
76
|
"tslib": "^2.6.2",
|
|
77
77
|
"uuid": "^9.0.0"
|
|
78
78
|
},
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"@angular-devkit/schematics": "~17.3.0",
|
|
81
81
|
"@angular/cli": "~17.3.0",
|
|
82
82
|
"@angular/common": "~17.3.0",
|
|
83
|
-
"@o3r/schematics": "^11.0.0-prerelease.
|
|
83
|
+
"@o3r/schematics": "^11.0.0-prerelease.6",
|
|
84
84
|
"@schematics/angular": "~17.3.0",
|
|
85
85
|
"chokidar": "^3.5.2",
|
|
86
86
|
"globby": "^11.1.0",
|
|
@@ -126,13 +126,13 @@
|
|
|
126
126
|
"@angular/core": "~17.3.0",
|
|
127
127
|
"@nx/eslint-plugin": "~18.3.0",
|
|
128
128
|
"@nx/jest": "~18.3.0",
|
|
129
|
-
"@o3r/build-helpers": "^11.0.0-prerelease.
|
|
130
|
-
"@o3r/eslint-plugin": "^11.0.0-prerelease.
|
|
131
|
-
"@o3r/test-helpers": "^11.0.0-prerelease.
|
|
129
|
+
"@o3r/build-helpers": "^11.0.0-prerelease.6",
|
|
130
|
+
"@o3r/eslint-plugin": "^11.0.0-prerelease.6",
|
|
131
|
+
"@o3r/test-helpers": "^11.0.0-prerelease.6",
|
|
132
132
|
"@schematics/angular": "~17.3.0",
|
|
133
133
|
"@stylistic/eslint-plugin-ts": "^1.5.4",
|
|
134
|
-
"@swc/cli": "
|
|
135
|
-
"@swc/core": "1.5.
|
|
134
|
+
"@swc/cli": "~0.3.0",
|
|
135
|
+
"@swc/core": "~1.5.24",
|
|
136
136
|
"@types/jest": "~29.5.2",
|
|
137
137
|
"@types/minimist": "^1.2.2",
|
|
138
138
|
"@types/node": "^20.0.0",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Name of the specification file copied locally (without extension) */
|
|
2
|
+
export declare const LOCAL_SPEC_FILENAME = "swagger-spec";
|
|
3
|
+
/** Extension of the Specification file in YAML format */
|
|
4
|
+
export declare const SPEC_YAML_EXTENSION = "yaml";
|
|
5
|
+
/** Extension of the Specification file in JSON format */
|
|
6
|
+
export declare const SPEC_JSON_EXTENSION = "yaml";
|
|
7
|
+
//# sourceMappingURL=generators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators.d.ts","sourceRoot":"","sources":["../../../src/utils/generators.ts"],"names":[],"mappings":"AACA,wEAAwE;AACxE,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAElD,yDAAyD;AACzD,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAG1C,yDAAyD;AACzD,eAAO,MAAM,mBAAmB,SAAS,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// TODO: Change to `openapi` in v11 (ref: #1745)
|
|
2
|
+
/** Name of the specification file copied locally (without extension) */
|
|
3
|
+
export const LOCAL_SPEC_FILENAME = 'swagger-spec';
|
|
4
|
+
/** Extension of the Specification file in YAML format */
|
|
5
|
+
export const SPEC_YAML_EXTENSION = 'yaml';
|
|
6
|
+
// TODO: Change to `json` in v11 (ref: #1745)
|
|
7
|
+
/** Extension of the Specification file in JSON format */
|
|
8
|
+
export const SPEC_JSON_EXTENSION = 'yaml';
|
|
9
|
+
//# sourceMappingURL=generators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators.js","sourceRoot":"","sources":["../../../src/utils/generators.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,wEAAwE;AACxE,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAElD,yDAAyD;AACzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAE1C,6CAA6C;AAC7C,yDAAyD;AACzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC"}
|
package/src/utils/index.d.ts
CHANGED
package/src/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
|
package/src/utils/index.js
CHANGED
package/src/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
|