@chainfuse/types 2.12.1 → 3.0.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.
@@ -1,10 +1,9 @@
1
- import { z as z3 } from 'zod/v3';
2
- import { z as z4 } from 'zod/v4';
1
+ import * as z from 'zod/mini';
3
2
  import type { ZodCoordinate } from '../zod/index.js';
4
3
  import { type CloudflareFunctionModelsEnum, type CloudflareModelsEnum } from './workers-ai/index.js';
5
4
  export interface Coordinate {
6
- lat: z4.infer<typeof ZodCoordinate>;
7
- lon: z4.infer<typeof ZodCoordinate>;
5
+ lat: z.infer<typeof ZodCoordinate>;
6
+ lon: z.infer<typeof ZodCoordinate>;
8
7
  }
9
8
  export declare namespace AiModels {
10
9
  namespace LanguageModels {
@@ -77,8 +76,7 @@ export declare namespace AiModels {
77
76
  }
78
77
  }
79
78
  }
80
- export declare const ZodLanguageModelValues3: z3.ZodEnum<["workersai:@cf/openai/gpt-oss-120b" | "workersai:@cf/qwen/qwen1.5-0.5b-chat" | "workersai:@cf/google/gemma-2b-it-lora" | "workersai:@hf/nexusflow/starling-lm-7b-beta" | "workersai:@cf/meta/llama-3-8b-instruct" | "workersai:@cf/meta/llama-3.2-3b-instruct" | "workersai:@hf/thebloke/llamaguard-7b-awq" | "workersai:@hf/thebloke/neural-chat-7b-v3-1-awq" | "workersai:@cf/meta/llama-guard-3-8b" | "workersai:@cf/meta/llama-2-7b-chat-fp16" | "workersai:@cf/mistral/mistral-7b-instruct-v0.1" | "workersai:@cf/mistral/mistral-7b-instruct-v0.2-lora" | "workersai:@cf/tinyllama/tinyllama-1.1b-chat-v1.0" | "workersai:@hf/mistral/mistral-7b-instruct-v0.2" | "workersai:@cf/fblgit/una-cybertron-7b-v2-bf16" | "workersai:@cf/deepseek-ai/deepseek-r1-distill-qwen-32b" | "workersai:@cf/thebloke/discolm-german-7b-v1-awq" | "workersai:@cf/meta/llama-2-7b-chat-int8" | "workersai:@cf/meta/llama-3.1-8b-instruct-fp8" | "workersai:@hf/thebloke/mistral-7b-instruct-v0.1-awq" | "workersai:@cf/qwen/qwen1.5-7b-chat-awq" | "workersai:@cf/meta/llama-3.2-1b-instruct" | "workersai:@hf/thebloke/llama-2-13b-chat-awq" | "workersai:@hf/thebloke/deepseek-coder-6.7b-base-awq" | "workersai:@cf/meta-llama/llama-2-7b-chat-hf-lora" | "workersai:@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "workersai:@hf/thebloke/openhermes-2.5-mistral-7b-awq" | "workersai:@hf/thebloke/deepseek-coder-6.7b-instruct-awq" | "workersai:@cf/qwen/qwen2.5-coder-32b-instruct" | "workersai:@cf/deepseek-ai/deepseek-math-7b-instruct" | "workersai:@cf/tiiuae/falcon-7b-instruct" | "workersai:@hf/nousresearch/hermes-2-pro-mistral-7b" | "workersai:@cf/meta/llama-3.1-8b-instruct-awq" | "workersai:@hf/thebloke/zephyr-7b-beta-awq" | "workersai:@cf/google/gemma-7b-it-lora" | "workersai:@cf/qwen/qwen1.5-1.8b-chat" | "workersai:@cf/mistralai/mistral-small-3.1-24b-instruct" | "workersai:@cf/meta/llama-3-8b-instruct-awq" | "workersai:@cf/meta/llama-3.2-11b-vision-instruct" | "workersai:@cf/defog/sqlcoder-7b-2" | "workersai:@cf/microsoft/phi-2" | "workersai:@hf/meta-llama/meta-llama-3-8b-instruct" | "workersai:@cf/openai/gpt-oss-20b" | "workersai:@hf/google/gemma-7b-it" | "workersai:@cf/qwen/qwen1.5-14b-chat-awq" | "workersai:@cf/openchat/openchat-3.5-0106" | "workersai:@cf/meta/llama-4-scout-17b-16e-instruct" | "workersai:@cf/google/gemma-3-12b-it" | "workersai:@cf/qwen/qwq-32b" | AiModels.LanguageModels.Azure | AiModels.LanguageModels.Anthropic | AiModels.LanguageModels.GoogleGenerativeAi | AiModels.LanguageModels.OpenAi, ...("workersai:@cf/openai/gpt-oss-120b" | "workersai:@cf/qwen/qwen1.5-0.5b-chat" | "workersai:@cf/google/gemma-2b-it-lora" | "workersai:@hf/nexusflow/starling-lm-7b-beta" | "workersai:@cf/meta/llama-3-8b-instruct" | "workersai:@cf/meta/llama-3.2-3b-instruct" | "workersai:@hf/thebloke/llamaguard-7b-awq" | "workersai:@hf/thebloke/neural-chat-7b-v3-1-awq" | "workersai:@cf/meta/llama-guard-3-8b" | "workersai:@cf/meta/llama-2-7b-chat-fp16" | "workersai:@cf/mistral/mistral-7b-instruct-v0.1" | "workersai:@cf/mistral/mistral-7b-instruct-v0.2-lora" | "workersai:@cf/tinyllama/tinyllama-1.1b-chat-v1.0" | "workersai:@hf/mistral/mistral-7b-instruct-v0.2" | "workersai:@cf/fblgit/una-cybertron-7b-v2-bf16" | "workersai:@cf/deepseek-ai/deepseek-r1-distill-qwen-32b" | "workersai:@cf/thebloke/discolm-german-7b-v1-awq" | "workersai:@cf/meta/llama-2-7b-chat-int8" | "workersai:@cf/meta/llama-3.1-8b-instruct-fp8" | "workersai:@hf/thebloke/mistral-7b-instruct-v0.1-awq" | "workersai:@cf/qwen/qwen1.5-7b-chat-awq" | "workersai:@cf/meta/llama-3.2-1b-instruct" | "workersai:@hf/thebloke/llama-2-13b-chat-awq" | "workersai:@hf/thebloke/deepseek-coder-6.7b-base-awq" | "workersai:@cf/meta-llama/llama-2-7b-chat-hf-lora" | "workersai:@cf/meta/llama-3.3-70b-instruct-fp8-fast" | "workersai:@hf/thebloke/openhermes-2.5-mistral-7b-awq" | "workersai:@hf/thebloke/deepseek-coder-6.7b-instruct-awq" | "workersai:@cf/qwen/qwen2.5-coder-32b-instruct" | "workersai:@cf/deepseek-ai/deepseek-math-7b-instruct" | "workersai:@cf/tiiuae/falcon-7b-instruct" | "workersai:@hf/nousresearch/hermes-2-pro-mistral-7b" | "workersai:@cf/meta/llama-3.1-8b-instruct-awq" | "workersai:@hf/thebloke/zephyr-7b-beta-awq" | "workersai:@cf/google/gemma-7b-it-lora" | "workersai:@cf/qwen/qwen1.5-1.8b-chat" | "workersai:@cf/mistralai/mistral-small-3.1-24b-instruct" | "workersai:@cf/meta/llama-3-8b-instruct-awq" | "workersai:@cf/meta/llama-3.2-11b-vision-instruct" | "workersai:@cf/defog/sqlcoder-7b-2" | "workersai:@cf/microsoft/phi-2" | "workersai:@hf/meta-llama/meta-llama-3-8b-instruct" | "workersai:@cf/openai/gpt-oss-20b" | "workersai:@hf/google/gemma-7b-it" | "workersai:@cf/qwen/qwen1.5-14b-chat-awq" | "workersai:@cf/openchat/openchat-3.5-0106" | "workersai:@cf/meta/llama-4-scout-17b-16e-instruct" | "workersai:@cf/google/gemma-3-12b-it" | "workersai:@cf/qwen/qwq-32b" | AiModels.LanguageModels.Azure | AiModels.LanguageModels.Anthropic | AiModels.LanguageModels.GoogleGenerativeAi | AiModels.LanguageModels.OpenAi)[]]>;
81
- export declare const ZodLanguageModelValues: z4.ZodEnum<{
79
+ export declare const ZodLanguageModelValues: z.ZodMiniEnum<{
82
80
  "workersai:@cf/openai/gpt-oss-120b": "workersai:@cf/openai/gpt-oss-120b";
83
81
  "workersai:@cf/qwen/qwen1.5-0.5b-chat": "workersai:@cf/qwen/qwen1.5-0.5b-chat";
84
82
  "workersai:@cf/google/gemma-2b-it-lora": "workersai:@cf/google/gemma-2b-it-lora";
@@ -154,9 +152,8 @@ export declare const ZodLanguageModelValues: z4.ZodEnum<{
154
152
  "openai:o1": AiModels.LanguageModels.OpenAi.o1;
155
153
  "openai:o3": AiModels.LanguageModels.OpenAi.o3;
156
154
  }>;
157
- export type LanguageModelValues = z4.infer<typeof ZodLanguageModelValues>;
158
- export declare const ZodImageModelValues3: z3.ZodEnum<["workersai:@cf/runwayml/stable-diffusion-v1-5-inpainting" | "workersai:@cf/black-forest-labs/flux-1-schnell" | "workersai:@cf/bytedance/stable-diffusion-xl-lightning" | "workersai:@cf/lykon/dreamshaper-8-lcm" | "workersai:@cf/leonardo/phoenix-1.0" | "workersai:@cf/stabilityai/stable-diffusion-xl-base-1.0" | "workersai:@cf/runwayml/stable-diffusion-v1-5-img2img" | "workersai:@cf/leonardo/lucid-origin" | AiModels.ImageModels.Azure | AiModels.ImageModels.GoogleGenerativeAi | AiModels.ImageModels.OpenAi, ...("workersai:@cf/runwayml/stable-diffusion-v1-5-inpainting" | "workersai:@cf/black-forest-labs/flux-1-schnell" | "workersai:@cf/bytedance/stable-diffusion-xl-lightning" | "workersai:@cf/lykon/dreamshaper-8-lcm" | "workersai:@cf/leonardo/phoenix-1.0" | "workersai:@cf/stabilityai/stable-diffusion-xl-base-1.0" | "workersai:@cf/runwayml/stable-diffusion-v1-5-img2img" | "workersai:@cf/leonardo/lucid-origin" | AiModels.ImageModels.Azure | AiModels.ImageModels.GoogleGenerativeAi | AiModels.ImageModels.OpenAi)[]]>;
159
- export declare const ZodImageModelValues: z4.ZodEnum<{
155
+ export type LanguageModelValues = z.infer<typeof ZodLanguageModelValues>;
156
+ export declare const ZodImageModelValues: z.ZodMiniEnum<{
160
157
  "workersai:@cf/runwayml/stable-diffusion-v1-5-inpainting": "workersai:@cf/runwayml/stable-diffusion-v1-5-inpainting";
161
158
  "workersai:@cf/black-forest-labs/flux-1-schnell": "workersai:@cf/black-forest-labs/flux-1-schnell";
162
159
  "workersai:@cf/bytedance/stable-diffusion-xl-lightning": "workersai:@cf/bytedance/stable-diffusion-xl-lightning";
@@ -170,9 +167,8 @@ export declare const ZodImageModelValues: z4.ZodEnum<{
170
167
  "google.generative-ai:imagen-3.0-fast-generate-001": AiModels.ImageModels.GoogleGenerativeAi.imagen_fast;
171
168
  "openai:dall-e-3": AiModels.ImageModels.OpenAi.dalle3;
172
169
  }>;
173
- export type ImageModelValues = z4.infer<typeof ZodImageModelValues>;
174
- export declare const ZodTextEmbeddingModelValues3: z3.ZodEnum<["workersai:@cf/baai/bge-m3" | "workersai:@cf/baai/omni-bge-m3" | "workersai:@cf/baai/bge-small-en-v1.5" | "workersai:@cf/baai/bge-base-en-v1.5" | "workersai:@cf/google/embeddinggemma-300m" | "workersai:@cf/baai/bge-large-en-v1.5" | AiModels.TextEmbeddingModels.Azure | AiModels.TextEmbeddingModels.GoogleGenerativeAi.te4 | AiModels.TextEmbeddingModels.OpenAi, ...("workersai:@cf/baai/bge-m3" | "workersai:@cf/baai/omni-bge-m3" | "workersai:@cf/baai/bge-small-en-v1.5" | "workersai:@cf/baai/bge-base-en-v1.5" | "workersai:@cf/google/embeddinggemma-300m" | "workersai:@cf/baai/bge-large-en-v1.5" | AiModels.TextEmbeddingModels.Azure | AiModels.TextEmbeddingModels.GoogleGenerativeAi.te4 | AiModels.TextEmbeddingModels.OpenAi)[]]>;
175
- export declare const ZodTextEmbeddingModelValues: z4.ZodEnum<{
170
+ export type ImageModelValues = z.infer<typeof ZodImageModelValues>;
171
+ export declare const ZodTextEmbeddingModelValues: z.ZodMiniEnum<{
176
172
  "workersai:@cf/baai/bge-m3": "workersai:@cf/baai/bge-m3";
177
173
  "workersai:@cf/baai/omni-bge-m3": "workersai:@cf/baai/omni-bge-m3";
178
174
  "workersai:@cf/baai/bge-small-en-v1.5": "workersai:@cf/baai/bge-small-en-v1.5";
@@ -185,7 +181,7 @@ export declare const ZodTextEmbeddingModelValues: z4.ZodEnum<{
185
181
  "openai:text-embedding-3-large": AiModels.TextEmbeddingModels.OpenAi.te3_large;
186
182
  "openai:text-embedding-3-small": AiModels.TextEmbeddingModels.OpenAi.te3_small;
187
183
  }>;
188
- export type TextEmbeddingModelValues = z4.infer<typeof ZodTextEmbeddingModelValues>;
184
+ export type TextEmbeddingModelValues = z.infer<typeof ZodTextEmbeddingModelValues>;
189
185
  export declare const default_mc_generic: LanguageModelValues;
190
186
  export declare const default_mc_summary: LanguageModelValues;
191
187
  export declare const default_mc_extraction: LanguageModelValues;
@@ -1,5 +1,4 @@
1
- import { z as z3 } from 'zod/v3';
2
- import { z as z4 } from 'zod/v4';
1
+ import * as z from 'zod/mini';
3
2
  import { enabledCloudflareLlmEmbeddingProviders, enabledCloudflareLlmFunctionProviders, enabledCloudflareLlmImageProviders, enabledCloudflareLlmProviders } from './workers-ai/index.js';
4
3
  export var AiModels;
5
4
  (function (AiModels) {
@@ -92,20 +91,17 @@ const ZodLanguageModelValuesRaw = Object.entries(AiModels.LanguageModels).reduce
92
91
  acc.push(value);
93
92
  return acc;
94
93
  }, []);
95
- export const ZodLanguageModelValues3 = z3.enum(Object.values(Object.assign({}, ...ZodLanguageModelValuesRaw)));
96
- export const ZodLanguageModelValues = z4.enum(Object.values(Object.assign({}, ...ZodLanguageModelValuesRaw)));
94
+ export const ZodLanguageModelValues = z.enum(Object.values(Object.assign({}, ...ZodLanguageModelValuesRaw)));
97
95
  const ZodImageModelValuesRaw = Object.entries(AiModels.ImageModels).reduce((acc, [, value]) => {
98
96
  acc.push(value);
99
97
  return acc;
100
98
  }, []);
101
- export const ZodImageModelValues3 = z3.enum(Object.values(Object.assign({}, ...ZodImageModelValuesRaw)));
102
- export const ZodImageModelValues = z4.enum(Object.values(Object.assign({}, ...ZodImageModelValuesRaw)));
99
+ export const ZodImageModelValues = z.enum(Object.values(Object.assign({}, ...ZodImageModelValuesRaw)));
103
100
  const ZodTextEmbeddingModelValuesRaw = Object.entries(AiModels.TextEmbeddingModels).reduce((acc, [, value]) => {
104
101
  acc.push(value);
105
102
  return acc;
106
103
  }, []);
107
- export const ZodTextEmbeddingModelValues3 = z3.enum(Object.values(Object.assign({}, ...ZodTextEmbeddingModelValuesRaw)));
108
- export const ZodTextEmbeddingModelValues = z4.enum(Object.values(Object.assign({}, ...ZodTextEmbeddingModelValuesRaw)));
104
+ export const ZodTextEmbeddingModelValues = z.enum(Object.values(Object.assign({}, ...ZodTextEmbeddingModelValuesRaw)));
109
105
  export const default_mc_generic = AiModels.LanguageModels.Azure.gpt4o_mini;
110
106
  export const default_mc_summary = AiModels.LanguageModels.Azure.gpt4o;
111
107
  export const default_mc_extraction = AiModels.LanguageModels.Azure.gpt4o_mini;
@@ -1,88 +1,31 @@
1
- import { z as z3 } from 'zod/v3';
2
- import { z as z4 } from 'zod/v4';
3
- /**
4
- * @link https://zod.dev/?id=json-type
5
- */
6
- declare const literalSchema: z3.ZodUnion<[z3.ZodString, z3.ZodNumber, z3.ZodBoolean, z3.ZodNull]>;
7
- export type JSON = z3.infer<typeof literalSchema> | {
8
- [key: string]: JSON;
9
- } | JSON[];
10
- export declare const jsonSchema: z3.ZodType<JSON>;
11
- export declare const ZodCoordinate: z4.ZodString;
12
- /**
13
- * @deprecated
14
- */
15
- export declare const Prefixed3UuidRaw: z3.ZodString;
16
- export declare const PrefixedUuidRaw: z4.ZodString;
17
- /**
18
- * @deprecated
19
- */
20
- export declare const Prefixed3Uuid7Raw: z3.ZodString;
21
- export declare const PrefixedUuid7Raw: z4.ZodString;
22
- /**
23
- * @deprecated
24
- */
25
- export declare const Prefixed3Uuid: z3.ZodEffects<z3.ZodString, {
26
- type: "dataspace" | "tenant" | "user";
27
- value: string;
28
- preview: boolean;
29
- }, string>;
30
- export declare const PrefixedUuid: z4.ZodPipe<z4.ZodString, z4.ZodTransform<{
1
+ import * as z from 'zod/mini';
2
+ export type JSON = z.infer<z.ZodMiniJSONSchema>;
3
+ export declare const ZodCoordinate: z.ZodMiniString<string>;
4
+ export declare const PrefixedUuidRaw: z.ZodMiniString<string>;
5
+ export declare const PrefixedUuid7Raw: z.ZodMiniString<string>;
6
+ export declare const PrefixedUuid8Raw: z.ZodMiniString<string>;
7
+ export declare const PrefixedUuid: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<{
31
8
  type: "dataspace" | "tenant" | "user";
32
9
  value: string;
33
10
  preview: boolean;
34
11
  }, string>>;
35
- /**
36
- * @deprecated
37
- */
38
- export declare const Prefixed3Uuid7: z3.ZodEffects<z3.ZodString, {
12
+ export declare const PrefixedUuid7: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<{
39
13
  type: "dataspace" | "tenant" | "user";
40
14
  value: string;
41
15
  preview: boolean;
42
- }, string>;
43
- export declare const PrefixedUuid7: z4.ZodPipe<z4.ZodString, z4.ZodTransform<{
16
+ }, string>>;
17
+ export declare const PrefixedUuid8: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<{
44
18
  type: "dataspace" | "tenant" | "user";
45
19
  value: string;
46
20
  preview: boolean;
47
21
  }, string>>;
48
- /**
49
- * @deprecated
50
- */
51
- export declare const Zod3Uuid: z3.ZodUnion<[z3.ZodString, z3.ZodString, z3.ZodEffects<z3.ZodString, string, string>, z3.ZodString, z3.ZodString]>;
52
- export declare const ZodUuid: z4.ZodUnion<readonly [z4.ZodString, z4.ZodUUID, z4.ZodString, z4.ZodBase64, z4.ZodBase64URL]>;
53
- /**
54
- * @deprecated
55
- */
56
- export declare const Zod3Uuid4: z3.ZodUnion<[z3.ZodEffects<z3.ZodString, string, string>, z3.ZodEffects<z3.ZodString, string, string>, z3.ZodString, z3.ZodString]>;
57
- export declare const ZodUuid4: z4.ZodUnion<readonly [z4.ZodUUID, z4.ZodString, z4.ZodBase64, z4.ZodBase64URL]>;
58
- /**
59
- * @deprecated
60
- */
61
- export declare const Zod3Uuid7: z3.ZodUnion<[z3.ZodString, z3.ZodEffects<z3.ZodString, string, string>, z3.ZodEffects<z3.ZodString, string, string>, z3.ZodString, z3.ZodString]>;
62
- export declare const ZodUuid7: z4.ZodUnion<readonly [z4.ZodString, z4.ZodUUID, z4.ZodString, z4.ZodBase64, z4.ZodBase64URL]>;
63
- /**
64
- * @deprecated
65
- */
66
- export declare const Zod3FakeUuidExport: z3.ZodObject<{
67
- utf8: z3.ZodString;
68
- hex: z3.ZodEffects<z3.ZodString, string, string>;
69
- base64: z3.ZodString;
70
- base64url: z3.ZodString;
71
- }, "strip", z3.ZodTypeAny, {
72
- base64: string;
73
- base64url: string;
74
- utf8: string;
75
- hex: string;
76
- }, {
77
- base64: string;
78
- base64url: string;
79
- utf8: string;
80
- hex: string;
81
- }>;
82
- export declare const Zod4FakeUuidExport: z4.ZodObject<{
83
- utf8: z4.ZodUUID;
84
- hex: z4.ZodString;
85
- base64: z4.ZodBase64;
86
- base64url: z4.ZodBase64URL;
87
- }, z4.core.$strip>;
88
- export {};
22
+ export declare const ZodUuid: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniUUID, z.ZodMiniCustomStringFormat<"hex">, z.ZodMiniBase64, z.ZodMiniBase64URL]>;
23
+ export declare const ZodUuid4: z.ZodMiniUnion<readonly [z.ZodMiniUUID, z.ZodMiniCustomStringFormat<"hex">, z.ZodMiniBase64, z.ZodMiniBase64URL]>;
24
+ export declare const ZodUuid7: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniUUID, z.ZodMiniCustomStringFormat<"hex">, z.ZodMiniBase64, z.ZodMiniBase64URL]>;
25
+ export declare const ZodUuid8: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniUUID, z.ZodMiniCustomStringFormat<"hex">, z.ZodMiniBase64, z.ZodMiniBase64URL]>;
26
+ export declare const Zod4FakeUuidExport: z.ZodMiniObject<{
27
+ utf8: z.ZodMiniUUID;
28
+ hex: z.ZodMiniCustomStringFormat<"hex">;
29
+ base64: z.ZodMiniBase64;
30
+ base64url: z.ZodMiniBase64URL;
31
+ }, z.core.$strip>;
package/dist/zod/index.js CHANGED
@@ -1,34 +1,16 @@
1
- import { z as z3 } from 'zod/v3';
2
- import { z as z4 } from 'zod/v4';
3
- /**
4
- * @link https://zod.dev/?id=json-type
5
- */
6
- const literalSchema = z3.union([z3.string(), z3.number(), z3.boolean(), z3.null()]);
7
- export const jsonSchema = z3.lazy(() => z3.union([literalSchema, z3.array(jsonSchema), z3.record(jsonSchema)]));
8
- export const ZodCoordinate = z4
9
- .string()
10
- .trim()
11
- .min(3)
12
- .regex(new RegExp(/^-?\d+\.\d+$/i));
1
+ import * as z from 'zod/mini';
2
+ export const ZodCoordinate = z.string().check(z.trim(), z.minLength(3), z.regex(new RegExp(/^-?\d+\.\d+$/i)));
13
3
  const prefixedUuidRegex = /^((d|t|u)_)?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(_p)?$/i;
14
4
  const hexUuidRegex = /^[0-9a-f]{8}[0-9a-f]{4}[0-9a-f]{4}[0-9a-f]{4}[0-9a-f]{12}$/i;
15
5
  const hexUuid4Regex = /^[0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[0-9a-f]{4}[0-9a-f]{12}$/i;
16
6
  const prefixedUuid7Regex = /^((d|t|u)_)?[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}(_p)?$/i;
17
7
  const hexUuid7Regex = /^[0-9a-f]{8}[0-9a-f]{4}7[0-9a-f]{3}[0-9a-f]{4}[0-9a-f]{12}$/i;
18
- /**
19
- * @deprecated
20
- */
21
- export const Prefixed3UuidRaw = z3.string().trim().toLowerCase().min(38).max(40).regex(prefixedUuidRegex);
22
- export const PrefixedUuidRaw = z4.string().trim().toLowerCase().min(38).max(40).regex(prefixedUuidRegex);
23
- /**
24
- * @deprecated
25
- */
26
- export const Prefixed3Uuid7Raw = z3.string().trim().toLowerCase().min(38).max(40).regex(prefixedUuid7Regex);
27
- export const PrefixedUuid7Raw = z4.string().trim().toLowerCase().min(38).max(40).regex(prefixedUuid7Regex);
28
- /**
29
- * @deprecated
30
- */
31
- export const Prefixed3Uuid = Prefixed3UuidRaw.transform((value) => {
8
+ const prefixedUuid8Regex = /^((d|t|u)_)?[0-9a-f]{8}-[0-9a-f]{4}-8[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}(_p)?$/i;
9
+ const hexUuid8Regex = /^[0-9a-f]{8}[0-9a-f]{4}8[0-9a-f]{3}[0-9a-f]{4}[0-9a-f]{12}$/i;
10
+ export const PrefixedUuidRaw = z.string().check(z.trim(), z.toLowerCase(), z.minLength(38), z.maxLength(40), z.regex(prefixedUuidRegex));
11
+ export const PrefixedUuid7Raw = z.string().check(z.trim(), z.toLowerCase(), z.minLength(38), z.maxLength(40), z.regex(prefixedUuid7Regex));
12
+ export const PrefixedUuid8Raw = z.string().check(z.trim(), z.toLowerCase(), z.minLength(38), z.maxLength(40), z.regex(prefixedUuid8Regex));
13
+ export const PrefixedUuid = z.pipe(PrefixedUuidRaw, z.transform((value) => {
32
14
  let type;
33
15
  if (value.startsWith('d_')) {
34
16
  type = 'dataspace';
@@ -43,8 +25,8 @@ export const Prefixed3Uuid = Prefixed3UuidRaw.transform((value) => {
43
25
  throw new Error('Invalid UUID prefix');
44
26
  }
45
27
  return { type, value, preview: value.endsWith('_p') };
46
- });
47
- export const PrefixedUuid = PrefixedUuidRaw.transform((value) => {
28
+ }));
29
+ export const PrefixedUuid7 = z.pipe(PrefixedUuid7Raw, z.transform((value) => {
48
30
  let type;
49
31
  if (value.startsWith('d_')) {
50
32
  type = 'dataspace';
@@ -59,11 +41,8 @@ export const PrefixedUuid = PrefixedUuidRaw.transform((value) => {
59
41
  throw new Error('Invalid UUID prefix');
60
42
  }
61
43
  return { type, value, preview: value.endsWith('_p') };
62
- });
63
- /**
64
- * @deprecated
65
- */
66
- export const Prefixed3Uuid7 = Prefixed3Uuid7Raw.transform((value) => {
44
+ }));
45
+ export const PrefixedUuid8 = z.pipe(PrefixedUuid8Raw, z.transform((value) => {
67
46
  let type;
68
47
  if (value.startsWith('d_')) {
69
48
  type = 'dataspace';
@@ -78,154 +57,45 @@ export const Prefixed3Uuid7 = Prefixed3Uuid7Raw.transform((value) => {
78
57
  throw new Error('Invalid UUID prefix');
79
58
  }
80
59
  return { type, value, preview: value.endsWith('_p') };
81
- });
82
- export const PrefixedUuid7 = PrefixedUuid7Raw.transform((value) => {
83
- let type;
84
- if (value.startsWith('d_')) {
85
- type = 'dataspace';
86
- }
87
- else if (value.startsWith('t_')) {
88
- type = 'tenant';
89
- }
90
- else if (value.startsWith('u_')) {
91
- type = 'user';
92
- }
93
- else {
94
- throw new Error('Invalid UUID prefix');
95
- }
96
- return { type, value, preview: value.endsWith('_p') };
97
- });
98
- /**
99
- * @deprecated
100
- */
101
- export const Zod3Uuid = z3.union([
102
- Prefixed3UuidRaw,
103
- // utf-8
104
- z3.string().trim().toLowerCase().uuid(),
105
- // hex
106
- z3
107
- .string()
108
- .trim()
109
- .toLowerCase()
110
- .length(32)
111
- .regex(hexUuidRegex)
112
- .refine((value) => import('validator/es/lib/isHexadecimal').then(({ default: isHexadecimal }) => isHexadecimal(value)).catch(() => import('validator').then(({ default: validator }) => validator.isHexadecimal(value)))),
113
- z3.string().trim().nonempty().base64(),
114
- z3.string().trim().nonempty().base64url(),
115
- ]);
116
- export const ZodUuid = z4.union([
60
+ }));
61
+ export const ZodUuid = z.union([
117
62
  PrefixedUuidRaw,
118
63
  // utf-8
119
- z4.uuid().trim().toLowerCase(),
64
+ z.uuid().check(z.trim(), z.toLowerCase()),
120
65
  // hex
121
- z4
122
- .string()
123
- .trim()
124
- .toLowerCase()
125
- .length(32)
126
- .regex(hexUuidRegex)
127
- .refine((value) => import('validator/es/lib/isHexadecimal').then(({ default: isHexadecimal }) => isHexadecimal(value)).catch(() => import('validator').then(({ default: validator }) => validator.isHexadecimal(value)))),
128
- z4.base64().trim().nonempty(),
129
- z4.base64url().trim().nonempty(),
66
+ z.hex().check(z.trim(), z.toLowerCase(), z.length(32), z.regex(hexUuidRegex)),
67
+ z.base64().check(z.trim(), z.minLength(1)),
68
+ z.base64url().check(z.trim(), z.minLength(1)),
130
69
  ]);
131
- /**
132
- * @deprecated
133
- */
134
- export const Zod3Uuid4 = z3.union([
70
+ export const ZodUuid4 = z.union([
135
71
  // utf-8
136
- z3
137
- .string()
138
- .trim()
139
- .toLowerCase()
140
- .uuid()
141
- .refine((value) => import('validator/es/lib/isUUID').then(({ default: isUUID }) => isUUID(value, 4)).catch(() => import('validator').then(({ default: validator }) => validator.isUUID(value, 4)))),
72
+ z.uuidv4().check(z.trim(), z.toLowerCase()),
142
73
  // hex
143
- z3
144
- .string()
145
- .trim()
146
- .toLowerCase()
147
- .length(32)
148
- .regex(hexUuid4Regex)
149
- .refine((value) => import('validator/es/lib/isHexadecimal').then(({ default: isHexadecimal }) => isHexadecimal(value)).catch(() => import('validator').then(({ default: validator }) => validator.isHexadecimal(value)))),
150
- z3.string().trim().nonempty().base64(),
151
- z3.string().trim().nonempty().base64url(),
74
+ z.hex().check(z.trim(), z.toLowerCase(), z.length(32), z.regex(hexUuid4Regex)),
75
+ z.base64().check(z.trim(), z.minLength(1)),
76
+ z.base64url().check(z.trim(), z.minLength(1)),
152
77
  ]);
153
- export const ZodUuid4 = z4.union([
154
- // utf-8
155
- z4.uuidv4().trim().toLowerCase(),
156
- // hex
157
- z4
158
- .string()
159
- .trim()
160
- .toLowerCase()
161
- .length(32)
162
- .regex(hexUuid4Regex)
163
- .refine((value) => import('validator/es/lib/isHexadecimal').then(({ default: isHexadecimal }) => isHexadecimal(value)).catch(() => import('validator').then(({ default: validator }) => validator.isHexadecimal(value)))),
164
- z4.base64().trim().nonempty(),
165
- z4.base64url().trim().nonempty(),
166
- ]);
167
- /**
168
- * @deprecated
169
- */
170
- export const Zod3Uuid7 = z3.union([
171
- Prefixed3Uuid7Raw,
78
+ export const ZodUuid7 = z.union([
79
+ PrefixedUuid7Raw,
172
80
  // utf-8
173
- z3
174
- .string()
175
- .trim()
176
- .toLowerCase()
177
- .uuid()
178
- .refine((value) => import('validator/es/lib/isUUID').then(({ default: isUUID }) => isUUID(value, 7)).catch(() => import('validator').then(({ default: validator }) => validator.isUUID(value, 7)))),
81
+ z.uuidv7().check(z.trim(), z.toLowerCase()),
179
82
  // hex
180
- z3
181
- .string()
182
- .trim()
183
- .toLowerCase()
184
- .length(32)
185
- .regex(hexUuid7Regex)
186
- .refine((value) => import('validator/es/lib/isHexadecimal').then(({ default: isHexadecimal }) => isHexadecimal(value)).catch(() => import('validator').then(({ default: validator }) => validator.isHexadecimal(value)))),
187
- z3.string().trim().nonempty().base64(),
188
- z3.string().trim().nonempty().base64url(),
83
+ z.hex().check(z.trim(), z.toLowerCase(), z.length(32), z.regex(hexUuid7Regex)),
84
+ z.base64().check(z.trim(), z.minLength(1)),
85
+ z.base64url().check(z.trim(), z.minLength(1)),
189
86
  ]);
190
- export const ZodUuid7 = z4.union([
191
- PrefixedUuid7Raw,
87
+ export const ZodUuid8 = z.union([
88
+ PrefixedUuid8Raw,
192
89
  // utf-8
193
- z4.uuidv7().trim().toLowerCase(),
90
+ z.uuid({ version: 'v8' }).check(z.trim(), z.toLowerCase()),
194
91
  // hex
195
- z4
196
- .string()
197
- .trim()
198
- .toLowerCase()
199
- .length(32)
200
- .regex(hexUuid7Regex)
201
- .refine((value) => import('validator/es/lib/isHexadecimal').then(({ default: isHexadecimal }) => isHexadecimal(value)).catch(() => import('validator').then(({ default: validator }) => validator.isHexadecimal(value)))),
202
- z4.base64().trim().nonempty(),
203
- z4.base64url().trim().nonempty(),
92
+ z.hex().check(z.trim(), z.toLowerCase(), z.length(32), z.regex(hexUuid8Regex)),
93
+ z.base64().check(z.trim(), z.minLength(1)),
94
+ z.base64url().check(z.trim(), z.minLength(1)),
204
95
  ]);
205
- /**
206
- * @deprecated
207
- */
208
- export const Zod3FakeUuidExport = z3.object({
209
- utf8: z3.string().trim().toLowerCase().uuid(),
210
- hex: z3
211
- .string()
212
- .trim()
213
- .toLowerCase()
214
- .length(32)
215
- .regex(hexUuidRegex)
216
- .refine((value) => import('validator/es/lib/isHexadecimal').then(({ default: isHexadecimal }) => isHexadecimal(value)).catch(() => import('validator').then(({ default: validator }) => validator.isHexadecimal(value)))),
217
- base64: z3.string().trim().nonempty().base64(),
218
- base64url: z3.string().trim().nonempty().base64url(),
219
- });
220
- export const Zod4FakeUuidExport = z4.object({
221
- utf8: z4.uuid().trim().toLowerCase(),
222
- hex: z4
223
- .string()
224
- .trim()
225
- .toLowerCase()
226
- .length(32)
227
- .regex(hexUuidRegex)
228
- .refine((value) => import('validator/es/lib/isHexadecimal').then(({ default: isHexadecimal }) => isHexadecimal(value)).catch(() => import('validator').then(({ default: validator }) => validator.isHexadecimal(value)))),
229
- base64: z4.base64().trim().nonempty(),
230
- base64url: z4.base64url().trim().nonempty(),
96
+ export const Zod4FakeUuidExport = z.object({
97
+ utf8: z.uuid().check(z.trim(), z.toLowerCase()),
98
+ hex: z.hex().check(z.trim(), z.toLowerCase(), z.length(32), z.regex(hexUuidRegex)),
99
+ base64: z.base64().check(z.trim(), z.minLength(1)),
100
+ base64url: z.base64url().check(z.trim(), z.minLength(1)),
231
101
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainfuse/types",
3
- "version": "2.12.1",
3
+ "version": "3.0.0",
4
4
  "description": "",
5
5
  "author": "ChainFuse",
6
6
  "homepage": "https://github.com/ChainFuse/packages/tree/main/packages/types#readme",
@@ -101,5 +101,5 @@
101
101
  "@cloudflare/workers-types": "^4.20250909.0",
102
102
  "@types/validator": "^13.15.3"
103
103
  },
104
- "gitHead": "4259cf9c169a4aced88159526927fe52bde6d658"
104
+ "gitHead": "a53477407bf7365156b75df30b94c9ad5d58bb53"
105
105
  }
@@ -1,7 +0,0 @@
1
- import { z as z3 } from 'zod/v3';
2
- import { z as z4 } from 'zod/v4';
3
- /**
4
- * @deprecated
5
- */
6
- export declare const ZodUuidExportInput3: z3.ZodUnion<[z3.ZodString, z3.ZodString, z3.ZodEffects<z3.ZodString, string, string>, z3.ZodString, z3.ZodString]>;
7
- export declare const ZodUuidExportInput: z4.ZodUnion<readonly [z4.ZodString, z4.ZodUUID, z4.ZodString, z4.ZodBase64, z4.ZodBase64URL]>;
package/dist/wf/index.js DELETED
@@ -1,45 +0,0 @@
1
- import { z as z3 } from 'zod/v3';
2
- import { z as z4 } from 'zod/v4';
3
- /**
4
- * @deprecated
5
- */
6
- export const ZodUuidExportInput3 = z3.union([
7
- // PrefixedUuid
8
- z3
9
- .string()
10
- .trim()
11
- .min(38)
12
- .max(40)
13
- .regex(new RegExp(/^((d|t|u)_)?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(_p)?$/i)),
14
- // utf-8
15
- z3.string().trim().nonempty().uuid(),
16
- // hex
17
- z3
18
- .string()
19
- .trim()
20
- .toLowerCase()
21
- .length(32)
22
- .refine((value) => import('validator/es/lib/isHexadecimal').then(({ default: isHexadecimal }) => isHexadecimal(value)).catch(() => import('validator').then(({ default: validator }) => validator.isHexadecimal(value)))),
23
- z3.string().trim().nonempty().base64(),
24
- z3.string().trim().nonempty().base64url(),
25
- ]);
26
- export const ZodUuidExportInput = z4.union([
27
- // PrefixedUuid
28
- z4
29
- .string()
30
- .trim()
31
- .min(38)
32
- .max(40)
33
- .regex(new RegExp(/^((d|t|u)_)?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(_p)?$/i)),
34
- // utf-8
35
- z4.uuid().trim().toLowerCase(),
36
- // hex
37
- z4
38
- .string()
39
- .trim()
40
- .toLowerCase()
41
- .length(32)
42
- .refine((value) => import('validator/es/lib/isHexadecimal').then(({ default: isHexadecimal }) => isHexadecimal(value)).catch(() => import('validator').then(({ default: validator }) => validator.isHexadecimal(value)))),
43
- z4.base64().trim().nonempty(),
44
- z4.base64url().trim().nonempty(),
45
- ]);