lucid-extension-sdk 0.0.221 → 0.0.224
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/serializedfield/serializedfields.d.ts +4 -0
- package/core/data/serializedfield/serializedfields.js +3 -3
- package/dataconnector/actions/action.d.ts +4 -0
- package/dataconnector/actions/action.js +3 -0
- package/dataconnector/actions/serializedactions.js +34 -28
- package/dataconnector/debugserver.d.ts +5 -1
- package/dataconnector/debugserver.js +3 -1
- package/package.json +1 -1
|
@@ -87,6 +87,10 @@ export declare const isSerializedLucidCurrency: (subject: unknown) => subject is
|
|
|
87
87
|
a: typeof isNumber;
|
|
88
88
|
t: typeof isString;
|
|
89
89
|
}>;
|
|
90
|
+
export declare const isSerializedMillisecondsDateObject: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
|
|
91
|
+
ms: typeof isNumber;
|
|
92
|
+
isDateOnly: (x: unknown) => x is boolean | undefined;
|
|
93
|
+
}>;
|
|
90
94
|
export declare const isSerializedLucidDateObject: (x: unknown) => x is import("../../guards").DestructureGuardedTypeObj<{
|
|
91
95
|
ms: typeof isNumber;
|
|
92
96
|
isDateOnly: (x: unknown) => x is boolean | 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.isSerializedLucidDateObject = exports.isSerializedLucidCurrency = exports.isSerializedLucidDictionary = exports.isJsonSerializedLucidDictionary = exports.isNestedSerializedLucidDictionary = exports.isSerializedColorObjectFieldType = void 0;
|
|
3
|
+
exports.isSerializedFields = exports.isSerializedJsonFieldType = exports.isSerializedFieldType = exports.isSerializedLucidDateObject = exports.isSerializedMillisecondsDateObject = 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) {
|
|
@@ -20,7 +20,7 @@ exports.isSerializedLucidCurrency = (0, validators_1.objectValidator)({
|
|
|
20
20
|
'a': checks_1.isNumber,
|
|
21
21
|
't': checks_1.isString,
|
|
22
22
|
});
|
|
23
|
-
|
|
23
|
+
exports.isSerializedMillisecondsDateObject = (0, validators_1.objectValidator)({
|
|
24
24
|
'ms': checks_1.isNumber,
|
|
25
25
|
'isDateOnly': (0, validators_1.option)(checks_1.isBoolean),
|
|
26
26
|
});
|
|
@@ -28,7 +28,7 @@ const isSerializedIsoDateObject = (0, validators_1.objectValidator)({
|
|
|
28
28
|
'isoDate': checks_1.isString,
|
|
29
29
|
'displayTimezone': (0, validators_1.option)(checks_1.isString),
|
|
30
30
|
});
|
|
31
|
-
exports.isSerializedLucidDateObject = (0, validators_1.either)(isSerializedMillisecondsDateObject, isSerializedIsoDateObject);
|
|
31
|
+
exports.isSerializedLucidDateObject = (0, validators_1.either)(exports.isSerializedMillisecondsDateObject, isSerializedIsoDateObject);
|
|
32
32
|
function isSerializedFieldType(value) {
|
|
33
33
|
return (value == null ||
|
|
34
34
|
(0, checks_1.isNumber)(value) ||
|
|
@@ -78,6 +78,8 @@ export declare class Patch {
|
|
|
78
78
|
itemsChanged: PatchItems;
|
|
79
79
|
/** List of item primary keys deleted by Lucid */
|
|
80
80
|
itemsDeleted: string[];
|
|
81
|
+
/** */
|
|
82
|
+
itemOrderChanged: [string, string | null][] | undefined;
|
|
81
83
|
/** The syncSourceId of the changed data source */
|
|
82
84
|
syncSourceId: string;
|
|
83
85
|
/** The syncCollectionId of the changed collection */
|
|
@@ -91,6 +93,8 @@ export declare class Patch {
|
|
|
91
93
|
itemsChanged: PatchItems,
|
|
92
94
|
/** List of item primary keys deleted by Lucid */
|
|
93
95
|
itemsDeleted: string[],
|
|
96
|
+
/** */
|
|
97
|
+
itemOrderChanged: [string, string | null][] | undefined,
|
|
94
98
|
/** The syncSourceId of the changed data source */
|
|
95
99
|
syncSourceId: string,
|
|
96
100
|
/** The syncCollectionId of the changed collection */
|
|
@@ -73,6 +73,8 @@ class Patch {
|
|
|
73
73
|
itemsChanged,
|
|
74
74
|
/** List of item primary keys deleted by Lucid */
|
|
75
75
|
itemsDeleted,
|
|
76
|
+
/** */
|
|
77
|
+
itemOrderChanged,
|
|
76
78
|
/** The syncSourceId of the changed data source */
|
|
77
79
|
syncSourceId,
|
|
78
80
|
/** The syncCollectionId of the changed collection */
|
|
@@ -81,6 +83,7 @@ class Patch {
|
|
|
81
83
|
this.itemsAdded = itemsAdded;
|
|
82
84
|
this.itemsChanged = itemsChanged;
|
|
83
85
|
this.itemsDeleted = itemsDeleted;
|
|
86
|
+
this.itemOrderChanged = itemOrderChanged;
|
|
84
87
|
this.syncSourceId = syncSourceId;
|
|
85
88
|
this.syncCollectionId = syncCollectionId;
|
|
86
89
|
}
|
|
@@ -6,47 +6,52 @@ const checks_1 = require("../../core/checks");
|
|
|
6
6
|
const validators_1 = require("../../core/validators/validators");
|
|
7
7
|
const action_1 = require("./action");
|
|
8
8
|
const dataconnectoractionkeys_1 = require("./dataconnectoractionkeys");
|
|
9
|
-
exports.actionsHeaderValidator = (0, validators_1.objectValidator)({
|
|
9
|
+
exports.actionsHeaderValidator = (0, validators_1.objectValidator)({
|
|
10
|
+
'x-lucid-rsa-nonce': checks_1.isString,
|
|
11
|
+
'x-lucid-signature': checks_1.isString,
|
|
12
|
+
});
|
|
10
13
|
const serializedActionsBaseValidator = (0, validators_1.objectValidator)({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
action: (0, validators_1.objectValidator)({ name: checks_1.isString, data: checks_1.isUnknown }),
|
|
15
|
+
packageId: checks_1.isString,
|
|
16
|
+
packageVersion: (0, validators_1.nullableOption)(checks_1.isString),
|
|
17
|
+
dataConnectorName: checks_1.isString,
|
|
18
|
+
installationId: (0, validators_1.nullableOption)(checks_1.isString),
|
|
19
|
+
userCredential: (0, validators_1.nullableOption)(checks_1.isString),
|
|
20
|
+
documentUpdateToken: (0, validators_1.nullableOption)(checks_1.isString),
|
|
21
|
+
documentCollections: (0, validators_1.objectOfValidator)((0, validators_1.arrayValidator)(checks_1.isString)),
|
|
22
|
+
updateFilterType: (0, validators_1.enumValidator)(dataupdatefiltertype_1.DataUpdateFilterType),
|
|
20
23
|
});
|
|
21
24
|
const serializedPatchDataValidator = (0, validators_1.objectValidator)({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
packageVersion: checks_1.isString,
|
|
26
|
+
patches: (0, validators_1.arrayValidator)((0, validators_1.objectValidator)({
|
|
27
|
+
patch: (0, validators_1.objectValidator)({
|
|
28
|
+
itemsAdded: (0, validators_1.objectOfValidator)(checks_1.isObjectUnsafe),
|
|
29
|
+
itemsChanged: (0, validators_1.objectOfValidator)(checks_1.isObjectUnsafe),
|
|
30
|
+
itemsDeleted: (0, validators_1.arrayValidator)(checks_1.isString),
|
|
31
|
+
itemOrderChanged: (0, validators_1.nullableOption)((0, validators_1.arrayValidator)((0, validators_1.tupleValidator)(checks_1.isString, (0, validators_1.nullable)(checks_1.isString)))),
|
|
32
|
+
syncSourceId: checks_1.isString,
|
|
33
|
+
syncCollectionId: checks_1.isString,
|
|
34
|
+
adapterType: (0, checks_1.isLiteral)('EXTENSION_API'),
|
|
35
|
+
syncSchema: checks_1.isUnknown,
|
|
32
36
|
}),
|
|
33
|
-
|
|
37
|
+
id: checks_1.isString,
|
|
34
38
|
})),
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
userCredential: checks_1.isString,
|
|
40
|
+
documentUpdateToken: checks_1.isString,
|
|
37
41
|
});
|
|
38
42
|
const parseSerializedPatches = (patches) => {
|
|
39
43
|
return patches.map((patch) => {
|
|
44
|
+
var _a;
|
|
40
45
|
const p = patch['patch'];
|
|
41
|
-
return new action_1.Patch(patch['id'], p['itemsAdded'], p['itemsChanged'], p['itemsDeleted'], p['syncSourceId'], p['syncCollectionId']);
|
|
46
|
+
return new action_1.Patch(patch['id'], p['itemsAdded'], p['itemsChanged'], p['itemsDeleted'], (_a = p['itemOrderChanged']) !== null && _a !== void 0 ? _a : undefined, p['syncSourceId'], p['syncCollectionId']);
|
|
42
47
|
});
|
|
43
48
|
};
|
|
44
49
|
const serializedManageWebhookDataValidator = (0, validators_1.objectValidator)({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
webhooks: (0, validators_1.arrayValidator)((0, validators_1.objectValidator)({
|
|
51
|
+
documentCollections: (0, validators_1.objectOfValidator)((0, validators_1.arrayValidator)(checks_1.isString)),
|
|
52
|
+
webhookData: (0, validators_1.option)(checks_1.isUnknown),
|
|
48
53
|
})),
|
|
49
|
-
|
|
54
|
+
webhookToken: checks_1.isString,
|
|
50
55
|
});
|
|
51
56
|
/** Function to convert the lucid action wire format into a clean list of actions */
|
|
52
57
|
function deserializeActions(client, actions) {
|
|
@@ -57,6 +62,7 @@ function deserializeActions(client, actions) {
|
|
|
57
62
|
const data = actions['action']['data'];
|
|
58
63
|
if (name === dataconnectoractionkeys_1.DataConnectorActionKeys.Patch) {
|
|
59
64
|
if (!(0, validators_1.arrayValidator)(serializedPatchDataValidator)(data)) {
|
|
65
|
+
console.log(`Failing validation step`);
|
|
60
66
|
return;
|
|
61
67
|
}
|
|
62
68
|
return data.map((item) => {
|
|
@@ -22,7 +22,11 @@ export type ExpressAppLike = {
|
|
|
22
22
|
end: () => unknown;
|
|
23
23
|
};
|
|
24
24
|
}) => Promise<void>) => unknown;
|
|
25
|
-
listen: (port: number
|
|
25
|
+
listen: (port: number, x: () => unknown) => {
|
|
26
|
+
address: () => {
|
|
27
|
+
port: number;
|
|
28
|
+
} | string | null;
|
|
29
|
+
};
|
|
26
30
|
};
|
|
27
31
|
/**
|
|
28
32
|
* Options for how to run the debug server
|
|
@@ -70,7 +70,9 @@ exports.routeDebugServer = routeDebugServer;
|
|
|
70
70
|
function runDebugServer(dataConnector, options) {
|
|
71
71
|
var _a;
|
|
72
72
|
const port = (_a = options.port) !== null && _a !== void 0 ? _a : 3001;
|
|
73
|
-
routeDebugServer(dataConnector, options).listen(port, () => {
|
|
73
|
+
const server = routeDebugServer(dataConnector, options).listen(port, () => {
|
|
74
|
+
const address = server.address();
|
|
75
|
+
const port = typeof address === 'string' ? address : address === null || address === void 0 ? void 0 : address.port;
|
|
74
76
|
console.log(`Listening on port ${port}`);
|
|
75
77
|
});
|
|
76
78
|
}
|