@dvmkit/sdk 0.3.3-rc.10 → 0.4.0-rc.1

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 (51) hide show
  1. package/dist/{chunk-C2AGARLM.js → chunk-2VGWYG4P.js} +5 -3
  2. package/dist/{chunk-A4CM2BD3.js → chunk-3MHE725Z.js} +1 -1
  3. package/dist/{chunk-VAMSJRJT.js → chunk-5LR6P7WN.js} +5 -3
  4. package/dist/{chunk-YYQG4R7T.js → chunk-74PUEZJ4.js} +6 -4
  5. package/dist/{chunk-MKI6OVW4.js → chunk-CZULM42S.js} +0 -51
  6. package/dist/{chunk-M4QDXD2A.js → chunk-FYRR2UEZ.js} +1 -1
  7. package/dist/{chunk-4UZN2GP5.js → chunk-GAOAYHZA.js} +209 -33
  8. package/dist/{chunk-Z4BNLUZF.js → chunk-IWQHUSMO.js} +3 -105
  9. package/dist/{chunk-4J32DTLT.js → chunk-IXR5RFK7.js} +82 -4
  10. package/dist/{chunk-2SD2W2BG.js → chunk-JH3SX3LY.js} +252 -26
  11. package/dist/{chunk-UZC4A4DM.js → chunk-K2YX2VRA.js} +2480 -206
  12. package/dist/chunk-KA6VN5FK.js +245 -0
  13. package/dist/chunk-LIRAHP7B.js +53 -0
  14. package/dist/{chunk-MG67KXU7.js → chunk-MZRJR2CW.js} +4 -2
  15. package/dist/{chunk-JDFLRNAZ.js → chunk-PB4FYZET.js} +67 -7
  16. package/dist/{chunk-BQ2NMWKE.js → chunk-PLG4XER6.js} +1 -1
  17. package/dist/{chunk-Z3EHBW2G.js → chunk-R4DQZFAL.js} +7 -5
  18. package/dist/chunk-RLTSCKRI.js +109 -0
  19. package/dist/{chunk-2KGG5ORW.js → chunk-TXX4GOUB.js} +3 -3
  20. package/dist/{chunk-YRDA7EWN.js → chunk-W2EQGDF5.js} +14 -10
  21. package/dist/{chunk-EAMZZ2B4.js → chunk-X7EZ5CLI.js} +59 -0
  22. package/dist/{chunk-7X6UDVCQ.js → chunk-Z4ZT5LNT.js} +66 -2
  23. package/dist/{credit-ledger-A35WH2TI.js → credit-ledger-MI2H7NEC.js} +3 -1
  24. package/dist/{credit-menu-0-UtJ3hh.d.ts → credit-menu-B8_p_vUz.d.ts} +133 -7
  25. package/dist/{fx-DhyT1Cjh.d.ts → fx-DuaYHvVn.d.ts} +1 -1
  26. package/dist/index.d.ts +6 -6
  27. package/dist/internal/caller.d.ts +15 -7
  28. package/dist/internal/caller.js +36 -24
  29. package/dist/internal/index.js +1 -1
  30. package/dist/internal/server.d.ts +11 -85
  31. package/dist/internal/server.js +18 -16
  32. package/dist/{job-store-D3CcZp_g.d.ts → job-store-D6Rjj5Oi.d.ts} +1 -1
  33. package/dist/{lightning-backend-BhsyrBLa.d.ts → lightning-backend-BaeCPmx7.d.ts} +1 -1
  34. package/dist/{memory-credit-ledger-2LBZVMKJ.js → memory-credit-ledger-W2BAUYJP.js} +4 -2
  35. package/dist/{mpp-setup-7CGBKNUP.js → mpp-setup-RF5FXGGV.js} +5 -1
  36. package/dist/{payout-reporter-ZMOA37GN.js → payout-reporter-3Y2U55ZX.js} +1 -1
  37. package/dist/{postgres-job-store-MSD2HZOI.js → postgres-job-store-VLXLWXUQ.js} +1 -1
  38. package/dist/{revenue-reporter-EKJOGQYR.js → revenue-reporter-MAERPYGK.js} +1 -1
  39. package/dist/server/index.d.ts +14 -10
  40. package/dist/server/index.js +54 -17
  41. package/dist/{step-cache-v2yhyhSZ.d.ts → step-cache-Bi43A0JN.d.ts} +1769 -1549
  42. package/dist/{tempo-charge-store-4WX7FPOV.js → tempo-charge-store-Q3D7KYMH.js} +1 -1
  43. package/dist/tempo-lifecycle-OTHV757Y.js +14 -0
  44. package/dist/{tempo-session-store-LCSDHB7G.js → tempo-session-store-ZRNCOX7P.js} +1 -1
  45. package/dist/{tempo-wallet-RCGBBAJH.js → tempo-wallet-32JWQZKQ.js} +4 -3
  46. package/dist/testing/index.d.ts +3 -3
  47. package/dist/{usd-Cu9G6xv2.d.ts → usd-AZPVq4eU.d.ts} +1 -1
  48. package/dist/{x402-S47Q77UE.js → x402-CEDHGZDI.js} +17 -14
  49. package/package.json +1 -1
  50. package/dist/chunk-YHN3WMMF.js +0 -122
  51. package/dist/tempo-lifecycle-TJ62A7UX.js +0 -13
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PostgresTempoChargeStore
3
- } from "./chunk-YHN3WMMF.js";
3
+ } from "./chunk-KA6VN5FK.js";
4
4
  import "./chunk-YG7G4DPZ.js";
