@api-client/core 0.5.19 → 0.5.22

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 (104) hide show
  1. package/build/browser.d.ts +9 -2
  2. package/build/browser.js +12 -0
  3. package/build/browser.js.map +1 -1
  4. package/build/index.d.ts +6 -2
  5. package/build/index.js +9 -0
  6. package/build/index.js.map +1 -1
  7. package/build/src/authorization/AuthorizationError.d.ts +23 -0
  8. package/build/src/authorization/AuthorizationError.js +33 -0
  9. package/build/src/authorization/AuthorizationError.js.map +1 -0
  10. package/build/src/authorization/CustomParameters.d.ts +24 -0
  11. package/build/src/authorization/CustomParameters.js +59 -0
  12. package/build/src/authorization/CustomParameters.js.map +1 -0
  13. package/build/src/authorization/OAuth2Authorization.d.ts +332 -0
  14. package/build/src/authorization/OAuth2Authorization.js +965 -0
  15. package/build/src/authorization/OAuth2Authorization.js.map +1 -0
  16. package/build/src/authorization/OidcAuthorization.d.ts +34 -0
  17. package/build/src/authorization/OidcAuthorization.js +139 -0
  18. package/build/src/authorization/OidcAuthorization.js.map +1 -0
  19. package/build/src/authorization/Utils.d.ts +51 -0
  20. package/build/src/authorization/Utils.js +122 -0
  21. package/build/src/authorization/Utils.js.map +1 -0
  22. package/build/src/authorization/lib/IframeAuthorization.d.ts +53 -0
  23. package/build/src/authorization/lib/IframeAuthorization.js +116 -0
  24. package/build/src/authorization/lib/IframeAuthorization.js.map +1 -0
  25. package/build/src/authorization/lib/KnownGrants.d.ts +6 -0
  26. package/build/src/authorization/lib/KnownGrants.js +7 -0
  27. package/build/src/authorization/lib/KnownGrants.js.map +1 -0
  28. package/build/src/authorization/lib/PopupAuthorization.d.ts +41 -0
  29. package/build/src/authorization/lib/PopupAuthorization.js +73 -0
  30. package/build/src/authorization/lib/PopupAuthorization.js.map +1 -0
  31. package/build/src/authorization/lib/Tokens.d.ts +55 -0
  32. package/build/src/authorization/lib/Tokens.js +117 -0
  33. package/build/src/authorization/lib/Tokens.js.map +1 -0
  34. package/build/src/authorization/types.d.ts +174 -0
  35. package/build/src/authorization/types.js +2 -0
  36. package/build/src/authorization/types.js.map +1 -0
  37. package/build/src/events/BaseEvents.d.ts +1 -1
  38. package/build/src/events/BaseEvents.js.map +1 -1
  39. package/build/src/events/EventTypes.d.ts +0 -28
  40. package/build/src/events/Events.d.ts +0 -1
  41. package/build/src/events/models/ClientCertificateEvents.d.ts +6 -8
  42. package/build/src/events/models/ClientCertificateEvents.js +4 -6
  43. package/build/src/events/models/ClientCertificateEvents.js.map +1 -1
  44. package/build/src/events/models/ModelEventTypes.d.ts +0 -34
  45. package/build/src/events/models/ModelEventTypes.js +0 -34
  46. package/build/src/events/models/ModelEventTypes.js.map +1 -1
  47. package/build/src/events/models/ModelEvents.d.ts +0 -2
  48. package/build/src/events/models/ModelEvents.js +0 -2
  49. package/build/src/events/models/ModelEvents.js.map +1 -1
  50. package/build/src/lib/Buffer.d.ts +21 -0
  51. package/build/src/lib/Buffer.js +43 -0
  52. package/build/src/lib/Buffer.js.map +1 -0
  53. package/build/src/models/Authorization.d.ts +3 -5
  54. package/build/src/models/ClientCertificate.d.ts +130 -25
  55. package/build/src/models/ClientCertificate.js +150 -1
  56. package/build/src/models/ClientCertificate.js.map +1 -1
  57. package/build/src/models/Request.d.ts +3 -3
  58. package/build/src/models/Request.js +3 -2
  59. package/build/src/models/Request.js.map +1 -1
  60. package/build/src/models/RequestAuthorization.js +4 -0
  61. package/build/src/models/RequestAuthorization.js.map +1 -1
  62. package/build/src/runtime/http-engine/CoreEngine.js +4 -1
  63. package/build/src/runtime/http-engine/CoreEngine.js.map +1 -1
  64. package/build/src/runtime/http-engine/HttpEngine.d.ts +4 -4
  65. package/build/src/runtime/http-engine/HttpEngine.js +38 -29
  66. package/build/src/runtime/http-engine/HttpEngine.js.map +1 -1
  67. package/build/src/runtime/modules/ModulesRegistry.d.ts +2 -2
  68. package/build/src/runtime/modules/RequestAuthorization.js +3 -7
  69. package/build/src/runtime/modules/RequestAuthorization.js.map +1 -1
  70. package/build/src/runtime/node/ProjectRequestRunner.js +1 -1
  71. package/build/src/runtime/node/ProjectRequestRunner.js.map +1 -1
  72. package/build/src/runtime/node/RequestFactory.d.ts +2 -2
  73. package/build/src/runtime/node/RequestFactory.js.map +1 -1
  74. package/oauth-popup.html +29 -0
  75. package/package.json +3 -1
  76. package/src/authorization/AuthorizationError.ts +25 -0
  77. package/src/authorization/CustomParameters.ts +61 -0
  78. package/src/authorization/OAuth2Authorization.ts +1027 -0
  79. package/src/authorization/OidcAuthorization.ts +143 -0
  80. package/src/authorization/Utils.ts +126 -0
  81. package/src/authorization/lib/IframeAuthorization.ts +128 -0
  82. package/src/authorization/lib/KnownGrants.ts +6 -0
  83. package/src/authorization/lib/PopupAuthorization.ts +80 -0
  84. package/src/authorization/lib/Tokens.ts +124 -0
  85. package/src/authorization/types.ts +176 -0
  86. package/src/events/BaseEvents.ts +1 -1
  87. package/src/events/models/ClientCertificateEvents.ts +11 -13
  88. package/src/events/models/ModelEventTypes.ts +0 -34
  89. package/src/events/models/ModelEvents.ts +0 -2
  90. package/src/lib/Buffer.ts +48 -0
  91. package/src/models/Authorization.ts +4 -5
  92. package/src/models/ClientCertificate.ts +224 -25
  93. package/src/models/Request.ts +5 -5
  94. package/src/models/RequestAuthorization.ts +5 -1
  95. package/src/runtime/http-engine/CoreEngine.ts +4 -1
  96. package/src/runtime/http-engine/HttpEngine.ts +39 -33
  97. package/src/runtime/modules/ModulesRegistry.ts +2 -2
  98. package/src/runtime/modules/RequestAuthorization.ts +3 -7
  99. package/src/runtime/node/ProjectRequestRunner.ts +1 -1
  100. package/src/runtime/node/RequestFactory.ts +2 -2
  101. package/build/src/events/models/ProjectEvents.d.ts +0 -221
  102. package/build/src/events/models/ProjectEvents.js +0 -253
  103. package/build/src/events/models/ProjectEvents.js.map +0 -1
  104. package/src/events/models/ProjectEvents.ts +0 -331
