@univerjs-pro/exchange-node 1.3.0 → 1.3.1
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/README.md +9 -33
- package/lib/shared/runtime.cjs +5 -2
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Keep this package and its Univer SDK dependencies on the same SDK version for no
|
|
|
15
15
|
pnpm add @univerjs-pro/exchange-node
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Native Binding dependencies allow same-minor patches from the version paired with the SDK; the application lock controls the installed patch.
|
|
19
19
|
|
|
20
20
|
## Import
|
|
21
21
|
|
|
@@ -70,11 +70,11 @@ Snapshot APIs materialize the complete aggregate in memory. They do not call a S
|
|
|
70
70
|
|
|
71
71
|
The initial release supports Sheet and Base import from XLS, XLSX, CSV, and TSV; Doc import from DOC and DOCX; and Slide import from PPT and PPTX. Export supports XLSX, CSV, TSV, DOCX, and PPTX for their corresponding unit types.
|
|
72
72
|
|
|
73
|
-
Office native packages are published for Linux x64 GNU, Linux arm64 GNU, Windows x64 MSVC, and macOS arm64.
|
|
73
|
+
Office native packages are published for Linux x64 GNU, Linux arm64 GNU, Windows x64 MSVC, and macOS x64/arm64.
|
|
74
74
|
|
|
75
75
|
## License and monthly export quota
|
|
76
76
|
|
|
77
|
-
Set both `UNIVER_LICENSE` and `UNIVER_LICENSE_KEY` for automatic configuration. The first export or quota query reads them once; no `configureExchange` call is required.
|
|
77
|
+
Set both `UNIVER_LICENSE` and `UNIVER_LICENSE_KEY` for automatic configuration. The first export or quota query reads them once; no `configureExchange` call is required. Unset, empty or whitespace-only environment values count as absent; when both are absent, Free applies. A single nonblank value is an incomplete pair. Nonblank contents are passed unchanged. This normalization applies only to environment fallbacks; explicit configuration and per-operation values remain unchanged and are strictly validated.
|
|
78
78
|
|
|
79
79
|
To configure credentials explicitly:
|
|
80
80
|
|
|
@@ -103,7 +103,7 @@ const output = await exportToBuffer(workbook, {
|
|
|
103
103
|
});
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
Omitting both fields uses the default configuration. A partial pair returns `INVALID_ARGUMENT`; credentials are never combined across sources.
|
|
106
|
+
Omitting both fields uses the default configuration. A partial pair returns `INVALID_ARGUMENT`; credentials are never combined across sources. Explicit values, including empty strings, are strictly validated as supplied; they are not treated as absent or retried with the default credentials. Per-operation credentials do not initialize or modify defaults. Successful commercial exports are tracked separately for each License ID; returning to the same ID resumes its usage. Free usage uses the shared Office/PDF quota.
|
|
107
107
|
|
|
108
108
|
`getExportQuota({ license, licenseKey })` queries shared Office/PDF quota. Omit credentials to query the default configuration. It accepts no Unit type and does not check the SDK version, activation time, or type entitlement; actual exports perform those checks. Importing `/pdf` selects the PDF query backend, so PDF-only consumers do not load Office binding. No alternate backend is tried on failure.
|
|
109
109
|
|
|
@@ -115,9 +115,11 @@ The response has nine fields:
|
|
|
115
115
|
- `limit`, `used`, `reserved`, `remaining`: monthly limit, successful uses, in-flight uses and available balance; all `null` when unlimited.
|
|
116
116
|
- `periodStart`, `periodEnd`: UTC ISO monthly quota bounds, inclusive start and exclusive end; `null` when unlimited.
|
|
117
117
|
|
|
118
|
-
Queries neither reserve nor consume quota. Before activation, limited quota describes the first authorization month with a future `periodStart`. Zero remaining is a successful query. The snapshot does not guarantee admission of the next export. `periodEnd` is the next monthly quota boundary, while `expiresAt` ends the subscription. A valid subscription always uses commercial quota: exhaustion or unavailable type entitlement cannot select Free. Subscription expiry selects the
|
|
118
|
+
Queries neither reserve nor consume quota. Before activation, limited quota describes the first authorization month with a future `periodStart`. Zero remaining is a successful query. The snapshot does not guarantee admission of the next export. `periodEnd` is the next monthly quota boundary, while `expiresAt` ends the subscription. A valid subscription always uses commercial quota: exhaustion or unavailable type entitlement cannot select Free. Subscription expiry selects the existing remaining Free quota without resetting it.
|
|
119
119
|
|
|
120
|
-
Free allows 10 successful exports per authorization month. Purchased licenses determine commercial quota, concurrency and version entitlements. Neither Free nor commercial licenses impose file-size or cell-count limits. Use the query response for the applicable period and balance. Unused monthly quota does not carry over. Office and PDF exports
|
|
120
|
+
Free allows 10 successful exports per authorization month. Purchased licenses determine commercial quota, concurrency and version entitlements. Neither Free nor commercial licenses impose file-size or cell-count limits. Use the query response for the applicable period and balance. Unused monthly quota does not carry over. Office and PDF exports share quota. Imports do not require export authorization and do not consume export quota.
|
|
121
|
+
|
|
122
|
+
Ordinary-user installation and export do not require sudo. The process needs writable local persistent storage for export usage. If that storage cannot be used, the SDK returns `LICENSE_USAGE_STORAGE_ERROR`; preserve the complete error and contact technical support.
|
|
121
123
|
|
|
122
124
|
A successful Buffer conversion counts once. File APIs then write that Buffer: a subsequent file-write failure is `IO_ERROR` and does not refund the conversion. Upload or download failures after successful conversion do not refund usage either. Each successful repeated conversion counts again. When quota is exhausted, wait for the next authorization period or update the license.
|
|
123
125
|
|
|
@@ -145,7 +147,7 @@ The following table compares quota queries and actual exports. Both APIs return
|
|
|
145
147
|
| `CONVERSION_FAILED` | Export only | Conversion failed. Retain the error and check the input contents. |
|
|
146
148
|
|
|
147
149
|
Applications may derive expiry reminders from `licenseStatus` and `expiresAt`. No separate notice list or automatic logging is emitted. Supplied invalid credentials reject configuration, queries and exports with `LICENSE_INVALID`. If usage processing fails, do not infer whether a count was consumed from the error alone; preserve the complete error for support.
|
|
148
|
-
ESM and CommonJS share configuration within the same JavaScript context. Each `worker_threads` Worker must configure itself or initialize from its environment; Workers share the export quota, not their configuration.
|
|
150
|
+
ESM and CommonJS share configuration within the same JavaScript context. Each `worker_threads` Worker must configure itself or initialize from its environment; Workers share the export quota, not their configuration. Exports capture configuration when the public method is called; a later configuration change applies to subsequently started exports. A failed explicit configuration leaves the previous configuration in effect.
|
|
149
151
|
|
|
150
152
|
## Optional PDF support
|
|
151
153
|
|
|
@@ -190,30 +192,4 @@ Export fails by default if a required image is missing or undecodable. Set `stri
|
|
|
190
192
|
|
|
191
193
|
Handle conversion failures through the existing `ExchangeError` and its `code`. `NATIVE_LOAD_FAILED` means that the optional platform package could not initialize; `CONVERSION_FAILED` means the conversion failed. For PDF resource failures, the message includes the applicable asset, page and entry identifiers; the native error remains available as `error.cause`. These failures do not invoke `onDiagnostics`.
|
|
192
194
|
|
|
193
|
-
## Building from source
|
|
194
|
-
|
|
195
|
-
From a clean checkout with the repository's submodules initialized:
|
|
196
|
-
|
|
197
|
-
```sh
|
|
198
|
-
pnpm install --frozen-lockfile --ignore-scripts --filter @univerjs-pro/exchange-node...
|
|
199
|
-
pnpm --filter @univerjs-pro/exchange-node build
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
This builds the JavaScript wrapper and declarations. The optional PDF native package is built separately using the verified inputs and platform toolchain described in `packages/exchange-pdf-node-binding/README.md`.
|
|
203
|
-
|
|
204
|
-
The manual `Exchange PDF Binding Release` workflow accepts an independent dev `binding_version` and an optional `native_ref`. When omitted, `native_ref` resolves univer-exchange `main` once to a full commit shared by all five platform builds. Each platform builds or reuses an exactly matching verified native cache, then runs installed-Binding smoke tests and dependency inspection before publication to insider-npm. This workflow neither builds nor publishes the Exchange Wrapper. Automatic source and packaging checks run separately in `Exchange PDF Checks`; full SDK integration tests use the explicit script documented in `packages/exchange-pdf-node-binding/README.md`.
|
|
205
|
-
|
|
206
195
|
The PDF backend uses private per-conversion temporary files and requires writable OS temporary storage. Embedded resources are materialized there and removed before returning. Existing system/configured font lookup still applies; this package does not promise identical font appearance across hosts.
|
|
207
|
-
|
|
208
|
-
## Test scopes
|
|
209
|
-
|
|
210
|
-
`pnpm --filter @univerjs-pro/exchange-node test` runs Office and shared wrapper checks, excluding the optional PDF contract suite. The repository's root `test`, `test:ts` and `test:rust` commands retain their existing scopes. PDF checks are explicit:
|
|
211
|
-
|
|
212
|
-
```sh
|
|
213
|
-
pnpm --filter @univerjs-pro/exchange-node test:pdf
|
|
214
|
-
# After building the wrapper:
|
|
215
|
-
pnpm --filter @univerjs-pro/exchange-node test:pdf:types
|
|
216
|
-
pnpm --filter @univerjs-pro/exchange-node test:pdf:package
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
The PDF binding package has explicit `test:unit` and `test:bridge` commands instead of a default `test`, so recursive workspace tests do not compile its native bridge. In CI, full native PDF builds run only in the manual release workflow; full SDK integration tests are invoked separately. PDF workflow quick checks follow PDF/shared adapter changes, rather than unrelated Office tests, documentation or lockfile-only changes.
|
package/lib/shared/runtime.cjs
CHANGED
|
@@ -79,8 +79,11 @@ module.exports = {
|
|
|
79
79
|
// Fix environment presence and values at entry. A configure already
|
|
80
80
|
// ahead in the queue still takes effect before this lazy selection.
|
|
81
81
|
const config = {};
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
// Only environment fallbacks treat blank text as absent; keep nonblank values unchanged.
|
|
83
|
+
const license = process.env.UNIVER_LICENSE;
|
|
84
|
+
const licenseKey = process.env.UNIVER_LICENSE_KEY;
|
|
85
|
+
if (license?.trim()) config.license = license;
|
|
86
|
+
if (licenseKey?.trim()) config.licenseKey = licenseKey;
|
|
84
87
|
const task = enqueue(() => {
|
|
85
88
|
if (current) return current;
|
|
86
89
|
return publish(candidate(validate(config)));
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@univerjs-pro/collaboration": "1.3.
|
|
5
|
-
"@univerjs-pro/exchange-node-binding": "1.0.
|
|
6
|
-
"@univerjs-pro/slides": "1.3.
|
|
7
|
-
"@univerjs/core": "1.3.
|
|
8
|
-
"@univerjs/protocol": "1.3.
|
|
9
|
-
"@univerjs-pro/pdfs": "1.3.
|
|
4
|
+
"@univerjs-pro/collaboration": "1.3.1",
|
|
5
|
+
"@univerjs-pro/exchange-node-binding": "~1.0.6",
|
|
6
|
+
"@univerjs-pro/slides": "1.3.1",
|
|
7
|
+
"@univerjs/core": "1.3.1",
|
|
8
|
+
"@univerjs/protocol": "1.3.1",
|
|
9
|
+
"@univerjs-pro/pdfs": "1.3.1"
|
|
10
10
|
},
|
|
11
11
|
"description": "Node.js SDK for converting between Office formats, Univer unit data, and snapshots",
|
|
12
12
|
"files": [
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
],
|
|
16
16
|
"name": "@univerjs-pro/exchange-node",
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@univerjs-pro/exchange-pdf-node-binding": "1.0.
|
|
18
|
+
"@univerjs-pro/exchange-pdf-node-binding": "~1.0.1"
|
|
19
19
|
},
|
|
20
20
|
"peerDependenciesMeta": {
|
|
21
21
|
"@univerjs-pro/exchange-pdf-node-binding": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"./lib/cjs/pdf.cjs"
|
|
29
29
|
],
|
|
30
30
|
"type": "module",
|
|
31
|
-
"version": "1.3.
|
|
31
|
+
"version": "1.3.1",
|
|
32
32
|
"main": "./lib/cjs/index.cjs",
|
|
33
33
|
"module": "./lib/es/index.js",
|
|
34
34
|
"types": "./lib/types/index.d.ts",
|