@totemsdk/edge-adapters 0.2.0 → 0.3.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.
Files changed (66) hide show
  1. package/dist/artifact-cache.d.ts +36 -0
  2. package/dist/artifact-cache.js +79 -0
  3. package/dist/cjs/artifact-cache.d.ts +36 -0
  4. package/dist/cjs/artifact-cache.js +82 -0
  5. package/dist/cjs/identity.d.ts +19 -0
  6. package/dist/cjs/identity.js +61 -0
  7. package/dist/cjs/index.d.ts +25 -0
  8. package/dist/cjs/index.js +41 -0
  9. package/dist/cjs/liquidity.d.ts +15 -0
  10. package/dist/cjs/liquidity.js +45 -0
  11. package/dist/cjs/location.d.ts +48 -0
  12. package/dist/cjs/location.js +208 -0
  13. package/dist/cjs/lookup.d.ts +13 -0
  14. package/dist/cjs/lookup.js +96 -0
  15. package/dist/cjs/manifest.d.ts +11 -0
  16. package/dist/cjs/manifest.js +36 -0
  17. package/dist/cjs/negotiation-transport.d.ts +50 -0
  18. package/dist/cjs/negotiation-transport.js +122 -0
  19. package/dist/cjs/omnia.d.ts +7 -0
  20. package/dist/cjs/omnia.js +46 -0
  21. package/dist/cjs/package.json +1 -0
  22. package/dist/cjs/payment-l1.d.ts +38 -0
  23. package/dist/cjs/payment-l1.js +46 -0
  24. package/dist/cjs/payment-l2.d.ts +39 -0
  25. package/dist/cjs/payment-l2.js +54 -0
  26. package/dist/cjs/policy.d.ts +13 -0
  27. package/dist/cjs/policy.js +95 -0
  28. package/dist/cjs/proof.d.ts +48 -0
  29. package/dist/cjs/proof.js +88 -0
  30. package/dist/cjs/pubsub.d.ts +11 -0
  31. package/dist/cjs/pubsub.js +30 -0
  32. package/dist/cjs/purchase-authority.d.ts +42 -0
  33. package/dist/cjs/purchase-authority.js +79 -0
  34. package/dist/cjs/purchase-lookup.d.ts +44 -0
  35. package/dist/cjs/purchase-lookup.js +60 -0
  36. package/dist/cjs/purchase-payment.d.ts +78 -0
  37. package/dist/cjs/purchase-payment.js +108 -0
  38. package/dist/cjs/sqlite-commerce-store.d.ts +69 -0
  39. package/dist/cjs/sqlite-commerce-store.js +416 -0
  40. package/dist/cjs/stream.d.ts +7 -0
  41. package/dist/cjs/stream.js +26 -0
  42. package/dist/identity.js +4 -7
  43. package/dist/index.d.ts +6 -0
  44. package/dist/index.js +18 -27
  45. package/dist/liquidity.js +1 -4
  46. package/dist/location.js +10 -13
  47. package/dist/lookup.js +3 -6
  48. package/dist/manifest.js +5 -7
  49. package/dist/negotiation-transport.d.ts +50 -0
  50. package/dist/negotiation-transport.js +118 -0
  51. package/dist/omnia.js +1 -4
  52. package/dist/payment-l1.js +1 -4
  53. package/dist/payment-l2.js +5 -8
  54. package/dist/policy.js +1 -4
  55. package/dist/proof.js +7 -10
  56. package/dist/pubsub.js +1 -4
  57. package/dist/purchase-authority.d.ts +42 -0
  58. package/dist/purchase-authority.js +76 -0
  59. package/dist/purchase-lookup.d.ts +44 -0
  60. package/dist/purchase-lookup.js +57 -0
  61. package/dist/purchase-payment.d.ts +78 -0
  62. package/dist/purchase-payment.js +105 -0
  63. package/dist/sqlite-commerce-store.d.ts +69 -0
  64. package/dist/sqlite-commerce-store.js +411 -0
  65. package/dist/stream.js +1 -4
  66. package/package.json +37 -26
