@superdoc-dev/sdk 1.10.0 → 1.11.0-next.4

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.
@@ -41810,7 +41810,7 @@ const CONTRACT = {
41810
41810
  "set-alignment"
41811
41811
  ],
41812
41812
  "category": "format",
41813
- "description": "Set paragraph alignment (justification) on a paragraph-like block.",
41813
+ "description": "Set visual paragraph alignment on a paragraph-like block. For RTL paragraphs, left/right are translated to Word-compatible stored justification values.",
41814
41814
  "requiresDocumentContext": true,
41815
41815
  "docRequirement": "optional",
41816
41816
  "responseEnvelopeKey": "result",
@@ -41952,8 +41952,10 @@ const CONTRACT = {
41952
41952
  {
41953
41953
  "const": "justify"
41954
41954
  }
41955
- ]
41956
- }
41955
+ ],
41956
+ "description": "Visual paragraph alignment. In RTL paragraphs, 'left' stores w:jc='right' and 'right' stores w:jc='left' so Word displays the requested side."
41957
+ },
41958
+ "description": "Visual paragraph alignment. In RTL paragraphs, 'left' stores w:jc='right' and 'right' stores w:jc='left' so Word displays the requested side."
41957
41959
  },
41958
41960
  {
41959
41961
  "name": "blockId",
@@ -42005,7 +42007,8 @@ const CONTRACT = {
42005
42007
  "center",
42006
42008
  "right",
42007
42009
  "justify"
42008
- ]
42010
+ ],
42011
+ "description": "Visual paragraph alignment. In RTL paragraphs, 'left' stores w:jc='right' and 'right' stores w:jc='left' so Word displays the requested side."
42009
42012
  }
42010
42013
  },
42011
42014
  "additionalProperties": false,
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/generated/contract.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,UAAU,CAAC;IAClC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;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;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,QAAQ;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,GAAG,EAAE;QACH,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,QAAQ,EAAE;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,aAAa,EAAE,MAAM,EAAE,CAAC;KACzB,CAAC;IACF,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;CACpD;AAED,eAAO,MAAM,QAAQ,EAAE,QA+8yJtB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,MAAM,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC"}
@@ -42931,7 +42931,7 @@ export const CONTRACT = {
42931
42931
  "set-alignment"
42932
42932
  ],
42933
42933
  "category": "format",
42934
- "description": "Set paragraph alignment (justification) on a paragraph-like block.",
42934
+ "description": "Set visual paragraph alignment on a paragraph-like block. For RTL paragraphs, left/right are translated to Word-compatible stored justification values.",
42935
42935
  "requiresDocumentContext": true,
42936
42936
  "docRequirement": "optional",
42937
42937
  "responseEnvelopeKey": "result",
@@ -43073,8 +43073,10 @@ export const CONTRACT = {
43073
43073
  {
43074
43074
  "const": "justify"
43075
43075
  }
43076
- ]
43077
- }
43076
+ ],
43077
+ "description": "Visual paragraph alignment. In RTL paragraphs, 'left' stores w:jc='right' and 'right' stores w:jc='left' so Word displays the requested side."
43078
+ },
43079
+ "description": "Visual paragraph alignment. In RTL paragraphs, 'left' stores w:jc='right' and 'right' stores w:jc='left' so Word displays the requested side."
43078
43080
  },
43079
43081
  {
43080
43082
  "name": "blockId",
@@ -43126,7 +43128,8 @@ export const CONTRACT = {
43126
43128
  "center",
43127
43129
  "right",
43128
43130
  "justify"
43129
- ]
43131
+ ],
43132
+ "description": "Visual paragraph alignment. In RTL paragraphs, 'left' stores w:jc='right' and 'right' stores w:jc='left' so Word displays the requested side."
43130
43133
  }
43131
43134
  },
43132
43135
  "additionalProperties": false,
@@ -12,6 +12,54 @@ const FORWARD_HOST_STDERR = typeof process !== 'undefined' && typeof process.env
12
12
  ? process.env.SUPERDOC_DEBUG_TEXT_REWRITE === '1'
13
13
  : false;
14
14
  const JSON_RPC_TIMEOUT_CODE = -32011;
