@ama-openapi/core 14.1.0-prerelease.4 → 14.1.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/package.json +9 -9
- package/src/schema/configurations/model-definitions.d.mts +21 -12
- package/src/schema/configurations/model-definitions.d.mts.map +1 -1
- package/src/schema/configurations/model-definitions.mjs +21 -5
- package/src/schema/configurations/model-definitions.mjs.map +1 -1
- package/src/main.d.mts +0 -13
- package/src/main.d.mts.map +0 -1
- package/src/main.mjs +0 -35
- package/src/main.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ama-openapi/core",
|
|
3
|
-
"version": "14.1.0-prerelease.
|
|
3
|
+
"version": "14.1.0-prerelease.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -63,17 +63,17 @@
|
|
|
63
63
|
"@nx/eslint-plugin": "~22.3.3",
|
|
64
64
|
"@nx/jest": "~22.3.3",
|
|
65
65
|
"@nx/js": "~22.3.3",
|
|
66
|
-
"@o3r/build-helpers": "~14.1.0-prerelease.
|
|
67
|
-
"@o3r/eslint-plugin": "~14.1.0-prerelease.
|
|
68
|
-
"@o3r/telemetry": "~14.1.0-prerelease.
|
|
69
|
-
"@o3r/test-helpers": "~14.1.0-prerelease.
|
|
70
|
-
"@stylistic/eslint-plugin": "~5.
|
|
66
|
+
"@o3r/build-helpers": "~14.1.0-prerelease.6",
|
|
67
|
+
"@o3r/eslint-plugin": "~14.1.0-prerelease.6",
|
|
68
|
+
"@o3r/telemetry": "~14.1.0-prerelease.6",
|
|
69
|
+
"@o3r/test-helpers": "~14.1.0-prerelease.6",
|
|
70
|
+
"@stylistic/eslint-plugin": "~5.7.0",
|
|
71
71
|
"@types/jest": "~30.0.0",
|
|
72
72
|
"@types/js-yaml": "^4.0.5",
|
|
73
73
|
"@types/minimist": "^1.2.2",
|
|
74
74
|
"@types/node": "~24.10.0",
|
|
75
75
|
"@types/semver": "^7.3.13",
|
|
76
|
-
"@typescript-eslint/parser": "~8.
|
|
76
|
+
"@typescript-eslint/parser": "~8.54.0",
|
|
77
77
|
"angular-eslint": "~21.0.1",
|
|
78
78
|
"babel-jest": "^30.0.5",
|
|
79
79
|
"babel-plugin-transform-import-meta": "^2.0.0",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"eslint-plugin-import": "~2.32.0",
|
|
85
85
|
"eslint-plugin-import-newlines": "~1.4.0",
|
|
86
86
|
"eslint-plugin-jest": "~29.12.0",
|
|
87
|
-
"eslint-plugin-jsdoc": "~61.
|
|
87
|
+
"eslint-plugin-jsdoc": "~61.7.0",
|
|
88
88
|
"eslint-plugin-prefer-arrow": "~1.2.3",
|
|
89
89
|
"eslint-plugin-unicorn": "~62.0.0",
|
|
90
90
|
"eslint-plugin-unused-imports": "~4.3.0",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"ts-jest": "~29.4.0",
|
|
100
100
|
"type-fest": "^5.3.1",
|
|
101
101
|
"typescript": "~5.9.2",
|
|
102
|
-
"typescript-eslint": "~8.
|
|
102
|
+
"typescript-eslint": "~8.54.0"
|
|
103
103
|
},
|
|
104
104
|
"engines": {
|
|
105
105
|
"node": "^20.19.0 || ^22.17.0 || ^24.0.0"
|
|
@@ -6,18 +6,19 @@ import type { SpecificationArtifact } from '../list-artifacts.mjs';
|
|
|
6
6
|
export declare const getModelDefinitions: (artifacts: SpecificationArtifact[]) => {
|
|
7
7
|
[k: string]: {
|
|
8
8
|
oneOf: ({
|
|
9
|
-
type: string;
|
|
10
|
-
default: boolean;
|
|
11
|
-
description: string;
|
|
12
|
-
const?: undefined;
|
|
13
|
-
properties?: undefined;
|
|
14
|
-
required?: undefined;
|
|
15
|
-
additionalProperties?: undefined;
|
|
16
|
-
} | {
|
|
17
9
|
const: string;
|
|
10
|
+
description: string;
|
|
18
11
|
type?: undefined;
|
|
19
|
-
|
|
12
|
+
pattern?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
type: string;
|
|
15
|
+
pattern: string;
|
|
16
|
+
const?: undefined;
|
|
20
17
|
description?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
type: string;
|
|
20
|
+
default: boolean;
|
|
21
|
+
description: string;
|
|
21
22
|
properties?: undefined;
|
|
22
23
|
required?: undefined;
|
|
23
24
|
additionalProperties?: undefined;
|
|
@@ -26,8 +27,17 @@ export declare const getModelDefinitions: (artifacts: SpecificationArtifact[]) =
|
|
|
26
27
|
description: string;
|
|
27
28
|
properties: {
|
|
28
29
|
path: {
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
oneOf: ({
|
|
31
|
+
const: string;
|
|
32
|
+
description: string;
|
|
33
|
+
type?: undefined;
|
|
34
|
+
pattern?: undefined;
|
|
35
|
+
} | {
|
|
36
|
+
type: string;
|
|
37
|
+
pattern: string;
|
|
38
|
+
const?: undefined;
|
|
39
|
+
description?: undefined;
|
|
40
|
+
})[];
|
|
31
41
|
};
|
|
32
42
|
transform: {
|
|
33
43
|
$ref: string;
|
|
@@ -36,7 +46,6 @@ export declare const getModelDefinitions: (artifacts: SpecificationArtifact[]) =
|
|
|
36
46
|
required: string[];
|
|
37
47
|
additionalProperties: boolean;
|
|
38
48
|
default?: undefined;
|
|
39
|
-
const?: undefined;
|
|
40
49
|
})[];
|
|
41
50
|
};
|
|
42
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-definitions.d.mts","sourceRoot":"","sources":["../../../../src/schema/configurations/model-definitions.mts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"model-definitions.d.mts","sourceRoot":"","sources":["../../../../src/schema/configurations/model-definitions.mts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAW/B;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,WAAW,qBAAqB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDrE,CAAC"}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { basename, } from 'node:path';
|
|
2
2
|
import { generateModelNameRef, } from '../generate-model-name.mjs';
|
|
3
|
+
/**
|
|
4
|
+
* Escape special characters in a string for use in a regular expression
|
|
5
|
+
* Note: This function can be removed on node >= 24 as `RegExp.escape` will be available natively
|
|
6
|
+
* @param str String to escape
|
|
7
|
+
*/
|
|
8
|
+
const regExpEscape = (str) => {
|
|
9
|
+
return str.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
10
|
+
};
|
|
3
11
|
/**
|
|
4
12
|
* Generate model definitions for the given artifacts
|
|
5
13
|
* @param artifacts
|
|
@@ -11,6 +19,17 @@ export const getModelDefinitions = (artifacts) => {
|
|
|
11
19
|
.filter((modelObj) => !!modelObj)
|
|
12
20
|
.map(({ model }) => {
|
|
13
21
|
const modelRef = generateModelNameRef(packageManifestName, model);
|
|
22
|
+
const pathSchemas = [
|
|
23
|
+
{
|
|
24
|
+
const: model,
|
|
25
|
+
description: 'Path to the specific model to include as is. The path is relative to the artifact root (e.g., "models/ExampleModel.v1.yaml")'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
type: 'string',
|
|
29
|
+
// TODO: give users hint on the available inner paths (cf #3938)
|
|
30
|
+
pattern: `^${regExpEscape(model)}#/.*$`
|
|
31
|
+
}
|
|
32
|
+
];
|
|
14
33
|
return [
|
|
15
34
|
`model-${modelRef}`,
|
|
16
35
|
{
|
|
@@ -22,16 +41,13 @@ export const getModelDefinitions = (artifacts) => {
|
|
|
22
41
|
description: 'Include the default model exposed by the artifact'
|
|
23
42
|
}]
|
|
24
43
|
: [],
|
|
25
|
-
|
|
26
|
-
const: model
|
|
27
|
-
},
|
|
44
|
+
...pathSchemas,
|
|
28
45
|
{
|
|
29
46
|
type: 'object',
|
|
30
47
|
description: 'Detailed model inclusion with optional transformations to apply',
|
|
31
48
|
properties: {
|
|
32
49
|
path: {
|
|
33
|
-
|
|
34
|
-
description: "Path to the specific model to include as is. The path is relative to the artifact root (e.g., 'models/ExampleModel.v1.yaml')"
|
|
50
|
+
oneOf: pathSchemas
|
|
35
51
|
},
|
|
36
52
|
transform: {
|
|
37
53
|
$ref: `#/definitions/transform-${modelRef}`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-definitions.mjs","sourceRoot":"","sources":["../../../../src/schema/configurations/model-definitions.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,GACT,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AAKpC;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,SAAkC,EAAE,EAAE;IACxE,OAAO,MAAM,CAAC,WAAW,CACvB,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,EAAE;QAC/D,MAAM,mBAAmB,GAAG,eAAe,CAAC,IAAI,IAAI,QAAQ,CAAC,aAAa,CAAC,CAAC;QAC5E,OAAO,MAAM;aACV,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;aAChC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;YACjB,MAAM,QAAQ,GAAG,oBAAoB,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;YAClE,OAAO;gBACL,SAAS,QAAQ,EAAE;gBACnB;oBACE,KAAK,EAAE;wBACL,GAAG,eAAe,CAAC,IAAI;4BACrB,CAAC,CAAC,CAAC;oCACD,IAAI,EAAE,SAAS;oCACf,OAAO,EAAE,IAAI;oCACb,WAAW,EAAE,mDAAmD;iCACjE,CAAC;4BACF,CAAC,CAAC,EAAE;wBACN
|
|
1
|
+
{"version":3,"file":"model-definitions.mjs","sourceRoot":"","sources":["../../../../src/schema/configurations/model-definitions.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,GACT,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AAKpC;;;;GAIG;AACH,MAAM,YAAY,GAAG,CAAC,GAAW,EAAU,EAAE;IAC3C,OAAO,GAAG,CAAC,OAAO,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,SAAkC,EAAE,EAAE;IACxE,OAAO,MAAM,CAAC,WAAW,CACvB,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,EAAE;QAC/D,MAAM,mBAAmB,GAAG,eAAe,CAAC,IAAI,IAAI,QAAQ,CAAC,aAAa,CAAC,CAAC;QAC5E,OAAO,MAAM;aACV,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;aAChC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;YACjB,MAAM,QAAQ,GAAG,oBAAoB,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;YAClE,MAAM,WAAW,GAAG;gBAClB;oBACE,KAAK,EAAE,KAAK;oBACZ,WAAW,EAAE,8HAA8H;iBAC5I;gBACD;oBACE,IAAI,EAAE,QAAQ;oBACd,gEAAgE;oBAChE,OAAO,EAAE,IAAI,YAAY,CAAC,KAAK,CAAC,OAAO;iBACxC;aACF,CAAC;YAEF,OAAO;gBACL,SAAS,QAAQ,EAAE;gBACnB;oBACE,KAAK,EAAE;wBACL,GAAG,eAAe,CAAC,IAAI;4BACrB,CAAC,CAAC,CAAC;oCACD,IAAI,EAAE,SAAS;oCACf,OAAO,EAAE,IAAI;oCACb,WAAW,EAAE,mDAAmD;iCACjE,CAAC;4BACF,CAAC,CAAC,EAAE;wBACN,GAAG,WAAW;wBACd;4BACE,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,iEAAiE;4BAC9E,UAAU,EAAE;gCACV,IAAI,EAAE;oCACJ,KAAK,EAAE,WAAW;iCACnB;gCACD,SAAS,EAAE;oCACT,IAAI,EAAE,2BAA2B,QAAQ,EAAE;iCAC5C;6BACF;4BACD,QAAQ,EAAE;gCACR,MAAM;6BACP;4BACD,oBAAoB,EAAE,KAAK;yBAC5B;qBACF;iBACF;aACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CACH,CAAC;AACJ,CAAC,CAAC"}
|
package/src/main.d.mts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Logger } from './logger.mjs';
|
|
2
|
-
/** Options for Install Dependencies */
|
|
3
|
-
export interface InstallDependenciesOptions {
|
|
4
|
-
/** Logger instance */
|
|
5
|
-
logger?: Logger;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Run the process to download and write dependency models
|
|
9
|
-
* @param workingDirectory
|
|
10
|
-
* @param options
|
|
11
|
-
*/
|
|
12
|
-
export declare const installDependencies: (workingDirectory?: string, options?: InstallDependenciesOptions) => Promise<void>;
|
|
13
|
-
//# sourceMappingURL=main.d.mts.map
|
package/src/main.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.mts","sourceRoot":"","sources":["../../src/main.mts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,MAAM,EACP,MAAM,cAAc,CAAC;AAEtB,uCAAuC;AACvC,MAAM,WAAW,0BAA0B;IACzC,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAU,yBAAwB,EAAE,UAAU,0BAA0B,KAAG,OAAO,CAAC,IAAI,CA6BtH,CAAC"}
|
package/src/main.mjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { cwd, } from 'node:process';
|
|
2
|
-
import { cleanOutputDirectory, } from './core/file-system/cleaner.mjs';
|
|
3
|
-
import { extractDependencyModels, } from './core/manifest/extract-dependency-models.mjs';
|
|
4
|
-
import { retrieveManifest, } from './core/manifest/manifest.mjs';
|
|
5
|
-
import { processModel, } from './core/process.mjs';
|
|
6
|
-
/**
|
|
7
|
-
* Run the process to download and write dependency models
|
|
8
|
-
* @param workingDirectory
|
|
9
|
-
* @param options
|
|
10
|
-
*/
|
|
11
|
-
export const installDependencies = async (workingDirectory = cwd(), options) => {
|
|
12
|
-
const { logger = console } = options || {};
|
|
13
|
-
const manifest = await retrieveManifest(workingDirectory, logger);
|
|
14
|
-
const context = {
|
|
15
|
-
cwd: workingDirectory,
|
|
16
|
-
logger
|
|
17
|
-
};
|
|
18
|
-
if (!manifest) {
|
|
19
|
-
logger?.info('No Manifest file discovered');
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
await cleanOutputDirectory(context);
|
|
23
|
-
const models = extractDependencyModels(manifest, context);
|
|
24
|
-
const results = await Promise.allSettled(processModel(models, context));
|
|
25
|
-
const rejected = results
|
|
26
|
-
.filter((result) => result.status === 'rejected');
|
|
27
|
-
if (rejected.length > 0) {
|
|
28
|
-
logger?.error(`Failed to retrieve some models:`);
|
|
29
|
-
rejected.forEach((result) => logger?.error(result.reason));
|
|
30
|
-
await cleanOutputDirectory(context);
|
|
31
|
-
throw new Error('Failed to retrieve some models');
|
|
32
|
-
}
|
|
33
|
-
logger?.info(`Successfully retrieved all models`);
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=main.mjs.map
|
package/src/main.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.mjs","sourceRoot":"","sources":["../../src/main.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,GACJ,MAAM,cAAc,CAAC;AAItB,OAAO,EACL,oB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