@prismicio/client 7.21.2 → 7.21.3-pr.431.23cc5c6
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/dist/iac/customType.cjs +54 -0
- package/dist/iac/customType.cjs.map +1 -0
- package/dist/iac/customType.d.cts +43 -0
- package/dist/iac/customType.d.cts.map +1 -0
- package/dist/iac/customType.d.ts +43 -0
- package/dist/iac/customType.d.ts.map +1 -0
- package/dist/iac/customType.js +53 -0
- package/dist/iac/customType.js.map +1 -0
- package/dist/iac/fields/boolean.cjs +38 -0
- package/dist/iac/fields/boolean.cjs.map +1 -0
- package/dist/iac/fields/boolean.d.cts +22 -0
- package/dist/iac/fields/boolean.d.cts.map +1 -0
- package/dist/iac/fields/boolean.d.ts +22 -0
- package/dist/iac/fields/boolean.d.ts.map +1 -0
- package/dist/iac/fields/boolean.js +38 -0
- package/dist/iac/fields/boolean.js.map +1 -0
- package/dist/iac/fields/color.cjs +29 -0
- package/dist/iac/fields/color.cjs.map +1 -0
- package/dist/iac/fields/color.d.cts +11 -0
- package/dist/iac/fields/color.d.cts.map +1 -0
- package/dist/iac/fields/color.d.ts +11 -0
- package/dist/iac/fields/color.d.ts.map +1 -0
- package/dist/iac/fields/color.js +29 -0
- package/dist/iac/fields/color.js.map +1 -0
- package/dist/iac/fields/contentRelationship.cjs +50 -0
- package/dist/iac/fields/contentRelationship.cjs.map +1 -0
- package/dist/iac/fields/contentRelationship.d.cts +23 -0
- package/dist/iac/fields/contentRelationship.d.cts.map +1 -0
- package/dist/iac/fields/contentRelationship.d.ts +23 -0
- package/dist/iac/fields/contentRelationship.d.ts.map +1 -0
- package/dist/iac/fields/contentRelationship.js +50 -0
- package/dist/iac/fields/contentRelationship.js.map +1 -0
- package/dist/iac/fields/date.cjs +29 -0
- package/dist/iac/fields/date.cjs.map +1 -0
- package/dist/iac/fields/date.d.cts +11 -0
- package/dist/iac/fields/date.d.cts.map +1 -0
- package/dist/iac/fields/date.d.ts +11 -0
- package/dist/iac/fields/date.d.ts.map +1 -0
- package/dist/iac/fields/date.js +29 -0
- package/dist/iac/fields/date.js.map +1 -0
- package/dist/iac/fields/embed.cjs +29 -0
- package/dist/iac/fields/embed.cjs.map +1 -0
- package/dist/iac/fields/embed.d.cts +11 -0
- package/dist/iac/fields/embed.d.cts.map +1 -0
- package/dist/iac/fields/embed.d.ts +11 -0
- package/dist/iac/fields/embed.d.ts.map +1 -0
- package/dist/iac/fields/embed.js +29 -0
- package/dist/iac/fields/embed.js.map +1 -0
- package/dist/iac/fields/geoPoint.cjs +26 -0
- package/dist/iac/fields/geoPoint.cjs.map +1 -0
- package/dist/iac/fields/geoPoint.d.cts +10 -0
- package/dist/iac/fields/geoPoint.d.cts.map +1 -0
- package/dist/iac/fields/geoPoint.d.ts +10 -0
- package/dist/iac/fields/geoPoint.d.ts.map +1 -0
- package/dist/iac/fields/geoPoint.js +26 -0
- package/dist/iac/fields/geoPoint.js.map +1 -0
- package/dist/iac/fields/group.cjs +38 -0
- package/dist/iac/fields/group.cjs.map +1 -0
- package/dist/iac/fields/group.d.cts +17 -0
- package/dist/iac/fields/group.d.cts.map +1 -0
- package/dist/iac/fields/group.d.ts +17 -0
- package/dist/iac/fields/group.d.ts.map +1 -0
- package/dist/iac/fields/group.js +38 -0
- package/dist/iac/fields/group.js.map +1 -0
- package/dist/iac/fields/image.cjs +48 -0
- package/dist/iac/fields/image.cjs.map +1 -0
- package/dist/iac/fields/image.d.cts +21 -0
- package/dist/iac/fields/image.d.cts.map +1 -0
- package/dist/iac/fields/image.d.ts +21 -0
- package/dist/iac/fields/image.d.ts.map +1 -0
- package/dist/iac/fields/image.js +48 -0
- package/dist/iac/fields/image.js.map +1 -0
- package/dist/iac/fields/integration.cjs +33 -0
- package/dist/iac/fields/integration.cjs.map +1 -0
- package/dist/iac/fields/integration.d.cts +15 -0
- package/dist/iac/fields/integration.d.cts.map +1 -0
- package/dist/iac/fields/integration.d.ts +15 -0
- package/dist/iac/fields/integration.d.ts.map +1 -0
- package/dist/iac/fields/integration.js +33 -0
- package/dist/iac/fields/integration.js.map +1 -0
- package/dist/iac/fields/link.cjs +45 -0
- package/dist/iac/fields/link.cjs.map +1 -0
- package/dist/iac/fields/link.d.cts +39 -0
- package/dist/iac/fields/link.d.cts.map +1 -0
- package/dist/iac/fields/link.d.ts +39 -0
- package/dist/iac/fields/link.d.ts.map +1 -0
- package/dist/iac/fields/link.js +45 -0
- package/dist/iac/fields/link.js.map +1 -0
- package/dist/iac/fields/linkToMedia.cjs +31 -0
- package/dist/iac/fields/linkToMedia.cjs.map +1 -0
- package/dist/iac/fields/linkToMedia.d.cts +11 -0
- package/dist/iac/fields/linkToMedia.d.cts.map +1 -0
- package/dist/iac/fields/linkToMedia.d.ts +11 -0
- package/dist/iac/fields/linkToMedia.d.ts.map +1 -0
- package/dist/iac/fields/linkToMedia.js +31 -0
- package/dist/iac/fields/linkToMedia.js.map +1 -0
- package/dist/iac/fields/number.cjs +29 -0
- package/dist/iac/fields/number.cjs.map +1 -0
- package/dist/iac/fields/number.d.cts +11 -0
- package/dist/iac/fields/number.d.cts.map +1 -0
- package/dist/iac/fields/number.d.ts +11 -0
- package/dist/iac/fields/number.d.ts.map +1 -0
- package/dist/iac/fields/number.js +29 -0
- package/dist/iac/fields/number.js.map +1 -0
- package/dist/iac/fields/richText.cjs +49 -0
- package/dist/iac/fields/richText.cjs.map +1 -0
- package/dist/iac/fields/richText.d.cts +33 -0
- package/dist/iac/fields/richText.d.cts.map +1 -0
- package/dist/iac/fields/richText.d.ts +33 -0
- package/dist/iac/fields/richText.d.ts.map +1 -0
- package/dist/iac/fields/richText.js +49 -0
- package/dist/iac/fields/richText.js.map +1 -0
- package/dist/iac/fields/select.cjs +46 -0
- package/dist/iac/fields/select.cjs.map +1 -0
- package/dist/iac/fields/select.d.cts +15 -0
- package/dist/iac/fields/select.d.cts.map +1 -0
- package/dist/iac/fields/select.d.ts +15 -0
- package/dist/iac/fields/select.d.ts.map +1 -0
- package/dist/iac/fields/select.js +46 -0
- package/dist/iac/fields/select.js.map +1 -0
- package/dist/iac/fields/sliceZone.cjs +37 -0
- package/dist/iac/fields/sliceZone.cjs.map +1 -0
- package/dist/iac/fields/sliceZone.d.cts +30 -0
- package/dist/iac/fields/sliceZone.d.cts.map +1 -0
- package/dist/iac/fields/sliceZone.d.ts +30 -0
- package/dist/iac/fields/sliceZone.d.ts.map +1 -0
- package/dist/iac/fields/sliceZone.js +37 -0
- package/dist/iac/fields/sliceZone.js.map +1 -0
- package/dist/iac/fields/table.cjs +26 -0
- package/dist/iac/fields/table.cjs.map +1 -0
- package/dist/iac/fields/table.d.cts +10 -0
- package/dist/iac/fields/table.d.cts.map +1 -0
- package/dist/iac/fields/table.d.ts +10 -0
- package/dist/iac/fields/table.d.ts.map +1 -0
- package/dist/iac/fields/table.js +26 -0
- package/dist/iac/fields/table.js.map +1 -0
- package/dist/iac/fields/text.cjs +29 -0
- package/dist/iac/fields/text.cjs.map +1 -0
- package/dist/iac/fields/text.d.cts +11 -0
- package/dist/iac/fields/text.d.cts.map +1 -0
- package/dist/iac/fields/text.d.ts +11 -0
- package/dist/iac/fields/text.d.ts.map +1 -0
- package/dist/iac/fields/text.js +29 -0
- package/dist/iac/fields/text.js.map +1 -0
- package/dist/iac/fields/timestamp.cjs +29 -0
- package/dist/iac/fields/timestamp.cjs.map +1 -0
- package/dist/iac/fields/timestamp.d.cts +11 -0
- package/dist/iac/fields/timestamp.d.cts.map +1 -0
- package/dist/iac/fields/timestamp.d.ts +11 -0
- package/dist/iac/fields/timestamp.d.ts.map +1 -0
- package/dist/iac/fields/timestamp.js +29 -0
- package/dist/iac/fields/timestamp.js.map +1 -0
- package/dist/iac/fields/uid.cjs +29 -0
- package/dist/iac/fields/uid.cjs.map +1 -0
- package/dist/iac/fields/uid.d.cts +11 -0
- package/dist/iac/fields/uid.d.cts.map +1 -0
- package/dist/iac/fields/uid.d.ts +11 -0
- package/dist/iac/fields/uid.d.ts.map +1 -0
- package/dist/iac/fields/uid.js +29 -0
- package/dist/iac/fields/uid.js.map +1 -0
- package/dist/iac/sharedSlice.cjs +54 -0
- package/dist/iac/sharedSlice.cjs.map +1 -0
- package/dist/iac/sharedSlice.d.cts +28 -0
- package/dist/iac/sharedSlice.d.cts.map +1 -0
- package/dist/iac/sharedSlice.d.ts +28 -0
- package/dist/iac/sharedSlice.d.ts.map +1 -0
- package/dist/iac/sharedSlice.js +54 -0
- package/dist/iac/sharedSlice.js.map +1 -0
- package/dist/iac/variation.cjs +45 -0
- package/dist/iac/variation.cjs.map +1 -0
- package/dist/iac/variation.d.cts +46 -0
- package/dist/iac/variation.d.cts.map +1 -0
- package/dist/iac/variation.d.ts +46 -0
- package/dist/iac/variation.d.ts.map +1 -0
- package/dist/iac/variation.js +44 -0
- package/dist/iac/variation.js.map +1 -0
- package/dist/iac.cjs +86 -0
- package/dist/iac.cjs.map +1 -0
- package/dist/iac.d.cts +109 -0
- package/dist/iac.d.cts.map +1 -0
- package/dist/iac.d.ts +110 -0
- package/dist/iac.d.ts.map +1 -0
- package/dist/iac.js +86 -0
- package/dist/iac.js.map +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/dist/types/model/types.d.cts +2 -2
- package/dist/types/model/types.d.ts +2 -2
- package/package.json +9 -2
- package/src/iac/customType.ts +98 -0
- package/src/iac/fields/boolean.ts +55 -0
- package/src/iac/fields/color.ts +33 -0
- package/src/iac/fields/contentRelationship.ts +74 -0
- package/src/iac/fields/date.ts +33 -0
- package/src/iac/fields/embed.ts +33 -0
- package/src/iac/fields/geoPoint.ts +33 -0
- package/src/iac/fields/group.ts +58 -0
- package/src/iac/fields/image.ts +65 -0
- package/src/iac/fields/index.ts +62 -0
- package/src/iac/fields/integration.ts +43 -0
- package/src/iac/fields/link.ts +79 -0
- package/src/iac/fields/linkToMedia.ts +37 -0
- package/src/iac/fields/number.ts +35 -0
- package/src/iac/fields/richText.ts +84 -0
- package/src/iac/fields/select.ts +63 -0
- package/src/iac/fields/sliceZone.ts +82 -0
- package/src/iac/fields/table.ts +31 -0
- package/src/iac/fields/text.ts +33 -0
- package/src/iac/fields/timestamp.ts +35 -0
- package/src/iac/fields/uid.ts +33 -0
- package/src/iac/index.ts +122 -0
- package/src/iac/sharedSlice.ts +81 -0
- package/src/iac/variation.ts +107 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/iac/customType.ts
|
|
3
|
+
/**
|
|
4
|
+
* Creates a custom type model.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* const blogPost = model.customType({
|
|
10
|
+
* id: "blog_post",
|
|
11
|
+
* label: "Blog Post",
|
|
12
|
+
* repeatable: true,
|
|
13
|
+
* format: "page",
|
|
14
|
+
* json: {
|
|
15
|
+
* Main: {
|
|
16
|
+
* uid: model.uid({ label: "UID" }),
|
|
17
|
+
* title: model.richText({ label: "Title", single: "heading1" }),
|
|
18
|
+
* featured_image: model.image({ label: "Featured Image" }),
|
|
19
|
+
* body: model.sliceZone({
|
|
20
|
+
* choices: {
|
|
21
|
+
* hero: { type: "SharedSlice" },
|
|
22
|
+
* text_block: { type: "SharedSlice" }
|
|
23
|
+
* }
|
|
24
|
+
* })
|
|
25
|
+
* },
|
|
26
|
+
* SEO: {
|
|
27
|
+
* meta_title: model.text({ label: "Meta Title" }),
|
|
28
|
+
* meta_description: model.text({ label: "Meta Description" })
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
* })
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @typeParam ID - Custom type ID literal for type inference.
|
|
35
|
+
* @typeParam Definition - Tabs and fields definition for type inference.
|
|
36
|
+
*
|
|
37
|
+
* @param config - Configuration for the custom type.
|
|
38
|
+
*
|
|
39
|
+
* @returns A custom type model.
|
|
40
|
+
*/
|
|
41
|
+
const customType = (config) => {
|
|
42
|
+
return {
|
|
43
|
+
id: config.id,
|
|
44
|
+
label: config.label ?? null,
|
|
45
|
+
repeatable: config.repeatable,
|
|
46
|
+
format: config.format,
|
|
47
|
+
status: config.status ?? true,
|
|
48
|
+
json: config.json
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
exports.customType = customType;
|
|
54
|
+
//# sourceMappingURL=customType.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType.cjs","names":[],"sources":["../../src/iac/customType.ts"],"sourcesContent":["import type {\n\tCustomTypeModel,\n\tCustomTypeModelDefinition,\n} from \"../types/model/customType\"\n\n/**\n * Configuration for a custom type.\n */\nexport interface CustomTypeConfig<\n\tID extends string = string,\n\tDefinition extends CustomTypeModelDefinition = CustomTypeModelDefinition,\n> {\n\t/**\n\t * The API ID of the custom type.\n\t */\n\tid: ID\n\t/**\n\t * The human-readable name of the custom type.\n\t */\n\tlabel?: string | null\n\t/**\n\t * Whether multiple documents of this type can be created.\n\t */\n\trepeatable: boolean\n\t/**\n\t * The format of the custom type.\n\t *\n\t * - `\"page\"` - A page type (has a URL).\n\t * - `\"custom\"` - A custom type (no URL).\n\t *\n\t * @defaultValue `\"custom\"`\n\t */\n\tformat?: \"page\" | \"custom\"\n\t/**\n\t * Whether new documents for this type can be created.\n\t *\n\t * @defaultValue `true`\n\t */\n\tstatus?: boolean\n\t/**\n\t * The tabs and fields definition for this custom type.\n\t */\n\tjson: Definition\n}\n\n/**\n * Creates a custom type model.\n *\n * @example\n *\n * ```ts\n * const blogPost = model.customType({\n * id: \"blog_post\",\n * label: \"Blog Post\",\n * repeatable: true,\n * format: \"page\",\n * json: {\n * Main: {\n * uid: model.uid({ label: \"UID\" }),\n * title: model.richText({ label: \"Title\", single: \"heading1\" }),\n * featured_image: model.image({ label: \"Featured Image\" }),\n * body: model.sliceZone({\n * choices: {\n * hero: { type: \"SharedSlice\" },\n * text_block: { type: \"SharedSlice\" }\n * }\n * })\n * },\n * SEO: {\n * meta_title: model.text({ label: \"Meta Title\" }),\n * meta_description: model.text({ label: \"Meta Description\" })\n * }\n * }\n * })\n * ```\n *\n * @typeParam ID - Custom type ID literal for type inference.\n * @typeParam Definition - Tabs and fields definition for type inference.\n *\n * @param config - Configuration for the custom type.\n *\n * @returns A custom type model.\n */\nexport const customType = <\n\tID extends string,\n\tDefinition extends CustomTypeModelDefinition,\n>(\n\tconfig: CustomTypeConfig<ID, Definition>,\n): CustomTypeModel<ID, Definition> => {\n\treturn {\n\t\tid: config.id,\n\t\tlabel: config.label ?? null,\n\t\trepeatable: config.repeatable,\n\t\tformat: config.format,\n\t\tstatus: config.status ?? true,\n\t\tjson: config.json,\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA,MAAa,cAIZ,WACqC;AACrC,QAAO;EACN,IAAI,OAAO;EACX,OAAO,OAAO,SAAS;EACvB,YAAY,OAAO;EACnB,QAAQ,OAAO;EACf,QAAQ,OAAO,UAAU;EACzB,MAAM,OAAO;EACb"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CustomTypeModelDefinition } from "../types/model/customType.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/iac/customType.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Configuration for a custom type.
|
|
7
|
+
*/
|
|
8
|
+
interface CustomTypeConfig<ID extends string = string, Definition extends CustomTypeModelDefinition = CustomTypeModelDefinition> {
|
|
9
|
+
/**
|
|
10
|
+
* The API ID of the custom type.
|
|
11
|
+
*/
|
|
12
|
+
id: ID;
|
|
13
|
+
/**
|
|
14
|
+
* The human-readable name of the custom type.
|
|
15
|
+
*/
|
|
16
|
+
label?: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Whether multiple documents of this type can be created.
|
|
19
|
+
*/
|
|
20
|
+
repeatable: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The format of the custom type.
|
|
23
|
+
*
|
|
24
|
+
* - `"page"` - A page type (has a URL).
|
|
25
|
+
* - `"custom"` - A custom type (no URL).
|
|
26
|
+
*
|
|
27
|
+
* @defaultValue `"custom"`
|
|
28
|
+
*/
|
|
29
|
+
format?: "page" | "custom";
|
|
30
|
+
/**
|
|
31
|
+
* Whether new documents for this type can be created.
|
|
32
|
+
*
|
|
33
|
+
* @defaultValue `true`
|
|
34
|
+
*/
|
|
35
|
+
status?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The tabs and fields definition for this custom type.
|
|
38
|
+
*/
|
|
39
|
+
json: Definition;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { CustomTypeConfig };
|
|
43
|
+
//# sourceMappingURL=customType.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType.d.cts","names":[],"sources":["../../src/iac/customType.ts"],"sourcesContent":[],"mappings":";;;;;;AAQA;AAEoB,UAFH,gBAEG,CAAA,WAAA,MAAA,GAAA,MAAA,EAAA,mBAAA,yBAAA,GAA4B,yBAA5B,CAAA,CAAA;EAA4B;;;EAgC/B,EAAA,EA3BZ,EA2BY;;;;;;;;;;;;;;;;;;;;;;;;;;;QAAV"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CustomTypeModelDefinition } from "../types/model/customType.js";
|
|
2
|
+
|
|
3
|
+
//#region src/iac/customType.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Configuration for a custom type.
|
|
7
|
+
*/
|
|
8
|
+
interface CustomTypeConfig<ID extends string = string, Definition extends CustomTypeModelDefinition = CustomTypeModelDefinition> {
|
|
9
|
+
/**
|
|
10
|
+
* The API ID of the custom type.
|
|
11
|
+
*/
|
|
12
|
+
id: ID;
|
|
13
|
+
/**
|
|
14
|
+
* The human-readable name of the custom type.
|
|
15
|
+
*/
|
|
16
|
+
label?: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Whether multiple documents of this type can be created.
|
|
19
|
+
*/
|
|
20
|
+
repeatable: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The format of the custom type.
|
|
23
|
+
*
|
|
24
|
+
* - `"page"` - A page type (has a URL).
|
|
25
|
+
* - `"custom"` - A custom type (no URL).
|
|
26
|
+
*
|
|
27
|
+
* @defaultValue `"custom"`
|
|
28
|
+
*/
|
|
29
|
+
format?: "page" | "custom";
|
|
30
|
+
/**
|
|
31
|
+
* Whether new documents for this type can be created.
|
|
32
|
+
*
|
|
33
|
+
* @defaultValue `true`
|
|
34
|
+
*/
|
|
35
|
+
status?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The tabs and fields definition for this custom type.
|
|
38
|
+
*/
|
|
39
|
+
json: Definition;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { CustomTypeConfig };
|
|
43
|
+
//# sourceMappingURL=customType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType.d.ts","names":[],"sources":["../../src/iac/customType.ts"],"sourcesContent":[],"mappings":";;;;;;AAQA;AAEoB,UAFH,gBAEG,CAAA,WAAA,MAAA,GAAA,MAAA,EAAA,mBAAA,yBAAA,GAA4B,yBAA5B,CAAA,CAAA;EAA4B;;;EAgC/B,EAAA,EA3BZ,EA2BY;;;;;;;;;;;;;;;;;;;;;;;;;;;QAAV"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/iac/customType.ts
|
|
2
|
+
/**
|
|
3
|
+
* Creates a custom type model.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* const blogPost = model.customType({
|
|
9
|
+
* id: "blog_post",
|
|
10
|
+
* label: "Blog Post",
|
|
11
|
+
* repeatable: true,
|
|
12
|
+
* format: "page",
|
|
13
|
+
* json: {
|
|
14
|
+
* Main: {
|
|
15
|
+
* uid: model.uid({ label: "UID" }),
|
|
16
|
+
* title: model.richText({ label: "Title", single: "heading1" }),
|
|
17
|
+
* featured_image: model.image({ label: "Featured Image" }),
|
|
18
|
+
* body: model.sliceZone({
|
|
19
|
+
* choices: {
|
|
20
|
+
* hero: { type: "SharedSlice" },
|
|
21
|
+
* text_block: { type: "SharedSlice" }
|
|
22
|
+
* }
|
|
23
|
+
* })
|
|
24
|
+
* },
|
|
25
|
+
* SEO: {
|
|
26
|
+
* meta_title: model.text({ label: "Meta Title" }),
|
|
27
|
+
* meta_description: model.text({ label: "Meta Description" })
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
* })
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @typeParam ID - Custom type ID literal for type inference.
|
|
34
|
+
* @typeParam Definition - Tabs and fields definition for type inference.
|
|
35
|
+
*
|
|
36
|
+
* @param config - Configuration for the custom type.
|
|
37
|
+
*
|
|
38
|
+
* @returns A custom type model.
|
|
39
|
+
*/
|
|
40
|
+
const customType = (config) => {
|
|
41
|
+
return {
|
|
42
|
+
id: config.id,
|
|
43
|
+
label: config.label ?? null,
|
|
44
|
+
repeatable: config.repeatable,
|
|
45
|
+
format: config.format,
|
|
46
|
+
status: config.status ?? true,
|
|
47
|
+
json: config.json
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { customType };
|
|
53
|
+
//# sourceMappingURL=customType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customType.js","names":[],"sources":["../../src/iac/customType.ts"],"sourcesContent":["import type {\n\tCustomTypeModel,\n\tCustomTypeModelDefinition,\n} from \"../types/model/customType\"\n\n/**\n * Configuration for a custom type.\n */\nexport interface CustomTypeConfig<\n\tID extends string = string,\n\tDefinition extends CustomTypeModelDefinition = CustomTypeModelDefinition,\n> {\n\t/**\n\t * The API ID of the custom type.\n\t */\n\tid: ID\n\t/**\n\t * The human-readable name of the custom type.\n\t */\n\tlabel?: string | null\n\t/**\n\t * Whether multiple documents of this type can be created.\n\t */\n\trepeatable: boolean\n\t/**\n\t * The format of the custom type.\n\t *\n\t * - `\"page\"` - A page type (has a URL).\n\t * - `\"custom\"` - A custom type (no URL).\n\t *\n\t * @defaultValue `\"custom\"`\n\t */\n\tformat?: \"page\" | \"custom\"\n\t/**\n\t * Whether new documents for this type can be created.\n\t *\n\t * @defaultValue `true`\n\t */\n\tstatus?: boolean\n\t/**\n\t * The tabs and fields definition for this custom type.\n\t */\n\tjson: Definition\n}\n\n/**\n * Creates a custom type model.\n *\n * @example\n *\n * ```ts\n * const blogPost = model.customType({\n * id: \"blog_post\",\n * label: \"Blog Post\",\n * repeatable: true,\n * format: \"page\",\n * json: {\n * Main: {\n * uid: model.uid({ label: \"UID\" }),\n * title: model.richText({ label: \"Title\", single: \"heading1\" }),\n * featured_image: model.image({ label: \"Featured Image\" }),\n * body: model.sliceZone({\n * choices: {\n * hero: { type: \"SharedSlice\" },\n * text_block: { type: \"SharedSlice\" }\n * }\n * })\n * },\n * SEO: {\n * meta_title: model.text({ label: \"Meta Title\" }),\n * meta_description: model.text({ label: \"Meta Description\" })\n * }\n * }\n * })\n * ```\n *\n * @typeParam ID - Custom type ID literal for type inference.\n * @typeParam Definition - Tabs and fields definition for type inference.\n *\n * @param config - Configuration for the custom type.\n *\n * @returns A custom type model.\n */\nexport const customType = <\n\tID extends string,\n\tDefinition extends CustomTypeModelDefinition,\n>(\n\tconfig: CustomTypeConfig<ID, Definition>,\n): CustomTypeModel<ID, Definition> => {\n\treturn {\n\t\tid: config.id,\n\t\tlabel: config.label ?? null,\n\t\trepeatable: config.repeatable,\n\t\tformat: config.format,\n\t\tstatus: config.status ?? true,\n\t\tjson: config.json,\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA,MAAa,cAIZ,WACqC;AACrC,QAAO;EACN,IAAI,OAAO;EACX,OAAO,OAAO,SAAS;EACvB,YAAY,OAAO;EACnB,QAAQ,OAAO;EACf,QAAQ,OAAO,UAAU;EACzB,MAAM,OAAO;EACb"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const require_types = require('../../types/model/types.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/iac/fields/boolean.ts
|
|
4
|
+
/**
|
|
5
|
+
* Creates a boolean field model.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* model.boolean({ label: "Featured" })
|
|
11
|
+
*
|
|
12
|
+
* model.boolean({
|
|
13
|
+
* label: "Published",
|
|
14
|
+
* default_value: false,
|
|
15
|
+
* placeholder_true: "Published",
|
|
16
|
+
* placeholder_false: "Draft"
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @param config - Configuration for the field.
|
|
21
|
+
*
|
|
22
|
+
* @returns A boolean field model.
|
|
23
|
+
*/
|
|
24
|
+
const boolean = (config) => {
|
|
25
|
+
return {
|
|
26
|
+
type: require_types.CustomTypeModelFieldType.Boolean,
|
|
27
|
+
config: {
|
|
28
|
+
label: (config === null || config === void 0 ? void 0 : config.label) ?? null,
|
|
29
|
+
default_value: config === null || config === void 0 ? void 0 : config.default_value,
|
|
30
|
+
placeholder_true: config === null || config === void 0 ? void 0 : config.placeholder_true,
|
|
31
|
+
placeholder_false: config === null || config === void 0 ? void 0 : config.placeholder_false
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.boolean = boolean;
|
|
38
|
+
//# sourceMappingURL=boolean.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean.cjs","names":["CustomTypeModelFieldType"],"sources":["../../../src/iac/fields/boolean.ts"],"sourcesContent":["import type { CustomTypeModelBooleanField } from \"../../types/model/boolean\"\nimport { CustomTypeModelFieldType } from \"../../types/model/types\"\n\n/**\n * Configuration for a boolean field.\n */\nexport interface BooleanFieldConfig {\n\tlabel?: string | null\n\t/**\n\t * Default value for the boolean field.\n\t */\n\tdefault_value?: boolean\n\t/**\n\t * Placeholder text shown when the value is true.\n\t */\n\tplaceholder_true?: string\n\t/**\n\t * Placeholder text shown when the value is false.\n\t */\n\tplaceholder_false?: string\n}\n\n/**\n * Creates a boolean field model.\n *\n * @example\n *\n * ```ts\n * model.boolean({ label: \"Featured\" })\n *\n * model.boolean({\n * label: \"Published\",\n * default_value: false,\n * placeholder_true: \"Published\",\n * placeholder_false: \"Draft\"\n * })\n * ```\n *\n * @param config - Configuration for the field.\n *\n * @returns A boolean field model.\n */\nexport const boolean = (\n\tconfig?: BooleanFieldConfig,\n): CustomTypeModelBooleanField => {\n\treturn {\n\t\ttype: CustomTypeModelFieldType.Boolean,\n\t\tconfig: {\n\t\t\tlabel: config?.label ?? null,\n\t\t\tdefault_value: config?.default_value,\n\t\t\tplaceholder_true: config?.placeholder_true,\n\t\t\tplaceholder_false: config?.placeholder_false,\n\t\t},\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,WACZ,WACiC;AACjC,QAAO;EACN,MAAMA,uCAAyB;EAC/B,QAAQ;GACP,wDAAO,OAAQ,UAAS;GACxB,+DAAe,OAAQ;GACvB,kEAAkB,OAAQ;GAC1B,mEAAmB,OAAQ;GAC3B;EACD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/iac/fields/boolean.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for a boolean field.
|
|
4
|
+
*/
|
|
5
|
+
interface BooleanFieldConfig {
|
|
6
|
+
label?: string | null;
|
|
7
|
+
/**
|
|
8
|
+
* Default value for the boolean field.
|
|
9
|
+
*/
|
|
10
|
+
default_value?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Placeholder text shown when the value is true.
|
|
13
|
+
*/
|
|
14
|
+
placeholder_true?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Placeholder text shown when the value is false.
|
|
17
|
+
*/
|
|
18
|
+
placeholder_false?: string;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { BooleanFieldConfig };
|
|
22
|
+
//# sourceMappingURL=boolean.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean.d.cts","names":[],"sources":["../../../src/iac/fields/boolean.ts"],"sourcesContent":[],"mappings":";AAMA;;;UAAiB,kBAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/iac/fields/boolean.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for a boolean field.
|
|
4
|
+
*/
|
|
5
|
+
interface BooleanFieldConfig {
|
|
6
|
+
label?: string | null;
|
|
7
|
+
/**
|
|
8
|
+
* Default value for the boolean field.
|
|
9
|
+
*/
|
|
10
|
+
default_value?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Placeholder text shown when the value is true.
|
|
13
|
+
*/
|
|
14
|
+
placeholder_true?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Placeholder text shown when the value is false.
|
|
17
|
+
*/
|
|
18
|
+
placeholder_false?: string;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { BooleanFieldConfig };
|
|
22
|
+
//# sourceMappingURL=boolean.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean.d.ts","names":[],"sources":["../../../src/iac/fields/boolean.ts"],"sourcesContent":[],"mappings":";AAMA;;;UAAiB,kBAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CustomTypeModelFieldType } from "../../types/model/types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/iac/fields/boolean.ts
|
|
4
|
+
/**
|
|
5
|
+
* Creates a boolean field model.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* model.boolean({ label: "Featured" })
|
|
11
|
+
*
|
|
12
|
+
* model.boolean({
|
|
13
|
+
* label: "Published",
|
|
14
|
+
* default_value: false,
|
|
15
|
+
* placeholder_true: "Published",
|
|
16
|
+
* placeholder_false: "Draft"
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @param config - Configuration for the field.
|
|
21
|
+
*
|
|
22
|
+
* @returns A boolean field model.
|
|
23
|
+
*/
|
|
24
|
+
const boolean = (config) => {
|
|
25
|
+
return {
|
|
26
|
+
type: CustomTypeModelFieldType.Boolean,
|
|
27
|
+
config: {
|
|
28
|
+
label: (config === null || config === void 0 ? void 0 : config.label) ?? null,
|
|
29
|
+
default_value: config === null || config === void 0 ? void 0 : config.default_value,
|
|
30
|
+
placeholder_true: config === null || config === void 0 ? void 0 : config.placeholder_true,
|
|
31
|
+
placeholder_false: config === null || config === void 0 ? void 0 : config.placeholder_false
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { boolean };
|
|
38
|
+
//# sourceMappingURL=boolean.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean.js","names":[],"sources":["../../../src/iac/fields/boolean.ts"],"sourcesContent":["import type { CustomTypeModelBooleanField } from \"../../types/model/boolean\"\nimport { CustomTypeModelFieldType } from \"../../types/model/types\"\n\n/**\n * Configuration for a boolean field.\n */\nexport interface BooleanFieldConfig {\n\tlabel?: string | null\n\t/**\n\t * Default value for the boolean field.\n\t */\n\tdefault_value?: boolean\n\t/**\n\t * Placeholder text shown when the value is true.\n\t */\n\tplaceholder_true?: string\n\t/**\n\t * Placeholder text shown when the value is false.\n\t */\n\tplaceholder_false?: string\n}\n\n/**\n * Creates a boolean field model.\n *\n * @example\n *\n * ```ts\n * model.boolean({ label: \"Featured\" })\n *\n * model.boolean({\n * label: \"Published\",\n * default_value: false,\n * placeholder_true: \"Published\",\n * placeholder_false: \"Draft\"\n * })\n * ```\n *\n * @param config - Configuration for the field.\n *\n * @returns A boolean field model.\n */\nexport const boolean = (\n\tconfig?: BooleanFieldConfig,\n): CustomTypeModelBooleanField => {\n\treturn {\n\t\ttype: CustomTypeModelFieldType.Boolean,\n\t\tconfig: {\n\t\t\tlabel: config?.label ?? null,\n\t\t\tdefault_value: config?.default_value,\n\t\t\tplaceholder_true: config?.placeholder_true,\n\t\t\tplaceholder_false: config?.placeholder_false,\n\t\t},\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,WACZ,WACiC;AACjC,QAAO;EACN,MAAM,yBAAyB;EAC/B,QAAQ;GACP,wDAAO,OAAQ,UAAS;GACxB,+DAAe,OAAQ;GACvB,kEAAkB,OAAQ;GAC1B,mEAAmB,OAAQ;GAC3B;EACD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const require_types = require('../../types/model/types.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/iac/fields/color.ts
|
|
4
|
+
/**
|
|
5
|
+
* Creates a color field model.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* model.color({ label: "Background Color" })
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @param config - Configuration for the field.
|
|
14
|
+
*
|
|
15
|
+
* @returns A color field model.
|
|
16
|
+
*/
|
|
17
|
+
const color = (config) => {
|
|
18
|
+
return {
|
|
19
|
+
type: require_types.CustomTypeModelFieldType.Color,
|
|
20
|
+
config: {
|
|
21
|
+
label: (config === null || config === void 0 ? void 0 : config.label) ?? null,
|
|
22
|
+
placeholder: config === null || config === void 0 ? void 0 : config.placeholder
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.color = color;
|
|
29
|
+
//# sourceMappingURL=color.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.cjs","names":["CustomTypeModelFieldType"],"sources":["../../../src/iac/fields/color.ts"],"sourcesContent":["import type { CustomTypeModelColorField } from \"../../types/model/color\"\nimport { CustomTypeModelFieldType } from \"../../types/model/types\"\n\n/**\n * Configuration for a color field.\n */\nexport interface ColorFieldConfig {\n\tlabel?: string | null\n\tplaceholder?: string\n}\n\n/**\n * Creates a color field model.\n *\n * @example\n *\n * ```ts\n * model.color({ label: \"Background Color\" })\n * ```\n *\n * @param config - Configuration for the field.\n *\n * @returns A color field model.\n */\nexport const color = (config?: ColorFieldConfig): CustomTypeModelColorField => {\n\treturn {\n\t\ttype: CustomTypeModelFieldType.Color,\n\t\tconfig: {\n\t\t\tlabel: config?.label ?? null,\n\t\t\tplaceholder: config?.placeholder,\n\t\t},\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,MAAa,SAAS,WAAyD;AAC9E,QAAO;EACN,MAAMA,uCAAyB;EAC/B,QAAQ;GACP,wDAAO,OAAQ,UAAS;GACxB,6DAAa,OAAQ;GACrB;EACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.cts","names":[],"sources":["../../../src/iac/fields/color.ts"],"sourcesContent":[],"mappings":";AAMA;;;UAAiB,gBAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","names":[],"sources":["../../../src/iac/fields/color.ts"],"sourcesContent":[],"mappings":";AAMA;;;UAAiB,gBAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CustomTypeModelFieldType } from "../../types/model/types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/iac/fields/color.ts
|
|
4
|
+
/**
|
|
5
|
+
* Creates a color field model.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* model.color({ label: "Background Color" })
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @param config - Configuration for the field.
|
|
14
|
+
*
|
|
15
|
+
* @returns A color field model.
|
|
16
|
+
*/
|
|
17
|
+
const color = (config) => {
|
|
18
|
+
return {
|
|
19
|
+
type: CustomTypeModelFieldType.Color,
|
|
20
|
+
config: {
|
|
21
|
+
label: (config === null || config === void 0 ? void 0 : config.label) ?? null,
|
|
22
|
+
placeholder: config === null || config === void 0 ? void 0 : config.placeholder
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { color };
|
|
29
|
+
//# sourceMappingURL=color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.js","names":[],"sources":["../../../src/iac/fields/color.ts"],"sourcesContent":["import type { CustomTypeModelColorField } from \"../../types/model/color\"\nimport { CustomTypeModelFieldType } from \"../../types/model/types\"\n\n/**\n * Configuration for a color field.\n */\nexport interface ColorFieldConfig {\n\tlabel?: string | null\n\tplaceholder?: string\n}\n\n/**\n * Creates a color field model.\n *\n * @example\n *\n * ```ts\n * model.color({ label: \"Background Color\" })\n * ```\n *\n * @param config - Configuration for the field.\n *\n * @returns A color field model.\n */\nexport const color = (config?: ColorFieldConfig): CustomTypeModelColorField => {\n\treturn {\n\t\ttype: CustomTypeModelFieldType.Color,\n\t\tconfig: {\n\t\t\tlabel: config?.label ?? null,\n\t\t\tplaceholder: config?.placeholder,\n\t\t},\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,MAAa,SAAS,WAAyD;AAC9E,QAAO;EACN,MAAM,yBAAyB;EAC/B,QAAQ;GACP,wDAAO,OAAQ,UAAS;GACxB,6DAAa,OAAQ;GACrB;EACD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const require_types = require('../../types/model/types.cjs');
|
|
2
|
+
const require_link = require('../../types/model/link.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/iac/fields/contentRelationship.ts
|
|
5
|
+
/**
|
|
6
|
+
* Creates a content relationship field model.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* // Any document
|
|
12
|
+
* model.contentRelationship({ label: "Related Content" })
|
|
13
|
+
*
|
|
14
|
+
* // Specific custom types (type-safe)
|
|
15
|
+
* model.contentRelationship({
|
|
16
|
+
* label: "Author",
|
|
17
|
+
* customtypes: ["author", "contributor"] as const
|
|
18
|
+
* })
|
|
19
|
+
*
|
|
20
|
+
* // With tag filtering
|
|
21
|
+
* model.contentRelationship({
|
|
22
|
+
* label: "Featured Post",
|
|
23
|
+
* customtypes: ["blog_post"] as const,
|
|
24
|
+
* tags: ["featured"] as const
|
|
25
|
+
* })
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @typeParam CustomTypes - Custom type ID literals for type inference.
|
|
29
|
+
* @typeParam Tags - Tag literals for type inference.
|
|
30
|
+
*
|
|
31
|
+
* @param config - Configuration for the field.
|
|
32
|
+
*
|
|
33
|
+
* @returns A content relationship field model.
|
|
34
|
+
*/
|
|
35
|
+
const contentRelationship = (config) => {
|
|
36
|
+
return {
|
|
37
|
+
type: require_types.CustomTypeModelFieldType.Link,
|
|
38
|
+
config: {
|
|
39
|
+
label: (config === null || config === void 0 ? void 0 : config.label) ?? null,
|
|
40
|
+
placeholder: config === null || config === void 0 ? void 0 : config.placeholder,
|
|
41
|
+
select: require_link.CustomTypeModelLinkSelectType.Document,
|
|
42
|
+
customtypes: config === null || config === void 0 ? void 0 : config.customtypes,
|
|
43
|
+
tags: config === null || config === void 0 ? void 0 : config.tags
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
exports.contentRelationship = contentRelationship;
|
|
50
|
+
//# sourceMappingURL=contentRelationship.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentRelationship.cjs","names":["CustomTypeModelFieldType","CustomTypeModelLinkSelectType"],"sources":["../../../src/iac/fields/contentRelationship.ts"],"sourcesContent":["import type { CustomTypeModelContentRelationshipField } from \"../../types/model/contentRelationship\"\nimport { CustomTypeModelFieldType } from \"../../types/model/types\"\nimport { CustomTypeModelLinkSelectType } from \"../../types/model/link\"\n\n/**\n * Configuration for a content relationship field.\n */\nexport interface ContentRelationshipFieldConfig<\n\tCustomTypes extends string = string,\n\tTags extends string = string,\n> {\n\tlabel?: string | null\n\tplaceholder?: string\n\t/**\n\t * Custom types to allow linking to.\n\t *\n\t * @example [\"blog_post\", \"author\"] as const\n\t */\n\tcustomtypes?: readonly CustomTypes[]\n\t/**\n\t * Tags to filter by.\n\t *\n\t * @example [\"featured\"] as const\n\t */\n\ttags?: readonly Tags[]\n}\n\n/**\n * Creates a content relationship field model.\n *\n * @example\n *\n * ```ts\n * // Any document\n * model.contentRelationship({ label: \"Related Content\" })\n *\n * // Specific custom types (type-safe)\n * model.contentRelationship({\n * label: \"Author\",\n * customtypes: [\"author\", \"contributor\"] as const\n * })\n *\n * // With tag filtering\n * model.contentRelationship({\n * label: \"Featured Post\",\n * customtypes: [\"blog_post\"] as const,\n * tags: [\"featured\"] as const\n * })\n * ```\n *\n * @typeParam CustomTypes - Custom type ID literals for type inference.\n * @typeParam Tags - Tag literals for type inference.\n *\n * @param config - Configuration for the field.\n *\n * @returns A content relationship field model.\n */\nexport const contentRelationship = <\n\tCustomTypes extends string = string,\n\tTags extends string = string,\n>(\n\tconfig?: ContentRelationshipFieldConfig<CustomTypes, Tags>,\n): CustomTypeModelContentRelationshipField<CustomTypes, Tags> => {\n\treturn {\n\t\ttype: CustomTypeModelFieldType.Link,\n\t\tconfig: {\n\t\t\tlabel: config?.label ?? null,\n\t\t\tplaceholder: config?.placeholder,\n\t\t\tselect: CustomTypeModelLinkSelectType.Document,\n\t\t\tcustomtypes: config?.customtypes,\n\t\t\ttags: config?.tags,\n\t\t},\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAa,uBAIZ,WACgE;AAChE,QAAO;EACN,MAAMA,uCAAyB;EAC/B,QAAQ;GACP,wDAAO,OAAQ,UAAS;GACxB,6DAAa,OAAQ;GACrB,QAAQC,2CAA8B;GACtC,6DAAa,OAAQ;GACrB,sDAAM,OAAQ;GACd;EACD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/iac/fields/contentRelationship.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for a content relationship field.
|
|
4
|
+
*/
|
|
5
|
+
interface ContentRelationshipFieldConfig<CustomTypes extends string = string, Tags extends string = string> {
|
|
6
|
+
label?: string | null;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Custom types to allow linking to.
|
|
10
|
+
*
|
|
11
|
+
* @example ["blog_post", "author"] as const
|
|
12
|
+
*/
|
|
13
|
+
customtypes?: readonly CustomTypes[];
|
|
14
|
+
/**
|
|
15
|
+
* Tags to filter by.
|
|
16
|
+
*
|
|
17
|
+
* @example ["featured"] as const
|
|
18
|
+
*/
|
|
19
|
+
tags?: readonly Tags[];
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { ContentRelationshipFieldConfig };
|
|
23
|
+
//# sourceMappingURL=contentRelationship.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentRelationship.d.cts","names":[],"sources":["../../../src/iac/fields/contentRelationship.ts"],"sourcesContent":[],"mappings":";AAOA;;;UAAiB;;;;;;;;yBAWO;;;;;;kBAMP"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/iac/fields/contentRelationship.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for a content relationship field.
|
|
4
|
+
*/
|
|
5
|
+
interface ContentRelationshipFieldConfig<CustomTypes extends string = string, Tags extends string = string> {
|
|
6
|
+
label?: string | null;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Custom types to allow linking to.
|
|
10
|
+
*
|
|
11
|
+
* @example ["blog_post", "author"] as const
|
|
12
|
+
*/
|
|
13
|
+
customtypes?: readonly CustomTypes[];
|
|
14
|
+
/**
|
|
15
|
+
* Tags to filter by.
|
|
16
|
+
*
|
|
17
|
+
* @example ["featured"] as const
|
|
18
|
+
*/
|
|
19
|
+
tags?: readonly Tags[];
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { ContentRelationshipFieldConfig };
|
|
23
|
+
//# sourceMappingURL=contentRelationship.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentRelationship.d.ts","names":[],"sources":["../../../src/iac/fields/contentRelationship.ts"],"sourcesContent":[],"mappings":";AAOA;;;UAAiB;;;;;;;;yBAWO;;;;;;kBAMP"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { CustomTypeModelFieldType } from "../../types/model/types.js";
|
|
2
|
+
import { CustomTypeModelLinkSelectType } from "../../types/model/link.js";
|
|
3
|
+
|
|
4
|
+
//#region src/iac/fields/contentRelationship.ts
|
|
5
|
+
/**
|
|
6
|
+
* Creates a content relationship field model.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* // Any document
|
|
12
|
+
* model.contentRelationship({ label: "Related Content" })
|
|
13
|
+
*
|
|
14
|
+
* // Specific custom types (type-safe)
|
|
15
|
+
* model.contentRelationship({
|
|
16
|
+
* label: "Author",
|
|
17
|
+
* customtypes: ["author", "contributor"] as const
|
|
18
|
+
* })
|
|
19
|
+
*
|
|
20
|
+
* // With tag filtering
|
|
21
|
+
* model.contentRelationship({
|
|
22
|
+
* label: "Featured Post",
|
|
23
|
+
* customtypes: ["blog_post"] as const,
|
|
24
|
+
* tags: ["featured"] as const
|
|
25
|
+
* })
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @typeParam CustomTypes - Custom type ID literals for type inference.
|
|
29
|
+
* @typeParam Tags - Tag literals for type inference.
|
|
30
|
+
*
|
|
31
|
+
* @param config - Configuration for the field.
|
|
32
|
+
*
|
|
33
|
+
* @returns A content relationship field model.
|
|
34
|
+
*/
|
|
35
|
+
const contentRelationship = (config) => {
|
|
36
|
+
return {
|
|
37
|
+
type: CustomTypeModelFieldType.Link,
|
|
38
|
+
config: {
|
|
39
|
+
label: (config === null || config === void 0 ? void 0 : config.label) ?? null,
|
|
40
|
+
placeholder: config === null || config === void 0 ? void 0 : config.placeholder,
|
|
41
|
+
select: CustomTypeModelLinkSelectType.Document,
|
|
42
|
+
customtypes: config === null || config === void 0 ? void 0 : config.customtypes,
|
|
43
|
+
tags: config === null || config === void 0 ? void 0 : config.tags
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { contentRelationship };
|
|
50
|
+
//# sourceMappingURL=contentRelationship.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentRelationship.js","names":[],"sources":["../../../src/iac/fields/contentRelationship.ts"],"sourcesContent":["import type { CustomTypeModelContentRelationshipField } from \"../../types/model/contentRelationship\"\nimport { CustomTypeModelFieldType } from \"../../types/model/types\"\nimport { CustomTypeModelLinkSelectType } from \"../../types/model/link\"\n\n/**\n * Configuration for a content relationship field.\n */\nexport interface ContentRelationshipFieldConfig<\n\tCustomTypes extends string = string,\n\tTags extends string = string,\n> {\n\tlabel?: string | null\n\tplaceholder?: string\n\t/**\n\t * Custom types to allow linking to.\n\t *\n\t * @example [\"blog_post\", \"author\"] as const\n\t */\n\tcustomtypes?: readonly CustomTypes[]\n\t/**\n\t * Tags to filter by.\n\t *\n\t * @example [\"featured\"] as const\n\t */\n\ttags?: readonly Tags[]\n}\n\n/**\n * Creates a content relationship field model.\n *\n * @example\n *\n * ```ts\n * // Any document\n * model.contentRelationship({ label: \"Related Content\" })\n *\n * // Specific custom types (type-safe)\n * model.contentRelationship({\n * label: \"Author\",\n * customtypes: [\"author\", \"contributor\"] as const\n * })\n *\n * // With tag filtering\n * model.contentRelationship({\n * label: \"Featured Post\",\n * customtypes: [\"blog_post\"] as const,\n * tags: [\"featured\"] as const\n * })\n * ```\n *\n * @typeParam CustomTypes - Custom type ID literals for type inference.\n * @typeParam Tags - Tag literals for type inference.\n *\n * @param config - Configuration for the field.\n *\n * @returns A content relationship field model.\n */\nexport const contentRelationship = <\n\tCustomTypes extends string = string,\n\tTags extends string = string,\n>(\n\tconfig?: ContentRelationshipFieldConfig<CustomTypes, Tags>,\n): CustomTypeModelContentRelationshipField<CustomTypes, Tags> => {\n\treturn {\n\t\ttype: CustomTypeModelFieldType.Link,\n\t\tconfig: {\n\t\t\tlabel: config?.label ?? null,\n\t\t\tplaceholder: config?.placeholder,\n\t\t\tselect: CustomTypeModelLinkSelectType.Document,\n\t\t\tcustomtypes: config?.customtypes,\n\t\t\ttags: config?.tags,\n\t\t},\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAa,uBAIZ,WACgE;AAChE,QAAO;EACN,MAAM,yBAAyB;EAC/B,QAAQ;GACP,wDAAO,OAAQ,UAAS;GACxB,6DAAa,OAAQ;GACrB,QAAQ,8BAA8B;GACtC,6DAAa,OAAQ;GACrB,sDAAM,OAAQ;GACd;EACD"}
|