@agnt-sdk/simon-server 0.0.0-stage → 0.1.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 (78) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +12 -0
  3. package/README.md +317 -2
  4. package/dist/account.d.ts +59 -0
  5. package/dist/account.js +244 -0
  6. package/dist/auth.d.ts +42 -0
  7. package/dist/auth.js +96 -0
  8. package/dist/config.d.ts +219 -0
  9. package/dist/config.js +300 -0
  10. package/dist/context.d.ts +57 -0
  11. package/dist/context.js +2 -0
  12. package/dist/continuity.d.ts +35 -0
  13. package/dist/continuity.js +74 -0
  14. package/dist/deliver.d.ts +22 -0
  15. package/dist/deliver.js +208 -0
  16. package/dist/errors.d.ts +11 -0
  17. package/dist/errors.js +11 -0
  18. package/dist/extensions.d.ts +216 -0
  19. package/dist/extensions.js +75 -0
  20. package/dist/fanout.d.ts +32 -0
  21. package/dist/fanout.js +79 -0
  22. package/dist/http.d.ts +69 -0
  23. package/dist/http.js +112 -0
  24. package/dist/index.d.ts +15 -0
  25. package/dist/index.js +12 -0
  26. package/dist/main.d.ts +2 -0
  27. package/dist/main.js +41 -0
  28. package/dist/net/dns.d.ts +31 -0
  29. package/dist/net/dns.js +100 -0
  30. package/dist/net/fetch.d.ts +48 -0
  31. package/dist/net/fetch.js +173 -0
  32. package/dist/net/ip.d.ts +38 -0
  33. package/dist/net/ip.js +159 -0
  34. package/dist/net/psl.d.ts +22 -0
  35. package/dist/net/psl.js +91 -0
  36. package/dist/net/public-suffixes.d.ts +10 -0
  37. package/dist/net/public-suffixes.js +6885 -0
  38. package/dist/notice.d.ts +5 -0
  39. package/dist/notice.js +61 -0
  40. package/dist/outbox.d.ts +14 -0
  41. package/dist/outbox.js +356 -0
  42. package/dist/parts.d.ts +29 -0
  43. package/dist/parts.js +443 -0
  44. package/dist/public.d.ts +43 -0
  45. package/dist/public.js +134 -0
  46. package/dist/published.d.ts +3 -0
  47. package/dist/published.js +140 -0
  48. package/dist/rate.d.ts +28 -0
  49. package/dist/rate.js +77 -0
  50. package/dist/readers.d.ts +31 -0
  51. package/dist/readers.js +48 -0
  52. package/dist/register.d.ts +4 -0
  53. package/dist/register.js +401 -0
  54. package/dist/resolver.d.ts +140 -0
  55. package/dist/resolver.js +386 -0
  56. package/dist/send.d.ts +30 -0
  57. package/dist/send.js +216 -0
  58. package/dist/server.d.ts +52 -0
  59. package/dist/server.js +234 -0
  60. package/dist/signal.d.ts +5 -0
  61. package/dist/signal.js +137 -0
  62. package/dist/store/contract.d.ts +4 -0
  63. package/dist/store/contract.js +1177 -0
  64. package/dist/store/sqlite-migration.d.ts +82 -0
  65. package/dist/store/sqlite-migration.js +1019 -0
  66. package/dist/store/sqlite.d.ts +108 -0
  67. package/dist/store/sqlite.js +992 -0
  68. package/dist/store/store.d.ts +400 -0
  69. package/dist/store/store.js +23 -0
  70. package/dist/sync.d.ts +19 -0
  71. package/dist/sync.js +199 -0
  72. package/dist/testing.d.ts +38 -0
  73. package/dist/testing.js +87 -0
  74. package/dist/webhooks.d.ts +10 -0
  75. package/dist/webhooks.js +162 -0
  76. package/dist/worker.d.ts +15 -0
  77. package/dist/worker.js +33 -0
  78. package/package.json +57 -4
