@openaddresses/batch-schema 9.3.0 → 10.0.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 (45) hide show
  1. package/.eslintrc.json +5 -47
  2. package/.github/workflows/release.yml +5 -2
  3. package/CHANGELOG.md +8 -0
  4. package/LICENSE +1 -1
  5. package/README.md +21 -17
  6. package/{routes/schema.js → lib/api.ts} +11 -4
  7. package/lib/openapi.ts +122 -0
  8. package/lib/schema.ts +293 -0
  9. package/lib/types.ts +32 -0
  10. package/package.json +16 -11
  11. package/test/{schema.srv.test.js → schema.srv.test.ts} +9 -20
  12. package/tsconfig.json +27 -0
  13. package/docs/assets/anchor.js +0 -350
  14. package/docs/assets/bass-addons.css +0 -12
  15. package/docs/assets/bass.css +0 -544
  16. package/docs/assets/fonts/EOT/SourceCodePro-Bold.eot +0 -0
  17. package/docs/assets/fonts/EOT/SourceCodePro-Regular.eot +0 -0
  18. package/docs/assets/fonts/LICENSE.txt +0 -93
  19. package/docs/assets/fonts/OTF/SourceCodePro-Bold.otf +0 -0
  20. package/docs/assets/fonts/OTF/SourceCodePro-Regular.otf +0 -0
  21. package/docs/assets/fonts/TTF/SourceCodePro-Bold.ttf +0 -0
  22. package/docs/assets/fonts/TTF/SourceCodePro-Regular.ttf +0 -0
  23. package/docs/assets/fonts/WOFF/OTF/SourceCodePro-Bold.otf.woff +0 -0
  24. package/docs/assets/fonts/WOFF/OTF/SourceCodePro-Regular.otf.woff +0 -0
  25. package/docs/assets/fonts/WOFF/TTF/SourceCodePro-Bold.ttf.woff +0 -0
  26. package/docs/assets/fonts/WOFF/TTF/SourceCodePro-Regular.ttf.woff +0 -0
  27. package/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Bold.otf.woff2 +0 -0
  28. package/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Regular.otf.woff2 +0 -0
  29. package/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Bold.ttf.woff2 +0 -0
  30. package/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Regular.ttf.woff2 +0 -0
  31. package/docs/assets/fonts/source-code-pro.css +0 -23
  32. package/docs/assets/github.css +0 -123
  33. package/docs/assets/site.js +0 -168
  34. package/docs/assets/split.css +0 -15
  35. package/docs/assets/split.js +0 -782
  36. package/docs/assets/style.css +0 -147
  37. package/docs/index.html +0 -792
  38. package/lib/middleware.js +0 -159
  39. package/lib/openapi.js +0 -96
  40. package/lib/param.js +0 -29
  41. package/lib/schema.js +0 -254
  42. package/schema/req.query.ListSchema.json +0 -25
  43. package/schema/res.ListSchema.json +0 -47
  44. package/test/schema.test.js +0 -33
  45. /package/{index.js → index.ts} +0 -0
