@hpcc-js/marshaller 2.28.7 → 2.28.9
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/LICENSE +43 -43
- package/dist/index.es6.js +25 -13
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +25 -13
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/package.json +14 -14
- package/src/__package__.ts +3 -3
- package/src/dashy.css +239 -239
- package/src/dashy.ts +521 -521
- package/src/ddl1/DDLApi.ts +229 -229
- package/src/ddl1/FlyoutButton.ts +120 -120
- package/src/ddl1/Graph.ts +93 -93
- package/src/ddl1/HTML.ts +77 -77
- package/src/ddl1/HipieDDL.ts +2437 -2437
- package/src/ddl1/HipieDDLMixin.ts +380 -380
- package/src/ddl1/Tabbed.ts +91 -91
- package/src/ddl1/TargetMarshaller.ts +57 -57
- package/src/ddl2/PopupManager.ts +89 -89
- package/src/ddl2/activities/activity.ts +431 -431
- package/src/ddl2/activities/databomb.ts +237 -237
- package/src/ddl2/activities/datasource.ts +52 -52
- package/src/ddl2/activities/dspicker.ts +106 -106
- package/src/ddl2/activities/filter.ts +542 -542
- package/src/ddl2/activities/form.ts +153 -153
- package/src/ddl2/activities/groupby.ts +439 -439
- package/src/ddl2/activities/hipiepipeline.ts +114 -114
- package/src/ddl2/activities/limit.ts +49 -49
- package/src/ddl2/activities/logicalfile.ts +62 -62
- package/src/ddl2/activities/nullview.ts +12 -12
- package/src/ddl2/activities/project.ts +764 -764
- package/src/ddl2/activities/rest.ts +568 -568
- package/src/ddl2/activities/roxie.ts +490 -490
- package/src/ddl2/activities/sampledata.json +16264 -16264
- package/src/ddl2/activities/sort.ts +176 -176
- package/src/ddl2/activities/wuresult.ts +395 -395
- package/src/ddl2/dashboard.css +13 -13
- package/src/ddl2/dashboard.ts +330 -330
- package/src/ddl2/dashboardDockPanel.ts +123 -123
- package/src/ddl2/dashboardGrid.ts +202 -202
- package/src/ddl2/ddl.ts +410 -410
- package/src/ddl2/ddleditor.ts +60 -60
- package/src/ddl2/dsTable.ts +238 -238
- package/src/ddl2/dvTable.ts +31 -31
- package/src/ddl2/graphadapter.ts +297 -297
- package/src/ddl2/javascriptadapter.ts +354 -354
- package/src/ddl2/model/element.ts +398 -398
- package/src/ddl2/model/visualization.ts +351 -351
- package/src/ddl2/model/vizChartPanel.ts +149 -149
- package/src/ddl2/pipelinePanel.css +4 -4
- package/src/ddl2/pipelinePanel.ts +465 -465
- package/src/index.ts +26 -26
- package/types/__package__.d.ts +2 -2
- package/types-3.4/__package__.d.ts +2 -2
package/src/ddl2/ddl.ts
CHANGED
|
@@ -1,410 +1,410 @@
|
|
|
1
|
-
import { DDL2 } from "@hpcc-js/ddl-shim";
|
|
2
|
-
import { scopedLogger } from "@hpcc-js/util";
|
|
3
|
-
import { BUILD_VERSION, PKG_NAME, PKG_VERSION } from "../__package__";
|
|
4
|
-
import { ActivityPipeline, ReferencedFields } from "./activities/activity";
|
|
5
|
-
import { Databomb } from "./activities/databomb";
|
|
6
|
-
import { DatasourceRef, DatasourceRefType, DatasourceType } from "./activities/datasource";
|
|
7
|
-
import { DSPicker } from "./activities/dspicker";
|
|
8
|
-
import { Filters } from "./activities/filter";
|
|
9
|
-
import { Form } from "./activities/form";
|
|
10
|
-
import { GroupBy } from "./activities/groupby";
|
|
11
|
-
import { Limit } from "./activities/limit";
|
|
12
|
-
import { LogicalFile } from "./activities/logicalfile";
|
|
13
|
-
import { Mappings, Project } from "./activities/project";
|
|
14
|
-
import { Param, RestResult, RestResultRef, RestService } from "./activities/rest";
|
|
15
|
-
import { HipieResultRef, RoxieResult, RoxieResultRef, RoxieService } from "./activities/roxie";
|
|
16
|
-
import { Sort } from "./activities/sort";
|
|
17
|
-
import { WU, WUResult, WUResultRef } from "./activities/wuresult";
|
|
18
|
-
import { Dashboard } from "./dashboard";
|
|
19
|
-
import { Element, ElementContainer } from "./model/element";
|
|
20
|
-
import { Visualization } from "./model/visualization";
|
|
21
|
-
|
|
22
|
-
const logger = scopedLogger("marshaller/ddl2/ddl");
|
|
23
|
-
|
|
24
|
-
type DatasourceRefTypeMap = { [key: string]: { refType: DatasourceRefType, ref: DatasourceRef } };
|
|
25
|
-
type ServerRefTypeMap = { [key: string]: { ds: DatasourceType, result: DatasourceRefTypeMap } };
|
|
26
|
-
|
|
27
|
-
class DDLDatasourceAdapter {
|
|
28
|
-
private _dsDedup: ServerRefTypeMap;
|
|
29
|
-
|
|
30
|
-
constructor() {
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
clear() {
|
|
34
|
-
this._dsDedup = {};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
id(dsT: DatasourceType): string {
|
|
38
|
-
if (dsT instanceof WU) {
|
|
39
|
-
return `${dsT.url()}/${dsT.wuid()}`;
|
|
40
|
-
} else if (dsT instanceof RoxieService) {
|
|
41
|
-
return `${dsT.url()}/${dsT.querySet()}/${dsT.queryID()}`;
|
|
42
|
-
} else if (dsT instanceof RestService) {
|
|
43
|
-
return `${dsT.url()}/${dsT.action()}`;
|
|
44
|
-
}
|
|
45
|
-
return dsT.id();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
_resolveID(dsT: DatasourceType): string {
|
|
49
|
-
return this._dsDedup[this.id(dsT)].ds.id();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
resolveID(dsRef: DatasourceRef): string | undefined {
|
|
53
|
-
if (dsRef instanceof WUResultRef) {
|
|
54
|
-
return this._resolveID(dsRef.datasource().wu());
|
|
55
|
-
} else if (dsRef instanceof RoxieResultRef) {
|
|
56
|
-
return this._resolveID(dsRef.datasource().service());
|
|
57
|
-
} else if (dsRef instanceof HipieResultRef) {
|
|
58
|
-
return this._resolveID(dsRef.datasource().service());
|
|
59
|
-
} else if (dsRef instanceof RestResultRef) {
|
|
60
|
-
return this._resolveID(dsRef.datasource().service());
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
append(pDS: DSPicker | DatasourceRefType) {
|
|
65
|
-
const refType: DatasourceRefType = pDS instanceof DSPicker ? pDS.datasource() : pDS;
|
|
66
|
-
const ref: DatasourceRef = pDS instanceof DSPicker ? pDS.datasourceRef() : undefined;
|
|
67
|
-
const dsTID = refType.id();
|
|
68
|
-
const ds: DatasourceType = refType instanceof WUResult ? refType.wu() : refType instanceof RoxieResult ? refType.service() : refType instanceof RestResult ? refType.service() : refType;
|
|
69
|
-
const dsID = this.id(ds);
|
|
70
|
-
if (!this._dsDedup[dsID]) {
|
|
71
|
-
this._dsDedup[dsID] = {
|
|
72
|
-
ds,
|
|
73
|
-
result: {}
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
if (!this._dsDedup[dsID].result[dsTID]) {
|
|
77
|
-
this._dsDedup[dsID].result[dsTID] = {
|
|
78
|
-
refType,
|
|
79
|
-
ref
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
getAll(): DDL2.DatasourceType[] {
|
|
85
|
-
const retVal: DDL2.DatasourceType[] = [];
|
|
86
|
-
for (const key in this._dsDedup) {
|
|
87
|
-
const ddl = this._dsDedup[key].ds.toDDL();
|
|
88
|
-
|
|
89
|
-
// Inputs ---
|
|
90
|
-
if (ddl.type === "roxie" || ddl.type === "hipie" || ddl.type === "rest") {
|
|
91
|
-
const inputs: { [fieldID: string]: DDL2.IField } = {};
|
|
92
|
-
for (const key2 in this._dsDedup[key].result) {
|
|
93
|
-
const ddl2 = this._dsDedup[key].result[key2].refType.toDDL();
|
|
94
|
-
const refs: ReferencedFields = {
|
|
95
|
-
inputs: {},
|
|
96
|
-
outputs: {}
|
|
97
|
-
};
|
|
98
|
-
this._dsDedup[key].result[key2].ref.referencedFields(refs);
|
|
99
|
-
for (const inElementID in refs.inputs) {
|
|
100
|
-
refs.inputs[inElementID].forEach(fieldID => {
|
|
101
|
-
inputs[fieldID] = (ddl2 as any).inputs.filter(row => row.id === fieldID)[0];
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
ddl.inputs = [];
|
|
106
|
-
for (const key in inputs) {
|
|
107
|
-
ddl.inputs.push(inputs[key]);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Outputs ---
|
|
112
|
-
if (ddl.type === "wuresult" || ddl.type === "roxie" || ddl.type === "hipie" || ddl.type === "rest") {
|
|
113
|
-
const outputs: { [fieldID: string]: DDL2.IOutput } = {};
|
|
114
|
-
for (const key2 in this._dsDedup[key].result) {
|
|
115
|
-
const ddl2 = this._dsDedup[key].result[key2].refType.toDDL();
|
|
116
|
-
if (ddl2.type === "wuresult" || ddl2.type === "roxie" || ddl2.type === "hipie" || ddl2.type === "rest") {
|
|
117
|
-
for (const outputID in ddl2.outputs) {
|
|
118
|
-
outputs[outputID] = ddl2.outputs[outputID];
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
ddl.outputs = {};
|
|
123
|
-
for (const key in outputs) {
|
|
124
|
-
ddl.outputs[key] = outputs[key];
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
retVal.push(ddl);
|
|
128
|
-
}
|
|
129
|
-
return retVal;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export class DDLAdapter {
|
|
134
|
-
private _dashboard: Dashboard;
|
|
135
|
-
private _ec: ElementContainer;
|
|
136
|
-
private _dsWriteDedup: DDLDatasourceAdapter = new DDLDatasourceAdapter();
|
|
137
|
-
private _dsReadDedup: { [id: string]: WU | RoxieService | RestService } = {};
|
|
138
|
-
|
|
139
|
-
constructor(dashboard: Dashboard) {
|
|
140
|
-
this._dashboard = dashboard;
|
|
141
|
-
this._ec = this._dashboard.elementContainer();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
writeDatasources(): DDL2.DatasourceType[] {
|
|
145
|
-
for (const viz of this._ec.elements()) {
|
|
146
|
-
this._dsWriteDedup.append(viz.hipiePipeline().datasource());
|
|
147
|
-
}
|
|
148
|
-
return this._dsWriteDedup.getAll();
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
writeFilters(filters: Filters): DDL2.IFilter {
|
|
152
|
-
if (!filters.exists()) return undefined;
|
|
153
|
-
return filters.toDDL();
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
readFilters(ddlFilter: DDL2.IFilter, ec: ElementContainer): Filters {
|
|
157
|
-
return Filters.fromDDL(ec, ddlFilter);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
writeProject(project: Project): DDL2.IProject {
|
|
161
|
-
if (!project.exists()) return undefined;
|
|
162
|
-
return project.toDDL();
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
readProject(ddlProject: DDL2.IProject): Project {
|
|
166
|
-
return Project.fromDDL(ddlProject);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
writeMappings(mappings: Mappings): DDL2.IMappings {
|
|
170
|
-
if (!mappings.exists()) return { type: "mappings", transformations: [] };
|
|
171
|
-
return mappings.toDDL();
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
readMappings(ddlProject: DDL2.IMappings): Mappings {
|
|
175
|
-
return Mappings.fromDDL(ddlProject);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
writeGroupBy(gb: GroupBy): DDL2.IGroupBy {
|
|
179
|
-
if (!gb.exists()) return undefined;
|
|
180
|
-
return gb.toDDL();
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
readGroupBy(ddlGB: DDL2.IGroupBy): GroupBy {
|
|
184
|
-
return GroupBy.fromDDL(ddlGB);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
writeSort(sort: Sort): DDL2.ISort {
|
|
188
|
-
if (!sort.exists()) return undefined;
|
|
189
|
-
return sort.toDDL();
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
readSort(ddlSort: DDL2.ISort): Sort {
|
|
193
|
-
return Sort.fromDDL(ddlSort);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
writeLimit(limit: Limit): DDL2.ILimit {
|
|
197
|
-
if (!limit.exists()) return undefined;
|
|
198
|
-
return limit.toDDL();
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
readLimit(ddlLimit: DDL2.ILimit): Limit {
|
|
202
|
-
return Limit.fromDDL(ddlLimit);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
readDatasourceRef(ddlDSRef: DDL2.IDatasourceRef, dsPicker: DSPicker, elementContainer: ElementContainer): this {
|
|
206
|
-
if (DDL2.isWUResultRef(ddlDSRef)) {
|
|
207
|
-
const wu = this._dsReadDedup[ddlDSRef.id] as WU;
|
|
208
|
-
dsPicker.datasourceID(wu.output(ddlDSRef.output).id());
|
|
209
|
-
} else if (DDL2.isRoxieServiceRef(ddlDSRef)) {
|
|
210
|
-
dsPicker.datasourceID(`${ddlDSRef.id}_${ddlDSRef.output}`);
|
|
211
|
-
const dsRef = dsPicker.datasourceRef() as RoxieResultRef | RestResultRef;
|
|
212
|
-
dsRef
|
|
213
|
-
.request(ddlDSRef.request.map(rf => {
|
|
214
|
-
return Param.fromDDL(this._ec, rf);
|
|
215
|
-
}))
|
|
216
|
-
;
|
|
217
|
-
} else {
|
|
218
|
-
dsPicker.datasourceID(ddlDSRef.id);
|
|
219
|
-
}
|
|
220
|
-
return this;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
writeActivities(view: ActivityPipeline): DDL2.ActivityType[] {
|
|
224
|
-
return view.activities().map(activity => {
|
|
225
|
-
if (activity instanceof Filters) {
|
|
226
|
-
return this.writeFilters(activity);
|
|
227
|
-
} else if (activity instanceof Project) {
|
|
228
|
-
return this.writeProject(activity);
|
|
229
|
-
} else if (activity instanceof GroupBy) {
|
|
230
|
-
return this.writeGroupBy(activity);
|
|
231
|
-
} else if (activity instanceof Sort) {
|
|
232
|
-
return this.writeSort(activity);
|
|
233
|
-
} else if (activity instanceof Limit) {
|
|
234
|
-
return this.writeLimit(activity);
|
|
235
|
-
} else if (activity instanceof Mappings) {
|
|
236
|
-
return this.writeMappings(activity);
|
|
237
|
-
} else if (activity instanceof DSPicker) {
|
|
238
|
-
// Fall through ---
|
|
239
|
-
} else {
|
|
240
|
-
logger.warning(`Unknown activity type: ${activity.classID()}`);
|
|
241
|
-
}
|
|
242
|
-
}).filter(activity => !!activity);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
writeVisualization(visualization: Visualization): DDL2.IVisualization {
|
|
246
|
-
return {
|
|
247
|
-
id: visualization.chartPanel().id(),
|
|
248
|
-
title: visualization.title(),
|
|
249
|
-
description: visualization.description(),
|
|
250
|
-
visibility: visualization.visibility(),
|
|
251
|
-
chartType: visualization.chartType(),
|
|
252
|
-
__class: visualization.chartPanel().widget().classID(),
|
|
253
|
-
mappings: this.writeMappings(visualization.mappings()),
|
|
254
|
-
properties: visualization.properties(),
|
|
255
|
-
secondaryDataviewID: visualization.secondaryDataviewID()
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
readVisualization(ddlViz: DDL2.IVisualization, visualization: Visualization): this {
|
|
260
|
-
const mappings = this.readMappings(ddlViz.mappings);
|
|
261
|
-
visualization.chartPanel().id(ddlViz.id);
|
|
262
|
-
visualization
|
|
263
|
-
.title(ddlViz.title)
|
|
264
|
-
.description(ddlViz.description)
|
|
265
|
-
.visibility(ddlViz.visibility)
|
|
266
|
-
.chartType(ddlViz.chartType as any)
|
|
267
|
-
.properties(ddlViz.properties)
|
|
268
|
-
.mappings(mappings)
|
|
269
|
-
.secondaryDataviewID(ddlViz.secondaryDataviewID)
|
|
270
|
-
;
|
|
271
|
-
return this;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
writeViewDatasource(dsRef: DatasourceRef) {
|
|
275
|
-
const retVal = dsRef.toDDL();
|
|
276
|
-
retVal.id = this._dsWriteDedup.resolveID(dsRef) || retVal.id;
|
|
277
|
-
return retVal;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
writeDDLViews(): DDL2.IView[] {
|
|
281
|
-
// Gather referenced fields ---
|
|
282
|
-
const refFields: ReferencedFields = { inputs: {}, outputs: {} };
|
|
283
|
-
for (const element of this._ec.elements()) {
|
|
284
|
-
element.visualization().mappings().referencedFields(refFields);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
return this._ec.elements().map(element => {
|
|
288
|
-
const view = element.hipiePipeline();
|
|
289
|
-
const dsPicker = view.datasource();
|
|
290
|
-
if (dsPicker instanceof DSPicker) {
|
|
291
|
-
const dsRef = dsPicker.datasourceRef();
|
|
292
|
-
const retVal = {
|
|
293
|
-
id: element.id(),
|
|
294
|
-
datasource: this.writeViewDatasource(dsRef),
|
|
295
|
-
activities: this.writeActivities(view),
|
|
296
|
-
visualization: this.writeVisualization(element.visualization())
|
|
297
|
-
};
|
|
298
|
-
return retVal;
|
|
299
|
-
}
|
|
300
|
-
throw new Error("Missing DSPicker?");
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
writeProperties(): DDL2.IProperties {
|
|
305
|
-
return {
|
|
306
|
-
name: PKG_NAME,
|
|
307
|
-
version: PKG_VERSION,
|
|
308
|
-
buildVersion: BUILD_VERSION,
|
|
309
|
-
layout: this._dashboard.layout() as any
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
readDDLViews(ddlViews: DDL2.IView[]) {
|
|
314
|
-
for (const ddlView of ddlViews) {
|
|
315
|
-
const element = new Element(this._ec).id(ddlView.id);
|
|
316
|
-
this._ec.append(element);
|
|
317
|
-
const hipiePipeline = element.hipiePipeline();
|
|
318
|
-
this.readDatasourceRef(ddlView.datasource, hipiePipeline.datasource() as DSPicker, this._ec);
|
|
319
|
-
for (const activity of ddlView.activities) {
|
|
320
|
-
if (DDL2.isProjectActivity(activity)) {
|
|
321
|
-
const project = this.readProject(activity);
|
|
322
|
-
hipiePipeline.project(project);
|
|
323
|
-
}
|
|
324
|
-
if (DDL2.isFilterActivity(activity)) {
|
|
325
|
-
const filters = this.readFilters(activity, this._ec);
|
|
326
|
-
hipiePipeline.filters(filters);
|
|
327
|
-
}
|
|
328
|
-
if (DDL2.isGroupByActivity(activity)) {
|
|
329
|
-
const groupBy = this.readGroupBy(activity);
|
|
330
|
-
hipiePipeline.groupBy(groupBy);
|
|
331
|
-
}
|
|
332
|
-
if (DDL2.isSortActivity(activity)) {
|
|
333
|
-
const sort = this.readSort(activity);
|
|
334
|
-
hipiePipeline.sort(sort);
|
|
335
|
-
}
|
|
336
|
-
if (DDL2.isLimitActivity(activity)) {
|
|
337
|
-
const limit = this.readLimit(activity);
|
|
338
|
-
hipiePipeline.limit(limit);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
this.readVisualization(ddlView.visualization, element.visualization());
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
readProperties(properties: DDL2.IProperties) {
|
|
346
|
-
if (properties && properties.layout) {
|
|
347
|
-
this._dashboard.layoutObj(properties.layout as object);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
write(): DDL2.Schema {
|
|
352
|
-
this._dsWriteDedup.clear();
|
|
353
|
-
const retVal: DDL2.Schema = {
|
|
354
|
-
version: "2.2.1",
|
|
355
|
-
createdBy: {
|
|
356
|
-
name: PKG_NAME,
|
|
357
|
-
version: PKG_VERSION
|
|
358
|
-
},
|
|
359
|
-
datasources: this.writeDatasources(),
|
|
360
|
-
dataviews: this.writeDDLViews(),
|
|
361
|
-
properties: this.writeProperties(),
|
|
362
|
-
hipieProperties: this._dashboard.hipieProps()
|
|
363
|
-
};
|
|
364
|
-
return retVal;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
read(ddl: DDL2.Schema) {
|
|
368
|
-
this._dsWriteDedup.clear();
|
|
369
|
-
for (const ddlDS of ddl.datasources) {
|
|
370
|
-
switch (ddlDS.type) {
|
|
371
|
-
case "databomb":
|
|
372
|
-
this._ec.appendDatasource(Databomb.fromDDL(ddlDS));
|
|
373
|
-
break;
|
|
374
|
-
case "form":
|
|
375
|
-
this._ec.appendDatasource(Form.fromDDL(ddlDS));
|
|
376
|
-
break;
|
|
377
|
-
case "logicalfile":
|
|
378
|
-
this._ec.appendDatasource(LogicalFile.fromDDL(this._ec, ddlDS));
|
|
379
|
-
break;
|
|
380
|
-
case "wuresult":
|
|
381
|
-
const wu = WU.fromDDL(this._ec, ddlDS);
|
|
382
|
-
this._dsReadDedup[wu.id()] = wu;
|
|
383
|
-
for (const resultName in ddlDS.outputs) {
|
|
384
|
-
this._ec.appendDatasource(wu.output(resultName));
|
|
385
|
-
}
|
|
386
|
-
break;
|
|
387
|
-
case "roxie":
|
|
388
|
-
case "hipie":
|
|
389
|
-
const rs = RoxieService.fromDDL(this._ec, ddlDS);
|
|
390
|
-
this._dsReadDedup[rs.id()] = rs;
|
|
391
|
-
for (const resultName in ddlDS.outputs) {
|
|
392
|
-
this._ec.appendDatasource(RoxieResult.fromDDL(this._ec, rs, resultName));
|
|
393
|
-
}
|
|
394
|
-
break;
|
|
395
|
-
case "rest":
|
|
396
|
-
const rs2 = RestService.fromDDL(this._ec, ddlDS);
|
|
397
|
-
this._dsReadDedup[rs2.id()] = rs2;
|
|
398
|
-
for (const resultName in ddlDS.outputs) {
|
|
399
|
-
this._ec.appendDatasource(RestResult.fromDDL(this._ec, rs2, resultName));
|
|
400
|
-
}
|
|
401
|
-
break;
|
|
402
|
-
default:
|
|
403
|
-
logger.warning(`Unknown ddl datasource type: ${(ddlDS as any).type} `);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
this.readDDLViews(ddl.dataviews);
|
|
407
|
-
this.readProperties(ddl.properties);
|
|
408
|
-
this._dashboard.hipieProps(ddl.hipieProperties);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
1
|
+
import { DDL2 } from "@hpcc-js/ddl-shim";
|
|
2
|
+
import { scopedLogger } from "@hpcc-js/util";
|
|
3
|
+
import { BUILD_VERSION, PKG_NAME, PKG_VERSION } from "../__package__";
|
|
4
|
+
import { ActivityPipeline, ReferencedFields } from "./activities/activity";
|
|
5
|
+
import { Databomb } from "./activities/databomb";
|
|
6
|
+
import { DatasourceRef, DatasourceRefType, DatasourceType } from "./activities/datasource";
|
|
7
|
+
import { DSPicker } from "./activities/dspicker";
|
|
8
|
+
import { Filters } from "./activities/filter";
|
|
9
|
+
import { Form } from "./activities/form";
|
|
10
|
+
import { GroupBy } from "./activities/groupby";
|
|
11
|
+
import { Limit } from "./activities/limit";
|
|
12
|
+
import { LogicalFile } from "./activities/logicalfile";
|
|
13
|
+
import { Mappings, Project } from "./activities/project";
|
|
14
|
+
import { Param, RestResult, RestResultRef, RestService } from "./activities/rest";
|
|
15
|
+
import { HipieResultRef, RoxieResult, RoxieResultRef, RoxieService } from "./activities/roxie";
|
|
16
|
+
import { Sort } from "./activities/sort";
|
|
17
|
+
import { WU, WUResult, WUResultRef } from "./activities/wuresult";
|
|
18
|
+
import { Dashboard } from "./dashboard";
|
|
19
|
+
import { Element, ElementContainer } from "./model/element";
|
|
20
|
+
import { Visualization } from "./model/visualization";
|
|
21
|
+
|
|
22
|
+
const logger = scopedLogger("marshaller/ddl2/ddl");
|
|
23
|
+
|
|
24
|
+
type DatasourceRefTypeMap = { [key: string]: { refType: DatasourceRefType, ref: DatasourceRef } };
|
|
25
|
+
type ServerRefTypeMap = { [key: string]: { ds: DatasourceType, result: DatasourceRefTypeMap } };
|
|
26
|
+
|
|
27
|
+
class DDLDatasourceAdapter {
|
|
28
|
+
private _dsDedup: ServerRefTypeMap;
|
|
29
|
+
|
|
30
|
+
constructor() {
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
clear() {
|
|
34
|
+
this._dsDedup = {};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
id(dsT: DatasourceType): string {
|
|
38
|
+
if (dsT instanceof WU) {
|
|
39
|
+
return `${dsT.url()}/${dsT.wuid()}`;
|
|
40
|
+
} else if (dsT instanceof RoxieService) {
|
|
41
|
+
return `${dsT.url()}/${dsT.querySet()}/${dsT.queryID()}`;
|
|
42
|
+
} else if (dsT instanceof RestService) {
|
|
43
|
+
return `${dsT.url()}/${dsT.action()}`;
|
|
44
|
+
}
|
|
45
|
+
return dsT.id();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
_resolveID(dsT: DatasourceType): string {
|
|
49
|
+
return this._dsDedup[this.id(dsT)].ds.id();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
resolveID(dsRef: DatasourceRef): string | undefined {
|
|
53
|
+
if (dsRef instanceof WUResultRef) {
|
|
54
|
+
return this._resolveID(dsRef.datasource().wu());
|
|
55
|
+
} else if (dsRef instanceof RoxieResultRef) {
|
|
56
|
+
return this._resolveID(dsRef.datasource().service());
|
|
57
|
+
} else if (dsRef instanceof HipieResultRef) {
|
|
58
|
+
return this._resolveID(dsRef.datasource().service());
|
|
59
|
+
} else if (dsRef instanceof RestResultRef) {
|
|
60
|
+
return this._resolveID(dsRef.datasource().service());
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
append(pDS: DSPicker | DatasourceRefType) {
|
|
65
|
+
const refType: DatasourceRefType = pDS instanceof DSPicker ? pDS.datasource() : pDS;
|
|
66
|
+
const ref: DatasourceRef = pDS instanceof DSPicker ? pDS.datasourceRef() : undefined;
|
|
67
|
+
const dsTID = refType.id();
|
|
68
|
+
const ds: DatasourceType = refType instanceof WUResult ? refType.wu() : refType instanceof RoxieResult ? refType.service() : refType instanceof RestResult ? refType.service() : refType;
|
|
69
|
+
const dsID = this.id(ds);
|
|
70
|
+
if (!this._dsDedup[dsID]) {
|
|
71
|
+
this._dsDedup[dsID] = {
|
|
72
|
+
ds,
|
|
73
|
+
result: {}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (!this._dsDedup[dsID].result[dsTID]) {
|
|
77
|
+
this._dsDedup[dsID].result[dsTID] = {
|
|
78
|
+
refType,
|
|
79
|
+
ref
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
getAll(): DDL2.DatasourceType[] {
|
|
85
|
+
const retVal: DDL2.DatasourceType[] = [];
|
|
86
|
+
for (const key in this._dsDedup) {
|
|
87
|
+
const ddl = this._dsDedup[key].ds.toDDL();
|
|
88
|
+
|
|
89
|
+
// Inputs ---
|
|
90
|
+
if (ddl.type === "roxie" || ddl.type === "hipie" || ddl.type === "rest") {
|
|
91
|
+
const inputs: { [fieldID: string]: DDL2.IField } = {};
|
|
92
|
+
for (const key2 in this._dsDedup[key].result) {
|
|
93
|
+
const ddl2 = this._dsDedup[key].result[key2].refType.toDDL();
|
|
94
|
+
const refs: ReferencedFields = {
|
|
95
|
+
inputs: {},
|
|
96
|
+
outputs: {}
|
|
97
|
+
};
|
|
98
|
+
this._dsDedup[key].result[key2].ref.referencedFields(refs);
|
|
99
|
+
for (const inElementID in refs.inputs) {
|
|
100
|
+
refs.inputs[inElementID].forEach(fieldID => {
|
|
101
|
+
inputs[fieldID] = (ddl2 as any).inputs.filter(row => row.id === fieldID)[0];
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
ddl.inputs = [];
|
|
106
|
+
for (const key in inputs) {
|
|
107
|
+
ddl.inputs.push(inputs[key]);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Outputs ---
|
|
112
|
+
if (ddl.type === "wuresult" || ddl.type === "roxie" || ddl.type === "hipie" || ddl.type === "rest") {
|
|
113
|
+
const outputs: { [fieldID: string]: DDL2.IOutput } = {};
|
|
114
|
+
for (const key2 in this._dsDedup[key].result) {
|
|
115
|
+
const ddl2 = this._dsDedup[key].result[key2].refType.toDDL();
|
|
116
|
+
if (ddl2.type === "wuresult" || ddl2.type === "roxie" || ddl2.type === "hipie" || ddl2.type === "rest") {
|
|
117
|
+
for (const outputID in ddl2.outputs) {
|
|
118
|
+
outputs[outputID] = ddl2.outputs[outputID];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
ddl.outputs = {};
|
|
123
|
+
for (const key in outputs) {
|
|
124
|
+
ddl.outputs[key] = outputs[key];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
retVal.push(ddl);
|
|
128
|
+
}
|
|
129
|
+
return retVal;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export class DDLAdapter {
|
|
134
|
+
private _dashboard: Dashboard;
|
|
135
|
+
private _ec: ElementContainer;
|
|
136
|
+
private _dsWriteDedup: DDLDatasourceAdapter = new DDLDatasourceAdapter();
|
|
137
|
+
private _dsReadDedup: { [id: string]: WU | RoxieService | RestService } = {};
|
|
138
|
+
|
|
139
|
+
constructor(dashboard: Dashboard) {
|
|
140
|
+
this._dashboard = dashboard;
|
|
141
|
+
this._ec = this._dashboard.elementContainer();
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
writeDatasources(): DDL2.DatasourceType[] {
|
|
145
|
+
for (const viz of this._ec.elements()) {
|
|
146
|
+
this._dsWriteDedup.append(viz.hipiePipeline().datasource());
|
|
147
|
+
}
|
|
148
|
+
return this._dsWriteDedup.getAll();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
writeFilters(filters: Filters): DDL2.IFilter {
|
|
152
|
+
if (!filters.exists()) return undefined;
|
|
153
|
+
return filters.toDDL();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
readFilters(ddlFilter: DDL2.IFilter, ec: ElementContainer): Filters {
|
|
157
|
+
return Filters.fromDDL(ec, ddlFilter);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
writeProject(project: Project): DDL2.IProject {
|
|
161
|
+
if (!project.exists()) return undefined;
|
|
162
|
+
return project.toDDL();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
readProject(ddlProject: DDL2.IProject): Project {
|
|
166
|
+
return Project.fromDDL(ddlProject);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
writeMappings(mappings: Mappings): DDL2.IMappings {
|
|
170
|
+
if (!mappings.exists()) return { type: "mappings", transformations: [] };
|
|
171
|
+
return mappings.toDDL();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
readMappings(ddlProject: DDL2.IMappings): Mappings {
|
|
175
|
+
return Mappings.fromDDL(ddlProject);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
writeGroupBy(gb: GroupBy): DDL2.IGroupBy {
|
|
179
|
+
if (!gb.exists()) return undefined;
|
|
180
|
+
return gb.toDDL();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
readGroupBy(ddlGB: DDL2.IGroupBy): GroupBy {
|
|
184
|
+
return GroupBy.fromDDL(ddlGB);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
writeSort(sort: Sort): DDL2.ISort {
|
|
188
|
+
if (!sort.exists()) return undefined;
|
|
189
|
+
return sort.toDDL();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
readSort(ddlSort: DDL2.ISort): Sort {
|
|
193
|
+
return Sort.fromDDL(ddlSort);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
writeLimit(limit: Limit): DDL2.ILimit {
|
|
197
|
+
if (!limit.exists()) return undefined;
|
|
198
|
+
return limit.toDDL();
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
readLimit(ddlLimit: DDL2.ILimit): Limit {
|
|
202
|
+
return Limit.fromDDL(ddlLimit);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
readDatasourceRef(ddlDSRef: DDL2.IDatasourceRef, dsPicker: DSPicker, elementContainer: ElementContainer): this {
|
|
206
|
+
if (DDL2.isWUResultRef(ddlDSRef)) {
|
|
207
|
+
const wu = this._dsReadDedup[ddlDSRef.id] as WU;
|
|
208
|
+
dsPicker.datasourceID(wu.output(ddlDSRef.output).id());
|
|
209
|
+
} else if (DDL2.isRoxieServiceRef(ddlDSRef)) {
|
|
210
|
+
dsPicker.datasourceID(`${ddlDSRef.id}_${ddlDSRef.output}`);
|
|
211
|
+
const dsRef = dsPicker.datasourceRef() as RoxieResultRef | RestResultRef;
|
|
212
|
+
dsRef
|
|
213
|
+
.request(ddlDSRef.request.map(rf => {
|
|
214
|
+
return Param.fromDDL(this._ec, rf);
|
|
215
|
+
}))
|
|
216
|
+
;
|
|
217
|
+
} else {
|
|
218
|
+
dsPicker.datasourceID(ddlDSRef.id);
|
|
219
|
+
}
|
|
220
|
+
return this;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
writeActivities(view: ActivityPipeline): DDL2.ActivityType[] {
|
|
224
|
+
return view.activities().map(activity => {
|
|
225
|
+
if (activity instanceof Filters) {
|
|
226
|
+
return this.writeFilters(activity);
|
|
227
|
+
} else if (activity instanceof Project) {
|
|
228
|
+
return this.writeProject(activity);
|
|
229
|
+
} else if (activity instanceof GroupBy) {
|
|
230
|
+
return this.writeGroupBy(activity);
|
|
231
|
+
} else if (activity instanceof Sort) {
|
|
232
|
+
return this.writeSort(activity);
|
|
233
|
+
} else if (activity instanceof Limit) {
|
|
234
|
+
return this.writeLimit(activity);
|
|
235
|
+
} else if (activity instanceof Mappings) {
|
|
236
|
+
return this.writeMappings(activity);
|
|
237
|
+
} else if (activity instanceof DSPicker) {
|
|
238
|
+
// Fall through ---
|
|
239
|
+
} else {
|
|
240
|
+
logger.warning(`Unknown activity type: ${activity.classID()}`);
|
|
241
|
+
}
|
|
242
|
+
}).filter(activity => !!activity);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
writeVisualization(visualization: Visualization): DDL2.IVisualization {
|
|
246
|
+
return {
|
|
247
|
+
id: visualization.chartPanel().id(),
|
|
248
|
+
title: visualization.title(),
|
|
249
|
+
description: visualization.description(),
|
|
250
|
+
visibility: visualization.visibility(),
|
|
251
|
+
chartType: visualization.chartType(),
|
|
252
|
+
__class: visualization.chartPanel().widget().classID(),
|
|
253
|
+
mappings: this.writeMappings(visualization.mappings()),
|
|
254
|
+
properties: visualization.properties(),
|
|
255
|
+
secondaryDataviewID: visualization.secondaryDataviewID()
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
readVisualization(ddlViz: DDL2.IVisualization, visualization: Visualization): this {
|
|
260
|
+
const mappings = this.readMappings(ddlViz.mappings);
|
|
261
|
+
visualization.chartPanel().id(ddlViz.id);
|
|
262
|
+
visualization
|
|
263
|
+
.title(ddlViz.title)
|
|
264
|
+
.description(ddlViz.description)
|
|
265
|
+
.visibility(ddlViz.visibility)
|
|
266
|
+
.chartType(ddlViz.chartType as any)
|
|
267
|
+
.properties(ddlViz.properties)
|
|
268
|
+
.mappings(mappings)
|
|
269
|
+
.secondaryDataviewID(ddlViz.secondaryDataviewID)
|
|
270
|
+
;
|
|
271
|
+
return this;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
writeViewDatasource(dsRef: DatasourceRef) {
|
|
275
|
+
const retVal = dsRef.toDDL();
|
|
276
|
+
retVal.id = this._dsWriteDedup.resolveID(dsRef) || retVal.id;
|
|
277
|
+
return retVal;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
writeDDLViews(): DDL2.IView[] {
|
|
281
|
+
// Gather referenced fields ---
|
|
282
|
+
const refFields: ReferencedFields = { inputs: {}, outputs: {} };
|
|
283
|
+
for (const element of this._ec.elements()) {
|
|
284
|
+
element.visualization().mappings().referencedFields(refFields);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return this._ec.elements().map(element => {
|
|
288
|
+
const view = element.hipiePipeline();
|
|
289
|
+
const dsPicker = view.datasource();
|
|
290
|
+
if (dsPicker instanceof DSPicker) {
|
|
291
|
+
const dsRef = dsPicker.datasourceRef();
|
|
292
|
+
const retVal = {
|
|
293
|
+
id: element.id(),
|
|
294
|
+
datasource: this.writeViewDatasource(dsRef),
|
|
295
|
+
activities: this.writeActivities(view),
|
|
296
|
+
visualization: this.writeVisualization(element.visualization())
|
|
297
|
+
};
|
|
298
|
+
return retVal;
|
|
299
|
+
}
|
|
300
|
+
throw new Error("Missing DSPicker?");
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
writeProperties(): DDL2.IProperties {
|
|
305
|
+
return {
|
|
306
|
+
name: PKG_NAME,
|
|
307
|
+
version: PKG_VERSION,
|
|
308
|
+
buildVersion: BUILD_VERSION,
|
|
309
|
+
layout: this._dashboard.layout() as any
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
readDDLViews(ddlViews: DDL2.IView[]) {
|
|
314
|
+
for (const ddlView of ddlViews) {
|
|
315
|
+
const element = new Element(this._ec).id(ddlView.id);
|
|
316
|
+
this._ec.append(element);
|
|
317
|
+
const hipiePipeline = element.hipiePipeline();
|
|
318
|
+
this.readDatasourceRef(ddlView.datasource, hipiePipeline.datasource() as DSPicker, this._ec);
|
|
319
|
+
for (const activity of ddlView.activities) {
|
|
320
|
+
if (DDL2.isProjectActivity(activity)) {
|
|
321
|
+
const project = this.readProject(activity);
|
|
322
|
+
hipiePipeline.project(project);
|
|
323
|
+
}
|
|
324
|
+
if (DDL2.isFilterActivity(activity)) {
|
|
325
|
+
const filters = this.readFilters(activity, this._ec);
|
|
326
|
+
hipiePipeline.filters(filters);
|
|
327
|
+
}
|
|
328
|
+
if (DDL2.isGroupByActivity(activity)) {
|
|
329
|
+
const groupBy = this.readGroupBy(activity);
|
|
330
|
+
hipiePipeline.groupBy(groupBy);
|
|
331
|
+
}
|
|
332
|
+
if (DDL2.isSortActivity(activity)) {
|
|
333
|
+
const sort = this.readSort(activity);
|
|
334
|
+
hipiePipeline.sort(sort);
|
|
335
|
+
}
|
|
336
|
+
if (DDL2.isLimitActivity(activity)) {
|
|
337
|
+
const limit = this.readLimit(activity);
|
|
338
|
+
hipiePipeline.limit(limit);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
this.readVisualization(ddlView.visualization, element.visualization());
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
readProperties(properties: DDL2.IProperties) {
|
|
346
|
+
if (properties && properties.layout) {
|
|
347
|
+
this._dashboard.layoutObj(properties.layout as object);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
write(): DDL2.Schema {
|
|
352
|
+
this._dsWriteDedup.clear();
|
|
353
|
+
const retVal: DDL2.Schema = {
|
|
354
|
+
version: "2.2.1",
|
|
355
|
+
createdBy: {
|
|
356
|
+
name: PKG_NAME,
|
|
357
|
+
version: PKG_VERSION
|
|
358
|
+
},
|
|
359
|
+
datasources: this.writeDatasources(),
|
|
360
|
+
dataviews: this.writeDDLViews(),
|
|
361
|
+
properties: this.writeProperties(),
|
|
362
|
+
hipieProperties: this._dashboard.hipieProps()
|
|
363
|
+
};
|
|
364
|
+
return retVal;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
read(ddl: DDL2.Schema) {
|
|
368
|
+
this._dsWriteDedup.clear();
|
|
369
|
+
for (const ddlDS of ddl.datasources) {
|
|
370
|
+
switch (ddlDS.type) {
|
|
371
|
+
case "databomb":
|
|
372
|
+
this._ec.appendDatasource(Databomb.fromDDL(ddlDS));
|
|
373
|
+
break;
|
|
374
|
+
case "form":
|
|
375
|
+
this._ec.appendDatasource(Form.fromDDL(ddlDS));
|
|
376
|
+
break;
|
|
377
|
+
case "logicalfile":
|
|
378
|
+
this._ec.appendDatasource(LogicalFile.fromDDL(this._ec, ddlDS));
|
|
379
|
+
break;
|
|
380
|
+
case "wuresult":
|
|
381
|
+
const wu = WU.fromDDL(this._ec, ddlDS);
|
|
382
|
+
this._dsReadDedup[wu.id()] = wu;
|
|
383
|
+
for (const resultName in ddlDS.outputs) {
|
|
384
|
+
this._ec.appendDatasource(wu.output(resultName));
|
|
385
|
+
}
|
|
386
|
+
break;
|
|
387
|
+
case "roxie":
|
|
388
|
+
case "hipie":
|
|
389
|
+
const rs = RoxieService.fromDDL(this._ec, ddlDS);
|
|
390
|
+
this._dsReadDedup[rs.id()] = rs;
|
|
391
|
+
for (const resultName in ddlDS.outputs) {
|
|
392
|
+
this._ec.appendDatasource(RoxieResult.fromDDL(this._ec, rs, resultName));
|
|
393
|
+
}
|
|
394
|
+
break;
|
|
395
|
+
case "rest":
|
|
396
|
+
const rs2 = RestService.fromDDL(this._ec, ddlDS);
|
|
397
|
+
this._dsReadDedup[rs2.id()] = rs2;
|
|
398
|
+
for (const resultName in ddlDS.outputs) {
|
|
399
|
+
this._ec.appendDatasource(RestResult.fromDDL(this._ec, rs2, resultName));
|
|
400
|
+
}
|
|
401
|
+
break;
|
|
402
|
+
default:
|
|
403
|
+
logger.warning(`Unknown ddl datasource type: ${(ddlDS as any).type} `);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
this.readDDLViews(ddl.dataviews);
|
|
407
|
+
this.readProperties(ddl.properties);
|
|
408
|
+
this._dashboard.hipieProps(ddl.hipieProperties);
|
|
409
|
+
}
|
|
410
|
+
}
|