@opengeni/artifact-tool 0.2.2

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 (203) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +104 -0
  3. package/dist/bounded-zip.d.ts +28 -0
  4. package/dist/chunk-4BSENMAE.js +39 -0
  5. package/dist/chunk-4BSENMAE.js.map +1 -0
  6. package/dist/chunk-4FRFNNBM.js +276 -0
  7. package/dist/chunk-4FRFNNBM.js.map +1 -0
  8. package/dist/chunk-5XIA6KHZ.js +49 -0
  9. package/dist/chunk-5XIA6KHZ.js.map +1 -0
  10. package/dist/chunk-66CT2ZRP.js +2229 -0
  11. package/dist/chunk-66CT2ZRP.js.map +1 -0
  12. package/dist/chunk-72SYDU4O.js +319 -0
  13. package/dist/chunk-72SYDU4O.js.map +1 -0
  14. package/dist/chunk-B2ZJRZDA.js +279 -0
  15. package/dist/chunk-B2ZJRZDA.js.map +1 -0
  16. package/dist/chunk-DCTLTNPW.js +2458 -0
  17. package/dist/chunk-DCTLTNPW.js.map +1 -0
  18. package/dist/chunk-FGZM4FQ6.js +473 -0
  19. package/dist/chunk-FGZM4FQ6.js.map +1 -0
  20. package/dist/chunk-HTJBLBDE.js +591 -0
  21. package/dist/chunk-HTJBLBDE.js.map +1 -0
  22. package/dist/chunk-IYFXZQ34.js +5306 -0
  23. package/dist/chunk-IYFXZQ34.js.map +1 -0
  24. package/dist/chunk-J6N7IR44.js +172 -0
  25. package/dist/chunk-J6N7IR44.js.map +1 -0
  26. package/dist/chunk-N2IHNWBS.js +1002 -0
  27. package/dist/chunk-N2IHNWBS.js.map +1 -0
  28. package/dist/chunk-NAG44K67.js +549 -0
  29. package/dist/chunk-NAG44K67.js.map +1 -0
  30. package/dist/chunk-O24KTEGP.js +33 -0
  31. package/dist/chunk-O24KTEGP.js.map +1 -0
  32. package/dist/chunk-PI2AZVGK.js +2074 -0
  33. package/dist/chunk-PI2AZVGK.js.map +1 -0
  34. package/dist/chunk-Q2FFHEY7.js +40 -0
  35. package/dist/chunk-Q2FFHEY7.js.map +1 -0
  36. package/dist/chunk-RBGQADXA.js +57 -0
  37. package/dist/chunk-RBGQADXA.js.map +1 -0
  38. package/dist/chunk-U5G2BKM2.js +613 -0
  39. package/dist/chunk-U5G2BKM2.js.map +1 -0
  40. package/dist/chunk-VOJHMSM3.js +39 -0
  41. package/dist/chunk-VOJHMSM3.js.map +1 -0
  42. package/dist/chunk-VUNV25KB.js +16 -0
  43. package/dist/chunk-VUNV25KB.js.map +1 -0
  44. package/dist/chunk-XIFUNVBO.js +101 -0
  45. package/dist/chunk-XIFUNVBO.js.map +1 -0
  46. package/dist/chunk-ZCJYRJGB.js +489 -0
  47. package/dist/chunk-ZCJYRJGB.js.map +1 -0
  48. package/dist/chunk-ZZXPEE4S.js +2260 -0
  49. package/dist/chunk-ZZXPEE4S.js.map +1 -0
  50. package/dist/document-docx-api.d.ts +49 -0
  51. package/dist/document-docx-codec.d.ts +9 -0
  52. package/dist/document-docx-codec.js +4765 -0
  53. package/dist/document-docx-codec.js.map +1 -0
  54. package/dist/document-docx-import.d.ts +261 -0
  55. package/dist/document-docx-packer.d.ts +18 -0
  56. package/dist/document-docx-state.d.ts +12 -0
  57. package/dist/document-render.d.ts +3 -0
  58. package/dist/document-render.js +492 -0
  59. package/dist/document-render.js.map +1 -0
  60. package/dist/document.d.ts +432 -0
  61. package/dist/document.js +37 -0
  62. package/dist/document.js.map +1 -0
  63. package/dist/errors.d.ts +23 -0
  64. package/dist/file-blob.d.ts +11 -0
  65. package/dist/index.d.ts +4 -0
  66. package/dist/index.js +186 -0
  67. package/dist/index.js.map +1 -0
  68. package/dist/inspection.d.ts +12 -0
  69. package/dist/kernel.d.ts +101 -0
  70. package/dist/lib-GQLPACFK.js +9746 -0
  71. package/dist/lib-GQLPACFK.js.map +1 -0
  72. package/dist/materializer-cli-entry.d.ts +2 -0
  73. package/dist/materializer-cli-entry.js +29 -0
  74. package/dist/materializer-cli-entry.js.map +1 -0
  75. package/dist/materializer-cli.d.ts +24 -0
  76. package/dist/materializer-cli.js +24 -0
  77. package/dist/materializer-cli.js.map +1 -0
  78. package/dist/native-raster.d.ts +10 -0
  79. package/dist/native.d.ts +129 -0
  80. package/dist/native.js +31 -0
  81. package/dist/native.js.map +1 -0
  82. package/dist/office-import.d.ts +48 -0
  83. package/dist/office-import.js +154 -0
  84. package/dist/office-import.js.map +1 -0
  85. package/dist/presentation-pptx-api.d.ts +60 -0
  86. package/dist/presentation-pptx-import.d.ts +5 -0
  87. package/dist/presentation-pptx-state-digest-765CZZED.js +10 -0
  88. package/dist/presentation-pptx-state-digest-765CZZED.js.map +1 -0
  89. package/dist/presentation-pptx-state-digest.d.ts +3 -0
  90. package/dist/presentation-pptx-state.d.ts +4 -0
  91. package/dist/presentation-pptx-xml.d.ts +29 -0
  92. package/dist/presentation-pptx.d.ts +5 -0
  93. package/dist/presentation-pptx.js +2365 -0
  94. package/dist/presentation-pptx.js.map +1 -0
  95. package/dist/presentation-render.d.ts +29 -0
  96. package/dist/presentation-render.js +375 -0
  97. package/dist/presentation-render.js.map +1 -0
  98. package/dist/presentation.d.ts +565 -0
  99. package/dist/presentation.js +71 -0
  100. package/dist/presentation.js.map +1 -0
  101. package/dist/production-composite.d.ts +68 -0
  102. package/dist/production-document.d.ts +2 -0
  103. package/dist/production-document.js +176 -0
  104. package/dist/production-document.js.map +1 -0
  105. package/dist/production-native-codecs.d.ts +94 -0
  106. package/dist/production-presentation.d.ts +2 -0
  107. package/dist/production-presentation.js +176 -0
  108. package/dist/production-presentation.js.map +1 -0
  109. package/dist/production-sha256.d.ts +2 -0
  110. package/dist/production-spreadsheet-native.d.ts +12 -0
  111. package/dist/production-spreadsheet.d.ts +2 -0
  112. package/dist/production-spreadsheet.js +176 -0
  113. package/dist/production-spreadsheet.js.map +1 -0
  114. package/dist/production.d.ts +96 -0
  115. package/dist/raster-image.d.ts +34 -0
  116. package/dist/reference.d.ts +17 -0
  117. package/dist/reference.js +574 -0
  118. package/dist/reference.js.map +1 -0
  119. package/dist/runtime-cli-entry.d.ts +2 -0
  120. package/dist/runtime-cli-entry.js +21 -0
  121. package/dist/runtime-cli-entry.js.map +1 -0
  122. package/dist/runtime-cli.d.ts +76 -0
  123. package/dist/runtime-cli.js +26 -0
  124. package/dist/runtime-cli.js.map +1 -0
  125. package/dist/runtime-development.d.ts +73 -0
  126. package/dist/runtime-development.js +30 -0
  127. package/dist/runtime-development.js.map +1 -0
  128. package/dist/runtime-receipt.d.ts +19 -0
  129. package/dist/runtime.d.ts +355 -0
  130. package/dist/runtime.js +42 -0
  131. package/dist/runtime.js.map +1 -0
  132. package/dist/snapshot.d.ts +26 -0
  133. package/dist/snapshot.js +61 -0
  134. package/dist/snapshot.js.map +1 -0
  135. package/dist/spreadsheet-address.d.ts +18 -0
  136. package/dist/spreadsheet-file.d.ts +17 -0
  137. package/dist/spreadsheet-formula.d.ts +67 -0
  138. package/dist/spreadsheet-image.d.ts +17 -0
  139. package/dist/spreadsheet-render.d.ts +5 -0
  140. package/dist/spreadsheet-render.js +752 -0
  141. package/dist/spreadsheet-render.js.map +1 -0
  142. package/dist/spreadsheet-types.d.ts +155 -0
  143. package/dist/spreadsheet-xlsx-api.d.ts +88 -0
  144. package/dist/spreadsheet-xlsx-codec.d.ts +16 -0
  145. package/dist/spreadsheet-xlsx-codec.js +16 -0
  146. package/dist/spreadsheet-xlsx-codec.js.map +1 -0
  147. package/dist/spreadsheet-xlsx-state.d.ts +16 -0
  148. package/dist/spreadsheet.d.ts +724 -0
  149. package/dist/spreadsheet.js +67 -0
  150. package/dist/spreadsheet.js.map +1 -0
  151. package/package.json +129 -0
  152. package/src/bounded-zip.ts +450 -0
  153. package/src/document-docx-api.ts +64 -0
  154. package/src/document-docx-codec.ts +2253 -0
  155. package/src/document-docx-import.ts +3814 -0
  156. package/src/document-docx-packer.ts +72 -0
  157. package/src/document-docx-state.ts +59 -0
  158. package/src/document-render.ts +615 -0
  159. package/src/document.ts +2800 -0
  160. package/src/errors.ts +45 -0
  161. package/src/file-blob.ts +43 -0
  162. package/src/index.ts +4 -0
  163. package/src/inspection.ts +50 -0
  164. package/src/kernel.ts +525 -0
  165. package/src/materializer-cli-entry.ts +11 -0
  166. package/src/materializer-cli.ts +743 -0
  167. package/src/native-raster.ts +141 -0
  168. package/src/native.ts +390 -0
  169. package/src/office-import.ts +243 -0
  170. package/src/presentation-pptx-api.ts +107 -0
  171. package/src/presentation-pptx-import.ts +2065 -0
  172. package/src/presentation-pptx-state-digest.ts +46 -0
  173. package/src/presentation-pptx-state.ts +18 -0
  174. package/src/presentation-pptx-xml.ts +473 -0
  175. package/src/presentation-pptx.ts +447 -0
  176. package/src/presentation-render.ts +532 -0
  177. package/src/presentation.ts +2599 -0
  178. package/src/production-composite.ts +805 -0
  179. package/src/production-document.ts +2 -0
  180. package/src/production-native-codecs.ts +1141 -0
  181. package/src/production-presentation.ts +2 -0
  182. package/src/production-sha256.ts +150 -0
  183. package/src/production-spreadsheet-native.ts +686 -0
  184. package/src/production-spreadsheet.ts +2 -0
  185. package/src/production.ts +1022 -0
  186. package/src/raster-image.ts +586 -0
  187. package/src/reference.ts +17 -0
  188. package/src/runtime-cli-entry.ts +13 -0
  189. package/src/runtime-cli.ts +670 -0
  190. package/src/runtime-development.ts +689 -0
  191. package/src/runtime-receipt.ts +169 -0
  192. package/src/runtime.ts +1463 -0
  193. package/src/snapshot.ts +88 -0
  194. package/src/spreadsheet-address.ts +90 -0
  195. package/src/spreadsheet-file.ts +71 -0
  196. package/src/spreadsheet-formula.ts +1212 -0
  197. package/src/spreadsheet-image.ts +242 -0
  198. package/src/spreadsheet-render.ts +985 -0
  199. package/src/spreadsheet-types.ts +171 -0
  200. package/src/spreadsheet-xlsx-api.ts +123 -0
  201. package/src/spreadsheet-xlsx-codec.ts +3063 -0
  202. package/src/spreadsheet-xlsx-state.ts +191 -0
  203. package/src/spreadsheet.ts +5195 -0
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ runArtifactMaterializerCli
4
+ } from "./chunk-NAG44K67.js";
5
+ import "./chunk-DCTLTNPW.js";
6
+ import "./chunk-U5G2BKM2.js";
7
+ import "./chunk-ZCJYRJGB.js";
8
+ import "./chunk-B2ZJRZDA.js";
9
+ import "./chunk-J6N7IR44.js";
10
+ import "./chunk-IYFXZQ34.js";
11
+ import "./chunk-4FRFNNBM.js";
12
+ import "./chunk-O24KTEGP.js";
13
+ import "./chunk-N2IHNWBS.js";
14
+ import "./chunk-72SYDU4O.js";
15
+ import "./chunk-FGZM4FQ6.js";
16
+ import "./chunk-4BSENMAE.js";
17
+ import "./chunk-Q2FFHEY7.js";
18
+ import "./chunk-VUNV25KB.js";
19
+
20
+ // src/materializer-cli-entry.ts
21
+ try {
22
+ await runArtifactMaterializerCli(process.argv.slice(2));
23
+ } catch (error) {
24
+ const message = error instanceof Error ? error.message : String(error);
25
+ process.stderr.write(`${JSON.stringify({ error: { code: "materializer_failed", message } })}
26
+ `);
27
+ process.exitCode = 1;
28
+ }
29
+ //# sourceMappingURL=materializer-cli-entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/materializer-cli-entry.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { runArtifactMaterializerCli } from \"./materializer-cli\";\n\ntry {\n await runArtifactMaterializerCli(process.argv.slice(2));\n} catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n process.stderr.write(`${JSON.stringify({ error: { code: \"materializer_failed\", message } })}\\n`);\n process.exitCode = 1;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAIA,IAAI;AACF,QAAM,2BAA2B,QAAQ,KAAK,MAAM,CAAC,CAAC;AACxD,SAAS,OAAO;AACd,QAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,UAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,EAAE,OAAO,EAAE,MAAM,uBAAuB,QAAQ,EAAE,CAAC,CAAC;AAAA,CAAI;AAC/F,UAAQ,WAAW;AACrB;","names":[]}
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ import type { ArtifactKernelRuntime } from "./runtime.js";
3
+ declare const XLSX_CODEC_ID = "opengeni.xlsx";
4
+ export type EditableArtifactNativeMaterializerCapabilities = Readonly<{
5
+ protocol: "OGAMC001";
6
+ runtimeKind: "native";
7
+ runtimeTarget: string;
8
+ kernelVersion: string;
9
+ codecVersions: Readonly<Record<typeof XLSX_CODEC_ID, string>>;
10
+ fontRegistryHash: string;
11
+ policyHash: string;
12
+ maxOutputBytes: number;
13
+ supportedModelSchemaVersions: readonly [1];
14
+ supportedOperationProtocolVersions: readonly [1];
15
+ supportedSnapshotProtocolVersions: readonly [1];
16
+ }>;
17
+ export declare function runArtifactMaterializerCli(args: readonly string[], environment?: Readonly<Record<string, string | undefined>>): Promise<void>;
18
+ /**
19
+ * Exact producer profile derived from the same verified native runtime used by
20
+ * the materializer child. The API uses this rather than accepting job identity
21
+ * facts from clients.
22
+ */
23
+ export declare function editableArtifactMaterializerCapabilitiesForRuntime(runtime: ArtifactKernelRuntime, packageVersion: string): EditableArtifactNativeMaterializerCapabilities;
24
+ export {};
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ editableArtifactMaterializerCapabilitiesForRuntime,
4
+ runArtifactMaterializerCli
5
+ } from "./chunk-NAG44K67.js";
6
+ import "./chunk-DCTLTNPW.js";
7
+ import "./chunk-U5G2BKM2.js";
8
+ import "./chunk-ZCJYRJGB.js";
9
+ import "./chunk-B2ZJRZDA.js";
10
+ import "./chunk-J6N7IR44.js";
11
+ import "./chunk-IYFXZQ34.js";
12
+ import "./chunk-4FRFNNBM.js";
13
+ import "./chunk-O24KTEGP.js";
14
+ import "./chunk-N2IHNWBS.js";
15
+ import "./chunk-72SYDU4O.js";
16
+ import "./chunk-FGZM4FQ6.js";
17
+ import "./chunk-4BSENMAE.js";
18
+ import "./chunk-Q2FFHEY7.js";
19
+ import "./chunk-VUNV25KB.js";
20
+ export {
21
+ editableArtifactMaterializerCapabilitiesForRuntime,
22
+ runArtifactMaterializerCli
23
+ };
24
+ //# sourceMappingURL=materializer-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Rasterize with an explicit font authority when the host configures one.
3
+ * Resvg otherwise succeeds while silently dropping every glyph on minimal
4
+ * Linux images. Sandboxes pin regular/bold/italic-capable Liberation faces;
5
+ * desktop installs retain their native system-font fallback.
6
+ */
7
+ export declare function rasterizeSvgToPng(svg: string, options?: Readonly<{
8
+ background?: string;
9
+ zoom?: number;
10
+ }>): Promise<Uint8Array>;
@@ -0,0 +1,129 @@
1
+ import { type EditableArtifactMutationIntent, type SpreadsheetArtifactCommandBatch } from "@opengeni/contracts/editable-artifacts";
2
+ import { ArtifactKernelRuntime, type ArtifactKernelCapabilities, type NativeArtifactRuntimeTarget } from "./runtime.js";
3
+ export { SPREADSHEET_ARTIFACT_COMMAND_VERSION, assertCanonicalSpreadsheetArtifactCommandBytes, decodeSpreadsheetArtifactCommandBatch, editableArtifactStableId, encodeSpreadsheetArtifactCommandBatch, spreadsheetSheetId, } from "@opengeni/contracts/editable-artifacts";
4
+ export type { EditableArtifactStableId, SpreadsheetArtifactCommand, SpreadsheetArtifactCommandBatch, SpreadsheetCellInput, SpreadsheetCellPoint, SpreadsheetCellRange, SpreadsheetSheetGeneration, SpreadsheetSheetPrecondition, } from "@opengeni/contracts/editable-artifacts";
5
+ export type NativeArtifactModality = "spreadsheet" | "document" | "presentation";
6
+ export type NativeSpreadsheetIntentFields = Omit<EditableArtifactMutationIntent, "envelopeVersion" | "protocolVersion" | "modelSchemaVersion" | "commandProtocolVersion" | "commandBytes">;
7
+ export type NativeSpreadsheetAuthorCommandsInput = Readonly<{
8
+ intent: NativeSpreadsheetIntentFields;
9
+ commands: SpreadsheetArtifactCommandBatch;
10
+ /** Exact authoritative OGACF001 base selected for this apply attempt. */
11
+ resolvedBaseBytes: Uint8Array;
12
+ }>;
13
+ export type NativeSpreadsheetAuthoredTransaction = Readonly<{
14
+ /** Exact canonical OGATX001 bytes passed to Rust. */
15
+ intentBytes: Uint8Array;
16
+ requestHash: string;
17
+ /** One whole canonical OGACO001 transaction returned by Rust. */
18
+ committedTransactionBytes: Uint8Array;
19
+ }>;
20
+ export type CreateNativeArtifactSessionInput = Readonly<{
21
+ modality: NativeArtifactModality;
22
+ replicaNamespace: bigint;
23
+ }>;
24
+ export type OpenNativeArtifactSessionInput = Readonly<{
25
+ modality: NativeArtifactModality;
26
+ snapshot: Uint8Array;
27
+ }>;
28
+ export type NativeArtifactSession = NativeSpreadsheetSession | NativeDocumentSession | NativePresentationSession;
29
+ /**
30
+ * Synchronous Node/Bun production spreadsheet session backed only by the
31
+ * verified Rust N-API collaboration kernel. It never selects the TypeScript
32
+ * reference model and deliberately rejects a browser/WASM runtime; browsers
33
+ * use the asynchronous `@opengeni/sdk/editable-artifacts` Worker API.
34
+ */
35
+ export declare class NativeSpreadsheetSession {
36
+ private readonly runtime;
37
+ private readonly session;
38
+ readonly kind: "native";
39
+ readonly modality: "spreadsheet";
40
+ readonly target: NativeArtifactRuntimeTarget;
41
+ readonly capabilities: ArtifactKernelCapabilities;
42
+ readonly buildIdentity: string;
43
+ private constructor();
44
+ static create(runtime: ArtifactKernelRuntime, replicaNamespace: bigint): NativeSpreadsheetSession;
45
+ static open(runtime: ArtifactKernelRuntime, snapshot: Uint8Array): NativeSpreadsheetSession;
46
+ /**
47
+ * Authors one already-canonical mutation. Rust independently validates the
48
+ * exact OGATX/OGASC bytes, resolves typed operations, applies atomically, and
49
+ * returns the whole canonical OGACO transaction.
50
+ */
51
+ authorTransaction(intentBytes: Uint8Array, resolvedBaseBytes: Uint8Array): Uint8Array;
52
+ /** Encodes one identity-free typed command batch and authors it atomically. */
53
+ authorCommands(input: NativeSpreadsheetAuthorCommandsInput): NativeSpreadsheetAuthoredTransaction;
54
+ /** Replays one whole authoritative OGACO transaction atomically. */
55
+ applyCommitted(committedTransactionBytes: Uint8Array): void;
56
+ /**
57
+ * Executes one canonical OGAKQ request. Typed viewport/metadata helpers use
58
+ * the shared contract codec; this raw method remains useful at server byte
59
+ * boundaries and never exposes a Rust object layout.
60
+ */
61
+ query(queryBytes: Uint8Array): Uint8Array;
62
+ snapshot(): Uint8Array;
63
+ frontier(): Uint8Array;
64
+ stateHash(): string;
65
+ revision(): bigint;
66
+ fork(): NativeSpreadsheetSession;
67
+ isClosed(): boolean;
68
+ dispose(): void;
69
+ }
70
+ /** Exact synchronous N-API structured-document byte session. */
71
+ export declare class NativeDocumentSession {
72
+ private readonly runtime;
73
+ private readonly session;
74
+ readonly kind: "native";
75
+ readonly modality: "document";
76
+ readonly target: NativeArtifactRuntimeTarget;
77
+ readonly capabilities: ArtifactKernelCapabilities;
78
+ readonly buildIdentity: string;
79
+ private constructor();
80
+ static create(runtime: ArtifactKernelRuntime, namespace: bigint): NativeDocumentSession;
81
+ static open(runtime: ArtifactKernelRuntime, snapshot: Uint8Array): NativeDocumentSession;
82
+ applyCommands(commands: Uint8Array): Uint8Array;
83
+ query(request: Uint8Array): Uint8Array;
84
+ snapshot(): Uint8Array;
85
+ revision(): bigint;
86
+ stateHash(): string;
87
+ fork(): NativeDocumentSession;
88
+ isClosed(): boolean;
89
+ dispose(): void;
90
+ }
91
+ /** Exact synchronous N-API presentation byte session. */
92
+ export declare class NativePresentationSession {
93
+ private readonly runtime;
94
+ private readonly session;
95
+ readonly kind: "native";
96
+ readonly modality: "presentation";
97
+ readonly target: NativeArtifactRuntimeTarget;
98
+ readonly capabilities: ArtifactKernelCapabilities;
99
+ readonly buildIdentity: string;
100
+ private constructor();
101
+ static create(runtime: ArtifactKernelRuntime, namespace: bigint): NativePresentationSession;
102
+ static open(runtime: ArtifactKernelRuntime, snapshot: Uint8Array): NativePresentationSession;
103
+ applyCommands(commands: Uint8Array): Uint8Array;
104
+ query(request: Uint8Array): Uint8Array;
105
+ snapshot(): Uint8Array;
106
+ revision(): bigint;
107
+ stateHash(): string;
108
+ fork(): NativePresentationSession;
109
+ isClosed(): boolean;
110
+ dispose(): void;
111
+ }
112
+ /** Exact synchronous N-API retained-font text-layout session. */
113
+ export declare class NativeTextLayoutSession {
114
+ private readonly session;
115
+ readonly kind: "native";
116
+ readonly modality: "text-layout";
117
+ readonly target: NativeArtifactRuntimeTarget;
118
+ readonly capabilities: ArtifactKernelCapabilities;
119
+ readonly buildIdentity: string;
120
+ private constructor();
121
+ static open(runtime: ArtifactKernelRuntime, fontBundle: Uint8Array): NativeTextLayoutSession;
122
+ layout(request: Uint8Array): Uint8Array;
123
+ isClosed(): boolean;
124
+ dispose(): void;
125
+ }
126
+ /** Creates a production modality session; unsupported Rust modes fail closed. */
127
+ export declare function createNativeArtifactSession(runtime: ArtifactKernelRuntime, input: CreateNativeArtifactSessionInput): NativeArtifactSession;
128
+ /** Opens a production modality session; unsupported Rust modes fail closed. */
129
+ export declare function openNativeArtifactSession(runtime: ArtifactKernelRuntime, input: OpenNativeArtifactSessionInput): NativeArtifactSession;
package/dist/native.js ADDED
@@ -0,0 +1,31 @@
1
+ import {
2
+ NativeDocumentSession,
3
+ NativePresentationSession,
4
+ NativeSpreadsheetSession,
5
+ NativeTextLayoutSession,
6
+ SPREADSHEET_ARTIFACT_COMMAND_VERSION,
7
+ assertCanonicalSpreadsheetArtifactCommandBytes,
8
+ createNativeArtifactSession,
9
+ decodeSpreadsheetArtifactCommandBatch,
10
+ editableArtifactStableId,
11
+ encodeSpreadsheetArtifactCommandBatch,
12
+ openNativeArtifactSession,
13
+ spreadsheetSheetId
14
+ } from "./chunk-B2ZJRZDA.js";
15
+ import "./chunk-N2IHNWBS.js";
16
+ import "./chunk-VUNV25KB.js";
17
+ export {
18
+ NativeDocumentSession,
19
+ NativePresentationSession,
20
+ NativeSpreadsheetSession,
21
+ NativeTextLayoutSession,
22
+ SPREADSHEET_ARTIFACT_COMMAND_VERSION,
23
+ assertCanonicalSpreadsheetArtifactCommandBytes,
24
+ createNativeArtifactSession,
25
+ decodeSpreadsheetArtifactCommandBatch,
26
+ editableArtifactStableId,
27
+ encodeSpreadsheetArtifactCommandBatch,
28
+ openNativeArtifactSession,
29
+ spreadsheetSheetId
30
+ };
31
+ //# sourceMappingURL=native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,48 @@
1
+ export type ArtifactOfficeModality = "spreadsheet" | "document" | "presentation";
2
+ export type ArtifactOfficeMimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.openxmlformats-officedocument.presentationml.presentation";
3
+ export type PreparedArtifactOfficeImport = Readonly<{
4
+ source: Readonly<{
5
+ filename: string;
6
+ byteSize: number;
7
+ contentHash: `sha256:${string}`;
8
+ mimeType: ArtifactOfficeMimeType;
9
+ }>;
10
+ snapshot: Readonly<{
11
+ modality: "spreadsheet";
12
+ bytes: Uint8Array;
13
+ byteSize: number;
14
+ contentHash: `sha256:${string}`;
15
+ stateHash: `sha256:${string}`;
16
+ modelSchemaVersion: 1;
17
+ kernelVersion: string;
18
+ coveredCausalFrontier: readonly Readonly<{
19
+ replicaId: string;
20
+ counter: number;
21
+ }>[];
22
+ operationProtocolVersion: 1;
23
+ crdtStateVersion: 1;
24
+ }> | Readonly<{
25
+ modality: "document" | "presentation";
26
+ bytes: Uint8Array;
27
+ byteSize: number;
28
+ contentHash: `sha256:${string}`;
29
+ stateHash: `sha256:${string}`;
30
+ modelSchemaVersion: 1;
31
+ kernelVersion: string;
32
+ nativeRevision: number;
33
+ }>;
34
+ }>;
35
+ /** The Office container is valid input bytes but cannot be modeled safely. */
36
+ export declare class ArtifactOfficeSourceUnsupportedError extends Error {
37
+ constructor(extension: ".xlsx" | ".docx" | ".pptx", options: ErrorOptions);
38
+ }
39
+ /** Import bounded Office bytes through the exact verified facade, without a local path. */
40
+ export declare function prepareArtifactOfficeImport(input: Readonly<{
41
+ facade: unknown;
42
+ modality: ArtifactOfficeModality;
43
+ filename: string;
44
+ mimeType: ArtifactOfficeMimeType;
45
+ bytes: Uint8Array;
46
+ expectedRuntimeTarget: string;
47
+ expectedKernelVersion: string;
48
+ }>): Promise<PreparedArtifactOfficeImport>;
@@ -0,0 +1,154 @@
1
+ import "./chunk-VUNV25KB.js";
2
+
3
+ // src/office-import.ts
4
+ import { createHash } from "crypto";
5
+ import { decodeEditableArtifactCausalFrontier } from "@opengeni/contracts/editable-artifact-causal-frontier";
6
+ import { EDITABLE_ARTIFACT_PRODUCT_MAX_SNAPSHOT_BYTES } from "@opengeni/contracts/editable-artifacts";
7
+ var ArtifactOfficeSourceUnsupportedError = class extends Error {
8
+ constructor(extension, options) {
9
+ super(`The ${extension} source could not be imported`, options);
10
+ this.name = "ArtifactOfficeSourceUnsupportedError";
11
+ }
12
+ };
13
+ async function prepareArtifactOfficeImport(input) {
14
+ const expected = officeFormat(input.modality);
15
+ if (input.mimeType !== expected.mimeType) {
16
+ throw new TypeError("Office MIME type does not match artifact modality");
17
+ }
18
+ if (!input.filename.toLowerCase().endsWith(expected.extension)) {
19
+ throw new TypeError(`Office filename must end with ${expected.extension}`);
20
+ }
21
+ if (!(input.bytes instanceof Uint8Array) || input.bytes.byteLength < 1) {
22
+ throw new TypeError("Office source bytes must be a nonempty Uint8Array");
23
+ }
24
+ if (input.bytes.byteLength > EDITABLE_ARTIFACT_PRODUCT_MAX_SNAPSHOT_BYTES) {
25
+ throw new RangeError("Office source exceeds the editable artifact product limit");
26
+ }
27
+ const sourceBytes = Uint8Array.from(input.bytes);
28
+ const module = exactModule(input.facade);
29
+ const fileBlob = exactNamespace(module.FileBlob, "FileBlob");
30
+ const fromBytes = exactFunction(fileBlob.fromBytes, "FileBlob.fromBytes");
31
+ const createSnapshot = exactFunction(module.createArtifactSnapshot, "createArtifactSnapshot");
32
+ const disposeArtifact = exactFunction(module.disposeArtifact, "disposeArtifact");
33
+ const importer = officeImporter(module, input.modality);
34
+ const blob = Reflect.apply(fromBytes, fileBlob, [
35
+ sourceBytes,
36
+ { name: input.filename, type: input.mimeType }
37
+ ]);
38
+ let artifact;
39
+ try {
40
+ artifact = await importer(blob);
41
+ } catch (cause) {
42
+ throw new ArtifactOfficeSourceUnsupportedError(expected.extension, { cause });
43
+ }
44
+ try {
45
+ const snapshot = validateSnapshot(
46
+ Reflect.apply(createSnapshot, module, [artifact]),
47
+ input.modality,
48
+ input.expectedRuntimeTarget,
49
+ input.expectedKernelVersion
50
+ );
51
+ return Object.freeze({
52
+ source: Object.freeze({
53
+ filename: input.filename,
54
+ byteSize: sourceBytes.byteLength,
55
+ contentHash: sha256(sourceBytes),
56
+ mimeType: input.mimeType
57
+ }),
58
+ snapshot
59
+ });
60
+ } finally {
61
+ Reflect.apply(disposeArtifact, module, [artifact]);
62
+ }
63
+ }
64
+ function validateSnapshot(value, modality, expectedRuntimeTarget, expectedKernelVersion) {
65
+ const snapshot = exactNamespace(value, "artifact snapshot");
66
+ if (snapshot.schemaVersion !== 1 || snapshot.modality !== modality || snapshot.runtimeTarget !== expectedRuntimeTarget || snapshot.kernelVersion !== expectedKernelVersion || snapshot.modelSchemaVersion !== 1 || snapshot.snapshotVersion !== 1 || !/^sha256:[0-9a-f]{64}$/u.test(snapshot.stateHash)) {
67
+ throw new TypeError("Imported snapshot differs from the verified native runtime boundary");
68
+ }
69
+ if (!(snapshot.snapshotBytes instanceof Uint8Array) || snapshot.snapshotBytes.byteLength < 1 || snapshot.snapshotBytes.byteLength > EDITABLE_ARTIFACT_PRODUCT_MAX_SNAPSHOT_BYTES) {
70
+ throw new TypeError("Imported snapshot bytes are outside the product limit");
71
+ }
72
+ const bytes = Uint8Array.from(snapshot.snapshotBytes);
73
+ const common = {
74
+ bytes,
75
+ byteSize: bytes.byteLength,
76
+ contentHash: sha256(bytes),
77
+ stateHash: snapshot.stateHash,
78
+ modelSchemaVersion: 1,
79
+ kernelVersion: snapshot.kernelVersion
80
+ };
81
+ if (snapshot.modality === "spreadsheet") {
82
+ if (!(snapshot.coveredCausalFrontierBytes instanceof Uint8Array) || snapshot.operationProtocolVersion !== 1 || snapshot.crdtStateVersion !== 1) {
83
+ throw new TypeError("Imported spreadsheet snapshot coverage is invalid");
84
+ }
85
+ return Object.freeze({
86
+ ...common,
87
+ modality: "spreadsheet",
88
+ coveredCausalFrontier: decodeEditableArtifactCausalFrontier(
89
+ snapshot.coveredCausalFrontierBytes
90
+ ),
91
+ operationProtocolVersion: 1,
92
+ crdtStateVersion: 1
93
+ });
94
+ }
95
+ if (!Number.isSafeInteger(snapshot.nativeRevision) || snapshot.nativeRevision < 0) {
96
+ throw new TypeError("Imported serialized snapshot revision is invalid");
97
+ }
98
+ return Object.freeze({
99
+ ...common,
100
+ modality: snapshot.modality,
101
+ nativeRevision: snapshot.nativeRevision
102
+ });
103
+ }
104
+ function officeImporter(module, modality) {
105
+ const namespaceName = modality === "spreadsheet" ? "SpreadsheetFile" : modality === "document" ? "DocumentFile" : "PresentationFile";
106
+ const methodName = modality === "spreadsheet" ? "importXlsx" : modality === "document" ? "importDocx" : "importPptx";
107
+ const namespace = exactNamespace(module[namespaceName], namespaceName);
108
+ const method = exactFunction(namespace[methodName], `${namespaceName}.${methodName}`);
109
+ return async (blob) => await Reflect.apply(method, namespace, [blob]);
110
+ }
111
+ function officeFormat(modality) {
112
+ if (modality === "spreadsheet") {
113
+ return {
114
+ extension: ".xlsx",
115
+ mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
116
+ };
117
+ }
118
+ if (modality === "document") {
119
+ return {
120
+ extension: ".docx",
121
+ mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
122
+ };
123
+ }
124
+ return {
125
+ extension: ".pptx",
126
+ mimeType: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
127
+ };
128
+ }
129
+ function exactModule(value) {
130
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
131
+ throw new TypeError("Verified artifact facade must be a module namespace");
132
+ }
133
+ return value;
134
+ }
135
+ function exactNamespace(value, label) {
136
+ if (typeof value !== "object" && typeof value !== "function" || value === null) {
137
+ throw new TypeError(`Verified artifact facade is missing ${label}`);
138
+ }
139
+ return value;
140
+ }
141
+ function exactFunction(value, label) {
142
+ if (typeof value !== "function") {
143
+ throw new TypeError(`Verified artifact facade is missing ${label}()`);
144
+ }
145
+ return value;
146
+ }
147
+ function sha256(bytes) {
148
+ return `sha256:${createHash("sha256").update(bytes).digest("hex")}`;
149
+ }
150
+ export {
151
+ ArtifactOfficeSourceUnsupportedError,
152
+ prepareArtifactOfficeImport
153
+ };
154
+ //# sourceMappingURL=office-import.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/office-import.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { decodeEditableArtifactCausalFrontier } from \"@opengeni/contracts/editable-artifact-causal-frontier\";\nimport { EDITABLE_ARTIFACT_PRODUCT_MAX_SNAPSHOT_BYTES } from \"@opengeni/contracts/editable-artifacts\";\nimport type { ArtifactSnapshot } from \"./snapshot\";\n\nexport type ArtifactOfficeModality = \"spreadsheet\" | \"document\" | \"presentation\";\nexport type ArtifactOfficeMimeType =\n | \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"\n | \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\"\n | \"application/vnd.openxmlformats-officedocument.presentationml.presentation\";\n\nexport type PreparedArtifactOfficeImport = Readonly<{\n source: Readonly<{\n filename: string;\n byteSize: number;\n contentHash: `sha256:${string}`;\n mimeType: ArtifactOfficeMimeType;\n }>;\n snapshot:\n | Readonly<{\n modality: \"spreadsheet\";\n bytes: Uint8Array;\n byteSize: number;\n contentHash: `sha256:${string}`;\n stateHash: `sha256:${string}`;\n modelSchemaVersion: 1;\n kernelVersion: string;\n coveredCausalFrontier: readonly Readonly<{ replicaId: string; counter: number }>[];\n operationProtocolVersion: 1;\n crdtStateVersion: 1;\n }>\n | Readonly<{\n modality: \"document\" | \"presentation\";\n bytes: Uint8Array;\n byteSize: number;\n contentHash: `sha256:${string}`;\n stateHash: `sha256:${string}`;\n modelSchemaVersion: 1;\n kernelVersion: string;\n nativeRevision: number;\n }>;\n}>;\n\n/** The Office container is valid input bytes but cannot be modeled safely. */\nexport class ArtifactOfficeSourceUnsupportedError extends Error {\n constructor(extension: \".xlsx\" | \".docx\" | \".pptx\", options: ErrorOptions) {\n super(`The ${extension} source could not be imported`, options);\n this.name = \"ArtifactOfficeSourceUnsupportedError\";\n }\n}\n\n/** Import bounded Office bytes through the exact verified facade, without a local path. */\nexport async function prepareArtifactOfficeImport(\n input: Readonly<{\n facade: unknown;\n modality: ArtifactOfficeModality;\n filename: string;\n mimeType: ArtifactOfficeMimeType;\n bytes: Uint8Array;\n expectedRuntimeTarget: string;\n expectedKernelVersion: string;\n }>,\n): Promise<PreparedArtifactOfficeImport> {\n const expected = officeFormat(input.modality);\n if (input.mimeType !== expected.mimeType) {\n throw new TypeError(\"Office MIME type does not match artifact modality\");\n }\n if (!input.filename.toLowerCase().endsWith(expected.extension)) {\n throw new TypeError(`Office filename must end with ${expected.extension}`);\n }\n if (!(input.bytes instanceof Uint8Array) || input.bytes.byteLength < 1) {\n throw new TypeError(\"Office source bytes must be a nonempty Uint8Array\");\n }\n if (input.bytes.byteLength > EDITABLE_ARTIFACT_PRODUCT_MAX_SNAPSHOT_BYTES) {\n throw new RangeError(\"Office source exceeds the editable artifact product limit\");\n }\n const sourceBytes = Uint8Array.from(input.bytes);\n const module = exactModule(input.facade);\n const fileBlob = exactNamespace(module.FileBlob, \"FileBlob\");\n const fromBytes = exactFunction(fileBlob.fromBytes, \"FileBlob.fromBytes\");\n const createSnapshot = exactFunction(module.createArtifactSnapshot, \"createArtifactSnapshot\");\n const disposeArtifact = exactFunction(module.disposeArtifact, \"disposeArtifact\");\n const importer = officeImporter(module, input.modality);\n const blob = Reflect.apply(fromBytes, fileBlob, [\n sourceBytes,\n { name: input.filename, type: input.mimeType },\n ]);\n let artifact: unknown;\n try {\n artifact = await importer(blob);\n } catch (cause) {\n throw new ArtifactOfficeSourceUnsupportedError(expected.extension, { cause });\n }\n try {\n const snapshot = validateSnapshot(\n Reflect.apply(createSnapshot, module, [artifact]),\n input.modality,\n input.expectedRuntimeTarget,\n input.expectedKernelVersion,\n );\n return Object.freeze({\n source: Object.freeze({\n filename: input.filename,\n byteSize: sourceBytes.byteLength,\n contentHash: sha256(sourceBytes),\n mimeType: input.mimeType,\n }),\n snapshot,\n });\n } finally {\n Reflect.apply(disposeArtifact, module, [artifact]);\n }\n}\n\nfunction validateSnapshot(\n value: unknown,\n modality: ArtifactOfficeModality,\n expectedRuntimeTarget: string,\n expectedKernelVersion: string,\n): PreparedArtifactOfficeImport[\"snapshot\"] {\n const snapshot = exactNamespace(value, \"artifact snapshot\") as unknown as ArtifactSnapshot;\n if (\n snapshot.schemaVersion !== 1 ||\n snapshot.modality !== modality ||\n snapshot.runtimeTarget !== expectedRuntimeTarget ||\n snapshot.kernelVersion !== expectedKernelVersion ||\n snapshot.modelSchemaVersion !== 1 ||\n snapshot.snapshotVersion !== 1 ||\n !/^sha256:[0-9a-f]{64}$/u.test(snapshot.stateHash)\n ) {\n throw new TypeError(\"Imported snapshot differs from the verified native runtime boundary\");\n }\n if (\n !(snapshot.snapshotBytes instanceof Uint8Array) ||\n snapshot.snapshotBytes.byteLength < 1 ||\n snapshot.snapshotBytes.byteLength > EDITABLE_ARTIFACT_PRODUCT_MAX_SNAPSHOT_BYTES\n ) {\n throw new TypeError(\"Imported snapshot bytes are outside the product limit\");\n }\n const bytes = Uint8Array.from(snapshot.snapshotBytes);\n const common = {\n bytes,\n byteSize: bytes.byteLength,\n contentHash: sha256(bytes),\n stateHash: snapshot.stateHash as `sha256:${string}`,\n modelSchemaVersion: 1 as const,\n kernelVersion: snapshot.kernelVersion,\n };\n if (snapshot.modality === \"spreadsheet\") {\n if (\n !(snapshot.coveredCausalFrontierBytes instanceof Uint8Array) ||\n snapshot.operationProtocolVersion !== 1 ||\n snapshot.crdtStateVersion !== 1\n ) {\n throw new TypeError(\"Imported spreadsheet snapshot coverage is invalid\");\n }\n return Object.freeze({\n ...common,\n modality: \"spreadsheet\" as const,\n coveredCausalFrontier: decodeEditableArtifactCausalFrontier(\n snapshot.coveredCausalFrontierBytes,\n ),\n operationProtocolVersion: 1 as const,\n crdtStateVersion: 1 as const,\n });\n }\n if (!Number.isSafeInteger(snapshot.nativeRevision) || snapshot.nativeRevision < 0) {\n throw new TypeError(\"Imported serialized snapshot revision is invalid\");\n }\n return Object.freeze({\n ...common,\n modality: snapshot.modality,\n nativeRevision: snapshot.nativeRevision,\n });\n}\n\nfunction officeImporter(\n module: Record<string, unknown>,\n modality: ArtifactOfficeModality,\n): (input: unknown) => Promise<unknown> {\n const namespaceName =\n modality === \"spreadsheet\"\n ? \"SpreadsheetFile\"\n : modality === \"document\"\n ? \"DocumentFile\"\n : \"PresentationFile\";\n const methodName =\n modality === \"spreadsheet\"\n ? \"importXlsx\"\n : modality === \"document\"\n ? \"importDocx\"\n : \"importPptx\";\n const namespace = exactNamespace(module[namespaceName], namespaceName);\n const method = exactFunction(namespace[methodName], `${namespaceName}.${methodName}`);\n return async (blob) => await Reflect.apply(method, namespace, [blob]);\n}\n\nfunction officeFormat(modality: ArtifactOfficeModality): Readonly<{\n extension: \".xlsx\" | \".docx\" | \".pptx\";\n mimeType: ArtifactOfficeMimeType;\n}> {\n if (modality === \"spreadsheet\") {\n return {\n extension: \".xlsx\",\n mimeType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n };\n }\n if (modality === \"document\") {\n return {\n extension: \".docx\",\n mimeType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n };\n }\n return {\n extension: \".pptx\",\n mimeType: \"application/vnd.openxmlformats-officedocument.presentationml.presentation\",\n };\n}\n\nfunction exactModule(value: unknown): Record<string, unknown> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new TypeError(\"Verified artifact facade must be a module namespace\");\n }\n return value as Record<string, unknown>;\n}\n\nfunction exactNamespace(value: unknown, label: string): Record<string, unknown> {\n if ((typeof value !== \"object\" && typeof value !== \"function\") || value === null) {\n throw new TypeError(`Verified artifact facade is missing ${label}`);\n }\n return value as Record<string, unknown>;\n}\n\nfunction exactFunction(value: unknown, label: string): (...args: unknown[]) => unknown {\n if (typeof value !== \"function\") {\n throw new TypeError(`Verified artifact facade is missing ${label}()`);\n }\n return value as (...args: unknown[]) => unknown;\n}\n\nfunction sha256(bytes: Uint8Array): `sha256:${string}` {\n return `sha256:${createHash(\"sha256\").update(bytes).digest(\"hex\")}`;\n}\n"],"mappings":"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","names":[]}
@@ -0,0 +1,60 @@
1
+ export declare const PPTX_MEDIA_TYPE: "application/vnd.openxmlformats-officedocument.presentationml.presentation";
2
+ export type PresentationPptxFeature = "animation" | "audio" | "custom-geometry" | "connector" | "embedded-object" | "group" | "hyperlink" | "master" | "layout" | "media" | "placeholder" | "source-only" | "smart-art" | "table-style" | "theme" | "transition" | "unsupported-chart" | "video";
3
+ export type PresentationFidelityIssue = {
4
+ code: "content-preserved-in-source" | "content-will-be-discarded" | "group-will-be-flattened" | "style-approximated";
5
+ severity: "warning" | "error";
6
+ feature: PresentationPptxFeature;
7
+ message: string;
8
+ parts?: readonly string[];
9
+ };
10
+ export type PresentationPptxImportLimits = {
11
+ compressedBytes: number;
12
+ expandedBytes: number;
13
+ entryBytes: number;
14
+ entries: number;
15
+ compressionRatio: number;
16
+ totalXmlBytes: number;
17
+ xmlBytes: number;
18
+ xmlDepth: number;
19
+ xmlNodes: number;
20
+ xmlAttributesPerElement: number;
21
+ relationshipsPerPart: number;
22
+ relationships: number;
23
+ slides: number;
24
+ elements: number;
25
+ textCharacters: number;
26
+ imageBytes: number;
27
+ chartPoints: number;
28
+ nestedPackageBytes: number;
29
+ nestedExpandedBytes: number;
30
+ nestedEntries: number;
31
+ retainedBytes: number;
32
+ };
33
+ export type PresentationPptxImportOptions = {
34
+ /** Preserve unsupported, inert content in the original package or reject it. */
35
+ unsupportedContent?: "preserve" | "error";
36
+ /** Every limit is applied before or while allocating decoded package state. */
37
+ limits?: Partial<PresentationPptxImportLimits>;
38
+ };
39
+ export type PresentationPptxExportOptions = {
40
+ fileName?: string;
41
+ /** Explicitly acknowledge content the editable model cannot regenerate. */
42
+ unsupportedContent?: "error" | "discard";
43
+ };
44
+ export type PresentationLossPreservationEnvelope = {
45
+ version: 1;
46
+ mediaType: typeof PPTX_MEDIA_TYPE;
47
+ sourceBytes: Uint8Array;
48
+ sourceDigest: string;
49
+ unsupportedParts: readonly string[];
50
+ modelDigest: string;
51
+ };
52
+ export declare class PresentationFidelityError extends Error {
53
+ readonly issues: readonly PresentationFidelityIssue[];
54
+ constructor(message: string, issues: readonly PresentationFidelityIssue[]);
55
+ }
56
+ export declare class PresentationSecurityError extends Error {
57
+ readonly code: "active-content" | "encrypted-content" | "external-relationship" | "invalid-package" | "limit-exceeded" | "unsafe-xml";
58
+ readonly entryName?: string | undefined;
59
+ constructor(message: string, code: "active-content" | "encrypted-content" | "external-relationship" | "invalid-package" | "limit-exceeded" | "unsafe-xml", entryName?: string | undefined);
60
+ }
@@ -0,0 +1,5 @@
1
+ import { FileBlob } from "./file-blob.js";
2
+ import { Presentation } from "./presentation.js";
3
+ import { type PresentationPptxImportLimits, type PresentationPptxImportOptions } from "./presentation-pptx-api.js";
4
+ export declare const DEFAULT_PPTX_IMPORT_LIMITS: PresentationPptxImportLimits;
5
+ export declare function importPresentationPptx(input: FileBlob | Blob | ArrayBuffer | Uint8Array, options?: PresentationPptxImportOptions): Promise<Presentation>;
@@ -0,0 +1,10 @@
1
+ import {
2
+ presentationModelDigest,
3
+ sha256Hex
4
+ } from "./chunk-5XIA6KHZ.js";
5
+ import "./chunk-VUNV25KB.js";
6
+ export {
7
+ presentationModelDigest,
8
+ sha256Hex
9
+ };
10
+ //# sourceMappingURL=presentation-pptx-state-digest-765CZZED.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,3 @@
1
+ import type { Presentation } from "./presentation.js";
2
+ export declare function presentationModelDigest(presentation: Presentation): Promise<string>;
3
+ export declare function sha256Hex(bytes: Uint8Array): Promise<string>;
@@ -0,0 +1,4 @@
1
+ import type { Presentation } from "./presentation.js";
2
+ import type { PresentationLossPreservationEnvelope } from "./presentation-pptx-api.js";
3
+ export declare function presentationLossState(presentation: Presentation): PresentationLossPreservationEnvelope | undefined;
4
+ export declare function setPresentationLossState(presentation: Presentation, envelope: PresentationLossPreservationEnvelope | undefined): void;
@@ -0,0 +1,29 @@
1
+ import { PresentationSecurityError, type PresentationPptxImportLimits } from "./presentation-pptx-api.js";
2
+ export type PptxXmlNode = PptxXmlElement | {
3
+ type: "text";
4
+ value: string;
5
+ };
6
+ export type PptxXmlElement = {
7
+ type: "element";
8
+ name: string;
9
+ localName: string;
10
+ attributes: ReadonlyMap<string, string>;
11
+ /** Resolved namespace bindings, populated by parsePptxXmlPart validation. */
12
+ namespaceUri?: string;
13
+ attributeNamespaces?: ReadonlyMap<string, string | undefined>;
14
+ children: PptxXmlNode[];
15
+ };
16
+ export type PptxXmlBudget = {
17
+ limits: PresentationPptxImportLimits;
18
+ totalBytes: number;
19
+ totalNodes: number;
20
+ };
21
+ export declare function parsePptxXmlPart(bytes: Uint8Array, partName: string, budget: PptxXmlBudget): PptxXmlElement;
22
+ export declare function pptxXmlChildren(element: PptxXmlElement | undefined): PptxXmlElement[];
23
+ export declare function pptxXmlChild(element: PptxXmlElement | undefined, localName: string): PptxXmlElement | undefined;
24
+ export declare function pptxXmlDescendants(element: PptxXmlElement | undefined, localName: string): PptxXmlElement[];
25
+ export declare function pptxXmlAttribute(element: PptxXmlElement | undefined, localName: string): string | undefined;
26
+ export declare function pptxXmlQualifiedAttribute(element: PptxXmlElement | undefined, qualifiedName: string): string | undefined;
27
+ export declare function pptxXmlText(element: PptxXmlElement | undefined): string;
28
+ export declare function pptxXmlDirectText(element: PptxXmlElement | undefined): string;
29
+ export declare function pptxXmlSecurity(message: string, code: PresentationSecurityError["code"], entryName?: string): PresentationSecurityError;
@@ -0,0 +1,5 @@
1
+ import { FileBlob } from "./file-blob.js";
2
+ import { type Presentation } from "./presentation.js";
3
+ import { type PresentationPptxExportOptions } from "./presentation-pptx-api.js";
4
+ export { importPresentationPptx } from "./presentation-pptx-import.js";
5
+ export declare function exportPresentationPptx(presentation: Presentation, options?: PresentationPptxExportOptions): Promise<FileBlob>;