15
+ // Mirrors apps/cli/src/host/server.ts:DEFAULT_REQUEST_TIMEOUT_MS. Kept in sync
16
+ // by hand; an explicit constant here avoids importing CLI app internals across
17
+ // the package boundary.
18
+ const HOST_DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
19
+ // Extra time the JS-side watchdog waits beyond the host-side ceiling so the
20
+ // host's structured RequestTimeout error wins the race against the SDK's own
21
+ // abort. The buffer absorbs JSON-RPC serialization, stdio drain, and event-
22
+ // loop latency.
23
+ const WATCHDOG_HEADROOM_MS = 5_000;
24
+ /**
25
+ * Builds the argv passed to `spawn` for `superdoc host --stdio`. Propagates
26
+ * `requestTimeoutMs` to the host via `--request-timeout-ms`, since the SDK
27
+ * option alone cannot raise the host's 30s per-invoke ceiling otherwise.
28
+ *
29
+ * Exported for unit testing.
30
+ */
31
+ function buildHostSpawnArgs(prefixArgs, options) {
32
+ const args = [...prefixArgs, 'host', '--stdio'];
33
+ if (options.requestTimeoutMs != null) {
34
+ args.push('--request-timeout-ms', String(options.requestTimeoutMs));
35
+ }
36
+ return args;
37
+ }
38
+ /**
39
+ * Computes the JS-side watchdog timeout for a single JSON-RPC request.
40
+ *
41
+ * The watchdog must outlive the host-side `cli.invoke` ceiling so the host's
42
+ * structured `RequestTimeout` JSON-RPC frame wins the race against the SDK's
43
+ * own abort. Three cases:
44
+ *
45
+ * 1. A per-call `InvokeOptions.timeoutMs` is supplied → widen above it.
46
+ * 2. The client set `requestTimeoutMs` → widen above that.
47
+ * 3. Neither is set → widen above the host's compiled-in default so the
48
+ * default-config case doesn't race at 30s (which previously surfaced the
49
+ * old "Host watchdog timed out" string instead of the host's structured
50
+ * TIMEOUT error).
51
+ *
52
+ * Exported for unit testing.
53
+ */
54
+ function resolveJsWatchdogTimeout(watchdogTimeoutMs, requestTimeoutMs, timeoutMsOverride) {
55
+ if (timeoutMsOverride != null) {
56
+ return Math.max(watchdogTimeoutMs, timeoutMsOverride + WATCHDOG_HEADROOM_MS);
57
+ }
58
+ if (requestTimeoutMs != null) {
59
+ return Math.max(watchdogTimeoutMs, requestTimeoutMs + WATCHDOG_HEADROOM_MS);
60
+ }
61
+ return Math.max(watchdogTimeoutMs, HOST_DEFAULT_REQUEST_TIMEOUT_MS + WATCHDOG_HEADROOM_MS);
62
+ }
15
63
  /**
16
64
  * Transport that communicates with a long-lived CLI host process over JSON-RPC stdio.
17
65
  */
@@ -111,7 +159,7 @@ class HostTransport {
111
159
  }
