lucid-extension-sdk 0.0.420 → 0.0.423
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/data/fieldspecification.d.ts +2 -2
- package/core/data/fieldtypedefinition/scalarfieldtype.d.ts +2 -1
- package/core/data/fieldtypedefinition/scalarfieldtype.js +2 -0
- package/core/data/serializedfield/serializedfields.d.ts +21 -1
- package/core/data/serializedfield/serializedfields.js +6 -1
- package/core/sharedcardintegration/cardintegrationdefinitions.d.ts +10 -0
- package/core/sharedcardintegration/cardintegrationdefinitions.js +2 -10
- package/package.json +1 -1
|
@@ -7,10 +7,10 @@ import { LucidFields } from './fieldtypedefinition/lucidfields';
|
|
|
7
7
|
import { ScalarFieldTypeEnum } from './fieldtypedefinition/scalarfieldtype';
|
|
8
8
|
import { SemanticFields } from './fieldtypedefinition/semanticfields';
|
|
9
9
|
import { SemanticKind } from './fieldtypedefinition/semantickind';
|
|
10
|
-
import { SerializedColorObject, SerializedLucidCurrency, SerializedLucidDateObject, SerializedLucidDictionary } from './serializedfield/serializedfields';
|
|
10
|
+
import { SerializedColorObject, SerializedLucidCurrency, SerializedLucidDateObject, SerializedLucidDateRangeObject, SerializedLucidDictionary } from './serializedfield/serializedfields';
|
|
11
11
|
type TsTypeOf<X> = X extends ScalarFieldTypeEnum.ANY ? unknown : X extends ScalarFieldTypeEnum.NUMBER ? number : X extends ScalarFieldTypeEnum.BOOLEAN ? boolean : X extends ScalarFieldTypeEnum.STRING ? string : X extends ScalarFieldTypeEnum.COLOR ? SerializedColorObject : X extends ScalarFieldTypeEnum.DATE ? SerializedLucidDateObject : X extends ScalarFieldTypeEnum.NULL ? null : X extends ScalarFieldTypeEnum.DICTIONARY ? SerializedLucidDictionary : X extends FieldTypeArray<infer Inner> ? TsTypeOf<Inner>[] : X extends ScalarFieldTypeEnum.CURRENCY ? SerializedLucidCurrency : X extends ScalarFieldTypeEnum.DATEONLY ? SerializedLucidDateObject & {
|
|
12
12
|
isDateOnly: true;
|
|
13
|
-
} : X extends CollectionEnumFieldType ? string : X extends DeserializedMapEnumFieldType ? string : X extends readonly [infer Inner, ...infer Others] ? TsTypeOf<Inner> | TsTypeOf<Others> : never;
|
|
13
|
+
} : X extends ScalarFieldTypeEnum.DATERANGE ? SerializedLucidDateRangeObject : X extends CollectionEnumFieldType ? string : X extends DeserializedMapEnumFieldType ? string : X extends readonly [infer Inner, ...infer Others] ? TsTypeOf<Inner> | TsTypeOf<Others> : never;
|
|
14
14
|
/**
|
|
15
15
|
* Specifies all the fields that this itegration will be sending to the data-sync service.
|
|
16
16
|
* Give you well typed methods to convert from `YourType[]` to `{[PrimaryKey:string]: YourType}`
|
|
@@ -9,7 +9,8 @@ export declare enum ScalarFieldTypeEnum {
|
|
|
9
9
|
DICTIONARY = 7,
|
|
10
10
|
CURRENCY = 8,
|
|
11
11
|
DATEONLY = 9,
|
|
12
|
-
TIMEONLY = 10
|
|
12
|
+
TIMEONLY = 10,
|
|
13
|
+
DATERANGE = 11
|
|
13
14
|
}
|
|
14
15
|
export declare const AnyScalarFieldType: ScalarFieldTypeEnum[];
|
|
15
16
|
export declare const isScalarFieldTypeEnum: (fieldType: any) => fieldType is ScalarFieldTypeEnum;
|
|
@@ -14,6 +14,7 @@ var ScalarFieldTypeEnum;
|
|
|
14
14
|
ScalarFieldTypeEnum[ScalarFieldTypeEnum["CURRENCY"] = 8] = "CURRENCY";
|
|
15
15
|
ScalarFieldTypeEnum[ScalarFieldTypeEnum["DATEONLY"] = 9] = "DATEONLY";
|
|
16
16
|
ScalarFieldTypeEnum[ScalarFieldTypeEnum["TIMEONLY"] = 10] = "TIMEONLY";
|
|
17
|
+
ScalarFieldTypeEnum[ScalarFieldTypeEnum["DATERANGE"] = 11] = "DATERANGE";
|
|
17
18
|
})(ScalarFieldTypeEnum || (exports.ScalarFieldTypeEnum = ScalarFieldTypeEnum = {}));
|
|
18
19
|
exports.AnyScalarFieldType = [
|
|
19
20
|
ScalarFieldTypeEnum.ANY,
|
|
@@ -27,6 +28,7 @@ exports.AnyScalarFieldType = [
|
|
|
27
28
|
ScalarFieldTypeEnum.DICTIONARY,
|
|
28
29
|
ScalarFieldTypeEnum.CURRENCY,
|
|
29
30
|
ScalarFieldTypeEnum.TIMEONLY,
|
|
31
|
+
ScalarFieldTypeEnum.DATERANGE,
|
|
30
32
|
];
|
|
31
33
|
const AnyScalarFieldTypeSet = new Set(exports.AnyScalarFieldType);
|
|
32
34
|
const isScalarFieldTypeEnum = (fieldType) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isNumber, isString } from '../../checks';
|
|
2
|
-
export type SerializedFieldType = number | boolean | string | null | SerializedLucidDateObject | SerializedTimeObject | SerializedColorObjectFieldType | SerializedLucidDictionary | SerializedLucidCurrency | undefined | Array<SerializedFieldType>;
|
|
2
|
+
export type SerializedFieldType = number | boolean | string | null | SerializedLucidDateObject | SerializedLucidDateRangeObject | SerializedTimeObject | SerializedColorObjectFieldType | SerializedLucidDictionary | SerializedLucidCurrency | undefined | Array<SerializedFieldType>;
|
|
3
3
|
export type SerializedJsonFieldType = number | boolean | string | null | undefined | Array<SerializedJsonFieldType> | {
|
|
4
4
|
[index: string]: SerializedJsonFieldType;
|
|
5
5
|
};
|
|
@@ -30,6 +30,10 @@ export type SerializedMillisecondsDateObject = {
|
|
|
30
30
|
'isDateOnly'?: boolean;
|
|
31
31
|
};
|
|
32
32
|
export type SerializedLucidDateObject = SerializedMillisecondsDateObject | SerializedIsoDateObject;
|
|
33
|
+
export type SerializedLucidDateRangeObject = {
|
|
34
|
+
'startDate': SerializedLucidDateObject;
|
|
35
|
+
'endDate': SerializedLucidDateObject;
|
|
36
|
+
};
|
|
33
37
|
export type SerializedTimeObject = {
|
|
34
38
|
'hours': number;
|
|
35
39
|
'minutes'?: number | undefined;
|
|
@@ -114,6 +118,22 @@ export declare const isSerializedLucidDateObject: (x: unknown) => x is import(".
|
|
|
114
118
|
isoDate: typeof isString;
|
|
115
119
|
displayTimezone: (x: unknown) => x is string | null | undefined;
|
|
116
120
|
}>;
|
|
121
|
+
export declare const isSerializedLucidDateRangeObject: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
|
|
122
|
+
startDate: (x: unknown) => x is import("../../guards").DestructureGuardedTypeObj<{
|
|
123
|
+
ms: typeof isNumber;
|
|
124
|
+
isDateOnly: (x: unknown) => x is boolean | undefined;
|
|
125
|
+
}> | import("../../guards").DestructureGuardedTypeObj<{
|
|
126
|
+
isoDate: typeof isString;
|
|
127
|
+
displayTimezone: (x: unknown) => x is string | null | undefined;
|
|
128
|
+
}>;
|
|
129
|
+
endDate: (x: unknown) => x is import("../../guards").DestructureGuardedTypeObj<{
|
|
130
|
+
ms: typeof isNumber;
|
|
131
|
+
isDateOnly: (x: unknown) => x is boolean | undefined;
|
|
132
|
+
}> | import("../../guards").DestructureGuardedTypeObj<{
|
|
133
|
+
isoDate: typeof isString;
|
|
134
|
+
displayTimezone: (x: unknown) => x is string | null | undefined;
|
|
135
|
+
}>;
|
|
136
|
+
}>;
|
|
117
137
|
export declare const isSerializedTimeObject: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
|
|
118
138
|
hours: typeof isNumber;
|
|
119
139
|
minutes: (x: unknown) => x is number | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSerializedFields = exports.isSerializedJsonFieldType = exports.isSerializedFieldType = exports.isSerializedLucidIconDataDictionary = exports.isSerializedTimeObject = exports.isSerializedLucidDateObject = exports.isSerializedIsoDateObject = exports.isSerializedMillisecondsDateObject = exports.isSerializedLucidAvatarDataDictionary = exports.isSerializedLucidCurrency = exports.isSerializedLucidDictionary = exports.isJsonSerializedLucidDictionary = exports.isNestedSerializedLucidDictionary = exports.isSerializedColorObjectFieldType = void 0;
|
|
3
|
+
exports.isSerializedFields = exports.isSerializedJsonFieldType = exports.isSerializedFieldType = exports.isSerializedLucidIconDataDictionary = exports.isSerializedTimeObject = exports.isSerializedLucidDateRangeObject = exports.isSerializedLucidDateObject = exports.isSerializedIsoDateObject = exports.isSerializedMillisecondsDateObject = exports.isSerializedLucidAvatarDataDictionary = exports.isSerializedLucidCurrency = exports.isSerializedLucidDictionary = exports.isJsonSerializedLucidDictionary = exports.isNestedSerializedLucidDictionary = exports.isSerializedColorObjectFieldType = void 0;
|
|
4
4
|
const checks_1 = require("../../checks");
|
|
5
5
|
const validators_1 = require("../../validators/validators");
|
|
6
6
|
function isSerializedColorObjectFieldType(value) {
|
|
@@ -35,6 +35,10 @@ exports.isSerializedIsoDateObject = (0, validators_1.objectValidator)({
|
|
|
35
35
|
'displayTimezone': (0, validators_1.nullableOption)(checks_1.isString),
|
|
36
36
|
});
|
|
37
37
|
exports.isSerializedLucidDateObject = (0, validators_1.either)(exports.isSerializedMillisecondsDateObject, exports.isSerializedIsoDateObject);
|
|
38
|
+
exports.isSerializedLucidDateRangeObject = (0, validators_1.objectValidator)({
|
|
39
|
+
'startDate': exports.isSerializedLucidDateObject,
|
|
40
|
+
'endDate': exports.isSerializedLucidDateObject,
|
|
41
|
+
});
|
|
38
42
|
exports.isSerializedTimeObject = (0, validators_1.objectValidator)({
|
|
39
43
|
'hours': checks_1.isNumber,
|
|
40
44
|
'minutes': (0, validators_1.option)(checks_1.isNumber),
|
|
@@ -56,6 +60,7 @@ function isSerializedFieldType(value) {
|
|
|
56
60
|
(0, exports.isSerializedLucidCurrency)(value) ||
|
|
57
61
|
((0, checks_1.isArray)(value) && value.every(isSerializedFieldType)) ||
|
|
58
62
|
(0, exports.isSerializedLucidDateObject)(value) ||
|
|
63
|
+
(0, exports.isSerializedLucidDateRangeObject)(value) ||
|
|
59
64
|
(0, exports.isSerializedTimeObject)(value) ||
|
|
60
65
|
isSerializedColorObjectFieldType(value) ||
|
|
61
66
|
(0, exports.isSerializedLucidIconDataDictionary)(value) ||
|
|
@@ -12,7 +12,16 @@ import { SerializedFieldType, SerializedLucidDictionary, isSerializedFieldType }
|
|
|
12
12
|
export interface ExtensionCardFieldOption {
|
|
13
13
|
label: string;
|
|
14
14
|
value: SerializedFieldType;
|
|
15
|
+
/**
|
|
16
|
+
* URL used for displaying the icon in dropdowns and on the card.
|
|
17
|
+
*/
|
|
15
18
|
iconUrl?: string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Optional override for iconUrl used when saving an icon's URL to a collection. Use when the URL to save differs
|
|
21
|
+
* from the URL to display (e.g., when using an image proxy), or to avoid processing the URL (e.g., to skip URL
|
|
22
|
+
* decoding).
|
|
23
|
+
*/
|
|
24
|
+
iconUrlForCollection?: string | undefined;
|
|
16
25
|
}
|
|
17
26
|
export interface ExtensionCardFieldDefinition extends FieldDefinition {
|
|
18
27
|
/** The label to display in the UI */
|
|
@@ -71,6 +80,7 @@ export type SerializedCardFieldOption = {
|
|
|
71
80
|
'l': string;
|
|
72
81
|
'v'?: SerializedFieldType;
|
|
73
82
|
'i'?: string | undefined;
|
|
83
|
+
'ic'?: string | undefined;
|
|
74
84
|
};
|
|
75
85
|
/** @ignore */
|
|
76
86
|
export declare function serializeCardFieldOption(option: ExtensionCardFieldOption): SerializedCardFieldOption;
|
|
@@ -27,11 +27,7 @@ exports.isSerializedCardUserData = (0, validators_1.objectValidator)({
|
|
|
27
27
|
exports.isSerializedCardUserDataArray = (0, validators_1.arrayValidator)(exports.isSerializedCardUserData);
|
|
28
28
|
/** @ignore */
|
|
29
29
|
function serializeCardFieldOption(option) {
|
|
30
|
-
return {
|
|
31
|
-
'l': option.label,
|
|
32
|
-
'v': option.value,
|
|
33
|
-
'i': option.iconUrl,
|
|
34
|
-
};
|
|
30
|
+
return Object.assign({ 'l': option.label, 'v': option.value, 'i': option.iconUrl }, ((0, checks_1.isDefAndNotNull)(option.iconUrlForCollection) && { 'ic': option.iconUrlForCollection }));
|
|
35
31
|
}
|
|
36
32
|
exports.serializeCardFieldOption = serializeCardFieldOption;
|
|
37
33
|
/** @ignore */
|
|
@@ -47,11 +43,7 @@ function serializeCardFieldArrayDefinition(fields) {
|
|
|
47
43
|
exports.serializeCardFieldArrayDefinition = serializeCardFieldArrayDefinition;
|
|
48
44
|
/** @ignore */
|
|
49
45
|
function deserializeFieldOption(option) {
|
|
50
|
-
return {
|
|
51
|
-
label: option['l'],
|
|
52
|
-
value: option['v'],
|
|
53
|
-
iconUrl: option['i'],
|
|
54
|
-
};
|
|
46
|
+
return Object.assign({ label: option['l'], value: option['v'], iconUrl: option['i'] }, ((0, checks_1.isDefAndNotNull)(option['ic']) && { iconUrlForCollection: option['ic'] }));
|
|
55
47
|
}
|
|
56
48
|
exports.deserializeFieldOption = deserializeFieldOption;
|
|
57
49
|
exports.isSerializedFieldOption = (0, validators_1.objectValidator)({
|