lucid-extension-sdk 0.0.199 → 0.0.201

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
@@ -64,6 +64,7 @@ export declare const enum CommandName {
64
64
  GetDocumentAccessPermission = "gdap",
65
65
  GetDocumentId = "gdid",
66
66
  GetElementType = "get",
67
+ GetEnvironmentConfig = "gec",
67
68
  GetItemPageId = "gip",
68
69
  GetItemsAt = "gia",
69
70
  GetOAuthToken = "got",
@@ -313,6 +314,10 @@ export type CommandArgs = {
313
314
  query: GetElementTypeQuery;
314
315
  result: GetElementTypeResult;
315
316
  };
317
+ [CommandName.GetEnvironmentConfig]: {
318
+ query: GetEnvironmentConfigQuery;
319
+ result: GetEnvironmentConfigResult;
320
+ };
316
321
  [CommandName.GetItemPageId]: {
317
322
  query: GetItemPageIdQuery;
318
323
  result: GetItemPageIdResult;
@@ -958,6 +963,8 @@ export type GetElementTypeQuery = {
958
963
  'id'?: string | undefined;
959
964
  };
960
965
  export type GetElementTypeResult = 'block' | 'line' | 'group' | 'visual-activity' | 'page' | 'document' | 'generator' | 'panel';
966
+ export type GetEnvironmentConfigQuery = string;
967
+ export type GetEnvironmentConfigResult = JsonSerializable;
961
968
  export type GetConnectedLinesQuery = string;
962
969
  export type GetConnectedLinesResult = string[];
963
970
  export type GetCurrentPageQuery = void;
package/commandtypes.js CHANGED
@@ -42,6 +42,7 @@ exports.commandTitles = new Map([
42
42
  ["gdap" /* CommandName.GetDocumentAccessPermission */, 'GetDocumentAccessPermission'],
43
43
  ["gdid" /* CommandName.GetDocumentId */, 'GetDocumentId'],
44
44
  ["get" /* CommandName.GetElementType */, 'GetElementType'],
45
+ ["gec" /* CommandName.GetEnvironmentConfig */, 'GetEnvironmentConfig'],
45
46
  ["gip" /* CommandName.GetItemPageId */, 'GetItemPageId'],
46
47
  ["gia" /* CommandName.GetItemsAt */, 'GetItemsAt'],
47
48
  ["got" /* CommandName.GetOAuthToken */, 'GetOAuthToken'],
@@ -12,16 +12,17 @@ const object_1 = require("../object");
12
12
  * and is one of the values in the specified enum (object).
13
13
  */
14
14
  function stringEnumValidator(enumMap) {
15
- return (x) => {
16
- if (!(0, checks_1.isString)(x)) {
17
- return false;
15
+ const enumValues = new Set();
16
+ for (const key in enumMap) {
17
+ const enumValue = enumMap[key];
18
+ if ((0, checks_1.isString)(enumValue)) {
19
+ enumValues.add(enumValue);
18
20
  }
19
- for (const key in enumMap) {
20
- if (enumMap[key] === x) {
21
- return true;
22
- }
23
- }
24
- return false;
21
+ }
22
+ // this allows using Set:has on unknown type
23
+ const unknownEnumValues = enumValues;
24
+ return (x) => {
25
+ return unknownEnumValues.has(x);
25
26
  };
26
27
  }
27
28
  exports.stringEnumValidator = stringEnumValidator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.199",
3
+ "version": "0.0.201",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",