@scalar/oas-utils 0.2.43 → 0.2.45

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 (188) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/diff/diff.d.ts +13 -0
  3. package/dist/diff/diff.d.ts.map +1 -0
  4. package/dist/diff/index.d.ts +1 -0
  5. package/dist/diff/index.d.ts.map +1 -0
  6. package/dist/diff/index.js +1 -0
  7. package/dist/entities/{workspace/cookie → cookie}/cookie.d.ts +1 -17
  8. package/dist/entities/cookie/cookie.d.ts.map +1 -0
  9. package/dist/entities/{workspace/cookie → cookie}/cookie.js +1 -4
  10. package/dist/entities/cookie/index.d.ts.map +1 -0
  11. package/dist/entities/cookie/index.js +1 -0
  12. package/dist/entities/environment/environment.d.ts +24 -0
  13. package/dist/entities/environment/environment.d.ts.map +1 -0
  14. package/dist/entities/environment/environment.js +12 -0
  15. package/dist/entities/environment/index.d.ts.map +1 -0
  16. package/dist/entities/environment/index.js +1 -0
  17. package/dist/entities/{workspace/consts/hot-keys.d.ts → hotkeys/hotkeys.d.ts} +2 -2
  18. package/dist/entities/hotkeys/hotkeys.d.ts.map +1 -0
  19. package/dist/entities/{workspace/consts/hot-keys.js → hotkeys/hotkeys.js} +1 -0
  20. package/dist/entities/hotkeys/index.d.ts +2 -0
  21. package/dist/entities/hotkeys/index.d.ts.map +1 -0
  22. package/dist/entities/hotkeys/index.js +1 -0
  23. package/dist/entities/index.d.ts +1 -1
  24. package/dist/entities/index.d.ts.map +1 -1
  25. package/dist/entities/index.js +1 -1
  26. package/dist/entities/shared/index.d.ts.map +1 -0
  27. package/dist/entities/shared/utility.d.ts.map +1 -0
  28. package/dist/entities/spec/collection.d.ts +489 -0
  29. package/dist/entities/spec/collection.d.ts.map +1 -0
  30. package/dist/entities/spec/collection.js +63 -0
  31. package/dist/entities/spec/index.d.ts +10 -0
  32. package/dist/entities/spec/index.d.ts.map +1 -0
  33. package/dist/entities/spec/index.js +7 -0
  34. package/dist/entities/spec/parameters.d.ts +42 -0
  35. package/dist/entities/spec/parameters.d.ts.map +1 -0
  36. package/dist/entities/spec/parameters.js +30 -0
  37. package/dist/entities/spec/request-examples.d.ts +916 -0
  38. package/dist/entities/spec/request-examples.d.ts.map +1 -0
  39. package/dist/entities/spec/request-examples.js +168 -0
  40. package/dist/entities/spec/requests.d.ts +317 -0
  41. package/dist/entities/spec/requests.d.ts.map +1 -0
  42. package/dist/entities/{workspace/spec → spec}/requests.js +56 -32
  43. package/dist/entities/spec/security.d.ts +964 -0
  44. package/dist/entities/spec/security.d.ts.map +1 -0
  45. package/dist/entities/spec/security.js +222 -0
  46. package/dist/entities/spec/server.d.ts +82 -0
  47. package/dist/entities/spec/server.d.ts.map +1 -0
  48. package/dist/entities/{workspace/server → spec}/server.js +11 -13
  49. package/dist/entities/spec/spec-objects.d.ts +279 -0
  50. package/dist/entities/spec/spec-objects.d.ts.map +1 -0
  51. package/dist/entities/{workspace/collection/collection.js → spec/spec-objects.js} +21 -45
  52. package/dist/entities/workspace/index.js +1 -1
  53. package/dist/entities/workspace/workspace.d.ts +24 -43
  54. package/dist/entities/workspace/workspace.d.ts.map +1 -1
  55. package/dist/entities/workspace/workspace.js +6 -7
  56. package/dist/helpers/httpMethods.d.ts +16 -82
  57. package/dist/helpers/httpMethods.d.ts.map +1 -1
  58. package/dist/helpers/httpMethods.js +45 -41
  59. package/dist/helpers/index.d.ts +2 -0
  60. package/dist/helpers/index.d.ts.map +1 -1
  61. package/dist/helpers/index.js +4 -2
  62. package/dist/helpers/local-storage.d.ts +16 -0
  63. package/dist/helpers/local-storage.d.ts.map +1 -0
  64. package/dist/helpers/local-storage.js +17 -0
  65. package/dist/helpers/redirectToProxy.d.ts +2 -0
  66. package/dist/helpers/redirectToProxy.d.ts.map +1 -1
  67. package/dist/helpers/redirectToProxy.js +6 -7
  68. package/dist/helpers/regexHelpers.d.ts +3 -0
  69. package/dist/helpers/regexHelpers.d.ts.map +1 -0
  70. package/dist/helpers/regexHelpers.js +4 -0
  71. package/dist/helpers/schema-model.d.ts +2 -2
  72. package/dist/helpers/schema-model.d.ts.map +1 -1
  73. package/dist/helpers/schema-model.js +11 -17
  74. package/dist/migrations/data-version.d.ts +12 -0
  75. package/dist/migrations/data-version.d.ts.map +1 -0
  76. package/dist/migrations/data-version.js +13 -0
  77. package/dist/migrations/generate-types.d.ts +2 -0
  78. package/dist/migrations/generate-types.d.ts.map +1 -0
  79. package/dist/migrations/index.d.ts +4 -0
  80. package/dist/migrations/index.d.ts.map +1 -0
  81. package/dist/migrations/index.js +3 -0
  82. package/dist/migrations/local-storage.d.ts +8 -0
  83. package/dist/migrations/local-storage.d.ts.map +1 -0
  84. package/dist/migrations/local-storage.js +36 -0
  85. package/dist/migrations/migrator.d.ts +4 -0
  86. package/dist/migrations/migrator.d.ts.map +1 -0
  87. package/dist/migrations/migrator.js +40 -0
  88. package/dist/migrations/semver.d.ts +5 -0
  89. package/dist/migrations/semver.d.ts.map +1 -0
  90. package/dist/migrations/semver.js +25 -0
  91. package/dist/migrations/v-0.0.0/index.d.ts +2 -0
  92. package/dist/migrations/v-0.0.0/index.d.ts.map +1 -0
  93. package/dist/migrations/v-0.0.0/index.js +1 -0
  94. package/dist/migrations/v-0.0.0/types.generated.d.ts +347 -0
  95. package/dist/migrations/v-0.0.0/types.generated.d.ts.map +1 -0
  96. package/dist/migrations/v-2.1.0/index.d.ts +3 -0
  97. package/dist/migrations/v-2.1.0/index.d.ts.map +1 -0
  98. package/dist/migrations/v-2.1.0/index.js +1 -0
  99. package/dist/migrations/v-2.1.0/migration.d.ts +334 -0
  100. package/dist/migrations/v-2.1.0/migration.d.ts.map +1 -0
  101. package/dist/migrations/v-2.1.0/migration.js +249 -0
  102. package/dist/migrations/v-2.1.0/types.generated.d.ts +42 -0
  103. package/dist/migrations/v-2.1.0/types.generated.d.ts.map +1 -0
  104. package/dist/spec-getters/getExampleFromSchema.d.ts.map +1 -1
  105. package/dist/spec-getters/getExampleFromSchema.js +21 -8
  106. package/dist/spec-getters/getParametersFromOperation.d.ts +1 -1
  107. package/dist/spec-getters/getParametersFromOperation.d.ts.map +1 -1
  108. package/dist/spec-getters/getParametersFromOperation.js +8 -7
  109. package/dist/spec-getters/getRequestBodyFromOperation.d.ts +12 -40
  110. package/dist/spec-getters/getRequestBodyFromOperation.d.ts.map +1 -1
  111. package/dist/spec-getters/getRequestBodyFromOperation.js +34 -23
  112. package/dist/spec-getters/getRequestFromOperation.d.ts.map +1 -1
  113. package/dist/spec-getters/getRequestFromOperation.js +1 -2
  114. package/dist/spec-getters/getServerVariableExamples.d.ts +4 -0
  115. package/dist/spec-getters/getServerVariableExamples.d.ts.map +1 -0
  116. package/dist/spec-getters/getServerVariableExamples.js +12 -0
  117. package/dist/spec-getters/index.d.ts +1 -0
  118. package/dist/spec-getters/index.d.ts.map +1 -1
  119. package/dist/spec-getters/index.js +1 -0
  120. package/dist/transforms/export-spec.d.ts +68 -0
  121. package/dist/transforms/export-spec.d.ts.map +1 -0
  122. package/dist/transforms/import-spec.d.ts +20 -68
  123. package/dist/transforms/import-spec.d.ts.map +1 -1
  124. package/dist/transforms/import-spec.js +209 -126
  125. package/package.json +43 -37
  126. package/dist/entities/workspace/collection/collection.d.ts +0 -330
  127. package/dist/entities/workspace/collection/collection.d.ts.map +0 -1
  128. package/dist/entities/workspace/collection/index.d.ts +0 -2
  129. package/dist/entities/workspace/collection/index.d.ts.map +0 -1
  130. package/dist/entities/workspace/collection/index.js +0 -1
  131. package/dist/entities/workspace/consts/hot-keys.d.ts.map +0 -1
  132. package/dist/entities/workspace/consts/index.d.ts +0 -2
  133. package/dist/entities/workspace/consts/index.d.ts.map +0 -1
  134. package/dist/entities/workspace/consts/index.js +0 -1
  135. package/dist/entities/workspace/cookie/cookie.d.ts.map +0 -1
  136. package/dist/entities/workspace/cookie/index.d.ts.map +0 -1
  137. package/dist/entities/workspace/cookie/index.js +0 -1
  138. package/dist/entities/workspace/environment/environment.d.ts +0 -55
  139. package/dist/entities/workspace/environment/environment.d.ts.map +0 -1
  140. package/dist/entities/workspace/environment/environment.js +0 -23
  141. package/dist/entities/workspace/environment/index.d.ts.map +0 -1
  142. package/dist/entities/workspace/environment/index.js +0 -1
  143. package/dist/entities/workspace/folder/folder.d.ts +0 -36
  144. package/dist/entities/workspace/folder/folder.d.ts.map +0 -1
  145. package/dist/entities/workspace/folder/folder.js +0 -21
  146. package/dist/entities/workspace/folder/index.d.ts +0 -2
  147. package/dist/entities/workspace/folder/index.d.ts.map +0 -1
  148. package/dist/entities/workspace/folder/index.js +0 -1
  149. package/dist/entities/workspace/security/index.d.ts +0 -3
  150. package/dist/entities/workspace/security/index.d.ts.map +0 -1
  151. package/dist/entities/workspace/security/index.js +0 -2
  152. package/dist/entities/workspace/security/security-requirement.d.ts +0 -13
  153. package/dist/entities/workspace/security/security-requirement.d.ts.map +0 -1
  154. package/dist/entities/workspace/security/security-requirement.js +0 -15
  155. package/dist/entities/workspace/security/security-schemes.d.ts +0 -696
  156. package/dist/entities/workspace/security/security-schemes.d.ts.map +0 -1
  157. package/dist/entities/workspace/security/security-schemes.js +0 -139
  158. package/dist/entities/workspace/server/index.d.ts +0 -2
  159. package/dist/entities/workspace/server/index.d.ts.map +0 -1
  160. package/dist/entities/workspace/server/index.js +0 -1
  161. package/dist/entities/workspace/server/server.d.ts +0 -91
  162. package/dist/entities/workspace/server/server.d.ts.map +0 -1
  163. package/dist/entities/workspace/shared/index.d.ts.map +0 -1
  164. package/dist/entities/workspace/shared/utility.d.ts.map +0 -1
  165. package/dist/entities/workspace/spec/components.d.ts +0 -3
  166. package/dist/entities/workspace/spec/components.d.ts.map +0 -1
  167. package/dist/entities/workspace/spec/index.d.ts +0 -5
  168. package/dist/entities/workspace/spec/index.d.ts.map +0 -1
  169. package/dist/entities/workspace/spec/index.js +0 -2
  170. package/dist/entities/workspace/spec/parameters.d.ts +0 -16
  171. package/dist/entities/workspace/spec/parameters.d.ts.map +0 -1
  172. package/dist/entities/workspace/spec/refs.d.ts +0 -30
  173. package/dist/entities/workspace/spec/refs.d.ts.map +0 -1
  174. package/dist/entities/workspace/spec/refs.js +0 -9
  175. package/dist/entities/workspace/spec/request-examples.d.ts +0 -1573
  176. package/dist/entities/workspace/spec/request-examples.d.ts.map +0 -1
  177. package/dist/entities/workspace/spec/request-examples.js +0 -96
  178. package/dist/entities/workspace/spec/requests.d.ts +0 -181
  179. package/dist/entities/workspace/spec/requests.d.ts.map +0 -1
  180. package/dist/entities/workspace/spec/spec.d.ts +0 -18
  181. package/dist/entities/workspace/spec/spec.d.ts.map +0 -1
  182. package/dist/entities/workspace/spec/spec.js +0 -8
  183. /package/dist/entities/{workspace/cookie → cookie}/index.d.ts +0 -0
  184. /package/dist/entities/{workspace/environment → environment}/index.d.ts +0 -0
  185. /package/dist/entities/{workspace/shared → shared}/index.d.ts +0 -0
  186. /package/dist/entities/{workspace/shared → shared}/index.js +0 -0
  187. /package/dist/entities/{workspace/shared → shared}/utility.d.ts +0 -0
  188. /package/dist/entities/{workspace/shared → shared}/utility.js +0 -0