112
160
  async startHostProcess() {
113
161
  const { command, prefixArgs } = transportCommon.resolveInvocation(this.cliBin);
114
- const args = [...prefixArgs, 'host', '--stdio'];
162
+ const args = buildHostSpawnArgs(prefixArgs, { requestTimeoutMs: this.requestTimeoutMs });
115
163
  const child = node_child_process.spawn(command, args, {
116
164
  env: {
117
165
  ...process.env,
@@ -204,13 +252,7 @@ class HostTransport {
204
252
  }
205
253
  }
206
254
  resolveWatchdogTimeout(timeoutMsOverride) {
207
- if (timeoutMsOverride != null) {
208
- return Math.max(this.watchdogTimeoutMs, timeoutMsOverride + 1_000);
209
- }
210
- if (this.requestTimeoutMs != null) {
211
- return Math.max(this.watchdogTimeoutMs, this.requestTimeoutMs + 1_000);
212
- }
213
- return this.watchdogTimeoutMs;
255
+ return resolveJsWatchdogTimeout(this.watchdogTimeoutMs, this.requestTimeoutMs, timeoutMsOverride);
214
256
  }
215
257
  async sendJsonRpcRequest(method, params, watchdogTimeoutMs) {
216
258
  const child = this.child;
@@ -356,3 +398,5 @@ class HostTransport {
356
398
  }
357
399
 
358
400
  exports.HostTransport = HostTransport;
401
+ exports.buildHostSpawnArgs = buildHostSpawnArgs;
402
+ exports.resolveJsWatchdogTimeout = resolveJsWatchdogTimeout;
@@ -1,4 +1,31 @@
1
1
  import { type InvokeOptions, type OperationSpec, type SuperDocClientOptions } from './transport-common.js';
2
+ /**
3
+ * Builds the argv passed to `spawn` for `superdoc host --stdio`. Propagates
4
+ * `requestTimeoutMs` to the host via `--request-timeout-ms`, since the SDK
5
+ * option alone cannot raise the host's 30s per-invoke ceiling otherwise.
6
+ *
7
+ * Exported for unit testing.
8
+ */
9
+ export declare function buildHostSpawnArgs(prefixArgs: readonly string[], options: {
10
+ requestTimeoutMs?: number;
11
+ }): string[];
12
+ /**
13
+ * Computes the JS-side watchdog timeout for a single JSON-RPC request.
14
+ *
15
+ * The watchdog must outlive the host-side `cli.invoke` ceiling so the host's
16
+ * structured `RequestTimeout` JSON-RPC frame wins the race against the SDK's
17
+ * own abort. Three cases:
18
+ *
19
+ * 1. A per-call `InvokeOptions.timeoutMs` is supplied → widen above it.
20
+ * 2. The client set `requestTimeoutMs` → widen above that.
21
+ * 3. Neither is set → widen above the host's compiled-in default so the
22
+ * default-config case doesn't race at 30s (which previously surfaced the
23
+ * old "Host watchdog timed out" string instead of the host's structured
24
+ * TIMEOUT error).
25
+ *
26
+ * Exported for unit testing.
27
+ */
28
+ export declare function resolveJsWatchdogTimeout(watchdogTimeoutMs: number, requestTimeoutMs: number | undefined, timeoutMsOverride: number | undefined): number;
2
29
  /**
3
30
  * Transport that communicates with a long-lived CLI host process over JSON-RPC stdio.
4
31
  */
@@ -1 +1 @@
1
- {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/runtime/host.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAE3B,MAAM,uBAAuB,CAAC;AAgC/B;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAqC;IAC1D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAa;IAChD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAe;IAErC,OAAO,CAAC,KAAK,CAA+C;IAC5D,OAAO,CAAC,YAAY,CAAkC;IACtD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqC;IAC7D,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,UAAU,CAA8B;IAChD,OAAO,CAAC,QAAQ,CAAS;gBAEb,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,qBAAqB;IAmBzD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA4BxB,MAAM,CAAC,KAAK,GAAG,OAAO,EAC1B,SAAS,EAAE,aAAa,EACxB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM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,CAAC,CAAe;IAErC,OAAO,CAAC,KAAK,CAA+C;IAC5D,OAAO,CAAC,YAAY,CAAkC;IACtD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqC;IAC7D,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,UAAU,CAA8B;IAChD,OAAO,CAAC,QAAQ,CAAS;gBAEb,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,qBAAqB;IAmBzD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA4BxB,MAAM,CAAC,KAAK,GAAG,OAAO,EAC1B,SAAS,EAAE,aAAa,EACxB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACpC,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,KAAK,CAAC;YAkCH,eAAe;YAkBf,gBAAgB;IA0E9B,OAAO,CAAC,kBAAkB;IAuC1B,OAAO,CAAC,sBAAsB;YAIhB,kBAAkB;IAkEhC,OAAO,CAAC,YAAY;IA2CpB,OAAO,CAAC,eAAe;IAmCvB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,cAAc;CA6BvB"}
@@ -9,6 +9,54 @@ const FORWARD_HOST_STDERR = typeof process !== 'undefined' && typeof process.env
9
9
  ? process.env.SUPERDOC_DEBUG_TEXT_REWRITE === '1'
10
10
  : false;
11
11
  const JSON_RPC_TIMEOUT_CODE = -32011;
12
+ // Mirrors apps/cli/src/host/server.ts:DEFAULT_REQUEST_TIMEOUT_MS. Kept in sync
13
+ // by hand; an explicit constant here avoids importing CLI app internals across
14
+ // the package boundary.
15
+ const HOST_DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
16
+ // Extra time the JS-side watchdog waits beyond the host-side ceiling so the
17
+ // host's structured RequestTimeout error wins the race against the SDK's own
18
+ // abort. The buffer absorbs JSON-RPC serialization, stdio drain, and event-
19
+ // loop latency.
20
+ const WATCHDOG_HEADROOM_MS = 5_000;
21
+ /**
22
+ * Builds the argv passed to `spawn` for `superdoc host --stdio`. Propagates
23
+ * `requestTimeoutMs` to the host via `--request-timeout-ms`, since the SDK
24
+ * option alone cannot raise the host's 30s per-invoke ceiling otherwise.
25
+ *
26
+ * Exported for unit testing.
27
+ */
28
+ export function buildHostSpawnArgs(prefixArgs, options) {
29
+ const args = [...prefixArgs, 'host', '--stdio'];
30
+ if (options.requestTimeoutMs != null) {
31
+ args.push('--request-timeout-ms', String(options.requestTimeoutMs));
32
+ }
33
+ return args;
34
+ }
35
+ /**
36
+ * Computes the JS-side watchdog timeout for a single JSON-RPC request.
37
+ *
38
+ * The watchdog must outlive the host-side `cli.invoke` ceiling so the host's
39
+ * structured `RequestTimeout` JSON-RPC frame wins the race against the SDK's
40
+ * own abort. Three cases:
41
+ *
42
+ * 1. A per-call `InvokeOptions.timeoutMs` is supplied → widen above it.
43
+ * 2. The client set `requestTimeoutMs` → widen above that.
44
+ * 3. Neither is set → widen above the host's compiled-in default so the
45
+ * default-config case doesn't race at 30s (which previously surfaced the
46
+ * old "Host watchdog timed out" string instead of the host's structured
47
+ * TIMEOUT error).
48
+ *
49
+ * Exported for unit testing.
50
+ */
51
+ export function resolveJsWatchdogTimeout(watchdogTimeoutMs, requestTimeoutMs, timeoutMsOverride) {
52
+ if (timeoutMsOverride != null) {
53
+ return Math.max(watchdogTimeoutMs, timeoutMsOverride + WATCHDOG_HEADROOM_MS);
54
+ }
55
+ if (requestTimeoutMs != null) {
56
+ return Math.max(watchdogTimeoutMs, requestTimeoutMs + WATCHDOG_HEADROOM_MS);
57
+ }
58
+ return Math.max(watchdogTimeoutMs, HOST_DEFAULT_REQUEST_TIMEOUT_MS + WATCHDOG_HEADROOM_MS);
59
+ }
12
60
  /**
13
61
  * Transport that communicates with a long-lived CLI host process over JSON-RPC stdio.
14
62
  */
@@ -108,7 +156,7 @@ export class HostTransport {
108
156
  }
109
157
  async startHostProcess() {
110
158
  const { command, prefixArgs } = resolveInvocation(this.cliBin);
111
- const args = [...prefixArgs, 'host', '--stdio'];
159
+ const args = buildHostSpawnArgs(prefixArgs, { requestTimeoutMs: this.requestTimeoutMs });
112
160
  const child = spawn(command, args, {
113
161
  env: {
114
162
  ...process.env,
@@ -201,13 +249,7 @@ export class HostTransport {
201
249
  }
202
250
  }
203
251
  resolveWatchdogTimeout(timeoutMsOverride) {
204
- if (timeoutMsOverride != null) {
205
- return Math.max(this.watchdogTimeoutMs, timeoutMsOverride + 1_000);
206
- }
207
- if (this.requestTimeoutMs != null) {
208
- return Math.max(this.watchdogTimeoutMs, this.requestTimeoutMs + 1_000);
209
- }
210
- return this.watchdogTimeoutMs;
252
+ return resolveJsWatchdogTimeout(this.watchdogTimeoutMs, this.requestTimeoutMs, timeoutMsOverride);
211
253
  }
212
254
  async sendJsonRpcRequest(method, params, watchdogTimeoutMs) {
213
255
  const child = this.child;
@@ -32,7 +32,25 @@ export interface SuperDocClientOptions {
32
32
  env?: Record<string, string | undefined>;
33
33
  startupTimeoutMs?: number;
34
34
  shutdownTimeoutMs?: number;
35
+ /**
36
+ * Upper bound (ms) on how long the host process may spend on a single
37
+ * `cli.invoke` request before it kills the operation and returns a
38
+ * `RequestTimeout` error. Propagated to the host via `--request-timeout-ms`
39
+ * at spawn. Raise this for documents that legitimately need more than 30s
40
+ * to process; the SDK widens its own JSON-RPC watchdog to match.
41
+ *
42
+ * Defaults to the host's own default (30s) when unset.
43
+ */
35
44
  requestTimeoutMs?: number;
45
+ /**
46
+ * JS-side watchdog (ms) the SDK waits for a host reply before giving up.
47
+ * Independent of {@link requestTimeoutMs} (which controls the host-side
48
+ * operation budget). Most callers should leave this at its default and use
49
+ * {@link requestTimeoutMs} as the single operation-timeout knob —
50
+ * `resolveWatchdogTimeout` already widens the watchdog above the host
51
+ * ceiling automatically. Override only when you need to detect a hung or
52
+ * crashed host faster than the operation budget allows.
53
+ */
36
54
  watchdogTimeoutMs?: number;
37
55
  maxQueueDepth?: number;
38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E,MAAM,EAAE,CAAC;CACtB;AAMD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAU/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,aAAa,EACtB,gBAAgB,EAAE,MAAM,GAAG,SAAS,EACpC,iBAAiB,CAAC,EAAE,UAAU,EAC9B,IAAI,CAAC,EAAE,YAAY,GAClB,MAAM,EAAE,CAiEV"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/sdk",
3
- "version": "1.10.0",
3
+ "version": "1.11.0-next.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -26,11 +26,11 @@
26
26
  "typescript": "^5.9.2"
27
27
  },
28
28
  "optionalDependencies": {
29
- "@superdoc-dev/sdk-darwin-arm64": "1.10.0",
30
- "@superdoc-dev/sdk-darwin-x64": "1.10.0",
31
- "@superdoc-dev/sdk-linux-x64": "1.10.0",
32
- "@superdoc-dev/sdk-linux-arm64": "1.10.0",
33
- "@superdoc-dev/sdk-windows-x64": "1.10.0"
29
+ "@superdoc-dev/sdk-darwin-arm64": "1.11.0-next.4",
30
+ "@superdoc-dev/sdk-linux-arm64": "1.11.0-next.4",
31
+ "@superdoc-dev/sdk-linux-x64": "1.11.0-next.4",
32
+ "@superdoc-dev/sdk-darwin-x64": "1.11.0-next.4",
33
+ "@superdoc-dev/sdk-windows-x64": "1.11.0-next.4"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
@@ -1653,7 +1653,7 @@
1653
1653
  "right",
1654
1654
  "justify"
1655
1655
  ],
1656
- "description": "Required for action 'set_alignment'."
1656
+ "description": "Visual paragraph alignment. In RTL paragraphs, 'left' stores w:jc='right' and 'right' stores w:jc='left' so Word displays the requested side. Required for action 'set_alignment'."
1657
1657
  },
1658
1658
  "left": {
1659
1659
  "type": "integer",
@@ -43,5 +43,5 @@
43
43
  "mutates": true
44
44
  }
45
45
  ],
46
- "contractHash": "30a98282620ba67a1197b0a2e228c6dd7203c4692c0ca15e56528855f02f38d1"
46
+ "contractHash": "266b6bb8fa042ebd94c3da6e11652471f49c40a061960f3df9055cf64c4bcbbe"
47
47
  }
@@ -1559,7 +1559,7 @@
1559
1559
  "right",
1560
1560
  "justify"
1561
1561
  ],
1562
- "description": "Required for action 'set_alignment'."
1562
+ "description": "Visual paragraph alignment. In RTL paragraphs, 'left' stores w:jc='right' and 'right' stores w:jc='left' so Word displays the requested side. Required for action 'set_alignment'."
1563
1563
  },
1564
1564
  "left": {
1565
1565
  "type": "integer",
@@ -1600,7 +1600,7 @@
1600
1600
  "right",
1601
1601
  "justify"
1602
1602
  ],
1603
- "description": "Required for action 'set_alignment'."
1603
+ "description": "Visual paragraph alignment. In RTL paragraphs, 'left' stores w:jc='right' and 'right' stores w:jc='left' so Word displays the requested side. Required for action 'set_alignment'."
1604
1604
  },
1605
1605
  "left": {
1606
1606
  "type": "integer",
@@ -1567,7 +1567,7 @@
1567
1567
  "right",
1568
1568
  "justify"
1569
1569
  ],
1570
- "description": "Required for action 'set_alignment'."
1570
+ "description": "Visual paragraph alignment. In RTL paragraphs, 'left' stores w:jc='right' and 'right' stores w:jc='left' so Word displays the requested side. Required for action 'set_alignment'."
1571
1571
  },
1572
1572
  "left": {
1573
1573
  "type": "integer",
@@ -1567,7 +1567,7 @@
1567
1567
  "right",
1568
1568
  "justify"
1569
1569
  ],
1570
- "description": "Required for action 'set_alignment'."
1570
+ "description": "Visual paragraph alignment. In RTL paragraphs, 'left' stores w:jc='right' and 'right' stores w:jc='left' so Word displays the requested side. Required for action 'set_alignment'."
1571
1571
  },
1572
1572
  "left": {
1573
1573
  "type": "integer",