@powerhousedao/shared 6.0.0-staging.4 → 6.0.0

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 (220) hide show
  1. package/README.md +1 -1
  2. package/dist/actions-UH5nIJcP.d.ts +21068 -0
  3. package/dist/actions-UH5nIJcP.d.ts.map +1 -0
  4. package/dist/analytics/index.d.ts +43 -0
  5. package/dist/analytics/index.d.ts.map +1 -0
  6. package/dist/analytics/index.js +308 -0
  7. package/dist/analytics/index.js.map +1 -0
  8. package/dist/clis/args/access-token.d.mts +18 -0
  9. package/dist/clis/args/access-token.d.mts.map +1 -0
  10. package/dist/clis/args/access-token.mjs +22 -0
  11. package/dist/clis/args/access-token.mjs.map +1 -0
  12. package/dist/clis/args/common-DPYlcz-d.mjs +275 -0
  13. package/dist/clis/args/common-DPYlcz-d.mjs.map +1 -0
  14. package/dist/clis/args/common-Dmf4BGPa.d.mts +177 -0
  15. package/dist/clis/args/common-Dmf4BGPa.d.mts.map +1 -0
  16. package/dist/clis/args/common.d.mts +2 -0
  17. package/dist/clis/args/common.mjs +2 -0
  18. package/dist/clis/args/connect.d.mts +204 -0
  19. package/dist/clis/args/connect.d.mts.map +1 -0
  20. package/dist/clis/args/connect.mjs +51 -0
  21. package/dist/clis/args/connect.mjs.map +1 -0
  22. package/dist/clis/args/generate-BJPBa0mK.mjs +153 -0
  23. package/dist/clis/args/generate-BJPBa0mK.mjs.map +1 -0
  24. package/dist/clis/args/generate.d.mts +87 -0
  25. package/dist/clis/args/generate.d.mts.map +1 -0
  26. package/dist/clis/args/generate.mjs +2 -0
  27. package/dist/clis/args/help-CYjFrzIJ.d.mts +193 -0
  28. package/dist/clis/args/help-CYjFrzIJ.d.mts.map +1 -0
  29. package/dist/clis/args/help-rztSuf9S.mjs +152 -0
  30. package/dist/clis/args/help-rztSuf9S.mjs.map +1 -0
  31. package/dist/clis/args/help.d.mts +2 -0
  32. package/dist/clis/args/help.mjs +14 -0
  33. package/dist/clis/args/index.d.mts +19 -0
  34. package/dist/clis/args/index.mjs +19 -0
  35. package/dist/clis/args/init.d.mts +49 -0
  36. package/dist/clis/args/init.d.mts.map +1 -0
  37. package/dist/clis/args/init.mjs +56 -0
  38. package/dist/clis/args/init.mjs.map +1 -0
  39. package/dist/clis/args/inspect.d.mts +15 -0
  40. package/dist/clis/args/inspect.d.mts.map +1 -0
  41. package/dist/clis/args/inspect.mjs +15 -0
  42. package/dist/clis/args/inspect.mjs.map +1 -0
  43. package/dist/clis/args/install.d.mts +40 -0
  44. package/dist/clis/args/install.d.mts.map +1 -0
  45. package/dist/clis/args/install.mjs +32 -0
  46. package/dist/clis/args/install.mjs.map +1 -0
  47. package/dist/clis/args/list.d.mts +12 -0
  48. package/dist/clis/args/list.d.mts.map +1 -0
  49. package/dist/clis/args/list.mjs +7 -0
  50. package/dist/clis/args/list.mjs.map +1 -0
  51. package/dist/clis/args/login.d.mts +27 -0
  52. package/dist/clis/args/login.d.mts.map +1 -0
  53. package/dist/clis/args/login.mjs +40 -0
  54. package/dist/clis/args/login.mjs.map +1 -0
  55. package/dist/clis/args/migrate.d.mts +21 -0
  56. package/dist/clis/args/migrate.d.mts.map +1 -0
  57. package/dist/clis/args/migrate.mjs +29 -0
  58. package/dist/clis/args/migrate.mjs.map +1 -0
  59. package/dist/clis/args/publish.d.mts +18 -0
  60. package/dist/clis/args/publish.d.mts.map +1 -0
  61. package/dist/clis/args/publish.mjs +19 -0
  62. package/dist/clis/args/publish.mjs.map +1 -0
  63. package/dist/clis/args/registry.d.mts +19 -0
  64. package/dist/clis/args/registry.d.mts.map +1 -0
  65. package/dist/clis/args/registry.mjs +23 -0
  66. package/dist/clis/args/registry.mjs.map +1 -0
  67. package/dist/clis/args/service-DVB7CNJn.d.mts +106 -0
  68. package/dist/clis/args/service-DVB7CNJn.d.mts.map +1 -0
  69. package/dist/clis/args/service.d.mts +2 -0
  70. package/dist/clis/args/service.mjs +11 -0
  71. package/dist/clis/args/service.mjs.map +1 -0
  72. package/dist/clis/args/switchboard.d.mts +72 -0
  73. package/dist/clis/args/switchboard.d.mts.map +1 -0
  74. package/dist/clis/args/switchboard.mjs +85 -0
  75. package/dist/clis/args/switchboard.mjs.map +1 -0
  76. package/dist/clis/args/uninstall.d.mts +31 -0
  77. package/dist/clis/args/uninstall.d.mts.map +1 -0
  78. package/dist/clis/args/uninstall.mjs +16 -0
  79. package/dist/clis/args/uninstall.mjs.map +1 -0
  80. package/dist/clis/args/unpublish.d.mts +24 -0
  81. package/dist/clis/args/unpublish.d.mts.map +1 -0
  82. package/dist/clis/args/unpublish.mjs +30 -0
  83. package/dist/clis/args/unpublish.mjs.map +1 -0
  84. package/dist/clis/args/vetra.d.mts +96 -0
  85. package/dist/clis/args/vetra.d.mts.map +1 -0
  86. package/dist/clis/args/vetra.mjs +69 -0
  87. package/dist/clis/args/vetra.mjs.map +1 -0
  88. package/dist/clis/build-config.d.mts +10623 -0
  89. package/dist/clis/build-config.d.mts.map +1 -0
  90. package/dist/clis/build-config.mjs +86 -0
  91. package/dist/clis/build-config.mjs.map +1 -0
  92. package/dist/clis/command-names.d.mts +5 -0
  93. package/dist/clis/command-names.d.mts.map +1 -0
  94. package/dist/clis/command-names.mjs +28 -0
  95. package/dist/clis/command-names.mjs.map +1 -0
  96. package/dist/clis/constants.d.mts +333 -0
  97. package/dist/clis/constants.d.mts.map +1 -0
  98. package/dist/clis/constants.mjs +194 -0
  99. package/dist/clis/constants.mjs.map +1 -0
  100. package/dist/clis/index.d.mts +1538 -0
  101. package/dist/clis/index.d.mts.map +1 -0
  102. package/dist/clis/index.mjs +7464 -0
  103. package/dist/clis/index.mjs.map +1 -0
  104. package/dist/clis/services/telemetry.d.mts +57 -0
  105. package/dist/clis/services/telemetry.d.mts.map +1 -0
  106. package/dist/clis/services/telemetry.mjs +221 -0
  107. package/dist/clis/services/telemetry.mjs.map +1 -0
  108. package/dist/clis/utils.d.mts +19 -0
  109. package/dist/clis/utils.d.mts.map +1 -0
  110. package/dist/clis/utils.mjs +388 -0
  111. package/dist/clis/utils.mjs.map +1 -0
  112. package/dist/connect/index.d.ts +377 -1
  113. package/dist/connect/index.d.ts.map +1 -1
  114. package/dist/connect/index.js +253 -1
  115. package/dist/connect/index.js.map +1 -1
  116. package/dist/constants-xNwF0jSl.d.ts +8 -0
  117. package/dist/constants-xNwF0jSl.d.ts.map +1 -0
  118. package/dist/constants.d.ts +2 -0
  119. package/dist/constants.js +40 -0
  120. package/dist/constants.js.map +1 -0
  121. package/dist/document-drive/index.d.ts +224 -0
  122. package/dist/document-drive/index.d.ts.map +1 -0
  123. package/dist/document-drive/index.js +963 -0
  124. package/dist/document-drive/index.js.map +1 -0
  125. package/dist/document-model/index.d.ts +5 -5
  126. package/dist/document-model/index.js +3465 -2
  127. package/dist/document-model/index.js.map +1 -1
  128. package/dist/document-model/mock.d.ts +2 -0
  129. package/dist/document-model/mock.js +9 -0
  130. package/dist/document-model/mock.js.map +1 -0
  131. package/dist/document-model/utils.d.ts +3 -0
  132. package/dist/document-model/utils.js +3 -0
  133. package/dist/index-C_iVZe7f.d.ts +7 -0
  134. package/dist/index-C_iVZe7f.d.ts.map +1 -0
  135. package/dist/index-DhPr5zSB.d.ts +306 -0
  136. package/dist/index-DhPr5zSB.d.ts.map +1 -0
  137. package/dist/index.d.ts +6 -0
  138. package/dist/index.js +14 -0
  139. package/dist/index.js.map +1 -0
  140. package/dist/mock-Cgn-VBF_.d.ts +7 -0
  141. package/dist/mock-Cgn-VBF_.d.ts.map +1 -0
  142. package/dist/processors/index.d.ts +2 -5
  143. package/dist/processors/index.js +116 -3
  144. package/dist/processors/index.js.map +1 -1
  145. package/dist/registry/index.d.ts +80 -0
  146. package/dist/registry/index.d.ts.map +1 -0
  147. package/dist/registry/index.js +157 -0
  148. package/dist/registry/index.js.map +1 -0
  149. package/dist/types-BFDlQkXZ.d.ts +158 -0
  150. package/dist/types-BFDlQkXZ.d.ts.map +1 -0
  151. package/dist/types-WzwAClp2.d.ts +410 -0
  152. package/dist/types-WzwAClp2.d.ts.map +1 -0
  153. package/dist/utils-CJF4w5Bp.d.ts +9 -0
  154. package/dist/utils-CJF4w5Bp.d.ts.map +1 -0
  155. package/dist/utils-bCWnsmtD.js +70 -0
  156. package/dist/utils-bCWnsmtD.js.map +1 -0
  157. package/package.json +105 -17
  158. package/dist/connect/env-config.d.ts +0 -844
  159. package/dist/connect/env-config.d.ts.map +0 -1
  160. package/dist/connect/env-config.js +0 -518
  161. package/dist/connect/env-config.js.map +0 -1
  162. package/dist/document-model/core/actions.d.ts +0 -62
  163. package/dist/document-model/core/actions.d.ts.map +0 -1
  164. package/dist/document-model/core/actions.js +0 -2
  165. package/dist/document-model/core/actions.js.map +0 -1
  166. package/dist/document-model/core/constants.d.ts +0 -6
  167. package/dist/document-model/core/constants.d.ts.map +0 -1
  168. package/dist/document-model/core/constants.js +0 -8
  169. package/dist/document-model/core/constants.js.map +0 -1
  170. package/dist/document-model/core/documents.d.ts +0 -102
  171. package/dist/document-model/core/documents.d.ts.map +0 -1
  172. package/dist/document-model/core/documents.js +0 -2
  173. package/dist/document-model/core/documents.js.map +0 -1
  174. package/dist/document-model/core/operations.d.ts +0 -74
  175. package/dist/document-model/core/operations.d.ts.map +0 -1
  176. package/dist/document-model/core/operations.js +0 -2
  177. package/dist/document-model/core/operations.js.map +0 -1
  178. package/dist/document-model/core/ph-types.d.ts +0 -7
  179. package/dist/document-model/core/ph-types.d.ts.map +0 -1
  180. package/dist/document-model/core/ph-types.js +0 -2
  181. package/dist/document-model/core/ph-types.js.map +0 -1
  182. package/dist/document-model/core/signatures.d.ts +0 -52
  183. package/dist/document-model/core/signatures.d.ts.map +0 -1
  184. package/dist/document-model/core/signatures.js +0 -2
  185. package/dist/document-model/core/signatures.js.map +0 -1
  186. package/dist/document-model/core/state.d.ts +0 -38
  187. package/dist/document-model/core/state.d.ts.map +0 -1
  188. package/dist/document-model/core/state.js +0 -2
  189. package/dist/document-model/core/state.js.map +0 -1
  190. package/dist/document-model/core/types.d.ts +0 -533
  191. package/dist/document-model/core/types.d.ts.map +0 -1
  192. package/dist/document-model/core/types.js +0 -2
  193. package/dist/document-model/core/types.js.map +0 -1
  194. package/dist/document-model/core/upgrades.d.ts +0 -24
  195. package/dist/document-model/core/upgrades.d.ts.map +0 -1
  196. package/dist/document-model/core/upgrades.js +0 -2
  197. package/dist/document-model/core/upgrades.js.map +0 -1
  198. package/dist/document-model/index.d.ts.map +0 -1
  199. package/dist/document-model/types.d.ts +0 -97
  200. package/dist/document-model/types.d.ts.map +0 -1
  201. package/dist/document-model/types.js +0 -2
  202. package/dist/document-model/types.js.map +0 -1
  203. package/dist/processors/constants.d.ts +0 -4
  204. package/dist/processors/constants.d.ts.map +0 -1
  205. package/dist/processors/constants.js +0 -4
  206. package/dist/processors/constants.js.map +0 -1
  207. package/dist/processors/index.d.ts.map +0 -1
  208. package/dist/processors/relational/types.d.ts +0 -72
  209. package/dist/processors/relational/types.d.ts.map +0 -1
  210. package/dist/processors/relational/types.js +0 -45
  211. package/dist/processors/relational/types.js.map +0 -1
  212. package/dist/processors/relational/utils.d.ts +0 -29
  213. package/dist/processors/relational/utils.d.ts.map +0 -1
  214. package/dist/processors/relational/utils.js +0 -67
  215. package/dist/processors/relational/utils.js.map +0 -1
  216. package/dist/processors/types.d.ts +0 -76
  217. package/dist/processors/types.d.ts.map +0 -1
  218. package/dist/processors/types.js +0 -2
  219. package/dist/processors/types.js.map +0 -1
  220. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,2 @@
