lucid-extension-sdk 0.0.195 → 0.0.197
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/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/document/imagedefinition.d.ts +15 -0
- package/document/imagedefinition.js +2 -0
- package/document/pageproxy.d.ts +2 -0
- package/document/pageproxy.js +4 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SimpleImageFill } from '../core/properties/fillcolor';
|
|
2
|
+
import { Box } from '../math';
|
|
3
|
+
/**
|
|
4
|
+
* The information required to create a new image block on the current document
|
|
5
|
+
*/
|
|
6
|
+
export interface ImageDefinition {
|
|
7
|
+
/**
|
|
8
|
+
* The initial location and size of the block on the page.
|
|
9
|
+
*/
|
|
10
|
+
boundingBox: Box;
|
|
11
|
+
/**
|
|
12
|
+
* Settings for using an image as the fill style of a block.
|
|
13
|
+
*/
|
|
14
|
+
fillStyle: SimpleImageFill;
|
|
15
|
+
}
|
package/document/pageproxy.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { BlockProxy } from './blockproxy';
|
|
|
6
6
|
import { RuleProxy } from './documentelement/ruleproxy';
|
|
7
7
|
import { ElementProxy } from './elementproxy';
|
|
8
8
|
import { GroupProxy } from './groupproxy';
|
|
9
|
+
import { ImageDefinition } from './imagedefinition';
|
|
9
10
|
import { LineDefinition } from './linedefinition';
|
|
10
11
|
import { LineProxy } from './lineproxy';
|
|
11
12
|
import { MapProxy } from './mapproxy';
|
|
@@ -72,6 +73,7 @@ export declare class PageProxy extends ElementProxy {
|
|
|
72
73
|
* @returns The added line
|
|
73
74
|
*/
|
|
74
75
|
addLine(def: LineDefinition): LineProxy;
|
|
76
|
+
addImage(def: ImageDefinition): Promise<BlockProxy>;
|
|
75
77
|
/**
|
|
76
78
|
* Updates the page of this page
|
|
77
79
|
* @param title The new title for this page
|
package/document/pageproxy.js
CHANGED
|
@@ -113,6 +113,10 @@ class PageProxy extends elementproxy_1.ElementProxy {
|
|
|
113
113
|
line.setEndpoint2(def.endpoint2);
|
|
114
114
|
return line;
|
|
115
115
|
}
|
|
116
|
+
async addImage(def) {
|
|
117
|
+
await this.client.loadBlockClasses(['UserImage2Block']);
|
|
118
|
+
return this.addBlock(Object.assign({ className: 'UserImage2Block' }, def));
|
|
119
|
+
}
|
|
116
120
|
/**
|
|
117
121
|
* Updates the page of this page
|
|
118
122
|
* @param title The new title for this page
|
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);
|