iii-browser-sdk 0.24.6 → 0.25.0-alpha.1

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.
@@ -11,13 +11,47 @@ declare enum MessageType {
11
11
  TriggerRegistrationResult = "triggerregistrationresult",
12
12
  RegistrationRejected = "registrationrejected",
13
13
  WorkerRegistered = "workerregistered",
14
- Reattach = "reattach"
14
+ Reattach = "reattach",
15
+ /** Observing worker → engine: create (or idempotently replay) an observer. */
16
+ Observe = "observe",
17
+ /** Observing worker → engine: dispose an observer this connection owns. */
18
+ Unobserve = "unobserve",
19
+ /** Engine → observing worker: the reply to `observe` (also on replay). */
20
+ ObserveResult = "observeresult",
21
+ /** Engine → observing worker: an observer's lifecycle transition. */
22
+ ObserverStateChanged = "observerstatechanged",
23
+ /** Engine → owner: the `registerfunction` ack, with the function's full observer set. */
24
+ FunctionRegistered = "functionregistered",
25
+ /** Engine → owner: one observer attached to a function this connection hosts. */
26
+ ObserverAdded = "observeradded",
27
+ /** Engine → owner: one observer detached. */
28
+ ObserverRemoved = "observerremoved",
29
+ /** Owner → engine: accept (or reject) an added observer. */
30
+ ObserverAck = "observerack",
31
+ /** Owner → engine: matched local invocations and `obs.emit` events, batched. */
32
+ InvocationsObserved = "invocationsobserved",
33
+ /** Owner → engine: periodic counts of local invocations and report drops. */
34
+ LocalInvocationStats = "localinvocationstats"
15
35
  }
36
+ /**
37
+ * A wire enum that a newer peer may extend: decoders keep a value they do not
38
+ * know instead of failing the frame.
39
+ */
40
+ type OpenEnum<T extends string> = T | (string & {});
41
+ /** `RegisterFunction.observe`: the part of the observe hooks that travels. Callbacks never do. */
42
+ type ObserveDescriptorWire = {
43
+ /** `auto` (default) or `owner`. */delivery?: OpenEnum<'auto' | 'owner'>; /** Owner only: validates the observers' `args` in the engine (`INVALID_ARGS`). */
44
+ args_format?: RegisterFunctionFormat; /** Phase 5 shim: accept old `registertrigger { trigger_type }` for this type. */
45
+ legacy_trigger_type?: string; /** Default `true`; `false` makes every `observe` on it fail with `NOT_OBSERVABLE`. */
46
+ allow?: boolean;
47
+ };
48
+ /** @deprecated Trigger types are replaced by functions with an observe descriptor (`RegisterFunctionMessage.observe`). */
16
49
  type RegisterTriggerTypeMessage = {
17
50
  message_type: MessageType.RegisterTriggerType; /** Unique identifier for the trigger type (e.g. `state`, `durable:subscriber`). */
18
51
  id: string; /** Human-readable description of what this trigger type does. */
19
52
  description: string;
20
53
  };
54
+ /** @deprecated Replaced by the `observe` message (`iii.observe`). */
21
55
  type RegisterTriggerMessage = {
22
56
  /** Wire discriminator; always `MessageType.RegisterTrigger`. */message_type: MessageType.RegisterTrigger; /** Unique trigger identifier, generated by the SDK during registration. */
23
57
  id: string; /** Identifier of the registered trigger type this trigger uses (e.g. `storage::object-created`, `http`). */
@@ -80,6 +114,11 @@ type RegisterFunctionMessage = {
80
114
  */
81
115
  response_format?: RegisterFunctionFormat;
82
116
  metadata?: Record<string, unknown>;
117
+ /**
118
+ * The observe descriptor: how observers of this function are delivered.
119
+ * Only these four fields travel; the hooks stay in the SDK.
120
+ */
121
+ observe?: ObserveDescriptorWire;
83
122
  };
84
123
  /**
85
124
  * Routing action for {@link TriggerRequest}. Determines how the engine
@@ -238,6 +277,27 @@ type TriggerRequest<TInput = unknown> = {
238
277
  action?: TriggerAction; /** Override the default invocation timeout, in milliseconds. */
239
278
  timeoutMs?: number; /** Namespace to route this invocation to. Omit to inherit this worker's; say `default` to reach the engine's from a namespaced worker. */
240
279
  namespace?: string;
280
+ /**
281
+ * Per-invocation metadata (any JSON). Travels beside the payload: the
282
+ * handler receives it as its second argument, and observer filters read it
283
+ * as `metadata.*`.
284
+ */
285
+ metadata?: unknown;
286
+ /**
287
+ * W3C `traceparent` to continue. The browser SDK has no OpenTelemetry, so it
288
+ * never makes one up: when omitted, a call made inside a handler forwards
289
+ * the `traceparent` that handler was invoked with (see
290
+ * {@link ISdk.currentInvocation}); a top-level call sends none and the engine
291
+ * starts the trace.
292
+ */
293
+ traceparent?: string; /** W3C `baggage` to send along with `traceparent`; defaults the same way. */
294
+ baggage?: string;
295
+ /**
296
+ * `auto` (default) runs a function this worker hosts in-process when the
297
+ * engine confirmed it for local dispatch; `remote` always goes through the
298
+ * engine. Tests use it, and so do callers that rely on engine-side effects.
299
+ */
300
+ dispatch?: 'auto' | 'remote';
241
301
  };
