@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,7 +1,7 @@
1
1
  import { IRequestConfig, RequestConfig } from './RequestConfig.js';
2
2
  import { Thing, IThing, Kind as ThingKind } from './Thing.js';
3
3
  import { IRequestActions, RequestActions } from './RequestActions.js';
4
- import { IRequestCertificate } from './ClientCertificate.js';
4
+ import { HttpCertificate, Certificate } from './ClientCertificate.js';
5
5
  import { IRequestAuthorization, RequestAuthorization } from './RequestAuthorization.js';
6
6
  import { IRequestLog, RequestLog, Kind as LogKind } from './RequestLog.js';
7
7
  import { SentRequest } from './SentRequest.js';
@@ -64,7 +64,7 @@ export interface IRequest {
64
64
  /**
65
65
  * The list of certificates to use with the request.
66
66
  */
67
- clientCertificate?: IRequestCertificate;
67
+ clientCertificate?: HttpCertificate;
68
68
  }
69
69
 
70
70
  export class Request {
@@ -99,7 +99,7 @@ export class Request {
99
99
  /**
100
100
  * The list of certificates to use with the request.
101
101
  */
102
- clientCertificate?: IRequestCertificate;
102
+ clientCertificate?: Certificate;
103
103
 
104
104
  /**
105
105
  * Creates a request from an URL.
@@ -373,7 +373,7 @@ export class Request {
373
373
  this.actions = undefined;
374
374
  }
375
375
  if (clientCertificate) {
376
- this.clientCertificate = clientCertificate;
376
+ this.clientCertificate = new Certificate(clientCertificate);
377
377
  } else {
378
378
  this.clientCertificate = undefined;
379
379
  }
@@ -401,7 +401,7 @@ export class Request {
401
401
  result.actions = this.actions.toJSON();
402
402
  }
403
403
  if (this.clientCertificate) {
404
- result.clientCertificate = { ...this.clientCertificate };
404
+ result.clientCertificate = this.clientCertificate.toJSON();
405
405
  }
406
406
  return result;
407
407
  }
@@ -58,9 +58,13 @@ export class RequestAuthorization {
58
58
  }
59
59
 
60
60
  static fromLegacy(info: LegacyAuthorization): RequestAuthorization {
61
+ const copy = { ...info };
62
+ if (copy.type === 'client certificate') {
63
+ copy.config = {};
64
+ }
61
65
  return new RequestAuthorization({
62
66
  kind: Kind,
63
- config: info.config,
67
+ config: (info.config as any),
64
68
  enabled: true,
65
69
  type: info.type as AuthorizationType,
66
70
  valid: info.valid,
@@ -728,12 +728,15 @@ export class CoreEngine extends HttpEngine {
728
728
  return;
729
729
  }
730
730
  if (data.length === 0) {
731
+ if (this.currentResponse?.status === 204) {
732
+ this._reportResponse();
733
+ return;
734
+ }
731
735
  if (this.currentHeaders.has('Content-Length')) {
732
736
  // If the server do not close the connection and clearly indicate that
733
737
  // there are no further data to receive the app can close the connection
734
738
  // and prepare the response.
735
739
  const length = Number(this.currentHeaders.get('Content-Length'));
736
- // NaN never equals NaN. This is faster.
737
740
  if (!Number.isNaN(length) && length === 0) {
738
741
  this._reportResponse();
739
742
  return;
@@ -10,7 +10,7 @@ import { IHttpRequest, HttpRequest } from '../../models/HttpRequest.js';
10
10
  import { IRequestBaseConfig } from '../../models/RequestConfig.js';
11
11
  import { IRequestAuthorization } from '../../models/RequestAuthorization.js';
12
12
  import { HostRule } from '../../models/HostRule.js';
13
- import { IRequestCertificate } from '../../models/ClientCertificate.js';
13
+ import { HttpCertificate } from '../../models/ClientCertificate.js';
14
14
  import { SentRequest } from '../../models/SentRequest.js';
15
15
  import { Response } from '../../models/Response.js';
16
16
  import { ErrorResponse } from '../../models/ErrorResponse.js';
@@ -40,7 +40,7 @@ export interface HttpEngineOptions extends IRequestBaseConfig {
40
40
  /**
41
41
  * A certificate to use with the request.
42
42
  */
43
- certificates?: IRequestCertificate[];
43
+ certificates?: HttpCertificate[];
44
44
  }
45
45
 
46
46
  export interface RequestStats {
@@ -385,7 +385,7 @@ export abstract class HttpEngine extends EventEmitter {
385
385
 
386
386
  /**
387
387
  * Reports response when redirected.
388
- * @param Received status code
388
+ * @param status Received status code
389
389
  * @return True if the request has been redirected.
390
390
  */
391
391
  _reportRedirect(status: number): boolean {
@@ -734,51 +734,57 @@ Check your request parameters.`);
734
734
  * @param certificate List of certificate configurations.
735
735
  * @param options Request options. Cert agent options are added to this object.
736
736
  */
737
- _addClientCertificate(certificate: IRequestCertificate, options: tls.ConnectionOptions): void {
737
+ _addClientCertificate(certificate: HttpCertificate, options: tls.ConnectionOptions): void {
738
738
  if (!certificate) {
739
739
  return;
740
740
  }
741
741
  const cert = { ...certificate };
742
- if (!Array.isArray(cert.cert)) {
743
- cert.cert = [cert.cert];
744
- }
745
742
  if (cert.type === 'p12') {
746
743
  if (!options.pfx) {
747
744
  options.pfx = [];
748
745
  }
749
- const added = cert.cert.map((item) => {
750
- const struct: tls.PxfObject = {
751
- buf: Buffer.from(item.data as string),
752
- };
753
- if (item.passphrase) {
754
- struct.passphrase = item.passphrase;
746
+ const struct: tls.PxfObject = {
747
+ buf: Buffer.from(cert.cert.data as string),
748
+ };
749
+ if (cert.cert.passphrase) {
750
+ struct.passphrase = cert.cert.passphrase;
751
+ }
752
+ if (!Array.isArray(options.pfx)) {
753
+ if (options.pfx) {
754
+ options.pfx = [options.pfx];
755
+ } else {
756
+ options.pfx = [];
755
757
  }
756
- return struct;
757
- });
758
- options.pfx = (options.pfx as tls.PxfObject[]).concat(added);
758
+ }
759
+ options.pfx.push(struct);
759
760
  } else if (cert.type === 'pem') {
760
761
  if (!options.cert) {
761
762
  options.cert = [];
762
763
  }
763
- const added = cert.cert.map((item) => Buffer.from(item.data as string));
764
- options.cert = (options.cert as Buffer[]).concat(added);
765
- if (cert.key) {
766
- if (!Array.isArray(cert.key)) {
767
- cert.key = [cert.key];
768
- }
769
- if (!options.key) {
770
- options.key = [];
764
+ if (!Array.isArray(options.cert)) {
765
+ if (options.cert) {
766
+ options.cert = [options.cert];
767
+ } else {
768
+ options.cert = [];
771
769
  }
772
- const keys = cert.key.map((item) => {
773
- const struct: tls.KeyObject = {
774
- pem: Buffer.from(item.data as string),
775
- };
776
- if (item.passphrase) {
777
- struct.passphrase = item.passphrase;
770
+ }
771
+ const added = Buffer.from(cert.cert.data as string);
772
+ options.cert.push(added);
773
+ if (cert.certKey) {
774
+ if (!Array.isArray(options.key)) {
775
+ if (options.key) {
776
+ options.key = [options.key];
777
+ } else {
778
+ options.key = [];
778
779
  }
779
- return struct;
780
- });
781
- options.key = (options.key as tls.KeyObject[]).concat(keys);
780
+ }
781
+ const struct: tls.KeyObject = {
782
+ pem: Buffer.from(cert.certKey.data as string),
783
+ };
784
+ if (cert.certKey.passphrase) {
785
+ struct.passphrase = cert.certKey.passphrase;
786
+ }
787
+ options.key.push(struct);
782
788
  }
783
789
  }
784
790
  }
@@ -8,7 +8,7 @@ import { ClientCertificateEvents } from '../../events/models/ClientCertificateEv
8
8
  import { IRequestAuthorization } from '../../models/RequestAuthorization.js';
9
9
  import { IRequestConfig } from '../../models/RequestConfig.js';
10
10
  import { IRequestLog } from '../../models/RequestLog.js';
11
- import { IRequestCertificate } from '../../models/ClientCertificate.js';
11
+ import { HttpCertificate } from '../../models/ClientCertificate.js';
12
12
 
13
13
  export interface RegisteredRequestModule {
14
14
  fn: (request: IHttpRequest, context: ExecutionContext) => Promise<number>;
@@ -49,7 +49,7 @@ export interface ExecutionContext {
49
49
  /**
50
50
  * Can be altered by the actions.
51
51
  */
52
- certificates?: IRequestCertificate[];
52
+ certificates?: HttpCertificate[];
53
53
  }
54
54
 
55
55
  export interface ExecutionEvents {
@@ -9,18 +9,14 @@ import { ExecutionContext } from './ModulesRegistry.js';
9
9
  * Injects client certificate object into the request object
10
10
  */
11
11
  async function processClientCertificate(config: ICCAuthorization, context: ExecutionContext): Promise<void> {
12
- const { id } = config;
13
- if (!id || !context.Events) {
14
- return;
15
- }
16
- const result = await context.Events.ClientCertificate.read(context.eventsTarget, id);
17
- if (!result) {
12
+ const { certificate } = config;
13
+ if (!certificate) {
18
14
  return;
19
15
  }
20
16
  if (!Array.isArray(context.certificates)) {
21
17
  context.certificates = [];
22
18
  }
23
- context.certificates.push(result);
19
+ context.certificates.push(certificate);
24
20
  }
25
21
 
26
22
  /**
@@ -136,7 +136,7 @@ export class ProjectRequestRunner extends EventEmitter {
136
136
  factory.actions = request.actions.toJSON();
137
137
  }
138
138
  if (request.clientCertificate) {
139
- factory.certificates = [request.clientCertificate];
139
+ factory.certificates = [request.clientCertificate.toJSON()];
140
140
  }
141
141
  if (config.enabled !== false) {
142
142
  factory.config = config.toJSON();
@@ -3,7 +3,7 @@ import { IHttpRequest } from '../../models/HttpRequest.js';
3
3
  import { IRequestConfig, IRequestBaseConfig } from '../../models/RequestConfig.js';
4
4
  import { IRequestAuthorization } from '../../models/RequestAuthorization.js';
5
5
  import { IRequestActions } from '../../models/RequestActions.js';
6
- import { IRequestCertificate } from '../../models/ClientCertificate.js';
6
+ import { HttpCertificate } from '../../models/ClientCertificate.js';
7
7
  import { IRequestLog } from '../../models/RequestLog.js';
8
8
  import { VariablesProcessor } from '../variables/VariablesProcessor.js';
9
9
  import { IRunnableAction } from '../../models/actions/RunnableAction.js';
@@ -57,7 +57,7 @@ export class RequestFactory {
57
57
  /**
58
58
  * The list of certificates to use with the request.
59
59
  */
60
- certificates?: IRequestCertificate[];
60
+ certificates?: HttpCertificate[];
61
61
  /**
62
62
  * The cumulative list of all variables to be applied to the request and other properties.
63
63
  * The variables must be already processed for variables in values (evaluated).
@@ -1,221 +0,0 @@
1
- import { IHttpProject, 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, ContextDeleteRecord } from "../BaseEvents.js";
6
- export interface ProjectMoveEventDetail {
7
- type: 'request' | 'folder';
8
- key: string;
9
- opts?: IProjectMoveOptions;
10
- }
11
- export interface ProjectCloneEventDetail {
12
- /**
13
- * The id of the project to clone in the data store.
14
- */
15
- id: string;
16
- }
17
- /**
18
- * A list of options to initialize a folder in a project.
19
- */
20
- export interface IFolderInitOptions extends IFolderCreateOptions {
21
- /**
22
- * The store id of the project.
23
- */
24
- id: string;
25
- /**
26
- * Optional name of the new folder.
27
- */
28
- name?: string;
29
- }
30
- /**
31
- * A list of options to initialize a request in a project.
32
- */
33
- export interface IRequestInitOptions extends IRequestAddOptions {
34
- /**
35
- * The store id of the project.
36
- */
37
- id: string;
38
- /**
39
- * The URL of the request.
40
- */
41
- url: string;
42
- }
43
- export interface IEnvironmentInitOptions {
44
- /**
45
- * The store id of the project.
46
- */
47
- id: string;
48
- /**
49
- * The name of the environment to create.
50
- */
51
- name: string;
52
- /**
53
- * The optional key of the parent folder.
54
- */
55
- key?: string;
56
- }
57
- declare class ProjectFolderEvents {
58
- /**
59
- * Creates a folder in a project.
60
- *
61
- * @param target The target on which to dispatch the event
62
- * @param id The store id of the project
63
- * @param name Optionally, name of the folder to create.
64
- * @param opts Optional options to create a folder.
65
- * @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.
66
- */
67
- static create(target: EventTarget, id: string, name?: string, opts?: IFolderCreateOptions): Promise<ContextChangeRecord<IProjectFolder> | undefined>;
68
- /**
69
- * Deletes a folder from a project
70
- *
71
- * @param target The target on which to dispatch the event
72
- * @param id The data store id of the project
73
- * @param key The key of the folder to delete.
74
- */
75
- static delete(target: EventTarget, id: string, key: string): Promise<ContextDeleteRecord | undefined>;
76
- /**
77
- * Updates the entire folder schema in a project.
78
- *
79
- * @param target The target on which to dispatch the event
80
- * @param id The data store id of the project
81
- * @param folder The folder to replace the schema for.
82
- * @returns The change record of the updated folder.
83
- */
84
- static update(target: EventTarget, id: string, folder: IProjectFolder): Promise<ContextChangeRecord<IProjectFolder> | undefined>;
85
- }
86
- declare class ProjectRequestEvents {
87
- /**
88
- * Creates a request in a project.
89
- *
90
- * @param target The target on which to dispatch the event
91
- * @param id The store id of the project
92
- * @param url The URL of the request.
93
- * @param opts Optional options to create a request.
94
- * @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.
95
- */
96
- static create(target: EventTarget, id: string, url: string, opts?: IRequestAddOptions): Promise<ContextChangeRecord<IProjectRequest> | undefined>;
97
- /**
98
- * Deletes a request from a project
99
- *
100
- * @param target The target on which to dispatch the event
101
- * @param id The data store id of the project
102
- * @param key The key of the request to delete.
103
- */
104
- static delete(target: EventTarget, id: string, key: string): Promise<ContextDeleteRecord | undefined>;
105
- /**
106
- * Updates the entire request schema in a project.
107
- *
108
- * @param target The target on which to dispatch the event
109
- * @param id The data store id of the project
110
- * @param request The request to replace the schema for.
111
- * @returns The change record of the updated request.
112
- */
113
- static update(target: EventTarget, id: string, request: IProjectRequest): Promise<ContextChangeRecord<IProjectRequest> | undefined>;
114
- }
115
- declare class ProjectEnvironmentEvents {
116
- /**
117
- * Creates an environment in a project.
118
- *
119
- * @param target The target on which to dispatch the event
120
- * @param id The store id of the project
121
- * @param name The name of the environment.
122
- * @param key The optional key of the parent folder.
123
- * @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.
124
- */
125
- static create(target: EventTarget, id: string, name: string, key?: string): Promise<ContextChangeRecord<IEnvironment> | undefined>;
126
- /**
127
- * Deletes an environment from a project
128
- *
129
- * @param target The target on which to dispatch the event
130
- * @param id The data store id of the project
131
- * @param key The key of the environment to delete.
132
- */
133
- static delete(target: EventTarget, id: string, key: string): Promise<ContextDeleteRecord | undefined>;
134
- /**
135
- * Updates the entire environment schema in a project.
136
- *
137
- * @param target The target on which to dispatch the event
138
- * @param id The data store id of the project
139
- * @param environment The environment to replace the schema for.
140
- * @returns The change record of the updated environment.
141
- */
142
- static update(target: EventTarget, id: string, environment: IEnvironment): Promise<ContextChangeRecord<IEnvironment> | undefined>;
143
- }
144
- /**
145
- * API Client's HTTP project events.
146
- *
147
- * Note, `id`s refers to datastore ids but `key`s are internal identifiers inside the project.
148
- * 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.
149
- */
150
- export declare class ProjectEvents {
151
- /**
152
- * Creates a new project in the data store.
153
- *
154
- * @param target The target on which to dispatch the event
155
- * @param name The name of the project to create
156
- * @returns The change record of the created project.
157
- */
158
- static create(target: EventTarget, name: string): Promise<ContextChangeRecord<IHttpProject> | undefined>;
159
- /**
160
- * Reads a project from the data store.
161
- *
162
- * @param target The target on which to dispatch the event
163
- * @param id The data store id of the project to read.
164
- * @param rev Optional revision version, when supported.
165
- */
166
- static read(target: EventTarget, id: string, rev?: string): Promise<IHttpProject | undefined>;
167
- /**
168
- * Updates the entire object in the store.
169
- *
170
- * @param target The target on which to dispatch the event
171
- * @param project The project to replace the value for.
172
- * @returns The change record of the updated project.
173
- */
174
- static update(target: EventTarget, project: IHttpProject): Promise<ContextChangeRecord<IHttpProject> | undefined>;
175
- /**
176
- * Deletes a project from the data store.
177
- *
178
- * @param target The target on which to dispatch the event
179
- * @param id The data store id of the project to delete.
180
- */
181
- static delete(target: EventTarget, id: string): Promise<ContextDeleteRecord | undefined>;
182
- /**
183
- * Moves a request or a folder inside the project.
184
- *
185
- * @param target The target on which to dispatch the event
186
- * @param type The type of the object to move within the project.
187
- * @param key The `key` of the request of the folder
188
- * @param opts The move options. When omitted then it moves the object to the project root at the last position.
189
- * @returns The change record of the updated project.
190
- */
191
- static move(target: EventTarget, type: 'request' | 'folder', key: string, opts?: IProjectMoveOptions): Promise<ContextChangeRecord<IHttpProject> | undefined>;
192
- /**
193
- * Clones a project that is stored in the data store.
194
- *
195
- * @param target The target on which to dispatch the event
196
- * @param id The data store id of the project to clone.
197
- * @returns The cloned project (the copy).
198
- */
199
- static clone(target: EventTarget, id: string): Promise<ContextChangeRecord<IHttpProject> | undefined>;
200
- /**
201
- * Lists all projects in the data store.
202
- * This does not return the whole project record. Instead it only returns the index object of the project.
203
- *
204
- * @param target The target on which to dispatch the event
205
- * @returns The list of project index objects.
206
- */
207
- static listAll(target: EventTarget): Promise<IHttpProjectIndex[] | undefined>;
208
- /**
209
- * Events related to a folder manipulation in a project.
210
- */
211
- static get Folder(): typeof ProjectFolderEvents;
212
- /**
213
- * Events related to a request manipulation in a project.
214
- */
215
- static get Request(): typeof ProjectRequestEvents;
216
- /**
217
- * Events related to an environment manipulation in a project.
218
- */
219
- static get Environment(): typeof ProjectEnvironmentEvents;
220
- }
221
- export {};