@fuzdev/fuz_app 0.35.0 → 0.36.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.
@@ -81,7 +81,7 @@ not the runtime):
81
81
  - `get_executor_phases(spec, executor)` — phases a given executor (`'frontend' | 'backend'`) participates in for the spec. Deduplicates via `Set` (handles `initiator: 'both'` overlap).
82
82
  - `get_handler_return_type(spec, phase, imports, path_prefix)` — the TS type a phase handler must return; triggers the `ActionOutputs` import as a side effect.
83
83
  - `generate_phase_handlers(spec, executor, imports, {action_event_type?})` — emits the typed handler-map fragment for one action; consumers compose these into `ActionHandlers` types.
84
- - `generate_actions_api_method_signature(spec, {sync_returns_value?})` — single source of truth for the typed `ActionsApi` method shape. Threads `options?: RpcClientCallOptions` (`{signal?, transport_name?, queue?}`) onto every async method. Consumers must regenerate onto this helperolder inline templates using `get_innermost_type_name` directly drop the options arg.
84
+ - `generate_actions_api_method_signature(spec, {sync_returns_value?})` — single source of truth for the typed `ActionsApi` method shape. Threads `options?: RpcClientCallOptions` (`{signal?, transport_name?, queue?}`) onto every async method `request_response`, `remote_notification`, and async `local_call`and wraps the return in `Promise<Result<...>>`. Notifications were previously emitted as `=> void`, mismatching the runtime (`create_remote_notification_method` returns a Promise that resolves to `Result<{value: void}>`); regenerate consumer typed clients to pick up the corrected shape. Older inline templates using `get_innermost_type_name` directly drop the options arg — also regenerate those.
85
85
  - `create_banner(origin_path)` — gen banner comment.
86
86
  - `to_action_spec_identifier(method)` / `to_action_spec_input_identifier` / `to_action_spec_output_identifier` — naming convention helpers (emit `foo_action_spec` / `foo_action_spec.input` / `foo_action_spec.output`).
87
87
  - `get_innermost_type(schema)` / `get_innermost_type_name(schema)` — unwrap Zod `ZodOptional` / `ZodNullable` / `ZodDefault` / transforms / pipes / prefaults to reach the base schema.
@@ -116,10 +116,16 @@ export declare const get_innermost_type_name: (schema: z.ZodType) => string;
116
116
  * surface evolves in one place when fields like `signal` or `transport_name`
117
117
  * are added to per-call options.
118
118
  *
119
- * Async methods (request_response, async local_call) get an optional second
120
- * `options?: RpcClientCallOptions` arg (`{signal?, transport_name?}`). Sync
121
- * local_call methods omit the options arg — `signal` can't cooperatively
122
- * interrupt a synchronous handler and there's no transport to select.
119
+ * Async methods (`request_response`, `remote_notification`, async
120
+ * `local_call`) get an optional second `options?: RpcClientCallOptions` arg
121
+ * (`{signal?, transport_name?, queue?}`) and a `Promise<Result<...>>` return
122
+ * type. Sync `local_call` methods omit the options arg `signal` can't
123
+ * cooperatively interrupt a synchronous handler and there's no transport to
124
+ * select. `remote_notification` is async because
125
+ * `create_remote_notification_method` returns a Promise that resolves to a
126
+ * `Result<{value: void}>` (success) or `Result<{error}>` (transport send
127
+ * failure). Earlier emit shapes declared notifications as `=> void` —
128
+ * regenerate consumer typed clients to pick up the corrected return.
123
129
  *
124
130
  * Consumers must import `ActionInputs`, `ActionOutputs`, `Result`,
125
131
  * `JsonrpcErrorObject`, and (for async) `RpcClientCallOptions` into the