242
302
  /**
243
303
  * Serializable reference to one end of a streaming channel. Can be included
@@ -321,6 +381,7 @@ declare class ChannelWriter {
321
381
  declare class ChannelReader {
322
382
  private ws;
323
383
  private connected;
384
+ private closedByCaller;
324
385
  private readonly messageCallbacks;
325
386
  private readonly binaryCallbacks;
326
387
  private readonly url;
@@ -330,7 +391,12 @@ declare class ChannelReader {
330
391
  onMessage(callback: (msg: string) => void): void;
331
392
  /** Register a callback to receive binary data from the channel. */
332
393
  onBinary(callback: (data: Uint8Array) => void): void;
333
- /** Read all binary data from the channel until it closes. */
394
+ /**
395
+ * Read all binary data from the channel until it closes.
396
+ *
397
+ * Rejects with an `Error` carrying the close `code` and `reason` when the
398
+ * channel ends abnormally (the writer aborted or the connection was lost).
399
+ */
334
400
  readAll(): Promise<Uint8Array>;
335
401
  /** Close the channel reader. */
336
402
  close(): void;
@@ -357,6 +423,49 @@ declare class RegistrationRejectedError extends Error {
357
423
  readonly owner_worker_id: string;
358
424
  constructor(init: RegistrationRejectedInit);
359
425
  }
426
+ /** Fields used to construct an {@link InvocationError}. */
427
+ type InvocationErrorInit = {
428
+ code: string;
429
+ message: string;
430
+ function_id?: string;
431
+ stacktrace?: string;
432
+ };
433
+ /**
434
+ * An error the SDK raises itself for an invocation, with a machine-readable
435
+ * `code`: observe delivery errors (`NOT_OWNER_DELIVERED`,
436
+ * `OBSERVER_NOT_ACTIVE`, `FILTERS_NOT_MATCHED`) and an invalid observe
437
+ * descriptor (`INVALID_OBSERVE_DESCRIPTOR`). Mirrors the Node SDK.
438
+ *
439
+ * A call the engine answers with an error still rejects with the engine's
440
+ * error body (`{ code, message, stacktrace? }`), as in earlier releases, and
441
+ * so does a locally dispatched call whose handler throws: both paths reject
442
+ * with the same value.
443
+ */
444
+ declare class InvocationError extends Error {
445
+ readonly code: string;
446
+ readonly function_id?: string;
447
+ readonly stacktrace?: string;
448
+ constructor(init: InvocationErrorInit);
449
+ }
450
+ /**
451
+ * Thrown by an `onObserverAdded` hook to reject an observer with a code of
452
+ * its own (`HTTP_ROUTE_CONFLICT`, `INVALID_CRON_EXPRESSION`, ...); any other
453
+ * error rejects it with `OBSERVE_REJECTED`. Also the error `ObserverHandle.ready()`
454
+ * rejects with when the observer turns `error` or `disposed`.
455
+ *
456
+ * @example
457
+ * ```typescript
458
+ * onObserverAdded(obs) {
459
+ * if (!isValidCron(obs.args.expression)) {
460
+ * throw new ObserveRejection('INVALID_CRON_EXPRESSION', 'invalid day-of-week field')
461
+ * }
462
+ * }
463
+ * ```
464
+ */
465
+ declare class ObserveRejection extends Error {
466
+ readonly code: string;
467
+ constructor(code: string, message: string);
468
+ }
360
469
  //#endregion
361
470
  //#region src/iii-constants.d.ts
