lucid-extension-sdk 0.0.150 → 0.0.153

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
@@ -53,6 +53,7 @@ export declare const enum CommandName {
53
53
  GetCurrentPage = "gcp",
54
54
  GetCustomShape = "gcs",
55
55
  GetDataItemField = "gdif",
56
+ GetDocumentId = "gdid",
56
57
  GetElementType = "get",
57
58
  GetItemPageId = "gip",
58
59
  GetItemsAt = "gia",
@@ -64,6 +65,7 @@ export declare const enum CommandName {
64
65
  GetSelection = "gs",
65
66
  GetShapeData = "gsd",
66
67
  GetTextStyle = "gts",
68
+ GetUserId = "guid",
67
69
  GetVisibleRect = "gvr",
68
70
  HideModal = "hm",
69
71
  HidePanel = "hp",
@@ -259,6 +261,10 @@ export declare type CommandArgs = {
259
261
  query: GetDataItemFieldQuery;
260
262
  result: GetDataItemFieldResult;
261
263
  };
264
+ [CommandName.GetDocumentId]: {
265
+ query: GetDocumentIdQuery;
266
+ result: GetDocumentIdResult;
267
+ };
262
268
  [CommandName.GetElementType]: {
263
269
  query: GetElementTypeQuery;
264
270
  result: GetElementTypeResult;
@@ -303,6 +309,10 @@ export declare type CommandArgs = {
303
309
  query: GetTextStyleQuery;
304
310
  result: GetTextStyleResult;
305
311
  };
312
+ [CommandName.GetUserId]: {
313
+ query: GetUserIdQuery;
314
+ result: GetUserIdResult;
315
+ };
306
316
  [CommandName.GetVisibleRect]: {
307
317
  query: GetVisibleRectQuery;
308
318
  result: GetVisibleRectResult;
@@ -865,6 +875,8 @@ export declare type GetDataItemFieldQuery = {
865
875
  'f': string;
866
876
  };
867
877
  export declare type GetDataItemFieldResult = SerializedFieldType;
878
+ export declare type GetDocumentIdQuery = void;
879
+ export declare type GetDocumentIdResult = string;
868
880
  export declare type GetItemPageIdQuery = string;
869
881
  export declare type GetItemPageIdResult = string;
870
882
  export declare enum GetItemsAtSearchType {
@@ -926,6 +938,8 @@ export declare type GetTextStyleQuery = {
926
938
  'n': string;
927
939
  };
928
940
  export declare type GetTextStyleResult = TextStyle;
941
+ export declare type GetUserIdQuery = void;
942
+ export declare type GetUserIdResult = string;
929
943
  export declare type GetVisibleRectQuery = void;
930
944
  export declare type GetVisibleRectResult = Box;
931
945
  export declare type HideModalQuery = {
package/commandtypes.js CHANGED
@@ -35,6 +35,7 @@ exports.commandTitles = new Map([
35
35
  ["gcp" /* CommandName.GetCurrentPage */, 'GetCurrentPage'],
36
36
  ["gcs" /* CommandName.GetCustomShape */, 'GetCustomShape'],
37
37
  ["gdif" /* CommandName.GetDataItemField */, 'GetDataItemField'],
38
+ ["gdid" /* CommandName.GetDocumentId */, 'GetDocumentId'],
38
39
  ["get" /* CommandName.GetElementType */, 'GetElementType'],
39
40
  ["gip" /* CommandName.GetItemPageId */, 'GetItemPageId'],
40
41
  ["gia" /* CommandName.GetItemsAt */, 'GetItemsAt'],
@@ -46,6 +47,7 @@ exports.commandTitles = new Map([
46
47
  ["gs" /* CommandName.GetSelection */, 'GetSelection'],
47
48
  ["gsd" /* CommandName.GetShapeData */, 'GetShapeData'],
48
49
  ["gts" /* CommandName.GetTextStyle */, 'GetTextStyle'],
50
+ ["guid" /* CommandName.GetUserId */, 'GetUserId'],
49
51
  ["gvr" /* CommandName.GetVisibleRect */, 'GetVisibleRect'],
50
52
  ["hm" /* CommandName.HideModal */, 'HideModal'],
51
53
  ["hp" /* CommandName.HidePanel */, 'HidePanel'],
@@ -7,7 +7,7 @@ export declare function alphabetize(n: number): string;
7
7
  /** @ignore */
8
8
  export declare const MetadataPK = "__PK__";
9
9
  /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
10
- export declare function makeSerializedImportedCollection(id: string, name: string, rawSchema: string[], data: SerializedFields[], metadata?: {
10
+ export declare function makeSerializedImportedCollection(id: string, hash: string, name: string, rawSchema: string[], data: SerializedFields[], metadata?: {
11
11
  [key: string]: SerializedFields[];
12
12
  }): SerializedImportedCollection;
13
13
  /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
@@ -99,7 +99,7 @@ function makeSerializedItems(rawItems, oldToNewFields, isMetadata = false) {
99
99
  return serializedItems;
100
100
  }
101
101
  /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
102
- function makeSerializedImportedCollection(id, name, rawSchema, data, metadata) {
102
+ function makeSerializedImportedCollection(id, hash, name, rawSchema, data, metadata) {
103
103
  const { sheetSchema, oldToNewFields } = makeSchema(rawSchema);
104
104
  const metadataCollections = {};
105
105
  const itemOrderCollection = makeItemOrderCollection(data.length, name);
@@ -120,6 +120,7 @@ function makeSerializedImportedCollection(id, name, rawSchema, data, metadata) {
120
120
  'properties': {
121
121
  'UpstreamType': upstreamupdatetype_1.UpstreamUpdateType.EVENTPULL,
122
122
  'sheetId': id,
123
+ 'hash': hash,
123
124
  },
124
125
  },
125
126
  'Metadata': metadataCollections,
@@ -13,3 +13,5 @@ export interface JsonObjectConvertible {
13
13
  * Any type that can be natively converted to a string with JSON.stringify.
14
14
  */
15
15
  export declare type JsonSerializable = undefined | null | string | number | boolean | JsonArray | JsonObject;
16
+ export declare function isJsonSerializable(x: unknown): x is JsonSerializable;
17
+ export declare function isJsonObject(x: unknown): x is JsonObject;
@@ -1,2 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isJsonObject = exports.isJsonSerializable = void 0;
4
+ const checks_1 = require("./checks");
5
+ function isJsonSerializable(x) {
6
+ return (x == null ||
7
+ (0, checks_1.isString)(x) ||
8
+ (0, checks_1.isNumber)(x) ||
9
+ (0, checks_1.isBoolean)(x) ||
10
+ ((0, checks_1.isArray)(x) && x.every(isJsonSerializable)) ||
11
+ isJsonObject(x));
12
+ }
13
+ exports.isJsonSerializable = isJsonSerializable;
14
+ function isJsonObject(x) {
15
+ if (!(0, checks_1.isObject)(x)) {
16
+ return false;
17
+ }
18
+ for (const k in x) {
19
+ if (!isJsonSerializable(x[k])) {
20
+ return false;
21
+ }
22
+ }
23
+ return true;
24
+ }
25
+ exports.isJsonObject = isJsonObject;
@@ -0,0 +1,11 @@
1
+ export interface Success<T> {
2
+ value: T;
3
+ }
4
+ export interface Failure<T> {
5
+ error: T;
6
+ }
7
+ export declare type Result<S, F> = Success<S> | Failure<F>;
8
+ export declare function isSuccess<S, F>(res: Result<S, F>): res is Success<S>;
9
+ export declare function isFailure<S, F>(res: Result<S, F>): res is Failure<F>;
10
+ export declare function groupByResultType<S, F>(results: Result<S, F>[]): [Success<S>[], Failure<F>[]];
11
+ export declare function isEqual<S, F>(a: Result<S, F> | undefined, b: Result<S, F> | undefined, valueCompS: (p1: S, p2: S) => boolean, valueCompF: (p1: F, p2: F) => boolean): boolean;
package/core/result.js ADDED
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isEqual = exports.groupByResultType = exports.isFailure = exports.isSuccess = void 0;
4
+ const checks_1 = require("./checks");
5
+ function isSuccess(res) {
6
+ return (0, checks_1.isDef)(res.value);
7
+ }
8
+ exports.isSuccess = isSuccess;
9
+ function isFailure(res) {
10
+ return (0, checks_1.isDef)(res.error);
11
+ }
12
+ exports.isFailure = isFailure;
13
+ function groupByResultType(results) {
14
+ const successes = [];
15
+ const failures = [];
16
+ results.forEach((result) => {
17
+ if (isSuccess(result)) {
18
+ successes.push(result);
19
+ }
20
+ else {
21
+ failures.push(result);
22
+ }
23
+ });
24
+ return [successes, failures];
25
+ }
26
+ exports.groupByResultType = groupByResultType;
27
+ function isEqual(a, b, valueCompS, valueCompF) {
28
+ return ((!!a &&
29
+ !!b &&
30
+ ((isSuccess(a) && isSuccess(b) && valueCompS(a.value, b.value)) ||
31
+ (isFailure(a) && isFailure(b) && valueCompF(a.error, b.error)))) ||
32
+ a == b);
33
+ }
34
+ exports.isEqual = isEqual;
@@ -19,9 +19,10 @@ export declare type ImportedResults = {
19
19
  'collectionId': string;
20
20
  'headerRow': number;
21
21
  'schema': SerializedSchema;
22
- 'upstreamConfig': JsonSerializable;
22
+ 'upstreamConfig'?: JsonSerializable;
23
23
  }[];
24
24
  };
25
+ export declare const isImportedResults: (x: unknown) => x is ImportedResults;
25
26
  /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
26
27
  export declare abstract class LucidSpreadsheetIntegration<CONFIG extends JsonSerializable, SHEET extends JsonSerializable> {
27
28
  abstract labelDescription: string;
@@ -30,5 +31,5 @@ export declare abstract class LucidSpreadsheetIntegration<CONFIG extends JsonSer
30
31
  abstract getSpreadsheetDetailsToImport(): Promise<CONFIG | LucidSpreadsheetIntegrationFailureType>;
31
32
  abstract getMultipleSheetsForSpreadsheetDetails(spreadsheetDetails: CONFIG): Promise<Map<SHEET, string> | LucidSpreadsheetIntegrationFailureType>;
32
33
  abstract getSpreadsheetData(spreadsheetDetails: CONFIG, sheets: SHEET[]): Promise<SerializedImportedDataSource | LucidSpreadsheetIntegrationFailureType>;
33
- abstract importIsComplete(importedResults: ImportedResults): void;
34
+ abstract importIsComplete(syncDataSourceIdNonce: string, importedResults: ImportedResults): void;
34
35
  }
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LucidSpreadsheetIntegration = exports.lucidSpreadsheetIntegrationFailureTypeValidator = exports.LucidSpreadsheetIntegrationFailureType = void 0;
3
+ exports.LucidSpreadsheetIntegration = exports.isImportedResults = exports.lucidSpreadsheetIntegrationFailureTypeValidator = exports.LucidSpreadsheetIntegrationFailureType = void 0;
4
+ const checks_1 = require("../checks");
5
+ const serializedupstreamconfig_1 = require("../data/datasource/serializedupstreamconfig");
6
+ const serializedschema_1 = require("../data/serializedfield/serializedschema");
7
+ const jsonserializable_1 = require("../jsonserializable");
4
8
  const validators_1 = require("../validators/validators");
5
9
  /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
6
10
  var LucidSpreadsheetIntegrationFailureType;
@@ -11,6 +15,17 @@ var LucidSpreadsheetIntegrationFailureType;
11
15
  })(LucidSpreadsheetIntegrationFailureType = exports.LucidSpreadsheetIntegrationFailureType || (exports.LucidSpreadsheetIntegrationFailureType = {}));
12
16
  /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
13
17
  exports.lucidSpreadsheetIntegrationFailureTypeValidator = (0, validators_1.stringEnumValidator)(LucidSpreadsheetIntegrationFailureType);
18
+ exports.isImportedResults = (0, validators_1.strictObjectValidator)({
19
+ 'dataSourceId': checks_1.isString,
20
+ 'syncDataSourceId': checks_1.isString,
21
+ 'upstreamConfig': serializedupstreamconfig_1.isSerializedUpstreamConfig,
22
+ 'collections': (0, validators_1.arrayValidator)((0, validators_1.strictObjectValidator)({
23
+ 'collectionId': checks_1.isString,
24
+ 'headerRow': checks_1.isNumber,
25
+ 'schema': serializedschema_1.isSerializedSchema,
26
+ 'upstreamConfig': jsonserializable_1.isJsonSerializable,
27
+ })),
28
+ });
14
29
  /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
15
30
  class LucidSpreadsheetIntegration {
16
31
  }
@@ -44,7 +44,7 @@ class LucidSpreadsheetIntegrationRegistry {
44
44
  });
45
45
  const importIsCompleteActionName = LucidSpreadsheetIntegrationRegistry.nextHookName();
46
46
  client.registerAction(importIsCompleteActionName, async (message) => {
47
- spreadsheetIntegration.importIsComplete(message['ImportedResults']);
47
+ spreadsheetIntegration.importIsComplete(message['SyncDataSourceIdNonce'], message['ImportedResults']);
48
48
  });
49
49
  const serialized = {
50
50
  'ld': spreadsheetIntegration.labelDescription,
@@ -17,8 +17,22 @@ export declare class DataSourceClient {
17
17
  * and items. If it's just an update then the schema can be omitted (if unchanged) and items that already exist can
18
18
  * be partial.*/
19
19
  update(request: DataSourceRequest): Promise<void>;
20
+ /**
21
+ * When dealing with data, we can often have a very large number of collections in a single data source, and in
22
+ * turn, we may well end up get the values for a very large number of metadata values per collection.
23
+ * Because the endpoints for metadata use query params to encode the metadata names, and because metadata value
24
+ * reads can be easily parallelized, and because URLs have length limits, this function constructs an array of
25
+ * query params that are certain to be short enough that each individual query will be a safe length, while still
26
+ * getting *all* of the requested data.
27
+ * @param keys The metadata keys we are requesting from the data sync service for the corresponding data source.
28
+ * @param prefixes The metadata prefixes we are requesting from the data sync service for the corresponding data source.
29
+ * @returns An array of query params such that each query param is short enough to be safe, but all params combined
30
+ * cover all requested metadata.
31
+ */
32
+ private getLengthLimitedQueryParams;
33
+ private getResponseOrError;
20
34
  /** @ignore until metadata endpoints are made part of the public API */
21
- getMetadata(keys: string[]): Promise<MetadataRecord[]>;
35
+ getMetadata(keys: string[], prefixes?: string[]): Promise<MetadataRecord[]>;
22
36
  /** @ignore until metadata endpoints are made part of the public API */
23
37
  patchMetadata(patches: MetadataPatch[]): Promise<MetadataPatchResponse>;
24
38
  }
@@ -30,14 +44,14 @@ export declare class MockDataSourceClient extends DataSourceClient {
30
44
  /** Assign this to your mocked update function */
31
45
  gotUpdate: (request: DataSourceRequest) => void;
32
46
  /** Assign this to your mocked update function */
33
- gotMetadata: (keys: string[]) => MetadataRecord[];
47
+ gotMetadata: (keys: string[], prefixes: string[]) => MetadataRecord[];
34
48
  /** Assign this to your mocked update function */
35
49
  patchedMetadata: (patches: MetadataPatch[]) => MetadataPatchResponse;
36
50
  constructor();
37
51
  /** @ignore */
38
52
  update(request: DataSourceRequest): Promise<void>;
39
53
  /** @ignore */
40
- getMetadata(keys: string[]): Promise<MetadataRecord[]>;
54
+ getMetadata(keys: string[], prefixes?: string[]): Promise<MetadataRecord[]>;
41
55
  /** @ignore */
42
56
  patchMetadata(patches: MetadataPatch[]): Promise<MetadataPatchResponse>;
43
57
  }
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MockDataSourceClient = exports.DataSourceClient = void 0;
4
4
  const checks_1 = require("../core/checks");
5
+ const result_1 = require("../core/result");
5
6
  const validators_1 = require("../core/validators/validators");
6
7
  const dataconnector_1 = require("./dataconnector");
7
8
  const datasourcemetadatatypes_1 = require("./datasourcemetadatatypes");
8
9
  const datasourceupdatetypes_1 = require("./datasourceupdatetypes");
9
10
  const defaultfetchfunction_1 = require("./defaultfetchfunction");
10
11
  const throwunsuccessful_1 = require("./throwunsuccessful");
12
+ const QueryParamLengthLimit = 2000;
11
13
  /**
12
14
  * Authenticated client for DataSource related requests to Lucid.
13
15
  */
@@ -61,14 +63,42 @@ class DataSourceClient {
61
63
  // return await response.text();
62
64
  // but lets avoid users trying to interpret the response
63
65
  }
64
- /** @ignore until metadata endpoints are made part of the public API */
65
- async getMetadata(keys) {
66
- if (this.metadataUrl == null) {
67
- throw new Error('Attempted to access data sync service metadata endpoints in environment where the URL does not exist!');
66
+ /**
67
+ * When dealing with data, we can often have a very large number of collections in a single data source, and in
68
+ * turn, we may well end up get the values for a very large number of metadata values per collection.
69
+ * Because the endpoints for metadata use query params to encode the metadata names, and because metadata value
70
+ * reads can be easily parallelized, and because URLs have length limits, this function constructs an array of
71
+ * query params that are certain to be short enough that each individual query will be a safe length, while still
72
+ * getting *all* of the requested data.
73
+ * @param keys The metadata keys we are requesting from the data sync service for the corresponding data source.
74
+ * @param prefixes The metadata prefixes we are requesting from the data sync service for the corresponding data source.
75
+ * @returns An array of query params such that each query param is short enough to be safe, but all params combined
76
+ * cover all requested metadata.
77
+ */
78
+ getLengthLimitedQueryParams(keys, prefixes) {
79
+ const keyQueryParams = keys.map(encodeURIComponent).map((keyVal) => `metadataKeys=${keyVal}`);
80
+ const prefixQueryParams = prefixes.map(encodeURIComponent).map((prefixVal) => `metadataPrefixes=${prefixVal}`);
81
+ const fullQueryParams = [];
82
+ let currentQueryParam = '';
83
+ let delimiter = '?';
84
+ [...keyQueryParams, ...prefixQueryParams].forEach((param) => {
85
+ currentQueryParam = currentQueryParam.concat(`${delimiter}${param}`);
86
+ if (currentQueryParam.length > QueryParamLengthLimit) {
87
+ fullQueryParams.push(currentQueryParam);
88
+ currentQueryParam = '';
89
+ delimiter = '?';
90
+ }
91
+ else {
92
+ delimiter = '&';
93
+ }
94
+ });
95
+ if (currentQueryParam.length > 0) {
96
+ fullQueryParams.push(currentQueryParam);
68
97
  }
69
- const encodedKeys = keys.map(encodeURIComponent);
70
- const urlWithParams = `${this.metadataUrl}?metadataKeys=${encodedKeys.join('&metadataKeys=')}`;
71
- const response = await this.fetchMethod(urlWithParams, {
98
+ return fullQueryParams;
99
+ }
100
+ async getResponseOrError(url) {
101
+ const response = await this.fetchMethod(url, {
72
102
  'method': 'GET',
73
103
  'headers': {
74
104
  'Content-Type': 'application/json',
@@ -76,19 +106,57 @@ class DataSourceClient {
76
106
  'Lucid-Api-Version': '1',
77
107
  },
78
108
  });
79
- await (0, throwunsuccessful_1.throwUnsuccessful)(response, 'getting data source`s metadata');
109
+ try {
110
+ await (0, throwunsuccessful_1.throwUnsuccessful)(response, 'getting data source`s metadata');
111
+ }
112
+ catch (e) {
113
+ if (e instanceof dataconnector_1.DataConnectorResponseError) {
114
+ return { error: { url, body: e.response } };
115
+ }
116
+ throw e;
117
+ }
80
118
  const responseBody = await response.json();
81
119
  if ((0, validators_1.arrayValidator)(datasourcemetadatatypes_1.isSerializedMetadataRecord)(responseBody)) {
82
- return responseBody.map((rawResponse) => {
83
- return {
84
- key: rawResponse['key'],
85
- value: rawResponse['value'],
86
- };
87
- });
120
+ return {
121
+ value: responseBody.map((rawResponse) => {
122
+ return {
123
+ key: rawResponse['key'],
124
+ value: rawResponse['value'],
125
+ };
126
+ }),
127
+ };
88
128
  }
89
129
  else {
90
- throw new dataconnector_1.DataConnectorResponseError(`Invalid response to query at '${urlWithParams}'! Expected an array of serialized metadata records`, JSON.stringify(responseBody));
130
+ return {
131
+ error: { url, body: responseBody },
132
+ };
133
+ }
134
+ }
135
+ /** @ignore until metadata endpoints are made part of the public API */
136
+ async getMetadata(keys, prefixes = []) {
137
+ if (this.metadataUrl == null) {
138
+ throw new Error('Attempted to access data sync service metadata endpoints in environment where the URL does not exist!');
139
+ }
140
+ const queryParamsList = this.getLengthLimitedQueryParams(keys, prefixes);
141
+ const urlsWithParams = queryParamsList.map((query) => `${this.metadataUrl}${query}`);
142
+ const responsePromises = urlsWithParams.map((url) => this.getResponseOrError(url));
143
+ const responses = await Promise.all(responsePromises);
144
+ const records = [];
145
+ const errors = [];
146
+ responses.forEach((response) => {
147
+ if ((0, result_1.isSuccess)(response)) {
148
+ records.push(...response.value);
149
+ }
150
+ else {
151
+ errors.push(response.error);
152
+ }
153
+ });
154
+ if (errors.length > 0) {
155
+ const message = `Error(s) received accessing URL(s): ${errors.map(({ url }) => url).join(',')}`;
156
+ const allBodies = errors.map(({ body }) => body);
157
+ throw new dataconnector_1.DataConnectorResponseError(message, JSON.stringify(allBodies));
91
158
  }
159
+ return records;
92
160
  }
93
161
  /** @ignore until metadata endpoints are made part of the public API */
94
162
  async patchMetadata(patches) {
@@ -156,8 +224,8 @@ class MockDataSourceClient extends DataSourceClient {
156
224
  return Promise.resolve(this.gotUpdate(request));
157
225
  }
158
226
  /** @ignore */
159
- getMetadata(keys) {
160
- return Promise.resolve(this.gotMetadata(keys));
227
+ getMetadata(keys, prefixes = []) {
228
+ return Promise.resolve(this.gotMetadata(keys, prefixes));
161
229
  }
162
230
  /** @ignore */
163
231
  patchMetadata(patches) {
@@ -11,7 +11,7 @@ const pageproxy_1 = require("./pageproxy");
11
11
  */
12
12
  class DocumentProxy extends elementproxy_1.ElementProxy {
13
13
  constructor(client) {
14
- super(undefined, client);
14
+ super(client.sendCommand("gdid" /* CommandName.GetDocumentId */, undefined), client);
15
15
  /**
16
16
  * The set of pages on this document, organized by ID
17
17
  */
@@ -42,10 +42,10 @@ export declare class ElementProxy extends PropertyStoreProxy {
42
42
  removeReferenceKey(key: number | string): void;
43
43
  /**
44
44
  *
45
- * @param id ID of this element, or `undefined` for the document itself
45
+ * @param id ID of this element
46
46
  * @param client
47
47
  */
48
- constructor(id: string | undefined, client: EditorClient);
48
+ constructor(id: string, client: EditorClient);
49
49
  /**
50
50
  * @returns `true` if this element still exists on the document, or `false` otherwise
51
51
  */
@@ -17,7 +17,7 @@ const shapedataproxy_1 = require("./shapedataproxy");
17
17
  class ElementProxy extends propertystoreproxy_1.PropertyStoreProxy {
18
18
  /**
19
19
  *
20
- * @param id ID of this element, or `undefined` for the document itself
20
+ * @param id ID of this element
21
21
  * @param client
22
22
  */
23
23
  constructor(id, client) {
@@ -4,7 +4,7 @@ import { WriteableMapProxy } from './mapproxy';
4
4
  * Base class for anything on a Lucid document that has an ID and properties.
5
5
  */
6
6
  export declare class PropertyStoreProxy {
7
- readonly id: string | undefined;
7
+ readonly id: string;
8
8
  protected readonly client: EditorClient;
9
9
  /**
10
10
  * All properties available on this element, organized by name.
@@ -14,8 +14,8 @@ export declare class PropertyStoreProxy {
14
14
  readonly properties: WriteableMapProxy<string, import("..").JsonSerializable, void, import("..").JsonSerializable>;
15
15
  /**
16
16
  *
17
- * @param id ID of this element, or undefined for the document itself
17
+ * @param id ID of this element
18
18
  * @param client
19
19
  */
20
- constructor(id: string | undefined, client: EditorClient);
20
+ constructor(id: string, client: EditorClient);
21
21
  }
@@ -8,7 +8,7 @@ const mapproxy_1 = require("./mapproxy");
8
8
  class PropertyStoreProxy {
9
9
  /**
10
10
  *
11
- * @param id ID of this element, or undefined for the document itself
11
+ * @param id ID of this element
12
12
  * @param client
13
13
  */
14
14
  constructor(id, client) {
package/index.d.ts CHANGED
@@ -105,3 +105,4 @@ export * from './ui/menu';
105
105
  export * from './ui/modal';
106
106
  export * from './ui/panel';
107
107
  export * from './ui/viewport';
108
+ export * from './user/userproxy';
package/index.js CHANGED
@@ -121,3 +121,4 @@ __exportStar(require("./ui/menu"), exports);
121
121
  __exportStar(require("./ui/modal"), exports);
122
122
  __exportStar(require("./ui/panel"), exports);
123
123
  __exportStar(require("./ui/viewport"), exports);
124
+ __exportStar(require("./user/userproxy"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.150",
3
+ "version": "0.0.153",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -0,0 +1,9 @@
1
+ import { EditorClient } from '../editorclient';
2
+ /**
3
+ * The UserProxy class gives access to the current user on the current Lucid document.
4
+ */
5
+ export declare class UserProxy {
6
+ private readonly client;
7
+ readonly id: string;
8
+ constructor(client: EditorClient);
9
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserProxy = void 0;
4
+ /**
5
+ * The UserProxy class gives access to the current user on the current Lucid document.
6
+ */
7
+ class UserProxy {
8
+ constructor(client) {
9
+ this.client = client;
10
+ this.id = this.client.sendCommand("guid" /* CommandName.GetUserId */, undefined);
11
+ }
12
+ }
13
+ exports.UserProxy = UserProxy;