lucid-extension-sdk 0.0.247 → 0.0.248

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/commandtypes.d.ts CHANGED
@@ -70,6 +70,7 @@ export declare const enum CommandName {
70
70
  GetCustomShape = "gcs",
71
71
  GetDataItemField = "gdif",
72
72
  GetDocumentAccessPermission = "gdap",
73
+ GetDocumentChunks = "gdc",
73
74
  GetDocumentId = "gdid",
74
75
  GetElementType = "get",
75
76
  GetEnvironmentConfig = "gec",
@@ -342,6 +343,10 @@ export type CommandArgs = {
342
343
  query: GetDocumentAccessPermissionQuery;
343
344
  result: GetDocumentAccessPermissionResult;
344
345
  };
346
+ [CommandName.GetDocumentChunks]: {
347
+ query: GetDocumentChunksQuery;
348
+ result: GetDocumentChunksResult;
349
+ };
345
350
  [CommandName.GetDocumentId]: {
346
351
  query: GetDocumentIdQuery;
347
352
  result: GetDocumentIdResult;
@@ -1112,6 +1117,29 @@ export type GetDataItemFieldQuery = {
1112
1117
  export type GetDataItemFieldResult = SerializedFieldType;
1113
1118
  export type GetDocumentAccessPermissionQuery = void;
1114
1119
  export type GetDocumentAccessPermissionResult = DocumentAccessPermission;
1120
+ export declare enum GetDocumentChunksType {
1121
+ /**
1122
+ * Breaks up a document into chunks geographically
1123
+ */
1124
+ Geographic = 0,
1125
+ /**
1126
+ * Breaks up a document into chunks by finding containing blocks
1127
+ */
1128
+ Container = 1
1129
+ }
1130
+ export type GetDocumentChunksQuery = {
1131
+ 't': GetDocumentChunksType[];
1132
+ };
1133
+ export type GetDocumentChunksResult = SerializedDocumentChunk[];
1134
+ type SerializedDocumentChunk = {
1135
+ /** Bounding box of all items combined */
1136
+ 'bb': Box;
1137
+ /** Ids of the items included in the chunk */
1138
+ 'i': string[];
1139
+ 't': string;
1140
+ /** Very brief description that helps describe the chunk */
1141
+ 'd': string;
1142
+ };
1115
1143
  export type GetDocumentIdQuery = void;
1116
1144
  export type GetDocumentIdResult = string;
1117
1145
  export type GetItemPageIdQuery = string;
@@ -1684,3 +1712,4 @@ export type ZOrderQuery = {
1684
1712
  'o': ZOrderOperation;
1685
1713
  };
1686
1714
  export type ZOrderResult = undefined;
1715
+ export {};
package/commandtypes.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZOrderOperation = exports.isRawSendXHRResponse = exports.MermaidDiagramType = exports.GetLLMContextType = exports.GetItemsAtSearchType = exports.HashAlgorithmEnum = exports.commandTitles = void 0;
3
+ exports.ZOrderOperation = exports.isRawSendXHRResponse = exports.MermaidDiagramType = exports.GetLLMContextType = exports.GetItemsAtSearchType = exports.GetDocumentChunksType = exports.HashAlgorithmEnum = exports.commandTitles = void 0;
4
4
  const checks_1 = require("./core/checks");
5
5
  /** @ignore */
6
6
  exports.commandTitles = new Map([
@@ -46,6 +46,7 @@ exports.commandTitles = new Map([
46
46
  ["gcs" /* CommandName.GetCustomShape */, 'GetCustomShape'],
47
47
  ["gdif" /* CommandName.GetDataItemField */, 'GetDataItemField'],
48
48
  ["gdap" /* CommandName.GetDocumentAccessPermission */, 'GetDocumentAccessPermission'],
49
+ ["gdc" /* CommandName.GetDocumentChunks */, 'GetDocumentChunks'],
49
50
  ["gdid" /* CommandName.GetDocumentId */, 'GetDocumentId'],
50
51
  ["get" /* CommandName.GetElementType */, 'GetElementType'],
51
52
  ["gec" /* CommandName.GetEnvironmentConfig */, 'GetEnvironmentConfig'],
@@ -131,6 +132,17 @@ var HashAlgorithmEnum;
131
132
  /** Use the SHA 256 hashing algorithm */
132
133
  HashAlgorithmEnum["sha256"] = "SHA256";
133
134
  })(HashAlgorithmEnum || (exports.HashAlgorithmEnum = HashAlgorithmEnum = {}));
135
+ var GetDocumentChunksType;
136
+ (function (GetDocumentChunksType) {
137
+ /**
138
+ * Breaks up a document into chunks geographically
139
+ */
140
+ GetDocumentChunksType[GetDocumentChunksType["Geographic"] = 0] = "Geographic";
141
+ /**
142
+ * Breaks up a document into chunks by finding containing blocks
143
+ */
144
+ GetDocumentChunksType[GetDocumentChunksType["Container"] = 1] = "Container";
145
+ })(GetDocumentChunksType || (exports.GetDocumentChunksType = GetDocumentChunksType = {}));
134
146
  var GetItemsAtSearchType;
135
147
  (function (GetItemsAtSearchType) {
136
148
  GetItemsAtSearchType[GetItemsAtSearchType["PossiblyOverlapping"] = 0] = "PossiblyOverlapping";
@@ -0,0 +1,25 @@
1
+ import { Box } from '../math';
2
+ import { ItemProxy } from './itemproxy';
3
+ /**
4
+ * @ignore
5
+ * A representation of separated portions of the document
6
+ */
7
+ export interface DocumentChunk {
8
+ /**
9
+ * THe bounding box of all items combined
10
+ */
11
+ boundingBox: Box;
12
+ /**
13
+ * Items included in the chunk
14
+ */
15
+ items: ItemProxy[];
16
+ /**
17
+ * All displayed text in the chunk
18
+ */
19
+ text: string;
20
+ /**
21
+ * Very brief description that helps describe the chunk. This will be used
22
+ * as part of the page name when writing to pages.
23
+ */
24
+ description: string;
25
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,6 @@
1
+ import { GetDocumentChunksType } from '../commandtypes';
1
2
  import { EditorClient } from '../editorclient';
3
+ import { DocumentChunk } from './documentchunk';
2
4
  import { CardConfigProxy } from './documentelement/cardconfigproxy';
3
5
  import { RuleProxy } from './documentelement/ruleproxy';
4
6
  import { ElementProxy } from './elementproxy';
@@ -41,6 +43,8 @@ export declare class DocumentProxy extends ElementProxy {
41
43
  * @returns The title of this document
42
44
  */
43
45
  getTitle(): string;
46
+ /** @ignore */
47
+ getDocumentChunks(types: GetDocumentChunksType[]): DocumentChunk[];
44
48
  /**
45
49
  * Infrequently, you may need to watch for *any* changes to the document. These changes may be
46
50
  * the local user adding content, or a data integration sending updated records to a data collection,
@@ -5,6 +5,7 @@ const cardconfigproxy_1 = require("./documentelement/cardconfigproxy");
5
5
  const documentelementtype_1 = require("./documentelement/documentelementtype");
6
6
  const ruleproxy_1 = require("./documentelement/ruleproxy");
7
7
  const elementproxy_1 = require("./elementproxy");
8
+ const itemproxy_1 = require("./itemproxy");
8
9
  const mapproxy_1 = require("./mapproxy");
9
10
  const pageproxy_1 = require("./pageproxy");
10
11
  /**
@@ -70,6 +71,20 @@ class DocumentProxy extends elementproxy_1.ElementProxy {
70
71
  getTitle() {
71
72
  return this.properties.get('Title');
72
73
  }
74
+ /** @ignore */
75
+ getDocumentChunks(types) {
76
+ const chunks = this.client.sendCommand("gdc" /* CommandName.GetDocumentChunks */, { 't': types });
77
+ return chunks.map((chunk) => {
78
+ return {
79
+ boundingBox: chunk['bb'],
80
+ items: chunk['i']
81
+ .map((id) => this.client.getElementProxy(id))
82
+ .filter((element) => element instanceof itemproxy_1.ItemProxy),
83
+ text: chunk['t'],
84
+ description: chunk['d'],
85
+ };
86
+ });
87
+ }
73
88
  /**
74
89
  * Infrequently, you may need to watch for *any* changes to the document. These changes may be
75
90
  * the local user adding content, or a data integration sending updated records to a data collection,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.247",
3
+ "version": "0.0.248",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",