iii-browser-sdk 0.24.4 → 0.24.5-alpha.2

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
@@ -357,6 +417,49 @@ declare class RegistrationRejectedError extends Error {
357
417
  readonly owner_worker_id: string;
358
418
  constructor(init: RegistrationRejectedInit);
359
419
  }
420
+ /** Fields used to construct an {@link InvocationError}. */
421
+ type InvocationErrorInit = {
422
+ code: string;
423
+ message: string;
424
+ function_id?: string;
425
+ stacktrace?: string;
426
+ };
427
+ /**
428
+ * An error the SDK raises itself for an invocation, with a machine-readable
429
+ * `code`: observe delivery errors (`NOT_OWNER_DELIVERED`,
430
+ * `OBSERVER_NOT_ACTIVE`, `FILTERS_NOT_MATCHED`) and an invalid observe
431
+ * descriptor (`INVALID_OBSERVE_DESCRIPTOR`). Mirrors the Node SDK.
432
+ *
433
+ * A call the engine answers with an error still rejects with the engine's
434
+ * error body (`{ code, message, stacktrace? }`), as in earlier releases, and
435
+ * so does a locally dispatched call whose handler throws: both paths reject
436
+ * with the same value.
437
+ */
438
+ declare class InvocationError extends Error {
439
+ readonly code: string;
440
+ readonly function_id?: string;
441
+ readonly stacktrace?: string;
442
+ constructor(init: InvocationErrorInit);
443
+ }
444
+ /**
445
+ * Thrown by an `onObserverAdded` hook to reject an observer with a code of
446
+ * its own (`HTTP_ROUTE_CONFLICT`, `INVALID_CRON_EXPRESSION`, ...); any other
447
+ * error rejects it with `OBSERVE_REJECTED`. Also the error `ObserverHandle.ready()`
448
+ * rejects with when the observer turns `error` or `disposed`.
449
+ *
450
+ * @example
451
+ * ```typescript
452
+ * onObserverAdded(obs) {
453
+ * if (!isValidCron(obs.args.expression)) {
454
+ * throw new ObserveRejection('INVALID_CRON_EXPRESSION', 'invalid day-of-week field')
455
+ * }
456
+ * }
457
+ * ```
458
+ */
459
+ declare class ObserveRejection extends Error {
460
+ readonly code: string;
461
+ constructor(code: string, message: string);
462
+ }
360
463
  //#endregion
361
464
  //#region src/iii-constants.d.ts
