@ama-openapi/core 14.1.0-prerelease.5 → 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
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,10 +63,10 @@
|
|
|
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.
|
|
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
70
|
"@stylistic/eslint-plugin": "~5.7.0",
|
|
71
71
|
"@types/jest": "~30.0.0",
|
|
72
72
|
"@types/js-yaml": "^4.0.5",
|
|
@@ -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"}
|