@xyd-js/openapi 0.1.0-build.168

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 (64) hide show
  1. package/CHANGELOG.md +1517 -0
  2. package/LICENSE +21 -0
  3. package/README.md +3 -0
  4. package/__fixtures__/-2.complex.openai/input.yaml +39848 -0
  5. package/__fixtures__/-2.complex.openai/output.json +321646 -0
  6. package/__fixtures__/-2.complex.openai/pluginOasOpenai.ts +553 -0
  7. package/__fixtures__/-3.random/input.yaml +234 -0
  8. package/__fixtures__/-3.random/output.json +1140 -0
  9. package/__fixtures__/1.basic/input.yaml +226 -0
  10. package/__fixtures__/1.basic/output.json +1919 -0
  11. package/__fixtures__/2.more/input.yaml +76 -0
  12. package/__fixtures__/2.more/output.json +327 -0
  13. package/__fixtures__/3.multiple-responses/input.yaml +48 -0
  14. package/__fixtures__/3.multiple-responses/output.json +311 -0
  15. package/__fixtures__/5.xdocs.codeLanguages/input.yaml +231 -0
  16. package/__fixtures__/5.xdocs.codeLanguages/output.json +1879 -0
  17. package/__fixtures__/5.xdocs.sidebar/input.yaml +256 -0
  18. package/__fixtures__/5.xdocs.sidebar/output.json +843 -0
  19. package/__fixtures__/6.codeSamples/input.yaml +75 -0
  20. package/__fixtures__/6.codeSamples/output.json +293 -0
  21. package/__tests__/oapSchemaToReferences.test.ts +82 -0
  22. package/__tests__/utils.ts +81 -0
  23. package/dist/index.cjs +2154 -0
  24. package/dist/index.cjs.map +1 -0
  25. package/dist/index.d.cts +40 -0
  26. package/dist/index.d.ts +40 -0
  27. package/dist/index.js +2119 -0
  28. package/dist/index.js.map +1 -0
  29. package/examples/basic/index.ts +20 -0
  30. package/examples/basic/index2.ts +36 -0
  31. package/examples/basic/openapi.yaml +124 -0
  32. package/examples/dist/index.cjs +2 -0
  33. package/examples/dist/index.cjs.map +1 -0
  34. package/examples/dist/index.d.cts +2 -0
  35. package/examples/dist/index.d.ts +2 -0
  36. package/examples/dist/index.js +2 -0
  37. package/examples/dist/index.js.map +1 -0
  38. package/examples/semi/index.ts +16 -0
  39. package/examples/semi/openapi.yaml +365 -0
  40. package/examples/semi/references.json +500 -0
  41. package/examples/webhooks/index.ts +16 -0
  42. package/examples/webhooks/openapi.yaml +248 -0
  43. package/examples/webhooks/references.json +895 -0
  44. package/index.ts +12 -0
  45. package/package.json +31 -0
  46. package/src/const.ts +14 -0
  47. package/src/converters/oas-componentSchemas.ts +205 -0
  48. package/src/converters/oas-examples.ts +530 -0
  49. package/src/converters/oas-parameters.ts +41 -0
  50. package/src/converters/oas-paths.ts +354 -0
  51. package/src/converters/oas-requestBody.ts +57 -0
  52. package/src/converters/oas-responses.ts +76 -0
  53. package/src/converters/oas-schema.ts +141 -0
  54. package/src/index.ts +21 -0
  55. package/src/oas-core.ts +579 -0
  56. package/src/types.ts +18 -0
  57. package/src/utils.ts +157 -0
  58. package/src/xdocs/index.ts +18 -0
  59. package/src/xdocs/pluginSidebar.ts +580 -0
  60. package/src/xdocs/types.ts +26 -0
  61. package/tsconfig.json +18 -0
  62. package/tsup.config.ts +19 -0
  63. package/tsup.examples-config.ts +30 -0
  64. package/vitest.config.ts +7 -0
