@nemphi/sdk 0.2.4997 → 0.2.5079
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 +59 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +136 -57
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -575,8 +575,9 @@ export interface Notification {
|
|
|
575
575
|
seq?: number;
|
|
576
576
|
}
|
|
577
577
|
/**
|
|
578
|
-
* One event
|
|
579
|
-
*
|
|
578
|
+
* One realtime event of the workspace (`openRealtimeSocket`, which polls
|
|
579
|
+
* `GET /v1/events/poll`; the frames of `GET /v1/events/stream` and
|
|
580
|
+
* `GET /v1/events/socket`).
|
|
580
581
|
* `action` and `notification` are wakeups — re-read the surface, the row
|
|
581
582
|
* itself comes by cursor; the rest is state that only matters while
|
|
582
583
|
* someone is watching.
|
|
@@ -654,19 +655,22 @@ export type RealtimeEvent = {
|
|
|
654
655
|
export type TypingScope = Extract<RealtimeEvent, {
|
|
655
656
|
type: "typing";
|
|
656
657
|
}>["scope"];
|
|
657
|
-
/** An open realtime
|
|
658
|
+
/** An open realtime subscription; `close()` stops it and its retries. */
|
|
658
659
|
export interface RealtimeSocket {
|
|
659
660
|
close(): void;
|
|
660
661
|
}
|
|
661
662
|
export interface RealtimeSocketOptions {
|
|
662
663
|
onEvent: (event: RealtimeEvent) => void;
|
|
663
|
-
/**
|
|
664
|
+
/**
|
|
665
|
+
* Called when the first poll answers, and again when one answers after
|
|
666
|
+
* polls failed; a screen re-reads what it shows here.
|
|
667
|
+
*/
|
|
664
668
|
onOpen?: () => void;
|
|
669
|
+
/** Called when a poll fails after one answered. */
|
|
665
670
|
onClose?: () => void;
|
|
666
671
|
/**
|
|
667
|
-
*
|
|
668
|
-
*
|
|
669
|
-
* cannot set them and should use the app's own stream route instead.
|
|
672
|
+
* Ignored: the subscription polls `GET /v1/events/poll` over `fetch`
|
|
673
|
+
* rather than holding a WebSocket. Kept so existing callers compile.
|
|
670
674
|
*/
|
|
671
675
|
webSocket?: (url: string, headers: Record<string, string>) => WebSocket;
|
|
672
676
|
}
|
|
@@ -1416,6 +1420,47 @@ export interface InvitePreview {
|
|
|
1416
1420
|
role_name?: string;
|
|
1417
1421
|
expires_at: string;
|
|
1418
1422
|
}
|
|
1423
|
+
export type BudgetSection = "income" | "fixed" | "variable" | "savings" | "debt";
|
|
1424
|
+
export type BudgetFrequency = "monthly" | "weekly" | "biweekly" | "quarterly" | "yearly" | "once";
|
|
1425
|
+
/** One month of a budget line (`budget.overview`). Amounts are in cents. */
|
|
1426
|
+
export interface BudgetMonth {
|
|
1427
|
+
/** YYYY-MM. */
|
|
1428
|
+
month: string;
|
|
1429
|
+
plan_cents: number;
|
|
1430
|
+
actual_cents: number;
|
|
1431
|
+
/** Where the actual comes from: a person's record, the ledger, or nowhere yet. */
|
|
1432
|
+
actual_source: "manual" | "ledger" | "none";
|
|
1433
|
+
/** Whether a person set this month's plan instead of the spread one. */
|
|
1434
|
+
plan_set: boolean;
|
|
1435
|
+
/** Whether the line counts in this month at all. */
|
|
1436
|
+
open: boolean;
|
|
1437
|
+
}
|
|
1438
|
+
/** A budget line with its twelve months (`budget.overview`). */
|
|
1439
|
+
export interface BudgetLine {
|
|
1440
|
+
id: string;
|
|
1441
|
+
section: BudgetSection;
|
|
1442
|
+
name: string;
|
|
1443
|
+
frequency: BudgetFrequency;
|
|
1444
|
+
amount_cents: number;
|
|
1445
|
+
due_day: number | null;
|
|
1446
|
+
account_code: string | null;
|
|
1447
|
+
account_name: string | null;
|
|
1448
|
+
owner_user_id: string | null;
|
|
1449
|
+
owner_name: string | null;
|
|
1450
|
+
/** YYYY-MM. */
|
|
1451
|
+
starts_on: string;
|
|
1452
|
+
ends_on: string | null;
|
|
1453
|
+
archived: boolean;
|
|
1454
|
+
months: BudgetMonth[];
|
|
1455
|
+
}
|
|
1456
|
+
/** The budget planner's year (`budget.overview`). */
|
|
1457
|
+
export interface BudgetOverview {
|
|
1458
|
+
year: number;
|
|
1459
|
+
today: string;
|
|
1460
|
+
/** Caja y bancos at the close of the day before the year opens. */
|
|
1461
|
+
opening_cash_cents: number;
|
|
1462
|
+
lines: BudgetLine[];
|
|
1463
|
+
}
|
|
1419
1464
|
export interface RecurringDocument {
|
|
1420
1465
|
id: string;
|
|
1421
1466
|
kind: "invoice" | "bill";
|
|
@@ -8073,6 +8118,7 @@ export interface NemphiClient {
|
|
|
8073
8118
|
}>;
|
|
8074
8119
|
listPolicies(): Promise<PolicyList>;
|
|
8075
8120
|
listRecurringDocuments(): Promise<RecurringDocument[]>;
|
|
8121
|
+
budgetOverview(year?: number): Promise<BudgetOverview>;
|
|
8076
8122
|
createInvite(input: {
|
|
8077
8123
|
email: string;
|
|
8078
8124
|
role: "admin" | "member" | "viewer" | "custom";
|
|
@@ -8464,10 +8510,12 @@ export interface NemphiClient {
|
|
|
8464
8510
|
signal?: AbortSignal;
|
|
8465
8511
|
}): AsyncGenerator<Action, void, void>;
|
|
8466
8512
|
/**
|
|
8467
|
-
* The realtime
|
|
8468
|
-
*
|
|
8469
|
-
*
|
|
8470
|
-
*
|
|
8513
|
+
* The workspace's realtime events, polled from `GET /v1/events/poll`
|
|
8514
|
+
* every two seconds (at once while the server has more), with retries
|
|
8515
|
+
* until `close()`: the ledger and the caller's notifications as
|
|
8516
|
+
* wake-ups, the workspace's frames as they are, and who is online when
|
|
8517
|
+
* that changed. Each poll keeps the caller online. The web app polls the
|
|
8518
|
+
* same route through its own server route.
|
|
8471
8519
|
*/
|
|
8472
8520
|
openRealtimeSocket(options: RealtimeSocketOptions): RealtimeSocket;
|
|
8473
8521
|
/** Say the caller is writing in a thread or an inbox conversation (`POST /v1/events/typing`); nothing is stored. */
|