@@ -1,253 +0,0 @@
1
- import { ContextEvent, ContextReadEvent, ContextUpdateEvent, ContextDeleteEvent } from "../BaseEvents.js";
2
- import { ModelEventTypes } from './ModelEventTypes.js';
3
- import CustomEvent from '../CustomEvent.js';
4
- class ProjectFolderEvents {
5
- /**
6
- * Creates a folder in a project.
7
- *
8
- * @param target The target on which to dispatch the event
9
- * @param id The store id of the project
10
- * @param name Optionally, name of the folder to create.
11
- * @param opts Optional options to create a folder.
12
- * @returns The change record of the created folder. Note, the client should either refresh the project from the store or append the change record to the instance of the project.
13
- */
14
- static async create(target, id, name, opts = {}) {
15
- const init = { ...opts, id, name, };
16
- const e = new ContextEvent(ModelEventTypes.Project.Folder.create, init);
17
- target.dispatchEvent(e);
18
- return e.detail.result;
19
- }
20
- /**
21
- * Deletes a folder from a project
22
- *
23
- * @param target The target on which to dispatch the event
24
- * @param id The data store id of the project
25
- * @param key The key of the folder to delete.
26
- */
27
- static async delete(target, id, key) {
28
- const e = new ContextDeleteEvent(ModelEventTypes.Project.Folder.delete, key, id);
29
- target.dispatchEvent(e);
30
- return e.detail.result;
31
- }
32
- /**
33
- * Updates the entire folder schema in a project.
34
- *
35
- * @param target The target on which to dispatch the event
36
- * @param id The data store id of the project
37
- * @param folder The folder to replace the schema for.
38
- * @returns The change record of the updated folder.
39
- */
40
- static async update(target, id, folder) {
41
- const e = new ContextUpdateEvent(ModelEventTypes.Project.Folder.update, { item: folder, parent: id });
42
- target.dispatchEvent(e);
43
- return e.detail.result;
44
- }
45
- }
46
- class ProjectRequestEvents {
47
- /**
48
- * Creates a request in a project.
49
- *
50
- * @param target The target on which to dispatch the event
51
- * @param id The store id of the project
52
- * @param url The URL of the request.
53
- * @param opts Optional options to create a request.
54
- * @returns The change record of the created request. Note, the client should either refresh the project from the store or append the change record to the instance of the project.
55
- */
56
- static async create(target, id, url, opts = {}) {
57
- const init = { ...opts, id, url, };
58
- const e = new ContextEvent(ModelEventTypes.Project.Request.create, init);
59
- target.dispatchEvent(e);
60
- return e.detail.result;
61
- }
62
- /**
63
- * Deletes a request from a project
64
- *
65
- * @param target The target on which to dispatch the event
66
- * @param id The data store id of the project
67
- * @param key The key of the request to delete.
68
- */
69
- static async delete(target, id, key) {
70
- const e = new ContextDeleteEvent(ModelEventTypes.Project.Request.delete, key, id);
71
- target.dispatchEvent(e);
72
- return e.detail.result;
73
- }
74
- /**
75
- * Updates the entire request schema in a project.
76
- *
77
- * @param target The target on which to dispatch the event
78
- * @param id The data store id of the project
79
- * @param request The request to replace the schema for.
80
- * @returns The change record of the updated request.
81
- */
82
- static async update(target, id, request) {
83
- const e = new ContextUpdateEvent(ModelEventTypes.Project.Request.update, { item: request, parent: id });
84
- target.dispatchEvent(e);
85
- return e.detail.result;
86
- }
87
- }
88
- class ProjectEnvironmentEvents {
89
- /**
90
- * Creates an environment in a project.
91
- *
92
- * @param target The target on which to dispatch the event
93
- * @param id The store id of the project
94
- * @param name The name of the environment.
95
- * @param key The optional key of the parent folder.
96
- * @returns The change record of the created environment. Note, the client should either refresh the project from the store or append the change record to the instance of the project.
97
- */
98
- static async create(target, id, name, key) {
99
- const init = { id, name, key };
100
- const e = new ContextEvent(ModelEventTypes.Project.Environment.create, init);
101
- target.dispatchEvent(e);
102
- return e.detail.result;
103
- }
104
- /**
105
- * Deletes an environment from a project
106
- *
107
- * @param target The target on which to dispatch the event
108
- * @param id The data store id of the project
109
- * @param key The key of the environment to delete.
110
- */
111
- static async delete(target, id, key) {
112
- const e = new ContextDeleteEvent(ModelEventTypes.Project.Environment.delete, key, id);
113
- target.dispatchEvent(e);
114
- return e.detail.result;
115
- }
116
- /**
117
- * Updates the entire environment schema in a project.
118
- *
119
- * @param target The target on which to dispatch the event
120
- * @param id The data store id of the project
121
- * @param environment The environment to replace the schema for.
122
- * @returns The change record of the updated environment.
123
- */
124
- static async update(target, id, environment) {
125
- const e = new ContextUpdateEvent(ModelEventTypes.Project.Environment.update, { item: environment, parent: id });
126
- target.dispatchEvent(e);
127
- return e.detail.result;
128
- }
129
- }
130
- /**
131
- * API Client's HTTP project events.
132
- *
133
- * Note, `id`s refers to datastore ids but `key`s are internal identifiers inside the project.
134
- * Whenever id is used it refers to the store's ids. When `key` is used it is the id of the project or any of its components.
135
- */
136
- export class ProjectEvents {
137
- /**
138
- * Creates a new project in the data store.
139
- *
140
- * @param target The target on which to dispatch the event
141
- * @param name The name of the project to create
142
- * @returns The change record of the created project.
143
- */
144
- static async create(target, name) {
145
- const e = new ContextEvent(ModelEventTypes.Project.create, { name });
146
- target.dispatchEvent(e);
147
- return e.detail.result;
148
- }
149
- /**
150
- * Reads a project from the data store.
151
- *
152
- * @param target The target on which to dispatch the event
153
- * @param id The data store id of the project to read.
154
- * @param rev Optional revision version, when supported.
155
- */
156
- static async read(target, id, rev) {
157
- const e = new ContextReadEvent(ModelEventTypes.Project.read, id, rev);
158
- target.dispatchEvent(e);
159
- return e.detail.result;
160
- }
161
- /**
162
- * Updates the entire object in the store.
163
- *
164
- * @param target The target on which to dispatch the event
165
- * @param project The project to replace the value for.
166
- * @returns The change record of the updated project.
167
- */
168
- static async update(target, project) {
169
- const e = new ContextUpdateEvent(ModelEventTypes.Project.update, { item: project });
170
- target.dispatchEvent(e);
171
- return e.detail.result;
172
- }
173
- /**
174
- * Deletes a project from the data store.
175
- *
176
- * @param target The target on which to dispatch the event
177
- * @param id The data store id of the project to delete.
178
- */
179
- static async delete(target, id) {
180
- const e = new ContextDeleteEvent(ModelEventTypes.Project.delete, id);
181
- target.dispatchEvent(e);
182
- return e.detail.result;
183
- }
184
- /**
185
- * Moves a request or a folder inside the project.
186
- *
187
- * @param target The target on which to dispatch the event
188
- * @param type The type of the object to move within the project.
189
- * @param key The `key` of the request of the folder
190
- * @param opts The move options. When omitted then it moves the object to the project root at the last position.
191
- * @returns The change record of the updated project.
192
- */
193
- static async move(target, type, key, opts) {
194
- const e = new ContextEvent(ModelEventTypes.Project.move, {
195
- key,
196
- type,
197
- opts,
198
- });
199
- target.dispatchEvent(e);
200
- return e.detail.result;
201
- }
202
- /**
203
- * Clones a project that is stored in the data store.
204
- *
205
- * @param target The target on which to dispatch the event
206
- * @param id The data store id of the project to clone.
207
- * @returns The cloned project (the copy).
208
- */
209
- static async clone(target, id) {
210
- const e = new ContextEvent(ModelEventTypes.Project.clone, {
211
- id,
212
- });
213
- target.dispatchEvent(e);
214
- return e.detail.result;
215
- }
216
- /**
217
- * Lists all projects in the data store.
218
- * This does not return the whole project record. Instead it only returns the index object of the project.
219
- *
220
- * @param target The target on which to dispatch the event
221
- * @returns The list of project index objects.
222
- */
223
- static async listAll(target) {
224
- const detail = {};
225
- const e = new CustomEvent(ModelEventTypes.Project.listAll, {
226
- bubbles: true,
227
- composed: true,
228
- cancelable: true,
229
- detail,
230
- });
231
- target.dispatchEvent(e);
232
- return e.detail.result;
233
- }
234
- /**
235
- * Events related to a folder manipulation in a project.
236
- */
237
- static get Folder() {
238
- return ProjectFolderEvents;
239
- }
240
- /**
241
- * Events related to a request manipulation in a project.
242
- */
243
- static get Request() {
244
- return ProjectRequestEvents;
245
- }
246
- /**
247
- * Events related to an environment manipulation in a project.
248
- */
249
- static get Environment() {
250
- return ProjectEnvironmentEvents;
251
- }
252
- }
253
- //# sourceMappingURL=ProjectEvents.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProjectEvents.js","sourceRoot":"","sources":["../../../../src/events/models/ProjectEvents.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAuB,kBAAkB,EAAgC,MAAM,kBAAkB,CAAC;AAClL,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,WAAW,MAAM,mBAAmB,CAAC;AA0D5C,MAAM,mBAAmB;IACvB;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAmB,EAAE,EAAU,EAAE,IAAa,EAAE,OAA6B,EAAE;QACjG,MAAM,IAAI,GAAuB,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,IAAI,GAAG,CAAC;QACxD,MAAM,CAAC,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,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAmB;QACtC,MAAM,MAAM,GAAsD,EAAE,CAAC;QACrE,MAAM,CAAC,GAAG,IAAI,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,EAAE;YACzD,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,IAAI;YAChB,MAAM;SACP,CAAC,CAAC;QACH,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;QACxB,OAAO,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,MAAM,KAAK,MAAM;QACf,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,MAAM,KAAK,OAAO;QAChB,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,MAAM,KAAK,WAAW;QACpB,OAAO,wBAAwB,CAAC;IAClC,CAAC;CACF"}
@@ -1,331 +0,0 @@
1
- import { IHttpProject, IProjectInitOptions, IProjectMoveOptions, IHttpProjectIndex, IFolderCreateOptions, IRequestAddOptions } from "../../models/HttpProject.js";
2
- import { IProjectFolder } from "../../models/ProjectFolder.js";
3
- import { IProjectRequest } from "../../models/ProjectRequest.js";
4
- import { IEnvironment } from "../../models/Environment.js";
5
- import { ContextChangeRecord, ContextEvent, ContextReadEvent, ContextUpdateEvent, ContextDeleteRecord, ContextDeleteEvent, ContextEventDetailWithResult } from "../BaseEvents.js";
6
- import { ModelEventTypes } from './ModelEventTypes.js';
7
- import CustomEvent from '../CustomEvent.js';
8
-
9
- export interface ProjectMoveEventDetail {
10
- type: 'request' | 'folder';
11
- key: string;
12
- opts?: IProjectMoveOptions;
13
- }
14
-
15
- export interface ProjectCloneEventDetail {
16
- /**
17
- * The id of the project to clone in the data store.
18
- */
19
- id: string;
20
- }
21
-
22
- /**
23
- * A list of options to initialize a folder in a project.
24
- */
25
- export interface IFolderInitOptions extends IFolderCreateOptions {
26
- /**
27
- * The store id of the project.
28
- */
29
- id: string;
30
- /**
31
- * Optional name of the new folder.
32
- */
33
- name?: string;
34
- }
35
-
36
- /**
37
- * A list of options to initialize a request in a project.
38
- */
39
- export interface IRequestInitOptions extends IRequestAddOptions {
40
- /**
41
- * The store id of the project.
42
- */
43
- id: string;
44
- /**
45
- * The URL of the request.
46
- */
47
- url: string;
48
- }
49
-
50
- export interface IEnvironmentInitOptions {
51
- /**
52
- * The store id of the project.
53
- */
54
- id: string;
55
- /**
56
- * The name of the environment to create.
57
- */
58
- name: string;
59
- /**
60
- * The optional key of the parent folder.
61
- */
62
- key?: string;
63
- }
64
-
65
- class ProjectFolderEvents {
66
- /**
67
- * Creates a folder in a project.
68
- *
69
- * @param target The target on which to dispatch the event
70
- * @param id The store id of the project
71
- * @param name Optionally, name of the folder to create.
72
- * @param opts Optional options to create a folder.
73
- * @returns The change record of the created folder. Note, the client should either refresh the project from the store or append the change record to the instance of the project.
74
- */
75
- static async create(target: EventTarget, id: string, name?: string, opts: IFolderCreateOptions = {}): Promise<ContextChangeRecord<IProjectFolder> | undefined> {
76
- const init: IFolderInitOptions = { ...opts, id, name, };
77
- const e = new ContextEvent<IFolderInitOptions, ContextChangeRecord<IProjectFolder>>(ModelEventTypes.Project.Folder.create, init);
78
- target.dispatchEvent(e);
79
- return e.detail.result;
80
- }
81
-
82
- /**
83
- * Deletes a folder from a project
84
- *
85
- * @param target The target on which to dispatch the event
86
- * @param id The data store id of the project
87
- * @param key The key of the folder to delete.
88
- */
89
- static async delete(target: EventTarget, id: string, key: string): Promise<ContextDeleteRecord | undefined> {
90
- const e = new ContextDeleteEvent(ModelEventTypes.Project.Folder.delete, key, id);
91
- target.dispatchEvent(e);
92
- return e.detail.result;
93
- }
94
-
95
- /**
96
- * Updates the entire folder schema in a project.
97
- *
98
- * @param target The target on which to dispatch the event
99
- * @param id The data store id of the project
100
- * @param folder The folder to replace the schema for.
101
- * @returns The change record of the updated folder.
102
- */
103
- static async update(target: EventTarget, id: string, folder: IProjectFolder): Promise<ContextChangeRecord<IProjectFolder> | undefined> {
104
- const e = new ContextUpdateEvent(ModelEventTypes.Project.Folder.update, { item: folder, parent: id });
105
- target.dispatchEvent(e);
106
- return e.detail.result;
107
- }
108
- }
109
-
110
- class ProjectRequestEvents {
111
- /**
112
- * Creates a request in a project.
113
- *
114
- * @param target The target on which to dispatch the event
115
- * @param id The store id of the project
116
- * @param url The URL of the request.
117
- * @param opts Optional options to create a request.
118
- * @returns The change record of the created request. Note, the client should either refresh the project from the store or append the change record to the instance of the project.
119
- */
120
- static async create(target: EventTarget, id: string, url: string, opts: IRequestAddOptions = {}): Promise<ContextChangeRecord<IProjectRequest> | undefined> {
121
- const init: IRequestInitOptions = { ...opts, id, url, };
122
- const e = new ContextEvent<IRequestInitOptions, ContextChangeRecord<IProjectRequest>>(ModelEventTypes.Project.Request.create, init);
123
- target.dispatchEvent(e);
124
- return e.detail.result;
125
- }
126
-
127
- /**
128
- * Deletes a request from a project
129
- *
130
- * @param target The target on which to dispatch the event
131
- * @param id The data store id of the project
132
- * @param key The key of the request to delete.
133
- */
134
- static async delete(target: EventTarget, id: string, key: string): Promise<ContextDeleteRecord | undefined> {
135
- const e = new ContextDeleteEvent(ModelEventTypes.Project.Request.delete, key, id);
136
- target.dispatchEvent(e);
137
- return e.detail.result;
138
- }
139
-
140
- /**
141
- * Updates the entire request schema in a project.
142
- *
143
- * @param target The target on which to dispatch the event
144
- * @param id The data store id of the project
145
- * @param request The request to replace the schema for.
146
- * @returns The change record of the updated request.
147
- */
148
- static async update(target: EventTarget, id: string, request: IProjectRequest): Promise<ContextChangeRecord<IProjectRequest> | undefined> {
149
- const e = new ContextUpdateEvent(ModelEventTypes.Project.Request.update, { item: request, parent: id });
150
- target.dispatchEvent(e);
151
- return e.detail.result;
152
- }
153
- }
154
-
155
- class ProjectEnvironmentEvents {
156
- /**
157
- * Creates an environment in a project.
158
- *
159
- * @param target The target on which to dispatch the event
160
- * @param id The store id of the project
161
- * @param name The name of the environment.
162
- * @param key The optional key of the parent folder.
163
- * @returns The change record of the created environment. Note, the client should either refresh the project from the store or append the change record to the instance of the project.
164
- */
165
- static async create(target: EventTarget, id: string, name: string, key?: string): Promise<ContextChangeRecord<IEnvironment> | undefined> {
166
- const init: IEnvironmentInitOptions = { id, name, key };
167
- const e = new ContextEvent<IEnvironmentInitOptions, ContextChangeRecord<IEnvironment>>(ModelEventTypes.Project.Environment.create, init);
168
- target.dispatchEvent(e);
169
- return e.detail.result;
170
- }
171
-
172
- /**
173
- * Deletes an environment from a project
174
- *
175
- * @param target The target on which to dispatch the event
176
- * @param id The data store id of the project
177
- * @param key The key of the environment to delete.
178
- */
179
- static async delete(target: EventTarget, id: string, key: string): Promise<ContextDeleteRecord | undefined> {
180
- const e = new ContextDeleteEvent(ModelEventTypes.Project.Environment.delete, key, id);
181
- target.dispatchEvent(e);
182
- return e.detail.result;
183
- }
184
-
185
- /**
186
- * Updates the entire environment schema in a project.
187
- *
188
- * @param target The target on which to dispatch the event
189
- * @param id The data store id of the project
190
- * @param environment The environment to replace the schema for.
191
- * @returns The change record of the updated environment.
192
- */
193
- static async update(target: EventTarget, id: string, environment: IEnvironment): Promise<ContextChangeRecord<IEnvironment> | undefined> {
194
- const e = new ContextUpdateEvent(ModelEventTypes.Project.Environment.update, { item: environment, parent: id });
195
- target.dispatchEvent(e);
196
- return e.detail.result;
197
- }
198
- }
199
-
200
- /**
201
- * API Client's HTTP project events.
202
- *
203
- * Note, `id`s refers to datastore ids but `key`s are internal identifiers inside the project.
204
- * Whenever id is used it refers to the store's ids. When `key` is used it is the id of the project or any of its components.
205
- */
206
- export class ProjectEvents {
207
- /**
208
- * Creates a new project in the data store.
209
- *
210
- * @param target The target on which to dispatch the event
211
- * @param name The name of the project to create
212
- * @returns The change record of the created project.
213
- */
214
- static async create(target: EventTarget, name: string): Promise<ContextChangeRecord<IHttpProject> | undefined> {
215
- const e = new ContextEvent<IProjectInitOptions, ContextChangeRecord<IHttpProject>>(ModelEventTypes.Project.create, { name });
216
- target.dispatchEvent(e);
217
- return e.detail.result;
218
- }
219
-
220
- /**
221
- * Reads a project from the data store.
222
- *
223
- * @param target The target on which to dispatch the event
224
- * @param id The data store id of the project to read.
225
- * @param rev Optional revision version, when supported.
226
- */
227
- static async read(target: EventTarget, id: string, rev?: string): Promise<IHttpProject | undefined> {
228
- const e = new ContextReadEvent<IHttpProject>(ModelEventTypes.Project.read, id, rev);
229
- target.dispatchEvent(e);
230
- return e.detail.result;
231
- }
232
-
233
- /**
234
- * Updates the entire object in the store.
235
- *
236
- * @param target The target on which to dispatch the event
237
- * @param project The project to replace the value for.
238
- * @returns The change record of the updated project.
239
- */
240
- static async update(target: EventTarget, project: IHttpProject): Promise<ContextChangeRecord<IHttpProject> | undefined> {
241
- const e = new ContextUpdateEvent(ModelEventTypes.Project.update, { item: project });
242
- target.dispatchEvent(e);
243
- return e.detail.result;
244
- }
245
-
246
- /**
247
- * Deletes a project from the data store.
248
- *
249
- * @param target The target on which to dispatch the event
250
- * @param id The data store id of the project to delete.
251
- */
252
- static async delete(target: EventTarget, id: string): Promise<ContextDeleteRecord | undefined> {
253
- const e = new ContextDeleteEvent(ModelEventTypes.Project.delete, id);
254
- target.dispatchEvent(e);
255
- return e.detail.result;
256
- }
257
-
258
- /**
259
- * Moves a request or a folder inside the project.
260
- *
261
- * @param target The target on which to dispatch the event
262
- * @param type The type of the object to move within the project.
263
- * @param key The `key` of the request of the folder
264
- * @param opts The move options. When omitted then it moves the object to the project root at the last position.
265
- * @returns The change record of the updated project.
266
- */
267
- static async move(target: EventTarget, type: 'request' | 'folder', key: string, opts?: IProjectMoveOptions): Promise<ContextChangeRecord<IHttpProject> | undefined> {
268
- const e = new ContextEvent<ProjectMoveEventDetail, ContextChangeRecord<IHttpProject>>(ModelEventTypes.Project.move, {
269
- key,
270
- type,
271
- opts,
272
- });
273
- target.dispatchEvent(e);
274
- return e.detail.result;
275
- }
276
-
277
- /**
278
- * Clones a project that is stored in the data store.
279
- *
280
- * @param target The target on which to dispatch the event
281
- * @param id The data store id of the project to clone.
282
- * @returns The cloned project (the copy).
283
- */
284
- static async clone(target: EventTarget, id: string): Promise<ContextChangeRecord<IHttpProject> | undefined> {
285
- const e = new ContextEvent<ProjectCloneEventDetail, ContextChangeRecord<IHttpProject>>(ModelEventTypes.Project.clone, {
286
- id,
287
- });
288
- target.dispatchEvent(e);
289
- return e.detail.result;
290
- }
291
-
292
- /**
293
- * Lists all projects in the data store.
294
- * This does not return the whole project record. Instead it only returns the index object of the project.
295
- *
296
- * @param target The target on which to dispatch the event
297
- * @returns The list of project index objects.
298
- */
299
- static async listAll(target: EventTarget): Promise<IHttpProjectIndex[] | undefined> {
300
- const detail: ContextEventDetailWithResult<IHttpProjectIndex[]> = {};
301
- const e = new CustomEvent(ModelEventTypes.Project.listAll, {
302
- bubbles: true,
303
- composed: true,
304
- cancelable: true,
305
- detail,
306
- });
307
- target.dispatchEvent(e);
308
- return e.detail.result;
309
- }
310
-
311
- /**
312
- * Events related to a folder manipulation in a project.
313
- */
314
- static get Folder(): typeof ProjectFolderEvents {
315
- return ProjectFolderEvents;
316
- }
317
-
318
- /**
319
- * Events related to a request manipulation in a project.
320
- */
321
- static get Request(): typeof ProjectRequestEvents {
322
- return ProjectRequestEvents;
323
- }
324
-
325
- /**
326
- * Events related to an environment manipulation in a project.
327
- */
328
- static get Environment(): typeof ProjectEnvironmentEvents {
329
- return ProjectEnvironmentEvents;
330
- }
331
- }