@econ-v1/ports 0.0.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/clock.d.ts +11 -0
- package/dist/clock.d.ts.map +1 -0
- package/dist/clock.js +2 -0
- package/dist/clock.js.map +1 -0
- package/dist/crypto.d.ts +5 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +2 -0
- package/dist/crypto.js.map +1 -0
- package/dist/id.d.ts +4 -0
- package/dist/id.d.ts.map +1 -0
- package/dist/id.js +2 -0
- package/dist/id.js.map +1 -0
- package/dist/identity.d.ts +44 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +2 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/media-preferences.d.ts +47 -0
- package/dist/media-preferences.d.ts.map +1 -0
- package/dist/media-preferences.js +2 -0
- package/dist/media-preferences.js.map +1 -0
- package/dist/network/home-node-candidate.d.ts +10 -0
- package/dist/network/home-node-candidate.d.ts.map +1 -0
- package/dist/network/home-node-candidate.js +2 -0
- package/dist/network/home-node-candidate.js.map +1 -0
- package/dist/network.d.ts +33 -0
- package/dist/network.d.ts.map +1 -0
- package/dist/network.js +2 -0
- package/dist/network.js.map +1 -0
- package/dist/repositories/conversation-repository.d.ts +122 -0
- package/dist/repositories/conversation-repository.d.ts.map +1 -0
- package/dist/repositories/conversation-repository.js +2 -0
- package/dist/repositories/conversation-repository.js.map +1 -0
- package/dist/repositories/durable-event.d.ts +21 -0
- package/dist/repositories/durable-event.d.ts.map +1 -0
- package/dist/repositories/durable-event.js +2 -0
- package/dist/repositories/durable-event.js.map +1 -0
- package/dist/repositories/outbox.d.ts +96 -0
- package/dist/repositories/outbox.d.ts.map +1 -0
- package/dist/repositories/outbox.js +9 -0
- package/dist/repositories/outbox.js.map +1 -0
- package/dist/repositories/repository-mutation.d.ts +5 -0
- package/dist/repositories/repository-mutation.d.ts.map +1 -0
- package/dist/repositories/repository-mutation.js +2 -0
- package/dist/repositories/repository-mutation.js.map +1 -0
- package/dist/repositories/revisioned-repository.d.ts +41 -0
- package/dist/repositories/revisioned-repository.d.ts.map +1 -0
- package/dist/repositories/revisioned-repository.js +2 -0
- package/dist/repositories/revisioned-repository.js.map +1 -0
- package/dist/repositories/settings.d.ts +27 -0
- package/dist/repositories/settings.d.ts.map +1 -0
- package/dist/repositories/settings.js +2 -0
- package/dist/repositories/settings.js.map +1 -0
- package/dist/repositories/sync-ledger.d.ts +30 -0
- package/dist/repositories/sync-ledger.d.ts.map +1 -0
- package/dist/repositories/sync-ledger.js +2 -0
- package/dist/repositories/sync-ledger.js.map +1 -0
- package/dist/repositories/wallet-mirror-repository.d.ts +52 -0
- package/dist/repositories/wallet-mirror-repository.d.ts.map +1 -0
- package/dist/repositories/wallet-mirror-repository.js +53 -0
- package/dist/repositories/wallet-mirror-repository.js.map +1 -0
- package/dist/repositories.d.ts +44 -0
- package/dist/repositories.d.ts.map +1 -0
- package/dist/repositories.js +2 -0
- package/dist/repositories.js.map +1 -0
- package/dist/scheduler.d.ts +12 -0
- package/dist/scheduler.d.ts.map +1 -0
- package/dist/scheduler.js +2 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/storage.d.ts +97 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +14 -0
- package/dist/storage.js.map +1 -0
- package/dist/theme.d.ts +30 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +2 -0
- package/dist/theme.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { RepositoryJsonValue } from "./repository-mutation.js";
|
|
2
|
+
import type { RepositoryWriteResult } from "./durable-event.js";
|
|
3
|
+
export declare const REVISIONED_REPOSITORY_DOMAINS: readonly ["agent", "settings", "graph"];
|
|
4
|
+
export type RevisionedRepositoryDomain = (typeof REVISIONED_REPOSITORY_DOMAINS)[number];
|
|
5
|
+
export interface RevisionedEntity<TValue extends RepositoryJsonValue = RepositoryJsonValue> {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly rev: number;
|
|
8
|
+
readonly value: TValue;
|
|
9
|
+
}
|
|
10
|
+
export interface RevisionCommand<TValue extends RepositoryJsonValue = RepositoryJsonValue> {
|
|
11
|
+
readonly baseRev: number;
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly idempotencyKey: string;
|
|
14
|
+
readonly value: TValue;
|
|
15
|
+
}
|
|
16
|
+
export type RevisionCommandResult<TValue extends RepositoryJsonValue = RepositoryJsonValue> = {
|
|
17
|
+
readonly entity: RevisionedEntity<TValue>;
|
|
18
|
+
readonly status: "accepted";
|
|
19
|
+
} | {
|
|
20
|
+
readonly status: "conflict";
|
|
21
|
+
readonly theirs: RevisionedEntity<TValue>;
|
|
22
|
+
};
|
|
23
|
+
export interface RevisionedRepositoryEvent {
|
|
24
|
+
readonly occurredAt: string;
|
|
25
|
+
readonly payload: {
|
|
26
|
+
readonly action: "created" | "updated";
|
|
27
|
+
readonly entityId: string;
|
|
28
|
+
readonly entityType: "agent" | "graph" | "setting";
|
|
29
|
+
};
|
|
30
|
+
readonly type: "domain.entity-changed";
|
|
31
|
+
}
|
|
32
|
+
export interface RevisionedRepository<TValue extends RepositoryJsonValue = RepositoryJsonValue> {
|
|
33
|
+
apply(entity: RevisionedEntity<TValue>): Promise<RepositoryWriteResult<RevisionedRepositoryEvent>>;
|
|
34
|
+
command(input: RevisionCommand<TValue>): Promise<RevisionCommandResult<TValue>>;
|
|
35
|
+
list(): Promise<readonly RevisionedEntity<TValue>[]>;
|
|
36
|
+
read(id: string): Promise<RevisionedEntity<TValue> | undefined>;
|
|
37
|
+
}
|
|
38
|
+
export type AgentRepository = RevisionedRepository;
|
|
39
|
+
export type RevisionedSettingsRepository = RevisionedRepository;
|
|
40
|
+
export type GraphRepository = RevisionedRepository;
|
|
41
|
+
//# sourceMappingURL=revis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AAE;QAChB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;QACvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;KACpD,CAAC;IACF,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC;CACxC;AAED,MAAM,WAAW,oBAAoB,CAAC,MAAM,SAAS,mBAAmB,GAAG,mBAAmB;IAC5F,KAAK,CAAC,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,qBAAqB,CAAC,yBAAyB,CAAC,CAAC,CAAC;IACnG,OAAO,CAAC,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;IAChF,IAAI,IAAI,OAAO,CAAC,SAAS,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACrD,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC;CACjE;AAED,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC;AACnD,MAAM,MAAM,4BAA4B,GAAG,oBAAoB,CAAC;AAChE,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revisioned-repository.js","sourceRoot":"","sources":["../../src/repositories/revisioned-repository.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAU,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { RepositoryWriteResult } from "./durable-event.js";
|
|
2
|
+
import type { RepositoryJsonValue } from "./repository-mutation.js";
|
|
3
|
+
export interface SettingRecord {
|
|
4
|
+
readonly key: string;
|
|
5
|
+
readonly updatedAt: string;
|
|
6
|
+
readonly value: RepositoryJsonValue;
|
|
7
|
+
}
|
|
8
|
+
export interface SettingInput {
|
|
9
|
+
readonly key: string;
|
|
10
|
+
readonly value: RepositoryJsonValue;
|
|
11
|
+
}
|
|
12
|
+
export interface SettingsRepositoryEvent {
|
|
13
|
+
readonly occurredAt: string;
|
|
14
|
+
readonly payload: {
|
|
15
|
+
readonly action: "created" | "deleted" | "updated";
|
|
16
|
+
readonly entityId: string;
|
|
17
|
+
readonly entityType: "setting";
|
|
18
|
+
};
|
|
19
|
+
readonly type: "domain.entity-changed";
|
|
20
|
+
}
|
|
21
|
+
export interface SettingsRepository {
|
|
22
|
+
delete(key: string): Promise<RepositoryWriteResult<SettingsRepositoryEvent>>;
|
|
23
|
+
list(): Promise<readonly SettingRecord[]>;
|
|
24
|
+
read(key: string): Promise<SettingRecord | undefined>;
|
|
25
|
+
set(input: SettingInput): Promise<RepositoryWriteResult<SettingsRepositoryEvent>>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/repositories/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;CACrC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;CACrC;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;QACnD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;KAChC,CAAC;IACF,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC;CACxC;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAC7E,IAAI,IAAI,OAAO,CAAC,SAAS,aAAa,EAAE,CAAC,CAAC;IAC1C,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;IACtD,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,qBAAqB,CAAC,uBAAuB,CAAC,CAAC,CAAC;CACnF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/repositories/settings.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { RepositoryWriteResult } from "./durable-event.js";
|
|
2
|
+
export interface SyncLedgerInput {
|
|
3
|
+
readonly cursor: string;
|
|
4
|
+
readonly domain: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SyncLedgerRecord extends SyncLedgerInput {
|
|
7
|
+
readonly updatedAt: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SyncDeltaAppliedEvent {
|
|
10
|
+
readonly occurredAt: string;
|
|
11
|
+
readonly payload: SyncLedgerInput;
|
|
12
|
+
readonly type: "sync.delta-applied";
|
|
13
|
+
}
|
|
14
|
+
export interface SyncCursorDeletedEvent {
|
|
15
|
+
readonly occurredAt: string;
|
|
16
|
+
readonly payload: {
|
|
17
|
+
readonly action: "deleted";
|
|
18
|
+
readonly entityId: string;
|
|
19
|
+
readonly entityType: "sync-cursor";
|
|
20
|
+
};
|
|
21
|
+
readonly type: "domain.entity-changed";
|
|
22
|
+
}
|
|
23
|
+
export type SyncLedgerRepositoryEvent = SyncCursorDeletedEvent | SyncDeltaAppliedEvent;
|
|
24
|
+
export interface SyncLedgerRepository {
|
|
25
|
+
delete(domain: string): Promise<RepositoryWriteResult<SyncLedgerRepositoryEvent>>;
|
|
26
|
+
list(): Promise<readonly SyncLedgerRecord[]>;
|
|
27
|
+
read(domain: string): Promise<SyncLedgerRecord | undefined>;
|
|
28
|
+
setCursor(input: SyncLedgerInput): Promise<RepositoryWriteResult<SyncLedgerRepositoryEvent>>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=sync-ledger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-ledger.d.ts","sourceRoot":"","sources":["../../src/repositories/sync-ledger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;CACrC;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;QAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;KACpC,CAAC;IACF,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC;CACxC;AAED,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,GAAG,qBAAqB,CAAC;AAEvF,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,yBAAyB,CAAC,CAAC,CAAC;IAClF,IAAI,IAAI,OAAO,CAAC,SAAS,gBAAgB,EAAE,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;IAC5D,SAAS,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,qBAAqB,CAAC,yBAAyB,CAAC,CAAC,CAAC;CAC9F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-ledger.js","sourceRoot":"","sources":["../../src/repositories/sync-ledger.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface WalletPaymentRecord {
|
|
2
|
+
readonly amountMsat: number;
|
|
3
|
+
readonly createdAt: string;
|
|
4
|
+
readonly direction: "incoming" | "outgoing";
|
|
5
|
+
readonly failureCode?: string;
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly paymentHash?: string;
|
|
8
|
+
readonly status: "pending" | "succeeded" | "failed" | "expired";
|
|
9
|
+
readonly updatedAt: string;
|
|
10
|
+
}
|
|
11
|
+
export interface WalletL402Receipt {
|
|
12
|
+
readonly amountMsat: number;
|
|
13
|
+
readonly paidAt: string;
|
|
14
|
+
readonly paymentHash?: string;
|
|
15
|
+
readonly receiptId: string;
|
|
16
|
+
readonly resource: string;
|
|
17
|
+
}
|
|
18
|
+
export interface WalletSnapshotValue {
|
|
19
|
+
readonly balanceMsat: number;
|
|
20
|
+
readonly l402: readonly WalletL402Receipt[];
|
|
21
|
+
readonly payments: readonly WalletPaymentRecord[];
|
|
22
|
+
readonly spendableMsat: number;
|
|
23
|
+
}
|
|
24
|
+
export interface WalletAuthoritativeSnapshot {
|
|
25
|
+
readonly observedAt: string;
|
|
26
|
+
readonly staleAt: string;
|
|
27
|
+
readonly value: WalletSnapshotValue;
|
|
28
|
+
}
|
|
29
|
+
export type WalletCommandResult = {
|
|
30
|
+
readonly amountMsat: number;
|
|
31
|
+
readonly invoiceId: string;
|
|
32
|
+
readonly kind: "invoice-created";
|
|
33
|
+
readonly paymentHash?: string;
|
|
34
|
+
readonly paymentRequest: string;
|
|
35
|
+
readonly status: "created";
|
|
36
|
+
} | {
|
|
37
|
+
readonly amountMsat: number;
|
|
38
|
+
readonly kind: "payment-submitted";
|
|
39
|
+
readonly paymentHash?: string;
|
|
40
|
+
readonly paymentId: string;
|
|
41
|
+
readonly status: "pending" | "succeeded" | "failed";
|
|
42
|
+
};
|
|
43
|
+
export interface WalletMirrorRepository {
|
|
44
|
+
readCommandResult(idempotencyKey: string): Promise<WalletCommandResult | undefined>;
|
|
45
|
+
readSnapshot(): Promise<WalletAuthoritativeSnapshot | undefined>;
|
|
46
|
+
writeCommandResult(idempotencyKey: string, result: WalletCommandResult): Promise<void>;
|
|
47
|
+
writeSnapshot(snapshot: WalletAuthoritativeSnapshot): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
export declare function isWalletSnapshotValue(value: unknown): value is WalletSnapshotValue;
|
|
50
|
+
export declare function isWalletAuthoritativeSnapshot(value: unknown): value is WalletAuthoritativeSnapshot;
|
|
51
|
+
export declare function isWalletCommandResult(value: unknown): value is WalletCommandResult;
|
|
52
|
+
//# sourceMappingURL=wallet-mirror-repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-mirror-repository.d.ts","sourceRoot":"","sources":["../../src/repositories/wallet-mirror-repository.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,UAAU,EAAE,MA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AC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;CAC5B,GACD;IACE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;CACrD,CAAC;AAEN,MAAM,WAAW,sBAAsB;IACrC,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC;IACpF,YAAY,IAAI,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAAC,CAAC;IACjE,kBAAkB,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvF,aAAa,CAAC,QAAQ,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrE;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAKlF;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,2BAA2B,CAIlG;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAYlF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export function isWalletSnapshotValue(value) {
|
|
2
|
+
if (!isRecord(value) || !hasOnlyKeys(value, ["balanceMsat", "l402", "payments", "spendableMsat"]) ||
|
|
3
|
+
!isNonNegativeNumber(value.balanceMsat) || !isNonNegativeNumber(value.spendableMsat))
|
|
4
|
+
return false;
|
|
5
|
+
return Array.isArray(value.payments) && value.payments.every(isWalletPaymentRecord) &&
|
|
6
|
+
Array.isArray(value.l402) && value.l402.every(isWalletL402Receipt);
|
|
7
|
+
}
|
|
8
|
+
export function isWalletAuthoritativeSnapshot(value) {
|
|
9
|
+
return isRecord(value) && hasOnlyKeys(value, ["observedAt", "staleAt", "value"]) &&
|
|
10
|
+
typeof value.observedAt === "string" && typeof value.staleAt === "string" &&
|
|
11
|
+
isWalletSnapshotValue(value.value);
|
|
12
|
+
}
|
|
13
|
+
export function isWalletCommandResult(value) {
|
|
14
|
+
if (!isRecord(value) || !isNonNegativeNumber(value.amountMsat))
|
|
15
|
+
return false;
|
|
16
|
+
if (value.kind === "invoice-created") {
|
|
17
|
+
return hasOnlyKeys(value, ["amountMsat", "invoiceId", "kind", "paymentHash", "paymentRequest", "status"]) &&
|
|
18
|
+
value.status === "created" && typeof value.invoiceId === "string" && typeof value.paymentRequest === "string" &&
|
|
19
|
+
(value.paymentHash === undefined || typeof value.paymentHash === "string");
|
|
20
|
+
}
|
|
21
|
+
return hasOnlyKeys(value, ["amountMsat", "kind", "paymentHash", "paymentId", "status"]) &&
|
|
22
|
+
value.kind === "payment-submitted" &&
|
|
23
|
+
(value.status === "pending" || value.status === "succeeded" || value.status === "failed") &&
|
|
24
|
+
typeof value.paymentId === "string" &&
|
|
25
|
+
(value.paymentHash === undefined || typeof value.paymentHash === "string");
|
|
26
|
+
}
|
|
27
|
+
function isWalletPaymentRecord(value) {
|
|
28
|
+
if (!isRecord(value) || !isNonNegativeNumber(value.amountMsat) || typeof value.createdAt !== "string" ||
|
|
29
|
+
typeof value.id !== "string" || typeof value.updatedAt !== "string" ||
|
|
30
|
+
!hasOnlyKeys(value, ["amountMsat", "createdAt", "direction", "failureCode", "id", "paymentHash", "status", "updatedAt"]))
|
|
31
|
+
return false;
|
|
32
|
+
return (value.direction === "incoming" || value.direction === "outgoing") &&
|
|
33
|
+
(value.status === "pending" || value.status === "succeeded" || value.status === "failed" || value.status === "expired") &&
|
|
34
|
+
(value.failureCode === undefined || typeof value.failureCode === "string") &&
|
|
35
|
+
(value.paymentHash === undefined || typeof value.paymentHash === "string");
|
|
36
|
+
}
|
|
37
|
+
function isWalletL402Receipt(value) {
|
|
38
|
+
return isRecord(value) && hasOnlyKeys(value, ["amountMsat", "paidAt", "paymentHash", "receiptId", "resource"]) &&
|
|
39
|
+
isNonNegativeNumber(value.amountMsat) && typeof value.paidAt === "string" &&
|
|
40
|
+
typeof value.receiptId === "string" && typeof value.resource === "string" &&
|
|
41
|
+
(value.paymentHash === undefined || typeof value.paymentHash === "string");
|
|
42
|
+
}
|
|
43
|
+
function isNonNegativeNumber(value) {
|
|
44
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
45
|
+
}
|
|
46
|
+
function isRecord(value) {
|
|
47
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
48
|
+
}
|
|
49
|
+
function hasOnlyKeys(value, allowed) {
|
|
50
|
+
const allowedKeys = new Set(allowed);
|
|
51
|
+
return Object.keys(value).every((key) => allowedKeys.has(key));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=wallet-mirror-repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-mirror-repository.js","sourceRoot":"","sources":["../../src/repositories/wallet-mirror-repository.ts"],"names":[],"mappings":"AA0DA,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;QAC/F,CAAC,mBAAmB,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,aAAa,CAAC;QAAE,OAAO,KAAK,CAAC;IACrG,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ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AAE,aAAa,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QAC5G,mBAAmB,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ;QACzE,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ;QACzE,CAAC,KAAK,CAAC,WAAW,KAAK,SAAS,IAAI,OAAO,KAAK,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAc;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,WAAW,CAAC,KAA8B,EAAE,OAA0B;IAC7E,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface StageManifest {
|
|
2
|
+
readonly entry: string;
|
|
3
|
+
readonly integrity: Readonly<Record<string, string>>;
|
|
4
|
+
readonly requires: readonly string[];
|
|
5
|
+
readonly version: string;
|
|
6
|
+
}
|
|
7
|
+
export type StageUiKind = "stage" | "widget";
|
|
8
|
+
export interface StageUiNav {
|
|
9
|
+
readonly order: number;
|
|
10
|
+
readonly section: string;
|
|
11
|
+
}
|
|
12
|
+
export interface StageUiMetadata {
|
|
13
|
+
readonly composes: readonly string[];
|
|
14
|
+
readonly icon?: string;
|
|
15
|
+
readonly kind: StageUiKind;
|
|
16
|
+
readonly nav?: StageUiNav;
|
|
17
|
+
readonly title: string;
|
|
18
|
+
readonly uiApi: 1;
|
|
19
|
+
}
|
|
20
|
+
export interface StageCatalogEntry {
|
|
21
|
+
readonly appName: string;
|
|
22
|
+
readonly assetBase: string;
|
|
23
|
+
readonly manifest: StageManifest;
|
|
24
|
+
readonly manifestSha256: string;
|
|
25
|
+
readonly ui: StageUiMetadata;
|
|
26
|
+
}
|
|
27
|
+
export interface StageRegistrySnapshot {
|
|
28
|
+
readonly entries: readonly StageCatalogEntry[];
|
|
29
|
+
readonly revision: string;
|
|
30
|
+
}
|
|
31
|
+
export interface StageRegistryPort {
|
|
32
|
+
read(): Promise<StageRegistrySnapshot | undefined>;
|
|
33
|
+
write(snapshot: StageRegistrySnapshot): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export interface PreparedStageAsset {
|
|
36
|
+
readonly appName: string;
|
|
37
|
+
readonly entryUrl: string;
|
|
38
|
+
readonly manifestSha256: string;
|
|
39
|
+
readonly version: string;
|
|
40
|
+
}
|
|
41
|
+
export interface StageAssetPort {
|
|
42
|
+
prepare(appName: string, manifest: StageManifest): Promise<PreparedStageAsset>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=repositories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repositories.d.ts","sourceRoot":"","sources":["../src/repositories.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1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,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAChF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repositories.js","sourceRoot":"","sources":["../src/repositories.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ScheduledJob {
|
|
2
|
+
readonly cadenceMs?: number;
|
|
3
|
+
readonly dueAt: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
run(): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export interface SchedulerPort {
|
|
8
|
+
cancel(name: string): void;
|
|
9
|
+
register(job: ScheduledJob): void;
|
|
10
|
+
shutdown(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=scheduler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../src/scheduler.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.js","sourceRoot":"","sources":["../src/scheduler.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { StageRegistryPort } from "./repositories.js";
|
|
2
|
+
import type { DurableRepositoryEventStore } from "./repositories/durable-event.js";
|
|
3
|
+
import type { ConversationRepository, NotificationRepository, RepositoryEvent } from "./repositories/conversation-repository.js";
|
|
4
|
+
import type { OutboxRepository, OutboxRepositoryEvent } from "./repositories/outbox.js";
|
|
5
|
+
import type { SettingsRepository, SettingsRepositoryEvent } from "./repositories/settings.js";
|
|
6
|
+
import type { SyncLedgerRepository, SyncLedgerRepositoryEvent } from "./repositories/sync-ledger.js";
|
|
7
|
+
import type { AgentRepository, GraphRepository, RevisionedRepositoryEvent, RevisionedSettingsRepository } from "./repositories/revisioned-repository.js";
|
|
8
|
+
import type { WalletMirrorRepository } from "./repositories/wallet-mirror-repository.js";
|
|
9
|
+
export declare const RESET_LOCAL_STORAGE_CONFIRMATION = "RESET LOCAL CLIENT DATA";
|
|
10
|
+
export type StorageRecoveryCode = "checksum-drift" | "corrupt" | "diagnostic-failed" | "identity-source-unavailable" | "migration-failed" | "opfs-unavailable" | "quota-exceeded" | "worker-operation-timeout" | "worker-preparation-timeout" | "writer-conflict";
|
|
11
|
+
export declare const STORAGE_RECOVERY_MESSAGES: {
|
|
12
|
+
readonly "checksum-drift": "Local schema history does not match this client build";
|
|
13
|
+
readonly corrupt: "Local SQLite data failed its integrity check";
|
|
14
|
+
readonly "diagnostic-failed": "Encrypted storage diagnostic creation failed";
|
|
15
|
+
readonly "identity-source-unavailable": "Protected identity metadata is temporarily unavailable";
|
|
16
|
+
readonly "migration-failed": "Local SQLite schema migration failed";
|
|
17
|
+
readonly "opfs-unavailable": "Persistent browser storage is unavailable";
|
|
18
|
+
readonly "quota-exceeded": "Persistent browser storage quota is exhausted";
|
|
19
|
+
readonly "worker-operation-timeout": "Persistent storage operation timed out";
|
|
20
|
+
readonly "worker-preparation-timeout": "Protected storage request preparation timed out";
|
|
21
|
+
readonly "writer-conflict": "Another client-node storage writer is active";
|
|
22
|
+
};
|
|
23
|
+
export interface StorageReadyState {
|
|
24
|
+
readonly schemaVersion: number;
|
|
25
|
+
/** Changes only after a destructive local-storage replacement. */
|
|
26
|
+
readonly storageGeneration?: number;
|
|
27
|
+
readonly status: "ready";
|
|
28
|
+
}
|
|
29
|
+
export interface StorageStartingState {
|
|
30
|
+
readonly schemaVersion: number;
|
|
31
|
+
readonly storageGeneration?: number;
|
|
32
|
+
readonly status: "starting";
|
|
33
|
+
}
|
|
34
|
+
export interface StorageRecoveryRequiredState {
|
|
35
|
+
readonly actions: {
|
|
36
|
+
readonly exportDiagnostic: boolean;
|
|
37
|
+
readonly reset: true;
|
|
38
|
+
readonly retry: true;
|
|
39
|
+
};
|
|
40
|
+
readonly code: StorageRecoveryCode;
|
|
41
|
+
readonly message: string;
|
|
42
|
+
readonly schemaVersion: number;
|
|
43
|
+
readonly storageGeneration?: number;
|
|
44
|
+
readonly status: "recovery-required";
|
|
45
|
+
}
|
|
46
|
+
export type StorageRecoveryState = StorageReadyState | StorageRecoveryRequiredState | StorageStartingState;
|
|
47
|
+
export interface EncryptedStorageDiagnostic {
|
|
48
|
+
readonly algorithm: "AES-GCM";
|
|
49
|
+
readonly ciphertextBase64: string;
|
|
50
|
+
readonly createdAt: string;
|
|
51
|
+
readonly format: "node-client-sqlite-diagnostic-v1";
|
|
52
|
+
readonly ivBase64: string;
|
|
53
|
+
readonly kdf: {
|
|
54
|
+
readonly hash: "SHA-256";
|
|
55
|
+
readonly iterations: 310_000;
|
|
56
|
+
readonly name: "PBKDF2";
|
|
57
|
+
readonly saltBase64: string;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export interface StorageDatabasePort {
|
|
61
|
+
readonly repositories: StorageRepositoryPort;
|
|
62
|
+
close(): Promise<void>;
|
|
63
|
+
exportEncryptedDiagnostic(options: {
|
|
64
|
+
readonly passphrase: string;
|
|
65
|
+
}): Promise<EncryptedStorageDiagnostic>;
|
|
66
|
+
initialize(): Promise<StorageRecoveryState>;
|
|
67
|
+
refreshIdentityMetadata(): Promise<void>;
|
|
68
|
+
recoveryState(): Promise<StorageRecoveryState>;
|
|
69
|
+
reset(options: {
|
|
70
|
+
readonly confirmation: string;
|
|
71
|
+
}): Promise<StorageRecoveryState>;
|
|
72
|
+
retry(): Promise<StorageRecoveryState>;
|
|
73
|
+
subscribeRecoveryState(listener: (state: StorageRecoveryState) => void): () => void;
|
|
74
|
+
}
|
|
75
|
+
export type StorageRepositoryEvent = OutboxRepositoryEvent | RepositoryEvent | RevisionedRepositoryEvent | SettingsRepositoryEvent | SyncLedgerRepositoryEvent;
|
|
76
|
+
export interface StorageRepositoryPort {
|
|
77
|
+
/** Optional for compatibility with storage implementations predating P4 domain repositories. */
|
|
78
|
+
readonly conversations?: ConversationRepository;
|
|
79
|
+
readonly events: DurableRepositoryEventStore<StorageRepositoryEvent>;
|
|
80
|
+
/** Optional for compatibility with storage implementations predating P4 domain repositories. */
|
|
81
|
+
readonly notifications?: NotificationRepository;
|
|
82
|
+
/** Optional for compatibility with storage implementations predating Task 26 repositories. */
|
|
83
|
+
readonly agents?: AgentRepository;
|
|
84
|
+
/** Optional for compatibility with storage implementations predating Task 26 repositories. */
|
|
85
|
+
readonly graphs?: GraphRepository;
|
|
86
|
+
readonly outbox: OutboxRepository;
|
|
87
|
+
/** Optional for compatibility with storage implementations predating Task 26 repositories. */
|
|
88
|
+
readonly revisionedSettings?: RevisionedSettingsRepository;
|
|
89
|
+
/** Optional for compatibility with storage implementations predating Task 27 repositories. */
|
|
90
|
+
readonly wallet?: WalletMirrorRepository;
|
|
91
|
+
readonly settings: SettingsRepository;
|
|
92
|
+
readonly syncLedger: SyncLedgerRepository;
|
|
93
|
+
}
|
|
94
|
+
export interface StoragePort extends StorageDatabasePort {
|
|
95
|
+
readonly stages: StageRegistryPort;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.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AAE,iBAAiB,CAAC;CACpC"}
|
package/dist/storage.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const RESET_LOCAL_STORAGE_CONFIRMATION = "RESET LOCAL CLIENT DATA";
|
|
2
|
+
export const STORAGE_RECOVERY_MESSAGES = {
|
|
3
|
+
"checksum-drift": "Local schema history does not match this client build",
|
|
4
|
+
corrupt: "Local SQLite data failed its integrity check",
|
|
5
|
+
"diagnostic-failed": "Encrypted storage diagnostic creation failed",
|
|
6
|
+
"identity-source-unavailable": "Protected identity metadata is temporarily unavailable",
|
|
7
|
+
"migration-failed": "Local SQLite schema migration failed",
|
|
8
|
+
"opfs-unavailable": "Persistent browser storage is unavailable",
|
|
9
|
+
"quota-exceeded": "Persistent browser storage quota is exhausted",
|
|
10
|
+
"worker-operation-timeout": "Persistent storage operation timed out",
|
|
11
|
+
"worker-preparation-timeout": "Protected storage request preparation timed out",
|
|
12
|
+
"writer-conflict": "Another client-node storage writer is active",
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAC,MAAM,gCAAgC,GAAG,yBAAyB,CAAC;AAc1E,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,gBAAgB,EAAE,uDAAuD;IACzE,OAAO,EAAE,8CAA8C;IACvD,mBAAmB,EAAE,8CAA8C;IACnE,6BAA6B,EAAE,wDAAwD;IACvF,kBAAkB,EAAE,sCAAsC;IAC1D,kBAAkB,EAAE,2CAA2C;IAC/D,gBAAgB,EAAE,+CAA+C;IACjE,0BAA0B,EAAE,wCAAwC;IACpE,4BAA4B,EAAE,iDAAiD;IAC/E,iBAAiB,EAAE,8CAA8C;CACD,CAAC"}
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type ThemePreference = "light" | "dark";
|
|
2
|
+
/**
|
|
3
|
+
* Boundary port for the shell's dark-mode plumbing (`client/ui/src/shell/theme-init.ts`).
|
|
4
|
+
*
|
|
5
|
+
* `client/ui` may never call `localStorage` or `matchMedia` directly (boundary rules
|
|
6
|
+
* B2/B3, `client/scripts/check-boundaries.mjs`) — this is the narrow surface
|
|
7
|
+
* `client/adapters-web`'s `createBrowserThemeEnvironment()` implements against the real
|
|
8
|
+
* globals, and the composition root (`system/pwa/src/main.ts`) registers it (via
|
|
9
|
+
* `client/ui`'s `configureThemeEnvironment`) before the shell's first paint. Every method is
|
|
10
|
+
* synchronous and side-effect-free beyond the read/write it names — `theme-init.ts`'s
|
|
11
|
+
* anti-FOUC contract requires resolving the initial theme before the shadow tree's first
|
|
12
|
+
* paint, which is before the kernel connection (`KernelRpcClient`, itself an async
|
|
13
|
+
* `SharedWorker`/leader-tab bridge) even exists, so this can never be mediated through
|
|
14
|
+
* `@econ-v1/rpc` the way ordinary UI reads/writes are (rule S4).
|
|
15
|
+
*/
|
|
16
|
+
export interface ThemeEnvironmentPort {
|
|
17
|
+
/** Reads the persisted preference, or `undefined` if unset or storage is unavailable
|
|
18
|
+
* (private browsing, quota). */
|
|
19
|
+
getStoredTheme(): ThemePreference | undefined;
|
|
20
|
+
/** Persists a preference. Implementations MUST swallow storage failures (private
|
|
21
|
+
* browsing, quota) rather than throwing. */
|
|
22
|
+
setStoredTheme(preference: ThemePreference): void;
|
|
23
|
+
/** Current `(prefers-color-scheme: dark)` match; `false` if the environment doesn't
|
|
24
|
+
* support media queries. */
|
|
25
|
+
prefersDarkColorScheme(): boolean;
|
|
26
|
+
/** Subscribes to live `(prefers-color-scheme: dark)` changes. Returns an unsubscribe
|
|
27
|
+
* function, or `undefined` if the environment doesn't support live media queries. */
|
|
28
|
+
watchDarkColorScheme(onChange: (matches: boolean) => void): (() => void) | undefined;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,CAAC;AAE/C;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,oBAAoB;IACnC;oCACgC;IAChC,cAAc,IAAI,eAAe,GAAG,SAAS,CAAC;IAC9C;gDAC4C;IAC5C,cAAc,CAAC,UAAU,EAAE,eAAe,GAAG,IAAI,CAAC;IAClD;gCAC4B;IAC5B,sBAAsB,IAAI,OAAO,CAAC;IAClC;yFACqF;IACrF,oBAAoB,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;CACtF"}
|
package/dist/theme.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@econ-v1/ports",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Platform-neutral ports for Node client applications",
|
|
5
|
+
"license": "MIT OR Apache-2.0",
|
|
6
|
+
"author": "Node contributors",
|
|
7
|
+
"homepage": "https://github.com/econ-v1/node",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/econ-v1/node.git",
|
|
11
|
+
"directory": "client/ports"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/econ-v1/node/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"node-client",
|
|
18
|
+
"ports",
|
|
19
|
+
"typescript"
|
|
20
|
+
],
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "rm -rf dist && tsc -b --pretty false",
|
|
26
|
+
"lint": "eslint src",
|
|
27
|
+
"prepack": "npm run build",
|
|
28
|
+
"test": "vitest run --passWithNoTests",
|
|
29
|
+
"type-check": "tsc -b --pretty false"
|
|
30
|
+
},
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"import": "./dist/index.js",
|
|
35
|
+
"default": "./dist/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist/**/*.d.ts",
|
|
40
|
+
"dist/**/*.d.ts.map",
|
|
41
|
+
"dist/**/*.js",
|
|
42
|
+
"dist/**/*.js.map",
|
|
43
|
+
"!dist/**/*.test.*"
|
|
44
|
+
],
|
|
45
|
+
"sideEffects": false,
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=18"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
}
|
|
52
|
+
}
|