@slicemachine/adapter-nuxt 0.3.10-dev-next-release.9 → 0.3.10-dev-next-release.11

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 (207) hide show
  1. package/dist/hooks/project-init.cjs +26 -29
  2. package/dist/hooks/project-init.cjs.map +1 -1
  3. package/dist/hooks/project-init.js +26 -28
  4. package/dist/hooks/project-init.js.map +1 -1
  5. package/dist/hooks/slice-create.cjs +28 -46
  6. package/dist/hooks/slice-create.cjs.map +1 -1
  7. package/dist/hooks/slice-create.js +28 -28
  8. package/dist/hooks/slice-create.js.map +1 -1
  9. package/dist/lib/checkHasSrcDirectory.cjs +5 -2
  10. package/dist/lib/checkHasSrcDirectory.cjs.map +1 -1
  11. package/dist/lib/checkHasSrcDirectory.js +5 -2
  12. package/dist/lib/checkHasSrcDirectory.js.map +1 -1
  13. package/dist/lib/checkIsTypeScriptProject.cjs +2 -3
  14. package/dist/lib/checkIsTypeScriptProject.cjs.map +1 -1
  15. package/dist/lib/checkIsTypeScriptProject.js +2 -3
  16. package/dist/lib/checkIsTypeScriptProject.js.map +1 -1
  17. package/dist/lib/getJSFileExtension.cjs +12 -0
  18. package/dist/lib/getJSFileExtension.cjs.map +1 -0
  19. package/dist/lib/getJSFileExtension.d.ts +5 -0
  20. package/dist/lib/getJSFileExtension.js +12 -0
  21. package/dist/lib/getJSFileExtension.js.map +1 -0
  22. package/dist/lib/upsertSliceLibraryIndexFile.cjs +30 -22
  23. package/dist/lib/upsertSliceLibraryIndexFile.cjs.map +1 -1
  24. package/dist/lib/upsertSliceLibraryIndexFile.js +30 -21
  25. package/dist/lib/upsertSliceLibraryIndexFile.js.map +1 -1
  26. package/dist/plugin.cjs +178 -36
  27. package/dist/plugin.cjs.map +1 -1
  28. package/dist/plugin.js +178 -36
  29. package/dist/plugin.js.map +1 -1
  30. package/dist/types.d.ts +22 -0
  31. package/package.json +3 -5
  32. package/src/hooks/project-init.ts +32 -36
  33. package/src/hooks/slice-create.ts +39 -34
  34. package/src/lib/checkHasSrcDirectory.ts +5 -2
  35. package/src/lib/checkIsTypeScriptProject.ts +5 -4
  36. package/src/lib/getJSFileExtension.ts +22 -0
  37. package/src/lib/upsertSliceLibraryIndexFile.ts +55 -36
  38. package/src/plugin.ts +247 -37
  39. package/src/types.ts +25 -0
  40. package/dist/hooks/customType-asset-delete.cjs +0 -31
  41. package/dist/hooks/customType-asset-delete.cjs.map +0 -1
  42. package/dist/hooks/customType-asset-delete.d.ts +0 -3
  43. package/dist/hooks/customType-asset-delete.js +0 -14
  44. package/dist/hooks/customType-asset-delete.js.map +0 -1
  45. package/dist/hooks/customType-asset-read.cjs +0 -34
  46. package/dist/hooks/customType-asset-read.cjs.map +0 -1
  47. package/dist/hooks/customType-asset-read.d.ts +0 -3
  48. package/dist/hooks/customType-asset-read.js +0 -17
  49. package/dist/hooks/customType-asset-read.js.map +0 -1
  50. package/dist/hooks/customType-asset-update.cjs +0 -34
  51. package/dist/hooks/customType-asset-update.cjs.map +0 -1
  52. package/dist/hooks/customType-asset-update.d.ts +0 -3
  53. package/dist/hooks/customType-asset-update.js +0 -16
  54. package/dist/hooks/customType-asset-update.js.map +0 -1
  55. package/dist/hooks/customType-create.cjs +0 -43
  56. package/dist/hooks/customType-create.cjs.map +0 -1
  57. package/dist/hooks/customType-create.d.ts +0 -3
  58. package/dist/hooks/customType-create.js +0 -25
  59. package/dist/hooks/customType-create.js.map +0 -1
  60. package/dist/hooks/customType-delete.cjs +0 -32
  61. package/dist/hooks/customType-delete.cjs.map +0 -1
  62. package/dist/hooks/customType-delete.d.ts +0 -3
  63. package/dist/hooks/customType-delete.js +0 -15
  64. package/dist/hooks/customType-delete.js.map +0 -1
  65. package/dist/hooks/customType-read.cjs +0 -31
  66. package/dist/hooks/customType-read.cjs.map +0 -1
  67. package/dist/hooks/customType-read.d.ts +0 -3
  68. package/dist/hooks/customType-read.js +0 -14
  69. package/dist/hooks/customType-read.js.map +0 -1
  70. package/dist/hooks/customType-rename.cjs +0 -6
  71. package/dist/hooks/customType-rename.cjs.map +0 -1
  72. package/dist/hooks/customType-rename.d.ts +0 -1
  73. package/dist/hooks/customType-rename.js +0 -6
  74. package/dist/hooks/customType-rename.js.map +0 -1
  75. package/dist/hooks/customType-update.cjs +0 -6
  76. package/dist/hooks/customType-update.cjs.map +0 -1
  77. package/dist/hooks/customType-update.d.ts +0 -1
  78. package/dist/hooks/customType-update.js +0 -6
  79. package/dist/hooks/customType-update.js.map +0 -1
  80. package/dist/hooks/customTypeLibrary-read.cjs +0 -55
  81. package/dist/hooks/customTypeLibrary-read.cjs.map +0 -1
  82. package/dist/hooks/customTypeLibrary-read.d.ts +0 -3
  83. package/dist/hooks/customTypeLibrary-read.js +0 -37
  84. package/dist/hooks/customTypeLibrary-read.js.map +0 -1
  85. package/dist/hooks/slice-asset-delete.cjs +0 -33
  86. package/dist/hooks/slice-asset-delete.cjs.map +0 -1
  87. package/dist/hooks/slice-asset-delete.d.ts +0 -3
  88. package/dist/hooks/slice-asset-delete.js +0 -16
  89. package/dist/hooks/slice-asset-delete.js.map +0 -1
  90. package/dist/hooks/slice-asset-read.cjs +0 -36
  91. package/dist/hooks/slice-asset-read.cjs.map +0 -1
  92. package/dist/hooks/slice-asset-read.d.ts +0 -3
  93. package/dist/hooks/slice-asset-read.js +0 -19
  94. package/dist/hooks/slice-asset-read.js.map +0 -1
  95. package/dist/hooks/slice-asset-update.cjs +0 -36
  96. package/dist/hooks/slice-asset-update.cjs.map +0 -1
  97. package/dist/hooks/slice-asset-update.d.ts +0 -3
  98. package/dist/hooks/slice-asset-update.js +0 -18
  99. package/dist/hooks/slice-asset-update.js.map +0 -1
  100. package/dist/hooks/slice-delete.cjs +0 -41
  101. package/dist/hooks/slice-delete.cjs.map +0 -1
  102. package/dist/hooks/slice-delete.d.ts +0 -3
  103. package/dist/hooks/slice-delete.js +0 -24
  104. package/dist/hooks/slice-delete.js.map +0 -1
  105. package/dist/hooks/slice-read.cjs +0 -62
  106. package/dist/hooks/slice-read.cjs.map +0 -1
  107. package/dist/hooks/slice-read.d.ts +0 -3
  108. package/dist/hooks/slice-read.js +0 -44
  109. package/dist/hooks/slice-read.js.map +0 -1
  110. package/dist/hooks/slice-rename.cjs +0 -51
  111. package/dist/hooks/slice-rename.cjs.map +0 -1
  112. package/dist/hooks/slice-rename.d.ts +0 -3
  113. package/dist/hooks/slice-rename.js +0 -34
  114. package/dist/hooks/slice-rename.js.map +0 -1
  115. package/dist/hooks/slice-update.cjs +0 -14
  116. package/dist/hooks/slice-update.cjs.map +0 -1
  117. package/dist/hooks/slice-update.d.ts +0 -3
  118. package/dist/hooks/slice-update.js +0 -14
  119. package/dist/hooks/slice-update.js.map +0 -1
  120. package/dist/hooks/sliceLibrary-read.cjs +0 -52
  121. package/dist/hooks/sliceLibrary-read.cjs.map +0 -1
  122. package/dist/hooks/sliceLibrary-read.d.ts +0 -3
  123. package/dist/hooks/sliceLibrary-read.js +0 -34
  124. package/dist/hooks/sliceLibrary-read.js.map +0 -1
  125. package/dist/lib/buildCustomTypeAssetPath.cjs +0 -29
  126. package/dist/lib/buildCustomTypeAssetPath.cjs.map +0 -1
  127. package/dist/lib/buildCustomTypeAssetPath.d.ts +0 -9
  128. package/dist/lib/buildCustomTypeAssetPath.js +0 -12
  129. package/dist/lib/buildCustomTypeAssetPath.js.map +0 -1
  130. package/dist/lib/buildCustomTypeDirectoryPath.cjs +0 -26
  131. package/dist/lib/buildCustomTypeDirectoryPath.cjs.map +0 -1
  132. package/dist/lib/buildCustomTypeDirectoryPath.d.ts +0 -8
  133. package/dist/lib/buildCustomTypeDirectoryPath.js +0 -9
  134. package/dist/lib/buildCustomTypeDirectoryPath.js.map +0 -1
  135. package/dist/lib/buildCustomTypeLibraryDirectoryPath.cjs +0 -7
  136. package/dist/lib/buildCustomTypeLibraryDirectoryPath.cjs.map +0 -1
  137. package/dist/lib/buildCustomTypeLibraryDirectoryPath.d.ts +0 -7
  138. package/dist/lib/buildCustomTypeLibraryDirectoryPath.js +0 -7
  139. package/dist/lib/buildCustomTypeLibraryDirectoryPath.js.map +0 -1
  140. package/dist/lib/buildSliceAssetPath.cjs +0 -34
  141. package/dist/lib/buildSliceAssetPath.cjs.map +0 -1
  142. package/dist/lib/buildSliceAssetPath.d.ts +0 -11
  143. package/dist/lib/buildSliceAssetPath.js +0 -17
  144. package/dist/lib/buildSliceAssetPath.js.map +0 -1
  145. package/dist/lib/buildSliceDirectoryPath.cjs +0 -30
  146. package/dist/lib/buildSliceDirectoryPath.cjs.map +0 -1
  147. package/dist/lib/buildSliceDirectoryPath.d.ts +0 -10
  148. package/dist/lib/buildSliceDirectoryPath.js +0 -13
  149. package/dist/lib/buildSliceDirectoryPath.js.map +0 -1
  150. package/dist/lib/buildSliceLibraryDirectoryPath.cjs +0 -7
  151. package/dist/lib/buildSliceLibraryDirectoryPath.cjs.map +0 -1
  152. package/dist/lib/buildSliceLibraryDirectoryPath.d.ts +0 -8
  153. package/dist/lib/buildSliceLibraryDirectoryPath.js +0 -7
  154. package/dist/lib/buildSliceLibraryDirectoryPath.js.map +0 -1
  155. package/dist/lib/checkPathExists.cjs +0 -30
  156. package/dist/lib/checkPathExists.cjs.map +0 -1
  157. package/dist/lib/checkPathExists.d.ts +0 -2
  158. package/dist/lib/checkPathExists.js +0 -13
  159. package/dist/lib/checkPathExists.js.map +0 -1
  160. package/dist/lib/isSharedSliceModel.cjs +0 -7
  161. package/dist/lib/isSharedSliceModel.cjs.map +0 -1
  162. package/dist/lib/isSharedSliceModel.d.ts +0 -335
  163. package/dist/lib/isSharedSliceModel.js +0 -7
  164. package/dist/lib/isSharedSliceModel.js.map +0 -1
  165. package/dist/lib/readJSONFile.cjs +0 -26
  166. package/dist/lib/readJSONFile.cjs.map +0 -1
  167. package/dist/lib/readJSONFile.d.ts +0 -1
  168. package/dist/lib/readJSONFile.js +0 -9
  169. package/dist/lib/readJSONFile.js.map +0 -1
  170. package/dist/lib/updateSliceModelFile.cjs +0 -33
  171. package/dist/lib/updateSliceModelFile.cjs.map +0 -1
  172. package/dist/lib/updateSliceModelFile.d.ts +0 -9
  173. package/dist/lib/updateSliceModelFile.js +0 -15
  174. package/dist/lib/updateSliceModelFile.js.map +0 -1
  175. package/dist/lib/upsertGlobalContentTypes.cjs +0 -56
  176. package/dist/lib/upsertGlobalContentTypes.cjs.map +0 -1
  177. package/dist/lib/upsertGlobalContentTypes.d.ts +0 -12
  178. package/dist/lib/upsertGlobalContentTypes.js +0 -38
  179. package/dist/lib/upsertGlobalContentTypes.js.map +0 -1
  180. package/src/hooks/customType-asset-delete.ts +0 -18
  181. package/src/hooks/customType-asset-read.ts +0 -22
  182. package/src/hooks/customType-asset-update.ts +0 -20
  183. package/src/hooks/customType-create.ts +0 -45
  184. package/src/hooks/customType-delete.ts +0 -21
  185. package/src/hooks/customType-read.ts +0 -24
  186. package/src/hooks/customType-rename.ts +0 -3
  187. package/src/hooks/customType-update.ts +0 -3
  188. package/src/hooks/customTypeLibrary-read.ts +0 -58
  189. package/src/hooks/slice-asset-delete.ts +0 -21
  190. package/src/hooks/slice-asset-read.ts +0 -25
  191. package/src/hooks/slice-asset-update.ts +0 -23
  192. package/src/hooks/slice-delete.ts +0 -41
  193. package/src/hooks/slice-read.ts +0 -69
  194. package/src/hooks/slice-rename.ts +0 -46
  195. package/src/hooks/slice-update.ts +0 -19
  196. package/src/hooks/sliceLibrary-read.ts +0 -48
  197. package/src/lib/buildCustomTypeAssetPath.ts +0 -24
  198. package/src/lib/buildCustomTypeDirectoryPath.ts +0 -20
  199. package/src/lib/buildCustomTypeLibraryDirectoryPath.ts +0 -13
  200. package/src/lib/buildSliceAssetPath.ts +0 -32
  201. package/src/lib/buildSliceDirectoryPath.ts +0 -26
  202. package/src/lib/buildSliceLibraryDirectoryPath.ts +0 -14
  203. package/src/lib/checkPathExists.ts +0 -12
  204. package/src/lib/isSharedSliceModel.ts +0 -14
  205. package/src/lib/readJSONFile.ts +0 -7
  206. package/src/lib/updateSliceModelFile.ts +0 -33
  207. package/src/lib/upsertGlobalContentTypes.ts +0 -61
