lucid-extension-sdk 0.0.198 → 0.0.200

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
@@ -19,6 +19,8 @@ import { PanelLocation } from './ui/panel';
19
19
  * exposed through appropriate classes and methods elsewhere in this SDK.
20
20
  *
21
21
  * To use these directly, use [EditorClient.sendCommand](#classes_editorclient-EditorClient_sendcommand).
22
+ *
23
+ * IMPORTANT - Before you add a new command bring it up in #api-committee to get feedback
22
24
  */
23
25
  export declare const enum CommandName {
24
26
  AddCardIntegration = "aci",
@@ -143,6 +145,8 @@ export declare const commandTitles: Map<CommandName, string>;
143
145
  * This is a type declaration whose purpose is to allow TypeScript to enforce the correct parameter and
144
146
  * return types from [EditorClient.sendCommand](#classes_editorclient-EditorClient_sendcommand) based on
145
147
  * which command name you pass in as the first parameter.
148
+ *
149
+ * IMPORTANT - Before you add a new command bring it up in #api-committee to get feedback
146
150
  */
147
151
  export type CommandArgs = {
148
152
  [CommandName.AddCardIntegration]: {
@@ -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.198",
3
+ "version": "0.0.200",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",