@nicolastoulemont/std 0.10.0 → 0.11.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.
Files changed (100) hide show
  1. package/README.md +20 -11
  2. package/dist/brand/index.d.mts +1 -1
  3. package/dist/{brand.types-C_7QgCA4.d.mts → brand.types-Cqkibdlt.d.mts} +1 -1
  4. package/dist/{brand.types-C_7QgCA4.d.mts.map → brand.types-Cqkibdlt.d.mts.map} +1 -1
  5. package/dist/context/index.d.mts +1 -1
  6. package/dist/{context-B9oWzbwF.d.mts → context-C9UX6GJo.d.mts} +2 -2
  7. package/dist/{context-B9oWzbwF.d.mts.map → context-C9UX6GJo.d.mts.map} +1 -1
  8. package/dist/data/index.d.mts +1 -1
  9. package/dist/duration/index.d.mts +1 -1
  10. package/dist/either/index.d.mts +1 -1
  11. package/dist/{exit-DOdhmr81.d.mts → exit-D5zZVlCn.d.mts} +2 -2
  12. package/dist/{exit-DOdhmr81.d.mts.map → exit-D5zZVlCn.d.mts.map} +1 -1
  13. package/dist/fiber/index.d.mts +1 -1
  14. package/dist/functions/index.d.mts +1 -1
  15. package/dist/fx/index.d.mts +1 -1
  16. package/dist/{fx.runtime-BuIElLpZ.d.mts → fx.runtime-q661ckFI.d.mts} +2 -2
  17. package/dist/{fx.runtime-BuIElLpZ.d.mts.map → fx.runtime-q661ckFI.d.mts.map} +1 -1
  18. package/dist/{index-5QkUtJ-4.d.mts → index-BJiD1-T_.d.mts} +4 -4
  19. package/dist/{index-5QkUtJ-4.d.mts.map → index-BJiD1-T_.d.mts.map} +1 -1
  20. package/dist/{index-DLkMqvw4.d.mts → index-BR6lwlNv.d.mts} +3 -3
  21. package/dist/{index-DLkMqvw4.d.mts.map → index-BR6lwlNv.d.mts.map} +1 -1
  22. package/dist/{index-C8KMi_I9.d.mts → index-BfQSp6pV.d.mts} +2 -2
  23. package/dist/{index-C8KMi_I9.d.mts.map → index-BfQSp6pV.d.mts.map} +1 -1
  24. package/dist/{index-BZP6t2h9.d.mts → index-Bo6pkkVO.d.mts} +4 -4
  25. package/dist/{index-BZP6t2h9.d.mts.map → index-Bo6pkkVO.d.mts.map} +1 -1
  26. package/dist/{index-Bu-z5Xoq.d.mts → index-BsCrdweM.d.mts} +1 -1
  27. package/dist/{index-Bu-z5Xoq.d.mts.map → index-BsCrdweM.d.mts.map} +1 -1
  28. package/dist/{index-D7mFNjot.d.mts → index-BtPFPfja.d.mts} +1 -1
  29. package/dist/{index-D7mFNjot.d.mts.map → index-BtPFPfja.d.mts.map} +1 -1
  30. package/dist/{index-BDUhDs4D.d.mts → index-C7uSldLA.d.mts} +3 -3
  31. package/dist/{index-BDUhDs4D.d.mts.map → index-C7uSldLA.d.mts.map} +1 -1
  32. package/dist/{index-DogEz6WQ.d.mts → index-CBtUJ94I.d.mts} +3 -3
  33. package/dist/{index-DogEz6WQ.d.mts.map → index-CBtUJ94I.d.mts.map} +1 -1
  34. package/dist/{index-B3xia3Jl.d.mts → index-CIEdspey.d.mts} +8 -8
  35. package/dist/{index-B3xia3Jl.d.mts.map → index-CIEdspey.d.mts.map} +1 -1
  36. package/dist/{index-CfXGmPMY.d.mts → index-CXz5Z5MP.d.mts} +3 -3
  37. package/dist/{index-CfXGmPMY.d.mts.map → index-CXz5Z5MP.d.mts.map} +1 -1
  38. package/dist/{index-XxPUUAGQ.d.mts → index-DDdSA1Rs.d.mts} +4 -4
  39. package/dist/{index-XxPUUAGQ.d.mts.map → index-DDdSA1Rs.d.mts.map} +1 -1
  40. package/dist/{index-pC80zLHb.d.mts → index-D_JbOTtg.d.mts} +2 -2
  41. package/dist/index-D_JbOTtg.d.mts.map +1 -0
  42. package/dist/{index-DlWm_PwP.d.mts → index-DzGXoCV1.d.mts} +19 -22
  43. package/dist/index-DzGXoCV1.d.mts.map +1 -0
  44. package/dist/{index-BZ1-IrU_.d.mts → index-Pma2THAy.d.mts} +10 -3
  45. package/dist/index-Pma2THAy.d.mts.map +1 -0
  46. package/dist/{index-B4rHoUK4.d.mts → index-hrn4s4Vn.d.mts} +2 -2
  47. package/dist/{index-B4rHoUK4.d.mts.map → index-hrn4s4Vn.d.mts.map} +1 -1
  48. package/dist/{index-D-KxgnwF.d.mts → index-lYxaV6H7.d.mts} +1 -1
  49. package/dist/{index-D-KxgnwF.d.mts.map → index-lYxaV6H7.d.mts.map} +1 -1
  50. package/dist/{index-Cv48HmyO.d.mts → index-xY9km50k.d.mts} +3 -3
  51. package/dist/{index-Cv48HmyO.d.mts.map → index-xY9km50k.d.mts.map} +1 -1
  52. package/dist/index.d.mts +22 -22
  53. package/dist/index.mjs +1 -1
  54. package/dist/layer/index.d.mts +1 -1
  55. package/dist/{layer.types-DsCTjICW.d.mts → layer.types-smjitsoN.d.mts} +3 -3
  56. package/dist/{layer.types-DsCTjICW.d.mts.map → layer.types-smjitsoN.d.mts.map} +1 -1
  57. package/dist/log/index.d.mts +1 -1
  58. package/dist/multithread/index.d.mts +1 -1
  59. package/dist/option/index.d.mts +1 -1
  60. package/dist/{option.types-DLp3QpFE.d.mts → option.types-Po1qwxiW.d.mts} +1 -1
  61. package/dist/{option.types-DLp3QpFE.d.mts.map → option.types-Po1qwxiW.d.mts.map} +1 -1
  62. package/dist/order/index.d.mts +1 -1
  63. package/dist/predicate/index.d.mts +1 -1
  64. package/dist/predicate/index.mjs +1 -1
  65. package/dist/predicate-CvH7cY_J.mjs +2 -0
  66. package/dist/predicate-CvH7cY_J.mjs.map +1 -0
  67. package/dist/provide/index.d.mts +1 -1
  68. package/dist/queue/index.d.mts +1 -1
  69. package/dist/{queue.types-B-l5XYbU.d.mts → queue.types-Bj63N2ab.d.mts} +1 -1
  70. package/dist/{queue.types-B-l5XYbU.d.mts.map → queue.types-Bj63N2ab.d.mts.map} +1 -1
  71. package/dist/result/index.d.mts +1 -1
  72. package/dist/{result.types-CnhiVFEV.d.mts → result.types-JEcowzYH.d.mts} +4 -25
  73. package/dist/result.types-JEcowzYH.d.mts.map +1 -0
  74. package/dist/schedule/index.d.mts +1 -1
  75. package/dist/{schedule-DiidMLcl.d.mts → schedule-ap6y014J.d.mts} +3 -3
  76. package/dist/{schedule-DiidMLcl.d.mts.map → schedule-ap6y014J.d.mts.map} +1 -1
  77. package/dist/schema/index.d.mts +1 -1
  78. package/dist/schema/index.mjs +1 -1
  79. package/dist/schema-CjON86AZ.mjs +2 -0
  80. package/dist/schema-CjON86AZ.mjs.map +1 -0
  81. package/dist/scope/index.d.mts +1 -1
  82. package/dist/{scope-7bLTmdRX.d.mts → scope-BQEFiS_2.d.mts} +2 -2
  83. package/dist/{scope-7bLTmdRX.d.mts.map → scope-BQEFiS_2.d.mts.map} +1 -1
  84. package/dist/service/index.d.mts +1 -1
  85. package/dist/{service-C4xUfS_M.d.mts → service-DIKUYHda.d.mts} +1 -1
  86. package/dist/{service-C4xUfS_M.d.mts.map → service-DIKUYHda.d.mts.map} +1 -1
  87. package/dist/trace/index.d.mts +1 -1
  88. package/dist/{trace-D_7sjH22.d.mts → trace-NETIRDfA.d.mts} +3 -3
  89. package/dist/{trace-D_7sjH22.d.mts.map → trace-NETIRDfA.d.mts.map} +1 -1
  90. package/dist/type-utils.types-CnPpsvt5.d.mts +30 -0
  91. package/dist/type-utils.types-CnPpsvt5.d.mts.map +1 -0
  92. package/package.json +3 -1
  93. package/dist/index-BZ1-IrU_.d.mts.map +0 -1
  94. package/dist/index-DlWm_PwP.d.mts.map +0 -1
  95. package/dist/index-pC80zLHb.d.mts.map +0 -1
  96. package/dist/predicate-8hY-0Ocv.mjs +0 -2
  97. package/dist/predicate-8hY-0Ocv.mjs.map +0 -1
  98. package/dist/result.types-CnhiVFEV.d.mts.map +0 -1
  99. package/dist/schema-CT_wO7tN.mjs +0 -2
  100. package/dist/schema-CT_wO7tN.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-CT_wO7tN.mjs","names":["Result.err","Result.ok","validateSync","Data.TaggedError","codec","struct","validateSync","dataStruct","validateSchemaSync","tagged","union","tagged","structImpl","taggedImpl","unionImpl","codecImpl","validateSync"],"sources":["../src/schema/schema.shared.ts","../src/schema/schema.codec.ts","../src/shared/is-plain-object.ts","../src/schema/schema.struct.ts","../src/schema/schema.tagged-utils.ts","../src/schema/schema.tagged.ts","../src/schema/schema.union.ts","../src/schema/schema.ts"],"sourcesContent":["import { Result } from \"../result\"\nimport type { Result as ResultType } from \"../result/result.types\"\nimport { isPromise } from \"../shared/is-promise\"\nimport type { ValidationError, ValidationIssue } from \"./schema.types\"\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\"\n\nfunction normalizePathSegment(segment: PropertyKey | { readonly key: PropertyKey }): PropertyKey {\n return typeof segment === \"object\" && segment !== null && \"key\" in segment ? segment.key : segment\n}\n\nfunction normalizeIssues(\n issues: NonNullable<StandardSchemaV1.Result<unknown>[\"issues\"]>,\n): ReadonlyArray<ValidationIssue> {\n return issues.map((issue) => ({\n message: issue.message,\n path: issue.path?.map(normalizePathSegment),\n }))\n}\n\nfunction toValidationResult<T>(result: StandardSchemaV1.Result<T>): ResultType<T, ValidationError> {\n if (result.issues) {\n return Result.err({ issues: normalizeIssues(result.issues) })\n }\n\n return Result.ok(result.value)\n}\n\nfunction toErrorMessage(error: unknown): string {\n if (error instanceof Error && error.message.length > 0) {\n return error.message\n }\n\n if (typeof error === \"string\" && error.length > 0) {\n return error\n }\n\n return \"Schema validation failed.\"\n}\n\nfunction toThrownValidationError(error: unknown): ValidationError {\n return {\n issues: [{ message: toErrorMessage(error) }],\n }\n}\n\nexport function validate<T>(\n schema: StandardSchemaV1<unknown, T>,\n value: unknown,\n): ResultType<T, ValidationError> | Promise<ResultType<T, ValidationError>> {\n try {\n const result = schema[\"~standard\"].validate(value)\n\n if (isPromise(result)) {\n return Promise.resolve(result).then(\n (validated) => toValidationResult(validated),\n (error) => Result.err(toThrownValidationError(error)),\n )\n }\n\n return toValidationResult(result)\n } catch (error) {\n return Result.err(toThrownValidationError(error))\n }\n}\n\nexport function validateSync<T>(\n schema: StandardSchemaV1<unknown, T>,\n value: unknown,\n operation: string,\n): ResultType<T, ValidationError> {\n let result: StandardSchemaV1.Result<T> | Promise<StandardSchemaV1.Result<T>>\n\n try {\n result = schema[\"~standard\"].validate(value)\n } catch (error) {\n return Result.err(toThrownValidationError(error))\n }\n\n if (isPromise(result)) {\n throw new TypeError(`Async validation is not supported in ${operation}.`)\n }\n\n return toValidationResult(result)\n}\n","import { Data } from \"../data\"\nimport { err, ok } from \"../result/result\"\nimport type { Result } from \"../result/result.types\"\nimport { isPromise } from \"../shared/is-promise\"\nimport { pipeable } from \"../shared/pipeable\"\nimport type { Pipeable } from \"../shared/pipeable\"\nimport { validate } from \"./schema.shared\"\nimport type { Input, Output, SyncSchema, ValidationError } from \"./schema.types\"\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\"\n\nexport class CodecDecodeError extends Data.TaggedError(\"CodecDecodeError\")<{\n readonly message: string\n readonly cause?: unknown\n}> {}\n\nexport class CodecDecodeValidationError extends Data.TaggedError(\"CodecDecodeValidationError\")<{\n readonly side: \"encoded\" | \"decoded\"\n readonly error: ValidationError\n}> {}\n\nexport class CodecEncodeValidationError extends Data.TaggedError(\"CodecEncodeValidationError\")<{\n readonly side: \"decoded\" | \"encoded\"\n readonly error: ValidationError\n}> {}\n\nexport class CodecEncodeError extends Data.TaggedError(\"CodecEncodeError\")<{\n readonly message: string\n readonly cause?: unknown\n}> {}\n\nexport type CodecError = CodecDecodeError | CodecDecodeValidationError | CodecEncodeValidationError | CodecEncodeError\n\ntype MaybePromise<T> = T | Promise<T>\n\ntype IsNever<T> = [T] extends [never] ? true : false\n\ntype IsAsyncValidation<Decoded extends StandardSchemaV1, Encoded extends StandardSchemaV1> = Decoded extends SyncSchema\n ? Encoded extends SyncSchema\n ? false\n : true\n : true\n\ntype DecodeIsAsync<Decoded extends StandardSchemaV1, Encoded extends StandardSchemaV1, DecodeReturn> =\n IsAsyncValidation<Decoded, Encoded> extends true\n ? true\n : IsNever<DecodeReturn> extends true\n ? false\n : DecodeReturn extends Promise<unknown>\n ? true\n : false\n\ntype EncodeIsAsync<Decoded extends StandardSchemaV1, Encoded extends StandardSchemaV1, EncodeReturn> =\n IsAsyncValidation<Decoded, Encoded> extends true\n ? true\n : IsNever<EncodeReturn> extends true\n ? false\n : EncodeReturn extends Promise<unknown>\n ? true\n : false\n\ntype CodecMethodResult<T, IsAsync extends boolean> = IsAsync extends true\n ? Promise<Result<T, CodecError>>\n : Result<T, CodecError>\n\nexport type Codec<\n Decoded extends StandardSchemaV1 = StandardSchemaV1,\n Encoded extends StandardSchemaV1 = StandardSchemaV1,\n DecodeReturn = Input<Decoded>,\n EncodeReturn = Input<Encoded>,\n> = Pipeable & {\n readonly decoded: Decoded\n readonly encoded: Encoded\n decode(input: Input<Encoded>): CodecMethodResult<Output<Decoded>, DecodeIsAsync<Decoded, Encoded, DecodeReturn>>\n encode(value: Output<Decoded>): CodecMethodResult<Output<Encoded>, EncodeIsAsync<Decoded, Encoded, EncodeReturn>>\n}\n\nexport type Decoded<C> = C extends { readonly decoded: infer DecodedSchema extends StandardSchemaV1 }\n ? Output<DecodedSchema>\n : never\n\nexport type Encoded<C> = C extends { readonly encoded: infer EncodedSchema extends StandardSchemaV1 }\n ? Output<EncodedSchema>\n : never\n\nexport type DecodeInput<C> = C extends { decode(input: infer I): unknown } ? I : never\n\nexport type EncodeInput<C> = C extends { encode(input: infer I): unknown } ? I : never\n\nexport type CodecOptions<\n Decoded extends StandardSchemaV1,\n Encoded extends StandardSchemaV1,\n DecodeReturn extends MaybePromise<Input<Decoded>>,\n EncodeReturn extends MaybePromise<Input<Encoded>>,\n> = {\n readonly decoded: Decoded\n readonly encoded: Encoded\n readonly decode: (encoded: Output<Encoded>) => DecodeReturn\n readonly encode: (decoded: Output<Decoded>) => EncodeReturn\n}\n\nexport type JsonCodecOptions = {\n readonly replacer?: Parameters<typeof JSON.stringify>[1]\n readonly space?: Parameters<typeof JSON.stringify>[2]\n}\n\ntype UnknownInputSchema<S extends StandardSchemaV1> = unknown extends Input<S> ? S : never\n\nconst stringSchema: SyncSchema<string, string> = {\n \"~standard\": {\n version: 1,\n vendor: \"@nicolastoulemont/std\",\n validate(value: unknown) {\n if (typeof value === \"string\") {\n return { value }\n }\n\n return { issues: [{ message: \"Expected string\" }] }\n },\n },\n}\n\nfunction mapDecodeValidationError(side: \"encoded\" | \"decoded\") {\n return (error: ValidationError): CodecDecodeValidationError => new CodecDecodeValidationError({ side, error })\n}\n\nfunction mapEncodeValidationError(side: \"decoded\" | \"encoded\") {\n return (error: ValidationError): CodecEncodeValidationError => new CodecEncodeValidationError({ side, error })\n}\n\nfunction normalizeDecodeCause(cause: unknown, message = \"Codec decode failed\"): CodecDecodeError {\n if (cause instanceof CodecDecodeError) {\n return cause\n }\n\n return new CodecDecodeError({ message, cause })\n}\n\nfunction normalizeEncodeCause(cause: unknown, message = \"Codec encode failed\"): CodecEncodeError {\n if (cause instanceof CodecEncodeError) {\n return cause\n }\n\n return new CodecEncodeError({ message, cause })\n}\n\nfunction mapValidation<T, E extends CodecError>(\n result: Result<T, ValidationError>,\n mapError: (error: ValidationError) => E,\n): Result<T, E> {\n if (result._tag === \"Err\") {\n return err(mapError(result.error))\n }\n\n return ok(result.value)\n}\n\nfunction mapValidationMaybePromise<T, E extends CodecError>(\n result: Result<T, ValidationError> | Promise<Result<T, ValidationError>>,\n mapError: (error: ValidationError) => E,\n): Result<T, E> | Promise<Result<T, E>> {\n if (isPromise(result)) {\n return Promise.resolve(result).then((validated) => mapValidation(validated, mapError))\n }\n\n return mapValidation(result, mapError)\n}\n\nfunction continueDecode<\n Decoded extends StandardSchemaV1,\n Encoded extends StandardSchemaV1,\n DecodeReturn extends MaybePromise<Input<Decoded>>,\n EncodeReturn extends MaybePromise<Input<Encoded>>,\n>(\n options: CodecOptions<Decoded, Encoded, DecodeReturn, EncodeReturn>,\n encodedResult: Result<Output<Encoded>, ValidationError>,\n): Result<Output<Decoded>, CodecError> | Promise<Result<Output<Decoded>, CodecError>> {\n if (encodedResult._tag === \"Err\") {\n return err(mapDecodeValidationError(\"encoded\")(encodedResult.error))\n }\n\n try {\n const decodedInput = options.decode(encodedResult.value)\n\n if (isPromise(decodedInput)) {\n return Promise.resolve(decodedInput).then(\n (value) => mapValidationMaybePromise(validate(options.decoded, value), mapDecodeValidationError(\"decoded\")),\n (cause) => err(normalizeDecodeCause(cause)),\n )\n }\n\n return mapValidationMaybePromise(validate(options.decoded, decodedInput), mapDecodeValidationError(\"decoded\"))\n } catch (cause) {\n return err(normalizeDecodeCause(cause))\n }\n}\n\nfunction continueEncode<\n Decoded extends StandardSchemaV1,\n Encoded extends StandardSchemaV1,\n DecodeReturn extends MaybePromise<Input<Decoded>>,\n EncodeReturn extends MaybePromise<Input<Encoded>>,\n>(\n options: CodecOptions<Decoded, Encoded, DecodeReturn, EncodeReturn>,\n decodedResult: Result<Output<Decoded>, ValidationError>,\n): Result<Output<Encoded>, CodecError> | Promise<Result<Output<Encoded>, CodecError>> {\n if (decodedResult._tag === \"Err\") {\n return err(mapEncodeValidationError(\"decoded\")(decodedResult.error))\n }\n\n try {\n const encodedInput = options.encode(decodedResult.value)\n\n if (isPromise(encodedInput)) {\n return Promise.resolve(encodedInput).then(\n (value) => mapValidationMaybePromise(validate(options.encoded, value), mapEncodeValidationError(\"encoded\")),\n (cause) => err(normalizeEncodeCause(cause)),\n )\n }\n\n return mapValidationMaybePromise(validate(options.encoded, encodedInput), mapEncodeValidationError(\"encoded\"))\n } catch (cause) {\n return err(normalizeEncodeCause(cause))\n }\n}\n\n/**\n * Create a first-class bidirectional schema codec.\n *\n * Pipeline:\n * - decode: encoded input -> encoded validation -> decode transform -> decoded validation -> decoded output\n * - encode: decoded value -> decoded validation -> encode transform -> encoded validation -> encoded output\n */\nfunction makeCodec<\n Decoded extends StandardSchemaV1,\n Encoded extends StandardSchemaV1,\n DecodeReturn extends MaybePromise<Input<Decoded>>,\n EncodeReturn extends MaybePromise<Input<Encoded>>,\n>(\n options: CodecOptions<Decoded, Encoded, DecodeReturn, EncodeReturn>,\n): Codec<Decoded, Encoded, DecodeReturn, EncodeReturn> {\n const codec: Codec<Decoded, Encoded, DecodeReturn, EncodeReturn> = {\n decoded: options.decoded,\n encoded: options.encoded,\n decode(input) {\n const encodedResult = validate(options.encoded, input)\n\n if (isPromise(encodedResult)) {\n return Promise.resolve(encodedResult).then((result) => continueDecode(options, result)) as ReturnType<\n Codec<Decoded, Encoded, DecodeReturn, EncodeReturn>[\"decode\"]\n >\n }\n\n return continueDecode(options, encodedResult) as ReturnType<\n Codec<Decoded, Encoded, DecodeReturn, EncodeReturn>[\"decode\"]\n >\n },\n encode(value) {\n const decodedResult = validate(options.decoded, value)\n\n if (isPromise(decodedResult)) {\n return Promise.resolve(decodedResult).then((result) => continueEncode(options, result)) as ReturnType<\n Codec<Decoded, Encoded, DecodeReturn, EncodeReturn>[\"encode\"]\n >\n }\n\n return continueEncode(options, decodedResult) as ReturnType<\n Codec<Decoded, Encoded, DecodeReturn, EncodeReturn>[\"encode\"]\n >\n },\n pipe: pipeable,\n }\n\n return Object.freeze(codec)\n}\n\nfunction jsonCodec<S extends StandardSchemaV1>(schema: UnknownInputSchema<S>, options: JsonCodecOptions = {}) {\n return makeCodec({\n decoded: schema,\n encoded: stringSchema,\n decode(input: string): Input<S> {\n try {\n return JSON.parse(input) as Input<S>\n } catch (cause) {\n throw normalizeDecodeCause(cause, \"JSON parse failed\")\n }\n },\n encode(value: Output<S>) {\n try {\n return JSON.stringify(value, options.replacer, options.space) as string\n } catch (cause) {\n throw normalizeEncodeCause(cause, \"JSON stringify failed\")\n }\n },\n })\n}\n\nexport type CodecConstructor = {\n <\n Decoded extends StandardSchemaV1,\n Encoded extends StandardSchemaV1,\n DecodeReturn extends MaybePromise<Input<Decoded>>,\n EncodeReturn extends MaybePromise<Input<Encoded>>,\n >(\n options: CodecOptions<Decoded, Encoded, DecodeReturn, EncodeReturn>,\n ): Codec<Decoded, Encoded, DecodeReturn, EncodeReturn>\n json<S extends StandardSchemaV1>(\n schema: UnknownInputSchema<S>,\n options?: JsonCodecOptions,\n ): ReturnType<typeof jsonCodec<S>>\n}\n\nexport const codec = Object.assign(makeCodec, {\n json: jsonCodec,\n}) as CodecConstructor\n","/**\n * Check if a value is a plain object.\n * A plain object is an object created with `{}`, `Object.create(null)`, or `new Object()`.\n * Arrays, functions, dates, maps, etc. are not considered plain objects.\n */\nexport function isPlainObject(value: unknown): value is Record<PropertyKey, unknown> {\n if (value === null || typeof value !== \"object\") {\n return false\n }\n\n return Object.getPrototypeOf(value) === null || Object.getPrototypeOf(value) === Object.prototype\n}\n","import { struct as dataStruct } from \"../data/data.struct\"\nimport type { StructValue } from \"../data/data.types\"\nimport { err, ok } from \"../result/result\"\nimport type { Result } from \"../result/result.types\"\nimport { isPlainObject } from \"../shared/is-plain-object\"\nimport { validateSync } from \"./schema.shared\"\nimport type { Input, Output, SyncSchema, ValidationError } from \"./schema.types\"\n\ntype StructSchema<TInput = unknown, TOutput extends Record<string, unknown> = Record<string, unknown>> = SyncSchema<\n TInput,\n TOutput\n>\n\ntype StructConstructor<S extends StructSchema> = (input: Input<S>) => Result<StructValue<Output<S>>, ValidationError>\n\n/**\n * Create a sync schema-backed constructor for struct objects.\n *\n * The constructor validates through the provided schema, then wraps the\n * validated object with `Data.struct()` so the result is frozen and gains\n * structural `equals()` and `hash()` behavior.\n */\nexport function struct<S extends StructSchema>(schema: S): StructConstructor<S> {\n return (input: Input<S>) => {\n const result = validateSync(schema, input, \"Schema.struct()\")\n\n if (result._tag === \"Err\") {\n return err(result.error)\n }\n\n if (!isPlainObject(result.value)) {\n return err({\n issues: [{ message: \"Schema.struct() requires schemas with plain object outputs.\" }],\n })\n }\n\n return ok(dataStruct(result.value))\n }\n}\n","import { validateSync as validateSchemaSync } from \"../schema/schema.shared\"\nimport { isPlainObject } from \"../shared/is-plain-object\"\nimport type { TaggedSchema } from \"./schema.union.types\"\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\"\n\n/**\n * Check if a value is an TaggedSchema created by tagged().\n * TaggedSchemas are callable functions with static properties.\n */\nexport function isVariant(value: unknown): value is TaggedSchema {\n return typeof value === \"function\" && \"_variant\" in value && value[\"_variant\"] === true\n}\n\n/**\n * Validate data using a Standard Schema, enforcing sync-only validation.\n * Throws if the schema returns a Promise.\n */\nexport function validateSync<T>(schema: StandardSchemaV1<unknown, T>, data: unknown, _tag: string) {\n return validateSchemaSync(schema, data, `ADT variant \"${_tag}\"`)\n}\n\n/**\n * Create a type guard function for a specific _tag.\n */\nexport function createIsGuard<Tag extends string, T>(\n _tag: Tag,\n): (value: unknown) => value is T & { readonly _tag: Tag } {\n return (value: unknown): value is T & { readonly _tag: Tag } => {\n return isPlainObject(value) && \"_tag\" in value && value[\"_tag\"] === _tag\n }\n}\n\n/**\n * Create a type guard function for multiple _tags (SchemaUnion root guard).\n */\nexport function createIsAnyGuard<T>(_tags: readonly string[]): (value: unknown) => value is T {\n const _tagSet = new Set(_tags)\n return (value: unknown): value is T => {\n return isPlainObject(value) && \"_tag\" in value && typeof value[\"_tag\"] === \"string\" && _tagSet.has(value[\"_tag\"])\n }\n}\n","import { createEqualsMethod, createHashMethod } from \"../equality/equality\"\nimport { ok, err } from \"../result/result\"\nimport type { Result } from \"../result/result.types\"\nimport type { ValidationError } from \"../schema/schema.types\"\nimport type { Discriminator } from \"../shared/discriminator.types\"\nimport { createIsGuard, validateSync } from \"./schema.tagged-utils\"\nimport type { TaggedSchemaInput, TaggedSchemaOutput, TaggedSchema } from \"./schema.union.types\"\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\"\n\n/**\n * Create a standalone tagged variant from a Standard Schema.\n *\n * Variants can be used independently or composed into an SchemaUnion via union().\n * All defaults should be defined at the schema level (e.g., Zod's .default()).\n *\n * @template Tag - The string literal type for the _tag discriminator\n * @template S - The Standard Schema type for validation\n * @param _tag - The _tag discriminator value\n * @param schema - A Standard Schema compliant validator\n * @returns A callable TaggedSchema with is(), equals(), and hash() methods\n *\n * @see {@link union} for composing variants into discriminated unions\n * @see {@link tagged} for unvalidated tagged value constructors\n *\n * @example\n * ```ts\n * const CircleSchema = z.object({\n * radius: z.number().positive(),\n * color: z.string().default('blue')\n * })\n *\n * const Circle = tagged('Circle', CircleSchema)\n *\n * const result = Circle({ radius: 10 })\n * // { _tag: \"Ok\", value: { _tag: \"Circle\", radius: 10, color: \"blue\" } }\n *\n * Circle.is(someValue) // type guard\n * ```\n */\nexport function tagged<Tag extends string, S extends StandardSchemaV1>(_tag: Tag, schema: S): TaggedSchema<Tag, S>\n\n// Implementation\nexport function tagged<Tag extends string, S extends StandardSchemaV1>(_tag: Tag, schema: S): TaggedSchema<Tag, S> {\n type Output = TaggedSchemaOutput<S> & Discriminator<Tag>\n\n const isGuard = createIsGuard<Tag, Output>(_tag)\n const equals = createEqualsMethod<Tag, TaggedSchemaOutput<S>>(_tag)\n const hash = createHashMethod<Tag, TaggedSchemaOutput<S>>(_tag)\n\n // Constructor function\n const constructor = (input: TaggedSchemaInput<S>): Result<Output, ValidationError> => {\n // Add _tag to the input before validation\n // oxlint-disable-next-line no-unsafe-type-assertion -- Required for spreading generic input\n const taggedInput = { ...(input as object), _tag }\n\n // Validate using the schema\n const result = validateSync(schema, taggedInput, _tag)\n\n if (result._tag === \"Err\") {\n return err(result.error)\n }\n\n // Ensure _tag is in the output (schema might strip unknown keys)\n // oxlint-disable-next-line no-unsafe-type-assertion -- Required for output construction\n const output = { ...(result.value as object), _tag } as Output\n return ok(output)\n }\n\n // Attach static properties to constructor function\n constructor._variant = true as const\n constructor._tag = _tag\n constructor.schema = schema\n constructor.is = isGuard\n constructor.equals = equals\n constructor.hash = hash\n\n return constructor as TaggedSchema<Tag, S>\n}\n","import { createADTEqualsMethod, createADTHashMethod } from \"../equality/equality\"\nimport { tagged } from \"./schema.tagged\"\nimport { createIsAnyGuard, isVariant } from \"./schema.tagged-utils\"\nimport type { SchemaUnion, TaggedSchemaDef, TaggedSchema } from \"./schema.union.types\"\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\"\n\n/**\n * Compose records or schemas into a discriminated union (SchemaUnion).\n *\n * Accepts either:\n * - Pre-built TaggedSchemas from tagged()\n * - Raw Standard Schema validators (will be wrapped internally)\n *\n * When using pre-built records, the object key overrides the original _tag.\n *\n * @template R - Record of variant names to TaggedSchemas or StandardSchema validators\n * @param name - The name of this SchemaUnion (for identification)\n * @param records - An object mapping _tag names to TaggedSchemas or schemas\n * @returns An SchemaUnion object with accessors for each variant\n *\n * @see {@link variant} for creating individual variant types\n * @see {@link match} for exhaustive pattern matching on SchemaUnion values\n *\n * @example\n * ```ts\n * // From pre-built variants\n * const Circle = tagged('Circle', CircleSchema)\n * const Square = tagged('Square', SquareSchema)\n * const Shape = union('Shape', { Circle, Square })\n *\n * // From raw schemas (JSON codec is automatically included)\n * const Shape = union('Shape', {\n * Circle: CircleSchema,\n * Square: SquareSchema\n * })\n *\n * // Mixed\n * const Shape = union('Shape', {\n * Circle, // Pre-built variant\n * Square: SquareSchema // Raw schema\n * })\n *\n * // Usage\n * Shape.Circle({ radius: 10 })\n * Shape.is(someValue) // type guard for any variant\n * Shape.Circle.is(someValue) // type guard for Circle\n * ```\n */\nexport function union<R extends Record<string, TaggedSchemaDef>>(name: string, records: R): SchemaUnion<R> {\n const tags = Object.keys(records)\n const variants: Record<string, TaggedSchema> = {}\n\n for (const [_tag, def] of Object.entries(records)) {\n if (isVariant(def)) {\n // Pre-built TaggedSchema - key overrides original _tag\n if (def._tag === _tag) {\n // _tag matches key, use as-is\n variants[_tag] = def\n } else {\n // _tag differs from key - create new variant with key as _tag\n variants[_tag] = tagged(_tag, def.schema)\n }\n } else {\n // Raw schema - wrap in variant\n // oxlint-disable-next-line no-unsafe-type-assertion -- def is a StandardSchemaV1 in this branch\n variants[_tag] = tagged(_tag, def as StandardSchemaV1)\n }\n }\n\n // Create the root type guard for any variant\n const isAnyVariant = createIsAnyGuard(tags)\n const equals = createADTEqualsMethod(tags)\n const hash = createADTHashMethod(tags)\n\n // oxlint-disable-next-line no-unsafe-type-assertion -- Required for generic SchemaUnion return type\n return {\n _name: name,\n is: isAnyVariant,\n equals,\n hash,\n ...variants,\n } as SchemaUnion<R>\n}\n","import type { Result as ResultType } from \"../result/result.types\"\n/**\n * Standard Schema-backed parsing and refinement helpers.\n *\n * **Mental model**\n * - `Schema.parse` is for boundary validation and parsing.\n * - `Schema.codec` is for bidirectional boundary encoding/decoding.\n * - `Schema.is` is a sync-only proof guard for direct in-memory checks.\n * - `Schema.refine` is the reusable preserved-shape guard for higher-order APIs like `Array.filter`.\n *\n * **Common tasks**\n * - Parse loose external data into validated subtypes.\n * - Build first-class codecs with validated encoded and decoded sides.\n * - Use `Schema.is` for direct control-flow checks against already-typed values.\n * - Reuse a schema as a preserved-shape predicate with `Schema.refine`.\n * - Name reusable narrowed types with `Schema.Refine<Base, typeof schema>` or exact schema outputs with `Schema.Infer<typeof schema>`.\n *\n * **Gotchas**\n * - `Schema.parse` may be sync or async based on the schema type you preserve.\n * - `Schema.refine` and `Schema.is` support both data-first and data-last styles.\n * - `Schema.refine` and `Schema.is` are sync-only.\n * - `Schema.is` and `Schema.refine` must only be used with proof schemas that validate the current value in place.\n * - Transforms, defaults, coercions, and other output-changing schemas should use `Schema.parse`.\n * - `Schema.is` narrows `unknown` to the exact schema output, but in direct control flow TypeScript preserves the current value shape.\n * - `Schema.refine` exists for the cases where you need that preserved shape to survive higher-order APIs like `Array.filter`.\n *\n * @module\n */\nimport { dual } from \"../shared/dual\"\nimport {\n CodecDecodeError,\n CodecDecodeValidationError,\n CodecEncodeError,\n CodecEncodeValidationError,\n codec as codecImpl,\n} from \"./schema.codec\"\nimport type {\n Codec as CodecType,\n CodecConstructor as CodecConstructorType,\n CodecError as CodecErrorType,\n CodecOptions as CodecOptionsType,\n Decoded as CodecDecoded,\n DecodeInput as CodecDecodeInput,\n Encoded as CodecEncoded,\n EncodeInput as CodecEncodeInput,\n JsonCodecOptions as CodecJsonOptions,\n} from \"./schema.codec\"\nimport { validate, validateSync } from \"./schema.shared\"\nimport { struct as structImpl } from \"./schema.struct\"\nimport { tagged as taggedImpl } from \"./schema.tagged\"\nimport type {\n Input,\n Output,\n Refine as Refined,\n SyncRefinementSchema,\n SyncSchema,\n ValidationError,\n} from \"./schema.types\"\nimport { union as unionImpl } from \"./schema.union\"\nimport type {\n UnionInfer as UnionInferType,\n UnionVariantNames as UnionVariantNamesType,\n UnionVariantOf as UnionVariantOfType,\n} from \"./schema.union.types\"\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\"\n\nexport type {\n Infer,\n Input,\n Output,\n Refine,\n RefinementSchema,\n SyncRefinementSchema,\n SyncSchema,\n ValidationError,\n ValidationIssue,\n} from \"./schema.types\"\n\nexport type {\n SchemaUnion,\n TaggedSchema,\n TaggedSchemaDef,\n TaggedSchemaInput,\n TaggedSchemaOutput,\n} from \"./schema.union.types\"\nexport type { StructValue } from \"../data/data.types\"\n\nexport declare namespace Union {\n export type Infer<T> = UnionInferType<T>\n export type VariantNames<T> = UnionVariantNamesType<T>\n export type VariantOf<T, K extends string> = UnionVariantOfType<T, K>\n}\n\nexport namespace Codec {\n export const DecodeError = CodecDecodeError\n export const DecodeValidationError = CodecDecodeValidationError\n export const EncodeValidationError = CodecEncodeValidationError\n export const EncodeError = CodecEncodeError\n\n export type Codec<\n DecodedSchema extends StandardSchemaV1 = StandardSchemaV1,\n EncodedSchema extends StandardSchemaV1 = StandardSchemaV1,\n DecodeReturn extends Input<DecodedSchema> | Promise<Input<DecodedSchema>> = Input<DecodedSchema>,\n EncodeReturn extends Input<EncodedSchema> | Promise<Input<EncodedSchema>> = Input<EncodedSchema>,\n > = CodecType<DecodedSchema, EncodedSchema, DecodeReturn, EncodeReturn>\n\n export type Decoded<C> = CodecDecoded<C>\n export type Encoded<C> = CodecEncoded<C>\n export type DecodeInput<C> = CodecDecodeInput<C>\n export type EncodeInput<C> = CodecEncodeInput<C>\n export type Error = CodecErrorType\n export type Options<\n DecodedSchema extends StandardSchemaV1,\n EncodedSchema extends StandardSchemaV1,\n DecodeReturn extends Input<DecodedSchema> | Promise<Input<DecodedSchema>>,\n EncodeReturn extends Input<EncodedSchema> | Promise<Input<EncodedSchema>>,\n > = CodecOptionsType<DecodedSchema, EncodedSchema, DecodeReturn, EncodeReturn>\n export type JsonOptions = CodecJsonOptions\n export type Constructor = CodecConstructorType\n}\n\n/**\n * Construct sync schema-backed structs with structural value semantics.\n */\nexport const struct = structImpl\n\n/**\n * Construct schema-backed tagged values.\n */\nexport const tagged = taggedImpl\n\n/**\n * Compose schema-backed tagged values into a discriminated union.\n */\nexport const union = unionImpl\n\n/**\n * Construct first-class bidirectional schema codecs.\n */\nexport const codec = codecImpl\n\n/**\n * Create a schema-backed parser.\n *\n * For sync schemas the returned parser is sync.\n * For general Standard Schema values the returned parser is async.\n */\nexport function parse<S extends SyncSchema>(schema: S): (value: Input<S>) => ResultType<Output<S>, ValidationError>\nexport function parse<S extends StandardSchemaV1>(\n schema: S,\n): (value: Input<S>) => Promise<ResultType<Output<S>, ValidationError>>\nexport function parse<S extends StandardSchemaV1>(schema: S) {\n return (value: Input<S>) => {\n return validate(schema, value)\n }\n}\n\nexport type RefineFn = {\n <S extends SyncSchema, Base extends Input<S>>(value: Base, schema: S): value is Refined<Base, S>\n <S extends SyncSchema>(schema: S): <Base extends Input<S>>(value: Base) => value is Refined<Base, S>\n}\n\nexport type Is = {\n <Base, Sub extends Base>(value: Base, schema: SyncRefinementSchema<Base, Sub>): value is Sub\n <S extends SyncSchema>(value: unknown, schema: S): value is Output<S>\n <Base, Sub extends Base>(schema: SyncRefinementSchema<Base, Sub>): (value: Base) => value is Sub\n <S extends SyncSchema>(schema: S): (value: unknown) => value is Output<S>\n}\n\n/* oxlint-disable no-explicit-any, no-unsafe-return, no-unsafe-type-assertion -- dual() requires a single implementation signature */\nconst refineImpl = dual(2, (value: unknown, schema: SyncSchema) => {\n return validateSync(schema, value, \"Schema.refine()\")._tag === \"Ok\"\n}) as RefineFn\n\n/**\n * Create a sync-only schema-backed reusable type guard that preserves the original value shape.\n *\n * Use this when a schema validates only a subset of a broader in-memory value\n * and you need the preserved shape to survive higher-order APIs like\n * `Array.filter`. The narrowed type is `Base & Output<typeof schema>`, not the\n * exact schema output.\n *\n * Supports both data-first and data-last styles:\n * - Data-first: `Schema.refine(value, schema)`\n * - Data-last: `Schema.refine(schema)(value)`\n *\n * Only use this with sync proof schemas that validate properties already\n * present on the original value. Transforms, defaults, and coercions are not\n * safe here because they can change the schema output without changing the\n * original input value.\n */\nexport function refine<S extends SyncSchema, Base extends Input<S>>(value: Base, schema: S): value is Refined<Base, S>\nexport function refine<S extends SyncSchema>(\n schema: S,\n): <Base extends Input<S>>(value: Base) => value is Refined<Base, S>\nexport function refine(...args: [value: unknown, schema: SyncSchema] | [schema: SyncSchema]) {\n return (refineImpl as (...args: [unknown, SyncSchema] | [SyncSchema]) => boolean | ((value: unknown) => boolean))(\n ...args,\n )\n}\n\nconst isImpl = dual(2, (value: unknown, schema: SyncSchema) => {\n return validateSync(schema, value, \"Schema.is()\")._tag === \"Ok\"\n}) as Is\n\n/**\n * Create a sync-only schema-backed proof guard.\n *\n * On `unknown` values this narrows to the exact schema output. On already-typed\n * values, TypeScript preserves the current shape during direct control-flow\n * checks. Use `Schema.refine` when that preserved shape must survive\n * higher-order APIs like `Array.filter`.\n *\n * Supports both data-first and data-last styles:\n * - Data-first: `Schema.is(value, schema)`\n * - Data-last: `Schema.is(schema)(value)`\n */\nexport function is<Base, Sub extends Base>(value: Base, schema: SyncRefinementSchema<Base, Sub>): value is Sub\nexport function is<S extends SyncSchema>(value: unknown, schema: S): value is Output<S>\nexport function is<Base, Sub extends Base>(schema: SyncRefinementSchema<Base, Sub>): (value: Base) => value is Sub\nexport function is<S extends SyncSchema>(schema: S): (value: unknown) => value is Output<S>\nexport function is(...args: [value: unknown, schema: SyncSchema] | [schema: SyncSchema]) {\n return (isImpl as (...args: [unknown, SyncSchema] | [SyncSchema]) => boolean | ((value: unknown) => boolean))(...args)\n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