@@ -1 +0,0 @@
1
- {"version":3,"file":"customType-asset-update.js","sources":["../../../src/hooks/customType-asset-update.ts"],"sourcesContent":["import type { CustomTypeAssetUpdateHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeAssetPath } from \"../lib/buildCustomTypeAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeAssetUpdate: CustomTypeAssetUpdateHook<\n\tPluginOptions\n> = async (data, context) => {\n\tconst filePath = buildCustomTypeAssetPath({\n\t\tcustomTypeID: data.customTypeID,\n\t\tassetID: data.asset.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, data.asset.data);\n};\n"],"names":[],"mappings":";;;AAQa,MAAA,wBAET,OAAO,MAAM,YAAW;AAC3B,QAAM,WAAW,yBAAyB;AAAA,IACzC,cAAc,KAAK;AAAA,IACnB,SAAS,KAAK,MAAM;AAAA,IACpB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAA,GAAG,MAAM,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAC1D,QAAM,GAAG,UAAU,UAAU,KAAK,MAAM,IAAI;AAC7C;"}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const fs = require("node:fs/promises");
4
- const path = require("node:path");
5
- const buildCustomTypeDirectoryPath = require("../lib/buildCustomTypeDirectoryPath.cjs");
6
- const upsertGlobalContentTypes = require("../lib/upsertGlobalContentTypes.cjs");
7
- function _interopNamespaceDefault(e) {
8
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
9
- if (e) {
10
- for (const k in e) {
11
- if (k !== "default") {
12
- const d = Object.getOwnPropertyDescriptor(e, k);
13
- Object.defineProperty(n, k, d.get ? d : {
14
- enumerable: true,
15
- get: () => e[k]
16
- });
17
- }
18
- }
19
- }
20
- n.default = e;
21
- return Object.freeze(n);
22
- }
23
- const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
24
- const path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
25
- const createModelFile = async ({ dir, data, helpers, options }) => {
26
- const filePath = path__namespace.join(dir, "index.json");
27
- let contents = JSON.stringify(data.model);
28
- if (options.format) {
29
- contents = await helpers.format(contents, filePath);
30
- }
31
- await fs__namespace.writeFile(filePath, contents);
32
- };
33
- const customTypeCreate = async (data, context) => {
34
- const dir = buildCustomTypeDirectoryPath.buildCustomTypeDirectoryPath({
35
- customTypeID: data.model.id,
36
- helpers: context.helpers
37
- });
38
- await fs__namespace.mkdir(dir, { recursive: true });
39
- await createModelFile({ dir, data, ...context });
40
- await upsertGlobalContentTypes.upsertGlobalContentTypes(context);
41
- };
42
- exports.customTypeCreate = customTypeCreate;
43
- //# sourceMappingURL=customType-create.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customType-create.cjs","sources":["../../../src/hooks/customType-create.ts"],"sourcesContent":["import type {\n\tCustomTypeCreateHook,\n\tCustomTypeCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: CustomTypeCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"index.json\");\n\n\tlet contents = JSON.stringify(data.model);\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const customTypeCreate: CustomTypeCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = buildCustomTypeDirectoryPath({\n\t\tcustomTypeID: data.model.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tawait createModelFile({ dir, data, ...context });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":["path","fs","buildCustomTypeDirectoryPath","upsertGlobalContentTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,kBAAkB,OAAO,EAAE,KAAK,MAAM,SAAS,cAAmB;AACvE,QAAM,WAAWA,gBAAK,KAAK,KAAK,YAAY;AAE5C,MAAI,WAAW,KAAK,UAAU,KAAK,KAAK;AAExC,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAAC,cAAG,UAAU,UAAU,QAAQ;AACtC;AAEa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAMC,6BAAAA,6BAA6B;AAAA,IACxC,cAAc,KAAK,MAAM;AAAA,IACzB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAMD,cAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEvC,QAAM,gBAAgB,EAAE,KAAK,MAAM,GAAG,QAAS,CAAA;AAE/C,QAAME,yBAAAA,yBAAyB,OAAO;AACvC;;"}
@@ -1,3 +0,0 @@
1
- import type { CustomTypeCreateHook } from "@slicemachine/plugin-kit";
2
- import type { PluginOptions } from "../types";
3
- export declare const customTypeCreate: CustomTypeCreateHook<PluginOptions>;
@@ -1,25 +0,0 @@
1
- import * as fs from "node:fs/promises";
2
- import * as path from "node:path";
3
- import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath.js";
4
- import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes.js";
5
- const createModelFile = async ({ dir, data, helpers, options }) => {
6
- const filePath = path.join(dir, "index.json");
7
- let contents = JSON.stringify(data.model);
8
- if (options.format) {
9
- contents = await helpers.format(contents, filePath);
10
- }
11
- await fs.writeFile(filePath, contents);
12
- };
13
- const customTypeCreate = async (data, context) => {
14
- const dir = buildCustomTypeDirectoryPath({
15
- customTypeID: data.model.id,
16
- helpers: context.helpers
17
- });
18
- await fs.mkdir(dir, { recursive: true });
19
- await createModelFile({ dir, data, ...context });
20
- await upsertGlobalContentTypes(context);
21
- };
22
- export {
23
- customTypeCreate
24
- };
25
- //# sourceMappingURL=customType-create.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customType-create.js","sources":["../../../src/hooks/customType-create.ts"],"sourcesContent":["import type {\n\tCustomTypeCreateHook,\n\tCustomTypeCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdir: string;\n\tdata: CustomTypeCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createModelFile = async ({ dir, data, helpers, options }: Args) => {\n\tconst filePath = path.join(dir, \"index.json\");\n\n\tlet contents = JSON.stringify(data.model);\n\n\tif (options.format) {\n\t\tcontents = await helpers.format(contents, filePath);\n\t}\n\n\tawait fs.writeFile(filePath, contents);\n};\n\nexport const customTypeCreate: CustomTypeCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = buildCustomTypeDirectoryPath({\n\t\tcustomTypeID: data.model.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tawait createModelFile({ dir, data, ...context });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":[],"mappings":";;;;AAkBA,MAAM,kBAAkB,OAAO,EAAE,KAAK,MAAM,SAAS,cAAmB;AACvE,QAAM,WAAW,KAAK,KAAK,KAAK,YAAY;AAE5C,MAAI,WAAW,KAAK,UAAU,KAAK,KAAK;AAExC,MAAI,QAAQ,QAAQ;AACnB,eAAW,MAAM,QAAQ,OAAO,UAAU,QAAQ;AAAA,EAClD;AAEK,QAAA,GAAG,UAAU,UAAU,QAAQ;AACtC;AAEa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAM,6BAA6B;AAAA,IACxC,cAAc,KAAK,MAAM;AAAA,IACzB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAM,GAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEvC,QAAM,gBAAgB,EAAE,KAAK,MAAM,GAAG,QAAS,CAAA;AAE/C,QAAM,yBAAyB,OAAO;AACvC;"}
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const fs = require("node:fs/promises");
4
- const buildCustomTypeDirectoryPath = require("../lib/buildCustomTypeDirectoryPath.cjs");
5
- const upsertGlobalContentTypes = require("../lib/upsertGlobalContentTypes.cjs");
6
- function _interopNamespaceDefault(e) {
7
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
8
- if (e) {
9
- for (const k in e) {
10
- if (k !== "default") {
11
- const d = Object.getOwnPropertyDescriptor(e, k);
12
- Object.defineProperty(n, k, d.get ? d : {
13
- enumerable: true,
14
- get: () => e[k]
15
- });
16
- }
17
- }
18
- }
19
- n.default = e;
20
- return Object.freeze(n);
21
- }
22
- const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
23
- const customTypeDelete = async (data, context) => {
24
- const dir = buildCustomTypeDirectoryPath.buildCustomTypeDirectoryPath({
25
- customTypeID: data.model.id,
26
- helpers: context.helpers
27
- });
28
- await fs__namespace.rm(dir, { recursive: true });
29
- await upsertGlobalContentTypes.upsertGlobalContentTypes(context);
30
- };
31
- exports.customTypeDelete = customTypeDelete;
32
- //# sourceMappingURL=customType-delete.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customType-delete.cjs","sources":["../../../src/hooks/customType-delete.ts"],"sourcesContent":["import type { CustomTypeDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeDelete: CustomTypeDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = buildCustomTypeDirectoryPath({\n\t\tcustomTypeID: data.model.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.rm(dir, { recursive: true });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":["buildCustomTypeDirectoryPath","fs","upsertGlobalContentTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAQa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAMA,6BAAAA,6BAA6B;AAAA,IACxC,cAAc,KAAK,MAAM;AAAA,IACzB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAMC,cAAG,GAAG,KAAK,EAAE,WAAW,MAAM;AAEpC,QAAMC,yBAAAA,yBAAyB,OAAO;AACvC;;"}
@@ -1,3 +0,0 @@
1
- import type { CustomTypeDeleteHook } from "@slicemachine/plugin-kit";
2
- import type { PluginOptions } from "../types";
3
- export declare const customTypeDelete: CustomTypeDeleteHook<PluginOptions>;
@@ -1,15 +0,0 @@
1
- import * as fs from "node:fs/promises";
2
- import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath.js";
3
- import { upsertGlobalContentTypes } from "../lib/upsertGlobalContentTypes.js";
4
- const customTypeDelete = async (data, context) => {
5
- const dir = buildCustomTypeDirectoryPath({
6
- customTypeID: data.model.id,
7
- helpers: context.helpers
8
- });
9
- await fs.rm(dir, { recursive: true });
10
- await upsertGlobalContentTypes(context);
11
- };
12
- export {
13
- customTypeDelete
14
- };
15
- //# sourceMappingURL=customType-delete.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customType-delete.js","sources":["../../../src/hooks/customType-delete.ts"],"sourcesContent":["import type { CustomTypeDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { upsertGlobalContentTypes } from \"../lib/upsertGlobalContentTypes\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeDelete: CustomTypeDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst dir = buildCustomTypeDirectoryPath({\n\t\tcustomTypeID: data.model.id,\n\t\thelpers: context.helpers,\n\t});\n\n\tawait fs.rm(dir, { recursive: true });\n\n\tawait upsertGlobalContentTypes(context);\n};\n"],"names":[],"mappings":";;;AAQa,MAAA,mBAAwD,OACpE,MACA,YACG;AACH,QAAM,MAAM,6BAA6B;AAAA,IACxC,cAAc,KAAK,MAAM;AAAA,IACzB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAM,GAAG,GAAG,KAAK,EAAE,WAAW,MAAM;AAEpC,QAAM,yBAAyB,OAAO;AACvC;"}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const path = require("node:path");
4
- const buildCustomTypeDirectoryPath = require("../lib/buildCustomTypeDirectoryPath.cjs");
5
- const readJSONFile = require("../lib/readJSONFile.cjs");
6
- function _interopNamespaceDefault(e) {
7
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
8
- if (e) {
9
- for (const k in e) {
10
- if (k !== "default") {
11
- const d = Object.getOwnPropertyDescriptor(e, k);
12
- Object.defineProperty(n, k, d.get ? d : {
13
- enumerable: true,
14
- get: () => e[k]
15
- });
16
- }
17
- }
18
- }
19
- n.default = e;
20
- return Object.freeze(n);
21
- }
22
- const path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
23
- const customTypeRead = async (data, { helpers }) => {
24
- const filePath = path__namespace.join(buildCustomTypeDirectoryPath.buildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }), "index.json");
25
- const model = await readJSONFile.readJSONFile(filePath);
26
- return {
27
- model
28
- };
29
- };
30
- exports.customTypeRead = customTypeRead;
31
- //# sourceMappingURL=customType-read.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customType-read.cjs","sources":["../../../src/hooks/customType-read.ts"],"sourcesContent":["import type { CustomTypeReadHook } from \"@slicemachine/plugin-kit\";\nimport type { CustomType } from \"@prismicio/types-internal/lib/customtypes\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeRead: CustomTypeReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst filePath = path.join(\n\t\tbuildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }),\n\t\t\"index.json\",\n\t);\n\n\tconst model = await readJSONFile<CustomType>(filePath);\n\n\treturn {\n\t\tmodel,\n\t};\n};\n"],"names":["path","buildCustomTypeDirectoryPath","readJSONFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AASO,MAAM,iBAAoD,OAChE,MACA,EAAE,cACC;AACG,QAAA,WAAWA,gBAAK,KACrBC,6BAA6B,6BAAA,EAAE,cAAc,KAAK,IAAI,SAAS,GAC/D,YAAY;AAGP,QAAA,QAAQ,MAAMC,0BAAyB,QAAQ;AAE9C,SAAA;AAAA,IACN;AAAA,EAAA;AAEF;;"}
@@ -1,3 +0,0 @@
1
- import type { CustomTypeReadHook } from "@slicemachine/plugin-kit";
2
- import type { PluginOptions } from "../types";
3
- export declare const customTypeRead: CustomTypeReadHook<PluginOptions>;
@@ -1,14 +0,0 @@
1
- import * as path from "node:path";
2
- import { buildCustomTypeDirectoryPath } from "../lib/buildCustomTypeDirectoryPath.js";
3
- import { readJSONFile } from "../lib/readJSONFile.js";
4
- const customTypeRead = async (data, { helpers }) => {
5
- const filePath = path.join(buildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }), "index.json");
6
- const model = await readJSONFile(filePath);
7
- return {
8
- model
9
- };
10
- };
11
- export {
12
- customTypeRead
13
- };
14
- //# sourceMappingURL=customType-read.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customType-read.js","sources":["../../../src/hooks/customType-read.ts"],"sourcesContent":["import type { CustomTypeReadHook } from \"@slicemachine/plugin-kit\";\nimport type { CustomType } from \"@prismicio/types-internal/lib/customtypes\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeDirectoryPath } from \"../lib/buildCustomTypeDirectoryPath\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const customTypeRead: CustomTypeReadHook<PluginOptions> = async (\n\tdata,\n\t{ helpers },\n) => {\n\tconst filePath = path.join(\n\t\tbuildCustomTypeDirectoryPath({ customTypeID: data.id, helpers }),\n\t\t\"index.json\",\n\t);\n\n\tconst model = await readJSONFile<CustomType>(filePath);\n\n\treturn {\n\t\tmodel,\n\t};\n};\n"],"names":[],"mappings":";;;AASO,MAAM,iBAAoD,OAChE,MACA,EAAE,cACC;AACG,QAAA,WAAW,KAAK,KACrB,6BAA6B,EAAE,cAAc,KAAK,IAAI,SAAS,GAC/D,YAAY;AAGP,QAAA,QAAQ,MAAM,aAAyB,QAAQ;AAE9C,SAAA;AAAA,IACN;AAAA,EAAA;AAEF;"}
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const customTypeCreate = require("./customType-create.cjs");
4
- const customTypeRename = customTypeCreate.customTypeCreate;
5
- exports.customTypeRename = customTypeRename;
6
- //# sourceMappingURL=customType-rename.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customType-rename.cjs","sources":["../../../src/hooks/customType-rename.ts"],"sourcesContent":["import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeRename = customTypeCreate;\n"],"names":["customTypeCreate"],"mappings":";;;AAEO,MAAM,mBAAmBA,iBAAAA;;"}
@@ -1 +0,0 @@
1
- export declare const customTypeRename: import("@slicemachine/plugin-kit").CustomTypeCreateHook<import("..").PluginOptions>;
@@ -1,6 +0,0 @@
1
- import { customTypeCreate } from "./customType-create.js";
2
- const customTypeRename = customTypeCreate;
3
- export {
4
- customTypeRename
5
- };
6
- //# sourceMappingURL=customType-rename.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customType-rename.js","sources":["../../../src/hooks/customType-rename.ts"],"sourcesContent":["import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeRename = customTypeCreate;\n"],"names":[],"mappings":";AAEO,MAAM,mBAAmB;"}
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const customTypeCreate = require("./customType-create.cjs");
4
- const customTypeUpdate = customTypeCreate.customTypeCreate;
5
- exports.customTypeUpdate = customTypeUpdate;
6
- //# sourceMappingURL=customType-update.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customType-update.cjs","sources":["../../../src/hooks/customType-update.ts"],"sourcesContent":["import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeUpdate = customTypeCreate;\n"],"names":["customTypeCreate"],"mappings":";;;AAEO,MAAM,mBAAmBA,iBAAAA;;"}
@@ -1 +0,0 @@
1
- export declare const customTypeUpdate: import("@slicemachine/plugin-kit").CustomTypeCreateHook<import("..").PluginOptions>;
@@ -1,6 +0,0 @@
1
- import { customTypeCreate } from "./customType-create.js";
2
- const customTypeUpdate = customTypeCreate;
3
- export {
4
- customTypeUpdate
5
- };
6
- //# sourceMappingURL=customType-update.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customType-update.js","sources":["../../../src/hooks/customType-update.ts"],"sourcesContent":["import { customTypeCreate } from \"./customType-create\";\n\nexport const customTypeUpdate = customTypeCreate;\n"],"names":[],"mappings":";AAEO,MAAM,mBAAmB;"}
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const fs = require("node:fs/promises");
4
- const path = require("node:path");
5
- const buildCustomTypeLibraryDirectoryPath = require("../lib/buildCustomTypeLibraryDirectoryPath.cjs");
6
- const readJSONFile = require("../lib/readJSONFile.cjs");
7
- function _interopNamespaceDefault(e) {
8
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
9
- if (e) {
10
- for (const k in e) {
11
- if (k !== "default") {
12
- const d = Object.getOwnPropertyDescriptor(e, k);
13
- Object.defineProperty(n, k, d.get ? d : {
14
- enumerable: true,
15
- get: () => e[k]
16
- });
17
- }
18
- }
19
- }
20
- n.default = e;
21
- return Object.freeze(n);
22
- }
23
- const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
24
- const path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
25
- const isCustomTypeModel = (input) => {
26
- return typeof input === "object" && input !== null && "json" in input;
27
- };
28
- const customTypeLibraryRead = async (_data, { helpers }) => {
29
- const dir = buildCustomTypeLibraryDirectoryPath.buildCustomTypeLibraryDirectoryPath({ helpers });
30
- await fs__namespace.mkdir(dir, { recursive: true });
31
- const childDirs = await fs__namespace.readdir(dir, { withFileTypes: true });
32
- const ids = [];
33
- await Promise.all(childDirs.map(async (childDir) => {
34
- if (childDir.isDirectory()) {
35
- const childDirContents = await fs__namespace.readdir(path__namespace.join(dir, childDir.name), {
36
- withFileTypes: true
37
- });
38
- const isCustomTypeDir = childDirContents.some((entry) => {
39
- return entry.isFile() && entry.name === "index.json";
40
- });
41
- if (isCustomTypeDir) {
42
- const modelPath = path__namespace.join(dir, childDir.name, "index.json");
43
- const modelContents = await readJSONFile.readJSONFile(modelPath);
44
- if (isCustomTypeModel(modelContents)) {
45
- ids.push(modelContents.id);
46
- }
47
- }
48
- }
49
- }));
50
- return {
51
- ids: ids.sort()
52
- };
53
- };
54
- exports.customTypeLibraryRead = customTypeLibraryRead;
55
- //# sourceMappingURL=customTypeLibrary-read.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customTypeLibrary-read.cjs","sources":["../../../src/hooks/customTypeLibrary-read.ts"],"sourcesContent":["import type { CustomTypeLibraryReadHook } from \"@slicemachine/plugin-kit\";\nimport type { CustomType } from \"@prismicio/types-internal/lib/customtypes\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeLibraryDirectoryPath } from \"../lib/buildCustomTypeLibraryDirectoryPath\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst isCustomTypeModel = (\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tinput: any,\n): input is CustomType => {\n\treturn typeof input === \"object\" && input !== null && \"json\" in input;\n};\n\nexport const customTypeLibraryRead: CustomTypeLibraryReadHook<\n\tPluginOptions\n> = async (_data, { helpers }) => {\n\tconst dir = buildCustomTypeLibraryDirectoryPath({ helpers });\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tconst childDirs = await fs.readdir(dir, { withFileTypes: true });\n\n\tconst ids: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tif (childDir.isDirectory()) {\n\t\t\t\tconst childDirContents = await fs.readdir(\n\t\t\t\t\tpath.join(dir, childDir.name),\n\t\t\t\t\t{\n\t\t\t\t\t\twithFileTypes: true,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tconst isCustomTypeDir = childDirContents.some((entry) => {\n\t\t\t\t\treturn entry.isFile() && entry.name === \"index.json\";\n\t\t\t\t});\n\n\t\t\t\tif (isCustomTypeDir) {\n\t\t\t\t\tconst modelPath = path.join(dir, childDir.name, \"index.json\");\n\n\t\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\t\tif (isCustomTypeModel(modelContents)) {\n\t\t\t\t\t\tids.push(modelContents.id);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tids: ids.sort(),\n\t};\n};\n"],"names":["buildCustomTypeLibraryDirectoryPath","fs","path","readJSONFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,oBAAoB,CAEzB,UACwB;AACxB,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;AAEO,MAAM,wBAET,OAAO,OAAO,EAAE,cAAa;AAChC,QAAM,MAAMA,oCAAAA,oCAAoC,EAAE,QAAS,CAAA;AAG3D,QAAMC,cAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEjC,QAAA,YAAY,MAAMA,cAAG,QAAQ,KAAK,EAAE,eAAe,MAAM;AAE/D,QAAM,MAAgB,CAAA;AACtB,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC5B,QAAA,SAAS,eAAe;AACrB,YAAA,mBAAmB,MAAMA,cAAG,QACjCC,gBAAK,KAAK,KAAK,SAAS,IAAI,GAC5B;AAAA,QACC,eAAe;AAAA,MAAA,CACf;AAEF,YAAM,kBAAkB,iBAAiB,KAAK,CAAC,UAAS;AACvD,eAAO,MAAM,OAAA,KAAY,MAAM,SAAS;AAAA,MAAA,CACxC;AAED,UAAI,iBAAiB;AACpB,cAAM,YAAYA,gBAAK,KAAK,KAAK,SAAS,MAAM,YAAY;AAEtD,cAAA,gBAAgB,MAAMC,0BAAa,SAAS;AAE9C,YAAA,kBAAkB,aAAa,GAAG;AACjC,cAAA,KAAK,cAAc,EAAE;AAAA,QACzB;AAAA,MACD;AAAA,IACD;AAAA,EACD,CAAA,CAAC;AAGI,SAAA;AAAA,IACN,KAAK,IAAI,KAAM;AAAA,EAAA;AAEjB;;"}
@@ -1,3 +0,0 @@
1
- import type { CustomTypeLibraryReadHook } from "@slicemachine/plugin-kit";
2
- import type { PluginOptions } from "../types";
3
- export declare const customTypeLibraryRead: CustomTypeLibraryReadHook<PluginOptions>;
@@ -1,37 +0,0 @@
1
- import * as fs from "node:fs/promises";
2
- import * as path from "node:path";
3
- import { buildCustomTypeLibraryDirectoryPath } from "../lib/buildCustomTypeLibraryDirectoryPath.js";
4
- import { readJSONFile } from "../lib/readJSONFile.js";
5
- const isCustomTypeModel = (input) => {
6
- return typeof input === "object" && input !== null && "json" in input;
7
- };
8
- const customTypeLibraryRead = async (_data, { helpers }) => {
9
- const dir = buildCustomTypeLibraryDirectoryPath({ helpers });
10
- await fs.mkdir(dir, { recursive: true });
11
- const childDirs = await fs.readdir(dir, { withFileTypes: true });
12
- const ids = [];
13
- await Promise.all(childDirs.map(async (childDir) => {
14
- if (childDir.isDirectory()) {
15
- const childDirContents = await fs.readdir(path.join(dir, childDir.name), {
16
- withFileTypes: true
17
- });
18
- const isCustomTypeDir = childDirContents.some((entry) => {
19
- return entry.isFile() && entry.name === "index.json";
20
- });
21
- if (isCustomTypeDir) {
22
- const modelPath = path.join(dir, childDir.name, "index.json");
23
- const modelContents = await readJSONFile(modelPath);
24
- if (isCustomTypeModel(modelContents)) {
25
- ids.push(modelContents.id);
26
- }
27
- }
28
- }
29
- }));
30
- return {
31
- ids: ids.sort()
32
- };
33
- };
34
- export {
35
- customTypeLibraryRead
36
- };
37
- //# sourceMappingURL=customTypeLibrary-read.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customTypeLibrary-read.js","sources":["../../../src/hooks/customTypeLibrary-read.ts"],"sourcesContent":["import type { CustomTypeLibraryReadHook } from \"@slicemachine/plugin-kit\";\nimport type { CustomType } from \"@prismicio/types-internal/lib/customtypes\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildCustomTypeLibraryDirectoryPath } from \"../lib/buildCustomTypeLibraryDirectoryPath\";\nimport { readJSONFile } from \"../lib/readJSONFile\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst isCustomTypeModel = (\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tinput: any,\n): input is CustomType => {\n\treturn typeof input === \"object\" && input !== null && \"json\" in input;\n};\n\nexport const customTypeLibraryRead: CustomTypeLibraryReadHook<\n\tPluginOptions\n> = async (_data, { helpers }) => {\n\tconst dir = buildCustomTypeLibraryDirectoryPath({ helpers });\n\n\t// Ensure the directory exists.\n\tawait fs.mkdir(dir, { recursive: true });\n\n\tconst childDirs = await fs.readdir(dir, { withFileTypes: true });\n\n\tconst ids: string[] = [];\n\tawait Promise.all(\n\t\tchildDirs.map(async (childDir) => {\n\t\t\tif (childDir.isDirectory()) {\n\t\t\t\tconst childDirContents = await fs.readdir(\n\t\t\t\t\tpath.join(dir, childDir.name),\n\t\t\t\t\t{\n\t\t\t\t\t\twithFileTypes: true,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tconst isCustomTypeDir = childDirContents.some((entry) => {\n\t\t\t\t\treturn entry.isFile() && entry.name === \"index.json\";\n\t\t\t\t});\n\n\t\t\t\tif (isCustomTypeDir) {\n\t\t\t\t\tconst modelPath = path.join(dir, childDir.name, \"index.json\");\n\n\t\t\t\t\tconst modelContents = await readJSONFile(modelPath);\n\n\t\t\t\t\tif (isCustomTypeModel(modelContents)) {\n\t\t\t\t\t\tids.push(modelContents.id);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t);\n\n\treturn {\n\t\tids: ids.sort(),\n\t};\n};\n"],"names":[],"mappings":";;;;AAUA,MAAM,oBAAoB,CAEzB,UACwB;AACxB,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AACjE;AAEO,MAAM,wBAET,OAAO,OAAO,EAAE,cAAa;AAChC,QAAM,MAAM,oCAAoC,EAAE,QAAS,CAAA;AAG3D,QAAM,GAAG,MAAM,KAAK,EAAE,WAAW,MAAM;AAEjC,QAAA,YAAY,MAAM,GAAG,QAAQ,KAAK,EAAE,eAAe,MAAM;AAE/D,QAAM,MAAgB,CAAA;AACtB,QAAM,QAAQ,IACb,UAAU,IAAI,OAAO,aAAY;AAC5B,QAAA,SAAS,eAAe;AACrB,YAAA,mBAAmB,MAAM,GAAG,QACjC,KAAK,KAAK,KAAK,SAAS,IAAI,GAC5B;AAAA,QACC,eAAe;AAAA,MAAA,CACf;AAEF,YAAM,kBAAkB,iBAAiB,KAAK,CAAC,UAAS;AACvD,eAAO,MAAM,OAAA,KAAY,MAAM,SAAS;AAAA,MAAA,CACxC;AAED,UAAI,iBAAiB;AACpB,cAAM,YAAY,KAAK,KAAK,KAAK,SAAS,MAAM,YAAY;AAEtD,cAAA,gBAAgB,MAAM,aAAa,SAAS;AAE9C,YAAA,kBAAkB,aAAa,GAAG;AACjC,cAAA,KAAK,cAAc,EAAE;AAAA,QACzB;AAAA,MACD;AAAA,IACD;AAAA,EACD,CAAA,CAAC;AAGI,SAAA;AAAA,IACN,KAAK,IAAI,KAAM;AAAA,EAAA;AAEjB;"}
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const fs = require("node:fs/promises");
4
- const buildSliceAssetPath = require("../lib/buildSliceAssetPath.cjs");
5
- function _interopNamespaceDefault(e) {
6
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
7
- if (e) {
8
- for (const k in e) {
9
- if (k !== "default") {
10
- const d = Object.getOwnPropertyDescriptor(e, k);
11
- Object.defineProperty(n, k, d.get ? d : {
12
- enumerable: true,
13
- get: () => e[k]
14
- });
15
- }
16
- }
17
- }
18
- n.default = e;
19
- return Object.freeze(n);
20
- }
21
- const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
22
- const sliceAssetDelete = async (data, context) => {
23
- const filePath = await buildSliceAssetPath.buildSliceAssetPath({
24
- libraryID: data.libraryID,
25
- sliceID: data.sliceID,
26
- assetID: data.assetID,
27
- helpers: context.helpers,
28
- actions: context.actions
29
- });
30
- await fs__namespace.rm(filePath);
31
- };
32
- exports.sliceAssetDelete = sliceAssetDelete;
33
- //# sourceMappingURL=slice-asset-delete.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"slice-asset-delete.cjs","sources":["../../../src/hooks/slice-asset-delete.ts"],"sourcesContent":["import type { SliceAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildSliceAssetPath } from \"../lib/buildSliceAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceAssetDelete: SliceAssetDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst filePath = await buildSliceAssetPath({\n\t\tlibraryID: data.libraryID,\n\t\tsliceID: data.sliceID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t\tactions: context.actions,\n\t});\n\n\tawait fs.rm(filePath);\n};\n"],"names":["buildSliceAssetPath","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOa,MAAA,mBAAwD,OACpE,MACA,YACG;AACG,QAAA,WAAW,MAAMA,wCAAoB;AAAA,IAC1C,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK;AAAA,IACd,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,IACjB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAAC,cAAG,GAAG,QAAQ;AACrB;;"}
@@ -1,3 +0,0 @@
1
- import type { SliceAssetDeleteHook } from "@slicemachine/plugin-kit";
2
- import type { PluginOptions } from "../types";
3
- export declare const sliceAssetDelete: SliceAssetDeleteHook<PluginOptions>;
@@ -1,16 +0,0 @@
1
- import * as fs from "node:fs/promises";
2
- import { buildSliceAssetPath } from "../lib/buildSliceAssetPath.js";
3
- const sliceAssetDelete = async (data, context) => {
4
- const filePath = await buildSliceAssetPath({
5
- libraryID: data.libraryID,
6
- sliceID: data.sliceID,
7
- assetID: data.assetID,
8
- helpers: context.helpers,
9
- actions: context.actions
10
- });
11
- await fs.rm(filePath);
12
- };
13
- export {
14
- sliceAssetDelete
15
- };
16
- //# sourceMappingURL=slice-asset-delete.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"slice-asset-delete.js","sources":["../../../src/hooks/slice-asset-delete.ts"],"sourcesContent":["import type { SliceAssetDeleteHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildSliceAssetPath } from \"../lib/buildSliceAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceAssetDelete: SliceAssetDeleteHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst filePath = await buildSliceAssetPath({\n\t\tlibraryID: data.libraryID,\n\t\tsliceID: data.sliceID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t\tactions: context.actions,\n\t});\n\n\tawait fs.rm(filePath);\n};\n"],"names":[],"mappings":";;AAOa,MAAA,mBAAwD,OACpE,MACA,YACG;AACG,QAAA,WAAW,MAAM,oBAAoB;AAAA,IAC1C,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK;AAAA,IACd,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,IACjB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAA,GAAG,GAAG,QAAQ;AACrB;"}
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const fs = require("node:fs/promises");
4
- const buildSliceAssetPath = require("../lib/buildSliceAssetPath.cjs");
5
- function _interopNamespaceDefault(e) {
6
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
7
- if (e) {
8
- for (const k in e) {
9
- if (k !== "default") {
10
- const d = Object.getOwnPropertyDescriptor(e, k);
11
- Object.defineProperty(n, k, d.get ? d : {
12
- enumerable: true,
13
- get: () => e[k]
14
- });
15
- }
16
- }
17
- }
18
- n.default = e;
19
- return Object.freeze(n);
20
- }
21
- const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
22
- const sliceAssetRead = async (data, context) => {
23
- const filePath = await buildSliceAssetPath.buildSliceAssetPath({
24
- libraryID: data.libraryID,
25
- sliceID: data.sliceID,
26
- assetID: data.assetID,
27
- helpers: context.helpers,
28
- actions: context.actions
29
- });
30
- const assetData = await fs__namespace.readFile(filePath);
31
- return {
32
- data: assetData
33
- };
34
- };
35
- exports.sliceAssetRead = sliceAssetRead;
36
- //# sourceMappingURL=slice-asset-read.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"slice-asset-read.cjs","sources":["../../../src/hooks/slice-asset-read.ts"],"sourcesContent":["import type { SliceAssetReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildSliceAssetPath } from \"../lib/buildSliceAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceAssetRead: SliceAssetReadHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst filePath = await buildSliceAssetPath({\n\t\tlibraryID: data.libraryID,\n\t\tsliceID: data.sliceID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t\tactions: context.actions,\n\t});\n\n\tconst assetData = await fs.readFile(filePath);\n\n\treturn {\n\t\tdata: assetData,\n\t};\n};\n"],"names":["buildSliceAssetPath","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOa,MAAA,iBAAoD,OAChE,MACA,YACG;AACG,QAAA,WAAW,MAAMA,wCAAoB;AAAA,IAC1C,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK;AAAA,IACd,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,IACjB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAM,YAAY,MAAMC,cAAG,SAAS,QAAQ;AAErC,SAAA;AAAA,IACN,MAAM;AAAA,EAAA;AAER;;"}
@@ -1,3 +0,0 @@
1
- import type { SliceAssetReadHook } from "@slicemachine/plugin-kit";
2
- import type { PluginOptions } from "../types";
3
- export declare const sliceAssetRead: SliceAssetReadHook<PluginOptions>;
@@ -1,19 +0,0 @@
1
- import * as fs from "node:fs/promises";
2
- import { buildSliceAssetPath } from "../lib/buildSliceAssetPath.js";
3
- const sliceAssetRead = async (data, context) => {
4
- const filePath = await buildSliceAssetPath({
5
- libraryID: data.libraryID,
6
- sliceID: data.sliceID,
7
- assetID: data.assetID,
8
- helpers: context.helpers,
9
- actions: context.actions
10
- });
11
- const assetData = await fs.readFile(filePath);
12
- return {
13
- data: assetData
14
- };
15
- };
16
- export {
17
- sliceAssetRead
18
- };
19
- //# sourceMappingURL=slice-asset-read.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"slice-asset-read.js","sources":["../../../src/hooks/slice-asset-read.ts"],"sourcesContent":["import type { SliceAssetReadHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\n\nimport { buildSliceAssetPath } from \"../lib/buildSliceAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceAssetRead: SliceAssetReadHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst filePath = await buildSliceAssetPath({\n\t\tlibraryID: data.libraryID,\n\t\tsliceID: data.sliceID,\n\t\tassetID: data.assetID,\n\t\thelpers: context.helpers,\n\t\tactions: context.actions,\n\t});\n\n\tconst assetData = await fs.readFile(filePath);\n\n\treturn {\n\t\tdata: assetData,\n\t};\n};\n"],"names":[],"mappings":";;AAOa,MAAA,iBAAoD,OAChE,MACA,YACG;AACG,QAAA,WAAW,MAAM,oBAAoB;AAAA,IAC1C,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK;AAAA,IACd,SAAS,KAAK;AAAA,IACd,SAAS,QAAQ;AAAA,IACjB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAED,QAAM,YAAY,MAAM,GAAG,SAAS,QAAQ;AAErC,SAAA;AAAA,IACN,MAAM;AAAA,EAAA;AAER;"}
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const fs = require("node:fs/promises");
4
- const path = require("node:path");
5
- const buildSliceAssetPath = require("../lib/buildSliceAssetPath.cjs");
6
- function _interopNamespaceDefault(e) {
7
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
8
- if (e) {
9
- for (const k in e) {
10
- if (k !== "default") {
11
- const d = Object.getOwnPropertyDescriptor(e, k);
12
- Object.defineProperty(n, k, d.get ? d : {
13
- enumerable: true,
14
- get: () => e[k]
15
- });
16
- }
17
- }
18
- }
19
- n.default = e;
20
- return Object.freeze(n);
21
- }
22
- const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
23
- const path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
24
- const sliceAssetUpdate = async (data, context) => {
25
- const filePath = await buildSliceAssetPath.buildSliceAssetPath({
26
- libraryID: data.libraryID,
27
- sliceID: data.sliceID,
28
- assetID: data.asset.id,
29
- helpers: context.helpers,
30
- actions: context.actions
31
- });
32
- await fs__namespace.mkdir(path__namespace.dirname(filePath), { recursive: true });
33
- await fs__namespace.writeFile(filePath, data.asset.data);
34
- };
35
- exports.sliceAssetUpdate = sliceAssetUpdate;
36
- //# sourceMappingURL=slice-asset-update.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"slice-asset-update.cjs","sources":["../../../src/hooks/slice-asset-update.ts"],"sourcesContent":["import type { SliceAssetUpdateHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildSliceAssetPath } from \"../lib/buildSliceAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceAssetUpdate: SliceAssetUpdateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst filePath = await buildSliceAssetPath({\n\t\tlibraryID: data.libraryID,\n\t\tsliceID: data.sliceID,\n\t\tassetID: data.asset.id,\n\t\thelpers: context.helpers,\n\t\tactions: context.actions,\n\t});\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, data.asset.data);\n};\n"],"names":["buildSliceAssetPath","fs","path"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAQa,MAAA,mBAAwD,OACpE,MACA,YACG;AACG,QAAA,WAAW,MAAMA,wCAAoB;AAAA,IAC1C,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK;AAAA,IACd,SAAS,KAAK,MAAM;AAAA,IACpB,SAAS,QAAQ;AAAA,IACjB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAAC,cAAG,MAAMC,gBAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAC1D,QAAMD,cAAG,UAAU,UAAU,KAAK,MAAM,IAAI;AAC7C;;"}
@@ -1,3 +0,0 @@
1
- import type { SliceAssetUpdateHook } from "@slicemachine/plugin-kit";
2
- import type { PluginOptions } from "../types";
3
- export declare const sliceAssetUpdate: SliceAssetUpdateHook<PluginOptions>;
@@ -1,18 +0,0 @@
1
- import * as fs from "node:fs/promises";
2
- import * as path from "node:path";
3
- import { buildSliceAssetPath } from "../lib/buildSliceAssetPath.js";
4
- const sliceAssetUpdate = async (data, context) => {
5
- const filePath = await buildSliceAssetPath({
6
- libraryID: data.libraryID,
7
- sliceID: data.sliceID,
8
- assetID: data.asset.id,
9
- helpers: context.helpers,
10
- actions: context.actions
11
- });
12
- await fs.mkdir(path.dirname(filePath), { recursive: true });
13
- await fs.writeFile(filePath, data.asset.data);
14
- };
15
- export {
16
- sliceAssetUpdate
17
- };
18
- //# sourceMappingURL=slice-asset-update.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"slice-asset-update.js","sources":["../../../src/hooks/slice-asset-update.ts"],"sourcesContent":["import type { SliceAssetUpdateHook } from \"@slicemachine/plugin-kit\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport { buildSliceAssetPath } from \"../lib/buildSliceAssetPath\";\n\nimport type { PluginOptions } from \"../types\";\n\nexport const sliceAssetUpdate: SliceAssetUpdateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\tconst filePath = await buildSliceAssetPath({\n\t\tlibraryID: data.libraryID,\n\t\tsliceID: data.sliceID,\n\t\tassetID: data.asset.id,\n\t\thelpers: context.helpers,\n\t\tactions: context.actions,\n\t});\n\n\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\tawait fs.writeFile(filePath, data.asset.data);\n};\n"],"names":[],"mappings":";;;AAQa,MAAA,mBAAwD,OACpE,MACA,YACG;AACG,QAAA,WAAW,MAAM,oBAAoB;AAAA,IAC1C,WAAW,KAAK;AAAA,IAChB,SAAS,KAAK;AAAA,IACd,SAAS,KAAK,MAAM;AAAA,IACpB,SAAS,QAAQ;AAAA,IACjB,SAAS,QAAQ;AAAA,EAAA,CACjB;AAEK,QAAA,GAAG,MAAM,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAA,CAAM;AAC1D,QAAM,GAAG,UAAU,UAAU,KAAK,MAAM,IAAI;AAC7C;"}