@superdoc/sdk 2.7.0 → 2.9.0-next.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.
@@ -29,6 +29,10 @@ export function resolveRuntimeProcess(options = {}, embedded = {
29
29
  processMode: 'cli',
30
30
  };
31
31
  }
32
+ export function toSafeInvokeTraceOptions(options) {
33
+ const { collaborationAuth: _collaborationAuth, ...traceOptions } = options;
34
+ return traceOptions;
35
+ }
32
36
  /**
33
37
  * Internal runtime that delegates operations to a persistent host transport.
34
38
  *
@@ -57,7 +61,7 @@ export class SuperDocRuntime {
57
61
  phase: 'start',
58
62
  operationId: operation.operationId,
59
63
  params,
60
- options,
64
+ options: toSafeInvokeTraceOptions(options),
61
65
  });
62
66
  try {
63
67
  const result = await this.transport.invoke(operation, params, options);
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ // AUTO-GENERATED by scripts/embed-version.mjs — DO NOT EDIT.
4
+ // Source of truth: package.json. Regenerated on every SDK build so the
5
+ // SDK retains its own version identity when bundled into another package.
6
+ const SDK_VERSION = '2.9.0-next.1';
7
+
8
+ exports.SDK_VERSION = SDK_VERSION;
@@ -0,0 +1 @@
1
+ export declare const SDK_VERSION = "2.9.0-next.1";
@@ -0,0 +1,4 @@
1
+ // AUTO-GENERATED by scripts/embed-version.mjs — DO NOT EDIT.
2
+ // Source of truth: package.json. Regenerated on every SDK build so the
3
+ // SDK retains its own version identity when bundled into another package.
4
+ export const SDK_VERSION = '2.9.0-next.1';
@@ -2,6 +2,27 @@
2
2
 
3
3
  var errors = require('./errors.cjs');
4
4
 
5
+ function normalizeCollaborationAuth(value) {
6
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
7
+ throw new errors.SuperDocCliError('collaborationAuth must be an object.', { code: 'INVALID_ARGUMENT' });
8
+ }
9
+ const record = value;
10
+ const unknownField = Object.keys(record).find((key) => key !== 'type' && key !== 'token');
11
+ if (unknownField) {
12
+ throw new errors.SuperDocCliError(`collaborationAuth.${unknownField} is not supported.`, {
13
+ code: 'INVALID_ARGUMENT',
14
+ });
15
+ }
16
+ if (record.type !== 'token') {
17
+ throw new errors.SuperDocCliError('collaborationAuth.type must be "token".', { code: 'INVALID_ARGUMENT' });
18
+ }
19
+ if (typeof record.token !== 'string' || record.token.length === 0) {
20
+ throw new errors.SuperDocCliError('collaborationAuth.token must be a non-empty string.', {
21
+ code: 'INVALID_ARGUMENT',
22
+ });
23
+ }
24
+ return { type: 'token', token: record.token };
25
+ }
5
26
  function hasExtension(filePath, extension) {
6
27
  return filePath.toLowerCase().endsWith(extension);
7
28
  }
@@ -165,4 +186,5 @@ function buildOperationArgv(operation, params, options, runtimeTimeoutMs, defaul
165
186
 
166
187
  exports.applyOperationParamAliases = applyOperationParamAliases;
167
188
  exports.buildOperationArgv = buildOperationArgv;
189
+ exports.normalizeCollaborationAuth = normalizeCollaborationAuth;
168
190
  exports.resolveInvocation = resolveInvocation;
@@ -19,6 +19,17 @@ export interface InvokeOptions {
19
19
  expectedRevision?: string | number;
20
20
  changeMode?: ChangeMode;
21
21
  }
22
+ export interface CollaborationAuth {
23
+ type: 'token';
24
+ token: string;
25
+ }
26
+ export interface DocOpenOptions extends InvokeOptions {
27
+ collaborationAuth?: CollaborationAuth;
28
+ }
29
+ export interface TransportInvokeOptions extends InvokeOptions {
30
+ collaborationAuth?: CollaborationAuth;
31
+ }
32
+ export declare function normalizeCollaborationAuth(value: unknown): CollaborationAuth;
22
33
  /**
23
34
  * Minimal invoke interface that both SuperDocRuntime and BoundRuntime satisfy.
24
35
  * Generated code depends on this interface, not on the concrete runtime class.
@@ -1,4 +1,25 @@
1
1
  import { SuperDocCliError } from './errors.js';
2
+ export function normalizeCollaborationAuth(value) {
3
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
4
+ throw new SuperDocCliError('collaborationAuth must be an object.', { code: 'INVALID_ARGUMENT' });
5
+ }
6
+ const record = value;
7
+ const unknownField = Object.keys(record).find((key) => key !== 'type' && key !== 'token');
8
+ if (unknownField) {
9
+ throw new SuperDocCliError(`collaborationAuth.${unknownField} is not supported.`, {
10
+ code: 'INVALID_ARGUMENT',
11
+ });
12
+ }
13
+ if (record.type !== 'token') {
14
+ throw new SuperDocCliError('collaborationAuth.type must be "token".', { code: 'INVALID_ARGUMENT' });
15
+ }
16
+ if (typeof record.token !== 'string' || record.token.length === 0) {
17
+ throw new SuperDocCliError('collaborationAuth.token must be a non-empty string.', {
18
+ code: 'INVALID_ARGUMENT',
19
+ });
20
+ }
21
+ return { type: 'token', token: record.token };
22
+ }
2
23
  function hasExtension(filePath, extension) {
3
24
  return filePath.toLowerCase().endsWith(extension);
4
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc/sdk",
3
- "version": "2.7.0",
3
+ "version": "2.9.0-next.1",
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",
@@ -37,19 +37,20 @@
37
37
  "typescript": "^5.9.2"
38
38
  },
39
39
  "optionalDependencies": {
40
- "@superdoc/sdk-darwin-arm64": "2.7.0",
41
- "@superdoc/sdk-darwin-x64": "2.7.0",
42
- "@superdoc/sdk-linux-x64": "2.7.0",
43
- "@superdoc/sdk-linux-arm64": "2.7.0",
44
- "@superdoc/sdk-windows-x64": "2.7.0"
40
+ "@superdoc/sdk-darwin-arm64": "2.9.0-next.1",
41
+ "@superdoc/sdk-darwin-x64": "2.9.0-next.1",
42
+ "@superdoc/sdk-linux-x64": "2.9.0-next.1",
43
+ "@superdoc/sdk-linux-arm64": "2.9.0-next.1",
44
+ "@superdoc/sdk-windows-x64": "2.9.0-next.1"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
49
  "scripts": {
50
- "build": "rm -rf dist && node scripts/embed-prompts.mjs && node scripts/embed-tools.mjs && tsc && rollup -c rollup.cjs.config.mjs && rm -rf dist/prompts && mkdir -p dist/prompts && cp src/prompts/*.md dist/prompts/ && pnpm run audit:publish",
50
+ "build": "rm -rf dist && node scripts/embed-version.mjs && node scripts/embed-prompts.mjs && node scripts/embed-tools.mjs && tsc && pnpm run typecheck:consumer && rollup -c rollup.cjs.config.mjs && rm -rf dist/prompts && mkdir -p dist/prompts && cp src/prompts/*.md dist/prompts/ && pnpm run audit:publish",
51
51
  "audit:publish": "node ../../../../scripts/audit-publish-artifact.mjs dist --label sdk-node-dist",
52
52
  "typecheck": "tsc --noEmit",
53
+ "typecheck:consumer": "tsc --noEmit --strict --skipLibCheck --target ES2022 --module NodeNext --moduleResolution NodeNext ../../../../tests/consumer-typecheck/src/sdk-per-open-collaboration-auth.mts",
53
54
  "test:document-host": "bun test src/runtime/__tests__/host-spawn-args.test.ts src/runtime/__tests__/document-rpc.test.ts src/__tests__/structured-document-rpc.e2e.test.ts src/__tests__/request-timeout-ms.e2e.test.ts",
54
55
  "smoke:product-action": "node scripts/product-action-smoke.mjs"
55
56
  }