@superdoc-dev/sdk 1.0.0-next.68 → 1.0.0-next.70

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.
@@ -4,13 +4,25 @@ var contract = require('./contract.cjs');
4
4
 
5
5
  /* eslint-disable */
6
6
  // Auto-generated by packages/sdk/codegen/src/generate-node.mjs
7
+ /** Extract a string value from a CLI response envelope like `{ document, text: "..." }`. */
8
+ function unwrapStringEnvelope(value, key) {
9
+ if (typeof value === "string")
10
+ return value;
11
+ if (typeof value === "object" && value !== null) {
12
+ const extracted = value[key];
13
+ if (typeof extracted === "string")
14
+ return extracted;
15
+ }
16
+ return value;
17
+ }
7
18
  function createDocApi(runtime) {
8
19
  return {
9
20
  find: (params = {}, options) => runtime.invoke(contract.CONTRACT.operations["doc.find"], params, options),
10
21
  getNode: (params = {}, options) => runtime.invoke(contract.CONTRACT.operations["doc.getNode"], params, options),
11
22
  getNodeById: (params, options) => runtime.invoke(contract.CONTRACT.operations["doc.getNodeById"], params, options),
12
- getText: (params = {}, options) => runtime.invoke(contract.CONTRACT.operations["doc.getText"], params, options),
13
- getMarkdown: (params = {}, options) => runtime.invoke(contract.CONTRACT.operations["doc.getMarkdown"], params, options),
23
+ getText: async (params = {}, options) => unwrapStringEnvelope(await runtime.invoke(contract.CONTRACT.operations["doc.getText"], params, options), "text"),
24
+ getMarkdown: async (params = {}, options) => unwrapStringEnvelope(await runtime.invoke(contract.CONTRACT.operations["doc.getMarkdown"], params, options), "markdown"),
25
+ getHtml: async (params = {}, options) => unwrapStringEnvelope(await runtime.invoke(contract.CONTRACT.operations["doc.getHtml"], params, options), "html"),
14
26
  info: (params = {}, options) => runtime.invoke(contract.CONTRACT.operations["doc.info"], params, options),
15
27
  insert: (params = {}, options) => runtime.invoke(contract.CONTRACT.operations["doc.insert"], params, options),
16
28
  replace: (params = {}, options) => runtime.invoke(contract.CONTRACT.operations["doc.replace"], params, options),
@@ -53,6 +53,11 @@ export interface DocGetMarkdownParams {
53
53
  doc?: string;
54
54
  sessionId?: string;
55
55
  }
56
+ export interface DocGetHtmlParams {
57
+ doc?: string;
58
+ sessionId?: string;
59
+ unflattenLists?: boolean;
60
+ }
56
61
  export interface DocInfoParams {
57
62
  doc?: string;
58
63
  sessionId?: string;
@@ -2472,7 +2477,7 @@ export interface DocQueryMatchParams {
2472
2477
  export interface DocMutationsPreviewParams {
2473
2478
  doc?: string;
2474
2479
  sessionId?: string;
2475
- expectedRevision: string;
2480
+ expectedRevision?: string;
2476
2481
  atomic: true;
2477
2482
  changeMode: string;
2478
2483
  steps: unknown;
@@ -3577,6 +3582,7 @@ export type DocGetNodeByIdResult = {
3577
3582
  };
3578
3583
  export type DocGetTextResult = string;
3579
3584
  export type DocGetMarkdownResult = string;
3585
+ export type DocGetHtmlResult = string;
3580
3586
  export type DocInfoResult = {
3581
3587
  capabilities: {
3582
3588
  canComment: boolean;
@@ -4956,6 +4962,12 @@ export type DocCapabilitiesGetResult = {
4956
4962
  reasons?: Array<"COMMAND_UNAVAILABLE" | "HELPER_UNAVAILABLE" | "OPERATION_UNAVAILABLE" | "TRACKED_MODE_UNAVAILABLE" | "DRY_RUN_UNAVAILABLE" | "NAMESPACE_UNAVAILABLE" | "STYLES_PART_MISSING" | "COLLABORATION_ACTIVE">;
4957
4963
  tracked: boolean;
4958
4964
  };
4965
+ getHtml: {
4966
+ available: boolean;
4967
+ dryRun: boolean;
4968
+ reasons?: Array<"COMMAND_UNAVAILABLE" | "HELPER_UNAVAILABLE" | "OPERATION_UNAVAILABLE" | "TRACKED_MODE_UNAVAILABLE" | "DRY_RUN_UNAVAILABLE" | "NAMESPACE_UNAVAILABLE" | "STYLES_PART_MISSING" | "COLLABORATION_ACTIVE">;
4969
+ tracked: boolean;
4970
+ };
4959
4971
  getMarkdown: {
4960
4972
  available: boolean;
4961
4973
  dryRun: boolean;
@@ -6103,8 +6115,9 @@ export declare function createDocApi(runtime: SuperDocRuntime): {
6103
6115
  find: (params?: DocFindParams, options?: InvokeOptions) => Promise<DocFindResult>;
6104
6116
  getNode: (params?: DocGetNodeParams, options?: InvokeOptions) => Promise<DocGetNodeResult>;
6105
6117
  getNodeById: (params: DocGetNodeByIdParams, options?: InvokeOptions) => Promise<DocGetNodeByIdResult>;
6106
- getText: (params?: DocGetTextParams, options?: InvokeOptions) => Promise<string>;
6107
- getMarkdown: (params?: DocGetMarkdownParams, options?: InvokeOptions) => Promise<string>;
6118
+ getText: (params?: DocGetTextParams, options?: InvokeOptions) => Promise<DocGetTextResult>;
6119
+ getMarkdown: (params?: DocGetMarkdownParams, options?: InvokeOptions) => Promise<DocGetMarkdownResult>;
6120
+ getHtml: (params?: DocGetHtmlParams, options?: InvokeOptions) => Promise<DocGetHtmlResult>;
6108
6121
  info: (params?: DocInfoParams, options?: InvokeOptions) => Promise<DocInfoResult>;
6109
6122
  insert: (params?: DocInsertParams, options?: InvokeOptions) => Promise<unknown>;
6110
6123
  replace: (params?: DocReplaceParams, options?: InvokeOptions) => Promise<unknown>;