@ama-openapi/core 0.0.0-placeholder.1 → 0.0.0-placeholder.10
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 +10 -9
- package/renovate/default.json +10 -0
- package/schemas/manifest.schema.json +8 -41
- package/schemas/transform.schema.json +45 -0
- package/src/constants.d.mts +8 -4
- package/src/constants.d.mts.map +1 -1
- package/src/constants.mjs +11 -5
- package/src/constants.mjs.map +1 -1
- package/src/context.d.mts +11 -0
- package/src/context.d.mts.map +1 -0
- package/src/context.mjs +2 -0
- package/src/context.mjs.map +1 -0
- package/src/core/file-system/cleaner.d.mts +3 -2
- package/src/core/file-system/cleaner.d.mts.map +1 -1
- package/src/core/file-system/cleaner.mjs +6 -3
- package/src/core/file-system/cleaner.mjs.map +1 -1
- package/src/core/file-system/parse-file.d.mts +2 -2
- package/src/core/file-system/parse-file.mjs +2 -2
- package/src/core/file-system/relative-path.d.mts +6 -0
- package/src/core/file-system/relative-path.d.mts.map +1 -0
- package/src/core/file-system/relative-path.mjs +9 -0
- package/src/core/file-system/relative-path.mjs.map +1 -0
- package/src/core/file-system/write-model.d.mts +3 -1
- package/src/core/file-system/write-model.d.mts.map +1 -1
- package/src/core/file-system/write-model.mjs +13 -4
- package/src/core/file-system/write-model.mjs.map +1 -1
- package/src/core/manifest/extract-dependency-models.d.mts +17 -9
- package/src/core/manifest/extract-dependency-models.d.mts.map +1 -1
- package/src/core/manifest/extract-dependency-models.mjs +45 -38
- package/src/core/manifest/extract-dependency-models.mjs.map +1 -1
- package/src/core/manifest/manifest.d.mts +3 -4
- package/src/core/manifest/manifest.d.mts.map +1 -1
- package/src/core/manifest/manifest.mjs +15 -16
- package/src/core/manifest/manifest.mjs.map +1 -1
- package/src/core/process.d.mts +9 -0
- package/src/core/process.d.mts.map +1 -0
- package/src/core/process.mjs +30 -0
- package/src/core/process.mjs.map +1 -0
- package/src/core/serialization.mjs +3 -3
- package/src/core/serialization.mjs.map +1 -1
- package/src/core/transforms/add-annotation.d.mts +4 -3
- package/src/core/transforms/add-annotation.d.mts.map +1 -1
- package/src/core/transforms/add-annotation.mjs +4 -2
- package/src/core/transforms/add-annotation.mjs.map +1 -1
- package/src/core/transforms/apply-mask.d.mts +5 -4
- package/src/core/transforms/apply-mask.d.mts.map +1 -1
- package/src/core/transforms/apply-mask.mjs +139 -39
- package/src/core/transforms/apply-mask.mjs.map +1 -1
- package/src/core/transforms/rename.d.mts +6 -3
- package/src/core/transforms/rename.d.mts.map +1 -1
- package/src/core/transforms/rename.mjs +6 -4
- package/src/core/transforms/rename.mjs.map +1 -1
- package/src/core/transforms/to-reference.d.mts +6 -3
- package/src/core/transforms/to-reference.d.mts.map +1 -1
- package/src/core/transforms/to-reference.mjs +9 -5
- package/src/core/transforms/to-reference.mjs.map +1 -1
- package/src/core/transforms/transform.d.mts +6 -2
- package/src/core/transforms/transform.d.mts.map +1 -1
- package/src/core/transforms/update-references.d.mts +4 -8
- package/src/core/transforms/update-references.d.mts.map +1 -1
- package/src/core/transforms/update-references.mjs +34 -16
- package/src/core/transforms/update-references.mjs.map +1 -1
- package/src/main.d.mts.map +1 -1
- package/src/main.mjs +9 -25
- package/src/main.mjs.map +1 -1
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ama-openapi/core",
|
|
3
|
-
"version": "0.0.0-placeholder.
|
|
3
|
+
"version": "0.0.0-placeholder.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
-
"
|
|
8
|
+
"types": "./src/public_api.d.mts",
|
|
9
9
|
"main": "./src/public_api.mjs",
|
|
10
10
|
"description": "Package exposing core function to manage OpenAPI dependencies",
|
|
11
11
|
"keywords": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
".": {
|
|
36
36
|
"module": "./src/public_api.mjs",
|
|
37
|
-
"
|
|
37
|
+
"types": "./src/public_api.d.mts",
|
|
38
38
|
"default": "./src/public_api.mjs"
|
|
39
39
|
}
|
|
40
40
|
},
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"@nx/eslint-plugin": "~21.6.0",
|
|
63
63
|
"@nx/jest": "~21.6.0",
|
|
64
64
|
"@nx/js": "~21.6.0",
|
|
65
|
-
"@o3r/build-helpers": "~0.0.0",
|
|
66
|
-
"@o3r/eslint-plugin": "~0.0.0",
|
|
67
|
-
"@o3r/telemetry": "~0.0.0",
|
|
68
|
-
"@o3r/test-helpers": "~0.0.0",
|
|
65
|
+
"@o3r/build-helpers": "~0.0.0-placeholder.10",
|
|
66
|
+
"@o3r/eslint-plugin": "~0.0.0-placeholder.10",
|
|
67
|
+
"@o3r/telemetry": "~0.0.0-placeholder.10",
|
|
68
|
+
"@o3r/test-helpers": "~0.0.0-placeholder.10",
|
|
69
69
|
"@stylistic/eslint-plugin": "~5.5.0",
|
|
70
70
|
"@types/jest": "~29.5.2",
|
|
71
71
|
"@types/js-yaml": "^4.0.5",
|
|
@@ -73,10 +73,11 @@
|
|
|
73
73
|
"@types/node": "~22.18.0",
|
|
74
74
|
"@types/semver": "^7.3.13",
|
|
75
75
|
"@typescript-eslint/parser": "~8.46.0",
|
|
76
|
-
"angular-eslint": "~20.
|
|
76
|
+
"angular-eslint": "~20.5.0",
|
|
77
77
|
"babel-jest": "^29.7.0",
|
|
78
|
+
"babel-plugin-transform-import-meta": "^2.0.0",
|
|
78
79
|
"cpy-cli": "^6.0.0",
|
|
79
|
-
"eslint": "~9.
|
|
80
|
+
"eslint": "~9.39.0",
|
|
80
81
|
"eslint-import-resolver-node": "~0.3.9",
|
|
81
82
|
"eslint-import-resolver-typescript": "~4.4.0",
|
|
82
83
|
"eslint-plugin-import": "~2.32.0",
|
package/renovate/default.json
CHANGED
|
@@ -3,5 +3,15 @@
|
|
|
3
3
|
"description": "Default Renovate configuration for @ama-openapi packages",
|
|
4
4
|
"extends": [
|
|
5
5
|
"github>AmadeusITGroup/otter//tools/renovate/group/otter"
|
|
6
|
+
],
|
|
7
|
+
"packageRules": [
|
|
8
|
+
{
|
|
9
|
+
"matchPackageNames": [
|
|
10
|
+
"/^@ama-openapi/",
|
|
11
|
+
"/^@redocly/"
|
|
12
|
+
],
|
|
13
|
+
"groupName": "Build Tools dependencies",
|
|
14
|
+
"groupSlug": "build-tools-dependencies"
|
|
15
|
+
}
|
|
6
16
|
]
|
|
7
17
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"title": "OpenApi specification package manifest",
|
|
4
|
+
"$id": "@ama-openapi/core/schemas/manifest.schema.json",
|
|
4
5
|
"type": "object",
|
|
5
6
|
"properties": {
|
|
6
7
|
"models": {
|
|
@@ -19,31 +20,7 @@
|
|
|
19
20
|
"transform": {
|
|
20
21
|
"oneOf": [
|
|
21
22
|
{
|
|
22
|
-
"
|
|
23
|
-
"examples": [
|
|
24
|
-
{
|
|
25
|
-
"mask": { "data": true },
|
|
26
|
-
"fileRename": "MyPrefix_$1"
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
"properties": {
|
|
30
|
-
"mask": {
|
|
31
|
-
"type": "object",
|
|
32
|
-
"description": "Mask to apply"
|
|
33
|
-
},
|
|
34
|
-
"titleRename": {
|
|
35
|
-
"type": "string",
|
|
36
|
-
"description": "Rename the model title. The keyword `$1` can be used to refer to original name (ex: a prefix would be `myPrefix_$1`)"
|
|
37
|
-
},
|
|
38
|
-
"fileRename": {
|
|
39
|
-
"type": "string",
|
|
40
|
-
"description": "Rename the outputted file (to be specified without extension)."
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"additionalProperties": false,
|
|
44
|
-
"required": [
|
|
45
|
-
"fileRename"
|
|
46
|
-
]
|
|
23
|
+
"$ref": "./transform.schema.json"
|
|
47
24
|
},
|
|
48
25
|
{
|
|
49
26
|
"type": "string",
|
|
@@ -58,7 +35,7 @@
|
|
|
58
35
|
{
|
|
59
36
|
"path": "models/ExampleModel.v1.yaml",
|
|
60
37
|
"transform": {
|
|
61
|
-
"mask": { "
|
|
38
|
+
"mask": { "properties": { "field": true } },
|
|
62
39
|
"fileRename": "MyPrefix_$1"
|
|
63
40
|
}
|
|
64
41
|
}
|
|
@@ -67,32 +44,22 @@
|
|
|
67
44
|
{
|
|
68
45
|
"type": "boolean",
|
|
69
46
|
"default": true,
|
|
70
|
-
"description": "Include the default model
|
|
47
|
+
"description": "Include the default model exposed by the artifact"
|
|
71
48
|
},
|
|
72
49
|
{
|
|
73
50
|
"type": "string",
|
|
74
|
-
"description": "Path to the model to include as is"
|
|
51
|
+
"description": "Path to the specific model to include as is. The path is relative to the artifact root (e.g., 'models/ExampleModel.v1.yaml')"
|
|
75
52
|
},
|
|
76
53
|
{
|
|
77
54
|
"type": "object",
|
|
78
|
-
"description": "
|
|
55
|
+
"description": "Detailed model inclusion with optional transformations to apply",
|
|
79
56
|
"properties": {
|
|
80
57
|
"path": {
|
|
81
58
|
"type": "string",
|
|
82
|
-
"description": "Path to the model
|
|
59
|
+
"description": "Path to the specific model to include as is. The path is relative to the artifact root (e.g., 'models/ExampleModel.v1.yaml')"
|
|
83
60
|
},
|
|
84
61
|
"transform": {
|
|
85
|
-
"
|
|
86
|
-
{
|
|
87
|
-
"$ref": "#/definitions/transform"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"type": "array",
|
|
91
|
-
"items": {
|
|
92
|
-
"$ref": "#/definitions/transform"
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
]
|
|
62
|
+
"$ref": "#/definitions/transform"
|
|
96
63
|
}
|
|
97
64
|
},
|
|
98
65
|
"required": [
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "@ama-openapi/core/schemas/transform.schema.json",
|
|
4
|
+
"title": "OpenApi mask definition",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"examples": [
|
|
7
|
+
{
|
|
8
|
+
"mask": {
|
|
9
|
+
"data": true
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"fileRename": "MyPrefix_$1"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"mask": {
|
|
17
|
+
"data": true
|
|
18
|
+
},
|
|
19
|
+
"fileRename": "MyPrefix_$1"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"properties": {
|
|
23
|
+
"mask": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"description": "Mask to apply"
|
|
26
|
+
},
|
|
27
|
+
"titleRename": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "Rename the model title. The keyword `$1` can be used to refer to original name (ex: a prefix would be `myPrefix_$1`)",
|
|
30
|
+
"examples": [
|
|
31
|
+
"myPrefix_$1",
|
|
32
|
+
"myModel"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"fileRename": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "Rename the outputted file. The keyword `$1` can be used to refer to the original name (ex: a prefix would be `my-prefix-$1`)",
|
|
38
|
+
"examples": [
|
|
39
|
+
"my-prefix-$1",
|
|
40
|
+
"myModel.v1.yaml"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"additionalProperties": false
|
|
45
|
+
}
|
package/src/constants.d.mts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
/** Directory containing the extracted module */
|
|
2
2
|
export declare const OUTPUT_DIRECTORY = "models_external";
|
|
3
|
+
/** Directory containing masked model when the mask is applied to referenced models */
|
|
4
|
+
export declare const SUB_MASK_DIRECTORY = "sub-masks";
|
|
3
5
|
/** Default manifest filenames to look for */
|
|
4
|
-
export declare const DEFAULT_MANIFEST_FILENAMES: readonly ["
|
|
6
|
+
export declare const DEFAULT_MANIFEST_FILENAMES: readonly ["ama-openapi.manifest.json", "ama-openapi.manifest.yaml", "ama-openapi.manifest.yml", "openapi.manifest.json", "openapi.manifest.yaml", "openapi.manifest.yml", "package.json"];
|
|
5
7
|
/** Key to mark masked properties */
|
|
6
8
|
export declare const MASKED_PROPERTY_KEY = "x-internal-masked";
|
|
7
9
|
/** Key to mark touched properties */
|
|
8
10
|
export declare const TOUCHED_PROPERTY_KEY = "x-internal-touched";
|
|
9
|
-
/** Key to indicate the source of the model */
|
|
11
|
+
/** Key to indicate the source of the model (e.g: `<package>/<model-path>`) */
|
|
10
12
|
export declare const SOURCE_PROPERTY_KEY = "x-internal-source";
|
|
11
13
|
/** Key to indicate the version of the model */
|
|
12
14
|
export declare const VERSION_PROPERTY_KEY = "x-internal-version";
|
|
13
|
-
/** Key to indicate reference
|
|
14
|
-
export declare const
|
|
15
|
+
/** Key to indicate the reference is rewritten */
|
|
16
|
+
export declare const REF_REWRITTEN_PROPERTY_KEY = "x-internal-reference-rewritten";
|
|
17
|
+
/** Key to indicate generated $ref references */
|
|
18
|
+
export declare const GENERATED_REF_PROPERTY_KEY = "x-internal-reference-generated";
|
|
15
19
|
//# sourceMappingURL=constants.d.mts.map
|
package/src/constants.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../../src/constants.mts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,eAAO,MAAM,gBAAgB,oBAAoB,CAAC;AAElD,6CAA6C;AAC7C,eAAO,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../../src/constants.mts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,eAAO,MAAM,gBAAgB,oBAAoB,CAAC;AAElD,sFAAsF;AACtF,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAE9C,6CAA6C;AAC7C,eAAO,MAAM,0BAA0B,2LAQ7B,CAAC;AAIX,oCAAoC;AACpC,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AACvD,qCAAqC;AACrC,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AACzD,8EAA8E;AAC9E,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AACvD,+CAA+C;AAC/C,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AACzD,iDAAiD;AACjD,eAAO,MAAM,0BAA0B,mCAAmC,CAAC;AAC3E,gDAAgD;AAChD,eAAO,MAAM,0BAA0B,mCAAmC,CAAC"}
|
package/src/constants.mjs
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
/** Directory containing the extracted module */
|
|
2
2
|
export const OUTPUT_DIRECTORY = 'models_external';
|
|
3
|
+
/** Directory containing masked model when the mask is applied to referenced models */
|
|
4
|
+
export const SUB_MASK_DIRECTORY = 'sub-masks';
|
|
3
5
|
/** Default manifest filenames to look for */
|
|
4
6
|
export const DEFAULT_MANIFEST_FILENAMES = [
|
|
5
|
-
'package.json',
|
|
6
7
|
'ama-openapi.manifest.json',
|
|
7
8
|
'ama-openapi.manifest.yaml',
|
|
9
|
+
'ama-openapi.manifest.yml',
|
|
8
10
|
'openapi.manifest.json',
|
|
9
|
-
'openapi.manifest.yaml'
|
|
11
|
+
'openapi.manifest.yaml',
|
|
12
|
+
'openapi.manifest.yml',
|
|
13
|
+
'package.json'
|
|
10
14
|
];
|
|
11
15
|
// Internal property keys :
|
|
12
16
|
/** Key to mark masked properties */
|
|
13
17
|
export const MASKED_PROPERTY_KEY = 'x-internal-masked';
|
|
14
18
|
/** Key to mark touched properties */
|
|
15
19
|
export const TOUCHED_PROPERTY_KEY = 'x-internal-touched';
|
|
16
|
-
/** Key to indicate the source of the model */
|
|
20
|
+
/** Key to indicate the source of the model (e.g: `<package>/<model-path>`) */
|
|
17
21
|
export const SOURCE_PROPERTY_KEY = 'x-internal-source';
|
|
18
22
|
/** Key to indicate the version of the model */
|
|
19
23
|
export const VERSION_PROPERTY_KEY = 'x-internal-version';
|
|
20
|
-
/** Key to indicate reference
|
|
21
|
-
export const
|
|
24
|
+
/** Key to indicate the reference is rewritten */
|
|
25
|
+
export const REF_REWRITTEN_PROPERTY_KEY = 'x-internal-reference-rewritten';
|
|
26
|
+
/** Key to indicate generated $ref references */
|
|
27
|
+
export const GENERATED_REF_PROPERTY_KEY = 'x-internal-reference-generated';
|
|
22
28
|
//# sourceMappingURL=constants.mjs.map
|
package/src/constants.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../src/constants.mts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAElD,6CAA6C;AAC7C,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,
|
|
1
|
+
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../src/constants.mts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAElD,sFAAsF;AACtF,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAE9C,6CAA6C;AAC7C,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,2BAA2B;IAC3B,2BAA2B;IAC3B,0BAA0B;IAC1B,uBAAuB;IACvB,uBAAuB;IACvB,sBAAsB;IACtB,cAAc;CACN,CAAC;AAEX,2BAA2B;AAE3B,oCAAoC;AACpC,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;AACvD,qCAAqC;AACrC,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AACzD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;AACvD,+CAA+C;AAC/C,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AACzD,iDAAiD;AACjD,MAAM,CAAC,MAAM,0BAA0B,GAAG,gCAAgC,CAAC;AAC3E,gDAAgD;AAChD,MAAM,CAAC,MAAM,0BAA0B,GAAG,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Logger } from './logger.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Context interface for Ama OpenAPI processing
|
|
4
|
+
*/
|
|
5
|
+
export interface Context {
|
|
6
|
+
/** Current working directory */
|
|
7
|
+
cwd: string;
|
|
8
|
+
/** Logger instance */
|
|
9
|
+
logger?: Logger;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=context.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.mts","sourceRoot":"","sources":["../../src/context.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACP,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
package/src/context.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.mjs","sourceRoot":"","sources":["../../src/context.mts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { Context } from '../../context.mjs';
|
|
1
2
|
/**
|
|
2
3
|
* Clean the dependency output directory
|
|
3
|
-
* @param
|
|
4
|
+
* @param context
|
|
4
5
|
*/
|
|
5
|
-
export declare const cleanOutputDirectory: (
|
|
6
|
+
export declare const cleanOutputDirectory: (context: Context) => Promise<void>;
|
|
6
7
|
//# sourceMappingURL=cleaner.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleaner.d.mts","sourceRoot":"","sources":["../../../../src/core/file-system/cleaner.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cleaner.d.mts","sourceRoot":"","sources":["../../../../src/core/file-system/cleaner.mts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,OAAO,EACR,MAAM,mBAAmB,CAAC;AAE3B;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS,OAAO,kBAKpD,CAAC"}
|
|
@@ -3,9 +3,12 @@ import { resolve, } from 'node:path';
|
|
|
3
3
|
import { OUTPUT_DIRECTORY, } from '../../constants.mjs';
|
|
4
4
|
/**
|
|
5
5
|
* Clean the dependency output directory
|
|
6
|
-
* @param
|
|
6
|
+
* @param context
|
|
7
7
|
*/
|
|
8
|
-
export const cleanOutputDirectory = (
|
|
9
|
-
|
|
8
|
+
export const cleanOutputDirectory = (context) => {
|
|
9
|
+
const { cwd, logger } = context;
|
|
10
|
+
const outputDirectory = resolve(cwd, OUTPUT_DIRECTORY);
|
|
11
|
+
logger?.debug?.(`Removing directory ${outputDirectory}`);
|
|
12
|
+
return fs.rm(outputDirectory, { force: true, recursive: true });
|
|
10
13
|
};
|
|
11
14
|
//# sourceMappingURL=cleaner.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleaner.mjs","sourceRoot":"","sources":["../../../../src/core/file-system/cleaner.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,IAAI,EAAE,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,OAAO,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"cleaner.mjs","sourceRoot":"","sources":["../../../../src/core/file-system/cleaner.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,IAAI,EAAE,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,OAAO,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAK7B;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAgB,EAAE,EAAE;IACvD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAChC,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;IACvD,MAAM,EAAE,KAAK,EAAE,CAAC,sBAAsB,eAAe,EAAE,CAAC,CAAC;IACzD,OAAO,EAAE,CAAC,EAAE,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAClE,CAAC,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Parse a file content based on its extension
|
|
3
3
|
* @param filePath
|
|
4
4
|
*/
|
|
5
5
|
export declare const isJsonFile: (filePath: string) => boolean;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Parse a file content based on its extension
|
|
8
8
|
* @param filePath
|
|
9
9
|
*/
|
|
10
10
|
export declare const parseFile: <S>(filePath: string) => Promise<S>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { promises as fs, } from 'node:fs';
|
|
2
2
|
import { load, } from 'js-yaml';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Parse a file content based on its extension
|
|
5
5
|
* @param filePath
|
|
6
6
|
*/
|
|
7
7
|
export const isJsonFile = (filePath) => {
|
|
8
8
|
return filePath.toLowerCase().endsWith('.json');
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Parse a file content based on its extension
|
|
12
12
|
* @param filePath
|
|
13
13
|
*/
|
|
14
14
|
export const parseFile = async (filePath) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relative-path.d.mts","sourceRoot":"","sources":["../../../../src/core/file-system/relative-path.mts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,KAAG,OAE7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relative-path.mjs","sourceRoot":"","sources":["../../../../src/core/file-system/relative-path.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,GACX,MAAM,iBAAiB,CAAC;AAEzB;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAW,EAAE;IACtD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { Context } from '../../context.mjs';
|
|
1
2
|
import type { RetrievedDependencyModel } from '../manifest/extract-dependency-models.mjs';
|
|
2
3
|
/**
|
|
3
4
|
* Write the model file in the dependencies folder.
|
|
4
5
|
* @param retrievedModel
|
|
6
|
+
* @param context
|
|
5
7
|
*/
|
|
6
|
-
export declare const writeModelFile: (retrievedModel: RetrievedDependencyModel) => Promise<void>;
|
|
8
|
+
export declare const writeModelFile: (retrievedModel: RetrievedDependencyModel, context: Context) => Promise<void>;
|
|
7
9
|
//# sourceMappingURL=write-model.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-model.d.mts","sourceRoot":"","sources":["../../../../src/core/file-system/write-model.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"write-model.d.mts","sourceRoot":"","sources":["../../../../src/core/file-system/write-model.mts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,OAAO,EACR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,wBAAwB,EACzB,MAAM,2CAA2C,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAU,gBAAgB,wBAAwB,EAAE,SAAS,OAAO,kBAiB9F,CAAC"}
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
import { promises as fs, } from 'node:fs';
|
|
1
|
+
import { existsSync, promises as fs, } from 'node:fs';
|
|
2
|
+
import { EOL, } from 'node:os';
|
|
2
3
|
import { dirname, } from 'node:path';
|
|
3
4
|
/**
|
|
4
5
|
* Write the model file in the dependencies folder.
|
|
5
6
|
* @param retrievedModel
|
|
7
|
+
* @param context
|
|
6
8
|
*/
|
|
7
|
-
export const writeModelFile = async (retrievedModel) => {
|
|
9
|
+
export const writeModelFile = async (retrievedModel, context) => {
|
|
8
10
|
const { outputFilePath, content } = retrievedModel;
|
|
11
|
+
const { logger } = context;
|
|
12
|
+
const directory = dirname(outputFilePath);
|
|
9
13
|
try {
|
|
10
|
-
|
|
14
|
+
logger?.debug?.(`Creating directory for model file at ${directory}`);
|
|
15
|
+
await fs.mkdir(directory, { recursive: true });
|
|
11
16
|
}
|
|
12
17
|
catch {
|
|
13
|
-
|
|
18
|
+
logger?.debug?.(`Directory ${directory} may already exist, continuing...`);
|
|
19
|
+
}
|
|
20
|
+
if (existsSync(outputFilePath)) {
|
|
21
|
+
logger?.warn(`The file ${outputFilePath} already exist and will be replaced.`
|
|
22
|
+
+ `${EOL}This may be due to a previous model extraction, please verify or apply a "fileRename" value to the associated Transform.`);
|
|
14
23
|
}
|
|
15
24
|
await fs.writeFile(outputFilePath, content, { encoding: 'utf8' });
|
|
16
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-model.mjs","sourceRoot":"","sources":["../../../../src/core/file-system/write-model.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,IAAI,EAAE,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,OAAO,GACR,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"write-model.mjs","sourceRoot":"","sources":["../../../../src/core/file-system/write-model.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,QAAQ,IAAI,EAAE,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,GAAG,GACJ,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,OAAO,GACR,MAAM,WAAW,CAAC;AAQnB;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,cAAwC,EAAE,OAAgB,EAAE,EAAE;IACjG,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC;IACnD,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3B,MAAM,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC1C,IAAI,CAAC;QACH,MAAM,EAAE,KAAK,EAAE,CAAC,wCAAwC,SAAS,EAAE,CAAC,CAAC;QACrE,MAAM,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,EAAE,KAAK,EAAE,CAAC,aAAa,SAAS,mCAAmC,CAAC,CAAC;IAC7E,CAAC;IAED,IAAI,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QAC/B,MAAM,EAAE,IAAI,CAAC,YAAY,cAAc,sCAAsC;cACzE,GAAG,GAAG,0HAA0H,CAAC,CAAC;IACxI,CAAC;IAED,MAAM,EAAE,CAAC,SAAS,CAAC,cAAc,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;AACpE,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Context } from '../../context.mjs';
|
|
2
2
|
import type { Manifest, Model, Transform } from './manifest.mjs';
|
|
3
3
|
/**
|
|
4
4
|
* Extracted dependency model information
|
|
@@ -13,11 +13,11 @@ export interface RetrievedDependencyModel {
|
|
|
13
13
|
/** Content of the model file */
|
|
14
14
|
content: string;
|
|
15
15
|
/** Model definition from the manifest */
|
|
16
|
-
model: Model &
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/** Indicates if the model file is a JSON file */
|
|
20
|
-
|
|
16
|
+
model: Model & Required<Pick<Model, 'path'>>;
|
|
17
|
+
/** Indicates if the input model file is a JSON file */
|
|
18
|
+
isInputJson: boolean;
|
|
19
|
+
/** Indicates if the output model file is a JSON file */
|
|
20
|
+
isOutputJson: boolean;
|
|
21
21
|
/** Absolute path to the artifact root folder */
|
|
22
22
|
artifactBasePath: string;
|
|
23
23
|
/** Absolute path to the output for the generated file */
|
|
@@ -25,11 +25,19 @@ export interface RetrievedDependencyModel {
|
|
|
25
25
|
/** Mask to apply */
|
|
26
26
|
transform?: Transform;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Extract dependency model given full model definition
|
|
30
|
+
* @param artifactName
|
|
31
|
+
* @param model
|
|
32
|
+
* @param transformPromise
|
|
33
|
+
* @param context
|
|
34
|
+
* @param outputDirectory
|
|
35
|
+
*/
|
|
36
|
+
export declare const extractDependencyModelsObject: (artifactName: string, model: Model, transformPromise: Promise<Transform | undefined>, context: Context, outputDirectory?: string) => Promise<RetrievedDependencyModel>;
|
|
28
37
|
/**
|
|
29
38
|
* Extract dependency models from the manifest
|
|
30
|
-
* @param cwd
|
|
31
39
|
* @param manifest
|
|
32
|
-
* @param
|
|
40
|
+
* @param context
|
|
33
41
|
*/
|
|
34
|
-
export declare const extractDependencyModels: (
|
|
42
|
+
export declare const extractDependencyModels: (manifest: Manifest, context: Context) => Promise<RetrievedDependencyModel>[];
|
|
35
43
|
//# sourceMappingURL=extract-dependency-models.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-dependency-models.d.mts","sourceRoot":"","sources":["../../../../src/core/manifest/extract-dependency-models.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extract-dependency-models.d.mts","sourceRoot":"","sources":["../../../../src/core/manifest/extract-dependency-models.mts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,OAAO,EACR,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,KAAK,EACV,QAAQ,EACR,KAAK,EACL,SAAS,EACV,MAAM,gBAAgB,CAAC;AAExB;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,2BAA2B;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,KAAK,EAAE,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7C,uDAAuD;IACvD,WAAW,EAAE,OAAO,CAAC;IACrB,wDAAwD;IACxD,YAAY,EAAE,OAAO,CAAC;IACtB,gDAAgD;IAChD,gBAAgB,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB;IACpB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AA4ED;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,GACxC,cAAc,MAAM,EACpB,OAAO,KAAK,EACZ,kBAAkB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,EAChD,SAAS,OAAO,EAChB,wBAAkC,KAAG,OAAO,CAAC,wBAAwB,CA2BtE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAAI,UAAU,QAAQ,EAAE,SAAS,OAAO,wCAU3E,CAAC"}
|