@pagopa/selfcare-common-frontend 1.34.100 → 1.34.101
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 +9 -2
- package/build.info +2 -2
- package/package.json +1 -2
- package/utils/fixSwagger20ArraySchemaDef.js +56 -63
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.101](https://github.com/pagopa/selfcare-common-frontend/compare/v1.35.0...v1.34.101)
|
|
8
8
|
|
|
9
|
+
- reset type module [`#335`](https://github.com/pagopa/selfcare-common-frontend/pull/335)
|
|
9
10
|
- update to esm [`#334`](https://github.com/pagopa/selfcare-common-frontend/pull/334)
|
|
10
11
|
- improve build for lib [`#333`](https://github.com/pagopa/selfcare-common-frontend/pull/333)
|
|
11
12
|
- [SELC-8391] feat:: add new action ListAllProductUsers [`#332`](https://github.com/pagopa/selfcare-common-frontend/pull/332)
|
|
@@ -158,10 +159,16 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
158
159
|
- Bump rimraf from 3.0.2 to 6.0.1 [`e6941b9`](https://github.com/pagopa/selfcare-common-frontend/commit/e6941b9e6b05c973d991e2470a851b5ca03926ce)
|
|
159
160
|
- 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)
|
|
160
161
|
|
|
161
|
-
#### [v1.35.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.
|
|
162
|
+
#### [v1.35.0](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.100...v1.35.0)
|
|
162
163
|
|
|
163
164
|
> 20 July 2023
|
|
164
165
|
|
|
166
|
+
#### [v1.34.100](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.99...v1.34.100)
|
|
167
|
+
|
|
168
|
+
> 19 March 2026
|
|
169
|
+
|
|
170
|
+
- update to esm [`#334`](https://github.com/pagopa/selfcare-common-frontend/pull/334)
|
|
171
|
+
|
|
165
172
|
#### [v1.34.99](https://github.com/pagopa/selfcare-common-frontend/compare/v1.34.98...v1.34.99)
|
|
166
173
|
|
|
167
174
|
> 19 March 2026
|
package/build.info
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
tags/v1.29.0~1^2
|
|
1
|
+
20260324.1 - selfcare-common-frontend.deploy(263841)
|
|
2
|
+
tags/v1.29.0~1^2 3f5753cb8592d084906a197a396e13db9e3b37b5
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
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.101",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/pagopa/selfcare-common-frontend",
|
|
7
7
|
"author": "https://www.pagopa.gov.it",
|
|
8
8
|
"private": false,
|
|
9
9
|
"main": "lib/index.js",
|
|
10
10
|
"types": "lib/index.d.ts",
|
|
11
|
-
"type": "module",
|
|
12
11
|
"sideEffects": false,
|
|
13
12
|
"dependencies": {
|
|
14
13
|
"@emotion/react": "^11.11.1",
|
|
@@ -1,74 +1,67 @@
|
|
|
1
|
-
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const regexReplace = require('regex-replace');
|
|
3
|
+
|
|
4
|
+
console.log(`Fixing Swagger 2.0 schema array definition in ${process.argv[2]}`);
|
|
2
5
|
|
|
3
6
|
const filePath = process.argv[2];
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
const patternRef =
|
|
9
|
+
/"schema"\s*:\s*\{[^{]+\{\s*"\$ref"\s*:\s*"#\/definitions\/([^"]+)"[^,]+,\s+"type"\s*:\s*"array"[^}]+}((?:\n|.)*"definitions"\s*:\s*\{)/gm;
|
|
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
|
+
});
|
|
7
23
|
}
|
|
8
24
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
}
|
|
40
|
-
|
|
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`;
|
|
25
|
+
const patternNativeArrayType = (nativeType) =>
|
|
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
|
+
}
|
|
58
46
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
47
|
+
const patternNativeType = (nativeType) =>
|
|
48
|
+
new RegExp(`"schema"\\s*:\\s*\\{\\s*"type"\\s*:\\s*"${nativeType}"\\s*}`, 'gm');
|
|
49
|
+
const replaceNativeType = (nativeType) =>
|
|
50
|
+
`"schema":{"$ref":"#/definitions/${nativeType.toUpperCase()}Wrapper"}`;
|
|
51
|
+
const replaceNativeTypeRef = (nativeType) =>
|
|
52
|
+
`"definitions" : {"${nativeType.toUpperCase()}Wrapper":{"type": "${nativeType}"},`;
|
|
62
53
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
54
|
+
async function fixNativeDef(nativeType) {
|
|
55
|
+
await regexReplace(patternNativeType(nativeType), replaceNativeType(nativeType), filePath);
|
|
66
56
|
|
|
67
|
-
|
|
68
|
-
Object.values(obj).forEach(traverse);
|
|
57
|
+
await regexReplace(patternNativeTypeRef, replaceNativeTypeRef(nativeType), filePath);
|
|
69
58
|
}
|
|
70
59
|
|
|
71
|
-
|
|
60
|
+
async function exec() {
|
|
61
|
+
await fixArrayDef(patternRef, replaceRef);
|
|
62
|
+
await fixArrayDef(patternRef2, replaceRef);
|
|
63
|
+
await fixArrayNativeDef('string');
|
|
64
|
+
await fixNativeDef('string');
|
|
65
|
+
}
|
|
72
66
|
|
|
73
|
-
|
|
74
|
-
await fs.writeFile(filePath, JSON.stringify(doc, null, 2));
|
|
67
|
+
exec();
|