@fabrika/app 0.9.0-dev.14 → 0.9.0-dev.15

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.
Files changed (64) hide show
  1. package/package.json +14 -9
  2. package/skill/SKILL.md +2 -2
  3. package/skill/references/app-setup.md +10 -9
  4. package/skill/references/endpoint.md +8 -1
  5. package/src/build-contract-child.ts +16 -0
  6. package/src/build.ts +48 -2
  7. package/src/client/contract.ts +6 -4
  8. package/src/cloudflare/application.ts +3 -0
  9. package/src/contract/artifact-schema.ts +355 -301
  10. package/src/contract/attachment.ts +4 -3
  11. package/src/contract/compile.ts +3 -2
  12. package/src/contract/context.ts +2 -3
  13. package/src/contract/define.ts +17 -5
  14. package/src/contract/group.ts +8 -7
  15. package/src/contract/index.ts +1 -1
  16. package/src/contract/kit.ts +2 -2
  17. package/src/contract/problems.ts +4 -0
  18. package/src/contract/schema-shape.ts +14 -2
  19. package/src/contract/token.ts +4 -3
  20. package/src/from-row.ts +12 -6
  21. package/src/implement/approved.ts +57 -0
  22. package/src/implement/attachment.ts +2 -1
  23. package/src/implement/boot.ts +90 -12
  24. package/src/implement/dispatch.ts +14 -10
  25. package/src/implement/egress.ts +7 -6
  26. package/src/implement/faults.ts +1 -0
  27. package/src/implement/project.ts +3 -1
  28. package/src/implement/tokens.ts +3 -2
  29. package/src/implement/types.ts +18 -6
  30. package/src/react/hooks.ts +12 -11
  31. package/src/react/provider.tsx +2 -1
  32. package/src/react/types.ts +2 -2
  33. package/src/schema/builder.ts +146 -0
  34. package/src/schema/data-schema.ts +365 -0
  35. package/src/schema/index.ts +18 -0
  36. package/src/schema/replay.ts +623 -0
  37. package/src/testing/kit.ts +3 -3
  38. package/types/src/build-contract-child.d.ts +1 -0
  39. package/types/src/build.d.ts +16 -1
  40. package/types/src/client/contract.d.ts +3 -4
  41. package/types/src/cloudflare/application.d.ts +2 -0
  42. package/types/src/contract/artifact-schema.d.ts +8 -0
  43. package/types/src/contract/attachment.d.ts +3 -2
  44. package/types/src/contract/context.d.ts +2 -3
  45. package/types/src/contract/define.d.ts +14 -5
  46. package/types/src/contract/group.d.ts +5 -6
  47. package/types/src/contract/index.d.ts +1 -1
  48. package/types/src/contract/kit.d.ts +2 -3
  49. package/types/src/contract/problems.d.ts +1 -0
  50. package/types/src/contract/schema-shape.d.ts +3 -2
  51. package/types/src/contract/token.d.ts +3 -3
  52. package/types/src/from-row.d.ts +9 -5
  53. package/types/src/implement/approved.d.ts +11 -0
  54. package/types/src/implement/boot.d.ts +6 -0
  55. package/types/src/implement/faults.d.ts +1 -0
  56. package/types/src/implement/project.d.ts +2 -1
  57. package/types/src/implement/types.d.ts +4 -5
  58. package/types/src/react/hooks.d.ts +4 -5
  59. package/types/src/react/types.d.ts +2 -2
  60. package/types/src/schema/builder.d.ts +45 -0
  61. package/types/src/schema/data-schema.d.ts +124 -0
  62. package/types/src/schema/index.d.ts +3 -0
  63. package/types/src/schema/replay.d.ts +27 -0
  64. package/types/src/testing/kit.d.ts +2 -3
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod/v4';
2
+ /** A plain argument of a step, with every schema in it already zod. */
3
+ export type ReplayArg = string | number | boolean | null | RegExp | z.ZodType | Unreadable | readonly ReplayArg[] | {
4
+ readonly [key: string]: ReplayArg;
5
+ };
6
+ /** An argument a reader of source read that is no value of the subset (a builder call, say): refused by its kind. */
7
+ export declare class Unreadable {
8
+ readonly kind: string;
9
+ constructor(kind: string);
10
+ }
11
+ /** `z.<factory>(…)`, `z.iso.<factory>(…)` or `.<method>(…)` on a receiver. */
12
+ export type ReplayStep = {
13
+ readonly factory: string;
14
+ readonly iso: boolean;
15
+ } | {
16
+ readonly method: string;
17
+ readonly receiver: z.ZodType;
18
+ };
19
+ export declare const SCHEMA_SUBSET = "a schema of the supported z subset (packages/check/CLAUDE.md)";
20
+ /** A step zod would refuse, or one outside the contract subset: what is wrong and what is allowed there. */
21
+ export declare class SchemaRefusal extends Error {
22
+ readonly name = "SchemaRefusal";
23
+ readonly allowed: string;
24
+ constructor(message: string, allowed: string);
25
+ }
26
+ /** The zod schema `step` builds from `args`; a step outside the subset, or one zod refuses, throws a `SchemaRefusal`. */
27
+ export declare function replayStep(step: ReplayStep, args: readonly ReplayArg[]): z.ZodType;
@@ -3,9 +3,8 @@ import type { Database } from '@fabrika/db';
3
3
  import { MemoryEmailSender } from '@fabrika/email/memory';
4
4
  import type { FileObjectStore } from '@fabrika/platform';
5
5
  import { type IamGateway } from '@fabrika/proxy-core';
6
- import type { z } from 'zod/v4';
7
6
  import type { RpcFetch } from '../client/transport';
8
- import type { AnyContract, DimensionOf } from '../contract/define';
7
+ import type { AnyContract, DimensionOf, SchemaInput } from '../contract/define';
9
8
  import type { TokenPurpose } from '../contract/token';
10
9
  import type { FILE_SWEEP_JOB } from '../files/kinds';
11
10
  import type { FILE_SCAN_JOB, FileScanner } from '../files/scan';
@@ -184,7 +183,7 @@ export type TokenPurposeName<C> = keyof TokensOf<C> & string;
184
183
  /** What a token of purpose `P` carries, as a site passes it to `sign`. */
185
184
  export type TokenClaimsInput<C, P extends string> = TokensOf<C> extends {
186
185
  readonly [K in P]: TokenPurpose<infer Claims>;
187
- } ? z.input<Claims> : never;
186
+ } ? SchemaInput<Claims> : never;
188
187
  /** Boots `app` the way its generated entrypoint would, behind the test proxy and IAM. Throws `BootError` like `boot`. */
189
188
  export declare function testKit<C extends AnyContract>(app: ContractImplementation<C>, options?: TestKitOptions): TestKit<C>;
190
189
  /** The kit of the generated tests, and its stand-in IAM, which seeds the invitations and links a case names. */