prismic-ts-codegen 0.1.6 → 0.1.7

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 (175) hide show
  1. package/README.md +5 -5
  2. package/bin/prismic-ts-codegen.mjs +3 -0
  3. package/dist/cli/configSchema.cjs +38 -0
  4. package/dist/cli/configSchema.cjs.map +1 -0
  5. package/dist/cli/configSchema.d.ts +3 -0
  6. package/dist/cli/configSchema.js +38 -0
  7. package/dist/cli/configSchema.js.map +1 -0
  8. package/dist/cli/constants.cjs +5 -0
  9. package/dist/cli/constants.cjs.map +1 -0
  10. package/dist/cli/constants.d.ts +1 -0
  11. package/dist/cli/constants.js +5 -0
  12. package/dist/cli/constants.js.map +1 -0
  13. package/dist/cli/index.d.ts +1 -0
  14. package/dist/cli/loadConfig.cjs +32 -0
  15. package/dist/cli/loadConfig.cjs.map +1 -0
  16. package/dist/cli/loadConfig.d.ts +6 -0
  17. package/dist/cli/loadConfig.js +32 -0
  18. package/dist/cli/loadConfig.js.map +1 -0
  19. package/dist/cli/loadLocaleIDs.cjs +37 -0
  20. package/dist/cli/loadLocaleIDs.cjs.map +1 -0
  21. package/dist/cli/loadLocaleIDs.d.ts +10 -0
  22. package/dist/cli/loadLocaleIDs.js +20 -0
  23. package/dist/cli/loadLocaleIDs.js.map +1 -0
  24. package/dist/cli/loadModels.cjs +79 -0
  25. package/dist/cli/loadModels.cjs.map +1 -0
  26. package/dist/cli/loadModels.d.ts +15 -0
  27. package/dist/cli/loadModels.js +62 -0
  28. package/dist/cli/loadModels.js.map +1 -0
  29. package/dist/cli/types.d.ts +175 -0
  30. package/dist/cli.cjs +119 -0
  31. package/dist/cli.cjs.map +1 -0
  32. package/dist/cli.js +118 -0
  33. package/dist/cli.js.map +1 -0
  34. package/dist/constants.cjs +29 -0
  35. package/dist/constants.cjs.map +1 -0
  36. package/dist/constants.d.ts +5 -0
  37. package/dist/constants.js +29 -0
  38. package/dist/constants.js.map +1 -0
  39. package/dist/detectTypesProvider.cjs +16 -0
  40. package/dist/detectTypesProvider.cjs.map +1 -0
  41. package/dist/detectTypesProvider.d.ts +13 -0
  42. package/dist/detectTypesProvider.js +16 -0
  43. package/dist/detectTypesProvider.js.map +1 -0
  44. package/dist/generateTypes.cjs +109 -0
  45. package/dist/generateTypes.cjs.map +1 -0
  46. package/dist/generateTypes.d.ts +15 -0
  47. package/dist/generateTypes.js +109 -0
  48. package/dist/generateTypes.js.map +1 -0
  49. package/dist/index.cjs +6 -1086
  50. package/dist/index.cjs.map +1 -1
  51. package/dist/index.d.ts +5 -192
  52. package/dist/index.js +5 -1081
  53. package/dist/index.js.map +1 -1
  54. package/dist/lib/addInterfacePropertiesForFields.cjs +490 -0
  55. package/dist/lib/addInterfacePropertiesForFields.cjs.map +1 -0
  56. package/dist/lib/addInterfacePropertiesForFields.d.ts +21 -0
  57. package/dist/lib/addInterfacePropertiesForFields.js +490 -0
  58. package/dist/lib/addInterfacePropertiesForFields.js.map +1 -0
  59. package/dist/lib/addTypeAliasForCustomType.cjs +81 -0
  60. package/dist/lib/addTypeAliasForCustomType.cjs.map +1 -0
  61. package/dist/lib/addTypeAliasForCustomType.d.ts +11 -0
  62. package/dist/lib/addTypeAliasForCustomType.js +81 -0
  63. package/dist/lib/addTypeAliasForCustomType.js.map +1 -0
  64. package/dist/lib/addTypeAliasForSharedSlice.cjs +149 -0
  65. package/dist/lib/addTypeAliasForSharedSlice.cjs.map +1 -0
  66. package/dist/lib/addTypeAliasForSharedSlice.d.ts +10 -0
  67. package/dist/lib/addTypeAliasForSharedSlice.js +149 -0
  68. package/dist/lib/addTypeAliasForSharedSlice.js.map +1 -0
  69. package/dist/lib/buildFieldDocs.cjs +43 -0
  70. package/dist/lib/buildFieldDocs.cjs.map +1 -0
  71. package/dist/lib/buildFieldDocs.d.ts +14 -0
  72. package/dist/lib/buildFieldDocs.js +43 -0
  73. package/dist/lib/buildFieldDocs.js.map +1 -0
  74. package/dist/lib/buildSharedSliceInterfaceNamePart.cjs +8 -0
  75. package/dist/lib/buildSharedSliceInterfaceNamePart.cjs.map +1 -0
  76. package/dist/lib/buildSharedSliceInterfaceNamePart.d.ts +5 -0
  77. package/dist/lib/buildSharedSliceInterfaceNamePart.js +8 -0
  78. package/dist/lib/buildSharedSliceInterfaceNamePart.js.map +1 -0
  79. package/dist/lib/buildTypeName.cjs +12 -0
  80. package/dist/lib/buildTypeName.cjs.map +1 -0
  81. package/dist/lib/buildTypeName.d.ts +1 -0
  82. package/dist/lib/buildTypeName.js +12 -0
  83. package/dist/lib/buildTypeName.js.map +1 -0
  84. package/dist/lib/getAPIIDPath.cjs +23 -0
  85. package/dist/lib/getAPIIDPath.cjs.map +1 -0
  86. package/dist/lib/getAPIIDPath.d.ts +10 -0
  87. package/dist/lib/getAPIIDPath.js +23 -0
  88. package/dist/lib/getAPIIDPath.js.map +1 -0
  89. package/dist/lib/getFieldDocumentationURL.cjs +8 -0
  90. package/dist/lib/getFieldDocumentationURL.cjs.map +1 -0
  91. package/dist/lib/getFieldDocumentationURL.d.ts +6 -0
  92. package/dist/lib/getFieldDocumentationURL.js +8 -0
  93. package/dist/lib/getFieldDocumentationURL.js.map +1 -0
  94. package/dist/lib/getHumanReadableFieldPath.cjs +19 -0
  95. package/dist/lib/getHumanReadableFieldPath.cjs.map +1 -0
  96. package/dist/lib/getHumanReadableFieldPath.d.ts +10 -0
  97. package/dist/lib/getHumanReadableFieldPath.js +19 -0
  98. package/dist/lib/getHumanReadableFieldPath.js.map +1 -0
  99. package/dist/lib/getHumanReadableFieldType.cjs +37 -0
  100. package/dist/lib/getHumanReadableFieldType.cjs.map +1 -0
  101. package/dist/lib/getHumanReadableFieldType.d.ts +6 -0
  102. package/dist/lib/getHumanReadableFieldType.js +37 -0
  103. package/dist/lib/getHumanReadableFieldType.js.map +1 -0
  104. package/dist/lib/getHumanReadableModelName.cjs +24 -0
  105. package/dist/lib/getHumanReadableModelName.cjs.map +1 -0
  106. package/dist/lib/getHumanReadableModelName.d.ts +7 -0
  107. package/dist/lib/getHumanReadableModelName.js +24 -0
  108. package/dist/lib/getHumanReadableModelName.js.map +1 -0
  109. package/dist/lib/getSourceFileText.cjs +9 -0
  110. package/dist/lib/getSourceFileText.cjs.map +1 -0
  111. package/dist/lib/getSourceFileText.d.ts +2 -0
  112. package/dist/lib/getSourceFileText.js +9 -0
  113. package/dist/lib/getSourceFileText.js.map +1 -0
  114. package/dist/lib/hasOwnProperty.cjs +7 -0
  115. package/dist/lib/hasOwnProperty.cjs.map +1 -0
  116. package/dist/lib/hasOwnProperty.d.ts +10 -0
  117. package/dist/lib/hasOwnProperty.js +7 -0
  118. package/dist/lib/hasOwnProperty.js.map +1 -0
  119. package/dist/lib/isCustomTypeModel.cjs +7 -0
  120. package/dist/lib/isCustomTypeModel.cjs.map +1 -0
  121. package/dist/lib/isCustomTypeModel.d.ts +2 -0
  122. package/dist/lib/isCustomTypeModel.js +7 -0
  123. package/dist/lib/isCustomTypeModel.js.map +1 -0
  124. package/dist/lib/isCustomTypeModelField.cjs +7 -0
  125. package/dist/lib/isCustomTypeModelField.cjs.map +1 -0
  126. package/dist/lib/isCustomTypeModelField.d.ts +2 -0
  127. package/dist/lib/isCustomTypeModelField.js +7 -0
  128. package/dist/lib/isCustomTypeModelField.js.map +1 -0
  129. package/dist/lib/isCustomTypeModelSlice.cjs +9 -0
  130. package/dist/lib/isCustomTypeModelSlice.cjs.map +1 -0
  131. package/dist/lib/isCustomTypeModelSlice.d.ts +2 -0
  132. package/dist/lib/isCustomTypeModelSlice.js +9 -0
  133. package/dist/lib/isCustomTypeModelSlice.js.map +1 -0
  134. package/dist/lib/isSharedSliceModel.cjs +9 -0
  135. package/dist/lib/isSharedSliceModel.cjs.map +1 -0
  136. package/dist/lib/isSharedSliceModel.d.ts +2 -0
  137. package/dist/lib/isSharedSliceModel.js +9 -0
  138. package/dist/lib/isSharedSliceModel.js.map +1 -0
  139. package/dist/lib/pascalCase.cjs +8 -0
  140. package/dist/lib/pascalCase.cjs.map +1 -0
  141. package/dist/lib/pascalCase.d.ts +1 -0
  142. package/dist/lib/pascalCase.js +8 -0
  143. package/dist/lib/pascalCase.js.map +1 -0
  144. package/dist/lib/writeFieldDocsDescription.cjs +29 -0
  145. package/dist/lib/writeFieldDocsDescription.cjs.map +1 -0
  146. package/dist/lib/writeFieldDocsDescription.d.ts +13 -0
  147. package/dist/lib/writeFieldDocsDescription.js +29 -0
  148. package/dist/lib/writeFieldDocsDescription.js.map +1 -0
  149. package/dist/types.d.ts +14 -0
  150. package/package.json +45 -36
  151. package/src/cli/configSchema.ts +2 -0
  152. package/src/cli/index.ts +9 -5
  153. package/src/cli/loadConfig.ts +4 -2
  154. package/src/cli/loadModels.ts +3 -3
  155. package/src/cli/types.ts +10 -0
  156. package/src/constants.ts +6 -3
  157. package/src/detectTypesProvider.ts +32 -0
  158. package/src/generateTypes.ts +11 -6
  159. package/src/index.ts +4 -1
  160. package/src/lib/addInterfacePropertiesForFields.ts +27 -27
  161. package/src/lib/addTypeAliasForCustomType.ts +7 -5
  162. package/src/lib/addTypeAliasForSharedSlice.ts +5 -4
  163. package/src/lib/buildFieldDocs.ts +2 -1
  164. package/src/lib/getAPIIDPath.ts +3 -2
  165. package/src/lib/getFieldDocumentationURL.ts +1 -1
  166. package/src/lib/getHumanReadableFieldPath.ts +2 -1
  167. package/src/lib/getHumanReadableFieldType.ts +2 -2
  168. package/src/lib/getHumanReadableModelName.ts +1 -1
  169. package/src/lib/getSourceFileText.ts +1 -1
  170. package/src/lib/isCustomTypeModel.ts +1 -1
  171. package/src/lib/isCustomTypeModelField.ts +1 -1
  172. package/src/lib/isCustomTypeModelSlice.ts +1 -1
  173. package/src/lib/isSharedSliceModel.ts +1 -1
  174. package/src/types.ts +1 -1
  175. package/bin/cli.mjs +0 -1342
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const prismic = require("@prismicio/client");
4
+ const isCustomTypeModelField = require("./isCustomTypeModelField.cjs");
5
+ const isCustomTypeModelSlice = require("./isCustomTypeModelSlice.cjs");
6
+ const isSharedSliceModel = require("./isSharedSliceModel.cjs");
7
+ const getAPIIDPath = (config) => {
8
+ return config.path.map((element, i) => {
9
+ if (isCustomTypeModelField.isCustomTypeModelField(element.model) && (element.model.type === prismic.CustomTypeModelFieldType.Group || element.model.type === prismic.CustomTypeModelFieldType.Slices)) {
10
+ return `${element.id}[]`;
11
+ } else {
12
+ if (element.id === "items") {
13
+ const previousElement = config.path[i - 1];
14
+ if (isCustomTypeModelSlice.isCustomTypeModelSlice(previousElement.model) || isSharedSliceModel.isSharedSliceModel(previousElement.model)) {
15
+ return `${element.id}[]`;
16
+ }
17
+ }
18
+ return element.id;
19
+ }
20
+ }).join(".");
21
+ };
22
+ exports.getAPIIDPath = getAPIIDPath;
23
+ //# sourceMappingURL=getAPIIDPath.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAPIIDPath.cjs","sources":["../../../src/lib/getAPIIDPath.ts"],"sourcesContent":["import type {\n\tCustomTypeModel,\n\tCustomTypeModelField,\n\tCustomTypeModelSlice,\n\tSharedSliceModel,\n} from \"@prismicio/client\";\nimport { CustomTypeModelFieldType } from \"@prismicio/client\";\n\nimport { PathElement } from \"../types\";\n\nimport { isCustomTypeModelField } from \"./isCustomTypeModelField\";\nimport { isCustomTypeModelSlice } from \"./isCustomTypeModelSlice\";\nimport { isSharedSliceModel } from \"./isSharedSliceModel\";\n\ntype GetAPIIDPathConfig = {\n\tpath: [\n\t\tPathElement<CustomTypeModel | SharedSliceModel>,\n\t\t...PathElement<CustomTypeModelField | CustomTypeModelSlice>[],\n\t];\n};\n\nexport const getAPIIDPath = (config: GetAPIIDPathConfig): string => {\n\treturn config.path\n\t\t.map((element, i) => {\n\t\t\tif (\n\t\t\t\tisCustomTypeModelField(element.model) &&\n\t\t\t\t(element.model.type === CustomTypeModelFieldType.Group ||\n\t\t\t\t\telement.model.type === CustomTypeModelFieldType.Slices)\n\t\t\t) {\n\t\t\t\treturn `${element.id}[]`;\n\t\t\t} else {\n\t\t\t\tif (element.id === \"items\") {\n\t\t\t\t\tconst previousElement = config.path[i - 1];\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tisCustomTypeModelSlice(previousElement.model) ||\n\t\t\t\t\t\tisSharedSliceModel(previousElement.model)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn `${element.id}[]`;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn element.id;\n\t\t\t}\n\t\t})\n\t\t.join(\".\");\n};\n"],"names":["isCustomTypeModelField","CustomTypeModelFieldType","isCustomTypeModelSlice","isSharedSliceModel"],"mappings":";;;;;;AAqBa,MAAA,eAAe,CAAC,WAAsC;AAClE,SAAO,OAAO,KACZ,IAAI,CAAC,SAAS,MAAK;AACnB,QACCA,uBAAAA,uBAAuB,QAAQ,KAAK,MACnC,QAAQ,MAAM,SAASC,QAAA,yBAAyB,SAChD,QAAQ,MAAM,SAASA,iCAAyB,SAChD;AACD,aAAO,GAAG,QAAQ;AAAA,IAAA,OACZ;AACF,UAAA,QAAQ,OAAO,SAAS;AAC3B,cAAM,kBAAkB,OAAO,KAAK,IAAI,CAAC;AAEzC,YACCC,uBAAAA,uBAAuB,gBAAgB,KAAK,KAC5CC,mBAAAA,mBAAmB,gBAAgB,KAAK,GACvC;AACD,iBAAO,GAAG,QAAQ;AAAA,QAClB;AAAA,MACD;AAED,aAAO,QAAQ;AAAA,IACf;AAAA,EAAA,CACD,EACA,KAAK,GAAG;AACX;;"}
@@ -0,0 +1,10 @@
1
+ import type { CustomTypeModel, CustomTypeModelField, CustomTypeModelSlice, SharedSliceModel } from "@prismicio/client";
2
+ import { PathElement } from "../types";
3
+ type GetAPIIDPathConfig = {
4
+ path: [
5
+ PathElement<CustomTypeModel | SharedSliceModel>,
6
+ ...PathElement<CustomTypeModelField | CustomTypeModelSlice>[]
7
+ ];
8
+ };
9
+ export declare const getAPIIDPath: (config: GetAPIIDPathConfig) => string;
10
+ export {};
@@ -0,0 +1,23 @@
1
+ import { CustomTypeModelFieldType } from "@prismicio/client";
2
+ import { isCustomTypeModelField } from "./isCustomTypeModelField.js";
3
+ import { isCustomTypeModelSlice } from "./isCustomTypeModelSlice.js";
4
+ import { isSharedSliceModel } from "./isSharedSliceModel.js";
5
+ const getAPIIDPath = (config) => {
6
+ return config.path.map((element, i) => {
7
+ if (isCustomTypeModelField(element.model) && (element.model.type === CustomTypeModelFieldType.Group || element.model.type === CustomTypeModelFieldType.Slices)) {
8
+ return `${element.id}[]`;
9
+ } else {
10
+ if (element.id === "items") {
11
+ const previousElement = config.path[i - 1];
12
+ if (isCustomTypeModelSlice(previousElement.model) || isSharedSliceModel(previousElement.model)) {
13
+ return `${element.id}[]`;
14
+ }
15
+ }
16
+ return element.id;
17
+ }
18
+ }).join(".");
19
+ };
20
+ export {
21
+ getAPIIDPath
22
+ };
23
+ //# sourceMappingURL=getAPIIDPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAPIIDPath.js","sources":["../../../src/lib/getAPIIDPath.ts"],"sourcesContent":["import type {\n\tCustomTypeModel,\n\tCustomTypeModelField,\n\tCustomTypeModelSlice,\n\tSharedSliceModel,\n} from \"@prismicio/client\";\nimport { CustomTypeModelFieldType } from \"@prismicio/client\";\n\nimport { PathElement } from \"../types\";\n\nimport { isCustomTypeModelField } from \"./isCustomTypeModelField\";\nimport { isCustomTypeModelSlice } from \"./isCustomTypeModelSlice\";\nimport { isSharedSliceModel } from \"./isSharedSliceModel\";\n\ntype GetAPIIDPathConfig = {\n\tpath: [\n\t\tPathElement<CustomTypeModel | SharedSliceModel>,\n\t\t...PathElement<CustomTypeModelField | CustomTypeModelSlice>[],\n\t];\n};\n\nexport const getAPIIDPath = (config: GetAPIIDPathConfig): string => {\n\treturn config.path\n\t\t.map((element, i) => {\n\t\t\tif (\n\t\t\t\tisCustomTypeModelField(element.model) &&\n\t\t\t\t(element.model.type === CustomTypeModelFieldType.Group ||\n\t\t\t\t\telement.model.type === CustomTypeModelFieldType.Slices)\n\t\t\t) {\n\t\t\t\treturn `${element.id}[]`;\n\t\t\t} else {\n\t\t\t\tif (element.id === \"items\") {\n\t\t\t\t\tconst previousElement = config.path[i - 1];\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tisCustomTypeModelSlice(previousElement.model) ||\n\t\t\t\t\t\tisSharedSliceModel(previousElement.model)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn `${element.id}[]`;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn element.id;\n\t\t\t}\n\t\t})\n\t\t.join(\".\");\n};\n"],"names":[],"mappings":";;;;AAqBa,MAAA,eAAe,CAAC,WAAsC;AAClE,SAAO,OAAO,KACZ,IAAI,CAAC,SAAS,MAAK;AACnB,QACC,uBAAuB,QAAQ,KAAK,MACnC,QAAQ,MAAM,SAAS,yBAAyB,SAChD,QAAQ,MAAM,SAAS,yBAAyB,SAChD;AACD,aAAO,GAAG,QAAQ;AAAA,IAAA,OACZ;AACF,UAAA,QAAQ,OAAO,SAAS;AAC3B,cAAM,kBAAkB,OAAO,KAAK,IAAI,CAAC;AAEzC,YACC,uBAAuB,gBAAgB,KAAK,KAC5C,mBAAmB,gBAAgB,KAAK,GACvC;AACD,iBAAO,GAAG,QAAQ;AAAA,QAClB;AAAA,MACD;AAED,aAAO,QAAQ;AAAA,IACf;AAAA,EAAA,CACD,EACA,KAAK,GAAG;AACX;"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const constants = require("../constants.cjs");
4
+ const getFieldDocumentationURL = (config) => {
5
+ return constants.FIELD_DOCUMENTATION_URLS[config.model.type];
6
+ };
7
+ exports.getFieldDocumentationURL = getFieldDocumentationURL;
8
+ //# sourceMappingURL=getFieldDocumentationURL.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFieldDocumentationURL.cjs","sources":["../../../src/lib/getFieldDocumentationURL.ts"],"sourcesContent":["import type { CustomTypeModelField } from \"@prismicio/client\";\n\nimport { FIELD_DOCUMENTATION_URLS } from \"../constants\";\n\ntype GetFieldDocumentationURLConfig = {\n\tmodel: CustomTypeModelField;\n};\n\nexport const getFieldDocumentationURL = (\n\tconfig: GetFieldDocumentationURLConfig,\n): string | undefined => {\n\treturn FIELD_DOCUMENTATION_URLS[\n\t\tconfig.model.type as keyof typeof FIELD_DOCUMENTATION_URLS\n\t];\n};\n"],"names":["FIELD_DOCUMENTATION_URLS"],"mappings":";;;AAQa,MAAA,2BAA2B,CACvC,WACuB;AAChB,SAAAA,mCACN,OAAO,MAAM,IAA6C;AAE5D;;"}
@@ -0,0 +1,6 @@
1
+ import type { CustomTypeModelField } from "@prismicio/client";
2
+ type GetFieldDocumentationURLConfig = {
3
+ model: CustomTypeModelField;
4
+ };
5
+ export declare const getFieldDocumentationURL: (config: GetFieldDocumentationURLConfig) => string | undefined;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ import { FIELD_DOCUMENTATION_URLS } from "../constants.js";
2
+ const getFieldDocumentationURL = (config) => {
3
+ return FIELD_DOCUMENTATION_URLS[config.model.type];
4
+ };
5
+ export {
6
+ getFieldDocumentationURL
7
+ };
8
+ //# sourceMappingURL=getFieldDocumentationURL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFieldDocumentationURL.js","sources":["../../../src/lib/getFieldDocumentationURL.ts"],"sourcesContent":["import type { CustomTypeModelField } from \"@prismicio/client\";\n\nimport { FIELD_DOCUMENTATION_URLS } from \"../constants\";\n\ntype GetFieldDocumentationURLConfig = {\n\tmodel: CustomTypeModelField;\n};\n\nexport const getFieldDocumentationURL = (\n\tconfig: GetFieldDocumentationURLConfig,\n): string | undefined => {\n\treturn FIELD_DOCUMENTATION_URLS[\n\t\tconfig.model.type as keyof typeof FIELD_DOCUMENTATION_URLS\n\t];\n};\n"],"names":[],"mappings":";AAQa,MAAA,2BAA2B,CACvC,WACuB;AAChB,SAAA,yBACN,OAAO,MAAM,IAA6C;AAE5D;"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const getHumanReadableModelName = require("./getHumanReadableModelName.cjs");
4
+ const getHumanReadableFieldPath = (config) => {
5
+ return config.path.map((element) => {
6
+ if (element.label) {
7
+ return element.label;
8
+ } else if (element.model) {
9
+ return getHumanReadableModelName.getHumanReadableModelName({
10
+ id: element.id,
11
+ model: element.model
12
+ });
13
+ } else {
14
+ return element.id;
15
+ }
16
+ }).join(" → ");
17
+ };
18
+ exports.getHumanReadableFieldPath = getHumanReadableFieldPath;
19
+ //# sourceMappingURL=getHumanReadableFieldPath.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getHumanReadableFieldPath.cjs","sources":["../../../src/lib/getHumanReadableFieldPath.ts"],"sourcesContent":["import type {\n\tCustomTypeModel,\n\tCustomTypeModelField,\n\tCustomTypeModelSlice,\n\tSharedSliceModel,\n} from \"@prismicio/client\";\n\nimport { PathElement } from \"../types\";\n\nimport { getHumanReadableModelName } from \"./getHumanReadableModelName\";\n\ntype GetHumanReadableFieldPathConfig = {\n\tpath: [\n\t\tPathElement<CustomTypeModel | SharedSliceModel>,\n\t\t...PathElement<CustomTypeModelField | CustomTypeModelSlice>[],\n\t];\n};\n\nexport const getHumanReadableFieldPath = (\n\tconfig: GetHumanReadableFieldPathConfig,\n): string => {\n\treturn config.path\n\t\t.map((element) => {\n\t\t\tif (element.label) {\n\t\t\t\treturn element.label;\n\t\t\t} else if (element.model) {\n\t\t\t\treturn getHumanReadableModelName({\n\t\t\t\t\tid: element.id,\n\t\t\t\t\tmodel: element.model,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treturn element.id;\n\t\t\t}\n\t\t})\n\t\t.join(\" → \");\n};\n"],"names":["getHumanReadableModelName"],"mappings":";;;AAkBa,MAAA,4BAA4B,CACxC,WACW;AACX,SAAO,OAAO,KACZ,IAAI,CAAC,YAAW;AAChB,QAAI,QAAQ,OAAO;AAClB,aAAO,QAAQ;AAAA,IAAA,WACL,QAAQ,OAAO;AACzB,aAAOA,oDAA0B;AAAA,QAChC,IAAI,QAAQ;AAAA,QACZ,OAAO,QAAQ;AAAA,MAAA,CACf;AAAA,IAAA,OACK;AACN,aAAO,QAAQ;AAAA,IACf;AAAA,EAAA,CACD,EACA,KAAK,KAAK;AACb;;"}
@@ -0,0 +1,10 @@
1
+ import type { CustomTypeModel, CustomTypeModelField, CustomTypeModelSlice, SharedSliceModel } from "@prismicio/client";
2
+ import { PathElement } from "../types";
3
+ type GetHumanReadableFieldPathConfig = {
4
+ path: [
5
+ PathElement<CustomTypeModel | SharedSliceModel>,
6
+ ...PathElement<CustomTypeModelField | CustomTypeModelSlice>[]
7
+ ];
8
+ };
9
+ export declare const getHumanReadableFieldPath: (config: GetHumanReadableFieldPathConfig) => string;
10
+ export {};
@@ -0,0 +1,19 @@
1
+ import { getHumanReadableModelName } from "./getHumanReadableModelName.js";
2
+ const getHumanReadableFieldPath = (config) => {
3
+ return config.path.map((element) => {
4
+ if (element.label) {
5
+ return element.label;
6
+ } else if (element.model) {
7
+ return getHumanReadableModelName({
8
+ id: element.id,
9
+ model: element.model
10
+ });
11
+ } else {
12
+ return element.id;
13
+ }
14
+ }).join(" → ");
15
+ };
16
+ export {
17
+ getHumanReadableFieldPath
18
+ };
19
+ //# sourceMappingURL=getHumanReadableFieldPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getHumanReadableFieldPath.js","sources":["../../../src/lib/getHumanReadableFieldPath.ts"],"sourcesContent":["import type {\n\tCustomTypeModel,\n\tCustomTypeModelField,\n\tCustomTypeModelSlice,\n\tSharedSliceModel,\n} from \"@prismicio/client\";\n\nimport { PathElement } from \"../types\";\n\nimport { getHumanReadableModelName } from \"./getHumanReadableModelName\";\n\ntype GetHumanReadableFieldPathConfig = {\n\tpath: [\n\t\tPathElement<CustomTypeModel | SharedSliceModel>,\n\t\t...PathElement<CustomTypeModelField | CustomTypeModelSlice>[],\n\t];\n};\n\nexport const getHumanReadableFieldPath = (\n\tconfig: GetHumanReadableFieldPathConfig,\n): string => {\n\treturn config.path\n\t\t.map((element) => {\n\t\t\tif (element.label) {\n\t\t\t\treturn element.label;\n\t\t\t} else if (element.model) {\n\t\t\t\treturn getHumanReadableModelName({\n\t\t\t\t\tid: element.id,\n\t\t\t\t\tmodel: element.model,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treturn element.id;\n\t\t\t}\n\t\t})\n\t\t.join(\" → \");\n};\n"],"names":[],"mappings":";AAkBa,MAAA,4BAA4B,CACxC,WACW;AACX,SAAO,OAAO,KACZ,IAAI,CAAC,YAAW;AAChB,QAAI,QAAQ,OAAO;AAClB,aAAO,QAAQ;AAAA,IAAA,WACL,QAAQ,OAAO;AACzB,aAAO,0BAA0B;AAAA,QAChC,IAAI,QAAQ;AAAA,QACZ,OAAO,QAAQ;AAAA,MAAA,CACf;AAAA,IAAA,OACK;AACN,aAAO,QAAQ;AAAA,IACf;AAAA,EAAA,CACD,EACA,KAAK,KAAK;AACb;"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const prismic = require("@prismicio/client");
4
+ const getHumanReadableFieldType = (config) => {
5
+ var _a, _b;
6
+ switch (config.model.type) {
7
+ case "StructuredText": {
8
+ const isTitleField = config.model.config && "single" in config.model.config && config.model.config.single && config.model.config.single.split(",").every((blockType) => /heading/.test(blockType));
9
+ return isTitleField ? "Title" : "Rich Text";
10
+ }
11
+ case "IntegrationFields": {
12
+ const catalog = (_a = config.model.config) == null ? void 0 : _a.catalog;
13
+ return `Integration Fields (Catalog: ${catalog ? `\`${catalog}\`` : "*unknown*"})`;
14
+ }
15
+ case "Link": {
16
+ switch ((_b = config.model.config) == null ? void 0 : _b.select) {
17
+ case prismic.CustomTypeModelLinkSelectType.Document: {
18
+ return "Content Relationship";
19
+ }
20
+ case prismic.CustomTypeModelLinkSelectType.Media: {
21
+ return "Link to Media";
22
+ }
23
+ default: {
24
+ return "Link";
25
+ }
26
+ }
27
+ }
28
+ case "Slices": {
29
+ return "Slice Zone";
30
+ }
31
+ default: {
32
+ return config.model.type;
33
+ }
34
+ }
35
+ };
36
+ exports.getHumanReadableFieldType = getHumanReadableFieldType;
37
+ //# sourceMappingURL=getHumanReadableFieldType.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getHumanReadableFieldType.cjs","sources":["../../../src/lib/getHumanReadableFieldType.ts"],"sourcesContent":["import type { CustomTypeModelField } from \"@prismicio/client\";\nimport { CustomTypeModelLinkSelectType } from \"@prismicio/client\";\n\ntype GetFieldHumanReadableTypeConfig = {\n\tmodel: CustomTypeModelField;\n};\n\nexport const getHumanReadableFieldType = (\n\tconfig: GetFieldHumanReadableTypeConfig,\n): string => {\n\tswitch (config.model.type) {\n\t\tcase \"StructuredText\": {\n\t\t\tconst isTitleField =\n\t\t\t\tconfig.model.config &&\n\t\t\t\t\"single\" in config.model.config &&\n\t\t\t\tconfig.model.config.single &&\n\t\t\t\tconfig.model.config.single\n\t\t\t\t\t.split(\",\")\n\t\t\t\t\t.every((blockType) => /heading/.test(blockType));\n\n\t\t\treturn isTitleField ? \"Title\" : \"Rich Text\";\n\t\t}\n\n\t\tcase \"IntegrationFields\": {\n\t\t\tconst catalog = config.model.config?.catalog;\n\n\t\t\treturn `Integration Fields (Catalog: ${\n\t\t\t\tcatalog ? `\\`${catalog}\\`` : \"*unknown*\"\n\t\t\t})`;\n\t\t}\n\n\t\tcase \"Link\": {\n\t\t\tswitch (config.model.config?.select) {\n\t\t\t\tcase CustomTypeModelLinkSelectType.Document: {\n\t\t\t\t\treturn \"Content Relationship\";\n\t\t\t\t}\n\n\t\t\t\tcase CustomTypeModelLinkSelectType.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 config.model.type;\n\t\t}\n\t}\n};\n"],"names":["CustomTypeModelLinkSelectType"],"mappings":";;;AAOa,MAAA,4BAA4B,CACxC,WACW;;AACH,UAAA,OAAO,MAAM,MAAM;AAAA,IAC1B,KAAK,kBAAkB;AAChB,YAAA,eACL,OAAO,MAAM,UACb,YAAY,OAAO,MAAM,UACzB,OAAO,MAAM,OAAO,UACpB,OAAO,MAAM,OAAO,OAClB,MAAM,GAAG,EACT,MAAM,CAAC,cAAc,UAAU,KAAK,SAAS,CAAC;AAEjD,aAAO,eAAe,UAAU;AAAA,IAChC;AAAA,IAED,KAAK,qBAAqB;AACnB,YAAA,WAAU,YAAO,MAAM,WAAb,mBAAqB;AAE9B,aAAA,gCACN,UAAU,KAAK,cAAc;AAAA,IAE9B;AAAA,IAED,KAAK,QAAQ;AACJ,eAAA,YAAO,MAAM,WAAb,mBAAqB,QAAQ;AAAA,QACpC,KAAKA,QAAAA,8BAA8B,UAAU;AACrC,iBAAA;AAAA,QACP;AAAA,QAED,KAAKA,QAAAA,8BAA8B,OAAO;AAClC,iBAAA;AAAA,QACP;AAAA,QAED,SAAS;AACD,iBAAA;AAAA,QACP;AAAA,MACD;AAAA,IACD;AAAA,IAED,KAAK,UAAU;AACP,aAAA;AAAA,IACP;AAAA,IAED,SAAS;AACR,aAAO,OAAO,MAAM;AAAA,IACpB;AAAA,EACD;AACF;;"}
@@ -0,0 +1,6 @@
1
+ import type { CustomTypeModelField } from "@prismicio/client";
2
+ type GetFieldHumanReadableTypeConfig = {
3
+ model: CustomTypeModelField;
4
+ };
5
+ export declare const getHumanReadableFieldType: (config: GetFieldHumanReadableTypeConfig) => string;
6
+ export {};
@@ -0,0 +1,37 @@
1
+ import { CustomTypeModelLinkSelectType } from "@prismicio/client";
2
+ const getHumanReadableFieldType = (config) => {
3
+ var _a, _b;
4
+ switch (config.model.type) {
5
+ case "StructuredText": {
6
+ const isTitleField = config.model.config && "single" in config.model.config && config.model.config.single && config.model.config.single.split(",").every((blockType) => /heading/.test(blockType));
7
+ return isTitleField ? "Title" : "Rich Text";
8
+ }
9
+ case "IntegrationFields": {
10
+ const catalog = (_a = config.model.config) == null ? void 0 : _a.catalog;
11
+ return `Integration Fields (Catalog: ${catalog ? `\`${catalog}\`` : "*unknown*"})`;
12
+ }
13
+ case "Link": {
14
+ switch ((_b = config.model.config) == null ? void 0 : _b.select) {
15
+ case CustomTypeModelLinkSelectType.Document: {
16
+ return "Content Relationship";
17
+ }
18
+ case CustomTypeModelLinkSelectType.Media: {
19
+ return "Link to Media";
20
+ }
21
+ default: {
22
+ return "Link";
23
+ }
24
+ }
25
+ }
26
+ case "Slices": {
27
+ return "Slice Zone";
28
+ }
29
+ default: {
30
+ return config.model.type;
31
+ }
32
+ }
33
+ };
34
+ export {
35
+ getHumanReadableFieldType
36
+ };
37
+ //# sourceMappingURL=getHumanReadableFieldType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getHumanReadableFieldType.js","sources":["../../../src/lib/getHumanReadableFieldType.ts"],"sourcesContent":["import type { CustomTypeModelField } from \"@prismicio/client\";\nimport { CustomTypeModelLinkSelectType } from \"@prismicio/client\";\n\ntype GetFieldHumanReadableTypeConfig = {\n\tmodel: CustomTypeModelField;\n};\n\nexport const getHumanReadableFieldType = (\n\tconfig: GetFieldHumanReadableTypeConfig,\n): string => {\n\tswitch (config.model.type) {\n\t\tcase \"StructuredText\": {\n\t\t\tconst isTitleField =\n\t\t\t\tconfig.model.config &&\n\t\t\t\t\"single\" in config.model.config &&\n\t\t\t\tconfig.model.config.single &&\n\t\t\t\tconfig.model.config.single\n\t\t\t\t\t.split(\",\")\n\t\t\t\t\t.every((blockType) => /heading/.test(blockType));\n\n\t\t\treturn isTitleField ? \"Title\" : \"Rich Text\";\n\t\t}\n\n\t\tcase \"IntegrationFields\": {\n\t\t\tconst catalog = config.model.config?.catalog;\n\n\t\t\treturn `Integration Fields (Catalog: ${\n\t\t\t\tcatalog ? `\\`${catalog}\\`` : \"*unknown*\"\n\t\t\t})`;\n\t\t}\n\n\t\tcase \"Link\": {\n\t\t\tswitch (config.model.config?.select) {\n\t\t\t\tcase CustomTypeModelLinkSelectType.Document: {\n\t\t\t\t\treturn \"Content Relationship\";\n\t\t\t\t}\n\n\t\t\t\tcase CustomTypeModelLinkSelectType.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 config.model.type;\n\t\t}\n\t}\n};\n"],"names":[],"mappings":";AAOa,MAAA,4BAA4B,CACxC,WACW;;AACH,UAAA,OAAO,MAAM,MAAM;AAAA,IAC1B,KAAK,kBAAkB;AAChB,YAAA,eACL,OAAO,MAAM,UACb,YAAY,OAAO,MAAM,UACzB,OAAO,MAAM,OAAO,UACpB,OAAO,MAAM,OAAO,OAClB,MAAM,GAAG,EACT,MAAM,CAAC,cAAc,UAAU,KAAK,SAAS,CAAC;AAEjD,aAAO,eAAe,UAAU;AAAA,IAChC;AAAA,IAED,KAAK,qBAAqB;AACnB,YAAA,WAAU,YAAO,MAAM,WAAb,mBAAqB;AAE9B,aAAA,gCACN,UAAU,KAAK,cAAc;AAAA,IAE9B;AAAA,IAED,KAAK,QAAQ;AACJ,eAAA,YAAO,MAAM,WAAb,mBAAqB,QAAQ;AAAA,QACpC,KAAK,8BAA8B,UAAU;AACrC,iBAAA;AAAA,QACP;AAAA,QAED,KAAK,8BAA8B,OAAO;AAClC,iBAAA;AAAA,QACP;AAAA,QAED,SAAS;AACD,iBAAA;AAAA,QACP;AAAA,MACD;AAAA,IACD;AAAA,IAED,KAAK,UAAU;AACP,aAAA;AAAA,IACP;AAAA,IAED,SAAS;AACR,aAAO,OAAO,MAAM;AAAA,IACpB;AAAA,EACD;AACF;"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const isCustomTypeModel = require("./isCustomTypeModel.cjs");
4
+ const isCustomTypeModelField = require("./isCustomTypeModelField.cjs");
5
+ const isCustomTypeModelSlice = require("./isCustomTypeModelSlice.cjs");
6
+ const isSharedSliceModel = require("./isSharedSliceModel.cjs");
7
+ const getHumanReadableModelName = (config) => {
8
+ if (isCustomTypeModel.isCustomTypeModel(config.model)) {
9
+ return config.model.label || config.model.id;
10
+ } else if (isSharedSliceModel.isSharedSliceModel(config.model)) {
11
+ return config.model.name;
12
+ } else if (isCustomTypeModelField.isCustomTypeModelField(config.model)) {
13
+ if (config.model.config && "label" in config.model.config) {
14
+ return config.model.config.label || config.id;
15
+ } else if (config.model.config && "fieldset" in config.model) {
16
+ return config.model.fieldset || config.id;
17
+ }
18
+ } else if (isCustomTypeModelSlice.isCustomTypeModelSlice(config.model)) {
19
+ return config.model.fieldset || config.id;
20
+ }
21
+ return `\`${config.id}\``;
22
+ };
23
+ exports.getHumanReadableModelName = getHumanReadableModelName;
24
+ //# sourceMappingURL=getHumanReadableModelName.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getHumanReadableModelName.cjs","sources":["../../../src/lib/getHumanReadableModelName.ts"],"sourcesContent":["import type {\n\tCustomTypeModel,\n\tCustomTypeModelField,\n\tCustomTypeModelSlice,\n\tSharedSliceModel,\n} from \"@prismicio/client\";\n\nimport { isCustomTypeModel } from \"./isCustomTypeModel\";\nimport { isCustomTypeModelField } from \"./isCustomTypeModelField\";\nimport { isCustomTypeModelSlice } from \"./isCustomTypeModelSlice\";\nimport { isSharedSliceModel } from \"./isSharedSliceModel\";\n\ntype GetModelHumanNameConfig = {\n\tid: string;\n\tmodel:\n\t\t| CustomTypeModel\n\t\t| SharedSliceModel\n\t\t| CustomTypeModelField\n\t\t| CustomTypeModelSlice;\n};\n\nexport const getHumanReadableModelName = (\n\tconfig: GetModelHumanNameConfig,\n): string => {\n\tif (isCustomTypeModel(config.model)) {\n\t\treturn config.model.label || config.model.id;\n\t} else if (isSharedSliceModel(config.model)) {\n\t\treturn config.model.name;\n\t} else if (isCustomTypeModelField(config.model)) {\n\t\tif (config.model.config && \"label\" in config.model.config) {\n\t\t\t// Non-Slice Zone fields\n\t\t\treturn config.model.config.label || config.id;\n\t\t} else if (config.model.config && \"fieldset\" in config.model) {\n\t\t\t// Slice Zone\n\t\t\treturn config.model.fieldset || config.id;\n\t\t}\n\t} else if (isCustomTypeModelSlice(config.model)) {\n\t\treturn config.model.fieldset || config.id;\n\t}\n\n\treturn `\\`${config.id}\\``;\n};\n"],"names":["isCustomTypeModel","isSharedSliceModel","isCustomTypeModelField","isCustomTypeModelSlice"],"mappings":";;;;;;AAqBa,MAAA,4BAA4B,CACxC,WACW;AACP,MAAAA,kBAAA,kBAAkB,OAAO,KAAK,GAAG;AACpC,WAAO,OAAO,MAAM,SAAS,OAAO,MAAM;AAAA,EAChC,WAAAC,mBAAA,mBAAmB,OAAO,KAAK,GAAG;AAC5C,WAAO,OAAO,MAAM;AAAA,EACV,WAAAC,uBAAA,uBAAuB,OAAO,KAAK,GAAG;AAChD,QAAI,OAAO,MAAM,UAAU,WAAW,OAAO,MAAM,QAAQ;AAE1D,aAAO,OAAO,MAAM,OAAO,SAAS,OAAO;AAAA,IAAA,WACjC,OAAO,MAAM,UAAU,cAAc,OAAO,OAAO;AAEtD,aAAA,OAAO,MAAM,YAAY,OAAO;AAAA,IACvC;AAAA,EACS,WAAAC,uBAAA,uBAAuB,OAAO,KAAK,GAAG;AACzC,WAAA,OAAO,MAAM,YAAY,OAAO;AAAA,EACvC;AAED,SAAO,KAAK,OAAO;AACpB;;"}
@@ -0,0 +1,7 @@
1
+ import type { CustomTypeModel, CustomTypeModelField, CustomTypeModelSlice, SharedSliceModel } from "@prismicio/client";
2
+ type GetModelHumanNameConfig = {
3
+ id: string;
4
+ model: CustomTypeModel | SharedSliceModel | CustomTypeModelField | CustomTypeModelSlice;
5
+ };
6
+ export declare const getHumanReadableModelName: (config: GetModelHumanNameConfig) => string;
7
+ export {};
@@ -0,0 +1,24 @@
1
+ import { isCustomTypeModel } from "./isCustomTypeModel.js";
2
+ import { isCustomTypeModelField } from "./isCustomTypeModelField.js";
3
+ import { isCustomTypeModelSlice } from "./isCustomTypeModelSlice.js";
4
+ import { isSharedSliceModel } from "./isSharedSliceModel.js";
5
+ const getHumanReadableModelName = (config) => {
6
+ if (isCustomTypeModel(config.model)) {
7
+ return config.model.label || config.model.id;
8
+ } else if (isSharedSliceModel(config.model)) {
9
+ return config.model.name;
10
+ } else if (isCustomTypeModelField(config.model)) {
11
+ if (config.model.config && "label" in config.model.config) {
12
+ return config.model.config.label || config.id;
13
+ } else if (config.model.config && "fieldset" in config.model) {
14
+ return config.model.fieldset || config.id;
15
+ }
16
+ } else if (isCustomTypeModelSlice(config.model)) {
17
+ return config.model.fieldset || config.id;
18
+ }
19
+ return `\`${config.id}\``;
20
+ };
21
+ export {
22
+ getHumanReadableModelName
23
+ };
24
+ //# sourceMappingURL=getHumanReadableModelName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getHumanReadableModelName.js","sources":["../../../src/lib/getHumanReadableModelName.ts"],"sourcesContent":["import type {\n\tCustomTypeModel,\n\tCustomTypeModelField,\n\tCustomTypeModelSlice,\n\tSharedSliceModel,\n} from \"@prismicio/client\";\n\nimport { isCustomTypeModel } from \"./isCustomTypeModel\";\nimport { isCustomTypeModelField } from \"./isCustomTypeModelField\";\nimport { isCustomTypeModelSlice } from \"./isCustomTypeModelSlice\";\nimport { isSharedSliceModel } from \"./isSharedSliceModel\";\n\ntype GetModelHumanNameConfig = {\n\tid: string;\n\tmodel:\n\t\t| CustomTypeModel\n\t\t| SharedSliceModel\n\t\t| CustomTypeModelField\n\t\t| CustomTypeModelSlice;\n};\n\nexport const getHumanReadableModelName = (\n\tconfig: GetModelHumanNameConfig,\n): string => {\n\tif (isCustomTypeModel(config.model)) {\n\t\treturn config.model.label || config.model.id;\n\t} else if (isSharedSliceModel(config.model)) {\n\t\treturn config.model.name;\n\t} else if (isCustomTypeModelField(config.model)) {\n\t\tif (config.model.config && \"label\" in config.model.config) {\n\t\t\t// Non-Slice Zone fields\n\t\t\treturn config.model.config.label || config.id;\n\t\t} else if (config.model.config && \"fieldset\" in config.model) {\n\t\t\t// Slice Zone\n\t\t\treturn config.model.fieldset || config.id;\n\t\t}\n\t} else if (isCustomTypeModelSlice(config.model)) {\n\t\treturn config.model.fieldset || config.id;\n\t}\n\n\treturn `\\`${config.id}\\``;\n};\n"],"names":[],"mappings":";;;;AAqBa,MAAA,4BAA4B,CACxC,WACW;AACP,MAAA,kBAAkB,OAAO,KAAK,GAAG;AACpC,WAAO,OAAO,MAAM,SAAS,OAAO,MAAM;AAAA,EAChC,WAAA,mBAAmB,OAAO,KAAK,GAAG;AAC5C,WAAO,OAAO,MAAM;AAAA,EACV,WAAA,uBAAuB,OAAO,KAAK,GAAG;AAChD,QAAI,OAAO,MAAM,UAAU,WAAW,OAAO,MAAM,QAAQ;AAE1D,aAAO,OAAO,MAAM,OAAO,SAAS,OAAO;AAAA,IAAA,WACjC,OAAO,MAAM,UAAU,cAAc,OAAO,OAAO;AAEtD,aAAA,OAAO,MAAM,YAAY,OAAO;AAAA,IACvC;AAAA,EACS,WAAA,uBAAuB,OAAO,KAAK,GAAG;AACzC,WAAA,OAAO,MAAM,YAAY,OAAO;AAAA,EACvC;AAED,SAAO,KAAK,OAAO;AACpB;"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const constants = require("../constants.cjs");
4
+ const getSourceFileText = (sourceFile) => {
5
+ const text = sourceFile.print().replace(new RegExp(constants.BLANK_LINE_IDENTIFIER, "g"), "");
6
+ return text;
7
+ };
8
+ exports.getSourceFileText = getSourceFileText;
9
+ //# sourceMappingURL=getSourceFileText.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSourceFileText.cjs","sources":["../../../src/lib/getSourceFileText.ts"],"sourcesContent":["import * as tsm from \"ts-morph\";\n\n// import prettier from \"prettier\";\nimport { BLANK_LINE_IDENTIFIER } from \"../constants\";\n\nexport const getSourceFileText = (sourceFile: tsm.SourceFile): string => {\n\tconst text = sourceFile\n\t\t.print()\n\t\t.replace(new RegExp(BLANK_LINE_IDENTIFIER, \"g\"), \"\");\n\n\treturn text;\n\n\t// return prettier.format(text, { parser: \"typescript\" });\n};\n"],"names":["BLANK_LINE_IDENTIFIER"],"mappings":";;;AAKa,MAAA,oBAAoB,CAAC,eAAsC;AACjE,QAAA,OAAO,WACX,MAAA,EACA,QAAQ,IAAI,OAAOA,iCAAuB,GAAG,GAAG,EAAE;AAE7C,SAAA;AAGR;;"}
@@ -0,0 +1,2 @@
1
+ import * as tsm from "ts-morph";
2
+ export declare const getSourceFileText: (sourceFile: tsm.SourceFile) => string;
@@ -0,0 +1,9 @@
1
+ import { BLANK_LINE_IDENTIFIER } from "../constants.js";
2
+ const getSourceFileText = (sourceFile) => {
3
+ const text = sourceFile.print().replace(new RegExp(BLANK_LINE_IDENTIFIER, "g"), "");
4
+ return text;
5
+ };
6
+ export {
7
+ getSourceFileText
8
+ };
9
+ //# sourceMappingURL=getSourceFileText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSourceFileText.js","sources":["../../../src/lib/getSourceFileText.ts"],"sourcesContent":["import * as tsm from \"ts-morph\";\n\n// import prettier from \"prettier\";\nimport { BLANK_LINE_IDENTIFIER } from \"../constants\";\n\nexport const getSourceFileText = (sourceFile: tsm.SourceFile): string => {\n\tconst text = sourceFile\n\t\t.print()\n\t\t.replace(new RegExp(BLANK_LINE_IDENTIFIER, \"g\"), \"\");\n\n\treturn text;\n\n\t// return prettier.format(text, { parser: \"typescript\" });\n};\n"],"names":[],"mappings":";AAKa,MAAA,oBAAoB,CAAC,eAAsC;AACjE,QAAA,OAAO,WACX,MAAA,EACA,QAAQ,IAAI,OAAO,uBAAuB,GAAG,GAAG,EAAE;AAE7C,SAAA;AAGR;"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const hasOwnProperty = (obj, prop) => {
4
+ return obj.hasOwnProperty(prop);
5
+ };
6
+ exports.hasOwnProperty = hasOwnProperty;
7
+ //# sourceMappingURL=hasOwnProperty.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hasOwnProperty.cjs","sources":["../../../src/lib/hasOwnProperty.ts"],"sourcesContent":["/**\n * Determines if an object contains a given property. It augments the provided\n * object's type to include the property.\n *\n * @remarks\n * This function is only necessary because TypeScript does not narrow a type\n * after using the `in` operator on `object`.\n * @returns `true` if `obj` contains a `prop` property, `false` otherwise.\n */\nexport const hasOwnProperty = <X extends object, Y extends PropertyKey>(\n\tobj: X,\n\tprop: Y,\n): obj is X & Record<Y, unknown> => {\n\treturn obj.hasOwnProperty(prop);\n};\n"],"names":[],"mappings":";;AASa,MAAA,iBAAiB,CAC7B,KACA,SACkC;AAC3B,SAAA,IAAI,eAAe,IAAI;AAC/B;;"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Determines if an object contains a given property. It augments the provided
3
+ * object's type to include the property.
4
+ *
5
+ * @remarks
6
+ * This function is only necessary because TypeScript does not narrow a type
7
+ * after using the `in` operator on `object`.
8
+ * @returns `true` if `obj` contains a `prop` property, `false` otherwise.
9
+ */
10
+ export declare const hasOwnProperty: <X extends object, Y extends PropertyKey>(obj: X, prop: Y) => obj is X & Record<Y, unknown>;
@@ -0,0 +1,7 @@
1
+ const hasOwnProperty = (obj, prop) => {
2
+ return obj.hasOwnProperty(prop);
3
+ };
4
+ export {
5
+ hasOwnProperty
6
+ };
7
+ //# sourceMappingURL=hasOwnProperty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hasOwnProperty.js","sources":["../../../src/lib/hasOwnProperty.ts"],"sourcesContent":["/**\n * Determines if an object contains a given property. It augments the provided\n * object's type to include the property.\n *\n * @remarks\n * This function is only necessary because TypeScript does not narrow a type\n * after using the `in` operator on `object`.\n * @returns `true` if `obj` contains a `prop` property, `false` otherwise.\n */\nexport const hasOwnProperty = <X extends object, Y extends PropertyKey>(\n\tobj: X,\n\tprop: Y,\n): obj is X & Record<Y, unknown> => {\n\treturn obj.hasOwnProperty(prop);\n};\n"],"names":[],"mappings":"AASa,MAAA,iBAAiB,CAC7B,KACA,SACkC;AAC3B,SAAA,IAAI,eAAe,IAAI;AAC/B;"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const isCustomTypeModel = (model) => {
4
+ return typeof model === "object" && model !== null && "json" in model;
5
+ };
6
+ exports.isCustomTypeModel = isCustomTypeModel;
7
+ //# sourceMappingURL=isCustomTypeModel.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isCustomTypeModel.cjs","sources":["../../../src/lib/isCustomTypeModel.ts"],"sourcesContent":["import type { CustomTypeModel } from \"@prismicio/client\";\n\nexport const isCustomTypeModel = (model: unknown): model is CustomTypeModel => {\n\treturn typeof model === \"object\" && model !== null && \"json\" in model;\n};\n"],"names":[],"mappings":";;AAEa,MAAA,oBAAoB,CAAC,UAA4C;AAC7E,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;;"}
@@ -0,0 +1,2 @@
1
+ import type { CustomTypeModel } from "@prismicio/client";
2
+ export declare const isCustomTypeModel: (model: unknown) => model is CustomTypeModel<string, import("@prismicio/client").CustomTypeModelDefinition<string>>;
@@ -0,0 +1,7 @@
1
+ const isCustomTypeModel = (model) => {
2
+ return typeof model === "object" && model !== null && "json" in model;
3
+ };
4
+ export {
5
+ isCustomTypeModel
6
+ };
7
+ //# sourceMappingURL=isCustomTypeModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isCustomTypeModel.js","sources":["../../../src/lib/isCustomTypeModel.ts"],"sourcesContent":["import type { CustomTypeModel } from \"@prismicio/client\";\n\nexport const isCustomTypeModel = (model: unknown): model is CustomTypeModel => {\n\treturn typeof model === \"object\" && model !== null && \"json\" in model;\n};\n"],"names":[],"mappings":"AAEa,MAAA,oBAAoB,CAAC,UAA4C;AAC7E,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const isCustomTypeModelField = (model) => {
4
+ return typeof model === "object" && model !== null && "type" in model;
5
+ };
6
+ exports.isCustomTypeModelField = isCustomTypeModelField;
7
+ //# sourceMappingURL=isCustomTypeModelField.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isCustomTypeModelField.cjs","sources":["../../../src/lib/isCustomTypeModelField.ts"],"sourcesContent":["import type { CustomTypeModelField } from \"@prismicio/client\";\n\nexport const isCustomTypeModelField = (\n\tmodel: unknown,\n): model is CustomTypeModelField => {\n\treturn typeof model === \"object\" && model !== null && \"type\" in model;\n};\n"],"names":[],"mappings":";;AAEa,MAAA,yBAAyB,CACrC,UACkC;AAClC,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;;"}
@@ -0,0 +1,2 @@
1
+ import type { CustomTypeModelField } from "@prismicio/client";
2
+ export declare const isCustomTypeModelField: (model: unknown) => model is CustomTypeModelField;
@@ -0,0 +1,7 @@
1
+ const isCustomTypeModelField = (model) => {
2
+ return typeof model === "object" && model !== null && "type" in model;
3
+ };
4
+ export {
5
+ isCustomTypeModelField
6
+ };
7
+ //# sourceMappingURL=isCustomTypeModelField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isCustomTypeModelField.js","sources":["../../../src/lib/isCustomTypeModelField.ts"],"sourcesContent":["import type { CustomTypeModelField } from \"@prismicio/client\";\n\nexport const isCustomTypeModelField = (\n\tmodel: unknown,\n): model is CustomTypeModelField => {\n\treturn typeof model === \"object\" && model !== null && \"type\" in model;\n};\n"],"names":[],"mappings":"AAEa,MAAA,yBAAyB,CACrC,UACkC;AAClC,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const prismic = require("@prismicio/client");
4
+ const hasOwnProperty = require("./hasOwnProperty.cjs");
5
+ const isCustomTypeModelSlice = (model) => {
6
+ return typeof model === "object" && model !== null && hasOwnProperty.hasOwnProperty(model, "type") && model.type === prismic.CustomTypeModelSliceType.Slice;
7
+ };
8
+ exports.isCustomTypeModelSlice = isCustomTypeModelSlice;
9
+ //# sourceMappingURL=isCustomTypeModelSlice.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isCustomTypeModelSlice.cjs","sources":["../../../src/lib/isCustomTypeModelSlice.ts"],"sourcesContent":["import {\n\tCustomTypeModelSlice,\n\tCustomTypeModelSliceType,\n} from \"@prismicio/client\";\n\nimport { hasOwnProperty } from \"./hasOwnProperty\";\n\nexport const isCustomTypeModelSlice = (\n\tmodel: unknown,\n): model is CustomTypeModelSlice => {\n\treturn (\n\t\ttypeof model === \"object\" &&\n\t\tmodel !== null &&\n\t\thasOwnProperty(model, \"type\") &&\n\t\tmodel.type === CustomTypeModelSliceType.Slice\n\t);\n};\n"],"names":["hasOwnProperty","CustomTypeModelSliceType"],"mappings":";;;;AAOa,MAAA,yBAAyB,CACrC,UACkC;AAEjC,SAAA,OAAO,UAAU,YACjB,UAAU,QACVA,eAAe,eAAA,OAAO,MAAM,KAC5B,MAAM,SAASC,QAAAA,yBAAyB;AAE1C;;"}
@@ -0,0 +1,2 @@
1
+ import { CustomTypeModelSlice } from "@prismicio/client";
2
+ export declare const isCustomTypeModelSlice: (model: unknown) => model is CustomTypeModelSlice<Record<string, import("@prismicio/client").CustomTypeModelFieldForGroup>, Record<string, import("@prismicio/client").CustomTypeModelFieldForGroup>>;
@@ -0,0 +1,9 @@
1
+ import { CustomTypeModelSliceType } from "@prismicio/client";
2
+ import { hasOwnProperty } from "./hasOwnProperty.js";
3
+ const isCustomTypeModelSlice = (model) => {
4
+ return typeof model === "object" && model !== null && hasOwnProperty(model, "type") && model.type === CustomTypeModelSliceType.Slice;
5
+ };
6
+ export {
7
+ isCustomTypeModelSlice
8
+ };
9
+ //# sourceMappingURL=isCustomTypeModelSlice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isCustomTypeModelSlice.js","sources":["../../../src/lib/isCustomTypeModelSlice.ts"],"sourcesContent":["import {\n\tCustomTypeModelSlice,\n\tCustomTypeModelSliceType,\n} from \"@prismicio/client\";\n\nimport { hasOwnProperty } from \"./hasOwnProperty\";\n\nexport const isCustomTypeModelSlice = (\n\tmodel: unknown,\n): model is CustomTypeModelSlice => {\n\treturn (\n\t\ttypeof model === \"object\" &&\n\t\tmodel !== null &&\n\t\thasOwnProperty(model, \"type\") &&\n\t\tmodel.type === CustomTypeModelSliceType.Slice\n\t);\n};\n"],"names":[],"mappings":";;AAOa,MAAA,yBAAyB,CACrC,UACkC;AAEjC,SAAA,OAAO,UAAU,YACjB,UAAU,QACV,eAAe,OAAO,MAAM,KAC5B,MAAM,SAAS,yBAAyB;AAE1C;"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const prismic = require("@prismicio/client");
4
+ const hasOwnProperty = require("./hasOwnProperty.cjs");
5
+ const isSharedSliceModel = (model) => {
6
+ return typeof model === "object" && model !== null && hasOwnProperty.hasOwnProperty(model, "type") && model.type === prismic.CustomTypeModelSliceType.SharedSlice;
7
+ };
8
+ exports.isSharedSliceModel = isSharedSliceModel;
9
+ //# sourceMappingURL=isSharedSliceModel.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isSharedSliceModel.cjs","sources":["../../../src/lib/isSharedSliceModel.ts"],"sourcesContent":["import { CustomTypeModelSliceType, SharedSliceModel } from \"@prismicio/client\";\n\nimport { hasOwnProperty } from \"./hasOwnProperty\";\n\nexport const isSharedSliceModel = (\n\tmodel: unknown,\n): model is SharedSliceModel => {\n\treturn (\n\t\ttypeof model === \"object\" &&\n\t\tmodel !== null &&\n\t\thasOwnProperty(model, \"type\") &&\n\t\tmodel.type === CustomTypeModelSliceType.SharedSlice\n\t);\n};\n"],"names":["hasOwnProperty","CustomTypeModelSliceType"],"mappings":";;;;AAIa,MAAA,qBAAqB,CACjC,UAC8B;AAE7B,SAAA,OAAO,UAAU,YACjB,UAAU,QACVA,eAAe,eAAA,OAAO,MAAM,KAC5B,MAAM,SAASC,QAAAA,yBAAyB;AAE1C;;"}
@@ -0,0 +1,2 @@
1
+ import { SharedSliceModel } from "@prismicio/client";
2
+ export declare const isSharedSliceModel: (model: unknown) => model is SharedSliceModel<string, import("@prismicio/client").SharedSliceModelVariation<string, Record<string, import("@prismicio/client").CustomTypeModelFieldForGroup>, Record<string, import("@prismicio/client").CustomTypeModelFieldForGroup>>>;
@@ -0,0 +1,9 @@
1
+ import { CustomTypeModelSliceType } from "@prismicio/client";
2
+ import { hasOwnProperty } from "./hasOwnProperty.js";
3
+ const isSharedSliceModel = (model) => {
4
+ return typeof model === "object" && model !== null && hasOwnProperty(model, "type") && model.type === CustomTypeModelSliceType.SharedSlice;
5
+ };
6
+ export {
7
+ isSharedSliceModel
8
+ };
9
+ //# sourceMappingURL=isSharedSliceModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isSharedSliceModel.js","sources":["../../../src/lib/isSharedSliceModel.ts"],"sourcesContent":["import { CustomTypeModelSliceType, SharedSliceModel } from \"@prismicio/client\";\n\nimport { hasOwnProperty } from \"./hasOwnProperty\";\n\nexport const isSharedSliceModel = (\n\tmodel: unknown,\n): model is SharedSliceModel => {\n\treturn (\n\t\ttypeof model === \"object\" &&\n\t\tmodel !== null &&\n\t\thasOwnProperty(model, \"type\") &&\n\t\tmodel.type === CustomTypeModelSliceType.SharedSlice\n\t);\n};\n"],"names":[],"mappings":";;AAIa,MAAA,qBAAqB,CACjC,UAC8B;AAE7B,SAAA,OAAO,UAAU,YACjB,UAAU,QACV,eAAe,OAAO,MAAM,KAC5B,MAAM,SAAS,yBAAyB;AAE1C;"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const pascalCase$1 = require("pascal-case");
4
+ const pascalCase = (input) => pascalCase$1.pascalCase(input, {
5
+ transform: pascalCase$1.pascalCaseTransformMerge
6
+ });
7
+ exports.pascalCase = pascalCase;
8
+ //# sourceMappingURL=pascalCase.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pascalCase.cjs","sources":["../../../src/lib/pascalCase.ts"],"sourcesContent":["import {\n\tpascalCase as pascalCaseBase,\n\tpascalCaseTransformMerge,\n} from \"pascal-case\";\n\nexport const pascalCase = (input: string): string =>\n\tpascalCaseBase(input, {\n\t\ttransform: pascalCaseTransformMerge,\n\t});\n"],"names":["pascalCaseBase","pascalCaseTransformMerge"],"mappings":";;;AAKO,MAAM,aAAa,CAAC,UAC1BA,aAAA,WAAe,OAAO;AAAA,EACrB,WAAWC,aAAA;AACX,CAAA;;"}
@@ -0,0 +1 @@
1
+ export declare const pascalCase: (input: string) => string;
@@ -0,0 +1,8 @@
1
+ import { pascalCase as pascalCase$1, pascalCaseTransformMerge } from "pascal-case";
2
+ const pascalCase = (input) => pascalCase$1(input, {
3
+ transform: pascalCaseTransformMerge
4
+ });
5
+ export {
6
+ pascalCase
7
+ };
8
+ //# sourceMappingURL=pascalCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pascalCase.js","sources":["../../../src/lib/pascalCase.ts"],"sourcesContent":["import {\n\tpascalCase as pascalCaseBase,\n\tpascalCaseTransformMerge,\n} from \"pascal-case\";\n\nexport const pascalCase = (input: string): string =>\n\tpascalCaseBase(input, {\n\t\ttransform: pascalCaseTransformMerge,\n\t});\n"],"names":["pascalCaseBase"],"mappings":";AAKO,MAAM,aAAa,CAAC,UAC1BA,aAAe,OAAO;AAAA,EACrB,WAAW;AACX,CAAA;"}