@api-client/core 0.19.18 → 0.19.20

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 (154) hide show
  1. package/build/src/authorization/Utils.js +3 -3
  2. package/build/src/authorization/Utils.js.map +1 -1
  3. package/build/src/browser.d.ts +1 -1
  4. package/build/src/browser.d.ts.map +1 -1
  5. package/build/src/browser.js.map +1 -1
  6. package/build/src/index.d.ts +1 -1
  7. package/build/src/index.d.ts.map +1 -1
  8. package/build/src/index.js.map +1 -1
  9. package/build/src/mocking/lib/Organization.d.ts +5 -1
  10. package/build/src/mocking/lib/Organization.d.ts.map +1 -1
  11. package/build/src/mocking/lib/Organization.js +17 -0
  12. package/build/src/mocking/lib/Organization.js.map +1 -1
  13. package/build/src/modeling/ApiModel.d.ts +16 -5
  14. package/build/src/modeling/ApiModel.d.ts.map +1 -1
  15. package/build/src/modeling/ApiModel.js +17 -2
  16. package/build/src/modeling/ApiModel.js.map +1 -1
  17. package/build/src/modeling/ApiValidation.d.ts.map +1 -1
  18. package/build/src/modeling/ApiValidation.js +2 -1
  19. package/build/src/modeling/ApiValidation.js.map +1 -1
  20. package/build/src/modeling/DomainProperty.d.ts +12 -0
  21. package/build/src/modeling/DomainProperty.d.ts.map +1 -1
  22. package/build/src/modeling/DomainProperty.js +23 -28
  23. package/build/src/modeling/DomainProperty.js.map +1 -1
  24. package/build/src/modeling/DomainSerialization.js +1 -1
  25. package/build/src/modeling/DomainSerialization.js.map +1 -1
  26. package/build/src/modeling/ExposedEntity.d.ts +15 -1
  27. package/build/src/modeling/ExposedEntity.d.ts.map +1 -1
  28. package/build/src/modeling/ExposedEntity.js +42 -4
  29. package/build/src/modeling/ExposedEntity.js.map +1 -1
  30. package/build/src/modeling/actions/Action.d.ts.map +1 -1
  31. package/build/src/modeling/actions/Action.js +1 -0
  32. package/build/src/modeling/actions/Action.js.map +1 -1
  33. package/build/src/modeling/actions/ListAction.d.ts +3 -17
  34. package/build/src/modeling/actions/ListAction.d.ts.map +1 -1
  35. package/build/src/modeling/actions/ListAction.js +18 -38
  36. package/build/src/modeling/actions/ListAction.js.map +1 -1
  37. package/build/src/modeling/actions/SearchAction.d.ts +4 -4
  38. package/build/src/modeling/actions/SearchAction.d.ts.map +1 -1
  39. package/build/src/modeling/actions/SearchAction.js +16 -13
  40. package/build/src/modeling/actions/SearchAction.js.map +1 -1
  41. package/build/src/modeling/generators/oas_312/OasGenerator.d.ts +32 -0
  42. package/build/src/modeling/generators/oas_312/OasGenerator.d.ts.map +1 -0
  43. package/build/src/modeling/generators/oas_312/OasGenerator.js +1452 -0
  44. package/build/src/modeling/generators/oas_312/OasGenerator.js.map +1 -0
  45. package/build/src/modeling/generators/oas_312/OasSchemaGenerator.d.ts +27 -0
  46. package/build/src/modeling/generators/oas_312/OasSchemaGenerator.d.ts.map +1 -0
  47. package/build/src/modeling/generators/oas_312/OasSchemaGenerator.js +295 -0
  48. package/build/src/modeling/generators/oas_312/OasSchemaGenerator.js.map +1 -0
  49. package/build/src/modeling/generators/oas_312/types.d.ts +1010 -0
  50. package/build/src/modeling/generators/oas_312/types.d.ts.map +1 -0
  51. package/build/src/modeling/generators/oas_312/types.js +2 -0
  52. package/build/src/modeling/generators/oas_312/types.js.map +1 -0
  53. package/build/src/modeling/generators/oas_320/OasGenerator.d.ts +16 -0
  54. package/build/src/modeling/generators/oas_320/OasGenerator.d.ts.map +1 -0
  55. package/build/src/modeling/generators/oas_320/OasGenerator.js +306 -0
  56. package/build/src/modeling/generators/oas_320/OasGenerator.js.map +1 -0
  57. package/build/src/modeling/generators/oas_320/OasSchemaGenerator.d.ts +25 -0
  58. package/build/src/modeling/generators/oas_320/OasSchemaGenerator.d.ts.map +1 -0
  59. package/build/src/modeling/generators/oas_320/OasSchemaGenerator.js +237 -0
  60. package/build/src/modeling/generators/oas_320/OasSchemaGenerator.js.map +1 -0
  61. package/build/src/modeling/generators/oas_320/types.d.ts +1219 -0
  62. package/build/src/modeling/generators/oas_320/types.d.ts.map +1 -0
  63. package/build/src/modeling/generators/oas_320/types.js +2 -0
  64. package/build/src/modeling/generators/oas_320/types.js.map +1 -0
  65. package/build/src/modeling/types.d.ts +50 -13
  66. package/build/src/modeling/types.d.ts.map +1 -1
  67. package/build/src/modeling/types.js.map +1 -1
  68. package/build/src/modeling/validation/api_model_rules.d.ts +1 -0
  69. package/build/src/modeling/validation/api_model_rules.d.ts.map +1 -1
  70. package/build/src/modeling/validation/api_model_rules.js +105 -29
  71. package/build/src/modeling/validation/api_model_rules.js.map +1 -1
  72. package/build/src/models/ProjectRequest.d.ts.map +1 -1
  73. package/build/src/models/ProjectRequest.js +0 -4
  74. package/build/src/models/ProjectRequest.js.map +1 -1
  75. package/build/src/models/store/Organization.d.ts +13 -0
  76. package/build/src/models/store/Organization.d.ts.map +1 -1
  77. package/build/src/models/store/Organization.js.map +1 -1
  78. package/build/src/models/transformers/ArcDexieTransformer.d.ts.map +1 -1
  79. package/build/src/models/transformers/ArcDexieTransformer.js +0 -4
  80. package/build/src/models/transformers/ArcDexieTransformer.js.map +1 -1
  81. package/build/src/models/transformers/ImportUtils.js +1 -1
  82. package/build/src/models/transformers/ImportUtils.js.map +1 -1
  83. package/build/src/models/transformers/PostmanBackupTransformer.d.ts.map +1 -1
  84. package/build/src/models/transformers/PostmanBackupTransformer.js +0 -4
  85. package/build/src/models/transformers/PostmanBackupTransformer.js.map +1 -1
  86. package/build/src/runtime/constants.d.ts +7 -0
  87. package/build/src/runtime/constants.d.ts.map +1 -0
  88. package/build/src/runtime/constants.js +8 -0
  89. package/build/src/runtime/constants.js.map +1 -0
  90. package/build/src/runtime/http-engine/ntlm/Des.d.ts.map +1 -1
  91. package/build/src/runtime/http-engine/ntlm/Des.js +1 -0
  92. package/build/src/runtime/http-engine/ntlm/Des.js.map +1 -1
  93. package/build/src/runtime/variables/EvalFunctions.d.ts.map +1 -1
  94. package/build/src/runtime/variables/EvalFunctions.js +0 -1
  95. package/build/src/runtime/variables/EvalFunctions.js.map +1 -1
  96. package/build/src/sdk/OrganizationsSdk.d.ts +17 -1
  97. package/build/src/sdk/OrganizationsSdk.d.ts.map +1 -1
  98. package/build/src/sdk/OrganizationsSdk.js +76 -0
  99. package/build/src/sdk/OrganizationsSdk.js.map +1 -1
  100. package/build/src/sdk/RouteBuilder.d.ts +2 -0
  101. package/build/src/sdk/RouteBuilder.d.ts.map +1 -1
  102. package/build/src/sdk/RouteBuilder.js +6 -0
  103. package/build/src/sdk/RouteBuilder.js.map +1 -1
  104. package/build/src/sdk/SdkMock.d.ts +12 -0
  105. package/build/src/sdk/SdkMock.d.ts.map +1 -1
  106. package/build/src/sdk/SdkMock.js +32 -0
  107. package/build/src/sdk/SdkMock.js.map +1 -1
  108. package/build/tsconfig.tsbuildinfo +1 -1
  109. package/eslint.config.js +6 -0
  110. package/package.json +3 -1
  111. package/src/authorization/Utils.ts +3 -3
  112. package/src/mocking/lib/Organization.ts +22 -1
  113. package/src/modeling/ApiModel.ts +23 -8
  114. package/src/modeling/ApiValidation.ts +2 -0
  115. package/src/modeling/DomainProperty.ts +22 -18
  116. package/src/modeling/DomainSerialization.ts +1 -1
  117. package/src/modeling/ExposedEntity.ts +44 -4
  118. package/src/modeling/actions/Action.ts +1 -0
  119. package/src/modeling/actions/ListAction.ts +12 -30
  120. package/src/modeling/actions/SearchAction.ts +11 -8
  121. package/src/modeling/generators/oas_312/OasGenerator.ts +1685 -0
  122. package/src/modeling/generators/oas_312/OasSchemaGenerator.ts +322 -0
  123. package/src/modeling/generators/oas_312/types.ts +1052 -0
  124. package/src/modeling/generators/oas_320/OasGenerator.ts +359 -0
  125. package/src/modeling/generators/oas_320/OasSchemaGenerator.ts +255 -0
  126. package/src/modeling/generators/oas_320/types.ts +1259 -0
  127. package/src/modeling/types.ts +55 -22
  128. package/src/modeling/validation/api_model_rules.ts +103 -32
  129. package/src/models/ProjectRequest.ts +0 -4
  130. package/src/models/store/Organization.ts +14 -0
  131. package/src/models/transformers/ArcDexieTransformer.ts +0 -4
  132. package/src/models/transformers/ImportUtils.ts +1 -1
  133. package/src/models/transformers/PostmanBackupTransformer.ts +0 -5
  134. package/src/runtime/constants.ts +9 -0
  135. package/src/runtime/http-engine/ntlm/Des.ts +1 -0
  136. package/src/runtime/variables/EvalFunctions.ts +0 -1
  137. package/src/sdk/OrganizationsSdk.ts +81 -1
  138. package/src/sdk/RouteBuilder.ts +8 -0
  139. package/src/sdk/SdkMock.ts +50 -0
  140. package/tests/test-utils.ts +6 -2
  141. package/tests/unit/decorators/observed.spec.ts +8 -24
  142. package/tests/unit/decorators/observed_recursive.spec.ts +0 -1
  143. package/tests/unit/events/EventsTestHelpers.ts +0 -1
  144. package/tests/unit/events/events_polyfills.ts +0 -1
  145. package/tests/unit/legacy-transformers/DataTestHelper.ts +0 -2
  146. package/tests/unit/legacy-transformers/LegacyExportProcessor.spec.ts +0 -1
  147. package/tests/unit/modeling/actions/ListAction.spec.ts +9 -69
  148. package/tests/unit/modeling/actions/SearchAction.spec.ts +9 -35
  149. package/tests/unit/modeling/api_model.spec.ts +28 -0
  150. package/tests/unit/modeling/definitions/sku.spec.ts +0 -2
  151. package/tests/unit/modeling/domain_property.spec.ts +20 -1
  152. package/tests/unit/modeling/exposed_entity.spec.ts +71 -0
  153. package/tests/unit/modeling/generators/OasGenerator.spec.ts +302 -0
  154. package/tests/unit/modeling/validation/api_model_rules.spec.ts +113 -15