5
5
  import "./chunk-COYKJRMM.js";
6
6
  import "./chunk-ETXDTUJO.js";
@@ -0,0 +1,14 @@
1
+ import {
2
+ assertTempoWalletIdle
3
+ } from "./chunk-R4DQZFAL.js";
4
+ import "./chunk-74PUEZJ4.js";
5
+ import "./chunk-2VGWYG4P.js";
6
+ import "./chunk-MZRJR2CW.js";
7
+ import "./chunk-3MHE725Z.js";
8
+ import "./chunk-CZULM42S.js";
9
+ import "./chunk-FUJ36YDV.js";
10
+ import "./chunk-AT6V3SY7.js";
11
+ import "./chunk-LIRAHP7B.js";
12
+ export {
13
+ assertTempoWalletIdle
14
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PostgresTempoSessionStore,
3
3
  assertMonotonicTransition
4
- } from "./chunk-EAMZZ2B4.js";
4
+ } from "./chunk-X7EZ5CLI.js";
5
5
  import "./chunk-YG7G4DPZ.js";
6
6
  import "./chunk-COYKJRMM.js";
7
7
  import "./chunk-P6QON7ER.js";
@@ -15,10 +15,11 @@ import {
15
15
  tempoTokenReference,
16
16
  tempoWrongAssetHint,
17
17
  tryResolveTempoAsset
18
- } from "./chunk-YYQG4R7T.js";
19
- import "./chunk-MG67KXU7.js";
20
- import "./chunk-MKI6OVW4.js";
18
+ } from "./chunk-74PUEZJ4.js";
19
+ import "./chunk-MZRJR2CW.js";
20
+ import "./chunk-CZULM42S.js";
21
21
  import "./chunk-FUJ36YDV.js";
