@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.
- package/RELEASE.md +163 -0
- package/RELEASE_SETUP.md +235 -0
- package/build/src/events/authorization/AuthorizationEvents.d.ts +1 -1
- package/build/src/events/authorization/AuthorizationEvents.d.ts.map +1 -1
- package/build/src/events/authorization/AuthorizationEvents.js +1 -1
- package/build/src/events/authorization/AuthorizationEvents.js.map +1 -1
- package/build/src/events/cookies/CookieEvents.d.ts +1 -1
- package/build/src/events/cookies/CookieEvents.d.ts.map +1 -1
- package/build/src/events/cookies/CookieEvents.js +1 -1
- package/build/src/events/cookies/CookieEvents.js.map +1 -1
- package/build/src/modeling/DomainImpactAnalysis.d.ts +22 -119
- package/build/src/modeling/DomainImpactAnalysis.d.ts.map +1 -1
- package/build/src/modeling/DomainImpactAnalysis.js +49 -155
- package/build/src/modeling/DomainImpactAnalysis.js.map +1 -1
- package/build/src/modeling/DomainValidation.d.ts +8 -0
- package/build/src/modeling/DomainValidation.d.ts.map +1 -0
- package/build/src/modeling/DomainValidation.js +99 -0
- package/build/src/modeling/DomainValidation.js.map +1 -0
- package/build/src/modeling/types.d.ts +70 -0
- package/build/src/modeling/types.d.ts.map +1 -1
- package/build/src/modeling/types.js.map +1 -1
- package/build/src/modeling/validation/rules.d.ts +2 -3
- package/build/src/modeling/validation/rules.d.ts.map +1 -1
- package/build/src/modeling/validation/rules.js.map +1 -1
- package/build/src/modeling/validation/semantic_validation.d.ts +31 -0
- package/build/src/modeling/validation/semantic_validation.d.ts.map +1 -0
- package/build/src/modeling/validation/semantic_validation.js +126 -0
- package/build/src/modeling/validation/semantic_validation.js.map +1 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/data/models/example-generator-api.json +6 -6
- package/noop.ts +3 -0
- package/package.json +9 -4
- package/src/events/authorization/AuthorizationEvents.ts +1 -1
- package/src/events/cookies/CookieEvents.ts +1 -1
- package/src/modeling/DomainImpactAnalysis.ts +54 -239
- package/src/modeling/DomainValidation.ts +105 -0
- package/src/modeling/types.ts +86 -0
- package/src/modeling/validation/rules.ts +2 -4
- package/src/modeling/validation/semantic_validation.ts +145 -0
- package/tests/unit/events/EventsTestHelpers.ts +16 -0
- package/tests/unit/events/amf.spec.ts +151 -0
- package/tests/unit/events/authorization.spec.ts +150 -0
- package/tests/unit/events/cookie.spec.ts +274 -0
- package/tests/unit/events/encryption.spec.ts +108 -0
- package/tests/unit/events/events_polyfills.ts +77 -0
- package/tests/unit/events/process.spec.ts +120 -0
- package/tests/unit/events/reporting.spec.ts +82 -0
- package/tests/unit/events/telemetry.spec.ts +224 -0
- package/tests/unit/events/transport.spec.ts +139 -0
- package/tests/unit/modeling/domain_impact_analysis.spec.ts +0 -110
- package/tests/unit/modeling/domain_validation.spec.ts +94 -0
- package/tests/unit/modeling/validation/semantic_validation.spec.ts +91 -0
- package/tests/unit/models/environment.spec.ts +574 -0
- package/tests/unit/models/error_response.spec.ts +183 -0
- package/tests/unit/models/headers_array.spec.ts +86 -0
- package/tests/unit/models/http-actions/assertion/equal_assertion.spec.ts +103 -0
- package/tests/unit/models/http-actions/assertion/greater_than_assertion.spec.ts +91 -0
- package/tests/unit/models/http-actions/assertion/includes_assertion.spec.ts +71 -0
- package/tests/unit/models/http-actions/assertion/less_than_assertion.spec.ts +91 -0
- package/tests/unit/models/http-actions/assertion/matches_assertion.spec.ts +71 -0
- package/tests/unit/models/http-actions/assertion/matches_schema_assertion.spec.ts +117 -0
- package/tests/unit/models/http-actions/assertion/not_equal_assertion.spec.ts +103 -0
- package/tests/unit/models/http-actions/assertion/not_includes_assertion.spec.ts +71 -0
- package/tests/unit/models/http-actions/assertion/not_ok_assertion.spec.ts +47 -0
- package/tests/unit/models/http-actions/assertion/not_to_be_assertion.spec.ts +72 -0
- package/tests/unit/models/http-actions/assertion/ok_assertion.spec.ts +44 -0
- package/tests/unit/models/http-actions/assertion/to_be_assertion.spec.ts +71 -0
- package/tests/unit/models/http-actions/transformation/as_lower_case_step.spec.ts +47 -0
- package/tests/unit/models/http-actions/transformation/as_number_step.spec.ts +47 -0
- package/tests/unit/models/http-actions/transformation/as_upper_case_step.spec.ts +47 -0
- package/tests/unit/models/http-actions/transformation/round_step.spec.ts +69 -0
- package/tests/unit/models/http-actions/transformation/substring_step.spec.ts +85 -0
- package/tests/unit/models/http-actions/transformation/trim_step.spec.ts +44 -0
- package/tests/unit/models/http_cookie.spec.ts +516 -0
- package/tests/unit/models/http_history.spec.ts +443 -0
- package/tests/unit/models/project_folder.spec.ts +926 -0
- package/tests/unit/models/project_item.spec.ts +137 -0
- package/tests/unit/models/project_request.spec.ts +1047 -0
- package/tests/unit/models/project_schema.spec.ts +236 -0
- package/tests/unit/models/property.spec.ts +625 -0
- package/tests/unit/models/provider.spec.ts +102 -0
- package/tests/unit/models/request.spec.ts +1206 -0
- package/tests/unit/models/request_log.spec.ts +308 -0
- package/tests/unit/models/request_time.spec.ts +138 -0
- package/tests/unit/models/response_redirect.spec.ts +303 -0
- package/tests/unit/models/sent_request.spec.ts +206 -0
- package/tests/unit/models/server.spec.ts +195 -0
- package/tests/unit/models/thing.spec.ts +154 -0
- package/build/oauth-popup.html +0 -33
- /package/tests/unit/models/{Certificate.spec.ts → certificate.spec.ts} +0 -0
- /package/tests/unit/models/{HostRule.spec.ts → host_rule.spec.ts} +0 -0
- /package/tests/unit/models/{HttpProject.spec.ts → http_project.spec.ts} +0 -0
- /package/tests/unit/models/{HttpRequest.spec.ts → http_request.spec.ts} +0 -0
- /package/tests/unit/models/{HttpResponse.spec.ts → http_response.spec.ts} +0 -0
- /package/tests/unit/models/{License.spec.ts → license.spec.ts} +0 -0
- /package/tests/unit/models/{Response.spec.ts → response.spec.ts} +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { test } from '@japa/runner'
|
|
2
|
+
import { ProjectItem } from '../../../src/models/ProjectItem.js'
|
|
3
|
+
import { HttpProject } from '../../../src/models/HttpProject.js'
|
|
4
|
+
import { Kind as ProjectRequestKind } from '../../../src/models/ProjectRequest.js'
|
|
5
|
+
import { ProjectFolderKind } from '../../../src/models/kinds.js'
|
|
6
|
+
|
|
7
|
+
test.group('ProjectItem.projectRequest()', () => {
|
|
8
|
+
test('creates the item', ({ assert }) => {
|
|
9
|
+
const project = HttpProject.fromName('test')
|
|
10
|
+
const item = ProjectItem.projectRequest(project, 'r1')
|
|
11
|
+
assert.equal(item.kind, ProjectRequestKind)
|
|
12
|
+
assert.equal(item.key, 'r1')
|
|
13
|
+
})
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
test.group('ProjectItem.projectFolder()', () => {
|
|
17
|
+
test('creates the item', ({ assert }) => {
|
|
18
|
+
const project = HttpProject.fromName('test')
|
|
19
|
+
const item = ProjectItem.projectFolder(project, 'f1')
|
|
20
|
+
assert.equal(item.kind, ProjectFolderKind)
|
|
21
|
+
assert.equal(item.key, 'f1')
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
test.group('ProjectItem.isProjectItem()', () => {
|
|
26
|
+
test('returns true for a folder item', ({ assert }) => {
|
|
27
|
+
const project = HttpProject.fromName('test')
|
|
28
|
+
const item = ProjectItem.projectFolder(project, 'f1')
|
|
29
|
+
assert.isTrue(ProjectItem.isProjectItem(item))
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
test('returns true for a request item', ({ assert }) => {
|
|
33
|
+
const project = HttpProject.fromName('test')
|
|
34
|
+
const item = ProjectItem.projectRequest(project, 'r1')
|
|
35
|
+
assert.isTrue(ProjectItem.isProjectItem(item))
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test('returns false when not an item', ({ assert }) => {
|
|
39
|
+
assert.isFalse(ProjectItem.isProjectItem({} as ProjectItem))
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
test.group('ProjectItem > constructor()', (group) => {
|
|
44
|
+
let project: HttpProject
|
|
45
|
+
group.each.setup(() => {
|
|
46
|
+
project = HttpProject.fromName('test')
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
test('creates a default item for "http-request" type', ({ assert }) => {
|
|
50
|
+
const item = new ProjectItem(project, 'http-request')
|
|
51
|
+
assert.equal(item.kind, ProjectRequestKind)
|
|
52
|
+
assert.equal(item.key, '')
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
test('creates a default item for "folder" type', ({ assert }) => {
|
|
56
|
+
const item = new ProjectItem(project, 'folder')
|
|
57
|
+
assert.equal(item.kind, ProjectFolderKind)
|
|
58
|
+
assert.equal(item.key, '')
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
test('creates an instance from a schema', ({ assert }) => {
|
|
62
|
+
const schema = ProjectItem.projectRequest(project, 'r1').toJSON()
|
|
63
|
+
const item = new ProjectItem(project, schema)
|
|
64
|
+
assert.equal(item.kind, ProjectRequestKind)
|
|
65
|
+
assert.equal(item.key, 'r1')
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
test('creates an instance from a serialized schema', ({ assert }) => {
|
|
69
|
+
const schema = JSON.stringify(ProjectItem.projectRequest(project, 'r1'))
|
|
70
|
+
const item = new ProjectItem(project, schema)
|
|
71
|
+
assert.equal(item.kind, ProjectRequestKind)
|
|
72
|
+
assert.equal(item.key, 'r1')
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
test('throws when input is not defined', ({ assert }) => {
|
|
76
|
+
assert.throws(() => {
|
|
77
|
+
// @ts-expect-error Used in testing
|
|
78
|
+
new ProjectItem(project, undefined)
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
test.group('ProjectItem > toJSON()', (group) => {
|
|
84
|
+
let project: HttpProject
|
|
85
|
+
group.each.setup(() => {
|
|
86
|
+
project = HttpProject.fromName('test')
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
test('sets the kind', ({ assert }) => {
|
|
90
|
+
const item = ProjectItem.projectRequest(project, 'r1').toJSON()
|
|
91
|
+
assert.equal(item.kind, ProjectRequestKind)
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
test('sets the key', ({ assert }) => {
|
|
95
|
+
const item = ProjectItem.projectRequest(project, 'r1').toJSON()
|
|
96
|
+
assert.equal(item.key, 'r1')
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
test.group('ProjectItem > getItem()', (group) => {
|
|
101
|
+
let project: HttpProject
|
|
102
|
+
group.each.setup(() => {
|
|
103
|
+
project = HttpProject.fromName('test')
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
test('returns a definition of a request', ({ assert }) => {
|
|
107
|
+
const created = project.addRequest('https://api.com')
|
|
108
|
+
const definition = project.items[0].getItem()
|
|
109
|
+
assert.deepEqual(definition, created)
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
test('returns a definition of a folder', ({ assert }) => {
|
|
113
|
+
const created = project.addFolder('a folder')
|
|
114
|
+
const definition = project.items[0].getItem()
|
|
115
|
+
assert.deepEqual(definition, created)
|
|
116
|
+
})
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
test.group('ProjectItem > getParent()', (group) => {
|
|
120
|
+
let project: HttpProject
|
|
121
|
+
group.each.setup(() => {
|
|
122
|
+
project = HttpProject.fromName('test')
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
test('returns the project for a root level items', ({ assert }) => {
|
|
126
|
+
project.addRequest('https://api.com')
|
|
127
|
+
const definition = project.items[0].getParent()
|
|
128
|
+
assert.isTrue(definition === project)
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
test('returns a parent folder', ({ assert }) => {
|
|
132
|
+
const f1 = project.addFolder('f1')
|
|
133
|
+
f1.addFolder('f2') // This creates an item in f1.items
|
|
134
|
+
const definition = f1.items[0].getParent()
|
|
135
|
+
assert.isTrue(definition === f1)
|
|
136
|
+
})
|
|
137
|
+
})
|