vpndetection 4.1.1 → 5.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.
@@ -199,7 +199,11 @@ export type DatabaseFormat = 'csvgz' | 'mmdb';
199
199
  export type DatabaseFormatSize = {
200
200
  format: DatabaseFormat;
201
201
  /**
202
- * Size of the published file, or null when it has not been published yet
202
+ * Size of the published file, or null when it has not been published
203
+ * yet. int64 because it is not hypothetical: resproxy_ip_14d's MMDB is
204
+ * 4.58 GB, so a 32-bit field cannot carry the catalogue and `list`
205
+ * throws for every caller rather than for that one entry.
206
+ *
203
207
  */
204
208
  bytes: number | null;
205
209
  };
@@ -277,6 +281,8 @@ export type Download = {
277
281
  /**
278
282
  * Object size at redirect time, NOT bytes delivered: the transfer is a
279
283
  * presigned redirect straight to object storage, so we never observe it.
284
+ * int64 for the same reason as DatabaseFormatSize.bytes - it is the
285
+ * size of the same object.
280
286
  *
281
287
  */
282
288
  bytes: number | null;
@@ -347,21 +353,21 @@ export type DatabaseMetadata = {
347
353
  */
348
354
  sample_entries?: number;
349
355
  };
350
- export type AccountMe = {
356
+ export type Entitlement = {
351
357
  /**
352
358
  * The organization the key belongs to.
353
359
  */
354
360
  org_id: string;
355
- apikey: AccountApikey;
356
- plan: AccountPlan;
357
- usage: AccountUsage;
361
+ apikey: EntitlementApikey;
362
+ plan: EntitlementPlan;
363
+ usage: EntitlementUsage;
358
364
  };
359
365
  /**
360
366
  * The credential itself. The key is never echoed - only its id, which is
361
367
  * what the console shows and what you can act on.
362
368
  *
363
369
  */
364
- export type AccountApikey = {
370
+ export type EntitlementApikey = {
365
371
  id: string;
366
372
  /**
367
373
  * Null for a key with no end date, which is the normal case.
@@ -374,7 +380,7 @@ export type AccountApikey = {
374
380
  */
375
381
  allowed_cidrs: Array<string>;
376
382
  };
377
- export type AccountPlan = {
383
+ export type EntitlementPlan = {
378
384
  /**
379
385
  * The plan the organization is on.
380
386
  */
@@ -387,7 +393,7 @@ export type AccountPlan = {
387
393
  */
388
394
  tier: 'free' | 'starter' | 'scale' | 'max';
389
395
  };
390
- export type AccountUsage = {
396
+ export type EntitlementUsage = {
391
397
  /**
392
398
  * Requests counted in the current window. The same number the lookup
393
399
  * API gates on, and it can lag by a few seconds.
@@ -414,9 +420,175 @@ export type AccountUsage = {
414
420
  */
415
421
  window_end: string;
416
422
  };
417
- export type AccountError = {
423
+ export type EntitlementError = {
418
424
  error: string;
419
425
  };
426
+ export type AccountRc = {
427
+ /**
428
+ * The outcome. `SUCCESS` on success; otherwise the reason.
429
+ */
430
+ rc: string;
431
+ };
432
+ export type Identity = {
433
+ rc: string;
434
+ user: AccountUser;
435
+ org: AccountOrgRef;
436
+ /**
437
+ * What this credential may do right now.
438
+ */
439
+ scopes: Array<string>;
440
+ };
441
+ export type AccountUser = {
442
+ id: string;
443
+ fullname?: string;
444
+ email?: string;
445
+ };
446
+ export type AccountOrgRef = {
447
+ id: string;
448
+ };
449
+ export type AccountOrgWrap = {
450
+ rc: string;
451
+ org: AccountOrg;
452
+ };
453
+ export type AccountOrg = {
454
+ id: string;
455
+ name?: string;
456
+ created?: string | null;
457
+ };
458
+ export type ApikeyList = {
459
+ rc: string;
460
+ keys: Array<ApikeyDetail>;
461
+ };
462
+ /**
463
+ * Key METADATA. Never the key itself.
464
+ */
465
+ export type ApikeyDetail = {
466
+ id: string;
467
+ name: string;
468
+ /**
469
+ * The leading, non-secret part, so a key is recognisable without storing it.
470
+ */
471
+ key_prefix: string;
472
+ created: string;
473
+ expires?: string | null;
474
+ last_used_at?: string | null;
475
+ revoked_at?: string | null;
476
+ /**
477
+ * Source-IP allowlist. EMPTY MEANS UNRESTRICTED, not deny-all.
478
+ */
479
+ allowed_cidrs?: Array<string>;
480
+ allowed_scopes?: Array<string>;
481
+ /**
482
+ * Whether this key's secret can still be read back. False permanently for a key issued before secrets were stored recoverably.
483
+ */
484
+ retrievable?: boolean;
485
+ };
486
+ export type AccountCreateApikeyRequest = {
487
+ /**
488
+ * A label you will recognise later. Shown wherever the key is listed.
489
+ */
490
+ name: string;
491
+ /**
492
+ * What the new key may do. Omit for a key that carries no named scope, which is the safe default.
493
+ */
494
+ allowed_scopes?: Array<string>;
495
+ };
496
+ export type AccountCreatedApikey = {
497
+ rc: string;
498
+ id: string;
499
+ name?: string;
500
+ /**
501
+ * The secret. Returned once, here, and never again.
502
+ */
503
+ key: string;
504
+ key_prefix?: string;
505
+ allowed_cidrs?: Array<string>;
506
+ allowed_scopes?: Array<string>;
507
+ };
508
+ export type AccountRevealedApikey = {
509
+ rc: string;
510
+ /**
511
+ * The secret.
512
+ */
513
+ key: string;
514
+ };
515
+ export type OauthMetadata = {
516
+ issuer: string;
517
+ authorization_endpoint: string;
518
+ token_endpoint: string;
519
+ device_authorization_endpoint?: string;
520
+ revocation_endpoint?: string;
521
+ scopes_supported?: Array<string>;
522
+ response_types_supported?: Array<string>;
523
+ grant_types_supported?: Array<string>;
524
+ code_challenge_methods_supported?: Array<string>;
525
+ /**
526
+ * A client_id may be an https URL serving your client metadata.
527
+ */
528
+ client_id_metadata_document_supported?: boolean;
529
+ };
530
+ export type DeviceAuthorizationRequest = {
531
+ client_id: string;
532
+ /**
533
+ * Space-delimited. Anything your client is not registered for is dropped rather than refused.
534
+ */
535
+ scope?: string;
536
+ /**
537
+ * RFC 8707: what the token is for.
538
+ */
539
+ resource?: string;
540
+ };
541
+ export type DeviceAuthorization = {
542
+ /**
543
+ * Yours. Poll with it; never show it to anyone.
544
+ */
545
+ device_code: string;
546
+ /**
547
+ * Short and typable. This is what the person confirms.
548
+ */
549
+ user_code: string;
550
+ verification_uri: string;
551
+ /**
552
+ * The same page with the code already filled in.
553
+ */
554
+ verification_uri_complete?: string;
555
+ expires_in: number;
556
+ /**
557
+ * Seconds between polls.
558
+ */
559
+ interval: number;
560
+ };
561
+ export type TokenRequest = {
562
+ grant_type: string;
563
+ client_id: string;
564
+ device_code?: string;
565
+ code?: string;
566
+ code_verifier?: string;
567
+ redirect_uri?: string;
568
+ refresh_token?: string;
569
+ };
570
+ export type TokenResponse = {
571
+ access_token: string;
572
+ token_type: string;
573
+ expires_in: number;
574
+ refresh_token?: string;
575
+ /**
576
+ * What was actually granted, which may be narrower than what was asked for.
577
+ */
578
+ scope?: string;
579
+ };
580
+ export type RevokeRequest = {
581
+ token: string;
582
+ client_id?: string;
583
+ };
584
+ export type OauthError = {
585
+ error: string;
586
+ error_description?: string;
587
+ };
588
+ /**
589
+ * The key's id, as returned by the list endpoint. Never the key itself.
590
+ */
591
+ export type ApikeyIdParam = string;
420
592
  export type LookupIpData = {
421
593
  body?: never;
422
594
  path: {
@@ -667,36 +839,379 @@ export type ListDownloadsResponses = {
667
839
  };
668
840
  };
669
841
  export type ListDownloadsResponse = ListDownloadsResponses[keyof ListDownloadsResponses];
670
- export type AccountMeData = {
842
+ export type MyEntitlementData = {
671
843
  body?: never;
672
844
  path?: never;
673
845
  query?: never;
674
- url: '/api/v1/account/me';
846
+ url: '/api/v1/entitlement';
675
847
  };
676
- export type AccountMeErrors = {
848
+ export type MyEntitlementErrors = {
677
849
  /**
678
850
  * No key was presented, or it is unknown, revoked or expired.
679
851
  */
680
- 401: AccountError;
852
+ 401: EntitlementError;
681
853
  /**
682
854
  * The key restricts which source addresses may use it, and this
683
855
  * request did not come from one of them.
684
856
  *
685
857
  */
686
- 403: AccountError;
858
+ 403: EntitlementError;
687
859
  /**
688
860
  * The usage counters could not be read. Reported rather than guessed
689
861
  * at: the whole answer is the number, and a confident zero would read
690
862
  * as "you have used nothing".
691
863
  *
692
864
  */
693
- 503: AccountError;
865
+ 503: EntitlementError;
694
866
  };
695
- export type AccountMeError = AccountMeErrors[keyof AccountMeErrors];
696
- export type AccountMeResponses = {
867
+ export type MyEntitlementError = MyEntitlementErrors[keyof MyEntitlementErrors];
868
+ export type MyEntitlementResponses = {
697
869
  /**
698
870
  * The key's entitlements and consumption.
699
871
  */
700
- 200: AccountMe;
872
+ 200: Entitlement;
873
+ };
874
+ export type MyEntitlementResponse = MyEntitlementResponses[keyof MyEntitlementResponses];
875
+ export type AccountIdentityData = {
876
+ body?: never;
877
+ path?: never;
878
+ query?: never;
879
+ url: '/api/v1/iam/identity';
880
+ };
881
+ export type AccountIdentityErrors = {
882
+ /**
883
+ * No credential was presented, or it is not valid.
884
+ */
885
+ 401: AccountRc;
886
+ /**
887
+ * The credential does not hold the scope this endpoint requires. The
888
+ * missing scope is deliberately not named.
889
+ *
890
+ */
891
+ 403: AccountRc;
892
+ };
893
+ export type AccountIdentityError = AccountIdentityErrors[keyof AccountIdentityErrors];
894
+ export type AccountIdentityResponses = {
895
+ /**
896
+ * The caller.
897
+ */
898
+ 200: Identity;
899
+ };
900
+ export type AccountIdentityResponse = AccountIdentityResponses[keyof AccountIdentityResponses];
901
+ export type AccountOrgData = {
902
+ body?: never;
903
+ path?: never;
904
+ query?: never;
905
+ url: '/api/v1/iam/org';
906
+ };
907
+ export type AccountOrgErrors = {
908
+ /**
909
+ * No credential was presented, or it is not valid.
910
+ */
911
+ 401: AccountRc;
912
+ /**
913
+ * The credential does not hold the scope this endpoint requires. The
914
+ * missing scope is deliberately not named.
915
+ *
916
+ */
917
+ 403: AccountRc;
918
+ };
919
+ export type AccountOrgError = AccountOrgErrors[keyof AccountOrgErrors];
920
+ export type AccountOrgResponses = {
921
+ /**
922
+ * The organization.
923
+ */
924
+ 200: AccountOrgWrap;
925
+ };
926
+ export type AccountOrgResponse = AccountOrgResponses[keyof AccountOrgResponses];
927
+ export type AccountOrgMembersData = {
928
+ body?: never;
929
+ path?: never;
930
+ query?: never;
931
+ url: '/api/v1/iam/org/members';
932
+ };
933
+ export type AccountOrgMembersErrors = {
934
+ /**
935
+ * No credential was presented, or it is not valid.
936
+ */
937
+ 401: AccountRc;
938
+ /**
939
+ * The credential does not hold the scope this endpoint requires. The
940
+ * missing scope is deliberately not named.
941
+ *
942
+ */
943
+ 403: AccountRc;
944
+ };
945
+ export type AccountOrgMembersError = AccountOrgMembersErrors[keyof AccountOrgMembersErrors];
946
+ export type AccountOrgMembersResponses = {
947
+ /**
948
+ * The members.
949
+ */
950
+ 200: AccountRc;
951
+ };
952
+ export type AccountOrgMembersResponse = AccountOrgMembersResponses[keyof AccountOrgMembersResponses];
953
+ export type AccountListApikeysData = {
954
+ body?: never;
955
+ path?: never;
956
+ query?: never;
957
+ url: '/api/v1/iam/apikeys';
958
+ };
959
+ export type AccountListApikeysErrors = {
960
+ /**
961
+ * No credential was presented, or it is not valid.
962
+ */
963
+ 401: AccountRc;
964
+ /**
965
+ * The credential does not hold the scope this endpoint requires. The
966
+ * missing scope is deliberately not named.
967
+ *
968
+ */
969
+ 403: AccountRc;
970
+ };
971
+ export type AccountListApikeysError = AccountListApikeysErrors[keyof AccountListApikeysErrors];
972
+ export type AccountListApikeysResponses = {
973
+ /**
974
+ * The organization's keys, newest first.
975
+ */
976
+ 200: ApikeyList;
977
+ };
978
+ export type AccountListApikeysResponse = AccountListApikeysResponses[keyof AccountListApikeysResponses];
979
+ export type AccountCreateApikeyData = {
980
+ body: AccountCreateApikeyRequest;
981
+ path?: never;
982
+ query?: never;
983
+ url: '/api/v1/iam/apikeys';
984
+ };
985
+ export type AccountCreateApikeyErrors = {
986
+ /**
987
+ * The request body is missing a required field.
988
+ */
989
+ 400: AccountRc;
990
+ /**
991
+ * No credential was presented, or it is not valid.
992
+ */
993
+ 401: AccountRc;
994
+ /**
995
+ * The credential does not hold the scope this endpoint requires. The
996
+ * missing scope is deliberately not named.
997
+ *
998
+ */
999
+ 403: AccountRc;
1000
+ };
1001
+ export type AccountCreateApikeyError = AccountCreateApikeyErrors[keyof AccountCreateApikeyErrors];
1002
+ export type AccountCreateApikeyResponses = {
1003
+ /**
1004
+ * The new key, including its secret.
1005
+ */
1006
+ 200: AccountCreatedApikey;
1007
+ };
1008
+ export type AccountCreateApikeyResponse = AccountCreateApikeyResponses[keyof AccountCreateApikeyResponses];
1009
+ export type AccountRotateApikeyData = {
1010
+ body?: never;
1011
+ path: {
1012
+ /**
1013
+ * The key's id, as returned by the list endpoint. Never the key itself.
1014
+ */
1015
+ id: string;
1016
+ };
1017
+ query?: never;
1018
+ url: '/api/v1/iam/apikeys/{id}/rotate';
1019
+ };
1020
+ export type AccountRotateApikeyErrors = {
1021
+ /**
1022
+ * No credential was presented, or it is not valid.
1023
+ */
1024
+ 401: AccountRc;
1025
+ /**
1026
+ * The credential does not hold the scope this endpoint requires. The
1027
+ * missing scope is deliberately not named.
1028
+ *
1029
+ */
1030
+ 403: AccountRc;
1031
+ /**
1032
+ * No such key in this organization.
1033
+ */
1034
+ 404: AccountRc;
1035
+ };
1036
+ export type AccountRotateApikeyError = AccountRotateApikeyErrors[keyof AccountRotateApikeyErrors];
1037
+ export type AccountRotateApikeyResponses = {
1038
+ /**
1039
+ * The key, with its new secret.
1040
+ */
1041
+ 200: AccountCreatedApikey;
1042
+ };
1043
+ export type AccountRotateApikeyResponse = AccountRotateApikeyResponses[keyof AccountRotateApikeyResponses];
1044
+ export type AccountRevokeApikeyData = {
1045
+ body?: never;
1046
+ path: {
1047
+ /**
1048
+ * The key's id, as returned by the list endpoint. Never the key itself.
1049
+ */
1050
+ id: string;
1051
+ };
1052
+ query?: never;
1053
+ url: '/api/v1/iam/apikeys/{id}/revoke';
1054
+ };
1055
+ export type AccountRevokeApikeyErrors = {
1056
+ /**
1057
+ * No credential was presented, or it is not valid.
1058
+ */
1059
+ 401: AccountRc;
1060
+ /**
1061
+ * The credential does not hold the scope this endpoint requires. The
1062
+ * missing scope is deliberately not named.
1063
+ *
1064
+ */
1065
+ 403: AccountRc;
1066
+ /**
1067
+ * No such key in this organization.
1068
+ */
1069
+ 404: AccountRc;
1070
+ };
1071
+ export type AccountRevokeApikeyError = AccountRevokeApikeyErrors[keyof AccountRevokeApikeyErrors];
1072
+ export type AccountRevokeApikeyResponses = {
1073
+ /**
1074
+ * Revoked.
1075
+ */
1076
+ 200: AccountRc;
1077
+ };
1078
+ export type AccountRevokeApikeyResponse = AccountRevokeApikeyResponses[keyof AccountRevokeApikeyResponses];
1079
+ export type AccountRevealApikeyData = {
1080
+ body?: never;
1081
+ path: {
1082
+ /**
1083
+ * The key's id, as returned by the list endpoint. Never the key itself.
1084
+ */
1085
+ id: string;
1086
+ };
1087
+ query?: never;
1088
+ url: '/api/v1/iam/apikeys/{id}/reveal';
1089
+ };
1090
+ export type AccountRevealApikeyErrors = {
1091
+ /**
1092
+ * No credential was presented, or it is not valid.
1093
+ */
1094
+ 401: AccountRc;
1095
+ /**
1096
+ * The credential does not hold the scope this endpoint requires. The
1097
+ * missing scope is deliberately not named.
1098
+ *
1099
+ */
1100
+ 403: AccountRc;
1101
+ /**
1102
+ * No such key in this organization, or its secret was never stored
1103
+ * recoverably (`NOT_RETRIEVABLE`).
1104
+ *
1105
+ */
1106
+ 404: AccountRc;
1107
+ };
1108
+ export type AccountRevealApikeyError = AccountRevealApikeyErrors[keyof AccountRevealApikeyErrors];
1109
+ export type AccountRevealApikeyResponses = {
1110
+ /**
1111
+ * The key's secret.
1112
+ */
1113
+ 200: AccountRevealedApikey;
1114
+ };
1115
+ export type AccountRevealApikeyResponse = AccountRevealApikeyResponses[keyof AccountRevealApikeyResponses];
1116
+ export type OauthMetadataData = {
1117
+ body?: never;
1118
+ path?: never;
1119
+ query?: never;
1120
+ url: '/.well-known/oauth-authorization-server';
1121
+ };
1122
+ export type OauthMetadataResponses = {
1123
+ /**
1124
+ * The server's metadata.
1125
+ */
1126
+ 200: OauthMetadata;
1127
+ };
1128
+ export type OauthMetadataResponse = OauthMetadataResponses[keyof OauthMetadataResponses];
1129
+ export type OauthDeviceAuthorizationData = {
1130
+ body: DeviceAuthorizationRequest;
1131
+ path?: never;
1132
+ query?: never;
1133
+ url: '/oauth/device_authorization';
1134
+ };
1135
+ export type OauthDeviceAuthorizationErrors = {
1136
+ /**
1137
+ * `invalid_request`, `invalid_client`, `unauthorized_client`, or
1138
+ * `slow_down` when this address has started too many authorizations.
1139
+ *
1140
+ */
1141
+ 400: OauthError;
1142
+ };
1143
+ export type OauthDeviceAuthorizationError = OauthDeviceAuthorizationErrors[keyof OauthDeviceAuthorizationErrors];
1144
+ export type OauthDeviceAuthorizationResponses = {
1145
+ /**
1146
+ * A pending device authorization.
1147
+ */
1148
+ 200: DeviceAuthorization;
1149
+ };
1150
+ export type OauthDeviceAuthorizationResponse = OauthDeviceAuthorizationResponses[keyof OauthDeviceAuthorizationResponses];
1151
+ export type OauthAuthorizeData = {
1152
+ body?: never;
1153
+ path?: never;
1154
+ query: {
1155
+ client_id: string;
1156
+ redirect_uri: string;
1157
+ response_type: 'code';
1158
+ code_challenge: string;
1159
+ /**
1160
+ * S256 only. `plain` is refused rather than downgraded.
1161
+ */
1162
+ code_challenge_method?: 'S256';
1163
+ scope?: string;
1164
+ /**
1165
+ * Returned unchanged. Use it to bind the response to your request.
1166
+ */
1167
+ state?: string;
1168
+ /**
1169
+ * RFC 8707. What the token is FOR, so it cannot be replayed elsewhere.
1170
+ */
1171
+ resource?: string;
1172
+ };
1173
+ url: '/oauth/authorize';
1174
+ };
1175
+ export type OauthAuthorizeErrors = {
1176
+ /**
1177
+ * Shown to the user. An unverified redirect target is never sent an error.
1178
+ */
1179
+ 400: unknown;
1180
+ };
1181
+ export type OauthTokenData = {
1182
+ body: TokenRequest;
1183
+ path?: never;
1184
+ query?: never;
1185
+ url: '/oauth/token';
1186
+ };
1187
+ export type OauthTokenErrors = {
1188
+ /**
1189
+ * An RFC 6749 error. `authorization_pending` and `slow_down` are
1190
+ * normal answers while polling a device authorization, not failures.
1191
+ *
1192
+ */
1193
+ 400: OauthError;
1194
+ };
1195
+ export type OauthTokenError = OauthTokenErrors[keyof OauthTokenErrors];
1196
+ export type OauthTokenResponses = {
1197
+ /**
1198
+ * Tokens.
1199
+ */
1200
+ 200: TokenResponse;
1201
+ };
1202
+ export type OauthTokenResponse = OauthTokenResponses[keyof OauthTokenResponses];
1203
+ export type OauthRevokeData = {
1204
+ body: RevokeRequest;
1205
+ path?: never;
1206
+ query?: never;
1207
+ url: '/oauth/revoke';
1208
+ };
1209
+ export type OauthRevokeResponses = {
1210
+ /**
1211
+ * Always, whatever was presented.
1212
+ */
1213
+ 200: {
1214
+ [key: string]: unknown;
1215
+ };
701
1216
  };
702
- export type AccountMeResponse = AccountMeResponses[keyof AccountMeResponses];
1217
+ export type OauthRevokeResponse = OauthRevokeResponses[keyof OauthRevokeResponses];
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { isBogon } from './bogon.js';
4
4
  export { VPNDetectionError } from './errors.js';
5
5
  export type { ErrorKind } from './errors.js';
6
6
  export type { Result, VpnDetail, ClassDetail, ProxyDetail, LookupResponse, } from './types.js';
7
+ export { DATABASE_FORMATS, STANDINGS, LICENSE_TYPES } from './types.js';
7
8
  export type { Database, DatabaseFormat, DatabaseFormatSize, DatabaseMetadata, DatabaseMetadataColumn, DatabaseVersion, DbChecksums, Download, Standing, } from './generated/types.gen.js';
8
9
  export type LicenseType = NonNullable<import('./generated/types.gen.js').Database['license_type']>;
9
- export type { AccountMe, AccountApikey, AccountPlan, AccountUsage, } from './generated/types.gen.js';
10
+ export type { Entitlement, EntitlementApikey, EntitlementPlan, EntitlementUsage, } from './generated/types.gen.js';
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { VPNDetection, DatabaseApi, DEFAULT_BASE_URL } from './client.js';
2
2
  export { isBogon } from './bogon.js';
3
3
  export { VPNDetectionError } from './errors.js';
4
+ export { DATABASE_FORMATS, STANDINGS, LICENSE_TYPES } from './types.js';
4
5
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAK1E,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAK1E,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAKhD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,5 +1,8 @@
1
- import type { ClassDetail, LookupResponse, ProxyDetail, VpnDetail } from './generated/types.gen.js';
1
+ import type { ClassDetail, Database, DatabaseFormat, LookupResponse, ProxyDetail, Standing, VpnDetail } from './generated/types.gen.js';
2
2
  export type { ClassDetail, ProxyDetail, VpnDetail, LookupResponse };
3
+ export declare const DATABASE_FORMATS: readonly DatabaseFormat[];
4
+ export declare const STANDINGS: readonly Standing[];
5
+ export declare const LICENSE_TYPES: readonly NonNullable<Database['license_type']>[];
3
6
  /**
4
7
  * What a lookup answers.
5
8
  *
package/dist/types.js CHANGED
@@ -1,3 +1,17 @@
1
+ // The runtime halves of the three closed vocabularies the API publishes, for a
2
+ // caller that wants to validate or enumerate rather than switch. The generated
3
+ // names are TYPES and are erased at compile time, so a JS caller - or anything
4
+ // taking one of these from a CLI flag, a form field or a model - has nothing to
5
+ // check against without them.
6
+ //
7
+ // Each is TYPED by the generated union, so a value the spec does not define
8
+ // will not compile; that a value is MISSING is what `conformance.test.mjs` pins
9
+ // against the pinned spec, since a subset would type-check happily.
10
+ export const DATABASE_FORMATS = ['csvgz', 'mmdb'];
11
+ export const STANDINGS = ['expired', 'licensed', 'unlicensed'];
12
+ export const LICENSE_TYPES = [
13
+ 'evaluation', 'standard', 'redistribute',
14
+ ];
1
15
  // The one place the wire's snake_case becomes idiomatic camelCase. Every
2
16
  // assignment is conditional on the key being PRESENT rather than truthy, so a
3
17
  // plan that includes a field and answers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