@api-client/core 0.8.21 → 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.
Files changed (215) hide show
  1. package/build/browser.d.ts +12 -5
  2. package/build/browser.js +2 -3
  3. package/build/browser.js.map +1 -1
  4. package/build/index.d.ts +12 -5
  5. package/build/index.js +2 -4
  6. package/build/index.js.map +1 -1
  7. package/build/src/events/BaseEvents.d.ts +125 -18
  8. package/build/src/events/BaseEvents.js.map +1 -1
  9. package/build/src/events/EventTypes.d.ts +0 -14
  10. package/build/src/events/EventTypes.js +0 -2
  11. package/build/src/events/EventTypes.js.map +1 -1
  12. package/build/src/events/Events.d.ts +1 -5
  13. package/build/src/events/Events.js +0 -2
  14. package/build/src/events/Events.js.map +1 -1
  15. package/build/src/events/transport/TransportEventTypes.d.ts +0 -1
  16. package/build/src/events/transport/TransportEventTypes.js +0 -1
  17. package/build/src/events/transport/TransportEventTypes.js.map +1 -1
  18. package/build/src/events/transport/TransportEvents.d.ts +0 -8
  19. package/build/src/events/transport/TransportEvents.js +0 -11
  20. package/build/src/events/transport/TransportEvents.js.map +1 -1
  21. package/build/src/mocking/ProjectMock.d.ts +0 -3
  22. package/build/src/mocking/ProjectMock.js +0 -3
  23. package/build/src/mocking/ProjectMock.js.map +1 -1
  24. package/build/src/mocking/lib/History.js +5 -0
  25. package/build/src/mocking/lib/History.js.map +1 -1
  26. package/build/src/models/{Workspace.d.ts → Folder.d.ts} +7 -7
  27. package/build/src/models/{Workspace.js → Folder.js} +5 -5
  28. package/build/src/models/Folder.js.map +1 -0
  29. package/build/src/models/HttpHistory.d.ts +38 -43
  30. package/build/src/models/HttpHistory.js +27 -34
  31. package/build/src/models/HttpHistory.js.map +1 -1
  32. package/build/src/models/HttpProject.d.ts +0 -2
  33. package/build/src/models/HttpProject.js +0 -27
  34. package/build/src/models/HttpProject.js.map +1 -1
  35. package/build/src/models/Project.d.ts +0 -8
  36. package/build/src/models/Project.js +0 -4
  37. package/build/src/models/Project.js.map +1 -1
  38. package/build/src/models/ProjectFolder.d.ts +0 -2
  39. package/build/src/models/ProjectFolder.js +0 -14
  40. package/build/src/models/ProjectFolder.js.map +1 -1
  41. package/build/src/models/ProjectItem.d.ts +0 -2
  42. package/build/src/models/ProjectItem.js +0 -20
  43. package/build/src/models/ProjectItem.js.map +1 -1
  44. package/build/src/models/ProjectRequest.d.ts +2 -3
  45. package/build/src/models/ProjectRequest.js.map +1 -1
  46. package/build/src/models/RequestConfig.d.ts +1 -1
  47. package/build/src/models/Space.d.ts +42 -0
  48. package/build/src/models/Space.js +81 -0
  49. package/build/src/models/Space.js.map +1 -0
  50. package/build/src/models/TrashEntry.d.ts +27 -0
  51. package/build/src/models/TrashEntry.js +2 -0
  52. package/build/src/models/TrashEntry.js.map +1 -0
  53. package/build/src/models/data/DataAssociation.d.ts +22 -5
  54. package/build/src/models/data/DataAssociation.js +29 -11
  55. package/build/src/models/data/DataAssociation.js.map +1 -1
  56. package/build/src/models/data/DataEntity.d.ts +12 -1
  57. package/build/src/models/data/DataEntity.js +49 -10
  58. package/build/src/models/data/DataEntity.js.map +1 -1
  59. package/build/src/models/data/DataNamespace.d.ts +34 -1
  60. package/build/src/models/data/DataNamespace.js +75 -1
  61. package/build/src/models/data/DataNamespace.js.map +1 -1
  62. package/build/src/models/store/Backend.d.ts +0 -315
  63. package/build/src/models/store/Backend.js +0 -1
  64. package/build/src/models/store/Backend.js.map +1 -1
  65. package/build/src/models/store/File.d.ts +30 -0
  66. package/build/src/models/store/File.js +5 -5
  67. package/build/src/models/store/File.js.map +1 -1
  68. package/build/src/proxy/ProxyService.d.ts +0 -10
  69. package/build/src/proxy/ProxyService.js +0 -14
  70. package/build/src/proxy/ProxyService.js.map +1 -1
  71. package/build/src/runtime/node/InteropInterfaces.d.ts +1 -2
  72. package/build/src/runtime/node/ProjectParallelRunner.d.ts +2 -3
  73. package/build/src/runtime/node/ProjectParallelRunner.js.map +1 -1
  74. package/build/src/runtime/node/ProjectRequestRunner.d.ts +7 -8
  75. package/build/src/runtime/node/ProjectRequestRunner.js +2 -3
  76. package/build/src/runtime/node/ProjectRequestRunner.js.map +1 -1
  77. package/build/src/runtime/node/ProjectRunner.d.ts +3 -4
  78. package/build/src/runtime/node/ProjectRunner.js.map +1 -1
  79. package/build/src/runtime/node/ProjectRunnerWorker.js +0 -4
  80. package/build/src/runtime/node/ProjectRunnerWorker.js.map +1 -1
  81. package/build/src/runtime/store/CertificatesSdk.d.ts +46 -0
  82. package/build/src/runtime/store/CertificatesSdk.js +227 -0
  83. package/build/src/runtime/store/CertificatesSdk.js.map +1 -0
  84. package/build/src/runtime/store/FilesSdk.d.ts +14 -9
  85. package/build/src/runtime/store/FilesSdk.js +60 -16
  86. package/build/src/runtime/store/FilesSdk.js.map +1 -1
  87. package/build/src/runtime/store/HistorySdk.d.ts +11 -8
  88. package/build/src/runtime/store/HistorySdk.js +140 -17
  89. package/build/src/runtime/store/HistorySdk.js.map +1 -1
  90. package/build/src/runtime/store/RevisionsSdk.d.ts +12 -0
  91. package/build/src/runtime/store/RevisionsSdk.js +43 -0
  92. package/build/src/runtime/store/RevisionsSdk.js.map +1 -0
  93. package/build/src/runtime/store/RouteBuilder.d.ts +16 -18
  94. package/build/src/runtime/store/RouteBuilder.js +33 -60
  95. package/build/src/runtime/store/RouteBuilder.js.map +1 -1
  96. package/build/src/runtime/store/Sdk.d.ts +10 -7
  97. package/build/src/runtime/store/Sdk.js +12 -5
  98. package/build/src/runtime/store/Sdk.js.map +1 -1
  99. package/build/src/runtime/store/SdkBase.js.map +1 -1
  100. package/build/src/runtime/store/SharedSdk.d.ts +2 -2
  101. package/build/src/runtime/store/SharedSdk.js.map +1 -1
  102. package/build/src/runtime/store/SpacesSdk.d.ts +29 -0
  103. package/build/src/runtime/store/SpacesSdk.js +135 -0
  104. package/build/src/runtime/store/SpacesSdk.js.map +1 -0
  105. package/build/src/runtime/store/TrashSdk.d.ts +35 -0
  106. package/build/src/runtime/store/TrashSdk.js +155 -0
  107. package/build/src/runtime/store/TrashSdk.js.map +1 -0
  108. package/build/src/runtime/store/UsersSdk.d.ts +2 -2
  109. package/build/src/runtime/store/UsersSdk.js.map +1 -1
  110. package/build/src/runtime/store/interfaces/ApiClientStore.d.ts +30 -0
  111. package/build/src/runtime/store/interfaces/ApiClientStore.js +2 -0
  112. package/build/src/runtime/store/interfaces/ApiClientStore.js.map +1 -0
  113. package/build/src/runtime/store/interfaces/Certificates.d.ts +49 -0
  114. package/build/src/runtime/store/interfaces/Certificates.js +2 -0
  115. package/build/src/runtime/store/interfaces/Certificates.js.map +1 -0
  116. package/build/src/runtime/store/interfaces/Files.d.ts +63 -0
  117. package/build/src/runtime/store/interfaces/Files.js +2 -0
  118. package/build/src/runtime/store/interfaces/Files.js.map +1 -0
  119. package/build/src/runtime/store/interfaces/History.d.ts +63 -0
  120. package/build/src/runtime/store/interfaces/History.js +2 -0
  121. package/build/src/runtime/store/interfaces/History.js.map +1 -0
  122. package/build/src/runtime/store/interfaces/Media.d.ts +42 -0
  123. package/build/src/runtime/store/interfaces/Media.js +2 -0
  124. package/build/src/runtime/store/interfaces/Media.js.map +1 -0
  125. package/build/src/runtime/store/interfaces/Revisions.d.ts +25 -0
  126. package/build/src/runtime/store/interfaces/Revisions.js +2 -0
  127. package/build/src/runtime/store/interfaces/Revisions.js.map +1 -0
  128. package/build/src/runtime/store/interfaces/Spaces.d.ts +42 -0
  129. package/build/src/runtime/store/interfaces/Spaces.js +2 -0
  130. package/build/src/runtime/store/interfaces/Spaces.js.map +1 -0
  131. package/build/src/runtime/store/interfaces/Trash.d.ts +38 -0
  132. package/build/src/runtime/store/interfaces/Trash.js +2 -0
  133. package/build/src/runtime/store/interfaces/Trash.js.map +1 -0
  134. package/package.json +12 -12
  135. package/src/events/BaseEvents.ts +136 -18
  136. package/src/events/EventTypes.ts +0 -2
  137. package/src/events/Events.ts +0 -2
  138. package/src/events/transport/TransportEventTypes.ts +0 -1
  139. package/src/events/transport/TransportEvents.ts +0 -13
  140. package/src/mocking/ProjectMock.ts +0 -4
  141. package/src/mocking/lib/History.ts +5 -0
  142. package/src/models/{Workspace.ts → Folder.ts} +12 -12
  143. package/src/models/HttpHistory.ts +53 -63
  144. package/src/models/HttpProject.ts +0 -29
  145. package/src/models/Project.ts +0 -8
  146. package/src/models/ProjectFolder.ts +0 -16
  147. package/src/models/ProjectItem.ts +0 -18
  148. package/src/models/ProjectRequest.ts +3 -4
  149. package/src/models/RequestConfig.ts +1 -1
  150. package/src/models/Space.ts +105 -0
  151. package/src/models/TrashEntry.ts +29 -0
  152. package/src/models/data/DataAssociation.ts +50 -15
  153. package/src/models/data/DataEntity.ts +51 -10
  154. package/src/models/data/DataNamespace.ts +78 -2
  155. package/src/models/store/Backend.ts +0 -342
  156. package/src/models/store/File.ts +38 -5
  157. package/src/proxy/ProxyService.ts +0 -15
  158. package/src/proxy/readme.md +0 -1
  159. package/src/runtime/node/InteropInterfaces.ts +1 -2
  160. package/src/runtime/node/ProjectParallelRunner.ts +2 -3
  161. package/src/runtime/node/ProjectRequestRunner.ts +13 -14
  162. package/src/runtime/node/ProjectRunner.ts +3 -4
  163. package/src/runtime/node/ProjectRunnerWorker.ts +1 -4
  164. package/src/runtime/store/CertificatesSdk.ts +231 -0
  165. package/src/runtime/store/FilesSdk.ts +71 -26
  166. package/src/runtime/store/HistorySdk.ts +145 -33
  167. package/src/runtime/store/RevisionsSdk.ts +44 -0
  168. package/src/runtime/store/RouteBuilder.ts +37 -69
  169. package/src/runtime/store/Sdk.ts +17 -7
  170. package/src/runtime/store/SdkBase.ts +1 -1
  171. package/src/runtime/store/SharedSdk.ts +3 -3
  172. package/src/runtime/store/SpacesSdk.ts +136 -0
  173. package/src/runtime/store/TrashSdk.ts +159 -0
  174. package/src/runtime/store/UsersSdk.ts +3 -3
  175. package/src/runtime/store/interfaces/ApiClientStore.ts +39 -0
  176. package/src/runtime/store/interfaces/Certificates.ts +56 -0
  177. package/src/runtime/store/interfaces/Files.ts +70 -0
  178. package/src/runtime/store/interfaces/History.ts +64 -0
  179. package/src/runtime/store/interfaces/Media.ts +46 -0
  180. package/src/runtime/store/interfaces/Revisions.ts +27 -0
  181. package/src/runtime/store/interfaces/Spaces.ts +48 -0
  182. package/src/runtime/store/interfaces/Trash.ts +42 -0
  183. package/build/src/events/models/ClientCertificateEvents.d.ts +0 -54
  184. package/build/src/events/models/ClientCertificateEvents.js +0 -78
  185. package/build/src/events/models/ClientCertificateEvents.js.map +0 -1
  186. package/build/src/events/models/ModelEventTypes.d.ts +0 -13
  187. package/build/src/events/models/ModelEventTypes.js +0 -14
  188. package/build/src/events/models/ModelEventTypes.js.map +0 -1
  189. package/build/src/events/models/ModelEvents.d.ts +0 -4
  190. package/build/src/events/models/ModelEvents.js +0 -5
  191. package/build/src/events/models/ModelEvents.js.map +0 -1
  192. package/build/src/mocking/lib/App.d.ts +0 -36
  193. package/build/src/mocking/lib/App.js +0 -70
  194. package/build/src/mocking/lib/App.js.map +0 -1
  195. package/build/src/models/AppProject.d.ts +0 -817
  196. package/build/src/models/AppProject.js +0 -1721
  197. package/build/src/models/AppProject.js.map +0 -1
  198. package/build/src/models/AppRequest.d.ts +0 -69
  199. package/build/src/models/AppRequest.js +0 -150
  200. package/build/src/models/AppRequest.js.map +0 -1
  201. package/build/src/models/Workspace.js.map +0 -1
  202. package/build/src/proxy/AppProjectProxy.d.ts +0 -28
  203. package/build/src/proxy/AppProjectProxy.js +0 -107
  204. package/build/src/proxy/AppProjectProxy.js.map +0 -1
  205. package/build/src/runtime/store/AppSdk.d.ts +0 -213
  206. package/build/src/runtime/store/AppSdk.js +0 -836
  207. package/build/src/runtime/store/AppSdk.js.map +0 -1
  208. package/src/events/models/ClientCertificateEvents.ts +0 -85
  209. package/src/events/models/ModelEventTypes.ts +0 -13
  210. package/src/events/models/ModelEvents.ts +0 -5
  211. package/src/mocking/lib/App.ts +0 -101
  212. package/src/models/AppProject.ts +0 -2188
  213. package/src/models/AppRequest.ts +0 -176
  214. package/src/proxy/AppProjectProxy.ts +0 -126
  215. package/src/runtime/store/AppSdk.ts +0 -842