package/docs/index.html DELETED
@@ -1,792 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset='utf-8'>
5
- <title>@openaddresses/batch-schema 3.1.3 | Documentation</title>
6
- <meta name='description' content='Strongly Validated JSON Schema support for address'>
7
- <meta name='viewport' content='width=device-width,initial-scale=1'>
8
- <link href='assets/bass.css' rel='stylesheet'>
9
- <link href='assets/style.css' rel='stylesheet'>
10
- <link href='assets/github.css' rel='stylesheet'>
11
- <link href='assets/split.css' rel='stylesheet'>
12
- </head>
13
- <body class='documentation m0'>
14
- <div class='flex'>
15
- <div id='split-left' class='overflow-auto fs0 height-viewport-100'>
16
- <div class='py1 px2'>
17
- <h3 class='mb0 no-anchor'>@openaddresses/batch-schema</h3>
18
- <div class='mb1'><code>3.1.3</code></div>
19
- <input
20
- placeholder='Filter'
21
- id='filter-input'
22
- class='col12 block input'
23
- spellcheck='false'
24
- autocapitalize='off'
25
- autocorrect='off'
26
- type='text' />
27
- <div id='toc'>
28
- <ul class='list-reset h5 py1-ul'>
29
-
30
-
31
- <li><a
32
- href='#param'
33
- class="">
34
- Param
35
-
36
- </a>
37
-
38
- </li>
39
-
40
-
41
- <li><a
42
- href='#schemas'
43
- class=" toggle-sibling">
44
- Schemas
45
- <span class='icon'>▸</span>
46
- </a>
47
-
48
- <div class='toggle-target display-none'>
49
-
50
- <ul class='list-reset py1-ul pl1'>
51
- <li class='h5'><span>Static members</span></li>
52
-
53
- <li><a
54
- href='#schemasparam'
55
- class='regular pre-open'>
56
- .param
57
- </a></li>
58
-
59
- <li><a
60
- href='#schemasquery'
61
- class='regular pre-open'>
62
- .query
63
- </a></li>
64
-
65
- </ul>
66
-
67
-
68
- <ul class='list-reset py1-ul pl1'>
69
- <li class='h5'><span>Instance members</span></li>
70
-
71
- <li><a
72
- href='#schemasquery'
73
- class='regular pre-open'>
74
- #query
75
- </a></li>
76
-
77
- <li><a
78
- href='#schemasnot_found'
79
- class='regular pre-open'>
80
- #not_found
81
- </a></li>
82
-
83
- <li><a
84
- href='#schemaserror'
85
- class='regular pre-open'>
86
- #error
87
- </a></li>
88
-
89
- <li><a
90
- href='#schemaslist'
91
- class='regular pre-open'>
92
- #list
93
- </a></li>
94
-
95
- </ul>
96
-
97
-
98
-
99
- </div>
100
-
101
- </li>
102
-
103
-
104
- <li><a
105
- href='#get'
106
- class="">
107
- get
108
-
109
- </a>
110
-
111
- </li>
112
-
113
-
114
- <li><a
115
- href='#publicerror'
116
- class="">
117
- PublicError
118
-
119
- </a>
120
-
121
- </li>
122
-
123
- </ul>
124
- </div>
125
- <div class='mt1 h6 quiet'>
126
- <a href='https://documentation.js.org/reading-documentation.html'>Need help reading this?</a>
127
- </div>
128
- </div>
129
- </div>
130
- <div id='split-right' class='relative overflow-auto height-viewport-100'>
131
-
132
-
133
- <section class='p2 mb2 clearfix bg-white minishadow'>
134
-
135
-
136
- <div class='clearfix'>
137
-
138
- <h3 class='fl m0' id='param'>
139
- Param
140
- </h3>
141
-
142
-
143
- </div>
144
-
145
-
146
-
147
- <div class='pre p1 fill-light mt0'>new Param()</div>
148
-
149
-
150
-
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
-
173
-
174
-
175
-
176
-
177
- </section>
178
-
179
-
180
-
181
-
182
- <section class='p2 mb2 clearfix bg-white minishadow'>
183
-
184
-
185
- <div class='clearfix'>
186
-
187
- <h3 class='fl m0' id='schemas'>
188
- Schemas
189
- </h3>
190
-
191
-
192
- </div>
193
-
194
-
195
-
196
- <div class='pre p1 fill-light mt0'>new Schemas(router: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>, opts: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>)</div>
197
-
198
-
199
-
200
-
201
-
202
-
203
-
204
-
205
-
206
-
207
-
208
- <div class='py1 quiet mt1 prose-big'>Parameters</div>
209
- <div class='prose'>
210
-
211
- <div class='space-bottom0'>
212
- <div>
213
- <span class='code bold'>router</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>)</code>
214
- Express Router Object
215
-
216
- </div>
217
-
218
- </div>
219
-
220
- <div class='space-bottom0'>
221
- <div>
222
- <span class='code bold'>opts</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>
223
- = <code>{}</code>)</code>
224
- Options Object
225
-
226
- </div>
227
-
228
- </div>
229
-
230
- </div>
231
-
232
-
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
-
241
-
242
-
243
-
244
- <div class='py1 quiet mt1 prose-big'>Static Members</div>
245
- <div class="clearfix">
246
-
247
- <div class='border-bottom' id='schemasparam'>
248
- <div class="clearfix small pointer toggle-sibling">
249
- <div class="py1 contain">
250
- <a class='icon pin-right py1 dark-link caret-right'>▸</a>
251
- <span class='code strong strong truncate'>param(match, type)</span>
252
- </div>
253
- </div>
254
- <div class="clearfix display-none toggle-target">
255
- <section class='p2 mb2 clearfix bg-white minishadow'>
256
-
257
-
258
-
259
- <p>Express middleware to identify express params that should be integers/number/booleans
260
- according to the schema and attempt to cast them as such to ensure they pass the schema</p>
261
-
262
- <div class='pre p1 fill-light mt0'>param(match: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, type: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">Function</a></div>
263
-
264
-
265
-
266
-
267
-
268
-
269
-
270
-
271
-
272
-
273
-
274
- <div class='py1 quiet mt1 prose-big'>Parameters</div>
275
- <div class='prose'>
276
-
277
- <div class='space-bottom0'>
278
- <div>
279
- <span class='code bold'>match</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code>
280
- Express Param
281
-
282
- </div>
283
-
284
- </div>
285
-
286
- <div class='space-bottom0'>
287
- <div>
288
- <span class='code bold'>type</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code>
289
- Type to coerce it to
290
-
291
- </div>
292
-
293
- </div>
294
-
295
- </div>
296
-
297
-
298
-
299
-
300
-
301
-
302
- <div class='py1 quiet mt1 prose-big'>Returns</div>
303
- <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">Function</a></code>:
304
-
305
-
306
-
307
-
308
-
309
-
310
-
311
-
312
-
313
-
314
-
315
-
316
-
317
-
318
-
319
-
320
-
321
-
322
- </section>
323
-
324
- </div>
325
- </div>
326
-
327
- <div class='border-bottom' id='schemasquery'>
328
- <div class="clearfix small pointer toggle-sibling">
329
- <div class="py1 contain">
330
- <a class='icon pin-right py1 dark-link caret-right'>▸</a>
331
- <span class='code strong strong truncate'>query(schema)</span>
332
- </div>
333
- </div>
334
- <div class="clearfix display-none toggle-target">
335
- <section class='p2 mb2 clearfix bg-white minishadow'>
336
-
337
-
338
-
339
- <p>Express middleware to identify query params that should be integers/booleans according to the schema
340
- and attempt to cast them as such to ensure they pass the schema</p>
341
-
342
- <div class='pre p1 fill-light mt0'>query(schema: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">Function</a></div>
343
-
344
-
345
-
346
-
347
-
348
-
349
-
350
-
351
-
352
-
353
-
354
- <div class='py1 quiet mt1 prose-big'>Parameters</div>
355
- <div class='prose'>
356
-
357
- <div class='space-bottom0'>
358
- <div>
359
- <span class='code bold'>schema</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>)</code>
360
- JSON Schema
361
-
362
- </div>
363
-
364
- </div>
365
-
366
- </div>
367
-
368
-
369
-
370
-
371
-
372
-
373
- <div class='py1 quiet mt1 prose-big'>Returns</div>
374
- <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">Function</a></code>:
375
-
376
-
377
-
378
-
379
-
380
-
381
-
382
-
383
-
384
-
385
-
386
-
387
-
388
-
389
-
390
-
391
-
392
-
393
- </section>
394
-
395
- </div>
396
- </div>
397
-
398
- </div>
399
-
400
-
401
-
402
-
403
- <div class='py1 quiet mt1 prose-big'>Instance Members</div>
404
- <div class="clearfix">
405
-
406
- <div class='border-bottom' id='schemasquery'>
407
- <div class="clearfix small pointer toggle-sibling">
408
- <div class="py1 contain">
409
- <a class='icon pin-right py1 dark-link caret-right'>▸</a>
410
- <span class='code strong strong truncate'>query(method, url)</span>
411
- </div>
412
- </div>
413
- <div class="clearfix display-none toggle-target">
414
- <section class='p2 mb2 clearfix bg-white minishadow'>
415
-
416
-
417
-
418
- <p>Return all schemas (body, query, etc) for a given method + url</p>
419
-
420
- <div class='pre p1 fill-light mt0'>query(method: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>, url: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></div>
421
-
422
-
423
-
424
-
425
-
426
-
427
-
428
-
429
-
430
-
431
-
432
- <div class='py1 quiet mt1 prose-big'>Parameters</div>
433
- <div class='prose'>
434
-
435
- <div class='space-bottom0'>
436
- <div>
437
- <span class='code bold'>method</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code>
438
- HTTP Method
439
-
440
- </div>
441
-
442
- </div>
443
-
444
- <div class='space-bottom0'>
445
- <div>
446
- <span class='code bold'>url</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">String</a>)</code>
447
- URL
448
-
449
- </div>
450
-
451
- </div>
452
-
453
- </div>
454
-
455
-
456
-
457
-
458
-
459
-
460
- <div class='py1 quiet mt1 prose-big'>Returns</div>
461
- <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code>:
462
-
463
-
464
-
465
-
466
-
467
-
468
-
469
-
470
-
471
-
472
-
473
-
474
-
475
-
476
-
477
-
478
-
479
-
480
- </section>
481
-
482
- </div>
483
- </div>
484
-
485
- <div class='border-bottom' id='schemasnot_found'>
486
- <div class="clearfix small pointer toggle-sibling">
487
- <div class="py1 contain">
488
- <a class='icon pin-right py1 dark-link caret-right'>▸</a>
489
- <span class='code strong strong truncate'>not_found()</span>
490
- </div>
491
- </div>
492
- <div class="clearfix display-none toggle-target">
493
- <section class='p2 mb2 clearfix bg-white minishadow'>
494
-
495
-
496
-
497
- <p>Catch all for unmatched routes</p>
498
-
499
- <div class='pre p1 fill-light mt0'>not_found()</div>
500
-
501
-
502
-
503
-
504
-
505
-
506
-
507
-
508
-
509
-
510
-
511
-
512
-
513
-
514
-
515
-
516
-
517
-
518
-
519
-
520
-
521
-
522
-
523
-
524
-
525
-
526
-
527
-
528
-
529
- </section>
530
-
531
- </div>
532
- </div>
533
-
534
- <div class='border-bottom' id='schemaserror'>
535
- <div class="clearfix small pointer toggle-sibling">
536
- <div class="py1 contain">
537
- <a class='icon pin-right py1 dark-link caret-right'>▸</a>
538
- <span class='code strong strong truncate'>error()</span>
539
- </div>
540
- </div>
541
- <div class="clearfix display-none toggle-target">
542
- <section class='p2 mb2 clearfix bg-white minishadow'>
543
-
544
-
545
-
546
- <p>Convert validation errors into standardized JSON Error Messages</p>
547
-
548
- <div class='pre p1 fill-light mt0'>error()</div>
549
-
550
-
551
-
552
-
553
-
554
-
555
-
556
-
557
-
558
-
559
-
560
-
561
-
562
-
563
-
564
-
565
-
566
-
567
-
568
-
569
-
570
-
571
-
572
-
573
-
574
-
575
-
576
-
577
-
578
- </section>
579
-
580
- </div>
581
- </div>
582
-
583
- <div class='border-bottom' id='schemaslist'>
584
- <div class="clearfix small pointer toggle-sibling">
585
- <div class="py1 contain">
586
- <a class='icon pin-right py1 dark-link caret-right'>▸</a>
587
- <span class='code strong strong truncate'>list()</span>
588
- </div>
589
- </div>
590
- <div class="clearfix display-none toggle-target">
591
- <section class='p2 mb2 clearfix bg-white minishadow'>
592
-
593
-
594
-
595
- <p>Return a list of endpoints with schemas</p>
596
-
597
- <div class='pre p1 fill-light mt0'>list(): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></div>
598
-
599
-
600
-
601
-
602
-
603
-
604
-
605
-
606
-
607
-
608
-
609
-
610
-
611
-
612
-
613
-
614
- <div class='py1 quiet mt1 prose-big'>Returns</div>
615
- <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code>:
616
-
617
-
618
-
619
-
620
-
621
-
622
-
623
-
624
-
625
-
626
-
627
-
628
-
629
-
630
-
631
-
632
-
633
-
634
- </section>
635
-
636
- </div>
637
- </div>
638
-
639
- </div>
640
-
641
-
642
-
643
-
644
-
645
-
646
- </section>
647
-
648
-
649
-
650
-
651
- <section class='p2 mb2 clearfix bg-white minishadow'>
652
-
653
-
654
- <div class='clearfix'>
655
-
656
- <h3 class='fl m0' id='get'>
657
- get
658
- </h3>
659
-
660
-
661
- </div>
662
-
663
-
664
-
665
- <div class='pre p1 fill-light mt0'>get</div>
666
-
667
-
668
-
669
-
670
-
671
-
672
-
673
-
674
-
675
-
676
-
677
-
678
-
679
-
680
-
681
-
682
-
683
-
684
-
685
-
686
-
687
-
688
-
689
-
690
-
691
-
692
-
693
-
694
-
695
- </section>
696
-
697
-
698
-
699
-
700
- <section class='p2 mb2 clearfix bg-white minishadow'>
701
-
702
-
703
- <div class='clearfix'>
704
-
705
- <h3 class='fl m0' id='publicerror'>
706
- PublicError
707
- </h3>
708
-
709
-
710
- </div>
711
-
712
-
713
-
714
- <div class='pre p1 fill-light mt0'>new PublicError(status: any, err: any, safe: any, print: any)</div>
715
-
716
-
717
-
718
-
719
-
720
-
721
-
722
-
723
-
724
-
725
-
726
- <div class='py1 quiet mt1 prose-big'>Parameters</div>
727
- <div class='prose'>
728
-
729
- <div class='space-bottom0'>
730
- <div>
731
- <span class='code bold'>status</span> <code class='quiet'>(any)</code>
732
-
733
- </div>
734
-
735
- </div>
736
-
737
- <div class='space-bottom0'>
738
- <div>
739
- <span class='code bold'>err</span> <code class='quiet'>(any)</code>
740
-
741
- </div>
742
-
743
- </div>
744
-
745
- <div class='space-bottom0'>
746
- <div>
747
- <span class='code bold'>safe</span> <code class='quiet'>(any)</code>
748
-
749
- </div>
750
-
751
- </div>
752
-
753
- <div class='space-bottom0'>
754
- <div>
755
- <span class='code bold'>print</span> <code class='quiet'>(any
756
- = <code>true</code>)</code>
757
-
758
- </div>
759
-
760
- </div>
761
-
762
- </div>
763
-
764
-
765
-
766
-
767
-
768
-
769
-
770
-
771
-
772
-
773
-
774
-
775
-
776
-
777
-
778
-
779
-
780
-
781
-
782
- </section>
783
-
784
-
785
-
786
- </div>
787
- </div>
788
- <script src='assets/anchor.js'></script>
789
- <script src='assets/split.js'></script>
790
- <script src='assets/site.js'></script>
791
- </body>
792
- </html>