@api-client/core 0.19.39 → 0.19.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/models/store/Organization.d.ts +4 -0
- package/build/src/models/store/Organization.d.ts.map +1 -1
- package/build/src/models/store/Organization.js.map +1 -1
- package/build/src/proxy/HttpProjectProxy.js +1 -1
- package/build/src/proxy/HttpProjectProxy.js.map +1 -1
- package/build/src/sdk/AiSdk.js +4 -4
- package/build/src/sdk/AiSdk.js.map +1 -1
- package/build/src/sdk/DataCatalogSdk.d.ts.map +1 -1
- package/build/src/sdk/DataCatalogSdk.js +9 -9
- package/build/src/sdk/DataCatalogSdk.js.map +1 -1
- package/build/src/sdk/DeploymentsSdk.d.ts +1 -1
- package/build/src/sdk/DeploymentsSdk.d.ts.map +1 -1
- package/build/src/sdk/DeploymentsSdk.js +6 -3
- package/build/src/sdk/DeploymentsSdk.js.map +1 -1
- package/build/src/sdk/FilesSdk.js +7 -7
- package/build/src/sdk/FilesSdk.js.map +1 -1
- package/build/src/sdk/GroupsSdk.js +4 -4
- package/build/src/sdk/GroupsSdk.js.map +1 -1
- package/build/src/sdk/HistorySdk.js +2 -2
- package/build/src/sdk/HistorySdk.js.map +1 -1
- package/build/src/sdk/OrganizationsSdk.js +12 -12
- package/build/src/sdk/OrganizationsSdk.js.map +1 -1
- package/build/src/sdk/ProjectExecutionsSdk.d.ts.map +1 -1
- package/build/src/sdk/ProjectExecutionsSdk.js +4 -4
- package/build/src/sdk/ProjectExecutionsSdk.js.map +1 -1
- package/build/src/sdk/SdkBase.d.ts +8 -0
- package/build/src/sdk/SdkBase.d.ts.map +1 -1
- package/build/src/sdk/SdkBase.js.map +1 -1
- package/build/src/sdk/SdkMock.d.ts +4 -1
- package/build/src/sdk/SdkMock.d.ts.map +1 -1
- package/build/src/sdk/SdkMock.js +87 -302
- package/build/src/sdk/SdkMock.js.map +1 -1
- package/build/src/sdk/UsersSdk.js +1 -1
- package/build/src/sdk/UsersSdk.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/models/store/Organization.ts +4 -0
- package/src/proxy/HttpProjectProxy.ts +1 -1
- package/src/sdk/AiSdk.ts +4 -4
- package/src/sdk/DataCatalogSdk.ts +10 -10
- package/src/sdk/DeploymentsSdk.ts +8 -5
- package/src/sdk/FilesSdk.ts +7 -7
- package/src/sdk/GroupsSdk.ts +4 -4
- package/src/sdk/HistorySdk.ts +2 -2
- package/src/sdk/OrganizationsSdk.ts +12 -12
- package/src/sdk/ProjectExecutionsSdk.ts +7 -7
- package/src/sdk/SdkBase.ts +9 -0
- package/src/sdk/SdkMock.ts +105 -320
- package/src/sdk/UsersSdk.ts +1 -1
- package/tests/unit/runtime/proxy/HttpProjectProxy.spec.ts +3 -2
- package/src/sdk/README-MOCK.md +0 -40
package/build/src/sdk/SdkMock.js
CHANGED
|
@@ -4,7 +4,7 @@ import { RouteBuilder } from './RouteBuilder.js';
|
|
|
4
4
|
import { ModelingMock } from '../mocking/ModelingMock.js';
|
|
5
5
|
import { DataDomain } from '../modeling/DataDomain.js';
|
|
6
6
|
import { nanoid } from '../nanoid.js';
|
|
7
|
-
import { DeploymentEnvironment } from '../models/store/Deployment.js';
|
|
7
|
+
import { DeploymentEnvironment, DeploymentStatus } from '../models/store/Deployment.js';
|
|
8
8
|
/**
|
|
9
9
|
* SDK mocking utility for testing. Uses Service Workers to intercept HTTP requests
|
|
10
10
|
* and provide mock responses for API calls.
|
|
@@ -107,10 +107,7 @@ export class SdkMock {
|
|
|
107
107
|
*/
|
|
108
108
|
list: async (init, options) => {
|
|
109
109
|
const { mock } = this;
|
|
110
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
111
|
-
data: this.gen.organization.organizations(init?.size ?? 5),
|
|
112
|
-
cursor: this.createCursorOption(init),
|
|
113
|
-
}), init);
|
|
110
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapList(this.gen.organization.organizations(init?.size ?? 5), init), init);
|
|
114
111
|
await mock.add({
|
|
115
112
|
match: {
|
|
116
113
|
uri: RouteBuilder.organizations(),
|
|
@@ -125,12 +122,7 @@ export class SdkMock {
|
|
|
125
122
|
*/
|
|
126
123
|
create: async (init, options) => {
|
|
127
124
|
const { mock } = this;
|
|
128
|
-
|
|
129
|
-
// status: 200,
|
|
130
|
-
// headers: { 'content-type': 'application/json' },
|
|
131
|
-
// body: JSON.stringify(this.gen.organization.organization()),
|
|
132
|
-
// }
|
|
133
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.organization.organization()), init);
|
|
125
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.organization.organization()), init);
|
|
134
126
|
await mock.add({
|
|
135
127
|
match: {
|
|
136
128
|
uri: RouteBuilder.organizations(),
|
|
@@ -142,13 +134,7 @@ export class SdkMock {
|
|
|
142
134
|
invitations: {
|
|
143
135
|
list: async (init, options) => {
|
|
144
136
|
const { mock } = this;
|
|
145
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
146
|
-
const obj = {
|
|
147
|
-
data: this.gen.invitation.invitations(init?.size ?? 5),
|
|
148
|
-
cursor: this.createCursorOption(init),
|
|
149
|
-
};
|
|
150
|
-
return JSON.stringify(obj);
|
|
151
|
-
}, init);
|
|
137
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapList(this.gen.invitation.invitations(init?.size ?? 5), init), init);
|
|
152
138
|
await mock.add({
|
|
153
139
|
match: {
|
|
154
140
|
uri: RouteBuilder.invitations(':oid'),
|
|
@@ -159,12 +145,7 @@ export class SdkMock {
|
|
|
159
145
|
},
|
|
160
146
|
create: async (init, options) => {
|
|
161
147
|
const { mock } = this;
|
|
162
|
-
|
|
163
|
-
// status: 200,
|
|
164
|
-
// headers: { 'content-type': 'application/json' },
|
|
165
|
-
// body: JSON.stringify(this.gen.invitation.invitation()),
|
|
166
|
-
// }
|
|
167
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.invitation.invitation()), init);
|
|
148
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.invitation.invitation()), init);
|
|
168
149
|
await mock.add({
|
|
169
150
|
match: {
|
|
170
151
|
uri: RouteBuilder.invitations(':oid'),
|
|
@@ -175,12 +156,7 @@ export class SdkMock {
|
|
|
175
156
|
},
|
|
176
157
|
findByToken: async (init, options) => {
|
|
177
158
|
const { mock } = this;
|
|
178
|
-
|
|
179
|
-
// status: 200,
|
|
180
|
-
// headers: { 'content-type': 'application/json' },
|
|
181
|
-
// body: JSON.stringify(this.gen.invitation.invitation()),
|
|
182
|
-
// }
|
|
183
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.invitation.invitation()), init);
|
|
159
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.invitation.invitation()), init);
|
|
184
160
|
await mock.add({
|
|
185
161
|
match: {
|
|
186
162
|
uri: RouteBuilder.findInvitation(),
|
|
@@ -191,12 +167,7 @@ export class SdkMock {
|
|
|
191
167
|
},
|
|
192
168
|
decline: async (init, options) => {
|
|
193
169
|
const { mock } = this;
|
|
194
|
-
|
|
195
|
-
// status: 200,
|
|
196
|
-
// headers: { 'content-type': 'application/json' },
|
|
197
|
-
// body: JSON.stringify(this.gen.invitation.invitation()),
|
|
198
|
-
// }
|
|
199
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.invitation.invitation()), init);
|
|
170
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.invitation.invitation()), init);
|
|
200
171
|
await mock.add({
|
|
201
172
|
match: {
|
|
202
173
|
uri: RouteBuilder.declineInvitation(':oid', ':id'),
|
|
@@ -207,12 +178,7 @@ export class SdkMock {
|
|
|
207
178
|
},
|
|
208
179
|
delete: async (init, options) => {
|
|
209
180
|
const { mock } = this;
|
|
210
|
-
|
|
211
|
-
// status: 200,
|
|
212
|
-
// headers: { 'content-type': 'application/json' },
|
|
213
|
-
// body: JSON.stringify(this.gen.invitation.invitation()),
|
|
214
|
-
// }
|
|
215
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.invitation.invitation()), init);
|
|
181
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.invitation.invitation()), init);
|
|
216
182
|
await mock.add({
|
|
217
183
|
match: {
|
|
218
184
|
uri: RouteBuilder.invitation(':oid', ':id'),
|
|
@@ -223,12 +189,7 @@ export class SdkMock {
|
|
|
223
189
|
},
|
|
224
190
|
patch: async (init, options) => {
|
|
225
191
|
const { mock } = this;
|
|
226
|
-
|
|
227
|
-
// status: 200,
|
|
228
|
-
// headers: { 'content-type': 'application/json' },
|
|
229
|
-
// body: JSON.stringify(this.gen.invitation.invitation()),
|
|
230
|
-
// }
|
|
231
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.invitation.invitation()), init);
|
|
192
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.invitation.invitation()), init);
|
|
232
193
|
await mock.add({
|
|
233
194
|
match: {
|
|
234
195
|
uri: RouteBuilder.invitation(':oid', ':id'),
|
|
@@ -239,12 +200,7 @@ export class SdkMock {
|
|
|
239
200
|
},
|
|
240
201
|
resend: async (init, options) => {
|
|
241
202
|
const { mock } = this;
|
|
242
|
-
|
|
243
|
-
// status: 200,
|
|
244
|
-
// headers: { 'content-type': 'application/json' },
|
|
245
|
-
// body: JSON.stringify(this.gen.invitation.invitation()),
|
|
246
|
-
// }
|
|
247
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.invitation.invitation()), init);
|
|
203
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.invitation.invitation()), init);
|
|
248
204
|
await mock.add({
|
|
249
205
|
match: {
|
|
250
206
|
uri: RouteBuilder.resendInvitation(':oid', ':id'),
|
|
@@ -257,13 +213,7 @@ export class SdkMock {
|
|
|
257
213
|
users: {
|
|
258
214
|
list: async (init, options) => {
|
|
259
215
|
const { mock } = this;
|
|
260
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
261
|
-
const obj = {
|
|
262
|
-
data: this.gen.users.users(init?.size ?? 5),
|
|
263
|
-
cursor: this.createCursorOption(init),
|
|
264
|
-
};
|
|
265
|
-
return JSON.stringify(obj);
|
|
266
|
-
}, init);
|
|
216
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapList(this.gen.users.users(init?.size ?? 5), init), init);
|
|
267
217
|
await mock.add({
|
|
268
218
|
match: {
|
|
269
219
|
uri: RouteBuilder.organizationUsers(':oid'),
|
|
@@ -274,12 +224,7 @@ export class SdkMock {
|
|
|
274
224
|
},
|
|
275
225
|
read: async (init, options) => {
|
|
276
226
|
const { mock } = this;
|
|
277
|
-
|
|
278
|
-
// status: 200,
|
|
279
|
-
// headers: { 'content-type': 'application/json' },
|
|
280
|
-
// body: JSON.stringify(this.gen.users.user()),
|
|
281
|
-
// }
|
|
282
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.users.user()), init);
|
|
227
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.users.user()), init);
|
|
283
228
|
await mock.add({
|
|
284
229
|
match: {
|
|
285
230
|
uri: RouteBuilder.organizationUser(':oid', ':id'),
|
|
@@ -291,14 +236,7 @@ export class SdkMock {
|
|
|
291
236
|
readBatch: async (init, options) => {
|
|
292
237
|
const { mock } = this;
|
|
293
238
|
const path = RouteBuilder.organizationUserBatch(':oid');
|
|
294
|
-
const respond = init?.
|
|
295
|
-
status: 200,
|
|
296
|
-
headers: { 'content-type': 'application/json' },
|
|
297
|
-
body: JSON.stringify({
|
|
298
|
-
data: this.gen.users.users(init?.size ?? 5),
|
|
299
|
-
cursor: this.createCursorOption(init),
|
|
300
|
-
}),
|
|
301
|
-
};
|
|
239
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapList(this.gen.users.users(init?.size ?? 5), init), init);
|
|
302
240
|
await mock.add({
|
|
303
241
|
match: {
|
|
304
242
|
uri: path,
|
|
@@ -309,12 +247,7 @@ export class SdkMock {
|
|
|
309
247
|
},
|
|
310
248
|
activate: async (init, options) => {
|
|
311
249
|
const { mock } = this;
|
|
312
|
-
|
|
313
|
-
// status: 200,
|
|
314
|
-
// headers: { 'content-type': 'application/json' },
|
|
315
|
-
// body: JSON.stringify(this.gen.users.user()),
|
|
316
|
-
// }
|
|
317
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.users.user()), init);
|
|
250
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.users.user()), init);
|
|
318
251
|
await mock.add({
|
|
319
252
|
match: {
|
|
320
253
|
uri: RouteBuilder.organizationUserActivate(':oid', ':id'),
|
|
@@ -325,12 +258,7 @@ export class SdkMock {
|
|
|
325
258
|
},
|
|
326
259
|
deactivate: async (init, options) => {
|
|
327
260
|
const { mock } = this;
|
|
328
|
-
|
|
329
|
-
// status: 200,
|
|
330
|
-
// headers: { 'content-type': 'application/json' },
|
|
331
|
-
// body: JSON.stringify(this.gen.users.user()),
|
|
332
|
-
// }
|
|
333
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.users.user()), init);
|
|
261
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.users.user()), init);
|
|
334
262
|
await mock.add({
|
|
335
263
|
match: {
|
|
336
264
|
uri: RouteBuilder.organizationUserDeactivate(':oid', ':id'),
|
|
@@ -341,9 +269,6 @@ export class SdkMock {
|
|
|
341
269
|
},
|
|
342
270
|
delete: async (init, options) => {
|
|
343
271
|
const { mock } = this;
|
|
344
|
-
// const respond = init?.response ?? {
|
|
345
|
-
// status: 204,
|
|
346
|
-
// }
|
|
347
272
|
const respond = this.createDefaultResponse(204, undefined, undefined, init);
|
|
348
273
|
await mock.add({
|
|
349
274
|
match: {
|
|
@@ -361,7 +286,7 @@ export class SdkMock {
|
|
|
361
286
|
*/
|
|
362
287
|
validate: async (init, options) => {
|
|
363
288
|
const { mock } = this;
|
|
364
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
289
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.organization.organizationSlugValidateResponse()), init);
|
|
365
290
|
await mock.add({
|
|
366
291
|
match: {
|
|
367
292
|
uri: RouteBuilder.orgSlugValidate(),
|
|
@@ -376,7 +301,7 @@ export class SdkMock {
|
|
|
376
301
|
*/
|
|
377
302
|
generate: async (init, options) => {
|
|
378
303
|
const { mock } = this;
|
|
379
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
304
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.organization.organizationSlugGenerateResponse()), init);
|
|
380
305
|
await mock.add({
|
|
381
306
|
match: {
|
|
382
307
|
uri: RouteBuilder.orgSlugGenerate(),
|
|
@@ -397,13 +322,7 @@ export class SdkMock {
|
|
|
397
322
|
*/
|
|
398
323
|
list: async (init, options) => {
|
|
399
324
|
const { mock } = this;
|
|
400
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
401
|
-
const obj = {
|
|
402
|
-
data: this.gen.group.groups(init?.size ?? 5),
|
|
403
|
-
cursor: this.createCursorOption(init),
|
|
404
|
-
};
|
|
405
|
-
return JSON.stringify(obj);
|
|
406
|
-
}, init);
|
|
325
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapList(this.gen.group.groups(init?.size ?? 5), init), init);
|
|
407
326
|
await mock.add({
|
|
408
327
|
match: {
|
|
409
328
|
uri: RouteBuilder.groups(':oid'),
|
|
@@ -418,12 +337,7 @@ export class SdkMock {
|
|
|
418
337
|
*/
|
|
419
338
|
create: async (init, options) => {
|
|
420
339
|
const { mock } = this;
|
|
421
|
-
|
|
422
|
-
// status: 201,
|
|
423
|
-
// headers: { 'content-type': 'application/json' },
|
|
424
|
-
// body: JSON.stringify(this.gen.group.group()),
|
|
425
|
-
// }
|
|
426
|
-
const respond = this.createDefaultResponse(201, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.group.group()), init);
|
|
340
|
+
const respond = this.createDefaultResponse(201, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.group.group()), init);
|
|
427
341
|
await mock.add({
|
|
428
342
|
match: {
|
|
429
343
|
uri: RouteBuilder.groups(':oid'),
|
|
@@ -438,12 +352,7 @@ export class SdkMock {
|
|
|
438
352
|
*/
|
|
439
353
|
update: async (init, options) => {
|
|
440
354
|
const { mock } = this;
|
|
441
|
-
|
|
442
|
-
// status: 200,
|
|
443
|
-
// headers: { 'content-type': 'application/json' },
|
|
444
|
-
// body: JSON.stringify(this.gen.group.group()),
|
|
445
|
-
// }
|
|
446
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.group.group()), init);
|
|
355
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.group.group()), init);
|
|
447
356
|
await mock.add({
|
|
448
357
|
match: {
|
|
449
358
|
uri: RouteBuilder.group(':oid', ':key'),
|
|
@@ -458,9 +367,6 @@ export class SdkMock {
|
|
|
458
367
|
*/
|
|
459
368
|
delete: async (init, options) => {
|
|
460
369
|
const { mock } = this;
|
|
461
|
-
// const respond = init?.response ?? {
|
|
462
|
-
// status: 204,
|
|
463
|
-
// }
|
|
464
370
|
const respond = this.createDefaultResponse(204, undefined, undefined, init);
|
|
465
371
|
await mock.add({
|
|
466
372
|
match: {
|
|
@@ -475,12 +381,7 @@ export class SdkMock {
|
|
|
475
381
|
*/
|
|
476
382
|
addUsers: async (init, options) => {
|
|
477
383
|
const { mock } = this;
|
|
478
|
-
|
|
479
|
-
// status: 200,
|
|
480
|
-
// headers: { 'content-type': 'application/json' },
|
|
481
|
-
// body: JSON.stringify(this.gen.group.group()),
|
|
482
|
-
// }
|
|
483
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.group.group()), init);
|
|
384
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.group.group()), init);
|
|
484
385
|
await mock.add({
|
|
485
386
|
match: {
|
|
486
387
|
uri: RouteBuilder.groupUsers(':oid', ':key'),
|
|
@@ -494,12 +395,7 @@ export class SdkMock {
|
|
|
494
395
|
*/
|
|
495
396
|
removeUsers: async (init, options) => {
|
|
496
397
|
const { mock } = this;
|
|
497
|
-
|
|
498
|
-
// status: 200,
|
|
499
|
-
// headers: { 'content-type': 'application/json' },
|
|
500
|
-
// body: JSON.stringify(this.gen.group.group()),
|
|
501
|
-
// }
|
|
502
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.group.group()), init);
|
|
398
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.group.group()), init);
|
|
503
399
|
await mock.add({
|
|
504
400
|
match: {
|
|
505
401
|
uri: RouteBuilder.groupUsers(':oid', ':key'),
|
|
@@ -513,13 +409,7 @@ export class SdkMock {
|
|
|
513
409
|
sessions: {
|
|
514
410
|
list: async (init, options) => {
|
|
515
411
|
const { mock } = this;
|
|
516
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
517
|
-
const obj = {
|
|
518
|
-
data: this.gen.ai.sessions('general', init?.size ?? 5),
|
|
519
|
-
cursor: this.createCursorOption(init),
|
|
520
|
-
};
|
|
521
|
-
return JSON.stringify(obj);
|
|
522
|
-
}, init);
|
|
412
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapList(this.gen.ai.sessions('general', init?.size ?? 5), init), init);
|
|
523
413
|
await mock.add({
|
|
524
414
|
match: {
|
|
525
415
|
uri: RouteBuilder.aiSessions(':oid', ':app'),
|
|
@@ -530,7 +420,7 @@ export class SdkMock {
|
|
|
530
420
|
},
|
|
531
421
|
create: async (init, options) => {
|
|
532
422
|
const { mock } = this;
|
|
533
|
-
const respond = this.createDefaultResponse(201, { 'content-type': 'application/json' }, () =>
|
|
423
|
+
const respond = this.createDefaultResponse(201, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.ai.session()), init);
|
|
534
424
|
await mock.add({
|
|
535
425
|
match: {
|
|
536
426
|
uri: RouteBuilder.aiSessions(':oid', ':app'),
|
|
@@ -541,7 +431,7 @@ export class SdkMock {
|
|
|
541
431
|
},
|
|
542
432
|
read: async (init, options) => {
|
|
543
433
|
const { mock } = this;
|
|
544
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
434
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.ai.session()), init);
|
|
545
435
|
await mock.add({
|
|
546
436
|
match: {
|
|
547
437
|
uri: RouteBuilder.aiSession(':oid', ':app', ':sid'),
|
|
@@ -552,7 +442,7 @@ export class SdkMock {
|
|
|
552
442
|
},
|
|
553
443
|
update: async (init, options) => {
|
|
554
444
|
const { mock } = this;
|
|
555
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
445
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.ai.session()), init);
|
|
556
446
|
await mock.add({
|
|
557
447
|
match: {
|
|
558
448
|
uri: RouteBuilder.aiSession(':oid', ':app', ':sid'),
|
|
@@ -576,13 +466,7 @@ export class SdkMock {
|
|
|
576
466
|
messages: {
|
|
577
467
|
list: async (init, options) => {
|
|
578
468
|
const { mock } = this;
|
|
579
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
580
|
-
const obj = {
|
|
581
|
-
data: this.gen.ai.messages(init?.size ?? 5),
|
|
582
|
-
cursor: this.createCursorOption(init),
|
|
583
|
-
};
|
|
584
|
-
return JSON.stringify(obj);
|
|
585
|
-
}, init);
|
|
469
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapList(this.gen.ai.messages(init?.size ?? 5), init), init);
|
|
586
470
|
await mock.add({
|
|
587
471
|
match: {
|
|
588
472
|
uri: RouteBuilder.aiMessages(':oid', ':sid'),
|
|
@@ -593,7 +477,7 @@ export class SdkMock {
|
|
|
593
477
|
},
|
|
594
478
|
update: async (init, options) => {
|
|
595
479
|
const { mock } = this;
|
|
596
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
480
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.ai.message()), init);
|
|
597
481
|
await mock.add({
|
|
598
482
|
match: {
|
|
599
483
|
uri: RouteBuilder.aiMessage(':oid', ':sid', ':mid'),
|
|
@@ -637,12 +521,7 @@ export class SdkMock {
|
|
|
637
521
|
*/
|
|
638
522
|
me: async (init, options) => {
|
|
639
523
|
const { mock } = this;
|
|
640
|
-
|
|
641
|
-
// status: 200,
|
|
642
|
-
// headers: { 'content-type': 'application/json' },
|
|
643
|
-
// body: JSON.stringify(this.gen.users.user()),
|
|
644
|
-
// }
|
|
645
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.users.user()), init);
|
|
524
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.users.user()), init);
|
|
646
525
|
await mock.add({
|
|
647
526
|
match: {
|
|
648
527
|
uri: RouteBuilder.usersMe(),
|
|
@@ -661,13 +540,7 @@ export class SdkMock {
|
|
|
661
540
|
*/
|
|
662
541
|
list: async (init, options) => {
|
|
663
542
|
const { mock } = this;
|
|
664
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
665
|
-
const obj = {
|
|
666
|
-
data: this.gen.files.files(init?.size ?? 5),
|
|
667
|
-
cursor: this.createCursorOption(init),
|
|
668
|
-
};
|
|
669
|
-
return JSON.stringify(obj);
|
|
670
|
-
}, init);
|
|
543
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapList(this.gen.files.files(init?.size ?? 5), init), init);
|
|
671
544
|
await mock.add({
|
|
672
545
|
match: {
|
|
673
546
|
uri: RouteBuilder.files(':oid'),
|
|
@@ -681,12 +554,7 @@ export class SdkMock {
|
|
|
681
554
|
*/
|
|
682
555
|
createMeta: async (init, options) => {
|
|
683
556
|
const { mock } = this;
|
|
684
|
-
|
|
685
|
-
// status: 201,
|
|
686
|
-
// headers: { 'content-type': 'application/json' },
|
|
687
|
-
// body: JSON.stringify(this.gen.files.file()),
|
|
688
|
-
// }
|
|
689
|
-
const respond = this.createDefaultResponse(201, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.files.file()), init);
|
|
557
|
+
const respond = this.createDefaultResponse(201, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.files.file()), init);
|
|
690
558
|
await mock.add({
|
|
691
559
|
match: {
|
|
692
560
|
uri: RouteBuilder.files(':oid'),
|
|
@@ -700,9 +568,6 @@ export class SdkMock {
|
|
|
700
568
|
*/
|
|
701
569
|
createMedia: async (init, options) => {
|
|
702
570
|
const { mock } = this;
|
|
703
|
-
// const respond = init?.response ?? {
|
|
704
|
-
// status: 200,
|
|
705
|
-
// }
|
|
706
571
|
const respond = this.createDefaultResponse(200, undefined, undefined, init);
|
|
707
572
|
await mock.add({
|
|
708
573
|
match: {
|
|
@@ -727,12 +592,7 @@ export class SdkMock {
|
|
|
727
592
|
*/
|
|
728
593
|
createFolder: async (init, options) => {
|
|
729
594
|
const { mock } = this;
|
|
730
|
-
|
|
731
|
-
// status: 201,
|
|
732
|
-
// headers: { 'content-type': 'application/json' },
|
|
733
|
-
// body: JSON.stringify(this.gen.files.folder()),
|
|
734
|
-
// }
|
|
735
|
-
const respond = this.createDefaultResponse(201, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.files.folder()), init);
|
|
595
|
+
const respond = this.createDefaultResponse(201, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.files.folder()), init);
|
|
736
596
|
await mock.add({
|
|
737
597
|
match: {
|
|
738
598
|
uri: RouteBuilder.files(':oid'),
|
|
@@ -746,12 +606,7 @@ export class SdkMock {
|
|
|
746
606
|
*/
|
|
747
607
|
read: async (init, options) => {
|
|
748
608
|
const { mock } = this;
|
|
749
|
-
|
|
750
|
-
// status: 200,
|
|
751
|
-
// headers: { 'content-type': 'application/json' },
|
|
752
|
-
// body: JSON.stringify(this.gen.files.file()),
|
|
753
|
-
// }
|
|
754
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.files.file()), init);
|
|
609
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.files.file()), init);
|
|
755
610
|
await mock.add({
|
|
756
611
|
match: {
|
|
757
612
|
uri: RouteBuilder.file(':oid', ':id'),
|
|
@@ -765,18 +620,10 @@ export class SdkMock {
|
|
|
765
620
|
*/
|
|
766
621
|
readMedia: async (init, options) => {
|
|
767
622
|
const { mock } = this;
|
|
768
|
-
// const respond = init?.response ?? {
|
|
769
|
-
// status: 200,
|
|
770
|
-
// headers: {
|
|
771
|
-
// 'content-type': 'application/json',
|
|
772
|
-
// 'x-version': `${this.gen.faker.number.int({ min: 1, max: 100 })}`,
|
|
773
|
-
// },
|
|
774
|
-
// body: JSON.stringify({ data: this.gen.faker.lorem.sentences() }),
|
|
775
|
-
// }
|
|
776
623
|
const respond = this.createDefaultResponse(200, {
|
|
777
624
|
'content-type': 'application/json',
|
|
778
625
|
'x-version': `${this.gen.faker.number.int({ min: 1, max: 100 })}`,
|
|
779
|
-
}, () =>
|
|
626
|
+
}, () => this.wrapResource({ data: this.gen.faker.lorem.sentences() }), init);
|
|
780
627
|
await mock.add({
|
|
781
628
|
match: {
|
|
782
629
|
uri: RouteBuilder.fileMedia(':oid', ':id'),
|
|
@@ -790,12 +637,7 @@ export class SdkMock {
|
|
|
790
637
|
*/
|
|
791
638
|
readBulk: async (init, options) => {
|
|
792
639
|
const { mock } = this;
|
|
793
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => {
|
|
794
|
-
const obj = {
|
|
795
|
-
data: this.gen.files.files(init?.size ?? 5),
|
|
796
|
-
};
|
|
797
|
-
return JSON.stringify(obj);
|
|
798
|
-
}, init);
|
|
640
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapList(this.gen.files.files(init?.size ?? 5), { cursor: false }), init);
|
|
799
641
|
await mock.add({
|
|
800
642
|
match: {
|
|
801
643
|
uri: RouteBuilder.filesBatch(':oid'),
|
|
@@ -809,12 +651,7 @@ export class SdkMock {
|
|
|
809
651
|
*/
|
|
810
652
|
patch: async (init, options) => {
|
|
811
653
|
const { mock } = this;
|
|
812
|
-
|
|
813
|
-
// status: 200,
|
|
814
|
-
// headers: { 'content-type': 'application/json' },
|
|
815
|
-
// body: JSON.stringify(this.gen.files.file()),
|
|
816
|
-
// }
|
|
817
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.files.file()), init);
|
|
654
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.files.file()), init);
|
|
818
655
|
await mock.add({
|
|
819
656
|
match: {
|
|
820
657
|
uri: RouteBuilder.file(':oid', ':id'),
|
|
@@ -828,12 +665,7 @@ export class SdkMock {
|
|
|
828
665
|
*/
|
|
829
666
|
patchMedia: async (init, options) => {
|
|
830
667
|
const { mock } = this;
|
|
831
|
-
|
|
832
|
-
// status: 200,
|
|
833
|
-
// headers: { 'content-type': 'application/json' },
|
|
834
|
-
// body: JSON.stringify(this.gen.patch.mediaPatchRevision()),
|
|
835
|
-
// }
|
|
836
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.patch.mediaPatchRevision()), init);
|
|
668
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.patch.mediaPatchRevision()), init);
|
|
837
669
|
await mock.add({
|
|
838
670
|
match: {
|
|
839
671
|
uri: RouteBuilder.fileMedia(':oid', ':id'),
|
|
@@ -847,9 +679,6 @@ export class SdkMock {
|
|
|
847
679
|
*/
|
|
848
680
|
delete: async (init, options) => {
|
|
849
681
|
const { mock } = this;
|
|
850
|
-
// const respond = init?.response ?? {
|
|
851
|
-
// status: 204,
|
|
852
|
-
// }
|
|
853
682
|
const respond = this.createDefaultResponse(204, undefined, undefined, init);
|
|
854
683
|
await mock.add({
|
|
855
684
|
match: {
|
|
@@ -864,9 +693,6 @@ export class SdkMock {
|
|
|
864
693
|
*/
|
|
865
694
|
deleteBulk: async (init, options) => {
|
|
866
695
|
const { mock } = this;
|
|
867
|
-
// const respond = init?.response ?? {
|
|
868
|
-
// status: 204,
|
|
869
|
-
// }
|
|
870
696
|
const respond = this.createDefaultResponse(204, undefined, undefined, init);
|
|
871
697
|
await mock.add({
|
|
872
698
|
match: {
|
|
@@ -881,12 +707,7 @@ export class SdkMock {
|
|
|
881
707
|
*/
|
|
882
708
|
patchUsers: async (init, options) => {
|
|
883
709
|
const { mock } = this;
|
|
884
|
-
|
|
885
|
-
// status: 200,
|
|
886
|
-
// headers: { 'content-type': 'application/json' },
|
|
887
|
-
// body: JSON.stringify(this.gen.files.file()),
|
|
888
|
-
// }
|
|
889
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => JSON.stringify(this.gen.files.file()), init);
|
|
710
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapResource(this.gen.files.file()), init);
|
|
890
711
|
await mock.add({
|
|
891
712
|
match: {
|
|
892
713
|
uri: RouteBuilder.filesAccess(':oid', ':id'),
|
|
@@ -912,13 +733,7 @@ export class SdkMock {
|
|
|
912
733
|
*/
|
|
913
734
|
listUsers: async (init, options) => {
|
|
914
735
|
const { mock } = this;
|
|
915
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
916
|
-
const obj = {
|
|
917
|
-
data: this.gen.users.users(init?.size ?? 5),
|
|
918
|
-
cursor: this.createCursorOption(init),
|
|
919
|
-
};
|
|
920
|
-
return JSON.stringify(obj);
|
|
921
|
-
}, init);
|
|
736
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapList(this.gen.users.users(init?.size ?? 5), init), init);
|
|
922
737
|
await mock.add({
|
|
923
738
|
match: {
|
|
924
739
|
uri: RouteBuilder.fileUsers(':oid', ':id'),
|
|
@@ -932,13 +747,7 @@ export class SdkMock {
|
|
|
932
747
|
*/
|
|
933
748
|
breadcrumbs: async (init, options) => {
|
|
934
749
|
const { mock } = this;
|
|
935
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
936
|
-
const obj = {
|
|
937
|
-
data: this.gen.files.fileBreadcrumbs(init?.size ?? 5),
|
|
938
|
-
cursor: this.createCursorOption(init),
|
|
939
|
-
};
|
|
940
|
-
return JSON.stringify(obj);
|
|
941
|
-
}, init);
|
|
750
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapList(this.gen.files.fileBreadcrumbs(init?.size ?? 5), init), init);
|
|
942
751
|
await mock.add({
|
|
943
752
|
match: {
|
|
944
753
|
uri: RouteBuilder.fileBreadcrumbs(':oid', ':id'),
|
|
@@ -958,13 +767,7 @@ export class SdkMock {
|
|
|
958
767
|
shared = {
|
|
959
768
|
list: async (init, options) => {
|
|
960
769
|
const { mock } = this;
|
|
961
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
962
|
-
const obj = {
|
|
963
|
-
data: this.gen.files.files(init?.size ?? 5),
|
|
964
|
-
cursor: this.createCursorOption(init),
|
|
965
|
-
};
|
|
966
|
-
return JSON.stringify(obj);
|
|
967
|
-
}, init);
|
|
770
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapList(this.gen.files.files(init?.size ?? 5), init), init);
|
|
968
771
|
await mock.add({
|
|
969
772
|
match: {
|
|
970
773
|
uri: RouteBuilder.shared(':oid'),
|
|
@@ -980,13 +783,7 @@ export class SdkMock {
|
|
|
980
783
|
trash = {
|
|
981
784
|
list: async (init, options) => {
|
|
982
785
|
const { mock } = this;
|
|
983
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
984
|
-
const obj = {
|
|
985
|
-
data: this.gen.trash.trashEntries(init?.size ?? 5),
|
|
986
|
-
cursor: this.createCursorOption(init),
|
|
987
|
-
};
|
|
988
|
-
return JSON.stringify(obj);
|
|
989
|
-
}, init);
|
|
786
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapList(this.gen.trash.trashEntries(init?.size ?? 5), init), init);
|
|
990
787
|
await mock.add({
|
|
991
788
|
match: {
|
|
992
789
|
uri: RouteBuilder.trash(':oid'),
|
|
@@ -997,9 +794,6 @@ export class SdkMock {
|
|
|
997
794
|
},
|
|
998
795
|
delete: async (init, options) => {
|
|
999
796
|
const { mock } = this;
|
|
1000
|
-
// const respond = init?.response ?? {
|
|
1001
|
-
// status: 204,
|
|
1002
|
-
// }
|
|
1003
797
|
const respond = this.createDefaultResponse(204, undefined, undefined, init);
|
|
1004
798
|
await mock.add({
|
|
1005
799
|
match: {
|
|
@@ -1011,9 +805,6 @@ export class SdkMock {
|
|
|
1011
805
|
},
|
|
1012
806
|
restore: async (init, options) => {
|
|
1013
807
|
const { mock } = this;
|
|
1014
|
-
// const respond = init?.response ?? {
|
|
1015
|
-
// status: 204,
|
|
1016
|
-
// }
|
|
1017
808
|
const respond = this.createDefaultResponse(204, undefined, undefined, init);
|
|
1018
809
|
await mock.add({
|
|
1019
810
|
match: {
|
|
@@ -1025,9 +816,6 @@ export class SdkMock {
|
|
|
1025
816
|
},
|
|
1026
817
|
empty: async (init, options) => {
|
|
1027
818
|
const { mock } = this;
|
|
1028
|
-
// const respond = init?.response ?? {
|
|
1029
|
-
// status: 204,
|
|
1030
|
-
// }
|
|
1031
819
|
const respond = this.createDefaultResponse(204, undefined, undefined, init);
|
|
1032
820
|
await mock.add({
|
|
1033
821
|
match: {
|
|
@@ -1095,11 +883,7 @@ export class SdkMock {
|
|
|
1095
883
|
}
|
|
1096
884
|
});
|
|
1097
885
|
}
|
|
1098
|
-
|
|
1099
|
-
data,
|
|
1100
|
-
cursor: this.createCursorOption(init),
|
|
1101
|
-
};
|
|
1102
|
-
return JSON.stringify(obj);
|
|
886
|
+
return this.wrapList(data, init);
|
|
1103
887
|
}, init);
|
|
1104
888
|
await mock.add({
|
|
1105
889
|
match: {
|
|
@@ -1121,7 +905,7 @@ export class SdkMock {
|
|
|
1121
905
|
env: payload.env,
|
|
1122
906
|
...(payload.env === DeploymentEnvironment.PROD ? { version: payload.version } : {}),
|
|
1123
907
|
});
|
|
1124
|
-
return
|
|
908
|
+
return this.wrapResource(obj);
|
|
1125
909
|
}, init);
|
|
1126
910
|
await mock.add({
|
|
1127
911
|
match: {
|
|
@@ -1138,7 +922,7 @@ export class SdkMock {
|
|
|
1138
922
|
key: req.params.id,
|
|
1139
923
|
orgId: req.params.oid,
|
|
1140
924
|
});
|
|
1141
|
-
return
|
|
925
|
+
return this.wrapResource(obj);
|
|
1142
926
|
}, init);
|
|
1143
927
|
await mock.add({
|
|
1144
928
|
match: {
|
|
@@ -1150,7 +934,14 @@ export class SdkMock {
|
|
|
1150
934
|
},
|
|
1151
935
|
deactivate: async (init, options) => {
|
|
1152
936
|
const { mock } = this;
|
|
1153
|
-
const respond = this.createDefaultResponse(
|
|
937
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, (req) => {
|
|
938
|
+
const obj = this.gen.deployments.deployment({
|
|
939
|
+
key: req.params.id,
|
|
940
|
+
orgId: req.params.oid,
|
|
941
|
+
status: DeploymentStatus.Inactive,
|
|
942
|
+
});
|
|
943
|
+
return this.wrapResource(obj);
|
|
944
|
+
}, init);
|
|
1154
945
|
await mock.add({
|
|
1155
946
|
match: {
|
|
1156
947
|
uri: RouteBuilder.deployment(':oid', ':id'),
|
|
@@ -1163,22 +954,20 @@ export class SdkMock {
|
|
|
1163
954
|
getLatestPerEnvironment: async (init, options) => {
|
|
1164
955
|
const { mock } = this;
|
|
1165
956
|
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => {
|
|
1166
|
-
const obj = {
|
|
1167
|
-
data: {},
|
|
1168
|
-
};
|
|
957
|
+
const obj = {};
|
|
1169
958
|
const hasProd = init?.prod ?? this.gen.faker.datatype.boolean();
|
|
1170
959
|
const hasStaging = init?.staging ?? this.gen.faker.datatype.boolean();
|
|
1171
960
|
const hasDev = init?.dev ?? this.gen.faker.datatype.boolean();
|
|
1172
961
|
if (hasProd) {
|
|
1173
|
-
obj.
|
|
962
|
+
obj.prod = this.gen.deployments.deployment();
|
|
1174
963
|
}
|
|
1175
964
|
if (hasStaging) {
|
|
1176
|
-
obj.
|
|
965
|
+
obj.staging = this.gen.deployments.deployment();
|
|
1177
966
|
}
|
|
1178
967
|
if (hasDev) {
|
|
1179
|
-
obj.
|
|
968
|
+
obj.dev = this.gen.deployments.deployment();
|
|
1180
969
|
}
|
|
1181
|
-
return
|
|
970
|
+
return this.wrapResource(obj);
|
|
1182
971
|
}, init);
|
|
1183
972
|
await mock.add({
|
|
1184
973
|
match: {
|
|
@@ -1190,12 +979,7 @@ export class SdkMock {
|
|
|
1190
979
|
},
|
|
1191
980
|
list: async (init, options) => {
|
|
1192
981
|
const { mock } = this;
|
|
1193
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => {
|
|
1194
|
-
const obj = {
|
|
1195
|
-
data: this.gen.deployments.deploymentApis(init?.size ?? 5),
|
|
1196
|
-
};
|
|
1197
|
-
return JSON.stringify(obj);
|
|
1198
|
-
}, init);
|
|
982
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapList(this.gen.deployments.deploymentApis(init?.size ?? 5), { cursor: false }), init);
|
|
1199
983
|
await mock.add({
|
|
1200
984
|
match: {
|
|
1201
985
|
uri: RouteBuilder.deploymentsApis(':oid'),
|
|
@@ -1212,13 +996,7 @@ export class SdkMock {
|
|
|
1212
996
|
dataCatalog = {
|
|
1213
997
|
list: async (init, options) => {
|
|
1214
998
|
const { mock } = this;
|
|
1215
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
1216
|
-
const obj = {
|
|
1217
|
-
data: this.gen.dataCatalog.dataCatalogsWithVersion(init?.size ?? 5),
|
|
1218
|
-
cursor: this.createCursorOption(init),
|
|
1219
|
-
};
|
|
1220
|
-
return JSON.stringify(obj);
|
|
1221
|
-
}, init);
|
|
999
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapList(this.gen.dataCatalog.dataCatalogsWithVersion(init?.size ?? 5), init), init);
|
|
1222
1000
|
await mock.add({
|
|
1223
1001
|
match: {
|
|
1224
1002
|
uri: RouteBuilder.dataCatalog(),
|
|
@@ -1229,13 +1007,7 @@ export class SdkMock {
|
|
|
1229
1007
|
},
|
|
1230
1008
|
listVersions: async (init, options) => {
|
|
1231
1009
|
const { mock } = this;
|
|
1232
|
-
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () =>
|
|
1233
|
-
const obj = {
|
|
1234
|
-
data: this.gen.dataCatalog.versionInfos(init?.size ?? 5),
|
|
1235
|
-
cursor: this.createCursorOption(init),
|
|
1236
|
-
};
|
|
1237
|
-
return JSON.stringify(obj);
|
|
1238
|
-
}, init);
|
|
1010
|
+
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => this.wrapList(this.gen.dataCatalog.versionInfos(init?.size ?? 5), init), init);
|
|
1239
1011
|
await mock.add({
|
|
1240
1012
|
match: {
|
|
1241
1013
|
uri: RouteBuilder.dataCatalogEntryVersions(':id'),
|
|
@@ -1253,7 +1025,7 @@ export class SdkMock {
|
|
|
1253
1025
|
item: obj,
|
|
1254
1026
|
kind: obj.kind,
|
|
1255
1027
|
};
|
|
1256
|
-
return
|
|
1028
|
+
return this.wrapResource(result);
|
|
1257
1029
|
}, init);
|
|
1258
1030
|
await mock.add({
|
|
1259
1031
|
match: {
|
|
@@ -1267,7 +1039,7 @@ export class SdkMock {
|
|
|
1267
1039
|
const { mock } = this;
|
|
1268
1040
|
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, (req) => {
|
|
1269
1041
|
const obj = this.gen.dataCatalog.dataCatalog({ key: req.params.id });
|
|
1270
|
-
return
|
|
1042
|
+
return this.wrapResource(obj);
|
|
1271
1043
|
}, init);
|
|
1272
1044
|
await mock.add({
|
|
1273
1045
|
match: {
|
|
@@ -1286,7 +1058,7 @@ export class SdkMock {
|
|
|
1286
1058
|
item: obj,
|
|
1287
1059
|
kind: obj.kind,
|
|
1288
1060
|
};
|
|
1289
|
-
return
|
|
1061
|
+
return this.wrapResource(result);
|
|
1290
1062
|
}, init);
|
|
1291
1063
|
await mock.add({
|
|
1292
1064
|
match: {
|
|
@@ -1305,7 +1077,7 @@ export class SdkMock {
|
|
|
1305
1077
|
item: obj,
|
|
1306
1078
|
kind: obj.kind,
|
|
1307
1079
|
};
|
|
1308
|
-
return
|
|
1080
|
+
return this.wrapResource(result);
|
|
1309
1081
|
}, init);
|
|
1310
1082
|
await mock.add({
|
|
1311
1083
|
match: {
|
|
@@ -1325,7 +1097,7 @@ export class SdkMock {
|
|
|
1325
1097
|
item: body,
|
|
1326
1098
|
kind: body.kind,
|
|
1327
1099
|
};
|
|
1328
|
-
return
|
|
1100
|
+
return this.wrapResource(result);
|
|
1329
1101
|
}, init);
|
|
1330
1102
|
await mock.add({
|
|
1331
1103
|
match: {
|
|
@@ -1339,7 +1111,7 @@ export class SdkMock {
|
|
|
1339
1111
|
const { mock } = this;
|
|
1340
1112
|
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, (req) => {
|
|
1341
1113
|
const obj = this.gen.dataCatalog.dataCatalogVersion({ key: req.params.vid, catalogKey: req.params.id });
|
|
1342
|
-
return
|
|
1114
|
+
return this.wrapResource(obj);
|
|
1343
1115
|
}, init);
|
|
1344
1116
|
await mock.add({
|
|
1345
1117
|
match: {
|
|
@@ -1361,10 +1133,7 @@ export class SdkMock {
|
|
|
1361
1133
|
});
|
|
1362
1134
|
data.push(domain.toJSON());
|
|
1363
1135
|
}
|
|
1364
|
-
|
|
1365
|
-
data,
|
|
1366
|
-
};
|
|
1367
|
-
return JSON.stringify(obj);
|
|
1136
|
+
return this.wrapList(data, { cursor: false });
|
|
1368
1137
|
}, init);
|
|
1369
1138
|
await mock.add({
|
|
1370
1139
|
match: {
|
|
@@ -1388,7 +1157,7 @@ export class SdkMock {
|
|
|
1388
1157
|
item: obj,
|
|
1389
1158
|
kind: obj.kind,
|
|
1390
1159
|
};
|
|
1391
|
-
return
|
|
1160
|
+
return this.wrapResource(result);
|
|
1392
1161
|
}, init);
|
|
1393
1162
|
await mock.add({
|
|
1394
1163
|
match: {
|
|
@@ -1409,7 +1178,7 @@ export class SdkMock {
|
|
|
1409
1178
|
item: obj,
|
|
1410
1179
|
kind: obj.kind,
|
|
1411
1180
|
};
|
|
1412
|
-
return
|
|
1181
|
+
return this.wrapResource(result);
|
|
1413
1182
|
}, init);
|
|
1414
1183
|
await mock.add({
|
|
1415
1184
|
match: {
|
|
@@ -1424,7 +1193,7 @@ export class SdkMock {
|
|
|
1424
1193
|
const respond = this.createDefaultResponse(200, { 'content-type': 'application/json' }, () => {
|
|
1425
1194
|
const obj = this.gen.dataCatalog.dataCatalog();
|
|
1426
1195
|
obj.versions = this.gen.dataCatalog.versionInfos(1);
|
|
1427
|
-
return
|
|
1196
|
+
return this.wrapResource(obj);
|
|
1428
1197
|
}, init);
|
|
1429
1198
|
await mock.add({
|
|
1430
1199
|
match: {
|
|
@@ -1470,6 +1239,9 @@ export class SdkMock {
|
|
|
1470
1239
|
if (init.cursor === false) {
|
|
1471
1240
|
return undefined;
|
|
1472
1241
|
}
|
|
1242
|
+
if (typeof init.cursor === 'string') {
|
|
1243
|
+
return init.cursor;
|
|
1244
|
+
}
|
|
1473
1245
|
const hasCursor = init.cursor === true ? true : this.gen.faker.datatype.boolean();
|
|
1474
1246
|
if (!hasCursor) {
|
|
1475
1247
|
return undefined;
|
|
@@ -1504,5 +1276,18 @@ export class SdkMock {
|
|
|
1504
1276
|
}
|
|
1505
1277
|
return respond;
|
|
1506
1278
|
}
|
|
1279
|
+
wrapResource(resource) {
|
|
1280
|
+
const wrapper = {
|
|
1281
|
+
data: resource,
|
|
1282
|
+
};
|
|
1283
|
+
return JSON.stringify(wrapper);
|
|
1284
|
+
}
|
|
1285
|
+
wrapList(items, init) {
|
|
1286
|
+
const obj = {
|
|
1287
|
+
data: items,
|
|
1288
|
+
cursor: this.createCursorOption(init),
|
|
1289
|
+
};
|
|
1290
|
+
return JSON.stringify(obj);
|
|
1291
|
+
}
|
|
1507
1292
|
}
|
|
1508
1293
|
//# sourceMappingURL=SdkMock.js.map
|