@prismicio/types-internal 4.0.0-pr.7.9dec8db → 4.0.0
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/README.md +5 -5
- package/dist/helpers/customTypeModel.d.ts +1 -2
- package/dist/helpers/customTypeModel.d.ts.map +1 -1
- package/dist/helpers/customTypeModel.js +0 -30
- package/dist/helpers/customTypeModel.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/customTypeModel.ts +0 -44
- package/dist/content/legacy/boolean.d.ts +0 -1
- package/dist/content/legacy/embed.d.ts +0 -1
- package/dist/content/legacy/empty.d.ts +0 -1
- package/dist/content/legacy/field.d.ts +0 -1
- package/dist/content/legacy/geopoint.d.ts +0 -1
- package/dist/content/legacy/image.d.ts +0 -1
- package/dist/content/legacy/integrationField.d.ts +0 -1
- package/dist/content/legacy/nestable.d.ts +0 -1
- package/dist/content/legacy/repeatable.d.ts +0 -1
- package/dist/content/legacy/separator.d.ts +0 -1
- package/dist/content/legacy/table.d.ts +0 -1
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ Non-breaking space: are here on purpose to fix emoji rendering on certain
|
|
|
34
34
|
## Install
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
npm install @prismicio/types-internal
|
|
37
|
+
npm install @prismicio/types-internal-2
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Documentation
|
|
@@ -92,7 +92,7 @@ limitations under the License.
|
|
|
92
92
|
|
|
93
93
|
<!-- Badges -->
|
|
94
94
|
|
|
95
|
-
[npm-version-src]: https://img.shields.io/npm/v/@prismicio/types-internal/latest.svg
|
|
96
|
-
[npm-version-href]: https://npmjs.com/package/@prismicio/types-internal
|
|
97
|
-
[npm-downloads-src]: https://img.shields.io/npm/dm/@prismicio/types-internal.svg
|
|
98
|
-
[npm-downloads-href]: https://npmjs.com/package/@prismicio/types-internal
|
|
95
|
+
[npm-version-src]: https://img.shields.io/npm/v/@prismicio/types-internal-2/latest.svg
|
|
96
|
+
[npm-version-href]: https://npmjs.com/package/@prismicio/types-internal-2
|
|
97
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/@prismicio/types-internal-2.svg
|
|
98
|
+
[npm-downloads-href]: https://npmjs.com/package/@prismicio/types-internal-2
|
|
@@ -4,12 +4,11 @@ import { StaticSectionModel } from "../model/section.js";
|
|
|
4
4
|
|
|
5
5
|
//#region src/helpers/customTypeModel.d.ts
|
|
6
6
|
declare namespace customTypeModel_d_exports {
|
|
7
|
-
export { collectSharedSlices,
|
|
7
|
+
export { collectSharedSlices, flatten, toStatic };
|
|
8
8
|
}
|
|
9
9
|
declare function toStatic(customType: CustomTypeModel, sharedSlices: Map<string, SharedSliceModel> | Record<string, SharedSliceModel>): StaticCustomTypeModel;
|
|
10
10
|
declare function flatten(customType: StaticCustomTypeModel): StaticSectionModel;
|
|
11
11
|
declare function collectSharedSlices(customType: StaticCustomTypeModel): Record<string, SharedSliceModel>;
|
|
12
|
-
declare function filterMissingSharedSlices<TCustomType extends StaticCustomTypeModel | CustomTypeModel>(customType: TCustomType, sharedSlices: Map<string, SharedSliceModel> | Record<string, SharedSliceModel>): TCustomType;
|
|
13
12
|
//#endregion
|
|
14
13
|
export { customTypeModel_d_exports };
|
|
15
14
|
//# sourceMappingURL=customTypeModel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customTypeModel.d.ts","names":[],"sources":["../../src/helpers/customTypeModel.ts"],"mappings":";;;;;;;;iBAIgB,QAAA,CACf,UAAA,EAAY,eAAA,EACZ,YAAA,EAAc,GAAA,SAAY,gBAAA,IAAoB,MAAA,SAAe,gBAAA,IAC3D,qBAAA;AAAA,iBAwCa,OAAA,CAAQ,UAAA,EAAY,qBAAA,GAAwB,kBAAA;AAAA,iBAI5C,mBAAA,CACf,UAAA,EAAY,qBAAA,GACV,MAAA,SAAe,gBAAA
|
|
1
|
+
{"version":3,"file":"customTypeModel.d.ts","names":[],"sources":["../../src/helpers/customTypeModel.ts"],"mappings":";;;;;;;;iBAIgB,QAAA,CACf,UAAA,EAAY,eAAA,EACZ,YAAA,EAAc,GAAA,SAAY,gBAAA,IAAoB,MAAA,SAAe,gBAAA,IAC3D,qBAAA;AAAA,iBAwCa,OAAA,CAAQ,UAAA,EAAY,qBAAA,GAAwB,kBAAA;AAAA,iBAI5C,mBAAA,CACf,UAAA,EAAY,qBAAA,GACV,MAAA,SAAe,gBAAA"}
|
|
@@ -2,7 +2,6 @@ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
//#region src/helpers/customTypeModel.ts
|
|
3
3
|
var customTypeModel_exports = /* @__PURE__ */ __exportAll({
|
|
4
4
|
collectSharedSlices: () => collectSharedSlices,
|
|
5
|
-
filterMissingSharedSlices: () => filterMissingSharedSlices,
|
|
6
5
|
flatten: () => flatten,
|
|
7
6
|
toStatic: () => toStatic
|
|
8
7
|
});
|
|
@@ -50,35 +49,6 @@ function collectSharedSlices(customType) {
|
|
|
50
49
|
}
|
|
51
50
|
return sharedSlices;
|
|
52
51
|
}
|
|
53
|
-
function filterMissingSharedSlices(customType, sharedSlices) {
|
|
54
|
-
const json = {};
|
|
55
|
-
const sharedSlicesMap = sharedSlices instanceof Map ? sharedSlices : new Map(Object.entries(sharedSlices));
|
|
56
|
-
for (const [tabKey, tab] of Object.entries(customType.json)) {
|
|
57
|
-
const tabJSON = {};
|
|
58
|
-
for (const [key, widget] of Object.entries(tab)) switch (widget.type) {
|
|
59
|
-
case "Slices":
|
|
60
|
-
case "Choice":
|
|
61
|
-
const choices = {};
|
|
62
|
-
for (const [id, model] of Object.entries(widget.config?.choices || {})) if (model.type === "SharedSlice") {
|
|
63
|
-
if (sharedSlicesMap.get(id)) choices[id] = model;
|
|
64
|
-
} else choices[id] = model;
|
|
65
|
-
tabJSON[key] = {
|
|
66
|
-
...widget,
|
|
67
|
-
config: {
|
|
68
|
-
...widget.config,
|
|
69
|
-
choices
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
break;
|
|
73
|
-
default: tabJSON[key] = widget;
|
|
74
|
-
}
|
|
75
|
-
json[tabKey] = tabJSON;
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
...customType,
|
|
79
|
-
json
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
52
|
//#endregion
|
|
83
53
|
export { collectSharedSlices, customTypeModel_exports, flatten };
|
|
84
54
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customTypeModel.js","names":[],"sources":["../../src/helpers/customTypeModel.ts"],"sourcesContent":["import type { CustomTypeModel, StaticCustomTypeModel } from \"../model/customType\"\nimport type { StaticSectionModel } from \"../model/section\"\nimport type { SharedSliceModel, StaticSliceModel } from \"../model/slice\"\n\nexport function toStatic(\n\tcustomType: CustomTypeModel,\n\tsharedSlices: Map<string, SharedSliceModel> | Record<string, SharedSliceModel>,\n): StaticCustomTypeModel {\n\tconst json: StaticCustomTypeModel[\"json\"] = {}\n\n\tconst sharedSlicesMap =\n\t\tsharedSlices instanceof Map ? sharedSlices : new Map(Object.entries(sharedSlices))\n\n\tfor (const [tabKey, tab] of Object.entries(customType.json)) {\n\t\tconst tabJSON: StaticCustomTypeModel[\"json\"][string] = {}\n\t\tfor (const [key, widget] of Object.entries(tab)) {\n\t\t\tswitch (widget.type) {\n\t\t\t\tcase \"Slices\":\n\t\t\t\tcase \"Choice\":\n\t\t\t\t\tconst choices: Record<string, StaticSliceModel> = {}\n\t\t\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\t\t\tconst sharedSlice = sharedSlicesMap.get(id)\n\t\t\t\t\t\t\tif (sharedSlice) {\n\t\t\t\t\t\t\t\tchoices[id] = sharedSlice\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchoices[id] = model\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttabJSON[key] = {\n\t\t\t\t\t\t...widget,\n\t\t\t\t\t\tconfig: { ...widget.config, choices },\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\ttabJSON[key] = widget\n\t\t\t}\n\t\t}\n\n\t\tjson[tabKey] = tabJSON\n\t}\n\n\treturn { ...customType, json }\n}\n\nexport function flatten(customType: StaticCustomTypeModel): StaticSectionModel {\n\treturn Object.values(customType.json).reduce((acc, fields) => ({ ...acc, ...fields }), {})\n}\n\nexport function collectSharedSlices(\n\tcustomType: StaticCustomTypeModel,\n): Record<string, SharedSliceModel> {\n\tconst sharedSlices: Record<string, SharedSliceModel> = {}\n\n\tconst flattened = flatten(customType)\n\tfor (const widget of Object.values(flattened)) {\n\t\tif (widget.type === \"Slices\" || widget.type === \"Choice\") {\n\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\tsharedSlices[id] = model\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn sharedSlices\n}\n
|
|
1
|
+
{"version":3,"file":"customTypeModel.js","names":[],"sources":["../../src/helpers/customTypeModel.ts"],"sourcesContent":["import type { CustomTypeModel, StaticCustomTypeModel } from \"../model/customType\"\nimport type { StaticSectionModel } from \"../model/section\"\nimport type { SharedSliceModel, StaticSliceModel } from \"../model/slice\"\n\nexport function toStatic(\n\tcustomType: CustomTypeModel,\n\tsharedSlices: Map<string, SharedSliceModel> | Record<string, SharedSliceModel>,\n): StaticCustomTypeModel {\n\tconst json: StaticCustomTypeModel[\"json\"] = {}\n\n\tconst sharedSlicesMap =\n\t\tsharedSlices instanceof Map ? sharedSlices : new Map(Object.entries(sharedSlices))\n\n\tfor (const [tabKey, tab] of Object.entries(customType.json)) {\n\t\tconst tabJSON: StaticCustomTypeModel[\"json\"][string] = {}\n\t\tfor (const [key, widget] of Object.entries(tab)) {\n\t\t\tswitch (widget.type) {\n\t\t\t\tcase \"Slices\":\n\t\t\t\tcase \"Choice\":\n\t\t\t\t\tconst choices: Record<string, StaticSliceModel> = {}\n\t\t\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\t\t\tconst sharedSlice = sharedSlicesMap.get(id)\n\t\t\t\t\t\t\tif (sharedSlice) {\n\t\t\t\t\t\t\t\tchoices[id] = sharedSlice\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchoices[id] = model\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttabJSON[key] = {\n\t\t\t\t\t\t...widget,\n\t\t\t\t\t\tconfig: { ...widget.config, choices },\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\ttabJSON[key] = widget\n\t\t\t}\n\t\t}\n\n\t\tjson[tabKey] = tabJSON\n\t}\n\n\treturn { ...customType, json }\n}\n\nexport function flatten(customType: StaticCustomTypeModel): StaticSectionModel {\n\treturn Object.values(customType.json).reduce((acc, fields) => ({ ...acc, ...fields }), {})\n}\n\nexport function collectSharedSlices(\n\tcustomType: StaticCustomTypeModel,\n): Record<string, SharedSliceModel> {\n\tconst sharedSlices: Record<string, SharedSliceModel> = {}\n\n\tconst flattened = flatten(customType)\n\tfor (const widget of Object.values(flattened)) {\n\t\tif (widget.type === \"Slices\" || widget.type === \"Choice\") {\n\t\t\tfor (const [id, model] of Object.entries(widget.config?.choices || {})) {\n\t\t\t\tif (model.type === \"SharedSlice\") {\n\t\t\t\t\tsharedSlices[id] = model\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn sharedSlices\n}\n"],"mappings":";;;;;;;AAIA,SAAgB,SACf,YACA,cACwB;CACxB,MAAM,OAAsC,EAAE;CAE9C,MAAM,kBACL,wBAAwB,MAAM,eAAe,IAAI,IAAI,OAAO,QAAQ,aAAa,CAAC;AAEnF,MAAK,MAAM,CAAC,QAAQ,QAAQ,OAAO,QAAQ,WAAW,KAAK,EAAE;EAC5D,MAAM,UAAiD,EAAE;AACzD,OAAK,MAAM,CAAC,KAAK,WAAW,OAAO,QAAQ,IAAI,CAC9C,SAAQ,OAAO,MAAf;GACC,KAAK;GACL,KAAK;IACJ,MAAM,UAA4C,EAAE;AACpD,SAAK,MAAM,CAAC,IAAI,UAAU,OAAO,QAAQ,OAAO,QAAQ,WAAW,EAAE,CAAC,CACrE,KAAI,MAAM,SAAS,eAAe;KACjC,MAAM,cAAc,gBAAgB,IAAI,GAAG;AAC3C,SAAI,YACH,SAAQ,MAAM;UAGf,SAAQ,MAAM;AAIhB,YAAQ,OAAO;KACd,GAAG;KACH,QAAQ;MAAE,GAAG,OAAO;MAAQ;MAAS;KACrC;AACD;GACD,QACC,SAAQ,OAAO;;AAIlB,OAAK,UAAU;;AAGhB,QAAO;EAAE,GAAG;EAAY;EAAM;;AAG/B,SAAgB,QAAQ,YAAuD;AAC9E,QAAO,OAAO,OAAO,WAAW,KAAK,CAAC,QAAQ,KAAK,YAAY;EAAE,GAAG;EAAK,GAAG;EAAQ,GAAG,EAAE,CAAC;;AAG3F,SAAgB,oBACf,YACmC;CACnC,MAAM,eAAiD,EAAE;CAEzD,MAAM,YAAY,QAAQ,WAAW;AACrC,MAAK,MAAM,UAAU,OAAO,OAAO,UAAU,CAC5C,KAAI,OAAO,SAAS,YAAY,OAAO,SAAS;OAC1C,MAAM,CAAC,IAAI,UAAU,OAAO,QAAQ,OAAO,QAAQ,WAAW,EAAE,CAAC,CACrE,KAAI,MAAM,SAAS,cAClB,cAAa,MAAM;;AAMvB,QAAO"}
|
package/package.json
CHANGED
|
@@ -67,47 +67,3 @@ export function collectSharedSlices(
|
|
|
67
67
|
|
|
68
68
|
return sharedSlices
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
export function filterMissingSharedSlices<
|
|
72
|
-
TCustomType extends StaticCustomTypeModel | CustomTypeModel,
|
|
73
|
-
>(
|
|
74
|
-
customType: TCustomType,
|
|
75
|
-
sharedSlices: Map<string, SharedSliceModel> | Record<string, SharedSliceModel>,
|
|
76
|
-
): TCustomType {
|
|
77
|
-
const json: TCustomType["json"] = {}
|
|
78
|
-
|
|
79
|
-
const sharedSlicesMap =
|
|
80
|
-
sharedSlices instanceof Map ? sharedSlices : new Map(Object.entries(sharedSlices))
|
|
81
|
-
|
|
82
|
-
for (const [tabKey, tab] of Object.entries(customType.json)) {
|
|
83
|
-
const tabJSON: typeof tab = {}
|
|
84
|
-
for (const [key, widget] of Object.entries(tab)) {
|
|
85
|
-
switch (widget.type) {
|
|
86
|
-
case "Slices":
|
|
87
|
-
case "Choice":
|
|
88
|
-
const choices: Required<typeof widget>["config"]["choices"] = {}
|
|
89
|
-
for (const [id, model] of Object.entries(widget.config?.choices || {})) {
|
|
90
|
-
if (model.type === "SharedSlice") {
|
|
91
|
-
if (sharedSlicesMap.get(id)) {
|
|
92
|
-
choices[id] = model
|
|
93
|
-
}
|
|
94
|
-
} else {
|
|
95
|
-
choices[id] = model
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
tabJSON[key] = {
|
|
100
|
-
...widget,
|
|
101
|
-
config: { ...widget.config, choices },
|
|
102
|
-
}
|
|
103
|
-
break
|
|
104
|
-
default:
|
|
105
|
-
tabJSON[key] = widget
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
json[tabKey] = tabJSON
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return { ...customType, json }
|
|
113
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/mini";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/mini";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/mini";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/mini";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/mini";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/mini";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/mini";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/mini";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/mini";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/mini";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/mini";
|