@@ -1 +1 @@
1
- {"version":3,"file":"action_codegen.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_codegen.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,KAAK,EAAC,eAAe,EAAE,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAOxE;;GAEG;AACH,UAAU,UAAU;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,WAAW,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,aAAa;;IACzB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAa;IAE1D;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAQrC;;;;OAIG;IACH,QAAQ,CAA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C,KACtC,MAoBF,CAAC"}
@@ -322,10 +322,16 @@ export const get_innermost_type_name = (schema) => {
322
322
  * surface evolves in one place when fields like `signal` or `transport_name`
323
323
  * are added to per-call options.
324
324
  *
325
- * Async methods (request_response, async local_call) get an optional second
326
- * `options?: RpcClientCallOptions` arg (`{signal?, transport_name?}`). Sync
327
- * local_call methods omit the options arg — `signal` can't cooperatively
328
- * interrupt a synchronous handler and there's no transport to select.
325
+ * Async methods (`request_response`, `remote_notification`, async
326
+ * `local_call`) get an optional second `options?: RpcClientCallOptions` arg
327
+ * (`{signal?, transport_name?, queue?}`) and a `Promise<Result<...>>` return
328
+ * type. Sync `local_call` methods omit the options arg `signal` can't
329
+ * cooperatively interrupt a synchronous handler and there's no transport to
330
+ * select. `remote_notification` is async because
331
+ * `create_remote_notification_method` returns a Promise that resolves to a
332
+ * `Result<{value: void}>` (success) or `Result<{error}>` (transport send
333
+ * failure). Earlier emit shapes declared notifications as `=> void` —
334
+ * regenerate consumer typed clients to pick up the corrected return.
329
335
  *
330
336
  * Consumers must import `ActionInputs`, `ActionOutputs`, `Result`,
331
337
  * `JsonrpcErrorObject`, and (for async) `RpcClientCallOptions` into the
@@ -345,7 +351,7 @@ export const generate_actions_api_method_signature = (spec, options) => {
345
351
  const input_param = has_input
346
352
  ? `input${spec.input.safeParse(undefined).success ? '?' : ''}: ActionInputs['${spec.method}']`
347
353
  : 'input?: void';
348
- const is_async = spec.kind === 'request_response' || (spec.kind === 'local_call' && spec.async);
354
+ const is_async = spec.kind === 'request_response' || spec.kind === 'remote_notification' || spec.async;
349
355
  const options_param = is_async ? ', options?: RpcClientCallOptions' : '';
350
356
  const result_return = `Result<{value: ActionOutputs['${spec.method}']}, {error: JsonrpcErrorObject}>`;
351
357
  const return_type = is_async
@@ -99,14 +99,18 @@ export type ThrowingRpcCall = <TOutput = unknown>(method: string, input?: unknow
99
99
  * The mapped-type generic constraint accepts both shapes without a cast:
100
100
  * a codegen-derived typed `ActionsApi` (named-method interface, e.g.
101
101
  * `{account_verify: (input) => Promise<Result<...>>, ...}`) and a loose
102
- * `Record<string, (input?: any) => Promise<any>>`. Using `keyof TApi` in
103
- * the constraint avoids the index-signature requirement that would
102
+ * `Record<string, (input?: any) => Promise<any> | void>`. Using `keyof TApi`
103
+ * in the constraint avoids the index-signature requirement that would
104
104
  * otherwise force consumers to `as unknown as Record<string, …>` their
105
- * generated client.
105
+ * generated client. The `| void` arm tolerates `remote_notification`
106
+ * methods, whose `ActionsApi` signature is `(input) => void` even though
107
+ * `create_remote_notification_method` returns a Promise at runtime — the
108
+ * throwing wrapper is intended for `request_response` calls but must
109
+ * accept mixed `ActionsApi` shapes without forcing a cast at the seam.
106
110
  *
107
111
  * @param api - typed RPC client from `create_rpc_client` (or any object
108
- * whose values are all `(input?) => Promise<...>` functions — notably
109
- * the consumer's generated `ActionsApi` interface)
112
+ * whose values are all `(input?) => Promise<...> | void` functions —
113
+ * notably the consumer's generated `ActionsApi` interface)
110
114
  */
111
- export declare const create_throwing_rpc_call: <TApi extends Record<keyof TApi, (input?: any) => Promise<any>>>(api: TApi) => ThrowingRpcCall;
115
+ export declare const create_throwing_rpc_call: <TApi extends Record<keyof TApi, (input?: any) => Promise<any> | void>>(api: TApi) => ThrowingRpcCall;
112
116
  //# sourceMappingURL=rpc_client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rpc_client.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/rpc_client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,yBAAyB,CAAC;AAOpE,OAAO,KAAK,EAAC,UAAU,EAAE,qBAAqB,EAAC,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAGnD;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,G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AAO,CAAC,OAAO,CAAC,CAAC;AAEtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,wBAAwB,GACpC,IAAI,SAAS,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,EAErE,KAAK,IAAI,KACP,eAcF,CAAC"}
@@ -193,14 +193,18 @@ const create_remote_notification_method = (peer, environment, spec, actions, tra
193
193
  * The mapped-type generic constraint accepts both shapes without a cast:
194
194
  * a codegen-derived typed `ActionsApi` (named-method interface, e.g.
195
195
  * `{account_verify: (input) => Promise<Result<...>>, ...}`) and a loose
196
- * `Record<string, (input?: any) => Promise<any>>`. Using `keyof TApi` in
197
- * the constraint avoids the index-signature requirement that would
196
+ * `Record<string, (input?: any) => Promise<any> | void>`. Using `keyof TApi`
197
+ * in the constraint avoids the index-signature requirement that would
198
198
  * otherwise force consumers to `as unknown as Record<string, …>` their
199
- * generated client.
199
+ * generated client. The `| void` arm tolerates `remote_notification`
200
+ * methods, whose `ActionsApi` signature is `(input) => void` even though
201
+ * `create_remote_notification_method` returns a Promise at runtime — the
202
+ * throwing wrapper is intended for `request_response` calls but must
203
+ * accept mixed `ActionsApi` shapes without forcing a cast at the seam.
200
204
  *
201
205
  * @param api - typed RPC client from `create_rpc_client` (or any object
202
- * whose values are all `(input?) => Promise<...>` functions — notably
203
- * the consumer's generated `ActionsApi` interface)
206
+ * whose values are all `(input?) => Promise<...> | void` functions —
207
+ * notably the consumer's generated `ActionsApi` interface)
204
208
  */
205
209
  export const create_throwing_rpc_call = (api) => {
206
210
  const rec = api;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzdev/fuz_app",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "fullstack app library",
5
5
  "glyph": "🗝",
6
6
  "logo": "logo.svg",