@api-client/core 0.19.36 → 0.19.37

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 (58) hide show
  1. package/build/src/events/BaseEvents.d.ts +14 -4
  2. package/build/src/events/BaseEvents.d.ts.map +1 -1
  3. package/build/src/events/BaseEvents.js +14 -0
  4. package/build/src/events/BaseEvents.js.map +1 -1
  5. package/build/src/mocking/lib/Deployment.d.ts +3 -0
  6. package/build/src/mocking/lib/Deployment.d.ts.map +1 -1
  7. package/build/src/mocking/lib/Deployment.js +11 -0
  8. package/build/src/mocking/lib/Deployment.js.map +1 -1
  9. package/build/src/models/store/Deployment.d.ts +4 -4
  10. package/build/src/models/store/Deployment.d.ts.map +1 -1
  11. package/build/src/models/store/Deployment.js +4 -4
  12. package/build/src/models/store/Deployment.js.map +1 -1
  13. package/build/src/sdk/AiSdk.js +2 -2
  14. package/build/src/sdk/AiSdk.js.map +1 -1
  15. package/build/src/sdk/DeploymentsSdk.d.ts +50 -5
  16. package/build/src/sdk/DeploymentsSdk.d.ts.map +1 -1
  17. package/build/src/sdk/DeploymentsSdk.js +31 -11
  18. package/build/src/sdk/DeploymentsSdk.js.map +1 -1
  19. package/build/src/sdk/FilesSdk.js +4 -4
  20. package/build/src/sdk/FilesSdk.js.map +1 -1
  21. package/build/src/sdk/HistorySdk.js +3 -3
  22. package/build/src/sdk/HistorySdk.js.map +1 -1
  23. package/build/src/sdk/OrganizationsSdk.js +4 -4
  24. package/build/src/sdk/OrganizationsSdk.js.map +1 -1
  25. package/build/src/sdk/RevisionsSdk.js +1 -1
  26. package/build/src/sdk/RevisionsSdk.js.map +1 -1
  27. package/build/src/sdk/RouteBuilder.d.ts +2 -4
  28. package/build/src/sdk/RouteBuilder.d.ts.map +1 -1
  29. package/build/src/sdk/RouteBuilder.js +5 -8
  30. package/build/src/sdk/RouteBuilder.js.map +1 -1
  31. package/build/src/sdk/SdkBase.d.ts +2 -2
  32. package/build/src/sdk/SdkBase.d.ts.map +1 -1
  33. package/build/src/sdk/SdkBase.js +6 -5
  34. package/build/src/sdk/SdkBase.js.map +1 -1
  35. package/build/src/sdk/SdkMock.d.ts +17 -4
  36. package/build/src/sdk/SdkMock.d.ts.map +1 -1
  37. package/build/src/sdk/SdkMock.js +158 -145
  38. package/build/src/sdk/SdkMock.js.map +1 -1
  39. package/build/src/sdk/SharedSdk.js +1 -1
  40. package/build/src/sdk/SharedSdk.js.map +1 -1
  41. package/build/src/sdk/TrashSdk.js +1 -1
  42. package/build/src/sdk/TrashSdk.js.map +1 -1
  43. package/build/tsconfig.tsbuildinfo +1 -1
  44. package/package.json +2 -2
  45. package/src/events/BaseEvents.ts +20 -4
  46. package/src/mocking/lib/Deployment.ts +14 -0
  47. package/src/models/store/Deployment.ts +4 -4
  48. package/src/sdk/AiSdk.ts +2 -2
  49. package/src/sdk/DeploymentsSdk.ts +66 -19
  50. package/src/sdk/FilesSdk.ts +4 -4
  51. package/src/sdk/HistorySdk.ts +3 -3
  52. package/src/sdk/OrganizationsSdk.ts +4 -4
  53. package/src/sdk/RevisionsSdk.ts +1 -1
  54. package/src/sdk/RouteBuilder.ts +6 -11
  55. package/src/sdk/SdkBase.ts +6 -6
  56. package/src/sdk/SdkMock.ts +177 -154
  57. package/src/sdk/SharedSdk.ts +1 -1
  58. package/src/sdk/TrashSdk.ts +1 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@api-client/core",
3
3
  "description": "The API Client's core client library. Works in NodeJS and in a ES enabled browser.",
4
- "version": "0.19.36",
4
+ "version": "0.19.37",
5
5
  "license": "UNLICENSED",
