@superdoc/sdk 2.13.0-next.11 → 2.13.0-next.13
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/dist/agent/actions.cjs +49 -3
- package/dist/agent/actions.js +49 -3
- package/dist/generated/client.d.ts +634 -634
- package/dist/generated/contract.cjs +446 -2
- package/dist/generated/contract.js +447 -2
- package/dist/runtime/host.cjs +24 -15
- package/dist/runtime/host.d.ts +3 -1
- package/dist/runtime/host.js +24 -15
- package/dist/runtime/sdk-version.generated.cjs +1 -1
- package/dist/runtime/sdk-version.generated.d.ts +1 -1
- package/dist/runtime/sdk-version.generated.js +1 -1
- package/package.json +6 -6
- package/tools/tools-policy.json +1 -1
package/dist/runtime/host.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var node_child_process = require('node:child_process');
|
|
4
|
-
var node_readline = require('node:readline');
|
|
5
4
|
var transportCommon = require('./transport-common.cjs');
|
|
6
5
|
var errors = require('./errors.cjs');
|
|
7
6
|
var documentEvidence = require('./document-evidence.cjs');
|
|
@@ -96,7 +95,8 @@ class HostTransport {
|
|
|
96
95
|
user;
|
|
97
96
|
documentRpcEnabled;
|
|
98
97
|
child = null;
|
|
99
|
-
|
|
98
|
+
stdoutBuffer = '';
|
|
99
|
+
stdoutDataListener = null;
|
|
100
100
|
pending = new Map();
|
|
101
101
|
nextRequestId = 1;
|
|
102
102
|
connecting = null;
|
|
@@ -418,14 +418,12 @@ class HostTransport {
|
|
|
418
418
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
419
419
|
});
|
|
420
420
|
this.child = child;
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
this.
|
|
426
|
-
|
|
427
|
-
this.onStdoutLine(line);
|
|
428
|
-
});
|
|
421
|
+
// JSON-RPC is framed by ASCII LF; Node 24 readline also splits on a raw
|
|
422
|
+
// U+2028 inside otherwise valid JSON string data.
|
|
423
|
+
child.stdout.setEncoding('utf8');
|
|
424
|
+
const stdoutDataListener = (chunk) => this.onStdoutChunk(chunk);
|
|
425
|
+
this.stdoutDataListener = stdoutDataListener;
|
|
426
|
+
child.stdout.on('data', stdoutDataListener);
|
|
429
427
|
child.stderr.on('data', (chunk) => {
|
|
430
428
|
if (!FORWARD_HOST_STDERR) {
|
|
431
429
|
return;
|
|
@@ -672,6 +670,18 @@ class HostTransport {
|
|
|
672
670
|
}
|
|
673
671
|
pending.resolve(record.result);
|
|
674
672
|
}
|
|
673
|
+
onStdoutChunk(chunk) {
|
|
674
|
+
this.stdoutBuffer += chunk;
|
|
675
|
+
let newlineIndex = this.stdoutBuffer.indexOf('\n');
|
|
676
|
+
while (newlineIndex !== -1) {
|
|
677
|
+
let line = this.stdoutBuffer.slice(0, newlineIndex);
|
|
678
|
+
this.stdoutBuffer = this.stdoutBuffer.slice(newlineIndex + 1);
|
|
679
|
+
if (line.endsWith('\r'))
|
|
680
|
+
line = line.slice(0, -1);
|
|
681
|
+
this.onStdoutLine(line);
|
|
682
|
+
newlineIndex = this.stdoutBuffer.indexOf('\n');
|
|
683
|
+
}
|
|
684
|
+
}
|
|
675
685
|
mapJsonRpcError(rawError) {
|
|
676
686
|
if (typeof rawError !== 'object' || rawError == null || Array.isArray(rawError)) {
|
|
677
687
|
return new errors.SuperDocCliError('Host returned an unknown JSON-RPC error.', {
|
|
@@ -730,15 +740,14 @@ class HostTransport {
|
|
|
730
740
|
this.indeterminateDiscardCloses.clear();
|
|
731
741
|
const child = this.child;
|
|
732
742
|
if (child) {
|
|
743
|
+
if (this.stdoutDataListener)
|
|
744
|
+
child.stdout.off('data', this.stdoutDataListener);
|
|
733
745
|
child.removeAllListeners();
|
|
734
746
|
child.kill('SIGKILL');
|
|
735
747
|
}
|
|
736
748
|
this.child = null;
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
this.stdoutReader.close();
|
|
740
|
-
this.stdoutReader = null;
|
|
741
|
-
}
|
|
749
|
+
this.stdoutBuffer = '';
|
|
750
|
+
this.stdoutDataListener = null;
|
|
742
751
|
const pendingEntries = Array.from(this.pending.values());
|
|
743
752
|
this.pending.clear();
|
|
744
753
|
const rejection = error ??
|
package/dist/runtime/host.d.ts
CHANGED
|
@@ -43,7 +43,8 @@ export declare class HostTransport {
|
|
|
43
43
|
private readonly user?;
|
|
44
44
|
private readonly documentRpcEnabled;
|
|
45
45
|
private child;
|
|
46
|
-
private
|
|
46
|
+
private stdoutBuffer;
|
|
47
|
+
private stdoutDataListener;
|
|
47
48
|
private readonly pending;
|
|
48
49
|
private nextRequestId;
|
|
49
50
|
private connecting;
|
|
@@ -82,6 +83,7 @@ export declare class HostTransport {
|
|
|
82
83
|
private reconcileIndeterminateDiscardCloses;
|
|
83
84
|
private sendJsonRpcRequest;
|
|
84
85
|
private onStdoutLine;
|
|
86
|
+
private onStdoutChunk;
|
|
85
87
|
private mapJsonRpcError;
|
|
86
88
|
private handleDisconnect;
|
|
87
89
|
private cleanupProcess;
|
package/dist/runtime/host.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
|
-
import { createInterface } from 'node:readline';
|
|
3
2
|
import { buildOperationArgv, normalizeCollaborationAuth, resolveInvocation, } from './transport-common.js';
|
|
4
3
|
import { SuperDocCliError } from './errors.js';
|
|
5
4
|
import { registerMutationRevision } from './document-evidence.js';
|
|
@@ -93,7 +92,8 @@ export class HostTransport {
|
|
|
93
92
|
user;
|
|
94
93
|
documentRpcEnabled;
|
|
95
94
|
child = null;
|
|
96
|
-
|
|
95
|
+
stdoutBuffer = '';
|
|
96
|
+
stdoutDataListener = null;
|
|
97
97
|
pending = new Map();
|
|
98
98
|
nextRequestId = 1;
|
|
99
99
|
connecting = null;
|
|
@@ -415,14 +415,12 @@ export class HostTransport {
|
|
|
415
415
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
416
416
|
});
|
|
417
417
|
this.child = child;
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
this.
|
|
423
|
-
|
|
424
|
-
this.onStdoutLine(line);
|
|
425
|
-
});
|
|
418
|
+
// JSON-RPC is framed by ASCII LF; Node 24 readline also splits on a raw
|
|
419
|
+
// U+2028 inside otherwise valid JSON string data.
|
|
420
|
+
child.stdout.setEncoding('utf8');
|
|
421
|
+
const stdoutDataListener = (chunk) => this.onStdoutChunk(chunk);
|
|
422
|
+
this.stdoutDataListener = stdoutDataListener;
|
|
423
|
+
child.stdout.on('data', stdoutDataListener);
|
|
426
424
|
child.stderr.on('data', (chunk) => {
|
|
427
425
|
if (!FORWARD_HOST_STDERR) {
|
|
428
426
|
return;
|
|
@@ -669,6 +667,18 @@ export class HostTransport {
|
|
|
669
667
|
}
|
|
670
668
|
pending.resolve(record.result);
|
|
671
669
|
}
|
|
670
|
+
onStdoutChunk(chunk) {
|
|
671
|
+
this.stdoutBuffer += chunk;
|
|
672
|
+
let newlineIndex = this.stdoutBuffer.indexOf('\n');
|
|
673
|
+
while (newlineIndex !== -1) {
|
|
674
|
+
let line = this.stdoutBuffer.slice(0, newlineIndex);
|
|
675
|
+
this.stdoutBuffer = this.stdoutBuffer.slice(newlineIndex + 1);
|
|
676
|
+
if (line.endsWith('\r'))
|
|
677
|
+
line = line.slice(0, -1);
|
|
678
|
+
this.onStdoutLine(line);
|
|
679
|
+
newlineIndex = this.stdoutBuffer.indexOf('\n');
|
|
680
|
+
}
|
|
681
|
+
}
|
|
672
682
|
mapJsonRpcError(rawError) {
|
|
673
683
|
if (typeof rawError !== 'object' || rawError == null || Array.isArray(rawError)) {
|
|
674
684
|
return new SuperDocCliError('Host returned an unknown JSON-RPC error.', {
|
|
@@ -727,15 +737,14 @@ export class HostTransport {
|
|
|
727
737
|
this.indeterminateDiscardCloses.clear();
|
|
728
738
|
const child = this.child;
|
|
729
739
|
if (child) {
|
|
740
|
+
if (this.stdoutDataListener)
|
|
741
|
+
child.stdout.off('data', this.stdoutDataListener);
|
|
730
742
|
child.removeAllListeners();
|
|
731
743
|
child.kill('SIGKILL');
|
|
732
744
|
}
|
|
733
745
|
this.child = null;
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
this.stdoutReader.close();
|
|
737
|
-
this.stdoutReader = null;
|
|
738
|
-
}
|
|
746
|
+
this.stdoutBuffer = '';
|
|
747
|
+
this.stdoutDataListener = null;
|
|
739
748
|
const pendingEntries = Array.from(this.pending.values());
|
|
740
749
|
this.pending.clear();
|
|
741
750
|
const rejection = error ??
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
// AUTO-GENERATED by scripts/embed-version.mjs — DO NOT EDIT.
|
|
4
4
|
// Source of truth: package.json. Regenerated on every SDK build so the
|
|
5
5
|
// SDK retains its own version identity when bundled into another package.
|
|
6
|
-
const SDK_VERSION = '2.13.0-next.
|
|
6
|
+
const SDK_VERSION = '2.13.0-next.13';
|
|
7
7
|
|
|
8
8
|
exports.SDK_VERSION = SDK_VERSION;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.13.0-next.
|
|
1
|
+
export declare const SDK_VERSION = "2.13.0-next.13";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// AUTO-GENERATED by scripts/embed-version.mjs — DO NOT EDIT.
|
|
2
2
|
// Source of truth: package.json. Regenerated on every SDK build so the
|
|
3
3
|
// SDK retains its own version identity when bundled into another package.
|
|
4
|
-
export const SDK_VERSION = '2.13.0-next.
|
|
4
|
+
export const SDK_VERSION = '2.13.0-next.13';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc/sdk",
|
|
3
|
-
"version": "2.13.0-next.
|
|
3
|
+
"version": "2.13.0-next.13",
|
|
4
4
|
"description": "Node SDK for SuperDoc, wrapping the SuperDoc CLI to read and edit .docx files from JavaScript and TypeScript.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"typescript": "^5.9.2"
|
|
39
39
|
},
|
|
40
40
|
"optionalDependencies": {
|
|
41
|
-
"@superdoc/sdk-darwin-arm64": "2.13.0-next.
|
|
42
|
-
"@superdoc/sdk-darwin-x64": "2.13.0-next.
|
|
43
|
-
"@superdoc/sdk-linux-x64": "2.13.0-next.
|
|
44
|
-
"@superdoc/sdk-linux-arm64": "2.13.0-next.
|
|
45
|
-
"@superdoc/sdk-windows-x64": "2.13.0-next.
|
|
41
|
+
"@superdoc/sdk-darwin-arm64": "2.13.0-next.13",
|
|
42
|
+
"@superdoc/sdk-darwin-x64": "2.13.0-next.13",
|
|
43
|
+
"@superdoc/sdk-linux-x64": "2.13.0-next.13",
|
|
44
|
+
"@superdoc/sdk-linux-arm64": "2.13.0-next.13",
|
|
45
|
+
"@superdoc/sdk-windows-x64": "2.13.0-next.13"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
package/tools/tools-policy.json
CHANGED