@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.
- package/LICENSE +190 -0
- package/README.md +104 -0
- package/dist/bounded-zip.d.ts +28 -0
- package/dist/chunk-4BSENMAE.js +39 -0
- package/dist/chunk-4BSENMAE.js.map +1 -0
- package/dist/chunk-4FRFNNBM.js +276 -0
- package/dist/chunk-4FRFNNBM.js.map +1 -0
- package/dist/chunk-5XIA6KHZ.js +49 -0
- package/dist/chunk-5XIA6KHZ.js.map +1 -0
- package/dist/chunk-66CT2ZRP.js +2229 -0
- package/dist/chunk-66CT2ZRP.js.map +1 -0
- package/dist/chunk-72SYDU4O.js +319 -0
- package/dist/chunk-72SYDU4O.js.map +1 -0
- package/dist/chunk-B2ZJRZDA.js +279 -0
- package/dist/chunk-B2ZJRZDA.js.map +1 -0
- package/dist/chunk-DCTLTNPW.js +2458 -0
- package/dist/chunk-DCTLTNPW.js.map +1 -0
- package/dist/chunk-FGZM4FQ6.js +473 -0
- package/dist/chunk-FGZM4FQ6.js.map +1 -0
- package/dist/chunk-HTJBLBDE.js +591 -0
- package/dist/chunk-HTJBLBDE.js.map +1 -0
- package/dist/chunk-IYFXZQ34.js +5306 -0
- package/dist/chunk-IYFXZQ34.js.map +1 -0
- package/dist/chunk-J6N7IR44.js +172 -0
- package/dist/chunk-J6N7IR44.js.map +1 -0
- package/dist/chunk-N2IHNWBS.js +1002 -0
- package/dist/chunk-N2IHNWBS.js.map +1 -0
- package/dist/chunk-NAG44K67.js +549 -0
- package/dist/chunk-NAG44K67.js.map +1 -0
- package/dist/chunk-O24KTEGP.js +33 -0
- package/dist/chunk-O24KTEGP.js.map +1 -0
- package/dist/chunk-PI2AZVGK.js +2074 -0
- package/dist/chunk-PI2AZVGK.js.map +1 -0
- package/dist/chunk-Q2FFHEY7.js +40 -0
- package/dist/chunk-Q2FFHEY7.js.map +1 -0
- package/dist/chunk-RBGQADXA.js +57 -0
- package/dist/chunk-RBGQADXA.js.map +1 -0
- package/dist/chunk-U5G2BKM2.js +613 -0
- package/dist/chunk-U5G2BKM2.js.map +1 -0
- package/dist/chunk-VOJHMSM3.js +39 -0
- package/dist/chunk-VOJHMSM3.js.map +1 -0
- package/dist/chunk-VUNV25KB.js +16 -0
- package/dist/chunk-VUNV25KB.js.map +1 -0
- package/dist/chunk-XIFUNVBO.js +101 -0
- package/dist/chunk-XIFUNVBO.js.map +1 -0
- package/dist/chunk-ZCJYRJGB.js +489 -0
- package/dist/chunk-ZCJYRJGB.js.map +1 -0
- package/dist/chunk-ZZXPEE4S.js +2260 -0
- package/dist/chunk-ZZXPEE4S.js.map +1 -0
- package/dist/document-docx-api.d.ts +49 -0
- package/dist/document-docx-codec.d.ts +9 -0
- package/dist/document-docx-codec.js +4765 -0
- package/dist/document-docx-codec.js.map +1 -0
- package/dist/document-docx-import.d.ts +261 -0
- package/dist/document-docx-packer.d.ts +18 -0
- package/dist/document-docx-state.d.ts +12 -0
- package/dist/document-render.d.ts +3 -0
- package/dist/document-render.js +492 -0
- package/dist/document-render.js.map +1 -0
- package/dist/document.d.ts +432 -0
- package/dist/document.js +37 -0
- package/dist/document.js.map +1 -0
- package/dist/errors.d.ts +23 -0
- package/dist/file-blob.d.ts +11 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +186 -0
- package/dist/index.js.map +1 -0
- package/dist/inspection.d.ts +12 -0
- package/dist/kernel.d.ts +101 -0
- package/dist/lib-GQLPACFK.js +9746 -0
- package/dist/lib-GQLPACFK.js.map +1 -0
- package/dist/materializer-cli-entry.d.ts +2 -0
- package/dist/materializer-cli-entry.js +29 -0
- package/dist/materializer-cli-entry.js.map +1 -0
- package/dist/materializer-cli.d.ts +24 -0
- package/dist/materializer-cli.js +24 -0
- package/dist/materializer-cli.js.map +1 -0
- package/dist/native-raster.d.ts +10 -0
- package/dist/native.d.ts +129 -0
- package/dist/native.js +31 -0
- package/dist/native.js.map +1 -0
- package/dist/office-import.d.ts +48 -0
- package/dist/office-import.js +154 -0
- package/dist/office-import.js.map +1 -0
- package/dist/presentation-pptx-api.d.ts +60 -0
- package/dist/presentation-pptx-import.d.ts +5 -0
- package/dist/presentation-pptx-state-digest-765CZZED.js +10 -0
- package/dist/presentation-pptx-state-digest-765CZZED.js.map +1 -0
- package/dist/presentation-pptx-state-digest.d.ts +3 -0
- package/dist/presentation-pptx-state.d.ts +4 -0
- package/dist/presentation-pptx-xml.d.ts +29 -0
- package/dist/presentation-pptx.d.ts +5 -0
- package/dist/presentation-pptx.js +2365 -0
- package/dist/presentation-pptx.js.map +1 -0
- package/dist/presentation-render.d.ts +29 -0
- package/dist/presentation-render.js +375 -0
- package/dist/presentation-render.js.map +1 -0
- package/dist/presentation.d.ts +565 -0
- package/dist/presentation.js +71 -0
- package/dist/presentation.js.map +1 -0
- package/dist/production-composite.d.ts +68 -0
- package/dist/production-document.d.ts +2 -0
- package/dist/production-document.js +176 -0
- package/dist/production-document.js.map +1 -0
- package/dist/production-native-codecs.d.ts +94 -0
- package/dist/production-presentation.d.ts +2 -0
- package/dist/production-presentation.js +176 -0
- package/dist/production-presentation.js.map +1 -0
- package/dist/production-sha256.d.ts +2 -0
- package/dist/production-spreadsheet-native.d.ts +12 -0
- package/dist/production-spreadsheet.d.ts +2 -0
- package/dist/production-spreadsheet.js +176 -0
- package/dist/production-spreadsheet.js.map +1 -0
- package/dist/production.d.ts +96 -0
- package/dist/raster-image.d.ts +34 -0
- package/dist/reference.d.ts +17 -0
- package/dist/reference.js +574 -0
- package/dist/reference.js.map +1 -0
- package/dist/runtime-cli-entry.d.ts +2 -0
- package/dist/runtime-cli-entry.js +21 -0
- package/dist/runtime-cli-entry.js.map +1 -0
- package/dist/runtime-cli.d.ts +76 -0
- package/dist/runtime-cli.js +26 -0
- package/dist/runtime-cli.js.map +1 -0
- package/dist/runtime-development.d.ts +73 -0
- package/dist/runtime-development.js +30 -0
- package/dist/runtime-development.js.map +1 -0
- package/dist/runtime-receipt.d.ts +19 -0
- package/dist/runtime.d.ts +355 -0
- package/dist/runtime.js +42 -0
- package/dist/runtime.js.map +1 -0
- package/dist/snapshot.d.ts +26 -0
- package/dist/snapshot.js +61 -0
- package/dist/snapshot.js.map +1 -0
- package/dist/spreadsheet-address.d.ts +18 -0
- package/dist/spreadsheet-file.d.ts +17 -0
- package/dist/spreadsheet-formula.d.ts +67 -0
- package/dist/spreadsheet-image.d.ts +17 -0
- package/dist/spreadsheet-render.d.ts +5 -0
- package/dist/spreadsheet-render.js +752 -0
- package/dist/spreadsheet-render.js.map +1 -0
- package/dist/spreadsheet-types.d.ts +155 -0
- package/dist/spreadsheet-xlsx-api.d.ts +88 -0
- package/dist/spreadsheet-xlsx-codec.d.ts +16 -0
- package/dist/spreadsheet-xlsx-codec.js +16 -0
- package/dist/spreadsheet-xlsx-codec.js.map +1 -0
- package/dist/spreadsheet-xlsx-state.d.ts +16 -0
- package/dist/spreadsheet.d.ts +724 -0
- package/dist/spreadsheet.js +67 -0
- package/dist/spreadsheet.js.map +1 -0
- package/package.json +129 -0
- package/src/bounded-zip.ts +450 -0
- package/src/document-docx-api.ts +64 -0
- package/src/document-docx-codec.ts +2253 -0
- package/src/document-docx-import.ts +3814 -0
- package/src/document-docx-packer.ts +72 -0
- package/src/document-docx-state.ts +59 -0
- package/src/document-render.ts +615 -0
- package/src/document.ts +2800 -0
- package/src/errors.ts +45 -0
- package/src/file-blob.ts +43 -0
- package/src/index.ts +4 -0
- package/src/inspection.ts +50 -0
- package/src/kernel.ts +525 -0
- package/src/materializer-cli-entry.ts +11 -0
- package/src/materializer-cli.ts +743 -0
- package/src/native-raster.ts +141 -0
- package/src/native.ts +390 -0
- package/src/office-import.ts +243 -0
- package/src/presentation-pptx-api.ts +107 -0
- package/src/presentation-pptx-import.ts +2065 -0
- package/src/presentation-pptx-state-digest.ts +46 -0
- package/src/presentation-pptx-state.ts +18 -0
- package/src/presentation-pptx-xml.ts +473 -0
- package/src/presentation-pptx.ts +447 -0
- package/src/presentation-render.ts +532 -0
- package/src/presentation.ts +2599 -0
- package/src/production-composite.ts +805 -0
- package/src/production-document.ts +2 -0
- package/src/production-native-codecs.ts +1141 -0
- package/src/production-presentation.ts +2 -0
- package/src/production-sha256.ts +150 -0
- package/src/production-spreadsheet-native.ts +686 -0
- package/src/production-spreadsheet.ts +2 -0
- package/src/production.ts +1022 -0
- package/src/raster-image.ts +586 -0
- package/src/reference.ts +17 -0
- package/src/runtime-cli-entry.ts +13 -0
- package/src/runtime-cli.ts +670 -0
- package/src/runtime-development.ts +689 -0
- package/src/runtime-receipt.ts +169 -0
- package/src/runtime.ts +1463 -0
- package/src/snapshot.ts +88 -0
- package/src/spreadsheet-address.ts +90 -0
- package/src/spreadsheet-file.ts +71 -0
- package/src/spreadsheet-formula.ts +1212 -0
- package/src/spreadsheet-image.ts +242 -0
- package/src/spreadsheet-render.ts +985 -0
- package/src/spreadsheet-types.ts +171 -0
- package/src/spreadsheet-xlsx-api.ts +123 -0
- package/src/spreadsheet-xlsx-codec.ts +3063 -0
- package/src/spreadsheet-xlsx-state.ts +191 -0
- package/src/spreadsheet.ts +5195 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Cloudgeni-ai
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# `@opengeni/artifact-tool`
|
|
2
|
+
|
|
3
|
+
OpenGeni's Office-artifact engine. The package root is the synchronous exact
|
|
4
|
+
native skill facade; hosts must configure its manifest-pinned N-API runtime
|
|
5
|
+
before creating an artifact. `@opengeni/artifact-tool/reference` is the
|
|
6
|
+
explicit universal TypeScript fixture/codec model, while browser production
|
|
7
|
+
editing is owned by the SDK Worker and paired WASM kernel.
|
|
8
|
+
|
|
9
|
+
The public authoring API intentionally follows the artifact workflows shipped
|
|
10
|
+
with OpenGeni's spreadsheet and presentation skills:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { SpreadsheetFile, Workbook } from "@opengeni/artifact-tool";
|
|
14
|
+
|
|
15
|
+
const workbook = Workbook.create();
|
|
16
|
+
const sheet = workbook.worksheets.add("Summary");
|
|
17
|
+
sheet.getRange("A1:B3").values = [
|
|
18
|
+
["Month", "Revenue"],
|
|
19
|
+
["Jan", 100],
|
|
20
|
+
["Feb", 120],
|
|
21
|
+
];
|
|
22
|
+
const output = await SpreadsheetFile.exportXlsx(workbook);
|
|
23
|
+
await output.save("summary.xlsx");
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Design invariants:
|
|
27
|
+
|
|
28
|
+
- Sparse live models; rectangular writes are one transaction.
|
|
29
|
+
- Stable object ids and deterministic inspection output.
|
|
30
|
+
- Formula values derive from formulas; exports never replace formulas with
|
|
31
|
+
hardcoded display values.
|
|
32
|
+
- Render and Office-file codecs are replaceable adapters around the same model.
|
|
33
|
+
- Unknown imported content is never silently presented as supported.
|
|
34
|
+
|
|
35
|
+
Every root-facade mutation is atomic across the host projection and native
|
|
36
|
+
session. Use `artifact.batch(draft => { ... })` for many sequential public
|
|
37
|
+
mutations: it applies host calls synchronously, reconciles native state once,
|
|
38
|
+
and rolls the complete batch back on failure. On the measured Darwin-arm64
|
|
39
|
+
fixture, 1,000 calls took 9.65 s spreadsheet / 4.48 s document / 7.20 s
|
|
40
|
+
presentation unbatched versus under 70 ms per modality batched. Ordinary
|
|
41
|
+
single calls remain exact; large builders must batch rather than rely on the
|
|
42
|
+
full-projection reconciliation fallback.
|
|
43
|
+
|
|
44
|
+
Filesystem, rasterization, and Office codecs remain lazy and outside the eager
|
|
45
|
+
facade closure.
|
|
46
|
+
|
|
47
|
+
## Kernel distribution status
|
|
48
|
+
|
|
49
|
+
The safe-Rust N-API and WebAssembly bindings are implemented and verified in
|
|
50
|
+
`kernel/bindings`. This package intentionally does **not** embed a partial
|
|
51
|
+
binary matrix: its tarball contains `dist/` and `src/`, while exact generated
|
|
52
|
+
kernel target packages carry platform assets separately.
|
|
53
|
+
The exported runtime locator/doctor verifies a local canonical installation
|
|
54
|
+
manifest, complete release manifest, pinned facade, target package, and every
|
|
55
|
+
executable byte before evaluating code. It performs no download, `latest`
|
|
56
|
+
lookup, target guess, or TypeScript fallback.
|
|
57
|
+
|
|
58
|
+
Native publication is one atomic matrix: macOS arm64/x64, Linux glibc
|
|
59
|
+
arm64/x64, Linux musl arm64/x64, and Windows x64, plus one browser-WASM
|
|
60
|
+
glue/binary/type set built from the same Rust source and protocol identity.
|
|
61
|
+
Every target requires a canonical receipt produced by executing its smoke test;
|
|
62
|
+
until every declared asset is present and provenance-verified, a complete
|
|
63
|
+
release cannot be materialized and production loading fails closed.
|
|
64
|
+
|
|
65
|
+
Installed hosts expose the exact local assembly with
|
|
66
|
+
`OPENGENI_ARTIFACT_RUNTIME_MANIFEST` and `OPENGENI_ARTIFACT_TOOL_ENTRY`. They
|
|
67
|
+
can run `opengeni-artifact-runtime locate --json` for verification without code
|
|
68
|
+
evaluation, or `opengeni-artifact-runtime doctor --json` to verify, load the
|
|
69
|
+
pinned bootstrap, and perform a minimal native facade health probe. Both
|
|
70
|
+
commands fail closed and return machine-readable JSON; neither performs network
|
|
71
|
+
discovery.
|
|
72
|
+
|
|
73
|
+
`scripts/assemble-artifact-runtime-installation.ts` is the production
|
|
74
|
+
installer. It accepts only absolute local paths to one canonical complete
|
|
75
|
+
release manifest, its exact already-materialized target package, and the packed
|
|
76
|
+
artifact-tool tarball named by that manifest. It verifies package identity,
|
|
77
|
+
tarball SHA-512, smoke receipt, and every runtime-file SHA-256 before atomically
|
|
78
|
+
publishing a relocatable root with a relative kernel import. The two OCI inputs
|
|
79
|
+
are assembled atomically by
|
|
80
|
+
`scripts/assemble-artifact-runtime-container-inputs.ts`: `amd64` is exactly
|
|
81
|
+
`linux-x64-gnu`; `arm64` is exactly `linux-arm64-gnu`. Missing either target
|
|
82
|
+
preserves the previous complete tree and fails the build.
|
|
83
|
+
|
|
84
|
+
`.github/workflows/artifact-runtime.yml` produces the inputs. Seven OS-native
|
|
85
|
+
jobs execute the addon on its exact target host/userspace; one WASM job executes
|
|
86
|
+
the generated browser ABI. Aggregation requires all eight canonical receipts,
|
|
87
|
+
one build identity, and the exact packed artifact-tool integrity, then runs the
|
|
88
|
+
strict doctor directly and through both Docker architectures. CI and immutable
|
|
89
|
+
release-candidate image builds consume only that run-local verified artifact.
|
|
90
|
+
|
|
91
|
+
Local development is deliberately separate. `scripts/dev-stack.sh` installs
|
|
92
|
+
workspace links first, then `scripts/prepare-development-artifact-runtime.ts`
|
|
93
|
+
builds and smokes only the current native host when its canonical source +
|
|
94
|
+
Rust-toolchain fingerprint is absent or stale. It writes the ignored
|
|
95
|
+
`.opengeni/artifact-runtime-development` bundle and exports its exact paths in
|
|
96
|
+
`.env.runtime`. This development manifest is a different schema, cannot claim
|
|
97
|
+
missing targets, cannot coexist with the production manifest, and is rejected
|
|
98
|
+
when `NODE_ENV=production`.
|
|
99
|
+
|
|
100
|
+
Performance evidence is deliberately narrower than the target matrix. The
|
|
101
|
+
machine-readable status in `bench/platform-evidence.json` distinguishes local
|
|
102
|
+
Darwin-arm64/kernel-WASM measurements from still-unmeasured packaged,
|
|
103
|
+
cross-platform, and sandbox runtimes; one platform's kernel result is never
|
|
104
|
+
presented as evidence for another.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type BoundedZipEntry = {
|
|
2
|
+
name: string;
|
|
3
|
+
flags: number;
|
|
4
|
+
compression: 0 | 8;
|
|
5
|
+
checksum: number;
|
|
6
|
+
compressedSize: number;
|
|
7
|
+
expandedSize: number;
|
|
8
|
+
localHeaderOffset: number;
|
|
9
|
+
dataStart: number;
|
|
10
|
+
dataEnd: number;
|
|
11
|
+
recordEnd: number;
|
|
12
|
+
directory: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type BoundedZipLimits = {
|
|
15
|
+
entries: number;
|
|
16
|
+
compressedEntryBytes: number;
|
|
17
|
+
expandedEntryBytes: number;
|
|
18
|
+
expandedBytes: number;
|
|
19
|
+
compressionRatio: number;
|
|
20
|
+
compressionRatioThreshold?: number;
|
|
21
|
+
};
|
|
22
|
+
export type BoundedZipFailure = (kind: "invalid" | "unsupported" | "encrypted" | "limit" | "platform", message: string, entryName?: string) => never;
|
|
23
|
+
/** Parses ZIP metadata and validates every local record without inflating payloads. */
|
|
24
|
+
export declare function parseBoundedZip(bytes: Uint8Array, limits: BoundedZipLimits, fail: BoundedZipFailure): BoundedZipEntry[];
|
|
25
|
+
export declare function inflateBoundedZipEntry(archive: Uint8Array, entry: BoundedZipEntry, maximumBytes: number, fail: BoundedZipFailure): Promise<Uint8Array>;
|
|
26
|
+
export declare function verifyBoundedZipEntry(archive: Uint8Array, entry: BoundedZipEntry, maximumBytes: number, fail: BoundedZipFailure): Promise<void>;
|
|
27
|
+
export declare function zipCrc32Update(initial: number, bytes: Uint8Array): number;
|
|
28
|
+
export declare function zipCrc32(bytes: Uint8Array): number;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// src/file-blob.ts
|
|
2
|
+
var FileBlob = class _FileBlob extends Blob {
|
|
3
|
+
name;
|
|
4
|
+
constructor(parts, options = {}) {
|
|
5
|
+
super(parts, options);
|
|
6
|
+
this.name = options.name ?? null;
|
|
7
|
+
}
|
|
8
|
+
static async load(path) {
|
|
9
|
+
const fs = await loadNodeFileSystem();
|
|
10
|
+
const bytes = await fs.readFile(path);
|
|
11
|
+
return new _FileBlob([bytes], { name: path });
|
|
12
|
+
}
|
|
13
|
+
static fromBytes(bytes, options = {}) {
|
|
14
|
+
return new _FileBlob([bytes instanceof Uint8Array ? ownedBytes(bytes) : bytes], options);
|
|
15
|
+
}
|
|
16
|
+
async save(path) {
|
|
17
|
+
const fs = await loadNodeFileSystem();
|
|
18
|
+
await fs.writeFile(path, new Uint8Array(await this.arrayBuffer()));
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
async function loadNodeFileSystem() {
|
|
22
|
+
return importRuntimeModule("node:fs/promises");
|
|
23
|
+
}
|
|
24
|
+
function importRuntimeModule(specifier) {
|
|
25
|
+
return import(
|
|
26
|
+
/* @vite-ignore */
|
|
27
|
+
specifier
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
function ownedBytes(bytes) {
|
|
31
|
+
const copy = new Uint8Array(bytes.byteLength);
|
|
32
|
+
copy.set(bytes);
|
|
33
|
+
return copy;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
FileBlob
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=chunk-4BSENMAE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/file-blob.ts"],"sourcesContent":["export class FileBlob extends Blob {\n readonly name: string | null;\n\n constructor(parts: BlobPart[], options: BlobPropertyBag & { name?: string | null } = {}) {\n super(parts, options);\n this.name = options.name ?? null;\n }\n\n static async load(path: string): Promise<FileBlob> {\n const fs = await loadNodeFileSystem();\n const bytes = await fs.readFile(path);\n return new FileBlob([bytes], { name: path });\n }\n\n static fromBytes(\n bytes: Uint8Array | ArrayBuffer,\n options: BlobPropertyBag & { name?: string | null } = {},\n ): FileBlob {\n return new FileBlob([bytes instanceof Uint8Array ? ownedBytes(bytes) : bytes], options);\n }\n\n async save(path: string): Promise<void> {\n const fs = await loadNodeFileSystem();\n await fs.writeFile(path, new Uint8Array(await this.arrayBuffer()));\n }\n}\n\nasync function loadNodeFileSystem(): Promise<typeof import(\"node:fs/promises\")> {\n // A literal dynamic import is still eagerly resolved by browser bundlers.\n // Keep this Node-only capability out of browser artifacts while retaining\n // ordinary native ESM resolution when load/save is actually called in Node.\n return importRuntimeModule<typeof import(\"node:fs/promises\")>(\"node:fs/promises\");\n}\n\nfunction importRuntimeModule<T>(specifier: string): Promise<T> {\n return import(/* @vite-ignore */ specifier) as Promise<T>;\n}\n\nfunction ownedBytes(bytes: Uint8Array): Uint8Array<ArrayBuffer> {\n const copy = new Uint8Array(bytes.byteLength);\n copy.set(bytes);\n return copy;\n}\n"],"mappings":";AAAO,IAAM,WAAN,MAAM,kBAAiB,KAAK;AAAA,EACxB;AAAA,EAET,YAAY,OAAmB,UAAsD,CAAC,GAAG;AACvF,UAAM,OAAO,OAAO;AACpB,SAAK,OAAO,QAAQ,QAAQ;AAAA,EAC9B;AAAA,EAEA,aAAa,KAAK,MAAiC;AACjD,UAAM,KAAK,MAAM,mBAAmB;AACpC,UAAM,QAAQ,MAAM,GAAG,SAAS,IAAI;AACpC,WAAO,IAAI,UAAS,CAAC,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAAA,EAC7C;AAAA,EAEA,OAAO,UACL,OACA,UAAsD,CAAC,GAC7C;AACV,WAAO,IAAI,UAAS,CAAC,iBAAiB,aAAa,WAAW,KAAK,IAAI,KAAK,GAAG,OAAO;AAAA,EACxF;AAAA,EAEA,MAAM,KAAK,MAA6B;AACtC,UAAM,KAAK,MAAM,mBAAmB;AACpC,UAAM,GAAG,UAAU,MAAM,IAAI,WAAW,MAAM,KAAK,YAAY,CAAC,CAAC;AAAA,EACnE;AACF;AAEA,eAAe,qBAAiE;AAI9E,SAAO,oBAAuD,kBAAkB;AAClF;AAEA,SAAS,oBAAuB,WAA+B;AAC7D,SAAO;AAAA;AAAA,IAA0B;AAAA;AACnC;AAEA,SAAS,WAAW,OAA4C;AAC9D,QAAM,OAAO,IAAI,WAAW,MAAM,UAAU;AAC5C,OAAK,IAAI,KAAK;AACd,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RasterImageValidationError,
|
|
3
|
+
boundedUtf8ByteLength,
|
|
4
|
+
canonicalizeRasterDataUrl,
|
|
5
|
+
encodeRasterBase64,
|
|
6
|
+
normalizeRasterContentType,
|
|
7
|
+
validateRasterImageBytes
|
|
8
|
+
} from "./chunk-FGZM4FQ6.js";
|
|
9
|
+
|
|
10
|
+
// src/spreadsheet-address.ts
|
|
11
|
+
var EXCEL_MAX_ROWS = 1048576;
|
|
12
|
+
var EXCEL_MAX_COLUMNS = 16384;
|
|
13
|
+
function columnNameToIndex(name) {
|
|
14
|
+
if (!/^[A-Za-z]+$/.test(name)) throw new Error(`Invalid column name: ${name}`);
|
|
15
|
+
let value = 0;
|
|
16
|
+
for (const character of name.toUpperCase()) {
|
|
17
|
+
value = value * 26 + character.charCodeAt(0) - 64;
|
|
18
|
+
}
|
|
19
|
+
const index = value - 1;
|
|
20
|
+
if (index < 0 || index >= EXCEL_MAX_COLUMNS) {
|
|
21
|
+
throw new Error(`Column is outside the XLSX range: ${name}`);
|
|
22
|
+
}
|
|
23
|
+
return index;
|
|
24
|
+
}
|
|
25
|
+
function columnIndexToName(index) {
|
|
26
|
+
assertIntegerInRange(index, 0, EXCEL_MAX_COLUMNS - 1, "column index");
|
|
27
|
+
let value = index + 1;
|
|
28
|
+
let result = "";
|
|
29
|
+
while (value > 0) {
|
|
30
|
+
const remainder = (value - 1) % 26;
|
|
31
|
+
result = String.fromCharCode(65 + remainder) + result;
|
|
32
|
+
value = Math.floor((value - 1) / 26);
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
function parseCellAddress(input) {
|
|
37
|
+
const match = /^\$?([A-Za-z]+)\$?([1-9]\d*)$/.exec(input.trim());
|
|
38
|
+
if (!match) throw new Error(`Invalid A1 cell address: ${input}`);
|
|
39
|
+
const row = Number(match[2]) - 1;
|
|
40
|
+
if (row < 0 || row >= EXCEL_MAX_ROWS) {
|
|
41
|
+
throw new Error(`Row is outside the XLSX range: ${input}`);
|
|
42
|
+
}
|
|
43
|
+
return { row, col: columnNameToIndex(match[1]) };
|
|
44
|
+
}
|
|
45
|
+
function parseRangeAddress(input) {
|
|
46
|
+
const parts = input.trim().split(":");
|
|
47
|
+
if (parts.length > 2 || !parts[0]) throw new Error(`Invalid A1 range: ${input}`);
|
|
48
|
+
const start = parseCellAddress(parts[0]);
|
|
49
|
+
const end = parseCellAddress(parts[1] ?? parts[0]);
|
|
50
|
+
if (end.row < start.row || end.col < start.col) {
|
|
51
|
+
throw new Error(`Range must run top-left to bottom-right: ${input}`);
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
row: start.row,
|
|
55
|
+
col: start.col,
|
|
56
|
+
rowCount: end.row - start.row + 1,
|
|
57
|
+
colCount: end.col - start.col + 1
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function formatCellAddress(address) {
|
|
61
|
+
return `${columnIndexToName(address.col)}${address.row + 1}`;
|
|
62
|
+
}
|
|
63
|
+
function formatRangeAddress(address) {
|
|
64
|
+
const start = formatCellAddress(address);
|
|
65
|
+
if (address.rowCount === 1 && address.colCount === 1) return start;
|
|
66
|
+
return `${start}:${formatCellAddress({
|
|
67
|
+
row: address.row + address.rowCount - 1,
|
|
68
|
+
col: address.col + address.colCount - 1
|
|
69
|
+
})}`;
|
|
70
|
+
}
|
|
71
|
+
function cellKey(row, col) {
|
|
72
|
+
return row * EXCEL_MAX_COLUMNS + col;
|
|
73
|
+
}
|
|
74
|
+
function assertRange(address) {
|
|
75
|
+
assertIntegerInRange(address.row, 0, EXCEL_MAX_ROWS - 1, "start row");
|
|
76
|
+
assertIntegerInRange(address.col, 0, EXCEL_MAX_COLUMNS - 1, "start column");
|
|
77
|
+
assertIntegerInRange(address.rowCount, 1, EXCEL_MAX_ROWS, "row count");
|
|
78
|
+
assertIntegerInRange(address.colCount, 1, EXCEL_MAX_COLUMNS, "column count");
|
|
79
|
+
if (address.row + address.rowCount > EXCEL_MAX_ROWS) throw new Error("Range exceeds XLSX rows");
|
|
80
|
+
if (address.col + address.colCount > EXCEL_MAX_COLUMNS) {
|
|
81
|
+
throw new Error("Range exceeds XLSX columns");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function assertIntegerInRange(value, min, max, label) {
|
|
85
|
+
if (!Number.isInteger(value) || value < min || value > max) {
|
|
86
|
+
throw new Error(`${label} must be an integer between ${min} and ${max}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// src/spreadsheet-image.ts
|
|
91
|
+
var InvalidSpreadsheetImageError = class extends Error {
|
|
92
|
+
constructor(field, detail) {
|
|
93
|
+
super(`Invalid spreadsheet ${field}: ${detail}`);
|
|
94
|
+
this.field = field;
|
|
95
|
+
this.name = "InvalidSpreadsheetImageError";
|
|
96
|
+
}
|
|
97
|
+
code = "INVALID_SPREADSHEET_IMAGE";
|
|
98
|
+
};
|
|
99
|
+
var MAX_IMAGE_BYTES = 32 * 1024 * 1024;
|
|
100
|
+
var MAX_ALT_LENGTH = 1024 * 1024;
|
|
101
|
+
var MAX_PIXEL_VALUE = 1e6;
|
|
102
|
+
var normalizedImages = /* @__PURE__ */ new WeakSet();
|
|
103
|
+
function normalizeSpreadsheetImageConfig(input) {
|
|
104
|
+
if (typeof input !== "object" || input === null) {
|
|
105
|
+
throw new InvalidSpreadsheetImageError("image", "must be an object");
|
|
106
|
+
}
|
|
107
|
+
if (normalizedImages.has(input)) return input;
|
|
108
|
+
const hasDataUrl = input.dataUrl !== void 0;
|
|
109
|
+
const hasBlob = input.blob !== void 0;
|
|
110
|
+
if (Number(hasDataUrl) + Number(hasBlob) !== 1) {
|
|
111
|
+
throw new InvalidSpreadsheetImageError(
|
|
112
|
+
"image source",
|
|
113
|
+
"requires exactly one source: dataUrl or blob"
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
let canonical;
|
|
117
|
+
let contentType;
|
|
118
|
+
if (hasDataUrl) {
|
|
119
|
+
const parsed = parseRasterDataUrl(input.dataUrl);
|
|
120
|
+
contentType = parsed.contentType;
|
|
121
|
+
canonical = parsed.canonical;
|
|
122
|
+
} else {
|
|
123
|
+
const bytes = copyImageBytes(input.blob);
|
|
124
|
+
contentType = validateRasterBytes(bytes, input.contentType, "image blob");
|
|
125
|
+
canonical = `data:${contentType};base64,${encodeRasterBase64(bytes)}`;
|
|
126
|
+
}
|
|
127
|
+
if (input.contentType !== void 0 && normalizeRasterMime(input.contentType) !== contentType) {
|
|
128
|
+
throw new InvalidSpreadsheetImageError("image contentType", "does not match the image bytes");
|
|
129
|
+
}
|
|
130
|
+
const anchor = normalizeAnchor(input.anchor);
|
|
131
|
+
const alt = normalizeAlt(input.alt);
|
|
132
|
+
const normalized = Object.freeze({
|
|
133
|
+
dataUrl: canonical,
|
|
134
|
+
contentType,
|
|
135
|
+
...alt === void 0 ? {} : { alt },
|
|
136
|
+
anchor
|
|
137
|
+
});
|
|
138
|
+
normalizedImages.add(normalized);
|
|
139
|
+
return normalized;
|
|
140
|
+
}
|
|
141
|
+
function spreadsheetImageSource(input) {
|
|
142
|
+
const normalized = normalizeSpreadsheetImageConfig(input);
|
|
143
|
+
return normalized.dataUrl;
|
|
144
|
+
}
|
|
145
|
+
function normalizeAnchor(anchor) {
|
|
146
|
+
if (typeof anchor !== "object" || anchor === null) {
|
|
147
|
+
throw new InvalidSpreadsheetImageError("image anchor", "must be an object");
|
|
148
|
+
}
|
|
149
|
+
const from = anchor.from;
|
|
150
|
+
const extent = anchor.extent;
|
|
151
|
+
if (typeof from !== "object" || from === null) {
|
|
152
|
+
throw new InvalidSpreadsheetImageError("image anchor.from", "must be an object");
|
|
153
|
+
}
|
|
154
|
+
if (typeof extent !== "object" || extent === null) {
|
|
155
|
+
throw new InvalidSpreadsheetImageError("image anchor.extent", "must be an object");
|
|
156
|
+
}
|
|
157
|
+
assertInteger(from.row, "image anchor.from.row", 0, 1048575);
|
|
158
|
+
assertInteger(from.col, "image anchor.from.col", 0, 16383);
|
|
159
|
+
if (from.rowOffsetPx !== void 0) {
|
|
160
|
+
assertFiniteInRange(from.rowOffsetPx, "image anchor.from.rowOffsetPx", 0, MAX_PIXEL_VALUE);
|
|
161
|
+
}
|
|
162
|
+
if (from.colOffsetPx !== void 0) {
|
|
163
|
+
assertFiniteInRange(from.colOffsetPx, "image anchor.from.colOffsetPx", 0, MAX_PIXEL_VALUE);
|
|
164
|
+
}
|
|
165
|
+
assertFiniteInRange(
|
|
166
|
+
extent.widthPx,
|
|
167
|
+
"image anchor.extent.widthPx",
|
|
168
|
+
Number.MIN_VALUE,
|
|
169
|
+
MAX_PIXEL_VALUE
|
|
170
|
+
);
|
|
171
|
+
assertFiniteInRange(
|
|
172
|
+
extent.heightPx,
|
|
173
|
+
"image anchor.extent.heightPx",
|
|
174
|
+
Number.MIN_VALUE,
|
|
175
|
+
MAX_PIXEL_VALUE
|
|
176
|
+
);
|
|
177
|
+
return Object.freeze({
|
|
178
|
+
from: Object.freeze({
|
|
179
|
+
row: from.row,
|
|
180
|
+
col: from.col,
|
|
181
|
+
...from.rowOffsetPx === void 0 ? {} : { rowOffsetPx: from.rowOffsetPx },
|
|
182
|
+
...from.colOffsetPx === void 0 ? {} : { colOffsetPx: from.colOffsetPx }
|
|
183
|
+
}),
|
|
184
|
+
extent: Object.freeze({ widthPx: extent.widthPx, heightPx: extent.heightPx })
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
function normalizeAlt(value) {
|
|
188
|
+
if (value === void 0) return void 0;
|
|
189
|
+
if (typeof value !== "string" || value.length > MAX_ALT_LENGTH || boundedUtf8ByteLength(value, MAX_ALT_LENGTH) > MAX_ALT_LENGTH) {
|
|
190
|
+
throw new InvalidSpreadsheetImageError("image alt", "must be a bounded string");
|
|
191
|
+
}
|
|
192
|
+
for (const character of value) {
|
|
193
|
+
const codePoint = character.codePointAt(0);
|
|
194
|
+
if (codePoint < 32 && codePoint !== 9 && codePoint !== 10 && codePoint !== 13 || codePoint >= 55296 && codePoint <= 57343 || codePoint === 65534 || codePoint === 65535) {
|
|
195
|
+
throw new InvalidSpreadsheetImageError(
|
|
196
|
+
"image alt",
|
|
197
|
+
"contains characters forbidden by XML 1.0"
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return value;
|
|
202
|
+
}
|
|
203
|
+
function parseRasterDataUrl(value) {
|
|
204
|
+
try {
|
|
205
|
+
const result = canonicalizeRasterDataUrl(value, MAX_IMAGE_BYTES);
|
|
206
|
+
return {
|
|
207
|
+
contentType: result.contentType,
|
|
208
|
+
canonical: result.canonical
|
|
209
|
+
};
|
|
210
|
+
} catch (error) {
|
|
211
|
+
if (error instanceof RasterImageValidationError) {
|
|
212
|
+
throw new InvalidSpreadsheetImageError("image dataUrl", error.detail);
|
|
213
|
+
}
|
|
214
|
+
throw error;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function copyImageBytes(value) {
|
|
218
|
+
if (!(value instanceof ArrayBuffer)) {
|
|
219
|
+
throw new InvalidSpreadsheetImageError("image blob", "must be an ArrayBuffer");
|
|
220
|
+
}
|
|
221
|
+
const bytes = new Uint8Array(value.slice(0));
|
|
222
|
+
if (bytes.byteLength === 0 || bytes.byteLength > MAX_IMAGE_BYTES) {
|
|
223
|
+
throw new InvalidSpreadsheetImageError(
|
|
224
|
+
"image blob",
|
|
225
|
+
`must contain between 1 and ${MAX_IMAGE_BYTES} bytes`
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
return bytes;
|
|
229
|
+
}
|
|
230
|
+
function normalizeRasterMime(value) {
|
|
231
|
+
try {
|
|
232
|
+
return normalizeRasterContentType(value);
|
|
233
|
+
} catch (error) {
|
|
234
|
+
if (error instanceof RasterImageValidationError) {
|
|
235
|
+
throw new InvalidSpreadsheetImageError("image contentType", error.detail);
|
|
236
|
+
}
|
|
237
|
+
throw error;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
function validateRasterBytes(bytes, declaredType, field) {
|
|
241
|
+
try {
|
|
242
|
+
return validateRasterImageBytes(bytes, declaredType);
|
|
243
|
+
} catch (error) {
|
|
244
|
+
if (error instanceof RasterImageValidationError) {
|
|
245
|
+
throw new InvalidSpreadsheetImageError(field, error.detail);
|
|
246
|
+
}
|
|
247
|
+
throw error;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function assertInteger(value, field, min, max) {
|
|
251
|
+
if (!Number.isInteger(value) || value < min || value > max) {
|
|
252
|
+
throw new InvalidSpreadsheetImageError(field, `must be an integer from ${min} through ${max}`);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function assertFiniteInRange(value, field, min, max) {
|
|
256
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < min || value > max) {
|
|
257
|
+
throw new InvalidSpreadsheetImageError(field, `must be a finite number from ${min} to ${max}`);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export {
|
|
262
|
+
EXCEL_MAX_ROWS,
|
|
263
|
+
EXCEL_MAX_COLUMNS,
|
|
264
|
+
columnNameToIndex,
|
|
265
|
+
columnIndexToName,
|
|
266
|
+
parseCellAddress,
|
|
267
|
+
parseRangeAddress,
|
|
268
|
+
formatCellAddress,
|
|
269
|
+
formatRangeAddress,
|
|
270
|
+
cellKey,
|
|
271
|
+
assertRange,
|
|
272
|
+
InvalidSpreadsheetImageError,
|
|
273
|
+
normalizeSpreadsheetImageConfig,
|
|
274
|
+
spreadsheetImageSource
|
|
275
|
+
};
|
|
276
|
+
//# sourceMappingURL=chunk-4FRFNNBM.js.map
|