@@ -1,4 +1,3 @@
1
- import { ModelEventTypes } from './models/ModelEventTypes.js';
2
1
  import { CookieEventTypes } from './cookies/CookieEventTypes.js';
3
2
  import { AuthorizationEventTypes } from './authorization/AuthorizationEventTypes.js';
4
3
  import { EncryptionEventTypes } from './encryption/EncryptionEventTypes.js';
@@ -14,7 +13,6 @@ export const EventTypes = Object.freeze({
14
13
  Authorization: AuthorizationEventTypes,
15
14
  Cookie: CookieEventTypes,
16
15
  Encryption: EncryptionEventTypes,
17
- Model: ModelEventTypes,
18
16
  Process: ProcessEventTypes,
19
17
  Reporting: ReportingEventTypes,
20
18
  Telemetry: TelemetryEventTypes,
@@ -1,4 +1,3 @@
1
- import { ModelEvents } from './models/ModelEvents.js';
2
1
  import { CookieEvents } from './cookies/CookieEvents.js';
3
2
  import { AuthorizationEvents } from './authorization/AuthorizationEvents.js';
4
3
  import { EncryptionEvents } from './encryption/EncryptionEvents.js';
@@ -14,7 +13,6 @@ export const Events = Object.freeze({
14
13
  Authorization: AuthorizationEvents,
15
14
  Cookie: CookieEvents,
16
15
  Encryption: EncryptionEvents,
17
- Model: ModelEvents,
18
16
  Process: ProcessEvents,
19
17
  Reporting: ReportingEvents,
20
18
  Telemetry: TelemetryEvents,
@@ -5,7 +5,6 @@ export const TransportEventTypes = Object.freeze({
5
5
  Core: Object.freeze({
6
6
  request: 'transportcorerequest',
7
7
  httpProject: 'transportcorehttpproject',
8
- appProject: 'transportcoreappproject',
9
8
  }),
10
9
 
11
10
  /**
@@ -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
  }
@@ -85,6 +85,11 @@ export class History {
85
85
  created: date.getTime(),
86
86
  log: await this.request.log(init.log),
87
87
  user: '',
88
+ app: '',
89
+ key: '',
90
+ project: '',
91
+ request: '',
92
+ space: '',
88
93
  }
89
94
  date.setHours(0, 0, 0, 0);
90
95
  result.midnight = date.getTime();
@@ -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#Space';
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 IWorkspace extends IFile {
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 Workspace extends File {
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): Workspace {
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 Workspace({
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 | IWorkspace) {
50
+ constructor(input?: string | IFolder) {
51
51
  super();
52
- let init: IWorkspace;
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: IWorkspace): void {
81
- if (!Workspace.isWorkspace(init)) {
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 IWorkspace;
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(): IWorkspace {
100
- const result: IWorkspace = {
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 data store key. Only present when the object was already inserted into the data store.
11
- * In majority of cases this value is set. It is not set when generating the history object before sending it to the store.
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?: string;
17
+ key: string;
18
18
  /**
19
- * Optional user space id. When set the history will become available to all space users.
19
+ * The key of the parent workspace.
20
20
  */
21
- space?: string;
21
+ space: string;
22
22
  /**
23
- * Optional project id. When set the history will become available to all project users.
23
+ * The key of the project the request belongs to.
24
24
  */
25
- project?: string;
25
+ project: string;
26
26
  /**
27
- * Optional application id. Must be set when the application that created this record does not use the concept of a user space.
27
+ * The application id that generated the history entry.
28
28
  */
29
- app?: string;
29
+ app: string;
30
30
  /**
31
- * The user id that made that request.
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
- user?: string;
33
+ request: string;
38
34
  /**
39
- * The optional request id in the project that generated this log.
35
+ * The user id that made that request.
36
+ * This is only available when the store support multi-user environment.
40
37
  */
41
- request?: string;
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
- * Optional user space id. Must be set when the originating request belongs to a user space.
62
+ * The key of the parent workspace.
66
63
  */
67
- space?: string;
64
+ space: string;
68
65
  /**
69
- * Optional project id. Must be set when the originating request belongs to a user space.
66
+ * The key of the project the request belongs to.
70
67
  */
71
- project?: string;
68
+ project: string;
72
69
  /**
73
- * Optional application id. Must be set when the application that created this record does not use the concept of a user space.
70
+ * The application id that generated the history entry.
74
71
  */
75
- app?: string;
72
+ app: string;
76
73
  /**
77
- * The optional request id in the project that generated this log.
74
+ * The key of the request that generated the history entry.
78
75
  */
79
- request?: string;
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 data store key. Only present when the object was already inserted into the data store.
100
- * In majority of cases this value is set. It is not set when generating the history object before sending it to the store.
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?: string;
99
+ key = '';
105
100
  /**
106
- * Optional user space id. Must be set when the originating request belongs to a user space.
101
+ * The key of the parent workspace.
107
102
  */
108
- space?: string;
103
+ space = '';
109
104
  /**
110
- * Optional project id. Must be set when the originating request belongs to a user space.
105
+ * The key of the project the request belongs to.
111
106
  */
112
- project?: string;
107
+ project = '';
113
108
  /**
114
- * Optional application id. Must be set when the application that created this record does not use the concept of a user space.
109
+ * The application id that generated the history entry.
115
110
  */
116
- app?: string;
111
+ app = '';
117
112
  /**
118
113
  * The user id that made that request.
119
- * Note, the default API Client's store automatically adds the user information to the record overriding any pre-set user id.
114
+ * This is only available when the store support multi-user environment.
120
115
  */
121
116
  user = '';
122
117
  /**
123
- * The optional request id in the project that generated this log.
118
+ * The key of the request that generated the history entry.
124
119
  */
125
- request?: string;
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 = undefined;
200
+ this.key = '';
201
201
  }
202
202
  if (app) {
203
203
  this.app = app;
204
204
  } else {
205
- this.app = undefined;
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 = undefined;
213
+ this.space = '';
214
214
  }
215
215
  if (project) {
216
216
  this.project = project;
217
217
  } else {
218
- this.project = undefined;
218
+ this.project = '';
219
219
  }
220
220
  if (request) {
221
221
  this.request = request;
222
222
  } else {
223
- this.request = undefined;
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.
@@ -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 | IAppProjectRequest) {
200
+ constructor(project: HttpProject, input?: string | IProjectRequest) {
202
201
  super(input);
203
202
  this.project = project;
204
- let init: IProjectRequest | IAppProjectRequest;
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 | IAppProjectRequest): void {
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 workspace variables.
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
+ }