@chainfuse/types 3.0.7 → 4.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,5 +1,5 @@
1
1
  import * as z from 'zod/mini';
2
- import type { ZodCoordinate } from '../zod/index.js';
2
+ import type { ZodCoordinate } from '../zod-mini/index.js';
3
3
  import { type CloudflareFunctionModelsEnum, type CloudflareModelsEnum } from './workers-ai/index.js';
4
4
  export interface Coordinate {
5
5
  lat: z.infer<typeof ZodCoordinate>;
@@ -170,7 +170,6 @@ export declare const ZodImageModelValues: z.ZodMiniEnum<{
170
170
  export type ImageModelValues = z.infer<typeof ZodImageModelValues>;
171
171
  export declare const ZodTextEmbeddingModelValues: z.ZodMiniEnum<{
172
172
  "workersai:@cf/baai/bge-m3": "workersai:@cf/baai/bge-m3";
173
- "workersai:@cf/baai/omni-bge-m3": "workersai:@cf/baai/omni-bge-m3";
174
173
  "workersai:@cf/baai/bge-small-en-v1.5": "workersai:@cf/baai/bge-small-en-v1.5";
175
174
  "workersai:@cf/baai/bge-base-en-v1.5": "workersai:@cf/baai/bge-base-en-v1.5";
176
175
  "workersai:@cf/google/embeddinggemma-300m": "workersai:@cf/google/embeddinggemma-300m";
@@ -815,16 +815,6 @@ export declare const workersAiCatalog: {
815
815
  readonly currency: "USD";
816
816
  }];
817
817
  };
818
- }, {
819
- readonly id: "e93e59ea-73d0-47dd-b0e1-469c6bda37c1";
820
- readonly source: 1;
821
- readonly name: "@cf/baai/omni-bge-m3";
822
- readonly description: "Multi-Functionality, Multi-Linguality, and Multi-Granularity embeddings model.";
823
- readonly created_at: "2025-09-01 15:23:18.431";
824
- readonly tags: readonly [];
825
- readonly properties: {
826
- readonly async_queue: true;
827
- };
828
818
  }, {
829
819
  readonly id: "57fbd08a-a4c4-411c-910d-b9459ff36c20";
830
820
  readonly source: 1;
@@ -930,17 +930,6 @@ export const workersAiCatalog = {
930
930
  ],
931
931
  },
932
932
  },
