lucid-extension-sdk 0.0.255 → 0.0.257

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
@@ -60,6 +60,7 @@ export declare const enum CommandName {
60
60
  Download = "d",
61
61
  DragPointerMove = "dpm",
62
62
  DragPointerUp = "dpu",
63
+ DuplicateItems = "dis",
63
64
  ElementExists = "ee",
64
65
  ExecuteFormula = "ef",
65
66
  FindAvailableSpace = "fas",
@@ -303,6 +304,10 @@ export type CommandArgs = {
303
304
  query: DragPointerUpQuery;
304
305
  result: DragPointerUpResult;
305
306
  };
307
+ [CommandName.DuplicateItems]: {
308
+ query: DuplicateItemsQuery;
309
+ result: DuplicateItemsResult;
310
+ };
306
311
  [CommandName.ElementExists]: {
307
312
  query: ElementExistsQuery;
308
313
  result: ElementExistsResult;
@@ -1039,6 +1044,10 @@ export type DragPointerUpQuery = {
1039
1044
  'y': number;
1040
1045
  };
1041
1046
  export type DragPointerUpResult = undefined;
1047
+ export type DuplicateItemsQuery = {
1048
+ 'ids': string[];
1049
+ };
1050
+ export type DuplicateItemsResult = Promise<string[]>;
1042
1051
  export type ElementExistsQuery = {
1043
1052
  'id'?: string | undefined;
1044
1053
  };
package/commandtypes.js CHANGED
@@ -36,6 +36,7 @@ exports.commandTitles = new Map([
36
36
  ["d" /* CommandName.Download */, 'Download'],
37
37
  ["dpm" /* CommandName.DragPointerMove */, 'DragPointerMove'],
38
38
  ["dpu" /* CommandName.DragPointerUp */, 'DragPointerUp'],
39
+ ["dis" /* CommandName.DuplicateItems */, 'DuplicateItems'],
39
40
  ["ee" /* CommandName.ElementExists */, 'ElementExists'],
40
41
  ["ef" /* CommandName.ExecuteFormula */, 'ExecuteFormula'],
41
42
  ["fas" /* CommandName.FindAvailableSpace */, 'FindAvailableSpace'],
@@ -10,7 +10,8 @@ export declare enum FieldConstraintType {
10
10
  MAX_VALUE = "maxValue",
11
11
  SINGLE_LINE_ONLY = "singleLineOnly",
12
12
  NO_WHITESPACE = "noWhitespace",
13
- UNIQUE_EDIT = "uniqueEditType"
13
+ UNIQUE_EDIT = "uniqueEditType",
14
+ MAX_LENGTH = "maxLength"
14
15
  }
15
16
  export declare const isFieldConstraintType: (x: unknown) => x is FieldConstraintType;
16
17
  export type SerializedFieldConstraint = {
@@ -16,6 +16,7 @@ var FieldConstraintType;
16
16
  FieldConstraintType["SINGLE_LINE_ONLY"] = "singleLineOnly";
17
17
  FieldConstraintType["NO_WHITESPACE"] = "noWhitespace";
18
18
  FieldConstraintType["UNIQUE_EDIT"] = "uniqueEditType";
19
+ FieldConstraintType["MAX_LENGTH"] = "maxLength";
19
20
  })(FieldConstraintType || (exports.FieldConstraintType = FieldConstraintType = {}));
20
21
  exports.isFieldConstraintType = (0, validators_1.enumValidator)(FieldConstraintType);
21
22
  exports.isSerializedFieldConstraint = (0, validators_1.objectValidator)({
@@ -32,8 +32,12 @@ export interface UniqueEditFieldConstraintDefinition {
32
32
  type: FieldConstraintType.UNIQUE_EDIT;
33
33
  value?: undefined;
34
34
  }
35
- export type FieldConstraintDefinition = RequiredFieldConstraintDefinition | LockedFieldConstraintDefinition | MinValueFieldConstraintDefinition | MaxValueFieldConstraintDefinition | SingleLineFieldConstraintDefinition | NoWhitespaceFieldConstraintDefinition | UniqueEditFieldConstraintDefinition;
36
- export declare function minMaxFieldConstraintValidator(val: unknown): val is FieldConstraintType.MIN_VALUE | FieldConstraintType.MAX_VALUE;
35
+ export interface MaxLengthConstraintDefinition {
36
+ type: FieldConstraintType.MAX_LENGTH;
37
+ value: number;
38
+ }
39
+ export type FieldConstraintDefinition = RequiredFieldConstraintDefinition | LockedFieldConstraintDefinition | MinValueFieldConstraintDefinition | MaxValueFieldConstraintDefinition | SingleLineFieldConstraintDefinition | NoWhitespaceFieldConstraintDefinition | UniqueEditFieldConstraintDefinition | MaxLengthConstraintDefinition;
40
+ export declare function minMaxFieldConstraintValidator(val: unknown): val is FieldConstraintType.MIN_VALUE | FieldConstraintType.MAX_VALUE | FieldConstraintType.MAX_LENGTH;
37
41
  export declare const isFieldConstraintDefinition: (x: unknown) => x is {
38
42
  type?: FieldConstraintType | undefined;
39
43
  } & {
@@ -6,7 +6,9 @@ const fieldtypedefinition_1 = require("../core/data/fieldtypedefinition/fieldtyp
6
6
  const serializedfielddefinition_1 = require("../core/data/serializedfield/serializedfielddefinition");
7
7
  const validators_1 = require("../core/validators/validators");
8
8
  function minMaxFieldConstraintValidator(val) {
9
- return val === serializedfielddefinition_1.FieldConstraintType.MIN_VALUE || val === serializedfielddefinition_1.FieldConstraintType.MAX_VALUE;
9
+ return (val === serializedfielddefinition_1.FieldConstraintType.MIN_VALUE ||
10
+ val === serializedfielddefinition_1.FieldConstraintType.MAX_VALUE ||
11
+ val === serializedfielddefinition_1.FieldConstraintType.MAX_LENGTH);
10
12
  }
11
13
  exports.minMaxFieldConstraintValidator = minMaxFieldConstraintValidator;
12
14
  exports.isFieldConstraintDefinition = (0, validators_1.both)((0, validators_1.objectValidator)({
@@ -54,6 +56,7 @@ function parseFieldDefinition(field) {
54
56
  switch (constraint['Type']) {
55
57
  case serializedfielddefinition_1.FieldConstraintType.MIN_VALUE:
56
58
  case serializedfielddefinition_1.FieldConstraintType.MAX_VALUE:
59
+ case serializedfielddefinition_1.FieldConstraintType.MAX_LENGTH:
57
60
  if (!(0, checks_1.isNumber)(constraint['Details'])) {
58
61
  throw new Error('Invalid constraint format');
59
62
  }
@@ -1,4 +1,4 @@
1
- import { GetDocumentChunksType } from '../commandtypes';
1
+ import { DuplicateItemsResult, GetDocumentChunksType } from '../commandtypes';
2
2
  import { EditorClient } from '../editorclient';
3
3
  import { DocumentChunk } from './documentchunk';
4
4
  import { CardConfigProxy } from './documentelement/cardconfigproxy';
@@ -96,4 +96,5 @@ export declare class DocumentProxy extends ElementProxy {
96
96
  * @param handle Return value from `hookDeleteItems`
97
97
  */
98
98
  unhookDeleteItems(handle: string): void;
99
+ duplicateItems(ids: string[]): DuplicateItemsResult;
99
100
  }
@@ -177,6 +177,9 @@ class DocumentProxy extends elementproxy_1.ElementProxy {
177
177
  this.client.deleteAction(handle);
178
178
  this.client.sendCommand("udi" /* CommandName.UnhookDeleteItems */, { 'n': handle });
179
179
  }
180
+ async duplicateItems(ids) {
181
+ return await this.client.sendCommand("dis" /* CommandName.DuplicateItems */, { 'ids': ids });
182
+ }
180
183
  }
181
184
  exports.DocumentProxy = DocumentProxy;
182
185
  DocumentProxy.nextHookId = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.255",
3
+ "version": "0.0.257",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",