prismic-ts-codegen 0.1.29-pr.80.577ac11 → 0.1.29

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.
Files changed (149) hide show
  1. package/bin/prismic-ts-codegen.js +1 -1
  2. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  3. package/dist/cli/configSchema.cjs +31 -0
  4. package/dist/cli/configSchema.cjs.map +1 -0
  5. package/dist/cli/{configSchema.d.mts → configSchema.d.cts} +1 -1
  6. package/dist/cli/{configSchema.d.mts.map → configSchema.d.cts.map} +1 -1
  7. package/dist/cli/configSchema.d.ts +39 -0
  8. package/dist/cli/configSchema.d.ts.map +1 -0
  9. package/dist/cli/{configSchema.mjs → configSchema.js} +1 -1
  10. package/dist/cli/configSchema.js.map +1 -0
  11. package/dist/cli/constants.cjs +6 -0
  12. package/dist/cli/{constants.mjs.map → constants.cjs.map} +1 -1
  13. package/dist/cli/{constants.d.mts → constants.d.cts} +1 -1
  14. package/dist/cli/constants.d.cts.map +1 -0
  15. package/dist/cli/constants.d.ts +5 -0
  16. package/dist/cli/constants.d.ts.map +1 -0
  17. package/dist/cli/{constants.mjs → constants.js} +1 -1
  18. package/dist/cli/constants.js.map +1 -0
  19. package/dist/cli/loadConfig.cjs +22 -0
  20. package/dist/cli/loadConfig.cjs.map +1 -0
  21. package/dist/cli/{loadConfig.mjs → loadConfig.js} +1 -1
  22. package/dist/cli/loadConfig.js.map +1 -0
  23. package/dist/cli/loadLocaleIDs.cjs +21 -0
  24. package/dist/cli/loadLocaleIDs.cjs.map +1 -0
  25. package/dist/cli/{loadLocaleIDs.mjs → loadLocaleIDs.js} +1 -1
  26. package/dist/cli/loadLocaleIDs.js.map +1 -0
  27. package/dist/cli/loadModels.cjs +54 -0
  28. package/dist/cli/loadModels.cjs.map +1 -0
  29. package/dist/cli/{loadModels.mjs → loadModels.js} +1 -1
  30. package/dist/cli/loadModels.js.map +1 -0
  31. package/dist/cli.cjs +110 -0
  32. package/dist/cli.cjs.map +1 -0
  33. package/dist/cli.d.ts +1 -0
  34. package/dist/{cli.mjs → cli.js} +9 -10
  35. package/dist/cli.js.map +1 -0
  36. package/dist/constants.cjs +33 -0
  37. package/dist/{constants.mjs.map → constants.cjs.map} +1 -1
  38. package/dist/{constants.mjs → constants.js} +1 -1
  39. package/dist/constants.js.map +1 -0
  40. package/dist/detectTypesProvider.cjs +25 -0
  41. package/dist/{detectTypesProvider.mjs.map → detectTypesProvider.cjs.map} +1 -1
  42. package/dist/{detectTypesProvider.d.mts → detectTypesProvider.d.cts} +2 -2
  43. package/dist/{detectTypesProvider.d.mts.map → detectTypesProvider.d.cts.map} +1 -1
  44. package/dist/detectTypesProvider.d.ts +17 -0
  45. package/dist/detectTypesProvider.d.ts.map +1 -0
  46. package/dist/{detectTypesProvider.mjs → detectTypesProvider.js} +1 -1
  47. package/dist/detectTypesProvider.js.map +1 -0
  48. package/dist/generateTypes.cjs +144 -0
  49. package/dist/generateTypes.cjs.map +1 -0
  50. package/dist/{generateTypes.d.mts → generateTypes.d.cts} +2 -2
  51. package/dist/{generateTypes.d.mts.map → generateTypes.d.cts.map} +1 -1
  52. package/dist/generateTypes.d.ts +21 -0
  53. package/dist/generateTypes.d.ts.map +1 -0
  54. package/dist/{generateTypes.mjs → generateTypes.js} +6 -6
  55. package/dist/generateTypes.js.map +1 -0
  56. package/dist/index.cjs +7 -0
  57. package/dist/{index.d.mts → index.d.cts} +4 -4
  58. package/dist/index.d.ts +5 -0
  59. package/dist/index.js +4 -0
  60. package/dist/lib/addBlankLine.cjs +10 -0
  61. package/dist/lib/addBlankLine.cjs.map +1 -0
  62. package/dist/lib/{addBlankLine.mjs → addBlankLine.js} +2 -2
  63. package/dist/lib/addBlankLine.js.map +1 -0
  64. package/dist/lib/addLine.cjs +9 -0
  65. package/dist/lib/addLine.cjs.map +1 -0
  66. package/dist/lib/{addLine.mjs → addLine.js} +2 -2
  67. package/dist/lib/addLine.js.map +1 -0
  68. package/dist/lib/addSection.cjs +9 -0
  69. package/dist/lib/addSection.cjs.map +1 -0
  70. package/dist/lib/{addSection.mjs → addSection.js} +2 -2
  71. package/dist/lib/addSection.js.map +1 -0
  72. package/dist/lib/addTrailingNewLine.cjs +9 -0
  73. package/dist/lib/{addTrailingNewLine.mjs.map → addTrailingNewLine.cjs.map} +1 -1
  74. package/dist/lib/{addTrailingNewLine.mjs → addTrailingNewLine.js} +1 -1
  75. package/dist/lib/addTrailingNewLine.js.map +1 -0
  76. package/dist/lib/buildCustomTypeDataType.cjs +51 -0
  77. package/dist/lib/buildCustomTypeDataType.cjs.map +1 -0
  78. package/dist/lib/{buildCustomTypeDataType.mjs → buildCustomTypeDataType.js} +4 -4
  79. package/dist/lib/buildCustomTypeDataType.js.map +1 -0
  80. package/dist/lib/buildCustomTypeType.cjs +63 -0
  81. package/dist/lib/buildCustomTypeType.cjs.map +1 -0
  82. package/dist/lib/{buildCustomTypeType.mjs → buildCustomTypeType.js} +9 -9
  83. package/dist/lib/buildCustomTypeType.js.map +1 -0
  84. package/dist/lib/buildFieldDocs.cjs +66 -0
  85. package/dist/lib/buildFieldDocs.cjs.map +1 -0
  86. package/dist/lib/{buildFieldDocs.mjs → buildFieldDocs.js} +6 -6
  87. package/dist/lib/buildFieldDocs.js.map +1 -0
  88. package/dist/lib/buildFieldProperties.cjs +285 -0
  89. package/dist/lib/buildFieldProperties.cjs.map +1 -0
  90. package/dist/lib/{buildFieldProperties.mjs → buildFieldProperties.js} +7 -7
  91. package/dist/lib/buildFieldProperties.js.map +1 -0
  92. package/dist/lib/buildSharedSliceType.cjs +152 -0
  93. package/dist/lib/buildSharedSliceType.cjs.map +1 -0
  94. package/dist/lib/{buildSharedSliceType.mjs → buildSharedSliceType.js} +9 -9
  95. package/dist/lib/buildSharedSliceType.js.map +1 -0
  96. package/dist/lib/buildTypeName.cjs +12 -0
  97. package/dist/lib/buildTypeName.cjs.map +1 -0
  98. package/dist/lib/{buildTypeName.mjs → buildTypeName.js} +1 -1
  99. package/dist/lib/buildTypeName.js.map +1 -0
  100. package/dist/lib/buildUnion.cjs +8 -0
  101. package/dist/lib/{buildUnion.mjs.map → buildUnion.cjs.map} +1 -1
  102. package/dist/lib/{buildUnion.mjs → buildUnion.js} +1 -1
  103. package/dist/lib/buildUnion.js.map +1 -0
  104. package/dist/lib/checkHasUIDFIeld.cjs +8 -0
  105. package/dist/lib/{checkHasUIDFIeld.mjs.map → checkHasUIDFIeld.cjs.map} +1 -1
  106. package/dist/lib/{checkHasUIDFIeld.mjs → checkHasUIDFIeld.js} +1 -1
  107. package/dist/lib/checkHasUIDFIeld.js.map +1 -0
  108. package/dist/lib/getAPIIDPath.cjs +24 -0
  109. package/dist/lib/{getAPIIDPath.mjs.map → getAPIIDPath.cjs.map} +1 -1
  110. package/dist/lib/{getAPIIDPath.mjs → getAPIIDPath.js} +1 -1
  111. package/dist/lib/getAPIIDPath.js.map +1 -0
  112. package/dist/lib/getCacheKey.cjs +17 -0
  113. package/dist/lib/getCacheKey.cjs.map +1 -0
  114. package/dist/lib/{getCacheKey.mjs → getCacheKey.js} +1 -1
  115. package/dist/lib/getCacheKey.js.map +1 -0
  116. package/dist/lib/getHumanReadableModelName.cjs +15 -0
  117. package/dist/lib/{getHumanReadableModelName.mjs.map → getHumanReadableModelName.cjs.map} +1 -1
  118. package/dist/lib/{getHumanReadableModelName.mjs → getHumanReadableModelName.js} +1 -1
  119. package/dist/lib/getHumanReadableModelName.js.map +1 -0
  120. package/dist/lib/getHumanReadablePath.cjs +16 -0
  121. package/dist/lib/getHumanReadablePath.cjs.map +1 -0
  122. package/dist/lib/{getHumanReadablePath.mjs → getHumanReadablePath.js} +2 -2
  123. package/dist/lib/getHumanReadablePath.js.map +1 -0
  124. package/dist/{types.d.mts → types.d.cts} +1 -1
  125. package/dist/types.d.cts.map +1 -0
  126. package/dist/types.d.ts +14 -0
  127. package/dist/types.d.ts.map +1 -0
  128. package/package.json +7 -2
  129. package/dist/cli/configSchema.mjs.map +0 -1
  130. package/dist/cli/constants.d.mts.map +0 -1
  131. package/dist/cli/loadConfig.mjs.map +0 -1
  132. package/dist/cli/loadLocaleIDs.mjs.map +0 -1
  133. package/dist/cli/loadModels.mjs.map +0 -1
  134. package/dist/cli.mjs.map +0 -1
  135. package/dist/generateTypes.mjs.map +0 -1
  136. package/dist/index.mjs +0 -4
  137. package/dist/lib/addBlankLine.mjs.map +0 -1
  138. package/dist/lib/addLine.mjs.map +0 -1
  139. package/dist/lib/addSection.mjs.map +0 -1
  140. package/dist/lib/buildCustomTypeDataType.mjs.map +0 -1
  141. package/dist/lib/buildCustomTypeType.mjs.map +0 -1
  142. package/dist/lib/buildFieldDocs.mjs.map +0 -1
  143. package/dist/lib/buildFieldProperties.mjs.map +0 -1
  144. package/dist/lib/buildSharedSliceType.mjs.map +0 -1
  145. package/dist/lib/buildTypeName.mjs.map +0 -1
  146. package/dist/lib/getCacheKey.mjs.map +0 -1
  147. package/dist/lib/getHumanReadablePath.mjs.map +0 -1
  148. package/dist/types.d.mts.map +0 -1
  149. /package/dist/{cli.d.mts → cli.d.cts} +0 -0
