lucid-extension-sdk 0.0.45 → 0.0.49
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/core/cardintegration/cardfielddisplaysettings.d.ts +88 -0
- package/sdk/core/cardintegration/cardfielddisplaysettings.js +66 -0
- package/sdk/core/cardintegration/cardintegration.d.ts +1 -19
- package/sdk/core/cardintegration/cardintegration.js +1 -17
- package/sdk/core/cardintegration/cardintegrationconfig.d.ts +25 -0
- package/sdk/core/cardintegration/cardintegrationconfig.js +29 -0
- package/sdk/core/checks.d.ts +11 -0
- package/sdk/core/checks.js +14 -1
- package/sdk/core/data/fieldtypedefinition/basefieldtypedefinition.d.ts +1 -2
- package/sdk/core/data/fieldtypedefinition/basefieldtypedefinition.js +3 -6
- package/sdk/core/data/fieldtypedefinition/collectionenumfieldtype.d.ts +2 -1
- package/sdk/core/data/fieldtypedefinition/fieldtypearray.d.ts +10 -6
- package/sdk/core/data/fieldtypedefinition/fieldtypearray.js +10 -11
- package/sdk/core/data/fieldtypedefinition/fieldtypedefinition.d.ts +2 -7
- package/sdk/core/data/fieldtypedefinition/fieldtypedefinition.js +3 -81
- package/sdk/core/xhr.d.ts +49 -0
- package/sdk/core/xhr.js +20 -0
- package/sdk/document/taskmanagementcardintegration.js +2 -1
- 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
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { HorizontalBadgePos, VerticalBadgePos } from '../properties/datagraphic/badgeposition';
|
|
2
|
+
/**
|
|
3
|
+
* When configuring a field on a LucidCardBlock to be displayed as a data graphic, one of these values specifies
|
|
4
|
+
* the function to convert the field value to the data graphic settings. The definition of these functions is in
|
|
5
|
+
* LucidCardsLibrary.registerStencilDisplayTypes.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum FieldDisplayType {
|
|
8
|
+
/**
|
|
9
|
+
* Text badge with the full text of the field.
|
|
10
|
+
* Black text on a light gray background in the upper-right of the card.
|
|
11
|
+
*/
|
|
12
|
+
BasicTextBadge = "BasicTextBadge",
|
|
13
|
+
/**
|
|
14
|
+
* Given a name (usually of a user), puts a text badge with their initials (first letter of each name)
|
|
15
|
+
* at the bottom-left of the card, black text on a light gray background.
|
|
16
|
+
*/
|
|
17
|
+
InitializedString = "InitializedString",
|
|
18
|
+
/**
|
|
19
|
+
* Given a number, display the number in the bottom-left of the card. If the number is higher than 999,
|
|
20
|
+
* display 999.
|
|
21
|
+
*/
|
|
22
|
+
StandardEstimation = "StandardEstimation"
|
|
23
|
+
}
|
|
24
|
+
export declare const isFieldDisplayType: (x: unknown) => x is FieldDisplayType;
|
|
25
|
+
/**
|
|
26
|
+
* When configuring a field on a LucidCardBlock to be displayed as a data graphic, this click handler value
|
|
27
|
+
* specifies what to do when the user clicks on the data graphic produced.
|
|
28
|
+
*/
|
|
29
|
+
export declare enum OnClickHandlerKeys {
|
|
30
|
+
/**
|
|
31
|
+
* Display the UI panel to edit fields on the data associated with the card
|
|
32
|
+
*/
|
|
33
|
+
BasicEditPanel = "BasicEditPanel"
|
|
34
|
+
}
|
|
35
|
+
export declare const isOnClickHandlerKey: (x: unknown) => x is OnClickHandlerKeys.BasicEditPanel;
|
|
36
|
+
export interface StencilConfig {
|
|
37
|
+
/**
|
|
38
|
+
* How should we generate the stencil/data graphic from the specified field value?
|
|
39
|
+
* These are registered in LucidCardsLibrary.registerStencilDisplayTypes.
|
|
40
|
+
*/
|
|
41
|
+
displayType: FieldDisplayType;
|
|
42
|
+
/**
|
|
43
|
+
* For displayType values that support it, you may provide an override for the
|
|
44
|
+
* background color for this data. If this is not provided, the background color
|
|
45
|
+
* will default to the background color of the card itself, darkened 5%.
|
|
46
|
+
*
|
|
47
|
+
* This may be provided as a literal color hex, e.g. "#00ff00ff" or as a formula
|
|
48
|
+
* by starting the string with "=", e.g. "=darken("#ffffff", 0.5)"
|
|
49
|
+
*/
|
|
50
|
+
backgroundColor?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Each display type has its default location on the card. You can override those
|
|
53
|
+
* default locations by setting these values.
|
|
54
|
+
*/
|
|
55
|
+
horizontalPosition?: HorizontalBadgePos;
|
|
56
|
+
/**
|
|
57
|
+
* Each display type has its default location on the card. You can override those
|
|
58
|
+
* default locations by setting these values.
|
|
59
|
+
*/
|
|
60
|
+
verticalPosition?: VerticalBadgePos;
|
|
61
|
+
/**
|
|
62
|
+
* If specified, what behavior should happen when the user clicks on the data graphic
|
|
63
|
+
* generated via the above displayType?
|
|
64
|
+
*/
|
|
65
|
+
onClickHandlerKey?: OnClickHandlerKeys;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Configuration settings for how to display a particular field on the card itself.
|
|
69
|
+
* Currently only used for adding custom data graphics with stencils.
|
|
70
|
+
*/
|
|
71
|
+
export interface LucidCardFieldDisplaySettings {
|
|
72
|
+
stencilConfig?: StencilConfig;
|
|
73
|
+
}
|
|
74
|
+
/** @ignore */
|
|
75
|
+
export declare type SerializedLucidCardFieldDisplaySettings = {
|
|
76
|
+
'StencilConfig'?: {
|
|
77
|
+
/** Since renamed to displayType, but we can't change the serialized name */
|
|
78
|
+
'getterKey': FieldDisplayType;
|
|
79
|
+
'bg'?: string;
|
|
80
|
+
'h'?: HorizontalBadgePos;
|
|
81
|
+
'v'?: VerticalBadgePos;
|
|
82
|
+
'onClickHandlerKey'?: OnClickHandlerKeys;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
/** @ignore */
|
|
86
|
+
export declare function serializeLucidCardFieldDisplaySettings(settings: LucidCardFieldDisplaySettings): SerializedLucidCardFieldDisplaySettings;
|
|
87
|
+
/** @ignore */
|
|
88
|
+
export declare function deserializeLucidCardFieldDisplaySettings(settings: SerializedLucidCardFieldDisplaySettings): LucidCardFieldDisplaySettings;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeLucidCardFieldDisplaySettings = exports.serializeLucidCardFieldDisplaySettings = exports.isOnClickHandlerKey = exports.OnClickHandlerKeys = exports.isFieldDisplayType = exports.FieldDisplayType = void 0;
|
|
4
|
+
const validators_1 = require("../validators/validators");
|
|
5
|
+
/**
|
|
6
|
+
* When configuring a field on a LucidCardBlock to be displayed as a data graphic, one of these values specifies
|
|
7
|
+
* the function to convert the field value to the data graphic settings. The definition of these functions is in
|
|
8
|
+
* LucidCardsLibrary.registerStencilDisplayTypes.
|
|
9
|
+
*/
|
|
10
|
+
var FieldDisplayType;
|
|
11
|
+
(function (FieldDisplayType) {
|
|
12
|
+
/**
|
|
13
|
+
* Text badge with the full text of the field.
|
|
14
|
+
* Black text on a light gray background in the upper-right of the card.
|
|
15
|
+
*/
|
|
16
|
+
FieldDisplayType["BasicTextBadge"] = "BasicTextBadge";
|
|
17
|
+
/**
|
|
18
|
+
* Given a name (usually of a user), puts a text badge with their initials (first letter of each name)
|
|
19
|
+
* at the bottom-left of the card, black text on a light gray background.
|
|
20
|
+
*/
|
|
21
|
+
FieldDisplayType["InitializedString"] = "InitializedString";
|
|
22
|
+
/**
|
|
23
|
+
* Given a number, display the number in the bottom-left of the card. If the number is higher than 999,
|
|
24
|
+
* display 999.
|
|
25
|
+
*/
|
|
26
|
+
FieldDisplayType["StandardEstimation"] = "StandardEstimation";
|
|
27
|
+
})(FieldDisplayType = exports.FieldDisplayType || (exports.FieldDisplayType = {}));
|
|
28
|
+
exports.isFieldDisplayType = (0, validators_1.enumValidator)(FieldDisplayType);
|
|
29
|
+
/**
|
|
30
|
+
* When configuring a field on a LucidCardBlock to be displayed as a data graphic, this click handler value
|
|
31
|
+
* specifies what to do when the user clicks on the data graphic produced.
|
|
32
|
+
*/
|
|
33
|
+
var OnClickHandlerKeys;
|
|
34
|
+
(function (OnClickHandlerKeys) {
|
|
35
|
+
/**
|
|
36
|
+
* Display the UI panel to edit fields on the data associated with the card
|
|
37
|
+
*/
|
|
38
|
+
OnClickHandlerKeys["BasicEditPanel"] = "BasicEditPanel";
|
|
39
|
+
})(OnClickHandlerKeys = exports.OnClickHandlerKeys || (exports.OnClickHandlerKeys = {}));
|
|
40
|
+
exports.isOnClickHandlerKey = (0, validators_1.enumValidator)(OnClickHandlerKeys);
|
|
41
|
+
/** @ignore */
|
|
42
|
+
function serializeLucidCardFieldDisplaySettings(settings) {
|
|
43
|
+
return {
|
|
44
|
+
'StencilConfig': settings.stencilConfig && {
|
|
45
|
+
'getterKey': settings.stencilConfig.displayType,
|
|
46
|
+
'bg': settings.stencilConfig.backgroundColor,
|
|
47
|
+
'h': settings.stencilConfig.horizontalPosition,
|
|
48
|
+
'v': settings.stencilConfig.verticalPosition,
|
|
49
|
+
'onClickHandlerKey': settings.stencilConfig.onClickHandlerKey,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
exports.serializeLucidCardFieldDisplaySettings = serializeLucidCardFieldDisplaySettings;
|
|
54
|
+
/** @ignore */
|
|
55
|
+
function deserializeLucidCardFieldDisplaySettings(settings) {
|
|
56
|
+
return {
|
|
57
|
+
stencilConfig: settings['StencilConfig'] && {
|
|
58
|
+
displayType: settings['StencilConfig']['getterKey'],
|
|
59
|
+
backgroundColor: settings['StencilConfig']['bg'],
|
|
60
|
+
horizontalPosition: settings['StencilConfig']['h'],
|
|
61
|
+
verticalPosition: settings['StencilConfig']['v'],
|
|
62
|
+
onClickHandlerKey: settings['StencilConfig']['onClickHandlerKey'],
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
exports.deserializeLucidCardFieldDisplaySettings = deserializeLucidCardFieldDisplaySettings;
|
|
@@ -5,6 +5,7 @@ import { isString } from '../checks';
|
|
|
5
5
|
import { isSerializedFieldTypeDefinition } from '../data/fieldtypedefinition/fieldtypedefinition';
|
|
6
6
|
import { FieldConstraintType, SerializedFieldDefinition } from '../data/serializedfield/serializedfielddefinition';
|
|
7
7
|
import { isSerializedFieldType, SerializedFieldType } from '../data/serializedfield/serializedfields';
|
|
8
|
+
import { CardIntegrationConfig } from './cardintegrationconfig';
|
|
8
9
|
/** For fields with Option or ApiOption type, the label and value for each available option */
|
|
9
10
|
export interface ExtensionCardFieldOption {
|
|
10
11
|
label: string;
|
|
@@ -72,25 +73,6 @@ export declare const isSerializedExtensionCardFieldDefinition: (subject: unknown
|
|
|
72
73
|
export declare function deserializeCardFieldDefinition(field: SerializedExtensionCardFieldDefinition): ExtensionCardFieldDefinition;
|
|
73
74
|
/** @ignore */
|
|
74
75
|
export declare function deserializeCardFieldArrayDefinition(fields: SerializedExtensionCardFieldDefinition[]): ExtensionCardFieldDefinition[];
|
|
75
|
-
export interface CardIntegrationConfig {
|
|
76
|
-
/**
|
|
77
|
-
* The data fields to be displayed on cards, as data-linked text fields
|
|
78
|
-
*/
|
|
79
|
-
fieldNames: string[];
|
|
80
|
-
/**
|
|
81
|
-
* The field name to use as the displayed ID of the card, if any
|
|
82
|
-
*/
|
|
83
|
-
idFieldName?: string;
|
|
84
|
-
}
|
|
85
|
-
/** @ignore */
|
|
86
|
-
export declare type SerializedCardIntegrationConfig = {
|
|
87
|
-
'f': string[];
|
|
88
|
-
'id'?: string;
|
|
89
|
-
};
|
|
90
|
-
/** @ignore */
|
|
91
|
-
export declare function serializeCardIntegrationConfig(config: CardIntegrationConfig): SerializedCardIntegrationConfig;
|
|
92
|
-
/** @ignore */
|
|
93
|
-
export declare function deserializeCardIntegrationConfig(raw: SerializedCardIntegrationConfig): CardIntegrationConfig;
|
|
94
76
|
export interface CardIntegration {
|
|
95
77
|
/**
|
|
96
78
|
* Label used to identify the integration, e.g. "Jira", which will be used in menu items, etc.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.deserializeCardFieldArrayDefinition = exports.deserializeCardFieldDefinition = exports.isSerializedExtensionCardFieldDefinition = exports.isSerializedFieldConstraint = exports.isSerializedFieldOptions = exports.isSerializedFieldOption = exports.deserializeFieldOption = exports.serializeCardFieldArrayDefinition = exports.serializeCardFieldDefinition = exports.serializeCardFieldOption = void 0;
|
|
4
4
|
const schemadefinition_1 = require("../../data/schemadefinition");
|
|
5
5
|
const checks_1 = require("../checks");
|
|
6
6
|
const fieldtypedefinition_1 = require("../data/fieldtypedefinition/fieldtypedefinition");
|
|
@@ -64,19 +64,3 @@ function deserializeCardFieldArrayDefinition(fields) {
|
|
|
64
64
|
return fields.map(deserializeCardFieldDefinition);
|
|
65
65
|
}
|
|
66
66
|
exports.deserializeCardFieldArrayDefinition = deserializeCardFieldArrayDefinition;
|
|
67
|
-
/** @ignore */
|
|
68
|
-
function serializeCardIntegrationConfig(config) {
|
|
69
|
-
return {
|
|
70
|
-
'f': config.fieldNames,
|
|
71
|
-
'id': config.idFieldName,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
exports.serializeCardIntegrationConfig = serializeCardIntegrationConfig;
|
|
75
|
-
/** @ignore */
|
|
76
|
-
function deserializeCardIntegrationConfig(raw) {
|
|
77
|
-
return {
|
|
78
|
-
fieldNames: raw['f'],
|
|
79
|
-
idFieldName: raw['id'],
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
exports.deserializeCardIntegrationConfig = deserializeCardIntegrationConfig;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LucidCardFieldDisplaySettings, SerializedLucidCardFieldDisplaySettings } from './cardfielddisplaysettings';
|
|
2
|
+
export interface CardIntegrationConfig {
|
|
3
|
+
/**
|
|
4
|
+
* The data fields to be displayed on cards, as data-linked text fields
|
|
5
|
+
*/
|
|
6
|
+
fieldNames: string[];
|
|
7
|
+
/**
|
|
8
|
+
* The data fields to be displayed on cards as data graphics
|
|
9
|
+
*/
|
|
10
|
+
fieldDisplaySettings?: Map<string, LucidCardFieldDisplaySettings>;
|
|
11
|
+
/**
|
|
12
|
+
* The field name to use as the displayed ID of the card, if any
|
|
13
|
+
*/
|
|
14
|
+
idFieldName?: string;
|
|
15
|
+
}
|
|
16
|
+
/** @ignore */
|
|
17
|
+
export declare type SerializedCardIntegrationConfig = {
|
|
18
|
+
'f': string[];
|
|
19
|
+
'fd'?: [string, SerializedLucidCardFieldDisplaySettings][];
|
|
20
|
+
'id'?: string;
|
|
21
|
+
};
|
|
22
|
+
/** @ignore */
|
|
23
|
+
export declare function serializeCardIntegrationConfig(config: CardIntegrationConfig): SerializedCardIntegrationConfig;
|
|
24
|
+
/** @ignore */
|
|
25
|
+
export declare function deserializeCardIntegrationConfig(raw: SerializedCardIntegrationConfig): CardIntegrationConfig;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeCardIntegrationConfig = exports.serializeCardIntegrationConfig = void 0;
|
|
4
|
+
const cardfielddisplaysettings_1 = require("./cardfielddisplaysettings");
|
|
5
|
+
/** @ignore */
|
|
6
|
+
function serializeCardIntegrationConfig(config) {
|
|
7
|
+
return {
|
|
8
|
+
'f': config.fieldNames,
|
|
9
|
+
'fd': config.fieldDisplaySettings
|
|
10
|
+
? [...config.fieldDisplaySettings].map(([key, settings]) => [
|
|
11
|
+
key,
|
|
12
|
+
(0, cardfielddisplaysettings_1.serializeLucidCardFieldDisplaySettings)(settings),
|
|
13
|
+
])
|
|
14
|
+
: undefined,
|
|
15
|
+
'id': config.idFieldName,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
exports.serializeCardIntegrationConfig = serializeCardIntegrationConfig;
|
|
19
|
+
/** @ignore */
|
|
20
|
+
function deserializeCardIntegrationConfig(raw) {
|
|
21
|
+
return {
|
|
22
|
+
fieldNames: raw['f'],
|
|
23
|
+
fieldDisplaySettings: raw['fd']
|
|
24
|
+
? new Map(raw['fd'].map(([key, settings]) => [key, (0, cardfielddisplaysettings_1.deserializeLucidCardFieldDisplaySettings)(settings)]))
|
|
25
|
+
: undefined,
|
|
26
|
+
idFieldName: raw['id'],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
exports.deserializeCardIntegrationConfig = deserializeCardIntegrationConfig;
|
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;
|
|
@@ -4,8 +4,7 @@ import { LiteralFieldType, SerializedLiteralFieldType } from './literalfieldtype
|
|
|
4
4
|
import { NDimensionalFieldTypeArray, SerializedNDimensionalFieldTypeArray } from './ndimensionalfieldtypearray';
|
|
5
5
|
import { ScalarFieldTypeEnum } from './scalarfieldtype';
|
|
6
6
|
export declare type AnyFieldTypeArrayDefinition = FieldTypeArray | NDimensionalFieldTypeArray;
|
|
7
|
-
export declare
|
|
8
|
-
export declare type BaseFieldTypeDefinition = ScalarFieldTypeEnum | LiteralFieldType | AnyFieldTypeArrayDefinition | CollectionEnumFieldType;
|
|
7
|
+
export declare type BaseFieldTypeDefinition = ScalarFieldTypeEnum | LiteralFieldType | FieldTypeArray | NDimensionalFieldTypeArray | CollectionEnumFieldType;
|
|
9
8
|
export declare type SerializedBaseFieldTypeDefinition = ScalarFieldTypeEnum | SerializedLiteralFieldType | SerializedFieldTypeArray | SerializedNDimensionalFieldTypeArray | SerializedCollectionEnumFieldType;
|
|
10
9
|
export declare function isBaseFieldTypeDefinition(fieldType: any): fieldType is BaseFieldTypeDefinition;
|
|
11
10
|
export declare function serializeBaseFieldTypeDefinition(baseFieldType: BaseFieldTypeDefinition): SerializedBaseFieldTypeDefinition;
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSerializedBaseFieldTypeDefinition = exports.deserializeBaseFieldTypeDefinition = exports.serializeBaseFieldTypeDefinition = exports.isBaseFieldTypeDefinition =
|
|
3
|
+
exports.isSerializedBaseFieldTypeDefinition = exports.deserializeBaseFieldTypeDefinition = exports.serializeBaseFieldTypeDefinition = exports.isBaseFieldTypeDefinition = void 0;
|
|
4
4
|
const checks_1 = require("../../checks");
|
|
5
5
|
const collectionenumfieldtype_1 = require("./collectionenumfieldtype");
|
|
6
6
|
const fieldtypearray_1 = require("./fieldtypearray");
|
|
7
7
|
const literalfieldtype_1 = require("./literalfieldtype");
|
|
8
8
|
const ndimensionalfieldtypearray_1 = require("./ndimensionalfieldtypearray");
|
|
9
9
|
const scalarfieldtype_1 = require("./scalarfieldtype");
|
|
10
|
-
function isAnyFieldTypeArray(fieldType) {
|
|
11
|
-
return fieldType instanceof fieldtypearray_1.FieldTypeArray || fieldType instanceof ndimensionalfieldtypearray_1.NDimensionalFieldTypeArray;
|
|
12
|
-
}
|
|
13
|
-
exports.isAnyFieldTypeArray = isAnyFieldTypeArray;
|
|
14
10
|
function isBaseFieldTypeDefinition(fieldType) {
|
|
15
11
|
return ((0, scalarfieldtype_1.isScalarFieldTypeEnum)(fieldType) ||
|
|
16
12
|
(0, literalfieldtype_1.isLiteralFieldType)(fieldType) ||
|
|
17
|
-
|
|
13
|
+
fieldType instanceof fieldtypearray_1.FieldTypeArray ||
|
|
14
|
+
fieldType instanceof ndimensionalfieldtypearray_1.NDimensionalFieldTypeArray ||
|
|
18
15
|
(0, collectionenumfieldtype_1.isCollectionEnumFieldType)(fieldType));
|
|
19
16
|
}
|
|
20
17
|
exports.isBaseFieldTypeDefinition = isBaseFieldTypeDefinition;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FieldTypeDefinition } from './fieldtypedefinition';
|
|
1
2
|
export declare const CollectionEnumFieldTypeKey = "COLLECTION_ENUM";
|
|
2
3
|
/**
|
|
3
4
|
* Contains the field names of all valid fields for a groovy metadata collection.
|
|
@@ -22,7 +23,7 @@ export declare class CollectionEnumFieldType {
|
|
|
22
23
|
constructor(collectionId: string);
|
|
23
24
|
serialize(): SerializedCollectionEnumFieldType;
|
|
24
25
|
}
|
|
25
|
-
export declare const isCollectionEnumFieldType: (fieldType:
|
|
26
|
+
export declare const isCollectionEnumFieldType: (fieldType: FieldTypeDefinition) => fieldType is CollectionEnumFieldType;
|
|
26
27
|
export declare type SerializedCollectionEnumFieldType = {
|
|
27
28
|
[CollectionEnumFieldTypeKey]: string;
|
|
28
29
|
};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { CollectionEnumFieldType, SerializedCollectionEnumFieldType } from './collectionenumfieldtype';
|
|
2
2
|
import { LiteralFieldType, SerializedLiteralFieldType } from './literalfieldtype';
|
|
3
3
|
import { ScalarFieldTypeEnum } from './scalarfieldtype';
|
|
4
|
-
export declare class
|
|
5
|
-
readonly validTypesArray:
|
|
6
|
-
constructor(validTypesArray:
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
export declare abstract class BaseFieldTypeArray<Type> {
|
|
5
|
+
readonly validTypesArray: Type[];
|
|
6
|
+
constructor(validTypesArray: Type[]);
|
|
7
|
+
protected abstract serializeType(t: Type): SerializedFieldTypeArray['validTypes']['0'];
|
|
8
|
+
getInnerTypes(): Type[];
|
|
9
|
+
getInnerNonArrayTypes(): Exclude<Type, BaseFieldTypeArray<Type>>[];
|
|
9
10
|
serialize(): SerializedFieldTypeArray;
|
|
10
11
|
}
|
|
11
|
-
export declare
|
|
12
|
+
export declare type FieldTypeArraySubTypes = ScalarFieldTypeEnum | CollectionEnumFieldType | LiteralFieldType | FieldTypeArray;
|
|
13
|
+
export declare class FieldTypeArray extends BaseFieldTypeArray<FieldTypeArraySubTypes> {
|
|
14
|
+
protected serializeType(t: FieldTypeArraySubTypes): string | SerializedCollectionEnumFieldType | ScalarFieldTypeEnum | SerializedFieldTypeArray;
|
|
15
|
+
}
|
|
12
16
|
export declare type SerializedFieldTypeArray = {
|
|
13
17
|
'ND': false;
|
|
14
18
|
'validTypes': (ScalarFieldTypeEnum | SerializedLiteralFieldType | SerializedFieldTypeArray | SerializedCollectionEnumFieldType)[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deserializeFieldTypeArray = exports.isSerializedFieldTypeArray = exports.
|
|
3
|
+
exports.deserializeFieldTypeArray = exports.isSerializedFieldTypeArray = exports.FieldTypeArray = exports.BaseFieldTypeArray = void 0;
|
|
4
4
|
const checks_1 = require("../../checks");
|
|
5
5
|
const collectionenumfieldtype_1 = require("./collectionenumfieldtype");
|
|
6
6
|
const literalfieldtype_1 = require("./literalfieldtype");
|
|
7
7
|
const scalarfieldtype_1 = require("./scalarfieldtype");
|
|
8
|
-
class
|
|
8
|
+
class BaseFieldTypeArray {
|
|
9
9
|
constructor(validTypesArray) {
|
|
10
10
|
this.validTypesArray = validTypesArray;
|
|
11
11
|
}
|
|
@@ -13,23 +13,22 @@ class FieldTypeArray {
|
|
|
13
13
|
return this.validTypesArray;
|
|
14
14
|
}
|
|
15
15
|
getInnerNonArrayTypes() {
|
|
16
|
-
return this.validTypesArray.filter((innerType) => (
|
|
16
|
+
return this.validTypesArray.filter((innerType) => !(innerType instanceof BaseFieldTypeArray));
|
|
17
17
|
}
|
|
18
18
|
serialize() {
|
|
19
19
|
return {
|
|
20
20
|
'ND': false,
|
|
21
|
-
'validTypes': this.validTypesArray.map((t) =>
|
|
21
|
+
'validTypes': this.validTypesArray.map((t) => this.serializeType(t)),
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
exports.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
(0,
|
|
29
|
-
|
|
30
|
-
fieldType instanceof FieldTypeArray);
|
|
25
|
+
exports.BaseFieldTypeArray = BaseFieldTypeArray;
|
|
26
|
+
class FieldTypeArray extends BaseFieldTypeArray {
|
|
27
|
+
serializeType(t) {
|
|
28
|
+
return (0, scalarfieldtype_1.isScalarFieldTypeEnum)(t) ? t : t.serialize();
|
|
29
|
+
}
|
|
31
30
|
}
|
|
32
|
-
exports.
|
|
31
|
+
exports.FieldTypeArray = FieldTypeArray;
|
|
33
32
|
function isSerializedFieldTypeArray(fieldType, validateTypeCheck) {
|
|
34
33
|
return ((0, checks_1.isObject)(fieldType) &&
|
|
35
34
|
(0, checks_1.isBoolean)(fieldType['ND']) &&
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { BaseFieldTypeDefinition, SerializedBaseFieldTypeDefinition } from './basefieldtypedefinition';
|
|
2
|
-
import { NDimensionalFieldTypeArray } from './ndimensionalfieldtypearray';
|
|
3
|
-
import { ScalarFieldTypeEnum } from './scalarfieldtype';
|
|
4
2
|
export declare type FieldTypeDefinition = BaseFieldTypeDefinition | BaseFieldTypeDefinition[];
|
|
5
3
|
export declare function fieldTypesEqual(a: FieldTypeDefinition, b: FieldTypeDefinition, checkEnumCollectionId?: boolean): boolean;
|
|
6
|
-
export declare function
|
|
7
|
-
export declare
|
|
8
|
-
export declare function isAnyFieldType(type: FieldTypeDefinition): boolean;
|
|
9
|
-
export declare const serializeFieldTypeDefinition: (fieldType: FieldTypeDefinition) => SerializedFieldTypeDefinition;
|
|
4
|
+
export declare function serializeFieldTypeDefinition(fieldType: BaseFieldTypeDefinition): SerializedBaseFieldTypeDefinition;
|
|
5
|
+
export declare function serializeFieldTypeDefinition(fieldType: FieldTypeDefinition): SerializedFieldTypeDefinition;
|
|
10
6
|
export declare const deserializeFieldTypeDefinition: (serializedFieldType: SerializedFieldTypeDefinition) => FieldTypeDefinition;
|
|
11
|
-
export declare const SerializedAnyFieldType: SerializedFieldTypeDefinition;
|
|
12
7
|
export declare type SerializedFieldTypeDefinition = SerializedBaseFieldTypeDefinition | SerializedBaseFieldTypeDefinition[];
|
|
13
8
|
export declare function isSerializedFieldTypeDefinition(definition: any): definition is SerializedFieldTypeDefinition;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSerializedFieldTypeDefinition = exports.
|
|
3
|
+
exports.isSerializedFieldTypeDefinition = exports.deserializeFieldTypeDefinition = exports.serializeFieldTypeDefinition = exports.fieldTypesEqual = void 0;
|
|
4
4
|
const checks_1 = require("../../checks");
|
|
5
5
|
const basefieldtypedefinition_1 = require("./basefieldtypedefinition");
|
|
6
6
|
const collectionenumfieldtype_1 = require("./collectionenumfieldtype");
|
|
7
7
|
const fieldtypearray_1 = require("./fieldtypearray");
|
|
8
8
|
const literalfieldtype_1 = require("./literalfieldtype");
|
|
9
9
|
const ndimensionalfieldtypearray_1 = require("./ndimensionalfieldtypearray");
|
|
10
|
-
const scalarfieldtype_1 = require("./scalarfieldtype");
|
|
11
10
|
function fieldTypesEqual(a, b, checkEnumCollectionId = true) {
|
|
12
11
|
if (a === b) {
|
|
13
12
|
return true;
|
|
@@ -54,90 +53,14 @@ function fieldTypesEqual(a, b, checkEnumCollectionId = true) {
|
|
|
54
53
|
return true;
|
|
55
54
|
}
|
|
56
55
|
exports.fieldTypesEqual = fieldTypesEqual;
|
|
57
|
-
function
|
|
58
|
-
if (!(0, checks_1.isArray)(superTypes)) {
|
|
59
|
-
superTypes = [superTypes];
|
|
60
|
-
}
|
|
61
|
-
if ((0, checks_1.isArray)(subType)) {
|
|
62
|
-
return subType.every((one) => isSubtypeOfFieldType(one, superTypes));
|
|
63
|
-
}
|
|
64
|
-
if (superTypes.includes(scalarfieldtype_1.ScalarFieldTypeEnum.ANY)) {
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
if ((0, scalarfieldtype_1.isScalarFieldTypeEnum)(subType)) {
|
|
68
|
-
return superTypes.includes(subType);
|
|
69
|
-
}
|
|
70
|
-
if ((0, literalfieldtype_1.isLiteralFieldType)(subType)) {
|
|
71
|
-
if (superTypes.includes(subType.getScalarFieldType())) {
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
const superLiteralTypes = superTypes.filter(literalfieldtype_1.isLiteralFieldType);
|
|
75
|
-
if (superLiteralTypes.find((superLiteralType) => subType.getLiteral() === superLiteralType.getLiteral())) {
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
const superArrayTypes = superTypes.filter(basefieldtypedefinition_1.isAnyFieldTypeArray);
|
|
79
|
-
for (const superArrayType of superArrayTypes) {
|
|
80
|
-
if (isSubtypeOfFieldType(subType, superArrayType.getInnerTypes())) {
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
if ((0, collectionenumfieldtype_1.isCollectionEnumFieldType)(subType)) {
|
|
87
|
-
return superTypes.filter(collectionenumfieldtype_1.isCollectionEnumFieldType).some((ce) => ce.collectionId === subType.collectionId);
|
|
88
|
-
}
|
|
89
|
-
if ((0, ndimensionalfieldtypearray_1.isNDimensionalFieldTypeArray)(subType)) {
|
|
90
|
-
const superNArrayTypes = superTypes.filter(ndimensionalfieldtypearray_1.isNDimensionalFieldTypeArray);
|
|
91
|
-
return !!superNArrayTypes.find((superNArrayType) => isSubtypeOfFieldType(subType.validTypesArray, superNArrayType.validTypesArray));
|
|
92
|
-
}
|
|
93
|
-
const subTypeArrayInnerTypes = subType.getInnerTypes();
|
|
94
|
-
const superArrayTypes = superTypes.filter(basefieldtypedefinition_1.isAnyFieldTypeArray);
|
|
95
|
-
for (const superArrayType of superArrayTypes) {
|
|
96
|
-
if (isSubtypeOfFieldType(subTypeArrayInnerTypes, superArrayType.getInnerTypes())) {
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
exports.isSubtypeOfFieldType = isSubtypeOfFieldType;
|
|
103
|
-
exports.AnyFieldType = [...scalarfieldtype_1.AnyScalarFieldType, new ndimensionalfieldtypearray_1.NDimensionalFieldTypeArray(scalarfieldtype_1.AnyScalarFieldType)];
|
|
104
|
-
function isAnyFieldType(type) {
|
|
105
|
-
let nArray;
|
|
106
|
-
if (type === scalarfieldtype_1.ScalarFieldTypeEnum.ANY ||
|
|
107
|
-
type === exports.AnyFieldType ||
|
|
108
|
-
((0, checks_1.isArray)(type) &&
|
|
109
|
-
type.includes(scalarfieldtype_1.ScalarFieldTypeEnum.NUMBER) &&
|
|
110
|
-
type.includes(scalarfieldtype_1.ScalarFieldTypeEnum.STRING) &&
|
|
111
|
-
type.includes(scalarfieldtype_1.ScalarFieldTypeEnum.BOOLEAN) &&
|
|
112
|
-
type.includes(scalarfieldtype_1.ScalarFieldTypeEnum.COLOR) &&
|
|
113
|
-
type.includes(scalarfieldtype_1.ScalarFieldTypeEnum.DATE) &&
|
|
114
|
-
type.includes(scalarfieldtype_1.ScalarFieldTypeEnum.NULL) &&
|
|
115
|
-
type.includes(scalarfieldtype_1.ScalarFieldTypeEnum.DICTIONARY) &&
|
|
116
|
-
type.includes(scalarfieldtype_1.ScalarFieldTypeEnum.CURRENCY) &&
|
|
117
|
-
!type.some(literalfieldtype_1.isLiteralFieldType) &&
|
|
118
|
-
(nArray = type.find(ndimensionalfieldtypearray_1.isNDimensionalFieldTypeArray)) &&
|
|
119
|
-
nArray.validTypesArray.includes(scalarfieldtype_1.ScalarFieldTypeEnum.NUMBER) &&
|
|
120
|
-
nArray.validTypesArray.includes(scalarfieldtype_1.ScalarFieldTypeEnum.STRING) &&
|
|
121
|
-
nArray.validTypesArray.includes(scalarfieldtype_1.ScalarFieldTypeEnum.BOOLEAN) &&
|
|
122
|
-
nArray.validTypesArray.includes(scalarfieldtype_1.ScalarFieldTypeEnum.COLOR) &&
|
|
123
|
-
nArray.validTypesArray.includes(scalarfieldtype_1.ScalarFieldTypeEnum.DATE) &&
|
|
124
|
-
nArray.validTypesArray.includes(scalarfieldtype_1.ScalarFieldTypeEnum.DICTIONARY) &&
|
|
125
|
-
nArray.validTypesArray.includes(scalarfieldtype_1.ScalarFieldTypeEnum.NULL) &&
|
|
126
|
-
nArray.validTypesArray.includes(scalarfieldtype_1.ScalarFieldTypeEnum.CURRENCY) &&
|
|
127
|
-
!nArray.validTypesArray.some(literalfieldtype_1.isLiteralFieldType))) {
|
|
128
|
-
return true;
|
|
129
|
-
}
|
|
130
|
-
return false;
|
|
131
|
-
}
|
|
132
|
-
exports.isAnyFieldType = isAnyFieldType;
|
|
133
|
-
const serializeFieldTypeDefinition = (fieldType) => {
|
|
56
|
+
function serializeFieldTypeDefinition(fieldType) {
|
|
134
57
|
if ((0, checks_1.isArray)(fieldType)) {
|
|
135
58
|
return fieldType.map(basefieldtypedefinition_1.serializeBaseFieldTypeDefinition);
|
|
136
59
|
}
|
|
137
60
|
else {
|
|
138
61
|
return (0, basefieldtypedefinition_1.serializeBaseFieldTypeDefinition)(fieldType);
|
|
139
62
|
}
|
|
140
|
-
}
|
|
63
|
+
}
|
|
141
64
|
exports.serializeFieldTypeDefinition = serializeFieldTypeDefinition;
|
|
142
65
|
const deserializeFieldTypeDefinition = (serializedFieldType) => {
|
|
143
66
|
if ((0, checks_1.isArray)(serializedFieldType)) {
|
|
@@ -146,7 +69,6 @@ const deserializeFieldTypeDefinition = (serializedFieldType) => {
|
|
|
146
69
|
return (0, basefieldtypedefinition_1.deserializeBaseFieldTypeDefinition)(serializedFieldType);
|
|
147
70
|
};
|
|
148
71
|
exports.deserializeFieldTypeDefinition = deserializeFieldTypeDefinition;
|
|
149
|
-
exports.SerializedAnyFieldType = (0, exports.serializeFieldTypeDefinition)(exports.AnyFieldType);
|
|
150
72
|
function isSerializedFieldTypeDefinition(definition) {
|
|
151
73
|
if ((0, checks_1.isArray)(definition)) {
|
|
152
74
|
return definition.every(basefieldtypedefinition_1.isSerializedBaseFieldTypeDefinition);
|
|
@@ -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);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TaskManagementCardIntegration = void 0;
|
|
4
4
|
const cardintegration_1 = require("../core/cardintegration/cardintegration");
|
|
5
|
+
const cardintegrationconfig_1 = require("../core/cardintegration/cardintegrationconfig");
|
|
5
6
|
const collectiondefinition_1 = require("../data/collectiondefinition");
|
|
6
7
|
const collectionproxy_1 = require("../data/collectionproxy");
|
|
7
8
|
class TaskManagementCardIntegration {
|
|
@@ -26,7 +27,7 @@ class TaskManagementCardIntegration {
|
|
|
26
27
|
const getDefaultConfigActionName = TaskManagementCardIntegration.nextHookName();
|
|
27
28
|
this.client.registerAction(getDefaultConfigActionName, async (param) => {
|
|
28
29
|
const collection = new collectionproxy_1.CollectionProxy(param['c'], this.client);
|
|
29
|
-
return (0,
|
|
30
|
+
return (0, cardintegrationconfig_1.serializeCardIntegrationConfig)(await card.getDefaultConfig(collection));
|
|
30
31
|
});
|
|
31
32
|
let showIntroActionName = undefined;
|
|
32
33
|
if (card.showIntro) {
|
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;
|