lucid-extension-sdk 0.0.195 → 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.
@@ -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
- // ...upstreamConfig,
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.195",
3
+ "version": "0.0.196",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",