@@ -0,0 +1,489 @@
1
+ import { z } from 'zod';
2
+ export declare const extendedCollectionSchema: z.ZodObject<{
3
+ uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
4
+ /** A list of security schemes UIDs associated with the collection */
5
+ securitySchemes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
6
+ /** The currently selected server */
7
+ selectedServerUid: z.ZodDefault<z.ZodString>;
8
+ /** UIDs which refer to servers on the workspace base */
9
+ servers: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
10
+ /** Request UIDs associated with a collection */
11
+ requests: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
12
+ /** Tag UIDs associated with the collection */
13
+ tags: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
14
+ /** List of requests without tags and top level tag "folders" */
15
+ children: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
16
+ /**
17
+ * Map of security schemas to their value sets
18
+ *
19
+ * For each selected security schema we should have an entry here
20
+ * The entry will contain the secret values (but not the schema definition)
21
+ */
22
+ auth: z.ZodDefault<z.ZodRecord<z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodUnion<[z.ZodObject<{
23
+ type: z.ZodDefault<z.ZodLiteral<"apiKey">>;
24
+ name: z.ZodDefault<z.ZodString>;
25
+ value: z.ZodDefault<z.ZodString>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ type: "apiKey";
28
+ value: string;
29
+ name: string;
30
+ }, {
31
+ type?: "apiKey" | undefined;
32
+ value?: string | undefined;
33
+ name?: string | undefined;
34
+ }>, z.ZodObject<{
35
+ type: z.ZodDefault<z.ZodLiteral<"http">>;
36
+ username: z.ZodDefault<z.ZodString>;
37
+ password: z.ZodDefault<z.ZodString>;
38
+ token: z.ZodDefault<z.ZodString>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ type: "http";
41
+ username: string;
42
+ password: string;
43
+ token: string;
44
+ }, {
45
+ type?: "http" | undefined;
46
+ username?: string | undefined;
47
+ password?: string | undefined;
48
+ token?: string | undefined;
49
+ }>, z.ZodObject<{
50
+ type: z.ZodDefault<z.ZodLiteral<"oauth-implicit">>;
51
+ token: z.ZodDefault<z.ZodString>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ type: "oauth-implicit";
54
+ token: string;
55
+ }, {
56
+ type?: "oauth-implicit" | undefined;
57
+ token?: string | undefined;
58
+ }>, z.ZodObject<{
59
+ type: z.ZodDefault<z.ZodLiteral<"oauth-password">>;
60
+ token: z.ZodDefault<z.ZodString>;
61
+ username: z.ZodDefault<z.ZodString>;
62
+ password: z.ZodDefault<z.ZodString>;
63
+ clientSecret: z.ZodDefault<z.ZodString>;
64
+ }, "strip", z.ZodTypeAny, {
65
+ type: "oauth-password";
66
+ username: string;
67
+ password: string;
68
+ token: string;
69
+ clientSecret: string;
70
+ }, {
71
+ type?: "oauth-password" | undefined;
72
+ username?: string | undefined;
73
+ password?: string | undefined;
74
+ token?: string | undefined;
75
+ clientSecret?: string | undefined;
76
+ }>, z.ZodObject<{
77
+ type: z.ZodDefault<z.ZodLiteral<"oauth-clientCredentials">>;
78
+ token: z.ZodDefault<z.ZodString>;
79
+ clientSecret: z.ZodDefault<z.ZodString>;
80
+ }, "strip", z.ZodTypeAny, {
81
+ type: "oauth-clientCredentials";
82
+ token: string;
83
+ clientSecret: string;
84
+ }, {
85
+ type?: "oauth-clientCredentials" | undefined;
86
+ token?: string | undefined;
87
+ clientSecret?: string | undefined;
88
+ }>, z.ZodObject<{
89
+ type: z.ZodDefault<z.ZodLiteral<"oauth-authorizationCode">>;
90
+ token: z.ZodDefault<z.ZodString>;
91
+ clientSecret: z.ZodDefault<z.ZodString>;
92
+ }, "strip", z.ZodTypeAny, {
93
+ type: "oauth-authorizationCode";
94
+ token: string;
95
+ clientSecret: string;
96
+ }, {
97
+ type?: "oauth-authorizationCode" | undefined;
98
+ token?: string | undefined;
99
+ clientSecret?: string | undefined;
100
+ }>]>>>;
101
+ }, "strip", z.ZodTypeAny, {
102
+ uid: string;
103
+ children: string[];
104
+ securitySchemes: string[];
105
+ selectedServerUid: string;
106
+ servers: string[];
107
+ requests: string[];
108
+ tags: string[];
109
+ auth: Record<string, {
110
+ type: "apiKey";
111
+ value: string;
112
+ name: string;
113
+ } | {
114
+ type: "http";
115
+ username: string;
116
+ password: string;
117
+ token: string;
118
+ } | {
119
+ type: "oauth-implicit";
120
+ token: string;
121
+ } | {
122
+ type: "oauth-password";
123
+ username: string;
124
+ password: string;
125
+ token: string;
126
+ clientSecret: string;
127
+ } | {
128
+ type: "oauth-clientCredentials";
129
+ token: string;
130
+ clientSecret: string;
131
+ } | {
132
+ type: "oauth-authorizationCode";
133
+ token: string;
134
+ clientSecret: string;
135
+ }>;
136
+ }, {
137
+ uid?: string | undefined;
138
+ children?: (string | undefined)[] | undefined;
139
+ securitySchemes?: string[] | undefined;
140
+ selectedServerUid?: string | undefined;
141
+ servers?: (string | undefined)[] | undefined;
142
+ requests?: (string | undefined)[] | undefined;
143
+ tags?: (string | undefined)[] | undefined;
144
+ auth?: Record<string | undefined, {
145
+ type?: "apiKey" | undefined;
146
+ value?: string | undefined;
147
+ name?: string | undefined;
148
+ } | {
149
+ type?: "http" | undefined;
150
+ username?: string | undefined;
151
+ password?: string | undefined;
152
+ token?: string | undefined;
153
+ } | {
154
+ type?: "oauth-implicit" | undefined;
155
+ token?: string | undefined;
156
+ } | {
157
+ type?: "oauth-password" | undefined;
158
+ username?: string | undefined;
159
+ password?: string | undefined;
160
+ token?: string | undefined;
161
+ clientSecret?: string | undefined;
162
+ } | {
163
+ type?: "oauth-clientCredentials" | undefined;
164
+ token?: string | undefined;
165
+ clientSecret?: string | undefined;
166
+ } | {
167
+ type?: "oauth-authorizationCode" | undefined;
168
+ token?: string | undefined;
169
+ clientSecret?: string | undefined;
170
+ }> | undefined;
171
+ }>;
172
+ export declare const collectionSchema: z.ZodObject<z.objectUtil.extendShape<{
173
+ type: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"collection">>>;
174
+ openapi: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<"3.0.0">, z.ZodLiteral<"3.1.0">, z.ZodLiteral<"4.0.0">]>>>;
175
+ jsonSchemaDialect: z.ZodOptional<z.ZodString>;
176
+ info: z.ZodOptional<z.ZodObject<{
177
+ title: z.ZodDefault<z.ZodOptional<z.ZodString>>;
178
+ summary: z.ZodOptional<z.ZodString>;
179
+ description: z.ZodOptional<z.ZodString>;
180
+ termsOfService: z.ZodOptional<z.ZodString>;
181
+ contact: z.ZodOptional<z.ZodObject<{
182
+ name: z.ZodOptional<z.ZodString>;
183
+ url: z.ZodOptional<z.ZodString>;
184
+ email: z.ZodOptional<z.ZodString>;
185
+ }, "strip", z.ZodTypeAny, {
186
+ name?: string | undefined;
187
+ url?: string | undefined;
188
+ email?: string | undefined;
189
+ }, {
190
+ name?: string | undefined;
191
+ url?: string | undefined;
192
+ email?: string | undefined;
193
+ }>>;
194
+ license: z.ZodOptional<z.ZodObject<{
195
+ name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
196
+ identifier: z.ZodOptional<z.ZodString>;
197
+ url: z.ZodOptional<z.ZodString>;
198
+ }, "strip", z.ZodTypeAny, {
199
+ name: string;
200
+ identifier?: string | undefined;
201
+ url?: string | undefined;
202
+ }, {
203
+ name?: string | undefined;
204
+ identifier?: string | undefined;
205
+ url?: string | undefined;
206
+ }>>;
207
+ version: z.ZodDefault<z.ZodString>;
208
+ }, "strip", z.ZodTypeAny, {
209
+ title: string;
210
+ version: string;
211
+ description?: string | undefined;
212
+ summary?: string | undefined;
213
+ termsOfService?: string | undefined;
214
+ contact?: {
215
+ name?: string | undefined;
216
+ url?: string | undefined;
217
+ email?: string | undefined;
218
+ } | undefined;
219
+ license?: {
220
+ name: string;
221
+ identifier?: string | undefined;
222
+ url?: string | undefined;
223
+ } | undefined;
224
+ }, {
225
+ description?: string | undefined;
226
+ title?: string | undefined;
227
+ summary?: string | undefined;
228
+ termsOfService?: string | undefined;
229
+ contact?: {
230
+ name?: string | undefined;
231
+ url?: string | undefined;
232
+ email?: string | undefined;
233
+ } | undefined;
234
+ license?: {
235
+ name?: string | undefined;
236
+ identifier?: string | undefined;
237
+ url?: string | undefined;
238
+ } | undefined;
239
+ version?: string | undefined;
240
+ }>>;
241
+ /**
242
+ * A declaration of which security mechanisms can be used across the API. The list of
243
+ * values includes alternative security requirement objects that can be used. Only
244
+ * one of the security requirement objects need to be satisfied to authorize a request.
245
+ * Individual operations can override this definition. To make security optional, an empty
246
+ * security requirement ({}) can be included in the array.
247
+ */
248
+ security: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>>, "many">>>;
249
+ externalDocs: z.ZodOptional<z.ZodObject<{
250
+ description: z.ZodOptional<z.ZodString>;
251
+ url: z.ZodDefault<z.ZodString>;
252
+ }, "strip", z.ZodTypeAny, {
253
+ url: string;
254
+ description?: string | undefined;
255
+ }, {
256
+ description?: string | undefined;
257
+ url?: string | undefined;
258
+ }>>;
259
+ /** TODO: Type these */
260
+ components: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
261
+ /** TODO: Type these */
262
+ webhooks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
263
+ }, {
264
+ uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
265
+ /** A list of security schemes UIDs associated with the collection */
266
+ securitySchemes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
267
+ /** The currently selected server */
268
+ selectedServerUid: z.ZodDefault<z.ZodString>;
269
+ /** UIDs which refer to servers on the workspace base */
270
+ servers: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
271
+ /** Request UIDs associated with a collection */
272
+ requests: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
273
+ /** Tag UIDs associated with the collection */
274
+ tags: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
275
+ /** List of requests without tags and top level tag "folders" */
276
+ children: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
277
+ /**
278
+ * Map of security schemas to their value sets
279
+ *
280
+ * For each selected security schema we should have an entry here
281
+ * The entry will contain the secret values (but not the schema definition)
282
+ */
283
+ auth: z.ZodDefault<z.ZodRecord<z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodUnion<[z.ZodObject<{
284
+ type: z.ZodDefault<z.ZodLiteral<"apiKey">>;
285
+ name: z.ZodDefault<z.ZodString>;
286
+ value: z.ZodDefault<z.ZodString>;
287
+ }, "strip", z.ZodTypeAny, {
288
+ type: "apiKey";
289
+ value: string;
290
+ name: string;
291
+ }, {
292
+ type?: "apiKey" | undefined;
293
+ value?: string | undefined;
294
+ name?: string | undefined;
295
+ }>, z.ZodObject<{
296
+ type: z.ZodDefault<z.ZodLiteral<"http">>;
297
+ username: z.ZodDefault<z.ZodString>;
298
+ password: z.ZodDefault<z.ZodString>;
299
+ token: z.ZodDefault<z.ZodString>;
300
+ }, "strip", z.ZodTypeAny, {
301
+ type: "http";
302
+ username: string;
303
+ password: string;
304
+ token: string;
305
+ }, {
306
+ type?: "http" | undefined;
307
+ username?: string | undefined;
308
+ password?: string | undefined;
309
+ token?: string | undefined;
310
+ }>, z.ZodObject<{
311
+ type: z.ZodDefault<z.ZodLiteral<"oauth-implicit">>;
312
+ token: z.ZodDefault<z.ZodString>;
313
+ }, "strip", z.ZodTypeAny, {
314
+ type: "oauth-implicit";
315
+ token: string;
316
+ }, {
317
+ type?: "oauth-implicit" | undefined;
318
+ token?: string | undefined;
319
+ }>, z.ZodObject<{
320
+ type: z.ZodDefault<z.ZodLiteral<"oauth-password">>;
321
+ token: z.ZodDefault<z.ZodString>;
322
+ username: z.ZodDefault<z.ZodString>;
323
+ password: z.ZodDefault<z.ZodString>;
324
+ clientSecret: z.ZodDefault<z.ZodString>;
325
+ }, "strip", z.ZodTypeAny, {
326
+ type: "oauth-password";
327
+ username: string;
328
+ password: string;
329
+ token: string;
330
+ clientSecret: string;
331
+ }, {
332
+ type?: "oauth-password" | undefined;
333
+ username?: string | undefined;
334
+ password?: string | undefined;
335
+ token?: string | undefined;
336
+ clientSecret?: string | undefined;
337
+ }>, z.ZodObject<{
338
+ type: z.ZodDefault<z.ZodLiteral<"oauth-clientCredentials">>;
339
+ token: z.ZodDefault<z.ZodString>;
340
+ clientSecret: z.ZodDefault<z.ZodString>;
341
+ }, "strip", z.ZodTypeAny, {
342
+ type: "oauth-clientCredentials";
343
+ token: string;
344
+ clientSecret: string;
345
+ }, {
346
+ type?: "oauth-clientCredentials" | undefined;
347
+ token?: string | undefined;
348
+ clientSecret?: string | undefined;
349
+ }>, z.ZodObject<{
350
+ type: z.ZodDefault<z.ZodLiteral<"oauth-authorizationCode">>;
351
+ token: z.ZodDefault<z.ZodString>;
352
+ clientSecret: z.ZodDefault<z.ZodString>;
353
+ }, "strip", z.ZodTypeAny, {
354
+ type: "oauth-authorizationCode";
355
+ token: string;
356
+ clientSecret: string;
357
+ }, {
358
+ type?: "oauth-authorizationCode" | undefined;
359
+ token?: string | undefined;
360
+ clientSecret?: string | undefined;
361
+ }>]>>>;
362
+ }>, "strip", z.ZodTypeAny, {
363
+ type: "collection";
364
+ uid: string;
365
+ children: string[];
366
+ openapi: string;
367
+ security: Record<string, string[]>[];
368
+ securitySchemes: string[];
369
+ selectedServerUid: string;
370
+ servers: string[];
371
+ requests: string[];
372
+ tags: string[];
373
+ auth: Record<string, {
374
+ type: "apiKey";
375
+ value: string;
376
+ name: string;
377
+ } | {
378
+ type: "http";
379
+ username: string;
380
+ password: string;
381
+ token: string;
382
+ } | {
383
+ type: "oauth-implicit";
384
+ token: string;
385
+ } | {
386
+ type: "oauth-password";
387
+ username: string;
388
+ password: string;
389
+ token: string;
390
+ clientSecret: string;
391
+ } | {
392
+ type: "oauth-clientCredentials";
393
+ token: string;
394
+ clientSecret: string;
395
+ } | {
396
+ type: "oauth-authorizationCode";
397
+ token: string;
398
+ clientSecret: string;
399
+ }>;
400
+ externalDocs?: {
401
+ url: string;
402
+ description?: string | undefined;
403
+ } | undefined;
404
+ jsonSchemaDialect?: string | undefined;
405
+ info?: {
406
+ title: string;
407
+ version: string;
408
+ description?: string | undefined;
409
+ summary?: string | undefined;
410
+ termsOfService?: string | undefined;
411
+ contact?: {
412
+ name?: string | undefined;
413
+ url?: string | undefined;
414
+ email?: string | undefined;
415
+ } | undefined;
416
+ license?: {
417
+ name: string;
418
+ identifier?: string | undefined;
419
+ url?: string | undefined;
420
+ } | undefined;
421
+ } | undefined;
422
+ components?: Record<string, unknown> | undefined;
423
+ webhooks?: Record<string, unknown> | undefined;
424
+ }, {
425
+ type?: "collection" | undefined;
426
+ uid?: string | undefined;
427
+ externalDocs?: {
428
+ description?: string | undefined;
429
+ url?: string | undefined;
430
+ } | undefined;
431
+ children?: (string | undefined)[] | undefined;
432
+ openapi?: string | undefined;
433
+ jsonSchemaDialect?: string | undefined;
434
+ info?: {
435
+ description?: string | undefined;
436
+ title?: string | undefined;
437
+ summary?: string | undefined;
438
+ termsOfService?: string | undefined;
439
+ contact?: {
440
+ name?: string | undefined;
441
+ url?: string | undefined;
442
+ email?: string | undefined;
443
+ } | undefined;
444
+ license?: {
445
+ name?: string | undefined;
446
+ identifier?: string | undefined;
447
+ url?: string | undefined;
448
+ } | undefined;
449
+ version?: string | undefined;
450
+ } | undefined;
451
+ security?: Record<string, string[] | undefined>[] | undefined;
452
+ components?: Record<string, unknown> | undefined;
453
+ webhooks?: Record<string, unknown> | undefined;
454
+ securitySchemes?: string[] | undefined;
455
+ selectedServerUid?: string | undefined;
456
+ servers?: (string | undefined)[] | undefined;
457
+ requests?: (string | undefined)[] | undefined;
458
+ tags?: (string | undefined)[] | undefined;
459
+ auth?: Record<string | undefined, {
460
+ type?: "apiKey" | undefined;
461
+ value?: string | undefined;
462
+ name?: string | undefined;
463
+ } | {
464
+ type?: "http" | undefined;
465
+ username?: string | undefined;
466
+ password?: string | undefined;
467
+ token?: string | undefined;
468
+ } | {
469
+ type?: "oauth-implicit" | undefined;
470
+ token?: string | undefined;
471
+ } | {
472
+ type?: "oauth-password" | undefined;
473
+ username?: string | undefined;
474
+ password?: string | undefined;
475
+ token?: string | undefined;
476
+ clientSecret?: string | undefined;
477
+ } | {
478
+ type?: "oauth-clientCredentials" | undefined;
479
+ token?: string | undefined;
480
+ clientSecret?: string | undefined;
481
+ } | {
482
+ type?: "oauth-authorizationCode" | undefined;
483
+ token?: string | undefined;
484
+ clientSecret?: string | undefined;
485
+ }> | undefined;
486
+ }>;
487
+ export type Collection = z.infer<typeof collectionSchema>;
488
+ export type CollectionPayload = z.input<typeof collectionSchema>;
489
+ //# sourceMappingURL=collection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/collection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAuCvB,eAAO,MAAM,wBAAwB;;IAEnC,qEAAqE;;IAErE,oCAAoC;;IAEpC,wDAAwD;;IAExD,gDAAgD;;IAEhD,8CAA8C;;IAE9C,gEAAgE;;IAEhE;;;;;OAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEH,CAAA;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA5C3B;;;;;;OAMG;;;;;;;;;;;;IAGH,uBAAuB;;IAEvB,uBAAuB;;;;IAYvB,qEAAqE;;IAErE,oCAAoC;;IAEpC,wDAAwD;;IAExD,gDAAgD;;IAEhD,8CAA8C;;IAE9C,gEAAgE;;IAEhE;;;;;OAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMJ,CAAA;AACD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AACzD,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA"}
@@ -0,0 +1,63 @@
1
+ import { oasSecurityRequirementSchema, securitySchemeExampleValueSchema } from './security.js';
2
+ import { z } from 'zod';
3
+ import { oasInfoSchema, oasExternalDocumentationSchema } from './spec-objects.js';
4
+ import { nanoidSchema } from '../shared/utility.js';
5
+
6
+ const oasCollectionSchema = z.object({
7
+ type: z.literal('collection').optional().default('collection'),
8
+ openapi: z
9
+ .union([
10
+ z.string(),
11
+ z.literal('3.0.0'),
12
+ z.literal('3.1.0'),
13
+ z.literal('4.0.0'),
14
+ ])
15
+ .optional()
16
+ .default('3.1.0'),
17
+ jsonSchemaDialect: z.string().optional(),
18
+ info: oasInfoSchema.optional(),
19
+ /**
20
+ * A declaration of which security mechanisms can be used across the API. The list of
21
+ * values includes alternative security requirement objects that can be used. Only
22
+ * one of the security requirement objects need to be satisfied to authorize a request.
23
+ * Individual operations can override this definition. To make security optional, an empty
24
+ * security requirement ({}) can be included in the array.
25
+ */
26
+ security: z.array(oasSecurityRequirementSchema).optional().default([]),
27
+ externalDocs: oasExternalDocumentationSchema.optional(),
28
+ /** TODO: Type these */
29
+ components: z.record(z.string(), z.unknown()).optional(),
30
+ /** TODO: Type these */
31
+ webhooks: z.record(z.string(), z.unknown()).optional(),
32
+ // These properties will be stripped out and mapped back as id lists
33
+ // servers
34
+ // paths/**
35
+ // servers
36
+ // tags
37
+ // security
38
+ });
39
+ const extendedCollectionSchema = z.object({
40
+ uid: nanoidSchema,
41
+ /** A list of security schemes UIDs associated with the collection */
42
+ securitySchemes: z.string().array().default([]),
43
+ /** The currently selected server */
44
+ selectedServerUid: z.string().default(''),
45
+ /** UIDs which refer to servers on the workspace base */
46
+ servers: nanoidSchema.array().default([]),
47
+ /** Request UIDs associated with a collection */
48
+ requests: nanoidSchema.array().default([]),
49
+ /** Tag UIDs associated with the collection */
50
+ tags: nanoidSchema.array().default([]),
51
+ /** List of requests without tags and top level tag "folders" */
52
+ children: nanoidSchema.array().default([]),
53
+ /**
54
+ * Map of security schemas to their value sets
55
+ *
56
+ * For each selected security schema we should have an entry here
57
+ * The entry will contain the secret values (but not the schema definition)
58
+ */
59
+ auth: z.record(nanoidSchema, securitySchemeExampleValueSchema).default({}),
60
+ });
61
+ const collectionSchema = oasCollectionSchema.merge(extendedCollectionSchema);
62
+
63
+ export { collectionSchema, extendedCollectionSchema };
@@ -0,0 +1,10 @@
1
+ export * from './collection.js';
2
+ export * from './server.js';
3
+ export * from './requests.js';
4
+ export * from './request-examples.js';
5
+ export * from './spec-objects.js';
6
+ export * from './parameters.js';
7
+ export * from './security.js';
8
+ type FetchRequest = Request;
9
+ export type { FetchRequest };
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAE1B,KAAK,YAAY,GAAG,OAAO,CAAA;AAC3B,YAAY,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,7 @@
1
+ export { collectionSchema, extendedCollectionSchema } from './collection.js';
2
+ export { oasServerSchema, oasServerVariableSchema, serverSchema } from './server.js';
3
+ export { oasRequestSchema, requestMethods, requestSchema } from './requests.js';
4
+ export { createExampleFromRequest, createParamInstance, exampleRequestBodyEncoding, exampleRequestBodySchema, requestExampleParametersSchema, requestExampleSchema } from './request-examples.js';
5
+ export { oasContactSchema, oasExternalDocumentationSchema, oasInfoSchema, oasLicenseSchema, oasTagSchema, tagSchema, xScalarNestedSchema } from './spec-objects.js';
6
+ export { oasParameterSchema, parameterStyleSchema, parameterTypeSchema } from './parameters.js';
7
+ export { authExampleFromSchema, oasSecurityRequirementSchema, oasSecuritySchemeSchema, securityApiKeySchema, securityHttpSchema, securityOauthSchema, securityOpenIdSchema, securitySchemeApiKeyIn, securitySchemeExampleValueSchema, securitySchemeSchema } from './security.js';
@@ -0,0 +1,42 @@
1
+ import { z } from 'zod';
2
+ export declare const parameterTypeSchema: z.ZodEnum<["path", "query", "header", "cookie"]>;
3
+ export type ParamType = z.infer<typeof parameterTypeSchema>;
4
+ export declare const parameterStyleSchema: z.ZodEnum<["matrix", "simple", "form", "label", "spaceDelimited", "pipeDelimited", "deepObject"]>;
5
+ export type ParameterStyle = z.infer<typeof parameterStyleSchema>;
6
+ /**
7
+ * OpenAPI compliant parameters object
8
+ */
9
+ export declare const oasParameterSchema: z.ZodObject<{
10
+ in: z.ZodEnum<["path", "query", "header", "cookie"]>;
11
+ name: z.ZodString;
12
+ description: z.ZodOptional<z.ZodString>;
13
+ /** Defaulted to false */
14
+ required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
15
+ /** Defaulted to false */
16
+ deprecated: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
17
+ schema: z.ZodOptional<z.ZodUnknown>;
18
+ content: z.ZodOptional<z.ZodUnknown>;
19
+ /** Defaulted according to @url https://spec.openapis.org/oas/v3.1.0#parameter-object */
20
+ style: z.ZodOptional<z.ZodEnum<["matrix", "simple", "form", "label", "spaceDelimited", "pipeDelimited", "deepObject"]>>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ required: boolean;
23
+ name: string;
24
+ in: "path" | "query" | "header" | "cookie";
25
+ deprecated: boolean;
26
+ description?: string | undefined;
27
+ schema?: unknown;
28
+ content?: unknown;
29
+ style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
30
+ }, {
31
+ name: string;
32
+ in: "path" | "query" | "header" | "cookie";
33
+ required?: boolean | undefined;
34
+ description?: string | undefined;
35
+ deprecated?: boolean | undefined;
36
+ schema?: unknown;
37
+ content?: unknown;
38
+ style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
39
+ }>;
40
+ export type RequestParameter = z.infer<typeof oasParameterSchema>;
41
+ export type RequestParameterPayload = z.input<typeof oasParameterSchema>;
42
+ //# sourceMappingURL=parameters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/parameters.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvC,eAAO,MAAM,mBAAmB,kDAAgD,CAAA;AAChF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE3D,eAAO,MAAM,oBAAoB,mGAQ/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;IAI7B,yBAAyB;;IAEzB,yBAAyB;;;;IAIzB,wFAAwF;;;;;;;;;;;;;;;;;;;;EAEjD,CAAA;AAEzC,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AACjE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { z } from 'zod';
2
+
3
+ const parameterTypeSchema = z.enum(['path', 'query', 'header', 'cookie']);
4
+ const parameterStyleSchema = z.enum([
5
+ 'matrix',
6
+ 'simple',
7
+ 'form',
8
+ 'label',
9
+ 'spaceDelimited',
10
+ 'pipeDelimited',
11
+ 'deepObject',
12
+ ]);
13
+ /**
14
+ * OpenAPI compliant parameters object
15
+ */
16
+ const oasParameterSchema = z.object({
17
+ in: parameterTypeSchema,
18
+ name: z.string(),
19
+ description: z.string().optional(),
20
+ /** Defaulted to false */
21
+ required: z.boolean().optional().default(false),
22
+ /** Defaulted to false */
23
+ deprecated: z.boolean().optional().default(false),
24
+ schema: z.unknown().optional(),
25
+ content: z.unknown().optional(),
26
+ /** Defaulted according to @url https://spec.openapis.org/oas/v3.1.0#parameter-object */
27
+ style: parameterStyleSchema.optional(),
28
+ });
29
+
30
+ export { oasParameterSchema, parameterStyleSchema, parameterTypeSchema };