@neuralinnovations/dataisland-sdk 0.6.8 → 0.6.10
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/dist/package.json +1 -1
- package/dist/src/storages/queryFlows/queryFlow.d.ts +1 -0
- package/dist/src/storages/queryFlows/queryFlow.d.ts.map +1 -1
- package/dist/src/storages/queryFlows/queryFlow.impl.d.ts.map +1 -1
- package/dist/src/storages/queryFlows/queryFlow.impl.js +0 -4
- package/dist/src/storages/queryFlows/queryFlow.impl.js.map +1 -1
- package/dist/src/storages/queryFlows/queryFlow.js.map +1 -1
- package/dist/src/storages/queryFlows/queryFlows.impl.d.ts +3 -0
- package/dist/src/storages/queryFlows/queryFlows.impl.d.ts.map +1 -1
- package/dist/src/storages/queryFlows/queryFlows.impl.js +25 -6
- package/dist/src/storages/queryFlows/queryFlows.impl.js.map +1 -1
- package/package.json +1 -1
- package/src/storages/queryFlows/queryFlow.impl.ts +0 -4
- package/src/storages/queryFlows/queryFlow.ts +2 -0
- package/src/storages/queryFlows/queryFlows.impl.ts +42 -16
package/dist/package.json
CHANGED
@@ -10,5 +10,6 @@ export declare abstract class QueryFlow extends EventDispatcher<QueryFlowEvent,
|
|
10
10
|
abstract get state(): QueryFlowState;
|
11
11
|
abstract get status(): QueryFlowStatus;
|
12
12
|
abstract get urls(): QueryFileUrlDto[] | undefined;
|
13
|
+
abstract fetch(): any;
|
13
14
|
}
|
14
15
|
//# sourceMappingURL=queryFlow.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"queryFlow.d.ts","sourceRoot":"","sources":["../../../../src/storages/queryFlows/queryFlow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EACL,eAAe,EACf,cAAc,EACd,eAAe,EAChB,MAAM,6BAA6B,CAAA;AAEpC,oBAAY,cAAc;IACxB,OAAO,YAAY;CACpB;AAED,8BAAsB,SAAU,SAAQ,eAAe,CACrD,cAAc,EACd,SAAS,CACV;IAEC,QAAQ,KAAK,EAAE,IAAI,MAAM,CAAA;IAEzB,QAAQ,KAAK,IAAI,IAAI,MAAM,CAAA;IAE3B,QAAQ,KAAK,KAAK,IAAI,cAAc,CAAA;IAEpC,QAAQ,KAAK,MAAM,IAAI,eAAe,CAAA;IAEtC,QAAQ,KAAK,IAAI,IAAI,eAAe,EAAE,GAAG,SAAS,CAAA;
|
1
|
+
{"version":3,"file":"queryFlow.d.ts","sourceRoot":"","sources":["../../../../src/storages/queryFlows/queryFlow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EACL,eAAe,EACf,cAAc,EACd,eAAe,EAChB,MAAM,6BAA6B,CAAA;AAEpC,oBAAY,cAAc;IACxB,OAAO,YAAY;CACpB;AAED,8BAAsB,SAAU,SAAQ,eAAe,CACrD,cAAc,EACd,SAAS,CACV;IAEC,QAAQ,KAAK,EAAE,IAAI,MAAM,CAAA;IAEzB,QAAQ,KAAK,IAAI,IAAI,MAAM,CAAA;IAE3B,QAAQ,KAAK,KAAK,IAAI,cAAc,CAAA;IAEpC,QAAQ,KAAK,MAAM,IAAI,eAAe,CAAA;IAEtC,QAAQ,KAAK,IAAI,IAAI,eAAe,EAAE,GAAG,SAAS,CAAA;IAElD,QAAQ,CAAC,KAAK,IAAI,GAAG;CAEtB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"queryFlow.impl.d.ts","sourceRoot":"","sources":["../../../../src/storages/queryFlows/queryFlow.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,aAAa,CAAA;AACvD,OAAO,EACL,eAAe,EAEf,cAAc,EACd,eAAe,EAChB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAIvC,qBAAa,aAAc,SAAQ,SAAS;IAI9B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,OAAO,CAAC,QAAQ,CAAC,CAAc;IAC/B,OAAO,CAAC,GAAG,CAAC,CAAQ;gBAES,OAAO,EAAE,OAAO;IAIvC,QAAQ,CAAC,EAAE,EAAE,MAAM;IAKnB,KAAK;
|
1
|
+
{"version":3,"file":"queryFlow.impl.d.ts","sourceRoot":"","sources":["../../../../src/storages/queryFlows/queryFlow.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,aAAa,CAAA;AACvD,OAAO,EACL,eAAe,EAEf,cAAc,EACd,eAAe,EAChB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAIvC,qBAAa,aAAc,SAAQ,SAAS;IAI9B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,OAAO,CAAC,QAAQ,CAAC,CAAc;IAC/B,OAAO,CAAC,GAAG,CAAC,CAAQ;gBAES,OAAO,EAAE,OAAO;IAIvC,QAAQ,CAAC,EAAE,EAAE,MAAM;IAKnB,KAAK;IA0BX,IAAI,EAAE,IAAI,MAAM,CAMf;IAED,IAAI,IAAI,IAAI,MAAM,CAMjB;IAED,IAAI,IAAI,IAAI,eAAe,EAAE,GAAG,SAAS,CAMxC;IAED,IAAI,KAAK,IAAI,cAAc,CAM1B;IAED,IAAI,MAAM,IAAI,eAAe,CAM5B;CAEF"}
|
@@ -2,7 +2,6 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.QueryFlowImpl = void 0;
|
4
4
|
const queryFlow_1 = require("./queryFlow");
|
5
|
-
const queryFlowResponse_1 = require("../../dto/queryFlowResponse");
|
6
5
|
const rpcService_1 = require("../../services/rpcService");
|
7
6
|
const responseUtils_1 = require("../../services/responseUtils");
|
8
7
|
class QueryFlowImpl extends queryFlow_1.QueryFlow {
|
@@ -32,9 +31,6 @@ class QueryFlowImpl extends queryFlow_1.QueryFlow {
|
|
32
31
|
data: this
|
33
32
|
});
|
34
33
|
}
|
35
|
-
if (this._content.state === queryFlowResponse_1.QueryFlowState.IN_PROGRESS) {
|
36
|
-
setTimeout(async () => await this.fetch(), 2000);
|
37
|
-
}
|
38
34
|
}
|
39
35
|
get id() {
|
40
36
|
if (this._id) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"queryFlow.impl.js","sourceRoot":"","sources":["../../../../src/storages/queryFlows/queryFlow.impl.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;
|
1
|
+
{"version":3,"file":"queryFlow.impl.js","sourceRoot":"","sources":["../../../../src/storages/queryFlows/queryFlow.impl.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;AASvD,0DAAsD;AACtD,gEAA4D;AAE5D,MAAa,aAAc,SAAQ,qBAAS;IAI1C,YAA6B,OAAgB;QAC3C,KAAK,EAAE,CAAA;QADoB,YAAO,GAAP,OAAO,CAAS;IAE7C,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU;QACvB,IAAI,CAAC,GAAG,GAAG,EAAE,CAAA;QACb,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,KAAK;;QACT,MAAM,QAAQ,GAAG,MAAM,CAAA,MAAA,IAAI,CAAC,OAAO;aAChC,OAAO,CAAC,uBAAU,CAAC,0CAClB,cAAc,CAAC,mBAAmB,EACnC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,EAC7B,OAAO,EAAE,CAAA,CAAA;QAEZ,wBAAwB;QACxB,IAAI,6BAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACnC,MAAM,6BAAa,CAAC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AC;YAClB,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAA;QAC5B,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC7C,CAAC;IACH,CAAC;IAED,IAAI,MAAM;QACR,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAA;QAC7B,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC7C,CAAC;IACH,CAAC;CAEF;AA/ED,sCA+EC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"queryFlow.js","sourceRoot":"","sources":["../../../../src/storages/queryFlows/queryFlow.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAQ9C,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,qCAAmB,CAAA;AACrB,CAAC,EAFW,cAAc,8BAAd,cAAc,QAEzB;AAED,MAAsB,SAAU,SAAQ,wBAGvC;
|
1
|
+
{"version":3,"file":"queryFlow.js","sourceRoot":"","sources":["../../../../src/storages/queryFlows/queryFlow.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAQ9C,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,qCAAmB,CAAA;AACrB,CAAC,EAFW,cAAc,8BAAd,cAAc,QAEzB;AAED,MAAsB,SAAU,SAAQ,wBAGvC;CAcA;AAjBD,8BAiBC"}
|
@@ -8,8 +8,11 @@ export declare class QueryFlowsImpl extends QueryFlows {
|
|
8
8
|
readonly organization: OrganizationImpl;
|
9
9
|
readonly context: Context;
|
10
10
|
private _collection;
|
11
|
+
private _inProgress;
|
12
|
+
private _fetchTimeout?;
|
11
13
|
constructor(organization: OrganizationImpl, context: Context);
|
12
14
|
getQueryFlows(): Promise<QueryFlow[]>;
|
15
|
+
internalFetchQueries(): Promise<void>;
|
13
16
|
create(name: string, workspaceId: WorkspaceId, file: UploadFile, table: UploadFile): Promise<FlowId>;
|
14
17
|
delete(id: FlowId): Promise<void>;
|
15
18
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"queryFlows.impl.d.ts","sourceRoot":"","sources":["../../../../src/storages/queryFlows/queryFlows.impl.ts"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"queryFlows.impl.d.ts","sourceRoot":"","sources":["../../../../src/storages/queryFlows/queryFlows.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAA;AACrC,OAAO,EAAC,MAAM,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAA;AAChE,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAA;AACrC,OAAO,EAAC,gBAAgB,EAAC,MAAM,oCAAoC,CAAA;AAGnE,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAA;AAOpD,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAA;AAEzC,qBAAa,cAAe,SAAQ,UAAU;aAS1B,YAAY,EAAE,gBAAgB;aAC9B,OAAO,EAAE,OAAO;IARlC,OAAO,CAAC,WAAW,CAAkB;IAErC,OAAO,CAAC,WAAW,CAAkB;IAErC,OAAO,CAAC,aAAa,CAAC,CAAgB;gBAGpB,YAAY,EAAE,gBAAgB,EAC9B,OAAO,EAAE,OAAO;IAI5B,aAAa,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IA4CrC,oBAAoB;IAcpB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAmDpG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAoCxC"}
|
@@ -4,6 +4,7 @@ exports.QueryFlowsImpl = void 0;
|
|
4
4
|
const queryFlows_1 = require("./queryFlows");
|
5
5
|
const rpcService_1 = require("../../services/rpcService");
|
6
6
|
const responseUtils_1 = require("../../services/responseUtils");
|
7
|
+
const queryFlowResponse_1 = require("../../dto/queryFlowResponse");
|
7
8
|
const queryFlow_impl_1 = require("./queryFlow.impl");
|
8
9
|
class QueryFlowsImpl extends queryFlows_1.QueryFlows {
|
9
10
|
constructor(organization, context) {
|
@@ -11,6 +12,7 @@ class QueryFlowsImpl extends queryFlows_1.QueryFlows {
|
|
11
12
|
this.organization = organization;
|
12
13
|
this.context = context;
|
13
14
|
this._collection = [];
|
15
|
+
this._inProgress = [];
|
14
16
|
}
|
15
17
|
async getQueryFlows() {
|
16
18
|
var _a;
|
@@ -23,29 +25,46 @@ class QueryFlowsImpl extends queryFlows_1.QueryFlows {
|
|
23
25
|
// parse flows from the server's response
|
24
26
|
const flows = (await response.json())
|
25
27
|
.flowIds;
|
28
|
+
// Clear collection before add new elementss
|
29
|
+
this._collection = [];
|
30
|
+
this._inProgress = [];
|
31
|
+
clearTimeout(this._fetchTimeout);
|
26
32
|
// init flows from the server's response
|
27
33
|
for (const flow of flows) {
|
28
34
|
// create workspace implementation
|
29
35
|
const flowImpl = new queryFlow_impl_1.QueryFlowImpl(this.context);
|
30
36
|
// init workspace from the server's response
|
31
37
|
await flowImpl.initFrom(flow);
|
38
|
+
if (flowImpl.state == queryFlowResponse_1.QueryFlowState.IN_PROGRESS) {
|
39
|
+
this._inProgress.push(flowImpl);
|
40
|
+
}
|
32
41
|
// add workspace to the collection
|
33
42
|
this._collection.push(flowImpl);
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
data: flowImpl
|
38
|
-
});
|
43
|
+
}
|
44
|
+
if (this._inProgress.length > 0) {
|
45
|
+
this._fetchTimeout = setTimeout(async () => await this.internalFetchQueries(), 2000);
|
39
46
|
}
|
40
47
|
return this._collection;
|
41
48
|
}
|
49
|
+
async internalFetchQueries() {
|
50
|
+
for (const flow of this._inProgress) {
|
51
|
+
await flow.fetch();
|
52
|
+
}
|
53
|
+
this._inProgress = this._inProgress.filter(flow => flow.state == queryFlowResponse_1.QueryFlowState.IN_PROGRESS);
|
54
|
+
if (this._inProgress.length > 0) {
|
55
|
+
this._fetchTimeout = setTimeout(async () => await this.internalFetchQueries(), 2000);
|
56
|
+
}
|
57
|
+
else {
|
58
|
+
clearTimeout(this._fetchTimeout);
|
59
|
+
}
|
60
|
+
}
|
42
61
|
async create(name, workspaceId, file, table) {
|
43
62
|
var _a;
|
44
63
|
if (name === undefined || name === null || name.trim() === "") {
|
45
64
|
throw new Error("Name is required, must be not empty");
|
46
65
|
}
|
47
66
|
if (workspaceId === undefined || workspaceId === null || workspaceId.trim() === "") {
|
48
|
-
throw new Error("
|
67
|
+
throw new Error("WorkspaceIds is required, must be not empty");
|
49
68
|
}
|
50
69
|
if (file === undefined || file === null) {
|
51
70
|
throw new Error("Create query flow, file is undefined or null");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"queryFlows.impl.js","sourceRoot":"","sources":["../../../../src/storages/queryFlows/queryFlows.impl.ts"],"names":[],"mappings":";;;AACA,
|
1
|
+
{"version":3,"file":"queryFlows.impl.js","sourceRoot":"","sources":["../../../../src/storages/queryFlows/queryFlows.impl.ts"],"names":[],"mappings":";;;AACA,6CAAgE;AAGhE,0DAAoD;AACpD,gEAA0D;AAE1D,mEAIoC;AACpC,qDAA8C;AAG9C,MAAa,cAAe,SAAQ,uBAAU;IAQ5C,YACkB,YAA8B,EAC9B,OAAgB;QAChC,KAAK,EAAE,CAAA;QAFS,iBAAY,GAAZ,YAAY,CAAkB;QAC9B,YAAO,GAAP,OAAO,CAAS;QAR1B,gBAAW,GAAgB,EAAE,CAAA;QAE7B,gBAAW,GAAgB,EAAE,CAAA;IAQrC,CAAC;IAED,KAAK,CAAC,aAAa;;QACjB,MAAM,QAAQ,GAAG,MAAM,CAAA,MAAA,IAAI,CAAC,OAAO;aAChC,OAAO,CAAC,uBAAU,CAAC,0CAClB,cAAc,CAAC,wBAAwB,EACxC,WAAW,CAAC,gB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
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
1
|
+
import {Context} from "../../context"
|
2
|
+
import {FlowId, QueryFlows, QueryFlowsEvent} from "./queryFlows"
|
3
|
+
import {QueryFlow} from "./queryFlow"
|
4
|
+
import {OrganizationImpl} from "../organizations/organization.impl"
|
5
|
+
import {RpcService} from "../../services/rpcService"
|
6
|
+
import {ResponseUtils} from "../../services/responseUtils"
|
7
|
+
import {WorkspaceId} from "../workspaces/workspaces"
|
8
8
|
import {
|
9
9
|
QueryFlowListResponse,
|
10
|
-
QueryFlowResponse
|
10
|
+
QueryFlowResponse,
|
11
|
+
QueryFlowState
|
11
12
|
} from "../../dto/queryFlowResponse"
|
12
|
-
import {
|
13
|
-
import {
|
13
|
+
import {QueryFlowImpl} from "./queryFlow.impl"
|
14
|
+
import {UploadFile} from "../files/files"
|
14
15
|
|
15
16
|
export class QueryFlowsImpl extends QueryFlows {
|
16
17
|
|
17
18
|
private _collection: QueryFlow[] = []
|
18
19
|
|
20
|
+
private _inProgress: QueryFlow[] = []
|
21
|
+
|
22
|
+
private _fetchTimeout?: NodeJS.Timeout
|
23
|
+
|
19
24
|
constructor(
|
20
25
|
public readonly organization: OrganizationImpl,
|
21
26
|
public readonly context: Context) {
|
@@ -38,6 +43,11 @@ export class QueryFlowsImpl extends QueryFlows {
|
|
38
43
|
const flows = ((await response!.json()) as QueryFlowListResponse)
|
39
44
|
.flowIds
|
40
45
|
|
46
|
+
// Clear collection before add new elementss
|
47
|
+
this._collection = []
|
48
|
+
this._inProgress = []
|
49
|
+
clearTimeout(this._fetchTimeout)
|
50
|
+
|
41
51
|
// init flows from the server's response
|
42
52
|
for (const flow of flows) {
|
43
53
|
// create workspace implementation
|
@@ -46,25 +56,41 @@ export class QueryFlowsImpl extends QueryFlows {
|
|
46
56
|
// init workspace from the server's response
|
47
57
|
await flowImpl.initFrom(flow)
|
48
58
|
|
59
|
+
if (flowImpl.state == QueryFlowState.IN_PROGRESS){
|
60
|
+
this._inProgress.push(flowImpl)
|
61
|
+
}
|
62
|
+
|
49
63
|
// add workspace to the collection
|
50
64
|
this._collection.push(flowImpl)
|
65
|
+
}
|
51
66
|
|
52
|
-
|
53
|
-
this.
|
54
|
-
type: QueryFlowsEvent.ADDED,
|
55
|
-
data: flowImpl
|
56
|
-
})
|
67
|
+
if (this._inProgress.length > 0) {
|
68
|
+
this._fetchTimeout = setTimeout(async () => await this.internalFetchQueries(), 2000)
|
57
69
|
}
|
58
70
|
|
59
71
|
return this._collection
|
60
72
|
}
|
61
73
|
|
74
|
+
async internalFetchQueries() {
|
75
|
+
for (const flow of this._inProgress){
|
76
|
+
await flow.fetch()
|
77
|
+
}
|
78
|
+
|
79
|
+
this._inProgress = this._inProgress.filter(flow => flow.state == QueryFlowState.IN_PROGRESS)
|
80
|
+
|
81
|
+
if (this._inProgress.length > 0) {
|
82
|
+
this._fetchTimeout = setTimeout(async () => await this.internalFetchQueries(), 2000)
|
83
|
+
} else {
|
84
|
+
clearTimeout(this._fetchTimeout)
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
62
88
|
async create(name: string, workspaceId: WorkspaceId, file: UploadFile, table: UploadFile): Promise<FlowId> {
|
63
89
|
if (name === undefined || name === null || name.trim() === "") {
|
64
90
|
throw new Error("Name is required, must be not empty")
|
65
91
|
}
|
66
92
|
if (workspaceId === undefined || workspaceId === null || workspaceId.trim() === "") {
|
67
|
-
throw new Error("
|
93
|
+
throw new Error("WorkspaceIds is required, must be not empty")
|
68
94
|
}
|
69
95
|
if (file === undefined || file === null) {
|
70
96
|
throw new Error("Create query flow, file is undefined or null")
|