362
471
  /**
@@ -402,11 +511,256 @@ interface IIIReconnectionConfig {
402
511
  maxRetries: number;
403
512
  }
404
513
  //#endregion
514
+ //#region src/observe-types.d.ts
515
+ /** What an observer ships to its target. Default `['input', 'output', 'caller']`. */
516
+ type Capture = 'input' | 'output' | 'error' | 'caller' | 'metadata';
517
+ /**
518
+ * An observer's lifecycle: `pending` (no owner yet, waiting for the owner's
519
+ * ack, or no target yet) → `active` or `error`; `suspended` while its worker
520
+ * or target is away; `disposed` at the end.
521
+ */
522
+ type ObserverState = 'pending' | 'active' | 'suspended' | 'error' | 'disposed';
523
+ /**
524
+ * A declarative filter over `input`, `output`, `error`, `caller` and
525
+ * `metadata`, with explicit operators only:
526
+ * `{ 'input.amount': { $gte: 500 } }`. See the filter language reference.
527
+ */
528
+ type Filter = Record<string, unknown>;
529
+ /** The right side of `iii.observe`: a registered function. */
530
+ type Target = string | {
531
+ function_id: string;
532
+ namespace?: string;
533
+ };
534
+ /** A state reason or an error: a machine-readable code and a message. */
535
+ type ObserveReason = {
536
+ code: string;
537
+ message: string;
538
+ };
539
+ /**
540
+ * Who started an invocation: the worker (`worker_id` / `worker_name`, stamped
541
+ * by the engine), and the function and invocation the call was made from.
542
+ */
543
+ interface Caller {
544
+ /** Absent on activations, whose caller is the engine (`worker_name: 'iii-engine'`). */
545
+ worker_id?: string;
546
+ worker_name?: string;
547
+ /** The handler the call was made from; absent for top-level calls. */
548
+ function_id?: string;
549
+ invocation_id?: string;
550
+ /** The caller of that handler, one level only. */
551
+ parent?: Omit<Caller, 'parent'>;
552
+ }
553
+ /**
554
+ * A caller as the SDK knows it: every field may be missing (a top-level call
555
+ * has no function; a call made before `WorkerRegistered` has no worker id).
556
+ */
557
+ type CallerInfo = Partial<Omit<Caller, 'parent'>> & {
558
+ parent?: Partial<Omit<Caller, 'parent'>>;
559
+ };
560
+ /**
561
+ * What the target of an auto observer (or of `obs.emit`) receives with
562
+ * `deliver: 'envelope'` (the default). Fields not in the observer's
563
+ * `capture` are absent.
564
+ */
565
+ interface Observed<I = unknown, O = unknown> {
566
+ observer_id: string;
567
+ activation_id: string;
568
+ function_id: string;
569
+ namespace: string;
570
+ invocation_id: string;
571
+ status: 'success' | 'error';
572
+ input?: I;
573
+ output?: O;
574
+ error?: {
575
+ code: string;
576
+ message: string;
577
+ };
578
+ caller?: Caller;
579
+ metadata?: Record<string, unknown>;
580
+ started_at_ms: number;
581
+ duration_ms: number;
582
+ }
583
+ /** The left side of `iii.observe`: what is observed. */
584
+ interface ObserveSource {
585
+ /** The observed function. */
586
+ function_id: string;
587
+ /** Defaults to this worker's namespace (`engine::*` resolves to `default`). */
588
+ namespace?: string;
589
+ /** Owner-delivered functions only: for the owner; validated against its `args_format`. */
590
+ args?: Record<string, unknown>;
591
+ /** Which events reach the target; `{}` (or absent) = every event. */
592
+ filters?: Filter;
593
+ /** Auto only; default `'success'`. */
594
+ on?: 'success' | 'error' | 'complete';
595
+ /** Auto and `obs.emit`; default `['input', 'output', 'caller']`. */
596
+ capture?: Capture[];
597
+ /** Auto and `obs.emit`; default `'envelope'`. */
598
+ deliver?: 'envelope' | 'input' | 'output';
599
+ }
600
+ /** The observer itself: its id, policy and metadata. */
601
+ interface ObserverOptions {
602
+ /** Default: a random UUID, stable across replays. */
603
+ id?: string;
604
+ /** The observer is disposed after this many activations (`MAX_FIRES`). Default: unlimited. */
605
+ max_fires?: number;
606
+ /** The observer is disposed this many milliseconds after it is created (`EXPIRED`). Default: never. */
607
+ expires_in_ms?: number;
608
+ /**
609
+ * Activations running at once; further ones queue, then drop as `OVERFLOW`.
610
+ * Default: the engine's `observers.default_max_in_flight` (64).
611
+ */
612
+ max_in_flight?: number;
613
+ /** Delivered as the metadata sidecar of every activation. */
614
+ metadata?: Record<string, unknown>;
615
+ }
616
+ /** What `iii.observe` returns, synchronously. */
617
+ interface ObserverHandle {
618
+ readonly id: string;
619
+ readonly state: ObserverState;
620
+ /** Why the observer is in its state (`error`, `suspended`, `disposed`). */
621
+ readonly reason?: ObserveReason;
622
+ /**
623
+ * Resolves when the observer is `active`; rejects with an
624
+ * {@link ObserveRejection} carrying the code when it turns `error` or
625
+ * `disposed` first.
626
+ */
627
+ ready(): Promise<void>;
628
+ /**
629
+ * Calls `listener` on every state change, in order; returns the
630
+ * unsubscribe function. Listeners are called asynchronously (never on the
631
+ * connection's read path), so they may call the client.
632
+ */
633
+ onStateChange(listener: (state: ObserverState, reason?: ObserveReason) => void): () => void;
634
+ /** Removes the observer (`unobserve`). It is not replayed on reconnect. */
635
+ dispose(): Promise<void>;
636
+ }
637
+ /** The document an observer's filters read (filters.md §1). */
638
+ type ObserveDoc = {
639
+ input?: unknown;
640
+ output?: unknown;
641
+ error?: unknown;
642
+ caller?: CallerInfo;
643
+ metadata?: unknown;
644
+ };
645
+ /**
646
+ * An observer as the function's owner sees it (`onObserverAdded`,
647
+ * `FunctionRef.observers()`): its args, filters, target, capture and `on`.
648
+ * Never its metadata, policy or the observing worker.
649
+ */
650
+ interface Observer {
651
+ readonly id: string;
652
+ /** The observed function (the one this worker hosts). */
653
+ readonly function_id: string;
654
+ /** The observer's args, validated against `args_format` by the engine. */
655
+ readonly args: Record<string, unknown>;
656
+ /** The observer's filters, normalized; the SDK applies them in `emit` / `call`. */
657
+ readonly filters: Filter;
658
+ /** The target function id. */
659
+ readonly target: string;
660
+ readonly capture: Capture[];
661
+ /** Auto only. */
662
+ readonly on: 'success' | 'error' | 'complete';
663
+ /** Set when the engine's legacy shim created the observer from an old `registerTrigger`. */
664
+ readonly legacy?: {
665
+ trigger_type: string;
666
+ config: unknown;
667
+ };
668
+ /** Evaluates the observer's filters on a document. */
669
+ matches(doc: ObserveDoc): boolean;
670
+ /**
671
+ * Owner delivery, fire-and-forget: hands `event` to this observer. Returns
672
+ * `false` and sends nothing when its filters reject the event or the
673
+ * observer is no longer active (removed or rejected meanwhile). Throws
674
+ * `NOT_OWNER_DELIVERED` on an auto function.
675
+ */
676
+ emit(event: unknown): boolean;
677
+ /**
678
+ * Owner delivery, request/response: invokes the target with `payload` and
679
+ * resolves with its result. Rejects with `FILTERS_NOT_MATCHED` (nothing is
680
+ * sent) when the filters reject the payload, and with `OBSERVER_NOT_ACTIVE`
681
+ * when the observer is no longer active.
682
+ */
683
+ call<R = unknown>(payload: unknown, opts?: {
684
+ timeoutMs?: number;
685
+ metadata?: never;
686
+ }): Promise<R>;
687
+ /**
688
+ * Late rejection of an active observer (e.g. after a config reload). It
689
+ * stops receiving events at once, and stays rejected across reconnects
690
+ * until the engine adds it again.
691
+ */
692
+ reject(code: string, message: string): void;
693
+ }
694
+ /**
695
+ * The `observe` option of `registerFunction`: how the function's observers
696
+ * are delivered, and the callbacks that run when one is added or removed.
697
+ *
698
+ * The callbacks of one function run one at a time, in revision order, with
699
+ * one exception: a callback still running after 30 s is treated as failed
700
+ * (`OWNER_TIMEOUT`) and the next one starts, so a hung callback cannot stall
701
+ * its function forever. It may then overlap with the callbacks after it, and
702
+ * if a timed-out `onObserverAdded` completes later, `onObserverRemoved` runs
703
+ * for that observer.
704
+ */
705
+ interface ObserveHooks {
706
+ /**
707
+ * `auto` (default): every invocation is offered to every observer.
708
+ * `owner`: the handler hands each event to the observers it belongs to,
709
+ * with `obs.emit` / `obs.call`.
710
+ */
711
+ delivery?: 'auto' | 'owner';
712
+ /** Owner only: JSON Schema of the observers' `args` (the engine answers `INVALID_ARGS`). */
713
+ args_format?: RegisterFunctionFormat;
714
+ /** Accept old `registerTrigger({ type })` calls for this trigger type. */
715
+ legacy_trigger_type?: string;
716
+ /** Default `true`; `false` refuses every observer (`NOT_OBSERVABLE`). */
717
+ allow?: boolean;
718
+ /**
719
+ * Runs once per added observer, before the SDK acks it. Throw to reject it
720
+ * (an {@link ObserveRejection} sets the code, anything else is
721
+ * `OBSERVE_REJECTED`); after 30 s it is rejected with `OWNER_TIMEOUT`.
722
+ */
723
+ onObserverAdded?(obs: Observer): void | Promise<void>;
724
+ /** Runs once per removed observer. Cannot fail: errors are logged. */
725
+ onObserverRemoved?(obs: Observer): void | Promise<void>;
726
+ }
727
+ /**
728
+ * The invocation the current code runs in, in every handler, remote or
729
+ * local (`iii.currentInvocation()`).
730
+ *
731
+ * Browsers have no `AsyncLocalStorage`, so the SDK knows it only while the
732
+ * handler runs synchronously: up to its first `await`. To keep it across an
733
+ * `await`, read it first and re-enter it with `iii.withInvocation(inv, fn)`.
734
+ */
735
+ interface InvocationContext {
736
+ function_id: string;
737
+ invocation_id: string;
738
+ caller?: CallerInfo;
739
+ /** Set when this invocation is the activation of an observer's target. */
740
+ activation?: {
741
+ observer_id: string;
742
+ activation_id?: string;
743
+ };
744
+ observe_depth: number;
745
+ /**
746
+ * The W3C `traceparent` the invocation arrived with (or was triggered with,
747
+ * for a local call). Calls made inside the handler forward it. Browser SDK
748
+ * only: there is no OpenTelemetry context to carry it.
749
+ */
750
+ traceparent?: string;
751
+ /** The W3C `baggage` that came with `traceparent`. */
752
+ baggage?: string;
753
+ }
754
+ //#endregion
405
755
  //#region src/triggers.d.ts
