@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,102 @@
1
+ import { test } from '@japa/runner'
2
+ import { Provider, IProvider, Kind as ProviderKind } from '../../../src/models/Provider.js'
3
+
4
+ test.group('Models > Provider > constructor()', () => {
5
+ test('creates a default instance', ({ assert }) => {
6
+ const result = new Provider()
7
+ assert.equal(result.kind, ProviderKind)
8
+ assert.isUndefined(result.url)
9
+ assert.isUndefined(result.name)
10
+ assert.isUndefined(result.email)
11
+ })
12
+
13
+ test('creates an instance from a schema', ({ assert }) => {
14
+ const init: IProvider = {
15
+ kind: ProviderKind,
16
+ name: 'test name',
17
+ url: 'https://dot.com',
18
+ email: 'a@b.c',
19
+ }
20
+ const result = new Provider(init)
21
+ assert.equal(result.kind, ProviderKind)
22
+ assert.equal(result.url, init.url)
23
+ assert.equal(result.name, init.name)
24
+ assert.equal(result.email, init.email)
25
+ })
26
+
27
+ test('creates an instance from a JSON schema string', ({ assert }) => {
28
+ const init: IProvider = {
29
+ kind: ProviderKind,
30
+ name: 'test name',
31
+ url: 'https://dot.com',
32
+ email: 'a@b.c',
33
+ }
34
+ const result = new Provider(JSON.stringify(init))
35
+ assert.equal(result.kind, ProviderKind)
36
+ assert.equal(result.url, init.url)
37
+ assert.equal(result.name, init.name)
38
+ assert.equal(result.email, init.email)
39
+ })
40
+ })
41
+
42
+ test.group('Models > Provider > new()', (group) => {
43
+ let instance: Provider
44
+ group.each.setup(() => {
45
+ instance = new Provider()
46
+ })
47
+
48
+ test('throws when invalid schema', ({ assert }) => {
49
+ assert.throws(() => {
50
+ // @ts-expect-error Used in testing
51
+ instance.new({})
52
+ })
53
+ })
54
+
55
+ test('sets the URL', ({ assert }) => {
56
+ const schema = instance.toJSON()
57
+ schema.url = 'https://dot.com'
58
+ instance.new(schema)
59
+ assert.equal(instance.url, 'https://dot.com')
60
+ })
61
+
62
+ test('sets the name', ({ assert }) => {
63
+ const schema = instance.toJSON()
64
+ schema.name = 'test name'
65
+ instance.new(schema)
66
+ assert.equal(instance.name, 'test name')
67
+ })
68
+
69
+ test('sets the email', ({ assert }) => {
70
+ const schema = instance.toJSON()
71
+ schema.email = 'a@b.c'
72
+ instance.new(schema)
73
+ assert.equal(instance.email, 'a@b.c')
74
+ })
75
+ })
76
+
77
+ test.group('Models > Provider > toJSON()', (group) => {
78
+ let instance: Provider
79
+ group.each.setup(() => {
80
+ instance = new Provider()
81
+ })
82
+
83
+ const properties: (keyof IProvider)[] = ['url', 'name', 'email']
84
+
85
+ test('serializes the kind', ({ assert }) => {
86
+ const result = instance.toJSON()
87
+ assert.equal(result.kind, ProviderKind)
88
+ })
89
+
90
+ properties.forEach((prop) => {
91
+ test(`does not serialize the ${prop} when missing`, ({ assert }) => {
92
+ const result = instance.toJSON()
93
+ assert.isUndefined(result[prop])
94
+ })
95
+
96
+ test(`serializes the ${prop}`, ({ assert }) => {
97
+ instance[prop] = `test ${prop}`
98
+ const result = instance.toJSON()
99
+ assert.equal(result[prop], `test ${prop}`)
100
+ })
101
+ })
102
+ })