6
6
  "exports": {
7
7
  "./browser.js": {
@@ -86,7 +86,7 @@
86
86
  "@api-client/json": "^0.2.0",
87
87
  "@esm-bundle/chai": "^4.3.4-fix.0",
88
88
  "@faker-js/faker": "^10.1.0",
89
- "@jarrodek/amw": "^0.1.1",
89
+ "@jarrodek/amw": "^0.2.2",
90
90
  "@jarrodek/pluralize": "^1.0.2",
91
91
  "@metrichor/jmespath": "^0.3.1",
92
92
  "@pawel-up/csv": "^0.2.0",
@@ -169,7 +169,7 @@ export interface IBulkOperationResult<T> {
169
169
  * The batch operation does not return specific errors. Use the direct delete operation
170
170
  * for the detailed error.
171
171
  */
172
- items: (T | undefined | null)[]
172
+ data: (T | undefined | null)[]
173
173
  }
174
174
 
175
175
  /**
@@ -280,7 +280,7 @@ export interface ContextUpdateBulkEventDetail<T = unknown> {
280
280
  /**
281
281
  * The list of context store objects to be updated by the context provider.
282
282
  */
283
- items: T[]
283
+ data: T[]
284
284
  /**
285
285
  * The key of the parent object, if applicable.
286
286
  */
@@ -347,7 +347,7 @@ export interface ContextListResult<T> {
347
347
  * The list of items in the response.
348
348
  * May be empty array when there was no more results.
349
349
  */
350
- items: T[]
350
+ data: T[]
351
351
  }
352
352
 
353
353
  /**
@@ -402,6 +402,22 @@ export interface FilterGroup {
402
402
  */
403
403
  export type QueryFilter = AtomicFilter | FilterGroup
404
404
 
405
+ /**
406
+ * Checks if the filter is an atomic filter.
407
+ * @param filter The filter to check.
408
+ */
409
+ export function isAtomicFilter(filter?: QueryFilter): filter is AtomicFilter {
410
+ return !!filter && 'field' in filter && 'operator' in filter
411
+ }
412
+
413
+ /**
414
+ * Checks if the filter is a group filter.
415
+ * @param filter The filter to check.
416
+ */
417
+ export function isFilterGroup(filter?: QueryFilter): filter is FilterGroup {
418
+ return !!filter && 'op' in filter && 'filters' in filter
419
+ }
420
+
405
421
  /**
406
422
  * Base query options for the data store.
407
423
  */
@@ -488,7 +504,7 @@ export interface IQueryResponse<T = unknown> {
488
504
  /**
489
505
  * An ordered list of results.
490
506
  */
491
- items: IQueryResult<T>[]
507
+ data: IQueryResult<T>[]
492
508
  }
493
509
 
494
510
  export interface IQueryResult<T = unknown> {
@@ -2,6 +2,7 @@ import { faker } from '@faker-js/faker'
2
2
  import { nanoid } from '../../nanoid.js'
3
3
  import { DeploymentEnvironment, DeploymentKind, DeploymentStatus } from '../../models/store/Deployment.js'
4
4
  import type { DeploymentSchema } from '../../models/store/Deployment.js'
5
+ import type { DeploymentApi } from '../../sdk/DeploymentsSdk.js'
5
6
 
6
7
  const deploymentEnvironments: DeploymentEnvironment[] = [
7
8
  DeploymentEnvironment.PROD,
@@ -85,4 +86,17 @@ export class Deployment {
85
86
  }
86
87
  return result
87
88
  }
89
+
90
+ deploymentApi(init: Partial<DeploymentApi> = {}): DeploymentApi {
91
+ const { fileId = nanoid(), apiSlug = faker.internet.domainWord() } = init
92
+ return { fileId, apiSlug }
93
+ }
94
+
95
+ deploymentApis(size = 25, init?: Partial<DeploymentApi>): DeploymentApi[] {
96
+ const result: DeploymentApi[] = []
97
+ for (let i = 0; i < size; i++) {
98
+ result.push(this.deploymentApi(init))
99
+ }
100
+ return result
101
+ }
88
102
  }
@@ -11,19 +11,19 @@ export enum DeploymentStatus {
11
11
  /**
12
12
  * Deployment is pending
13
13
  */
14
- Pending = 0,
14
+ Pending = 'pending',
15
15
  /**
16
16
  * Deployment is active
17
17
  */
18
- Active = 1,
18
+ Active = 'active',
19
19
  /**
20
20
  * Deployment is inactive
21
21
  */
22
- Inactive = 2,
22
+ Inactive = 'inactive',
23
23
  /**
24
24
  * Deployment has failed
25
25
  */
26
- Failed = 3,
26
+ Failed = 'failed',
27
27
  }
28
28
 
29
29
  /**
package/src/sdk/AiSdk.ts CHANGED
@@ -156,7 +156,7 @@ export class AiSdk extends SdkBase {
156
156
  } catch {
157
157
  throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
158
158
  }
159
- if (!Array.isArray(data.items)) {
159
+ if (!Array.isArray(data.data)) {
160
160
  throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
161
161
  }
162
162
  return data
@@ -328,7 +328,7 @@ export class AiSdk extends SdkBase {
328
328
  } catch {
329
329
  throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
330
330
  }
331
- if (!Array.isArray(data.items)) {
331
+ if (!Array.isArray(data.data)) {
332
332
  throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
333
333
  }
334
334
  return data
@@ -1,4 +1,4 @@
1
- import { SdkBase, type SdkOptions, E_RESPONSE_STATUS } from './SdkBase.js'
1
+ import { SdkBase, type SdkOptions, E_RESPONSE_STATUS, E_RESPONSE_UNKNOWN } from './SdkBase.js'
2
2
  import { RouteBuilder } from './RouteBuilder.js'
3
3
  import { DeploymentEnvironment, DeploymentKind, DeploymentSchema } from '../models/store/Deployment.js'
4
4
  import { Exception } from '../exceptions/exception.js'
@@ -24,7 +24,49 @@ export interface CreateDeploymentPayload {
24
24
  env: DeploymentEnvironment
25
25
  }
26
26
 
27
+ /**
28
+ * Used when querying for all APIs deployed in the organization.
29
+ */
30
+ export interface DeploymentApi {
31
+ /**
32
+ * ID of the API file.
33
+ */
34
+ fileId: string
35
+ /**
36
+ * Slug of the API.
37
+ */
38
+ apiSlug: string
39
+ }
40
+
41
+ export interface DeploymentLatestEnvironments {
42
+ /**
43
+ * Latest production deployment (if any).
44
+ */
45
+ prod?: DeploymentSchema
46
+ /**
47
+ * Latest staging environment deployment (if any).
48
+ */
49
+ stage?: DeploymentSchema
50
+ /**
51
+ * Latest development environment deployment (if any).
52
+ */
53
+ dev?: DeploymentSchema
54
+ }
55
+
56
+ export interface DeploymentLatestEnvironmentsResponse {
57
+ data: DeploymentLatestEnvironments
58
+ }
59
+
27
60
  export class DeploymentsSdk extends SdkBase {
61
+ /**
62
+ * Lists deployments for a given organization.
63
+ *
64
+ * This endpoint supports pagination and filtering.
65
+ * The client should use it to compose its own paginated list of deployments.
66
+ *
67
+ * @param oid The organization ID
68
+ * @param options Optional SDK options
69
+ */
28
70
  async list(
29
71
  oid: string,
30
72
  options: ContextListOptions = {},
@@ -123,36 +165,41 @@ export class DeploymentsSdk extends SdkBase {
123
165
 
124
166
  apis = {
125
167
  /**
126
- * Lists deployments for a given API, with one entry per environment.
127
- * This is used to display the list of environments for a given API.
168
+ * Lists all APIs in an organization with their active or latest (if no active) deployments.
169
+ * If an environment is missing then there's no deployment for it.
128
170
  *
129
171
  * @param oid The organization ID
130
- * @param apiId The API ID
172
+ * @param fileId The API model file ID
131
173
  * @param request Optional SDK options
174
+ * @returns Object containing latest deployments for each environment
132
175
  */
133
- listAllForApi: async (
176
+ getLatestPerEnvironment: async (
134
177
  oid: string,
135
- apiId: string,
178
+ fileId: string,
136
179
  request: SdkOptions = {}
137
- ): Promise<ContextListResult<DeploymentSchema>> => {
138
- const url = this.sdk.getUrl(RouteBuilder.deploymentsApisByEnv(oid, apiId))
180
+ ): Promise<DeploymentLatestEnvironmentsResponse> => {
181
+ const url = this.sdk.getUrl(RouteBuilder.deploymentsApisByEnvLatest(oid, fileId))
139
182
  const { token = this.sdk.token } = request
140
183
  const result = await this.sdk.http.get(url.toString(), { token })
141
- return this.processListResponse<DeploymentSchema>(result, 'Unable to list environment deployments for an API. ')
184
+ this.inspectCommonStatusCodes(result)
185
+ const E_PREFIX = 'Unable to list latest deployments for an API. '
186
+ const data = this.readResponseJSON<DeploymentLatestEnvironmentsResponse>(result, E_PREFIX)
187
+ if (!data.data) {
188
+ throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
189
+ }
190
+ return data
142
191
  },
143
192
 
144
- listForEnvironment: async (
145
- oid: string,
146
- apiId: string,
147
- env: DeploymentEnvironment,
148
- options: ContextListOptions = {},
149
- request: SdkOptions = {}
150
- ): Promise<ContextListResult<DeploymentSchema>> => {
151
- const url = this.sdk.getUrl(RouteBuilder.deploymentsApisForEnv(oid, apiId, env))
152
- this.sdk.appendListOptions(url, options)
193
+ /**
194
+ * List all APIs in an organization (API slugs + API model file ID).
195
+ * @param oid The organization ID
196
+ * @param request Optional SDK options
197
+ */
198
+ list: async (oid: string, request: SdkOptions = {}): Promise<ContextListResult<DeploymentApi>> => {
199
+ const url = this.sdk.getUrl(RouteBuilder.deploymentsApis(oid))
153
200
  const { token = this.sdk.token } = request
154
201
  const result = await this.sdk.http.get(url.toString(), { token })
155
- return this.processListResponse<DeploymentSchema>(result, 'Unable to list environment deployments for an API. ')
202
+ return this.processListResponse<DeploymentApi>(result, 'Unable to list APIs. ')
156
203
  },
157
204
  }
158
205
  }
@@ -78,7 +78,7 @@ export class FilesSdk extends SdkBase {
78
78
  } catch {
79
79
  throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
80
80
  }
81
- if (!Array.isArray(data.items)) {
81
+ if (!Array.isArray(data.data)) {
82
82
  throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
83
83
  }
84
84
  return data
@@ -338,7 +338,7 @@ export class FilesSdk extends SdkBase {
338
338
  } catch {
339
339
  throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
340
340
  }
341
- if (!Array.isArray(data.items)) {
341
+ if (!Array.isArray(data.data)) {
342
342
  throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
343
343
  }
344
344
  return data
@@ -553,7 +553,7 @@ export class FilesSdk extends SdkBase {
553
553
  } catch {
554
554
  throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
555
555
  }
556
- if (!Array.isArray(data.items)) {
556
+ if (!Array.isArray(data.data)) {
557
557
  throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
558
558
  }
559
559
  return data
@@ -586,7 +586,7 @@ export class FilesSdk extends SdkBase {
586
586
  } catch {
587
587
  throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
588
588
  }
589
- if (!Array.isArray(data.items)) {
589
+ if (!Array.isArray(data.data)) {
590
590
  throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
591
591
  }
592
592
  return data
@@ -87,7 +87,7 @@ export class HistorySdk extends SdkBase {
87
87
  } catch {
88
88
  throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
89
89
  }
90
- if (!data.items) {
90
+ if (!data.data) {
91
91
  throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
92
92
  }
93
93
  return data
@@ -119,7 +119,7 @@ export class HistorySdk extends SdkBase {
119
119
  } catch {
120
120
  throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
121
121
  }
122
- if (!Array.isArray(data.items)) {
122
+ if (!Array.isArray(data.data)) {
123
123
  throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
124
124
  }
125
125
  return data
@@ -192,7 +192,7 @@ export class HistorySdk extends SdkBase {
192
192
  } catch {
193
193
  throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
194
194
  }
195
- if (!Array.isArray(data.items)) {
195
+ if (!Array.isArray(data.data)) {
196
196
  throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
197
197
  }
198
198
  return data
@@ -41,7 +41,7 @@ export class OrganizationsSdk extends SdkBase {
41
41
  } catch {
42
42
  throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
43
43
  }
44
- if (!Array.isArray(data.items)) {
44
+ if (!Array.isArray(data.data)) {
45
45
  throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
46
46
  }
47
47
  return data
@@ -115,7 +115,7 @@ export class OrganizationsSdk extends SdkBase {
115
115
  } catch {
116
116
  throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
117
117
  }
118
- if (!Array.isArray(data.items)) {
118
+ if (!Array.isArray(data.data)) {
119
119
  throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
120
120
  }
121
121
  return data
@@ -371,7 +371,7 @@ export class OrganizationsSdk extends SdkBase {
371
371
  } catch {
372
372
  throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
373
373
  }
374
- if (!Array.isArray(data.items)) {
374
+ if (!Array.isArray(data.data)) {
375
375
  throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
376
376
  }
377
377
  return data
@@ -445,7 +445,7 @@ export class OrganizationsSdk extends SdkBase {
445
445
  } catch {
446
446
  throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
447
447
  }
448
- if (!Array.isArray(data.items)) {
448
+ if (!Array.isArray(data.data)) {
449
449
  throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
450
450
  }
451
451
  return data
@@ -43,7 +43,7 @@ export class RevisionsSdk extends SdkBase {
43
43
  } catch {
44
44
  throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
45
45
  }
46
- if (!Array.isArray(data.items)) {
46
+ if (!Array.isArray(data.data)) {
47
47
  throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
48
48
  }
49
49
  return data
@@ -1,7 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-extraneous-class */
2
2
 
3
3
  import type { AiSessionApp } from '../models/AiSession.js'
4
- import type { DeploymentEnvironment } from '../models/store/Deployment.js'
5
4
 
6
5
  /**
7
6
  * A helper class to make sure routes user and reported by this service are consistent.
@@ -340,19 +339,15 @@ export class RouteBuilder {
340
339
  return `/v1/orgs/${oid}/deployments`
341
340
  }
342
341
 
343
- static deploymentsApis(oid: string, apiId: string): string {
344
- return `${RouteBuilder.deployments(oid)}/apis/${apiId}`
345
- }
346
-
347
- static deploymentsApisByEnv(oid: string, apiId: string): string {
348
- return `${RouteBuilder.deploymentsApis(oid, apiId)}/envs`
349
- }
350
-
351
- static deploymentsApisForEnv(oid: string, apiId: string, env: DeploymentEnvironment): string {
352
- return `${RouteBuilder.deploymentsApis(oid, apiId)}/envs/${env}`
342
+ static deploymentsApis(oid: string): string {
343
+ return `${RouteBuilder.deployments(oid)}/apis`
353
344
  }
354
345
 
355
346
  static deployment(oid: string, deploymentId: string): string {
356
347
  return `${RouteBuilder.deployments(oid)}/${deploymentId}`
357
348
  }
349
+
350
+ static deploymentsApisByEnvLatest(oid: string, fileId: string): string {
351
+ return `${RouteBuilder.deploymentsApis(oid)}/${fileId}/environments/latest`
352
+ }
358
353
  }
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-console */
2
1
  import { Headers } from '../lib/headers/Headers.js'
3
2
  import { Sdk } from './Sdk.js'
4
3
  import {
@@ -54,6 +53,7 @@ export class SdkBase {
54
53
  try {
55
54
  const data = JSON.parse(response.body)
56
55
  if (data.message) {
56
+ // eslint-disable-next-line no-console
57
57
  console.warn(`[Store message]: ${data.message}`)
58
58
  }
59
59
  } catch {
@@ -155,7 +155,7 @@ export class SdkBase {
155
155
  } catch {
156
156
  throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
157
157
  }
158
- if (!Array.isArray(data.items)) {
158
+ if (!Array.isArray(data.data)) {
159
159
  throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
160
160
  }
161
161
  return data
@@ -201,7 +201,7 @@ export class SdkBase {
201
201
  } catch {
202
202
  throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
203
203
  }
204
- if (!Array.isArray(data.items)) {
204
+ if (!Array.isArray(data.data)) {
205
205
  throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
206
206
  }
207
207
  return data
@@ -240,9 +240,9 @@ export class SdkBase {
240
240
 
241
241
  /**
242
242
  * A helper function to process List response.
243
- * The list response is standardised response containing the `items` and `cursor` properties.
243
+ * The list response is standardised response containing the `data` and `cursor` properties.
244
244
  * The list response also returns 200 status code. The logic validates the JSON response,
245
- * 200 status code, and whether the response the `items` array (can be empty).
245
+ * 200 status code, and whether the response the `data` array (can be empty).
246
246
  *
247
247
  * @param result The read results of a standard List request
248
248
  * @param prefix The error prefix to use with the error codes.
@@ -252,7 +252,7 @@ export class SdkBase {
252
252
  this.inspectCommonStatusCodes(result)
253
253
  // Status check happens in the readResponseBody method.
254
254
  const data = this.readResponseJSON<ContextListResult<T>>(result, prefix)
255
- if (!Array.isArray(data.items)) {
255
+ if (!Array.isArray(data.data)) {
256
256
  throw new Exception(`${prefix}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
257
257
  }
258
258
  return data