@@ -0,0 +1,500 @@
1
+ [
2
+ {
3
+ "title": "Get Sessions",
4
+ "canonical": "GetSessions",
5
+ "description": "---\ntitle: List sessions\ngroup: [ENDPOINTS]\n---\n\nList of all sessions\n",
6
+ "category": "rest",
7
+ "type": "rest_get",
8
+ "context": {
9
+ "method": "get",
10
+ "path": "https%3A%2F%2Fapi.livesession.io%2Fv1%2Fsessions"
11
+ },
12
+ "examples": {
13
+ "groups": [
14
+ {
15
+ "description": "Response",
16
+ "examples": [
17
+ {
18
+ "codeblock": {
19
+ "title": "200",
20
+ "tabs": [
21
+ {
22
+ "title": "json",
23
+ "language": "json",
24
+ "code": "{\n \"total\": 0,\n \"page\": {\n \"num\": 0,\n \"size\": 0\n },\n \"sessions\": [\n {\n \"id\": \"string\",\n \"website_id\": \"string\",\n \"session_url\": \"string\",\n \"creation_timestamp\": 0,\n \"duration\": 0,\n \"end_timestamp\": 0,\n \"active_time\": 0,\n \"end_url\": \"string\",\n \"expiration_timestamp\": 0,\n \"last_event_timestamp\": 0,\n \"product\": \"string\",\n \"device\": \"string\",\n \"tags\": [\n \"string\"\n ],\n \"last_seen_page_view_id\": \"string\",\n \"seen\": true,\n \"referrer\": \"string\",\n \"start_url\": \"string\",\n \"visitor_first_session\": true,\n \"engagment_score\": 0,\n \"visitor\": {\n \"id\": \"string\",\n \"ip\": \"string\",\n \"geolocation\": {\n \"country_code\": \"string\",\n \"city\": \"string\",\n \"region\": \"string\"\n },\n \"name\": \"string\",\n \"email\": \"string\",\n \"email_hash\": \"string\",\n \"params\": [\n {\n \"name\": \"string\",\n \"value\": \"string\"\n }\n ],\n \"last_session_timestamp\": 0,\n \"first_session_timestamp\": 0\n },\n \"resolution\": {\n \"height\": 0,\n \"width\": 0,\n \"resolution\": \"string\"\n },\n \"os\": {\n \"name\": \"string\",\n \"version\": \"string\"\n },\n \"browser\": {\n \"description\": \"string\",\n \"name\": \"string\",\n \"version\": \"string\"\n },\n \"utm\": {\n \"source\": \"string\",\n \"medium\": \"string\",\n \"campaign\": \"string\",\n \"term\": \"string\",\n \"content\": \"string\"\n },\n \"page_views_statistics\": {\n \"count\": 0\n },\n \"events_statistics\": {\n \"clicks\": 0,\n \"error_clicks\": 0,\n \"rage_clicks\": 0,\n \"error_logs\": 0,\n \"net_errors\": 0\n }\n }\n ]\n}"
25
+ }
26
+ ]
27
+ }
28
+ },
29
+ {
30
+ "codeblock": {
31
+ "title": "400",
32
+ "tabs": [
33
+ {
34
+ "title": "json",
35
+ "language": "json",
36
+ "code": "{\n \"error\": {\n \"type\": \"string\",\n \"code\": \"string\",\n \"param\": \"string\",\n \"message\": \"string\",\n \"http_status_code\": 0,\n \"request_id\": \"string\"\n }\n}"
37
+ }
38
+ ]
39
+ }
40
+ },
41
+ {
42
+ "codeblock": {
43
+ "title": "500",
44
+ "tabs": [
45
+ {
46
+ "title": "json",
47
+ "language": "json",
48
+ "code": "{\n \"error\": {\n \"type\": \"string\",\n \"code\": \"string\",\n \"param\": \"string\",\n \"message\": \"string\",\n \"http_status_code\": 0,\n \"request_id\": \"string\"\n }\n}"
49
+ }
50
+ ]
51
+ }
52
+ }
53
+ ]
54
+ }
55
+ ]
56
+ },
57
+ "definitions": [
58
+ {
59
+ "title": "Query",
60
+ "properties": [
61
+ {
62
+ "name": "page",
63
+ "type": "integer",
64
+ "description": "The number of page to start with (default 0, max 10000)."
65
+ },
66
+ {
67
+ "name": "size",
68
+ "type": "integer",
69
+ "description": "The number of page's size (default 25, max 100)."
70
+ },
71
+ {
72
+ "name": "email",
73
+ "type": "string",
74
+ "description": "The email address that you have associated with a session via [identify](https://developers.livesession.io/javascript-api/methods/#identify)."
75
+ },
76
+ {
77
+ "name": "visitor_id",
78
+ "type": "string",
79
+ "description": "The visitor ID."
80
+ },
81
+ {
82
+ "name": "tz",
83
+ "type": "string",
84
+ "description": "IANA timezone. Default Europe/London if RelativeDateString is applied."
85
+ },
86
+ {
87
+ "name": "date_from",
88
+ "type": "",
89
+ "description": "ISO 8601 string or RelativeDateString. For RelativeDateString see table below for possible values."
90
+ },
91
+ {
92
+ "name": "date_to",
93
+ "type": "",
94
+ "description": "ISO 8601 string or [RelativeDateString](#/components/schemas/RelativeDateString). For RelativeDateString see table below for possible values."
95
+ }
96
+ ]
97
+ },
98
+ {
99
+ "title": "Response",
100
+ "properties": [
101
+ {
102
+ "name": "total",
103
+ "type": "integer",
104
+ "description": "",
105
+ "properties": []
106
+ },
107
+ {
108
+ "name": "page",
109
+ "type": "object",
110
+ "description": "",
111
+ "properties": [
112
+ {
113
+ "name": "num",
114
+ "type": "integer",
115
+ "description": "",
116
+ "properties": []
117
+ },
118
+ {
119
+ "name": "size",
120
+ "type": "integer",
121
+ "description": "",
122
+ "properties": []
123
+ }
124
+ ]
125
+ },
126
+ {
127
+ "name": "sessions",
128
+ "type": "array",
129
+ "description": "",
130
+ "properties": [
131
+ {
132
+ "name": "id",
133
+ "type": "string",
134
+ "description": "",
135
+ "properties": []
136
+ },
137
+ {
138
+ "name": "website_id",
139
+ "type": "string",
140
+ "description": "",
141
+ "properties": []
142
+ },
143
+ {
144
+ "name": "session_url",
145
+ "type": "string",
146
+ "description": "",
147
+ "properties": []
148
+ },
149
+ {
150
+ "name": "creation_timestamp",
151
+ "type": "integer",
152
+ "description": "",
153
+ "properties": []
154
+ },
155
+ {
156
+ "name": "duration",
157
+ "type": "integer",
158
+ "description": "",
159
+ "properties": []
160
+ },
161
+ {
162
+ "name": "end_timestamp",
163
+ "type": "integer",
164
+ "description": "",
165
+ "properties": []
166
+ },
167
+ {
168
+ "name": "active_time",
169
+ "type": "integer",
170
+ "description": "",
171
+ "properties": []
172
+ },
173
+ {
174
+ "name": "end_url",
175
+ "type": "string",
176
+ "description": "",
177
+ "properties": []
178
+ },
179
+ {
180
+ "name": "expiration_timestamp",
181
+ "type": "integer",
182
+ "description": "",
183
+ "properties": []
184
+ },
185
+ {
186
+ "name": "last_event_timestamp",
187
+ "type": "integer",
188
+ "description": "",
189
+ "properties": []
190
+ },
191
+ {
192
+ "name": "product",
193
+ "type": "string",
194
+ "description": "",
195
+ "properties": []
196
+ },
197
+ {
198
+ "name": "device",
199
+ "type": "string",
200
+ "description": "",
201
+ "properties": []
202
+ },
203
+ {
204
+ "name": "tags",
205
+ "type": "array",
206
+ "description": "",
207
+ "properties": []
208
+ },
209
+ {
210
+ "name": "last_seen_page_view_id",
211
+ "type": "string",
212
+ "description": "",
213
+ "properties": []
214
+ },
215
+ {
216
+ "name": "seen",
217
+ "type": "boolean",
218
+ "description": "",
219
+ "properties": []
220
+ },
221
+ {
222
+ "name": "referrer",
223
+ "type": "string",
224
+ "description": "",
225
+ "properties": []
226
+ },
227
+ {
228
+ "name": "start_url",
229
+ "type": "string",
230
+ "description": "",
231
+ "properties": []
232
+ },
233
+ {
234
+ "name": "visitor_first_session",
235
+ "type": "boolean",
236
+ "description": "",
237
+ "properties": []
238
+ },
239
+ {
240
+ "name": "engagment_score",
241
+ "type": "number",
242
+ "description": "",
243
+ "properties": []
244
+ },
245
+ {
246
+ "name": "visitor",
247
+ "type": "object",
248
+ "description": "",
249
+ "properties": [
250
+ {
251
+ "name": "id",
252
+ "type": "string",
253
+ "description": "",
254
+ "properties": []
255
+ },
256
+ {
257
+ "name": "ip",
258
+ "type": "string",
259
+ "description": "",
260
+ "properties": []
261
+ },
262
+ {
263
+ "name": "geolocation",
264
+ "type": "object",
265
+ "description": "",
266
+ "properties": [
267
+ {
268
+ "name": "country_code",
269
+ "type": "string",
270
+ "description": "",
271
+ "properties": []
272
+ },
273
+ {
274
+ "name": "city",
275
+ "type": "string",
276
+ "description": "",
277
+ "properties": []
278
+ },
279
+ {
280
+ "name": "region",
281
+ "type": "string",
282
+ "description": "",
283
+ "properties": []
284
+ }
285
+ ]
286
+ },
287
+ {
288
+ "name": "name",
289
+ "type": "string",
290
+ "description": "",
291
+ "properties": []
292
+ },
293
+ {
294
+ "name": "email",
295
+ "type": "string",
296
+ "description": "",
297
+ "properties": []
298
+ },
299
+ {
300
+ "name": "email_hash",
301
+ "type": "string",
302
+ "description": "",
303
+ "properties": []
304
+ },
305
+ {
306
+ "name": "params",
307
+ "type": "array",
308
+ "description": "",
309
+ "properties": [
310
+ {
311
+ "name": "name",
312
+ "type": "string",
313
+ "description": "",
314
+ "properties": []
315
+ },
316
+ {
317
+ "name": "value",
318
+ "type": "string",
319
+ "description": "",
320
+ "properties": []
321
+ }
322
+ ]
323
+ },
324
+ {
325
+ "name": "last_session_timestamp",
326
+ "type": "integer",
327
+ "description": "",
328
+ "properties": []
329
+ },
330
+ {
331
+ "name": "first_session_timestamp",
332
+ "type": "integer",
333
+ "description": "",
334
+ "properties": []
335
+ }
336
+ ]
337
+ },
338
+ {
339
+ "name": "resolution",
340
+ "type": "object",
341
+ "description": "",
342
+ "properties": [
343
+ {
344
+ "name": "height",
345
+ "type": "integer",
346
+ "description": "",
347
+ "properties": []
348
+ },
349
+ {
350
+ "name": "width",
351
+ "type": "integer",
352
+ "description": "",
353
+ "properties": []
354
+ },
355
+ {
356
+ "name": "resolution",
357
+ "type": "string",
358
+ "description": "",
359
+ "properties": []
360
+ }
361
+ ]
362
+ },
363
+ {
364
+ "name": "os",
365
+ "type": "object",
366
+ "description": "",
367
+ "properties": [
368
+ {
369
+ "name": "name",
370
+ "type": "string",
371
+ "description": "",
372
+ "properties": []
373
+ },
374
+ {
375
+ "name": "version",
376
+ "type": "string",
377
+ "description": "",
378
+ "properties": []
379
+ }
380
+ ]
381
+ },
382
+ {
383
+ "name": "browser",
384
+ "type": "object",
385
+ "description": "",
386
+ "properties": [
387
+ {
388
+ "name": "description",
389
+ "type": "string",
390
+ "description": "",
391
+ "properties": []
392
+ },
393
+ {
394
+ "name": "name",
395
+ "type": "string",
396
+ "description": "",
397
+ "properties": []
398
+ },
399
+ {
400
+ "name": "version",
401
+ "type": "string",
402
+ "description": "",
403
+ "properties": []
404
+ }
405
+ ]
406
+ },
407
+ {
408
+ "name": "utm",
409
+ "type": "object",
410
+ "description": "",
411
+ "properties": [
412
+ {
413
+ "name": "source",
414
+ "type": "string",
415
+ "description": "",
416
+ "properties": []
417
+ },
418
+ {
419
+ "name": "medium",
420
+ "type": "string",
421
+ "description": "",
422
+ "properties": []
423
+ },
424
+ {
425
+ "name": "campaign",
426
+ "type": "string",
427
+ "description": "",
428
+ "properties": []
429
+ },
430
+ {
431
+ "name": "term",
432
+ "type": "string",
433
+ "description": "",
434
+ "properties": []
435
+ },
436
+ {
437
+ "name": "content",
438
+ "type": "string",
439
+ "description": "",
440
+ "properties": []
441
+ }
442
+ ]
443
+ },
444
+ {
445
+ "name": "page_views_statistics",
446
+ "type": "object",
447
+ "description": "",
448
+ "properties": [
449
+ {
450
+ "name": "count",
451
+ "type": "integer",
452
+ "description": "",
453
+ "properties": []
454
+ }
455
+ ]
456
+ },
457
+ {
458
+ "name": "events_statistics",
459
+ "type": "object",
460
+ "description": "",
461
+ "properties": [
462
+ {
463
+ "name": "clicks",
464
+ "type": "integer",
465
+ "description": "",
466
+ "properties": []
467
+ },
468
+ {
469
+ "name": "error_clicks",
470
+ "type": "integer",
471
+ "description": "",
472
+ "properties": []
473
+ },
474
+ {
475
+ "name": "rage_clicks",
476
+ "type": "integer",
477
+ "description": "",
478
+ "properties": []
479
+ },
480
+ {
481
+ "name": "error_logs",
482
+ "type": "integer",
483
+ "description": "",
484
+ "properties": []
485
+ },
486
+ {
487
+ "name": "net_errors",
488
+ "type": "integer",
489
+ "description": "",
490
+ "properties": []
491
+ }
492
+ ]
493
+ }
494
+ ]
495
+ }
496
+ ]
497
+ }
498
+ ]
499
+ }
500
+ ]
@@ -0,0 +1,16 @@
1
+ import path from 'path';
2
+
3
+ import {
4
+ deferencedOpenAPI,
5
+ oapSchemaToReferences,
6
+ } from "../../src";
7
+ import fs from "fs";
8
+
9
+ (async () => {
10
+ const openApiPath = path.join(process.cwd(), './examples/webhooks/openapi.yaml');
11
+ const schema = await deferencedOpenAPI(openApiPath)
12
+ const references = oapSchemaToReferences(schema)
13
+
14
+ fs.writeFileSync(path.join(process.cwd(), './examples/webhooks/references.json'), JSON.stringify(references, null, 2))
15
+ })()
16
+