@@ -0,0 +1,411 @@
1
+ /**
2
+ * sqlite-commerce-store.ts — Production SQLite-backed CommerceStore.
3
+ *
4
+ * Implements the five durable commerce contracts over ONE SQLite database:
5
+ * NegotiationStore, PurchaseStore, ReplayLedger, PrincipalNegotiationStore,
6
+ * OutboxStore.
7
+ *
8
+ * The database connection, journal/busy pragmas, transaction lifecycle, and
9
+ * CAS kinematics are owned by the shared `SqliteStore` primitive from
10
+ * `@totemsdk/storage/sqlite` (RFC-007 §4.2). All consumer mutations run through
11
+ * `transactionalSync` (atomic multi-statement batches) or the generalized
12
+ * `transitionAndEnqueue` (revision-CAS update + outbox-style enqueue in one
13
+ * commit). Table schemas and row shapes are unchanged ("records unchanged in
14
+ * shape").
15
+ *
16
+ * The critical guarantee — `transitionAndEnqueue` (negotiation CAS + outbox
17
+ * enqueue) — maps to ONE transaction on the shared primitive:
18
+ *
19
+ * BEGIN
20
+ * UPDATE negotiations SET ... WHERE negotiation_id=? AND revision=?
21
+ * INSERT INTO outbox (...) VALUES (...)
22
+ * COMMIT (or ROLLBACK on CAS miss — nothing is enqueued)
23
+ *
24
+ * Uses WAL mode + busy_timeout for concurrent runtime use. Does NOT persist
25
+ * private keys — only stable references/IDs.
26
+ *
27
+ * All statements use positional `?` parameters so the same SQL runs on the
28
+ * real better-sqlite3 native binding and the node:sqlite jest mock.
29
+ */
30
+ import { SqliteStore } from '@totemsdk/storage/sqlite';
31
+ // ─────────────────────────────────────────────────────────────────────────────
32
+ // Serialization helpers
33
+ // ─────────────────────────────────────────────────────────────────────────────
34
+ function toJson(value) {
35
+ return JSON.stringify(value, (_key, v) => (typeof v === 'bigint' ? v.toString() : v));
36
+ }
37
+ function fromJson(json) {
38
+ return JSON.parse(json);
39
+ }
40
+ /** Reconstruct a NegotiationRecord, restoring bigint fields. */
41
+ function rowToNegotiation(row) {
42
+ const record = fromJson(row.record_json);
43
+ return {
44
+ ...record,
45
+ cumulativeWork: BigInt(String(record.cumulativeWork ?? '0')),
46
+ };
47
+ }
48
+ function negotiationToRow(record) {
49
+ return {
50
+ negotiation_id: record.negotiationId,
51
+ record_json: toJson(record),
52
+ revision: record.revision,
53
+ state: record.state,
54
+ principal: record.principal,
55
+ updated_at: record.updatedAt,
56
+ };
57
+ }
58
+ function rowToPurchase(row) {
59
+ return fromJson(row.record_json);
60
+ }
61
+ function purchaseToRow(record) {
62
+ return {
63
+ purchase_id: record.purchaseId,
64
+ record_json: toJson(record),
65
+ revision: record.revision,
66
+ status: record.status,
67
+ updated_at: record.updatedAt,
68
+ };
69
+ }
70
+ function rowToReplay(row) {
71
+ if (row.state === 'COMPLETED') {
72
+ return {
73
+ state: 'COMPLETED',
74
+ outcome: fromJson(row.outcome_json ?? '{}'),
75
+ completedAt: row.completed_at ?? 0,
76
+ };
77
+ }
78
+ return {
79
+ state: 'PROCESSING',
80
+ claimedAt: row.claimed_at,
81
+ ...(row.lease_until !== null ? { leaseUntil: row.lease_until } : {}),
82
+ };
83
+ }
84
+ function rowToOutbox(row) {
85
+ return {
86
+ messageId: row.message_id,
87
+ recipient: row.recipient,
88
+ message: fromJson(row.payload),
89
+ enqueuedAt: row.enqueued_at,
90
+ ...(row.delivered_at !== null ? { deliveredAt: row.delivered_at } : {}),
91
+ attempts: row.attempts,
92
+ };
93
+ }
94
+ // ─────────────────────────────────────────────────────────────────────────────
95
+ // Schema (unchanged — "records unchanged in shape")
96
+ // ─────────────────────────────────────────────────────────────────────────────
97
+ const SCHEMA = `
98
+ CREATE TABLE IF NOT EXISTS negotiations (
99
+ negotiation_id TEXT PRIMARY KEY,
100
+ record_json TEXT NOT NULL,
101
+ revision INTEGER NOT NULL,
102
+ state TEXT NOT NULL,
103
+ principal TEXT NOT NULL,
104
+ updated_at INTEGER NOT NULL
105
+ );
106
+ CREATE INDEX IF NOT EXISTS idx_negotiations_principal ON negotiations(principal);
107
+ CREATE INDEX IF NOT EXISTS idx_negotiations_state ON negotiations(state);
108
+
109
+ CREATE TABLE IF NOT EXISTS purchases (
110
+ purchase_id TEXT PRIMARY KEY,
111
+ record_json TEXT NOT NULL,
112
+ revision INTEGER NOT NULL,
113
+ status TEXT NOT NULL,
114
+ updated_at INTEGER NOT NULL
115
+ );
116
+ CREATE INDEX IF NOT EXISTS idx_purchases_status ON purchases(status);
117
+
118
+ CREATE TABLE IF NOT EXISTS replay (
119
+ message_id TEXT PRIMARY KEY,
120
+ state TEXT NOT NULL,
121
+ claimed_at INTEGER NOT NULL,
122
+ lease_until INTEGER,
123
+ outcome_json TEXT,
124
+ completed_at INTEGER
125
+ );
126
+
127
+ CREATE TABLE IF NOT EXISTS principal_slots (
128
+ principal TEXT NOT NULL,
129
+ negotiation_id TEXT NOT NULL,
130
+ opened_at INTEGER NOT NULL,
131
+ PRIMARY KEY (principal, negotiation_id)
132
+ );
133
+ CREATE INDEX IF NOT EXISTS idx_principal_slots_principal ON principal_slots(principal);
134
+
135
+ CREATE TABLE IF NOT EXISTS principal_cooldown (
136
+ principal TEXT PRIMARY KEY,
137
+ cooldown_until INTEGER NOT NULL
138
+ );
139
+
140
+ CREATE TABLE IF NOT EXISTS outbox (
141
+ message_id TEXT PRIMARY KEY,
142
+ recipient TEXT NOT NULL,
143
+ payload TEXT NOT NULL,
144
+ enqueued_at INTEGER NOT NULL,
145
+ delivered_at INTEGER,
146
+ attempts INTEGER NOT NULL DEFAULT 0
147
+ );
148
+ CREATE INDEX IF NOT EXISTS idx_outbox_undelivered ON outbox(delivered_at);
149
+ `;
150
+ // ─────────────────────────────────────────────────────────────────────────────
151
+ // SQLite CommerceStore
152
+ // ─────────────────────────────────────────────────────────────────────────────
153
+ export class SQLiteCommerceStore {
154
+ constructor(config) {
155
+ this.store = new SqliteStore(config.filename, {
156
+ createKvTable: false,
157
+ wal: config.wal,
158
+ busyTimeoutMs: config.busyTimeoutMs ?? 5000,
159
+ });
160
+ this.store.transactionalSync((tx) => tx.exec(SCHEMA));
161
+ this.negotiations = this.createNegotiationStore();
162
+ this.purchases = this.createPurchaseStore();
163
+ this.replay = this.createReplayLedger();
164
+ this.principals = this.createPrincipalStore();
165
+ this.outbox = this.createOutboxStore();
166
+ }
167
+ close() {
168
+ void this.store.close();
169
+ }
170
+ // ── NegotiationStore ──────────────────────────────────────────────────────
171
+ createNegotiationStore() {
172
+ const store = this.store;
173
+ const INSERT_SQL = `
174
+ INSERT INTO negotiations (negotiation_id, record_json, revision, state, principal, updated_at)
175
+ VALUES (?, ?, ?, ?, ?, ?)
176
+ `;
177
+ const GET_SQL = `SELECT * FROM negotiations WHERE negotiation_id = ?`;
178
+ const CAS_SQL = `
179
+ UPDATE negotiations
180
+ SET record_json = ?, revision = ?, state = ?, updated_at = ?
181
+ WHERE negotiation_id = ? AND revision = ?
182
+ `;
183
+ const LIST_RECOVERABLE_SQL = `
184
+ SELECT * FROM negotiations WHERE state NOT IN ('AGREED','REJECTED','CANCELLED','EXHAUSTED','EXPIRED')
185
+ `;
186
+ return {
187
+ async create(record) {
188
+ const row = negotiationToRow(record);
189
+ store.transactionalSync((tx) => {
190
+ tx.run(INSERT_SQL, row.negotiation_id, row.record_json, row.revision, row.state, row.principal, row.updated_at);
191
+ });
192
+ },
193
+ async get(negotiationId) {
194
+ const row = store.transactionalSync((tx) => tx.get(GET_SQL, negotiationId));
195
+ return row ? rowToNegotiation(row) : undefined;
196
+ },
197
+ async compareAndSet(negotiationId, expectedRevision, next) {
198
+ const row = negotiationToRow(next);
199
+ const touched = store.transactionalSync((tx) => tx.run(CAS_SQL, row.record_json, row.revision, row.state, row.updated_at, negotiationId, expectedRevision));
200
+ return touched === 1;
201
+ },
202
+ async transitionAndEnqueue(negotiationId, expectedRevision, next, outboxMessages) {
203
+ // Generalized transitionAndEnqueue: CAS the negotiation and enqueue
204
+ // every outbox message in ONE transaction (rollback on CAS miss).
205
+ const row = negotiationToRow(next);
206
+ const now = Date.now();
207
+ return store.transitionAndEnqueue({
208
+ casUpdateSql: CAS_SQL,
209
+ casUpdateParams: [
210
+ row.record_json, row.revision, row.state, row.updated_at,
211
+ negotiationId, expectedRevision,
212
+ ],
213
+ enqueueSql: `
214
+ INSERT OR REPLACE INTO outbox (message_id, recipient, payload, enqueued_at, attempts)
215
+ VALUES (?, ?, ?, ?, 0)
216
+ `,
217
+ enqueueRows: outboxMessages.map((m) => [m.messageId, m.recipient, m.payload, now]),
218
+ });
219
+ },
220
+ async listRecoverable() {
221
+ const rows = store.transactionalSync((tx) => tx.all(LIST_RECOVERABLE_SQL));
222
+ return rows.map(rowToNegotiation);
223
+ },
224
+ };
225
+ }
226
+ // ── PurchaseStore ─────────────────────────────────────────────────────────
227
+ createPurchaseStore() {
228
+ const store = this.store;
229
+ const INSERT_SQL = `
230
+ INSERT INTO purchases (purchase_id, record_json, revision, status, updated_at)
231
+ VALUES (?, ?, ?, ?, ?)
232
+ `;
233
+ const GET_SQL = `SELECT * FROM purchases WHERE purchase_id = ?`;
234
+ const CAS_SQL = `
235
+ UPDATE purchases
236
+ SET record_json = ?, revision = ?, status = ?, updated_at = ?
237
+ WHERE purchase_id = ? AND revision = ?
238
+ `;
239
+ const LIST_RECOVERABLE_SQL = `
240
+ SELECT * FROM purchases WHERE status NOT IN ('COMPLETED','FAILED','CANCELLED')
241
+ `;
242
+ return {
243
+ async create(record) {
244
+ const row = purchaseToRow(record);
245
+ store.transactionalSync((tx) => {
246
+ tx.run(INSERT_SQL, row.purchase_id, row.record_json, row.revision, row.status, row.updated_at);
247
+ });
248
+ },
249
+ async get(purchaseId) {
250
+ const row = store.transactionalSync((tx) => tx.get(GET_SQL, purchaseId));
251
+ return row ? rowToPurchase(row) : undefined;
252
+ },
253
+ async compareAndSet(purchaseId, expectedRevision, next) {
254
+ const row = purchaseToRow(next);
255
+ const touched = store.transactionalSync((tx) => tx.run(CAS_SQL, row.record_json, row.revision, row.status, row.updated_at, purchaseId, expectedRevision));
256
+ return touched === 1;
257
+ },
258
+ async listRecoverable() {
259
+ const rows = store.transactionalSync((tx) => tx.all(LIST_RECOVERABLE_SQL));
260
+ return rows.map(rowToPurchase);
261
+ },
262
+ };
263
+ }
264
+ // ── ReplayLedger ──────────────────────────────────────────────────────────
265
+ createReplayLedger() {
266
+ const store = this.store;
267
+ const GET_SQL = `SELECT * FROM replay WHERE message_id = ?`;
268
+ const INSERT_PROCESSING_SQL = `
269
+ INSERT INTO replay (message_id, state, claimed_at, lease_until)
270
+ VALUES (?, 'PROCESSING', ?, ?)
271
+ `;
272
+ const UPDATE_PROCESSING_SQL = `
273
+ UPDATE replay SET claimed_at = ?, lease_until = ? WHERE message_id = ? AND state = 'PROCESSING'
274
+ `;
275
+ const COMPLETE_SQL = `
276
+ UPDATE replay SET state = 'COMPLETED', outcome_json = ?, completed_at = ?
277
+ WHERE message_id = ?
278
+ `;
279
+ return {
280
+ async claim(messageId, receivedAt, leaseMs = 30000) {
281
+ return store.transactionalSync((tx) => {
282
+ const row = tx.get(GET_SQL, messageId);
283
+ if (!row) {
284
+ tx.run(INSERT_PROCESSING_SQL, messageId, receivedAt, receivedAt + leaseMs);
285
+ return { claimed: true };
286
+ }
287
+ if (row.state === 'COMPLETED') {
288
+ return { claimed: false, entry: rowToReplay(row) };
289
+ }
290
+ // PROCESSING — reclaim if lease expired.
291
+ if (row.lease_until !== null && receivedAt > row.lease_until) {
292
+ tx.run(UPDATE_PROCESSING_SQL, receivedAt, receivedAt + leaseMs, messageId);
293
+ return { claimed: true, reclaimed: true };
294
+ }
295
+ return { claimed: false, entry: rowToReplay(row) };
296
+ });
297
+ },
298
+ async complete(messageId, outcome) {
299
+ store.transactionalSync((tx) => {
300
+ tx.run(COMPLETE_SQL, toJson(outcome), Date.now(), messageId);
301
+ });
302
+ },
303
+ async get(messageId) {
304
+ const row = store.transactionalSync((tx) => tx.get(GET_SQL, messageId));
305
+ return row ? rowToReplay(row) : undefined;
306
+ },
307
+ };
308
+ }
309
+ // ── PrincipalNegotiationStore ────────────────────────────────────────────
310
+ createPrincipalStore() {
311
+ const store = this.store;
312
+ const INSERT_SLOT_SQL = `
313
+ INSERT INTO principal_slots (principal, negotiation_id, opened_at) VALUES (?, ?, ?)
314
+ `;
315
+ const DELETE_SLOT_SQL = `
316
+ DELETE FROM principal_slots WHERE principal = ? AND negotiation_id = ?
317
+ `;
318
+ const SLOTS_FOR_SQL = `SELECT * FROM principal_slots WHERE principal = ?`;
319
+ const GET_COOLDOWN_SQL = `SELECT cooldown_until FROM principal_cooldown WHERE principal = ?`;
320
+ const SET_COOLDOWN_SQL = `
321
+ INSERT OR REPLACE INTO principal_cooldown (principal, cooldown_until) VALUES (?, ?)
322
+ `;
323
+ return {
324
+ async tryOpen(principal, negotiationId, now, limits) {
325
+ // Atomic on the shared transaction primitive: check cooldown, window,
326
+ // concurrency, then consume — two concurrent opens cannot both pass.
327
+ return store.transactionalSync((tx) => {
328
+ const cooldownRow = tx.get(GET_COOLDOWN_SQL, principal);
329
+ if (cooldownRow && now < cooldownRow.cooldown_until) {
330
+ return { allowed: false, reason: 'COOLDOWN' };
331
+ }
332
+ const slots = tx.all(SLOTS_FOR_SQL, principal);
333
+ const recent = slots.filter((s) => now - s.opened_at < limits.windowMs);
334
+ if (recent.length >= limits.maxNegotiationsPerWindow) {
335
+ return { allowed: false, reason: 'WINDOW_LIMIT' };
336
+ }
337
+ if (slots.length >= limits.maxConcurrentNegotiations) {
338
+ return { allowed: false, reason: 'CONCURRENCY_LIMIT' };
339
+ }
340
+ tx.run(INSERT_SLOT_SQL, principal, negotiationId, now);
341
+ return { allowed: true };
342
+ });
343
+ },
344
+ async close(principal, negotiationId) {
345
+ store.transactionalSync((tx) => {
346
+ tx.run(DELETE_SLOT_SQL, principal, negotiationId);
347
+ });
348
+ },
349
+ async reconcile(principal, activeNegotiationIds) {
350
+ store.transactionalSync((tx) => {
351
+ const slots = tx.all(SLOTS_FOR_SQL, principal);
352
+ const active = new Set(activeNegotiationIds);
353
+ for (const slot of slots) {
354
+ if (!active.has(slot.negotiation_id)) {
355
+ tx.run(DELETE_SLOT_SQL, principal, slot.negotiation_id);
356
+ }
357
+ }
358
+ });
359
+ },
360
+ async getCooldownUntil(principal) {
361
+ const row = store.transactionalSync((tx) => tx.get(GET_COOLDOWN_SQL, principal));
362
+ return row?.cooldown_until ?? 0;
363
+ },
364
+ async setCooldownUntil(principal, until) {
365
+ store.transactionalSync((tx) => {
366
+ tx.run(SET_COOLDOWN_SQL, principal, until);
367
+ });
368
+ },
369
+ };
370
+ }
371
+ // ── OutboxStore ───────────────────────────────────────────────────────────
372
+ createOutboxStore() {
373
+ const store = this.store;
374
+ const ENQUEUE_SQL = `
375
+ INSERT OR REPLACE INTO outbox (message_id, recipient, payload, enqueued_at, attempts)
376
+ VALUES (?, ?, ?, ?, ?)
377
+ `;
378
+ const LIST_UNDELIVERED_SQL = `SELECT * FROM outbox WHERE delivered_at IS NULL`;
379
+ const MARK_DELIVERED_SQL = `UPDATE outbox SET delivered_at = ? WHERE message_id = ?`;
380
+ const RECORD_ATTEMPT_SQL = `UPDATE outbox SET attempts = attempts + 1 WHERE message_id = ?`;
381
+ return {
382
+ async enqueue(entry) {
383
+ store.transactionalSync((tx) => {
384
+ tx.run(ENQUEUE_SQL, entry.messageId, entry.recipient, toJson(entry.message), entry.enqueuedAt, entry.attempts);
385
+ });
386
+ },
387
+ async listUndelivered() {
388
+ const rows = store.transactionalSync((tx) => tx.all(LIST_UNDELIVERED_SQL));
389
+ return rows.map(rowToOutbox);
390
+ },
391
+ async markDelivered(messageId, deliveredAt) {
392
+ store.transactionalSync((tx) => {
393
+ tx.run(MARK_DELIVERED_SQL, deliveredAt, messageId);
394
+ });
395
+ },
396
+ async recordAttempt(messageId) {
397
+ store.transactionalSync((tx) => {
398
+ tx.run(RECORD_ATTEMPT_SQL, messageId);
399
+ });
400
+ },
401
+ };
402
+ }
403
+ }
404
+ /**
405
+ * Create a SQLite-backed CommerceStore.
406
+ *
407
+ * @param config filename (or ':memory:') + WAL/busy options.
408
+ */
409
+ export function createSQLiteCommerceStore(config) {
410
+ return new SQLiteCommerceStore(config);
411
+ }
package/dist/stream.js CHANGED
@@ -1,11 +1,8 @@
1
- "use strict";
2
1
  /**
3
2
  * EdgeStreamPort adapter — wraps @totemsdk/stream-transport's IStreamTransport
4
3
  * as a first-class EdgeStreamPort for EdgeRuntimePorts.stream.
5
4
  */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.createStreamPortAdapter = createStreamPortAdapter;
