@api-client/core 0.8.22 → 0.9.0
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 +125 -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 +42 -0
- package/build/src/models/Space.js +81 -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 +30 -0
- package/build/src/models/store/File.js +5 -5
- package/build/src/models/store/File.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 +14 -9
- package/build/src/runtime/store/FilesSdk.js +60 -16
- 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 +136 -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 +105 -0
- package/src/models/TrashEntry.ts +29 -0
- package/src/models/store/Backend.ts +0 -342
- package/src/models/store/File.ts +38 -5
- 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 +71 -26
- 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
|
@@ -7,7 +7,6 @@ import { TransportEventTypes } from "./TransportEventTypes.js";
|
|
|
7
7
|
import { IProjectExecutionLog } from "../../runtime/reporters/Reporter.js";
|
|
8
8
|
import { IRequestProxyInit } from "../../proxy/RequestProxy.js";
|
|
9
9
|
import { IHttpProjectProxyInit, IHttpProjectStoreProxyInit } from "../../proxy/HttpProjectProxy.js";
|
|
10
|
-
import { IAppProjectProxyInit } from "../../proxy/AppProjectProxy.js";
|
|
11
10
|
import { IProxyResult } from "../../proxy/Proxy.js";
|
|
12
11
|
|
|
13
12
|
export interface IHttpRequestDetail {
|
|
@@ -45,18 +44,6 @@ export const TransportEvent = Object.freeze({
|
|
|
45
44
|
target.dispatchEvent(e);
|
|
46
45
|
return e.detail.result;
|
|
47
46
|
},
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* For both the project or a folder (since it's all single configuration.)
|
|
51
|
-
*
|
|
52
|
-
* @param target The events target
|
|
53
|
-
* @param init The project execution configuration
|
|
54
|
-
*/
|
|
55
|
-
appProject: async (init: IAppProjectProxyInit, target: EventTarget = window): Promise<IProxyResult<IProjectExecutionLog> | undefined> => {
|
|
56
|
-
const e = new ContextEvent<IAppProjectProxyInit, IProxyResult<IProjectExecutionLog>>(TransportEventTypes.Core.appProject, init);
|
|
57
|
-
target.dispatchEvent(e);
|
|
58
|
-
return e.detail.result;
|
|
59
|
-
},
|
|
60
47
|
}),
|
|
61
48
|
/**
|
|
62
49
|
* Transport via the native platform's bindings.
|
|
@@ -6,13 +6,11 @@ import { History } from './lib/History.js';
|
|
|
6
6
|
import { Url } from './lib/Url.js';
|
|
7
7
|
import { Certificates } from './lib/Certificates.js';
|
|
8
8
|
import { HostRules } from './lib/HostRules.js';
|
|
9
|
-
import { App } from './lib/App.js';
|
|
10
9
|
|
|
11
10
|
export { IRequestLogInit } from './lib/Request.js';
|
|
12
11
|
export { IResponseInit } from './lib/Response.js';
|
|
13
12
|
export { IUserInit } from './lib/User.js';
|
|
14
13
|
export { IHttpHistoryInit, IHttpHistoryListInit } from './lib/History.js';
|
|
15
|
-
export { IAppRequestInit } from './lib/App.js';
|
|
16
14
|
|
|
17
15
|
export class ProjectMock extends DataMock {
|
|
18
16
|
projectRequest: Request;
|
|
@@ -22,7 +20,6 @@ export class ProjectMock extends DataMock {
|
|
|
22
20
|
url: Url;
|
|
23
21
|
certificates: Certificates;
|
|
24
22
|
hostRules: HostRules;
|
|
25
|
-
app: App;
|
|
26
23
|
|
|
27
24
|
/**
|
|
28
25
|
* @param init The library init options.
|
|
@@ -36,6 +33,5 @@ export class ProjectMock extends DataMock {
|
|
|
36
33
|
this.url = new Url(init);
|
|
37
34
|
this.certificates = new Certificates(init);
|
|
38
35
|
this.hostRules = new HostRules(init);
|
|
39
|
-
this.app = new App(init);
|
|
40
36
|
}
|
|
41
37
|
}
|
|
@@ -2,14 +2,14 @@ import { IFile, File, DefaultOwner } from "./store/File.js";
|
|
|
2
2
|
import { Thing, Kind as ThingKind } from './Thing.js';
|
|
3
3
|
import v4 from '../lib/uuid.js';
|
|
4
4
|
|
|
5
|
-
export const Kind = 'Core#
|
|
5
|
+
export const Kind = 'Core#Folder';
|
|
6
6
|
/**
|
|
7
7
|
* A definition of the working space for users.
|
|
8
8
|
*
|
|
9
9
|
* A working space is a logical container in the data store
|
|
10
10
|
* created by the system users, where they can store their projects and other data.
|
|
11
11
|
*/
|
|
12
|
-
export interface
|
|
12
|
+
export interface IFolder extends IFile {
|
|
13
13
|
kind: typeof Kind;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -19,7 +19,7 @@ export interface IWorkspace extends IFile {
|
|
|
19
19
|
* A working space is a logical container in the data store
|
|
20
20
|
* created by the system users, where they can store their projects and other data.
|
|
21
21
|
*/
|
|
22
|
-
export class
|
|
22
|
+
export class Folder extends File {
|
|
23
23
|
override kind = Kind;
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -28,10 +28,10 @@ export class Workspace extends File {
|
|
|
28
28
|
* @param name The name to set.
|
|
29
29
|
* @param owner The user id that is the owner of the space.
|
|
30
30
|
*/
|
|
31
|
-
static fromName(name: string, owner = DefaultOwner):
|
|
31
|
+
static fromName(name: string, owner = DefaultOwner): Folder {
|
|
32
32
|
const key = v4();
|
|
33
33
|
const info = new Thing({ kind: ThingKind, name });
|
|
34
|
-
const definition = new
|
|
34
|
+
const definition = new Folder({
|
|
35
35
|
key,
|
|
36
36
|
kind: Kind,
|
|
37
37
|
info: info.toJSON(),
|
|
@@ -47,9 +47,9 @@ export class Workspace extends File {
|
|
|
47
47
|
/**
|
|
48
48
|
* @param input The environment definition used to restore the state.
|
|
49
49
|
*/
|
|
50
|
-
constructor(input?: string |
|
|
50
|
+
constructor(input?: string | IFolder) {
|
|
51
51
|
super();
|
|
52
|
-
let init:
|
|
52
|
+
let init: IFolder;
|
|
53
53
|
if (typeof input === 'string') {
|
|
54
54
|
init = JSON.parse(input);
|
|
55
55
|
} else if (typeof input === 'object') {
|
|
@@ -77,8 +77,8 @@ export class Workspace extends File {
|
|
|
77
77
|
*
|
|
78
78
|
* Note, this throws an error when the environment is not a space.
|
|
79
79
|
*/
|
|
80
|
-
override new(init:
|
|
81
|
-
if (!
|
|
80
|
+
override new(init: IFolder): void {
|
|
81
|
+
if (!Folder.isWorkspace(init)) {
|
|
82
82
|
throw new Error(`Not a space.`);
|
|
83
83
|
}
|
|
84
84
|
super.new(init);
|
|
@@ -89,15 +89,15 @@ export class Workspace extends File {
|
|
|
89
89
|
* Checks whether the input is a definition of an user space.
|
|
90
90
|
*/
|
|
91
91
|
static isWorkspace(input: unknown): boolean {
|
|
92
|
-
const typed = input as
|
|
92
|
+
const typed = input as IFolder;
|
|
93
93
|
if (!input || typed.kind !== Kind) {
|
|
94
94
|
return false;
|
|
95
95
|
}
|
|
96
96
|
return true;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
override toJSON():
|
|
100
|
-
const result:
|
|
99
|
+
override toJSON(): IFolder {
|
|
100
|
+
const result: IFolder = {
|
|
101
101
|
...super.toJSON(),
|
|
102
102
|
kind: Kind,
|
|
103
103
|
};
|
|
@@ -4,41 +4,38 @@ export const Kind = 'Core#HttpHistory';
|
|
|
4
4
|
export const createdSymbol = Symbol('created');
|
|
5
5
|
export const midnightSymbol = Symbol('midnight');
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* An HTTP history log.
|
|
9
|
+
* It's a definition of a HTTP requests history made in an app.
|
|
10
|
+
*/
|
|
7
11
|
export interface IHttpHistory {
|
|
8
12
|
kind: typeof Kind;
|
|
9
13
|
/**
|
|
10
|
-
* The
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* Note for data store implementations. This must be a URL-safe value so the id should be encoded if needed.
|
|
14
|
-
*
|
|
15
|
-
* @readonly
|
|
14
|
+
* The key of the history entry. The application must
|
|
15
|
+
* revalidate the local copy of the record as the store may change the key.
|
|
16
16
|
*/
|
|
17
|
-
key
|
|
17
|
+
key: string;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* The key of the parent workspace.
|
|
20
20
|
*/
|
|
21
|
-
space
|
|
21
|
+
space: string;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* The key of the project the request belongs to.
|
|
24
24
|
*/
|
|
25
|
-
project
|
|
25
|
+
project: string;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* The application id that generated the history entry.
|
|
28
28
|
*/
|
|
29
|
-
app
|
|
29
|
+
app: string;
|
|
30
30
|
/**
|
|
31
|
-
* The
|
|
32
|
-
* Note, the default API Client's store automatically adds the user information to the record overriding any pre-set user id, making it a read-only
|
|
33
|
-
* value.
|
|
34
|
-
*
|
|
35
|
-
* @readonly
|
|
31
|
+
* The key of the request that generated the history entry.
|
|
36
32
|
*/
|
|
37
|
-
|
|
33
|
+
request: string;
|
|
38
34
|
/**
|
|
39
|
-
* The
|
|
35
|
+
* The user id that made that request.
|
|
36
|
+
* This is only available when the store support multi-user environment.
|
|
40
37
|
*/
|
|
41
|
-
|
|
38
|
+
user?: string;
|
|
42
39
|
/**
|
|
43
40
|
* The request log.
|
|
44
41
|
*/
|
|
@@ -62,21 +59,21 @@ export interface IHttpHistory {
|
|
|
62
59
|
*/
|
|
63
60
|
export interface IHttpHistoryBulkAdd {
|
|
64
61
|
/**
|
|
65
|
-
*
|
|
62
|
+
* The key of the parent workspace.
|
|
66
63
|
*/
|
|
67
|
-
space
|
|
64
|
+
space: string;
|
|
68
65
|
/**
|
|
69
|
-
*
|
|
66
|
+
* The key of the project the request belongs to.
|
|
70
67
|
*/
|
|
71
|
-
project
|
|
68
|
+
project: string;
|
|
72
69
|
/**
|
|
73
|
-
*
|
|
70
|
+
* The application id that generated the history entry.
|
|
74
71
|
*/
|
|
75
|
-
app
|
|
72
|
+
app: string;
|
|
76
73
|
/**
|
|
77
|
-
* The
|
|
74
|
+
* The key of the request that generated the history entry.
|
|
78
75
|
*/
|
|
79
|
-
request
|
|
76
|
+
request: string;
|
|
80
77
|
/**
|
|
81
78
|
* The list of request logs.
|
|
82
79
|
*/
|
|
@@ -96,33 +93,31 @@ export class HttpHistory {
|
|
|
96
93
|
|
|
97
94
|
kind = Kind;
|
|
98
95
|
/**
|
|
99
|
-
* The
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* Note for data store implementations. This must be a URL-safe value so the id should be encoded if needed.
|
|
96
|
+
* The key of the history entry. The application must
|
|
97
|
+
* revalidate the local copy of the record as the store may change the key.
|
|
103
98
|
*/
|
|
104
|
-
key
|
|
99
|
+
key = '';
|
|
105
100
|
/**
|
|
106
|
-
*
|
|
101
|
+
* The key of the parent workspace.
|
|
107
102
|
*/
|
|
108
|
-
space
|
|
103
|
+
space = '';
|
|
109
104
|
/**
|
|
110
|
-
*
|
|
105
|
+
* The key of the project the request belongs to.
|
|
111
106
|
*/
|
|
112
|
-
project
|
|
107
|
+
project = '';
|
|
113
108
|
/**
|
|
114
|
-
*
|
|
109
|
+
* The application id that generated the history entry.
|
|
115
110
|
*/
|
|
116
|
-
app
|
|
111
|
+
app = '';
|
|
117
112
|
/**
|
|
118
113
|
* The user id that made that request.
|
|
119
|
-
*
|
|
114
|
+
* This is only available when the store support multi-user environment.
|
|
120
115
|
*/
|
|
121
116
|
user = '';
|
|
122
117
|
/**
|
|
123
|
-
* The
|
|
118
|
+
* The key of the request that generated the history entry.
|
|
124
119
|
*/
|
|
125
|
-
request
|
|
120
|
+
request = '';
|
|
126
121
|
/**
|
|
127
122
|
* The execution log of the HTTP request with a response.
|
|
128
123
|
*/
|
|
@@ -182,6 +177,11 @@ export class HttpHistory {
|
|
|
182
177
|
kind: Kind,
|
|
183
178
|
created: now,
|
|
184
179
|
user: '',
|
|
180
|
+
app: '',
|
|
181
|
+
key: '',
|
|
182
|
+
project: '',
|
|
183
|
+
request: '',
|
|
184
|
+
space: '',
|
|
185
185
|
log: {
|
|
186
186
|
kind: RequestLogKind,
|
|
187
187
|
},
|
|
@@ -197,12 +197,12 @@ export class HttpHistory {
|
|
|
197
197
|
if (key) {
|
|
198
198
|
this.key = key;
|
|
199
199
|
} else {
|
|
200
|
-
this.key =
|
|
200
|
+
this.key = '';
|
|
201
201
|
}
|
|
202
202
|
if (app) {
|
|
203
203
|
this.app = app;
|
|
204
204
|
} else {
|
|
205
|
-
this.app =
|
|
205
|
+
this.app = '';
|
|
206
206
|
}
|
|
207
207
|
if (midnight) {
|
|
208
208
|
this.midnight = midnight;
|
|
@@ -210,17 +210,17 @@ export class HttpHistory {
|
|
|
210
210
|
if (space) {
|
|
211
211
|
this.space = space;
|
|
212
212
|
} else {
|
|
213
|
-
this.space =
|
|
213
|
+
this.space = '';
|
|
214
214
|
}
|
|
215
215
|
if (project) {
|
|
216
216
|
this.project = project;
|
|
217
217
|
} else {
|
|
218
|
-
this.project =
|
|
218
|
+
this.project = '';
|
|
219
219
|
}
|
|
220
220
|
if (request) {
|
|
221
221
|
this.request = request;
|
|
222
222
|
} else {
|
|
223
|
-
this.request =
|
|
223
|
+
this.request = '';
|
|
224
224
|
}
|
|
225
225
|
if (user) {
|
|
226
226
|
this.user = user;
|
|
@@ -236,22 +236,12 @@ export class HttpHistory {
|
|
|
236
236
|
midnight: this.midnight,
|
|
237
237
|
log: this.log.toJSON(),
|
|
238
238
|
user: this.user,
|
|
239
|
+
key: this.key,
|
|
240
|
+
space: this.space,
|
|
241
|
+
project: this.project,
|
|
242
|
+
request: this.request,
|
|
243
|
+
app: this.app,
|
|
239
244
|
};
|
|
240
|
-
if (this.key) {
|
|
241
|
-
result.key = this.key;
|
|
242
|
-
}
|
|
243
|
-
if (this.space) {
|
|
244
|
-
result.space = this.space;
|
|
245
|
-
}
|
|
246
|
-
if (this.project) {
|
|
247
|
-
result.project = this.project;
|
|
248
|
-
}
|
|
249
|
-
if (this.request) {
|
|
250
|
-
result.request = this.request;
|
|
251
|
-
}
|
|
252
|
-
if (this.app) {
|
|
253
|
-
result.app = this.app;
|
|
254
|
-
}
|
|
255
245
|
return result;
|
|
256
246
|
}
|
|
257
247
|
|
|
@@ -16,7 +16,6 @@ import v4 from '../lib/uuid.js';
|
|
|
16
16
|
import { ARCSavedRequest, ARCHistoryRequest } from './legacy/request/ArcRequest.js';
|
|
17
17
|
import { ArcLegacyProject, ARCProject } from './legacy/models/ArcLegacyProject.js';
|
|
18
18
|
import { PostmanDataTransformer } from './transformers/PostmanDataTransformer.js';
|
|
19
|
-
import { IAppProject } from './AppProject.js';
|
|
20
19
|
import { Certificate, HttpCertificate } from './ClientCertificate.js';
|
|
21
20
|
import { ICCAuthorization } from './Authorization.js';
|
|
22
21
|
|
|
@@ -352,34 +351,6 @@ export class HttpProject extends ProjectParent {
|
|
|
352
351
|
return HttpProject.fromName(name);
|
|
353
352
|
}
|
|
354
353
|
|
|
355
|
-
static fromAppProject(init: IAppProject): HttpProject {
|
|
356
|
-
const result = new HttpProject();
|
|
357
|
-
const { definitions = {}, items, info, key = v4() } = init;
|
|
358
|
-
result.key = key;
|
|
359
|
-
result.info = new Thing(info);
|
|
360
|
-
if (Array.isArray(items)) {
|
|
361
|
-
result.items = items.map(i => ProjectItem.fromAppProject(result, i));
|
|
362
|
-
}
|
|
363
|
-
if (Array.isArray(definitions.environments)) {
|
|
364
|
-
result.definitions.environments = definitions.environments.map(i => new Environment(i));
|
|
365
|
-
}
|
|
366
|
-
if (Array.isArray(definitions.requests)) {
|
|
367
|
-
result.definitions.requests = definitions.requests.map(i => {
|
|
368
|
-
const instance = new ProjectRequest(result, i);
|
|
369
|
-
instance.attachedCallback();
|
|
370
|
-
return instance;
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
if (Array.isArray(definitions.folders)) {
|
|
374
|
-
result.definitions.folders = definitions.folders.map(i => {
|
|
375
|
-
const instance = ProjectFolder.fromAppProject(result, i);
|
|
376
|
-
instance.attachedCallback();
|
|
377
|
-
return instance;
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
return result;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
354
|
/**
|
|
384
355
|
* @param input The project definition used to restore the state.
|
|
385
356
|
* @param environments Optional list of environments to use with this project. It overrides environments stored in the project definition.
|
package/src/models/Project.ts
CHANGED
|
@@ -8,10 +8,6 @@ export const Kind = 'Core#Project';
|
|
|
8
8
|
/**
|
|
9
9
|
* This model represents a meta data for an HTTP project stored with the data store.
|
|
10
10
|
* This does not include the HTTP project entity, though, it is referenced through the same key.
|
|
11
|
-
*
|
|
12
|
-
* A concept of a project is similar to a Workspace. It is an object that is rendered in the UIs
|
|
13
|
-
* like a workspace but has a different meaning. On the store side, when listing workspace items,
|
|
14
|
-
* both spaces and projects are returned in a single query.
|
|
15
11
|
*/
|
|
16
12
|
export interface IProject extends IFile {
|
|
17
13
|
kind: typeof Kind;
|
|
@@ -20,10 +16,6 @@ export interface IProject extends IFile {
|
|
|
20
16
|
/**
|
|
21
17
|
* This model represents a meta data for an HTTP project stored with the data store.
|
|
22
18
|
* This does not include the HTTP project entity, though, it is referenced through the same key.
|
|
23
|
-
*
|
|
24
|
-
* A concept of a project is similar to a Workspace. It is an object that is rendered in the UIs
|
|
25
|
-
* like a workspace but has a different meaning. On the store side, when listing workspace items,
|
|
26
|
-
* both spaces and projects are returned in a single query.
|
|
27
19
|
*/
|
|
28
20
|
export class Project extends File {
|
|
29
21
|
override kind = Kind;
|
|
@@ -6,7 +6,6 @@ import { HttpProject, IEnvironmentCreateOptions } from './HttpProject.js';
|
|
|
6
6
|
import { IThing, Thing, Kind as ThingKind } from './Thing.js';
|
|
7
7
|
import { Environment, IEnvironment } from './Environment.js';
|
|
8
8
|
import v4 from '../lib/uuid.js';
|
|
9
|
-
import { IAppProjectParent } from './AppProject.js';
|
|
10
9
|
|
|
11
10
|
export const Kind = 'Core#ProjectFolder';
|
|
12
11
|
export const DefaultFolderName = 'New folder';
|
|
@@ -95,21 +94,6 @@ export class ProjectFolder extends ProjectParent {
|
|
|
95
94
|
*/
|
|
96
95
|
created = 0;
|
|
97
96
|
|
|
98
|
-
static fromAppProject(project: HttpProject, init: IAppProjectParent): ProjectFolder {
|
|
99
|
-
const result = new ProjectFolder(project);
|
|
100
|
-
const { key = v4(), created = Date.now(), updated = Date.now(), items, info } = init;
|
|
101
|
-
result.key = key;
|
|
102
|
-
result.created = created;
|
|
103
|
-
result.updated = updated;
|
|
104
|
-
if (info) {
|
|
105
|
-
result.info = new Thing(info);
|
|
106
|
-
}
|
|
107
|
-
if (Array.isArray(items)) {
|
|
108
|
-
result.items = items.map(i => ProjectItem.fromAppProject(project, i));
|
|
109
|
-
}
|
|
110
|
-
return result;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
97
|
constructor(project: HttpProject, input?: string | IProjectFolder) {
|
|
114
98
|
super();
|
|
115
99
|
this.project = project;
|
|
@@ -2,7 +2,6 @@ import { Kind as ProjectFolderKind, ProjectFolder } from './ProjectFolder.js';
|
|
|
2
2
|
import { Kind as ProjectRequestKind, ProjectRequest } from './ProjectRequest.js';
|
|
3
3
|
import { Kind as EnvironmentKind, Environment } from './Environment.js';
|
|
4
4
|
import { HttpProject } from './HttpProject.js';
|
|
5
|
-
import { AppProjectFolderKind, AppProjectRequestKind, IAppProjectItem } from './AppProject.js';
|
|
6
5
|
|
|
7
6
|
type Kind = typeof ProjectFolderKind | typeof ProjectRequestKind | typeof EnvironmentKind;
|
|
8
7
|
|
|
@@ -75,23 +74,6 @@ export class ProjectItem {
|
|
|
75
74
|
return item;
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
static fromAppProject(project: HttpProject, item: IAppProjectItem): ProjectItem {
|
|
79
|
-
let kind: Kind;
|
|
80
|
-
if (item.kind === AppProjectFolderKind) {
|
|
81
|
-
kind = ProjectFolderKind
|
|
82
|
-
} else if (item.kind === AppProjectRequestKind) {
|
|
83
|
-
kind = ProjectRequestKind
|
|
84
|
-
} else if (item.kind === EnvironmentKind) {
|
|
85
|
-
kind = EnvironmentKind
|
|
86
|
-
} else {
|
|
87
|
-
throw new Error(`Invalid item kind: ${item.kind}`);
|
|
88
|
-
}
|
|
89
|
-
return new ProjectItem(project, {
|
|
90
|
-
kind,
|
|
91
|
-
key: item.key,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
77
|
/**
|
|
96
78
|
* @param project The top-most project.
|
|
97
79
|
* @param input The project item definition used to restore the state.
|
|
@@ -5,7 +5,6 @@ import { IHttpRequest, Kind as HttpRequestKind } from './HttpRequest.js';
|
|
|
5
5
|
import { HttpProject } from './HttpProject.js';
|
|
6
6
|
import v4 from '../lib/uuid.js';
|
|
7
7
|
import { IRequest, Request } from './Request.js';
|
|
8
|
-
import { IAppProjectRequest } from './AppProject.js';
|
|
9
8
|
import { Environment } from './Environment.js';
|
|
10
9
|
import { Property } from './Property.js';
|
|
11
10
|
import { Server } from './Server.js';
|
|
@@ -198,10 +197,10 @@ export class ProjectRequest extends Request implements ProjectDefinitionProperty
|
|
|
198
197
|
return result;
|
|
199
198
|
}
|
|
200
199
|
|
|
201
|
-
constructor(project: HttpProject, input?: string | IProjectRequest
|
|
200
|
+
constructor(project: HttpProject, input?: string | IProjectRequest) {
|
|
202
201
|
super(input);
|
|
203
202
|
this.project = project;
|
|
204
|
-
let init: IProjectRequest
|
|
203
|
+
let init: IProjectRequest;
|
|
205
204
|
if (typeof input === 'string') {
|
|
206
205
|
init = JSON.parse(input);
|
|
207
206
|
} else if (typeof input === 'object') {
|
|
@@ -227,7 +226,7 @@ export class ProjectRequest extends Request implements ProjectDefinitionProperty
|
|
|
227
226
|
this.new(init);
|
|
228
227
|
}
|
|
229
228
|
|
|
230
|
-
override new(init: IProjectRequest
|
|
229
|
+
override new(init: IProjectRequest): void {
|
|
231
230
|
super.new(init);
|
|
232
231
|
|
|
233
232
|
const { key, environment } = init as IProjectRequest;
|
|
@@ -82,7 +82,7 @@ export interface IRequestConfig extends IRequestBaseConfig {
|
|
|
82
82
|
ignoreSessionCookies?: boolean;
|
|
83
83
|
/**
|
|
84
84
|
* A list of variables to use with the request.
|
|
85
|
-
* Note, request variables override application and
|
|
85
|
+
* Note, request variables override application and Folder variables.
|
|
86
86
|
*/
|
|
87
87
|
variables?: IProperty[];
|
|
88
88
|
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { IThing, Thing, Kind as ThingKind } from "./Thing.js";
|
|
2
|
+
import v4 from '../lib/uuid.js';
|
|
3
|
+
|
|
4
|
+
export const Kind = 'Core#Space';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The definition of a space (or workspace).
|
|
8
|
+
* A space is the parent container keeping all the data the user sees in the application.
|
|
9
|
+
* By changing space the user has completely different set of data.
|
|
10
|
+
*/
|
|
11
|
+
export interface ISpace {
|
|
12
|
+
/**
|
|
13
|
+
* The key of the space.
|
|
14
|
+
*/
|
|
15
|
+
key: string;
|
|
16
|
+
|
|
17
|
+
kind: typeof Kind;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The basic information about the space.
|
|
21
|
+
*/
|
|
22
|
+
info: IThing;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The definition of a space (or workspace).
|
|
27
|
+
* A space is the parent container keeping all the data the user sees in the application.
|
|
28
|
+
* By changing space the user has completely different set of data.
|
|
29
|
+
*/
|
|
30
|
+
export class Space {
|
|
31
|
+
/**
|
|
32
|
+
* The key of the rule.
|
|
33
|
+
*/
|
|
34
|
+
key = '';
|
|
35
|
+
|
|
36
|
+
kind = Kind;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The basic information about the project / folder.
|
|
40
|
+
*/
|
|
41
|
+
info: Thing = new Thing({ kind: ThingKind, name: '' });
|
|
42
|
+
|
|
43
|
+
static fromName(name: string): Space {
|
|
44
|
+
const key = v4();
|
|
45
|
+
const result = new Space({
|
|
46
|
+
key,
|
|
47
|
+
kind: Kind,
|
|
48
|
+
info: Thing.fromName(name).toJSON()
|
|
49
|
+
});
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
constructor(input?: string | ISpace) {
|
|
54
|
+
let init: ISpace;
|
|
55
|
+
if (typeof input === 'string') {
|
|
56
|
+
init = JSON.parse(input);
|
|
57
|
+
} else if (typeof input === 'object') {
|
|
58
|
+
init = input;
|
|
59
|
+
} else {
|
|
60
|
+
init = {
|
|
61
|
+
key: v4(),
|
|
62
|
+
kind: Kind,
|
|
63
|
+
info: Thing.fromName('').toJSON(),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
this.new(init);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
new(init: ISpace): void {
|
|
70
|
+
if (!Space.isSpace(init)) {
|
|
71
|
+
throw new Error(`Not a Space.`);
|
|
72
|
+
}
|
|
73
|
+
const { info, key = v4() } = init;
|
|
74
|
+
this.kind = Kind;
|
|
75
|
+
this.key = key;
|
|
76
|
+
if (info) {
|
|
77
|
+
if (!info.kind) {
|
|
78
|
+
info.kind = ThingKind;
|
|
79
|
+
}
|
|
80
|
+
this.info = new Thing(info);
|
|
81
|
+
} else {
|
|
82
|
+
this.info = Thing.fromName('')
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Checks whether the input is a definition of a host rule.
|
|
88
|
+
*/
|
|
89
|
+
static isSpace(input: unknown): boolean {
|
|
90
|
+
const typed = input as ISpace;
|
|
91
|
+
if (input && typed.kind && typed.kind === Kind) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
toJSON(): ISpace {
|
|
98
|
+
const result: ISpace = {
|
|
99
|
+
kind: Kind,
|
|
100
|
+
key: this.key,
|
|
101
|
+
info: this.info.toJSON(),
|
|
102
|
+
};
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IDeletion } from "./store/Deletion.js";
|
|
2
|
+
|
|
3
|
+
export interface TrashEntryCreate {
|
|
4
|
+
/**
|
|
5
|
+
* The store key of the object that has been deleted.
|
|
6
|
+
*/
|
|
7
|
+
file: string;
|
|
8
|
+
/**
|
|
9
|
+
* The kind of the delete object.
|
|
10
|
+
*/
|
|
11
|
+
kind: string;
|
|
12
|
+
/**
|
|
13
|
+
* The name of the deleted object.
|
|
14
|
+
*
|
|
15
|
+
* If the object does not have a name then it shouldn't be here.
|
|
16
|
+
*/
|
|
17
|
+
name: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface TrashEntry extends TrashEntryCreate {
|
|
21
|
+
/**
|
|
22
|
+
* The key of the trash entry.
|
|
23
|
+
*/
|
|
24
|
+
key: string;
|
|
25
|
+
/**
|
|
26
|
+
* The delete info.
|
|
27
|
+
*/
|
|
28
|
+
info: IDeletion;
|
|
29
|
+
}
|