@molecule/api-resource 1.0.5 → 1.0.6

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 (2) hide show
  1. package/README.md +15 -150
  2. package/package.json +8 -8
package/README.md CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-10-17T04:45:43.913Z
6
+ Generated: 2026-10-23T21:27:14.472Z
7
7
  -->
8
8
 
9
9
  # @molecule/api-resource
@@ -599,7 +599,7 @@ returned by resource CRUD operations.
599
599
  ```typescript
600
600
  function responseSchema(
601
601
  propsSchema: T,
602
- ): z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>
602
+ ): z.ZodTypeAny<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>
603
603
  ```
604
604
 
605
605
  - `propsSchema` — The Zod schema for the resource's props (e.g. `userPropsSchema`).
@@ -614,7 +614,7 @@ Creates a Zod schema that validates a resource descriptor object
614
614
  ```typescript
615
615
  function resourceSchema(
616
616
  _propsSchema: T,
617
- ): z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>
617
+ ): z.ZodTypeAny<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>
618
618
  ```
619
619
 
620
620
  - `_propsSchema` — The Zod schema for the resource's props (used for type inference only).
@@ -628,7 +628,7 @@ human-readable message listing all validation failures if invalid.
628
628
 
629
629
  ```typescript
630
630
  function validate(
631
- schema: z.ZodType<T, unknown, z.core.$ZodTypeInternals<T, unknown>>,
631
+ schema: z.ZodSchema<T, unknown, z.core.$ZodTypeInternals<T, unknown>>,
632
632
  data: unknown,
633
633
  ): T
634
634
  ```
@@ -645,7 +645,7 @@ union: `{ success: true, data }` on success or `{ success: false, error }` on fa
645
645
 
646
646
  ```typescript
647
647
  function safeParse(
648
- schema: z.ZodType<T, unknown, z.core.$ZodTypeInternals<T, unknown>>,
648
+ schema: z.ZodSchema<T, unknown, z.core.$ZodTypeInternals<T, unknown>>,
649
649
  data: unknown,
650
650
  ): { success: true; data: T } | { success: false; error: z.ZodError }
651
651
  ```
