workerdeck 2.2.0 → 2.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.
package/build/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as ConfigError, d as parseArgs, f as resolveInstanceConfig, r as startInstance, u as loadConfigFile } from "./instance-
|
|
2
|
+
import { a as ConfigError, d as parseArgs, f as resolveInstanceConfig, r as startInstance, u as loadConfigFile } from "./instance-Bdf5e-lQ.mjs";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
package/build/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Authenticator, WorkerServer, WorkerServerOptions } from "@workerdeck/server";
|
|
2
2
|
import { KeyObject } from "node:crypto";
|
|
3
|
-
import { IncomingMessage, ServerResponse } from "node:http";
|
|
4
3
|
import { ProfileInfo, SessionNotification } from "@workerdeck/protocol";
|
|
4
|
+
import { IncomingMessage, ServerResponse } from "node:http";
|
|
5
5
|
//#region src/apns/client.d.ts
|
|
6
6
|
type ApnsEnvironment = 'development' | 'production';
|
|
7
7
|
type ApnsConfig = {
|
|
@@ -11,10 +11,12 @@ type ApnsConfig = {
|
|
|
11
11
|
topic: string;
|
|
12
12
|
production?: boolean;
|
|
13
13
|
};
|
|
14
|
+
type ApnsPushType = 'alert' | 'liveactivity';
|
|
14
15
|
type ApnsRequest = {
|
|
15
16
|
deviceToken: string;
|
|
16
17
|
environment: ApnsEnvironment;
|
|
17
18
|
payload: unknown;
|
|
19
|
+
pushType?: ApnsPushType;
|
|
18
20
|
priority?: 5 | 10;
|
|
19
21
|
expiration?: number;
|
|
20
22
|
collapseId?: string;
|
|
@@ -200,12 +202,14 @@ type DeviceRecord = {
|
|
|
200
202
|
hostId?: string;
|
|
201
203
|
bundleId?: string;
|
|
202
204
|
platform?: string;
|
|
205
|
+
liveActivityStartToken?: string;
|
|
203
206
|
updatedAt: number;
|
|
204
207
|
};
|
|
205
208
|
type DeviceRegistry = {
|
|
206
209
|
list(): DeviceRecord[];
|
|
207
210
|
register(record: Omit<DeviceRecord, 'updatedAt'>): Promise<void>;
|
|
208
211
|
remove(token: string): Promise<void>;
|
|
212
|
+
clearStartToken(token: string): Promise<void>;
|
|
209
213
|
};
|
|
210
214
|
declare function createDeviceRegistry(options: {
|
|
211
215
|
dir: string | null;
|
|
@@ -214,13 +218,103 @@ declare function createDeviceRegistry(options: {
|
|
|
214
218
|
path: string;
|
|
215
219
|
}) => void;
|
|
216
220
|
}): Promise<DeviceRegistry>;
|
|
217
|
-
declare function createDeviceRoute(registry: DeviceRegistry, authenticate: (req: IncomingMessage) => unknown): (req: IncomingMessage, res: ServerResponse) => Promise<boolean>;
|
|
221
|
+
declare function createDeviceRoute(registry: DeviceRegistry | null, authenticate: (req: IncomingMessage) => unknown): (req: IncomingMessage, res: ServerResponse) => Promise<boolean>;
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region src/apns/activities.d.ts
|
|
224
|
+
type ActivityPhase = 'starting' | 'live' | 'ending';
|
|
225
|
+
type ActivityRecord = {
|
|
226
|
+
deviceToken: string;
|
|
227
|
+
sessionId: string;
|
|
228
|
+
hostId?: string;
|
|
229
|
+
environment: ApnsEnvironment;
|
|
230
|
+
updateToken?: string;
|
|
231
|
+
phase: ActivityPhase;
|
|
232
|
+
startedAt: number;
|
|
233
|
+
lastPushAt?: number;
|
|
234
|
+
contentHash?: string;
|
|
235
|
+
};
|
|
236
|
+
type ActivityRegistry = {
|
|
237
|
+
list(): ActivityRecord[];
|
|
238
|
+
get(deviceToken: string, sessionId: string): ActivityRecord | undefined;
|
|
239
|
+
forSession(sessionId: string): ActivityRecord[];
|
|
240
|
+
start(record: Omit<ActivityRecord, 'phase' | 'startedAt'> & {
|
|
241
|
+
startedAt?: number;
|
|
242
|
+
}): Promise<ActivityRecord>;
|
|
243
|
+
attach(match: {
|
|
244
|
+
sessionId: string;
|
|
245
|
+
deviceToken?: string;
|
|
246
|
+
environment: ApnsEnvironment;
|
|
247
|
+
}, updateToken: string): Promise<ActivityRecord | undefined>;
|
|
248
|
+
touch(deviceToken: string, sessionId: string, changes: Partial<Pick<ActivityRecord, 'phase' | 'lastPushAt' | 'contentHash'>>): Promise<void>;
|
|
249
|
+
remove(deviceToken: string, sessionId: string): Promise<void>;
|
|
250
|
+
removeByUpdateToken(updateToken: string): Promise<void>;
|
|
251
|
+
};
|
|
252
|
+
declare function createActivityRegistry(options: {
|
|
253
|
+
dir: string | null;
|
|
254
|
+
onError?: (error: unknown, context: {
|
|
255
|
+
op: string;
|
|
256
|
+
path: string;
|
|
257
|
+
}) => void;
|
|
258
|
+
}): Promise<ActivityRegistry>;
|
|
259
|
+
declare function createActivityRoute(registry: ActivityRegistry | null, authenticate: (req: IncomingMessage) => unknown): (req: IncomingMessage, res: ServerResponse) => Promise<boolean>;
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region src/apns/routes.d.ts
|
|
262
|
+
type ApnsRouteHandler = (req: IncomingMessage, res: ServerResponse) => Promise<boolean>;
|
|
263
|
+
declare function createApnsRoute(registries: {
|
|
264
|
+
devices: DeviceRegistry;
|
|
265
|
+
activities: ActivityRegistry;
|
|
266
|
+
} | null, authenticate: (req: IncomingMessage) => unknown): ApnsRouteHandler;
|
|
267
|
+
//#endregion
|
|
268
|
+
//#region src/apns/live-activity.d.ts
|
|
269
|
+
type ActivityAttributes = {
|
|
270
|
+
sessionId: string;
|
|
271
|
+
hostId?: string;
|
|
272
|
+
engine?: string;
|
|
273
|
+
cwdLeaf: string;
|
|
274
|
+
};
|
|
275
|
+
type ActivityChoice = {
|
|
276
|
+
index: number;
|
|
277
|
+
label: string;
|
|
278
|
+
};
|
|
279
|
+
type ActivityRequestState = {
|
|
280
|
+
id: string;
|
|
281
|
+
kind: 'permission' | 'question' | 'plan';
|
|
282
|
+
choices: ActivityChoice[];
|
|
283
|
+
inputJSON?: string;
|
|
284
|
+
};
|
|
285
|
+
type ActivityContentState = {
|
|
286
|
+
phase: ActivityPhaseName;
|
|
287
|
+
title: string;
|
|
288
|
+
headline: string;
|
|
289
|
+
detail?: string;
|
|
290
|
+
startedAtMs: number;
|
|
291
|
+
expiresAtMs?: number;
|
|
292
|
+
pendingCount: number;
|
|
293
|
+
steps?: {
|
|
294
|
+
done: number;
|
|
295
|
+
total: number;
|
|
296
|
+
};
|
|
297
|
+
request?: ActivityRequestState;
|
|
298
|
+
epoch?: number;
|
|
299
|
+
seq?: number;
|
|
300
|
+
decision: null;
|
|
301
|
+
};
|
|
302
|
+
type ActivityPhaseName = 'running' | 'approval' | 'question' | 'plan' | 'done' | 'failed' | 'parked' | 'ended';
|
|
218
303
|
//#endregion
|
|
219
304
|
//#region src/apns/forwarder.d.ts
|
|
220
305
|
type ApnsForwarder = {
|
|
221
306
|
onNotification: (notification: SessionNotification) => void;
|
|
222
307
|
handleRequest: (req: IncomingMessage, res: ServerResponse) => Promise<boolean>;
|
|
223
308
|
deviceCount: () => number;
|
|
309
|
+
activity: {
|
|
310
|
+
start: (attributes: ActivityAttributes, state: ActivityContentState) => void;
|
|
311
|
+
update: (sessionId: string, state: ActivityContentState, options: {
|
|
312
|
+
urgent: boolean;
|
|
313
|
+
}) => void;
|
|
314
|
+
end: (sessionId: string, state: ActivityContentState) => void;
|
|
315
|
+
endAll: (headline: string) => Promise<void>;
|
|
316
|
+
count: () => number;
|
|
317
|
+
};
|
|
224
318
|
close: () => void;
|
|
225
319
|
};
|
|
226
320
|
declare function buildPush(notification: SessionNotification, hostId: string | undefined): Omit<ApnsRequest, 'deviceToken' | 'environment'>;
|
|
@@ -231,5 +325,5 @@ declare function createApnsForwarder(options: {
|
|
|
231
325
|
warn?: (message: string) => void;
|
|
232
326
|
}): Promise<ApnsForwarder>;
|
|
233
327
|
//#endregion
|
|
234
|
-
export { type ApnsClient, type ApnsConfig, type ApnsEnvironment, type ApnsForwarder, type ApnsRequest, type ApnsResult, type AuthSessionStoreOptions, type CliAuth, type CliAuthOptions, type CliFlags, type CliPrincipal, type CliSessionStore, ConfigError, type DeviceRecord, type DeviceRegistry, type Instance, type LoadedConfig, type LoginPageOptions, type MaterializedAuthKey, type ResolvedConfig, type StoredSession, type WorkerDeckConfig, buildPush, createApnsClient, createApnsForwarder, createAuthSessionStore, createCliAuth, createDeviceRegistry, createDeviceRoute, createHostGuard, defaultStateDir, hostnameOf, isLoopback, isLoopbackHostname, loadApnsKey, loadConfigFile, materializeAuthKey, parseArgs, renderLoginPage, resolveInstanceConfig, resolveWebRoot, runGuard, startInstance };
|
|
328
|
+
export { type ActivityRecord, type ActivityRegistry, type ApnsClient, type ApnsConfig, type ApnsEnvironment, type ApnsForwarder, type ApnsRequest, type ApnsResult, type ApnsRouteHandler, type AuthSessionStoreOptions, type CliAuth, type CliAuthOptions, type CliFlags, type CliPrincipal, type CliSessionStore, ConfigError, type DeviceRecord, type DeviceRegistry, type Instance, type LoadedConfig, type LoginPageOptions, type MaterializedAuthKey, type ResolvedConfig, type StoredSession, type WorkerDeckConfig, buildPush, createActivityRegistry, createActivityRoute, createApnsClient, createApnsForwarder, createApnsRoute, createAuthSessionStore, createCliAuth, createDeviceRegistry, createDeviceRoute, createHostGuard, defaultStateDir, hostnameOf, isLoopback, isLoopbackHostname, loadApnsKey, loadConfigFile, materializeAuthKey, parseArgs, renderLoginPage, resolveInstanceConfig, resolveWebRoot, runGuard, startInstance };
|
|
235
329
|
//# sourceMappingURL=index.d.mts.map
|
package/build/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as runGuard } from "./guard-CGPVzJ3Q.mjs";
|
|
2
|
-
import { _ as createApnsForwarder, a as ConfigError, b as
|
|
3
|
-
export { ConfigError, buildPush, createApnsClient, createApnsForwarder, createAuthSessionStore, createCliAuth, createDeviceRegistry, createDeviceRoute, createHostGuard, defaultStateDir, hostnameOf, isLoopback, isLoopbackHostname, loadApnsKey, loadConfigFile, materializeAuthKey, parseArgs, renderLoginPage, resolveInstanceConfig, resolveWebRoot, runGuard, startInstance };
|
|
2
|
+
import { C as createActivityRegistry, S as createDeviceRoute, _ as createApnsForwarder, a as ConfigError, b as createApnsRoute, c as isLoopback, d as parseArgs, f as resolveInstanceConfig, g as buildPush, h as materializeAuthKey, i as renderLoginPage, l as isLoopbackHostname, m as createAuthSessionStore, n as resolveWebRoot, o as defaultStateDir, p as createCliAuth, r as startInstance, s as hostnameOf, t as createHostGuard, u as loadConfigFile, v as createApnsClient, w as createActivityRoute, x as createDeviceRegistry, y as loadApnsKey } from "./instance-Bdf5e-lQ.mjs";
|
|
3
|
+
export { ConfigError, buildPush, createActivityRegistry, createActivityRoute, createApnsClient, createApnsForwarder, createApnsRoute, createAuthSessionStore, createCliAuth, createDeviceRegistry, createDeviceRoute, createHostGuard, defaultStateDir, hostnameOf, isLoopback, isLoopbackHostname, loadApnsKey, loadConfigFile, materializeAuthKey, parseArgs, renderLoginPage, resolveInstanceConfig, resolveWebRoot, runGuard, startInstance };
|