1
+ import { t as generateMock } from "../mock-Cgn-VBF_.js";
2
+ export { generateMock };
@@ -0,0 +1,9 @@
1
+ import { zocker } from "zocker";
2
+ //#region document-model/mock.ts
3
+ function generateMock(schema) {
4
+ return zocker(schema).generate();
5
+ }
6
+ //#endregion
7
+ export { generateMock };
8
+
9
+ //# sourceMappingURL=mock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock.js","names":[],"sources":["../../document-model/mock.ts"],"sourcesContent":["import { zocker } from \"zocker\";\nimport type { z } from \"zod\";\n\nexport function generateMock<TSchema extends z.ZodType>(\n schema: TSchema,\n): z.infer<TSchema> {\n return zocker(schema).generate() as z.infer<TSchema>;\n}\n"],"mappings":";;AAGA,SAAgB,aACd,QACkB;AAClB,QAAO,OAAO,OAAO,CAAC,UAAU"}
@@ -0,0 +1,3 @@
1
+ import { t as generateMock } from "../mock-Cgn-VBF_.js";
2
+ import { n as generateId, t as deriveOperationId } from "../utils-CJF4w5Bp.js";
3
+ export { deriveOperationId, generateId, generateMock };
@@ -0,0 +1,3 @@
1
+ import { n as generateId, t as deriveOperationId } from "../utils-bCWnsmtD.js";
2
+ import { generateMock } from "./mock.js";
3
+ export { deriveOperationId, generateId, generateMock };
@@ -0,0 +1,7 @@
1
+ //#region git.d.ts
2
+ declare const GITHUB_REPO_URL = "https://github.com/powerhouse-inc/powerhouse";
3
+ declare function buildTreeUrl(sha: string): string | null;
4
+ declare function shortGitSha(sha: string): string;
5
+ //#endregion
6
+ export { buildTreeUrl as n, shortGitSha as r, GITHUB_REPO_URL as t };
7
+ //# sourceMappingURL=index-C_iVZe7f.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-C_iVZe7f.d.ts","names":[],"sources":["../git.ts"],"mappings":";cAAa,eAAA;AAAA,iBAEG,YAAA,CAAa,GAAA;AAAA,iBAKb,WAAA,CAAY,GAAA"}
@@ -0,0 +1,306 @@
1
+ import { Ai as ModuleSpecification, An as ActionSignatureContext, Br as DocumentModelOperationErrorOperations, Dr as DocumentModelDocument, Ha as Reducer, Hr as DocumentModelOperationExampleOperations, Ia as PruneActionInput, Kr as DocumentModelStateOperations, Lr as DocumentModelModuleOperations, Pr as DocumentModelLocalState, Ss as StateReducer, Ua as ReducerOptions, Ur as DocumentModelOperationOperations, Wr as DocumentModelPHState, Xn as Author, Yr as DocumentModelVersioningOperations, Zr as DocumentSpecification, an as Operation, ao as ReplayDocumentOptions, bs as SkipHeaderOperations, bt as PHDocumentHeader, co as SaveToFileHandle, fi as ISigner, hn as PHBaseState, in as DocumentOperations, jr as DocumentModelHeaderOperations, ka as OperationSpecification, ki as MinimalBackupData, kr as DocumentModelGlobalState, on as OperationContext, ps as SignalDispatch, ri as FileInput, t as Action, vi as LoadFromInput, vs as SigningParameters, yt as PHDocument, zs as ValidationError } from "./actions-UH5nIJcP.js";
2
+ import { ZodIssue, z } from "zod";
3
+
4
+ //#region document-model/constants.d.ts
5
+ declare const documentModelFileExtension: "phdm";
6
+ declare const documentModelInitialLocalState: DocumentModelLocalState;
7
+ declare const documentModelInitialGlobalState: DocumentModelGlobalState;
8
+ declare const documentModelGlobalState: DocumentModelGlobalState;
9
+ declare const HASH_ALGORITHM_SHA1 = "sha1";
10
+ declare const HASH_ALGORITHM_SHA256 = "sha256";
11
+ declare const HASH_ALGORITHM_SHA512 = "sha512";
12
+ declare const HASH_ENCODING_BASE64 = "base64";
13
+ declare const HASH_ENCODING_HEX = "hex";
14
+ //#endregion
15
+ //#region document-model/crypto.d.ts
16
+ declare const hashBrowser: (data: string | Uint8Array | ArrayBufferView | DataView, algorithm?: string, encoding?: string, _params?: Record<string, unknown>) => string;
17
+ declare function getUnixTimestamp(date: Date | string): string;
18
+ declare function buildOperationSignatureParams({
19
+ documentId,
20
+ signer,
21
+ action,
22
+ previousStateHash
23
+ }: ActionSignatureContext): [string, string, string, string];
24
+ declare function buildOperationSignatureMessage(params: [string, string, string, string]): Uint8Array;
25
+ declare function ab2hex(ab: ArrayBuffer | ArrayBufferView): string;
26
+ declare function hex2ab(hex: string): Uint8Array<ArrayBuffer>;
27
+ //#endregion
28
+ //#region document-model/document-schema.d.ts
29
+ declare const BaseDocumentHeaderSchema: z.ZodObject<{
30
+ id: z.ZodString;
31
+ name: z.ZodString;
32
+ createdAtUtcIso: z.ZodString;
33
+ lastModifiedAtUtcIso: z.ZodString;
34
+ documentType: z.ZodString;
35
+ }, z.core.$strip>;
36
+ declare const BaseDocumentStateSchema: z.ZodObject<{
37
+ global: z.ZodUnknown;
38
+ }, z.core.$strip>;
39
+ /** Schema for validating the header object of a DocumentModel document */
40
+ declare const DocumentModelHeaderSchema: z.ZodObject<{
41
+ id: z.ZodString;
42
+ name: z.ZodString;
43
+ createdAtUtcIso: z.ZodString;
44
+ lastModifiedAtUtcIso: z.ZodString;
45
+ documentType: z.ZodLiteral<"powerhouse/document-model">;
46
+ }, z.core.$strip>;
47
+ /** Schema for validating the state object of a DocumentModel document */
48
+ declare const DocumentModelPHStateSchema: z.ZodObject<{
49
+ global: z.ZodObject<Required<{
50
+ author: z.ZodType<Author, Author, z.core.$ZodTypeInternals<Author, Author>>;
51
+ description: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
52
+ extension: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
53
+ id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
54
+ name: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
55
+ specifications: z.ZodType<DocumentSpecification[], DocumentSpecification[], z.core.$ZodTypeInternals<DocumentSpecification[], DocumentSpecification[]>>;
56
+ }>, z.core.$strip>;
57
+ }, z.core.$strip>;
58
+ declare const DocumentModelSchema: z.ZodObject<{
59
+ header: z.ZodObject<{
60
+ id: z.ZodString;
61
+ name: z.ZodString;
62
+ createdAtUtcIso: z.ZodString;
63
+ lastModifiedAtUtcIso: z.ZodString;
64
+ documentType: z.ZodLiteral<"powerhouse/document-model">;
65
+ }, z.core.$strip>;
66
+ state: z.ZodObject<{
67
+ global: z.ZodObject<Required<{
68
+ author: z.ZodType<Author, Author, z.core.$ZodTypeInternals<Author, Author>>;
69
+ description: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
70
+ extension: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
71
+ id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
72
+ name: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
73
+ specifications: z.ZodType<DocumentSpecification[], DocumentSpecification[], z.core.$ZodTypeInternals<DocumentSpecification[], DocumentSpecification[]>>;
74
+ }>, z.core.$strip>;
75
+ }, z.core.$strip>;
76
+ initialState: z.ZodObject<{
77
+ global: z.ZodObject<Required<{
78
+ author: z.ZodType<Author, Author, z.core.$ZodTypeInternals<Author, Author>>;
79
+ description: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
80
+ extension: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
81
+ id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
82
+ name: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
83
+ specifications: z.ZodType<DocumentSpecification[], DocumentSpecification[], z.core.$ZodTypeInternals<DocumentSpecification[], DocumentSpecification[]>>;
84
+ }>, z.core.$strip>;
85
+ }, z.core.$strip>;
86
+ }, z.core.$strip>;
87
+ /** Simple helper function to check if a state object is a DocumentModel document state object */
88
+ declare function isDocumentModelState(state: unknown): state is DocumentModelPHState;
89
+ /** Simple helper function to assert that a document state object is a DocumentModel document state object */
90
+ declare function assertIsDocumentModelState(state: unknown): asserts state is DocumentModelPHState;
91
+ /** Simple helper function to check if a document is a DocumentModel document */
92
+ declare function isDocumentModelDocument(document: unknown): document is DocumentModelDocument;
93
+ /** Simple helper function to assert that a document is a DocumentModel document */
94
+ declare function assertIsDocumentModelDocument(document: unknown): asserts document is DocumentModelDocument;
95
+ //#endregion
96
+ //#region document-model/document-type.d.ts
97
+ declare const documentModelDocumentType = "powerhouse/document-model";
98
+ //#endregion
99
+ //#region document-model/errors.d.ts
100
+ declare const FileSystemError: Error;
101
+ declare class InvalidActionInputError extends Error {
102
+ data: unknown;
103
+ constructor(data: unknown);
104
+ }
105
+ declare class InvalidActionInputZodError extends InvalidActionInputError {
106
+ issues: ZodIssue[];
107
+ constructor(issues: ZodIssue[]);
108
+ }
109
+ declare class HashMismatchError extends Error {
110
+ protected _scope: string;
111
+ protected _document: PHDocument;
112
+ protected _operation: Operation;
113
+ constructor(scope: string, document: PHDocument, operation: Operation);
114
+ get document(): PHDocument;
115
+ get scope(): string;
116
+ get operation(): Operation;
117
+ }
118
+ //#endregion
119
+ //#region document-model/files.d.ts
120
+ declare function createZip(document: PHDocument): Promise<Uint8Array>;
121
+ /**
122
+ * Creates a minimal ZIP backup from strand data.
123
+ * Used when the full document is not available (e.g., in onOperations handler).
124
+ * Creates a ZIP with minimal header and empty operations.
125
+ */
126
+ declare function createMinimalZip(data: MinimalBackupData): Promise<Uint8Array>;
127
+ declare function baseSaveToFileHandle(document: PHDocument, input: FileSystemFileHandle): Promise<void>;
128
+ declare function baseLoadFromInput<TState extends PHBaseState>(input: FileInput, reducer: Reducer<TState>, options?: ReplayDocumentOptions): Promise<PHDocument<TState>>;
129
+ declare const documentModelLoadFromInput: LoadFromInput<DocumentModelPHState>;
130
+ declare const documentModelSaveToFileHandle: SaveToFileHandle;
131
+ declare function writeFileBrowser(path: string, name: string, stream: Uint8Array): Promise<string>;
132
+ declare function readFileBrowser(path: string): void;
133
+ declare function fetchFileBrowser(url: string): Promise<{
134
+ data: Buffer;
135
+ mimeType?: string;
136
+ }>;
137
+ declare const getFileBrowser: (file: string) => Promise<void>;
138
+ //#endregion
139
+ //#region document-model/header.d.ts
140
+ /**
141
+ * Creates a verification-only signer from a public key.
142
+ * This signer can only verify signatures, not sign data.
143
+ *
144
+ * @param pubKey - The public key to use for verification.
145
+ * @returns An ISigner that can only verify signatures.
146
+ */
147
+ declare function createVerificationSigner(pubKey: JsonWebKey): Promise<ISigner>;
148
+ /**
149
+ * Signs a header. Generally, this is not called directly, but rather through
150
+ * {@link createSignedHeader}.
151
+ *
152
+ * @param parameters - The parameters used to sign the header.
153
+ * @param signer - The signer of the document.
154
+ *
155
+ * @returns The signature of the header.
156
+ */
157
+ declare const sign: (parameters: SigningParameters, signer: ISigner) => Promise<string>;
158
+ /**
159
+ * Verifies a header signature. Generally, this is not called directly, but
160
+ * rather through {@link validateHeader}.
161
+ *
162
+ * @param parameters - The parameters used to sign the header.
163
+ * @param signature - The signature to verify.
164
+ * @param signer - The signer of the document.
165
+ */
166
+ declare const verify: (parameters: SigningParameters, signature: string, signer: ISigner) => Promise<void>;
167
+ /**
168
+ * Validates a header signature.
169
+ */
170
+ declare const validateHeader: (header: PHDocumentHeader) => Promise<void>;
171
+ /**
172
+ * Creates a header that has yet to be signed. This header is not valid, but
173
+ * can be input into {@link createSignedHeader} to create a signed header.
174
+ *
175
+ * @returns An unsigned header for a document.
176
+ */
177
+ declare const createPresignedHeader: (id?: string, documentType?: string) => PHDocumentHeader;
178
+ /**
179
+ * Creates a new, signed header for a document. This will replace the id of the
180
+ * document.
181
+ *
182
+ * @param unsignedHeader - The unsigned header to created the signed header from.
183
+ * @param signer - The signer of the document.
184
+ *
185
+ * @returns A new signed header for a document. Some fields are mutable and
186
+ * some are not. See the PHDocumentHeader type for more information.
187
+ */
188
+ declare const createSignedHeader: (unsignedHeader: PHDocumentHeader, documentType: string, signer: ISigner) => Promise<PHDocumentHeader>;
189
+ /**
190
+ * Creates a signed header for a document. The document header requires a signer
191
+ * as the document id is a cryptographic signature.
192
+ *
193
+ * @param documentType - The type of the document.
194
+ * @param signer - The signer of the document.
195
+ *
196
+ * @returns The signed header for a document. Some fields are mutable and
197
+ * some are not. See the PHDocumentHeader type for more information.
198
+ */
199
+ declare const createSignedHeaderForSigner: (documentType: string, signer: ISigner) => Promise<PHDocumentHeader>;
200
+ //#endregion
201
+ //#region document-model/reducer.d.ts
202
+ declare function replayOperations<TState extends PHBaseState = PHBaseState>(initialState: TState, clearedOperations: DocumentOperations, stateReducer: StateReducer<TState>, header: PHDocumentHeader, dispatch?: SignalDispatch, documentReducer?: typeof baseReducer, skipHeaderOperations?: SkipHeaderOperations, options?: ReplayDocumentOptions): PHDocument<TState>;
203
+ /**
204
+ * Updates the document state based on the provided action.
205
+ *
206
+ * @param state The current state of the document.
207
+ * @param action The action being applied to the document.
208
+ * @param skip The number of operations to skip before applying the action.
209
+ * @param reuseLastOperationIndex Whether to reuse the last operation index (used when a an UNDO operation is performed after an existing one).
210
+ * @param context The operation context for deterministic ID generation.
211
+ * @returns The updated document state.
212
+ */
213
+ declare function updateDocument<TDocument extends PHDocument>(document: TDocument, action: Action, reuseLastOperationIndex: boolean, skip: number, context: OperationContext, operation?: Operation, skipIndexValidation?: boolean): TDocument;
214
+ /**
215
+ * Processes an UNDO or REDO action.
216
+ *
217
+ * @param document The current state of the document.
218
+ * @param action The action being applied to the document.
219
+ * @param skip The number of operations to skip before applying the action.
220
+ * @returns The updated document, calculated skip value and transformed action (if applied).
221
+ */
222
+ declare function processUndoRedo<TState extends PHBaseState = PHBaseState>(document: PHDocument<TState>, action: Action, skip: number, protocolVersion?: number): {
223
+ document: PHDocument<TState>;
224
+ action: Action;
225
+ skip: number;
226
+ reuseLastOperationIndex: boolean;
227
+ };
228
+ /**
229
+ * Base document reducer that wraps a custom document reducer and handles
230
+ * document-level actions such as undo, redo, prune, and set name.
231
+ *
232
+ * @template TGlobalState - The type of the state of the custom reducer.
233
+ * @template TAction - The type of the actions of the custom reducer.
234
+ * @param state - The current state of the document.
235
+ * @param action - The action object to apply to the state.
236
+ * @param customReducer - The custom reducer that implements the application logic
237
+ * specific to the document's state.
238
+ * @returns The new state of the document.
239
+ */
240
+ declare function baseReducer<TState extends PHBaseState = PHBaseState>(document: PHDocument<TState>, action: Action, customReducer: StateReducer<TState>, dispatch?: SignalDispatch, options?: ReducerOptions): PHDocument<TState>;
241
+ /**
242
+ * Helper function to create a document model reducer.
243
+ *
244
+ * @remarks
245
+ * This function creates a new reducer that wraps the provided `reducer` with
246
+ * `documentReducer`, adding support for document actions:
247
+ * - `SET_NAME`
248
+ * - `UNDO`
249
+ * - `REDO`
250
+ * - `PRUNE`
251
+ *
252
+ * It also updates the document-related attributes on every operation.
253
+ *
254
+ * @param reducer - The custom reducer to wrap.
255
+ * @param documentReducer - The document reducer to use.
256
+ *
257
+ * @returns The new reducer.
258
+ */
259
+ declare function createReducer<TState extends PHBaseState = PHBaseState>(stateReducer: StateReducer<TState>, documentReducer?: typeof baseReducer): Reducer<TState>;
260
+ declare function pruneOperation<TState extends PHBaseState = PHBaseState>(document: PHDocument<TState>, input: PruneActionInput, wrappedReducer: StateReducer<TState>): PHDocument<TState>;
261
+ //#endregion
262
+ //#region document-model/reducers.d.ts
263
+ declare const documentModelHeaderReducer: DocumentModelHeaderOperations;
264
+ declare const documentModelModuleReducer: DocumentModelModuleOperations;
265
+ declare const documentModelOperationErrorReducer: DocumentModelOperationErrorOperations;
266
+ declare const documentModelOperationExampleReducer: DocumentModelOperationExampleOperations;
267
+ declare const documentModelOperationReducer: DocumentModelOperationOperations;
268
+ declare const documentModelStateSchemaReducer: DocumentModelStateOperations;
269
+ declare const documentModelVersioningReducer: DocumentModelVersioningOperations;
270
+ declare const documentModelStateReducer: StateReducer<DocumentModelPHState>;
271
+ declare const documentModelReducer: Reducer<DocumentModelPHState>;
272
+ //#endregion
273
+ //#region document-model/validation.d.ts
274
+ /**
275
+ * Reserved operation names from base reducer (core/actions.ts).
276
+ * These names cannot be used for custom operations.
277
+ */
278
+ declare const RESERVED_OPERATION_NAMES: readonly ["UNDO", "REDO", "PRUNE", "LOAD_STATE", "SET_NAME", "SET_PREFERRED_EDITOR", "NOOP"];
279
+ type ReservedOperationName = (typeof RESERVED_OPERATION_NAMES)[number];
280
+ /**
281
+ * Check if name conflicts with base reducer actions (case-insensitive).
282
+ */
283
+ declare function isReservedOperationName(name: string): boolean;
284
+ /**
285
+ * Get all operation names from all modules in the latest specification.
286
+ * Returns names in uppercase for case-insensitive comparison.
287
+ */
288
+ declare function getAllOperationNames(state: DocumentModelGlobalState, excludeOperationId?: string): string[];
289
+ /**
290
+ * Validate operation name is not reserved or duplicate. Throws on failure.
291
+ *
292
+ * @param name - The operation name to validate
293
+ * @param state - The document model global state
294
+ * @param excludeOperationId - Optional operation ID to exclude (for rename validation)
295
+ * @throws Error if the name is reserved or a duplicate
296
+ */
297
+ declare function validateOperationName(name: string, state: DocumentModelGlobalState, excludeOperationId?: string): void;
298
+ declare function validateInitialState(initialState: string, allowEmptyState?: boolean): ValidationError[];
299
+ declare function validateStateSchemaName(schema: string, documentName: string, scope?: string, allowEmptySchema?: boolean): ValidationError[];
300
+ declare function validateModules(modules: ModuleSpecification[]): ValidationError[];
301
+ declare function validateModule(mod: ModuleSpecification): ValidationError[];
302
+ declare function validateModuleOperation(operation: OperationSpecification): ValidationError[];
303
+ declare function validateOperations(operations: DocumentOperations): ValidationError[];
304
+ //#endregion
305
+ export { DocumentModelSchema as $, createVerificationSigner as A, fetchFileBrowser as B, processUndoRedo as C, createPresignedHeader as D, updateDocument as E, baseSaveToFileHandle as F, HashMismatchError as G, readFileBrowser as H, createMinimalZip as I, documentModelDocumentType as J, InvalidActionInputError as K, createZip as L, validateHeader as M, verify as N, createSignedHeader as O, baseLoadFromInput as P, DocumentModelPHStateSchema as Q, documentModelLoadFromInput as R, createReducer as S, replayOperations as T, writeFileBrowser as U, getFileBrowser as V, FileSystemError as W, BaseDocumentStateSchema as X, BaseDocumentHeaderSchema as Y, DocumentModelHeaderSchema as Z, documentModelReducer as _, documentModelInitialGlobalState as _t, validateInitialState as a, buildOperationSignatureMessage as at, documentModelVersioningReducer as b, validateModules as c, hashBrowser as ct, validateStateSchemaName as d, HASH_ALGORITHM_SHA256 as dt, assertIsDocumentModelDocument as et, documentModelHeaderReducer as f, HASH_ALGORITHM_SHA512 as ft, documentModelOperationReducer as g, documentModelGlobalState as gt, documentModelOperationExampleReducer as h, documentModelFileExtension as ht, isReservedOperationName as i, ab2hex as it, sign as j, createSignedHeaderForSigner as k, validateOperationName as l, hex2ab as lt, documentModelOperationErrorReducer as m, HASH_ENCODING_HEX as mt, ReservedOperationName as n, isDocumentModelDocument as nt, validateModule as o, buildOperationSignatureParams as ot, documentModelModuleReducer as p, HASH_ENCODING_BASE64 as pt, InvalidActionInputZodError as q, getAllOperationNames as r, isDocumentModelState as rt, validateModuleOperation as s, getUnixTimestamp as st, RESERVED_OPERATION_NAMES as t, assertIsDocumentModelState as tt, validateOperations as u, HASH_ALGORITHM_SHA1 as ut, documentModelStateReducer as v, documentModelInitialLocalState as vt, pruneOperation as w, baseReducer as x, documentModelStateSchemaReducer as y, documentModelSaveToFileHandle as z };
306
+ //# sourceMappingURL=index-DhPr5zSB.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DhPr5zSB.d.ts","names":[],"sources":["../document-model/constants.ts","../document-model/crypto.ts","../document-model/document-schema.ts","../document-model/document-type.ts","../document-model/errors.ts","../document-model/files.ts","../document-model/header.ts","../document-model/reducer.ts","../document-model/reducers.ts","../document-model/validation.ts"],"mappings":"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"}
@@ -0,0 +1,6 @@
1
+ import { a as AnalyticsSeriesInput, c as CompoundAnalyticsExpression, d as ConversionMetric, f as IAnalyticsStore, i as AnalyticsSeries, l as CompoundAnalyticsInputs, n as AnalyticsOperand, o as AnalyticsSeriesQuery, p as MultiCurrencyConversion, r as AnalyticsQuery, s as AnalyticsUpdateCallback, t as AnalyticsDimension, u as CompoundAnalyticsQuery } from "./types-BFDlQkXZ.js";
2
+ import { i as PACKAGES_DEPENDENCIES, n as APPS_DEPENDENCIES, r as CLIS_DEPENDENCIES, t as ALL_POWERHOUSE_DEPENDENCIES } from "./constants-xNwF0jSl.js";
3
+ import { $a as ReorderOperationErrorsAction, $i as MutationReorderOperationErrorsArgs, $n as ConfigEntryType, $o as SetOperationSchemaAction, $r as EditorDispatch, Aa as OperationsByScope, Ai as ModuleSpecification, An as ActionSignatureContext, Ao as SetModelNameAction, Ar as DocumentModelHeaderAction, As as UpdateOperationExampleAction, Ba as RedoAction, Bi as MutationDeleteChangeLogItemInputArgs, Bl as ProcessorFilter, Bn as AddOperationErrorInput, Bo as SetOperationDescriptionInput, Br as DocumentModelOperationErrorOperations, Ca as MutationUpdateChangeLogItemInputArgs, Ci as MakeEmpty, Co as SetInitialStateInput, Cr as DeleteStateExampleInput, Cs as SubgraphModule, Da as OperationErrorSpecification, Di as MappedOperation, Do as SetModelExtensionInput, Dr as DocumentModelDocument, Ds as UndoRedoAction, Ea as NOOPAction, Ei as Manifest, Eo as SetModelExtensionAction, Er as DocumentModelAction, Es as UndoActionInput, Fa as PruneAction, Fi as MutationAddModuleArgs, Fl as ProcessorApp, Fn as AddChangeLogItemInput, Fo as SetModuleNameInput, Fr as DocumentModelModule, Fs as UpdateStateExampleInput, Ga as RemoveRelationshipAction, Gi as MutationDeleteStateExampleArgs, Gn as AddRelationshipActionInput, Go as SetOperationErrorNameAction, Gr as DocumentModelStateAction, Ha as Reducer, Hi as MutationDeleteOperationArgs, Hl as ProcessorStatus, Hn as AddOperationExampleInput, Ho as SetOperationErrorCodeInput, Hr as DocumentModelOperationExampleOperations, Ia as PruneActionInput, Ii as MutationAddOperationArgs, Il as ProcessorApps, In as AddModuleAction, Io as SetNameAction, Ir as DocumentModelModuleAction, Is as UpgradeDocumentAction, Ja as ReorderChangeLogItemsInput, Ji as MutationPruneArgs, Jn as AssertIsDocumentOfType, Jo as SetOperationErrorTemplateInput, Jr as DocumentModelVersioningAction, Ka as RemoveRelationshipActionInput, Ki as MutationLoadStateArgs, Kn as AddStateExampleAction, Ko as SetOperationErrorNameInput, Kr as DocumentModelStateOperations, La as Publisher, Li as MutationAddOperationErrorArgs, Ll as ProcessorDispatchResult, Ln as AddModuleInput, Lo as SetNameActionInput, Lr as DocumentModelModuleOperations, Ls as UpgradeDocumentActionInput, Ma as PartialState, Mi as MoveOperationInput, Ml as IProcessorDispatch, Mn as ActionVerificationHandler, Mo as SetModuleDescriptionAction, Mr as DocumentModelInput, Ms as UpdateRelationshipAction, Na as PowerhouseModule, Ni as Mutation, Nl as IProcessorHostModule, Nn as Actions, No as SetModuleDescriptionInput, Nr as DocumentModelLib, Ns as UpdateRelationshipActionInput, Oa as OperationIndex, Oi as Maybe, Oo as SetModelIdAction, Or as DocumentModelDocumentModelModule, Os as UpdateChangeLogItemAction, Pa as Prune, Pi as MutationAddChangeLogItemInputArgs, Pl as IProcessorManager, Pn as AddChangeLogItemAction, Po as SetModuleNameAction, Pr as DocumentModelLocalState, Ps as UpdateStateExampleAction, Qa as ReorderModulesInput, Qi as MutationReorderModulesArgs, Qn as ConfigEntry, Qo as SetOperationReducerInput, Qr as ENSInfo, Ra as Query, Ri as MutationAddOperationExampleArgs, Rl as ProcessorFactory, Rn as AddOperationAction, Ro as SetNameOperation, Rr as DocumentModelOperationAction, Rs as User, Sa as MutationUndoArgs, Si as Load_State, So as SetInitialStateAction, Sr as DeleteStateExampleAction, Ss as StateReducer, Ta as MutationUpdateStateExampleArgs, Ti as MakeOptional, To as SetModelDescriptionInput, Tr as DocumentFile, Ts as UndoAction, Ua as ReducerOptions, Ui as MutationDeleteOperationErrorArgs, Ul as TrackedProcessor, Un as AddOperationInput, Uo as SetOperationErrorDescriptionAction, Ur as DocumentModelOperationOperations, Va as RedoActionInput, Vi as MutationDeleteModuleArgs, Vl as ProcessorRecord, Vn as AddOperationExampleAction, Vo as SetOperationErrorCodeAction, Vr as DocumentModelOperationExampleAction, Wa as ReleaseNewVersionAction, Wi as MutationDeleteOperationExampleArgs, Wn as AddRelationshipAction, Wo as SetOperationErrorDescriptionInput, Wr as DocumentModelPHState, Xa as ReorderModuleOperationsInput, Xi as MutationReorderChangeLogItemsInputArgs, Xn as Author, Xo as SetOperationNameInput, Xr as DocumentOperationsIgnoreMap, Ya as ReorderModuleOperationsAction, Yi as MutationRedoArgs, Yn as AssertIsStateOfType, Yo as SetOperationNameAction, Yr as DocumentModelVersioningOperations, Za as ReorderModulesAction, Zi as MutationReorderModuleOperationsArgs, Zn as CodeExample, Zo as SetOperationReducerAction, Zr as DocumentSpecification, _a as MutationSetOperationNameArgs, _i as LoadFromFile, _o as ScopeState, _r as DeleteOperationErrorAction, _s as SignatureVerificationHandler, aa as MutationSetModelDescriptionArgs, ai as GetDocumentOptions, ao as ReplayDocumentOptions, ar as CreateDocumentAction, as as SetPreferredEditorAction, ba as MutationSetOperationTemplateArgs, bi as LoadStateActionInput, bo as SetAuthorWebsiteAction, br as DeleteOperationExampleInput, bs as SkipHeaderOperations, ca as MutationSetModelNameArgs, ci as IDocument, co as SaveToFileHandle, cr as DeleteChangeLogItemAction, cs as SetStateSchemaAction, da as MutationSetNameArgs, di as ISignalResult, do as SchemaNOOPAction, dr as DeleteChildDocumentSignal, ds as Set_PreferredEditor, ea as MutationReorderOperationExamplesArgs, ei as EditorModule, eo as ReorderOperationErrorsInput, er as CopyChildDocumentInput, es as SetOperationSchemaInput, fa as MutationSetOperationDescriptionArgs, fi as ISigner, fo as SchemaPruneAction, fr as DeleteDocumentAction, fs as Signal, ga as MutationSetOperationErrorTemplateArgs, gi as IsStateOfType, go as SchemaUndoAction, gr as DeleteOperationAction, gs as SignalType, ha as MutationSetOperationErrorNameArgs, hi as IsDocumentOfType, ho as SchemaSetPreferredEditorAction, hr as DeleteModuleInput, hs as SignalResults, ia as MutationSetInitialStateArgs, ii as FileRegistry, io as ReorderStateExamplesInput, ir as CreateDocument, is as SetOperationTemplateInput, ja as PartialRecord, ji as MoveOperationAction, jl as IProcessor, jn as ActionSigningHandler, jo as SetModelNameInput, jr as DocumentModelHeaderOperations, js as UpdateOperationExampleInput, ka as OperationSpecification, ki as MinimalBackupData, kn as ActionErrorCallback, ko as SetModelIdInput, kr as DocumentModelGlobalState, ks as UpdateChangeLogItemInput, la as MutationSetModuleDescriptionArgs, li as IOperation, lo as Scalars, lr as DeleteChangeLogItemInput, ls as SetStateSchemaInput, ma as MutationSetOperationErrorDescriptionArgs, mi as InputMaybe, mo as SchemaSetNameAction, mr as DeleteModuleAction, ms as SignalResult, na as MutationSetAuthorNameArgs, ni as Exact, no as ReorderOperationExamplesInput, nr as CreateChildDocumentInput, ns as SetOperationScopeInput, oa as MutationSetModelExtensionArgs, oi as IAction, oo as RevisionsFilter, or as CreateDocumentActionInput, os as SetPreferredEditorActionInput, pa as MutationSetOperationErrorCodeArgs, pi as Incremental, po as SchemaRedoAction, pr as DeleteDocumentActionInput, ps as SignalDispatch, qa as ReorderChangeLogItemsAction, qi as MutationMoveOperationArgs, qn as AddStateExampleInput, qo as SetOperationErrorTemplateAction, qr as DocumentModelUtils, ra as MutationSetAuthorWebsiteArgs, ri as FileInput, ro as ReorderStateExamplesAction, rr as CreateChildDocumentSignal, rs as SetOperationTemplateAction, sa as MutationSetModelIdArgs, si as ID, so as SaveToFile, sr as CreateState, ss as SetPreferredEditorOperation, ta as MutationReorderStateExamplesArgs, ti as EditorProps, to as ReorderOperationExamplesAction, tr as CopyChildDocumentSignal, ts as SetOperationScopeAction, ua as MutationSetModuleNameArgs, ui as ISignal, uo as SchemaLoadStateAction, ur as DeleteChildDocumentInput, us as Set_Name, va as MutationSetOperationReducerArgs, vi as LoadFromInput, vo as SetAuthorNameAction, vr as DeleteOperationErrorInput, vs as SigningParameters, wa as MutationUpdateOperationExampleArgs, wi as MakeMaybe, wo as SetModelDescriptionAction, wr as DocumentAction, ws as Undo, xa as MutationSetStateSchemaArgs, xi as LoadStateActionStateInput, xo as SetAuthorWebsiteInput, xr as DeleteOperationInput, xs as State, ya as MutationSetOperationSchemaArgs, yi as LoadStateAction, yo as SetAuthorNameInput, yr as DeleteOperationExampleAction, ys as SkipHeaderOperationIndex, za as Redo, zi as MutationAddStateExampleArgs, zl as ProcessorFactoryBuilder, zn as AddOperationErrorAction, zo as SetOperationDescriptionAction, zr as DocumentModelOperationErrorAction, zs as ValidationError } from "./actions-UH5nIJcP.js";
4
+ import { $ as AddFolderAction, A as TriggerData, B as RegistryPackageStatus, C as RemoveTriggerInput, Ct as ParsedCmdResult, D as SetSharingTypeInput, Dt as ServiceAction, E as SetDriveNameInput, Et as PowerhousePackage, F as PackageInfo, G as GenerateNodesCopySrc, H as DriveDocumentModelModule, I as RegistryPackage, J as DocumentDriveDocument, K as SharingType, L as RegistryPackageList, M as TriggerType, N as UpdateFileInput, O as TransmitterType, Ot as ServiceActions, P as UpdateNodeInput, Q as AddFileAction, R as RegistryPackageMap, S as RemoveListenerInput, St as PackageManagerArgs, T as SetDriveIconInput, Tt as PowerhouseConfig, U as DriveInput, V as DocumentDrivePHState, W as GenerateNodesCopyIdGenerator, X as LegacyAddFileInput, Y as LegacyAddFileAction, Z as LegacySynchronizationUnit, _ as ListenerInput, _t as DrivePreserveStrategies, a as CopyNodeInput, at as UpdateFileAction, b as PullResponderTriggerData, bt as LogLevels, c as DocumentDriveLocalState, ct as AddTriggerAction, d as FolderNode, dt as RemoveListenerAction, et as CopyNodeAction, f as Listener, ft as RemoveTriggerAction, g as ListenerFilterInput, gt as SetSharingTypeAction, h as ListenerFilter, ht as SetDriveNameAction, i as AddTriggerInput, it as MoveNodeAction, j as TriggerInput, k as Trigger, lt as DocumentDriveDriveAction, m as ListenerCallInfoInput, mt as SetDriveIconAction, n as AddFolderInput, nt as DocumentDriveNodeAction, o as DeleteNodeInput, ot as UpdateNodeAction, p as ListenerCallInfo, pt as SetAvailableOfflineAction, q as DocumentDriveAction, r as AddListenerInput, rt as DocumentDriveNodeOperations, s as DocumentDriveGlobalState, st as AddListenerAction, t as AddFileInput, tt as DeleteNodeAction, u as FileNode, ut as DocumentDriveDriveOperations, v as MoveNodeInput, vt as DrivePreserveStrategy, w as SetAvailableOfflineInput, wt as PathValidation, x as PullResponderTriggerDataInput, xt as PHPackageProvider, y as Node, yt as LogLevel, z as RegistryPackageSource } from "./types-WzwAClp2.js";
5
+ import { n as buildTreeUrl, r as shortGitSha, t as GITHUB_REPO_URL } from "./index-C_iVZe7f.js";
6
+ export { ALL_POWERHOUSE_DEPENDENCIES, APPS_DEPENDENCIES, ActionErrorCallback, ActionSignatureContext, ActionSigningHandler, ActionVerificationHandler, Actions, AddChangeLogItemAction, AddChangeLogItemInput, AddFileAction, AddFileInput, AddFolderAction, AddFolderInput, AddListenerAction, AddListenerInput, AddModuleAction, AddModuleInput, AddOperationAction, AddOperationErrorAction, AddOperationErrorInput, AddOperationExampleAction, AddOperationExampleInput, AddOperationInput, AddRelationshipAction, AddRelationshipActionInput, AddStateExampleAction, AddStateExampleInput, AddTriggerAction, AddTriggerInput, AnalyticsDimension, AnalyticsOperand, AnalyticsQuery, AnalyticsSeries, AnalyticsSeriesInput, AnalyticsSeriesQuery, AnalyticsUpdateCallback, AssertIsDocumentOfType, AssertIsStateOfType, Author, CLIS_DEPENDENCIES, CodeExample, CompoundAnalyticsExpression, CompoundAnalyticsInputs, CompoundAnalyticsQuery, ConfigEntry, ConfigEntryType, ConversionMetric, CopyChildDocumentInput, CopyChildDocumentSignal, CopyNodeAction, CopyNodeInput, CreateChildDocumentInput, CreateChildDocumentSignal, CreateDocument, CreateDocumentAction, CreateDocumentActionInput, CreateState, DeleteChangeLogItemAction, DeleteChangeLogItemInput, DeleteChildDocumentInput, DeleteChildDocumentSignal, DeleteDocumentAction, DeleteDocumentActionInput, DeleteModuleAction, DeleteModuleInput, DeleteNodeAction, DeleteNodeInput, DeleteOperationAction, DeleteOperationErrorAction, DeleteOperationErrorInput, DeleteOperationExampleAction, DeleteOperationExampleInput, DeleteOperationInput, DeleteStateExampleAction, DeleteStateExampleInput, DocumentAction, DocumentDriveAction, DocumentDriveDocument, DocumentDriveDriveAction, DocumentDriveDriveOperations, DocumentDriveGlobalState, DocumentDriveLocalState, DocumentDriveNodeAction, DocumentDriveNodeOperations, DocumentDrivePHState, DocumentFile, DocumentModelAction, DocumentModelDocument, DocumentModelDocumentModelModule, DocumentModelGlobalState, DocumentModelHeaderAction, DocumentModelHeaderOperations, DocumentModelInput, DocumentModelLib, DocumentModelLocalState, DocumentModelModule, DocumentModelModuleAction, DocumentModelModuleOperations, DocumentModelOperationAction, DocumentModelOperationErrorAction, DocumentModelOperationErrorOperations, DocumentModelOperationExampleAction, DocumentModelOperationExampleOperations, DocumentModelOperationOperations, DocumentModelPHState, DocumentModelStateAction, DocumentModelStateOperations, DocumentModelUtils, DocumentModelVersioningAction, DocumentModelVersioningOperations, DocumentOperationsIgnoreMap, DocumentSpecification, DriveDocumentModelModule, DriveInput, DrivePreserveStrategies, DrivePreserveStrategy, ENSInfo, EditorDispatch, EditorModule, EditorProps, Exact, FileInput, FileNode, FileRegistry, FolderNode, GITHUB_REPO_URL, GenerateNodesCopyIdGenerator, GenerateNodesCopySrc, GetDocumentOptions, IAction, IAnalyticsStore, ID, IDocument, IOperation, IProcessor, IProcessorDispatch, IProcessorHostModule, IProcessorManager, ISignal, ISignalResult, ISigner, Incremental, InputMaybe, IsDocumentOfType, IsStateOfType, LegacyAddFileAction, LegacyAddFileInput, LegacySynchronizationUnit, Listener, ListenerCallInfo, ListenerCallInfoInput, ListenerFilter, ListenerFilterInput, ListenerInput, LoadFromFile, LoadFromInput, LoadStateAction, LoadStateActionInput, LoadStateActionStateInput, Load_State, LogLevel, LogLevels, MakeEmpty, MakeMaybe, MakeOptional, Manifest, MappedOperation, Maybe, MinimalBackupData, ModuleSpecification, MoveNodeAction, MoveNodeInput, MoveOperationAction, MoveOperationInput, MultiCurrencyConversion, Mutation, MutationAddChangeLogItemInputArgs, MutationAddModuleArgs, MutationAddOperationArgs, MutationAddOperationErrorArgs, MutationAddOperationExampleArgs, MutationAddStateExampleArgs, MutationDeleteChangeLogItemInputArgs, MutationDeleteModuleArgs, MutationDeleteOperationArgs, MutationDeleteOperationErrorArgs, MutationDeleteOperationExampleArgs, MutationDeleteStateExampleArgs, MutationLoadStateArgs, MutationMoveOperationArgs, MutationPruneArgs, MutationRedoArgs, MutationReorderChangeLogItemsInputArgs, MutationReorderModuleOperationsArgs, MutationReorderModulesArgs, MutationReorderOperationErrorsArgs, MutationReorderOperationExamplesArgs, MutationReorderStateExamplesArgs, MutationSetAuthorNameArgs, MutationSetAuthorWebsiteArgs, MutationSetInitialStateArgs, MutationSetModelDescriptionArgs, MutationSetModelExtensionArgs, MutationSetModelIdArgs, MutationSetModelNameArgs, MutationSetModuleDescriptionArgs, MutationSetModuleNameArgs, MutationSetNameArgs, MutationSetOperationDescriptionArgs, MutationSetOperationErrorCodeArgs, MutationSetOperationErrorDescriptionArgs, MutationSetOperationErrorNameArgs, MutationSetOperationErrorTemplateArgs, MutationSetOperationNameArgs, MutationSetOperationReducerArgs, MutationSetOperationSchemaArgs, MutationSetOperationTemplateArgs, MutationSetStateSchemaArgs, MutationUndoArgs, MutationUpdateChangeLogItemInputArgs, MutationUpdateOperationExampleArgs, MutationUpdateStateExampleArgs, NOOPAction, Node, OperationErrorSpecification, OperationIndex, OperationSpecification, OperationsByScope, PACKAGES_DEPENDENCIES, PHPackageProvider, PackageInfo, PackageManagerArgs, ParsedCmdResult, PartialRecord, PartialState, PathValidation, PowerhouseConfig, PowerhouseModule, PowerhousePackage, ProcessorApp, ProcessorApps, ProcessorDispatchResult, ProcessorFactory, ProcessorFactoryBuilder, ProcessorFilter, ProcessorRecord, ProcessorStatus, Prune, PruneAction, PruneActionInput, Publisher, PullResponderTriggerData, PullResponderTriggerDataInput, Query, Redo, RedoAction, RedoActionInput, Reducer, ReducerOptions, RegistryPackage, RegistryPackageList, RegistryPackageMap, RegistryPackageSource, RegistryPackageStatus, ReleaseNewVersionAction, RemoveListenerAction, RemoveListenerInput, RemoveRelationshipAction, RemoveRelationshipActionInput, RemoveTriggerAction, RemoveTriggerInput, ReorderChangeLogItemsAction, ReorderChangeLogItemsInput, ReorderModuleOperationsAction, ReorderModuleOperationsInput, ReorderModulesAction, ReorderModulesInput, ReorderOperationErrorsAction, ReorderOperationErrorsInput, ReorderOperationExamplesAction, ReorderOperationExamplesInput, ReorderStateExamplesAction, ReorderStateExamplesInput, ReplayDocumentOptions, RevisionsFilter, SaveToFile, SaveToFileHandle, Scalars, SchemaLoadStateAction, SchemaNOOPAction, SchemaPruneAction, SchemaRedoAction, SchemaSetNameAction, SchemaSetPreferredEditorAction, SchemaUndoAction, ScopeState, ServiceAction, ServiceActions, SetAuthorNameAction, SetAuthorNameInput, SetAuthorWebsiteAction, SetAuthorWebsiteInput, SetAvailableOfflineAction, SetAvailableOfflineInput, SetDriveIconAction, SetDriveIconInput, SetDriveNameAction, SetDriveNameInput, SetInitialStateAction, SetInitialStateInput, SetModelDescriptionAction, SetModelDescriptionInput, SetModelExtensionAction, SetModelExtensionInput, SetModelIdAction, SetModelIdInput, SetModelNameAction, SetModelNameInput, SetModuleDescriptionAction, SetModuleDescriptionInput, SetModuleNameAction, SetModuleNameInput, SetNameAction, SetNameActionInput, SetNameOperation, SetOperationDescriptionAction, SetOperationDescriptionInput, SetOperationErrorCodeAction, SetOperationErrorCodeInput, SetOperationErrorDescriptionAction, SetOperationErrorDescriptionInput, SetOperationErrorNameAction, SetOperationErrorNameInput, SetOperationErrorTemplateAction, SetOperationErrorTemplateInput, SetOperationNameAction, SetOperationNameInput, SetOperationReducerAction, SetOperationReducerInput, SetOperationSchemaAction, SetOperationSchemaInput, SetOperationScopeAction, SetOperationScopeInput, SetOperationTemplateAction, SetOperationTemplateInput, SetPreferredEditorAction, SetPreferredEditorActionInput, SetPreferredEditorOperation, SetSharingTypeAction, SetSharingTypeInput, SetStateSchemaAction, SetStateSchemaInput, Set_Name, Set_PreferredEditor, SharingType, Signal, SignalDispatch, SignalResult, SignalResults, SignalType, SignatureVerificationHandler, SigningParameters, SkipHeaderOperationIndex, SkipHeaderOperations, State, StateReducer, SubgraphModule, TrackedProcessor, TransmitterType, Trigger, TriggerData, TriggerInput, TriggerType, Undo, UndoAction, UndoActionInput, UndoRedoAction, UpdateChangeLogItemAction, UpdateChangeLogItemInput, UpdateFileAction, UpdateFileInput, UpdateNodeAction, UpdateNodeInput, UpdateOperationExampleAction, UpdateOperationExampleInput, UpdateRelationshipAction, UpdateRelationshipActionInput, UpdateStateExampleAction, UpdateStateExampleInput, UpgradeDocumentAction, UpgradeDocumentActionInput, User, ValidationError, buildTreeUrl, shortGitSha };
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ import { ALL_POWERHOUSE_DEPENDENCIES, APPS_DEPENDENCIES, CLIS_DEPENDENCIES, PACKAGES_DEPENDENCIES } from "./constants.js";
2
+ //#region git.ts
3
+ const GITHUB_REPO_URL = "https://github.com/powerhouse-inc/powerhouse";
4
+ function buildTreeUrl(sha) {
5
+ if (!sha || sha === "unknown") return null;
6
+ return `${GITHUB_REPO_URL}/tree/${sha}`;
7
+ }
8
+ function shortGitSha(sha) {
9
+ return sha === "unknown" ? sha : sha.slice(0, 7);
10
+ }
11
+ //#endregion
12
+ export { ALL_POWERHOUSE_DEPENDENCIES, APPS_DEPENDENCIES, CLIS_DEPENDENCIES, GITHUB_REPO_URL, PACKAGES_DEPENDENCIES, buildTreeUrl, shortGitSha };
13
+
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../git.ts"],"sourcesContent":["export const GITHUB_REPO_URL = \"https://github.com/powerhouse-inc/powerhouse\";\n\nexport function buildTreeUrl(sha: string): string | null {\n if (!sha || sha === \"unknown\") return null;\n return `${GITHUB_REPO_URL}/tree/${sha}`;\n}\n\nexport function shortGitSha(sha: string): string {\n return sha === \"unknown\" ? sha : sha.slice(0, 7);\n}\n"],"mappings":";;AAAA,MAAa,kBAAkB;AAE/B,SAAgB,aAAa,KAA4B;AACvD,KAAI,CAAC,OAAO,QAAQ,UAAW,QAAO;AACtC,QAAO,GAAG,gBAAgB,QAAQ;;AAGpC,SAAgB,YAAY,KAAqB;AAC/C,QAAO,QAAQ,YAAY,MAAM,IAAI,MAAM,GAAG,EAAE"}
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+
3
+ //#region document-model/mock.d.ts
4
+ declare function generateMock<TSchema extends z.ZodType>(schema: TSchema): z.infer<TSchema>;
5
+ //#endregion
6
+ export { generateMock as t };
7
+ //# sourceMappingURL=mock-Cgn-VBF_.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-Cgn-VBF_.d.ts","names":[],"sources":["../document-model/mock.ts"],"mappings":";;;iBAGgB,YAAA,iBAA6B,CAAA,CAAE,OAAA,CAAA,CAC7C,MAAA,EAAQ,OAAA,GACP,CAAA,CAAE,KAAA,CAAM,OAAA"}
@@ -1,5 +1,2 @@
1
- export * from "./constants.js";
2
- export * from "./relational/types.js";
3
- export * from "./relational/utils.js";
4
- export type * from "./types.js";
5
- //# sourceMappingURL=index.d.ts.map
1
+ import { Al as RelationalDbProcessorClass, Bl as ProcessorFilter, Cl as HashAlgorithms, Dl as IRelationalQueryBuilder, El as IRelationalDbProcessor, Fl as ProcessorApp, Gl as DEFAULT_RELATIONAL_PROCESSOR_DB_NAME, Hl as ProcessorStatus, Il as ProcessorApps, Kl as PROCESSOR_APPS, Ll as ProcessorDispatchResult, Ml as IProcessorDispatch, Nl as IProcessorHostModule, Ol as IRelationalQueryMethods, Pl as IProcessorManager, Rl as ProcessorFactory, Sl as ExtractProcessorSchemaOrSelf, Tl as IRelationalDb, Ul as TrackedProcessor, Vl as ProcessorRecord, Wl as DEFAULT_ANALYTICS_PROCESSOR_DB_NAME, _l as createNamespacedDb, bl as hashNamespace, jl as IProcessor, kl as RelationalDbProcessor, vl as createNamespacedQueryBuilder, wl as IBaseRelationalDb, xl as relationalDbToQueryBuilder, yl as createRelationalDb, zl as ProcessorFactoryBuilder } from "../actions-UH5nIJcP.js";
2
+ export { DEFAULT_ANALYTICS_PROCESSOR_DB_NAME, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME, ExtractProcessorSchemaOrSelf, HashAlgorithms, IBaseRelationalDb, IProcessor, IProcessorDispatch, IProcessorHostModule, IProcessorManager, IRelationalDb, IRelationalDbProcessor, IRelationalQueryBuilder, IRelationalQueryMethods, PROCESSOR_APPS, ProcessorApp, ProcessorApps, ProcessorDispatchResult, ProcessorFactory, ProcessorFactoryBuilder, ProcessorFilter, ProcessorRecord, ProcessorStatus, RelationalDbProcessor, RelationalDbProcessorClass, TrackedProcessor, createNamespacedDb, createNamespacedQueryBuilder, createRelationalDb, hashNamespace, relationalDbToQueryBuilder };
@@ -1,4 +1,117 @@
1
- export * from "./constants.js";
2
- export * from "./relational/types.js";
3
- export * from "./relational/utils.js";
1
+ import fnv1a from "@sindresorhus/fnv1a";
2
+ //#region processors/constants.ts
3
+ const PROCESSOR_APPS = ["connect", "switchboard"];
4
+ const DEFAULT_RELATIONAL_PROCESSOR_DB_NAME = "relational-db";
5
+ const DEFAULT_ANALYTICS_PROCESSOR_DB_NAME = "analytics-db";
6
+ //#endregion
7
+ //#region processors/relational/utils.ts
8
+ const SUPPORTED_SIZES = [
9
+ 32,
10
+ 64,
11
+ 128,
12
+ 256,
13
+ 512,
14
+ 1024
15
+ ];
16
+ const LOG2_26 = Math.log2(26);
17
+ /**
18
+ * Hashes a string to a lowercase base-26 string.
19
+ * @param str The string to hash.
20
+ * @param length The length of the hash. Defaults to 10.
21
+ * @param algorithm The hashing algorithm to use. Defaults to "fnv1a".
22
+ * @returns The hashed string.
23
+ */
24
+ function hashNamespace(str, length = 10) {
25
+ const requiredBits = Math.ceil(length * LOG2_26);
26
+ return toBase26(fnv1a(str, { size: SUPPORTED_SIZES.find((size) => size && size >= requiredBits) ?? 1024 }), length);
27
+ }
28
+ function toBase26(num, length = 10) {
29
+ const alphabet = "abcdefghijklmnopqrstuvwxyz";
30
+ let out = "";
31
+ while (num > 0n && out.length < length) {
32
+ out = alphabet[Number(num % 26n)] + out;
33
+ num /= 26n;
34
+ }
35
+ return out.padStart(length, "a");
36
+ }
37
+ /**
38
+ * Creates a RelationalDb instance with namespace support.
39
+ * @param baseDb The base RelationalDb instance to enhance.
40
+ * @param baseOptions The default options for namespace creation. Hashes namespace by default.
41
+ * @returns The enhanced RelationalDb instance.
42
+ */
43
+ function createRelationalDb(baseDb, baseOptions) {
44
+ const relationalDb = baseDb;
45
+ relationalDb.createNamespace = (namespace, options) => createNamespacedDb(baseDb, namespace, options ?? baseOptions);
46
+ relationalDb.queryNamespace = (namespace, options) => createNamespacedQueryBuilder(baseDb, namespace, options ?? baseOptions);
47
+ return relationalDb;
48
+ }
49
+ async function createNamespacedDb(db, namespace, options) {
50
+ const hashValue = options?.hashNamespace ?? true ? hashNamespace(namespace) : namespace;
51
+ await db.schema.createSchema(hashValue).ifNotExists().execute();
52
+ return db.withSchema(hashValue);
53
+ }
54
+ function createNamespacedQueryBuilder(db, namespace, options) {
55
+ const hashValue = options?.hashNamespace ?? true ? hashNamespace(namespace) : namespace;
56
+ return relationalDbToQueryBuilder(db.withSchema(hashValue));
57
+ }
58
+ /**
59
+ * Returns a query builder for a RelationalDb instance.
60
+ * @param query The RelationalDb instance to convert.
61
+ * @returns The IRelationalQueryBuilder instance.
62
+ */
63
+ function relationalDbToQueryBuilder(query) {
64
+ return {
65
+ selectFrom: query.selectFrom.bind(query),
66
+ selectNoFrom: query.selectNoFrom.bind(query),
67
+ with: query.with.bind(query),
68
+ withRecursive: query.withRecursive.bind(query),
69
+ withSchema: (schema) => relationalDbToQueryBuilder(query.withSchema(schema))
70
+ };
71
+ }
72
+ //#endregion
73
+ //#region processors/relational/types.ts
74
+ const IS_RELATIONAL_DB_PROCESSOR = Symbol.for("ph.IS_RELATIONAL_DB_PROCESSOR");
75
+ /**
76
+ * Base class for relational db processors that require a relational database storage.
77
+ * This class abstracts database initialization, migration management, and resource cleanup,
78
+ * allowing derived classes to focus on business logic.
79
+ */
80
+ var RelationalDbProcessor = class {
81
+ constructor(_namespace, _filter, relationalDb) {
82
+ this._namespace = _namespace;
83
+ this._filter = _filter;
84
+ this.relationalDb = relationalDb;
85
+ }
86
+ static [IS_RELATIONAL_DB_PROCESSOR] = true;
87
+ /**
88
+ * Returns the namespace for a given drive id.
89
+ * This method can be overridden by derived classes to provide a custom namespace.
90
+ */
91
+ static getNamespace(driveId) {
92
+ return `${this.name}_${driveId.replaceAll("-", "_")}`;
93
+ }
94
+ static query(driveId, db) {
95
+ return db.queryNamespace(this.getNamespace(driveId));
96
+ }
97
+ /**
98
+ * Returns the filter for the processor.
99
+ * This method can be overridden by derived classes to provide a custom filter.
100
+ */
101
+ get filter() {
102
+ return this._filter;
103
+ }
104
+ /**
105
+ * Returns the namespace used by the processor.
106
+ */
107
+ get namespace() {
108
+ return this._namespace;
109
+ }
110
+ get query() {
111
+ return relationalDbToQueryBuilder(this.relationalDb);
112
+ }
113
+ };
114
+ //#endregion
115
+ export { DEFAULT_ANALYTICS_PROCESSOR_DB_NAME, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME, PROCESSOR_APPS, RelationalDbProcessor, createNamespacedDb, createNamespacedQueryBuilder, createRelationalDb, hashNamespace, relationalDbToQueryBuilder };
116
+
4
117
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../processors/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../processors/constants.ts","../../processors/relational/utils.ts","../../processors/relational/types.ts"],"sourcesContent":["export const PROCESSOR_APPS = [\"connect\", \"switchboard\"] as const;\nexport const DEFAULT_RELATIONAL_PROCESSOR_DB_NAME = \"relational-db\";\nexport const DEFAULT_ANALYTICS_PROCESSOR_DB_NAME = \"analytics-db\";\n","import type { Options } from \"@sindresorhus/fnv1a\";\nimport fnv1a from \"@sindresorhus/fnv1a\";\nimport type {\n IBaseRelationalDb,\n IRelationalDb,\n IRelationalQueryBuilder,\n} from \"./types.js\";\n\nconst SUPPORTED_SIZES: Options[\"size\"][] = [32, 64, 128, 256, 512, 1024];\nconst LOG2_26 = Math.log2(26); //\n/**\n * Hashes a string to a lowercase base-26 string.\n * @param str The string to hash.\n * @param length The length of the hash. Defaults to 10.\n * @param algorithm The hashing algorithm to use. Defaults to \"fnv1a\".\n * @returns The hashed string.\n */\nexport function hashNamespace(str: string, length = 10) {\n const requiredBits = Math.ceil(length * LOG2_26);\n const bitSize =\n SUPPORTED_SIZES.find((size) => size && size >= requiredBits) ?? 1024;\n const hash = fnv1a(str, { size: bitSize });\n return toBase26(hash, length);\n}\n\n// converts hash to lowercase letters\nfunction toBase26(num: bigint, length = 10): string {\n const alphabet = \"abcdefghijklmnopqrstuvwxyz\";\n let out = \"\";\n while (num > 0n && out.length < length) {\n out = alphabet[Number(num % 26n)] + out;\n num /= 26n;\n }\n return out.padStart(length, \"a\"); // optional padding\n}\n\n/**\n * Creates a RelationalDb instance with namespace support.\n * @param baseDb The base RelationalDb instance to enhance.\n * @param baseOptions The default options for namespace creation. Hashes namespace by default.\n * @returns The enhanced RelationalDb instance.\n */\nexport function createRelationalDb<Schema>(\n baseDb: IBaseRelationalDb<Schema>,\n baseOptions?: NamespaceOptions,\n): IRelationalDb<Schema> {\n const relationalDb = baseDb as IRelationalDb<Schema>;\n\n relationalDb.createNamespace = <NamespaceSchema>(\n namespace: string,\n options?: NamespaceOptions,\n ) =>\n createNamespacedDb<NamespaceSchema>(\n baseDb,\n namespace,\n options ?? baseOptions,\n );\n\n relationalDb.queryNamespace = <NamespaceSchema>(\n namespace: string,\n options?: NamespaceOptions,\n ) =>\n createNamespacedQueryBuilder<NamespaceSchema>(\n baseDb,\n namespace,\n options ?? baseOptions,\n );\n\n return relationalDb;\n}\n\ntype NamespaceOptions = {\n hashNamespace?: boolean;\n};\n\nexport async function createNamespacedDb<Schema>(\n db: IBaseRelationalDb<any>,\n namespace: string,\n options?: NamespaceOptions,\n): Promise<IRelationalDb<Schema>> {\n // hash the namespace to avoid too long namespaces\n const shouldHash = options?.hashNamespace ?? true;\n const hashValue = shouldHash ? hashNamespace(namespace) : namespace;\n await db.schema.createSchema(hashValue).ifNotExists().execute();\n const schemaRelationalDb = db.withSchema(hashValue);\n return schemaRelationalDb as IRelationalDb<Schema>;\n}\n\nexport function createNamespacedQueryBuilder<Schema>(\n db: IBaseRelationalDb<any>,\n namespace: string,\n options?: NamespaceOptions,\n): IRelationalQueryBuilder<Schema> {\n const shouldHash = options?.hashNamespace ?? true;\n const hashValue = shouldHash ? hashNamespace(namespace) : namespace;\n const namespacedDb = db.withSchema(hashValue) as IRelationalDb<Schema>;\n return relationalDbToQueryBuilder(namespacedDb);\n}\n\n/**\n * Returns a query builder for a RelationalDb instance.\n * @param query The RelationalDb instance to convert.\n * @returns The IRelationalQueryBuilder instance.\n */\nexport function relationalDbToQueryBuilder<TSchema>(\n query: IBaseRelationalDb<TSchema>,\n): IRelationalQueryBuilder<TSchema> {\n return {\n selectFrom: query.selectFrom.bind(query),\n selectNoFrom: query.selectNoFrom.bind(query),\n with: query.with.bind(query),\n withRecursive: query.withRecursive.bind(query),\n withSchema: (schema: string) =>\n relationalDbToQueryBuilder<TSchema>(query.withSchema(schema)),\n };\n}\n","import type { OperationWithContext } from \"@powerhousedao/shared/document-model\";\nimport type { Kysely, QueryCreator } from \"kysely\";\nimport type { IProcessor, ProcessorFilter } from \"../types.js\";\nimport { relationalDbToQueryBuilder } from \"./utils.js\";\n\nexport type IRelationalQueryMethods =\n | \"selectFrom\"\n | \"selectNoFrom\"\n | \"with\"\n | \"withRecursive\";\n\nexport type IRelationalQueryBuilder<Schema = unknown> = Pick<\n QueryCreator<Schema>,\n IRelationalQueryMethods\n> & {\n withSchema: (schema: string) => IRelationalQueryBuilder<Schema>;\n};\n\nexport type HashAlgorithms = \"fnv1a\";\nexport type IBaseRelationalDb<Schema = unknown> = Kysely<Schema>;\n\n/**\n * The standardized relational database interface for relational db processors.\n * This abstraction provides type-safe database operations while hiding the underlying\n * database framework implementation details.\n **/\nexport type IRelationalDb<Schema = unknown> = IBaseRelationalDb<Schema> & {\n createNamespace<NamespaceSchema>(\n namespace: string,\n ): Promise<IRelationalDb<ExtractProcessorSchemaOrSelf<NamespaceSchema>>>;\n queryNamespace<NamespaceSchema>(\n namespace: string,\n ): IRelationalQueryBuilder<NamespaceSchema>;\n};\n\nexport type ExtractProcessorSchemaOrSelf<TProcessor> =\n TProcessor extends RelationalDbProcessor<infer TSchema>\n ? TSchema\n : TProcessor;\n\nexport type RelationalDbProcessorClass<TSchema> =\n typeof RelationalDbProcessor<TSchema>;\n\nexport interface IRelationalDbProcessor<\n TDatabaseSchema = unknown,\n> extends IProcessor {\n namespace: string;\n query: IRelationalQueryBuilder<TDatabaseSchema>;\n filter: ProcessorFilter;\n initAndUpgrade(): Promise<void>;\n}\n\nconst IS_RELATIONAL_DB_PROCESSOR = Symbol.for(\"ph.IS_RELATIONAL_DB_PROCESSOR\");\n\n/**\n * Base class for relational db processors that require a relational database storage.\n * This class abstracts database initialization, migration management, and resource cleanup,\n * allowing derived classes to focus on business logic.\n */\nexport abstract class RelationalDbProcessor<\n TDatabaseSchema = unknown,\n> implements IRelationalDbProcessor<TDatabaseSchema> {\n constructor(\n protected _namespace: string,\n protected _filter: ProcessorFilter,\n protected relationalDb: IRelationalDb<TDatabaseSchema>,\n ) {}\n\n static [IS_RELATIONAL_DB_PROCESSOR] = true;\n\n /**\n * Returns the namespace for a given drive id.\n * This method can be overridden by derived classes to provide a custom namespace.\n */\n static getNamespace(driveId: string): string {\n return `${this.name}_${driveId.replaceAll(\"-\", \"_\")}`;\n }\n\n static query<Schema>(\n this: RelationalDbProcessorClass<Schema>,\n driveId: string,\n db: IRelationalDb<any>,\n ): IRelationalQueryBuilder<Schema> {\n return db.queryNamespace(this.getNamespace(driveId));\n }\n\n /**\n * Processes a list of operations with context.\n * Called when operations match this processor's filter.\n */\n abstract onOperations(operations: OperationWithContext[]): Promise<void>;\n\n /**\n * Returns the filter for the processor.\n * This method can be overridden by derived classes to provide a custom filter.\n */\n get filter(): ProcessorFilter {\n return this._filter;\n }\n\n /**\n * Returns the namespace used by the processor.\n */\n get namespace(): string {\n return this._namespace;\n }\n\n get query(): IRelationalQueryBuilder<TDatabaseSchema> {\n return relationalDbToQueryBuilder(this.relationalDb);\n }\n\n /**\n * Abstract method that derived classes must implement.\n * This method is meant to be called on subclasses to initialize and upgrade the database.\n */\n abstract initAndUpgrade(): Promise<void>;\n\n /**\n * Called when the processor is disconnected.\n * This method is meant to be overridden by subclasses to clean up resources.\n */\n abstract onDisconnect(): Promise<void>;\n}\n"],"mappings":";;AAAA,MAAa,iBAAiB,CAAC,WAAW,cAAc;AACxD,MAAa,uCAAuC;AACpD,MAAa,sCAAsC;;;ACMnD,MAAM,kBAAqC;CAAC;CAAI;CAAI;CAAK;CAAK;CAAK;CAAK;AACxE,MAAM,UAAU,KAAK,KAAK,GAAG;;;;;;;;AAQ7B,SAAgB,cAAc,KAAa,SAAS,IAAI;CACtD,MAAM,eAAe,KAAK,KAAK,SAAS,QAAQ;AAIhD,QAAO,SADM,MAAM,KAAK,EAAE,MADxB,gBAAgB,MAAM,SAAS,QAAQ,QAAQ,aAAa,IAAI,MACzB,CAAC,EACpB,OAAO;;AAI/B,SAAS,SAAS,KAAa,SAAS,IAAY;CAClD,MAAM,WAAW;CACjB,IAAI,MAAM;AACV,QAAO,MAAM,MAAM,IAAI,SAAS,QAAQ;AACtC,QAAM,SAAS,OAAO,MAAM,IAAI,IAAI;AACpC,SAAO;;AAET,QAAO,IAAI,SAAS,QAAQ,IAAI;;;;;;;;AASlC,SAAgB,mBACd,QACA,aACuB;CACvB,MAAM,eAAe;AAErB,cAAa,mBACX,WACA,YAEA,mBACE,QACA,WACA,WAAW,YACZ;AAEH,cAAa,kBACX,WACA,YAEA,6BACE,QACA,WACA,WAAW,YACZ;AAEH,QAAO;;AAOT,eAAsB,mBACpB,IACA,WACA,SACgC;CAGhC,MAAM,YADa,SAAS,iBAAiB,OACd,cAAc,UAAU,GAAG;AAC1D,OAAM,GAAG,OAAO,aAAa,UAAU,CAAC,aAAa,CAAC,SAAS;AAE/D,QAD2B,GAAG,WAAW,UAAU;;AAIrD,SAAgB,6BACd,IACA,WACA,SACiC;CAEjC,MAAM,YADa,SAAS,iBAAiB,OACd,cAAc,UAAU,GAAG;AAE1D,QAAO,2BADc,GAAG,WAAW,UAAU,CACE;;;;;;;AAQjD,SAAgB,2BACd,OACkC;AAClC,QAAO;EACL,YAAY,MAAM,WAAW,KAAK,MAAM;EACxC,cAAc,MAAM,aAAa,KAAK,MAAM;EAC5C,MAAM,MAAM,KAAK,KAAK,MAAM;EAC5B,eAAe,MAAM,cAAc,KAAK,MAAM;EAC9C,aAAa,WACX,2BAAoC,MAAM,WAAW,OAAO,CAAC;EAChE;;;;AC9DH,MAAM,6BAA6B,OAAO,IAAI,gCAAgC;;;;;;AAO9E,IAAsB,wBAAtB,MAEqD;CACnD,YACE,YACA,SACA,cACA;AAHU,OAAA,aAAA;AACA,OAAA,UAAA;AACA,OAAA,eAAA;;CAGZ,QAAQ,8BAA8B;;;;;CAMtC,OAAO,aAAa,SAAyB;AAC3C,SAAO,GAAG,KAAK,KAAK,GAAG,QAAQ,WAAW,KAAK,IAAI;;CAGrD,OAAO,MAEL,SACA,IACiC;AACjC,SAAO,GAAG,eAAe,KAAK,aAAa,QAAQ,CAAC;;;;;;CAatD,IAAI,SAA0B;AAC5B,SAAO,KAAK;;;;;CAMd,IAAI,YAAoB;AACtB,SAAO,KAAK;;CAGd,IAAI,QAAkD;AACpD,SAAO,2BAA2B,KAAK,aAAa"}