plsremind 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +277 -2
- package/dist/cache.d.ts +54 -0
- package/dist/cache.js +287 -0
- package/dist/client.d.ts +39 -0
- package/dist/client.js +199 -0
- package/dist/convert.d.ts +8 -0
- package/dist/convert.js +123 -0
- package/dist/duration.d.ts +4 -0
- package/dist/duration.js +35 -0
- package/dist/emitter.d.ts +10 -0
- package/dist/emitter.js +39 -0
- package/dist/errors.d.ts +21 -0
- package/dist/errors.js +31 -0
- package/dist/events.d.ts +152 -0
- package/dist/events.js +21 -0
- package/dist/gateway.d.ts +34 -0
- package/dist/gateway.js +283 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +4 -0
- package/dist/optimistic/index.d.ts +51 -0
- package/dist/optimistic/index.js +540 -0
- package/dist/rest.d.ts +212 -0
- package/dist/rest.js +394 -0
- package/dist/types.d.ts +307 -0
- package/dist/types.js +1 -0
- package/package.json +58 -4
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
export type Priority = "low" | "normal" | "high";
|
|
2
|
+
export type ItemStatus = "open" | "done";
|
|
3
|
+
export type FollowUp = "never" | "daily" | "twice_daily";
|
|
4
|
+
export type ReminderKind = "before" | "due" | "follow_up" | "manual";
|
|
5
|
+
export type DeliveryStatus = "pending" | "delivered" | "failed" | "superseded" | "cancelled" | "expired";
|
|
6
|
+
export type Intent = "users" | "lists" | "items" | "plans" | "history" | "deliveries";
|
|
7
|
+
export type Role = "user" | "admin";
|
|
8
|
+
export type Registration = "open" | "invite";
|
|
9
|
+
export type ProviderType = "password" | "github" | "discord" | "oidc";
|
|
10
|
+
/** One page of a listing. `nextCursor` is null on the last page. */
|
|
11
|
+
export interface Page<T> {
|
|
12
|
+
readonly data: readonly T[];
|
|
13
|
+
readonly nextCursor: string | null;
|
|
14
|
+
}
|
|
15
|
+
export interface LoginMethod {
|
|
16
|
+
readonly key: string;
|
|
17
|
+
readonly type: ProviderType;
|
|
18
|
+
readonly name: string;
|
|
19
|
+
/** Whether people can log in with it. */
|
|
20
|
+
readonly login: boolean;
|
|
21
|
+
/** Whether logged-in users can link their account there. */
|
|
22
|
+
readonly link: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface Info {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly version: string;
|
|
27
|
+
readonly gatewayUrl: string;
|
|
28
|
+
readonly setupRequired: boolean;
|
|
29
|
+
readonly registration: Registration;
|
|
30
|
+
readonly loginMethods: readonly LoginMethod[];
|
|
31
|
+
}
|
|
32
|
+
/** Local times of day as text, for example "22:00". */
|
|
33
|
+
export interface QuietHours {
|
|
34
|
+
readonly start: string;
|
|
35
|
+
readonly end: string;
|
|
36
|
+
}
|
|
37
|
+
export interface User {
|
|
38
|
+
readonly id: string;
|
|
39
|
+
readonly displayName: string;
|
|
40
|
+
readonly role: Role;
|
|
41
|
+
readonly timezone: string;
|
|
42
|
+
readonly quietHours: QuietHours | null;
|
|
43
|
+
readonly locale: string | null;
|
|
44
|
+
/** The user's own client settings. The SDK hands them through as they are. */
|
|
45
|
+
readonly preferences: Readonly<Record<string, unknown>>;
|
|
46
|
+
readonly createdAt: Date;
|
|
47
|
+
}
|
|
48
|
+
export interface UserSummary {
|
|
49
|
+
readonly id: string;
|
|
50
|
+
readonly displayName: string;
|
|
51
|
+
readonly timezone: string;
|
|
52
|
+
readonly quietHours: QuietHours | null;
|
|
53
|
+
readonly locale: string | null;
|
|
54
|
+
}
|
|
55
|
+
/** The profile a connection sees of a user in the gateway. */
|
|
56
|
+
export interface ConnectionUser extends UserSummary {
|
|
57
|
+
readonly externalIds: readonly string[];
|
|
58
|
+
readonly remind: boolean;
|
|
59
|
+
}
|
|
60
|
+
export type Profile = User | ConnectionUser;
|
|
61
|
+
export interface NewPasswordAccount {
|
|
62
|
+
readonly username: string;
|
|
63
|
+
readonly password: string;
|
|
64
|
+
readonly displayName?: string;
|
|
65
|
+
readonly timezone?: string;
|
|
66
|
+
readonly locale?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface Identity {
|
|
69
|
+
readonly id: string;
|
|
70
|
+
readonly provider: string;
|
|
71
|
+
readonly externalId: string;
|
|
72
|
+
readonly displayName: string;
|
|
73
|
+
/** The handle at the provider; empty when it has none or the account was linked before the hub kept it. */
|
|
74
|
+
readonly username: string;
|
|
75
|
+
/** Whether `rest.identityAvatarUrl(id)` has a picture. */
|
|
76
|
+
readonly hasAvatar: boolean;
|
|
77
|
+
readonly createdAt: Date;
|
|
78
|
+
}
|
|
79
|
+
export interface Settings {
|
|
80
|
+
readonly name: string;
|
|
81
|
+
readonly registration: Registration;
|
|
82
|
+
}
|
|
83
|
+
export interface Invite {
|
|
84
|
+
readonly id: string;
|
|
85
|
+
/** Only present in the answer that created the invite. */
|
|
86
|
+
readonly code?: string;
|
|
87
|
+
readonly createdAt: Date;
|
|
88
|
+
readonly expiresAt: Date;
|
|
89
|
+
readonly usedAt: Date | null;
|
|
90
|
+
readonly usedBy: string | null;
|
|
91
|
+
}
|
|
92
|
+
export interface AdminUser {
|
|
93
|
+
readonly id: string;
|
|
94
|
+
readonly displayName: string;
|
|
95
|
+
readonly role: Role;
|
|
96
|
+
readonly timezone: string;
|
|
97
|
+
readonly quietHours: QuietHours | null;
|
|
98
|
+
readonly locale: string | null;
|
|
99
|
+
readonly createdAt: Date;
|
|
100
|
+
readonly disabled: boolean;
|
|
101
|
+
}
|
|
102
|
+
export interface PersonalToken {
|
|
103
|
+
readonly id: string;
|
|
104
|
+
readonly name: string;
|
|
105
|
+
readonly remind: boolean;
|
|
106
|
+
/** Only present in the answer that created the token. */
|
|
107
|
+
readonly token?: string;
|
|
108
|
+
readonly createdAt: Date;
|
|
109
|
+
readonly lastUsedAt: Date | null;
|
|
110
|
+
}
|
|
111
|
+
export interface List {
|
|
112
|
+
readonly id: string;
|
|
113
|
+
readonly name: string;
|
|
114
|
+
readonly position: number;
|
|
115
|
+
readonly isInbox: boolean;
|
|
116
|
+
readonly createdAt: Date;
|
|
117
|
+
readonly updatedAt: Date;
|
|
118
|
+
}
|
|
119
|
+
export interface ListName {
|
|
120
|
+
readonly name: string;
|
|
121
|
+
}
|
|
122
|
+
export interface Order {
|
|
123
|
+
readonly ids: readonly string[];
|
|
124
|
+
}
|
|
125
|
+
export interface ReminderPlan {
|
|
126
|
+
readonly priority: Priority;
|
|
127
|
+
/** How long before the deadline to remind, in milliseconds. */
|
|
128
|
+
readonly before: readonly number[];
|
|
129
|
+
readonly followUp: FollowUp;
|
|
130
|
+
readonly isDefault: boolean;
|
|
131
|
+
}
|
|
132
|
+
export interface ReminderOverride {
|
|
133
|
+
readonly mode: "off" | "custom";
|
|
134
|
+
readonly before?: readonly number[];
|
|
135
|
+
}
|
|
136
|
+
export interface ItemInput {
|
|
137
|
+
readonly title?: string;
|
|
138
|
+
readonly note?: string;
|
|
139
|
+
readonly listId?: string;
|
|
140
|
+
readonly priority?: Priority;
|
|
141
|
+
readonly dueAt?: Date | null;
|
|
142
|
+
/** A whole day as text, for example "2026-11-13". */
|
|
143
|
+
readonly dueDate?: string | null;
|
|
144
|
+
readonly subitems?: readonly string[];
|
|
145
|
+
readonly reminderOverride?: ReminderOverride | null;
|
|
146
|
+
}
|
|
147
|
+
export interface Subitem {
|
|
148
|
+
readonly id: string;
|
|
149
|
+
readonly itemId: string;
|
|
150
|
+
readonly title: string;
|
|
151
|
+
readonly done: boolean;
|
|
152
|
+
readonly position: number;
|
|
153
|
+
readonly createdAt: Date;
|
|
154
|
+
readonly updatedAt: Date;
|
|
155
|
+
}
|
|
156
|
+
export interface ManualReminder {
|
|
157
|
+
readonly id: string;
|
|
158
|
+
readonly itemId: string;
|
|
159
|
+
readonly remindAt: Date;
|
|
160
|
+
readonly createdAt: Date;
|
|
161
|
+
}
|
|
162
|
+
export interface Item {
|
|
163
|
+
readonly id: string;
|
|
164
|
+
readonly listId: string;
|
|
165
|
+
readonly title: string;
|
|
166
|
+
readonly note: string;
|
|
167
|
+
readonly priority: Priority;
|
|
168
|
+
readonly dueAt: Date | null;
|
|
169
|
+
/** Set for all-day items: the day as text, for example "2026-11-13". */
|
|
170
|
+
readonly dueDate: string | null;
|
|
171
|
+
readonly allDay: boolean;
|
|
172
|
+
readonly status: ItemStatus;
|
|
173
|
+
readonly completedAt: Date | null;
|
|
174
|
+
readonly reminderOverride: ReminderOverride | null;
|
|
175
|
+
readonly subitems: readonly Subitem[];
|
|
176
|
+
readonly reminders: readonly ManualReminder[];
|
|
177
|
+
readonly createdAt: Date;
|
|
178
|
+
readonly updatedAt: Date;
|
|
179
|
+
}
|
|
180
|
+
export interface ScheduledReminder {
|
|
181
|
+
readonly kind: ReminderKind;
|
|
182
|
+
readonly offset: number | null;
|
|
183
|
+
readonly reminderId: string | null;
|
|
184
|
+
readonly scheduledFor: Date;
|
|
185
|
+
readonly fireAt: Date;
|
|
186
|
+
}
|
|
187
|
+
export interface Connection {
|
|
188
|
+
readonly id: string;
|
|
189
|
+
readonly name: string;
|
|
190
|
+
readonly description: string;
|
|
191
|
+
readonly provider: string;
|
|
192
|
+
readonly enabled: boolean;
|
|
193
|
+
readonly allowedIntents: readonly Intent[];
|
|
194
|
+
/** Where users add the app on the provider's side; empty when there is no such place. */
|
|
195
|
+
readonly installUrl: string;
|
|
196
|
+
/** How many users the connection would remind now. */
|
|
197
|
+
readonly reach: number;
|
|
198
|
+
/** Only present in the answer that created the connection or rotated its token. */
|
|
199
|
+
readonly token?: string;
|
|
200
|
+
readonly createdAt: Date;
|
|
201
|
+
readonly lastUsedAt: Date | null;
|
|
202
|
+
}
|
|
203
|
+
export interface UserConnection {
|
|
204
|
+
readonly id: string;
|
|
205
|
+
readonly name: string;
|
|
206
|
+
readonly description: string;
|
|
207
|
+
readonly provider: string;
|
|
208
|
+
readonly linked: boolean;
|
|
209
|
+
readonly enabled: boolean;
|
|
210
|
+
readonly remind: boolean;
|
|
211
|
+
readonly intents: readonly Intent[];
|
|
212
|
+
/** Where the user adds the app on the provider's side; empty when there is no such place. */
|
|
213
|
+
readonly installUrl: string;
|
|
214
|
+
/**
|
|
215
|
+
* Whether linking the account at the provider also adds the app, as the Discord sign-in does
|
|
216
|
+
* for the bot of its own application. Start the link then rather than opening `installUrl`.
|
|
217
|
+
*/
|
|
218
|
+
readonly installsWithLink: boolean;
|
|
219
|
+
/** How the newest delivery through this connection to the user went, null before the first. */
|
|
220
|
+
readonly lastDelivery: LastDelivery | null;
|
|
221
|
+
}
|
|
222
|
+
export interface LastDelivery {
|
|
223
|
+
readonly status: "pending" | "delivered" | "failed" | "expired";
|
|
224
|
+
/** What the connection reported when it failed; empty otherwise. */
|
|
225
|
+
readonly reason: string;
|
|
226
|
+
/** When it was closed, or created while it is still pending. */
|
|
227
|
+
readonly at: Date;
|
|
228
|
+
/** True when it was a test the user sent, not a reminder. */
|
|
229
|
+
readonly test: boolean;
|
|
230
|
+
}
|
|
231
|
+
/** A test the user asked an app to send. */
|
|
232
|
+
export interface ConnectionTest {
|
|
233
|
+
readonly id: string;
|
|
234
|
+
readonly connectionId: string;
|
|
235
|
+
readonly status: "pending" | "delivered" | "failed" | "unanswered";
|
|
236
|
+
/** For `failed` what the app reported; for `unanswered` `not_connected` or `no_answer`. */
|
|
237
|
+
readonly reason: string;
|
|
238
|
+
readonly createdAt: Date;
|
|
239
|
+
readonly closedAt: Date | null;
|
|
240
|
+
}
|
|
241
|
+
/** What an app receives to show the user that it reaches them. */
|
|
242
|
+
export interface DeliveryTest {
|
|
243
|
+
readonly id: string;
|
|
244
|
+
readonly user: DeliveryUser;
|
|
245
|
+
}
|
|
246
|
+
export interface LoginProvider {
|
|
247
|
+
readonly key: string;
|
|
248
|
+
readonly type: ProviderType;
|
|
249
|
+
readonly name: string;
|
|
250
|
+
readonly loginEnabled: boolean;
|
|
251
|
+
readonly linkEnabled: boolean;
|
|
252
|
+
readonly clientId: string;
|
|
253
|
+
readonly hasClientSecret: boolean;
|
|
254
|
+
readonly issuerUrl: string;
|
|
255
|
+
}
|
|
256
|
+
export interface DeliveryReminder {
|
|
257
|
+
readonly id: string;
|
|
258
|
+
readonly kind: ReminderKind;
|
|
259
|
+
readonly offset?: number;
|
|
260
|
+
readonly scheduledFor: Date;
|
|
261
|
+
}
|
|
262
|
+
export interface DeliveryUser {
|
|
263
|
+
readonly id: string;
|
|
264
|
+
readonly displayName: string;
|
|
265
|
+
readonly timezone: string;
|
|
266
|
+
readonly locale: string | null;
|
|
267
|
+
readonly externalIds?: readonly string[];
|
|
268
|
+
}
|
|
269
|
+
export interface Delivery {
|
|
270
|
+
readonly id: string;
|
|
271
|
+
readonly attempt: number;
|
|
272
|
+
readonly late: boolean;
|
|
273
|
+
readonly reminder: DeliveryReminder;
|
|
274
|
+
readonly item: Item;
|
|
275
|
+
readonly user: DeliveryUser;
|
|
276
|
+
}
|
|
277
|
+
export interface DeliveryResult {
|
|
278
|
+
readonly id: string;
|
|
279
|
+
readonly status: DeliveryStatus;
|
|
280
|
+
readonly reason: string;
|
|
281
|
+
}
|
|
282
|
+
export interface LookupResult {
|
|
283
|
+
readonly id: string;
|
|
284
|
+
readonly displayName: string;
|
|
285
|
+
readonly timezone: string;
|
|
286
|
+
}
|
|
287
|
+
export interface ReminderLogDelivery {
|
|
288
|
+
readonly id: string;
|
|
289
|
+
readonly channel: {
|
|
290
|
+
readonly kind: "connection" | "token";
|
|
291
|
+
readonly id: string;
|
|
292
|
+
readonly name: string;
|
|
293
|
+
};
|
|
294
|
+
readonly status: DeliveryStatus;
|
|
295
|
+
readonly reason: string;
|
|
296
|
+
readonly attempts: number;
|
|
297
|
+
}
|
|
298
|
+
export interface ReminderLogEntry {
|
|
299
|
+
readonly id: string;
|
|
300
|
+
readonly itemId: string;
|
|
301
|
+
readonly kind: ReminderKind;
|
|
302
|
+
readonly offset?: number;
|
|
303
|
+
readonly scheduledFor: Date;
|
|
304
|
+
readonly firedAt: Date;
|
|
305
|
+
readonly outcome: "fired" | "missed" | "superseded";
|
|
306
|
+
readonly deliveries: readonly ReminderLogDelivery[];
|
|
307
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plsremind",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Client for the plsremind hub: gateway, cache and REST",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "rayakame",
|
|
7
|
+
"homepage": "https://github.com/rayakame/plsremind/tree/main/sdk/ts#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/rayakame/plsremind.git",
|
|
11
|
+
"directory": "sdk/ts"
|
|
12
|
+
},
|
|
13
|
+
"bugs": "https://github.com/rayakame/plsremind/issues",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"plsremind",
|
|
16
|
+
"todo",
|
|
17
|
+
"reminders",
|
|
18
|
+
"gateway",
|
|
19
|
+
"sdk"
|
|
20
|
+
],
|
|
21
|
+
"type": "module",
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=22"
|
|
24
|
+
},
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./optimistic": {
|
|
31
|
+
"types": "./dist/optimistic/index.d.ts",
|
|
32
|
+
"default": "./dist/optimistic/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist"
|
|
37
|
+
],
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsc -p tsconfig.build.json",
|
|
43
|
+
"dev": "tsc -p tsconfig.build.json --watch",
|
|
44
|
+
"prepare": "tsc -p tsconfig.build.json",
|
|
45
|
+
"check": "tsc --noEmit && prettier --check .",
|
|
46
|
+
"format": "prettier --write .",
|
|
47
|
+
"test": "vitest run --project unit",
|
|
48
|
+
"test:hub": "vitest run --project hub",
|
|
49
|
+
"check:pack": "node scripts/check-pack.mjs"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/node": "^26.6.6",
|
|
53
|
+
"@types/pg": "^8.23.1",
|
|
54
|
+
"pg": "^8.23.1",
|
|
55
|
+
"prettier": "^3.10.1",
|
|
56
|
+
"typescript": "^7.0.2",
|
|
57
|
+
"vitest": "^5.1.0",
|
|
58
|
+
"yaml": "^2.9.1"
|
|
59
|
+
}
|
|
60
|
+
}
|