@api-client/core 0.14.10 → 0.15.0

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 (96) hide show
  1. package/RELEASE.md +163 -0
  2. package/RELEASE_SETUP.md +235 -0
  3. package/build/src/events/authorization/AuthorizationEvents.d.ts +1 -1
  4. package/build/src/events/authorization/AuthorizationEvents.d.ts.map +1 -1
  5. package/build/src/events/authorization/AuthorizationEvents.js +1 -1
  6. package/build/src/events/authorization/AuthorizationEvents.js.map +1 -1
  7. package/build/src/events/cookies/CookieEvents.d.ts +1 -1
  8. package/build/src/events/cookies/CookieEvents.d.ts.map +1 -1
  9. package/build/src/events/cookies/CookieEvents.js +1 -1
  10. package/build/src/events/cookies/CookieEvents.js.map +1 -1
  11. package/build/src/modeling/DomainImpactAnalysis.d.ts +22 -119
  12. package/build/src/modeling/DomainImpactAnalysis.d.ts.map +1 -1
  13. package/build/src/modeling/DomainImpactAnalysis.js +49 -155
  14. package/build/src/modeling/DomainImpactAnalysis.js.map +1 -1
  15. package/build/src/modeling/DomainValidation.d.ts +8 -0
  16. package/build/src/modeling/DomainValidation.d.ts.map +1 -0
  17. package/build/src/modeling/DomainValidation.js +99 -0
  18. package/build/src/modeling/DomainValidation.js.map +1 -0
  19. package/build/src/modeling/types.d.ts +70 -0
  20. package/build/src/modeling/types.d.ts.map +1 -1
  21. package/build/src/modeling/types.js.map +1 -1
  22. package/build/src/modeling/validation/rules.d.ts +2 -3
  23. package/build/src/modeling/validation/rules.d.ts.map +1 -1
  24. package/build/src/modeling/validation/rules.js.map +1 -1
  25. package/build/src/modeling/validation/semantic_validation.d.ts +31 -0
  26. package/build/src/modeling/validation/semantic_validation.d.ts.map +1 -0
  27. package/build/src/modeling/validation/semantic_validation.js +126 -0
  28. package/build/src/modeling/validation/semantic_validation.js.map +1 -0
  29. package/build/tsconfig.tsbuildinfo +1 -1
  30. package/data/models/example-generator-api.json +6 -6
  31. package/noop.ts +3 -0
  32. package/package.json +9 -4
  33. package/src/events/authorization/AuthorizationEvents.ts +1 -1
  34. package/src/events/cookies/CookieEvents.ts +1 -1
  35. package/src/modeling/DomainImpactAnalysis.ts +54 -239
  36. package/src/modeling/DomainValidation.ts +105 -0
  37. package/src/modeling/types.ts +86 -0
  38. package/src/modeling/validation/rules.ts +2 -4
  39. package/src/modeling/validation/semantic_validation.ts +145 -0
  40. package/tests/unit/events/EventsTestHelpers.ts +16 -0
  41. package/tests/unit/events/amf.spec.ts +151 -0
  42. package/tests/unit/events/authorization.spec.ts +150 -0
  43. package/tests/unit/events/cookie.spec.ts +274 -0
  44. package/tests/unit/events/encryption.spec.ts +108 -0
  45. package/tests/unit/events/events_polyfills.ts +77 -0
  46. package/tests/unit/events/process.spec.ts +120 -0
  47. package/tests/unit/events/reporting.spec.ts +82 -0
  48. package/tests/unit/events/telemetry.spec.ts +224 -0
  49. package/tests/unit/events/transport.spec.ts +139 -0
  50. package/tests/unit/modeling/domain_impact_analysis.spec.ts +0 -110
  51. package/tests/unit/modeling/domain_validation.spec.ts +94 -0
  52. package/tests/unit/modeling/validation/semantic_validation.spec.ts +91 -0
  53. package/tests/unit/models/environment.spec.ts +574 -0
  54. package/tests/unit/models/error_response.spec.ts +183 -0
  55. package/tests/unit/models/headers_array.spec.ts +86 -0
  56. package/tests/unit/models/http-actions/assertion/equal_assertion.spec.ts +103 -0
  57. package/tests/unit/models/http-actions/assertion/greater_than_assertion.spec.ts +91 -0
  58. package/tests/unit/models/http-actions/assertion/includes_assertion.spec.ts +71 -0
  59. package/tests/unit/models/http-actions/assertion/less_than_assertion.spec.ts +91 -0
  60. package/tests/unit/models/http-actions/assertion/matches_assertion.spec.ts +71 -0
  61. package/tests/unit/models/http-actions/assertion/matches_schema_assertion.spec.ts +117 -0
  62. package/tests/unit/models/http-actions/assertion/not_equal_assertion.spec.ts +103 -0
  63. package/tests/unit/models/http-actions/assertion/not_includes_assertion.spec.ts +71 -0
  64. package/tests/unit/models/http-actions/assertion/not_ok_assertion.spec.ts +47 -0
  65. package/tests/unit/models/http-actions/assertion/not_to_be_assertion.spec.ts +72 -0
  66. package/tests/unit/models/http-actions/assertion/ok_assertion.spec.ts +44 -0
  67. package/tests/unit/models/http-actions/assertion/to_be_assertion.spec.ts +71 -0
  68. package/tests/unit/models/http-actions/transformation/as_lower_case_step.spec.ts +47 -0
  69. package/tests/unit/models/http-actions/transformation/as_number_step.spec.ts +47 -0
  70. package/tests/unit/models/http-actions/transformation/as_upper_case_step.spec.ts +47 -0
  71. package/tests/unit/models/http-actions/transformation/round_step.spec.ts +69 -0
  72. package/tests/unit/models/http-actions/transformation/substring_step.spec.ts +85 -0
  73. package/tests/unit/models/http-actions/transformation/trim_step.spec.ts +44 -0
  74. package/tests/unit/models/http_cookie.spec.ts +516 -0
  75. package/tests/unit/models/http_history.spec.ts +443 -0
  76. package/tests/unit/models/project_folder.spec.ts +926 -0
  77. package/tests/unit/models/project_item.spec.ts +137 -0
  78. package/tests/unit/models/project_request.spec.ts +1047 -0
  79. package/tests/unit/models/project_schema.spec.ts +236 -0
  80. package/tests/unit/models/property.spec.ts +625 -0
  81. package/tests/unit/models/provider.spec.ts +102 -0
  82. package/tests/unit/models/request.spec.ts +1206 -0
  83. package/tests/unit/models/request_log.spec.ts +308 -0
  84. package/tests/unit/models/request_time.spec.ts +138 -0
  85. package/tests/unit/models/response_redirect.spec.ts +303 -0
  86. package/tests/unit/models/sent_request.spec.ts +206 -0
  87. package/tests/unit/models/server.spec.ts +195 -0
  88. package/tests/unit/models/thing.spec.ts +154 -0
  89. package/build/oauth-popup.html +0 -33
  90. /package/tests/unit/models/{Certificate.spec.ts → certificate.spec.ts} +0 -0
  91. /package/tests/unit/models/{HostRule.spec.ts → host_rule.spec.ts} +0 -0
  92. /package/tests/unit/models/{HttpProject.spec.ts → http_project.spec.ts} +0 -0
  93. /package/tests/unit/models/{HttpRequest.spec.ts → http_request.spec.ts} +0 -0
  94. /package/tests/unit/models/{HttpResponse.spec.ts → http_response.spec.ts} +0 -0
  95. /package/tests/unit/models/{License.spec.ts → license.spec.ts} +0 -0
  96. /package/tests/unit/models/{Response.spec.ts → response.spec.ts} +0 -0