22
+ import "./chunk-LIRAHP7B.js";
22
23
  export {
23
24
  TEMPO_CHAIN_ID,
24
25
  TEMPO_MODERATO_CHAIN_ID,
@@ -1,12 +1,12 @@
1
- import { Y as JobReceipt, a1 as Message, a2 as MessageType, K as KVStore, L as Logger, u as ResponseContent, P as PaymentContent, S as SDKJobContext } from '../step-cache-v2yhyhSZ.js';
2
- import { c as StreamableJobStore, R as ReceiptIssuingStore, J as JobRecord, d as RequestIdClaim, e as RequestIdClaimResult, f as JobRetentionCursor, O as OutgoingMessage, A as AppendOutgoingOptions, P as PaymentCreditDelta, V as VerifyAndCreditResult, g as JobCounters } from '../job-store-D3CcZp_g.js';
1
+ import { Y as JobReceipt, a1 as Message, a2 as MessageType, K as KVStore, L as Logger, u as ResponseContent, P as PaymentContent, S as SDKJobContext } from '../step-cache-Bi43A0JN.js';
2
+ import { c as StreamableJobStore, R as ReceiptIssuingStore, J as JobRecord, d as RequestIdClaim, e as RequestIdClaimResult, f as JobRetentionCursor, O as OutgoingMessage, A as AppendOutgoingOptions, P as PaymentCreditDelta, V as VerifyAndCreditResult, g as JobCounters } from '../job-store-D6Rjj5Oi.js';
3
3
  import 'hono';
4
4
  import 'mppx';
5
5
  import '@x402/core/server';
6
6
  import '@x402/evm/batch-settlement/server';
7
- import 'viem';
8
7
  import 'pg';
9
8
  import '@x402/core/types';
9
+ import 'viem';
10
10
  import 'zod';
11
11
  import '@cashu/cashu-ts';
12
12
 
@@ -1,4 +1,4 @@
1
- import { C as Currency } from './step-cache-v2yhyhSZ.js';
1
+ import { C as Currency } from './step-cache-Bi43A0JN.js';
2
2
 
3
3
  /**
4
4
  * Thrown by `fiatToSatsCeil` / `satsToFiat` when the supplied `ratePerBtc` is
@@ -10,20 +10,18 @@ import {
10
10
  saveX402Wallet,
11
11
  tryX402Payment,
12
12
  x402WrongAssetHint
13
- } from "./chunk-YRDA7EWN.js";
14
- import "./chunk-C2AGARLM.js";
15
- import "./chunk-MG67KXU7.js";
13
+ } from "./chunk-W2EQGDF5.js";
14
+ import "./chunk-2VGWYG4P.js";
15
+ import "./chunk-MZRJR2CW.js";
16
16
  import {
17
17
  verifyX402Payment
18
- } from "./chunk-2KGG5ORW.js";
19
- import "./chunk-BQ2NMWKE.js";
18
+ } from "./chunk-TXX4GOUB.js";
19
+ import "./chunk-PLG4XER6.js";
20
20
  import {
21
21
  X402_DEFAULT_FACILITATOR,
22
22
  X402_DEFAULT_NETWORK,
23
- X402_NETWORKS,
24
23
  X402_V1_VERSION,
25
24
  X402_VERSION,
26
- assertSupportedX402Network,
27
25
  buildPaymentRequiredV2,
28
26
  buildPaymentRequirements,
29
27
  caip2ToX402Network,
@@ -36,17 +34,22 @@ import {
36
34
  exactEvmAuthorization,
37
35
  paymentRequiredV2FromV1,
38
36
  usdcContractByCaip2,
37
+ x402NetworkToCaip2
38
+ } from "./chunk-IWQHUSMO.js";
39
+ import "./chunk-3MHE725Z.js";
40
+ import "./chunk-CZULM42S.js";
41
+ import "./chunk-66HGCPBU.js";
42
+ import "./chunk-FUJ36YDV.js";
43
+ import "./chunk-AT6V3SY7.js";
44
+ import {
45
+ X402_NETWORKS,
46
+ assertSupportedX402Network,
39
47
  x402NetworkByCaip2,
40
48
  x402NetworkLabel,
41
49
  x402NetworkListForCopy,
42
- x402NetworkToCaip2,
43
50
  x402SupportedNetworksHint
44
- } from "./chunk-Z4BNLUZF.js";
45
- import "./chunk-A4CM2BD3.js";
46
- import "./chunk-MKI6OVW4.js";
47
- import "./chunk-66HGCPBU.js";
48
- import "./chunk-FUJ36YDV.js";
49
- import "./chunk-AT6V3SY7.js";
51
+ } from "./chunk-RLTSCKRI.js";
52
+ import "./chunk-LIRAHP7B.js";
50
53
  export {
51
54
  X402_DEFAULT_FACILITATOR,
52
55
  X402_DEFAULT_NETWORK,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dvmkit/sdk",
3
- "version": "0.3.3-rc.10",
3
+ "version": "0.4.0-rc.1",
4
4
  "description": "SDK for building accountless, pay-per-use Digital Vending Machines",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1,122 +0,0 @@
1
- import {
2
- parseStoreValue,
3
- stringifyStoreValue
4
- } from "./chunk-YG7G4DPZ.js";
5
- import {
6
- withSdkInitLock
7
- } from "./chunk-COYKJRMM.js";
8
- import {
9
- diagnosticConsole
10
- } from "./chunk-ETXDTUJO.js";
11
-
12
- // src/sdk/server/tempo-charge-store.ts
13
- var DEFAULT_TABLE_NAME = "mpp_tempo_charge_replays";
14
- var DEFAULT_RETENTION_MS = 60 * 60 * 1e3;
15
- var DEFAULT_GC_SAMPLE_RATE = 0.01;
16
- var VALID_IDENTIFIER = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
17
- var PostgresTempoChargeStore = class {
18
- pool;
19
- tableName;
20
- retentionMs;
21
- gcSampleRate;
22
- now;
23
- constructor(pool, opts) {
24
- const tableName = opts?.tableName ?? DEFAULT_TABLE_NAME;
25
- if (!VALID_IDENTIFIER.test(tableName)) {
26
- throw new Error(
27
- `PostgresTempoChargeStore: tableName must match ${VALID_IDENTIFIER.source}, got "${tableName}"`
28
- );
29
- }
30
- this.pool = pool;
31
- this.tableName = tableName;
32
- this.retentionMs = opts?.retentionMs ?? DEFAULT_RETENTION_MS;
33
- this.gcSampleRate = opts?.gcSampleRate ?? DEFAULT_GC_SAMPLE_RATE;
34
- this.now = opts?.now ?? (() => Date.now());
35
- this.get = this.get.bind(this);
36
- this.put = this.put.bind(this);
37
- this.delete = this.delete.bind(this);
38
- this.update = this.update.bind(this);
39
- }
40
- /** Run the CREATE TABLE migration. Idempotent — safe to call repeatedly. */
41
- async init() {
42
- await withSdkInitLock(this.pool, () => this.createTables());
43
- }
44
- /** Read one stored value, or `null` when absent — mppx's miss sentinel. */
45
- async get(key) {
46
- const { rows } = await this.pool.query(
47
- `SELECT value_json FROM ${this.tableName} WHERE store_key = $1`,
48
- [key]
49
- );
50
- return rows[0] ? parseStoreValue(rows[0].value_json) : null;
51
- }
52
- async put(key, value) {
53
- await this.update(key, () => ({ op: "set", value, result: void 0 }));
54
- }
55
- /** Delete one stored value — mppx's compensating release on a failed broadcast. */
56
- async delete(key) {
57
- await this.update(key, () => ({ op: "delete", result: void 0 }));
58
- }
59
- /**
60
- * Advisory locking covers the absent-row first write before the row lock.
61
- * Both competing presentations of one credential and the shared sponsor
62
- * budget need this serialization. The transaction contains no chain call.
63
- */
64
- async update(key, fn) {
65
- const client = await this.pool.connect();
66
- try {
67
- await client.query("BEGIN");
68
- await client.query(`SELECT pg_advisory_xact_lock(hashtextextended($1, 2036))`, [key]);
69
- const { rows } = await client.query(
70
- `SELECT value_json FROM ${this.tableName} WHERE store_key = $1 FOR UPDATE`,
71
- [key]
72
- );
73
- const current = rows[0] ? parseStoreValue(rows[0].value_json) : null;
74
- const change = fn(current);
75
- const now = this.now();
76
- if (change.op === "set") {
77
- await client.query(
78
- `INSERT INTO ${this.tableName} (store_key, value_json, expires_at)
79
- VALUES ($1, $2, $3)
80
- ON CONFLICT (store_key) DO UPDATE
81
- SET value_json = EXCLUDED.value_json, expires_at = EXCLUDED.expires_at`,
82
- [
83
- key,
84
- stringifyStoreValue(change.value, "Tempo charge store value"),
85
- now + this.retentionMs
86
- ]
87
- );
88
- } else if (change.op === "delete") {
89
- await client.query(`DELETE FROM ${this.tableName} WHERE store_key = $1`, [key]);
90
- }
91
- await client.query("COMMIT");
92
- if (change.op !== "noop") this.maybeSweep(now);
93
- return change.result;
94
- } catch (error) {
95
- await client.query("ROLLBACK").catch(() => void 0);
96
- throw error;
97
- } finally {
98
- client.release();
99
- }
100
- }
101
- async createTables() {
102
- await this.pool.query(`
103
- CREATE TABLE IF NOT EXISTS ${this.tableName} (
104
- store_key TEXT PRIMARY KEY,
105
- value_json TEXT NOT NULL,
106
- expires_at BIGINT NOT NULL
107
- );
108
- CREATE INDEX IF NOT EXISTS ${this.tableName}_expires_at_idx
109
- ON ${this.tableName} (expires_at);
110
- `);
111
- }
112
- maybeSweep(now) {
113
- if (this.gcSampleRate <= 0 || Math.random() >= this.gcSampleRate) return;
114
- this.pool.query(`DELETE FROM ${this.tableName} WHERE expires_at < $1`, [now]).catch((err) => {
115
- diagnosticConsole.error("PostgresTempoChargeStore GC sweep failed:", err);
116
- });
117
- }
118
- };
119
-
120
- export {
121
- PostgresTempoChargeStore
122
- };
@@ -1,13 +0,0 @@
1
- import {
2
- assertTempoWalletIdle
3
- } from "./chunk-Z3EHBW2G.js";
4
- import "./chunk-YYQG4R7T.js";
5
- import "./chunk-C2AGARLM.js";
6
- import "./chunk-MG67KXU7.js";
7
- import "./chunk-A4CM2BD3.js";
8
- import "./chunk-MKI6OVW4.js";
9
- import "./chunk-FUJ36YDV.js";
10
- import "./chunk-AT6V3SY7.js";
11
- export {
12
- assertTempoWalletIdle
13
- };