8
- function createStreamPortAdapter(transport) {
5
+ export function createStreamPortAdapter(transport) {
9
6
  return {
10
7
  async send(data) {
11
8
  await transport.send(data);
package/package.json CHANGED
@@ -1,14 +1,19 @@
1
1
  {
2
2
  "name": "@totemsdk/edge-adapters",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Reference adapters bridging Totem SDK packages to @totemsdk/edge port interfaces",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "main": "dist/cjs/index.js",
6
+ "types": "dist/cjs/index.d.ts",
7
7
  "exports": {
8
8
  ".": {
9
- "types": "./dist/index.d.ts",
10
- "require": "./dist/index.js",
11
- "import": "./dist/index.js"
9
+ "import": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "require": {
14
+ "types": "./dist/cjs/index.d.ts",
15
+ "default": "./dist/cjs/index.js"
16
+ }
12
17
  }
13
18
  },
14
19
  "files": [
@@ -16,18 +21,21 @@
16
21
  "README.md",
17
22
  "LICENSE"
18
23
  ],
24
+ "dependencies": {
25
+ "@totemsdk/storage": "^0.1.0"
26
+ },
19
27
  "peerDependencies": {
20
- "@totemsdk/agent-policy": "^0.2.1",
21
- "@totemsdk/identity": "^1.0.0",
22
- "@totemsdk/chain-provider": "^0.2.0",
23
- "@totemsdk/location-proof": "^1.0.0",
24
- "@totemsdk/lookup-client": "^0.2.0",
25
- "@totemsdk/manifest": "^1.0.0",
26
- "@totemsdk/omnia-router": "^0.2.0",
28
+ "@totemsdk/agent-policy": ">=0.3.1 <1.0.0",
29
+ "@totemsdk/chain-provider": ">=0.2.1 <1.0.0",
30
+ "@totemsdk/lookup-client": ">=0.2.0 <1.0.0",
31
+ "@totemsdk/omnia-router": ">=0.3.0 <1.0.0",
32
+ "@totemsdk/pubsub-transport": ">=0.2.0 <1.0.0",
33
+ "@totemsdk/stream-transport": ">=0.2.0 <1.0.0",
34
+ "@totemsdk/identity": "^1.0.1",
35
+ "@totemsdk/manifest": "^2.0.0",
27
36
  "@totemsdk/proof": "^1.0.0",
28
- "@totemsdk/pubsub-transport": "^0.2.0",
29
- "@totemsdk/root-identity": "^1.0.8",
30
- "@totemsdk/stream-transport": "^0.2.0"
37
+ "@totemsdk/root-identity": "^1.0.9",
38
+ "@totemsdk/location-proof": "^1.0.0"
31
39
  },
32
40
  "peerDependenciesMeta": {
33
41
  "@totemsdk/agent-policy": {
@@ -70,18 +78,20 @@
70
78
  "jest": "^30.4.2",
71
79
  "ts-jest": "^29.0.0",
72
80
  "typescript": "^7.0.2",
73
- "@totemsdk/chain-provider": "^0.2.0",
74
- "@totemsdk/edge": "^1.0.0",
81
+ "@totemsdk/agent-policy": "^0.3.1",
82
+ "@totemsdk/chain-provider": "^0.2.1",
83
+ "@totemsdk/edge": "^1.3.0",
84
+ "@totemsdk/core": "^1.2.11",
85
+ "@totemsdk/identity": "^1.0.1",
86
+ "@totemsdk/manifest": "^2.0.0",
75
87
  "@totemsdk/lookup-client": "^0.2.0",
76
- "@totemsdk/identity": "^1.0.0",
77
- "@totemsdk/agent-policy": "^0.2.1",
88
+ "@totemsdk/omnia-router": "^0.3.0",
78
89
  "@totemsdk/location-proof": "^1.0.0",
79
- "@totemsdk/manifest": "^1.0.0",
80
- "@totemsdk/omnia-router": "^0.2.0",
90
+ "@totemsdk/proof": "^1.0.0",
81
91
  "@totemsdk/pubsub-transport": "^0.2.0",
92
+ "@totemsdk/root-identity": "^1.0.9",
82
93
  "@totemsdk/stream-transport": "^0.2.0",
83
- "@totemsdk/proof": "^1.0.0",
84
- "@totemsdk/root-identity": "^1.0.8"
94
+ "@totemsdk/txpow": "^1.0.2"
85
95
  },
86
96
  "engines": {
87
97
  "node": ">=18.0.0"
@@ -91,7 +101,7 @@
91
101
  },
92
102
  "license": "MIT",
93
103
  "author": "Totem SDK",
94
- "homepage": "https://totem.ing",
104
+ "homepage": "https://docs.totem.ing",
95
105
  "repository": {
96
106
  "type": "git",
97
107
  "url": "git+https://github.com/Totem-Edge/totem-sdk.git",
@@ -112,8 +122,9 @@
112
122
  "bugs": {
113
123
  "url": "https://github.com/Totem-Edge/totem-sdk/issues"
114
124
  },
125
+ "type": "module",
115
126
  "scripts": {
116
- "build": "tsc",
127
+ "build": "tsc && tsc -p tsconfig.cjs.json && node -e \"require('fs').writeFileSync('dist/cjs/package.json', JSON.stringify({type:'commonjs'})+'\\n')\"",
117
128
  "clean": "rm -rf dist",
118
129
  "test": "jest"
119
130
  }