@@ -0,0 +1,108 @@
1
+ import { type AnyMessage } from '@agnt-sdk/simon-protocol';
2
+ import { type RetractionCapacity } from './store.ts';
3
+ import type { Agent, AgentKey, AgentAdmission, Delivery, HeldSignal, Page, PartFetch, PartSource, QueuedArrival, Store, StoredMessage, SweepCounts, SyncEntry, Webhook } from './store.ts';
4
+ export declare class SqliteStore implements Store {
5
+ #private;
6
+ constructor(path?: string, options?: {
7
+ retractions?: Partial<RetractionCapacity>;
8
+ });
9
+ createAgent(agent: Agent, admit?: AgentAdmission): Promise<"created" | "address_taken" | "key_in_use" | "too_many_keys">;
10
+ agentByAddress(address: string): Promise<Agent | null>;
11
+ agentByKey(key: string): Promise<Agent | null>;
12
+ addKey(address: string, entry: AgentKey, maxActive: number, admit?: AgentAdmission): Promise<"added" | "key_in_use" | "too_many_keys">;
13
+ revokeKey(address: string, key: string, at: string, admit?: AgentAdmission): Promise<"not_found" | "revoked" | "last_key">;
14
+ replaceKeys(address: string, entry: AgentKey, admit?: AgentAdmission): Promise<"retired" | "key_in_use" | "too_many_keys" | "replaced">;
15
+ keepOnlyKey(address: string, key: string, at: string): Promise<"kept" | "not_held">;
16
+ retireAgent(address: string, at: string, unpairing?: string): Promise<void>;
17
+ beginRecovery(address: string, value: unknown, expiresAt: string | null, now: string, admit?: AgentAdmission): Promise<unknown>;
18
+ activateRecovery(address: string, expectedRecovery: unknown, now: string): Promise<boolean>;
19
+ completeRecovery(address: string, entry: AgentKey, expectedRecovery: unknown, admit?: AgentAdmission): Promise<"retired" | "key_in_use" | "too_many_keys" | "replaced" | "not_pending">;
20
+ cancelRecovery(address: string, expectedRecovery: unknown, now: string, admit?: AgentAdmission, keyCancelledAt?: string): Promise<boolean>;
21
+ putMessage(m: StoredMessage, rows?: {
22
+ deliveries?: Delivery[];
23
+ arrivals?: QueuedArrival[];
24
+ }): Promise<StoredMessage>;
25
+ message(id: string): Promise<StoredMessage | null>;
26
+ listingRetracted(ownerAddress: string, id: string, replyAuthor: string): Promise<boolean>;
27
+ deleteMessage(id: string): Promise<void>;
28
+ published(author: string, before: string | null, limit: number): Promise<Page>;
29
+ repliesTo(address: string, id: string, before: string | null, limit: number): Promise<Page>;
30
+ arrivals(now: string, limit: number): Promise<{
31
+ arrival: {
32
+ id: string;
33
+ recipient: string;
34
+ hints: any;
35
+ attempts: number;
36
+ dueAt: string;
37
+ };
38
+ message: StoredMessage;
39
+ generation: string;
40
+ }[]>;
41
+ arrivalRetry(id: string, recipient: string, at: string, generation?: string): Promise<void>;
42
+ arrivalDone(id: string, recipient: string, kept: boolean, generation?: string): Promise<"kept" | "dropped" | null>;
43
+ addToInbox(address: string, id: string, at: string, generation?: string, minExpiresAt?: string): Promise<boolean>;
44
+ sync(address: string, after: number, limit: number, now: string, from?: string): Promise<{
45
+ messages: SyncEntry[];
46
+ signals: HeldSignal[];
47
+ cursor: number;
48
+ more: boolean;
49
+ }>;
50
+ holdSignal(address: string, signal: Omit<HeldSignal, 'cursor'>, expiresAt: string, now: string): Promise<void>;
51
+ inbox(address: string, after: number, limit: number): Promise<SyncEntry[]>;
52
+ inInbox(address: string, id: string): Promise<boolean>;
53
+ wroteTo(author: string, recipient: string, self: string): Promise<boolean>;
54
+ inboxEvents(limit: number): Promise<SyncEntry[]>;
55
+ inboxEventDone(cursor: number): Promise<void>;
56
+ addWebhook(w: Webhook, max: number): Promise<boolean>;
57
+ webhook(id: string): Promise<Webhook | null>;
58
+ verifyWebhook(id: string): Promise<void>;
59
+ deleteWebhook(id: string): Promise<void>;
60
+ wakeWebhooks(address: string, at: string): Promise<void>;
61
+ claimWebhooks(now: string, limit: number, quietUntil: string, lease: {
62
+ token: string;
63
+ until: string;
64
+ }): Promise<Webhook[]>;
65
+ settleWebhook(id: string, failingSince: string | null, retryAt: string | null, token: string, disable?: boolean): Promise<boolean>;
66
+ claimDeliveries(now: string, limit: number, skip: string[], lease: {
67
+ token: string;
68
+ until: string;
69
+ }): Promise<Delivery[]>;
70
+ settleDelivery(d: Delivery, token: string): Promise<boolean>;
71
+ deliveries(id: string): Promise<Delivery[]>;
72
+ putPart(sha256: string, bytes: Buffer, source: PartSource, at: string): Promise<void>;
73
+ part(sha256: string, source: PartSource): Promise<Buffer<ArrayBuffer> | null>;
74
+ heldFor(sha256: string, address: string, self: string): Promise<(PartSource & {
75
+ size: number;
76
+ })[]>;
77
+ partNamers(sha256: string, viewer: {
78
+ published: true;
79
+ } | {
80
+ server: string;
81
+ }, self: string): Promise<{
82
+ author: string;
83
+ message: AnyMessage;
84
+ }[]>;
85
+ queueFetch(f: PartFetch, now?: string): Promise<PartFetch>;
86
+ queueFetch(f: PartFetch, now: string | undefined, max: number): Promise<PartFetch | null>;
87
+ fetches(now: string, limit: number): Promise<PartFetch[]>;
88
+ claimFetch(f: PartFetch, now: string, lease: {
89
+ token: string;
90
+ until: string;
91
+ }): Promise<boolean>;
92
+ renewFetch(sha256: string, carrier: string, token: string, now: string, until: string): Promise<boolean>;
93
+ fetchRetry(sha256: string, carrier: string, at: string, token: string): Promise<boolean>;
94
+ fetchDefer(sha256: string, carrier: string, at: string, token: string): Promise<boolean>;
95
+ fetchDone(sha256: string, carrier: string, token: string): Promise<boolean>;
96
+ fetchGiveUp(sha256: string, carrier: string, token: string, expiresAt: string): Promise<boolean>;
97
+ fetchExhausted(sha256: string, carrier: string, now: string): Promise<boolean>;
98
+ mark(scope: string, id: string, expiresAt: string, now: string): Promise<boolean>;
99
+ marked(scope: string, id: string, now: string): Promise<boolean>;
100
+ count(scope: string, id: string, expiresAt: string, now: string, by?: number): Promise<number>;
101
+ value<T>(scope: string, id: string, now: string): Promise<T | null>;
102
+ setValue(scope: string, id: string, value: unknown, expiresAt: string | null): Promise<void>;
103
+ releaseValue(scope: string, id: string, value: unknown): Promise<boolean>;
104
+ renewValue(scope: string, id: string, value: unknown, expiresAt: string): Promise<boolean>;
105
+ valueOnce<T>(scope: string, id: string, value: T, expiresAt: string | null, now: string): Promise<T>;
106
+ sweep(now: string, uploadsBefore: string): Promise<SweepCounts>;
107
+ close(): Promise<void>;
108
+ }