@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/src/sdk/SdkMock.ts
CHANGED
|
@@ -6,36 +6,24 @@ import {
|
|
|
6
6
|
type InterceptOptions,
|
|
7
7
|
type SerializedRequest,
|
|
8
8
|
} from '@jarrodek/amw'
|
|
9
|
-
import type { OrganizationSchema } from '../models/store/Organization.js'
|
|
10
|
-
import type { GroupSchema } from '../models/store/Group.js'
|
|
11
|
-
import type { UserSchema } from '../models/store/User.js'
|
|
12
|
-
import type { InvitationSchema } from '../models/store/Invitation.js'
|
|
13
|
-
import { type FileSchema, type FileBreadcrumb } from '../models/store/File.js'
|
|
14
9
|
import {
|
|
15
10
|
isAtomicFilter,
|
|
16
11
|
type ContextChangeRecord,
|
|
17
12
|
type ContextListResult,
|
|
18
|
-
type IBulkOperationResult,
|
|
19
13
|
type QueryFilter,
|
|
20
14
|
} from '../events/BaseEvents.js'
|
|
21
|
-
import type { TrashEntry } from '../models/TrashEntry.js'
|
|
22
15
|
import { RouteBuilder } from './RouteBuilder.js'
|
|
23
16
|
import { ModelingMock } from '../mocking/ModelingMock.js'
|
|
24
|
-
import type {
|
|
25
|
-
DataCatalogSchema,
|
|
26
|
-
DataCatalogSchemaWithVersion,
|
|
27
|
-
DataCatalogStatus,
|
|
28
|
-
DataCatalogVersionInfo,
|
|
29
|
-
} from '../models/DataCatalog.js'
|
|
17
|
+
import type { DataCatalogSchema, DataCatalogStatus } from '../models/DataCatalog.js'
|
|
30
18
|
import type { DataCatalogVersionSchema } from '../models/DataCatalogVersion.js'
|
|
31
19
|
import { DataDomain, type DataDomainSchema } from '../modeling/DataDomain.js'
|
|
32
20
|
import type { ForeignDomainDependency } from '../modeling/types.js'
|
|
33
21
|
import { nanoid } from '../nanoid.js'
|
|
34
|
-
import type {
|
|
35
|
-
import type { AiMessageSchema } from '../models/AiMessage.js'
|
|
22
|
+
import type { AiSessionApp } from '../models/AiSession.js'
|
|
36
23
|
import type { DeploymentSchema } from '../models/store/Deployment.js'
|
|
37
|
-
import { DeploymentEnvironment } from '../models/store/Deployment.js'
|
|
38
|
-
import type { CreateDeploymentPayload,
|
|
24
|
+
import { DeploymentEnvironment, DeploymentStatus } from '../models/store/Deployment.js'
|
|
25
|
+
import type { CreateDeploymentPayload, DeploymentLatestEnvironments } from './DeploymentsSdk.js'
|
|
26
|
+
import { ResourceResponse } from './SdkBase.js'
|
|
39
27
|
|
|
40
28
|
export interface MockResult {
|
|
41
29
|
/**
|
|
@@ -59,8 +47,9 @@ export interface MockListResult extends MockResult {
|
|
|
59
47
|
* If true, the response will include a cursor for pagination.
|
|
60
48
|
* If false, the response will not include a cursor.
|
|
61
49
|
* If not set, a random choice will be made.
|
|
50
|
+
* If string, the exact cursor value will be used.
|
|
62
51
|
*/
|
|
63
|
-
cursor?: boolean
|
|
52
|
+
cursor?: boolean | string
|
|
64
53
|
}
|
|
65
54
|
|
|
66
55
|
/**
|
|
@@ -171,11 +160,7 @@ export class SdkMock {
|
|
|
171
160
|
const respond = this.createDefaultResponse(
|
|
172
161
|
200,
|
|
173
162
|
{ 'content-type': 'application/json' },
|
|
174
|
-
() =>
|
|
175
|
-
JSON.stringify({
|
|
176
|
-
data: this.gen.organization.organizations(init?.size ?? 5),
|
|
177
|
-
cursor: this.createCursorOption(init),
|
|
178
|
-
} as ContextListResult<OrganizationSchema>),
|
|
163
|
+
() => this.wrapList(this.gen.organization.organizations(init?.size ?? 5), init),
|
|
179
164
|
init
|
|
180
165
|
)
|
|
181
166
|
await mock.add(
|
|
@@ -196,15 +181,10 @@ export class SdkMock {
|
|
|
196
181
|
*/
|
|
197
182
|
create: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
198
183
|
const { mock } = this
|
|
199
|
-
// const respond = init?.response ?? {
|
|
200
|
-
// status: 200,
|
|
201
|
-
// headers: { 'content-type': 'application/json' },
|
|
202
|
-
// body: JSON.stringify(this.gen.organization.organization()),
|
|
203
|
-
// }
|
|
204
184
|
const respond = this.createDefaultResponse(
|
|
205
185
|
200,
|
|
206
186
|
{ 'content-type': 'application/json' },
|
|
207
|
-
() =>
|
|
187
|
+
() => this.wrapResource(this.gen.organization.organization()),
|
|
208
188
|
init
|
|
209
189
|
)
|
|
210
190
|
await mock.add(
|
|
@@ -225,13 +205,7 @@ export class SdkMock {
|
|
|
225
205
|
const respond = this.createDefaultResponse(
|
|
226
206
|
200,
|
|
227
207
|
{ 'content-type': 'application/json' },
|
|
228
|
-
() =>
|
|
229
|
-
const obj: ContextListResult<InvitationSchema> = {
|
|
230
|
-
data: this.gen.invitation.invitations(init?.size ?? 5),
|
|
231
|
-
cursor: this.createCursorOption(init),
|
|
232
|
-
}
|
|
233
|
-
return JSON.stringify(obj)
|
|
234
|
-
},
|
|
208
|
+
() => this.wrapList(this.gen.invitation.invitations(init?.size ?? 5), init),
|
|
235
209
|
init
|
|
236
210
|
)
|
|
237
211
|
await mock.add(
|
|
@@ -247,15 +221,10 @@ export class SdkMock {
|
|
|
247
221
|
},
|
|
248
222
|
create: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
249
223
|
const { mock } = this
|
|
250
|
-
// const respond = init?.response ?? {
|
|
251
|
-
// status: 200,
|
|
252
|
-
// headers: { 'content-type': 'application/json' },
|
|
253
|
-
// body: JSON.stringify(this.gen.invitation.invitation()),
|
|
254
|
-
// }
|
|
255
224
|
const respond = this.createDefaultResponse(
|
|
256
225
|
200,
|
|
257
226
|
{ 'content-type': 'application/json' },
|
|
258
|
-
() =>
|
|
227
|
+
() => this.wrapResource(this.gen.invitation.invitation()),
|
|
259
228
|
init
|
|
260
229
|
)
|
|
261
230
|
await mock.add(
|
|
@@ -271,15 +240,10 @@ export class SdkMock {
|
|
|
271
240
|
},
|
|
272
241
|
findByToken: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
273
242
|
const { mock } = this
|
|
274
|
-
// const respond = init?.response ?? {
|
|
275
|
-
// status: 200,
|
|
276
|
-
// headers: { 'content-type': 'application/json' },
|
|
277
|
-
// body: JSON.stringify(this.gen.invitation.invitation()),
|
|
278
|
-
// }
|
|
279
243
|
const respond = this.createDefaultResponse(
|
|
280
244
|
200,
|
|
281
245
|
{ 'content-type': 'application/json' },
|
|
282
|
-
() =>
|
|
246
|
+
() => this.wrapResource(this.gen.invitation.invitation()),
|
|
283
247
|
init
|
|
284
248
|
)
|
|
285
249
|
|
|
@@ -296,15 +260,10 @@ export class SdkMock {
|
|
|
296
260
|
},
|
|
297
261
|
decline: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
298
262
|
const { mock } = this
|
|
299
|
-
// const respond = init?.response ?? {
|
|
300
|
-
// status: 200,
|
|
301
|
-
// headers: { 'content-type': 'application/json' },
|
|
302
|
-
// body: JSON.stringify(this.gen.invitation.invitation()),
|
|
303
|
-
// }
|
|
304
263
|
const respond = this.createDefaultResponse(
|
|
305
264
|
200,
|
|
306
265
|
{ 'content-type': 'application/json' },
|
|
307
|
-
() =>
|
|
266
|
+
() => this.wrapResource(this.gen.invitation.invitation()),
|
|
308
267
|
init
|
|
309
268
|
)
|
|
310
269
|
|
|
@@ -321,15 +280,10 @@ export class SdkMock {
|
|
|
321
280
|
},
|
|
322
281
|
delete: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
323
282
|
const { mock } = this
|
|
324
|
-
// const respond = init?.response ?? {
|
|
325
|
-
// status: 200,
|
|
326
|
-
// headers: { 'content-type': 'application/json' },
|
|
327
|
-
// body: JSON.stringify(this.gen.invitation.invitation()),
|
|
328
|
-
// }
|
|
329
283
|
const respond = this.createDefaultResponse(
|
|
330
284
|
200,
|
|
331
285
|
{ 'content-type': 'application/json' },
|
|
332
|
-
() =>
|
|
286
|
+
() => this.wrapResource(this.gen.invitation.invitation()),
|
|
333
287
|
init
|
|
334
288
|
)
|
|
335
289
|
|
|
@@ -346,15 +300,10 @@ export class SdkMock {
|
|
|
346
300
|
},
|
|
347
301
|
patch: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
348
302
|
const { mock } = this
|
|
349
|
-
// const respond = init?.response ?? {
|
|
350
|
-
// status: 200,
|
|
351
|
-
// headers: { 'content-type': 'application/json' },
|
|
352
|
-
// body: JSON.stringify(this.gen.invitation.invitation()),
|
|
353
|
-
// }
|
|
354
303
|
const respond = this.createDefaultResponse(
|
|
355
304
|
200,
|
|
356
305
|
{ 'content-type': 'application/json' },
|
|
357
|
-
() =>
|
|
306
|
+
() => this.wrapResource(this.gen.invitation.invitation()),
|
|
358
307
|
init
|
|
359
308
|
)
|
|
360
309
|
await mock.add(
|
|
@@ -370,15 +319,10 @@ export class SdkMock {
|
|
|
370
319
|
},
|
|
371
320
|
resend: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
372
321
|
const { mock } = this
|
|
373
|
-
// const respond = init?.response ?? {
|
|
374
|
-
// status: 200,
|
|
375
|
-
// headers: { 'content-type': 'application/json' },
|
|
376
|
-
// body: JSON.stringify(this.gen.invitation.invitation()),
|
|
377
|
-
// }
|
|
378
322
|
const respond = this.createDefaultResponse(
|
|
379
323
|
200,
|
|
380
324
|
{ 'content-type': 'application/json' },
|
|
381
|
-
() =>
|
|
325
|
+
() => this.wrapResource(this.gen.invitation.invitation()),
|
|
382
326
|
init
|
|
383
327
|
)
|
|
384
328
|
|
|
@@ -401,13 +345,7 @@ export class SdkMock {
|
|
|
401
345
|
const respond = this.createDefaultResponse(
|
|
402
346
|
200,
|
|
403
347
|
{ 'content-type': 'application/json' },
|
|
404
|
-
() =>
|
|
405
|
-
const obj: ContextListResult<UserSchema> = {
|
|
406
|
-
data: this.gen.users.users(init?.size ?? 5),
|
|
407
|
-
cursor: this.createCursorOption(init),
|
|
408
|
-
}
|
|
409
|
-
return JSON.stringify(obj)
|
|
410
|
-
},
|
|
348
|
+
() => this.wrapList(this.gen.users.users(init?.size ?? 5), init),
|
|
411
349
|
init
|
|
412
350
|
)
|
|
413
351
|
await mock.add(
|
|
@@ -423,15 +361,10 @@ export class SdkMock {
|
|
|
423
361
|
},
|
|
424
362
|
read: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
425
363
|
const { mock } = this
|
|
426
|
-
// const respond = init?.response ?? {
|
|
427
|
-
// status: 200,
|
|
428
|
-
// headers: { 'content-type': 'application/json' },
|
|
429
|
-
// body: JSON.stringify(this.gen.users.user()),
|
|
430
|
-
// }
|
|
431
364
|
const respond = this.createDefaultResponse(
|
|
432
365
|
200,
|
|
433
366
|
{ 'content-type': 'application/json' },
|
|
434
|
-
() =>
|
|
367
|
+
() => this.wrapResource(this.gen.users.user()),
|
|
435
368
|
init
|
|
436
369
|
)
|
|
437
370
|
await mock.add(
|
|
@@ -448,14 +381,12 @@ export class SdkMock {
|
|
|
448
381
|
readBatch: async (init?: MockListResult, options?: InterceptOptions): Promise<void> => {
|
|
449
382
|
const { mock } = this
|
|
450
383
|
const path = RouteBuilder.organizationUserBatch(':oid')
|
|
451
|
-
const respond =
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
} as ContextListResult<UserSchema>),
|
|
458
|
-
}
|
|
384
|
+
const respond = this.createDefaultResponse(
|
|
385
|
+
200,
|
|
386
|
+
{ 'content-type': 'application/json' },
|
|
387
|
+
() => this.wrapList(this.gen.users.users(init?.size ?? 5), init),
|
|
388
|
+
init
|
|
389
|
+
)
|
|
459
390
|
await mock.add(
|
|
460
391
|
{
|
|
461
392
|
match: {
|
|
@@ -469,15 +400,10 @@ export class SdkMock {
|
|
|
469
400
|
},
|
|
470
401
|
activate: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
471
402
|
const { mock } = this
|
|
472
|
-
// const respond = init?.response ?? {
|
|
473
|
-
// status: 200,
|
|
474
|
-
// headers: { 'content-type': 'application/json' },
|
|
475
|
-
// body: JSON.stringify(this.gen.users.user()),
|
|
476
|
-
// }
|
|
477
403
|
const respond = this.createDefaultResponse(
|
|
478
404
|
200,
|
|
479
405
|
{ 'content-type': 'application/json' },
|
|
480
|
-
() =>
|
|
406
|
+
() => this.wrapResource(this.gen.users.user()),
|
|
481
407
|
init
|
|
482
408
|
)
|
|
483
409
|
await mock.add(
|
|
@@ -493,15 +419,10 @@ export class SdkMock {
|
|
|
493
419
|
},
|
|
494
420
|
deactivate: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
495
421
|
const { mock } = this
|
|
496
|
-
// const respond = init?.response ?? {
|
|
497
|
-
// status: 200,
|
|
498
|
-
// headers: { 'content-type': 'application/json' },
|
|
499
|
-
// body: JSON.stringify(this.gen.users.user()),
|
|
500
|
-
// }
|
|
501
422
|
const respond = this.createDefaultResponse(
|
|
502
423
|
200,
|
|
503
424
|
{ 'content-type': 'application/json' },
|
|
504
|
-
() =>
|
|
425
|
+
() => this.wrapResource(this.gen.users.user()),
|
|
505
426
|
init
|
|
506
427
|
)
|
|
507
428
|
await mock.add(
|
|
@@ -517,9 +438,6 @@ export class SdkMock {
|
|
|
517
438
|
},
|
|
518
439
|
delete: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
519
440
|
const { mock } = this
|
|
520
|
-
// const respond = init?.response ?? {
|
|
521
|
-
// status: 204,
|
|
522
|
-
// }
|
|
523
441
|
const respond = this.createDefaultResponse(204, undefined, undefined, init)
|
|
524
442
|
await mock.add(
|
|
525
443
|
{
|
|
@@ -544,7 +462,7 @@ export class SdkMock {
|
|
|
544
462
|
const respond = this.createDefaultResponse(
|
|
545
463
|
200,
|
|
546
464
|
{ 'content-type': 'application/json' },
|
|
547
|
-
() =>
|
|
465
|
+
() => this.wrapResource(this.gen.organization.organizationSlugValidateResponse()),
|
|
548
466
|
init
|
|
549
467
|
)
|
|
550
468
|
await mock.add(
|
|
@@ -568,7 +486,7 @@ export class SdkMock {
|
|
|
568
486
|
const respond = this.createDefaultResponse(
|
|
569
487
|
200,
|
|
570
488
|
{ 'content-type': 'application/json' },
|
|
571
|
-
() =>
|
|
489
|
+
() => this.wrapResource(this.gen.organization.organizationSlugGenerateResponse()),
|
|
572
490
|
init
|
|
573
491
|
)
|
|
574
492
|
await mock.add(
|
|
@@ -598,13 +516,7 @@ export class SdkMock {
|
|
|
598
516
|
const respond = this.createDefaultResponse(
|
|
599
517
|
200,
|
|
600
518
|
{ 'content-type': 'application/json' },
|
|
601
|
-
() =>
|
|
602
|
-
const obj: ContextListResult<GroupSchema> = {
|
|
603
|
-
data: this.gen.group.groups(init?.size ?? 5),
|
|
604
|
-
cursor: this.createCursorOption(init),
|
|
605
|
-
}
|
|
606
|
-
return JSON.stringify(obj)
|
|
607
|
-
},
|
|
519
|
+
() => this.wrapList(this.gen.group.groups(init?.size ?? 5), init),
|
|
608
520
|
init
|
|
609
521
|
)
|
|
610
522
|
await mock.add(
|
|
@@ -625,15 +537,10 @@ export class SdkMock {
|
|
|
625
537
|
*/
|
|
626
538
|
create: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
627
539
|
const { mock } = this
|
|
628
|
-
// const respond = init?.response ?? {
|
|
629
|
-
// status: 201,
|
|
630
|
-
// headers: { 'content-type': 'application/json' },
|
|
631
|
-
// body: JSON.stringify(this.gen.group.group()),
|
|
632
|
-
// }
|
|
633
540
|
const respond = this.createDefaultResponse(
|
|
634
541
|
201,
|
|
635
542
|
{ 'content-type': 'application/json' },
|
|
636
|
-
() =>
|
|
543
|
+
() => this.wrapResource(this.gen.group.group()),
|
|
637
544
|
init
|
|
638
545
|
)
|
|
639
546
|
await mock.add(
|
|
@@ -654,15 +561,10 @@ export class SdkMock {
|
|
|
654
561
|
*/
|
|
655
562
|
update: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
656
563
|
const { mock } = this
|
|
657
|
-
// const respond = init?.response ?? {
|
|
658
|
-
// status: 200,
|
|
659
|
-
// headers: { 'content-type': 'application/json' },
|
|
660
|
-
// body: JSON.stringify(this.gen.group.group()),
|
|
661
|
-
// }
|
|
662
564
|
const respond = this.createDefaultResponse(
|
|
663
565
|
200,
|
|
664
566
|
{ 'content-type': 'application/json' },
|
|
665
|
-
() =>
|
|
567
|
+
() => this.wrapResource(this.gen.group.group()),
|
|
666
568
|
init
|
|
667
569
|
)
|
|
668
570
|
await mock.add(
|
|
@@ -683,9 +585,6 @@ export class SdkMock {
|
|
|
683
585
|
*/
|
|
684
586
|
delete: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
685
587
|
const { mock } = this
|
|
686
|
-
// const respond = init?.response ?? {
|
|
687
|
-
// status: 204,
|
|
688
|
-
// }
|
|
689
588
|
const respond = this.createDefaultResponse(204, undefined, undefined, init)
|
|
690
589
|
await mock.add(
|
|
691
590
|
{
|
|
@@ -704,15 +603,10 @@ export class SdkMock {
|
|
|
704
603
|
*/
|
|
705
604
|
addUsers: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
706
605
|
const { mock } = this
|
|
707
|
-
// const respond = init?.response ?? {
|
|
708
|
-
// status: 200,
|
|
709
|
-
// headers: { 'content-type': 'application/json' },
|
|
710
|
-
// body: JSON.stringify(this.gen.group.group()),
|
|
711
|
-
// }
|
|
712
606
|
const respond = this.createDefaultResponse(
|
|
713
607
|
200,
|
|
714
608
|
{ 'content-type': 'application/json' },
|
|
715
|
-
() =>
|
|
609
|
+
() => this.wrapResource(this.gen.group.group()),
|
|
716
610
|
init
|
|
717
611
|
)
|
|
718
612
|
await mock.add(
|
|
@@ -732,15 +626,10 @@ export class SdkMock {
|
|
|
732
626
|
*/
|
|
733
627
|
removeUsers: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
734
628
|
const { mock } = this
|
|
735
|
-
// const respond = init?.response ?? {
|
|
736
|
-
// status: 200,
|
|
737
|
-
// headers: { 'content-type': 'application/json' },
|
|
738
|
-
// body: JSON.stringify(this.gen.group.group()),
|
|
739
|
-
// }
|
|
740
629
|
const respond = this.createDefaultResponse(
|
|
741
630
|
200,
|
|
742
631
|
{ 'content-type': 'application/json' },
|
|
743
|
-
() =>
|
|
632
|
+
() => this.wrapResource(this.gen.group.group()),
|
|
744
633
|
init
|
|
745
634
|
)
|
|
746
635
|
await mock.add(
|
|
@@ -763,13 +652,7 @@ export class SdkMock {
|
|
|
763
652
|
const respond = this.createDefaultResponse(
|
|
764
653
|
200,
|
|
765
654
|
{ 'content-type': 'application/json' },
|
|
766
|
-
() =>
|
|
767
|
-
const obj: ContextListResult<AiSessionSchema> = {
|
|
768
|
-
data: this.gen.ai.sessions('general', init?.size ?? 5),
|
|
769
|
-
cursor: this.createCursorOption(init),
|
|
770
|
-
}
|
|
771
|
-
return JSON.stringify(obj)
|
|
772
|
-
},
|
|
655
|
+
() => this.wrapList(this.gen.ai.sessions('general', init?.size ?? 5), init),
|
|
773
656
|
init
|
|
774
657
|
)
|
|
775
658
|
await mock.add(
|
|
@@ -788,7 +671,7 @@ export class SdkMock {
|
|
|
788
671
|
const respond = this.createDefaultResponse(
|
|
789
672
|
201,
|
|
790
673
|
{ 'content-type': 'application/json' },
|
|
791
|
-
() =>
|
|
674
|
+
() => this.wrapResource(this.gen.ai.session()),
|
|
792
675
|
init
|
|
793
676
|
)
|
|
794
677
|
await mock.add(
|
|
@@ -807,7 +690,7 @@ export class SdkMock {
|
|
|
807
690
|
const respond = this.createDefaultResponse(
|
|
808
691
|
200,
|
|
809
692
|
{ 'content-type': 'application/json' },
|
|
810
|
-
() =>
|
|
693
|
+
() => this.wrapResource(this.gen.ai.session()),
|
|
811
694
|
init
|
|
812
695
|
)
|
|
813
696
|
await mock.add(
|
|
@@ -826,7 +709,7 @@ export class SdkMock {
|
|
|
826
709
|
const respond = this.createDefaultResponse(
|
|
827
710
|
200,
|
|
828
711
|
{ 'content-type': 'application/json' },
|
|
829
|
-
() =>
|
|
712
|
+
() => this.wrapResource(this.gen.ai.session()),
|
|
830
713
|
init
|
|
831
714
|
)
|
|
832
715
|
await mock.add(
|
|
@@ -862,13 +745,7 @@ export class SdkMock {
|
|
|
862
745
|
const respond = this.createDefaultResponse(
|
|
863
746
|
200,
|
|
864
747
|
{ 'content-type': 'application/json' },
|
|
865
|
-
() =>
|
|
866
|
-
const obj: ContextListResult<AiMessageSchema> = {
|
|
867
|
-
data: this.gen.ai.messages(init?.size ?? 5),
|
|
868
|
-
cursor: this.createCursorOption(init),
|
|
869
|
-
}
|
|
870
|
-
return JSON.stringify(obj)
|
|
871
|
-
},
|
|
748
|
+
() => this.wrapList(this.gen.ai.messages(init?.size ?? 5), init),
|
|
872
749
|
init
|
|
873
750
|
)
|
|
874
751
|
await mock.add(
|
|
@@ -887,7 +764,7 @@ export class SdkMock {
|
|
|
887
764
|
const respond = this.createDefaultResponse(
|
|
888
765
|
200,
|
|
889
766
|
{ 'content-type': 'application/json' },
|
|
890
|
-
() =>
|
|
767
|
+
() => this.wrapResource(this.gen.ai.message()),
|
|
891
768
|
init
|
|
892
769
|
)
|
|
893
770
|
await mock.add(
|
|
@@ -949,15 +826,10 @@ export class SdkMock {
|
|
|
949
826
|
*/
|
|
950
827
|
me: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
951
828
|
const { mock } = this
|
|
952
|
-
// const respond = init?.response ?? {
|
|
953
|
-
// status: 200,
|
|
954
|
-
// headers: { 'content-type': 'application/json' },
|
|
955
|
-
// body: JSON.stringify(this.gen.users.user()),
|
|
956
|
-
// }
|
|
957
829
|
const respond = this.createDefaultResponse(
|
|
958
830
|
200,
|
|
959
831
|
{ 'content-type': 'application/json' },
|
|
960
|
-
() =>
|
|
832
|
+
() => this.wrapResource(this.gen.users.user()),
|
|
961
833
|
init
|
|
962
834
|
)
|
|
963
835
|
await mock.add(
|
|
@@ -985,13 +857,7 @@ export class SdkMock {
|
|
|
985
857
|
const respond = this.createDefaultResponse(
|
|
986
858
|
200,
|
|
987
859
|
{ 'content-type': 'application/json' },
|
|
988
|
-
() =>
|
|
989
|
-
const obj: ContextListResult<FileSchema> = {
|
|
990
|
-
data: this.gen.files.files(init?.size ?? 5),
|
|
991
|
-
cursor: this.createCursorOption(init),
|
|
992
|
-
}
|
|
993
|
-
return JSON.stringify(obj)
|
|
994
|
-
},
|
|
860
|
+
() => this.wrapList(this.gen.files.files(init?.size ?? 5), init),
|
|
995
861
|
init
|
|
996
862
|
)
|
|
997
863
|
await mock.add(
|
|
@@ -1011,15 +877,10 @@ export class SdkMock {
|
|
|
1011
877
|
*/
|
|
1012
878
|
createMeta: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
1013
879
|
const { mock } = this
|
|
1014
|
-
// const respond = init?.response ?? {
|
|
1015
|
-
// status: 201,
|
|
1016
|
-
// headers: { 'content-type': 'application/json' },
|
|
1017
|
-
// body: JSON.stringify(this.gen.files.file()),
|
|
1018
|
-
// }
|
|
1019
880
|
const respond = this.createDefaultResponse(
|
|
1020
881
|
201,
|
|
1021
882
|
{ 'content-type': 'application/json' },
|
|
1022
|
-
() =>
|
|
883
|
+
() => this.wrapResource(this.gen.files.file()),
|
|
1023
884
|
init
|
|
1024
885
|
)
|
|
1025
886
|
await mock.add(
|
|
@@ -1039,9 +900,6 @@ export class SdkMock {
|
|
|
1039
900
|
*/
|
|
1040
901
|
createMedia: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
1041
902
|
const { mock } = this
|
|
1042
|
-
// const respond = init?.response ?? {
|
|
1043
|
-
// status: 200,
|
|
1044
|
-
// }
|
|
1045
903
|
const respond = this.createDefaultResponse(200, undefined, undefined, init)
|
|
1046
904
|
await mock.add(
|
|
1047
905
|
{
|
|
@@ -1071,15 +929,10 @@ export class SdkMock {
|
|
|
1071
929
|
*/
|
|
1072
930
|
createFolder: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
1073
931
|
const { mock } = this
|
|
1074
|
-
// const respond = init?.response ?? {
|
|
1075
|
-
// status: 201,
|
|
1076
|
-
// headers: { 'content-type': 'application/json' },
|
|
1077
|
-
// body: JSON.stringify(this.gen.files.folder()),
|
|
1078
|
-
// }
|
|
1079
932
|
const respond = this.createDefaultResponse(
|
|
1080
933
|
201,
|
|
1081
934
|
{ 'content-type': 'application/json' },
|
|
1082
|
-
() =>
|
|
935
|
+
() => this.wrapResource(this.gen.files.folder()),
|
|
1083
936
|
init
|
|
1084
937
|
)
|
|
1085
938
|
await mock.add(
|
|
@@ -1099,15 +952,10 @@ export class SdkMock {
|
|
|
1099
952
|
*/
|
|
1100
953
|
read: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
1101
954
|
const { mock } = this
|
|
1102
|
-
// const respond = init?.response ?? {
|
|
1103
|
-
// status: 200,
|
|
1104
|
-
// headers: { 'content-type': 'application/json' },
|
|
1105
|
-
// body: JSON.stringify(this.gen.files.file()),
|
|
1106
|
-
// }
|
|
1107
955
|
const respond = this.createDefaultResponse(
|
|
1108
956
|
200,
|
|
1109
957
|
{ 'content-type': 'application/json' },
|
|
1110
|
-
() =>
|
|
958
|
+
() => this.wrapResource(this.gen.files.file()),
|
|
1111
959
|
init
|
|
1112
960
|
)
|
|
1113
961
|
await mock.add(
|
|
@@ -1127,21 +975,13 @@ export class SdkMock {
|
|
|
1127
975
|
*/
|
|
1128
976
|
readMedia: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
1129
977
|
const { mock } = this
|
|
1130
|
-
// const respond = init?.response ?? {
|
|
1131
|
-
// status: 200,
|
|
1132
|
-
// headers: {
|
|
1133
|
-
// 'content-type': 'application/json',
|
|
1134
|
-
// 'x-version': `${this.gen.faker.number.int({ min: 1, max: 100 })}`,
|
|
1135
|
-
// },
|
|
1136
|
-
// body: JSON.stringify({ data: this.gen.faker.lorem.sentences() }),
|
|
1137
|
-
// }
|
|
1138
978
|
const respond = this.createDefaultResponse(
|
|
1139
979
|
200,
|
|
1140
980
|
{
|
|
1141
981
|
'content-type': 'application/json',
|
|
1142
982
|
'x-version': `${this.gen.faker.number.int({ min: 1, max: 100 })}`,
|
|
1143
983
|
},
|
|
1144
|
-
() =>
|
|
984
|
+
() => this.wrapResource({ data: this.gen.faker.lorem.sentences() }),
|
|
1145
985
|
init
|
|
1146
986
|
)
|
|
1147
987
|
await mock.add(
|
|
@@ -1164,12 +1004,7 @@ export class SdkMock {
|
|
|
1164
1004
|
const respond = this.createDefaultResponse(
|
|
1165
1005
|
200,
|
|
1166
1006
|
{ 'content-type': 'application/json' },
|
|
1167
|
-
() => {
|
|
1168
|
-
const obj: IBulkOperationResult<FileSchema> = {
|
|
1169
|
-
data: this.gen.files.files(init?.size ?? 5),
|
|
1170
|
-
}
|
|
1171
|
-
return JSON.stringify(obj)
|
|
1172
|
-
},
|
|
1007
|
+
() => this.wrapList(this.gen.files.files(init?.size ?? 5), { cursor: false }),
|
|
1173
1008
|
init
|
|
1174
1009
|
)
|
|
1175
1010
|
await mock.add(
|
|
@@ -1189,15 +1024,10 @@ export class SdkMock {
|
|
|
1189
1024
|
*/
|
|
1190
1025
|
patch: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
1191
1026
|
const { mock } = this
|
|
1192
|
-
// const respond = init?.response ?? {
|
|
1193
|
-
// status: 200,
|
|
1194
|
-
// headers: { 'content-type': 'application/json' },
|
|
1195
|
-
// body: JSON.stringify(this.gen.files.file()),
|
|
1196
|
-
// }
|
|
1197
1027
|
const respond = this.createDefaultResponse(
|
|
1198
1028
|
200,
|
|
1199
1029
|
{ 'content-type': 'application/json' },
|
|
1200
|
-
() =>
|
|
1030
|
+
() => this.wrapResource(this.gen.files.file()),
|
|
1201
1031
|
init
|
|
1202
1032
|
)
|
|
1203
1033
|
await mock.add(
|
|
@@ -1217,15 +1047,10 @@ export class SdkMock {
|
|
|
1217
1047
|
*/
|
|
1218
1048
|
patchMedia: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
1219
1049
|
const { mock } = this
|
|
1220
|
-
// const respond = init?.response ?? {
|
|
1221
|
-
// status: 200,
|
|
1222
|
-
// headers: { 'content-type': 'application/json' },
|
|
1223
|
-
// body: JSON.stringify(this.gen.patch.mediaPatchRevision()),
|
|
1224
|
-
// }
|
|
1225
1050
|
const respond = this.createDefaultResponse(
|
|
1226
1051
|
200,
|
|
1227
1052
|
{ 'content-type': 'application/json' },
|
|
1228
|
-
() =>
|
|
1053
|
+
() => this.wrapResource(this.gen.patch.mediaPatchRevision()),
|
|
1229
1054
|
init
|
|
1230
1055
|
)
|
|
1231
1056
|
await mock.add(
|
|
@@ -1245,9 +1070,6 @@ export class SdkMock {
|
|
|
1245
1070
|
*/
|
|
1246
1071
|
delete: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
1247
1072
|
const { mock } = this
|
|
1248
|
-
// const respond = init?.response ?? {
|
|
1249
|
-
// status: 204,
|
|
1250
|
-
// }
|
|
1251
1073
|
const respond = this.createDefaultResponse(204, undefined, undefined, init)
|
|
1252
1074
|
await mock.add(
|
|
1253
1075
|
{
|
|
@@ -1266,9 +1088,6 @@ export class SdkMock {
|
|
|
1266
1088
|
*/
|
|
1267
1089
|
deleteBulk: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
1268
1090
|
const { mock } = this
|
|
1269
|
-
// const respond = init?.response ?? {
|
|
1270
|
-
// status: 204,
|
|
1271
|
-
// }
|
|
1272
1091
|
const respond = this.createDefaultResponse(204, undefined, undefined, init)
|
|
1273
1092
|
await mock.add(
|
|
1274
1093
|
{
|
|
@@ -1287,15 +1106,10 @@ export class SdkMock {
|
|
|
1287
1106
|
*/
|
|
1288
1107
|
patchUsers: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
1289
1108
|
const { mock } = this
|
|
1290
|
-
// const respond = init?.response ?? {
|
|
1291
|
-
// status: 200,
|
|
1292
|
-
// headers: { 'content-type': 'application/json' },
|
|
1293
|
-
// body: JSON.stringify(this.gen.files.file()),
|
|
1294
|
-
// }
|
|
1295
1109
|
const respond = this.createDefaultResponse(
|
|
1296
1110
|
200,
|
|
1297
1111
|
{ 'content-type': 'application/json' },
|
|
1298
|
-
() =>
|
|
1112
|
+
() => this.wrapResource(this.gen.files.file()),
|
|
1299
1113
|
init
|
|
1300
1114
|
)
|
|
1301
1115
|
await mock.add(
|
|
@@ -1332,13 +1146,7 @@ export class SdkMock {
|
|
|
1332
1146
|
const respond = this.createDefaultResponse(
|
|
1333
1147
|
200,
|
|
1334
1148
|
{ 'content-type': 'application/json' },
|
|
1335
|
-
() =>
|
|
1336
|
-
const obj: ContextListResult<UserSchema> = {
|
|
1337
|
-
data: this.gen.users.users(init?.size ?? 5),
|
|
1338
|
-
cursor: this.createCursorOption(init),
|
|
1339
|
-
}
|
|
1340
|
-
return JSON.stringify(obj)
|
|
1341
|
-
},
|
|
1149
|
+
() => this.wrapList(this.gen.users.users(init?.size ?? 5), init),
|
|
1342
1150
|
init
|
|
1343
1151
|
)
|
|
1344
1152
|
await mock.add(
|
|
@@ -1361,13 +1169,7 @@ export class SdkMock {
|
|
|
1361
1169
|
const respond = this.createDefaultResponse(
|
|
1362
1170
|
200,
|
|
1363
1171
|
{ 'content-type': 'application/json' },
|
|
1364
|
-
() =>
|
|
1365
|
-
const obj: ContextListResult<FileBreadcrumb> = {
|
|
1366
|
-
data: this.gen.files.fileBreadcrumbs(init?.size ?? 5),
|
|
1367
|
-
cursor: this.createCursorOption(init),
|
|
1368
|
-
}
|
|
1369
|
-
return JSON.stringify(obj)
|
|
1370
|
-
},
|
|
1172
|
+
() => this.wrapList(this.gen.files.fileBreadcrumbs(init?.size ?? 5), init),
|
|
1371
1173
|
init
|
|
1372
1174
|
)
|
|
1373
1175
|
await mock.add(
|
|
@@ -1397,13 +1199,7 @@ export class SdkMock {
|
|
|
1397
1199
|
const respond = this.createDefaultResponse(
|
|
1398
1200
|
200,
|
|
1399
1201
|
{ 'content-type': 'application/json' },
|
|
1400
|
-
() =>
|
|
1401
|
-
const obj: ContextListResult<FileSchema> = {
|
|
1402
|
-
data: this.gen.files.files(init?.size ?? 5),
|
|
1403
|
-
cursor: this.createCursorOption(init),
|
|
1404
|
-
}
|
|
1405
|
-
return JSON.stringify(obj)
|
|
1406
|
-
},
|
|
1202
|
+
() => this.wrapList(this.gen.files.files(init?.size ?? 5), init),
|
|
1407
1203
|
init
|
|
1408
1204
|
)
|
|
1409
1205
|
await mock.add(
|
|
@@ -1428,13 +1224,7 @@ export class SdkMock {
|
|
|
1428
1224
|
const respond = this.createDefaultResponse(
|
|
1429
1225
|
200,
|
|
1430
1226
|
{ 'content-type': 'application/json' },
|
|
1431
|
-
() =>
|
|
1432
|
-
const obj: ContextListResult<TrashEntry> = {
|
|
1433
|
-
data: this.gen.trash.trashEntries(init?.size ?? 5),
|
|
1434
|
-
cursor: this.createCursorOption(init),
|
|
1435
|
-
}
|
|
1436
|
-
return JSON.stringify(obj)
|
|
1437
|
-
},
|
|
1227
|
+
() => this.wrapList(this.gen.trash.trashEntries(init?.size ?? 5), init),
|
|
1438
1228
|
init
|
|
1439
1229
|
)
|
|
1440
1230
|
await mock.add(
|
|
@@ -1450,9 +1240,6 @@ export class SdkMock {
|
|
|
1450
1240
|
},
|
|
1451
1241
|
delete: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
1452
1242
|
const { mock } = this
|
|
1453
|
-
// const respond = init?.response ?? {
|
|
1454
|
-
// status: 204,
|
|
1455
|
-
// }
|
|
1456
1243
|
const respond = this.createDefaultResponse(204, undefined, undefined, init)
|
|
1457
1244
|
await mock.add(
|
|
1458
1245
|
{
|
|
@@ -1467,9 +1254,6 @@ export class SdkMock {
|
|
|
1467
1254
|
},
|
|
1468
1255
|
restore: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
1469
1256
|
const { mock } = this
|
|
1470
|
-
// const respond = init?.response ?? {
|
|
1471
|
-
// status: 204,
|
|
1472
|
-
// }
|
|
1473
1257
|
const respond = this.createDefaultResponse(204, undefined, undefined, init)
|
|
1474
1258
|
await mock.add(
|
|
1475
1259
|
{
|
|
@@ -1484,9 +1268,6 @@ export class SdkMock {
|
|
|
1484
1268
|
},
|
|
1485
1269
|
empty: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
1486
1270
|
const { mock } = this
|
|
1487
|
-
// const respond = init?.response ?? {
|
|
1488
|
-
// status: 204,
|
|
1489
|
-
// }
|
|
1490
1271
|
const respond = this.createDefaultResponse(204, undefined, undefined, init)
|
|
1491
1272
|
await mock.add(
|
|
1492
1273
|
{
|
|
@@ -1560,11 +1341,7 @@ export class SdkMock {
|
|
|
1560
1341
|
}
|
|
1561
1342
|
})
|
|
1562
1343
|
}
|
|
1563
|
-
|
|
1564
|
-
data,
|
|
1565
|
-
cursor: this.createCursorOption(init),
|
|
1566
|
-
}
|
|
1567
|
-
return JSON.stringify(obj)
|
|
1344
|
+
return this.wrapList(data, init)
|
|
1568
1345
|
},
|
|
1569
1346
|
init
|
|
1570
1347
|
)
|
|
@@ -1594,7 +1371,7 @@ export class SdkMock {
|
|
|
1594
1371
|
env: payload.env,
|
|
1595
1372
|
...(payload.env === DeploymentEnvironment.PROD ? { version: payload.version } : {}),
|
|
1596
1373
|
})
|
|
1597
|
-
return
|
|
1374
|
+
return this.wrapResource(obj)
|
|
1598
1375
|
},
|
|
1599
1376
|
init
|
|
1600
1377
|
)
|
|
@@ -1619,7 +1396,7 @@ export class SdkMock {
|
|
|
1619
1396
|
key: req.params.id,
|
|
1620
1397
|
orgId: req.params.oid,
|
|
1621
1398
|
})
|
|
1622
|
-
return
|
|
1399
|
+
return this.wrapResource(obj)
|
|
1623
1400
|
},
|
|
1624
1401
|
init
|
|
1625
1402
|
)
|
|
@@ -1636,7 +1413,19 @@ export class SdkMock {
|
|
|
1636
1413
|
},
|
|
1637
1414
|
deactivate: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
|
|
1638
1415
|
const { mock } = this
|
|
1639
|
-
const respond = this.createDefaultResponse(
|
|
1416
|
+
const respond = this.createDefaultResponse(
|
|
1417
|
+
200,
|
|
1418
|
+
{ 'content-type': 'application/json' },
|
|
1419
|
+
(req: SerializedRequest) => {
|
|
1420
|
+
const obj = this.gen.deployments.deployment({
|
|
1421
|
+
key: req.params.id,
|
|
1422
|
+
orgId: req.params.oid,
|
|
1423
|
+
status: DeploymentStatus.Inactive,
|
|
1424
|
+
})
|
|
1425
|
+
return this.wrapResource(obj)
|
|
1426
|
+
},
|
|
1427
|
+
init
|
|
1428
|
+
)
|
|
1640
1429
|
await mock.add(
|
|
1641
1430
|
{
|
|
1642
1431
|
match: {
|
|
@@ -1658,23 +1447,21 @@ export class SdkMock {
|
|
|
1658
1447
|
200,
|
|
1659
1448
|
{ 'content-type': 'application/json' },
|
|
1660
1449
|
() => {
|
|
1661
|
-
const obj:
|
|
1662
|
-
data: {},
|
|
1663
|
-
}
|
|
1450
|
+
const obj: DeploymentLatestEnvironments = {}
|
|
1664
1451
|
const hasProd = init?.prod ?? this.gen.faker.datatype.boolean()
|
|
1665
1452
|
const hasStaging = init?.staging ?? this.gen.faker.datatype.boolean()
|
|
1666
1453
|
const hasDev = init?.dev ?? this.gen.faker.datatype.boolean()
|
|
1667
1454
|
|
|
1668
1455
|
if (hasProd) {
|
|
1669
|
-
obj.
|
|
1456
|
+
obj.prod = this.gen.deployments.deployment()
|
|
1670
1457
|
}
|
|
1671
1458
|
if (hasStaging) {
|
|
1672
|
-
obj.
|
|
1459
|
+
obj.staging = this.gen.deployments.deployment()
|
|
1673
1460
|
}
|
|
1674
1461
|
if (hasDev) {
|
|
1675
|
-
obj.
|
|
1462
|
+
obj.dev = this.gen.deployments.deployment()
|
|
1676
1463
|
}
|
|
1677
|
-
return
|
|
1464
|
+
return this.wrapResource(obj)
|
|
1678
1465
|
},
|
|
1679
1466
|
init
|
|
1680
1467
|
)
|
|
@@ -1694,12 +1481,7 @@ export class SdkMock {
|
|
|
1694
1481
|
const respond = this.createDefaultResponse(
|
|
1695
1482
|
200,
|
|
1696
1483
|
{ 'content-type': 'application/json' },
|
|
1697
|
-
() => {
|
|
1698
|
-
const obj: ContextListResult<DeploymentApi> = {
|
|
1699
|
-
data: this.gen.deployments.deploymentApis(init?.size ?? 5),
|
|
1700
|
-
}
|
|
1701
|
-
return JSON.stringify(obj)
|
|
1702
|
-
},
|
|
1484
|
+
() => this.wrapList(this.gen.deployments.deploymentApis(init?.size ?? 5), { cursor: false }),
|
|
1703
1485
|
init
|
|
1704
1486
|
)
|
|
1705
1487
|
await mock.add(
|
|
@@ -1725,13 +1507,7 @@ export class SdkMock {
|
|
|
1725
1507
|
const respond = this.createDefaultResponse(
|
|
1726
1508
|
200,
|
|
1727
1509
|
{ 'content-type': 'application/json' },
|
|
1728
|
-
() =>
|
|
1729
|
-
const obj: ContextListResult<DataCatalogSchemaWithVersion> = {
|
|
1730
|
-
data: this.gen.dataCatalog.dataCatalogsWithVersion(init?.size ?? 5),
|
|
1731
|
-
cursor: this.createCursorOption(init),
|
|
1732
|
-
}
|
|
1733
|
-
return JSON.stringify(obj)
|
|
1734
|
-
},
|
|
1510
|
+
() => this.wrapList(this.gen.dataCatalog.dataCatalogsWithVersion(init?.size ?? 5), init),
|
|
1735
1511
|
init
|
|
1736
1512
|
)
|
|
1737
1513
|
await mock.add(
|
|
@@ -1751,13 +1527,7 @@ export class SdkMock {
|
|
|
1751
1527
|
const respond = this.createDefaultResponse(
|
|
1752
1528
|
200,
|
|
1753
1529
|
{ 'content-type': 'application/json' },
|
|
1754
|
-
() =>
|
|
1755
|
-
const obj: ContextListResult<DataCatalogVersionInfo> = {
|
|
1756
|
-
data: this.gen.dataCatalog.versionInfos(init?.size ?? 5),
|
|
1757
|
-
cursor: this.createCursorOption(init),
|
|
1758
|
-
}
|
|
1759
|
-
return JSON.stringify(obj)
|
|
1760
|
-
},
|
|
1530
|
+
() => this.wrapList(this.gen.dataCatalog.versionInfos(init?.size ?? 5), init),
|
|
1761
1531
|
init
|
|
1762
1532
|
)
|
|
1763
1533
|
await mock.add(
|
|
@@ -1784,7 +1554,7 @@ export class SdkMock {
|
|
|
1784
1554
|
item: obj,
|
|
1785
1555
|
kind: obj.kind,
|
|
1786
1556
|
}
|
|
1787
|
-
return
|
|
1557
|
+
return this.wrapResource(result)
|
|
1788
1558
|
},
|
|
1789
1559
|
init
|
|
1790
1560
|
)
|
|
@@ -1807,7 +1577,7 @@ export class SdkMock {
|
|
|
1807
1577
|
{ 'content-type': 'application/json' },
|
|
1808
1578
|
(req: SerializedRequest) => {
|
|
1809
1579
|
const obj = this.gen.dataCatalog.dataCatalog({ key: req.params.id })
|
|
1810
|
-
return
|
|
1580
|
+
return this.wrapResource(obj)
|
|
1811
1581
|
},
|
|
1812
1582
|
init
|
|
1813
1583
|
)
|
|
@@ -1835,7 +1605,7 @@ export class SdkMock {
|
|
|
1835
1605
|
item: obj,
|
|
1836
1606
|
kind: obj.kind,
|
|
1837
1607
|
}
|
|
1838
|
-
return
|
|
1608
|
+
return this.wrapResource(result)
|
|
1839
1609
|
},
|
|
1840
1610
|
init
|
|
1841
1611
|
)
|
|
@@ -1863,7 +1633,7 @@ export class SdkMock {
|
|
|
1863
1633
|
item: obj,
|
|
1864
1634
|
kind: obj.kind,
|
|
1865
1635
|
}
|
|
1866
|
-
return
|
|
1636
|
+
return this.wrapResource(result)
|
|
1867
1637
|
},
|
|
1868
1638
|
init
|
|
1869
1639
|
)
|
|
@@ -1893,7 +1663,7 @@ export class SdkMock {
|
|
|
1893
1663
|
item: body,
|
|
1894
1664
|
kind: body.kind,
|
|
1895
1665
|
}
|
|
1896
|
-
return
|
|
1666
|
+
return this.wrapResource(result)
|
|
1897
1667
|
},
|
|
1898
1668
|
init
|
|
1899
1669
|
)
|
|
@@ -1916,7 +1686,7 @@ export class SdkMock {
|
|
|
1916
1686
|
{ 'content-type': 'application/json' },
|
|
1917
1687
|
(req: SerializedRequest) => {
|
|
1918
1688
|
const obj = this.gen.dataCatalog.dataCatalogVersion({ key: req.params.vid, catalogKey: req.params.id })
|
|
1919
|
-
return
|
|
1689
|
+
return this.wrapResource(obj)
|
|
1920
1690
|
},
|
|
1921
1691
|
init
|
|
1922
1692
|
)
|
|
@@ -1947,10 +1717,7 @@ export class SdkMock {
|
|
|
1947
1717
|
})
|
|
1948
1718
|
data.push(domain.toJSON())
|
|
1949
1719
|
}
|
|
1950
|
-
|
|
1951
|
-
data,
|
|
1952
|
-
}
|
|
1953
|
-
return JSON.stringify(obj)
|
|
1720
|
+
return this.wrapList(data, { cursor: false })
|
|
1954
1721
|
},
|
|
1955
1722
|
init
|
|
1956
1723
|
)
|
|
@@ -1983,7 +1750,7 @@ export class SdkMock {
|
|
|
1983
1750
|
item: obj,
|
|
1984
1751
|
kind: obj.kind,
|
|
1985
1752
|
}
|
|
1986
|
-
return
|
|
1753
|
+
return this.wrapResource(result)
|
|
1987
1754
|
},
|
|
1988
1755
|
init
|
|
1989
1756
|
)
|
|
@@ -2013,7 +1780,7 @@ export class SdkMock {
|
|
|
2013
1780
|
item: obj,
|
|
2014
1781
|
kind: obj.kind,
|
|
2015
1782
|
}
|
|
2016
|
-
return
|
|
1783
|
+
return this.wrapResource(result)
|
|
2017
1784
|
},
|
|
2018
1785
|
init
|
|
2019
1786
|
)
|
|
@@ -2037,7 +1804,7 @@ export class SdkMock {
|
|
|
2037
1804
|
() => {
|
|
2038
1805
|
const obj = this.gen.dataCatalog.dataCatalog() as DataCatalogStatus
|
|
2039
1806
|
obj.versions = this.gen.dataCatalog.versionInfos(1)
|
|
2040
|
-
return
|
|
1807
|
+
return this.wrapResource(obj)
|
|
2041
1808
|
},
|
|
2042
1809
|
init
|
|
2043
1810
|
)
|
|
@@ -2091,6 +1858,9 @@ export class SdkMock {
|
|
|
2091
1858
|
if (init.cursor === false) {
|
|
2092
1859
|
return undefined
|
|
2093
1860
|
}
|
|
1861
|
+
if (typeof init.cursor === 'string') {
|
|
1862
|
+
return init.cursor
|
|
1863
|
+
}
|
|
2094
1864
|
const hasCursor = init.cursor === true ? true : this.gen.faker.datatype.boolean()
|
|
2095
1865
|
if (!hasCursor) {
|
|
2096
1866
|
return undefined
|
|
@@ -2129,4 +1899,19 @@ export class SdkMock {
|
|
|
2129
1899
|
}
|
|
2130
1900
|
return respond
|
|
2131
1901
|
}
|
|
1902
|
+
|
|
1903
|
+
public wrapResource<T extends object>(resource: T): string {
|
|
1904
|
+
const wrapper: ResourceResponse<T> = {
|
|
1905
|
+
data: resource,
|
|
1906
|
+
}
|
|
1907
|
+
return JSON.stringify(wrapper)
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
public wrapList<T extends object>(items: (T | undefined)[], init?: MockListResult): string {
|
|
1911
|
+
const obj: ContextListResult<T | undefined> = {
|
|
1912
|
+
data: items,
|
|
1913
|
+
cursor: this.createCursorOption(init),
|
|
1914
|
+
}
|
|
1915
|
+
return JSON.stringify(obj)
|
|
1916
|
+
}
|
|
2132
1917
|
}
|