362
465
  /**
@@ -402,11 +505,256 @@ interface IIIReconnectionConfig {
402
505
  maxRetries: number;
403
506
  }
404
507
  //#endregion
508
+ //#region src/observe-types.d.ts
509
+ /** What an observer ships to its target. Default `['input', 'output', 'caller']`. */
510
+ type Capture = 'input' | 'output' | 'error' | 'caller' | 'metadata';
511
+ /**
512
+ * An observer's lifecycle: `pending` (no owner yet, waiting for the owner's
513
+ * ack, or no target yet) → `active` or `error`; `suspended` while its worker
514
+ * or target is away; `disposed` at the end.
515
+ */
516
+ type ObserverState = 'pending' | 'active' | 'suspended' | 'error' | 'disposed';
517
+ /**
518
+ * A declarative filter over `input`, `output`, `error`, `caller` and
519
+ * `metadata`, with explicit operators only:
520
+ * `{ 'input.amount': { $gte: 500 } }`. See the filter language reference.
521
+ */
522
+ type Filter = Record<string, unknown>;
523
+ /** The right side of `iii.observe`: a registered function. */
524
+ type Target = string | {
525
+ function_id: string;
526
+ namespace?: string;
527
+ };
528
+ /** A state reason or an error: a machine-readable code and a message. */
529
+ type ObserveReason = {
530
+ code: string;
531
+ message: string;
532
+ };
533
+ /**
534
+ * Who started an invocation: the worker (`worker_id` / `worker_name`, stamped
535
+ * by the engine), and the function and invocation the call was made from.
536
+ */
537
+ interface Caller {
538
+ /** Absent on activations, whose caller is the engine (`worker_name: 'iii-engine'`). */
539
+ worker_id?: string;
540
+ worker_name?: string;
541
+ /** The handler the call was made from; absent for top-level calls. */
542
+ function_id?: string;
543
+ invocation_id?: string;
544
+ /** The caller of that handler, one level only. */
545
+ parent?: Omit<Caller, 'parent'>;
546
+ }
547
+ /**
548
+ * A caller as the SDK knows it: every field may be missing (a top-level call
549
+ * has no function; a call made before `WorkerRegistered` has no worker id).
550
+ */
551
+ type CallerInfo = Partial<Omit<Caller, 'parent'>> & {
552
+ parent?: Partial<Omit<Caller, 'parent'>>;
553
+ };
554
+ /**
555
+ * What the target of an auto observer (or of `obs.emit`) receives with
556
+ * `deliver: 'envelope'` (the default). Fields not in the observer's
557
+ * `capture` are absent.
558
+ */
559
+ interface Observed<I = unknown, O = unknown> {
560
+ observer_id: string;
561
+ activation_id: string;
562
+ function_id: string;
563
+ namespace: string;
564
+ invocation_id: string;
565
+ status: 'success' | 'error';
566
+ input?: I;
567
+ output?: O;
568
+ error?: {
569
+ code: string;
570
+ message: string;
571
+ };
572
+ caller?: Caller;
573
+ metadata?: Record<string, unknown>;
574
+ started_at_ms: number;
575
+ duration_ms: number;
576
+ }
577
+ /** The left side of `iii.observe`: what is observed. */
578
+ interface ObserveSource {
579
+ /** The observed function. */
580
+ function_id: string;
581
+ /** Defaults to this worker's namespace (`engine::*` resolves to `default`). */
582
+ namespace?: string;
583
+ /** Owner-delivered functions only: for the owner; validated against its `args_format`. */
584
+ args?: Record<string, unknown>;
585
+ /** Which events reach the target; `{}` (or absent) = every event. */
586
+ filters?: Filter;
587
+ /** Auto only; default `'success'`. */
588
+ on?: 'success' | 'error' | 'complete';
589
+ /** Auto and `obs.emit`; default `['input', 'output', 'caller']`. */
590
+ capture?: Capture[];
591
+ /** Auto and `obs.emit`; default `'envelope'`. */
592
+ deliver?: 'envelope' | 'input' | 'output';
593
+ }
594
+ /** The observer itself: its id, policy and metadata. */
595
+ interface ObserverOptions {
596
+ /** Default: a random UUID, stable across replays. */
597
+ id?: string;
598
+ /** The observer is disposed after this many activations (`MAX_FIRES`). Default: unlimited. */
599
+ max_fires?: number;
600
+ /** The observer is disposed this many milliseconds after it is created (`EXPIRED`). Default: never. */
601
+ expires_in_ms?: number;
602
+ /**
603
+ * Activations running at once; further ones queue, then drop as `OVERFLOW`.
604
+ * Default: the engine's `observers.default_max_in_flight` (64).
605
+ */
606
+ max_in_flight?: number;
607
+ /** Delivered as the metadata sidecar of every activation. */
608
+ metadata?: Record<string, unknown>;
609
+ }
610
+ /** What `iii.observe` returns, synchronously. */
611
+ interface ObserverHandle {
612
+ readonly id: string;
613
+ readonly state: ObserverState;
614
+ /** Why the observer is in its state (`error`, `suspended`, `disposed`). */
615
+ readonly reason?: ObserveReason;
616
+ /**
617
+ * Resolves when the observer is `active`; rejects with an
618
+ * {@link ObserveRejection} carrying the code when it turns `error` or
619
+ * `disposed` first.
620
+ */
621
+ ready(): Promise<void>;
622
+ /**
623
+ * Calls `listener` on every state change, in order; returns the
624
+ * unsubscribe function. Listeners are called asynchronously (never on the
625
+ * connection's read path), so they may call the client.
626
+ */
627
+ onStateChange(listener: (state: ObserverState, reason?: ObserveReason) => void): () => void;
628
+ /** Removes the observer (`unobserve`). It is not replayed on reconnect. */
629
+ dispose(): Promise<void>;
630
+ }
631
+ /** The document an observer's filters read (filters.md §1). */
632
+ type ObserveDoc = {
633
+ input?: unknown;
634
+ output?: unknown;
635
+ error?: unknown;
636
+ caller?: CallerInfo;
637
+ metadata?: unknown;
638
+ };
639
+ /**
640
+ * An observer as the function's owner sees it (`onObserverAdded`,
641
+ * `FunctionRef.observers()`): its args, filters, target, capture and `on`.
642
+ * Never its metadata, policy or the observing worker.
643
+ */
644
+ interface Observer {
645
+ readonly id: string;
646
+ /** The observed function (the one this worker hosts). */
647
+ readonly function_id: string;
648
+ /** The observer's args, validated against `args_format` by the engine. */
649
+ readonly args: Record<string, unknown>;
650
+ /** The observer's filters, normalized; the SDK applies them in `emit` / `call`. */
651
+ readonly filters: Filter;
652
+ /** The target function id. */
653
+ readonly target: string;
654
+ readonly capture: Capture[];
655
+ /** Auto only. */
656
+ readonly on: 'success' | 'error' | 'complete';
657
+ /** Set when the engine's legacy shim created the observer from an old `registerTrigger`. */
658
+ readonly legacy?: {
659
+ trigger_type: string;
660
+ config: unknown;
661
+ };
662
+ /** Evaluates the observer's filters on a document. */
663
+ matches(doc: ObserveDoc): boolean;
664
+ /**
665
+ * Owner delivery, fire-and-forget: hands `event` to this observer. Returns
666
+ * `false` and sends nothing when its filters reject the event or the
667
+ * observer is no longer active (removed or rejected meanwhile). Throws
668
+ * `NOT_OWNER_DELIVERED` on an auto function.
669
+ */
670
+ emit(event: unknown): boolean;
671
+ /**
672
+ * Owner delivery, request/response: invokes the target with `payload` and
673
+ * resolves with its result. Rejects with `FILTERS_NOT_MATCHED` (nothing is
674
+ * sent) when the filters reject the payload, and with `OBSERVER_NOT_ACTIVE`
675
+ * when the observer is no longer active.
676
+ */
677
+ call<R = unknown>(payload: unknown, opts?: {
678
+ timeoutMs?: number;
679
+ metadata?: never;
680
+ }): Promise<R>;
681
+ /**
682
+ * Late rejection of an active observer (e.g. after a config reload). It
683
+ * stops receiving events at once, and stays rejected across reconnects
684
+ * until the engine adds it again.
685
+ */
686
+ reject(code: string, message: string): void;
687
+ }
688
+ /**
689
+ * The `observe` option of `registerFunction`: how the function's observers
690
+ * are delivered, and the callbacks that run when one is added or removed.
691
+ *
692
+ * The callbacks of one function run one at a time, in revision order, with
693
+ * one exception: a callback still running after 30 s is treated as failed
694
+ * (`OWNER_TIMEOUT`) and the next one starts, so a hung callback cannot stall
695
+ * its function forever. It may then overlap with the callbacks after it, and
696
+ * if a timed-out `onObserverAdded` completes later, `onObserverRemoved` runs
697
+ * for that observer.
698
+ */
699
+ interface ObserveHooks {
700
+ /**
701
+ * `auto` (default): every invocation is offered to every observer.
702
+ * `owner`: the handler hands each event to the observers it belongs to,
703
+ * with `obs.emit` / `obs.call`.
704
+ */
705
+ delivery?: 'auto' | 'owner';
706
+ /** Owner only: JSON Schema of the observers' `args` (the engine answers `INVALID_ARGS`). */
707
+ args_format?: RegisterFunctionFormat;
708
+ /** Accept old `registerTrigger({ type })` calls for this trigger type. */
709
+ legacy_trigger_type?: string;
710
+ /** Default `true`; `false` refuses every observer (`NOT_OBSERVABLE`). */
711
+ allow?: boolean;
712
+ /**
713
+ * Runs once per added observer, before the SDK acks it. Throw to reject it
714
+ * (an {@link ObserveRejection} sets the code, anything else is
715
+ * `OBSERVE_REJECTED`); after 30 s it is rejected with `OWNER_TIMEOUT`.
716
+ */
717
+ onObserverAdded?(obs: Observer): void | Promise<void>;
718
+ /** Runs once per removed observer. Cannot fail: errors are logged. */
719
+ onObserverRemoved?(obs: Observer): void | Promise<void>;
720
+ }
721
+ /**
722
+ * The invocation the current code runs in, in every handler, remote or
723
+ * local (`iii.currentInvocation()`).
724
+ *
725
+ * Browsers have no `AsyncLocalStorage`, so the SDK knows it only while the
726
+ * handler runs synchronously: up to its first `await`. To keep it across an
727
+ * `await`, read it first and re-enter it with `iii.withInvocation(inv, fn)`.
728
+ */
729
+ interface InvocationContext {
730
+ function_id: string;
731
+ invocation_id: string;
732
+ caller?: CallerInfo;
733
+ /** Set when this invocation is the activation of an observer's target. */
734
+ activation?: {
735
+ observer_id: string;
736
+ activation_id?: string;
737
+ };
738
+ observe_depth: number;
739
+ /**
740
+ * The W3C `traceparent` the invocation arrived with (or was triggered with,
741
+ * for a local call). Calls made inside the handler forward it. Browser SDK
742
+ * only: there is no OpenTelemetry context to carry it.
743
+ */
744
+ traceparent?: string;
745
+ /** The W3C `baggage` that came with `traceparent`. */
746
+ baggage?: string;
747
+ }
748
+ //#endregion
405
749
  //#region src/triggers.d.ts
