logic-sdk 0.1.0 → 0.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/dist/index.d.ts CHANGED
@@ -2,7 +2,6 @@ import type { StandardSchemaV1 } from "@standard-schema/spec";
2
2
  type Schema<I = any, O = any> = StandardSchemaV1<I, O>;
3
3
  type In<S> = S extends Schema<infer I, any> ? I : never;
4
4
  type Out<S> = S extends Schema<any, infer O> ? O : never;
5
- type Awaitable<T> = T | Promise<T>;
6
5
  /** What you declare once in `init<...>()`. */
7
6
  export interface Config {
8
7
  /** Who and where: actor, account, locale... Must be JSON-serializable (it travels with events). */
@@ -13,6 +12,11 @@ export interface Config {
13
12
  reader?: unknown;
14
13
  /** Side-effecting services (mailer, payments...). Only actions and listeners receive them. */
15
14
  services?: object;
15
+ /**
16
+ * Your app's settings, read as `ctx.config` in every function: base URL, limits, switches. Plain data, read-only.
17
+ * Build it once from your env at the entry; clients built from secrets go in `services` instead.
18
+ */
19
+ config?: object;
16
20
  /** The shape of `meta` on your functions (tags, rate limits, "agent may call"...). Read by `wrap` and adapters. */
17
21
  meta?: object;
18
22
  }
@@ -29,6 +33,19 @@ type ServicesOf<C extends Config> = C extends {
29
33
  type MetaOf<C extends Config> = C extends {
30
34
  meta: infer M;
31
35
  } ? M : never;
36
+ /** Without a declared `config`, nothing may be passed or read: no silently ignored settings. */
37
+ type ConfigOf<C extends Config> = C extends {
38
+ config: infer F;
39
+ } ? F : Record<string, never>;
40
+ type Primitive = string | number | boolean | bigint | symbol | null | undefined;
41
+ /** Read-only all the way down: what `ctx.config` gives you. Primitives (branded ones too) stay as they are. */
42
+ export type Frozen<T> = T extends Primitive ? T : T extends readonly (infer U)[] ? readonly Frozen<U>[] : {
43
+ readonly [K in keyof T]: Frozen<T[K]>;
44
+ };
45
+ /** Any part of `T`, at any depth: what a test may override in `config`. Arrays are replaced whole, like at runtime. */
46
+ export type DeepPartial<T> = T extends Primitive | readonly unknown[] ? T : {
47
+ [K in keyof T]?: DeepPartial<T[K]>;
48
+ };
32
49
  export type Kind = "query" | "mutation" | "action";
33
50
  declare const types: unique symbol;
34
51
  declare const BRAND: unique symbol;
@@ -41,8 +58,10 @@ export interface Fn<K extends Kind = Kind, I = any, O = any, E extends boolean =
41
58
  readonly outputSchema?: Schema;
42
59
  /** Your own data about the function. Checked against `meta` in `init` where you set it, typed in `wrap`; loose here, for adapters. */
43
60
  readonly meta?: any;
44
- /** Set when the function is exposed: who may call it. Runs on every call. */
45
- readonly check?: (scope: any, input: any) => Awaitable<boolean>;
61
+ /** Who may call it (from `authorize`). Runs on every call, before validation. */
62
+ readonly authorize?: Policy<any>;
63
+ /** `true`: adapters may publish it (HTTP, oRPC, AI tools). Requires `authorize` and `outputSchema`. */
64
+ readonly expose?: true;
46
65
  readonly execute: (input: any, ctx: any) => Promise<any>;
47
66
  /** Phantom types, never set at runtime. */
48
67
  readonly [types]?: {
@@ -51,7 +70,7 @@ export interface Fn<K extends Kind = Kind, I = any, O = any, E extends boolean =
51
70
  exposed: E;
52
71
  };
53
72
  }
54
- /** A function with `expose`: adapters publish it. */
73
+ /** A function with `expose: true`: adapters may publish it. */
55
74
  export type ExposedFn<K extends Kind = Kind, I = any, O = any> = Fn<K, I, O, true>;
56
75
  /** What callers pass to a function. */
57
76
  export type FnIn<F> = F extends Fn<any, infer I, any> ? I : never;
@@ -87,13 +106,26 @@ export interface Listener<O = any> {
87
106
  readonly description?: string;
88
107
  readonly execute: (payload: O, ctx: any) => Promise<unknown>;
89
108
  }
90
- type Run<Allowed extends Kind> = <F extends Fn<Allowed>>(fn: F, input: FnIn<F>) => Promise<FnOut<F>>;
109
+ /** What a single call may change: who it runs as (part of the scope) and when to give up. Nothing else. */
110
+ export interface RunOptions<S = object> {
111
+ /**
112
+ * Merged over the current scope for this call and everything it runs: `{ scope: { actor: system } }` to act as
113
+ * someone else on purpose, `{ scope: { locale: "es" } }` to render in another language. The callee's policy sees it.
114
+ */
115
+ scope?: Partial<S>;
116
+ /**
117
+ * Checked before this call starts. Inside, actions get it as `ctx.signal` to pass on (`fetch(url, { signal })`).
118
+ * Never checked between your steps, so a caller who gives up can't leave a workflow half done.
119
+ */
120
+ signal?: AbortSignal;
121
+ }
122
+ type Run<Allowed extends Kind, S> = <F extends Fn<Allowed>>(fn: F, input: FnIn<F>, options?: RunOptions<S>) => Promise<FnOut<F>>;
91
123
  /**
92
- * Expected failures, namespaced to the module you're in: inside `bookings`, `ctx.reject("not_pending")` has
124
+ * Expected failures, namespaced to the module you're in: inside `bookings`, `ctx.errors.reject("not_pending")` has
93
125
  * code `"bookings.not_pending"`. Throw what they return. Codes are plain strings on purpose (see the errors docs).
94
126
  */
95
- interface Fail {
96
- /** A business rule said no, and trying again won't help. `throw ctx.reject("not_pending", { status })` */
127
+ export interface Errors {
128
+ /** A business rule said no, and trying again won't help. `throw ctx.errors.reject("not_pending", { status })` */
97
129
  reject(code: string, details?: unknown): DomainError;
98
130
  /** Someone else got there first, or it already exists. Refreshing and retrying may work. */
99
131
  conflict(code: string, details?: unknown): DomainError;
@@ -102,47 +134,50 @@ interface Fail {
102
134
  /** The caller is known but may not do this. Code defaults to `"<module>.<function>.forbidden"`. */
103
135
  deny(code?: string, details?: unknown): DomainError;
104
136
  }
105
- interface BaseCtx<S> extends Fail {
137
+ interface BaseCtx<C extends Config, S> {
106
138
  scope: S;
139
+ /** Your settings from `createRegistry({ config })`. Read-only; tests override parts of it. */
140
+ config: Frozen<ConfigOf<C>>;
141
+ /** Expected failures: `throw ctx.errors.reject("not_pending")`. */
142
+ errors: Errors;
107
143
  /** Current time. Fixed in tests. */
108
144
  now: () => Date;
109
145
  }
110
146
  /** `S` is the scope, narrowed by the function's policy. Alias it in init.ts: `type QueryCtx = Core.QueryCtx<Config>`. */
111
- export interface QueryCtx<C extends Config, S = ScopeOf<C>> extends BaseCtx<S> {
147
+ export interface QueryCtx<C extends Config, S = ScopeOf<C>> extends BaseCtx<C, S> {
112
148
  db: ReaderOf<C>;
113
- run: Run<"query">;
114
- /** The caller's abort signal, if any. */
115
- signal: AbortSignal | undefined;
116
- with(patch: Partial<ScopeOf<C>>): QueryCtx<C>;
149
+ /** Call another query, with its policy, validation and output check: `await ctx.run(pricing.quote, { nights })`. */
150
+ run: Run<"query", ScopeOf<C>>;
117
151
  }
118
- export interface MutationCtx<C extends Config, S = ScopeOf<C>> extends BaseCtx<S> {
152
+ export interface MutationCtx<C extends Config, S = ScopeOf<C>> extends BaseCtx<C, S> {
119
153
  db: DbOf<C>;
120
- run: Run<"query" | "mutation">;
154
+ /**
155
+ * Call a query or mutation inside this same transaction, with its policy and validation:
156
+ * `await ctx.run(availability.hold, { propertyId })`. If it fails, the whole transaction rolls back.
157
+ */
158
+ run: Run<"query" | "mutation", ScopeOf<C>>;
121
159
  /** Queue an event. Delivered to listeners only after the transaction commits. */
122
160
  emit<I>(event: EventDef<I, any>, payload: I): void;
123
- signal: AbortSignal | undefined;
124
- with(patch: Partial<ScopeOf<C>>): MutationCtx<C>;
125
161
  }
126
- export interface ActionCtx<C extends Config, S = ScopeOf<C>> extends BaseCtx<S> {
162
+ export interface ActionCtx<C extends Config, S = ScopeOf<C>> extends BaseCtx<C, S> {
127
163
  services: ServicesOf<C>;
128
- /** Each mutation you run here gets its own transaction. */
129
- run: Run<Kind>;
130
- /** The caller's abort signal. Always undefined in listeners (they outlive the request). */
164
+ /** Call any function: `await ctx.run(bookings.confirmPaid, { bookingId })`. Each mutation you run commits on its own. */
165
+ run: Run<Kind, ScopeOf<C>>;
166
+ /** The caller's abort signal: pass it on, `fetch(url, { signal: ctx.signal })`. Always undefined in listeners (they outlive the request). */
131
167
  signal: AbortSignal | undefined;
132
- with(patch: Partial<ScopeOf<C>>): ActionCtx<C>;
133
168
  }
134
169
  export interface ListenerCtx<C extends Config, O = unknown> extends ActionCtx<C> {
135
170
  event: Envelope<unknown, ScopeOf<C>> & {
136
171
  payload: O;
137
172
  };
138
173
  }
139
- /** Who may call an exposed function. Write it as a type guard (`(s): s is Staff => ...`) to narrow `scope` in `execute`. */
174
+ /**
175
+ * Who may call a function at all: signed in, admin, staff. Sync, reads only the scope, returns exactly `true` to allow.
176
+ * Write it as a type guard (`(s): s is Admin => ...`) to narrow `ctx.scope` in `execute`.
177
+ * Rules about one record ("only the owner may cancel") go in `execute`, after loading it.
178
+ */
140
179
  export type Policy<S> = (scope: S) => boolean;
141
180
  type Guarded<F, S> = F extends (scope: any) => scope is infer G ? G : S;
142
- type Inline<C extends Config, IS extends Schema> = (scope: ScopeOf<C>, input: Out<IS>) => Awaitable<boolean>;
143
- /** A policy name from `init`, or an inline check that also sees the input. */
144
- type Exposure<C extends Config, P, IS extends Schema> = (keyof P & string) | Inline<C, IS>;
145
- type ScopeFor<C extends Config, P, E> = E extends keyof P ? Guarded<P[E], ScopeOf<C>> : ScopeOf<C>;
146
181
  type CtxOf<C extends Config, K extends Kind, S> = K extends "query" ? QueryCtx<C, S> : K extends "mutation" ? MutationCtx<C, S> : ActionCtx<C, S>;
147
182
  type Def<IS extends Schema, Ctx, R> = {
148
183
  /** One sentence, shown to humans, adapters and AI tools. */
@@ -150,22 +185,35 @@ type Def<IS extends Schema, Ctx, R> = {
150
185
  inputSchema: IS;
151
186
  execute: (input: Out<IS>, ctx: Ctx) => Promise<R>;
152
187
  };
153
- type Internal = {
188
+ type NotExposed = {
154
189
  expose?: undefined;
155
190
  };
191
+ type NoPolicy = {
192
+ authorize?: undefined;
193
+ };
156
194
  type WithMeta<C extends Config> = {
157
195
  meta?: MetaOf<C>;
158
196
  };
159
197
  type WithOutput<OS extends Schema> = {
160
198
  outputSchema: OS;
161
199
  };
162
- /** Exposed functions must declare `outputSchema`: what leaves your process is a contract. Internal ones may skip it. */
163
- interface Constructor<C extends Config, K extends Kind, P> {
164
- <IS extends Schema, OS extends Schema, const E extends Exposure<C, P, IS>>(def: Def<IS, CtxOf<C, K, ScopeFor<C, P, E>>, In<OS>> & WithOutput<OS> & WithMeta<C> & {
165
- expose: E;
200
+ /**
201
+ * `expose: true` needs `authorize` and `outputSchema`: you can't publish something without saying who may call it,
202
+ * and what leaves your process is a contract. Internal functions may skip both; `authorize` still runs if set.
203
+ */
204
+ interface Constructor<C extends Config, K extends Kind> {
205
+ <IS extends Schema, OS extends Schema, P extends Policy<ScopeOf<C>>>(def: Def<IS, CtxOf<C, K, Guarded<P, ScopeOf<C>>>, In<OS>> & WithOutput<OS> & WithMeta<C> & {
206
+ authorize: P;
207
+ expose: true;
166
208
  }): Fn<K, In<IS>, Out<OS>, true>;
167
- <IS extends Schema, OS extends Schema>(def: Def<IS, CtxOf<C, K, ScopeOf<C>>, In<OS>> & WithOutput<OS> & WithMeta<C> & Internal): Fn<K, In<IS>, Out<OS>, false>;
168
- <IS extends Schema, R>(def: Def<IS, CtxOf<C, K, ScopeOf<C>>, R> & WithMeta<C> & Internal): Fn<K, In<IS>, R, false>;
209
+ <IS extends Schema, OS extends Schema, P extends Policy<ScopeOf<C>>>(def: Def<IS, CtxOf<C, K, Guarded<P, ScopeOf<C>>>, In<OS>> & WithOutput<OS> & WithMeta<C> & {
210
+ authorize: P;
211
+ } & NotExposed): Fn<K, In<IS>, Out<OS>, false>;
212
+ <IS extends Schema, R, P extends Policy<ScopeOf<C>>>(def: Def<IS, CtxOf<C, K, Guarded<P, ScopeOf<C>>>, R> & WithMeta<C> & {
213
+ authorize: P;
214
+ } & NotExposed): Fn<K, In<IS>, R, false>;
215
+ <IS extends Schema, OS extends Schema>(def: Def<IS, CtxOf<C, K, ScopeOf<C>>, In<OS>> & WithOutput<OS> & WithMeta<C> & NoPolicy & NotExposed): Fn<K, In<IS>, Out<OS>, false>;
216
+ <IS extends Schema, R>(def: Def<IS, CtxOf<C, K, ScopeOf<C>>, R> & WithMeta<C> & NoPolicy & NotExposed): Fn<K, In<IS>, R, false>;
169
217
  }
170
218
  export type ErrorKind = "invalid" | "unauthenticated" | "forbidden" | "not_found" | "conflict" | "rejected";
171
219
  /**
@@ -179,8 +227,6 @@ export declare class DomainError extends Error {
179
227
  readonly details: unknown;
180
228
  constructor(kind: ErrorKind, code: string, details?: unknown);
181
229
  }
182
- /** For the edge (`resolveScope`): no valid session. Inside modules, use `ctx.deny()`. */
183
- export declare const unauthenticated: (code?: string, details?: unknown) => DomainError;
184
230
  /** `isDomainError(e)`, or with a code: `isDomainError(e, "availability.dates_unavailable")`. */
185
231
  export declare const isDomainError: (e: unknown, code?: string) => e is DomainError;
186
232
  export interface DatabaseAdapter<Db = unknown, Tx = Db> {
@@ -216,6 +262,8 @@ export interface RegistryOptions<Mods extends Record<string, object>> {
216
262
  modules: Mods;
217
263
  database?: DatabaseAdapter<any, any>;
218
264
  services?: object;
265
+ /** Settings every function reads as `ctx.config`. Plain data: it's copied and frozen. */
266
+ config?: object;
219
267
  events?: Dispatcher;
220
268
  /** Wraps every call, including ones that fail validation or authorization: logging, tracing, audit. */
221
269
  wrap?: (call: Call, next: () => Promise<unknown>) => Promise<unknown>;
@@ -242,15 +290,11 @@ export interface RegistryOptions<Mods extends Record<string, object>> {
242
290
  attempts?: number;
243
291
  };
244
292
  }
245
- export interface CallerOptions {
246
- /** Aborts the call before it starts work. Listeners never get it: they outlive the request. */
247
- signal?: AbortSignal;
248
- }
249
- /** A registry bound to a scope: `const caller = registry.as(scope)`. */
293
+ /** A registry bound to who is calling: `const caller = registry.as(scope)`. */
250
294
  export interface Caller<S extends object = object> {
251
295
  readonly scope: S;
252
- run<F extends Fn>(fn: F, input: FnIn<F>): Promise<FnOut<F>>;
253
- with(patch: Partial<S>): Caller<S>;
296
+ /** Run any function as this caller: `await caller.run(bookings.cancel, input, { signal: request.signal })`. */
297
+ run<F extends Fn>(fn: F, input: FnIn<F>, options?: RunOptions<S>): Promise<FnOut<F>>;
254
298
  }
255
299
  export interface Registered {
256
300
  id: string;
@@ -260,7 +304,7 @@ export interface Registered {
260
304
  export interface RegisteredFn extends Registered {
261
305
  fn: Fn;
262
306
  kind: Kind;
263
- /** Has `expose`: adapters publish it. */
307
+ /** Has `expose: true`: adapters may publish it. */
264
308
  exposed: boolean;
265
309
  }
266
310
  type TypedOptions<C extends Config, Mods extends Record<string, object>> = Omit<RegistryOptions<Mods>, "wrap"> & {
@@ -270,39 +314,33 @@ type TypedOptions<C extends Config, Mods extends Record<string, object>> = Omit<
270
314
  services?: ServicesOf<C>;
271
315
  } : {
272
316
  services: ServicesOf<C>;
317
+ }) & ({} extends ConfigOf<C> ? {
318
+ config?: ConfigOf<C>;
319
+ } : {
320
+ config: ConfigOf<C>;
273
321
  }) & ([DbOf<C>] extends [never] ? {
274
322
  database?: undefined;
275
323
  } : {
276
324
  database: DatabaseAdapter<any, DbOf<C>>;
277
325
  });
326
+ /** Keys `Config` doesn't know are errors, so a typo like `servises` can't be silently ignored. */
327
+ type OnlyKnownKeys<C> = {
328
+ [K in Exclude<keyof C, keyof Config>]: never;
329
+ };
278
330
  /**
279
- * Typed constructors for your app. Curried so policy names are inferred while `Config` is explicit:
331
+ * Typed constructors for your app:
280
332
  *
281
333
  * ```ts
282
- * export const { query, mutation, action, event, on, createRegistry } = init<Config>()({
283
- * policies: { public: () => true, staff: (s): s is Staff => isStaff(s) },
284
- * });
334
+ * export const { query, mutation, action, event, on, createRegistry } = init<Config>();
285
335
  * ```
286
336
  */
287
- /** Keys `Config` doesn't know are errors, so a typo like `servises` can't be silently ignored. */
288
- type OnlyKnownKeys<C> = {
289
- [K in Exclude<keyof C, keyof Config>]: never;
290
- };
291
- export declare function init<C extends Config & OnlyKnownKeys<C>>(): Init<C>;
292
- interface Init<C extends Config> {
293
- (): Constructors<C, {}>;
294
- <P extends Record<string, Policy<ScopeOf<C>>>>(options: {
295
- policies: P;
296
- }): Constructors<C, P>;
297
- }
298
- type Constructors<C extends Config, P> = ReturnType<typeof constructors<C, P>>;
299
- declare function constructors<C extends Config, P>(policies: Record<string, Policy<any>>): {
337
+ export declare function init<C extends Config & OnlyKnownKeys<C>>(): {
300
338
  /** Create the registry once at startup: `createRegistry({ modules, database, services })`. */
301
339
  createRegistry: <const Mods extends Record<string, object>>(options: TypedOptions<C, Mods>) => {
302
340
  /** The modules you registered (typed), for adapters that build typed routers. */
303
341
  modules: Mods;
304
342
  /** Bind who is calling, once per request, job or test: `const caller = registry.as(scope)`. */
305
- as: (scope: ScopeOf<C>, opts?: CallerOptions) => Caller<ScopeOf<C>>;
343
+ as: (scope: ScopeOf<C>) => Caller<ScopeOf<C>>;
306
344
  /** Everything the registry can do. Adapters read this. */
307
345
  functions: readonly RegisteredFn[];
308
346
  events: readonly (Registered & {
@@ -319,15 +357,16 @@ declare function constructors<C extends Config, P>(policies: Record<string, Poli
319
357
  [INTERNAL]: {
320
358
  options: RegistryOptions<Mods>;
321
359
  overrides: Overrides;
360
+ config: Frozen<ConfigOf<C>>;
322
361
  derive: (more: Overrides) => /*elided*/ any;
323
362
  };
324
363
  };
325
364
  /** Reads data. Can run other queries. No writes, no events, no services. */
326
- query: Constructor<C, "query", P>;
365
+ query: Constructor<C, "query">;
327
366
  /** Changes data inside one transaction. Can run queries and mutations (same transaction) and emit events. */
328
- mutation: Constructor<C, "mutation", P>;
367
+ mutation: Constructor<C, "mutation">;
329
368
  /** Talks to the outside world (payments, email, AI). No transaction; each mutation it runs commits on its own. */
330
- action: Constructor<C, "action", P>;
369
+ action: Constructor<C, "action">;
331
370
  /** Something that happened. Emitted by mutations, delivered after commit. */
332
371
  event: <S extends Schema>(def: {
333
372
  schema: S;
@@ -342,18 +381,20 @@ declare const INTERNAL: unique symbol;
342
381
  export interface Overrides {
343
382
  database?: DatabaseAdapter<any, any>;
344
383
  services?: object;
384
+ /** Merged over the registry's config, section by section. */
385
+ config?: object;
345
386
  events?: Dispatcher;
346
387
  now?: () => Date;
347
388
  stubs?: Map<Fn, (input: any, ctx: any) => Promise<any>>;
348
389
  record?: (envelope: Envelope) => void;
349
390
  }
350
- export type Registry<S extends object = object, Mods extends Record<string, object> = Record<string, object>> = ReturnType<typeof build<S, Mods>>;
391
+ export type Registry<S extends object = object, Mods extends Record<string, object> = Record<string, object>, Cf = unknown> = ReturnType<typeof build<S, Mods, Cf>>;
351
392
  /** Create the registry once at startup. Prefer the `createRegistry` returned by `init()`: it's typed with your config. */
352
393
  export declare function createRegistry<S extends object = object, const Mods extends Record<string, object> = Record<string, object>>(options: RegistryOptions<Mods>): {
353
394
  /** The modules you registered (typed), for adapters that build typed routers. */
354
395
  modules: Mods;
355
396
  /** Bind who is calling, once per request, job or test: `const caller = registry.as(scope)`. */
356
- as: (scope: S, opts?: CallerOptions) => Caller<S>;
397
+ as: (scope: S) => Caller<S>;
357
398
  /** Everything the registry can do. Adapters read this. */
358
399
  functions: readonly RegisteredFn[];
359
400
  events: readonly (Registered & {
@@ -370,6 +411,7 @@ export declare function createRegistry<S extends object = object, const Mods ext
370
411
  [INTERNAL]: {
371
412
  options: RegistryOptions<Mods>;
372
413
  overrides: Overrides;
414
+ config: {};
373
415
  derive: (more: Overrides) => /*elided*/ any;
374
416
  };
375
417
  };
@@ -388,11 +430,11 @@ export declare function describeModules(modules: Record<string, object>): {
388
430
  event: EventDef;
389
431
  })[];
390
432
  };
391
- declare function build<S extends object, Mods extends Record<string, object>>(options: RegistryOptions<Mods>, o: Overrides): {
433
+ declare function build<S extends object, Mods extends Record<string, object>, Cf = unknown>(options: RegistryOptions<Mods>, o: Overrides): {
392
434
  /** The modules you registered (typed), for adapters that build typed routers. */
393
435
  modules: Mods;
394
436
  /** Bind who is calling, once per request, job or test: `const caller = registry.as(scope)`. */
395
- as: (scope: S, opts?: CallerOptions) => Caller<S>;
437
+ as: (scope: S) => Caller<S>;
396
438
  /** Everything the registry can do. Adapters read this. */
397
439
  functions: readonly RegisteredFn[];
398
440
  events: readonly (Registered & {
@@ -409,18 +451,20 @@ declare function build<S extends object, Mods extends Record<string, object>>(op
409
451
  [INTERNAL]: {
410
452
  options: RegistryOptions<Mods>;
411
453
  overrides: Overrides;
454
+ config: Frozen<Cf>;
412
455
  derive: (more: Overrides) => /*elided*/ any;
413
456
  };
414
457
  };
415
458
  /** @internal */
416
- export declare const internal: (registry: Registry<any, any>) => {
459
+ export declare const internal: (registry: Registry<any, any, any>) => {
417
460
  options: RegistryOptions<any>;
418
461
  overrides: Overrides;
462
+ config: any;
419
463
  derive: (more: Overrides) => {
420
464
  /** The modules you registered (typed), for adapters that build typed routers. */
421
465
  modules: any;
422
466
  /** Bind who is calling, once per request, job or test: `const caller = registry.as(scope)`. */
423
- as: (scope: any, opts?: CallerOptions) => Caller<any>;
467
+ as: (scope: any) => Caller<any>;
424
468
  /** Everything the registry can do. Adapters read this. */
425
469
  functions: readonly RegisteredFn[];
426
470
  events: readonly (Registered & {