lucid-extension-sdk 0.0.44 → 0.0.46
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/package.json +1 -1
- package/sdk/commandtypes.d.ts +15 -1
- package/sdk/core/cardintegration/cardintegration.d.ts +63 -29
- package/sdk/core/cardintegration/cardintegration.js +19 -26
- package/sdk/core/checks.d.ts +11 -0
- package/sdk/core/checks.js +14 -1
- package/sdk/core/xhr.d.ts +49 -0
- package/sdk/core/xhr.js +20 -0
- package/sdk/data/collectionproxy.d.ts +3 -1
- package/sdk/data/collectionproxy.js +5 -1
- package/sdk/data/schemadefinition.d.ts +33 -0
- package/sdk/data/schemadefinition.js +51 -13
- package/sdk/document/taskmanagementcardintegration.js +28 -3
- package/sdk/editorclient.d.ts +2 -45
- package/sdk/editorclient.js +10 -5
- package/sdk/index.d.ts +1 -0
- package/sdk/index.js +1 -0
- package/sdk/message/unfurleventmessage.d.ts +24 -0
- package/sdk/message/unfurleventmessage.js +23 -0
- package/sdk/message/registerunfurlmessage.d.ts +0 -32
- package/sdk/message/registerunfurlmessage.js +0 -33
package/package.json
CHANGED
package/sdk/commandtypes.d.ts
CHANGED
|
@@ -415,12 +415,18 @@ export declare type CommandArgs = {
|
|
|
415
415
|
export declare type AddCardIntegrationQuery = {
|
|
416
416
|
/** Title/name */
|
|
417
417
|
'n': string;
|
|
418
|
+
/** Item label */
|
|
419
|
+
'il': string;
|
|
420
|
+
/** Items label */
|
|
421
|
+
'isl': string;
|
|
418
422
|
/** Icon url */
|
|
419
423
|
'u': string;
|
|
420
424
|
/** Callback to get field definitions for a given imported collection */
|
|
421
425
|
'gf': string;
|
|
422
426
|
/** Show intro if user has not yet authorized this integration */
|
|
423
427
|
'i'?: string;
|
|
428
|
+
/** Get default config action */
|
|
429
|
+
'gdc': string;
|
|
424
430
|
/** If specified, import modal settings */
|
|
425
431
|
'im'?: {
|
|
426
432
|
/** Get search fields action */
|
|
@@ -430,6 +436,13 @@ export declare type AddCardIntegrationQuery = {
|
|
|
430
436
|
/** Import action */
|
|
431
437
|
'i': string;
|
|
432
438
|
};
|
|
439
|
+
/** If specified, add-card settings */
|
|
440
|
+
'ac'?: {
|
|
441
|
+
/** Get input fields action */
|
|
442
|
+
'gif': string;
|
|
443
|
+
/** Create card action */
|
|
444
|
+
'cc': string;
|
|
445
|
+
};
|
|
433
446
|
};
|
|
434
447
|
export declare type AddCardIntegrationResult = undefined;
|
|
435
448
|
export declare type AddLineTextAreaQuery = {
|
|
@@ -822,7 +835,8 @@ export declare type PatchDataItemsQuery = {
|
|
|
822
835
|
/** Primary keys of items to delete */
|
|
823
836
|
'd': string[];
|
|
824
837
|
};
|
|
825
|
-
|
|
838
|
+
/** Primary keys inserted, if any */
|
|
839
|
+
export declare type PatchDataItemsResult = string[];
|
|
826
840
|
export declare type RegisterPanelQuery = {
|
|
827
841
|
/** Name of the panel's action for receiving events; generated automatically by Panel base class */
|
|
828
842
|
'n': string;
|
|
@@ -1,36 +1,23 @@
|
|
|
1
1
|
import { CollectionDefinition } from '../../data/collectiondefinition';
|
|
2
2
|
import { CollectionProxy } from '../../data/collectionproxy';
|
|
3
|
+
import { FieldDefinition } from '../../data/schemadefinition';
|
|
3
4
|
import { isString } from '../checks';
|
|
4
|
-
import {
|
|
5
|
+
import { isSerializedFieldTypeDefinition } from '../data/fieldtypedefinition/fieldtypedefinition';
|
|
6
|
+
import { FieldConstraintType, SerializedFieldDefinition } from '../data/serializedfield/serializedfielddefinition';
|
|
5
7
|
import { isSerializedFieldType, SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
6
|
-
/**
|
|
7
|
-
* When this field is displayed on a card shape, how should it be displayed?
|
|
8
|
-
*/
|
|
9
|
-
export declare enum CardFieldDisplayType {
|
|
10
|
-
Text = 1,
|
|
11
|
-
TextBadge = 2,
|
|
12
|
-
ImageBadge = 3
|
|
13
|
-
}
|
|
14
8
|
/** For fields with Option or ApiOption type, the label and value for each available option */
|
|
15
9
|
export interface ExtensionCardFieldOption {
|
|
16
10
|
label: string;
|
|
17
11
|
value: SerializedFieldType;
|
|
18
12
|
}
|
|
19
|
-
export interface ExtensionCardFieldDefinition {
|
|
20
|
-
/**
|
|
21
|
-
fieldName: string;
|
|
22
|
-
/** The text to display on the menu item */
|
|
13
|
+
export interface ExtensionCardFieldDefinition extends FieldDefinition {
|
|
14
|
+
/** The label to display in the UI */
|
|
23
15
|
label: string;
|
|
24
|
-
/**
|
|
16
|
+
/** If defined, the default value for this field */
|
|
17
|
+
default?: SerializedFieldType;
|
|
18
|
+
/** Additional information we can provide to users, e.g. as a hover tooltip */
|
|
25
19
|
description?: string;
|
|
26
|
-
/**
|
|
27
|
-
displayType?: CardFieldDisplayType;
|
|
28
|
-
/**
|
|
29
|
-
* Override what kind of input to allow the user to edit the value.
|
|
30
|
-
* e.g. ScalarFieldTypeEnum.STRING for a text input
|
|
31
|
-
**/
|
|
32
|
-
inputType?: FieldTypeDefinition;
|
|
33
|
-
/** If dataType is Option, the list of options available to choose from */
|
|
20
|
+
/** If specified, the list of options available to choose from */
|
|
34
21
|
options?: ExtensionCardFieldOption[];
|
|
35
22
|
}
|
|
36
23
|
/** @ignore */
|
|
@@ -41,12 +28,10 @@ export declare type SerializedCardFieldOption = {
|
|
|
41
28
|
/** @ignore */
|
|
42
29
|
export declare function serializeCardFieldOption(option: ExtensionCardFieldOption): SerializedCardFieldOption;
|
|
43
30
|
/** @ignore */
|
|
44
|
-
export declare type SerializedExtensionCardFieldDefinition = {
|
|
45
|
-
'
|
|
46
|
-
'
|
|
31
|
+
export declare type SerializedExtensionCardFieldDefinition = SerializedFieldDefinition & {
|
|
32
|
+
'l': string;
|
|
33
|
+
'def'?: SerializedFieldType;
|
|
47
34
|
'd'?: string;
|
|
48
|
-
'diT'?: CardFieldDisplayType;
|
|
49
|
-
'daT'?: SerializedFieldTypeDefinition;
|
|
50
35
|
'op'?: SerializedCardFieldOption[];
|
|
51
36
|
};
|
|
52
37
|
/** @ignore */
|
|
@@ -63,6 +48,26 @@ export declare const isSerializedFieldOptions: (p1: unknown) => p1 is import("..
|
|
|
63
48
|
l: typeof isString;
|
|
64
49
|
v: typeof isSerializedFieldType;
|
|
65
50
|
}>[];
|
|
51
|
+
export declare const isSerializedFieldConstraint: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
|
|
52
|
+
Type: (x: unknown) => x is FieldConstraintType;
|
|
53
|
+
Details: (x: unknown) => x is number | undefined;
|
|
54
|
+
}>;
|
|
55
|
+
/** @ignore */
|
|
56
|
+
export declare const isSerializedExtensionCardFieldDefinition: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
|
|
57
|
+
Name: typeof isString;
|
|
58
|
+
Type: typeof isSerializedFieldTypeDefinition;
|
|
59
|
+
Constraints: (x: unknown) => x is import("../guards").DestructureGuardedTypeObj<{
|
|
60
|
+
Type: (x: unknown) => x is FieldConstraintType;
|
|
61
|
+
Details: (x: unknown) => x is number | undefined;
|
|
62
|
+
}>[] | undefined;
|
|
63
|
+
l: typeof isString;
|
|
64
|
+
d: (x: unknown) => x is string | undefined;
|
|
65
|
+
def: (x: unknown) => x is SerializedFieldType;
|
|
66
|
+
op: (x: unknown) => x is import("../guards").DestructureGuardedTypeObj<{
|
|
67
|
+
l: typeof isString;
|
|
68
|
+
v: typeof isSerializedFieldType;
|
|
69
|
+
}>[] | undefined;
|
|
70
|
+
}>;
|
|
66
71
|
/** @ignore */
|
|
67
72
|
export declare function deserializeCardFieldDefinition(field: SerializedExtensionCardFieldDefinition): ExtensionCardFieldDefinition;
|
|
68
73
|
/** @ignore */
|
|
@@ -92,6 +97,14 @@ export interface CardIntegration {
|
|
|
92
97
|
* Should be unique within any given extension.
|
|
93
98
|
*/
|
|
94
99
|
label: string;
|
|
100
|
+
/**
|
|
101
|
+
* Label used to identify one card worth of data, e.g. "Jira task"
|
|
102
|
+
*/
|
|
103
|
+
itemLabel: string;
|
|
104
|
+
/**
|
|
105
|
+
* Label used to identify multiple cards worth of data, e.g. "Jira tasks"
|
|
106
|
+
*/
|
|
107
|
+
itemsLabel: string;
|
|
95
108
|
/**
|
|
96
109
|
* URL for an icon to display in toolbars, etc. Should be at least 24x24.
|
|
97
110
|
*/
|
|
@@ -109,6 +122,10 @@ export interface CardIntegration {
|
|
|
109
122
|
* this should show the user an intro dialog or take some other action.
|
|
110
123
|
*/
|
|
111
124
|
showIntro?: () => void;
|
|
125
|
+
/**
|
|
126
|
+
* Provide the default configuration for a new import
|
|
127
|
+
*/
|
|
128
|
+
getDefaultConfig: (collection: CollectionProxy) => Promise<CardIntegrationConfig>;
|
|
112
129
|
/**
|
|
113
130
|
* If specified, allow the user to import cards using the standard card-import modal.
|
|
114
131
|
*/
|
|
@@ -133,10 +150,27 @@ export interface CardIntegration {
|
|
|
133
150
|
* The config provided here is only used on the first import from a given source; on subsequent imports,
|
|
134
151
|
* the existing config will remain unchanged to preserve any customizations by the user.
|
|
135
152
|
*/
|
|
136
|
-
import: (primaryKeys: string[]) => Promise<{
|
|
153
|
+
import: (primaryKeys: string[], searchFields: Map<string, SerializedFieldType>) => Promise<{
|
|
137
154
|
collection: CollectionProxy;
|
|
138
155
|
primaryKeys: string[];
|
|
139
|
-
|
|
156
|
+
}>;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* If specified, allow the user to create new cards and convert other shapes to cards
|
|
160
|
+
*/
|
|
161
|
+
addCard?: {
|
|
162
|
+
/**
|
|
163
|
+
* Given the values entered by the user so far into input fields, return the list of all input fields
|
|
164
|
+
* to display in the create-card form.
|
|
165
|
+
*/
|
|
166
|
+
getInputFields: (inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldDefinition[]>;
|
|
167
|
+
/**
|
|
168
|
+
* Given the values entered by the user into input fields, create a new data record to represent the
|
|
169
|
+
* created card, and return information about that record.
|
|
170
|
+
*/
|
|
171
|
+
createCardData: (input: Map<string, SerializedFieldType>) => Promise<{
|
|
172
|
+
collection: CollectionProxy;
|
|
173
|
+
primaryKey: string;
|
|
140
174
|
}>;
|
|
141
175
|
};
|
|
142
176
|
}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deserializeCardIntegrationConfig = exports.serializeCardIntegrationConfig = exports.deserializeCardFieldArrayDefinition = exports.deserializeCardFieldDefinition = exports.isSerializedFieldOptions = exports.isSerializedFieldOption = exports.deserializeFieldOption = exports.serializeCardFieldArrayDefinition = exports.serializeCardFieldDefinition = exports.serializeCardFieldOption =
|
|
3
|
+
exports.deserializeCardIntegrationConfig = exports.serializeCardIntegrationConfig = exports.deserializeCardFieldArrayDefinition = exports.deserializeCardFieldDefinition = exports.isSerializedExtensionCardFieldDefinition = exports.isSerializedFieldConstraint = exports.isSerializedFieldOptions = exports.isSerializedFieldOption = exports.deserializeFieldOption = exports.serializeCardFieldArrayDefinition = exports.serializeCardFieldDefinition = exports.serializeCardFieldOption = void 0;
|
|
4
|
+
const schemadefinition_1 = require("../../data/schemadefinition");
|
|
4
5
|
const checks_1 = require("../checks");
|
|
5
6
|
const fieldtypedefinition_1 = require("../data/fieldtypedefinition/fieldtypedefinition");
|
|
7
|
+
const serializedfielddefinition_1 = require("../data/serializedfield/serializedfielddefinition");
|
|
6
8
|
const serializedfields_1 = require("../data/serializedfield/serializedfields");
|
|
7
9
|
const validators_1 = require("../validators/validators");
|
|
8
|
-
/**
|
|
9
|
-
* When this field is displayed on a card shape, how should it be displayed?
|
|
10
|
-
*/
|
|
11
|
-
var CardFieldDisplayType;
|
|
12
|
-
(function (CardFieldDisplayType) {
|
|
13
|
-
CardFieldDisplayType[CardFieldDisplayType["Text"] = 1] = "Text";
|
|
14
|
-
CardFieldDisplayType[CardFieldDisplayType["TextBadge"] = 2] = "TextBadge";
|
|
15
|
-
CardFieldDisplayType[CardFieldDisplayType["ImageBadge"] = 3] = "ImageBadge";
|
|
16
|
-
})(CardFieldDisplayType = exports.CardFieldDisplayType || (exports.CardFieldDisplayType = {}));
|
|
17
10
|
/** @ignore */
|
|
18
11
|
function serializeCardFieldOption(option) {
|
|
19
12
|
return {
|
|
@@ -25,14 +18,7 @@ exports.serializeCardFieldOption = serializeCardFieldOption;
|
|
|
25
18
|
/** @ignore */
|
|
26
19
|
function serializeCardFieldDefinition(field) {
|
|
27
20
|
var _a;
|
|
28
|
-
return {
|
|
29
|
-
'n': field.fieldName,
|
|
30
|
-
't': field.label,
|
|
31
|
-
'd': field.description,
|
|
32
|
-
'diT': field.displayType,
|
|
33
|
-
'daT': field.inputType === undefined ? undefined : (0, fieldtypedefinition_1.serializeFieldTypeDefinition)(field.inputType),
|
|
34
|
-
'op': (_a = field.options) === null || _a === void 0 ? void 0 : _a.map(serializeCardFieldOption),
|
|
35
|
-
};
|
|
21
|
+
return Object.assign(Object.assign({}, (0, schemadefinition_1.serializeFieldDefinition)(field)), { 'l': field.label, 'def': field.default, 'd': field.description, 'op': (_a = field.options) === null || _a === void 0 ? void 0 : _a.map(serializeCardFieldOption) });
|
|
36
22
|
}
|
|
37
23
|
exports.serializeCardFieldDefinition = serializeCardFieldDefinition;
|
|
38
24
|
/** @ignore */
|
|
@@ -53,17 +39,24 @@ exports.isSerializedFieldOption = (0, validators_1.objectValidator)({
|
|
|
53
39
|
'v': serializedfields_1.isSerializedFieldType,
|
|
54
40
|
});
|
|
55
41
|
exports.isSerializedFieldOptions = (0, validators_1.arrayValidator)(exports.isSerializedFieldOption);
|
|
42
|
+
exports.isSerializedFieldConstraint = (0, validators_1.objectValidator)({
|
|
43
|
+
'Type': (0, validators_1.enumValidator)(serializedfielddefinition_1.FieldConstraintType),
|
|
44
|
+
'Details': (0, validators_1.option)(checks_1.isNumber),
|
|
45
|
+
});
|
|
46
|
+
/** @ignore */
|
|
47
|
+
exports.isSerializedExtensionCardFieldDefinition = (0, validators_1.objectValidator)({
|
|
48
|
+
'Name': checks_1.isString,
|
|
49
|
+
'Type': fieldtypedefinition_1.isSerializedFieldTypeDefinition,
|
|
50
|
+
'Constraints': (0, validators_1.option)((0, validators_1.arrayValidator)(exports.isSerializedFieldConstraint)),
|
|
51
|
+
'l': checks_1.isString,
|
|
52
|
+
'd': (0, validators_1.option)(checks_1.isString),
|
|
53
|
+
'def': (0, validators_1.option)(serializedfields_1.isSerializedFieldType),
|
|
54
|
+
'op': (0, validators_1.option)((0, validators_1.arrayValidator)(exports.isSerializedFieldOption)),
|
|
55
|
+
});
|
|
56
56
|
/** @ignore */
|
|
57
57
|
function deserializeCardFieldDefinition(field) {
|
|
58
58
|
var _a;
|
|
59
|
-
return {
|
|
60
|
-
fieldName: field['n'],
|
|
61
|
-
label: field['t'],
|
|
62
|
-
description: field['d'],
|
|
63
|
-
displayType: field['diT'],
|
|
64
|
-
inputType: field['daT'] === undefined ? undefined : (0, fieldtypedefinition_1.deserializeFieldTypeDefinition)(field['daT']),
|
|
65
|
-
options: (_a = field['op']) === null || _a === void 0 ? void 0 : _a.map(deserializeFieldOption),
|
|
66
|
-
};
|
|
59
|
+
return Object.assign(Object.assign({}, (0, schemadefinition_1.parseFieldDefinition)(field)), { label: field['l'], description: field['d'], default: field['def'], options: (_a = field['op']) === null || _a === void 0 ? void 0 : _a.map(deserializeFieldOption) });
|
|
67
60
|
}
|
|
68
61
|
exports.deserializeCardFieldDefinition = deserializeCardFieldDefinition;
|
|
69
62
|
/** @ignore */
|
package/sdk/core/checks.d.ts
CHANGED
|
@@ -99,3 +99,14 @@ export declare function isEmptyOrNullishObject(val: unknown): val is {};
|
|
|
99
99
|
export declare function isAny(val: unknown): val is any;
|
|
100
100
|
export declare function isUnknown(val: unknown): val is unknown;
|
|
101
101
|
export declare function isPromise(val: unknown): val is Promise<unknown>;
|
|
102
|
+
export declare function isLiteral<T extends string | number | symbol>(t: T): (x: unknown) => x is T;
|
|
103
|
+
declare type AbstractConstructor<T> = Function & {
|
|
104
|
+
prototype: T;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Since `instanceof` should generally be avoided, this function should generally be avoided as well.
|
|
108
|
+
*
|
|
109
|
+
* A valid use case is for native types, like Uint8Array.
|
|
110
|
+
*/
|
|
111
|
+
export declare function isInstanceOf<T>(klass: AbstractConstructor<T>): (x: unknown) => x is T;
|
|
112
|
+
export {};
|
package/sdk/core/checks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isPromise = exports.isUnknown = exports.isAny = exports.isEmptyOrNullishObject = exports.isTypedArray = exports.isArray = exports.isRecord = exports.isObject = exports.isFunction = exports.isInt = exports.isNumber = exports.isBoolean = exports.isString = exports.isNullish = exports.isDefAndNotNull = exports.isUndefined = exports.isNull = exports.isDef = void 0;
|
|
3
|
+
exports.isInstanceOf = exports.isLiteral = exports.isPromise = exports.isUnknown = exports.isAny = exports.isEmptyOrNullishObject = exports.isTypedArray = exports.isArray = exports.isRecord = exports.isObject = exports.isFunction = exports.isInt = exports.isNumber = exports.isBoolean = exports.isString = exports.isNullish = exports.isDefAndNotNull = exports.isUndefined = exports.isNull = exports.isDef = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Returns true if the specified value is not undefined.
|
|
6
6
|
*
|
|
@@ -163,3 +163,16 @@ function isPromise(val) {
|
|
|
163
163
|
return isObject(val) && isFunction(val['then']) && isFunction(val['catch']);
|
|
164
164
|
}
|
|
165
165
|
exports.isPromise = isPromise;
|
|
166
|
+
function isLiteral(t) {
|
|
167
|
+
return (x) => x === t;
|
|
168
|
+
}
|
|
169
|
+
exports.isLiteral = isLiteral;
|
|
170
|
+
/**
|
|
171
|
+
* Since `instanceof` should generally be avoided, this function should generally be avoided as well.
|
|
172
|
+
*
|
|
173
|
+
* A valid use case is for native types, like Uint8Array.
|
|
174
|
+
*/
|
|
175
|
+
function isInstanceOf(klass) {
|
|
176
|
+
return (x) => x instanceof klass;
|
|
177
|
+
}
|
|
178
|
+
exports.isInstanceOf = isInstanceOf;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { SendXHRResponseFormat } from '../commandtypes';
|
|
2
|
+
import { Validator } from './guards';
|
|
3
|
+
export interface XHRRequest {
|
|
4
|
+
/** URL to request */
|
|
5
|
+
url: string;
|
|
6
|
+
/** HTTP method, e.g. "POST". If omitted, GET is used */
|
|
7
|
+
method?: string;
|
|
8
|
+
/** The data to send as the body of the request */
|
|
9
|
+
data?: string;
|
|
10
|
+
/** Headers to send with the request. If specifying an array, multiple headers with the same name will be sent */
|
|
11
|
+
headers?: {
|
|
12
|
+
[key: string]: string | string[];
|
|
13
|
+
};
|
|
14
|
+
/** If specified, this request should time out after the given number of milliseconds */
|
|
15
|
+
timeoutMs?: number;
|
|
16
|
+
/**
|
|
17
|
+
* The desired format for the returned response body. Defaults to 'utf8'.
|
|
18
|
+
*
|
|
19
|
+
* - If 'utf8', the response body will be returned as a string.
|
|
20
|
+
* - If 'binary', the response body will be returned as a Uint8Array.
|
|
21
|
+
*/
|
|
22
|
+
responseFormat?: SendXHRResponseFormat;
|
|
23
|
+
}
|
|
24
|
+
export interface BaseXHRResponse {
|
|
25
|
+
/** URL of the final response, after any redirects */
|
|
26
|
+
url: string;
|
|
27
|
+
/** HTTP status, e.g. 200 or 404 */
|
|
28
|
+
status: number;
|
|
29
|
+
/** Headers sent by the server in the response */
|
|
30
|
+
headers: {
|
|
31
|
+
[key: string]: string;
|
|
32
|
+
};
|
|
33
|
+
/** True if this request failed due to a timeout */
|
|
34
|
+
timeout?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface TextXHRResponse extends BaseXHRResponse {
|
|
37
|
+
responseFormat: 'utf8';
|
|
38
|
+
/** Plain text of the response body */
|
|
39
|
+
responseText: string;
|
|
40
|
+
}
|
|
41
|
+
export interface BinaryXHRResponse extends BaseXHRResponse {
|
|
42
|
+
responseFormat: 'binary';
|
|
43
|
+
/** Contents of the response body */
|
|
44
|
+
responseData: Uint8Array;
|
|
45
|
+
}
|
|
46
|
+
export declare type XHRResponse = TextXHRResponse | BinaryXHRResponse;
|
|
47
|
+
export declare const isTextXHRResponse: Validator<TextXHRResponse>;
|
|
48
|
+
export declare const isBinaryXHRResponse: Validator<BinaryXHRResponse>;
|
|
49
|
+
export declare const isXHRResponse: Validator<XHRResponse>;
|
package/sdk/core/xhr.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isXHRResponse = exports.isBinaryXHRResponse = exports.isTextXHRResponse = void 0;
|
|
4
|
+
const checks_1 = require("./checks");
|
|
5
|
+
const validators_1 = require("./validators/validators");
|
|
6
|
+
const isBaseXHRResponse = (0, validators_1.objectValidator)({
|
|
7
|
+
url: checks_1.isString,
|
|
8
|
+
status: checks_1.isNumber,
|
|
9
|
+
headers: (0, validators_1.objectOfValidator)(checks_1.isString),
|
|
10
|
+
timeout: (0, validators_1.option)(checks_1.isBoolean),
|
|
11
|
+
});
|
|
12
|
+
exports.isTextXHRResponse = (0, validators_1.both)(isBaseXHRResponse, (0, validators_1.objectValidator)({
|
|
13
|
+
responseFormat: (0, checks_1.isLiteral)('utf8'),
|
|
14
|
+
responseText: checks_1.isString,
|
|
15
|
+
}));
|
|
16
|
+
exports.isBinaryXHRResponse = (0, validators_1.both)(isBaseXHRResponse, (0, validators_1.objectValidator)({
|
|
17
|
+
responseFormat: (0, checks_1.isLiteral)('binary'),
|
|
18
|
+
responseData: (0, checks_1.isInstanceOf)(Uint8Array),
|
|
19
|
+
}));
|
|
20
|
+
exports.isXHRResponse = (0, validators_1.either)(exports.isTextXHRResponse, exports.isBinaryXHRResponse);
|
|
@@ -3,6 +3,7 @@ import { MapProxy } from '../document/mapproxy';
|
|
|
3
3
|
import { PropertyStoreProxy } from '../document/propertystoreproxy';
|
|
4
4
|
import { EditorClient } from '../editorclient';
|
|
5
5
|
import { DataItemProxy } from './dataitemproxy';
|
|
6
|
+
import { SchemaDefinition } from './schemadefinition';
|
|
6
7
|
/**
|
|
7
8
|
* A collection is a set of data items, each with the same set of fields (though some data items may not have all
|
|
8
9
|
* fields defined).
|
|
@@ -38,9 +39,10 @@ export declare class CollectionProxy extends PropertyStoreProxy {
|
|
|
38
39
|
added?: Record<string, SerializedFieldType>[];
|
|
39
40
|
changed?: Map<string, Record<string, SerializedFieldType>>;
|
|
40
41
|
deleted?: string[];
|
|
41
|
-
}):
|
|
42
|
+
}): import("../commandtypes").PatchDataItemsResult;
|
|
42
43
|
/**
|
|
43
44
|
* @returns an array of field names that are accessible on the items in this collection
|
|
44
45
|
*/
|
|
45
46
|
getFields(): string[];
|
|
47
|
+
getSchema(): SchemaDefinition;
|
|
46
48
|
}
|
|
@@ -4,6 +4,7 @@ exports.CollectionProxy = void 0;
|
|
|
4
4
|
const mapproxy_1 = require("../document/mapproxy");
|
|
5
5
|
const propertystoreproxy_1 = require("../document/propertystoreproxy");
|
|
6
6
|
const dataitemproxy_1 = require("./dataitemproxy");
|
|
7
|
+
const schemadefinition_1 = require("./schemadefinition");
|
|
7
8
|
/**
|
|
8
9
|
* A collection is a set of data items, each with the same set of fields (though some data items may not have all
|
|
9
10
|
* fields defined).
|
|
@@ -50,7 +51,7 @@ class CollectionProxy extends propertystoreproxy_1.PropertyStoreProxy {
|
|
|
50
51
|
changed[primaryKey] = record;
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
|
-
this.client.sendCommand("pdi" /* PatchDataItems */, {
|
|
54
|
+
return this.client.sendCommand("pdi" /* PatchDataItems */, {
|
|
54
55
|
'id': this.id,
|
|
55
56
|
'a': (_a = patch.added) !== null && _a !== void 0 ? _a : [],
|
|
56
57
|
'c': changed,
|
|
@@ -63,5 +64,8 @@ class CollectionProxy extends propertystoreproxy_1.PropertyStoreProxy {
|
|
|
63
64
|
getFields() {
|
|
64
65
|
return this.client.sendCommand("lcf" /* ListCollectionFields */, { 'id': this.id });
|
|
65
66
|
}
|
|
67
|
+
getSchema() {
|
|
68
|
+
return (0, schemadefinition_1.parseSchemaDefinition)(this.properties.get('Schema'));
|
|
69
|
+
}
|
|
66
70
|
}
|
|
67
71
|
exports.CollectionProxy = CollectionProxy;
|
|
@@ -1,11 +1,38 @@
|
|
|
1
1
|
import { FieldTypeDefinition } from '../core/data/fieldtypedefinition/fieldtypedefinition';
|
|
2
|
+
import { FieldConstraintType, SerializedFieldConstraint, SerializedFieldDefinition } from '../core/data/serializedfield/serializedfielddefinition';
|
|
2
3
|
import { SerializedSchema } from '../core/data/serializedfield/serializedschema';
|
|
4
|
+
export interface RequiredFieldConstraintDefinition {
|
|
5
|
+
type: FieldConstraintType.REQUIRED;
|
|
6
|
+
value?: undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface LockedFieldConstraintDefinition {
|
|
9
|
+
type: FieldConstraintType.LOCKED;
|
|
10
|
+
value?: undefined;
|
|
11
|
+
}
|
|
12
|
+
export interface MinValueFieldConstraintDefinition {
|
|
13
|
+
type: FieldConstraintType.MIN_VALUE;
|
|
14
|
+
value: number;
|
|
15
|
+
}
|
|
16
|
+
export interface MaxValueFieldConstraintDefinition {
|
|
17
|
+
type: FieldConstraintType.MAX_VALUE;
|
|
18
|
+
value: number;
|
|
19
|
+
}
|
|
20
|
+
export interface SingleLineFieldConstraintDefinition {
|
|
21
|
+
type: FieldConstraintType.SINGLE_LINE_ONLY;
|
|
22
|
+
value?: undefined;
|
|
23
|
+
}
|
|
24
|
+
export interface NoWhitespaceFieldConstraintDefinition {
|
|
25
|
+
type: FieldConstraintType.NO_WHITESPACE;
|
|
26
|
+
value?: undefined;
|
|
27
|
+
}
|
|
28
|
+
export declare type FieldConstraintDefinition = RequiredFieldConstraintDefinition | LockedFieldConstraintDefinition | MinValueFieldConstraintDefinition | MaxValueFieldConstraintDefinition | SingleLineFieldConstraintDefinition | NoWhitespaceFieldConstraintDefinition;
|
|
3
29
|
/**
|
|
4
30
|
* The definition for a field to be included in a [SchemaDefinition](#interfaces_data_schemadefinition-SchemaDefinition)
|
|
5
31
|
*/
|
|
6
32
|
export interface FieldDefinition {
|
|
7
33
|
name: string;
|
|
8
34
|
type: FieldTypeDefinition;
|
|
35
|
+
constraints?: FieldConstraintDefinition[];
|
|
9
36
|
}
|
|
10
37
|
/**
|
|
11
38
|
* Definition of a schema for creating a [Collection](#classes_data_collectionproxy-CollectionProxy)
|
|
@@ -24,6 +51,12 @@ export interface SchemaDefinition {
|
|
|
24
51
|
fieldLabels?: Record<string, string>;
|
|
25
52
|
}
|
|
26
53
|
/** @ignore */
|
|
54
|
+
export declare function serializeFieldConstraintDefinition(constraint: FieldConstraintDefinition): SerializedFieldConstraint;
|
|
55
|
+
/** @ignore */
|
|
56
|
+
export declare function serializeFieldDefinition(field: FieldDefinition): SerializedFieldDefinition;
|
|
57
|
+
/** @ignore */
|
|
27
58
|
export declare function serializeSchemaDefinition(def: SchemaDefinition): SerializedSchema;
|
|
28
59
|
/** @ignore */
|
|
60
|
+
export declare function parseFieldDefinition(field: SerializedFieldDefinition): FieldDefinition;
|
|
61
|
+
/** @ignore */
|
|
29
62
|
export declare function parseSchemaDefinition(def: SerializedSchema): SchemaDefinition;
|
|
@@ -1,30 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseSchemaDefinition = exports.serializeSchemaDefinition = void 0;
|
|
3
|
+
exports.parseSchemaDefinition = exports.parseFieldDefinition = exports.serializeSchemaDefinition = exports.serializeFieldDefinition = exports.serializeFieldConstraintDefinition = void 0;
|
|
4
|
+
const checks_1 = require("../core/checks");
|
|
4
5
|
const fieldtypedefinition_1 = require("../core/data/fieldtypedefinition/fieldtypedefinition");
|
|
6
|
+
const serializedfielddefinition_1 = require("../core/data/serializedfield/serializedfielddefinition");
|
|
7
|
+
/** @ignore */
|
|
8
|
+
function serializeFieldConstraintDefinition(constraint) {
|
|
9
|
+
return {
|
|
10
|
+
'Type': constraint.type,
|
|
11
|
+
'Details': constraint.value,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.serializeFieldConstraintDefinition = serializeFieldConstraintDefinition;
|
|
15
|
+
/** @ignore */
|
|
16
|
+
function serializeFieldDefinition(field) {
|
|
17
|
+
const serialized = {
|
|
18
|
+
'Name': field.name,
|
|
19
|
+
'Type': (0, fieldtypedefinition_1.serializeFieldTypeDefinition)(field.type),
|
|
20
|
+
};
|
|
21
|
+
if (field.constraints) {
|
|
22
|
+
serialized['Constraints'] = field.constraints.map(serializeFieldConstraintDefinition);
|
|
23
|
+
}
|
|
24
|
+
return serialized;
|
|
25
|
+
}
|
|
26
|
+
exports.serializeFieldDefinition = serializeFieldDefinition;
|
|
5
27
|
/** @ignore */
|
|
6
28
|
function serializeSchemaDefinition(def) {
|
|
7
29
|
return {
|
|
8
|
-
'Fields': def.fields.map(
|
|
9
|
-
return {
|
|
10
|
-
'Name': field.name,
|
|
11
|
-
'Type': (0, fieldtypedefinition_1.serializeFieldTypeDefinition)(field.type),
|
|
12
|
-
};
|
|
13
|
-
}),
|
|
30
|
+
'Fields': def.fields.map(serializeFieldDefinition),
|
|
14
31
|
'PrimaryKey': def.primaryKey,
|
|
15
32
|
'FieldLabelOverrides': def.fieldLabels,
|
|
16
33
|
};
|
|
17
34
|
}
|
|
18
35
|
exports.serializeSchemaDefinition = serializeSchemaDefinition;
|
|
19
36
|
/** @ignore */
|
|
20
|
-
function
|
|
37
|
+
function parseFieldDefinition(field) {
|
|
38
|
+
var _a;
|
|
21
39
|
return {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
40
|
+
name: field['Name'],
|
|
41
|
+
type: (0, fieldtypedefinition_1.deserializeFieldTypeDefinition)(field['Type']),
|
|
42
|
+
constraints: (_a = field['Constraints']) === null || _a === void 0 ? void 0 : _a.map((constraint) => {
|
|
43
|
+
switch (constraint['Type']) {
|
|
44
|
+
case serializedfielddefinition_1.FieldConstraintType.MIN_VALUE:
|
|
45
|
+
case serializedfielddefinition_1.FieldConstraintType.MAX_VALUE:
|
|
46
|
+
if (!(0, checks_1.isNumber)(constraint['Details'])) {
|
|
47
|
+
throw new Error('Invalid constraint format');
|
|
48
|
+
}
|
|
49
|
+
return { type: constraint['Type'], value: constraint['Details'] };
|
|
50
|
+
case serializedfielddefinition_1.FieldConstraintType.REQUIRED:
|
|
51
|
+
case serializedfielddefinition_1.FieldConstraintType.LOCKED:
|
|
52
|
+
case serializedfielddefinition_1.FieldConstraintType.SINGLE_LINE_ONLY:
|
|
53
|
+
case serializedfielddefinition_1.FieldConstraintType.NO_WHITESPACE:
|
|
54
|
+
return { type: constraint['Type'] };
|
|
55
|
+
default:
|
|
56
|
+
throw new Error('Invalid constraint format');
|
|
57
|
+
}
|
|
27
58
|
}),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
exports.parseFieldDefinition = parseFieldDefinition;
|
|
62
|
+
/** @ignore */
|
|
63
|
+
function parseSchemaDefinition(def) {
|
|
64
|
+
return {
|
|
65
|
+
fields: def['Fields'].map(parseFieldDefinition),
|
|
28
66
|
primaryKey: def['PrimaryKey'],
|
|
29
67
|
fieldLabels: def['FieldLabelOverrides'],
|
|
30
68
|
};
|
|
@@ -23,6 +23,11 @@ class TaskManagementCardIntegration {
|
|
|
23
23
|
const serializedFields = (0, cardintegration_1.serializeCardFieldArrayDefinition)(fields);
|
|
24
24
|
return serializedFields;
|
|
25
25
|
});
|
|
26
|
+
const getDefaultConfigActionName = TaskManagementCardIntegration.nextHookName();
|
|
27
|
+
this.client.registerAction(getDefaultConfigActionName, async (param) => {
|
|
28
|
+
const collection = new collectionproxy_1.CollectionProxy(param['c'], this.client);
|
|
29
|
+
return (0, cardintegration_1.serializeCardIntegrationConfig)(await card.getDefaultConfig(collection));
|
|
30
|
+
});
|
|
26
31
|
let showIntroActionName = undefined;
|
|
27
32
|
if (card.showIntro) {
|
|
28
33
|
showIntroActionName = TaskManagementCardIntegration.nextHookName();
|
|
@@ -30,8 +35,11 @@ class TaskManagementCardIntegration {
|
|
|
30
35
|
}
|
|
31
36
|
const serialized = {
|
|
32
37
|
'n': card.label,
|
|
38
|
+
'il': card.itemLabel,
|
|
39
|
+
'isl': card.itemsLabel,
|
|
33
40
|
'u': card.iconUrl,
|
|
34
41
|
'gf': getFieldsActionName,
|
|
42
|
+
'gdc': getDefaultConfigActionName,
|
|
35
43
|
'i': showIntroActionName,
|
|
36
44
|
};
|
|
37
45
|
if (card.importModal) {
|
|
@@ -52,12 +60,29 @@ class TaskManagementCardIntegration {
|
|
|
52
60
|
'f': (0, cardintegration_1.serializeCardFieldArrayDefinition)(result.fields),
|
|
53
61
|
};
|
|
54
62
|
});
|
|
55
|
-
this.client.registerAction(serialized['im']['i'], async ({ 'pks': primaryKeys }) => {
|
|
56
|
-
const result = await importModal.import(primaryKeys);
|
|
63
|
+
this.client.registerAction(serialized['im']['i'], async ({ 'pks': primaryKeys, 's': searchFields }) => {
|
|
64
|
+
const result = await importModal.import(primaryKeys, new Map(searchFields));
|
|
57
65
|
return {
|
|
58
66
|
'c': result.collection.id,
|
|
59
67
|
'pks': result.primaryKeys,
|
|
60
|
-
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (card.addCard) {
|
|
72
|
+
const addCard = card.addCard;
|
|
73
|
+
serialized['ac'] = {
|
|
74
|
+
'gif': TaskManagementCardIntegration.nextHookName(),
|
|
75
|
+
'cc': TaskManagementCardIntegration.nextHookName(),
|
|
76
|
+
};
|
|
77
|
+
this.client.registerAction(serialized['ac']['gif'], async ({ 'i': inputSoFar }) => {
|
|
78
|
+
const result = await addCard.getInputFields(new Map(inputSoFar));
|
|
79
|
+
return (0, cardintegration_1.serializeCardFieldArrayDefinition)(result);
|
|
80
|
+
});
|
|
81
|
+
this.client.registerAction(serialized['ac']['cc'], async ({ 'i': input }) => {
|
|
82
|
+
const result = await addCard.createCardData(new Map(input));
|
|
83
|
+
return {
|
|
84
|
+
'c': result.collection.id,
|
|
85
|
+
'pk': result.primaryKey,
|
|
61
86
|
};
|
|
62
87
|
});
|
|
63
88
|
}
|
package/sdk/editorclient.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { CommandArgs, CommandName,
|
|
1
|
+
import { CommandArgs, CommandName, UnionToIntersection } from './commandtypes';
|
|
2
2
|
import { JsonSerializable } from './core/jsonserializable';
|
|
3
3
|
import { UnfurlCallbacks } from './core/unfurl/unfurlcallbacks';
|
|
4
|
+
import { BinaryXHRResponse, TextXHRResponse, XHRRequest, XHRResponse } from './core/xhr';
|
|
4
5
|
import { CollectionProxy } from './data/collectionproxy';
|
|
5
6
|
import { BlockDefinition } from './document/blockdefinition';
|
|
6
7
|
import { BlockProxy } from './document/blockproxy';
|
|
@@ -9,50 +10,6 @@ import { GroupProxy } from './document/groupproxy';
|
|
|
9
10
|
import { LineProxy } from './document/lineproxy';
|
|
10
11
|
import { PageProxy } from './document/pageproxy';
|
|
11
12
|
import { FileUploadData } from './ui/menu';
|
|
12
|
-
export interface XHRRequest {
|
|
13
|
-
/** URL to request */
|
|
14
|
-
url: string;
|
|
15
|
-
/** HTTP method, e.g. "POST". If omitted, GET is used */
|
|
16
|
-
method?: string;
|
|
17
|
-
/** The data to send as the body of the request */
|
|
18
|
-
data?: string;
|
|
19
|
-
/** Headers to send with the request. If specifying an array, multiple headers with the same name will be sent */
|
|
20
|
-
headers?: {
|
|
21
|
-
[key: string]: string | string[];
|
|
22
|
-
};
|
|
23
|
-
/** If specified, this request should time out after the given number of milliseconds */
|
|
24
|
-
timeoutMs?: number;
|
|
25
|
-
/**
|
|
26
|
-
* The desired format for the returned response body. Defaults to 'utf8'.
|
|
27
|
-
*
|
|
28
|
-
* - If 'utf8', the response body will be returned as a string.
|
|
29
|
-
* - If 'binary', the response body will be returned as a Uint8Array.
|
|
30
|
-
*/
|
|
31
|
-
responseFormat?: SendXHRResponseFormat;
|
|
32
|
-
}
|
|
33
|
-
export interface BaseXHRResponse {
|
|
34
|
-
/** URL of the final response, after any redirects */
|
|
35
|
-
url: string;
|
|
36
|
-
/** HTTP status, e.g. 200 or 404 */
|
|
37
|
-
status: number;
|
|
38
|
-
/** Headers sent by the server in the response */
|
|
39
|
-
headers: {
|
|
40
|
-
[key: string]: string;
|
|
41
|
-
};
|
|
42
|
-
/** True if this request failed due to a timeout */
|
|
43
|
-
timeout?: boolean;
|
|
44
|
-
}
|
|
45
|
-
export interface TextXHRResponse extends BaseXHRResponse {
|
|
46
|
-
responseFormat: 'utf8';
|
|
47
|
-
/** Plain text of the response body */
|
|
48
|
-
responseText: string;
|
|
49
|
-
}
|
|
50
|
-
export interface BinaryXHRResponse extends BaseXHRResponse {
|
|
51
|
-
responseFormat: 'binary';
|
|
52
|
-
/** Contents of the response body */
|
|
53
|
-
responseData: Uint8Array;
|
|
54
|
-
}
|
|
55
|
-
export declare type XHRResponse = TextXHRResponse | BinaryXHRResponse;
|
|
56
13
|
export declare type DataActionResult = {
|
|
57
14
|
/** The HTTP Status Code from the Extension Data Sync endpoint */
|
|
58
15
|
'status': number;
|
package/sdk/editorclient.js
CHANGED
|
@@ -16,7 +16,7 @@ const elementproxy_1 = require("./document/elementproxy");
|
|
|
16
16
|
const groupproxy_1 = require("./document/groupproxy");
|
|
17
17
|
const lineproxy_1 = require("./document/lineproxy");
|
|
18
18
|
const pageproxy_1 = require("./document/pageproxy");
|
|
19
|
-
const
|
|
19
|
+
const unfurleventmessage_1 = require("./message/unfurleventmessage");
|
|
20
20
|
function parseRawXHRResponse(responseFormat, raw) {
|
|
21
21
|
var _a, _b, _c, _d;
|
|
22
22
|
return Object.assign({ url: (_a = raw === null || raw === void 0 ? void 0 : raw['url']) !== null && _a !== void 0 ? _a : '', status: (_b = raw === null || raw === void 0 ? void 0 : raw['s']) !== null && _b !== void 0 ? _b : 0, headers: (_c = raw === null || raw === void 0 ? void 0 : raw['h']) !== null && _c !== void 0 ? _c : {}, timeout: raw === null || raw === void 0 ? void 0 : raw['to'] }, (responseFormat === 'utf8'
|
|
@@ -207,12 +207,17 @@ class EditorClient {
|
|
|
207
207
|
const action = this.getUniqueActionName();
|
|
208
208
|
this.registerAction(action, async (rawMsg) => {
|
|
209
209
|
var _a;
|
|
210
|
-
const msg = (0,
|
|
210
|
+
const msg = (0, unfurleventmessage_1.deserializeUnfurlEventMessage)(rawMsg);
|
|
211
211
|
switch (msg.unfurlCallbackType) {
|
|
212
212
|
case unfurlcallbacks_1.UnfurlCallbackType.Unfurl: {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
try {
|
|
214
|
+
const result = await callbacks.unfurlCallback(msg.url);
|
|
215
|
+
if (result && !(0, unfurlrefresherrortype_1.unfurlRefreshErrorTypeValidator)(result)) {
|
|
216
|
+
return (0, unfurldetails_1.serializeUnfurlDetails)(result);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
catch (err) {
|
|
220
|
+
return unfurlrefresherrortype_1.UnfurlRefreshErrorType.GenericFailure;
|
|
216
221
|
}
|
|
217
222
|
break;
|
|
218
223
|
}
|
package/sdk/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './core/offsettype';
|
|
|
5
5
|
export * from './core/serializeddataerror';
|
|
6
6
|
export * from './core/shapedatainheritance';
|
|
7
7
|
export * from './core/unfurl/unfurldetails';
|
|
8
|
+
export * from './core/xhr';
|
|
8
9
|
export * from './data/collectionproxy';
|
|
9
10
|
export * from './data/dataerror';
|
|
10
11
|
export * from './data/dataitemproxy';
|
package/sdk/index.js
CHANGED
|
@@ -17,6 +17,7 @@ __exportStar(require("./core/offsettype"), exports);
|
|
|
17
17
|
__exportStar(require("./core/serializeddataerror"), exports);
|
|
18
18
|
__exportStar(require("./core/shapedatainheritance"), exports);
|
|
19
19
|
__exportStar(require("./core/unfurl/unfurldetails"), exports);
|
|
20
|
+
__exportStar(require("./core/xhr"), exports);
|
|
20
21
|
__exportStar(require("./data/collectionproxy"), exports);
|
|
21
22
|
__exportStar(require("./data/dataerror"), exports);
|
|
22
23
|
__exportStar(require("./data/dataitemproxy"), exports);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { JsonObject } from '../core/jsonserializable';
|
|
2
|
+
import { UnfurlCallbackType } from '../core/unfurl/unfurlcallbacks';
|
|
3
|
+
/** @ignore */
|
|
4
|
+
export interface UnfurlEventMessage {
|
|
5
|
+
/** @ignore */
|
|
6
|
+
id: string;
|
|
7
|
+
/** @ignore */
|
|
8
|
+
url: string;
|
|
9
|
+
/** @ignore */
|
|
10
|
+
unfurlCallbackType: UnfurlCallbackType;
|
|
11
|
+
/** @ignore */
|
|
12
|
+
blockId?: string;
|
|
13
|
+
}
|
|
14
|
+
/** @ignore */
|
|
15
|
+
export interface SerializedUnfurlEventMessage extends JsonObject {
|
|
16
|
+
'id': string;
|
|
17
|
+
'u': string;
|
|
18
|
+
't': UnfurlCallbackType;
|
|
19
|
+
'b'?: string;
|
|
20
|
+
}
|
|
21
|
+
/** @ignore */
|
|
22
|
+
export declare function deserializeUnfurlEventMessage(raw: SerializedUnfurlEventMessage): UnfurlEventMessage;
|
|
23
|
+
/** @ignore */
|
|
24
|
+
export declare function serializeUnfurlEventMessage(concrete: UnfurlEventMessage): SerializedUnfurlEventMessage;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeUnfurlEventMessage = exports.deserializeUnfurlEventMessage = void 0;
|
|
4
|
+
/** @ignore */
|
|
5
|
+
function deserializeUnfurlEventMessage(raw) {
|
|
6
|
+
return {
|
|
7
|
+
id: raw['id'],
|
|
8
|
+
url: raw['u'],
|
|
9
|
+
unfurlCallbackType: raw['t'],
|
|
10
|
+
blockId: raw['b'],
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
exports.deserializeUnfurlEventMessage = deserializeUnfurlEventMessage;
|
|
14
|
+
/** @ignore */
|
|
15
|
+
function serializeUnfurlEventMessage(concrete) {
|
|
16
|
+
return {
|
|
17
|
+
'id': concrete.id,
|
|
18
|
+
'u': concrete.url,
|
|
19
|
+
't': concrete.unfurlCallbackType,
|
|
20
|
+
'b': concrete.blockId,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.serializeUnfurlEventMessage = serializeUnfurlEventMessage;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { JsonObject } from '../../lucid-extension-sdk';
|
|
2
|
-
import { isString } from '../core/checks';
|
|
3
|
-
import { UnfurlCallbackType } from '../core/unfurl/unfurlcallbacks';
|
|
4
|
-
/** @ignore */
|
|
5
|
-
export interface RegisterUnfurlMessage {
|
|
6
|
-
/** @ignore */
|
|
7
|
-
id: string;
|
|
8
|
-
/** @ignore */
|
|
9
|
-
url: string;
|
|
10
|
-
/** @ignore */
|
|
11
|
-
unfurlCallbackType: UnfurlCallbackType;
|
|
12
|
-
/** @ignore */
|
|
13
|
-
blockId?: string;
|
|
14
|
-
}
|
|
15
|
-
/** @ignore */
|
|
16
|
-
export interface SerializedRegisterUnfurlMessage extends JsonObject {
|
|
17
|
-
'id': string;
|
|
18
|
-
'u': string;
|
|
19
|
-
't': UnfurlCallbackType;
|
|
20
|
-
'b'?: string;
|
|
21
|
-
}
|
|
22
|
-
/** @ignore */
|
|
23
|
-
export declare const isValidRegisterUnfurlMessage: (subject: unknown) => subject is import("../core/guards").DestructureGuardedTypeObj<{
|
|
24
|
-
id: typeof isString;
|
|
25
|
-
u: typeof isString;
|
|
26
|
-
t: (x: unknown) => x is UnfurlCallbackType;
|
|
27
|
-
b: (x: unknown) => x is string | undefined;
|
|
28
|
-
}>;
|
|
29
|
-
/** @ignore */
|
|
30
|
-
export declare function deserializeRegisterUnfurlMessage(raw: SerializedRegisterUnfurlMessage): RegisterUnfurlMessage;
|
|
31
|
-
/** @ignore */
|
|
32
|
-
export declare function serializeRegisterUnfurlMessage(concrete: RegisterUnfurlMessage): SerializedRegisterUnfurlMessage;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.serializeRegisterUnfurlMessage = exports.deserializeRegisterUnfurlMessage = exports.isValidRegisterUnfurlMessage = void 0;
|
|
4
|
-
const checks_1 = require("../core/checks");
|
|
5
|
-
const unfurlcallbacks_1 = require("../core/unfurl/unfurlcallbacks");
|
|
6
|
-
const validators_1 = require("../core/validators/validators");
|
|
7
|
-
/** @ignore */
|
|
8
|
-
exports.isValidRegisterUnfurlMessage = (0, validators_1.objectValidator)({
|
|
9
|
-
'id': checks_1.isString,
|
|
10
|
-
'u': checks_1.isString,
|
|
11
|
-
't': (0, validators_1.stringEnumValidator)(unfurlcallbacks_1.UnfurlCallbackType),
|
|
12
|
-
'b': (0, validators_1.option)(checks_1.isString),
|
|
13
|
-
});
|
|
14
|
-
/** @ignore */
|
|
15
|
-
function deserializeRegisterUnfurlMessage(raw) {
|
|
16
|
-
return {
|
|
17
|
-
id: raw['id'],
|
|
18
|
-
url: raw['u'],
|
|
19
|
-
unfurlCallbackType: raw['t'],
|
|
20
|
-
blockId: raw['b'],
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
exports.deserializeRegisterUnfurlMessage = deserializeRegisterUnfurlMessage;
|
|
24
|
-
/** @ignore */
|
|
25
|
-
function serializeRegisterUnfurlMessage(concrete) {
|
|
26
|
-
return {
|
|
27
|
-
'id': concrete.id,
|
|
28
|
-
'u': concrete.url,
|
|
29
|
-
't': concrete.unfurlCallbackType,
|
|
30
|
-
'b': concrete.blockId,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
exports.serializeRegisterUnfurlMessage = serializeRegisterUnfurlMessage;
|