@@ -0,0 +1,63 @@
1
+ require("../_virtual/_rolldown/runtime.cjs");
2
+ const require_addSection = require("./addSection.cjs");
3
+ const require_constants = require("../constants.cjs");
4
+ const require_buildTypeName = require("./buildTypeName.cjs");
5
+ const require_getHumanReadableModelName = require("./getHumanReadableModelName.cjs");
6
+ const require_buildUnion = require("./buildUnion.cjs");
7
+ const require_buildCustomTypeDataType = require("./buildCustomTypeDataType.cjs");
8
+ const require_checkHasUIDFIeld = require("./checkHasUIDFIeld.cjs");
9
+ const require_getCacheKey = require("./getCacheKey.cjs");
10
+ let common_tags = require("common-tags");
11
+ //#region src/lib/buildCustomTypeType.ts
12
+ function buildCustomTypeType(args) {
13
+ if (args.cache) {
14
+ const key = require_getCacheKey.getCacheKey(args.model);
15
+ const cached = args.cache.get(key);
16
+ if (cached) return cached;
17
+ }
18
+ let code = "";
19
+ const auxiliaryTypes = [];
20
+ const contentTypeNames = [];
21
+ const name = require_buildTypeName.buildTypeName(args.model.id, "Document");
22
+ const langDefault = args.localeIDs && args.localeIDs.length > 0 ? require_buildUnion.buildUnion(args.localeIDs.map((localeID) => `"${localeID}"`)) : "string";
23
+ const baseDocumentType = require_checkHasUIDFIeld.checkHasUIDField(args.model) ? "PrismicDocumentWithUID" : "PrismicDocumentWithoutUID";
24
+ const humanReadableName = require_getHumanReadableModelName.getHumanReadableModelName({
25
+ name: args.model.id,
26
+ model: args.model
27
+ });
28
+ const dataType = require_buildCustomTypeDataType.buildCustomTypeDataType({
29
+ model: args.model,
30
+ fieldConfigs: args.fieldConfigs
31
+ });
32
+ auxiliaryTypes.push(...dataType.auxiliaryTypes);
33
+ contentTypeNames.push(dataType.name);
34
+ contentTypeNames.push(...dataType.contentTypeNames);
35
+ code = require_addSection.addSection(dataType.code, code);
36
+ code = require_addSection.addSection(common_tags.source`
37
+ /**
38
+ * ${humanReadableName} document from Prismic
39
+ *
40
+ * - **API ID**: \`${args.model.id}\`
41
+ * - **Repeatable**: \`${args.model.repeatable.toString()}\`
42
+ * - **Documentation**: ${require_constants.CUSTOM_TYPES_DOCUMENTATION_URL}
43
+ *
44
+ * @typeParam Lang - Language API ID of the document.
45
+ */
46
+ export type ${name}<Lang extends string = ${langDefault}> = prismic.${baseDocumentType}<Simplify<${dataType.name}>, "${args.model.id}", Lang>;
47
+ `, code);
48
+ const result = {
49
+ name,
50
+ code,
51
+ auxiliaryTypes,
52
+ contentTypeNames
53
+ };
54
+ if (args.cache) {
55
+ const key = require_getCacheKey.getCacheKey(args.model);
56
+ args.cache.set(key, result);
57
+ }
58
+ return result;
59
+ }
60
+ //#endregion
61
+ exports.buildCustomTypeType = buildCustomTypeType;
62
+
63
+ //# sourceMappingURL=buildCustomTypeType.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildCustomTypeType.cjs","names":["getCacheKey","buildTypeName","buildUnion","checkHasUIDField","getHumanReadableModelName","buildCustomTypeDataType","addSection","CUSTOM_TYPES_DOCUMENTATION_URL"],"sources":["../../src/lib/buildCustomTypeType.ts"],"sourcesContent":["import type { CustomTypeModel } from \"@prismicio/client\";\nimport { source } from \"common-tags\";\nimport type QuickLRU from \"quick-lru\";\n\nimport { CUSTOM_TYPES_DOCUMENTATION_URL } from \"../constants\";\nimport type { AuxiliaryType, FieldConfigs } from \"../types\";\nimport { addSection } from \"./addSection\";\nimport { buildCustomTypeDataType } from \"./buildCustomTypeDataType\";\nimport { buildTypeName } from \"./buildTypeName\";\nimport { buildUnion } from \"./buildUnion\";\nimport { checkHasUIDField } from \"./checkHasUIDFIeld\";\nimport { getCacheKey } from \"./getCacheKey\";\nimport { getHumanReadableModelName } from \"./getHumanReadableModelName\";\n\ntype BuildCustomTypeTypesArgs = {\n\tmodel: CustomTypeModel;\n\tlocaleIDs?: string[];\n\tfieldConfigs: FieldConfigs;\n\tcache?: QuickLRU<string, unknown>;\n};\n\ntype BuildCustomTypeTypeReturnValue = {\n\tname: string;\n\tcode: string;\n\tauxiliaryTypes: AuxiliaryType[];\n\tcontentTypeNames: string[];\n};\n\nexport function buildCustomTypeType(\n\targs: BuildCustomTypeTypesArgs\n): BuildCustomTypeTypeReturnValue {\n\tif (args.cache) {\n\t\tconst key = getCacheKey(args.model);\n\t\tconst cached = args.cache.get(key);\n\n\t\tif (cached) {\n\t\t\treturn cached as BuildCustomTypeTypeReturnValue;\n\t\t}\n\t}\n\n\tlet code = \"\";\n\n\tconst auxiliaryTypes: AuxiliaryType[] = [];\n\tconst contentTypeNames: string[] = [];\n\n\tconst name = buildTypeName(args.model.id, \"Document\");\n\tconst langDefault =\n\t\targs.localeIDs && args.localeIDs.length > 0\n\t\t\t? buildUnion(args.localeIDs.map((localeID) => `\"${localeID}\"`))\n\t\t\t: \"string\";\n\tconst baseDocumentType = checkHasUIDField(args.model)\n\t\t? \"PrismicDocumentWithUID\"\n\t\t: \"PrismicDocumentWithoutUID\";\n\tconst humanReadableName = getHumanReadableModelName({\n\t\tname: args.model.id,\n\t\tmodel: args.model,\n\t});\n\n\tconst dataType = buildCustomTypeDataType({\n\t\tmodel: args.model,\n\t\tfieldConfigs: args.fieldConfigs,\n\t});\n\n\tauxiliaryTypes.push(...dataType.auxiliaryTypes);\n\tcontentTypeNames.push(dataType.name);\n\tcontentTypeNames.push(...dataType.contentTypeNames);\n\n\tcode = addSection(dataType.code, code);\n\n\tcode = addSection(\n\t\tsource`\n\t\t\t/**\n\t\t\t * ${humanReadableName} document from Prismic\n\t\t\t *\n\t\t\t * - **API ID**: \\`${args.model.id}\\`\n\t\t\t * - **Repeatable**: \\`${args.model.repeatable.toString()}\\`\n\t\t\t * - **Documentation**: ${CUSTOM_TYPES_DOCUMENTATION_URL}\n\t\t\t *\n\t\t\t * @typeParam Lang - Language API ID of the document.\n\t\t\t */\n\t\t\texport type ${name}<Lang extends string = ${langDefault}> = prismic.${baseDocumentType}<Simplify<${\n\t\t\tdataType.name\n\t\t}>, \"${args.model.id}\", Lang>;\n\t\t`,\n\t\tcode\n\t);\n\n\tconst result = {\n\t\tname,\n\t\tcode,\n\t\tauxiliaryTypes,\n\t\tcontentTypeNames,\n\t};\n\n\tif (args.cache) {\n\t\tconst key = getCacheKey(args.model);\n\n\t\targs.cache.set(key, result);\n\t}\n\n\treturn result;\n}\n"],"mappings":";;;;;;;;;;;AA4BA,SAAgB,oBACf,MACiC;AACjC,KAAI,KAAK,OAAO;EACf,MAAM,MAAMA,oBAAAA,YAAY,KAAK,MAAM;EACnC,MAAM,SAAS,KAAK,MAAM,IAAI,IAAI;AAElC,MAAI,OACH,QAAO;;CAIT,IAAI,OAAO;CAEX,MAAM,iBAAkC,EAAE;CAC1C,MAAM,mBAA6B,EAAE;CAErC,MAAM,OAAOC,sBAAAA,cAAc,KAAK,MAAM,IAAI,WAAW;CACrD,MAAM,cACL,KAAK,aAAa,KAAK,UAAU,SAAS,IACvCC,mBAAAA,WAAW,KAAK,UAAU,KAAK,aAAa,IAAI,SAAS,GAAG,CAAC,GAC7D;CACJ,MAAM,mBAAmBC,yBAAAA,iBAAiB,KAAK,MAAM,GAClD,2BACA;CACH,MAAM,oBAAoBC,kCAAAA,0BAA0B;EACnD,MAAM,KAAK,MAAM;EACjB,OAAO,KAAK;EACZ,CAAC;CAEF,MAAM,WAAWC,gCAAAA,wBAAwB;EACxC,OAAO,KAAK;EACZ,cAAc,KAAK;EACnB,CAAC;AAEF,gBAAe,KAAK,GAAG,SAAS,eAAe;AAC/C,kBAAiB,KAAK,SAAS,KAAK;AACpC,kBAAiB,KAAK,GAAG,SAAS,iBAAiB;AAEnD,QAAOC,mBAAAA,WAAW,SAAS,MAAM,KAAK;AAEtC,QAAOA,mBAAAA,WACN,YAAA,MAAM;;QAEA,kBAAkB;;wBAEF,KAAK,MAAM,GAAG;4BACV,KAAK,MAAM,WAAW,UAAU,CAAC;6BAChCC,kBAAAA,+BAA+B;;;;iBAI3C,KAAK,yBAAyB,YAAY,cAAc,iBAAiB,YACvF,SAAS,KACT,MAAM,KAAK,MAAM,GAAG;KAErB,KACA;CAED,MAAM,SAAS;EACd;EACA;EACA;EACA;EACA;AAED,KAAI,KAAK,OAAO;EACf,MAAM,MAAMP,oBAAAA,YAAY,KAAK,MAAM;AAEnC,OAAK,MAAM,IAAI,KAAK,OAAO;;AAG5B,QAAO"}
@@ -1,11 +1,11 @@
1
- import { addSection } from "./addSection.mjs";
2
- import { CUSTOM_TYPES_DOCUMENTATION_URL } from "../constants.mjs";
3
- import { buildTypeName } from "./buildTypeName.mjs";
4
- import { getHumanReadableModelName } from "./getHumanReadableModelName.mjs";
5
- import { buildUnion } from "./buildUnion.mjs";
6
- import { buildCustomTypeDataType } from "./buildCustomTypeDataType.mjs";
7
- import { checkHasUIDField } from "./checkHasUIDFIeld.mjs";
8
- import { getCacheKey } from "./getCacheKey.mjs";
1
+ import { addSection } from "./addSection.js";
2
+ import { CUSTOM_TYPES_DOCUMENTATION_URL } from "../constants.js";
3
+ import { buildTypeName } from "./buildTypeName.js";
4
+ import { getHumanReadableModelName } from "./getHumanReadableModelName.js";
5
+ import { buildUnion } from "./buildUnion.js";
6
+ import { buildCustomTypeDataType } from "./buildCustomTypeDataType.js";
7
+ import { checkHasUIDField } from "./checkHasUIDFIeld.js";
8
+ import { getCacheKey } from "./getCacheKey.js";
9
9
  import { source } from "common-tags";
