@api-client/core 0.8.22 → 0.9.1
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/build/browser.d.ts +12 -5
- package/build/browser.js +2 -3
- package/build/browser.js.map +1 -1
- package/build/index.d.ts +12 -5
- package/build/index.js +2 -4
- package/build/index.js.map +1 -1
- package/build/src/events/BaseEvents.d.ts +137 -18
- package/build/src/events/BaseEvents.js.map +1 -1
- package/build/src/events/EventTypes.d.ts +0 -14
- package/build/src/events/EventTypes.js +0 -2
- package/build/src/events/EventTypes.js.map +1 -1
- package/build/src/events/Events.d.ts +1 -5
- package/build/src/events/Events.js +0 -2
- package/build/src/events/Events.js.map +1 -1
- package/build/src/events/transport/TransportEventTypes.d.ts +0 -1
- package/build/src/events/transport/TransportEventTypes.js +0 -1
- package/build/src/events/transport/TransportEventTypes.js.map +1 -1
- package/build/src/events/transport/TransportEvents.d.ts +0 -8
- package/build/src/events/transport/TransportEvents.js +0 -11
- package/build/src/events/transport/TransportEvents.js.map +1 -1
- package/build/src/mocking/ProjectMock.d.ts +0 -3
- package/build/src/mocking/ProjectMock.js +0 -3
- package/build/src/mocking/ProjectMock.js.map +1 -1
- package/build/src/mocking/lib/History.js +5 -0
- package/build/src/mocking/lib/History.js.map +1 -1
- package/build/src/models/{Workspace.d.ts → Folder.d.ts} +7 -7
- package/build/src/models/{Workspace.js → Folder.js} +5 -5
- package/build/src/models/Folder.js.map +1 -0
- package/build/src/models/HttpHistory.d.ts +38 -43
- package/build/src/models/HttpHistory.js +27 -34
- package/build/src/models/HttpHistory.js.map +1 -1
- package/build/src/models/HttpProject.d.ts +0 -2
- package/build/src/models/HttpProject.js +0 -27
- package/build/src/models/HttpProject.js.map +1 -1
- package/build/src/models/Project.d.ts +0 -8
- package/build/src/models/Project.js +0 -4
- package/build/src/models/Project.js.map +1 -1
- package/build/src/models/ProjectFolder.d.ts +0 -2
- package/build/src/models/ProjectFolder.js +0 -14
- package/build/src/models/ProjectFolder.js.map +1 -1
- package/build/src/models/ProjectItem.d.ts +0 -2
- package/build/src/models/ProjectItem.js +0 -20
- package/build/src/models/ProjectItem.js.map +1 -1
- package/build/src/models/ProjectRequest.d.ts +2 -3
- package/build/src/models/ProjectRequest.js.map +1 -1
- package/build/src/models/RequestConfig.d.ts +1 -1
- package/build/src/models/Space.d.ts +25 -0
- package/build/src/models/Space.js +76 -0
- package/build/src/models/Space.js.map +1 -0
- package/build/src/models/TrashEntry.d.ts +27 -0
- package/build/src/models/TrashEntry.js +2 -0
- package/build/src/models/TrashEntry.js.map +1 -0
- package/build/src/models/store/Backend.d.ts +0 -315
- package/build/src/models/store/Backend.js +0 -1
- package/build/src/models/store/Backend.js.map +1 -1
- package/build/src/models/store/File.d.ts +31 -1
- package/build/src/models/store/File.js +6 -6
- package/build/src/models/store/File.js.map +1 -1
- package/build/src/proxy/HttpProjectProxy.d.ts +4 -0
- package/build/src/proxy/HttpProjectProxy.js +10 -2
- package/build/src/proxy/HttpProjectProxy.js.map +1 -1
- package/build/src/proxy/ProxyService.d.ts +0 -10
- package/build/src/proxy/ProxyService.js +0 -14
- package/build/src/proxy/ProxyService.js.map +1 -1
- package/build/src/runtime/node/InteropInterfaces.d.ts +1 -2
- package/build/src/runtime/node/ProjectParallelRunner.d.ts +2 -3
- package/build/src/runtime/node/ProjectParallelRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRequestRunner.d.ts +7 -8
- package/build/src/runtime/node/ProjectRequestRunner.js +2 -3
- package/build/src/runtime/node/ProjectRequestRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRunner.d.ts +3 -4
- package/build/src/runtime/node/ProjectRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRunnerWorker.js +0 -4
- package/build/src/runtime/node/ProjectRunnerWorker.js.map +1 -1
- package/build/src/runtime/store/CertificatesSdk.d.ts +46 -0
- package/build/src/runtime/store/CertificatesSdk.js +227 -0
- package/build/src/runtime/store/CertificatesSdk.js.map +1 -0
- package/build/src/runtime/store/FilesSdk.d.ts +21 -16
- package/build/src/runtime/store/FilesSdk.js +75 -23
- package/build/src/runtime/store/FilesSdk.js.map +1 -1
- package/build/src/runtime/store/HistorySdk.d.ts +11 -8
- package/build/src/runtime/store/HistorySdk.js +140 -17
- package/build/src/runtime/store/HistorySdk.js.map +1 -1
- package/build/src/runtime/store/RevisionsSdk.d.ts +12 -0
- package/build/src/runtime/store/RevisionsSdk.js +43 -0
- package/build/src/runtime/store/RevisionsSdk.js.map +1 -0
- package/build/src/runtime/store/RouteBuilder.d.ts +16 -18
- package/build/src/runtime/store/RouteBuilder.js +33 -60
- package/build/src/runtime/store/RouteBuilder.js.map +1 -1
- package/build/src/runtime/store/Sdk.d.ts +10 -7
- package/build/src/runtime/store/Sdk.js +12 -5
- package/build/src/runtime/store/Sdk.js.map +1 -1
- package/build/src/runtime/store/SdkBase.js.map +1 -1
- package/build/src/runtime/store/SharedSdk.d.ts +2 -2
- package/build/src/runtime/store/SharedSdk.js.map +1 -1
- package/build/src/runtime/store/SpacesSdk.d.ts +29 -0
- package/build/src/runtime/store/SpacesSdk.js +135 -0
- package/build/src/runtime/store/SpacesSdk.js.map +1 -0
- package/build/src/runtime/store/TrashSdk.d.ts +35 -0
- package/build/src/runtime/store/TrashSdk.js +155 -0
- package/build/src/runtime/store/TrashSdk.js.map +1 -0
- package/build/src/runtime/store/UsersSdk.d.ts +2 -2
- package/build/src/runtime/store/UsersSdk.js.map +1 -1
- package/build/src/runtime/store/interfaces/ApiClientStore.d.ts +30 -0
- package/build/src/runtime/store/interfaces/ApiClientStore.js +2 -0
- package/build/src/runtime/store/interfaces/ApiClientStore.js.map +1 -0
- package/build/src/runtime/store/interfaces/Certificates.d.ts +49 -0
- package/build/src/runtime/store/interfaces/Certificates.js +2 -0
- package/build/src/runtime/store/interfaces/Certificates.js.map +1 -0
- package/build/src/runtime/store/interfaces/Files.d.ts +63 -0
- package/build/src/runtime/store/interfaces/Files.js +2 -0
- package/build/src/runtime/store/interfaces/Files.js.map +1 -0
- package/build/src/runtime/store/interfaces/History.d.ts +63 -0
- package/build/src/runtime/store/interfaces/History.js +2 -0
- package/build/src/runtime/store/interfaces/History.js.map +1 -0
- package/build/src/runtime/store/interfaces/Media.d.ts +42 -0
- package/build/src/runtime/store/interfaces/Media.js +2 -0
- package/build/src/runtime/store/interfaces/Media.js.map +1 -0
- package/build/src/runtime/store/interfaces/Revisions.d.ts +25 -0
- package/build/src/runtime/store/interfaces/Revisions.js +2 -0
- package/build/src/runtime/store/interfaces/Revisions.js.map +1 -0
- package/build/src/runtime/store/interfaces/Spaces.d.ts +42 -0
- package/build/src/runtime/store/interfaces/Spaces.js +2 -0
- package/build/src/runtime/store/interfaces/Spaces.js.map +1 -0
- package/build/src/runtime/store/interfaces/Trash.d.ts +38 -0
- package/build/src/runtime/store/interfaces/Trash.js +2 -0
- package/build/src/runtime/store/interfaces/Trash.js.map +1 -0
- package/package.json +1 -1
- package/src/events/BaseEvents.ts +148 -18
- package/src/events/EventTypes.ts +0 -2
- package/src/events/Events.ts +0 -2
- package/src/events/transport/TransportEventTypes.ts +0 -1
- package/src/events/transport/TransportEvents.ts +0 -13
- package/src/mocking/ProjectMock.ts +0 -4
- package/src/mocking/lib/History.ts +5 -0
- package/src/models/{Workspace.ts → Folder.ts} +12 -12
- package/src/models/HttpHistory.ts +53 -63
- package/src/models/HttpProject.ts +0 -29
- package/src/models/Project.ts +0 -8
- package/src/models/ProjectFolder.ts +0 -16
- package/src/models/ProjectItem.ts +0 -18
- package/src/models/ProjectRequest.ts +3 -4
- package/src/models/RequestConfig.ts +1 -1
- package/src/models/Space.ts +91 -0
- package/src/models/TrashEntry.ts +29 -0
- package/src/models/store/Backend.ts +0 -342
- package/src/models/store/File.ts +39 -6
- package/src/proxy/HttpProjectProxy.ts +14 -2
- package/src/proxy/ProxyService.ts +0 -15
- package/src/proxy/readme.md +0 -1
- package/src/runtime/node/InteropInterfaces.ts +1 -2
- package/src/runtime/node/ProjectParallelRunner.ts +2 -3
- package/src/runtime/node/ProjectRequestRunner.ts +13 -14
- package/src/runtime/node/ProjectRunner.ts +3 -4
- package/src/runtime/node/ProjectRunnerWorker.ts +1 -4
- package/src/runtime/store/CertificatesSdk.ts +231 -0
- package/src/runtime/store/FilesSdk.ts +88 -35
- package/src/runtime/store/HistorySdk.ts +145 -33
- package/src/runtime/store/RevisionsSdk.ts +44 -0
- package/src/runtime/store/RouteBuilder.ts +37 -69
- package/src/runtime/store/Sdk.ts +17 -7
- package/src/runtime/store/SdkBase.ts +1 -1
- package/src/runtime/store/SharedSdk.ts +3 -3
- package/src/runtime/store/SpacesSdk.ts +136 -0
- package/src/runtime/store/TrashSdk.ts +159 -0
- package/src/runtime/store/UsersSdk.ts +3 -3
- package/src/runtime/store/interfaces/ApiClientStore.ts +39 -0
- package/src/runtime/store/interfaces/Certificates.ts +56 -0
- package/src/runtime/store/interfaces/Files.ts +70 -0
- package/src/runtime/store/interfaces/History.ts +64 -0
- package/src/runtime/store/interfaces/Media.ts +46 -0
- package/src/runtime/store/interfaces/Revisions.ts +27 -0
- package/src/runtime/store/interfaces/Spaces.ts +48 -0
- package/src/runtime/store/interfaces/Trash.ts +42 -0
- package/build/src/events/models/ClientCertificateEvents.d.ts +0 -54
- package/build/src/events/models/ClientCertificateEvents.js +0 -78
- package/build/src/events/models/ClientCertificateEvents.js.map +0 -1
- package/build/src/events/models/ModelEventTypes.d.ts +0 -13
- package/build/src/events/models/ModelEventTypes.js +0 -14
- package/build/src/events/models/ModelEventTypes.js.map +0 -1
- package/build/src/events/models/ModelEvents.d.ts +0 -4
- package/build/src/events/models/ModelEvents.js +0 -5
- package/build/src/events/models/ModelEvents.js.map +0 -1
- package/build/src/mocking/lib/App.d.ts +0 -36
- package/build/src/mocking/lib/App.js +0 -70
- package/build/src/mocking/lib/App.js.map +0 -1
- package/build/src/models/AppProject.d.ts +0 -817
- package/build/src/models/AppProject.js +0 -1721
- package/build/src/models/AppProject.js.map +0 -1
- package/build/src/models/AppRequest.d.ts +0 -69
- package/build/src/models/AppRequest.js +0 -150
- package/build/src/models/AppRequest.js.map +0 -1
- package/build/src/models/Workspace.js.map +0 -1
- package/build/src/proxy/AppProjectProxy.d.ts +0 -28
- package/build/src/proxy/AppProjectProxy.js +0 -107
- package/build/src/proxy/AppProjectProxy.js.map +0 -1
- package/build/src/runtime/store/AppSdk.d.ts +0 -213
- package/build/src/runtime/store/AppSdk.js +0 -836
- package/build/src/runtime/store/AppSdk.js.map +0 -1
- package/src/events/models/ClientCertificateEvents.ts +0 -85
- package/src/events/models/ModelEventTypes.ts +0 -13
- package/src/events/models/ModelEvents.ts +0 -5
- package/src/mocking/lib/App.ts +0 -101
- package/src/models/AppProject.ts +0 -2188
- package/src/models/AppRequest.ts +0 -176
- package/src/proxy/AppProjectProxy.ts +0 -126
- package/src/runtime/store/AppSdk.ts +0 -842
package/src/models/AppRequest.ts
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { IRequest, Request } from "./Request.js";
|
|
2
|
-
import { HttpRequest, IHttpRequest } from "./HttpRequest.js";
|
|
3
|
-
import { Thing } from "./Thing.js";
|
|
4
|
-
|
|
5
|
-
export const Kind = 'Core#AppRequest';
|
|
6
|
-
|
|
7
|
-
export interface IAppRequest extends IRequest {
|
|
8
|
-
kind: typeof Kind;
|
|
9
|
-
key: string;
|
|
10
|
-
/**
|
|
11
|
-
* The application id that created this request.
|
|
12
|
-
*/
|
|
13
|
-
app: string;
|
|
14
|
-
/**
|
|
15
|
-
* May be used internally by the application that generated this entry
|
|
16
|
-
* to distinguish between different types of requests.
|
|
17
|
-
*/
|
|
18
|
-
type?: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* An App request is an HTTP request that has been generated by an application that is
|
|
23
|
-
* not related to a concept of project.
|
|
24
|
-
* You can think of it as a stand-alone request definition in an application.
|
|
25
|
-
* In HttpClient this represents a history entry. Another application can use it to stor a request data
|
|
26
|
-
* without any additional structure.
|
|
27
|
-
*/
|
|
28
|
-
export class AppRequest extends Request {
|
|
29
|
-
override kind = Kind;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* The identifier of the request.
|
|
33
|
-
* The key is related to the `created` property. It should be the `new Date(created).toJSON()` value.
|
|
34
|
-
*/
|
|
35
|
-
key = '';
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* The application id that created this request.
|
|
39
|
-
*/
|
|
40
|
-
app = '';
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* May be used internally by the application that generated this entry
|
|
44
|
-
* to distinguish between different types of requests.
|
|
45
|
-
*/
|
|
46
|
-
type?: string;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Creates a project request from an URL.
|
|
50
|
-
*
|
|
51
|
-
* @param url The Request URL. This is required.
|
|
52
|
-
* @param app The application id that generated this request. This is a required argument, even though, typings marks it as optional.
|
|
53
|
-
*/
|
|
54
|
-
static override fromUrl(url: string, app?: string): AppRequest {
|
|
55
|
-
if (!app) {
|
|
56
|
-
throw new Error(`The app argument is required.`);
|
|
57
|
-
}
|
|
58
|
-
const d = new Date();
|
|
59
|
-
const now: number = d.getTime();
|
|
60
|
-
const request = new AppRequest({
|
|
61
|
-
key: d.toJSON(),
|
|
62
|
-
kind: Kind,
|
|
63
|
-
created: now,
|
|
64
|
-
updated: now,
|
|
65
|
-
expects: HttpRequest.fromBaseValues({ url, method: 'GET' }).toJSON(),
|
|
66
|
-
info: Thing.fromName(url).toJSON(),
|
|
67
|
-
app,
|
|
68
|
-
});
|
|
69
|
-
return request;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Creates a project request from a name.
|
|
74
|
-
*
|
|
75
|
-
* @param name The Request name.
|
|
76
|
-
* @param app The application id that generated this request. This is a required argument, even though, typings marks it as optional.
|
|
77
|
-
*/
|
|
78
|
-
static override fromName(name: string, app?: string): AppRequest {
|
|
79
|
-
if (!app) {
|
|
80
|
-
throw new Error(`The app argument is required.`);
|
|
81
|
-
}
|
|
82
|
-
const d = new Date();
|
|
83
|
-
const now: number = d.getTime();
|
|
84
|
-
const request = new AppRequest({
|
|
85
|
-
key: d.toJSON(),
|
|
86
|
-
kind: Kind,
|
|
87
|
-
created: now,
|
|
88
|
-
updated: now,
|
|
89
|
-
expects: new HttpRequest().toJSON(),
|
|
90
|
-
info: Thing.fromName(name).toJSON(),
|
|
91
|
-
app,
|
|
92
|
-
});
|
|
93
|
-
return request;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Creates a request from an HttpRequest definition.
|
|
98
|
-
*
|
|
99
|
-
* @param info The request data.
|
|
100
|
-
* @param app The application id that generated this request. This is a required argument, even though, typings marks it as optional.
|
|
101
|
-
*/
|
|
102
|
-
static override fromHttpRequest(info: IHttpRequest, app?: string): AppRequest {
|
|
103
|
-
if (!app) {
|
|
104
|
-
throw new Error(`The app argument is required.`);
|
|
105
|
-
}
|
|
106
|
-
const d = new Date();
|
|
107
|
-
const now: number = d.getTime();
|
|
108
|
-
const request = new AppRequest({
|
|
109
|
-
key: d.toJSON(),
|
|
110
|
-
kind: Kind,
|
|
111
|
-
created: now,
|
|
112
|
-
updated: now,
|
|
113
|
-
expects: HttpRequest.fromBaseValues({ method: info.method, url: info.url, headers: info.headers, payload: info.payload }).toJSON(),
|
|
114
|
-
info: Thing.fromName(info.url).toJSON(),
|
|
115
|
-
app,
|
|
116
|
-
});
|
|
117
|
-
return request;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Creates a request for a schema of a Request.
|
|
122
|
-
* @param app The application id that generated this request.
|
|
123
|
-
*/
|
|
124
|
-
static fromRequest(request: IRequest, app: string): AppRequest {
|
|
125
|
-
const d = new Date(request.created || Date.now());
|
|
126
|
-
const now: number = d.getTime();
|
|
127
|
-
const init: IAppRequest = {
|
|
128
|
-
...request,
|
|
129
|
-
key: d.toJSON(),
|
|
130
|
-
kind: Kind,
|
|
131
|
-
created: now,
|
|
132
|
-
app,
|
|
133
|
-
};
|
|
134
|
-
const result = new AppRequest(init);
|
|
135
|
-
return result;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
constructor(input?: string | IAppRequest) {
|
|
139
|
-
super(input);
|
|
140
|
-
|
|
141
|
-
let init: IAppRequest | undefined;
|
|
142
|
-
if (typeof input === 'string') {
|
|
143
|
-
init = JSON.parse(input);
|
|
144
|
-
} else if (typeof input === 'object') {
|
|
145
|
-
init = input;
|
|
146
|
-
}
|
|
147
|
-
if (init) {
|
|
148
|
-
this.key = init.key;
|
|
149
|
-
this.app = init.app;
|
|
150
|
-
}
|
|
151
|
-
if (!this.key) {
|
|
152
|
-
this.key = new Date(this.created || Date.now()).toJSON();
|
|
153
|
-
}
|
|
154
|
-
this.kind = Kind;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
override new(init: IAppRequest): void {
|
|
158
|
-
super.new(init);
|
|
159
|
-
|
|
160
|
-
const { key, app } = init;
|
|
161
|
-
this.key = key || new Date(init.created || Date.now()).toJSON();
|
|
162
|
-
this.kind = Kind;
|
|
163
|
-
this.app = app;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
override toJSON(): IAppRequest {
|
|
167
|
-
const request = super.toJSON();
|
|
168
|
-
const result: IAppRequest = {
|
|
169
|
-
...request,
|
|
170
|
-
key: this.key,
|
|
171
|
-
kind: Kind,
|
|
172
|
-
app: this.app,
|
|
173
|
-
};
|
|
174
|
-
return result;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { IProjectRunnerOptions } from "../runtime/node/InteropInterfaces.js";
|
|
2
|
-
import { AppProject, AppProjectKind, IAppProject } from "../models/AppProject.js";
|
|
3
|
-
import { ApiError } from "../runtime/store/Errors.js";
|
|
4
|
-
import { StoreSdk } from "../runtime/store/StoreSdkNode.js";
|
|
5
|
-
import { ProjectSerialRunner } from "../runtime/node/ProjectSerialRunner.js";
|
|
6
|
-
import { ProjectParallelRunner } from "../runtime/node/ProjectParallelRunner.js";
|
|
7
|
-
import Proxy, { IProxyResult } from "./Proxy.js";
|
|
8
|
-
import { IProjectExecutionLog } from "../runtime/reporters/Reporter.js";
|
|
9
|
-
|
|
10
|
-
export interface IAppProjectProxyInit {
|
|
11
|
-
kind: typeof AppProjectKind;
|
|
12
|
-
/**
|
|
13
|
-
* Project key
|
|
14
|
-
*/
|
|
15
|
-
pid: string;
|
|
16
|
-
/**
|
|
17
|
-
* Application that created the project id.
|
|
18
|
-
*/
|
|
19
|
-
appId: string;
|
|
20
|
-
/**
|
|
21
|
-
* Runner options.
|
|
22
|
-
*/
|
|
23
|
-
options: IProjectRunnerOptions;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Runs requests from an AppProject read from the store.
|
|
28
|
-
*/
|
|
29
|
-
export default class AppProjectProxy extends Proxy {
|
|
30
|
-
project?: AppProject;
|
|
31
|
-
options?: IProjectRunnerOptions;
|
|
32
|
-
|
|
33
|
-
async configure(init: IAppProjectProxyInit, token: string, baseUri: string): Promise<void> {
|
|
34
|
-
const { pid, appId, options } = init;
|
|
35
|
-
if (!pid) {
|
|
36
|
-
throw new ApiError({
|
|
37
|
-
error: true,
|
|
38
|
-
message: 'Invalid request',
|
|
39
|
-
detail: 'The "pid" parameter is required.',
|
|
40
|
-
code: 400,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
if (!appId) {
|
|
44
|
-
throw new ApiError({
|
|
45
|
-
error: true,
|
|
46
|
-
message: 'Invalid request',
|
|
47
|
-
detail: 'The "appId" parameter is required.',
|
|
48
|
-
code: 400,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
if (!options) {
|
|
52
|
-
throw new ApiError({
|
|
53
|
-
error: true,
|
|
54
|
-
message: 'Invalid request',
|
|
55
|
-
detail: 'The "options" parameter is required.',
|
|
56
|
-
code: 400,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
if (!token) {
|
|
60
|
-
throw new ApiError({
|
|
61
|
-
error: true,
|
|
62
|
-
message: 'Invalid request',
|
|
63
|
-
detail: 'Set the authentication credentials.',
|
|
64
|
-
code: 400,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
if (!baseUri) {
|
|
68
|
-
throw new ApiError({
|
|
69
|
-
error: true,
|
|
70
|
-
message: 'Invalid request',
|
|
71
|
-
detail: 'The store uri is missing.',
|
|
72
|
-
code: 400,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
if (!baseUri.startsWith('http')) {
|
|
76
|
-
throw new ApiError({
|
|
77
|
-
error: true,
|
|
78
|
-
message: 'Invalid request',
|
|
79
|
-
detail: 'The store uri is invalid.',
|
|
80
|
-
code: 400,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
const sdk = new StoreSdk(baseUri);
|
|
84
|
-
sdk.token = token;
|
|
85
|
-
let project: IAppProject;
|
|
86
|
-
try {
|
|
87
|
-
project = await sdk.app.projects.read(pid, appId);
|
|
88
|
-
} catch (cause) {
|
|
89
|
-
const e = cause as Error;
|
|
90
|
-
throw new ApiError(e.message, 400);
|
|
91
|
-
}
|
|
92
|
-
if (project.key !== pid) {
|
|
93
|
-
throw new ApiError(`Unable to read the project.`, 500);
|
|
94
|
-
}
|
|
95
|
-
this.options = options;
|
|
96
|
-
this.project = new AppProject(project);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
async execute(): Promise<IProxyResult<IProjectExecutionLog>> {
|
|
100
|
-
const project = this.project as AppProject;
|
|
101
|
-
const opts = this.options as IProjectRunnerOptions;
|
|
102
|
-
let factory: ProjectParallelRunner | ProjectSerialRunner;
|
|
103
|
-
if (opts.parallel) {
|
|
104
|
-
factory = new ProjectParallelRunner(project, opts);
|
|
105
|
-
} else {
|
|
106
|
-
factory = new ProjectSerialRunner();
|
|
107
|
-
factory.configure(project, opts);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// eslint-disable-next-line no-inner-declarations
|
|
111
|
-
function unhandledRejection(): void {
|
|
112
|
-
//
|
|
113
|
-
}
|
|
114
|
-
// the executing library handles all related errors it need.
|
|
115
|
-
// However, when executing a request to an unknown host Node process may
|
|
116
|
-
// throw unhandled error event when the error is properly reported by the
|
|
117
|
-
// application. This suppresses these errors.
|
|
118
|
-
// Note, uncomment this line for debug.
|
|
119
|
-
process.on('unhandledRejection', unhandledRejection);
|
|
120
|
-
const report = await factory.execute();
|
|
121
|
-
process.off('unhandledRejection', unhandledRejection);
|
|
122
|
-
return {
|
|
123
|
-
result: report,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
}
|