kaafil-js 0.3.1 → 0.4.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.
@@ -708,6 +708,7 @@ interface components {
708
708
  proof: string | null;
709
709
  why?: string;
710
710
  lastObservedAt: string | null;
711
+ lastCheckedAt: string | null;
711
712
  };
712
713
  ChangeMyConsolePasswordRequest: {
713
714
  currentPassword: string;
@@ -2021,6 +2022,9 @@ interface components {
2021
2022
  periodStart?: string;
2022
2023
  /** Format: date-time */
2023
2024
  periodEnd?: string;
2025
+ overrides?: {
2026
+ includedStorageBytes?: number | null;
2027
+ };
2024
2028
  adminEmail: string;
2025
2029
  adminName?: string;
2026
2030
  /** @enum {string} */
@@ -6767,6 +6771,15 @@ interface components {
6767
6771
  updatedAt: string;
6768
6772
  key: string;
6769
6773
  };
6774
+ RevealedShareTokenViewResponse: {
6775
+ /** @description The link's plaintext, or null when this link predates recoverable storage and can never be shown again. Null is a normal answer — offer the operator `regenerate`, not a retry. */
6776
+ token: string | null;
6777
+ /**
6778
+ * @description Why `token` is what it is. `revealed` — the address is in this response. `not_recoverable` — the link was minted before Kaafil stored a recoverable copy, so only a digest exists and the address is gone for good.
6779
+ * @enum {string}
6780
+ */
6781
+ reason: "revealed" | "not_recoverable";
6782
+ };
6770
6783
  RevealedWebhookEndpointResponse: {
6771
6784
  /**
6772
6785
  * @description Kaafil's own id for this webhook endpoint. Use it in every later call that names this endpoint.
@@ -7973,6 +7986,8 @@ interface components {
7973
7986
  * @enum {string}
7974
7987
  */
7975
7988
  phase: "PRE_DEPARTURE" | "ON_TRIP" | "POST_TRIP";
7989
+ /** @description Whether this trip has been cancelled. Deliberately a separate field rather than a fourth `phase` member, because `phase` is date-derived and is a total enum existing clients switch on exhaustively. A cancelled trip still reports whichever `phase` its dates imply, so a client MUST check this field before rendering any date-derived status — otherwise a cancelled trip reads as 'Upcoming' with a countdown to a departure that is not happening. Always present. */
7990
+ cancelled: boolean;
7976
7991
  };
7977
7992
  /** @description This trip's day-by-day itinerary. Present only when the link exposes this section and there's data for it; otherwise the key is absent entirely, never null. */
7978
7993
  itinerary?: {
@@ -10533,21 +10548,6 @@ interface operations {
10533
10548
  };
10534
10549
  };
10535
10550
  };
10536
- /** @description `UNAUTHENTICATED` — Missing/expired credential — the SDK attempts one token refresh first */
10537
- 401: {
10538
- headers: {
10539
- "X-Request-Id"?: string;
10540
- [name: string]: unknown;
10541
- };
10542
- content: {
10543
- "application/json": components["schemas"]["ErrorEnvelope"] & {
10544
- error?: {
10545
- /** @enum {string} */
10546
- code?: "UNAUTHENTICATED";
10547
- };
10548
- };
10549
- };
10550
- };
10551
10551
  /** @description `VALIDATION_ERROR` — Body/params fail schema validation */
10552
10552
  422: {
10553
10553
  headers: {
@@ -10774,20 +10774,16 @@ interface operations {
10774
10774
  };
10775
10775
  };
10776
10776
  };
10777
- inspectConsoleInvite: {
10777
+ refreshConsoleSession: {
10778
10778
  parameters: {
10779
10779
  query?: never;
10780
10780
  header?: never;
10781
10781
  path?: never;
10782
10782
  cookie?: never;
10783
10783
  };
10784
- requestBody: {
10785
- content: {
10786
- "application/json": components["schemas"]["InspectConsoleInviteRequest"];
10787
- };
10788
- };
10784
+ requestBody?: never;
10789
10785
  responses: {
10790
- /** @description Preview a console invite before accepting it */
10786
+ /** @description Rotate the console session forward */
10791
10787
  200: {
10792
10788
  headers: {
10793
10789
  "X-Request-Id"?: string;
@@ -10795,7 +10791,7 @@ interface operations {
10795
10791
  };
10796
10792
  content: {
10797
10793
  "application/json": components["schemas"]["SuccessEnvelope"] & {
10798
- data: components["schemas"]["ConsoleInviteInspectResponse"];
10794
+ data: components["schemas"]["ConsoleSessionResponse"];
10799
10795
  };
10800
10796
  };
10801
10797
  };
@@ -10814,6 +10810,71 @@ interface operations {
10814
10810
  };
10815
10811
  };
10816
10812
  };
10813
+ /** @description `RATE_LIMITED` — Per-key/per-token rate limit */
10814
+ 429: {
10815
+ headers: {
10816
+ "X-Request-Id"?: string;
10817
+ /** @description Seconds until the limiter refills enough to accept another request. Integer, never below 1 on a 429 — `decision()` in `rate-limit.ts` floors it at 1 so `Retry-After: 0` ("retry instantly") never ships on an actual refusal. */
10818
+ "Retry-After"?: number;
10819
+ /** @description The ceiling, in requests per window, of the specific limiter tier (IP / API key / share token / bulk-ingest / session-rotation) that refused this request. */
10820
+ "X-RateLimit-Limit"?: number;
10821
+ /** @description Requests remaining in the current window for that tier — always 0 on a 429. */
10822
+ "X-RateLimit-Remaining"?: number;
10823
+ /** @description Seconds until the window resets — relative, not an absolute epoch, so an offline-first client whose clock is wrong cannot misread it. Same value as `Retry-After` on a 429. */
10824
+ "X-RateLimit-Reset"?: number;
10825
+ [name: string]: unknown;
10826
+ };
10827
+ content: {
10828
+ "application/json": components["schemas"]["ErrorEnvelope"] & {
10829
+ error?: {
10830
+ /** @enum {string} */
10831
+ code?: "RATE_LIMITED";
10832
+ };
10833
+ };
10834
+ };
10835
+ };
10836
+ /** @description `INTERNAL_ERROR` — Engine fault; safe to retry with backoff (all writes are idempotent); `TENANT_SCOPE_MISSING` — Engine invariant tripped — a query reached the database without tenant scope; always a bug, never client-fixable */
10837
+ 500: {
10838
+ headers: {
10839
+ "X-Request-Id"?: string;
10840
+ [name: string]: unknown;
10841
+ };
10842
+ content: {
10843
+ "application/json": components["schemas"]["ErrorEnvelope"] & {
10844
+ error?: {
10845
+ /** @enum {string} */
10846
+ code?: "INTERNAL_ERROR" | "TENANT_SCOPE_MISSING";
10847
+ };
10848
+ };
10849
+ };
10850
+ };
10851
+ };
10852
+ };
10853
+ inspectConsoleInvite: {
10854
+ parameters: {
10855
+ query?: never;
10856
+ header?: never;
10857
+ path?: never;
10858
+ cookie?: never;
10859
+ };
10860
+ requestBody: {
10861
+ content: {
10862
+ "application/json": components["schemas"]["InspectConsoleInviteRequest"];
10863
+ };
10864
+ };
10865
+ responses: {
10866
+ /** @description Preview a console invite before accepting it */
10867
+ 200: {
10868
+ headers: {
10869
+ "X-Request-Id"?: string;
10870
+ [name: string]: unknown;
10871
+ };
10872
+ content: {
10873
+ "application/json": components["schemas"]["SuccessEnvelope"] & {
10874
+ data: components["schemas"]["ConsoleInviteInspectResponse"];
10875
+ };
10876
+ };
10877
+ };
10817
10878
  /** @description `VALIDATION_ERROR` — Body/params fail schema validation */
10818
10879
  422: {
10819
10880
  headers: {
@@ -10896,21 +10957,6 @@ interface operations {
10896
10957
  };
10897
10958
  };
10898
10959
  };
10899
- /** @description `UNAUTHENTICATED` — Missing/expired credential — the SDK attempts one token refresh first */
10900
- 401: {
10901
- headers: {
10902
- "X-Request-Id"?: string;
10903
- [name: string]: unknown;
10904
- };
10905
- content: {
10906
- "application/json": components["schemas"]["ErrorEnvelope"] & {
10907
- error?: {
10908
- /** @enum {string} */
10909
- code?: "UNAUTHENTICATED";
10910
- };
10911
- };
10912
- };
10913
- };
10914
10960
  /** @description `SECRET_NOT_REPLAYABLE` — Replay of an operation whose response carried a one-time secret. The operation completed exactly once; the secret was never stored and cannot be re-shown */
10915
10961
  409: {
10916
10962
  headers: {
@@ -12197,6 +12243,82 @@ interface operations {
12197
12243
  };
12198
12244
  };
12199
12245
  };
12246
+ recheckConsoleCertification: {
12247
+ parameters: {
12248
+ query?: never;
12249
+ header?: never;
12250
+ path?: never;
12251
+ cookie?: never;
12252
+ };
12253
+ requestBody?: never;
12254
+ responses: {
12255
+ /** @description Re-run the certification evaluator for this tenant */
12256
+ 200: {
12257
+ headers: {
12258
+ "X-Request-Id"?: string;
12259
+ [name: string]: unknown;
12260
+ };
12261
+ content: {
12262
+ "application/json": components["schemas"]["SuccessEnvelope"] & {
12263
+ data: components["schemas"]["CertificationItemResponse"][];
12264
+ };
12265
+ };
12266
+ };
12267
+ /** @description `UNAUTHENTICATED` — Missing/expired credential — the SDK attempts one token refresh first */
12268
+ 401: {
12269
+ headers: {
12270
+ "X-Request-Id"?: string;
12271
+ [name: string]: unknown;
12272
+ };
12273
+ content: {
12274
+ "application/json": components["schemas"]["ErrorEnvelope"] & {
12275
+ error?: {
12276
+ /** @enum {string} */
12277
+ code?: "UNAUTHENTICATED";
12278
+ };
12279
+ };
12280
+ };
12281
+ };
12282
+ /** @description `RATE_LIMITED` — Per-key/per-token rate limit */
12283
+ 429: {
12284
+ headers: {
12285
+ "X-Request-Id"?: string;
12286
+ /** @description Seconds until the limiter refills enough to accept another request. Integer, never below 1 on a 429 — `decision()` in `rate-limit.ts` floors it at 1 so `Retry-After: 0` ("retry instantly") never ships on an actual refusal. */
12287
+ "Retry-After"?: number;
12288
+ /** @description The ceiling, in requests per window, of the specific limiter tier (IP / API key / share token / bulk-ingest / session-rotation) that refused this request. */
12289
+ "X-RateLimit-Limit"?: number;
12290
+ /** @description Requests remaining in the current window for that tier — always 0 on a 429. */
12291
+ "X-RateLimit-Remaining"?: number;
12292
+ /** @description Seconds until the window resets — relative, not an absolute epoch, so an offline-first client whose clock is wrong cannot misread it. Same value as `Retry-After` on a 429. */
12293
+ "X-RateLimit-Reset"?: number;
12294
+ [name: string]: unknown;
12295
+ };
12296
+ content: {
12297
+ "application/json": components["schemas"]["ErrorEnvelope"] & {
12298
+ error?: {
12299
+ /** @enum {string} */
12300
+ code?: "RATE_LIMITED";
12301
+ };
12302
+ };
12303
+ };
12304
+ };
12305
+ /** @description `INTERNAL_ERROR` — Engine fault; safe to retry with backoff (all writes are idempotent); `TENANT_SCOPE_MISSING` — Engine invariant tripped — a query reached the database without tenant scope; always a bug, never client-fixable */
12306
+ 500: {
12307
+ headers: {
12308
+ "X-Request-Id"?: string;
12309
+ [name: string]: unknown;
12310
+ };
12311
+ content: {
12312
+ "application/json": components["schemas"]["ErrorEnvelope"] & {
12313
+ error?: {
12314
+ /** @enum {string} */
12315
+ code?: "INTERNAL_ERROR" | "TENANT_SCOPE_MISSING";
12316
+ };
12317
+ };
12318
+ };
12319
+ };
12320
+ };
12321
+ };
12200
12322
  listApiKeys: {
12201
12323
  parameters: {
12202
12324
  query?: {
@@ -13462,6 +13584,114 @@ interface operations {
13462
13584
  };
13463
13585
  };
13464
13586
  };
13587
+ revealShareToken: {
13588
+ parameters: {
13589
+ query?: never;
13590
+ header?: never;
13591
+ path: {
13592
+ id: string;
13593
+ };
13594
+ cookie?: never;
13595
+ };
13596
+ requestBody?: never;
13597
+ responses: {
13598
+ /** @description Show an existing link's address again */
13599
+ 200: {
13600
+ headers: {
13601
+ "X-Request-Id"?: string;
13602
+ [name: string]: unknown;
13603
+ };
13604
+ content: {
13605
+ "application/json": components["schemas"]["SuccessEnvelope"] & {
13606
+ data: components["schemas"]["RevealedShareTokenViewResponse"];
13607
+ };
13608
+ };
13609
+ };
13610
+ /** @description `UNAUTHENTICATED` — Missing/expired credential — the SDK attempts one token refresh first */
13611
+ 401: {
13612
+ headers: {
13613
+ "X-Request-Id"?: string;
13614
+ [name: string]: unknown;
13615
+ };
13616
+ content: {
13617
+ "application/json": components["schemas"]["ErrorEnvelope"] & {
13618
+ error?: {
13619
+ /** @enum {string} */
13620
+ code?: "UNAUTHENTICATED";
13621
+ };
13622
+ };
13623
+ };
13624
+ };
13625
+ /** @description `RESOURCE_NOT_FOUND` — Missing or out-of-scope — the same 404 either way; treat as loss-of-access (purge + surface) */
13626
+ 404: {
13627
+ headers: {
13628
+ "X-Request-Id"?: string;
13629
+ [name: string]: unknown;
13630
+ };
13631
+ content: {
13632
+ "application/json": components["schemas"]["ErrorEnvelope"] & {
13633
+ error?: {
13634
+ /** @enum {string} */
13635
+ code?: "RESOURCE_NOT_FOUND";
13636
+ };
13637
+ };
13638
+ };
13639
+ };
13640
+ /** @description `VALIDATION_ERROR` — Body/params fail schema validation */
13641
+ 422: {
13642
+ headers: {
13643
+ "X-Request-Id"?: string;
13644
+ [name: string]: unknown;
13645
+ };
13646
+ content: {
13647
+ "application/json": components["schemas"]["ErrorEnvelope"] & {
13648
+ error?: {
13649
+ /** @enum {string} */
13650
+ code?: "VALIDATION_ERROR";
13651
+ };
13652
+ };
13653
+ };
13654
+ };
13655
+ /** @description `RATE_LIMITED` — Per-key/per-token rate limit */
13656
+ 429: {
13657
+ headers: {
13658
+ "X-Request-Id"?: string;
13659
+ /** @description Seconds until the limiter refills enough to accept another request. Integer, never below 1 on a 429 — `decision()` in `rate-limit.ts` floors it at 1 so `Retry-After: 0` ("retry instantly") never ships on an actual refusal. */
13660
+ "Retry-After"?: number;
13661
+ /** @description The ceiling, in requests per window, of the specific limiter tier (IP / API key / share token / bulk-ingest / session-rotation) that refused this request. */
13662
+ "X-RateLimit-Limit"?: number;
13663
+ /** @description Requests remaining in the current window for that tier — always 0 on a 429. */
13664
+ "X-RateLimit-Remaining"?: number;
13665
+ /** @description Seconds until the window resets — relative, not an absolute epoch, so an offline-first client whose clock is wrong cannot misread it. Same value as `Retry-After` on a 429. */
13666
+ "X-RateLimit-Reset"?: number;
13667
+ [name: string]: unknown;
13668
+ };
13669
+ content: {
13670
+ "application/json": components["schemas"]["ErrorEnvelope"] & {
13671
+ error?: {
13672
+ /** @enum {string} */
13673
+ code?: "RATE_LIMITED";
13674
+ };
13675
+ };
13676
+ };
13677
+ };
13678
+ /** @description `INTERNAL_ERROR` — Engine fault; safe to retry with backoff (all writes are idempotent); `TENANT_SCOPE_MISSING` — Engine invariant tripped — a query reached the database without tenant scope; always a bug, never client-fixable */
13679
+ 500: {
13680
+ headers: {
13681
+ "X-Request-Id"?: string;
13682
+ [name: string]: unknown;
13683
+ };
13684
+ content: {
13685
+ "application/json": components["schemas"]["ErrorEnvelope"] & {
13686
+ error?: {
13687
+ /** @enum {string} */
13688
+ code?: "INTERNAL_ERROR" | "TENANT_SCOPE_MISSING";
13689
+ };
13690
+ };
13691
+ };
13692
+ };
13693
+ };
13694
+ };
13465
13695
  upsertTrip: {
13466
13696
  parameters: {
13467
13697
  query?: never;
@@ -48307,6 +48537,7 @@ declare const OperationId: {
48307
48537
  readonly ReadWebhookEventCatalog: "readWebhookEventCatalog";
48308
48538
  readonly ReassignPickupStopTravellers: "reassignPickupStopTravellers";
48309
48539
  readonly RebuildJourney: "rebuildJourney";
48540
+ readonly RecheckConsoleCertification: "recheckConsoleCertification";
48310
48541
  readonly ReconcileTrekWalkIn: "reconcileTrekWalkIn";
48311
48542
  readonly RecordCollection: "recordCollection";
48312
48543
  readonly RedeliverEndpointDelivery: "redeliverEndpointDelivery";
@@ -48314,6 +48545,7 @@ declare const OperationId: {
48314
48545
  readonly RedeliverWebhookDeliveryConsole: "redeliverWebhookDeliveryConsole";
48315
48546
  readonly RedriveSupportWebhookDelivery: "redriveSupportWebhookDelivery";
48316
48547
  readonly RefreshAgencyAdminTokens: "refreshAgencyAdminTokens";
48548
+ readonly RefreshConsoleSession: "refreshConsoleSession";
48317
48549
  readonly RefreshManagerTokens: "refreshManagerTokens";
48318
48550
  readonly RegenerateShareToken: "regenerateShareToken";
48319
48551
  readonly RegisterWebhookEndpoint: "registerWebhookEndpoint";
@@ -48337,6 +48569,7 @@ declare const OperationId: {
48337
48569
  readonly ResetTestClockConsole: "resetTestClockConsole";
48338
48570
  readonly ResolvePlatformCredential: "resolvePlatformCredential";
48339
48571
  readonly ReturnFloat: "returnFloat";
48572
+ readonly RevealShareToken: "revealShareToken";
48340
48573
  readonly RevokeApiKey: "revokeApiKey";
48341
48574
  readonly RevokeMyConsoleSession: "revokeMyConsoleSession";
48342
48575
  readonly RevokePlatformPartnerApiKey: "revokePlatformPartnerApiKey";
@@ -52738,6 +52971,7 @@ type MintedShareTokenViewResponse = components['schemas']['MintedShareTokenViewR
52738
52971
  type ShareTokenViewResponse = components['schemas']['ShareTokenViewResponse'];
52739
52972
  type PatchShareTokenRequest = components['schemas']['PatchShareTokenRequest'];
52740
52973
  type RegenerateShareTokenRequest = components['schemas']['RegenerateShareTokenRequest'];
52974
+ type RevealedShareTokenViewResponse = components['schemas']['RevealedShareTokenViewResponse'];
52741
52975
  interface CreateShareTokenOptions extends Omit<MintShareTokenRequest, 'expiresAt'> {
52742
52976
  /** Optional on the wire (`ttlDays` is the other way to set expiry) — see
52743
52977
  * `../datetime` for the coercion contract; a full ISO string with an
@@ -52816,6 +53050,17 @@ interface ShareTokensResource {
52816
53050
  * the same subject, superseding the old one. By default the old token is
52817
53051
  * revoked in the same transaction; pass `keepOld: true` to retain it. */
52818
53052
  regenerate(options: RegenerateShareTokenOptions): Promise<KaafilResponse<MintedShareTokenViewResponse>>;
53053
+ /**
53054
+ * `GET /api/v1/share-tokens/{id}/reveal` — show an EXISTING link's address
53055
+ * again, so a desk can re-send it instead of calling `regenerate`, which
53056
+ * revokes the copy the family is already using.
53057
+ *
53058
+ * `token` is `null` with `reason: 'not_recoverable'` for a link minted
53059
+ * before Kaafil kept a recoverable copy: those rows hold only a digest, so
53060
+ * the address is gone for good and the caller should offer `regenerate`
53061
+ * rather than a retry. That is a 200, not an error.
53062
+ */
53063
+ reveal(options: ReadShareTokenOptions): Promise<KaafilResponse<RevealedShareTokenViewResponse>>;
52819
53064
  }
52820
53065
 
52821
53066
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kaafil-js",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Headless, typed TypeScript client for the Kaafil on-ground and post-trip engine.",
5
5
  "keywords": [
6
6
  "kaafil",