406
750
  /**
407
751
  * Configuration passed to a trigger handler when a trigger instance is
408
752
  * registered or unregistered.
409
753
  *
754
+ * @deprecated Replaced by the `Observer` an `onObserverAdded` hook
755
+ * receives (`{ id, args, filters, target }`). Migration guide:
756
+ * https://iii.dev/docs/upgrading/from-0-24-x
757
+ *
410
758
  * @typeParam TConfig - Type of the trigger-specific configuration.
411
759
  */
412
760
  type TriggerConfig<TConfig> = {
@@ -429,6 +777,10 @@ type TriggerConfig<TConfig> = {
429
777
  * Handler interface for custom trigger types. Passed to
430
778
  * `ISdk.registerTriggerType`.
431
779
  *
780
+ * @deprecated Replaced by `ObserveHooks` (`onObserverAdded` /
781
+ * `onObserverRemoved`) on `registerFunction`. Migration guide:
782
+ * https://iii.dev/docs/upgrading/from-0-24-x
783
+ *
432
784
  * @typeParam TConfig - Type of the trigger-specific configuration.
433
785
  *
434
786
  * @example
@@ -451,7 +803,8 @@ type TriggerHandler<TConfig> = {
451
803
  //#region src/types.d.ts
452
804
  /**
453
805
  * Async function handler for a registered function. Receives the invocation
454
- * payload and returns the result.
806
+ * payload and its metadata (`TriggerRequest.metadata` of the call, or an
807
+ * observer's metadata sidecar on an activation) and returns the result.
455
808
  *
456
809
  * @typeParam TInput - Type of the invocation payload.
457
810
  * @typeParam TOutput - Type of the return value.
@@ -462,14 +815,39 @@ type TriggerHandler<TConfig> = {
462
815
  * async (data) => ({ message: `Hello, ${data.name}!` })
463
816
  * ```
464
817
  */
465
- type RemoteFunctionHandler<TInput = any, TOutput = any> = (data: TInput) => Promise<TOutput>;
818
+ type RemoteFunctionHandler<TInput = any, TOutput = any> = (data: TInput, metadata?: unknown) => Promise<TOutput>;
819
+ /** @deprecated Use `iii.observe(source, target, options)` and its {@link ObserveSource}. */
466
820
  type RegisterTriggerInput = Omit<RegisterTriggerMessage, 'message_type' | 'id'>;
467
821
  type RegisterFunctionInput = Omit<RegisterFunctionMessage, 'message_type'>;
468
- type RegisterFunctionOptions = Omit<RegisterFunctionMessage, 'message_type' | 'id'>;
822
+ /**
823
+ * Options of {@link ISdk.registerFunction}: description, request/response
824
+ * formats, metadata, and the observe hooks.
825
+ */
826
+ type RegisterFunctionOptions = Omit<RegisterFunctionMessage, 'message_type' | 'id' | 'observe'> & {
827
+ /**
828
+ * Makes the function observable on its own terms: owner delivery
829
+ * (`delivery: 'owner'`, `args_format`), and callbacks when an observer is
830
+ * added or removed. Without it the function is still observable (auto
831
+ * delivery, no args).
832
+ */
833
+ observe?: ObserveHooks;
834
+ /**
835
+ * Calls this worker makes to its own function run in-process once the
836
+ * engine confirmed it (default `true`). Set `false` for a handler that must
837
+ * always run through the engine.
838
+ */
839
+ localDispatch?: boolean;
840
+ };
841
+ /** @deprecated Register a function with an observe descriptor instead. */
469
842
  type RegisterTriggerTypeInput = Omit<RegisterTriggerTypeMessage, 'message_type'>;
470
843
  interface ISdk {
471
844
  /**
472
845
  * Registers a new trigger. A trigger is a way to invoke a function when a certain event occurs.
846
+ *
847
+ * @deprecated Use {@link ISdk.observe} instead: `iii.observe({ function_id, args, filters }, target, { metadata })`.
848
+ * Logs a warning once per page. The http, cron, queue, state, stream, pubsub and database workers
849
+ * still publish trigger types: keep using `registerTrigger` for them until they ship source functions.
850
+ * Migration guide: https://iii.dev/docs/upgrading/from-0-24-x
473
851
  * <!-- docs:expand-params -->
474
852
  * @param trigger - The trigger to register
475
853
  * @returns A trigger object that can be used to unregister the trigger
@@ -543,8 +921,104 @@ interface ISdk {
543
921
  * ```
544
922
  */
545
923
  trigger<TInput = unknown, TOutput = any>(request: TriggerRequest<TInput>): Promise<TOutput>;
924
+ /**
925
+ * Observes a function: every event of `source` that passes its `filters`
926
+ * invokes `target`, a registered function. Returns synchronously (also
927
+ * before the connection is up); the observer is replayed with the same id
928
+ * on reconnect. Errors show up as state `error` and reject `ready()`;
929
+ * against an engine without observe that is `UNSUPPORTED`.
930
+ *
931
+ * @param source - What is observed: `function_id`, `args` (owner-delivered functions only), `filters`, `on`, `capture`, `deliver`.
932
+ * @param target - The function to invoke.
933
+ * @param options - `id`, `max_fires`, `expires_in_ms`, `max_in_flight`, `metadata`.
934
+ *
935
+ * @example
936
+ * ```typescript
937
+ * worker.registerFunction('ui::order-shipped', async ({ input }: Observed) => toast(input))
938
+ *
939
+ * const shipped = worker.observe(
940
+ * { function_id: 'orders::ship', filters: { 'input.customer_id': { $eq: customerId } } },
941
+ * 'ui::order-shipped',
942
+ * )
943
+ * await shipped.ready()
944
+ * ```
945
+ */
946
+ observe(source: ObserveSource, target: Target, options?: ObserverOptions): ObserverHandle;
947
+ /**
948
+ * The invocation the calling code runs in (remote or local handler), or
949
+ * `undefined` outside any handler.
950
+ *
951
+ * Browsers have no `AsyncLocalStorage`: the SDK knows the invocation while
952
+ * the handler runs synchronously, up to its first `await`; after it this
953
+ * returns `undefined`. Read it before awaiting, and re-enter it with
954
+ * {@link ISdk.withInvocation} for calls made after.
955
+ *
956
+ * Code after an `await`, outside {@link ISdk.withInvocation}, runs outside any
957
+ * invocation, but its calls are not treated as new chains: they carry the
958
+ * `observe_depth` of the deepest invocation running on this page, so the
959
+ * engine's loop guard (`max_observe_depth`) still stops an observer cycle
960
+ * whose target awaits before calling back. With several invocations
961
+ * running this over-counts, and a legitimate chain may stop early. They
962
+ * carry a `caller` and `traceparent` only when that is unambiguous (one
963
+ * invocation is running, and it is an observe activation); otherwise none.
964
+ * They never get an invocation's metadata: `obs.emit` / `obs.call` filters
965
+ * on `metadata.*` see it only inside a real scope. An invocation that never
966
+ * settles stops counting as running after 10 minutes (a local call: at its
967
+ * timeout). Local calls nest the same way: a self-recursion that awaits
968
+ * before each call goes through the engine past 64 levels, while calls
969
+ * started together count as one level. A limitation: local calls started in
970
+ * separate ticks while earlier ones still run also look nested, so a long,
971
+ * wide fan-out may send some through the engine (same results). While the
972
+ * socket is closed none is: a function this worker hosts then runs here up
973
+ * to 256 local calls deep, and past that the call fails at once with
974
+ * `LOCAL_DEPTH_EXCEEDED` (a runaway recursion must not freeze the page).
975
+ *
976
+ * @example
977
+ * ```typescript
978
+ * worker.registerFunction('ui::checkout', async (cart) => {
979
+ * const inv = worker.currentInvocation() // { function_id, invocation_id, caller, observe_depth, ... }
980
+ * const quote = await fetchQuote(cart)
981
+ * return worker.withInvocation(inv, () => worker.trigger({ function_id: 'orders::create', payload: quote }))
982
+ * })
983
+ * ```
984
+ */
985
+ currentInvocation(): InvocationContext | undefined;
986
+ /**
987
+ * Runs `fn` inside `invocation` (what {@link ISdk.currentInvocation}
988
+ * returned), and returns what `fn` returns. Calls `fn` makes before its own
989
+ * first `await` (`trigger`, `obs.emit`, `obs.call`, `currentInvocation`)
990
+ * belong to that invocation: they carry its caller, `observe_depth` and
991
+ * `traceparent`. When `fn` returns a promise, the invocation counts as
992
+ * running until it settles, so `fn`'s code after an `await` gets the
993
+ * fallback below. `undefined` runs `fn` outside any invocation.
994
+ *
995
+ * Code after an `await`, outside `withInvocation`, runs outside any
996
+ * invocation, but its calls are not treated as new chains: they carry the
997
+ * `observe_depth` of the deepest invocation running on this page, so the
998
+ * engine's loop guard (`max_observe_depth`) still stops an observer cycle
999
+ * whose target awaits before calling back. With several invocations
1000
+ * running this over-counts, and a legitimate chain may stop early. They
1001
+ * carry a `caller` and `traceparent` only when that is unambiguous (one
1002
+ * invocation is running, and it is an observe activation); otherwise none.
1003
+ * They never get an invocation's metadata: `obs.emit` / `obs.call` filters
1004
+ * on `metadata.*` see it only inside a real scope. An invocation that never
1005
+ * settles stops counting as running after 10 minutes (a local call: at its
1006
+ * timeout). Local calls nest the same way: a self-recursion that awaits
1007
+ * before each call goes through the engine past 64 levels, while calls
1008
+ * started together count as one level. A limitation: local calls started in
1009
+ * separate ticks while earlier ones still run also look nested, so a long,
1010
+ * wide fan-out may send some through the engine (same results). While the
1011
+ * socket is closed none is: a function this worker hosts then runs here up
1012
+ * to 256 local calls deep, and past that the call fails at once with
1013
+ * `LOCAL_DEPTH_EXCEEDED` (a runaway recursion must not freeze the page).
1014
+ */
1015
+ withInvocation<T>(invocation: InvocationContext | undefined, fn: () => T): T;
546
1016
  /**
547
1017
  * Registers a new trigger type. A trigger type is a way to invoke a function when a certain event occurs.
1018
+ *
1019
+ * @deprecated Register a function with an observe descriptor instead:
1020
+ * `registerFunction(id, handler, { observe: { delivery: 'owner', onObserverAdded, onObserverRemoved } })`.
1021
+ * Logs a warning once per page. Migration guide: https://iii.dev/docs/upgrading/from-0-24-x
548
1022
  * @param triggerType - The trigger type to register
549
1023
  * @param handler - The handler for the trigger type
550
1024
  * @returns A trigger type object that can be used to unregister the trigger type
@@ -571,6 +1045,8 @@ interface ISdk {
571
1045
  registerTriggerType<TConfig>(triggerType: RegisterTriggerTypeInput, handler: TriggerHandler<TConfig>): TriggerTypeRef<TConfig>;
572
1046
  /**
573
1047
  * Unregisters a trigger type.
1048
+ *
1049
+ * @deprecated Trigger types are replaced by functions with an observe descriptor.
574
1050
  * @param triggerType - The trigger type to unregister
575
1051
  *
576
1052
  * @example
@@ -617,6 +1093,8 @@ interface ISdk {
617
1093
  /**
618
1094
  * Handle returned by {@link ISdk.registerTrigger}. Use `unregister()` to
619
1095
  * remove the trigger from the engine.
1096
+ *
1097
+ * @deprecated `registerTrigger` is replaced by `iii.observe`, which returns an {@link ObserverHandle}.
620
1098
  */
621
1099
  type Trigger = {
622
1100
  /** Removes this trigger from the engine. */unregister(): void;
@@ -628,10 +1106,20 @@ type Trigger = {
628
1106
  type FunctionRef = {
629
1107
  /** The unique function identifier. */id: string; /** Removes this function from the engine. */
630
1108
  unregister: () => void;
1109
+ /**
1110
+ * Whether any observer is active on this function (one load, for the emit
1111
+ * fast path: skip building an event nobody receives).
1112
+ */
1113
+ isObserved: () => boolean; /** The active observers, as this owner sees them. */
1114
+ observers: () => readonly Observer[];
631
1115
  };
632
1116
  /**
633
1117
  * Typed handle returned by {@link ISdk.registerTriggerType}.
634
1118
  *
1119
+ * @deprecated Trigger types are replaced by functions with an observe
1120
+ * descriptor, and these helpers by `iii.observe`. Migration guide:
1121
+ * https://iii.dev/docs/upgrading/from-0-24-x
1122
+ *
635
1123
  * Provides convenience methods to register triggers and functions scoped
636
1124
  * to this trigger type, so callers don't need to repeat the `type` field.
637
1125
  *
@@ -724,5 +1212,5 @@ type ApiResponse<TStatus extends number = number, TBody = string | Record<string
724
1212
  body?: TBody;
725
1213
  };
726
1214
  //#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-fqr5SRfu.d.cts.map
1215
+ 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 };
1216
+ //# sourceMappingURL=types-Crw4auK5.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-Crw4auK5.d.mts","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;EA2BU;EAzBV,mBAAA;EAyBkB;EAvBlB,oBAAA;AAAA;;;;;KAuBU,QAAA,qBAA6B,CAAA;;KAgC7B,qBAAA;EAmQV,mCAjQA,QAAA,GAAW,QAAA,oBAkQC;EAhQZ,WAAA,GAAc,sBAAA,EAmQJ;EAjQV,mBAAA;EAEA,KAAA;AAAA;;KA2JU,0BAAA;EACV,YAAA,EAAc,WAAA,CAAY,mBAAA,EA8TD;EA5TzB,EAAA,UAgUA;EA9TA,WAAA;AAAA;;KA6CU,sBAAA;ECvRiB,gEDyR3B,YAAA,EAAc,WAAA,CAAY,eAAA,ECzRW;ED2RrC,EAAA,UChRQ;EDkRR,IAAA,UCzRqB;ED2RrB,WAAA,UCvR2B;EDyR3B,MAAA;ECzRsC;;;;;;;;EDkStC,SAAA;AAAA;AAAA,KAGU,sBAAA;ECnRc;;;EDuRxB,IAAA;ECrRQ;;;EDyRR,WAAA;;;;EAIA,IAAA;EChRQ;;;EDoRR,UAAA,GAAa,MAAA;EClPI;;;EDsPjB,KAAA;ECrNe;;AA8BjB;ED2LE,QAAA;EAAA,CACC,GAAA;AAAA;AAAA,KAGS,uBAAA;EACV,YAAA,EAAc,WAAA,CAAY,gBAAA;EC3IT;;;ED+IjB,EAAA;EClMQ;;;E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