@smart-byte/leani-sdk 0.1.0-rc.2 → 0.1.0-rc.4

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.
@@ -964,13 +964,48 @@ export interface paths {
964
964
  get: operations["getBackfillSubscription"];
965
965
  put?: never;
966
966
  post?: never;
967
- /** Delete a terminal backfill subscription */
967
+ /**
968
+ * Delete a terminal backfill subscription
969
+ * @description A completed subscription can be deleted once its consumer acknowledged
970
+ * the completion. A failed or cancelled one can be deleted once its
971
+ * required consumer acknowledged every delivered record, and gets 409
972
+ * `backfill_conflict` while one is unacknowledged: read its stream to
973
+ * the end and acknowledge, or pass `discardUnacknowledged=true`.
974
+ */
968
975
  delete: operations["deleteBackfillSubscription"];
969
976
  options?: never;
970
977
  head?: never;
971
978
  patch?: never;
972
979
  trace?: never;
973
980
  };
981
+ "/admin/v1/backfill-subscriptions/{id}/retry": {
982
+ parameters: {
983
+ query?: never;
984
+ header?: never;
985
+ path: {
986
+ id: components["parameters"]["Identifier"];
987
+ };
988
+ cookie?: never;
989
+ };
990
+ get?: never;
991
+ put?: never;
992
+ /**
993
+ * Retry a failed backfill subscription
994
+ * @description Re-queues a failed subscription. It resumes from its committed
995
+ * progress with the same history stream, consumer, and acknowledgement,
996
+ * and its error is cleared. A subscription that is still active returns
997
+ * its status unchanged; a completed or cancelled one gets 409
998
+ * `backfill_conflict`. A failed subscription whose processor instance is
999
+ * not configured (see `processorConfigured`) gets 400 `invalid_request`
1000
+ * and stays failed.
1001
+ */
1002
+ post: operations["retryBackfillSubscription"];
1003
+ delete?: never;
1004
+ options?: never;
1005
+ head?: never;
1006
+ patch?: never;
1007
+ trace?: never;
1008
+ };
974
1009
  "/admin/v1/backfill-subscriptions/{id}/cancel": {
975
1010
  parameters: {
976
1011
  query?: never;
@@ -982,7 +1017,12 @@ export interface paths {
982
1017
  };
983
1018
  get?: never;
984
1019
  put?: never;
985
- /** Cancel a backfill subscription */
1020
+ /**
1021
+ * Cancel a backfill subscription
1022
+ * @description A draining subscription, whose job finished but whose required
1023
+ * consumer has not acknowledged the completion, becomes `cancelled`,
1024
+ * even when its processor instance is not configured.
1025
+ */
986
1026
  post: operations["cancelBackfillSubscription"];
987
1027
  delete?: never;
988
1028
  options?: never;
@@ -1484,7 +1524,10 @@ export interface components {
1484
1524
  complete: boolean;
1485
1525
  /**
1486
1526
  * @description `paused` and `failed` report the processor's live lane;
1487
- * `/v1/network/status` gives its `pauseReason`.
1527
+ * `/v1/network/status` gives its `pauseReason`. `catching_up`
1528
+ * means the range has no gaps but the processor has not reached
1529
+ * `chainFinalizedHead` or the node is not ready; only then is it
1530
+ * `live`.
1488
1531
  * @enum {string}
1489
1532
  */
1490
1533
  state: "starting" | "backfilling" | "catching_up" | "live" | "degraded" | "paused" | "failed";
@@ -1618,6 +1661,67 @@ export interface components {
1618
1661
  createdAtUnixMs: components["schemas"]["DecimalQuantity"];
1619
1662
  updatedAtUnixMs: components["schemas"]["DecimalQuantity"];
1620
1663
  };
1664
+ /** @description A backfill subscription or materialization job. */
1665
+ BackfillStatus: {
1666
+ /**
1667
+ * @description Opaque; do not parse it. An application finds its own
1668
+ * subscriptions by `consumer`.
1669
+ */
1670
+ id: string;
1671
+ /** @enum {string} */
1672
+ owner: "subscription" | "materialization";
1673
+ /** @description The processor instance that runs the job. */
1674
+ processor: string;
1675
+ /**
1676
+ * @description Whether the node configures the processor instance `processor`
1677
+ * now: exactly that instance, not another instance of its kind.
1678
+ * Without it, the subscription's stream and acknowledgement routes
1679
+ * refuse the subscription. That can be temporary, as when a
1680
+ * restart's configuration leaves the instance out by mistake. If
1681
+ * the instance will not return, cancel the subscription and delete
1682
+ * it with `discardUnacknowledged=true`, which discards its
1683
+ * unacknowledged records.
1684
+ */
1685
+ processorConfigured: boolean;
1686
+ /**
1687
+ * @description The subscription's required consumer, which reads and
1688
+ * acknowledges its history stream; null for a materialization job.
1689
+ */
1690
+ consumer: string | null;
1691
+ /** @description The subscription's history stream. */
1692
+ deliveryStreamId?: string;
1693
+ publicationRevision?: components["schemas"]["DecimalQuantity"];
1694
+ fromBlock: components["schemas"]["SafeInteger"];
1695
+ toBlock: components["schemas"]["SafeInteger"];
1696
+ ranges: components["schemas"]["RequestedRange"][];
1697
+ requestedBlocks: components["schemas"]["SafeInteger"];
1698
+ processedBlocks: components["schemas"]["SafeInteger"];
1699
+ remainingBlocks: components["schemas"]["SafeInteger"];
1700
+ capturedFinalizedTarget?: components["schemas"]["SafeInteger"];
1701
+ /** @enum {string} */
1702
+ mode: "fill_missing" | "recompute";
1703
+ /** @description The subscription's effective history batch limits. */
1704
+ batching?: {
1705
+ targetEncodedBytes: components["schemas"]["SafeInteger"];
1706
+ maximumEncodedBytes: components["schemas"]["SafeInteger"];
1707
+ maximumEvents: components["schemas"]["SafeInteger"];
1708
+ maximumProcessedBlocks: components["schemas"]["SafeInteger"];
1709
+ maximumDelayMs: components["schemas"]["SafeInteger"];
1710
+ maximumBufferedBatches: components["schemas"]["SafeInteger"];
1711
+ maximumBufferedBytes: components["schemas"]["SafeInteger"];
1712
+ /** @enum {string} */
1713
+ compression: "none" | "gzip";
1714
+ };
1715
+ /** @enum {string} */
1716
+ state: "waiting_for_consumer" | "queued" | "running" | "backpressured" | "storage_backpressured" | "draining" | "complete_reclaimable" | "completed" | "failed" | "cancelled";
1717
+ attempts: components["schemas"]["SafeInteger"];
1718
+ updatedAtUnixMs: components["schemas"]["SafeInteger"];
1719
+ /** @description The completed job's source report; null until it completes. */
1720
+ report: {
1721
+ [key: string]: unknown;
1722
+ } | null;
1723
+ lastError: string | null;
1724
+ };
1621
1725
  RecoveryCheckpoint: {
1622
1726
  checkpointId: components["schemas"]["SafeInteger"];
1623
1727
  processorInstance: string;
@@ -1784,12 +1888,79 @@ export interface components {
1784
1888
  /** @description Versioned processor change schema identifier. */
1785
1889
  schema: string;
1786
1890
  key: string | null;
1891
+ /**
1892
+ * @description The processor's entity for `apply` and `undo`. For `finalized`,
1893
+ * the `system.finality.put` kind carries `{ throughBlock }`, and the
1894
+ * `system.live_gap.put` kind carries
1895
+ * `{ fromBlock, toBlock, reason: "not_filled" }`: blocks the live
1896
+ * lane skipped and did not fill, such as after a restart at a later
1897
+ * finalized anchor. A processor with `live_gap_fill` delivers a
1898
+ * short range itself as `live_recovery` batches; request what is
1899
+ * announced as history.
1900
+ */
1787
1901
  data: unknown;
1788
1902
  /** @description Present only on reset_required events. */
1789
1903
  coverage?: components["schemas"]["ProcessorCoverage"];
1790
1904
  /** @description Stable emission timestamp. */
1791
1905
  emittedAt: string;
1792
1906
  };
1907
+ LiveStreamRecord: components["schemas"]["LiveStreamHello"] | components["schemas"]["LiveStreamBatch"] | components["schemas"]["StreamHeartbeat"] | components["schemas"]["StreamFailure"];
1908
+ LiveStreamHello: {
1909
+ /** @constant */
1910
+ type: "hello";
1911
+ /** @constant */
1912
+ apiVersion: "1";
1913
+ chainId: components["schemas"]["SafeInteger"];
1914
+ processor: components["schemas"]["ProcessorSummary"];
1915
+ streamId: string;
1916
+ /** @constant */
1917
+ streamKind: "live";
1918
+ acknowledgedCursor: components["schemas"]["Cursor"];
1919
+ storeEpoch: string;
1920
+ heartbeatIntervalMs: components["schemas"]["DecimalQuantity"];
1921
+ /** @description Send as `x-leani-consumer-session` to acknowledge, renew, or release. */
1922
+ sessionToken: string;
1923
+ sessionExpiresAtUnixMs: components["schemas"]["DecimalQuantity"];
1924
+ leaseTtlMs: components["schemas"]["DecimalQuantity"];
1925
+ /** @description What the processor covers as the session starts, to diff against the destination. */
1926
+ coverage: components["schemas"]["ProcessorCoverage"];
1927
+ };
1928
+ LiveStreamBatch: {
1929
+ /** @constant */
1930
+ type: "batch";
1931
+ streamId: string;
1932
+ /** @enum {string} */
1933
+ originKind: "live" | "live_recovery";
1934
+ originId: string;
1935
+ publicationRevision: components["schemas"]["DecimalQuantity"];
1936
+ fromBlock: components["schemas"]["SafeInteger"];
1937
+ throughBlock: components["schemas"]["SafeInteger"];
1938
+ processedBlockCount: components["schemas"]["DecimalQuantity"];
1939
+ /** @description Changes other than `system.*` kinds. */
1940
+ domainChangeCount: components["schemas"]["DecimalQuantity"];
1941
+ progressUnitCount: components["schemas"]["DecimalQuantity"];
1942
+ rawPayloadBytes: components["schemas"]["DecimalQuantity"];
1943
+ uncompressedEncodedBytes: components["schemas"]["DecimalQuantity"];
1944
+ transmittedBytes: components["schemas"]["DecimalQuantity"];
1945
+ buildDelayMs: components["schemas"]["DecimalQuantity"];
1946
+ firstCursor: components["schemas"]["Cursor"];
1947
+ lastCursor: components["schemas"]["Cursor"];
1948
+ acknowledgeableCursor: components["schemas"]["Cursor"];
1949
+ changes: components["schemas"]["ChangeEnvelope"][];
1950
+ };
1951
+ StreamHeartbeat: {
1952
+ /** @constant */
1953
+ type: "heartbeat";
1954
+ emittedAt: string;
1955
+ };
1956
+ StreamFailure: {
1957
+ /** @enum {string} */
1958
+ type: "error" | "reset_required";
1959
+ code: string;
1960
+ message: string;
1961
+ earliestAvailableSequence: components["schemas"]["DecimalQuantity"] | null;
1962
+ latestAvailableSequence: components["schemas"]["DecimalQuantity"] | null;
1963
+ };
1793
1964
  ChangeHead: {
1794
1965
  earliestSequence: components["schemas"]["DecimalQuantity"] | null;
1795
1966
  latestSequence: components["schemas"]["DecimalQuantity"] | null;
@@ -2864,12 +3035,21 @@ export interface operations {
2864
3035
  };
2865
3036
  requestBody?: never;
2866
3037
  responses: {
2867
- /** @description Server-sent live-lane batches. */
3038
+ /**
3039
+ * @description Newline-delimited JSON records: first a `hello` with the
3040
+ * processor's coverage as the session starts, then whole-block
3041
+ * `batch` records and, while idle, `heartbeat` records. An `error`
3042
+ * or `reset_required` record ends the stream. A batch of a
3043
+ * `system.live_gap.put` change announces blocks the live lane
3044
+ * skipped and did not fill.
3045
+ */
2868
3046
  200: {
2869
3047
  headers: {
2870
3048
  [name: string]: unknown;
2871
3049
  };
2872
- content?: never;
3050
+ content: {
3051
+ "application/x-ndjson": components["schemas"]["LiveStreamRecord"];
3052
+ };
2873
3053
  };
2874
3054
  default: components["responses"]["Error"];
2875
3055
  };
@@ -3268,7 +3448,11 @@ export interface operations {
3268
3448
  headers: {
3269
3449
  [name: string]: unknown;
3270
3450
  };
3271
- content?: never;
3451
+ content: {
3452
+ "application/json": {
3453
+ data: components["schemas"]["BackfillStatus"][];
3454
+ };
3455
+ };
3272
3456
  };
3273
3457
  default: components["responses"]["Error"];
3274
3458
  };
@@ -3287,7 +3471,9 @@ export interface operations {
3287
3471
  headers: {
3288
3472
  [name: string]: unknown;
3289
3473
  };
3290
- content?: never;
3474
+ content: {
3475
+ "application/json": components["schemas"]["BackfillStatus"];
3476
+ };
3291
3477
  };
3292
3478
  default: components["responses"]["Error"];
3293
3479
  };
@@ -3308,14 +3494,23 @@ export interface operations {
3308
3494
  headers: {
3309
3495
  [name: string]: unknown;
3310
3496
  };
3311
- content?: never;
3497
+ content: {
3498
+ "application/json": components["schemas"]["BackfillStatus"];
3499
+ };
3312
3500
  };
3313
3501
  default: components["responses"]["Error"];
3314
3502
  };
3315
3503
  };
3316
3504
  deleteBackfillSubscription: {
3317
3505
  parameters: {
3318
- query?: never;
3506
+ query?: {
3507
+ /**
3508
+ * @description Delete a failed or cancelled subscription although its required
3509
+ * consumer has not acknowledged every record. Has no effect on a
3510
+ * subscription that is still running.
3511
+ */
3512
+ discardUnacknowledged?: boolean;
3513
+ };
3319
3514
  header?: {
3320
3515
  /**
3321
3516
  * @description Marks a mutating request without a JSON body as sent by a Leani
@@ -3341,6 +3536,36 @@ export interface operations {
3341
3536
  default: components["responses"]["Error"];
3342
3537
  };
3343
3538
  };
3539
+ retryBackfillSubscription: {
3540
+ parameters: {
3541
+ query?: never;
3542
+ header?: {
3543
+ /**
3544
+ * @description Marks a mutating request without a JSON body as sent by a Leani
3545
+ * client. A POST or DELETE needs `content-type: application/json` or
3546
+ * this header, and gets HTTP 415 otherwise.
3547
+ */
3548
+ "x-leani-request"?: components["parameters"]["LeaniRequest"];
3549
+ };
3550
+ path: {
3551
+ id: components["parameters"]["Identifier"];
3552
+ };
3553
+ cookie?: never;
3554
+ };
3555
+ requestBody?: never;
3556
+ responses: {
3557
+ /** @description Retried backfill subscription. */
3558
+ 200: {
3559
+ headers: {
3560
+ [name: string]: unknown;
3561
+ };
3562
+ content: {
3563
+ "application/json": components["schemas"]["BackfillStatus"];
3564
+ };
3565
+ };
3566
+ default: components["responses"]["Error"];
3567
+ };
3568
+ };
3344
3569
  cancelBackfillSubscription: {
3345
3570
  parameters: {
3346
3571
  query?: never;
@@ -3364,7 +3589,9 @@ export interface operations {
3364
3589
  headers: {
3365
3590
  [name: string]: unknown;
3366
3591
  };
3367
- content?: never;
3592
+ content: {
3593
+ "application/json": components["schemas"]["BackfillStatus"];
3594
+ };
3368
3595
  };
3369
3596
  default: components["responses"]["Error"];
3370
3597
  };
@@ -3383,7 +3610,11 @@ export interface operations {
3383
3610
  headers: {
3384
3611
  [name: string]: unknown;
3385
3612
  };
3386
- content?: never;
3613
+ content: {
3614
+ "application/json": {
3615
+ data: components["schemas"]["BackfillStatus"][];
3616
+ };
3617
+ };
3387
3618
  };
3388
3619
  default: components["responses"]["Error"];
3389
3620
  };
@@ -3402,7 +3633,9 @@ export interface operations {
3402
3633
  headers: {
3403
3634
  [name: string]: unknown;
3404
3635
  };
3405
- content?: never;
3636
+ content: {
3637
+ "application/json": components["schemas"]["BackfillStatus"];
3638
+ };
3406
3639
  };
3407
3640
  default: components["responses"]["Error"];
3408
3641
  };
@@ -3423,7 +3656,9 @@ export interface operations {
3423
3656
  headers: {
3424
3657
  [name: string]: unknown;
3425
3658
  };
3426
- content?: never;
3659
+ content: {
3660
+ "application/json": components["schemas"]["BackfillStatus"];
3661
+ };
3427
3662
  };
3428
3663
  default: components["responses"]["Error"];
3429
3664
  };
@@ -3479,7 +3714,9 @@ export interface operations {
3479
3714
  headers: {
3480
3715
  [name: string]: unknown;
3481
3716
  };
3482
- content?: never;
3717
+ content: {
3718
+ "application/json": components["schemas"]["BackfillStatus"];
3719
+ };
3483
3720
  };
3484
3721
  default: components["responses"]["Error"];
3485
3722
  };