@@ -13,7 +13,6 @@ test.group('observed decorator', () => {
13
13
  class TestClass {
14
14
  domain = mockDomain
15
15
 
16
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
16
  @observed() accessor testProperty: any
18
17
  }
19
18
 
@@ -41,7 +40,6 @@ test.group('observed decorator', () => {
41
40
  instanceNotifyCallCount++
42
41
  }
43
42
 
44
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
43
  @observed() accessor testProperty: any
46
44
  }
47
45
 
@@ -92,7 +90,6 @@ test.group('observed decorator', () => {
92
90
  class TestClass {
93
91
  domain = mockDomain
94
92
 
95
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
96
93
  @observed({ deep: true }) accessor nestedData: any
97
94
  }
98
95
 
@@ -119,7 +116,6 @@ test.group('observed decorator', () => {
119
116
  class TestClass {
120
117
  domain = mockDomain
121
118
 
122
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
123
119
  @observed({ deep: true }) accessor primitiveValue: any
124
120
  }
125
121
 
@@ -146,7 +142,6 @@ test.group('observed decorator', () => {
146
142
  class TestClass {
147
143
  domain = mockDomain
148
144
 
149
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
150
145
  @observed() accessor nullableValue: any
151
146
  }
152
147
 
@@ -168,7 +163,7 @@ test.group('observed decorator', () => {
168
163
  test('should throw error for unsupported decorator locations', ({ assert }) => {
169
164
  assert.throws(() => {
170
165
  const decorator = observed()
171
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
166
+
172
167
  decorator({} as any, { kind: 'field' } as any)
173
168
  }, 'Unsupported decorator location: field')
174
169
  }).tags(['@decorators', '@observed', '@core', '@unit', '@fast'])
@@ -184,7 +179,6 @@ test.group('observed decorator', () => {
184
179
  class TestClass {
185
180
  domain = mockDomain
186
181
 
187
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
188
182
  @observed({ deep: true }) accessor complexData: any
189
183
  }
190
184
 
@@ -205,7 +199,7 @@ test.group('observed decorator', () => {
205
199
  test('should handle class without domain or notifyChange', ({ assert }) => {
206
200
  class TestClass {
207
201
  // @ts-expect-error It is for testing purposes
208
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
202
+
209
203
  @observed() accessor testProperty: any
210
204
  }
211
205
 
@@ -229,9 +223,8 @@ test.group('observed decorator', () => {
229
223
  class TestClass {
230
224
  domain = mockDomain
231
225
 
232
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
233
226
  @observed() accessor prop1: any
234
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
227
+
235
228
  @observed() accessor prop2: any
236
229
  }
237
230
 
@@ -258,12 +251,11 @@ test.group('observed decorator', () => {
258
251
  class TestClass {
259
252
  domain = mockDomain
260
253
 
261
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
262
254
  @observed({ deep: true }) accessor data: any
263
255
  }
264
256
 
265
257
  const instance = new TestClass()
266
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
258
+
267
259
  const obj: any = { name: 'test' }
268
260
  obj.self = obj // Create circular reference
269
261
 
@@ -316,7 +308,6 @@ test.group('retargetChange decorator', () => {
316
308
  domain = mockDomain
317
309
 
318
310
  @retargetChange()
319
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
320
311
  accessor target: any
321
312
  }
322
313
 
@@ -344,7 +335,6 @@ test.group('retargetChange decorator', () => {
344
335
  domain = mockDomain
345
336
 
346
337
  @retargetChange()
347
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
348
338
  accessor target: any
349
339
  }
350
340
 
@@ -369,17 +359,14 @@ test.group('retargetChange decorator', () => {
369
359
  }
370
360
 
371
361
  class TestClass {
372
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
373
362
  #target: any
374
363
  domain = mockDomain
375
364
 
376
365
  @retargetChange()
377
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
378
366
  set target(value: any) {
379
367
  this.#target = value
380
368
  }
381
369
 
382
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
383
370
  get target(): any {
384
371
  return this.#target
385
372
  }
@@ -400,7 +387,7 @@ test.group('retargetChange decorator', () => {
400
387
  test('should throw error for unsupported decorator locations', ({ assert }) => {
401
388
  assert.throws(() => {
402
389
  const decorator = retargetChange()
403
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
390
+
404
391
  decorator({} as any, { kind: 'field' } as any)
405
392
  }, 'Unsupported decorator location: field')
406
393
  }).tags(['@decorators', '@retargetChange', '@core', '@unit', '@fast'])
@@ -417,7 +404,6 @@ test.group('toRaw function', () => {
417
404
  class TestClass {
418
405
  domain = mockDomain
419
406
 
420
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
421
407
  @observed({ deep: true }) accessor data: any
422
408
  }
423
409
 
@@ -494,7 +480,7 @@ test.group('edge cases and error conditions', () => {
494
480
  test('should handle class without domain or notifyChange', ({ assert }) => {
495
481
  class TestClass {
496
482
  // @ts-expect-error It is for testing purposes
497
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
483
+
498
484
  @observed() accessor testProperty: any
499
485
  }
500
486
 
@@ -518,9 +504,8 @@ test.group('edge cases and error conditions', () => {
518
504
  class TestClass {
519
505
  domain = mockDomain
520
506
 
521
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
522
507
  @observed() accessor prop1: any
523
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
508
+
524
509
  @observed() accessor prop2: any
525
510
  }
526
511
 
@@ -547,12 +532,11 @@ test.group('edge cases and error conditions', () => {
547
532
  class TestClass {
548
533
  domain = mockDomain
549
534
 
550
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
551
535
  @observed({ deep: true }) accessor data: any
552
536
  }
553
537
 
554
538
  const instance = new TestClass()
555
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
539
+
556
540
  const obj: any = { name: 'test' }
557
541
  obj.self = obj // Create circular reference
558
542
 
@@ -10,7 +10,6 @@ test.group('toRaw recursive proxies', () => {
10
10
  }
11
11
  class TestClass {
12
12
  domain = mockDomain
13
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
13
  @observed({ deep: true }) accessor data: any
15
14
  }
16
15
 
@@ -1,7 +1,6 @@
1
1
  // The event names should be unique across all events in all modules.
2
2
  const names: string[] = []
3
3
 
4
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
4
  export function ensureUnique(namespace: string, src: any): void {
6
5
  for (const [key, value] of Object.entries(src)) {
7
6
  const typedValue = value as string
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  // Originally these tests were written for a browser environment.
3
2
  // They are now adapted to run in a Node.js environment with polyfills for browser APIs.
4
3
 
@@ -1,5 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
-
3
1
  import type { Assert } from '@japa/assert'
4
2
 
5
3
  // eslint-disable-next-line @typescript-eslint/no-extraneous-class
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  import { test } from '@japa/runner'
3
2
  import {
4
3
  ExportArcHistoryRequest,
@@ -1,105 +1,45 @@
1
1
  import { test } from '@japa/runner'
2
2
  import { ListAction } from '../../../../src/modeling/actions/ListAction.js'
3
- import { PaginationStrategy } from '../../../../src/modeling/types.js'
4
3
 
5
4
  test.group('ListAction', () => {
6
5
  test('initializes with default values', ({ assert }) => {
7
6
  const action = new ListAction({} as any)
8
7
  assert.equal(action.kind, 'list')
9
- assert.deepEqual(action.pagination, { kind: 'offset' })
10
- assert.deepEqual(action.filterableFields, [])
11
- assert.deepEqual(action.sortableFields, [])
8
+ assert.isUndefined(action.cacheTtl)
12
9
  assert.isEmpty(action.accessRule) // Inherited from Action
13
10
  }).tags(['@modeling', '@action', '@list-action'])
14
11
 
15
12
  test('initializes with provided values', ({ assert }) => {
16
- const pagination: PaginationStrategy = { kind: 'cursor' }
17
- const filterableFields = ['name', 'status']
18
- const sortableFields = ['createdAt']
13
+ const cacheTtl = 100
19
14
 
20
15
  const action = new ListAction({} as any, {
21
- pagination,
22
- filterableFields,
23
- sortableFields,
16
+ cacheTtl,
24
17
  })
25
18
 
26
- assert.deepEqual(action.pagination, pagination)
27
- assert.deepEqual(action.filterableFields, filterableFields)
28
- assert.deepEqual(action.sortableFields, sortableFields)
19
+ assert.equal(action.cacheTtl, cacheTtl)
29
20
  }).tags(['@modeling', '@action', '@list-action'])
30
21
 
31
- test('constructor copies arrays and objects (immutability)', ({ assert }) => {
32
- const pagination: PaginationStrategy = { kind: 'offset' }
33
- const filterableFields = ['name']
34
- const sortableFields = ['name']
35
-
36
- const action = new ListAction({} as any, {
37
- pagination,
38
- filterableFields,
39
- sortableFields,
40
- })
41
-
42
- // Modify original sources
43
- pagination.kind = 'cursor'
44
- filterableFields.push('age')
45
- sortableFields.push('age')
46
-
47
- assert.deepEqual(action.pagination, { kind: 'offset' })
48
- assert.deepEqual(action.filterableFields, ['name'])
49
- assert.deepEqual(action.sortableFields, ['name'])
50
- }).tags(['@modeling', '@action', '@list-action', '@immutability'])
51
-
52
22
  test('toJSON returns safe copy', ({ assert }) => {
53
23
  const action = new ListAction({} as any, {
54
- pagination: { kind: 'offset' },
55
- filterableFields: ['name'],
56
- sortableFields: ['name'],
24
+ cacheTtl: 100,
57
25
  })
58
26
 
59
27
  const json = action.toJSON()
60
28
 
61
29
  // Modify JSON
62
- json.pagination.kind = 'cursor'
63
- json.filterableFields.push('new')
64
- json.sortableFields.push('new')
30
+ json.cacheTtl = 200
65
31
 
66
- assert.deepEqual(action.pagination, { kind: 'offset' })
67
- assert.deepEqual(action.filterableFields, ['name'])
68
- assert.deepEqual(action.sortableFields, ['name'])
32
+ assert.equal(action.cacheTtl, 100)
69
33
  }).tags(['@modeling', '@action', '@list-action', '@immutability'])
70
34
 
71
- test('notifies change when pagination changes', async ({ assert }) => {
72
- const action = new ListAction({} as any)
73
- let notified = false
74
- action.addEventListener('change', () => {
75
- notified = true
76
- })
77
-
78
- action.pagination = { kind: 'cursor' }
79
- await Promise.resolve()
80
- assert.isTrue(notified)
81
- }).tags(['@modeling', '@action', '@list-action', '@observed'])
82
-
83
- test('notifies change when filterableFields changes', async ({ assert }) => {
84
- const action = new ListAction({} as any)
85
- let notified = false
86
- action.addEventListener('change', () => {
87
- notified = true
88
- })
89
-
90
- action.filterableFields = ['name']
91
- await Promise.resolve()
92
- assert.isTrue(notified)
93
- }).tags(['@modeling', '@action', '@list-action', '@observed'])
94
-
95
- test('notifies change when sortableFields changes', async ({ assert }) => {
35
+ test('notifies change when cacheTtl changes', async ({ assert }) => {
96
36
  const action = new ListAction({} as any)
97
37
  let notified = false
98
38
  action.addEventListener('change', () => {
99
39
  notified = true
100
40
  })
101
41
 
102
- action.sortableFields = ['name']
42
+ action.cacheTtl = 100
103
43
  await Promise.resolve()
104
44
  assert.isTrue(notified)
105
45
  }).tags(['@modeling', '@action', '@list-action', '@observed'])
@@ -5,68 +5,42 @@ test.group('SearchAction', () => {
5
5
  test('initializes with default values', ({ assert }) => {
6
6
  const action = new SearchAction({} as any)
7
7
  assert.equal(action.kind, 'search')
8
- assert.deepEqual(action.fields, [])
8
+ assert.isUndefined(action.maxAstDepth)
9
9
  assert.isEmpty(action.accessRule)
10
10
  }).tags(['@modeling', '@action', '@search-action'])
11
11
 
12
12
  test('initializes with provided values', ({ assert }) => {
13
- const fields = ['name', 'description']
13
+ const maxAstDepth = 10
14
14
  const action = new SearchAction({} as any, {
15
- fields,
15
+ maxAstDepth,
16
16
  })
17
17
 
18
18
  assert.equal(action.kind, 'search')
19
- assert.deepEqual(action.fields, fields)
19
+ assert.equal(action.maxAstDepth, maxAstDepth)
20
20
  }).tags(['@modeling', '@action', '@search-action'])
21
21
 
22
- test('constructor copies arrays (immutability)', ({ assert }) => {
23
- const fields = ['name']
24
-
25
- const action = new SearchAction({} as any, {
26
- fields,
27
- })
28
-
29
- // Modify original source
30
- fields.push('age')
31
-
32
- assert.deepEqual(action.fields, ['name'])
33
- }).tags(['@modeling', '@action', '@search-action', '@immutability'])
34
-
35
22
  test('toJSON returns valid schema', ({ assert }) => {
36
23
  const action = new SearchAction({} as any, {
37
- fields: ['name'],
24
+ maxAstDepth: 10,
38
25
  })
39
26
 
40
27
  const json = action.toJSON()
41
28
 
42
29
  // Modify JSON
43
- json.fields.push('new')
30
+ json.maxAstDepth = 20
44
31
 
45
32
  assert.equal(json.kind, 'search')
46
- assert.lengthOf(action.fields, 1) // Ensure immutability
47
- assert.equal(action.fields[0], 'name')
33
+ assert.equal(action.maxAstDepth, 10)
48
34
  }).tags(['@modeling', '@action', '@search-action', '@serialization', '@immutability'])
49
35
 
50
- test('notifies change when fields changes', async ({ assert }) => {
51
- const action = new SearchAction({} as any)
52
- let notified = false
53
- action.addEventListener('change', () => {
54
- notified = true
55
- })
56
-
57
- action.fields = ['name']
58
- await Promise.resolve()
59
- assert.isTrue(notified)
60
- }).tags(['@modeling', '@action', '@search-action', '@observed'])
61
-
62
- test('notifies change when fields value change', async ({ assert }) => {
36
+ test('notifies change when maxAstDepth changes', async ({ assert }) => {
63
37
  const action = new SearchAction({} as any)
64
38
  let notified = false
65
39
  action.addEventListener('change', () => {
66
40
  notified = true
67
41
  })
68
42
 
69
- action.fields.push('name')
43
+ action.maxAstDepth = 10
70
44
  await Promise.resolve()
71
45
  assert.isTrue(notified)
72
46
  }).tags(['@modeling', '@action', '@search-action', '@observed'])
@@ -33,6 +33,7 @@ test.group('ApiModel.createSchema()', () => {
33
33
  assert.isUndefined(schema.termsOfService)
34
34
  assert.isUndefined(schema.contact)
35
35
  assert.isUndefined(schema.license)
36
+ assert.deepEqual(schema.pagination, { kind: 'cursor' })
36
37
  }).tags(['@modeling', '@api', '@schema'])
37
38
 
38
39
  test('creates a schema with provided values', ({ assert }) => {
@@ -59,6 +60,7 @@ test.group('ApiModel.createSchema()', () => {
59
60
  termsOfService: 'https://example.com/terms',
60
61
  contact: { name: 'John Doe', email: 'john.doe@example.com' } as ApiContact,
61
62
  license: { name: 'MIT', url: 'https://opensource.org/licenses/MIT' } as ApiLicense,
63
+ pagination: { kind: 'offset', defaultLimit: 10 },
62
64
  }
63
65
  const schema = ApiModel.createSchema(input)
64
66
 
@@ -77,6 +79,7 @@ test.group('ApiModel.createSchema()', () => {
77
79
  assert.equal(schema.termsOfService, 'https://example.com/terms')
78
80
  assert.deepEqual(schema.contact, { name: 'John Doe', email: 'john.doe@example.com' })
79
81
  assert.deepEqual(schema.license, { name: 'MIT', url: 'https://opensource.org/licenses/MIT' })
82
+ assert.deepEqual(schema.pagination, { kind: 'offset', defaultLimit: 10 })
80
83
  }).tags(['@modeling', '@api', '@schema'])
81
84
 
82
85
  test('creates a schema with partial info', ({ assert }) => {
@@ -108,6 +111,7 @@ test.group('ApiModel.constructor()', () => {
108
111
  assert.isUndefined(model.contact)
109
112
  assert.isUndefined(model.license)
110
113
  assert.deepEqual(model.dependencyList, [])
114
+ assert.deepEqual(model.pagination, { kind: 'cursor' })
111
115
  }).tags(['@modeling', '@api', '@creation'])
112
116
 
113
117
  test('creates an instance with provided schema values', ({ assert }) => {
@@ -135,6 +139,7 @@ test.group('ApiModel.constructor()', () => {
135
139
  termsOfService: 'https://example.com/terms',
136
140
  contact: { name: 'John Doe', email: 'john.doe@example.com' },
137
141
  license: { name: 'MIT', url: 'https://opensource.org/licenses/MIT' },
142
+ pagination: { kind: 'offset', maxLimit: 50 },
138
143
  }
139
144
  const model = new ApiModel(schema)
140
145
 
@@ -152,6 +157,7 @@ test.group('ApiModel.constructor()', () => {
152
157
  assert.equal(model.termsOfService, 'https://example.com/terms')
153
158
  assert.deepEqual(model.contact, { name: 'John Doe', email: 'john.doe@example.com' })
154
159
  assert.deepEqual(model.license, { name: 'MIT', url: 'https://opensource.org/licenses/MIT' })
160
+ assert.deepEqual(model.pagination, { kind: 'offset', maxLimit: 50 })
155
161
  }).tags(['@modeling', '@api', '@creation'])
156
162
 
157
163
  test('creates an instance with a DataDomain', ({ assert }) => {
@@ -220,6 +226,25 @@ test.group('ApiModel.constructor()', () => {
220
226
  await Promise.resolve()
221
227
  assert.isTrue(notified)
222
228
  }).tags(['@modeling', '@api', '@observed'])
229
+
230
+ test('notifies change when pagination changes', async ({ assert }) => {
231
+ const model = new ApiModel()
232
+ let notified = false
233
+ model.addEventListener('change', () => {
234
+ notified = true
235
+ })
236
+
237
+ // Test mutability notifications
238
+ model.pagination.defaultLimit = 100
239
+ await Promise.resolve()
240
+ assert.isTrue(notified)
241
+ notified = false
242
+
243
+ // Test object reassignment
244
+ model.pagination = { kind: 'offset', maxLimit: 50 }
245
+ await Promise.resolve()
246
+ assert.isTrue(notified)
247
+ }).tags(['@modeling', '@api', '@observed'])
223
248
  })
224
249
 
225
250
  test.group('ApiModel.toJSON()', () => {
@@ -241,6 +266,7 @@ test.group('ApiModel.toJSON()', () => {
241
266
  assert.isUndefined(json.termsOfService)
242
267
  assert.isUndefined(json.contact)
243
268
  assert.isUndefined(json.license)
269
+ assert.deepEqual(json.pagination, { kind: 'cursor' })
244
270
  }).tags(['@modeling', '@api', '@serialization'])
245
271
 
246
272
  test('serializes all provided values', ({ assert }) => {
@@ -268,6 +294,7 @@ test.group('ApiModel.toJSON()', () => {
268
294
  termsOfService: 'https://example.com/terms',
269
295
  contact: { name: 'John Doe', email: 'john.doe@example.com' },
270
296
  license: { name: 'MIT', url: 'https://opensource.org/licenses/MIT' },
297
+ pagination: { kind: 'cursor', defaultLimit: 25 },
271
298
  }
272
299
  const model = new ApiModel(schema)
273
300
  const json = model.toJSON()
@@ -286,6 +313,7 @@ test.group('ApiModel.toJSON()', () => {
286
313
  assert.equal(json.termsOfService, 'https://example.com/terms')
287
314
  assert.deepEqual(json.contact, { name: 'John Doe', email: 'john.doe@example.com' })
288
315
  assert.deepEqual(json.license, { name: 'MIT', url: 'https://opensource.org/licenses/MIT' })
316
+ assert.deepEqual(json.pagination, { kind: 'cursor', defaultLimit: 25 })
289
317
  }).tags(['@modeling', '@api', '@serialization'])
290
318
 
291
319
  test('actions are immutable', ({ assert }) => {
@@ -130,9 +130,7 @@ test.group('SKU Value Validation', () => {
130
130
 
131
131
  test('should reject empty or null values', ({ assert }) => {
132
132
  assert.include(validateSKUValue(''), 'SKU value must be a non-empty string')
133
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
134
133
  assert.include(validateSKUValue(null as any), 'SKU value must be a non-empty string')
135
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
136
134
  assert.include(validateSKUValue(undefined as any), 'SKU value must be a non-empty string')
137
135
  })
138
136
 
@@ -13,6 +13,7 @@ test.group('DomainProperty.createSchema()', () => {
13
13
  assert.isUndefined(schema.multiple)
14
14
  assert.isUndefined(schema.required)
15
15
  assert.isUndefined(schema.index)
16
+ assert.isUndefined(schema.search)
16
17
  assert.isUndefined(schema.primary)
17
18
  assert.isUndefined(schema.readOnly)
18
19
  assert.isUndefined(schema.writeOnly)
@@ -31,6 +32,7 @@ test.group('DomainProperty.createSchema()', () => {
31
32
  multiple: true,
32
33
  primary: true,
33
34
  index: true,
35
+ search: true,
34
36
  readOnly: true,
35
37
  writeOnly: true,
36
38
  deprecated: true,
@@ -48,6 +50,7 @@ test.group('DomainProperty.createSchema()', () => {
48
50
  assert.isTrue(schema.multiple)
49
51
  assert.isTrue(schema.primary)
50
52
  assert.isTrue(schema.index)
53
+ assert.isTrue(schema.search)
51
54
  assert.isTrue(schema.readOnly)
52
55
  assert.isTrue(schema.writeOnly)
53
56
  assert.isTrue(schema.deprecated)
@@ -83,6 +86,7 @@ test.group('DomainProperty.createSchema()', () => {
83
86
  multiple: undefined,
84
87
  required: undefined,
85
88
  index: undefined,
89
+ search: undefined,
86
90
  primary: undefined,
87
91
  readOnly: undefined,
88
92
  writeOnly: undefined,
@@ -100,6 +104,7 @@ test.group('DomainProperty.createSchema()', () => {
100
104
  assert.isUndefined(schema.multiple)
101
105
  assert.isUndefined(schema.required)
102
106
  assert.isUndefined(schema.index)
107
+ assert.isUndefined(schema.search)
103
108
  assert.isUndefined(schema.primary)
104
109
  assert.isUndefined(schema.readOnly)
105
110
  assert.isUndefined(schema.writeOnly)
@@ -119,6 +124,8 @@ test.group('DomainProperty.createSchema()', () => {
119
124
  // @ts-expect-error Testing null values
120
125
  index: null,
121
126
  // @ts-expect-error Testing null values
127
+ search: null,
128
+ // @ts-expect-error Testing null values
122
129
  primary: null,
123
130
  // @ts-expect-error Testing null values
124
131
  readOnly: null,
@@ -138,6 +145,7 @@ test.group('DomainProperty.createSchema()', () => {
138
145
  assert.isUndefined(schema.multiple)
139
146
  assert.isUndefined(schema.required)
140
147
  assert.isUndefined(schema.index)
148
+ assert.isUndefined(schema.search)
141
149
  assert.isUndefined(schema.primary)
142
150
  assert.isUndefined(schema.readOnly)
143
151
  assert.isUndefined(schema.writeOnly)
@@ -165,6 +173,7 @@ test.group('DomainProperty.createSchema()', () => {
165
173
  multiple: false,
166
174
  primary: false,
167
175
  index: false,
176
+ search: false,
168
177
  readOnly: false,
169
178
  writeOnly: false,
170
179
  deprecated: false,
@@ -173,6 +182,7 @@ test.group('DomainProperty.createSchema()', () => {
173
182
  assert.isFalse(schema.multiple)
174
183
  assert.isFalse(schema.primary)
175
184
  assert.isFalse(schema.index)
185
+ assert.isFalse(schema.search)
176
186
  assert.isFalse(schema.readOnly)
177
187
  assert.isFalse(schema.writeOnly)
178
188
  assert.isFalse(schema.deprecated)
@@ -238,6 +248,7 @@ test.group('DomainProperty.constructor()', () => {
238
248
  assert.isUndefined(property.multiple)
239
249
  assert.isUndefined(property.required)
240
250
  assert.isUndefined(property.index)
251
+ assert.isUndefined(property.search)
241
252
  assert.isUndefined(property.primary)
242
253
  assert.isUndefined(property.readOnly)
243
254
  assert.isUndefined(property.writeOnly)
@@ -260,6 +271,7 @@ test.group('DomainProperty.constructor()', () => {
260
271
  multiple: true,
261
272
  primary: true,
262
273
  index: true,
274
+ search: true,
263
275
  readOnly: true,
264
276
  writeOnly: true,
265
277
  deprecated: true,
@@ -278,6 +290,7 @@ test.group('DomainProperty.constructor()', () => {
278
290
  assert.isTrue(property.multiple)
279
291
  assert.isTrue(property.primary)
280
292
  assert.isTrue(property.index)
293
+ assert.isTrue(property.search)
281
294
  assert.isTrue(property.readOnly)
282
295
  assert.isTrue(property.writeOnly)
283
296
  assert.isTrue(property.deprecated)
@@ -400,6 +413,7 @@ test.group('DomainProperty.toJSON()', () => {
400
413
  assert.isUndefined(json.multiple)
401
414
  assert.isUndefined(json.required)
402
415
  assert.isUndefined(json.index)
416
+ assert.isUndefined(json.search)
403
417
  assert.isUndefined(json.primary)
404
418
  assert.isUndefined(json.readOnly)
405
419
  assert.isUndefined(json.writeOnly)
@@ -420,6 +434,7 @@ test.group('DomainProperty.toJSON()', () => {
420
434
  multiple: true,
421
435
  primary: true,
422
436
  index: true,
437
+ search: true,
423
438
  readOnly: true,
424
439
  writeOnly: true,
425
440
  deprecated: true,
@@ -439,6 +454,7 @@ test.group('DomainProperty.toJSON()', () => {
439
454
  assert.isTrue(json.multiple)
440
455
  assert.isTrue(json.primary)
441
456
  assert.isTrue(json.index)
457
+ assert.isTrue(json.search)
442
458
  assert.isTrue(json.readOnly)
443
459
  assert.isTrue(json.writeOnly)
444
460
  assert.isTrue(json.deprecated)
@@ -470,6 +486,7 @@ test.group('DomainProperty.toJSON()', () => {
470
486
  required: undefined,
471
487
  multiple: undefined,
472
488
  index: undefined,
489
+ search: undefined,
473
490
  primary: undefined,
474
491
  readOnly: undefined,
475
492
  writeOnly: undefined,
@@ -484,6 +501,7 @@ test.group('DomainProperty.toJSON()', () => {
484
501
  assert.isUndefined(json.required)
485
502
  assert.isUndefined(json.multiple)
486
503
  assert.isUndefined(json.index)
504
+ assert.isUndefined(json.search)
487
505
  assert.isUndefined(json.primary)
488
506
  assert.isUndefined(json.readOnly)
489
507
  assert.isUndefined(json.writeOnly)
@@ -1296,7 +1314,6 @@ test.group('DomainProperty.toExample()', () => {
1296
1314
 
1297
1315
  // Mock the toApiShape method to return a shape without range
1298
1316
  const originalToApiShape = property.toApiShape
1299
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1300
1317
  property.toApiShape = () => ({ range: undefined }) as any
1301
1318
 
1302
1319
  const result = property.toExample('application/json')
@@ -1545,6 +1562,7 @@ test.group('DomainProperty.duplicate()', () => {
1545
1562
  required: true,
1546
1563
  multiple: true,
1547
1564
  index: true,
1565
+ search: true,
1548
1566
  readOnly: true,
1549
1567
  writeOnly: false,
1550
1568
  deprecated: true,
@@ -1562,6 +1580,7 @@ test.group('DomainProperty.duplicate()', () => {
1562
1580
  assert.equal(duplicate.required, true)
1563
1581
  assert.equal(duplicate.multiple, true)
1564
1582
  assert.equal(duplicate.index, true)
1583
+ assert.equal(duplicate.search, true)
1565
1584
  assert.equal(duplicate.readOnly, true)
1566
1585
  assert.equal(duplicate.writeOnly, false)
1567
1586
  assert.equal(duplicate.deprecated, true)