experimental-a2 0.8.1 → 0.10.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/CHANGELOG.md +42 -0
- package/dist/actor-client.d.ts +46 -0
- package/dist/actor-client.d.ts.map +1 -0
- package/dist/actor-client.js +54 -0
- package/dist/actor-client.js.map +1 -0
- package/dist/actor-react.d.ts +54 -0
- package/dist/actor-react.d.ts.map +1 -0
- package/dist/actor-react.js +79 -0
- package/dist/actor-react.js.map +1 -0
- package/dist/actor-shared-DI7J5upy.js +127 -0
- package/dist/actor-shared-DI7J5upy.js.map +1 -0
- package/dist/actor-shared-USo5MyuF.d.ts +136 -0
- package/dist/actor-shared-USo5MyuF.d.ts.map +1 -0
- package/dist/actor.browser.d.ts +1 -0
- package/dist/actor.browser.js +13 -0
- package/dist/actor.browser.js.map +1 -0
- package/dist/actor.d.ts +176 -0
- package/dist/actor.d.ts.map +1 -0
- package/dist/actor.js +437 -0
- package/dist/actor.js.map +1 -0
- package/dist/ai-server.d.ts +2 -2
- package/dist/ai-server.js +2 -2
- package/dist/ai.d.ts +2 -2
- package/dist/client.d.ts +14 -8
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +238 -58
- package/dist/client.js.map +1 -1
- package/dist/{errors-BQuJpe82.js → errors-DCk6ch5n.js} +16 -2
- package/dist/{errors-BQuJpe82.js.map → errors-DCk6ch5n.js.map} +1 -1
- package/dist/{idempotent-replay-DuqEkYA7.js → idempotent-replay-DVOlyYbx.js} +2 -2
- package/dist/{idempotent-replay-DuqEkYA7.js.map → idempotent-replay-DVOlyYbx.js.map} +1 -1
- package/dist/index.d.ts +16 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/react.d.ts +1 -1
- package/dist/{contract-jIfaR085.d.ts → reducer-DJKWm3cp.d.ts} +39 -39
- package/dist/reducer-DJKWm3cp.d.ts.map +1 -0
- package/dist/scheduler-qstash.d.ts +2 -2
- package/dist/scheduler-qstash.js +2 -2
- package/dist/scheduler-vercel.d.ts +2 -2
- package/dist/scheduler-vercel.js +1 -1
- package/dist/{server-DjPhHnbI.d.ts → server-DgCrSuhB.d.ts} +5 -3
- package/dist/server-DgCrSuhB.d.ts.map +1 -0
- package/dist/{server-B2XNevQA.js → server-DlLyvaSH.js} +140 -81
- package/dist/server-DlLyvaSH.js.map +1 -0
- package/dist/server.d.ts +3 -3
- package/dist/server.js +1 -1
- package/dist/{store-RJO35BMj.d.ts → store-DGHeBtIQ.d.ts} +2 -2
- package/dist/{store-RJO35BMj.d.ts.map → store-DGHeBtIQ.d.ts.map} +1 -1
- package/dist/store-memory.d.ts +1 -1
- package/dist/store-memory.js +2 -2
- package/dist/store-postgres.d.ts +1 -1
- package/dist/store-postgres.js +2 -2
- package/dist/{store-redis-core-DT01r4GZ.js → store-redis-core-z-ykbyMg.js} +3 -3
- package/dist/{store-redis-core-DT01r4GZ.js.map → store-redis-core-z-ykbyMg.js.map} +1 -1
- package/dist/store-redis-http.d.ts +1 -1
- package/dist/store-redis-http.js +2 -2
- package/dist/store-redis.d.ts +1 -1
- package/dist/store-redis.js +2 -2
- package/dist/store-sqlite.d.ts +1 -1
- package/dist/store-sqlite.js +2 -2
- package/dist/{wire-B6te_wns.js → wire--yji6mO3.js} +2 -2
- package/dist/{wire-B6te_wns.js.map → wire--yji6mO3.js.map} +1 -1
- package/docs/actors/01-introduction.mdx +189 -0
- package/docs/actors/02-concurrency.mdx +154 -0
- package/docs/actors/03-timers.mdx +120 -0
- package/docs/actors/04-routes.mdx +352 -0
- package/docs/actors/meta.ts +1 -0
- package/docs/concepts/meta.ts +1 -0
- package/docs/guides/10-transports.mdx +72 -22
- package/docs/guides/meta.ts +1 -0
- package/docs/index.mdx +3 -0
- package/docs/reference/01-api.mdx +30 -12
- package/docs/reference/02-errors.mdx +33 -0
- package/docs/reference/meta.ts +1 -0
- package/examples/playground/app/page.tsx +10 -1
- package/examples/playground/app/vault/[vaultId]/route.ts +19 -0
- package/examples/playground/app/vault/page.tsx +12 -0
- package/examples/playground/app/vault/server.ts +9 -0
- package/examples/playground/app/vault/vault-client.tsx +124 -0
- package/examples/playground/app/vault/vault.test.ts +147 -0
- package/examples/playground/app/vault/vault.ts +119 -0
- package/examples/playground/package.json +1 -1
- package/package.json +7 -1
- package/src/actor-client.ts +132 -0
- package/src/actor-react.ts +143 -0
- package/src/actor-shared.ts +356 -0
- package/src/actor.browser.ts +12 -0
- package/src/actor.ts +914 -0
- package/src/client.ts +341 -88
- package/src/errors.ts +15 -0
- package/src/index.ts +1 -1
- package/src/server-fetch.ts +51 -23
- package/src/server.ts +13 -3
- package/src/session-socket.ts +216 -81
- package/dist/contract-jIfaR085.d.ts.map +0 -1
- package/dist/server-B2XNevQA.js.map +0 -1
- package/dist/server-DjPhHnbI.d.ts.map +0 -1
package/src/server.ts
CHANGED
|
@@ -19,7 +19,7 @@ import type {
|
|
|
19
19
|
PresenceSnapshot,
|
|
20
20
|
WithPresence,
|
|
21
21
|
} from './contract.ts'
|
|
22
|
-
import { A2Error, asStoreUnavailable } from './errors.ts'
|
|
22
|
+
import { A2Error, NonRetriableError, asStoreUnavailable } from './errors.ts'
|
|
23
23
|
import {
|
|
24
24
|
DRAIN_TIMINGS,
|
|
25
25
|
POLL_TIMINGS,
|
|
@@ -1431,9 +1431,15 @@ export function createServer<
|
|
|
1431
1431
|
const validated: Record<string, unknown> = nullProtoRecord()
|
|
1432
1432
|
for (const [field, value] of Object.entries(patch.values)) {
|
|
1433
1433
|
if (value === undefined) continue
|
|
1434
|
+
// '*' is a catch-all vocabulary entry: any field name (bar
|
|
1435
|
+
// object-plumbing names) validates against its schema. The
|
|
1436
|
+
// actor module declares it — presence vocabularies typed by the
|
|
1437
|
+
// protocol, values held to the JSON floor here.
|
|
1434
1438
|
const schema = Object.hasOwn(presenceDefs, field)
|
|
1435
1439
|
? presenceDefs[field]
|
|
1436
|
-
:
|
|
1440
|
+
: RESERVED_PARTICIPANT_IDS.has(field)
|
|
1441
|
+
? undefined
|
|
1442
|
+
: presenceDefs['*']
|
|
1437
1443
|
if (!schema) {
|
|
1438
1444
|
throw new A2Error(
|
|
1439
1445
|
'UNKNOWN_PRESENCE_FIELD',
|
|
@@ -2209,7 +2215,11 @@ export function createServer<
|
|
|
2209
2215
|
index: event.index,
|
|
2210
2216
|
attempt: event.attemptCount,
|
|
2211
2217
|
error: describeError(err),
|
|
2212
|
-
|
|
2218
|
+
// A NonRetriableError is terminal on its first throw:
|
|
2219
|
+
// deterministic failures should not burn the retry
|
|
2220
|
+
// budget before dead-lettering.
|
|
2221
|
+
maxFailures:
|
|
2222
|
+
err instanceof NonRetriableError ? 1 : MAX_FAILURES,
|
|
2213
2223
|
})
|
|
2214
2224
|
eventSpan.setAttribute('a2.event.outcome', failure.outcome)
|
|
2215
2225
|
return {
|
package/src/session-socket.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The A2 socket protocol's server half (specs/a2-api.md §13): the
|
|
3
3
|
* per-socket shell — teardown, backpressure, heartbeat, the malformed
|
|
4
|
-
* budget, the in-flight bound
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* platform hands over) is re-exported as public surface.
|
|
4
|
+
* budget, and the in-flight bound. `sessionSocket` binds one session to
|
|
5
|
+
* one socket; `sessionsSocket` is the opt-in multiplexed handler. Only
|
|
6
|
+
* `A2Socket`, the structural socket the platform hands over, is public.
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
9
|
import { A2Error } from './errors.ts'
|
|
@@ -256,17 +255,210 @@ export type SessionsSocketOptions = {
|
|
|
256
255
|
): A2Error | null | Promise<A2Error | null>
|
|
257
256
|
}
|
|
258
257
|
|
|
258
|
+
export type SessionSocketOptions = SessionsSocketOptions & {
|
|
259
|
+
startAfter?: number
|
|
260
|
+
}
|
|
261
|
+
|
|
259
262
|
type SocketSubscription = {
|
|
260
263
|
target: SocketSession
|
|
261
264
|
iterator: AsyncIterator<Event | PresencePatch | PresenceSnapshot>
|
|
262
265
|
stopped: boolean
|
|
263
266
|
}
|
|
264
267
|
|
|
268
|
+
const socketSubscription = (
|
|
269
|
+
target: SocketSession,
|
|
270
|
+
startAfter: number,
|
|
271
|
+
presence: boolean,
|
|
272
|
+
): SocketSubscription => ({
|
|
273
|
+
target,
|
|
274
|
+
iterator: (presence
|
|
275
|
+
? target.stream({ startAfter, presence: true })
|
|
276
|
+
: target.stream({ startAfter }))[Symbol.asyncIterator](),
|
|
277
|
+
stopped: false,
|
|
278
|
+
})
|
|
279
|
+
|
|
265
280
|
const stopSubscription = (subscription: SocketSubscription): void => {
|
|
266
281
|
subscription.stopped = true
|
|
267
282
|
void subscription.iterator.return?.()?.catch(() => {})
|
|
268
283
|
}
|
|
269
284
|
|
|
285
|
+
const pumpSubscription = async (
|
|
286
|
+
shell: SocketShell,
|
|
287
|
+
subscription: SocketSubscription,
|
|
288
|
+
frameFor: (item: Event | PresencePatch | PresenceSnapshot) => string,
|
|
289
|
+
): Promise<void> => {
|
|
290
|
+
for (;;) {
|
|
291
|
+
while (
|
|
292
|
+
!shell.torn() &&
|
|
293
|
+
!subscription.stopped &&
|
|
294
|
+
shell.buffered() > SOCKET_TIMINGS.highWaterMarkBytes
|
|
295
|
+
) {
|
|
296
|
+
// oxlint-disable-next-line no-await-in-loop -- backpressure park
|
|
297
|
+
await new Promise((wake) => setTimeout(wake, SOCKET_TIMINGS.resumePollMs))
|
|
298
|
+
}
|
|
299
|
+
if (shell.torn() || subscription.stopped) return
|
|
300
|
+
// oxlint-disable-next-line no-await-in-loop -- stream pump
|
|
301
|
+
const { value, done } = await subscription.iterator.next()
|
|
302
|
+
if (shell.torn() || subscription.stopped || done) return
|
|
303
|
+
shell.send(frameFor(value))
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const handleSocketPush = async (
|
|
308
|
+
shell: SocketShell,
|
|
309
|
+
target: SocketSession,
|
|
310
|
+
sessionId: string,
|
|
311
|
+
frame: Record<string, unknown>,
|
|
312
|
+
req: number,
|
|
313
|
+
ackSessionId: string | undefined,
|
|
314
|
+
gatePush: SessionsSocketOptions['gatePush'],
|
|
315
|
+
): Promise<void> => {
|
|
316
|
+
try {
|
|
317
|
+
const events = parsePushEvents(frame['events'])
|
|
318
|
+
const denial = (await gatePush?.(sessionId, events, undefined)) ?? null
|
|
319
|
+
if (denial !== null) {
|
|
320
|
+
shell.send(socketErrorAckFor(req, denial, ackSessionId))
|
|
321
|
+
return
|
|
322
|
+
}
|
|
323
|
+
// oxlint-disable-next-line a2/await-handler-append -- this transport append is awaited before its ack
|
|
324
|
+
const appended = await target.append(...events)
|
|
325
|
+
shell.send(socketAckFor(req, appended, ackSessionId))
|
|
326
|
+
} catch (error) {
|
|
327
|
+
shell.send(socketErrorAckFor(req, asA2Error(error), ackSessionId))
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const applySocketPresence = async (
|
|
332
|
+
shell: SocketShell,
|
|
333
|
+
target: SocketSession,
|
|
334
|
+
sessionId: string,
|
|
335
|
+
frame: Record<string, unknown>,
|
|
336
|
+
gatePush: SessionsSocketOptions['gatePush'],
|
|
337
|
+
): Promise<void> => {
|
|
338
|
+
if (typeof target.setPresence !== 'function') {
|
|
339
|
+
shell.malformedFrame('presence frame on a presence-less session')
|
|
340
|
+
return
|
|
341
|
+
}
|
|
342
|
+
let patch: ParsedPushPresence | undefined
|
|
343
|
+
try {
|
|
344
|
+
patch = parsePresenceSibling(frame)
|
|
345
|
+
} catch {
|
|
346
|
+
shell.malformedFrame('invalid presence frame')
|
|
347
|
+
return
|
|
348
|
+
}
|
|
349
|
+
if (!patch) return
|
|
350
|
+
try {
|
|
351
|
+
const denial = (await gatePush?.(sessionId, [], patch)) ?? null
|
|
352
|
+
if (denial !== null) return
|
|
353
|
+
await target.setPresence(patch)
|
|
354
|
+
} catch (error) {
|
|
355
|
+
const failure = asA2Error(error)
|
|
356
|
+
if (
|
|
357
|
+
failure.code === 'INVALID_PAYLOAD' ||
|
|
358
|
+
failure.code === 'UNKNOWN_PRESENCE_FIELD'
|
|
359
|
+
) {
|
|
360
|
+
shell.malformedFrame('invalid presence frame')
|
|
361
|
+
return
|
|
362
|
+
}
|
|
363
|
+
shell.shutdown(1011, 'internal error')
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
export function sessionSocket<D extends EventDefs>(
|
|
368
|
+
sessionId: string,
|
|
369
|
+
session: Pick<Session<D>, 'stream'>,
|
|
370
|
+
socket: A2Socket,
|
|
371
|
+
options?: SessionSocketOptions,
|
|
372
|
+
): void {
|
|
373
|
+
const target = session as unknown as SocketSession
|
|
374
|
+
const subscription = socketSubscription(
|
|
375
|
+
target,
|
|
376
|
+
options?.startAfter ?? 0,
|
|
377
|
+
options?.presence === true,
|
|
378
|
+
)
|
|
379
|
+
|
|
380
|
+
const handleFrame = (frame: Record<string, unknown>): void => {
|
|
381
|
+
switch (frame['kind']) {
|
|
382
|
+
case 'push': {
|
|
383
|
+
const req = frame['req']
|
|
384
|
+
if (typeof req !== 'number') {
|
|
385
|
+
shell.malformedFrame('push frame without a numeric req')
|
|
386
|
+
return
|
|
387
|
+
}
|
|
388
|
+
if (frame['sessionId'] !== undefined) {
|
|
389
|
+
shell.send(
|
|
390
|
+
socketErrorAckFor(
|
|
391
|
+
req,
|
|
392
|
+
new A2Error(
|
|
393
|
+
'INVALID_PAYLOAD',
|
|
394
|
+
'sessionId is not allowed on a single-session socket',
|
|
395
|
+
),
|
|
396
|
+
),
|
|
397
|
+
)
|
|
398
|
+
return
|
|
399
|
+
}
|
|
400
|
+
if (shell.overCap()) {
|
|
401
|
+
shell.send(
|
|
402
|
+
socketErrorAckFor(
|
|
403
|
+
req,
|
|
404
|
+
new A2Error(
|
|
405
|
+
'STORE_UNAVAILABLE',
|
|
406
|
+
'push shed: too many in flight on this socket',
|
|
407
|
+
),
|
|
408
|
+
),
|
|
409
|
+
)
|
|
410
|
+
return
|
|
411
|
+
}
|
|
412
|
+
shell.track(
|
|
413
|
+
handleSocketPush(
|
|
414
|
+
shell,
|
|
415
|
+
target,
|
|
416
|
+
sessionId,
|
|
417
|
+
frame,
|
|
418
|
+
req,
|
|
419
|
+
undefined,
|
|
420
|
+
options?.gatePush,
|
|
421
|
+
),
|
|
422
|
+
)
|
|
423
|
+
return
|
|
424
|
+
}
|
|
425
|
+
case 'presence':
|
|
426
|
+
if (frame['sessionId'] !== undefined) {
|
|
427
|
+
shell.malformedFrame(
|
|
428
|
+
'sessionId is not allowed on a single-session socket',
|
|
429
|
+
)
|
|
430
|
+
return
|
|
431
|
+
}
|
|
432
|
+
if (!shell.overCap()) {
|
|
433
|
+
shell.track(
|
|
434
|
+
applySocketPresence(
|
|
435
|
+
shell,
|
|
436
|
+
target,
|
|
437
|
+
sessionId,
|
|
438
|
+
frame,
|
|
439
|
+
options?.gatePush,
|
|
440
|
+
),
|
|
441
|
+
)
|
|
442
|
+
}
|
|
443
|
+
return
|
|
444
|
+
default:
|
|
445
|
+
return
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const shell = socketShell(
|
|
450
|
+
socket,
|
|
451
|
+
() => stopSubscription(subscription),
|
|
452
|
+
handleFrame,
|
|
453
|
+
options?.deadline,
|
|
454
|
+
)
|
|
455
|
+
|
|
456
|
+
void pumpSubscription(shell, subscription, socketFrameFor).then(
|
|
457
|
+
() => shell.shutdown(1000),
|
|
458
|
+
() => shell.shutdown(1011, 'stream failed'),
|
|
459
|
+
)
|
|
460
|
+
}
|
|
461
|
+
|
|
270
462
|
const parseSubscribeEntries = (
|
|
271
463
|
value: unknown,
|
|
272
464
|
): Array<{ id: string; index: number }> | null => {
|
|
@@ -308,38 +500,14 @@ export function sessionsSocket<D extends EventDefs>(
|
|
|
308
500
|
if (subscriptions.get(id) === subscription) subscriptions.delete(id)
|
|
309
501
|
}
|
|
310
502
|
|
|
311
|
-
const pump = async (
|
|
312
|
-
id: string,
|
|
313
|
-
subscription: SocketSubscription,
|
|
314
|
-
): Promise<void> => {
|
|
315
|
-
for (;;) {
|
|
316
|
-
for (;;) {
|
|
317
|
-
if (
|
|
318
|
-
shell.torn() ||
|
|
319
|
-
subscription.stopped ||
|
|
320
|
-
shell.buffered() <= SOCKET_TIMINGS.highWaterMarkBytes
|
|
321
|
-
)
|
|
322
|
-
break
|
|
323
|
-
// oxlint-disable-next-line no-await-in-loop -- backpressure park
|
|
324
|
-
await new Promise((wake) =>
|
|
325
|
-
setTimeout(wake, SOCKET_TIMINGS.resumePollMs),
|
|
326
|
-
)
|
|
327
|
-
}
|
|
328
|
-
if (shell.torn() || subscription.stopped) return
|
|
329
|
-
// oxlint-disable-next-line no-await-in-loop -- stream pump
|
|
330
|
-
const { value, done } = await subscription.iterator.next()
|
|
331
|
-
if (shell.torn() || subscription.stopped) return
|
|
332
|
-
if (done) return
|
|
333
|
-
shell.send(socketFrameFor(value, id))
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
503
|
const runSubscription = async (
|
|
338
504
|
id: string,
|
|
339
505
|
subscription: SocketSubscription,
|
|
340
506
|
): Promise<void> => {
|
|
341
507
|
try {
|
|
342
|
-
await
|
|
508
|
+
await pumpSubscription(shell, subscription, (item) =>
|
|
509
|
+
socketFrameFor(item, id),
|
|
510
|
+
)
|
|
343
511
|
if (shell.torn() || subscription.stopped) return
|
|
344
512
|
retire(id, subscription)
|
|
345
513
|
shell.send(socketUnsubscribedFor(id))
|
|
@@ -371,16 +539,7 @@ export function sessionsSocket<D extends EventDefs>(
|
|
|
371
539
|
const target = session as unknown as SocketSession
|
|
372
540
|
const existing = subscriptions.get(id)
|
|
373
541
|
if (existing) stopSubscription(existing)
|
|
374
|
-
const
|
|
375
|
-
presence
|
|
376
|
-
? target.stream({ startAfter: index, presence: true })
|
|
377
|
-
: target.stream({ startAfter: index })
|
|
378
|
-
)[Symbol.asyncIterator]()
|
|
379
|
-
const subscription: SocketSubscription = {
|
|
380
|
-
target,
|
|
381
|
-
iterator,
|
|
382
|
-
stopped: false,
|
|
383
|
-
}
|
|
542
|
+
const subscription = socketSubscription(target, index, presence)
|
|
384
543
|
subscriptions.set(id, subscription)
|
|
385
544
|
shell.send(socketSubscribedFor(id))
|
|
386
545
|
void runSubscription(id, subscription)
|
|
@@ -415,19 +574,15 @@ export function sessionsSocket<D extends EventDefs>(
|
|
|
415
574
|
)
|
|
416
575
|
return
|
|
417
576
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
shell.send(socketAckFor(req, appended, sessionId))
|
|
428
|
-
} catch (err) {
|
|
429
|
-
shell.send(socketErrorAckFor(req, asA2Error(err), sessionId))
|
|
430
|
-
}
|
|
577
|
+
await handleSocketPush(
|
|
578
|
+
shell,
|
|
579
|
+
subscription.target,
|
|
580
|
+
sessionId,
|
|
581
|
+
frame,
|
|
582
|
+
req,
|
|
583
|
+
sessionId,
|
|
584
|
+
options?.gatePush,
|
|
585
|
+
)
|
|
431
586
|
}
|
|
432
587
|
|
|
433
588
|
const handlePresence = async (
|
|
@@ -437,33 +592,13 @@ export function sessionsSocket<D extends EventDefs>(
|
|
|
437
592
|
const subscription = subscriptions.get(sessionId)
|
|
438
593
|
// An unsubscribe race, not malformedness — the plane repaints.
|
|
439
594
|
if (subscription === undefined) return
|
|
440
|
-
|
|
441
|
-
shell
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
} catch {
|
|
448
|
-
shell.malformedFrame('invalid presence frame')
|
|
449
|
-
return
|
|
450
|
-
}
|
|
451
|
-
if (!patch) return
|
|
452
|
-
try {
|
|
453
|
-
const denial = (await options?.gatePush?.(sessionId, [], patch)) ?? null
|
|
454
|
-
if (denial !== null) return
|
|
455
|
-
await subscription.target.setPresence(patch)
|
|
456
|
-
} catch (error) {
|
|
457
|
-
const failure = asA2Error(error)
|
|
458
|
-
if (
|
|
459
|
-
failure.code === 'INVALID_PAYLOAD' ||
|
|
460
|
-
failure.code === 'UNKNOWN_PRESENCE_FIELD'
|
|
461
|
-
) {
|
|
462
|
-
shell.malformedFrame('invalid presence frame')
|
|
463
|
-
return
|
|
464
|
-
}
|
|
465
|
-
shell.shutdown(1011, 'internal error')
|
|
466
|
-
}
|
|
595
|
+
await applySocketPresence(
|
|
596
|
+
shell,
|
|
597
|
+
subscription.target,
|
|
598
|
+
sessionId,
|
|
599
|
+
frame,
|
|
600
|
+
options?.gatePush,
|
|
601
|
+
)
|
|
467
602
|
}
|
|
468
603
|
|
|
469
604
|
const handleFrame = (frame: Record<string, unknown>): void => {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract-jIfaR085.d.ts","names":[],"sources":["../src/standard-schema.ts","../src/reducer.ts","../src/contract.ts"],"mappings":";;;;;;;;UAQiB,iBAAiB,iBAAiB,SAAS;;WAEjD,aAAa,iBAAiB,MAAM,OAAO;;kBAG7B;;mBAEN,MAAM,iBAAiB,SAAS;;aAEtC;;aAEA;;aAEA,WACP,mBACG,OAAO,UAAU,QAAQ,OAAO;;aAE5B,QAAQ,MAAM,OAAO;;;cAIpB,OAAO,UAAU,cAAc,UAAU;;mBAGpC,cAAc;;aAEpB,OAAO;;aAEP;;;mBAIM;;aAEN,QAAQ,cAAc;;;mBAIhB;;aAEN;;aAEA,OAAO,cAAc,cAAc;;;mBAI7B;;aAEN,KAAK;;;mBAIC,MAAM,iBAAiB,SAAS;;aAEtC,OAAO;;aAEP,QAAQ;;;cAIP,WAAW,eAAe,oBAAoB,YACxD;;cAIU,YAAY,eAAe,oBAAoB,YACzD;;;;;;;;;;;;;;KC5DQ,QACV,UAAU,YAAY,WACtB,aACA,UAAU,eAAe;;WAGhB;;WAEA,QAAQ,SAAS;;;;;;WAMjB,UAAU,SAAS;WACnB,OAAO,OAAO,GAAG,OAAO,cAAc,OAAO;WAC7C,cAAc;;;;;;;WAOd,aAAa,0BAA0B;;;KAItC,eACV,UAAU,WACV,GACA,UAAU,eAAe;EAEzB,KAAK,OAAO,OAAO,GAAG,OAAO,cAAc,OAAO,IAAI,QAAQ,GAAG,GAAG;;;;;KC9B1D,YAAY,eAAe;;KAG3B,eAAe,eAAe;;KAG9B,cACV,UAAU,WACV,gBAAgB,mBAAmB,iBAElC,WAAW;EACV;EACA,MAAM;EACN,SAAS,iBAAiB,YAAY,EAAE;EACxC;EACA;EACA,WAAW;KAEb;;KAGU,YAAY,UAAU,gBAC/B,WAAW;EACV,MAAM;EACN,SAAS,iBAAiB,WAAW,EAAE;EACvC;WAEI;KAEI,kBAAkB,UAAU,oBAChC,mBAAmB,YAAY,SAElC,QAAQ,MACR;;;;;;KAOO,cAAc,UAAU,eAAe;EACjD;EACA,WACG,WAAW,cAAc,iBAAiB,YAAY,EAAE;EAE3D;EACA,IAAI;;;;;;;;KASM,YAAY,UAAU,eAAe;GAE5C,yBAAA,WAAW;IACV,OAAO,iBAAiB,YAAY,EAAE;IACtC;IACA,IAAI;;;;;;;;KAUE,iBAAiB,UAAU,eAAe;EACpD,UAAU,YAAY;;;;;;;KAQZ,aACV,UAAU,cACV,iBACQ,4BAA4B;KAE1B,eAAe,MAAM;;;;;EAK/B;;;;;;EAMA,cAAc;;;;;;EAMd,cAAc,iBAAiB,MAAM;;KAG3B,SACV,UAAU,YAAY,WACtB,UAAU,eAAe;;WAGhB;;WAEA,QAAQ,SAAS;;WAEjB,UAAU,SAAS;;WAEnB,OAAO,kBAAkB;;;;;;;;;;;EAWlC,QAAQ,MAAM,IAAI,MAChB,SAAS,eAAe,MAAM,KAC7B,eAAe,GAAG,GAAG;;;;;;;iBAQV,SACd,UAAU,WACV,UAAU,eAAe,sBACzB;;EAEA;;EAEA,QAAQ;;;;;;EAMR,WAAW;IACT,SAAS,GAAG"}
|