933
- {
934
- id: 'e93e59ea-73d0-47dd-b0e1-469c6bda37c1',
935
- source: 1,
936
- name: '@cf/baai/omni-bge-m3',
937
- description: 'Multi-Functionality, Multi-Linguality, and Multi-Granularity embeddings model.',
938
- created_at: '2025-09-01 15:23:18.431',
939
- tags: [],
940
- properties: {
941
- async_queue: true,
942
- },
943
- },
944
933
  {
945
934
  id: '57fbd08a-a4c4-411c-910d-b9459ff36c20',
946
935
  source: 1,
@@ -0,0 +1,34 @@
1
+ import type { infer as zInfer, ZodJSONSchema } from 'zod/v4';
2
+ import { z } from 'zod/v4';
3
+ export type JSON = zInfer<ZodJSONSchema>;
4
+ export declare const WorkflowId: z.ZodString;
5
+ export declare const DoId: z.ZodCustomStringFormat<"hex">;
6
+ export declare const ZodCoordinate: z.ZodString;
7
+ export declare const PrefixedUuidRaw: z.ZodString;
8
+ export declare const PrefixedUuid7Raw: z.ZodString;
9
+ export declare const PrefixedUuid8Raw: z.ZodString;
10
+ export declare const PrefixedUuid: z.ZodPipe<z.ZodString, z.ZodTransform<{
11
+ type: "dataspace" | "tenant" | "user";
12
+ value: string;
13
+ preview: boolean;
14
+ }, string>>;
15
+ export declare const PrefixedUuid7: z.ZodPipe<z.ZodString, z.ZodTransform<{
16
+ type: "dataspace" | "tenant" | "user";
17
+ value: string;
18
+ preview: boolean;
19
+ }, string>>;
20
+ export declare const PrefixedUuid8: z.ZodPipe<z.ZodString, z.ZodTransform<{
21
+ type: "dataspace" | "tenant" | "user";
22
+ value: string;
23
+ preview: boolean;
24
+ }, string>>;
25
+ export declare const ZodUuid: z.ZodUnion<readonly [z.ZodString, z.ZodUUID, z.ZodCustomStringFormat<"hex">, z.ZodBase64, z.ZodBase64URL]>;
26
+ export declare const ZodUuid4: z.ZodUnion<readonly [z.ZodUUID, z.ZodCustomStringFormat<"hex">, z.ZodBase64, z.ZodBase64URL]>;
27
+ export declare const ZodUuid7: z.ZodUnion<readonly [z.ZodString, z.ZodUUID, z.ZodCustomStringFormat<"hex">, z.ZodBase64, z.ZodBase64URL]>;
28
+ export declare const ZodUuid8: z.ZodUnion<readonly [z.ZodString, z.ZodUUID, z.ZodCustomStringFormat<"hex">, z.ZodBase64, z.ZodBase64URL]>;
29
+ export declare const Zod4FakeUuidExport: z.ZodObject<{
30
+ utf8: z.ZodUUID;
31
+ hex: z.ZodCustomStringFormat<"hex">;
32
+ base64: z.ZodBase64;
33
+ base64url: z.ZodBase64URL;
34
+ }, z.core.$strip>;
@@ -0,0 +1,108 @@
1
+ import { z } from 'zod/v4';
2
+ import { hexUuid4Regex, hexUuid7Regex, hexUuid8Regex, hexUuidRegex, prefixedUuid7Regex, prefixedUuid8Regex, prefixedUuidRegex } from '../zod-mini/index.js';
3
+ export const WorkflowId = z
4
+ .string()
5
+ .trim()
6
+ .max(64)
7
+ /**
8
+ * @link https://developers.cloudflare.com/workflows/reference/limits/
9
+ */
10
+ .regex(/^[a-zA-Z0-9_][a-zA-Z0-9-_]*$/);
11
+ export const DoId = z.hex().trim().length(64).toLowerCase();
12
+ export const ZodCoordinate = z
13
+ .string()
14
+ .trim()
15
+ .min(3)
16
+ .regex(new RegExp(/^-?\d+\.\d+$/i));
17
+ export const PrefixedUuidRaw = z.string().trim().toLowerCase().min(38).max(40).regex(prefixedUuidRegex);
18
+ export const PrefixedUuid7Raw = z.string().trim().toLowerCase().min(38).max(40).regex(prefixedUuid7Regex);
19
+ export const PrefixedUuid8Raw = z.string().trim().toLowerCase().min(38).max(40).regex(prefixedUuid8Regex);
20
+ export const PrefixedUuid = PrefixedUuidRaw.transform((value) => {
21
+ let type;
22
+ if (value.startsWith('d_')) {
23
+ type = 'dataspace';
24
+ }
25
+ else if (value.startsWith('t_')) {
26
+ type = 'tenant';
27
+ }
28
+ else if (value.startsWith('u_')) {
29
+ type = 'user';
30
+ }
31
+ else {
32
+ throw new Error('Invalid UUID prefix');
33
+ }
34
+ return { type, value, preview: value.endsWith('_p') };
35
+ });
36
+ export const PrefixedUuid7 = PrefixedUuid7Raw.transform((value) => {
37
+ let type;
38
+ if (value.startsWith('d_')) {
39
+ type = 'dataspace';
40
+ }
41
+ else if (value.startsWith('t_')) {
42
+ type = 'tenant';
43
+ }
44
+ else if (value.startsWith('u_')) {
45
+ type = 'user';
46
+ }
47
+ else {
48
+ throw new Error('Invalid UUID prefix');
49
+ }
50
+ return { type, value, preview: value.endsWith('_p') };
51
+ });
52
+ export const PrefixedUuid8 = PrefixedUuid8Raw.transform((value) => {
53
+ let type;
54
+ if (value.startsWith('d_')) {
55
+ type = 'dataspace';
56
+ }
57
+ else if (value.startsWith('t_')) {
58
+ type = 'tenant';
59
+ }
60
+ else if (value.startsWith('u_')) {
61
+ type = 'user';
62
+ }
63
+ else {
64
+ throw new Error('Invalid UUID prefix');
65
+ }
66
+ return { type, value, preview: value.endsWith('_p') };
67
+ });
68
+ export const ZodUuid = z.union([
69
+ PrefixedUuidRaw,
70
+ // utf-8
71
+ z.uuid().trim().toLowerCase(),
72
+ // hex
73
+ z.hex().trim().toLowerCase().length(32).regex(hexUuidRegex),
74
+ z.base64().trim().nonempty(),
75
+ z.base64url().trim().nonempty(),
76
+ ]);
77
+ export const ZodUuid4 = z.union([
78
+ // utf-8
79
+ z.uuidv4().trim().toLowerCase(),
80
+ // hex
81
+ z.hex().trim().toLowerCase().length(32).regex(hexUuid4Regex),
82
+ z.base64().trim().nonempty(),
83
+ z.base64url().trim().nonempty(),
84
+ ]);
85
+ export const ZodUuid7 = z.union([
86
+ PrefixedUuid7Raw,
87
+ // utf-8
88
+ z.uuidv7().trim().toLowerCase(),
89
+ // hex
90
+ z.hex().trim().toLowerCase().length(32).regex(hexUuid7Regex),
91
+ z.base64().trim().nonempty(),
92
+ z.base64url().trim().nonempty(),
93
+ ]);
94
+ export const ZodUuid8 = z.union([
95
+ PrefixedUuid8Raw,
96
+ // utf-8
97
+ z.uuid({ version: 'v8' }).trim().toLowerCase(),
98
+ // hex
99
+ z.hex().trim().toLowerCase().length(32).regex(hexUuid8Regex),
100
+ z.base64().trim().nonempty(),
101
+ z.base64url().trim().nonempty(),
102
+ ]);
103
+ export const Zod4FakeUuidExport = z.object({
104
+ utf8: z.uuid().trim().toLowerCase(),
105
+ hex: z.hex().trim().toLowerCase().length(32).regex(hexUuidRegex),
106
+ base64: z.base64().trim().nonempty(),
107
+ base64url: z.base64url().trim().nonempty(),
108
+ });
@@ -8,7 +8,16 @@ export type ZodPartial<T extends ZodMiniObject> = ZodMiniObject<{
8
8
  [k in keyof T['shape']]: ZodMiniOptional<T['shape'][k]>;
9
9
  }, T['_zod']['config']>;
10
10
  export type JSON = zInfer<ZodMiniJSONSchema>;
11
+ export declare const WorkflowId: z.ZodMiniString<string>;
12
+ export declare const DoId: z.ZodMiniCustomStringFormat<"hex">;
11
13
  export declare const ZodCoordinate: z.ZodMiniString<string>;
14
+ export declare const prefixedUuidRegex: RegExp;
15
+ export declare const hexUuidRegex: RegExp;
16
+ export declare const hexUuid4Regex: RegExp;
17
+ export declare const prefixedUuid7Regex: RegExp;
18
+ export declare const hexUuid7Regex: RegExp;
19
+ export declare const prefixedUuid8Regex: RegExp;
20
+ export declare const hexUuid8Regex: RegExp;
12
21
  export declare const PrefixedUuidRaw: z.ZodMiniString<string>;
13
22
  export declare const PrefixedUuid7Raw: z.ZodMiniString<string>;
14
23
  export declare const PrefixedUuid8Raw: z.ZodMiniString<string>;
@@ -1,12 +1,18 @@
1
1
  import * as z from 'zod/mini';
2
+ export const WorkflowId = z.string().check(z.trim(), z.maxLength(64),
3
+ /**
4
+ * @link https://developers.cloudflare.com/workflows/reference/limits/
5
+ */
6
+ z.regex(/^[a-zA-Z0-9_][a-zA-Z0-9-_]*$/));
7
+ export const DoId = z.hex().check(z.trim(), z.length(64), z.toLowerCase());
2
8
  export const ZodCoordinate = z.string().check(z.trim(), z.minLength(3), z.regex(new RegExp(/^-?\d+\.\d+$/i)));
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;
4
- const hexUuidRegex = /^[0-9a-f]{8}[0-9a-f]{4}[0-9a-f]{4}[0-9a-f]{4}[0-9a-f]{12}$/i;
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;
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;
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;
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;
9
+ export 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;
10
+ export const hexUuidRegex = /^[0-9a-f]{8}[0-9a-f]{4}[0-9a-f]{4}[0-9a-f]{4}[0-9a-f]{12}$/i;
11
+ export const hexUuid4Regex = /^[0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[0-9a-f]{4}[0-9a-f]{12}$/i;
12
+ export 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;
13
+ export const hexUuid7Regex = /^[0-9a-f]{8}[0-9a-f]{4}7[0-9a-f]{3}[0-9a-f]{4}[0-9a-f]{12}$/i;
14
+ export 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;
15
+ export 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
16
  export const PrefixedUuidRaw = z.string().check(z.trim(), z.toLowerCase(), z.minLength(38), z.maxLength(40), z.regex(prefixedUuidRegex));
11
17
  export const PrefixedUuid7Raw = z.string().check(z.trim(), z.toLowerCase(), z.minLength(38), z.maxLength(40), z.regex(prefixedUuid7Regex));
12
18
  export const PrefixedUuid8Raw = z.string().check(z.trim(), z.toLowerCase(), z.minLength(38), z.maxLength(40), z.regex(prefixedUuid8Regex));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainfuse/types",
3
- "version": "3.0.7",
3
+ "version": "4.0.0",
4
4
  "description": "",
5
5
  "author": "ChainFuse",
6
6
  "homepage": "https://github.com/ChainFuse/packages/tree/main/packages/types#readme",
@@ -87,9 +87,13 @@
87
87
  "import": "./dist/discourse/topic/index.js",
88
88
  "types": "./dist/discourse/topic/index.d.ts"
89
89
  },
90
- "./zod": {
91
- "import": "./dist/zod/index.js",
92
- "types": "./dist/zod/index.d.ts"
90
+ "./zod-mini": {
91
+ "import": "./dist/zod-mini/index.js",
92
+ "types": "./dist/zod-mini/index.d.ts"
93
+ },
94
+ "./zod-4": {
95
+ "import": "./dist/zod-4/index.js",
96
+ "types": "./dist/zod-4/index.d.ts"
93
97
  }
94
98
  },
95
99
  "prettier": "@demosjarco/prettier-config",
@@ -98,8 +102,8 @@
98
102
  "zod": "^4.1.8"
99
103
  },
100
104
  "devDependencies": {
101
- "@cloudflare/workers-types": "^4.20250910.0",
105
+ "@cloudflare/workers-types": "^4.20250913.0",
102
106
  "@types/validator": "^13.15.3"
103
107
  },
104
- "gitHead": "eed5adc4e9741ed850e44da694069c0a031b2d05"
108
+ "gitHead": "024d8452ccb2992f76e33377742270639c53b7e9"
105
109
  }