@@ -797,6 +797,16 @@ interface Response<T = unknown> {
797
797
 
798
798
  Re-exported as a namespace — reach every member below through it (e.g. `utilities.<name>`).
799
799
 
800
+ ##### `utilities.ZodSchema` _(deprecated)_
801
+
802
+ ```typescript
803
+ type ZodSchema<
804
+ Output = unknown,
805
+ Input = unknown,
806
+ Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>,
807
+ > = ZodType<Output, Input, Internals>
808
+ ```
809
+
800
810
  ##### `utilities.ZodError`
801
811
 
802
812
  An Error-like class used to store Zod validation issues.
@@ -818,151 +828,6 @@ interface ZodError<T = unknown> extends $ZodError<T> {
818
828
  }
819
829
  ```
820
830
 
821
- ##### `utilities.ZodSchema`
822
-
823
- ````typescript
824
- interface ZodType<
825
- out Output = unknown,
826
- out Input = unknown,
827
- out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<
828
- Output,
829
- Input
830
- >,
831
- > extends core.$ZodType<Output, Input, Internals> {
832
- def: Internals['def']
833
- type: Internals['def']['type']
834
- /** @deprecated Use `.def` instead. */
835
- _def: Internals['def']
836
- /** @deprecated Use `z.output<typeof schema>` instead. */
837
- _output: Internals['output']
838
- /** @deprecated Use `z.input<typeof schema>` instead. */
839
- _input: Internals['input']
840
- '~standard': ZodStandardSchemaWithJSON<this>
841
- /** Converts this schema to a JSON Schema representation. */
842
- toJSONSchema(params?: core.ToJSONSchemaParams): core.ZodStandardJSONSchemaPayload<this>
843
- check(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this
844
- with(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this
845
- clone(
846
- def?: Internals['def'],
847
- params?: {
848
- parent: boolean
849
- },
850
- ): this
851
- register<R extends core.$ZodRegistry>(
852
- registry: R,
853
- ...meta: this extends R['_schema']
854
- ? undefined extends R['_meta']
855
- ? [core.$replace<R['_meta'], this>?]
856
- : [core.$replace<R['_meta'], this>]
857
- : ['Incompatible schema']
858
- ): this
859
- brand<T extends PropertyKey = PropertyKey, Dir extends 'in' | 'out' | 'inout' = 'out'>(
860
- value?: T,
861
- ): PropertyKey extends T ? this : core.$ZodBranded<this, T, Dir>
862
- parse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): core.output<this>
863
- safeParse(
864
- data: unknown,
865
- params?: core.ParseContext<core.$ZodIssue>,
866
- ): parse.ZodSafeParseResult<core.output<this>>
867
- parseAsync(data: unknown, params?: core.ParseContext<core.$ZodIssue>): Promise<core.output<this>>
868
- safeParseAsync(
869
- data: unknown,
870
- params?: core.ParseContext<core.$ZodIssue>,
871
- ): Promise<parse.ZodSafeParseResult<core.output<this>>>
872
- spa: (
873
- data: unknown,
874
- params?: core.ParseContext<core.$ZodIssue>,
875
- ) => Promise<parse.ZodSafeParseResult<core.output<this>>>
876
- encode(data: core.output<this>, params?: core.ParseContext<core.$ZodIssue>): core.input<this>
877
- decode(data: core.input<this>, params?: core.ParseContext<core.$ZodIssue>): core.output<this>
878
- encodeAsync(
879
- data: core.output<this>,
880
- params?: core.ParseContext<core.$ZodIssue>,
881
- ): Promise<core.input<this>>
882
- decodeAsync(
883
- data: core.input<this>,
884
- params?: core.ParseContext<core.$ZodIssue>,
885
- ): Promise<core.output<this>>
886
- safeEncode(
887
- data: core.output<this>,
888
- params?: core.ParseContext<core.$ZodIssue>,
889
- ): parse.ZodSafeParseResult<core.input<this>>
890
- safeDecode(
891
- data: core.input<this>,
892
- params?: core.ParseContext<core.$ZodIssue>,
893
- ): parse.ZodSafeParseResult<core.output<this>>
894
- safeEncodeAsync(
895
- data: core.output<this>,
896
- params?: core.ParseContext<core.$ZodIssue>,
897
- ): Promise<parse.ZodSafeParseResult<core.input<this>>>
898
- safeDecodeAsync(
899
- data: core.input<this>,
900
- params?: core.ParseContext<core.$ZodIssue>,
901
- ): Promise<parse.ZodSafeParseResult<core.output<this>>>
902
- refine<Ch extends (arg: core.output<this>) => unknown | Promise<unknown>>(
903
- check: Ch,
904
- params?: string | core.$ZodCustomParams,
905
- ): Ch extends (arg: any) => arg is infer R ? this & ZodType<R, core.input<this>> : this
906
- superRefine(
907
- refinement: (
908
- arg: core.output<this>,
909
- ctx: core.$RefinementCtx<core.output<this>>,
910
- ) => void | Promise<void>,
911
- params?: core.$ZodSuperRefineParams,
912
- ): this
913
- overwrite(fn: (x: core.output<this>) => core.output<this>): this
914
- optional(): ZodOptional<this>
915
- exactOptional(): ZodExactOptional<this>
916
- nonoptional(params?: string | core.$ZodNonOptionalParams): ZodNonOptional<this>
917
- nullable(): ZodNullable<this>
918
- nullish(): ZodOptional<ZodNullable<this>>
919
- default(def: util.NoUndefined<core.output<this>>): ZodDefault<this>
920
- default(def: () => util.NoUndefined<core.output<this>>): ZodDefault<this>
921
- prefault(def: () => core.input<this>): ZodPrefault<this>
922
- prefault(def: core.input<this>): ZodPrefault<this>
923
- array(): ZodArray<this>
924
- or<T extends core.SomeType>(option: T): ZodUnion<[this, T]>
925
- and<T extends core.SomeType>(incoming: T): ZodIntersection<this, T>
926
- transform<NewOut>(
927
- transform: (
928
- arg: core.output<this>,
929
- ctx: core.$RefinementCtx<core.output<this>>,
930
- ) => NewOut | Promise<NewOut>,
931
- ): ZodPipe<this, ZodTransform<Awaited<NewOut>, core.output<this>>>
932
- catch(def: core.output<this>): ZodCatch<this>
933
- catch(def: (ctx: core.$ZodCatchCtx) => core.output<this>): ZodCatch<this>
934
- pipe<T extends core.$ZodType<any, core.output<this>>>(
935
- target: T | core.$ZodType<any, core.output<this>>,
936
- ): ZodPipe<this, T>
937
- readonly(): ZodReadonly<this>
938
- /** Returns a new instance that has been registered in `z.globalRegistry` with the specified description */
939
- describe(description: string): this
940
- description?: string
941
- /** Returns the metadata associated with this instance in `z.globalRegistry` */
942
- meta(): core.$replace<core.GlobalMeta, this> | undefined
943
- /** Returns a new instance that has been registered in `z.globalRegistry` with the specified metadata */
944
- meta(data: core.$replace<core.GlobalMeta, this>): this
945
- /** @deprecated Try safe-parsing `undefined` (this is what `isOptional` does internally):
946
- *
947
- * ```ts
948
- * const schema = z.string().optional();
949
- * const isOptional = schema.safeParse(undefined).success; // true
950
- * ```
951
- */
952
- isOptional(): boolean
953
- /**
954
- * @deprecated Try safe-parsing `null` (this is what `isNullable` does internally):
955
- *
956
- * ```ts
957
- * const schema = z.string().nullable();
958
- * const isNullable = schema.safeParse(null).success; // true
959
- * ```
960
- */
961
- isNullable(): boolean
962
- apply<T>(fn: (schema: this) => T): T
963
- }
964
- ````
965
-
966
831
  ##### `utilities.getValidProps`
967
832
 
968
833
  Validates resource props against a Zod schema, returning typed valid props or throwing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-resource",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Resource CRUD operations and utilities for molecule.dev.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -35,17 +35,17 @@
35
35
  ],
36
36
  "license": "Apache-2.0",
37
37
  "dependencies": {
38
- "uuid": "14.0.1",
39
- "zod": "4.4.3"
38
+ "uuid": "14.0.3",
39
+ "zod": "4.6.7"
40
40
  },
41
41
  "devDependencies": {
42
- "@molecule/api-bond": "1.0.2",
43
- "@molecule/api-database": "1.1.3",
42
+ "@molecule/api-bond": "1.0.3",
43
+ "@molecule/api-database": "1.1.5",
44
44
  "@molecule/api-locales-resource": "1.0.2",
45
- "@molecule/api-utilities-validation": "1.0.2",
46
- "@types/node": "26.1.2",
45
+ "@molecule/api-utilities-validation": "1.0.3",
46
+ "@types/node": "26.6.5",
47
47
  "typescript": "6.0.3",
48
- "vitest": "4.1.11"
48
+ "vitest": "4.1.12"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@molecule/api-bond": "^1.0.1",