prismic-ts-codegen 0.1.29 → 0.1.30

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/cli/{configSchema.d.cts → configSchema.d.mts} +1 -1
  3. package/dist/cli/{configSchema.d.cts.map → configSchema.d.mts.map} +1 -1
  4. package/dist/cli/{configSchema.js → configSchema.mjs} +1 -1
  5. package/dist/cli/configSchema.mjs.map +1 -0
  6. package/dist/cli/{constants.d.cts → constants.d.mts} +1 -1
  7. package/dist/cli/constants.d.mts.map +1 -0
  8. package/dist/cli/{constants.js → constants.mjs} +1 -1
  9. package/dist/cli/{constants.cjs.map → constants.mjs.map} +1 -1
  10. package/dist/cli/{loadConfig.js → loadConfig.mjs} +1 -1
  11. package/dist/cli/loadConfig.mjs.map +1 -0
  12. package/dist/cli/{loadLocaleIDs.js → loadLocaleIDs.mjs} +1 -1
  13. package/dist/cli/loadLocaleIDs.mjs.map +1 -0
  14. package/dist/cli/{loadModels.js → loadModels.mjs} +1 -1
  15. package/dist/cli/loadModels.mjs.map +1 -0
  16. package/dist/{cli.js → cli.mjs} +10 -9
  17. package/dist/cli.mjs.map +1 -0
  18. package/dist/{constants.js → constants.mjs} +1 -1
  19. package/dist/{constants.cjs.map → constants.mjs.map} +1 -1
  20. package/dist/{detectTypesProvider.d.cts → detectTypesProvider.d.mts} +2 -2
  21. package/dist/{detectTypesProvider.d.cts.map → detectTypesProvider.d.mts.map} +1 -1
  22. package/dist/{detectTypesProvider.js → detectTypesProvider.mjs} +1 -1
  23. package/dist/{detectTypesProvider.cjs.map → detectTypesProvider.mjs.map} +1 -1
  24. package/dist/{generateTypes.d.ts → generateTypes.d.mts} +2 -2
  25. package/dist/{generateTypes.d.cts.map → generateTypes.d.mts.map} +1 -1
  26. package/dist/{generateTypes.js → generateTypes.mjs} +6 -6
  27. package/dist/generateTypes.mjs.map +1 -0
  28. package/dist/{index.d.cts → index.d.mts} +4 -4
  29. package/dist/index.mjs +4 -0
  30. package/dist/lib/{addBlankLine.js → addBlankLine.mjs} +2 -2
  31. package/dist/lib/addBlankLine.mjs.map +1 -0
  32. package/dist/lib/{addLine.js → addLine.mjs} +2 -2
  33. package/dist/lib/addLine.mjs.map +1 -0
  34. package/dist/lib/{addSection.js → addSection.mjs} +2 -2
  35. package/dist/lib/addSection.mjs.map +1 -0
  36. package/dist/lib/{addTrailingNewLine.js → addTrailingNewLine.mjs} +1 -1
  37. package/dist/lib/{addTrailingNewLine.cjs.map → addTrailingNewLine.mjs.map} +1 -1
  38. package/dist/lib/{buildCustomTypeDataType.js → buildCustomTypeDataType.mjs} +4 -4
  39. package/dist/lib/buildCustomTypeDataType.mjs.map +1 -0
  40. package/dist/lib/{buildCustomTypeType.js → buildCustomTypeType.mjs} +9 -9
  41. package/dist/lib/buildCustomTypeType.mjs.map +1 -0
  42. package/dist/lib/{buildFieldDocs.js → buildFieldDocs.mjs} +6 -6
  43. package/dist/lib/buildFieldDocs.mjs.map +1 -0
  44. package/dist/lib/{buildFieldProperties.js → buildFieldProperties.mjs} +7 -7
  45. package/dist/lib/buildFieldProperties.mjs.map +1 -0
  46. package/dist/lib/{buildSharedSliceType.js → buildSharedSliceType.mjs} +9 -9
  47. package/dist/lib/buildSharedSliceType.mjs.map +1 -0
  48. package/dist/lib/{buildTypeName.js → buildTypeName.mjs} +1 -1
  49. package/dist/lib/buildTypeName.mjs.map +1 -0
  50. package/dist/lib/{buildUnion.js → buildUnion.mjs} +1 -1
  51. package/dist/lib/{buildUnion.cjs.map → buildUnion.mjs.map} +1 -1
  52. package/dist/lib/{checkHasUIDFIeld.js → checkHasUIDFIeld.mjs} +1 -1
  53. package/dist/lib/{checkHasUIDFIeld.cjs.map → checkHasUIDFIeld.mjs.map} +1 -1
  54. package/dist/lib/{getAPIIDPath.js → getAPIIDPath.mjs} +1 -1
  55. package/dist/lib/{getAPIIDPath.cjs.map → getAPIIDPath.mjs.map} +1 -1
  56. package/dist/lib/{getCacheKey.js → getCacheKey.mjs} +1 -1
  57. package/dist/lib/getCacheKey.mjs.map +1 -0
  58. package/dist/lib/{getHumanReadableModelName.js → getHumanReadableModelName.mjs} +1 -1
  59. package/dist/lib/{getHumanReadableModelName.cjs.map → getHumanReadableModelName.mjs.map} +1 -1
  60. package/dist/lib/{getHumanReadablePath.js → getHumanReadablePath.mjs} +2 -2
  61. package/dist/lib/getHumanReadablePath.mjs.map +1 -0
  62. package/dist/{types.d.cts → types.d.mts} +1 -1
  63. package/dist/types.d.mts.map +1 -0
  64. package/package.json +2 -8
  65. package/dist/_virtual/_rolldown/runtime.cjs +0 -23
  66. package/dist/cli/configSchema.cjs +0 -31
  67. package/dist/cli/configSchema.cjs.map +0 -1
  68. package/dist/cli/configSchema.d.ts +0 -39
  69. package/dist/cli/configSchema.d.ts.map +0 -1
  70. package/dist/cli/configSchema.js.map +0 -1
  71. package/dist/cli/constants.cjs +0 -6
  72. package/dist/cli/constants.d.cts.map +0 -1
  73. package/dist/cli/constants.d.ts +0 -5
  74. package/dist/cli/constants.d.ts.map +0 -1
  75. package/dist/cli/constants.js.map +0 -1
  76. package/dist/cli/loadConfig.cjs +0 -22
  77. package/dist/cli/loadConfig.cjs.map +0 -1
  78. package/dist/cli/loadConfig.js.map +0 -1
  79. package/dist/cli/loadLocaleIDs.cjs +0 -21
  80. package/dist/cli/loadLocaleIDs.cjs.map +0 -1
  81. package/dist/cli/loadLocaleIDs.js.map +0 -1
  82. package/dist/cli/loadModels.cjs +0 -54
  83. package/dist/cli/loadModels.cjs.map +0 -1
  84. package/dist/cli/loadModels.js.map +0 -1
  85. package/dist/cli.cjs +0 -110
  86. package/dist/cli.cjs.map +0 -1
  87. package/dist/cli.d.ts +0 -1
  88. package/dist/cli.js.map +0 -1
  89. package/dist/constants.cjs +0 -33
  90. package/dist/constants.js.map +0 -1
  91. package/dist/detectTypesProvider.cjs +0 -25
  92. package/dist/detectTypesProvider.d.ts +0 -17
  93. package/dist/detectTypesProvider.d.ts.map +0 -1
  94. package/dist/detectTypesProvider.js.map +0 -1
  95. package/dist/generateTypes.cjs +0 -144
  96. package/dist/generateTypes.cjs.map +0 -1
  97. package/dist/generateTypes.d.cts +0 -21
  98. package/dist/generateTypes.d.ts.map +0 -1
  99. package/dist/generateTypes.js.map +0 -1
  100. package/dist/index.cjs +0 -7
  101. package/dist/index.d.ts +0 -5
  102. package/dist/index.js +0 -4
  103. package/dist/lib/addBlankLine.cjs +0 -10
  104. package/dist/lib/addBlankLine.cjs.map +0 -1
  105. package/dist/lib/addBlankLine.js.map +0 -1
  106. package/dist/lib/addLine.cjs +0 -9
  107. package/dist/lib/addLine.cjs.map +0 -1
  108. package/dist/lib/addLine.js.map +0 -1
  109. package/dist/lib/addSection.cjs +0 -9
  110. package/dist/lib/addSection.cjs.map +0 -1
  111. package/dist/lib/addSection.js.map +0 -1
  112. package/dist/lib/addTrailingNewLine.cjs +0 -9
  113. package/dist/lib/addTrailingNewLine.js.map +0 -1
  114. package/dist/lib/buildCustomTypeDataType.cjs +0 -51
  115. package/dist/lib/buildCustomTypeDataType.cjs.map +0 -1
  116. package/dist/lib/buildCustomTypeDataType.js.map +0 -1
  117. package/dist/lib/buildCustomTypeType.cjs +0 -63
  118. package/dist/lib/buildCustomTypeType.cjs.map +0 -1
  119. package/dist/lib/buildCustomTypeType.js.map +0 -1
  120. package/dist/lib/buildFieldDocs.cjs +0 -66
  121. package/dist/lib/buildFieldDocs.cjs.map +0 -1
  122. package/dist/lib/buildFieldDocs.js.map +0 -1
  123. package/dist/lib/buildFieldProperties.cjs +0 -285
  124. package/dist/lib/buildFieldProperties.cjs.map +0 -1
  125. package/dist/lib/buildFieldProperties.js.map +0 -1
  126. package/dist/lib/buildSharedSliceType.cjs +0 -152
  127. package/dist/lib/buildSharedSliceType.cjs.map +0 -1
  128. package/dist/lib/buildSharedSliceType.js.map +0 -1
  129. package/dist/lib/buildTypeName.cjs +0 -12
  130. package/dist/lib/buildTypeName.cjs.map +0 -1
  131. package/dist/lib/buildTypeName.js.map +0 -1
  132. package/dist/lib/buildUnion.cjs +0 -8
  133. package/dist/lib/buildUnion.js.map +0 -1
  134. package/dist/lib/checkHasUIDFIeld.cjs +0 -8
  135. package/dist/lib/checkHasUIDFIeld.js.map +0 -1
  136. package/dist/lib/getAPIIDPath.cjs +0 -24
  137. package/dist/lib/getAPIIDPath.js.map +0 -1
  138. package/dist/lib/getCacheKey.cjs +0 -17
  139. package/dist/lib/getCacheKey.cjs.map +0 -1
  140. package/dist/lib/getCacheKey.js.map +0 -1
  141. package/dist/lib/getHumanReadableModelName.cjs +0 -15
  142. package/dist/lib/getHumanReadableModelName.js.map +0 -1
  143. package/dist/lib/getHumanReadablePath.cjs +0 -16
  144. package/dist/lib/getHumanReadablePath.cjs.map +0 -1
  145. package/dist/lib/getHumanReadablePath.js.map +0 -1
  146. package/dist/types.d.cts.map +0 -1
  147. package/dist/types.d.ts +0 -14
  148. package/dist/types.d.ts.map +0 -1
  149. /package/dist/{cli.d.cts → cli.d.mts} +0 -0
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import("../dist/cli.cjs");
3
+ import("../dist/cli.mjs");
@@ -36,4 +36,4 @@ declare const configSchema: z.ZodObject<{
36
36
  type Config = z.infer<typeof configSchema>;
37
37
  //#endregion
38
38
  export { Config };
39
- //# sourceMappingURL=configSchema.d.cts.map
39
+ //# sourceMappingURL=configSchema.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"configSchema.d.cts","names":[],"sources":["../../src/cli/configSchema.ts"],"mappings":";;;;cAGa,YAAA,EAAY,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqLb,MAAA,GAAS,CAAA,CAAE,KAAA,QAAa,YAAA"}
1
+ {"version":3,"file":"configSchema.d.mts","names":[],"sources":["../../src/cli/configSchema.ts"],"mappings":";;;;cAGa,YAAA,EAAY,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqLb,MAAA,GAAS,CAAA,CAAE,KAAA,QAAa,YAAA"}
@@ -27,4 +27,4 @@ const configSchema = z.object({
27
27
  //#endregion
28
28
  export { configSchema };
29
29
 
30
- //# sourceMappingURL=configSchema.js.map
30
+ //# sourceMappingURL=configSchema.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configSchema.mjs","names":[],"sources":["../../src/cli/configSchema.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/** Configuration to control the generated types. */\nexport const configSchema = z.object({\n\t/** The name of the Prismic repository. */\n\trepositoryName: z.string().optional(),\n\n\t/**\n\t * The access token for the Prismic repository. If the repository is private and\n\t * `locales.fetchFromRepository` is `true`, providing a token is required.\n\t */\n\taccessToken: z.string().optional(),\n\n\t/**\n\t * The Custom Types API token for the Prismic repository. If `models.fetchFromRepository` is\n\t * `true`, providing a token is required.\n\t */\n\tcustomTypesAPIToken: z.string().optional(),\n\n\t/**\n\t * The file path where the generated types will be saved. This path is relative to where the\n\t * command is called.\n\t */\n\toutput: z.string().optional(),\n\n\t/**\n\t * The package that provides TypeScript types for Prismic data. Most projects will not need to\n\t * configure this option.\n\t *\n\t * @defaultValue Automatically detected using the project's `package.json`.\n\t */\n\ttypesProvider: z.enum([\"@prismicio/client\", \"@prismicio/types\"]).optional(),\n\n\t/** Configuration for automatic `@prismicio/client` integration. */\n\tclientIntegration: z\n\t\t.object({\n\t\t\t/**\n\t\t\t * Determines if a `@prismicio/client` integration with automatic typing should be included in\n\t\t\t * the output.\n\t\t\t *\n\t\t\t * If set to `true`, Prismic clients will automatically be typed with the generated Custom\n\t\t\t * Types and Slices.\n\t\t\t *\n\t\t\t * **Note**: If your project queries content from multiple Prismic repositories, set\n\t\t\t * `includeCreateClientInterface` to `true` for the primary repository and `false` or any\n\t\t\t * other repository. The generated `AllDocumentTypes` type for non-primary repositories can be\n\t\t\t * provided to `@prismicio/client`'s `createClient()` function as its only type parameter to\n\t\t\t * type the client.\n\t\t\t *\n\t\t\t * @defaultValue `true`\n\t\t\t */\n\t\t\tincludeCreateClientInterface: z.boolean().optional(),\n\n\t\t\t/**\n\t\t\t * Determines if a `@prismicio/client` namespace named `Content` containing all Document and\n\t\t\t * Slice types should be included in the output.\n\t\t\t *\n\t\t\t * If set to `true`, a `Content` namespace from `@prismicio/client` will be available to\n\t\t\t * import to easily access types for your Prismic repository content.\n\t\t\t *\n\t\t\t * **Note**: If your project queries content from multiple Prismic repositories, set\n\t\t\t * `includeContentNamespace` to `true` for the primary repository and `false` or any other\n\t\t\t * repository. Types for non-primary repositories should be imported directly from the\n\t\t\t * generated file rather than via the `Content` namespace.\n\t\t\t *\n\t\t\t * @defaultValue `true`\n\t\t\t */\n\t\t\tincludeContentNamespace: z.boolean().optional(),\n\t\t})\n\t\t.optional(),\n\n\t/**\n\t * Configuration for languages for the Prismic repository.\n\t *\n\t * It can be configured by providing an array of locale IDs configured for the repository or an\n\t * object with finer control.\n\t *\n\t * @example\n\t * \t```ts\n\t * \t[\"en-us\", \"fr-fr\"];\n\t * \t```;\n\t *\n\t * @example\n\t * \t```ts\n\t * \t{\n\t * \t\"ids\": [\"en-us\", \"fr-fr\"],\n\t * \t\"fetchFromRepository\": true\n\t * \t}\n\t * \t```;\n\t */\n\tlocales: z\n\t\t.union([\n\t\t\tz.array(z.string()),\n\t\t\tz.object({\n\t\t\t\t/**\n\t\t\t\t * A list of locales configured for the Prismic repository. This is used to type a\n\t\t\t\t * document's `lang` property.\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t * \t```ts\n\t\t\t\t * \t[\"en-us\", \"fr-fr\"];\n\t\t\t\t * \t```;\n\t\t\t\t */\n\t\t\t\tids: z.array(z.string()).optional(),\n\n\t\t\t\t/**\n\t\t\t\t * Determines if the Prismic repository's locales should be fetched from the repository's\n\t\t\t\t * API.\n\t\t\t\t */\n\t\t\t\tfetchFromRepository: z.boolean().optional(),\n\t\t\t}),\n\t\t])\n\t\t.optional(),\n\n\t/**\n\t * Configuration for Custom Type and Slice models for the Prismic repository.\n\t *\n\t * It can be configured by providing an array of file paths to Custom Type and Slice JSON models\n\t * or an object with finer control.\n\t */\n\tmodels: z\n\t\t.union([\n\t\t\tz.array(z.string()),\n\t\t\tz.object({\n\t\t\t\t/** A list of file paths to Custom Type and Slice models. Globs are supported. */\n\t\t\t\tfiles: z.array(z.string()).optional(),\n\n\t\t\t\t/**\n\t\t\t\t * Determines if the Prismic repository's Custom Type and Slice models should be fetched\n\t\t\t\t * from the repository's API.\n\t\t\t\t *\n\t\t\t\t * `customTypesAPIToken` must be provided if set to `true`.\n\t\t\t\t */\n\t\t\t\tfetchFromRepository: z.boolean().optional(),\n\t\t\t}),\n\t\t])\n\t\t.optional(),\n\n\t/** Configuration for types generated for fields. */\n\tfields: z\n\t\t.object({\n\t\t\t/** Configuration for Embed fields. */\n\t\t\tembed: z\n\t\t\t\t.object({\n\t\t\t\t\t/**\n\t\t\t\t\t * An object mapping oEmbed providers to their type. The type should be provided as a\n\t\t\t\t\t * string and is added directly into the generated types.\n\t\t\t\t\t *\n\t\t\t\t\t * @example\n\t\t\t\t\t * \t```ts\n\t\t\t\t\t * \t{\n\t\t\t\t\t * \t\"YouTube\": \"import('./types').OEmbedYouTube\"\n\t\t\t\t\t * \t\"Twitter\": \"import('./types').OEmbedTwitter\"\n\t\t\t\t\t * \t\"Vimeo\": \"import('./types').OEmbedVimeo\"\n\t\t\t\t\t * \t}\n\t\t\t\t\t * \t```;\n\t\t\t\t\t */\n\t\t\t\t\tproviderTypes: z.record(z.string(), z.string()).optional(),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\n\t\t\t/** Configuration for Integration Fields. */\n\t\t\tintegrationFields: z\n\t\t\t\t.object({\n\t\t\t\t\t/**\n\t\t\t\t\t * An object mapping catalog IDs to their type. The type should be provided as a string\n\t\t\t\t\t * and is added directly into the generated types.\n\t\t\t\t\t *\n\t\t\t\t\t * @example\n\t\t\t\t\t * \t```ts\n\t\t\t\t\t * \t{\n\t\t\t\t\t * \t\"shopify_products\": \"import('./types').IntegrationFieldShopifyProduct\"\n\t\t\t\t\t * \t\"mux_videos\": \"import('./types').IntegrationFieldMuxVideo\"\n\t\t\t\t\t * \t}\n\t\t\t\t\t * \t```;\n\t\t\t\t\t */\n\t\t\t\t\tcatalogTypes: z.record(z.string(), z.string()).optional(),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional(),\n});\n\n/** Configuration to control the generated types. */\nexport type Config = z.infer<typeof configSchema>;\n"],"mappings":";;;AAGA,MAAa,eAAe,EAAE,OAAO;CAEpC,gBAAgB,EAAE,QAAQ,CAAC,UAAU;CAMrC,aAAa,EAAE,QAAQ,CAAC,UAAU;CAMlC,qBAAqB,EAAE,QAAQ,CAAC,UAAU;CAM1C,QAAQ,EAAE,QAAQ,CAAC,UAAU;CAQ7B,eAAe,EAAE,KAAK,CAAC,qBAAqB,mBAAmB,CAAC,CAAC,UAAU;CAG3E,mBAAmB,EACjB,OAAO;EAgBP,8BAA8B,EAAE,SAAS,CAAC,UAAU;EAgBpD,yBAAyB,EAAE,SAAS,CAAC,UAAU;EAC/C,CAAC,CACD,UAAU;CAqBZ,SAAS,EACP,MAAM,CACN,EAAE,MAAM,EAAE,QAAQ,CAAC,EACnB,EAAE,OAAO;EAUR,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;EAMnC,qBAAqB,EAAE,SAAS,CAAC,UAAU;EAC3C,CAAC,CACF,CAAC,CACD,UAAU;CAQZ,QAAQ,EACN,MAAM,CACN,EAAE,MAAM,EAAE,QAAQ,CAAC,EACnB,EAAE,OAAO;EAER,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;EAQrC,qBAAqB,EAAE,SAAS,CAAC,UAAU;EAC3C,CAAC,CACF,CAAC,CACD,UAAU;CAGZ,QAAQ,EACN,OAAO;EAEP,OAAO,EACL,OAAO,EAcP,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC,UAAU,EAC1D,CAAC,CACD,UAAU;EAGZ,mBAAmB,EACjB,OAAO,EAaP,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC,UAAU,EACzD,CAAC,CACD,UAAU;EACZ,CAAC,CACD,UAAU;CACZ,CAAC"}
@@ -2,4 +2,4 @@
2
2
  declare const NON_EDITABLE_FILE_HEADER = "// Code generated by prismic-ts-codegen. DO NOT EDIT.";
3
3
  //#endregion
4
4
  export { NON_EDITABLE_FILE_HEADER };
5
- //# sourceMappingURL=constants.d.cts.map
5
+ //# sourceMappingURL=constants.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.mts","names":[],"sources":["../../src/cli/constants.ts"],"mappings":";cAAa,wBAAA"}
@@ -3,4 +3,4 @@ const NON_EDITABLE_FILE_HEADER = "// Code generated by prismic-ts-codegen. DO NO
3
3
  //#endregion
4
4
  export { NON_EDITABLE_FILE_HEADER };
5
5
 
6
- //# sourceMappingURL=constants.js.map
6
+ //# sourceMappingURL=constants.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.cjs","names":[],"sources":["../../src/cli/constants.ts"],"sourcesContent":["export const NON_EDITABLE_FILE_HEADER = \"// Code generated by prismic-ts-codegen. DO NOT EDIT.\";\n"],"mappings":";AAAA,MAAa,2BAA2B"}
1
+ {"version":3,"file":"constants.mjs","names":[],"sources":["../../src/cli/constants.ts"],"sourcesContent":["export const NON_EDITABLE_FILE_HEADER = \"// Code generated by prismic-ts-codegen. DO NOT EDIT.\";\n"],"mappings":";AAAA,MAAa,2BAA2B"}
@@ -17,4 +17,4 @@ const loadConfig = (config) => {
17
17
  //#endregion
18
18
  export { loadConfig };
19
19
 
20
- //# sourceMappingURL=loadConfig.js.map
20
+ //# sourceMappingURL=loadConfig.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadConfig.mjs","names":["resolvePath"],"sources":["../../src/cli/loadConfig.ts"],"sourcesContent":["import { existsSync } from \"fs\";\nimport { resolve as resolvePath } from \"path\";\n\nimport _jiti from \"jiti\";\n\nimport type { Config } from \"./configSchema\";\n\nconst jiti = _jiti(process.cwd());\n\nconst loadModuleWithJiti = <TModule>(id: string): TModule => {\n\tconst mod = jiti(id) as TModule | { default: TModule };\n\n\treturn typeof mod === \"object\" && mod !== null && \"default\" in mod ? mod.default : mod;\n};\n\nconst DEFAULT_CONFIG_PATHS = [\"prismicCodegen.config.ts\", \"prismicCodegen.config.js\"];\n\ntype LoadConfigConfig = {\n\tpath?: string;\n};\n\nexport const loadConfig = (config: LoadConfigConfig): Config => {\n\tif (config.path) {\n\t\tif (existsSync(config.path)) {\n\t\t\treturn loadModuleWithJiti(resolvePath(config.path));\n\t\t} else {\n\t\t\tthrow new Error(`Config file does not exist: ${config.path}`);\n\t\t}\n\t} else {\n\t\tfor (const configPath of DEFAULT_CONFIG_PATHS) {\n\t\t\tif (existsSync(configPath)) {\n\t\t\t\treturn loadModuleWithJiti(resolvePath(configPath));\n\t\t\t}\n\t\t}\n\t}\n\n\t// If no config file exists, an empty config is returned.\n\treturn {};\n};\n"],"mappings":";;;;AAOA,MAAM,OAAO,MAAM,QAAQ,KAAK,CAAC;AAEjC,MAAM,sBAA+B,OAAwB;CAC5D,MAAM,MAAM,KAAK,GAAG;AAEpB,QAAO,OAAO,QAAQ,YAAY,QAAQ,QAAQ,aAAa,MAAM,IAAI,UAAU;;AAGpF,MAAM,uBAAuB,CAAC,4BAA4B,2BAA2B;AAMrF,MAAa,cAAc,WAAqC;AAC/D,KAAI,OAAO,KACV,KAAI,WAAW,OAAO,KAAK,CAC1B,QAAO,mBAAmBA,QAAY,OAAO,KAAK,CAAC;KAEnD,OAAM,IAAI,MAAM,+BAA+B,OAAO,OAAO;KAG9D,MAAK,MAAM,cAAc,qBACxB,KAAI,WAAW,WAAW,CACzB,QAAO,mBAAmBA,QAAY,WAAW,CAAC;AAMrD,QAAO,EAAE"}
@@ -15,4 +15,4 @@ const loadLocaleIDs = async (config) => {
15
15
  //#endregion
16
16
  export { loadLocaleIDs };
17
17
 
18
- //# sourceMappingURL=loadLocaleIDs.js.map
18
+ //# sourceMappingURL=loadLocaleIDs.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadLocaleIDs.mjs","names":[],"sources":["../../src/cli/loadLocaleIDs.ts"],"sourcesContent":["import * as prismic from \"@prismicio/client\";\nimport fetch from \"node-fetch\";\n\ntype LoadLocalesConfig =\n\t| {\n\t\t\tlocaleIDs?: string[];\n\t }\n\t| {\n\t\t\tlocaleIDs?: string[];\n\t\t\trepositoryName: string;\n\t\t\taccessToken: string;\n\t\t\tfetchFromRepository?: boolean;\n\t };\n\nexport const loadLocaleIDs = async (config: LoadLocalesConfig): Promise<string[]> => {\n\tconst localeIDs = new Set<string>(config.localeIDs || []);\n\n\tif (\"repositoryName\" in config && config.fetchFromRepository) {\n\t\tconst client = prismic.createClient(config.repositoryName, {\n\t\t\taccessToken: config.accessToken,\n\t\t\tfetch,\n\t\t});\n\n\t\tconst repository = await client.getRepository();\n\n\t\tfor (const language of repository.languages) {\n\t\t\tlocaleIDs.add(language.id);\n\t\t}\n\t}\n\n\treturn [...localeIDs];\n};\n"],"mappings":";;;AAcA,MAAa,gBAAgB,OAAO,WAAiD;CACpF,MAAM,YAAY,IAAI,IAAY,OAAO,aAAa,EAAE,CAAC;AAEzD,KAAI,oBAAoB,UAAU,OAAO,qBAAqB;EAM7D,MAAM,aAAa,MALJ,QAAQ,aAAa,OAAO,gBAAgB;GAC1D,aAAa,OAAO;GACpB;GACA,CAAC,CAE8B,eAAe;AAE/C,OAAK,MAAM,YAAY,WAAW,UACjC,WAAU,IAAI,SAAS,GAAG;;AAI5B,QAAO,CAAC,GAAG,UAAU"}
@@ -47,4 +47,4 @@ const loadModels = async (config) => {
47
47
  //#endregion
48
48
  export { loadModels };
49
49
 
50
- //# sourceMappingURL=loadModels.js.map
50
+ //# sourceMappingURL=loadModels.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadModels.mjs","names":[],"sources":["../../src/cli/loadModels.ts"],"sourcesContent":["import { readFileSync } from \"fs\";\n\nimport type { CustomTypeModel, SharedSliceModel } from \"@prismicio/client\";\nimport * as prismicCT from \"@prismicio/custom-types-client\";\nimport fg from \"fast-glob\";\nimport fetch from \"node-fetch\";\n\nconst isCustomTypeModel = (input: unknown): input is CustomTypeModel => {\n\treturn typeof input === \"object\" && input !== null && \"json\" in input;\n};\n\nconst isSharedSliceModel = (input: unknown): input is SharedSliceModel => {\n\treturn typeof input === \"object\" && input !== null && \"variations\" in input;\n};\n\nconst readJSONFromGlob = async <T>(globs: string): Promise<T[]> => {\n\tconst paths = await fg(globs.split(\",\").map((path) => path.trim()));\n\n\treturn paths.map((path) => {\n\t\tconst raw = readFileSync(path, \"utf8\");\n\n\t\treturn JSON.parse(raw);\n\t});\n};\n\ntype LoadModelsConfig =\n\t| {\n\t\t\tlocalPaths?: string[];\n\t }\n\t| {\n\t\t\tlocalPaths?: string[];\n\t\t\trepositoryName: string;\n\t\t\tcustomTypesAPIToken: string;\n\t\t\tfetchFromRepository?: boolean;\n\t };\n\ntype LoadModelsReturnType = {\n\tcustomTypeModels: CustomTypeModel[];\n\tsharedSliceModels: SharedSliceModel[];\n};\n\nexport const loadModels = async (config: LoadModelsConfig): Promise<LoadModelsReturnType> => {\n\tconst customTypeModels: Record<string, CustomTypeModel> = {};\n\tconst sharedSliceModels: Record<string, SharedSliceModel> = {};\n\n\tif (\"customTypesAPIToken\" in config) {\n\t\tconst customTypesClient = prismicCT.createClient({\n\t\t\trepositoryName: config.repositoryName,\n\t\t\ttoken: config.customTypesAPIToken,\n\t\t\tfetch,\n\t\t});\n\n\t\tif (config.fetchFromRepository) {\n\t\t\tconst [remoteCustomTypeModels, remoteSharedSliceModels] = await Promise.all([\n\t\t\t\tcustomTypesClient.getAllCustomTypes(),\n\t\t\t\tcustomTypesClient.getAllSharedSlices(),\n\t\t\t]);\n\n\t\t\tfor (const customTypeModel of remoteCustomTypeModels) {\n\t\t\t\tcustomTypeModels[customTypeModel.id] = customTypeModel;\n\t\t\t}\n\t\t\tfor (const sharedSliceModel of remoteSharedSliceModels) {\n\t\t\t\tsharedSliceModels[sharedSliceModel.id] = sharedSliceModel;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (config.localPaths) {\n\t\tconst models = (\n\t\t\tawait Promise.all(config.localPaths.map((glob) => readJSONFromGlob(glob)))\n\t\t).flat();\n\n\t\tfor (const model of models) {\n\t\t\tif (isCustomTypeModel(model)) {\n\t\t\t\tcustomTypeModels[model.id] = model;\n\t\t\t} else if (isSharedSliceModel(model)) {\n\t\t\t\tsharedSliceModels[model.id] = model;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tcustomTypeModels: Object.values(customTypeModels).sort((a, b) => {\n\t\t\treturn a.id.localeCompare(b.id);\n\t\t}),\n\t\tsharedSliceModels: Object.values(sharedSliceModels).sort((a, b) => {\n\t\t\treturn a.id.localeCompare(b.id);\n\t\t}),\n\t};\n};\n"],"mappings":";;;;;AAOA,MAAM,qBAAqB,UAA6C;AACvE,QAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;;AAGjE,MAAM,sBAAsB,UAA8C;AACzE,QAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,gBAAgB;;AAGvE,MAAM,mBAAmB,OAAU,UAAgC;AAGlE,SAFc,MAAM,GAAG,MAAM,MAAM,IAAI,CAAC,KAAK,SAAS,KAAK,MAAM,CAAC,CAAC,EAEtD,KAAK,SAAS;EAC1B,MAAM,MAAM,aAAa,MAAM,OAAO;AAEtC,SAAO,KAAK,MAAM,IAAI;GACrB;;AAmBH,MAAa,aAAa,OAAO,WAA4D;CAC5F,MAAM,mBAAoD,EAAE;CAC5D,MAAM,oBAAsD,EAAE;AAE9D,KAAI,yBAAyB,QAAQ;EACpC,MAAM,oBAAoB,UAAU,aAAa;GAChD,gBAAgB,OAAO;GACvB,OAAO,OAAO;GACd;GACA,CAAC;AAEF,MAAI,OAAO,qBAAqB;GAC/B,MAAM,CAAC,wBAAwB,2BAA2B,MAAM,QAAQ,IAAI,CAC3E,kBAAkB,mBAAmB,EACrC,kBAAkB,oBAAoB,CACtC,CAAC;AAEF,QAAK,MAAM,mBAAmB,uBAC7B,kBAAiB,gBAAgB,MAAM;AAExC,QAAK,MAAM,oBAAoB,wBAC9B,mBAAkB,iBAAiB,MAAM;;;AAK5C,KAAI,OAAO,YAAY;EACtB,MAAM,UACL,MAAM,QAAQ,IAAI,OAAO,WAAW,KAAK,SAAS,iBAAiB,KAAK,CAAC,CAAC,EACzE,MAAM;AAER,OAAK,MAAM,SAAS,OACnB,KAAI,kBAAkB,MAAM,CAC3B,kBAAiB,MAAM,MAAM;WACnB,mBAAmB,MAAM,CACnC,mBAAkB,MAAM,MAAM;;AAKjC,QAAO;EACN,kBAAkB,OAAO,OAAO,iBAAiB,CAAC,MAAM,GAAG,MAAM;AAChE,UAAO,EAAE,GAAG,cAAc,EAAE,GAAG;IAC9B;EACF,mBAAmB,OAAO,OAAO,kBAAkB,CAAC,MAAM,GAAG,MAAM;AAClE,UAAO,EAAE,GAAG,cAAc,EAAE,GAAG;IAC9B;EACF"}
@@ -1,11 +1,11 @@
1
- import { generateTypes } from "./generateTypes.js";
2
- import { detectTypesProvider } from "./detectTypesProvider.js";
3
- import { NON_EDITABLE_FILE_HEADER } from "./cli/constants.js";
4
- import "./index.js";
5
- import { configSchema } from "./cli/configSchema.js";
6
- import { loadConfig } from "./cli/loadConfig.js";
7
- import { loadLocaleIDs } from "./cli/loadLocaleIDs.js";
8
- import { loadModels } from "./cli/loadModels.js";
1
+ import { generateTypes } from "./generateTypes.mjs";
2
+ import { detectTypesProvider } from "./detectTypesProvider.mjs";
3
+ import { NON_EDITABLE_FILE_HEADER } from "./cli/constants.mjs";
4
+ import "./index.mjs";
5
+ import { configSchema } from "./cli/configSchema.mjs";
6
+ import { loadConfig } from "./cli/loadConfig.mjs";
7
+ import { loadLocaleIDs } from "./cli/loadLocaleIDs.mjs";
8
+ import { loadModels } from "./cli/loadModels.mjs";
9
9
  import { stripIndent } from "common-tags";
10
10
  import { existsSync, writeFileSync } from "fs";
11
11
  import { resolve } from "path";
@@ -104,5 +104,6 @@ main().catch((error) => {
104
104
  process.exit(1);
105
105
  });
106
106
  //#endregion
107
+ export {};
107
108
 
108
- //# sourceMappingURL=cli.js.map
109
+ //# sourceMappingURL=cli.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.mjs","names":["resolvePath"],"sources":["../src/cli/index.ts"],"sourcesContent":["import { existsSync, writeFileSync } from \"fs\";\nimport { resolve as resolvePath } from \"path\";\n\nimport { stripIndent } from \"common-tags\";\nimport meow from \"meow\";\n\nimport { detectTypesProvider, generateTypes } from \"../index\";\nimport { configSchema } from \"./configSchema\";\nimport { NON_EDITABLE_FILE_HEADER } from \"./constants\";\nimport { loadConfig } from \"./loadConfig\";\nimport { loadLocaleIDs } from \"./loadLocaleIDs\";\nimport { loadModels } from \"./loadModels\";\n\nconst cli = meow(\n\t`\n\tUsage:\n\t prismic-ts-codegen [options...]\n\t prismic-ts-codegen init [options...]\n\n\tCommands:\n\t init [options]\n\n\tOptions:\n\t -c, --config <path> Path to a prismic-ts-codegen configuration file.\n\t`,\n\t{\n\t\timportMeta: import.meta,\n\t\tflags: {\n\t\t\tconfig: {\n\t\t\t\ttype: \"string\",\n\t\t\t\tshortFlag: \"c\",\n\t\t\t\tisRequired: false,\n\t\t\t},\n\t\t},\n\t},\n);\n\nconst main = async () => {\n\tif (cli.input[0] === \"init\") {\n\t\tconst configPath = cli.flags.config || \"prismicCodegen.config.ts\";\n\n\t\tif (existsSync(configPath)) {\n\t\t\tconsole.info(`\\n${configPath} already exists.`);\n\t\t} else {\n\t\t\tlet contents = \"\";\n\n\t\t\tif (existsSync(\"slicemachine.config.json\") || existsSync(\"sm.json\")) {\n\t\t\t\tcontents = stripIndent`\n\t\t\t\t\timport type { Config } from \"prismic-ts-codegen\";\n\n\t\t\t\t\tconst config: Config = {\n\t\t\t\t\t output: \"./types.generated.ts\",\n\t\t\t\t\t models: [\"./customtypes/**/index.json\", \"./slices/**/model.json\"],\n\t\t\t\t\t};\n\n\t\t\t\t\texport default config;\n\t\t\t\t`;\n\t\t\t} else {\n\t\t\t\tcontents = stripIndent`\n\t\t\t\t\timport type { Config } from \"prismic-ts-codegen\";\n\n\t\t\t\t\tconst config: Config = {\n\t\t\t\t\t output: \"./types.generated.ts\",\n\t\t\t\t\t};\n\n\t\t\t\t\texport default config;\n\t\t\t\t`;\n\t\t\t}\n\n\t\t\twriteFileSync(configPath, contents);\n\n\t\t\tconsole.info(`\\nCreated prismic-ts-codegen config file: ${configPath}`);\n\t\t}\n\t} else {\n\t\tconst unvalidatedConfig = loadConfig({ path: cli.flags.config });\n\n\t\tconst result = configSchema.safeParse(unvalidatedConfig);\n\n\t\tif (result.success) {\n\t\t\tconst config = result.data;\n\t\t\tconst { customTypeModels, sharedSliceModels } = await loadModels({\n\t\t\t\tlocalPaths: Array.isArray(config.models) ? config.models : config.models?.files,\n\t\t\t\trepositoryName: config.repositoryName,\n\t\t\t\tcustomTypesAPIToken: config.customTypesAPIToken,\n\t\t\t\tfetchFromRepository:\n\t\t\t\t\tconfig.models &&\n\t\t\t\t\t\"fetchFromRepository\" in config.models &&\n\t\t\t\t\tconfig.models.fetchFromRepository,\n\t\t\t});\n\n\t\t\tconst localeIDs = await loadLocaleIDs({\n\t\t\t\tlocaleIDs: Array.isArray(config.locales) ? config.locales : config.locales?.ids,\n\t\t\t\trepositoryName: config.repositoryName,\n\t\t\t\taccessToken: config.accessToken,\n\t\t\t\tfetchFromRepository:\n\t\t\t\t\tconfig.locales &&\n\t\t\t\t\t\"fetchFromRepository\" in config.locales &&\n\t\t\t\t\tconfig.locales.fetchFromRepository,\n\t\t\t});\n\n\t\t\tconst typesProvider = config.typesProvider || (await detectTypesProvider());\n\n\t\t\tconst hasCustomTypeModels = customTypeModels.length > 0;\n\n\t\t\tif (config.clientIntegration?.includeCreateClientInterface && !hasCustomTypeModels) {\n\t\t\t\tconsole.info(\n\t\t\t\t\t\"[INFO]: prismic-ts-codegen was configured to automatically integrate with `@prismicio/client`, but the integration was not generated because no Custom Type models were found. Automatic integration requires at least one Custom Type model.\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst types = generateTypes({\n\t\t\t\tcustomTypeModels,\n\t\t\t\tsharedSliceModels,\n\t\t\t\tlocaleIDs,\n\t\t\t\tfieldConfigs: config.fields,\n\t\t\t\tclientIntegration: {\n\t\t\t\t\tincludeCreateClientInterface: hasCustomTypeModels\n\t\t\t\t\t\t? (config.clientIntegration?.includeCreateClientInterface ?? true)\n\t\t\t\t\t\t: false,\n\t\t\t\t\tincludeContentNamespace: config.clientIntegration?.includeContentNamespace ?? true,\n\t\t\t\t},\n\t\t\t\ttypesProvider,\n\t\t\t});\n\n\t\t\tconst fileContents = `${NON_EDITABLE_FILE_HEADER}\\n\\n${types}`;\n\n\t\t\tif (config.output) {\n\t\t\t\twriteFileSync(resolvePath(config.output), fileContents);\n\n\t\t\t\tconsole.info(`\\nGenerated types in: ${config.output}`);\n\t\t\t} else {\n\t\t\t\tprocess.stdout.write(types + \"\\n\");\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.error(result.error.message);\n\t\t\tprocess.exit(1);\n\t\t}\n\t}\n};\n\nmain().catch((error) => {\n\tconsole.error(error);\n\tprocess.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAM,MAAM,KACX;;;;;;;;;;IAWA;CACC,YAAY,OAAO;CACnB,OAAO,EACN,QAAQ;EACP,MAAM;EACN,WAAW;EACX,YAAY;EACZ,EACD;CACD,CACD;AAED,MAAM,OAAO,YAAY;AACxB,KAAI,IAAI,MAAM,OAAO,QAAQ;EAC5B,MAAM,aAAa,IAAI,MAAM,UAAU;AAEvC,MAAI,WAAW,WAAW,CACzB,SAAQ,KAAK,KAAK,WAAW,k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AAEvD,YAAQ,KAAK,yBAAyB,OAAO,SAAS;SAEtD,SAAQ,OAAO,MAAM,QAAQ,KAAK;SAE7B;AACN,WAAQ,MAAM,OAAO,MAAM,QAAQ;AACnC,WAAQ,KAAK,EAAE;;;;AAKlB,MAAM,CAAC,OAAO,UAAU;AACvB,SAAQ,MAAM,MAAM;AACpB,SAAQ,KAAK,EAAE;EACd"}
@@ -28,4 +28,4 @@ const FIELD_DOCUMENTATION_URLS = {
28
28
  //#endregion
29
29
  export { CUSTOM_TYPES_DOCUMENTATION_URL, FIELD_DOCUMENTATION_URLS, SHARED_SLICES_DOCUMENTATION_URL };
30
30
 
31
- //# sourceMappingURL=constants.js.map
31
+ //# sourceMappingURL=constants.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["import type { CustomTypeModelFieldType } from \"@prismicio/client\";\n\nexport const CUSTOM_TYPES_DOCUMENTATION_URL = \"https://prismic.io/docs/content-modeling\";\n\nexport const SHARED_SLICES_DOCUMENTATION_URL = \"https://prismic.io/docs/slices\";\n\nexport const FIELD_DOCUMENTATION_URLS = {\n\tUID: \"https://prismic.io/docs/fields/uid\",\n\tBoolean: \"https://prismic.io/docs/fields/boolean\",\n\tColor: \"https://prismic.io/docs/fields/color\",\n\tDate: \"https://prismic.io/docs/fields/date\",\n\tTimestamp: \"https://prismic.io/docs/fields/timestamp\",\n\tNumber: \"https://prismic.io/docs/fields/number\",\n\tText: \"https://prismic.io/docs/fields/text\",\n\tSelect: \"https://prismic.io/docs/fields/select\",\n\tStructuredText: \"https://prismic.io/docs/fields/rich-text\",\n\tImage: \"https://prismic.io/docs/fields/image\",\n\tLink: {\n\t\tcontentRelationship: \"https://prismic.io/docs/fields/content-relationship\",\n\t\tlink: \"https://prismic.io/docs/fields/link\",\n\t\tlinkToMedia: \"https://prismic.io/docs/fields/link-to-media\",\n\t},\n\tEmbed: \"https://prismic.io/docs/fields/embed\",\n\tGeoPoint: \"https://prismic.io/docs/fields/geopoint\",\n\tTable: \"https://prismic.io/docs/fields/table\",\n\tGroup: \"https://prismic.io/docs/fields/repeatable-group\",\n\tIntegrationFields: \"https://prismic.io/docs/fields/integration\",\n\tSlices: \"https://prismic.io/docs/slices\",\n\tChoice: \"https://prismic.io/docs/slices\",\n} satisfies Record<\n\tExclude<\n\t\t(typeof CustomTypeModelFieldType)[keyof typeof CustomTypeModelFieldType],\n\t\t\"Range\" | \"Separator\"\n\t>,\n\tstring | Record<string, string>\n>;\n"],"mappings":";AAEA,MAAa,iCAAiC;AAE9C,MAAa,kCAAkC;AAE/C,MAAa,2BAA2B;CACvC,KAAK;CACL,SAAS;CACT,OAAO;CACP,MAAM;CACN,WAAW;CACX,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,gBAAgB;CAChB,OAAO;CACP,MAAM;EACL,qBAAqB;EACrB,MAAM;EACN,aAAa;EACb;CACD,OAAO;CACP,UAAU;CACV,OAAO;CACP,OAAO;CACP,mBAAmB;CACnB,QAAQ;CACR,QAAQ;CACR"}
1
+ {"version":3,"file":"constants.mjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["import type { CustomTypeModelFieldType } from \"@prismicio/client\";\n\nexport const CUSTOM_TYPES_DOCUMENTATION_URL = \"https://prismic.io/docs/content-modeling\";\n\nexport const SHARED_SLICES_DOCUMENTATION_URL = \"https://prismic.io/docs/slices\";\n\nexport const FIELD_DOCUMENTATION_URLS = {\n\tUID: \"https://prismic.io/docs/fields/uid\",\n\tBoolean: \"https://prismic.io/docs/fields/boolean\",\n\tColor: \"https://prismic.io/docs/fields/color\",\n\tDate: \"https://prismic.io/docs/fields/date\",\n\tTimestamp: \"https://prismic.io/docs/fields/timestamp\",\n\tNumber: \"https://prismic.io/docs/fields/number\",\n\tText: \"https://prismic.io/docs/fields/text\",\n\tSelect: \"https://prismic.io/docs/fields/select\",\n\tStructuredText: \"https://prismic.io/docs/fields/rich-text\",\n\tImage: \"https://prismic.io/docs/fields/image\",\n\tLink: {\n\t\tcontentRelationship: \"https://prismic.io/docs/fields/content-relationship\",\n\t\tlink: \"https://prismic.io/docs/fields/link\",\n\t\tlinkToMedia: \"https://prismic.io/docs/fields/link-to-media\",\n\t},\n\tEmbed: \"https://prismic.io/docs/fields/embed\",\n\tGeoPoint: \"https://prismic.io/docs/fields/geopoint\",\n\tTable: \"https://prismic.io/docs/fields/table\",\n\tGroup: \"https://prismic.io/docs/fields/repeatable-group\",\n\tIntegrationFields: \"https://prismic.io/docs/fields/integration\",\n\tSlices: \"https://prismic.io/docs/slices\",\n\tChoice: \"https://prismic.io/docs/slices\",\n} satisfies Record<\n\tExclude<\n\t\t(typeof CustomTypeModelFieldType)[keyof typeof CustomTypeModelFieldType],\n\t\t\"Range\" | \"Separator\"\n\t>,\n\tstring | Record<string, string>\n>;\n"],"mappings":";AAEA,MAAa,iCAAiC;AAE9C,MAAa,kCAAkC;AAE/C,MAAa,2BAA2B;CACvC,KAAK;CACL,SAAS;CACT,OAAO;CACP,MAAM;CACN,WAAW;CACX,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,gBAAgB;CAChB,OAAO;CACP,MAAM;EACL,qBAAqB;EACrB,MAAM;EACN,aAAa;EACb;CACD,OAAO;CACP,UAAU;CACV,OAAO;CACP,OAAO;CACP,mBAAmB;CACnB,QAAQ;CACR,QAAQ;CACR"}
@@ -1,4 +1,4 @@
1
- import { TypesProvider } from "./generateTypes.cjs";
1
+ import { TypesProvider } from "./generateTypes.mjs";
2
2
 
3
3
  //#region src/detectTypesProvider.d.ts
4
4
  type DetectTypesProviderConfig = {
@@ -14,4 +14,4 @@ type DetectTypesProviderConfig = {
14
14
  declare const detectTypesProvider: (config?: DetectTypesProviderConfig) => Promise<TypesProvider | undefined>;
15
15
  //#endregion
16
16
  export { DetectTypesProviderConfig, detectTypesProvider };
17
- //# sourceMappingURL=detectTypesProvider.d.cts.map
17
+ //# sourceMappingURL=detectTypesProvider.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"detectTypesProvider.d.cts","names":[],"sources":["../src/detectTypesProvider.ts"],"mappings":";;;KAIY,yBAAA;EACX,GAAA;AAAA;;;;;AAUD;;;cAAa,mBAAA,GACZ,MAAA,GAAQ,yBAAA,KACN,OAAA,CAAQ,aAAA"}
1
+ {"version":3,"file":"detectTypesProvider.d.mts","names":[],"sources":["../src/detectTypesProvider.ts"],"mappings":";;;KAIY,yBAAA;EACX,GAAA;AAAA;;;;;AAUD;;;cAAa,mBAAA,GACZ,MAAA,GAAQ,yBAAA,KACN,OAAA,CAAQ,aAAA"}
@@ -21,4 +21,4 @@ const detectTypesProvider = async (config = {}) => {
21
21
  //#endregion
22
22
  export { detectTypesProvider };
23
23
 
24
- //# sourceMappingURL=detectTypesProvider.js.map
24
+ //# sourceMappingURL=detectTypesProvider.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"detectTypesProvider.cjs","names":[],"sources":["../src/detectTypesProvider.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\n\nimport type { TypesProvider } from \"./generateTypes\";\n\nexport type DetectTypesProviderConfig = {\n\tcwd?: string;\n};\n\n/**\n * Detects which types provider should be used for a project.\n *\n * @param config - Configures the detection.\n * @returns The types provider identifier to use, or `undefined` if on cannot be\n * determined.\n */\nexport const detectTypesProvider = async (\n\tconfig: DetectTypesProviderConfig = {},\n): Promise<TypesProvider | undefined> => {\n\tconst cwd = config.cwd || process.cwd();\n\n\tconst require = createRequire(cwd.endsWith(\"/\") ? cwd : cwd + \"/\");\n\n\ttry {\n\t\tif (Number.parseInt(require(\"@prismicio/client/package.json\").version.split(\".\")[0]) >= 7) {\n\t\t\treturn \"@prismicio/client\";\n\t\t}\n\t} catch {\n\t\t// noop\n\t}\n\n\ttry {\n\t\trequire.resolve(\"@prismicio/types\");\n\n\t\treturn \"@prismicio/types\";\n\t} catch {\n\t\t// noop\n\t}\n};\n"],"mappings":";;;;;;;;;;AAeA,MAAa,sBAAsB,OAClC,SAAoC,EAAE,KACE;CACxC,MAAM,MAAM,OAAO,OAAO,QAAQ,KAAK;CAEvC,MAAM,WAAA,GAAA,YAAA,eAAwB,IAAI,SAAS,IAAI,GAAG,MAAM,MAAM,IAAI;AAElE,KAAI;AACH,MAAI,OAAO,SAAS,QAAQ,iCAAiC,CAAC,QAAQ,MAAM,IAAI,CAAC,GAAG,IAAI,EACvF,QAAO;SAED;AAIR,KAAI;AACH,UAAQ,QAAQ,mBAAmB;AAEnC,SAAO;SACA"}
1
+ {"version":3,"file":"detectTypesProvider.mjs","names":[],"sources":["../src/detectTypesProvider.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\n\nimport type { TypesProvider } from \"./generateTypes\";\n\nexport type DetectTypesProviderConfig = {\n\tcwd?: string;\n};\n\n/**\n * Detects which types provider should be used for a project.\n *\n * @param config - Configures the detection.\n * @returns The types provider identifier to use, or `undefined` if on cannot be\n * determined.\n */\nexport const detectTypesProvider = async (\n\tconfig: DetectTypesProviderConfig = {},\n): Promise<TypesProvider | undefined> => {\n\tconst cwd = config.cwd || process.cwd();\n\n\tconst require = createRequire(cwd.endsWith(\"/\") ? cwd : cwd + \"/\");\n\n\ttry {\n\t\tif (Number.parseInt(require(\"@prismicio/client/package.json\").version.split(\".\")[0]) >= 7) {\n\t\t\treturn \"@prismicio/client\";\n\t\t}\n\t} catch {\n\t\t// noop\n\t}\n\n\ttry {\n\t\trequire.resolve(\"@prismicio/types\");\n\n\t\treturn \"@prismicio/types\";\n\t} catch {\n\t\t// noop\n\t}\n};\n"],"mappings":";;;;;;;;;AAeA,MAAa,sBAAsB,OAClC,SAAoC,EAAE,KACE;CACxC,MAAM,MAAM,OAAO,OAAO,QAAQ,KAAK;CAEvC,MAAM,UAAU,cAAc,IAAI,SAAS,IAAI,GAAG,MAAM,MAAM,IAAI;AAElE,KAAI;AACH,MAAI,OAAO,SAAS,QAAQ,iCAAiC,CAAC,QAAQ,MAAM,IAAI,CAAC,GAAG,IAAI,EACvF,QAAO;SAED;AAIR,KAAI;AACH,UAAQ,QAAQ,mBAAmB;AAEnC,SAAO;SACA"}
@@ -1,4 +1,4 @@
1
- import { FieldConfigs } from "./types.js";
1
+ import { FieldConfigs } from "./types.mjs";
2
2
  import { CustomTypeModel, SharedSliceModel } from "@prismicio/client";
3
3
 
4
4
  //#region src/generateTypes.d.ts
@@ -18,4 +18,4 @@ type GenerateTypesConfig = {
18
18
  declare function generateTypes(config?: GenerateTypesConfig): string;
19
19
  //#endregion
20
20
  export { GenerateTypesConfig, TypesProvider, generateTypes };
21
- //# sourceMappingURL=generateTypes.d.ts.map
21
+ //# sourceMappingURL=generateTypes.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateTypes.d.cts","names":[],"sources":["../src/generateTypes.ts"],"mappings":";;;;KAWY,aAAA;AAAA,KAIA,mBAAA;EACX,gBAAA,GAAmB,eAAA;EACnB,iBAAA,GAAoB,gBAAA;EACpB,SAAA;EACA,YAAA,GAAe,YAAA;EACf,aAAA,GAAgB,aAAA;EAChB,iBAAA;IACC,4BAAA;IACA,uBAAA;EAAA;EAED,KAAA;AAAA;AAAA,iBAGe,aAAA,CAAc,MAAA,GAAQ,mBAAA"}
1
+ {"version":3,"file":"generateTypes.d.mts","names":[],"sources":["../src/generateTypes.ts"],"mappings":";;;;KAWY,aAAA;AAAA,KAIA,mBAAA;EACX,gBAAA,GAAmB,eAAA;EACnB,iBAAA,GAAoB,gBAAA;EACpB,SAAA;EACA,YAAA,GAAe,YAAA;EACf,aAAA,GAAgB,aAAA;EAChB,iBAAA;IACC,4BAAA;IACA,uBAAA;EAAA;EAED,KAAA;AAAA;AAAA,iBAGe,aAAA,CAAc,MAAA,GAAQ,mBAAA"}
@@ -1,8 +1,8 @@
1
- import { addLine } from "./lib/addLine.js";
2
- import { addSection } from "./lib/addSection.js";
3
- import { buildUnion } from "./lib/buildUnion.js";
4
- import { buildCustomTypeType } from "./lib/buildCustomTypeType.js";
5
- import { buildSharedSliceType } from "./lib/buildSharedSliceType.js";
1
+ import { addLine } from "./lib/addLine.mjs";
2
+ import { addSection } from "./lib/addSection.mjs";
3
+ import { buildUnion } from "./lib/buildUnion.mjs";
4
+ import { buildCustomTypeType } from "./lib/buildCustomTypeType.mjs";
5
+ import { buildSharedSliceType } from "./lib/buildSharedSliceType.mjs";
6
6
  import { source } from "common-tags";
7
7
  import QuickLRU from "quick-lru";
8
8
  //#region src/generateTypes.ts
@@ -139,4 +139,4 @@ type ContentRelationshipFieldWithData<
139
139
  //#endregion
140
140
  export { generateTypes };
141
141
 
142
- //# sourceMappingURL=generateTypes.js.map
142
+ //# sourceMappingURL=generateTypes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateTypes.mjs","names":[],"sources":["../src/generateTypes.ts"],"sourcesContent":["import type { CustomTypeModel, SharedSliceModel } from \"@prismicio/client\";\nimport { source } from \"common-tags\";\nimport QuickLRU from \"quick-lru\";\n\nimport { addLine } from \"./lib/addLine\";\nimport { addSection } from \"./lib/addSection\";\nimport { buildCustomTypeType } from \"./lib/buildCustomTypeType\";\nimport { buildSharedSliceType } from \"./lib/buildSharedSliceType\";\nimport { buildUnion } from \"./lib/buildUnion\";\nimport type { FieldConfigs } from \"./types\";\n\nexport type TypesProvider = \"@prismicio/client\" | \"@prismicio/types\";\n\nconst cache = new QuickLRU<string, unknown>({ maxSize: 1000 });\n\nexport type GenerateTypesConfig = {\n\tcustomTypeModels?: CustomTypeModel[];\n\tsharedSliceModels?: SharedSliceModel[];\n\tlocaleIDs?: string[];\n\tfieldConfigs?: FieldConfigs;\n\ttypesProvider?: TypesProvider;\n\tclientIntegration?: {\n\t\tincludeCreateClientInterface?: boolean;\n\t\tincludeContentNamespace?: boolean;\n\t};\n\tcache?: boolean;\n};\n\nexport function generateTypes(config: GenerateTypesConfig = {}): string {\n\tconst fieldConfigs = config.fieldConfigs || {};\n\tconst shouldUseCache = config.cache ?? true;\n\n\tlet code = \"\";\n\n\tconst typesProvider = config.typesProvider || \"@prismicio/types\";\n\tlet clientImportName = \"prismic\";\n\n\tcode = addLine(`import type * as prismic from \"${typesProvider}\";`, code);\n\n\tif (\n\t\tconfig.clientIntegration?.includeCreateClientInterface ||\n\t\tconfig.clientIntegration?.includeContentNamespace\n\t) {\n\t\tif (typesProvider !== \"@prismicio/client\") {\n\t\t\tclientImportName = \"prismicClient\";\n\n\t\t\t// This import declaration would be a duplicate if the types\n\t\t\t// provider is @prismicio/client.\n\t\t\tcode = addLine(`import type * as ${clientImportName} from \"@prismicio/client\";`, code);\n\t\t}\n\t}\n\n\tcode = addSection(`type Simplify<T> = { [KeyType in keyof T]: T[KeyType] };`, code);\n\n\tcode = addSection(\n\t\t`\ntype PickContentRelationshipFieldData<\n\tTRelationship extends prismic.CustomTypeModelFetchCustomTypeLevel1 | prismic.CustomTypeModelFetchCustomTypeLevel2 | prismic.CustomTypeModelFetchGroupLevel1 | prismic.CustomTypeModelFetchGroupLevel2,\n\tTData extends Record<string, prismic.AnyRegularField | prismic.GroupField | prismic.NestedGroupField | prismic.SliceZone>,\n\tTLang extends string\n> = |\n\t// Content relationship fields\n\t{\n\t\t[TSubRelationship in Extract<\n\t\t\tTRelationship[\"fields\"][number], prismic.CustomTypeModelFetchContentRelationshipLevel1\n\t\t> as TSubRelationship[\"id\"]]:\n\t\t\tContentRelationshipFieldWithData<TSubRelationship[\"customtypes\"], TLang>;\n\t} &\n\t// Group\n\t{\n\t\t[TGroup in Extract<\n\t\t\tTRelationship[\"fields\"][number], prismic.CustomTypeModelFetchGroupLevel1 | prismic.CustomTypeModelFetchGroupLevel2\n\t\t> as TGroup[\"id\"]]:\n\t\t\tTData[TGroup[\"id\"]] extends prismic.GroupField<infer TGroupData>\n\t\t\t\t? prismic.GroupField<PickContentRelationshipFieldData<TGroup, TGroupData, TLang>>\n\t\t\t\t: never\n\t} &\n\t// Other fields\n\t{\n\t\t[TFieldKey in Extract<TRelationship[\"fields\"][number], string>]:\n\t\t\tTFieldKey extends keyof TData ? TData[TFieldKey] : never;\n\t};\n\ntype ContentRelationshipFieldWithData<\n\tTCustomType extends readonly (prismic.CustomTypeModelFetchCustomTypeLevel1 | string)[] | readonly (prismic.CustomTypeModelFetchCustomTypeLevel2 | string)[],\n\tTLang extends string = string\n> = {\n\t[ID in Exclude<TCustomType[number], string>[\"id\"]]:\n\t\tprismic.ContentRelationshipField<\n\t\t\tID,\n\t\t\tTLang,\n\t\t\tPickContentRelationshipFieldData<\n\t\t\t\tExtract<TCustomType[number], { id: ID }>,\n\t\t\t\tExtract<prismic.Content.AllDocumentTypes, { type: ID }>[\"data\"],\n\t\t\t\tTLang\n\t\t\t>\n\t\t>\n}[Exclude<TCustomType[number], string>[\"id\"]];\n`,\n\t\tcode,\n\t);\n\n\tconst contentTypeNames: string[] = [];\n\n\tif (config.customTypeModels) {\n\t\tconst allDocumentTypesTypeNames: string[] = [];\n\n\t\tfor (const model of config.customTypeModels) {\n\t\t\tconst customTypeType = buildCustomTypeType({\n\t\t\t\tmodel,\n\t\t\t\tlocaleIDs: config.localeIDs,\n\t\t\t\tfieldConfigs,\n\t\t\t\tcache: shouldUseCache ? cache : undefined,\n\t\t\t});\n\n\t\t\tfor (const auxiliaryType of customTypeType.auxiliaryTypes) {\n\t\t\t\tcode = addSection(auxiliaryType.code, code);\n\t\t\t}\n\n\t\t\tcode = addSection(customTypeType.code, code);\n\n\t\t\tallDocumentTypesTypeNames.push(customTypeType.name);\n\n\t\t\tcontentTypeNames.push(customTypeType.name);\n\t\t\tcontentTypeNames.push(...customTypeType.contentTypeNames);\n\t\t}\n\n\t\tif (config.customTypeModels.length > 0) {\n\t\t\tconst allDocumentTypesUnionName = \"AllDocumentTypes\";\n\t\t\tconst allDocumentTypesUnion = buildUnion(allDocumentTypesTypeNames);\n\n\t\t\tcode = addSection(\n\t\t\t\t`export type ${allDocumentTypesUnionName} = ${allDocumentTypesUnion};`,\n\t\t\t\tcode,\n\t\t\t);\n\n\t\t\tcontentTypeNames.push(allDocumentTypesUnionName);\n\t\t}\n\t}\n\n\tif (config.sharedSliceModels) {\n\t\tfor (const model of config.sharedSliceModels) {\n\t\t\tconst sharedSliceType = buildSharedSliceType({\n\t\t\t\tmodel,\n\t\t\t\tfieldConfigs,\n\t\t\t\tcache: shouldUseCache ? cache : undefined,\n\t\t\t});\n\n\t\t\tfor (const auxiliaryType of sharedSliceType.auxiliaryTypes) {\n\t\t\t\tcode = addSection(auxiliaryType.code, code);\n\t\t\t}\n\n\t\t\tcode = addSection(sharedSliceType.code, code);\n\n\t\t\tcontentTypeNames.push(sharedSliceType.name);\n\t\t\tcontentTypeNames.push(...sharedSliceType.contentTypeNames);\n\t\t}\n\t}\n\n\tif (\n\t\tconfig.clientIntegration?.includeCreateClientInterface ||\n\t\tconfig.clientIntegration?.includeContentNamespace\n\t) {\n\t\tlet clientModuleCode = \"\";\n\n\t\tif (config.clientIntegration.includeCreateClientInterface) {\n\t\t\tif ((config.customTypeModels?.length || 0) > 0) {\n\t\t\t\tclientModuleCode = addSection(\n\t\t\t\t\t`interface CreateClient {\n\t(repositoryNameOrEndpoint: string, options?: ${clientImportName}.ClientConfig): ${clientImportName}.Client<AllDocumentTypes>;\n}`,\n\t\t\t\t\tclientModuleCode,\n\t\t\t\t);\n\t\t\t\tclientModuleCode = addSection(\n\t\t\t\t\t`interface CreateWriteClient {\n\t(repositoryNameOrEndpoint: string, options: ${clientImportName}.WriteClientConfig): ${clientImportName}.WriteClient<AllDocumentTypes>;\n}`,\n\t\t\t\t\tclientModuleCode,\n\t\t\t\t);\n\t\t\t\tclientModuleCode = addSection(\n\t\t\t\t\t`interface CreateMigration {\n\t(): ${clientImportName}.Migration<AllDocumentTypes>;\n}`,\n\t\t\t\t\tclientModuleCode,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tclientModuleCode = addSection(\n\t\t\t\t\t`interface CreateClient {\n\t(repositoryNameOrEndpoint: string, options?: ${clientImportName}.ClientConfig): ${clientImportName}.Client;\n}`,\n\t\t\t\t\tclientModuleCode,\n\t\t\t\t);\n\t\t\t\tclientModuleCode = addSection(\n\t\t\t\t\t`interface CreateWriteClient {\n\t(repositoryNameOrEndpoint: string, options?: ${clientImportName}.WriteClientConfig): ${clientImportName}.WriteClient;\n}`,\n\t\t\t\t\tclientModuleCode,\n\t\t\t\t);\n\t\t\t\tclientModuleCode = addSection(\n\t\t\t\t\t`interface CreateMigration {\n\t(): ${clientImportName}.Migration;\n}`,\n\t\t\t\t\tclientModuleCode,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (config.clientIntegration.includeContentNamespace) {\n\t\t\tclientModuleCode = addSection(\n\t\t\t\tsource`\n\t\t\t\t\tnamespace Content {\n\t\t\t\t\t\texport type {\n\t\t\t\t\t\t\t${contentTypeNames.join(\",\\n\")}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t`,\n\t\t\t\tclientModuleCode,\n\t\t\t);\n\t\t}\n\n\t\tcode = addSection(\n\t\t\tsource`\n\t\t\t\tdeclare module \"@prismicio/client\" {\n\t\t\t\t\t${clientModuleCode}\n\t\t\t\t}\n\t\t\t`,\n\t\t\tcode,\n\t\t);\n\t}\n\n\treturn code;\n}\n"],"mappings":";;;;;;;;AAaA,MAAM,QAAQ,IAAI,SAA0B,EAAE,SAAS,KAAM,CAAC;AAe9D,SAAgB,cAAc,SAA8B,EAAE,EAAU;CACvE,MAAM,eAAe,OAAO,gBAAgB,EAAE;CAC9C,MAAM,iBAAiB,OAAO,SAAS;CAEvC,IAAI,OAAO;CAEX,MAAM,gBAAgB,OAAO,iBAAiB;CAC9C,IAAI,mBAAmB;AAEvB,QAAO,QAAQ,kCAAkC,cAAc,KAAK,KAAK;AAEzE,KACC,OAAO,mBAAmB,gCAC1B,OAAO,mBAAmB;MAEtB,kBAAkB,qBAAqB;AAC1C,sBAAmB;AAInB,UAAO,QAAQ,oBAAoB,iBAAiB,6BAA6B,KAAK;;;AAIxF,QAAO,WAAW,4DAA4D,KAAK;AAEnF,QAAO,WACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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B;IAEnG,iBACA;AACD,sBAAmB,WAClB;OACE,iBAAiB;IAEnB,iBACA;SACK;AACN,sBAAmB,WAClB;gDAC2C,iBAAiB,kBAAkB,iBAAiB;IAE/F,iBACA;AACD,sBAAmB,WAClB;gDAC2C,iBAAiB,uBAAuB,iBAAiB;IAEpG,iBACA;AACD,sBAAmB,WAClB;OACE,iBAAiB;IAEnB,iBACA;;AAIH,MAAI,OAAO,kBAAkB,wBAC5B,oBAAmB,WAClB,MAAM;;;SAGD,iBAAiB,KAAK,MAAM,CAAC;;;OAIlC,iBACA;AAGF,SAAO,WACN,MAAM;;OAEF,iBAAiB;;MAGrB,KACA;;AAGF,QAAO"}
@@ -1,5 +1,5 @@
1
- import { GenerateTypesConfig, TypesProvider, generateTypes } from "./generateTypes.cjs";
2
- import { DetectTypesProviderConfig, detectTypesProvider } from "./detectTypesProvider.cjs";
3
- import { Config } from "./cli/configSchema.cjs";
4
- import { NON_EDITABLE_FILE_HEADER } from "./cli/constants.cjs";
1
+ import { GenerateTypesConfig, TypesProvider, generateTypes } from "./generateTypes.mjs";
2
+ import { DetectTypesProviderConfig, detectTypesProvider } from "./detectTypesProvider.mjs";
3
+ import { Config } from "./cli/configSchema.mjs";
4
+ import { NON_EDITABLE_FILE_HEADER } from "./cli/constants.mjs";
5
5
  export { type Config, type DetectTypesProviderConfig, type GenerateTypesConfig, NON_EDITABLE_FILE_HEADER, type TypesProvider, detectTypesProvider, generateTypes };
package/dist/index.mjs ADDED
@@ -0,0 +1,4 @@
1
+ import { generateTypes } from "./generateTypes.mjs";
2
+ import { detectTypesProvider } from "./detectTypesProvider.mjs";
3
+ import { NON_EDITABLE_FILE_HEADER } from "./cli/constants.mjs";
4
+ export { NON_EDITABLE_FILE_HEADER, detectTypesProvider, generateTypes };
@@ -1,4 +1,4 @@
1
- import { addTrailingNewLine } from "./addTrailingNewLine.js";
1
+ import { addTrailingNewLine } from "./addTrailingNewLine.mjs";
2
2
  //#region src/lib/addBlankLine.ts
3
3
  function addBlankLine(state, config) {
4
4
  if ((!state || state.endsWith("\n\n")) && !config?.force) return state;
@@ -7,4 +7,4 @@ function addBlankLine(state, config) {
7
7
  //#endregion
8
8
  export { addBlankLine };
9
9
 
10
- //# sourceMappingURL=addBlankLine.js.map
10
+ //# sourceMappingURL=addBlankLine.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addBlankLine.mjs","names":[],"sources":["../../src/lib/addBlankLine.ts"],"sourcesContent":["import { addTrailingNewLine } from \"./addTrailingNewLine\";\n\ntype AddBlankLineConfig = {\n\tforce?: boolean;\n};\n\nexport function addBlankLine(state: string, config?: AddBlankLineConfig): string {\n\tif ((!state || state.endsWith(\"\\n\\n\")) && !config?.force) {\n\t\treturn state;\n\t} else {\n\t\treturn addTrailingNewLine(state) + \"\\n\";\n\t}\n}\n"],"mappings":";;AAMA,SAAgB,aAAa,OAAe,QAAqC;AAChF,MAAK,CAAC,SAAS,MAAM,SAAS,OAAO,KAAK,CAAC,QAAQ,MAClD,QAAO;KAEP,QAAO,mBAAmB,MAAM,GAAG"}
@@ -1,4 +1,4 @@
1
- import { addTrailingNewLine } from "./addTrailingNewLine.js";
1
+ import { addTrailingNewLine } from "./addTrailingNewLine.mjs";
2
2
  //#region src/lib/addLine.ts
3
3
  function addLine(line, state) {
4
4
  return addTrailingNewLine(state) + line;
@@ -6,4 +6,4 @@ function addLine(line, state) {
6
6
  //#endregion
7
7
  export { addLine };
8
8
 
9
- //# sourceMappingURL=addLine.js.map
9
+ //# sourceMappingURL=addLine.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addLine.mjs","names":[],"sources":["../../src/lib/addLine.ts"],"sourcesContent":["import { addTrailingNewLine } from \"./addTrailingNewLine\";\n\nexport function addLine(line: string, state: string): string {\n\treturn addTrailingNewLine(state) + line;\n}\n"],"mappings":";;AAEA,SAAgB,QAAQ,MAAc,OAAuB;AAC5D,QAAO,mBAAmB,MAAM,GAAG"}
@@ -1,4 +1,4 @@
1
- import { addBlankLine } from "./addBlankLine.js";
1
+ import { addBlankLine } from "./addBlankLine.mjs";
2
2
  //#region src/lib/addSection.ts
3
3
  function addSection(section, state) {
4
4
  return addBlankLine(state) + section;
@@ -6,4 +6,4 @@ function addSection(section, state) {
6
6
  //#endregion
7
7
  export { addSection };
8
8
 
9
- //# sourceMappingURL=addSection.js.map
9
+ //# sourceMappingURL=addSection.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addSection.mjs","names":[],"sources":["../../src/lib/addSection.ts"],"sourcesContent":["import { addBlankLine } from \"./addBlankLine\";\n\nexport function addSection(section: string, state: string): string {\n\treturn addBlankLine(state) + section;\n}\n"],"mappings":";;AAEA,SAAgB,WAAW,SAAiB,OAAuB;AAClE,QAAO,aAAa,MAAM,GAAG"}
@@ -6,4 +6,4 @@ function addTrailingNewLine(state, config) {
6
6
  //#endregion
7
7
  export { addTrailingNewLine };
8
8
 
9
- //# sourceMappingURL=addTrailingNewLine.js.map
9
+ //# sourceMappingURL=addTrailingNewLine.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"addTrailingNewLine.cjs","names":[],"sources":["../../src/lib/addTrailingNewLine.ts"],"sourcesContent":["type AddTrailingNewLineConfig = {\n\tforce?: boolean;\n};\n\nexport function addTrailingNewLine(state: string, config?: AddTrailingNewLineConfig): string {\n\tif ((!state || state.endsWith(\"\\n\")) && !config?.force) {\n\t\treturn state;\n\t} else {\n\t\treturn state + \"\\n\";\n\t}\n}\n"],"mappings":";AAIA,SAAgB,mBAAmB,OAAe,QAA2C;AAC5F,MAAK,CAAC,SAAS,MAAM,SAAS,KAAK,KAAK,CAAC,QAAQ,MAChD,QAAO;KAEP,QAAO,QAAQ"}
1
+ {"version":3,"file":"addTrailingNewLine.mjs","names":[],"sources":["../../src/lib/addTrailingNewLine.ts"],"sourcesContent":["type AddTrailingNewLineConfig = {\n\tforce?: boolean;\n};\n\nexport function addTrailingNewLine(state: string, config?: AddTrailingNewLineConfig): string {\n\tif ((!state || state.endsWith(\"\\n\")) && !config?.force) {\n\t\treturn state;\n\t} else {\n\t\treturn state + \"\\n\";\n\t}\n}\n"],"mappings":";AAIA,SAAgB,mBAAmB,OAAe,QAA2C;AAC5F,MAAK,CAAC,SAAS,MAAM,SAAS,KAAK,KAAK,CAAC,QAAQ,MAChD,QAAO;KAEP,QAAO,QAAQ"}
@@ -1,6 +1,6 @@
1
- import { buildTypeName } from "./buildTypeName.js";
2
- import { getHumanReadableModelName } from "./getHumanReadableModelName.js";
3
- import { buildFieldProperties } from "./buildFieldProperties.js";
1
+ import { buildTypeName } from "./buildTypeName.mjs";
2
+ import { getHumanReadableModelName } from "./getHumanReadableModelName.mjs";
3
+ import { buildFieldProperties } from "./buildFieldProperties.mjs";
4
4
  import { source } from "common-tags";
5
5
  //#region src/lib/buildCustomTypeDataType.ts
6
6
  function buildCustomTypeDataType(args) {
@@ -47,4 +47,4 @@ function buildCustomTypeDataType(args) {
47
47
  //#endregion
48
48
  export { buildCustomTypeDataType };
49
49
 
50
- //# sourceMappingURL=buildCustomTypeDataType.js.map
50
+ //# sourceMappingURL=buildCustomTypeDataType.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildCustomTypeDataType.mjs","names":[],"sources":["../../src/lib/buildCustomTypeDataType.ts"],"sourcesContent":["import type { CustomTypeModel } from \"@prismicio/client\";\nimport { source } from \"common-tags\";\n\nimport { buildTypeName } from \"../lib/buildTypeName\";\nimport type { AuxiliaryType, FieldConfigs } from \"../types\";\nimport { buildFieldProperties } from \"./buildFieldProperties\";\nimport { getHumanReadableModelName } from \"./getHumanReadableModelName\";\n\ntype BuildCustomTypeDataTypeArgs = {\n\tmodel: CustomTypeModel;\n\tfieldConfigs: FieldConfigs;\n};\n\ntype BuildCustomTypeDataTypeReturnValue = {\n\tname: string;\n\tcode: string;\n\tauxiliaryTypes: AuxiliaryType[];\n\tcontentTypeNames: string[];\n};\n\nexport function buildCustomTypeDataType(\n\targs: BuildCustomTypeDataTypeArgs,\n): BuildCustomTypeDataTypeReturnValue {\n\tlet code = \"\";\n\tconst auxiliaryTypes: AuxiliaryType[] = [];\n\tconst contentTypeNames: string[] = [];\n\n\tconst name = buildTypeName(args.model.id, \"Document\", \"Data\");\n\tconst humanReadableName = getHumanReadableModelName({\n\t\tname: args.model.id,\n\t\tmodel: args.model,\n\t});\n\n\tlet fieldProperties = \"\";\n\n\tfor (const tabName in args.model.json) {\n\t\tconst { uid: _uid, ...fields } = args.model.json[tabName];\n\n\t\tconst tabFieldProperties = buildFieldProperties({\n\t\t\tfields,\n\t\t\tfieldConfigs: args.fieldConfigs,\n\t\t\tpath: [\n\t\t\t\t{\n\t\t\t\t\tname: args.model.id,\n\t\t\t\t\tmodel: args.model,\n\t\t\t\t},\n\t\t\t],\n\t\t\ttabName,\n\t\t});\n\n\t\tfieldProperties += tabFieldProperties.code;\n\n\t\tauxiliaryTypes.push(...tabFieldProperties.auxiliaryTypes);\n\t\tcontentTypeNames.push(...tabFieldProperties.contentTypeNames);\n\t}\n\n\tif (fieldProperties) {\n\t\tcode = source`\n\t\t\t/**\n\t\t\t * Content for ${humanReadableName} documents\n\t\t\t */\n\t\t\tinterface ${name} {\n\t\t\t\t${fieldProperties}\n\t\t\t}\n\t\t`;\n\t} else {\n\t\tcode = `interface ${name} {}`;\n\t}\n\n\treturn {\n\t\tname,\n\t\tcode,\n\t\tauxiliaryTypes,\n\t\tcontentTypeNames,\n\t};\n}\n"],"mappings":";;;;;AAoBA,SAAgB,wBACf,MACqC;CACrC,IAAI,OAAO;CACX,MAAM,iBAAkC,EAAE;CAC1C,MAAM,mBAA6B,EAAE;CAErC,MAAM,OAAO,cAAc,KAAK,MAAM,IAAI,YAAY,OAAO;CAC7D,MAAM,oBAAoB,0BAA0B;EACnD,MAAM,KAAK,MAAM;EACjB,OAAO,KAAK;EACZ,CAAC;CAEF,IAAI,kBAAkB;AAEtB,MAAK,MAAM,WAAW,KAAK,MAAM,MAAM;EACtC,MAAM,EAAE,KAAK,MAAM,GAAG,WAAW,KAAK,MAAM,KAAK;EAEjD,MAAM,qBAAqB,qBAAqB;GAC/C;GACA,cAAc,KAAK;GACnB,MAAM,CACL;IACC,MAAM,KAAK,MAAM;IACjB,OAAO,KAAK;IACZ,CACD;GACD;GACA,CAAC;AAEF,qBAAmB,mBAAmB;AAEtC,iBAAe,KAAK,GAAG,mBAAmB,eAAe;AACzD,mBAAiB,KAAK,GAAG,mBAAmB,iBAAiB;;AAG9D,KAAI,gBACH,QAAO,MAAM;;oBAEK,kBAAkB;;eAEvB,KAAK;MACd,gBAAgB;;;KAIpB,QAAO,aAAa,KAAK;AAG1B,QAAO;EACN;EACA;EACA;EACA;EACA"}
@@ -1,11 +1,11 @@
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";
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";
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.js.map
62
+ //# sourceMappingURL=buildCustomTypeType.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildCustomTypeType.mjs","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"}
@@ -1,8 +1,8 @@
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";
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";
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.js.map
66
+ //# sourceMappingURL=buildFieldDocs.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildFieldDocs.mjs","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,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,OAAO,yBAAyB;AAEtC,WAAQ,KAAK,MAAM,QAAQ,QAA3B;IACC,KAAK,WACJ,QAAO,KAAK;IAGb,KAAK,QACJ,QAAO,KAAK;IAGb,QACC,QAAO,KAAK;;;EAKf,SAAS;GACR,MAAM,MACL,yBAAyB,KAAK,MAAM;AAErC,OAAI,OAAO,QAAQ,SAClB,QAAO;;;;AAaX,SAAgB,eAAe,MAAkC;CAChE,IAAI,SAAS;CAEb,MAAM,oBAAoB,0BAA0B;EACnD,OAAO,KAAK;EACZ,MAAM,KAAK;EACX,CAAC;CACF,MAAM,oBAAoB,qBAAqB,EAAE,MAAM,KAAK,MAAM,CAAC;CACnE,MAAM,yBAAyB,0BAA0B,EACxD,OAAO,KAAK,OACZ,CAAC;AAEF,UAAS,QAAQ,MAAM,kBAAkB,aAAa,kBAAkB,IAAI,OAAO;AAEnF,UAAS,QAAQ,MAAM,OAAO;AAE9B,UAAS,QAAQ,wBAAwB,0BAA0B,OAAO;AAK1E,UAAS,QAAQ,yBAFf,KAAK,MAAM,UAAU,iBAAiB,KAAK,MAAM,UAAU,KAAK,MAAM,OAAO,eAC9E,YACwD,OAAO;CAEhE,MAAM,eACL,KAAK,MAAM,UAAU,mBAAmB,KAAK,MAAM,SAChD,KAAK,MAAM,OAAO,gBAClB,KAAA;AACJ,KAAI,iBAAiB,KAAA,EAIpB,UAAS,QAAQ,2BAFhB,OAAO,iBAAiB,YAAY,GAAG,iBAAiB,gBAEc,OAAO;AAM/E,UAAS,QAAQ,yBAHC,aAAa,EAC9B,MAAM,CAAC,GAAG,KAAK,MAAM;EAAE,MAAM,KAAK;EAAM,OAAO,KAAK;EAAO,CAAC,EAC5D,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"}
@@ -1,9 +1,9 @@
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";
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";
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.js.map
284
+ //# sourceMappingURL=buildFieldProperties.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildFieldProperties.mjs","names":[],"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,OAAO,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,UAAO,QAAQ,GAAG,KAAK,0BAA0B,KAAK;AAEtD;EAGD,KAAK;AACJ,UAAO,QAAQ,GAAG,KAAK,wBAAwB,KAAK;AAEpD;EAGD,KAAK;AACJ,UAAO,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,qBAAqB,WAAW,cAAc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KAAK;GACnB,SAAS,KAAK;GACd,CAAC;AAEF,SAAO,WAAW,cAAc,MAAM,KAAK;AAE3C,iBAAe,KAAK,GAAG,cAAc,eAAe;AACpD,mBAAiB,KAAK,GAAG,cAAc,iBAAiB;;AAGzD,QAAO;EACN;EACA;EACA;EACA"}
@@ -1,11 +1,11 @@
1
- import { addSection } from "./addSection.js";
2
- import { SHARED_SLICES_DOCUMENTATION_URL } from "../constants.js";
3
- import { buildTypeName } from "./buildTypeName.js";
4
- import { getHumanReadableModelName } from "./getHumanReadableModelName.js";
5
- import { getHumanReadablePath } from "./getHumanReadablePath.js";
6
- import { buildUnion } from "./buildUnion.js";
7
- import { buildFieldProperties } from "./buildFieldProperties.js";
8
- import { getCacheKey } from "./getCacheKey.js";
1
+ import { addSection } from "./addSection.mjs";
2
+ import { SHARED_SLICES_DOCUMENTATION_URL } from "../constants.mjs";
3
+ import { buildTypeName } from "./buildTypeName.mjs";
4
+ import { getHumanReadableModelName } from "./getHumanReadableModelName.mjs";
5
+ import { getHumanReadablePath } from "./getHumanReadablePath.mjs";
6
+ import { buildUnion } from "./buildUnion.mjs";
7
+ import { buildFieldProperties } from "./buildFieldProperties.mjs";
8
+ import { getCacheKey } from "./getCacheKey.mjs";
9
9
  import { source, stripIndent } from "common-tags";
10
10
  //#region src/lib/buildSharedSliceType.ts
11
11
  function buildSharedSliceType(args) {
@@ -148,4 +148,4 @@ function buildSharedSliceType(args) {
148
148
  //#endregion
149
149
  export { buildSharedSliceType };
150
150
 
151
- //# sourceMappingURL=buildSharedSliceType.js.map
151
+ //# sourceMappingURL=buildSharedSliceType.mjs.map