10
10
  //#region src/lib/buildCustomTypeType.ts
11
11
  function buildCustomTypeType(args) {
@@ -59,4 +59,4 @@ function buildCustomTypeType(args) {
59
59
  //#endregion
60
60
  export { buildCustomTypeType };
61
61
 
62
- //# sourceMappingURL=buildCustomTypeType.mjs.map
62
+ //# sourceMappingURL=buildCustomTypeType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildCustomTypeType.js","names":[],"sources":["../../src/lib/buildCustomTypeType.ts"],"sourcesContent":["import type { CustomTypeModel } from \"@prismicio/client\";\nimport { source } from \"common-tags\";\nimport type QuickLRU from \"quick-lru\";\n\nimport { CUSTOM_TYPES_DOCUMENTATION_URL } from \"../constants\";\nimport type { AuxiliaryType, FieldConfigs } from \"../types\";\nimport { addSection } from \"./addSection\";\nimport { buildCustomTypeDataType } from \"./buildCustomTypeDataType\";\nimport { buildTypeName } from \"./buildTypeName\";\nimport { buildUnion } from \"./buildUnion\";\nimport { checkHasUIDField } from \"./checkHasUIDFIeld\";\nimport { getCacheKey } from \"./getCacheKey\";\nimport { getHumanReadableModelName } from \"./getHumanReadableModelName\";\n\ntype BuildCustomTypeTypesArgs = {\n\tmodel: CustomTypeModel;\n\tlocaleIDs?: string[];\n\tfieldConfigs: FieldConfigs;\n\tcache?: QuickLRU<string, unknown>;\n};\n\ntype BuildCustomTypeTypeReturnValue = {\n\tname: string;\n\tcode: string;\n\tauxiliaryTypes: AuxiliaryType[];\n\tcontentTypeNames: string[];\n};\n\nexport function buildCustomTypeType(\n\targs: BuildCustomTypeTypesArgs\n): BuildCustomTypeTypeReturnValue {\n\tif (args.cache) {\n\t\tconst key = getCacheKey(args.model);\n\t\tconst cached = args.cache.get(key);\n\n\t\tif (cached) {\n\t\t\treturn cached as BuildCustomTypeTypeReturnValue;\n\t\t}\n\t}\n\n\tlet code = \"\";\n\n\tconst auxiliaryTypes: AuxiliaryType[] = [];\n\tconst contentTypeNames: string[] = [];\n\n\tconst name = buildTypeName(args.model.id, \"Document\");\n\tconst langDefault =\n\t\targs.localeIDs && args.localeIDs.length > 0\n\t\t\t? buildUnion(args.localeIDs.map((localeID) => `\"${localeID}\"`))\n\t\t\t: \"string\";\n\tconst baseDocumentType = checkHasUIDField(args.model)\n\t\t? \"PrismicDocumentWithUID\"\n\t\t: \"PrismicDocumentWithoutUID\";\n\tconst humanReadableName = getHumanReadableModelName({\n\t\tname: args.model.id,\n\t\tmodel: args.model,\n\t});\n\n\tconst dataType = buildCustomTypeDataType({\n\t\tmodel: args.model,\n\t\tfieldConfigs: args.fieldConfigs,\n\t});\n\n\tauxiliaryTypes.push(...dataType.auxiliaryTypes);\n\tcontentTypeNames.push(dataType.name);\n\tcontentTypeNames.push(...dataType.contentTypeNames);\n\n\tcode = addSection(dataType.code, code);\n\n\tcode = addSection(\n\t\tsource`\n\t\t\t/**\n\t\t\t * ${humanReadableName} document from Prismic\n\t\t\t *\n\t\t\t * - **API ID**: \\`${args.model.id}\\`\n\t\t\t * - **Repeatable**: \\`${args.model.repeatable.toString()}\\`\n\t\t\t * - **Documentation**: ${CUSTOM_TYPES_DOCUMENTATION_URL}\n\t\t\t *\n\t\t\t * @typeParam Lang - Language API ID of the document.\n\t\t\t */\n\t\t\texport type ${name}<Lang extends string = ${langDefault}> = prismic.${baseDocumentType}<Simplify<${\n\t\t\tdataType.name\n\t\t}>, \"${args.model.id}\", Lang>;\n\t\t`,\n\t\tcode\n\t);\n\n\tconst result = {\n\t\tname,\n\t\tcode,\n\t\tauxiliaryTypes,\n\t\tcontentTypeNames,\n\t};\n\n\tif (args.cache) {\n\t\tconst key = getCacheKey(args.model);\n\n\t\targs.cache.set(key, result);\n\t}\n\n\treturn result;\n}\n"],"mappings":";;;;;;;;;;AA4BA,SAAgB,oBACf,MACiC;AACjC,KAAI,KAAK,OAAO;EACf,MAAM,MAAM,YAAY,KAAK,MAAM;EACnC,MAAM,SAAS,KAAK,MAAM,IAAI,IAAI;AAElC,MAAI,OACH,QAAO;;CAIT,IAAI,OAAO;CAEX,MAAM,iBAAkC,EAAE;CAC1C,MAAM,mBAA6B,EAAE;CAErC,MAAM,OAAO,cAAc,KAAK,MAAM,IAAI,WAAW;CACrD,MAAM,cACL,KAAK,aAAa,KAAK,UAAU,SAAS,IACvC,WAAW,KAAK,UAAU,KAAK,aAAa,IAAI,SAAS,GAAG,CAAC,GAC7D;CACJ,MAAM,mBAAmB,iBAAiB,KAAK,MAAM,GAClD,2BACA;CACH,MAAM,oBAAoB,0BAA0B;EACnD,MAAM,KAAK,MAAM;EACjB,OAAO,KAAK;EACZ,CAAC;CAEF,MAAM,WAAW,wBAAwB;EACxC,OAAO,KAAK;EACZ,cAAc,KAAK;EACnB,CAAC;AAEF,gBAAe,KAAK,GAAG,SAAS,eAAe;AAC/C,kBAAiB,KAAK,SAAS,KAAK;AACpC,kBAAiB,KAAK,GAAG,SAAS,iBAAiB;AAEnD,QAAO,WAAW,SAAS,MAAM,KAAK;AAEtC,QAAO,WACN,MAAM;;QAEA,kBAAkB;;wBAEF,KAAK,MAAM,GAAG;4BACV,KAAK,MAAM,WAAW,UAAU,CAAC;6BAChC,+BAA+B;;;;iBAI3C,KAAK,yBAAyB,YAAY,cAAc,iBAAiB,YACvF,SAAS,KACT,MAAM,KAAK,MAAM,GAAG;KAErB,KACA;CAED,MAAM,SAAS;EACd;EACA;EACA;EACA;EACA;AAED,KAAI,KAAK,OAAO;EACf,MAAM,MAAM,YAAY,KAAK,MAAM;AAEnC,OAAK,MAAM,IAAI,KAAK,OAAO;;AAG5B,QAAO"}
@@ -0,0 +1,66 @@
1
+ const require_addLine = require("./addLine.cjs");
2
+ const require_constants = require("../constants.cjs");
3
+ const require_getAPIIDPath = require("./getAPIIDPath.cjs");
4
+ const require_getHumanReadableModelName = require("./getHumanReadableModelName.cjs");
5
+ const require_getHumanReadablePath = require("./getHumanReadablePath.cjs");
6
+ //#region src/lib/buildFieldDocs.ts
7
+ function getHumanReadableFieldType(args) {
8
+ switch (args.field.type) {
9
+ case "StructuredText": return "Rich Text";
10
+ case "IntegrationFields": {
11
+ const catalog = args.field.config?.catalog;
12
+ return `Integration Fields (Catalog: ${catalog ? `\`${catalog}\`` : "*unknown*"})`;
13
+ }
14
+ case "Link": switch (args.field.config?.select) {
15
+ case "document": return "Content Relationship";
16
+ case "media": return "Link to Media";
17
+ default: return "Link";
18
+ }
19
+ case "Slices": return "Slice Zone";
20
+ default: return args.field.type;
21
+ }
22
+ }
23
+ function getDocumentationURL(args) {
24
+ switch (args.field.type) {
25
+ case "Link": {
26
+ const urls = require_constants.FIELD_DOCUMENTATION_URLS.Link;
27
+ switch (args.field.config?.select) {
28
+ case "document": return urls.contentRelationship;
29
+ case "media": return urls.linkToMedia;
30
+ default: return urls.link;
31
+ }
32
+ }
33
+ default: {
34
+ const url = require_constants.FIELD_DOCUMENTATION_URLS[args.field.type];
35
+ if (typeof url === "string") return url;
36
+ }
37
+ }
38
+ }
39
+ function buildFieldDocs(args) {
40
+ let result = "/**";
41
+ const humanReadableName = require_getHumanReadableModelName.getHumanReadableModelName({
42
+ model: args.field,
43
+ name: args.name
44
+ });
45
+ const humanReadablePath = require_getHumanReadablePath.getHumanReadablePath({ path: args.path });
46
+ const humanReadableFieldType = getHumanReadableFieldType({ field: args.field });
47
+ result = require_addLine.addLine(` * ${humanReadableName} field in *${humanReadablePath}*`, result);
48
+ result = require_addLine.addLine(" *", result);
49
+ result = require_addLine.addLine(` * - **Field Type**: ${humanReadableFieldType}`, result);
50
+ result = require_addLine.addLine(` * - **Placeholder**: ${args.field.config && "placeholder" in args.field.config && args.field.config.placeholder || `*None*`}`, result);
51
+ const defaultValue = args.field.config && "default_value" in args.field.config ? args.field.config.default_value : void 0;
52
+ if (defaultValue !== void 0) result = require_addLine.addLine(` * - **Default Value**: ${typeof defaultValue === "boolean" ? `${defaultValue}` : defaultValue}`, result);
53
+ result = require_addLine.addLine(` * - **API ID Path**: ${require_getAPIIDPath.getAPIIDPath({ path: [...args.path, {
54
+ name: args.name,
55
+ model: args.field
56
+ }] })}`, result);
57
+ if (args.tabName) result = require_addLine.addLine(` * - **Tab**: ${args.tabName}`, result);
58
+ const documentationURL = getDocumentationURL({ field: args.field });
59
+ if (documentationURL) result = require_addLine.addLine(` * - **Documentation**: ${documentationURL}`, result);
60
+ result = require_addLine.addLine(" */", result);
61
+ return result;
62
+ }
63
+ //#endregion
64
+ exports.buildFieldDocs = buildFieldDocs;
65
+
66
+ //# sourceMappingURL=buildFieldDocs.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildFieldDocs.cjs","names":["FIELD_DOCUMENTATION_URLS","getHumanReadableModelName","getHumanReadablePath","addLine","getAPIIDPath"],"sources":["../../src/lib/buildFieldDocs.ts"],"sourcesContent":["import type { CustomTypeModelField } from \"@prismicio/client\";\n\nimport { FIELD_DOCUMENTATION_URLS } from \"../constants\";\nimport type { FieldPath } from \"../types\";\nimport { addLine } from \"./addLine\";\nimport { getAPIIDPath } from \"./getAPIIDPath\";\nimport { getHumanReadableModelName } from \"./getHumanReadableModelName\";\nimport { getHumanReadablePath } from \"./getHumanReadablePath\";\n\ntype GetFieldHumanReadableTypeArgs = {\n\tfield: CustomTypeModelField;\n};\n\nfunction getHumanReadableFieldType(args: GetFieldHumanReadableTypeArgs): string {\n\tswitch (args.field.type) {\n\t\tcase \"StructuredText\": {\n\t\t\treturn \"Rich Text\";\n\t\t}\n\n\t\tcase \"IntegrationFields\": {\n\t\t\tconst catalog = args.field.config?.catalog;\n\n\t\t\treturn `Integration Fields (Catalog: ${catalog ? `\\`${catalog}\\`` : \"*unknown*\"})`;\n\t\t}\n\n\t\tcase \"Link\": {\n\t\t\tswitch (args.field.config?.select) {\n\t\t\t\tcase \"document\": {\n\t\t\t\t\treturn \"Content Relationship\";\n\t\t\t\t}\n\n\t\t\t\tcase \"media\": {\n\t\t\t\t\treturn \"Link to Media\";\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\treturn \"Link\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tcase \"Slices\": {\n\t\t\treturn \"Slice Zone\";\n\t\t}\n\n\t\tdefault: {\n\t\t\treturn args.field.type;\n\t\t}\n\t}\n}\n\ntype getDocumentationURLArgs = {\n\tfield: CustomTypeModelField;\n};\n\nfunction getDocumentationURL(args: getDocumentationURLArgs) {\n\tswitch (args.field.type) {\n\t\tcase \"Link\": {\n\t\t\tconst urls = FIELD_DOCUMENTATION_URLS.Link;\n\n\t\t\tswitch (args.field.config?.select) {\n\t\t\t\tcase \"document\": {\n\t\t\t\t\treturn urls.contentRelationship;\n\t\t\t\t}\n\n\t\t\t\tcase \"media\": {\n\t\t\t\t\treturn urls.linkToMedia;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\treturn urls.link;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdefault: {\n\t\t\tconst url =\n\t\t\t\tFIELD_DOCUMENTATION_URLS[args.field.type as keyof typeof FIELD_DOCUMENTATION_URLS];\n\n\t\t\tif (typeof url === \"string\") {\n\t\t\t\treturn url;\n\t\t\t}\n\t\t}\n\t}\n}\n\ntype BuildFieldDocsArgs = {\n\tname: string;\n\tfield: CustomTypeModelField;\n\tpath: FieldPath;\n\ttabName?: string;\n};\n\nexport function buildFieldDocs(args: BuildFieldDocsArgs): string {\n\tlet result = \"/**\";\n\n\tconst humanReadableName = getHumanReadableModelName({\n\t\tmodel: args.field,\n\t\tname: args.name,\n\t});\n\tconst humanReadablePath = getHumanReadablePath({ path: args.path });\n\tconst humanReadableFieldType = getHumanReadableFieldType({\n\t\tfield: args.field,\n\t});\n\n\tresult = addLine(` * ${humanReadableName} field in *${humanReadablePath}*`, result);\n\n\tresult = addLine(\" *\", result);\n\n\tresult = addLine(` * - **Field Type**: ${humanReadableFieldType}`, result);\n\n\tconst placeholder =\n\t\t(args.field.config && \"placeholder\" in args.field.config && args.field.config.placeholder) ||\n\t\t`*None*`;\n\tresult = addLine(` * - **Placeholder**: ${placeholder}`, result);\n\n\tconst defaultValue =\n\t\targs.field.config && \"default_value\" in args.field.config\n\t\t\t? args.field.config.default_value\n\t\t\t: undefined;\n\tif (defaultValue !== undefined) {\n\t\tconst stringifiedDefaultValue =\n\t\t\ttypeof defaultValue === \"boolean\" ? `${defaultValue}` : defaultValue;\n\n\t\tresult = addLine(` * - **Default Value**: ${stringifiedDefaultValue}`, result);\n\t}\n\n\tconst apiIDPath = getAPIIDPath({\n\t\tpath: [...args.path, { name: args.name, model: args.field }],\n\t});\n\tresult = addLine(` * - **API ID Path**: ${apiIDPath}`, result);\n\n\tif (args.tabName) {\n\t\tresult = addLine(` * - **Tab**: ${args.tabName}`, result);\n\t}\n\n\tconst documentationURL = getDocumentationURL({ field: args.field });\n\tif (documentationURL) {\n\t\tresult = addLine(` * - **Documentation**: ${documentationURL}`, result);\n\t}\n\n\tresult = addLine(\" */\", result);\n\n\treturn result;\n}\n"],"mappings":";;;;;;AAaA,SAAS,0BAA0B,MAA6C;AAC/E,SAAQ,KAAK,MAAM,MAAnB;EACC,KAAK,iBACJ,QAAO;EAGR,KAAK,qBAAqB;GACzB,MAAM,UAAU,KAAK,MAAM,QAAQ;AAEnC,UAAO,gCAAgC,UAAU,KAAK,QAAQ,MAAM,YAAY;;EAGjF,KAAK,OACJ,SAAQ,KAAK,MAAM,QAAQ,QAA3B;GACC,KAAK,WACJ,QAAO;GAGR,KAAK,QACJ,QAAO;GAGR,QACC,QAAO;;EAKV,KAAK,SACJ,QAAO;EAGR,QACC,QAAO,KAAK,MAAM;;;AASrB,SAAS,oBAAoB,MAA+B;AAC3D,SAAQ,KAAK,MAAM,MAAnB;EACC,KAAK,QAAQ;GACZ,MAAM,OAAOA,kBAAAA,y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AoB,EAAE,OAAO,KAAK,OAAO,CAAC;AACnE,KAAI,iBACH,UAASA,gBAAAA,QAAQ,2BAA2B,oBAAoB,OAAO;AAGxE,UAASA,gBAAAA,QAAQ,OAAO,OAAO;AAE/B,QAAO"}
@@ -1,8 +1,8 @@
1
- import { addLine } from "./addLine.mjs";
2
- import { FIELD_DOCUMENTATION_URLS } from "../constants.mjs";
3
- import { getAPIIDPath } from "./getAPIIDPath.mjs";
4
- import { getHumanReadableModelName } from "./getHumanReadableModelName.mjs";
5
- import { getHumanReadablePath } from "./getHumanReadablePath.mjs";
1
+ import { addLine } from "./addLine.js";
2
+ import { FIELD_DOCUMENTATION_URLS } from "../constants.js";
3
+ import { getAPIIDPath } from "./getAPIIDPath.js";
4
+ import { getHumanReadableModelName } from "./getHumanReadableModelName.js";
5
+ import { getHumanReadablePath } from "./getHumanReadablePath.js";
6
6
  //#region src/lib/buildFieldDocs.ts
7
7
  function getHumanReadableFieldType(args) {
8
8
  switch (args.field.type) {
@@ -63,4 +63,4 @@ function buildFieldDocs(args) {
63
63
  //#endregion
64
64
  export { buildFieldDocs };
65
65
 
66
- //# sourceMappingURL=buildFieldDocs.mjs.map
66
+ //# sourceMappingURL=buildFieldDocs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildFieldDocs.js","names":[],"sources":["../../src/lib/buildFieldDocs.ts"],"sourcesContent":["import type { CustomTypeModelField } from \"@prismicio/client\";\n\nimport { FIELD_DOCUMENTATION_URLS } from \"../constants\";\nimport type { FieldPath } from \"../types\";\nimport { addLine } from \"./addLine\";\nimport { getAPIIDPath } from \"./getAPIIDPath\";\nimport { getHumanReadableModelName } from \"./getHumanReadableModelName\";\nimport { getHumanReadablePath } from \"./getHumanReadablePath\";\n\ntype GetFieldHumanReadableTypeArgs = {\n\tfield: CustomTypeModelField;\n};\n\nfunction getHumanReadableFieldType(args: GetFieldHumanReadableTypeArgs): string {\n\tswitch (args.field.type) {\n\t\tcase \"StructuredText\": {\n\t\t\treturn \"Rich Text\";\n\t\t}\n\n\t\tcase \"IntegrationFields\": {\n\t\t\tconst catalog = args.field.config?.catalog;\n\n\t\t\treturn `Integration Fields (Catalog: ${catalog ? `\\`${catalog}\\`` : \"*unknown*\"})`;\n\t\t}\n\n\t\tcase \"Link\": {\n\t\t\tswitch (args.field.config?.select) {\n\t\t\t\tcase \"document\": {\n\t\t\t\t\treturn \"Content Relationship\";\n\t\t\t\t}\n\n\t\t\t\tcase \"media\": {\n\t\t\t\t\treturn \"Link to Media\";\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\treturn \"Link\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tcase \"Slices\": {\n\t\t\treturn \"Slice Zone\";\n\t\t}\n\n\t\tdefault: {\n\t\t\treturn args.field.type;\n\t\t}\n\t}\n}\n\ntype getDocumentationURLArgs = {\n\tfield: CustomTypeModelField;\n};\n\nfunction getDocumentationURL(args: getDocumentationURLArgs) {\n\tswitch (args.field.type) {\n\t\tcase \"Link\": {\n\t\t\tconst urls = FIELD_DOCUMENTATION_URLS.Link;\n\n\t\t\tswitch (args.field.config?.select) {\n\t\t\t\tcase \"document\": {\n\t\t\t\t\treturn urls.contentRelationship;\n\t\t\t\t}\n\n\t\t\t\tcase \"media\": {\n\t\t\t\t\treturn urls.linkToMedia;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\treturn urls.link;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdefault: {\n\t\t\tconst url =\n\t\t\t\tFIELD_DOCUMENTATION_URLS[args.field.type as keyof typeof FIELD_DOCUMENTATION_URLS];\n\n\t\t\tif (typeof url === \"string\") {\n\t\t\t\treturn url;\n\t\t\t}\n\t\t}\n\t}\n}\n\ntype BuildFieldDocsArgs = {\n\tname: string;\n\tfield: CustomTypeModelField;\n\tpath: FieldPath;\n\ttabName?: string;\n};\n\nexport function buildFieldDocs(args: BuildFieldDocsArgs): string {\n\tlet result = \"/**\";\n\n\tconst humanReadableName = getHumanReadableModelName({\n\t\tmodel: args.field,\n\t\tname: args.name,\n\t});\n\tconst humanReadablePath = getHumanReadablePath({ path: args.path });\n\tconst humanReadableFieldType = getHumanReadableFieldType({\n\t\tfield: args.field,\n\t});\n\n\tresult = addLine(` * ${humanReadableName} field in *${humanReadablePath}*`, result);\n\n\tresult = addLine(\" *\", result);\n\n\tresult = addLine(` * - **Field Type**: ${humanReadableFieldType}`, result);\n\n\tconst placeholder =\n\t\t(args.field.config && \"placeholder\" in args.field.config && args.field.config.placeholder) ||\n\t\t`*None*`;\n\tresult = addLine(` * - **Placeholder**: ${placeholder}`, result);\n\n\tconst defaultValue =\n\t\targs.field.config && \"default_value\" in args.field.config\n\t\t\t? args.field.config.default_value\n\t\t\t: undefined;\n\tif (defaultValue !== undefined) {\n\t\tconst stringifiedDefaultValue =\n\t\t\ttypeof defaultValue === \"boolean\" ? `${defaultValue}` : defaultValue;\n\n\t\tresult = addLine(` * - **Default Value**: ${stringifiedDefaultValue}`, result);\n\t}\n\n\tconst apiIDPath = getAPIIDPath({\n\t\tpath: [...args.path, { name: args.name, model: args.field }],\n\t});\n\tresult = addLine(` * - **API ID Path**: ${apiIDPath}`, result);\n\n\tif (args.tabName) {\n\t\tresult = addLine(` * - **Tab**: ${args.tabName}`, result);\n\t}\n\n\tconst documentationURL = getDocumentationURL({ field: args.field });\n\tif (documentationURL) {\n\t\tresult = addLine(` * - **Documentation**: ${documentationURL}`, result);\n\t}\n\n\tresult = addLine(\" */\", result);\n\n\treturn result;\n}\n"],"mappings":";;;;;;AAaA,SAAS,0BAA0B,MAA6C;AAC/E,SAAQ,KAAK,MAAM,MAAnB;EACC,KAAK,iBACJ,QAAO;EAGR,KAAK,qBAAqB;GACzB,MAAM,UAAU,KAAK,MAAM,QAAQ;AAEnC,UAAO,gCAAgC,UAAU,KAAK,QAAQ,MAAM,YAAY;;EAGjF,KAAK,OACJ,SAAQ,KAAK,MAAM,QAAQ,QAA3B;GACC,KAA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AC5D,CAAC,IACqD,OAAO;AAE9D,KAAI,KAAK,QACR,UAAS,QAAQ,iBAAiB,KAAK,WAAW,OAAO;CAG1D,MAAM,mBAAmB,oBAAoB,EAAE,OAAO,KAAK,OAAO,CAAC;AACnE,KAAI,iBACH,UAAS,QAAQ,2BAA2B,oBAAoB,OAAO;AAGxE,UAAS,QAAQ,OAAO,OAAO;AAE/B,QAAO"}
@@ -0,0 +1,285 @@
1
+ require("../_virtual/_rolldown/runtime.cjs");
2
+ const require_addLine = require("./addLine.cjs");
3
+ const require_addSection = require("./addSection.cjs");
4
+ const require_buildTypeName = require("./buildTypeName.cjs");
5
+ const require_getHumanReadablePath = require("./getHumanReadablePath.cjs");
6
+ const require_buildFieldDocs = require("./buildFieldDocs.cjs");
7
+ const require_buildUnion = require("./buildUnion.cjs");
8
+ let common_tags = require("common-tags");
9
+ let _prismicio_client = require("@prismicio/client");
10
+ //#region src/lib/buildFieldProperties.ts
11
+ function buildFieldProperty(args) {
12
+ let code = require_buildFieldDocs.buildFieldDocs({
13
+ name: args.name,
14
+ field: args.field,
15
+ path: args.path,
16
+ tabName: args.tabName
17
+ });
18
+ const auxiliaryTypes = [];
19
+ const contentTypeNames = [];
20
+ const name = args.name.includes("-") || args.name.includes(":") || /^[0-9]/.test(args.name) ? `"${args.name}"` : args.name;
21
+ switch (args.field.type) {
22
+ case "UID": break;
23
+ case "Boolean":
24
+ code = require_addLine.addLine(`${name}: prismic.BooleanField;`, code);
25
+ break;
26
+ case "Color":
27
+ code = require_addLine.addLine(`${name}: prismic.ColorField;`, code);
28
+ break;
29
+ case "Date":
30
+ code = require_addLine.addLine(`${name}: prismic.DateField;`, code);
31
+ break;
32
+ case "Embed": {
33
+ const providerTypes = [];
34
+ if (args.fieldConfigs.embed?.providerTypes) for (const providerType in args.fieldConfigs.embed?.providerTypes) {
35
+ const configuredProviderType = args.fieldConfigs.embed?.providerTypes[providerType];
36
+ providerTypes.push(`({ provider_name: "${providerType}" } & ${configuredProviderType})`);
37
+ }
38
+ const providerTypesUnion = require_buildUnion.buildUnion(providerTypes);
39
+ code = providerTypes.length > 0 ? require_addLine.addLine(`${name}: prismic.EmbedField<prismic.AnyOEmbed & prismic.OEmbedExtra & (${providerTypesUnion})>`, code) : require_addLine.addLine(`${name}: prismic.EmbedField`, code);
40
+ break;
41
+ }
42
+ case "GeoPoint":
43
+ code = require_addLine.addLine(`${name}: prismic.GeoPointField;`, code);
44
+ break;
45
+ case "Image":
46
+ if (args.field.config?.thumbnails && args.field.config.thumbnails.length > 0) code = require_addLine.addLine(`${name}: prismic.ImageField<${require_buildUnion.buildUnion(args.field.config.thumbnails.map((thumb) => `"${thumb.name}"`))}>;`, code);
47
+ else code = require_addLine.addLine(`${name}: prismic.ImageField<never>;`, code);
48
+ break;
49
+ case "IntegrationFields": {
50
+ const catalogType = args.field.config?.catalog ? args.fieldConfigs.integrationFields?.catalogTypes?.[args.field.config.catalog] : void 0;
51
+ if (catalogType) code = require_addLine.addLine(`${name}: prismic.IntegrationField<${catalogType}>;`, code);
52
+ else code = require_addLine.addLine(`${name}: prismic.IntegrationField;`, code);
53
+ break;
54
+ }
55
+ case "Link": {
56
+ const variants = args.field.config && "variants" in args.field.config && Array.isArray(args.field.config.variants) && args.field.config.variants.length > 0 ? args.field.config.variants.map((variant) => `"${variant.replace(/"/g, "\\\"")}"`).join(" | ") : "never";
57
+ switch (args.field.config?.select) {
58
+ case "document":
59
+ if ("customtypes" in args.field.config && args.field.config.customtypes && args.field.config.customtypes.length > 0) code = require_addLine.addLine(`${name}: ${require_buildUnion.buildUnion(args.field.config.customtypes.map((type) => {
60
+ if (typeof type === "string") return `prismic.ContentRelationshipField<"${type}">`;
61
+ return `ContentRelationshipFieldWithData<${JSON.stringify([type])}>`;
62
+ }))};`, code);
63
+ else code = require_addLine.addLine(`${name}: prismic.ContentRelationshipField;`, code);
64
+ break;
65
+ case "media":
66
+ code = require_addLine.addLine(`${name}: prismic.LinkToMediaField<prismic.FieldState, ${variants}>;`, code);
67
+ break;
68
+ default: {
69
+ let type = `prismic.LinkField<string, string, unknown, prismic.FieldState, ${variants}>`;
70
+ if (args.field.config?.repeat) type = `prismic.Repeatable<${type}>`;
71
+ code = require_addLine.addLine(`${name}: ${type};`, code);
72
+ break;
73
+ }
74
+ }
75
+ break;
76
+ }
77
+ case "Number":
78
+ code = require_addLine.addLine(`${name}: prismic.NumberField;`, code);
79
+ break;
80
+ case "StructuredText":
81
+ code = require_addLine.addLine(`${name}: prismic.RichTextField;`, code);
82
+ break;
83
+ case "Select": {
84
+ const options = args.field.config?.options?.map((option) => `"${option}"`) || [];
85
+ const optionsType = options.length ? require_buildUnion.buildUnion(options) : "string";
86
+ if (Boolean(args.field.config?.default_value)) code = require_addLine.addLine(`${name}: prismic.SelectField<${optionsType}, "filled">;`, code);
87
+ else code = require_addLine.addLine(`${name}: prismic.SelectField${options.length > 0 ? `<${optionsType}>` : ""};`, code);
88
+ break;
89
+ }
90
+ case "Table":
91
+ code = require_addLine.addLine(`${name}: prismic.TableField;`, code);
92
+ break;
93
+ case "Text":
94
+ code = require_addLine.addLine(`${name}: prismic.KeyTextField;`, code);
95
+ break;
96
+ case "Timestamp":
97
+ code = require_addLine.addLine(`${name}: prismic.TimestampField;`, code);
98
+ break;
99
+ case "Group": {
100
+ const groupPathParts = args.path.filter((part) => part.model !== void 0 && "type" in part.model && part.model.type === _prismicio_client.CustomTypeModelFieldType.Group);
101
+ const isNestedGroup = groupPathParts.length > 0;
102
+ let itemName;
103
+ if (args.path[0].model && "type" in args.path[0].model && args.path[0].model.type === "SharedSlice") {
104
+ const [slicePathPart, variationPathPart, zonePathPart] = args.path;
105
+ itemName = require_buildTypeName.buildTypeName(slicePathPart.name, "Slice", variationPathPart.name, zonePathPart.name, ...groupPathParts.map((part) => part.name), args.name, "Item");
106
+ } else itemName = require_buildTypeName.buildTypeName(args.path[0].name, "Document", "Data", ...groupPathParts.map((part) => part.name), args.name, "Item");
107
+ const path = [...args.path, {
108
+ name,
109
+ model: args.field
110
+ }];
111
+ const humanReadablePath = require_getHumanReadablePath.getHumanReadablePath({ path });
112
+ const itemFieldProperties = buildFieldProperties({
113
+ fields: args.field.config?.fields || {},
114
+ fieldConfigs: args.fieldConfigs,
115
+ path
116
+ });
117
+ auxiliaryTypes.push(...itemFieldProperties.auxiliaryTypes);
118
+ contentTypeNames.push(...itemFieldProperties.contentTypeNames);
119
+ auxiliaryTypes.push({
120
+ name: itemName,
121
+ code: common_tags.source`
122
+ /**
123
+ * Item in *${humanReadablePath}*
124
+ */
125
+ export interface ${itemName} {
126
+ ${itemFieldProperties.code}
127
+ }
128
+ `
129
+ });
130
+ contentTypeNames.push(itemName);
131
+ if (isNestedGroup) code = require_addLine.addLine(`${name}: prismic.NestedGroupField<Simplify<${itemName}>>;`, code);
132
+ else code = require_addLine.addLine(`${name}: prismic.GroupField<Simplify<${itemName}>>;`, code);
133
+ break;
134
+ }
135
+ case "Slices": {
136
+ const choiceNames = [];
137
+ if (args.field.config?.choices) for (const choiceID in args.field.config.choices) {
138
+ const choice = args.field.config.choices[choiceID];
139
+ if (choice.type === "SharedSlice") choiceNames.push(require_buildTypeName.buildTypeName(choiceID, "Slice"));
140
+ else if (choice.type === "Slice") {
141
+ const sliceName = require_buildTypeName.buildTypeName(args.path[0].name, "Document", "Data", args.name, choiceID, "Slice");
142
+ let primaryInterfaceName;
143
+ if (choice["non-repeat"] && Object.keys(choice["non-repeat"]).length > 0) {
144
+ primaryInterfaceName = require_buildTypeName.buildTypeName(sliceName, "Primary");
145
+ const path = [
146
+ ...args.path,
147
+ {
148
+ name: args.name,
149
+ model: args.field
150
+ },
151
+ {
152
+ name: choiceID,
153
+ model: choice
154
+ },
155
+ {
156
+ name: "primary",
157
+ label: "Primary"
158
+ }
159
+ ];
160
+ const humanReadablePath = require_getHumanReadablePath.getHumanReadablePath({ path });
161
+ const primaryFieldProperties = buildFieldProperties({
162
+ fields: choice["non-repeat"],
163
+ fieldConfigs: args.fieldConfigs,
164
+ path
165
+ });
166
+ auxiliaryTypes.push(...primaryFieldProperties.auxiliaryTypes);
167
+ contentTypeNames.push(...primaryFieldProperties.contentTypeNames);
168
+ let primaryCode = common_tags.stripIndent`
169
+ /**
170
+ * Primary content in *${humanReadablePath}*
171
+ */
172
+ `;
173
+ primaryCode = primaryFieldProperties.code ? require_addLine.addLine(common_tags.source`
174
+ export interface ${primaryInterfaceName} {
175
+ ${primaryFieldProperties.code}
176
+ }
177
+ `, primaryCode) : require_addLine.addLine(`export interface ${primaryInterfaceName} {}`, primaryCode);
178
+ auxiliaryTypes.push({
179
+ name: primaryInterfaceName,
180
+ code: primaryCode
181
+ });
182
+ contentTypeNames.push(primaryInterfaceName);
183
+ }
184
+ let itemInterfaceName;
185
+ if (choice.repeat && Object.keys(choice.repeat).length > 0) {
186
+ itemInterfaceName = require_buildTypeName.buildTypeName(sliceName, "Item");
187
+ const path = [
188
+ ...args.path,
189
+ {
190
+ name: args.name,
191
+ model: args.field
192
+ },
193
+ {
194
+ name: choiceID,
195
+ model: choice
196
+ },
197
+ {
198
+ name: "items",
199
+ label: "Items"
200
+ }
201
+ ];
202
+ const humanReadablePath = require_getHumanReadablePath.getHumanReadablePath({ path });
203
+ const itemFieldProperties = buildFieldProperties({
204
+ fields: choice.repeat,
205
+ fieldConfigs: args.fieldConfigs,
206
+ path
207
+ });
208
+ auxiliaryTypes.push(...itemFieldProperties.auxiliaryTypes);
209
+ contentTypeNames.push(...itemFieldProperties.contentTypeNames);
210
+ let itemCode = common_tags.stripIndent`
211
+ /**
212
+ * Item content in *${humanReadablePath}*
213
+ */
214
+ `;
215
+ itemCode = itemFieldProperties.code ? require_addLine.addLine(common_tags.source`
216
+ export interface ${itemInterfaceName} {
217
+ ${itemFieldProperties.code}
218
+ }
219
+ `, itemCode) : require_addLine.addLine(`export interface ${itemInterfaceName} {}`, itemCode);
220
+ auxiliaryTypes.push({
221
+ name: itemInterfaceName,
222
+ code: itemCode
223
+ });
224
+ contentTypeNames.push(itemInterfaceName);
225
+ }
226
+ auxiliaryTypes.push({
227
+ name: sliceName,
228
+ code: common_tags.stripIndent`
229
+ /**
230
+ * Slice for *${require_getHumanReadablePath.getHumanReadablePath({ path: [...args.path, {
231
+ name: args.name,
232
+ model: args.field
233
+ }] })}*
234
+ */
235
+ export type ${sliceName} = prismic.Slice<"${choiceID}", ${primaryInterfaceName ? `Simplify<${primaryInterfaceName}>` : `Record<string, never>`}, ${itemInterfaceName ? `Simplify<${itemInterfaceName}>` : `never`}>
236
+ `
237
+ });
238
+ choiceNames.push(sliceName);
239
+ }
240
+ }
241
+ const choiceUnionName = require_buildTypeName.buildTypeName(args.path[0].name, "Document", "Data", args.name, "Slice");
242
+ const choiceUnion = require_buildUnion.buildUnion(choiceNames);
243
+ auxiliaryTypes.push({
244
+ name: choiceUnionName,
245
+ code: `type ${choiceUnionName} = ${choiceUnion}`
246
+ });
247
+ contentTypeNames.push(choiceUnionName);
248
+ code = require_addLine.addLine(`${name}: prismic.SliceZone<${choiceUnionName}>;`, code);
249
+ break;
250
+ }
251
+ default: code = require_addLine.addLine(`${name}: unknown;`, code);
252
+ }
253
+ return {
254
+ code,
255
+ auxiliaryTypes,
256
+ contentTypeNames
257
+ };
258
+ }
259
+ function buildFieldProperties(args) {
260
+ let code = "";
261
+ const auxiliaryTypes = [];
262
+ const contentTypeNames = [];
263
+ for (const name in args.fields) {
264
+ const field = args.fields[name];
265
+ const fieldProperty = buildFieldProperty({
266
+ name,
267
+ field,
268
+ path: args.path,
269
+ fieldConfigs: args.fieldConfigs,
270
+ tabName: args.tabName
271
+ });
272
+ code = require_addSection.addSection(fieldProperty.code, code);
273
+ auxiliaryTypes.push(...fieldProperty.auxiliaryTypes);
274
+ contentTypeNames.push(...fieldProperty.contentTypeNames);
275
+ }
276
+ return {
277
+ code,
278
+ auxiliaryTypes,
279
+ contentTypeNames
280
+ };
281
+ }
282
+ //#endregion
283
+ exports.buildFieldProperties = buildFieldProperties;
284
+
285
+ //# sourceMappingURL=buildFieldProperties.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildFieldProperties.cjs","names":["buildFieldDocs","addLine","buildUnion","CustomTypeModelFieldType","buildTypeName","getHumanReadablePath","addSection"],"sources":["../../src/lib/buildFieldProperties.ts"],"sourcesContent":["import { type CustomTypeModelField, CustomTypeModelFieldType } from \"@prismicio/client\";\nimport { source, stripIndent } from \"common-tags\";\n\nimport type { AuxiliaryType, FieldConfigs, FieldPath } from \"../types\";\nimport { addLine } from \"./addLine\";\nimport { addSection } from \"./addSection\";\nimport { buildFieldDocs } from \"./buildFieldDocs\";\nimport { buildTypeName } from \"./buildTypeName\";\nimport { buildUnion } from \"./buildUnion\";\nimport { getHumanReadablePath } from \"./getHumanReadablePath\";\n\ntype BuildFieldPropertyArgs = Pick<\n\tBuildFieldPropertiesArgs,\n\t\"path\" | \"fieldConfigs\" | \"tabName\"\n> & {\n\tname: string;\n\tfield: CustomTypeModelField;\n};\n\ntype BuildFieldPropertyReturnType = {\n\tcode: string;\n\tauxiliaryTypes: AuxiliaryType[];\n\tcontentTypeNames: string[];\n};\n\nfunction buildFieldProperty(args: BuildFieldPropertyArgs): BuildFieldPropertyReturnType {\n\tlet code = buildFieldDocs({\n\t\tname: args.name,\n\t\tfield: args.field,\n\t\tpath: args.path,\n\t\ttabName: args.tabName,\n\t});\n\n\tconst auxiliaryTypes: AuxiliaryType[] = [];\n\tconst contentTypeNames: string[] = [];\n\n\tconst name =\n\t\targs.name.includes(\"-\") || args.name.includes(\":\") || /^[0-9]/.test(args.name)\n\t\t\t? `\"${args.name}\"`\n\t\t\t: args.name;\n\n\tswitch (args.field.type) {\n\t\tcase \"UID\": {\n\t\t\t// UID fields are not included in Data.\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"Boolean\": {\n\t\t\tcode = addLine(`${name}: prismic.BooleanField;`, code);\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"Color\": {\n\t\t\tcode = addLine(`${name}: prismic.ColorField;`, code);\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"Date\": {\n\t\t\tcode = addLine(`${name}: prismic.DateField;`, code);\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"Embed\": {\n\t\t\tconst providerTypes: string[] = [];\n\n\t\t\tif (args.fieldConfigs.embed?.providerTypes) {\n\t\t\t\tfor (const providerType in args.fieldConfigs.embed?.providerTypes) {\n\t\t\t\t\tconst configuredProviderType = args.fieldConfigs.embed?.providerTypes[providerType];\n\n\t\t\t\t\tproviderTypes.push(`({ provider_name: \"${providerType}\" } & ${configuredProviderType})`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst providerTypesUnion = buildUnion(providerTypes);\n\n\t\t\tcode =\n\t\t\t\tproviderTypes.length > 0\n\t\t\t\t\t? addLine(\n\t\t\t\t\t\t\t`${name}: prismic.EmbedField<prismic.AnyOEmbed & prismic.OEmbedExtra & (${providerTypesUnion})>`,\n\t\t\t\t\t\t\tcode,\n\t\t\t\t\t\t)\n\t\t\t\t\t: addLine(`${name}: prismic.EmbedField`, code);\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"GeoPoint\": {\n\t\t\tcode = addLine(`${name}: prismic.GeoPointField;`, code);\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"Image\": {\n\t\t\tif (args.field.config?.thumbnails && args.field.config.thumbnails.length > 0) {\n\t\t\t\tconst thumbnailNames = buildUnion(\n\t\t\t\t\targs.field.config.thumbnails.map((thumb) => `\"${thumb.name}\"`),\n\t\t\t\t);\n\n\t\t\t\tcode = addLine(`${name}: prismic.ImageField<${thumbnailNames}>;`, code);\n\t\t\t} else {\n\t\t\t\tcode = addLine(`${name}: prismic.ImageField<never>;`, code);\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"IntegrationFields\": {\n\t\t\tconst catalogType = args.field.config?.catalog\n\t\t\t\t? args.fieldConfigs.integrationFields?.catalogTypes?.[args.field.config.catalog]\n\t\t\t\t: undefined;\n\n\t\t\tif (catalogType) {\n\t\t\t\tcode = addLine(`${name}: prismic.IntegrationField<${catalogType}>;`, code);\n\t\t\t} else {\n\t\t\t\tcode = addLine(`${name}: prismic.IntegrationField;`, code);\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"Link\": {\n\t\t\tconst variants =\n\t\t\t\targs.field.config &&\n\t\t\t\t\"variants\" in args.field.config &&\n\t\t\t\tArray.isArray(args.field.config.variants) &&\n\t\t\t\targs.field.config.variants.length > 0\n\t\t\t\t\t? args.field.config.variants\n\t\t\t\t\t\t\t.map((variant) => `\"${variant.replace(/\"/g, '\\\\\"')}\"`)\n\t\t\t\t\t\t\t.join(\" | \")\n\t\t\t\t\t: \"never\";\n\n\t\t\tswitch (args.field.config?.select) {\n\t\t\t\tcase \"document\": {\n\t\t\t\t\tif (\n\t\t\t\t\t\t\"customtypes\" in args.field.config &&\n\t\t\t\t\t\targs.field.config.customtypes &&\n\t\t\t\t\t\targs.field.config.customtypes.length > 0\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst contentRelationshipUnion = buildUnion(\n\t\t\t\t\t\t\targs.field.config.customtypes.map((type) => {\n\t\t\t\t\t\t\t\tif (typeof type === \"string\") {\n\t\t\t\t\t\t\t\t\treturn `prismic.ContentRelationshipField<\"${type}\">`;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn `ContentRelationshipFieldWithData<${JSON.stringify([type])}>`;\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tcode = addLine(`${name}: ${contentRelationshipUnion};`, code);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcode = addLine(`${name}: prismic.ContentRelationshipField;`, code);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase \"media\": {\n\t\t\t\t\tcode = addLine(\n\t\t\t\t\t\t`${name}: prismic.LinkToMediaField<prismic.FieldState, ${variants}>;`,\n\t\t\t\t\t\tcode,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tlet type = `prismic.LinkField<string, string, unknown, prismic.FieldState, ${variants}>`;\n\n\t\t\t\t\tif (args.field.config?.repeat) {\n\t\t\t\t\t\ttype = `prismic.Repeatable<${type}>`;\n\t\t\t\t\t}\n\n\t\t\t\t\tcode = addLine(`${name}: ${type};`, code);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"Number\": {\n\t\t\tcode = addLine(`${name}: prismic.NumberField;`, code);\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"StructuredText\": {\n\t\t\tcode = addLine(`${name}: prismic.RichTextField;`, code);\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"Select\": {\n\t\t\tconst options: string[] = args.field.config?.options?.map((option) => `\"${option}\"`) || [];\n\t\t\tconst optionsType = options.length ? buildUnion(options) : \"string\";\n\n\t\t\tconst hasDefault = Boolean(args.field.config?.default_value);\n\n\t\t\tif (hasDefault) {\n\t\t\t\tcode = addLine(`${name}: prismic.SelectField<${optionsType}, \"filled\">;`, code);\n\t\t\t} else {\n\t\t\t\tcode = addLine(\n\t\t\t\t\t`${name}: prismic.SelectField${options.length > 0 ? `<${optionsType}>` : \"\"};`,\n\t\t\t\t\tcode,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"Table\": {\n\t\t\tcode = addLine(`${name}: prismic.TableField;`, code);\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"Text\": {\n\t\t\tcode = addLine(`${name}: prismic.KeyTextField;`, code);\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"Timestamp\": {\n\t\t\tcode = addLine(`${name}: prismic.TimestampField;`, code);\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"Group\": {\n\t\t\tconst groupPathParts = args.path.filter(\n\t\t\t\t(part) =>\n\t\t\t\t\tpart.model !== undefined &&\n\t\t\t\t\t\"type\" in part.model &&\n\t\t\t\t\tpart.model.type === CustomTypeModelFieldType.Group,\n\t\t\t);\n\t\t\tconst isNestedGroup = groupPathParts.length > 0;\n\n\t\t\tlet itemName;\n\t\t\tif (\n\t\t\t\targs.path[0].model &&\n\t\t\t\t\"type\" in args.path[0].model &&\n\t\t\t\targs.path[0].model.type === \"SharedSlice\"\n\t\t\t) {\n\t\t\t\tconst [slicePathPart, variationPathPart, zonePathPart] = args.path;\n\n\t\t\t\titemName = buildTypeName(\n\t\t\t\t\tslicePathPart.name,\n\t\t\t\t\t\"Slice\",\n\t\t\t\t\tvariationPathPart.name,\n\t\t\t\t\tzonePathPart.name,\n\t\t\t\t\t...groupPathParts.map((part) => part.name),\n\t\t\t\t\targs.name,\n\t\t\t\t\t\"Item\",\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\titemName = buildTypeName(\n\t\t\t\t\targs.path[0].name,\n\t\t\t\t\t\"Document\",\n\t\t\t\t\t\"Data\",\n\t\t\t\t\t...groupPathParts.map((part) => part.name),\n\t\t\t\t\targs.name,\n\t\t\t\t\t\"Item\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst path: FieldPath = [\n\t\t\t\t...args.path,\n\t\t\t\t{\n\t\t\t\t\tname: name,\n\t\t\t\t\tmodel: args.field,\n\t\t\t\t},\n\t\t\t];\n\t\t\tconst humanReadablePath = getHumanReadablePath({ path });\n\n\t\t\tconst itemFieldProperties = buildFieldProperties({\n\t\t\t\tfields: args.field.config?.fields || {},\n\t\t\t\tfieldConfigs: args.fieldConfigs,\n\t\t\t\tpath,\n\t\t\t});\n\t\t\tauxiliaryTypes.push(...itemFieldProperties.auxiliaryTypes);\n\t\t\tcontentTypeNames.push(...itemFieldProperties.contentTypeNames);\n\n\t\t\tauxiliaryTypes.push({\n\t\t\t\tname: itemName,\n\t\t\t\tcode: source`\n\t\t\t\t\t/**\n\t\t\t\t\t * Item in *${humanReadablePath}*\n\t\t\t\t\t */\n\t\t\t\t\texport interface ${itemName} {\n\t\t\t\t\t\t${itemFieldProperties.code}\n\t\t\t\t\t}\n\t\t\t\t`,\n\t\t\t});\n\t\t\tcontentTypeNames.push(itemName);\n\n\t\t\tif (isNestedGroup) {\n\t\t\t\tcode = addLine(`${name}: prismic.NestedGroupField<Simplify<${itemName}>>;`, code);\n\t\t\t} else {\n\t\t\t\tcode = addLine(`${name}: prismic.GroupField<Simplify<${itemName}>>;`, code);\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"Slices\": {\n\t\t\tconst choiceNames: string[] = [];\n\n\t\t\tif (args.field.config?.choices) {\n\t\t\t\tfor (const choiceID in args.field.config.choices) {\n\t\t\t\t\tconst choice = args.field.config.choices[choiceID];\n\n\t\t\t\t\tif (choice.type === \"SharedSlice\") {\n\t\t\t\t\t\t// TODO: Verify that the Shared Slice\n\t\t\t\t\t\t// is provided to the global\n\t\t\t\t\t\t// `sharedSlices` array. If it is not,\n\t\t\t\t\t\t// the type won't exist, so we can't\n\t\t\t\t\t\t// add it to the union. We should\n\t\t\t\t\t\t// probably throw an error if we reach\n\t\t\t\t\t\t// that state, or maybe the input can\n\t\t\t\t\t\t// be validated early so we don't\n\t\t\t\t\t\t// generate any code using invalid\n\t\t\t\t\t\t// models.\n\t\t\t\t\t\tchoiceNames.push(buildTypeName(choiceID, \"Slice\"));\n\t\t\t\t\t} else if (choice.type === \"Slice\") {\n\t\t\t\t\t\tconst sliceName = buildTypeName(\n\t\t\t\t\t\t\targs.path[0].name,\n\t\t\t\t\t\t\t\"Document\",\n\t\t\t\t\t\t\t\"Data\",\n\t\t\t\t\t\t\targs.name,\n\t\t\t\t\t\t\tchoiceID,\n\t\t\t\t\t\t\t\"Slice\",\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tlet primaryInterfaceName: string | undefined;\n\t\t\t\t\t\tif (choice[\"non-repeat\"] && Object.keys(choice[\"non-repeat\"]).length > 0) {\n\t\t\t\t\t\t\tprimaryInterfaceName = buildTypeName(sliceName, \"Primary\");\n\n\t\t\t\t\t\t\tconst path: FieldPath = [\n\t\t\t\t\t\t\t\t...args.path,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: args.name,\n\t\t\t\t\t\t\t\t\tmodel: args.field,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: choiceID,\n\t\t\t\t\t\t\t\t\tmodel: choice,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: \"primary\",\n\t\t\t\t\t\t\t\t\tlabel: \"Primary\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\tconst humanReadablePath = getHumanReadablePath({ path });\n\n\t\t\t\t\t\t\tconst primaryFieldProperties = buildFieldProperties({\n\t\t\t\t\t\t\t\tfields: choice[\"non-repeat\"],\n\t\t\t\t\t\t\t\tfieldConfigs: args.fieldConfigs,\n\t\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tauxiliaryTypes.push(...primaryFieldProperties.auxiliaryTypes);\n\t\t\t\t\t\t\tcontentTypeNames.push(...primaryFieldProperties.contentTypeNames);\n\n\t\t\t\t\t\t\tlet primaryCode = stripIndent`\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * Primary content in *${humanReadablePath}*\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t`;\n\t\t\t\t\t\t\tprimaryCode = primaryFieldProperties.code\n\t\t\t\t\t\t\t\t? addLine(\n\t\t\t\t\t\t\t\t\t\tsource`\n\t\t\t\t\t\t\t\t\t\t\texport interface ${primaryInterfaceName} {\n\t\t\t\t\t\t\t\t\t\t\t\t${primaryFieldProperties.code}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t`,\n\t\t\t\t\t\t\t\t\t\tprimaryCode,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t: addLine(`export interface ${primaryInterfaceName} {}`, primaryCode);\n\n\t\t\t\t\t\t\tauxiliaryTypes.push({\n\t\t\t\t\t\t\t\tname: primaryInterfaceName,\n\t\t\t\t\t\t\t\tcode: primaryCode,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tcontentTypeNames.push(primaryInterfaceName);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet itemInterfaceName: string | undefined;\n\t\t\t\t\t\tif (choice.repeat && Object.keys(choice.repeat).length > 0) {\n\t\t\t\t\t\t\titemInterfaceName = buildTypeName(sliceName, \"Item\");\n\n\t\t\t\t\t\t\tconst path: FieldPath = [\n\t\t\t\t\t\t\t\t...args.path,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: args.name,\n\t\t\t\t\t\t\t\t\tmodel: args.field,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: choiceID,\n\t\t\t\t\t\t\t\t\tmodel: choice,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: \"items\",\n\t\t\t\t\t\t\t\t\tlabel: \"Items\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\tconst humanReadablePath = getHumanReadablePath({ path });\n\n\t\t\t\t\t\t\tconst itemFieldProperties = buildFieldProperties({\n\t\t\t\t\t\t\t\tfields: choice.repeat,\n\t\t\t\t\t\t\t\tfieldConfigs: args.fieldConfigs,\n\t\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tauxiliaryTypes.push(...itemFieldProperties.auxiliaryTypes);\n\t\t\t\t\t\t\tcontentTypeNames.push(...itemFieldProperties.contentTypeNames);\n\n\t\t\t\t\t\t\tlet itemCode = stripIndent`\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * Item content in *${humanReadablePath}*\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t`;\n\t\t\t\t\t\t\titemCode = itemFieldProperties.code\n\t\t\t\t\t\t\t\t? addLine(\n\t\t\t\t\t\t\t\t\t\tsource`\n\t\t\t\t\t\t\t\t\t\t\texport interface ${itemInterfaceName} {\n\t\t\t\t\t\t\t\t\t\t\t\t${itemFieldProperties.code}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t`,\n\t\t\t\t\t\t\t\t\t\titemCode,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t: addLine(`export interface ${itemInterfaceName} {}`, itemCode);\n\n\t\t\t\t\t\t\tauxiliaryTypes.push({\n\t\t\t\t\t\t\t\tname: itemInterfaceName,\n\t\t\t\t\t\t\t\tcode: itemCode,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tcontentTypeNames.push(itemInterfaceName);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tauxiliaryTypes.push({\n\t\t\t\t\t\t\tname: sliceName,\n\t\t\t\t\t\t\tcode: stripIndent`\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * Slice for *${getHumanReadablePath({\n\t\t\t\t\t\t\t\t\t\tpath: [\n\t\t\t\t\t\t\t\t\t\t\t...args.path,\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tname: args.name,\n\t\t\t\t\t\t\t\t\t\t\t\tmodel: args.field,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t})}*\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\texport type ${sliceName} = prismic.Slice<\"${choiceID}\", ${\n\t\t\t\t\t\t\t\t\tprimaryInterfaceName\n\t\t\t\t\t\t\t\t\t\t? `Simplify<${primaryInterfaceName}>`\n\t\t\t\t\t\t\t\t\t\t: `Record<string, never>`\n\t\t\t\t\t\t\t\t}, ${itemInterfaceName ? `Simplify<${itemInterfaceName}>` : `never`}>\n\t\t\t\t\t\t\t`,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tchoiceNames.push(sliceName);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst choiceUnionName = buildTypeName(\n\t\t\t\targs.path[0].name,\n\t\t\t\t\"Document\",\n\t\t\t\t\"Data\",\n\t\t\t\targs.name,\n\t\t\t\t\"Slice\",\n\t\t\t);\n\t\t\tconst choiceUnion = buildUnion(choiceNames);\n\t\t\tauxiliaryTypes.push({\n\t\t\t\tname: choiceUnionName,\n\t\t\t\tcode: `type ${choiceUnionName} = ${choiceUnion}`,\n\t\t\t});\n\t\t\tcontentTypeNames.push(choiceUnionName);\n\n\t\t\tcode = addLine(`${name}: prismic.SliceZone<${choiceUnionName}>;`, code);\n\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault: {\n\t\t\tcode = addLine(`${name}: unknown;`, code);\n\t\t}\n\t}\n\n\treturn {\n\t\tcode,\n\t\tauxiliaryTypes,\n\t\tcontentTypeNames,\n\t};\n}\n\ntype BuildFieldPropertiesArgs = {\n\tfields: Record<string, CustomTypeModelField>;\n\tpath: FieldPath;\n\tfieldConfigs: FieldConfigs;\n\ttabName?: string;\n};\n\ntype BuildFieldPropertiesReturnType = {\n\tcode: string;\n\tauxiliaryTypes: AuxiliaryType[];\n\tcontentTypeNames: string[];\n};\n\nexport function buildFieldProperties(\n\targs: BuildFieldPropertiesArgs,\n): BuildFieldPropertiesReturnType {\n\tlet code = \"\";\n\n\tconst auxiliaryTypes: AuxiliaryType[] = [];\n\tconst contentTypeNames: string[] = [];\n\n\tfor (const name in args.fields) {\n\t\tconst field = args.fields[name];\n\n\t\tconst fieldProperty = buildFieldProperty({\n\t\t\tname,\n\t\t\tfield,\n\t\t\tpath: args.path,\n\t\t\tfieldConfigs: args.fieldConfigs,\n\t\t\ttabName: args.tabName,\n\t\t});\n\n\t\tcode = addSection(fieldProperty.code, code);\n\n\t\tauxiliaryTypes.push(...fieldProperty.auxiliaryTypes);\n\t\tcontentTypeNames.push(...fieldProperty.contentTypeNames);\n\t}\n\n\treturn {\n\t\tcode,\n\t\tauxiliaryTypes,\n\t\tcontentTypeNames,\n\t};\n}\n"],"mappings":";;;;;;;;;;AAyBA,SAAS,mBAAmB,MAA4D;CACvF,IAAI,OAAOA,uBAAAA,eAAe;EACzB,MAAM,KAAK;EACX,OAAO,KAAK;EACZ,MAAM,KAAK;EACX,SAAS,KAAK;EACd,CAAC;CAEF,MAAM,iBAAkC,EAAE;CAC1C,MAAM,mBAA6B,EAAE;CAErC,MAAM,OACL,KAAK,KAAK,SAAS,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,IAAI,SAAS,KAAK,KAAK,KAAK,GAC3E,IAAI,KAAK,KAAK,KACd,KAAK;AAET,SAAQ,KAAK,MAAM,MAAnB;EACC,KAAK,MAEJ;EAGD,KAAK;AACJ,UAAOC,gBAAAA,QAAQ,GAAG,KAAK,0BAA0B,KAAK;AAEtD;EAGD,KAAK;AACJ,UAAOA,gBAAAA,QAAQ,GAAG,KAAK,wBAAwB,KAAK;AAEpD;EAGD,KAAK;AACJ,UAAOA,gBAAAA,QAAQ,GAAG,KAAK,uBAAuB,KAAK;AAEnD;EAGD,KAAK,SAAS;GACb,MAAM,gBAA0B,EAAE;AAElC,OAAI,KAAK,aAAa,OAAO,cAC5B,MAAK,MAAM,gBAAgB,KAAK,aAAa,OAAO,eAAe;IAClE,MAAM,yBAAyB,KAAK,aAAa,OAAO,cAAc;AAEtE,kBAAc,KAAK,sBAAsB,aAAa,QAAQ,uBAAuB,GAAG;;GAI1F,MAAM,qBAAqBC,mBAAAA,WAAW,cAAc;AAEpD,UACC,cAAc,SAAS,IACpBD,gBAAAA,QACA,GAAG,KAAK,kEAAkE,mBAAmB,KAC7F,KACA,GACAA,gBAAAA,QAAQ,GAAG,KAAK,uBAA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OA,gBAAAA,QAAQ,GAAG,KAAK,aAAa,KAAK;;AAI3C,QAAO;EACN;EACA;EACA;EACA;;AAgBF,SAAgB,qBACf,MACiC;CACjC,IAAI,OAAO;CAEX,MAAM,iBAAkC,EAAE;CAC1C,MAAM,mBAA6B,EAAE;AAErC,MAAK,MAAM,QAAQ,KAAK,QAAQ;EAC/B,MAAM,QAAQ,KAAK,OAAO;EAE1B,MAAM,gBAAgB,mBAAmB;GACxC;GACA;GACA,MAAM,KAAK;GACX,cAAc,KAAK;GACnB,SAAS,KAAK;GACd,CAAC;AAEF,SAAOK,mBAAAA,WAAW,cAAc,MAAM,KAAK;AAE3C,iBAAe,KAAK,GAAG,cAAc,eAAe;AACpD,mBAAiB,KAAK,GAAG,cAAc,iBAAiB;;AAGzD,QAAO;EACN;EACA;EACA;EACA"}
@@ -1,9 +1,9 @@
1
- import { addLine } from "./addLine.mjs";
2
- import { addSection } from "./addSection.mjs";
3
- import { buildTypeName } from "./buildTypeName.mjs";
4
- import { getHumanReadablePath } from "./getHumanReadablePath.mjs";
5
- import { buildFieldDocs } from "./buildFieldDocs.mjs";
6
- import { buildUnion } from "./buildUnion.mjs";
1
+ import { addLine } from "./addLine.js";
2
+ import { addSection } from "./addSection.js";
3
+ import { buildTypeName } from "./buildTypeName.js";
4
+ import { getHumanReadablePath } from "./getHumanReadablePath.js";
5
+ import { buildFieldDocs } from "./buildFieldDocs.js";
6
+ import { buildUnion } from "./buildUnion.js";
7
7
  import { source, stripIndent } from "common-tags";
8
8
  import { CustomTypeModelFieldType } from "@prismicio/client";
9
9
  //#region src/lib/buildFieldProperties.ts
@@ -281,4 +281,4 @@ function buildFieldProperties(args) {
281
281
  //#endregion
282
282
  export { buildFieldProperties };
283
283
 
284
- //# sourceMappingURL=buildFieldProperties.mjs.map
284
+ //# sourceMappingURL=buildFieldProperties.js.map