lucid-extension-sdk 0.0.192 → 0.0.196
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/datasource/datasourceutils.d.ts +1 -1
- package/core/data/datasource/datasourceutils.js +2 -1
- package/core/data/datasource/serializedimporteddatasource.d.ts +3 -0
- package/core/data/datasource/serializedimporteddatasource.js +1 -0
- package/core/data/datasource/upstreamconfig.d.ts +19 -0
- package/core/data/datasource/upstreamconfig.js +26 -0
- package/dataconnector/datasourceclient.js +11 -2
- package/dataconnector/datasourceupdatetypes.d.ts +6 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ export declare const MetadataPK = "__PK__";
|
|
|
13
13
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
14
14
|
export declare function makeSerializedImportedCollection(name: string, rawFieldNames: string[], data: SerializedFields[], upstreamConfig: {
|
|
15
15
|
[key: string]: any;
|
|
16
|
-
}, metadata?: {
|
|
16
|
+
}, dataIsPartial?: true | undefined, metadata?: {
|
|
17
17
|
[key: string]: SerializedFields[];
|
|
18
18
|
}, schemaFromData?: {
|
|
19
19
|
headerRow: number;
|
|
@@ -182,7 +182,7 @@ function makeSerializedItems(primaryKeys, rawItems, oldToNewFields, headerRow, i
|
|
|
182
182
|
return serializedItems;
|
|
183
183
|
}
|
|
184
184
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
185
|
-
function makeSerializedImportedCollection(name, rawFieldNames, data, upstreamConfig, metadata, schemaFromData) {
|
|
185
|
+
function makeSerializedImportedCollection(name, rawFieldNames, data, upstreamConfig, dataIsPartial, metadata, schemaFromData) {
|
|
186
186
|
var _a;
|
|
187
187
|
const { sheetSchema, oldToNewFields } = makePrimaryCollectionSchema(rawFieldNames, data, schemaFromData);
|
|
188
188
|
const primaryKeys = getPrimaryKeysForData(oldToNewFields, data, schemaFromData);
|
|
@@ -211,6 +211,7 @@ function makeSerializedImportedCollection(name, rawFieldNames, data, upstreamCon
|
|
|
211
211
|
'Items': makeSerializedItems(primaryKeys, data, oldToNewFields, headerRow),
|
|
212
212
|
'UpstreamConfig': upstreamConfig,
|
|
213
213
|
'Metadata': metadataCollections,
|
|
214
|
+
'DataIsPartial': dataIsPartial,
|
|
214
215
|
};
|
|
215
216
|
}
|
|
216
217
|
exports.makeSerializedImportedCollection = makeSerializedImportedCollection;
|
|
@@ -25,6 +25,7 @@ export interface SerializedImportedCollection {
|
|
|
25
25
|
'Metadata': {
|
|
26
26
|
[key: string]: SerializedImportedMetadataCollection;
|
|
27
27
|
};
|
|
28
|
+
'DataIsPartial'?: true | undefined;
|
|
28
29
|
}
|
|
29
30
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
30
31
|
export declare const isSerializedImportedCollection: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
|
|
@@ -37,6 +38,7 @@ export declare const isSerializedImportedCollection: (subject: unknown) => subje
|
|
|
37
38
|
Schema: typeof isSerializedSchema;
|
|
38
39
|
Items: typeof isSerializedDataItems;
|
|
39
40
|
}>>;
|
|
41
|
+
DataIsPartial: (x: unknown) => x is true | undefined;
|
|
40
42
|
}>;
|
|
41
43
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
42
44
|
export interface SerializedImportedDataSource {
|
|
@@ -64,5 +66,6 @@ export declare const isSerializedImportedDataSource: (subject: unknown) => subje
|
|
|
64
66
|
Schema: typeof isSerializedSchema;
|
|
65
67
|
Items: typeof isSerializedDataItems;
|
|
66
68
|
}>>;
|
|
69
|
+
DataIsPartial: (x: unknown) => x is true | undefined;
|
|
67
70
|
}>[];
|
|
68
71
|
}>;
|
|
@@ -19,6 +19,7 @@ exports.isSerializedImportedCollection = (0, validators_1.strictObjectValidator)
|
|
|
19
19
|
'Items': serializeddataitems_1.isSerializedDataItems,
|
|
20
20
|
'UpstreamConfig': checks_1.isObject,
|
|
21
21
|
'Metadata': (0, checks_1.isRecord)(exports.isSerializedImportedMetadataCollection),
|
|
22
|
+
'DataIsPartial': (0, validators_1.option)(validators_1.isTrue),
|
|
22
23
|
});
|
|
23
24
|
/** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
|
|
24
25
|
exports.isSerializedImportedDataSource = (0, validators_1.strictObjectValidator)({
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { JsonObject } from '../../jsonserializable';
|
|
2
|
+
import { DataSourceType } from './datasourcetype';
|
|
3
|
+
import { SerializedUpstreamConfig } from './serializedupstreamconfig';
|
|
4
|
+
import { UpstreamPatchType } from './upstreampatchtype';
|
|
5
|
+
import { UpstreamUpdateType } from './upstreamupdatetype';
|
|
6
|
+
export interface UpstreamConfig {
|
|
7
|
+
dataSourceType: DataSourceType;
|
|
8
|
+
updateType: UpstreamUpdateType;
|
|
9
|
+
patchType?: UpstreamPatchType | undefined;
|
|
10
|
+
sourceConfig: {
|
|
11
|
+
[index: string]: any;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare function serializeUpstreamConfig(config: UpstreamConfig): SerializedUpstreamConfig;
|
|
15
|
+
export declare function deserializeUpstreamConfig(config: SerializedUpstreamConfig): UpstreamConfig;
|
|
16
|
+
export interface SerializedSourceConfig {
|
|
17
|
+
[primaryKey: string]: JsonObject;
|
|
18
|
+
}
|
|
19
|
+
export declare function isSerializedSourceConfig(x: unknown): x is SerializedSourceConfig;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSerializedSourceConfig = exports.deserializeUpstreamConfig = exports.serializeUpstreamConfig = void 0;
|
|
4
|
+
const checks_1 = require("../../checks");
|
|
5
|
+
function serializeUpstreamConfig(config) {
|
|
6
|
+
return {
|
|
7
|
+
'SourceType': config.dataSourceType,
|
|
8
|
+
'UpdateType': config.updateType,
|
|
9
|
+
'PatchType': config.patchType,
|
|
10
|
+
'SourceConfig': config.sourceConfig,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
exports.serializeUpstreamConfig = serializeUpstreamConfig;
|
|
14
|
+
function deserializeUpstreamConfig(config) {
|
|
15
|
+
return {
|
|
16
|
+
dataSourceType: config['SourceType'],
|
|
17
|
+
updateType: config['UpdateType'],
|
|
18
|
+
patchType: config['PatchType'] === null ? undefined : config['PatchType'],
|
|
19
|
+
sourceConfig: config['SourceConfig'],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
exports.deserializeUpstreamConfig = deserializeUpstreamConfig;
|
|
23
|
+
function isSerializedSourceConfig(x) {
|
|
24
|
+
return (0, checks_1.isObject)(x);
|
|
25
|
+
}
|
|
26
|
+
exports.isSerializedSourceConfig = isSerializedSourceConfig;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MockDataSourceClient = exports.DataSourceClient = void 0;
|
|
4
4
|
const checks_1 = require("../core/checks");
|
|
5
|
+
const datasourcetype_1 = require("../core/data/datasource/datasourcetype");
|
|
6
|
+
const upstreamconfig_1 = require("../core/data/datasource/upstreamconfig");
|
|
7
|
+
const upstreamupdatetype_1 = require("../core/data/datasource/upstreamupdatetype");
|
|
5
8
|
const result_1 = require("../core/result");
|
|
6
9
|
const validators_1 = require("../core/validators/validators");
|
|
7
10
|
const dataconnector_1 = require("./dataconnector");
|
|
@@ -21,15 +24,21 @@ class DataSourceClient {
|
|
|
21
24
|
const dataSyncUrl = urls.dataSync;
|
|
22
25
|
this.metadataUrl = (0, checks_1.isString)(dataSyncUrl) ? `${dataSyncUrl}dataSource/metadata` : undefined;
|
|
23
26
|
}
|
|
24
|
-
formatBody({ dataSourceName, collections }) {
|
|
27
|
+
formatBody({ dataSourceName, collections, dataSourceConfiguration }) {
|
|
25
28
|
const updateData = {};
|
|
26
29
|
for (const collectionId in collections) {
|
|
27
30
|
updateData[collectionId] = (0, datasourceupdatetypes_1.serializeCollectionPatch)(collections[collectionId]);
|
|
28
31
|
}
|
|
32
|
+
const upstreamConfig = {
|
|
33
|
+
dataSourceType: datasourcetype_1.DataSourceType.DataService,
|
|
34
|
+
updateType: upstreamupdatetype_1.UpstreamUpdateType.EVENTPULL,
|
|
35
|
+
patchType: dataSourceConfiguration === null || dataSourceConfiguration === void 0 ? void 0 : dataSourceConfiguration.patchType,
|
|
36
|
+
sourceConfig: {},
|
|
37
|
+
};
|
|
29
38
|
return {
|
|
30
39
|
'updateData': updateData,
|
|
31
40
|
'name': dataSourceName,
|
|
32
|
-
|
|
41
|
+
'upstreamConfig': (0, upstreamconfig_1.serializeUpstreamConfig)(upstreamConfig),
|
|
33
42
|
};
|
|
34
43
|
}
|
|
35
44
|
/** Create or update a datasource. If you create a new collection it must be fully specified in terms of schema and
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UpstreamPatchType } from '../core/data/datasource/upstreampatchtype';
|
|
1
2
|
import { SerializedFieldTypeDefinition } from '../core/data/fieldtypedefinition/fieldtypedefinition';
|
|
2
3
|
import { SemanticKind } from '../core/data/fieldtypedefinition/semantickind';
|
|
3
4
|
import { FieldConstraintType } from '../core/data/serializedfield/serializedfielddefinition';
|
|
@@ -16,6 +17,11 @@ export type DataSourceRequest = {
|
|
|
16
17
|
dataSourceName: string;
|
|
17
18
|
/** Collections to add or update to the data source */
|
|
18
19
|
collections: Record<string, CollectionPatch>;
|
|
20
|
+
/** Configuration for the data source to be added or modified */
|
|
21
|
+
dataSourceConfiguration?: {
|
|
22
|
+
/** Configures how changes made to the data are pushed to the external source */
|
|
23
|
+
patchType: UpstreamPatchType;
|
|
24
|
+
};
|
|
19
25
|
};
|
|
20
26
|
type SerializedFieldConstraintForApi = {
|
|
21
27
|
'type': FieldConstraintType;
|
package/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './core/data/datasource/metadatatypes';
|
|
|
12
12
|
export * from './core/data/datasource/serializeddatasourceproperties';
|
|
13
13
|
export * from './core/data/datasource/serializedimporteddatasource';
|
|
14
14
|
export * from './core/data/datasource/serializedupstreamconfig';
|
|
15
|
+
export * from './core/data/datasource/upstreamconfig';
|
|
15
16
|
export * from './core/data/datasource/upstreampatchtype';
|
|
16
17
|
export * from './core/data/datasource/upstreamupdatetype';
|
|
17
18
|
export * from './core/data/fieldspecification';
|
package/index.js
CHANGED
|
@@ -28,6 +28,7 @@ __exportStar(require("./core/data/datasource/metadatatypes"), exports);
|
|
|
28
28
|
__exportStar(require("./core/data/datasource/serializeddatasourceproperties"), exports);
|
|
29
29
|
__exportStar(require("./core/data/datasource/serializedimporteddatasource"), exports);
|
|
30
30
|
__exportStar(require("./core/data/datasource/serializedupstreamconfig"), exports);
|
|
31
|
+
__exportStar(require("./core/data/datasource/upstreamconfig"), exports);
|
|
31
32
|
__exportStar(require("./core/data/datasource/upstreampatchtype"), exports);
|
|
32
33
|
__exportStar(require("./core/data/datasource/upstreamupdatetype"), exports);
|
|
33
34
|
__exportStar(require("./core/data/fieldspecification"), exports);
|