lucid-extension-sdk 0.0.328 → 0.0.330
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/core/cardintegration/cardintegrationdefinitions.d.ts +9 -0
- package/core/cardintegration/cardintegrationdefinitions.js +3 -2
- package/core/validators/validators.d.ts +7 -1
- package/core/validators/validators.js +21 -2
- package/editorclient.d.ts +2 -1
- package/editorclient.js +13 -1
- package/package.json +1 -1
|
@@ -22,6 +22,13 @@ export interface ExtensionCardFieldDefinition extends FieldDefinition {
|
|
|
22
22
|
* or as a Promise).
|
|
23
23
|
*/
|
|
24
24
|
options?: ExtensionCardFieldOption[] | string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* If set, when this field is changed, selections for any of the fields in
|
|
27
|
+
* this list will be unset.
|
|
28
|
+
*
|
|
29
|
+
* This is useful if changing this field invalidates the values of other fields.
|
|
30
|
+
*/
|
|
31
|
+
unsetFieldsWhenChanged?: string[] | undefined;
|
|
25
32
|
/**
|
|
26
33
|
* If specified, an action that takes the search text and input so far, and
|
|
27
34
|
* returns the list of options that should be displayed. This is useful when
|
|
@@ -69,6 +76,7 @@ export type SerializedExtensionCardFieldDefinition = SerializedFieldDefinition &
|
|
|
69
76
|
'd'?: string | undefined;
|
|
70
77
|
'op'?: SerializedCardFieldOption[] | string | undefined;
|
|
71
78
|
's'?: string | undefined;
|
|
79
|
+
'u'?: string[] | undefined;
|
|
72
80
|
};
|
|
73
81
|
/** @ignore */
|
|
74
82
|
export declare function serializeCardFieldDefinition(field: ExtensionCardFieldDefinition): SerializedExtensionCardFieldDefinition;
|
|
@@ -103,6 +111,7 @@ export declare const isSerializedExtensionCardFieldDefinition: (subject: unknown
|
|
|
103
111
|
i: (x: unknown) => x is string | undefined;
|
|
104
112
|
}>[] | undefined;
|
|
105
113
|
s: (x: unknown) => x is string | undefined;
|
|
114
|
+
u: (x: unknown) => x is string[] | undefined;
|
|
106
115
|
}>;
|
|
107
116
|
/** @ignore */
|
|
108
117
|
export declare function deserializeCardFieldDefinition(field: SerializedExtensionCardFieldDefinition): ExtensionCardFieldDefinition;
|
|
@@ -36,7 +36,7 @@ exports.serializeCardFieldOption = serializeCardFieldOption;
|
|
|
36
36
|
/** @ignore */
|
|
37
37
|
function serializeCardFieldDefinition(field) {
|
|
38
38
|
var _a;
|
|
39
|
-
return Object.assign(Object.assign({}, (0, schemadefinition_1.serializeFieldDefinition)(field)), { 'l': field.label, 'def': field.default, 'd': field.description, 'op': (0, checks_1.isString)(field.options) ? field.options : (_a = field.options) === null || _a === void 0 ? void 0 : _a.map(serializeCardFieldOption), 's': field.search });
|
|
39
|
+
return Object.assign(Object.assign({}, (0, schemadefinition_1.serializeFieldDefinition)(field)), { 'l': field.label, 'def': field.default, 'd': field.description, 'op': (0, checks_1.isString)(field.options) ? field.options : (_a = field.options) === null || _a === void 0 ? void 0 : _a.map(serializeCardFieldOption), 's': field.search, 'u': field.unsetFieldsWhenChanged });
|
|
40
40
|
}
|
|
41
41
|
exports.serializeCardFieldDefinition = serializeCardFieldDefinition;
|
|
42
42
|
/** @ignore */
|
|
@@ -69,11 +69,12 @@ exports.isSerializedExtensionCardFieldDefinition = (0, validators_1.objectValida
|
|
|
69
69
|
'def': (0, validators_1.option)(serializedfields_1.isSerializedFieldType),
|
|
70
70
|
'op': (0, validators_1.option)((0, validators_1.either)(checks_1.isString, (0, validators_1.arrayValidator)(exports.isSerializedFieldOption))),
|
|
71
71
|
's': (0, validators_1.option)(checks_1.isString),
|
|
72
|
+
'u': (0, validators_1.option)((0, checks_1.isTypedArray)(checks_1.isString)),
|
|
72
73
|
});
|
|
73
74
|
/** @ignore */
|
|
74
75
|
function deserializeCardFieldDefinition(field) {
|
|
75
76
|
var _a;
|
|
76
|
-
return Object.assign(Object.assign({}, (0, schemadefinition_1.parseFieldDefinition)(field)), { label: field['l'], description: field['d'], default: field['def'], options: (0, checks_1.isString)(field['op']) ? field['op'] : (_a = field['op']) === null || _a === void 0 ? void 0 : _a.map(deserializeFieldOption), search: field['s'] });
|
|
77
|
+
return Object.assign(Object.assign({}, (0, schemadefinition_1.parseFieldDefinition)(field)), { label: field['l'], description: field['d'], default: field['def'], options: (0, checks_1.isString)(field['op']) ? field['op'] : (_a = field['op']) === null || _a === void 0 ? void 0 : _a.map(deserializeFieldOption), search: field['s'], unsetFieldsWhenChanged: field['u'] });
|
|
77
78
|
}
|
|
78
79
|
exports.deserializeCardFieldDefinition = deserializeCardFieldDefinition;
|
|
79
80
|
/** @ignore */
|
|
@@ -28,6 +28,12 @@ export declare function rangeValidator(min: number, max: number): (x: unknown) =
|
|
|
28
28
|
* @return A validator for the array type
|
|
29
29
|
*/
|
|
30
30
|
export declare function arrayValidator<T>(subValidator: (p1: unknown) => p1 is T): (p1: unknown) => p1 is T[];
|
|
31
|
+
/**
|
|
32
|
+
* valid if at least one item in the array is valid.
|
|
33
|
+
* @param subValidator
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
export declare function arrayValidatorWithList<T>(subValidator: (p1: unknown) => p1 is T): (p1: unknown, invalidItems?: unknown[]) => p1 is T[];
|
|
31
37
|
/**
|
|
32
38
|
* Creates a validator for a fixed width array where each entry
|
|
33
39
|
* in the array can have a separate validator
|
|
@@ -74,7 +80,7 @@ export declare function objectValidator<T extends {
|
|
|
74
80
|
* which will return all of the fields that were found to be invalid.
|
|
75
81
|
*/
|
|
76
82
|
export declare function objectValidatorWithList<T extends {
|
|
77
|
-
[key: string]: (p1: unknown) => p1 is unknown;
|
|
83
|
+
[key: string]: (p1: unknown, invalidFields?: unknown[]) => p1 is unknown;
|
|
78
84
|
}>(validatorStructure: T): (subject: unknown, invalidFields?: unknown[]) => subject is DestructureGuardedTypeObj<T>;
|
|
79
85
|
/**
|
|
80
86
|
* Creates a validator which tests if the target is an object
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.asAssertion = exports.validatorWithMessage = exports.minLengthValidator = exports.maxLengthValidator = exports.isDate = exports.isPositiveNumber = exports.isSize = exports.isPanelSize = exports.isBoundingBox = exports.isPointLike = exports.isOpacity = exports.isFalse = exports.isTrue = exports.isFlag = exports.isRestrictions = exports.isStringOrNegativeOne = exports.isBooleanOrEmptyString = exports.isNumberOrEmptyString = exports.isSet = exports.propertyValidator = exports.exclude = exports.both = exports.either = exports.isNullOption = exports.nullableOption = exports.option = exports.nullable = exports.objectOfValidator = exports.typedRecordValidator = exports.recordValidator = exports.strictObjectValidator = exports.partialObjectValidator = exports.objectValidatorWithList = exports.objectValidator = exports.mapValidator = exports.someValidator = exports.someValue = exports.tupleValidator = exports.arrayValidator = exports.rangeValidator = exports.enumValidator = exports.stringEnumValidator = void 0;
|
|
3
|
+
exports.asAssertion = exports.validatorWithMessage = exports.minLengthValidator = exports.maxLengthValidator = exports.isDate = exports.isPositiveNumber = exports.isSize = exports.isPanelSize = exports.isBoundingBox = exports.isPointLike = exports.isOpacity = exports.isFalse = exports.isTrue = exports.isFlag = exports.isRestrictions = exports.isStringOrNegativeOne = exports.isBooleanOrEmptyString = exports.isNumberOrEmptyString = exports.isSet = exports.propertyValidator = exports.exclude = exports.both = exports.either = exports.isNullOption = exports.nullableOption = exports.option = exports.nullable = exports.objectOfValidator = exports.typedRecordValidator = exports.recordValidator = exports.strictObjectValidator = exports.partialObjectValidator = exports.objectValidatorWithList = exports.objectValidator = exports.mapValidator = exports.someValidator = exports.someValue = exports.tupleValidator = exports.arrayValidatorWithList = exports.arrayValidator = exports.rangeValidator = exports.enumValidator = exports.stringEnumValidator = void 0;
|
|
4
4
|
const checks_1 = require("../checks");
|
|
5
5
|
/*********************************************************************************
|
|
6
6
|
* Validator generators: These functions construct new composite validators
|
|
@@ -64,6 +64,25 @@ function arrayValidator(subValidator) {
|
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
exports.arrayValidator = arrayValidator;
|
|
67
|
+
/**
|
|
68
|
+
* valid if at least one item in the array is valid.
|
|
69
|
+
* @param subValidator
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
function arrayValidatorWithList(subValidator) {
|
|
73
|
+
return (x, invalidItems) => {
|
|
74
|
+
if (!(0, checks_1.isArray)(x)) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
for (const element of x) {
|
|
78
|
+
if (!subValidator(element)) {
|
|
79
|
+
invalidItems === null || invalidItems === void 0 ? void 0 : invalidItems.push(element);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return x.some(subValidator);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
exports.arrayValidatorWithList = arrayValidatorWithList;
|
|
67
86
|
/**
|
|
68
87
|
* Creates a validator for a fixed width array where each entry
|
|
69
88
|
* in the array can have a separate validator
|
|
@@ -157,7 +176,7 @@ function objectValidatorWithList(validatorStructure) {
|
|
|
157
176
|
else {
|
|
158
177
|
let valid = true;
|
|
159
178
|
Object.entries(validatorStructure).forEach(([key, validator]) => {
|
|
160
|
-
if (!validator(subject[key])) {
|
|
179
|
+
if (!validator(subject[key], invalidFields)) {
|
|
161
180
|
if (invalidFields && Array.isArray(invalidFields)) {
|
|
162
181
|
invalidFields.push(key);
|
|
163
182
|
}
|
package/editorclient.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandArgs, CommandName, HashAlgorithmEnum, TriggerAuthFlowResult, UnionToIntersection } from './commandtypes';
|
|
2
|
-
import { JsonSerializable } from './core/jsonserializable';
|
|
2
|
+
import { JsonObject, JsonSerializable } from './core/jsonserializable';
|
|
3
3
|
import { UnfurlCallbacks } from './core/unfurl/unfurlcallbacks';
|
|
4
4
|
import { BinaryXHRResponse, OAuthXHRRequest, TextXHRResponse, XHRRequest, XHRResponse } from './core/xhr';
|
|
5
5
|
import { CollectionProxy } from './data/collectionproxy';
|
|
@@ -20,6 +20,7 @@ export type DataActionResponse = {
|
|
|
20
20
|
/** The body of the HTTP Response (otherwise) */
|
|
21
21
|
'text': string;
|
|
22
22
|
});
|
|
23
|
+
export declare function getResponseBody(response: DataActionResponse): string | JsonObject;
|
|
23
24
|
export type DataActionOptions = {
|
|
24
25
|
dataConnectorName: string;
|
|
25
26
|
actionName: string;
|
package/editorclient.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EditorClient = void 0;
|
|
3
|
+
exports.EditorClient = exports.getResponseBody = void 0;
|
|
4
4
|
const commandtypes_1 = require("./commandtypes");
|
|
5
5
|
const base64_1 = require("./core/base64");
|
|
6
6
|
const checks_1 = require("./core/checks");
|
|
@@ -29,6 +29,18 @@ function parseRawXHRResponse(responseFormat, raw) {
|
|
|
29
29
|
responseData: (raw === null || raw === void 0 ? void 0 : raw['t']) ? (0, base64_1.decodeBase64)(raw['t']) : new Uint8Array(0),
|
|
30
30
|
}));
|
|
31
31
|
}
|
|
32
|
+
function getResponseBody(response) {
|
|
33
|
+
if ('json' in response) {
|
|
34
|
+
return response['json'];
|
|
35
|
+
}
|
|
36
|
+
else if ('text' in response) {
|
|
37
|
+
return response['text'];
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return '';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.getResponseBody = getResponseBody;
|
|
32
44
|
class EditorClient {
|
|
33
45
|
getUniqueActionName() {
|
|
34
46
|
while (this.actionExists('a' + this.nextId)) {
|