@pagopa/selfcare-common-frontend 1.34.99 → 1.34.100
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/CHANGELOG.md +7 -2
- package/build.info +2 -2
- package/package.json +1 -1
- package/utils/fixSwagger20ArraySchemaDef.js +63 -56
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,9 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
-
#### [v1.34.
|
|
7
|
+
#### [v1.34.100](https://github.com/pagopa/selfcare-common-frontend/compare/v1.35.0...v1.34.100)
|
|
8
8
|
|
|
9
|
+
- update to esm [`#334`](https://github.com/pagopa/selfcare-common-frontend/pull/334)
|
|
9
10
|
- improve build for lib [`#333`](https://github.com/pagopa/selfcare-common-frontend/pull/333)
|
|
10
11
|
- [SELC-8391] feat:: add new action ListAllProductUsers [`#332`](https://github.com/pagopa/selfcare-common-frontend/pull/332)
|
|
11
12
|
- add send products to backstage configuration [`#330`](https://github.com/pagopa/selfcare-common-frontend/pull/330)
|
|
@@ -157,10 +158,14 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
157
158
|
- Bump rimraf from 3.0.2 to 6.0.1 [`e6941b9`](https://github.com/pagopa/selfcare-common-frontend/commit/e6941b9e6b05c973d991e2470a851b5ca03926ce)
|
|
158
159
|
- Used a environment variable to manage correct links in the footer based to product and actual environment [`960e2fb`](https://github.com/pagopa/selfcare-common-frontend/commit/960e2fbaa8aa8f79061639b26dc1a27f28b8aae3)
|
|
159
160
|
|
|
160
|
-
#### [v1.35.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.
|
|
161
|
+
#### [v1.35.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.99...v1.35.0)
|
|
161
162
|
|
|
162
163
|
> 20 July 2023
|
|
163
164
|
|
|
165
|
+
#### [v1.34.99](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.98...v1.34.99)
|
|
166
|
+
|
|
167
|
+
> 19 March 2026
|
|
168
|
+
|
|
164
169
|
#### [v1.34.98](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.97...v1.34.98)
|
|
165
170
|
|
|
166
171
|
> 19 March 2026
|
package/build.info
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
20260319.
|
|
2
|
-
tags/v1.29.0~1^2
|
|
1
|
+
20260319.3 - selfcare-common-frontend.deploy(263265)
|
|
2
|
+
tags/v1.29.0~1^2 fd48bed1ca5cf2ca8ce9feb5d6915f170ef73a22
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagopa/selfcare-common-frontend",
|
|
3
3
|
"description": "Shared React components for the pagopa selfcare project",
|
|
4
|
-
"version": "1.34.
|
|
4
|
+
"version": "1.34.100",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/pagopa/selfcare-common-frontend",
|
|
7
7
|
"author": "https://www.pagopa.gov.it",
|
|
@@ -1,67 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
const regexReplace = require('regex-replace');
|
|
3
|
-
|
|
4
|
-
console.log(`Fixing Swagger 2.0 schema array definition in ${process.argv[2]}`);
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
5
2
|
|
|
6
3
|
const filePath = process.argv[2];
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const patternRef2 =
|
|
11
|
-
/"schema"\s*:\s*\{\s*"type"\s*:\s*"array"[^{]+\{\s*"\$ref"\s*:\s*"#\/definitions\/([^"]+)"[^}]*}[^}]*}((?:\n|.)*"definitions"\s*:\s*\{)/gm;
|
|
12
|
-
const replaceRef =
|
|
13
|
-
'"schema":{"$ref":"#/definitions/$1Array"}$2"$1Array":{"type": "array", "items": {"$ref": "#/definitions/$1"}},';
|
|
14
|
-
|
|
15
|
-
async function fixArrayDef(patternRef, replaceRef) {
|
|
16
|
-
regexReplace(patternRef, replaceRef, filePath).then((r) => {
|
|
17
|
-
fs.readFile(filePath, 'utf8', function (err, doc) {
|
|
18
|
-
if (doc.match(patternRef)) {
|
|
19
|
-
fixArrayDef(patternRef, replaceRef);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
});
|
|
5
|
+
if (!filePath) {
|
|
6
|
+
throw new Error('Missing file path argument');
|
|
23
7
|
}
|
|
24
8
|
|
|
25
|
-
const
|
|
26
|
-
new RegExp(
|
|
27
|
-
`"schema"\\s*:\\s*\\{[^{]+\\{\\s*"type"\\s*:\\s*"${nativeType}"[^,]+,\\s+"type"\\s*:\\s*"array"[^}]+}`,
|
|
28
|
-
'gm'
|
|
29
|
-
);
|
|
30
|
-
const replaceNativeArrayType = (nativeType) =>
|
|
31
|
-
`"schema":{"$ref":"#/definitions/${nativeType.toUpperCase()}Array"}`;
|
|
32
|
-
|
|
33
|
-
const patternNativeTypeRef = /"definitions"\s*:\s*\{/gm;
|
|
34
|
-
const replaceNativeArrayTypeRef = (nativeType) =>
|
|
35
|
-
`"definitions" : {"${nativeType.toUpperCase()}Array":{"type": "array", "items": {"type": "${nativeType}"}},`;
|
|
36
|
-
|
|
37
|
-
async function fixArrayNativeDef(nativeType) {
|
|
38
|
-
await regexReplace(
|
|
39
|
-
patternNativeArrayType(nativeType),
|
|
40
|
-
replaceNativeArrayType(nativeType),
|
|
41
|
-
filePath
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
await regexReplace(patternNativeTypeRef, replaceNativeArrayTypeRef(nativeType), filePath);
|
|
45
|
-
}
|
|
9
|
+
const doc = JSON.parse(await fs.readFile(filePath, 'utf8'));
|
|
46
10
|
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
const replaceNativeType = (nativeType) =>
|
|
50
|
-
`"schema":{"$ref":"#/definitions/${nativeType.toUpperCase()}Wrapper"}`;
|
|
51
|
-
const replaceNativeTypeRef = (nativeType) =>
|
|
52
|
-
`"definitions" : {"${nativeType.toUpperCase()}Wrapper":{"type": "${nativeType}"},`;
|
|
11
|
+
const definitions = doc.definitions || {};
|
|
12
|
+
doc.definitions = definitions;
|
|
53
13
|
|
|
54
|
-
|
|
55
|
-
|
|
14
|
+
// Utility
|
|
15
|
+
const ensureDefinition = (name, value) => {
|
|
16
|
+
if (!definitions[name]) {
|
|
17
|
+
definitions[name] = value;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
56
20
|
|
|
57
|
-
|
|
58
|
-
|
|
21
|
+
// Recursive traversal
|
|
22
|
+
function traverse(obj) {
|
|
23
|
+
if (!obj || typeof obj !== 'object') return;
|
|
24
|
+
|
|
25
|
+
if (obj.schema) {
|
|
26
|
+
const schema = obj.schema;
|
|
27
|
+
|
|
28
|
+
// CASE 1: array + $ref (invalid swagger)
|
|
29
|
+
if (schema.type === 'array' && schema.$ref) {
|
|
30
|
+
const refName = schema.$ref.split('/').pop();
|
|
31
|
+
const arrayName = `${refName}Array`;
|
|
32
|
+
|
|
33
|
+
ensureDefinition(arrayName, {
|
|
34
|
+
type: 'array',
|
|
35
|
+
items: { $ref: `#/definitions/${refName}` },
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
obj.schema = { $ref: `#/definitions/${arrayName}` };
|
|
39
|
+
}
|
|
59
40
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
41
|
+
// CASE 2: native array
|
|
42
|
+
if (schema.type === 'array' && schema.items?.type) {
|
|
43
|
+
const native = schema.items.type.toUpperCase();
|
|
44
|
+
const arrayName = `${native}Array`;
|
|
45
|
+
|
|
46
|
+
ensureDefinition(arrayName, {
|
|
47
|
+
type: 'array',
|
|
48
|
+
items: { type: schema.items.type },
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
obj.schema = { $ref: `#/definitions/${arrayName}` };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// CASE 3: native type
|
|
55
|
+
if (schema.type && typeof schema.type === 'string' && !schema.$ref) {
|
|
56
|
+
const native = schema.type.toUpperCase();
|
|
57
|
+
const wrapperName = `${native}Wrapper`;
|
|
58
|
+
|
|
59
|
+
ensureDefinition(wrapperName, {
|
|
60
|
+
type: schema.type,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
obj.schema = { $ref: `#/definitions/${wrapperName}` };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// recurse
|
|
68
|
+
Object.values(obj).forEach(traverse);
|
|
65
69
|
}
|
|
66
70
|
|
|
67
|
-
|
|
71
|
+
traverse(doc);
|
|
72
|
+
|
|
73
|
+
// Write back
|
|
74
|
+
await fs.writeFile(filePath, JSON.stringify(doc, null, 2));
|