@vxil/sdk 0.19.0 → 0.20.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.
- package/dist/index.d.ts +47 -0
- package/dist/index.js +20 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -885,6 +885,33 @@ export interface PaymentsCharge {
|
|
|
885
885
|
environment: PaymentsEventEnvironment;
|
|
886
886
|
created_at: string;
|
|
887
887
|
}
|
|
888
|
+
/** A credit ledger row as listed by GET /v1/payments/credits/ledger (2026-10-05). */
|
|
889
|
+
export interface PaymentsLedgerEntry {
|
|
890
|
+
/** `led_…` */
|
|
891
|
+
ledger_entry_id: string;
|
|
892
|
+
user_id: string;
|
|
893
|
+
credit_type: string;
|
|
894
|
+
/** grant / grant_once add credits; consume and expire remove them; settle and
|
|
895
|
+
* reversal correct a job-linked consume (`reverses_entry_id` names it) */
|
|
896
|
+
kind: 'grant' | 'grant_once' | 'consume' | 'settle' | 'reversal' | 'expire';
|
|
897
|
+
/** `provisional` = a job-linked hold not settled yet */
|
|
898
|
+
state: 'provisional' | 'committed' | 'reversed';
|
|
899
|
+
/** `insufficient` = a recorded 402 consume (no balance moved) */
|
|
900
|
+
outcome: 'applied' | 'insufficient';
|
|
901
|
+
/** the signed amount: positive adds credits, negative removes them */
|
|
902
|
+
delta: number;
|
|
903
|
+
balance_after: number | null;
|
|
904
|
+
source: string | null;
|
|
905
|
+
/** the jobs run this row is linked to */
|
|
906
|
+
job_id: string | null;
|
|
907
|
+
/** on a settle / reversal: the consume entry it corrects */
|
|
908
|
+
reverses_entry_id: string | null;
|
|
909
|
+
/** the grant-once dedup key */
|
|
910
|
+
grant_key: string | null;
|
|
911
|
+
/** the Idempotency-Key the consume / grant was sent with */
|
|
912
|
+
idempotency_key: string | null;
|
|
913
|
+
created_at: string;
|
|
914
|
+
}
|
|
888
915
|
/** A refund row as listed by GET /v1/payments/refunds (2026-10-01). */
|
|
889
916
|
export interface PaymentsRefund {
|
|
890
917
|
/** `ref_…` — what `createRefund` returned, and what a 502 / `payments.refund.failed`
|
|
@@ -6311,6 +6338,26 @@ export declare class Vxil<S extends VxilSchemaShape = VxilSchemaShape> {
|
|
|
6311
6338
|
created_at: string;
|
|
6312
6339
|
}>;
|
|
6313
6340
|
}>;
|
|
6341
|
+
/** (2026-10-05) The credit ledger ACROSS users, OLDEST first — for
|
|
6342
|
+
* reconciliation or a warehouse sync. Keyset-paged: pass the prior page's
|
|
6343
|
+
* `next_cursor` as `cursor` until it is null; start at `since` (inclusive
|
|
6344
|
+
* ISO-8601). To tail later, start a new walk with `since` = the last
|
|
6345
|
+
* `created_at` you stored MINUS an overlap (a minute) and dedupe on
|
|
6346
|
+
* `ledger_entry_id` — `created_at` is the writing transaction's start, so
|
|
6347
|
+
* a slow transaction can commit a row behind one already listed. `limit` 1..500 (default 100).
|
|
6348
|
+
* Needs payments:read. SERVER-SIDE KEYS ONLY — a thin-client
|
|
6349
|
+
* (`end_user_required`) key gets 403 `server_only` (use `usage` for one
|
|
6350
|
+
* user's own rows). */
|
|
6351
|
+
ledger: (q?: {
|
|
6352
|
+
since?: string;
|
|
6353
|
+
cursor?: string;
|
|
6354
|
+
user_id?: string;
|
|
6355
|
+
credit_type?: string;
|
|
6356
|
+
limit?: number;
|
|
6357
|
+
}) => Promise<{
|
|
6358
|
+
entries: PaymentsLedgerEntry[];
|
|
6359
|
+
next_cursor: string | null;
|
|
6360
|
+
}>;
|
|
6314
6361
|
/** Start a subscription (mock = instant checkout; real providers redirect via
|
|
6315
6362
|
* their own flow). `tier` keys the tierMap fold; `price_ref` is your catalog
|
|
6316
6363
|
* ref. Returns the vxil subscription_id + provider sub id + status. */
|
package/dist/index.js
CHANGED
|
@@ -2460,6 +2460,26 @@ export class Vxil {
|
|
|
2460
2460
|
});
|
|
2461
2461
|
return (await this.call('GET', `/v1/payments/usage${s}`)).data;
|
|
2462
2462
|
},
|
|
2463
|
+
/** (2026-10-05) The credit ledger ACROSS users, OLDEST first — for
|
|
2464
|
+
* reconciliation or a warehouse sync. Keyset-paged: pass the prior page's
|
|
2465
|
+
* `next_cursor` as `cursor` until it is null; start at `since` (inclusive
|
|
2466
|
+
* ISO-8601). To tail later, start a new walk with `since` = the last
|
|
2467
|
+
* `created_at` you stored MINUS an overlap (a minute) and dedupe on
|
|
2468
|
+
* `ledger_entry_id` — `created_at` is the writing transaction's start, so
|
|
2469
|
+
* a slow transaction can commit a row behind one already listed. `limit` 1..500 (default 100).
|
|
2470
|
+
* Needs payments:read. SERVER-SIDE KEYS ONLY — a thin-client
|
|
2471
|
+
* (`end_user_required`) key gets 403 `server_only` (use `usage` for one
|
|
2472
|
+
* user's own rows). */
|
|
2473
|
+
ledger: async (q) => {
|
|
2474
|
+
const suffix = qs({
|
|
2475
|
+
since: q?.since || undefined,
|
|
2476
|
+
cursor: q?.cursor || undefined,
|
|
2477
|
+
user_id: q?.user_id || undefined,
|
|
2478
|
+
credit_type: q?.credit_type || undefined,
|
|
2479
|
+
limit: q?.limit || undefined,
|
|
2480
|
+
});
|
|
2481
|
+
return (await this.call('GET', `/v1/payments/credits/ledger${suffix}`)).data;
|
|
2482
|
+
},
|
|
2463
2483
|
/** Start a subscription (mock = instant checkout; real providers redirect via
|
|
2464
2484
|
* their own flow). `tier` keys the tierMap fold; `price_ref` is your catalog
|
|
2465
2485
|
* ref. Returns the vxil subscription_id + provider sub id + status. */
|
package/package.json
CHANGED