406
756
  /**
407
757
  * Configuration passed to a trigger handler when a trigger instance is
408
758
  * registered or unregistered.
409
759
  *
760
+ * @deprecated Replaced by the `Observer` an `onObserverAdded` hook
761
+ * receives (`{ id, args, filters, target }`). Migration guide:
762
+ * https://iii.dev/docs/upgrading/from-0-24-x
763
+ *
410
764
  * @typeParam TConfig - Type of the trigger-specific configuration.
411
765
  */
412
766
  type TriggerConfig<TConfig> = {
@@ -429,6 +783,10 @@ type TriggerConfig<TConfig> = {
429
783
  * Handler interface for custom trigger types. Passed to
430
784
  * `ISdk.registerTriggerType`.
431
785
  *
786
+ * @deprecated Replaced by `ObserveHooks` (`onObserverAdded` /
787
+ * `onObserverRemoved`) on `registerFunction`. Migration guide:
788
+ * https://iii.dev/docs/upgrading/from-0-24-x
789
+ *
432
790
  * @typeParam TConfig - Type of the trigger-specific configuration.
433
791
  *
434
792
  * @example
@@ -451,7 +809,8 @@ type TriggerHandler<TConfig> = {
451
809
  //#region src/types.d.ts
452
810
  /**
453
811
  * Async function handler for a registered function. Receives the invocation
454
- * payload and returns the result.
812
+ * payload and its metadata (`TriggerRequest.metadata` of the call, or an
813
+ * observer's metadata sidecar on an activation) and returns the result.
455
814
  *
456
815
  * @typeParam TInput - Type of the invocation payload.
457
816
  * @typeParam TOutput - Type of the return value.
@@ -462,14 +821,39 @@ type TriggerHandler<TConfig> = {
462
821
  * async (data) => ({ message: `Hello, ${data.name}!` })
463
822
  * ```
464
823
  */
465
- type RemoteFunctionHandler<TInput = any, TOutput = any> = (data: TInput) => Promise<TOutput>;
824
+ type RemoteFunctionHandler<TInput = any, TOutput = any> = (data: TInput, metadata?: unknown) => Promise<TOutput>;
825
+ /** @deprecated Use `iii.observe(source, target, options)` and its {@link ObserveSource}. */
466
826
  type RegisterTriggerInput = Omit<RegisterTriggerMessage, 'message_type' | 'id'>;
467
827
  type RegisterFunctionInput = Omit<RegisterFunctionMessage, 'message_type'>;
468
- type RegisterFunctionOptions = Omit<RegisterFunctionMessage, 'message_type' | 'id'>;
828
+ /**
829
+ * Options of {@link ISdk.registerFunction}: description, request/response
830
+ * formats, metadata, and the observe hooks.
831
+ */
832
+ type RegisterFunctionOptions = Omit<RegisterFunctionMessage, 'message_type' | 'id' | 'observe'> & {
833
+ /**
834
+ * Makes the function observable on its own terms: owner delivery
835
+ * (`delivery: 'owner'`, `args_format`), and callbacks when an observer is
836
+ * added or removed. Without it the function is still observable (auto
837
+ * delivery, no args).
838
+ */
839
+ observe?: ObserveHooks;
840
+ /**
841
+ * Calls this worker makes to its own function run in-process once the
842
+ * engine confirmed it (default `true`). Set `false` for a handler that must
843
+ * always run through the engine.
844
+ */
845
+ localDispatch?: boolean;
846
+ };
847
+ /** @deprecated Register a function with an observe descriptor instead. */
469
848
  type RegisterTriggerTypeInput = Omit<RegisterTriggerTypeMessage, 'message_type'>;
470
849
  interface ISdk {
471
850
  /**
472
851
  * Registers a new trigger. A trigger is a way to invoke a function when a certain event occurs.
852
+ *
853
+ * @deprecated Use {@link ISdk.observe} instead: `iii.observe({ function_id, args, filters }, target, { metadata })`.
854
+ * Logs a warning once per page. The http, cron, queue, state, stream, pubsub and database workers
855
+ * still publish trigger types: keep using `registerTrigger` for them until they ship source functions.
856
+ * Migration guide: https://iii.dev/docs/upgrading/from-0-24-x
473
857
  * <!-- docs:expand-params -->
474
858
  * @param trigger - The trigger to register
475
859
  * @returns A trigger object that can be used to unregister the trigger
@@ -543,8 +927,104 @@ interface ISdk {
543
927
  * ```
544
928
  */
545
929
  trigger<TInput = unknown, TOutput = any>(request: TriggerRequest<TInput>): Promise<TOutput>;
930
+ /**
931
+ * Observes a function: every event of `source` that passes its `filters`
932
+ * invokes `target`, a registered function. Returns synchronously (also
933
+ * before the connection is up); the observer is replayed with the same id
934
+ * on reconnect. Errors show up as state `error` and reject `ready()`;
935
+ * against an engine without observe that is `UNSUPPORTED`.
936
+ *
937
+ * @param source - What is observed: `function_id`, `args` (owner-delivered functions only), `filters`, `on`, `capture`, `deliver`.
938
+ * @param target - The function to invoke.
939
+ * @param options - `id`, `max_fires`, `expires_in_ms`, `max_in_flight`, `metadata`.
940
+ *
941
+ * @example
942
+ * ```typescript
943
+ * worker.registerFunction('ui::order-shipped', async ({ input }: Observed) => toast(input))
944
+ *
945
+ * const shipped = worker.observe(
946
+ * { function_id: 'orders::ship', filters: { 'input.customer_id': { $eq: customerId } } },
947
+ * 'ui::order-shipped',
948
+ * )
949
+ * await shipped.ready()
950
+ * ```
951
+ */
952
+ observe(source: ObserveSource, target: Target, options?: ObserverOptions): ObserverHandle;
953
+ /**
954
+ * The invocation the calling code runs in (remote or local handler), or
955
+ * `undefined` outside any handler.
956
+ *
957
+ * Browsers have no `AsyncLocalStorage`: the SDK knows the invocation while
958
+ * the handler runs synchronously, up to its first `await`; after it this
959
+ * returns `undefined`. Read it before awaiting, and re-enter it with
960
+ * {@link ISdk.withInvocation} for calls made after.
961
+ *
962
+ * Code after an `await`, outside {@link ISdk.withInvocation}, runs outside any
963
+ * invocation, but its calls are not treated as new chains: they carry the
964
+ * `observe_depth` of the deepest invocation running on this page, so the
965
+ * engine's loop guard (`max_observe_depth`) still stops an observer cycle
966
+ * whose target awaits before calling back. With several invocations
967
+ * running this over-counts, and a legitimate chain may stop early. They
968
+ * carry a `caller` and `traceparent` only when that is unambiguous (one
969
+ * invocation is running, and it is an observe activation); otherwise none.
970
+ * They never get an invocation's metadata: `obs.emit` / `obs.call` filters
971
+ * on `metadata.*` see it only inside a real scope. An invocation that never
972
+ * settles stops counting as running after 10 minutes (a local call: at its
973
+ * timeout). Local calls nest the same way: a self-recursion that awaits
974
+ * before each call goes through the engine past 64 levels, while calls
975
+ * started together count as one level. A limitation: local calls started in
976
+ * separate ticks while earlier ones still run also look nested, so a long,
977
+ * wide fan-out may send some through the engine (same results). While the
978
+ * socket is closed none is: a function this worker hosts then runs here up
979
+ * to 256 local calls deep, and past that the call fails at once with
980
+ * `LOCAL_DEPTH_EXCEEDED` (a runaway recursion must not freeze the page).
981
+ *
982
+ * @example
983
+ * ```typescript
984
+ * worker.registerFunction('ui::checkout', async (cart) => {
985
+ * const inv = worker.currentInvocation() // { function_id, invocation_id, caller, observe_depth, ... }
986
+ * const quote = await fetchQuote(cart)
987
+ * return worker.withInvocation(inv, () => worker.trigger({ function_id: 'orders::create', payload: quote }))
988
+ * })
989
+ * ```
990
+ */
991
+ currentInvocation(): InvocationContext | undefined;
992
+ /**
993
+ * Runs `fn` inside `invocation` (what {@link ISdk.currentInvocation}
994
+ * returned), and returns what `fn` returns. Calls `fn` makes before its own
995
+ * first `await` (`trigger`, `obs.emit`, `obs.call`, `currentInvocation`)
996
+ * belong to that invocation: they carry its caller, `observe_depth` and
997
+ * `traceparent`. When `fn` returns a promise, the invocation counts as
998
+ * running until it settles, so `fn`'s code after an `await` gets the
999
+ * fallback below. `undefined` runs `fn` outside any invocation.
1000
+ *
1001
+ * Code after an `await`, outside `withInvocation`, runs outside any
1002
+ * invocation, but its calls are not treated as new chains: they carry the
1003
+ * `observe_depth` of the deepest invocation running on this page, so the
1004
+ * engine's loop guard (`max_observe_depth`) still stops an observer cycle
1005
+ * whose target awaits before calling back. With several invocations
1006
+ * running this over-counts, and a legitimate chain may stop early. They
1007
+ * carry a `caller` and `traceparent` only when that is unambiguous (one
1008
+ * invocation is running, and it is an observe activation); otherwise none.
1009
+ * They never get an invocation's metadata: `obs.emit` / `obs.call` filters
1010
+ * on `metadata.*` see it only inside a real scope. An invocation that never
1011
+ * settles stops counting as running after 10 minutes (a local call: at its
1012
+ * timeout). Local calls nest the same way: a self-recursion that awaits
1013
+ * before each call goes through the engine past 64 levels, while calls
1014
+ * started together count as one level. A limitation: local calls started in
1015
+ * separate ticks while earlier ones still run also look nested, so a long,
1016
+ * wide fan-out may send some through the engine (same results). While the
1017
+ * socket is closed none is: a function this worker hosts then runs here up
1018
+ * to 256 local calls deep, and past that the call fails at once with
1019
+ * `LOCAL_DEPTH_EXCEEDED` (a runaway recursion must not freeze the page).
1020
+ */
1021
+ withInvocation<T>(invocation: InvocationContext | undefined, fn: () => T): T;
546
1022
  /**
547
1023
  * Registers a new trigger type. A trigger type is a way to invoke a function when a certain event occurs.
1024
+ *
1025
+ * @deprecated Register a function with an observe descriptor instead:
1026
+ * `registerFunction(id, handler, { observe: { delivery: 'owner', onObserverAdded, onObserverRemoved } })`.
1027
+ * Logs a warning once per page. Migration guide: https://iii.dev/docs/upgrading/from-0-24-x
548
1028
  * @param triggerType - The trigger type to register
549
1029
  * @param handler - The handler for the trigger type
550
1030
  * @returns A trigger type object that can be used to unregister the trigger type
@@ -571,6 +1051,8 @@ interface ISdk {
571
1051
  registerTriggerType<TConfig>(triggerType: RegisterTriggerTypeInput, handler: TriggerHandler<TConfig>): TriggerTypeRef<TConfig>;
572
1052
  /**
573
1053
  * Unregisters a trigger type.
1054
+ *
1055
+ * @deprecated Trigger types are replaced by functions with an observe descriptor.
574
1056
  * @param triggerType - The trigger type to unregister
575
1057
  *
576
1058
  * @example
@@ -617,6 +1099,8 @@ interface ISdk {
617
1099
  /**
618
1100
  * Handle returned by {@link ISdk.registerTrigger}. Use `unregister()` to
619
1101
  * remove the trigger from the engine.
1102
+ *
1103
+ * @deprecated `registerTrigger` is replaced by `iii.observe`, which returns an {@link ObserverHandle}.
620
1104
  */
621
1105
  type Trigger = {
622
1106
  /** Removes this trigger from the engine. */unregister(): void;
@@ -628,10 +1112,20 @@ type Trigger = {
628
1112
  type FunctionRef = {
629
1113
  /** The unique function identifier. */id: string; /** Removes this function from the engine. */
630
1114
  unregister: () => void;
1115
+ /**
1116
+ * Whether any observer is active on this function (one load, for the emit
1117
+ * fast path: skip building an event nobody receives).
1118
+ */
1119
+ isObserved: () => boolean; /** The active observers, as this owner sees them. */
1120
+ observers: () => readonly Observer[];
631
1121
  };
632
1122
  /**
633
1123
  * Typed handle returned by {@link ISdk.registerTriggerType}.
634
1124
  *
1125
+ * @deprecated Trigger types are replaced by functions with an observe
1126
+ * descriptor, and these helpers by `iii.observe`. Migration guide:
1127
+ * https://iii.dev/docs/upgrading/from-0-24-x
1128
+ *
635
1129
  * Provides convenience methods to register triggers and functions scoped
636
1130
  * to this trigger type, so callers don't need to repeat the `type` field.
637
1131
  *
@@ -724,5 +1218,5 @@ type ApiResponse<TStatus extends number = number, TBody = string | Record<string
724
1218
  body?: TBody;
725
1219
  };
726
1220
  //#endregion
727
- export { OnFunctionRegistrationInput as A, StreamChannelRef as B, ChannelReader as C, EnqueueResult as D, AuthResult as E, OnTriggerTypeRegistrationResult as F, RegisterFunctionFormat as I, RegisterFunctionMessage as L, OnTriggerRegistrationInput as M, OnTriggerRegistrationResult as N, MessageType as O, OnTriggerTypeRegistrationInput as P, RegisterTriggerMessage as R, ChannelItem as S, AuthInput as T, TriggerRequest as V, IIIConnectionState as _, ISdk as a, RegistrationRejectedInit as b, RegisterTriggerInput as c, Trigger as d, TriggerTypeRef as f, EngineTriggers as g, EngineFunctions as h, FunctionRef as i, OnFunctionRegistrationResult as j, MiddlewareFunctionInput as k, RegisterTriggerTypeInput as l, TriggerHandler as m, ApiResponse as n, RegisterFunctionInput as o, TriggerConfig as p, Channel as r, RegisterFunctionOptions as s, ApiRequest as t, RemoteFunctionHandler as u, IIIReconnectionConfig as v, ChannelWriter as w, ChannelDirection as x, RegistrationRejectedError as y, RegisterTriggerTypeMessage as z };
728
- //# sourceMappingURL=types-DeNafz-M.d.mts.map
1221
+ export { OnTriggerTypeRegistrationInput as $, EngineFunctions as A, ChannelItem as B, ObserveSource as C, ObserverOptions as D, ObserverHandle as E, InvocationErrorInit as F, EnqueueResult as G, ChannelWriter as H, ObserveRejection as I, ObserveDescriptorWire as J, MessageType as K, RegistrationRejectedError as L, IIIConnectionState as M, IIIReconnectionConfig as N, ObserverState as O, InvocationError as P, OnTriggerRegistrationResult as Q, RegistrationRejectedInit as R, ObserveReason as S, Observer as T, AuthInput as U, ChannelReader as V, AuthResult as W, OnFunctionRegistrationResult as X, OnFunctionRegistrationInput as Y, OnTriggerRegistrationInput as Z, Capture as _, ISdk as a, RegisterTriggerTypeMessage as at, ObserveDoc as b, RegisterTriggerInput as c, Trigger as d, OnTriggerTypeRegistrationResult as et, TriggerTypeRef as f, CallerInfo as g, Caller as h, FunctionRef as i, RegisterTriggerMessage as it, EngineTriggers as j, Target as k, RegisterTriggerTypeInput as l, TriggerHandler as m, ApiResponse as n, RegisterFunctionFormat as nt, RegisterFunctionInput as o, StreamChannelRef as ot, TriggerConfig as p, MiddlewareFunctionInput as q, Channel as r, RegisterFunctionMessage as rt, RegisterFunctionOptions as s, TriggerRequest as st, ApiRequest as t, OpenEnum as tt, RemoteFunctionHandler as u, Filter as v, Observed as w, ObserveHooks as x, InvocationContext as y, ChannelDirection as z };
1222
+ //# sourceMappingURL=types-BVi8fWCt.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-BVi8fWCt.d.cts","names":[],"sources":["../src/iii-types.ts","../src/channels.ts","../src/errors.ts","../src/iii-constants.ts","../src/observe-types.ts","../src/triggers.ts","../src/types.ts"],"mappings":";aAAY,WAAA;EACV,gBAAA;EACA,kBAAA;EACA,cAAA;EACA,gBAAA;EACA,mBAAA;EACA,eAAA;EACA,iBAAA;EACA,qBAAA;EACA,yBAAA;EACA,oBAAA;EACA,gBAAA;EACA,QAAA;EAHA;EAKA,OAAA;EAHA;EAKA,SAAA;EAFA;EAIA,aAAA;EAAA;EAEA,oBAAA;EAEA;EAAA,kBAAA;EAIA;EAFA,aAAA;EAMA;EAJA,eAAA;EAMoB;EAJpB,WAAA;EA+BU;EA7BV,mBAAA;EA6BkB;EA3BlB,oBAAA;AAAA;;;;;KA2BU,QAAA,qBAA6B,CAAA;;KAgC7B,qBAAA;EAuQA,mCArQV,QAAA,GAAW,QAAA;EAEX,WAAA,GAAc,sBAAA,EAgRG;EA9QjB,mBAAA,WAmRW;EAjRX,KAAA;AAAA;;KA2JU,0BAAA;EACV,YAAA,EAAc,WAAA,CAAY,mBAAA,EAoU1B;EAlUA,EAAA,UAoUA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