@@ -0,0 +1,236 @@
1
+ import { test } from '@japa/runner'
2
+ import { ProjectSchema, IProjectSchema, Kind as ProjectSchemaKind } from '../../../src/models/ProjectSchema.js'
3
+ import { Property, IProperty, Kind as PropertyKind } from '../../../src/models/Property.js'
4
+
5
+ test.group('ProjectSchema#fromName()', () => {
6
+ test('creates the schema from the name', ({ assert }) => {
7
+ const result = ProjectSchema.fromName('test')
8
+ assert.equal(result.kind, ProjectSchemaKind)
9
+ assert.equal(result.name, 'test')
10
+ assert.typeOf(result.key, 'string')
11
+ assert.isUndefined(result.properties)
12
+ assert.isUndefined(result.content)
13
+ assert.isUndefined(result.mime)
14
+ })
15
+ })
16
+
17
+ test.group('ProjectSchema#fromContent()', () => {
18
+ test('creates the schema from the content', ({ assert }) => {
19
+ const result = ProjectSchema.fromContent('test name', 'test-content', 'application/json')
20
+ assert.equal(result.kind, ProjectSchemaKind)
21
+ assert.equal(result.name, 'test name')
22
+ assert.typeOf(result.key, 'string')
23
+ assert.isUndefined(result.properties)
24
+ assert.equal(result.content, 'test-content')
25
+ assert.equal(result.mime, 'application/json')
26
+ })
27
+ })
28
+
29
+ test.group('ProjectSchema.constructor()', () => {
30
+ test('creates a default schema', ({ assert }) => {
31
+ const result = new ProjectSchema()
32
+ assert.equal(result.kind, ProjectSchemaKind)
33
+ assert.equal(result.name, '')
34
+ assert.typeOf(result.key, 'string')
35
+ assert.isUndefined(result.properties)
36
+ assert.isUndefined(result.content)
37
+ assert.isUndefined(result.mime)
38
+ })
39
+
40
+ test('creates an instance from a schema', ({ assert }) => {
41
+ const info: IProjectSchema = {
42
+ kind: ProjectSchemaKind,
43
+ name: 'test-info',
44
+ content: 'test-content',
45
+ mime: 'application/json',
46
+ key: '123',
47
+ properties: [Property.Boolean('p1').toJSON()],
48
+ }
49
+ const result = new ProjectSchema(info)
50
+ assert.equal(result.kind, ProjectSchemaKind)
51
+ assert.equal(result.name, 'test-info')
52
+ assert.equal(result.key, '123')
53
+ assert.equal(result.content, 'test-content')
54
+ assert.equal(result.mime, 'application/json')
55
+ assert.typeOf(result.properties, 'array')
56
+ assert.lengthOf(result.properties!, 1)
57
+ assert.equal(result.properties![0].name, 'p1')
58
+ assert.equal(result.properties![0].type, 'boolean')
59
+ })
60
+
61
+ test('creates an instance from a JSON string', ({ assert }) => {
62
+ const info: IProjectSchema = {
63
+ kind: ProjectSchemaKind,
64
+ name: 'test-info',
65
+ key: '123',
66
+ }
67
+ const result = new ProjectSchema(JSON.stringify(info))
68
+ assert.equal(result.kind, ProjectSchemaKind)
69
+ assert.equal(result.name, 'test-info')
70
+ assert.equal(result.key, '123')
71
+ })
72
+
73
+ test('creates the key when missing', ({ assert }) => {
74
+ const info: IProjectSchema = {
75
+ kind: ProjectSchemaKind,
76
+ name: 'test-info',
77
+ key: '123',
78
+ }
79
+ // @ts-expect-error Used in testing
80
+ delete info.key
81
+ const result = new ProjectSchema(info)
82
+ assert.typeOf(result.key, 'string')
83
+ })
84
+ })
85
+
86
+ test.group('ProjectSchema.toJSON()', () => {
87
+ const base: IProjectSchema = {
88
+ kind: ProjectSchemaKind,
89
+ name: 'test-info',
90
+ content: 'test-content',
91
+ mime: 'application/json',
92
+ key: '123',
93
+ properties: [Property.Boolean('p1').toJSON()],
94
+ }
95
+
96
+ test('serializes the kind', ({ assert }) => {
97
+ const instance = new ProjectSchema({ ...base })
98
+ const result = instance.toJSON()
99
+ assert.equal(result.kind, ProjectSchemaKind)
100
+ })
101
+
102
+ test('serializes the key', ({ assert }) => {
103
+ const instance = new ProjectSchema({ ...base })
104
+ const result = instance.toJSON()
105
+ assert.equal(result.key, '123')
106
+ })
107
+
108
+ test('creates the key when missing', ({ assert }) => {
109
+ const instance = new ProjectSchema({ ...base })
110
+ // @ts-expect-error Used in testing
111
+ instance.key = undefined
112
+ const result = instance.toJSON()
113
+ assert.typeOf(result.key, 'string')
114
+ })
115
+
116
+ test('serializes the name', ({ assert }) => {
117
+ const instance = new ProjectSchema({ ...base })
118
+ const result = instance.toJSON()
119
+ assert.equal(result.name, 'test-info')
120
+ })
121
+
122
+ test('serializes the default name when missing', ({ assert }) => {
123
+ const instance = new ProjectSchema({ ...base })
124
+ // @ts-expect-error Used in testing
125
+ instance.name = undefined
126
+ const result = instance.toJSON()
127
+ assert.equal(result.name, '')
128
+ })
129
+
130
+ test('serializes the content', ({ assert }) => {
131
+ const instance = new ProjectSchema({ ...base })
132
+ const result = instance.toJSON()
133
+ assert.equal(result.content, 'test-content')
134
+ })
135
+
136
+ test('serializes the mime', ({ assert }) => {
137
+ const instance = new ProjectSchema({ ...base })
138
+ const result = instance.toJSON()
139
+ assert.equal(result.mime, 'application/json')
140
+ })
141
+
142
+ test('serializes the properties', ({ assert }) => {
143
+ const instance = new ProjectSchema({ ...base })
144
+ const result = instance.toJSON()
145
+ assert.typeOf(result.properties, 'array')
146
+ assert.lengthOf(result.properties!, 1)
147
+ })
148
+
149
+ test('does not serialize the content when missing', ({ assert }) => {
150
+ const instance = new ProjectSchema({ ...base, content: undefined })
151
+ const result = instance.toJSON()
152
+ assert.isUndefined(result.content)
153
+ })
154
+
155
+ test('does not serialize the mime when missing', ({ assert }) => {
156
+ const instance = new ProjectSchema({ ...base, mime: undefined })
157
+ const result = instance.toJSON()
158
+ assert.isUndefined(result.mime)
159
+ })
160
+
161
+ test('does not serialize the properties when missing', ({ assert }) => {
162
+ const instance = new ProjectSchema({ ...base, properties: undefined })
163
+ const result = instance.toJSON()
164
+ assert.isUndefined(result.properties)
165
+ })
166
+ })
167
+
168
+ test.group('ProjectSchema.addProperty()', () => {
169
+ test('adds property by name and type when no properties', ({ assert }) => {
170
+ const instance = new ProjectSchema()
171
+ instance.addProperty('a', 'boolean')
172
+ assert.typeOf(instance.properties, 'array')
173
+ assert.lengthOf(instance.properties!, 1)
174
+ const [prop] = instance.properties!
175
+ assert.equal(prop.name, 'a')
176
+ assert.equal(prop.type, 'boolean')
177
+ })
178
+
179
+ test('adds property by name and type when existing properties', ({ assert }) => {
180
+ const instance = new ProjectSchema()
181
+ instance.addProperty('a', 'boolean')
182
+ instance.addProperty('b', 'string')
183
+ assert.lengthOf(instance.properties!, 2)
184
+ const [, prop] = instance.properties!
185
+ assert.equal(prop.name, 'b')
186
+ assert.equal(prop.type, 'string')
187
+ })
188
+
189
+ test('returns the created property', ({ assert }) => {
190
+ const instance = new ProjectSchema()
191
+ const result = instance.addProperty('a', 'boolean')
192
+ const [prop] = instance.properties!
193
+ assert.deepEqual(prop, result)
194
+ })
195
+
196
+ test('throws when the type is not defined', ({ assert }) => {
197
+ const instance = new ProjectSchema()
198
+ assert.throws(() => {
199
+ // @ts-expect-error Used in testing
200
+ instance.addProperty('a')
201
+ })
202
+ })
203
+
204
+ test('adds a property from the schema', ({ assert }) => {
205
+ const instance = new ProjectSchema()
206
+ const schema: IProperty = {
207
+ kind: PropertyKind,
208
+ name: 'a',
209
+ type: 'string',
210
+ value: '',
211
+ }
212
+ instance.addProperty(schema)
213
+ assert.typeOf(instance.properties, 'array')
214
+ assert.lengthOf(instance.properties!, 1)
215
+ const [prop] = instance.properties!
216
+ assert.equal(prop.name, 'a')
217
+ assert.equal(prop.type, 'string')
218
+ })
219
+
220
+ test('adds the kind property when missing', ({ assert }) => {
221
+ const instance = new ProjectSchema()
222
+ const schema: IProperty = {
223
+ kind: PropertyKind,
224
+ name: 'a',
225
+ type: 'string',
226
+ value: '',
227
+ }
228
+ // @ts-expect-error Used in testing
229
+ delete schema.kind
230
+ instance.addProperty(schema)
231
+ assert.typeOf(instance.properties, 'array')
232
+ assert.lengthOf(instance.properties!, 1)
233
+ const [prop] = instance.properties!
234
+ assert.equal(prop.kind, PropertyKind)
235
+ })
236
+ })