@chainfuse/types 4.0.0 → 4.0.2

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.
@@ -118,7 +118,6 @@ export declare const ZodLanguageModelValues: z.ZodMiniEnum<{
118
118
  "workersai:@cf/meta/llama-3.2-11b-vision-instruct": "workersai:@cf/meta/llama-3.2-11b-vision-instruct";
119
119
  "workersai:@cf/defog/sqlcoder-7b-2": "workersai:@cf/defog/sqlcoder-7b-2";
120
120
  "workersai:@cf/microsoft/phi-2": "workersai:@cf/microsoft/phi-2";
121
- "workersai:@hf/meta-llama/meta-llama-3-8b-instruct": "workersai:@hf/meta-llama/meta-llama-3-8b-instruct";
122
121
  "workersai:@cf/openai/gpt-oss-20b": "workersai:@cf/openai/gpt-oss-20b";
123
122
  "workersai:@hf/google/gemma-7b-it": "workersai:@hf/google/gemma-7b-it";
124
123
  "workersai:@cf/qwen/qwen1.5-14b-chat-awq": "workersai:@cf/qwen/qwen1.5-14b-chat-awq";
@@ -663,16 +663,6 @@ export declare const workersAiCatalog: {
663
663
  readonly context_window: 2048;
664
664
  readonly info: "https://huggingface.co/microsoft/phi-2";
665
665
  };
666
- }, {
667
- readonly id: "1a7b6ad6-9987-4bd3-a329-20ee8de93296";
668
- readonly source: 2;
669
- readonly name: "@hf/meta-llama/meta-llama-3-8b-instruct";
670
- readonly description: "Generation over generation, Meta Llama 3 demonstrates state-of-the-art performance on a wide range of industry benchmarks and offers new capabilities, including improved reasoning.\t";
671
- readonly created_at: "2024-05-22 18:21:04.371";
672
- readonly tags: readonly [];
673
- readonly properties: {
674
- readonly context_window: 8192;
675
- };
676
666
  }, {
677
667
  readonly id: "188a4e1e-253e-46d0-9616-0bf8c149763f";
678
668
  readonly source: 1;
@@ -754,17 +754,6 @@ export const workersAiCatalog = {
754
754
  info: 'https://huggingface.co/microsoft/phi-2',
755
755
  },
756
756
  },
757
- {
758
- id: '1a7b6ad6-9987-4bd3-a329-20ee8de93296',
759
- source: 2,
760
- name: '@hf/meta-llama/meta-llama-3-8b-instruct',
761
- description: 'Generation over generation, Meta Llama 3 demonstrates state-of-the-art performance on a wide range of industry benchmarks and offers new capabilities, including improved reasoning.\t',
762
- created_at: '2024-05-22 18:21:04.371',
763
- tags: [],
764
- properties: {
765
- context_window: 8192,
766
- },
767
- },
768
757
  {
769
758
  id: '188a4e1e-253e-46d0-9616-0bf8c149763f',
770
759
  source: 1,
@@ -1,5 +1,32 @@
1
1
  export type D0Blob = [number, ...number[]];
2
- export declare enum ShardType {
3
- Director = 0,
2
+ export declare enum D0Version {
3
+ v1 = 1
4
+ }
5
+ export declare enum D0SystemType {
6
+ Dataspace = 1,
7
+ Tenant = 2,
8
+ User = 3,
9
+ Workflow = 4
10
+ }
11
+ export declare enum D0CombinedLocations {
12
+ none = 0,
13
+ eu = 1,
14
+ fedramp = 2,
15
+ wnam = 10,
16
+ enam = 11,
17
+ sam = 12,
18
+ weur = 13,
19
+ eeur = 14,
20
+ apac = 15,
21
+ oc = 16,
22
+ afr = 17,
23
+ me = 18
24
+ }
25
+ export declare enum D0ShardType {
26
+ None = 0,
4
27
  Storage = 1
5
28
  }
29
+ export declare enum D0Environment {
30
+ Production = 0,
31
+ Preview = 1
32
+ }
package/dist/d0/index.js CHANGED
@@ -1,5 +1,36 @@
1
- export var ShardType;
2
- (function (ShardType) {
3
- ShardType[ShardType["Director"] = 0] = "Director";
4
- ShardType[ShardType["Storage"] = 1] = "Storage";
5
- })(ShardType || (ShardType = {}));
1
+ export var D0Version;
2
+ (function (D0Version) {
3
+ D0Version[D0Version["v1"] = 1] = "v1";
4
+ })(D0Version || (D0Version = {}));
5
+ export var D0SystemType;
6
+ (function (D0SystemType) {
7
+ D0SystemType[D0SystemType["Dataspace"] = 1] = "Dataspace";
8
+ D0SystemType[D0SystemType["Tenant"] = 2] = "Tenant";
9
+ D0SystemType[D0SystemType["User"] = 3] = "User";
10
+ D0SystemType[D0SystemType["Workflow"] = 4] = "Workflow";
11
+ })(D0SystemType || (D0SystemType = {}));
12
+ export var D0CombinedLocations;
13
+ (function (D0CombinedLocations) {
14
+ D0CombinedLocations[D0CombinedLocations["none"] = 0] = "none";
15
+ D0CombinedLocations[D0CombinedLocations["eu"] = 1] = "eu";
16
+ D0CombinedLocations[D0CombinedLocations["fedramp"] = 2] = "fedramp";
17
+ D0CombinedLocations[D0CombinedLocations["wnam"] = 10] = "wnam";
18
+ D0CombinedLocations[D0CombinedLocations["enam"] = 11] = "enam";
19
+ D0CombinedLocations[D0CombinedLocations["sam"] = 12] = "sam";
20
+ D0CombinedLocations[D0CombinedLocations["weur"] = 13] = "weur";
21
+ D0CombinedLocations[D0CombinedLocations["eeur"] = 14] = "eeur";
22
+ D0CombinedLocations[D0CombinedLocations["apac"] = 15] = "apac";
23
+ D0CombinedLocations[D0CombinedLocations["oc"] = 16] = "oc";
24
+ D0CombinedLocations[D0CombinedLocations["afr"] = 17] = "afr";
25
+ D0CombinedLocations[D0CombinedLocations["me"] = 18] = "me";
26
+ })(D0CombinedLocations || (D0CombinedLocations = {}));
27
+ export var D0ShardType;
28
+ (function (D0ShardType) {
29
+ D0ShardType[D0ShardType["None"] = 0] = "None";
30
+ D0ShardType[D0ShardType["Storage"] = 1] = "Storage";
31
+ })(D0ShardType || (D0ShardType = {}));
32
+ export var D0Environment;
33
+ (function (D0Environment) {
34
+ D0Environment[D0Environment["Production"] = 0] = "Production";
35
+ D0Environment[D0Environment["Preview"] = 1] = "Preview";
36
+ })(D0Environment || (D0Environment = {}));
@@ -1,7 +1,5 @@
1
1
  import type { Buffer } from 'node:buffer';
2
2
  import * as z from 'zod/mini';
3
- import { ShardType } from '../d0/index.js';
4
- import { DOCombinedLocations } from '../index.js';
5
3
  export type PrefixedUuid = `${'t_' | 'd_' | 'u_'}${UuidExport['utf8']}${'' | '_p'}`;
6
4
  export interface UuidExport {
7
5
  utf8: ReturnType<typeof crypto.randomUUID>;
@@ -13,17 +11,7 @@ export interface UuidExport {
13
11
  export declare const UUIDExtract7: z.ZodMiniObject<{
14
12
  date: z.ZodMiniDate<unknown>;
15
13
  }, z.core.$strip>;
16
- export declare const UUIDExtract8: z.ZodMiniObject<{
17
- date: z.ZodMiniDate<unknown>;
18
- location: z.ZodMiniEnum<typeof DOCombinedLocations>;
19
- shardType: z.ZodMiniEnum<typeof ShardType>;
20
- suffix: z.ZodMiniOptional<z.ZodMiniObject<{
21
- hex: z.ZodMiniCustomStringFormat<"hex">;
22
- base64: z.ZodMiniBase64;
23
- base64url: z.ZodMiniBase64URL;
24
- }, z.core.$strip>>;
25
- }, z.core.$strip>;
26
- export type UUIDExtract = z.output<typeof UUIDExtract7> | z.output<typeof UUIDExtract8>;
14
+ export type UUIDExtract = z.output<typeof UUIDExtract7>;
27
15
  export type ISODateString = `${number}-${number}-${number}T${number}:${number}:${number}.${number}Z`;
28
16
  /**
29
17
  * Represents a cron expression string (in UTC time).
package/dist/d1/index.js CHANGED
@@ -1,15 +1,4 @@
1
1
  import * as z from 'zod/mini';
2
- import { ShardType } from '../d0/index.js';
3
- import { DOCombinedLocations } from '../index.js';
4
2
  export const UUIDExtract7 = z.object({
5
3
  date: z.coerce.date(),
6
4
  });
7
- export const UUIDExtract8 = z.extend(UUIDExtract7, {
8
- location: z.enum(DOCombinedLocations),
9
- shardType: z.enum(ShardType),
10
- suffix: z.optional(z.object({
11
- hex: z.hex().check(z.length(3)),
12
- base64: z.base64(),
13
- base64url: z.base64url(),
14
- })),
15
- });
package/dist/index.d.ts CHANGED
@@ -69,18 +69,4 @@ export declare enum DOLocations {
69
69
  'Africa' = "afr",
70
70
  'Middle East' = "me"
71
71
  }
72
- export declare enum DOCombinedLocations {
73
- none = 0,
74
- eu = 1,
75
- fedramp = 2,
76
- wnam = 10,
77
- enam = 11,
78
- sam = 12,
79
- weur = 13,
80
- eeur = 14,
81
- apac = 15,
82
- oc = 16,
83
- afr = 17,
84
- me = 18
85
- }
86
72
  export {};
package/dist/index.js CHANGED
@@ -21,18 +21,3 @@ export var DOLocations;
21
21
  DOLocations["Africa"] = "afr";
22
22
  DOLocations["Middle East"] = "me";
23
23
  })(DOLocations || (DOLocations = {}));
24
- export var DOCombinedLocations;
25
- (function (DOCombinedLocations) {
26
- DOCombinedLocations[DOCombinedLocations["none"] = 0] = "none";
27
- DOCombinedLocations[DOCombinedLocations["eu"] = 1] = "eu";
28
- DOCombinedLocations[DOCombinedLocations["fedramp"] = 2] = "fedramp";
29
- DOCombinedLocations[DOCombinedLocations["wnam"] = 10] = "wnam";
30
- DOCombinedLocations[DOCombinedLocations["enam"] = 11] = "enam";
31
- DOCombinedLocations[DOCombinedLocations["sam"] = 12] = "sam";
32
- DOCombinedLocations[DOCombinedLocations["weur"] = 13] = "weur";
33
- DOCombinedLocations[DOCombinedLocations["eeur"] = 14] = "eeur";
34
- DOCombinedLocations[DOCombinedLocations["apac"] = 15] = "apac";
35
- DOCombinedLocations[DOCombinedLocations["oc"] = 16] = "oc";
36
- DOCombinedLocations[DOCombinedLocations["afr"] = 17] = "afr";
37
- DOCombinedLocations[DOCombinedLocations["me"] = 18] = "me";
38
- })(DOCombinedLocations || (DOCombinedLocations = {}));
@@ -4,9 +4,10 @@ export type JSON = zInfer<ZodJSONSchema>;
4
4
  export declare const WorkflowId: z.ZodString;
5
5
  export declare const DoId: z.ZodCustomStringFormat<"hex">;
6
6
  export declare const ZodCoordinate: z.ZodString;
7
+ export declare const ZodBlob: z.ZodUnion<readonly [z.ZodPipe<z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>, z.ZodTransform<Uint8Array<ArrayBuffer>, Buffer<ArrayBufferLike>>>, z.ZodPipe<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z.ZodTransform<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBuffer>>>, z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodCustom<ArrayBuffer, ArrayBuffer>, z.ZodTransform<ArrayBuffer | SharedArrayBuffer, ArrayBuffer>>, z.ZodPipe<z.ZodCustom<SharedArrayBuffer, SharedArrayBuffer>, z.ZodTransform<ArrayBuffer | SharedArrayBuffer, SharedArrayBuffer>>]>, z.ZodTransform<Uint8Array<ArrayBuffer | SharedArrayBuffer>, ArrayBuffer | SharedArrayBuffer>>, z.ZodPipe<z.ZodTuple<[z.ZodInt], z.ZodInt>, z.ZodTransform<Uint8Array<ArrayBuffer>, [number, ...number[]]>>]>;
8
+ export declare const ZodBlobExport: z.ZodPipe<z.ZodTuple<[z.ZodInt], z.ZodInt>, z.ZodTransform<Uint8Array<ArrayBuffer>, [number, ...number[]]>>;
7
9
  export declare const PrefixedUuidRaw: z.ZodString;
8
10
  export declare const PrefixedUuid7Raw: z.ZodString;
9
- export declare const PrefixedUuid8Raw: z.ZodString;
10
11
  export declare const PrefixedUuid: z.ZodPipe<z.ZodString, z.ZodTransform<{
11
12
  type: "dataspace" | "tenant" | "user";
12
13
  value: string;
@@ -17,18 +18,13 @@ export declare const PrefixedUuid7: z.ZodPipe<z.ZodString, z.ZodTransform<{
17
18
  value: string;
18
19
  preview: boolean;
19
20
  }, 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
21
  export declare const ZodUuid: z.ZodUnion<readonly [z.ZodString, z.ZodUUID, z.ZodCustomStringFormat<"hex">, z.ZodBase64, z.ZodBase64URL]>;
26
22
  export declare const ZodUuid4: z.ZodUnion<readonly [z.ZodUUID, z.ZodCustomStringFormat<"hex">, z.ZodBase64, z.ZodBase64URL]>;
27
23
  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
24
  export declare const Zod4FakeUuidExport: z.ZodObject<{
30
25
  utf8: z.ZodUUID;
31
26
  hex: z.ZodCustomStringFormat<"hex">;
32
27
  base64: z.ZodBase64;
33
28
  base64url: z.ZodBase64URL;
34
29
  }, z.core.$strip>;
30
+ export declare const ZodSuruId: z.ZodUnion<readonly [z.ZodCustomStringFormat<"hex">, z.ZodBase64, z.ZodBase64URL]>;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod/v4';
2
- import { hexUuid4Regex, hexUuid7Regex, hexUuid8Regex, hexUuidRegex, prefixedUuid7Regex, prefixedUuid8Regex, prefixedUuidRegex } from '../zod-mini/index.js';
2
+ import { hexUuid4Regex, hexUuid7Regex, hexUuidRegex, prefixedUuid7Regex, prefixedUuidRegex } from '../zod-mini/index.js';
3
3
  export const WorkflowId = z
4
4
  .string()
5
5
  .trim()
@@ -14,9 +14,25 @@ export const ZodCoordinate = z
14
14
  .trim()
15
15
  .min(3)
16
16
  .regex(new RegExp(/^-?\d+\.\d+$/i));
17
+ export const ZodBlob = z.union([
18
+ // Literal `node:buffer` type
19
+ z.instanceof(Buffer).transform((b) => new Uint8Array(b)),
20
+ // Uint8Array
21
+ z.instanceof(Uint8Array).transform((ui8a) => ui8a),
22
+ // ArrayBuffer
23
+ z
24
+ .union([
25
+ // Each one has to be manually specified
26
+ z.instanceof(ArrayBuffer).transform((ab) => ab),
27
+ z.instanceof(SharedArrayBuffer).transform((sab) => sab),
28
+ ])
29
+ .transform((abl) => new Uint8Array(abl)),
30
+ // D0Blob
31
+ z.tuple([z.int().min(0).max(255)], z.int().min(0).max(255)).transform((arr) => new Uint8Array(arr)),
32
+ ]);
33
+ export const ZodBlobExport = z.tuple([z.int().min(0).max(255)], z.int().min(0).max(255)).transform((arr) => new Uint8Array(arr));
17
34
  export const PrefixedUuidRaw = z.string().trim().toLowerCase().min(38).max(40).regex(prefixedUuidRegex);
18
35
  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
36
  export const PrefixedUuid = PrefixedUuidRaw.transform((value) => {
21
37
  let type;
22
38
  if (value.startsWith('d_')) {
@@ -49,22 +65,6 @@ export const PrefixedUuid7 = PrefixedUuid7Raw.transform((value) => {
49
65
  }
50
66
  return { type, value, preview: value.endsWith('_p') };
51
67
  });
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
68
  export const ZodUuid = z.union([
69
69
  PrefixedUuidRaw,
70
70
  // utf-8
@@ -91,18 +91,15 @@ export const ZodUuid7 = z.union([
91
91
  z.base64().trim().nonempty(),
92
92
  z.base64url().trim().nonempty(),
93
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
94
  export const Zod4FakeUuidExport = z.object({
104
95
  utf8: z.uuid().trim().toLowerCase(),
105
96
  hex: z.hex().trim().toLowerCase().length(32).regex(hexUuidRegex),
106
97
  base64: z.base64().trim().nonempty(),
107
98
  base64url: z.base64url().trim().nonempty(),
108
99
  });
100
+ export const ZodSuruId = z.union([
101
+ //
102
+ z.hex().trim().toLowerCase().length(96),
103
+ z.base64().trim().max(64),
104
+ z.base64url().trim().max(64),
105
+ ]);
@@ -11,16 +11,15 @@ export type JSON = zInfer<ZodMiniJSONSchema>;
11
11
  export declare const WorkflowId: z.ZodMiniString<string>;
12
12
  export declare const DoId: z.ZodMiniCustomStringFormat<"hex">;
13
13
  export declare const ZodCoordinate: z.ZodMiniString<string>;
14
+ export declare const ZodBlob: z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>, z.ZodMiniTransform<Uint8Array<ArrayBufferLike>, Buffer<ArrayBufferLike>>>, z.ZodMiniPipe<z.ZodMiniCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z.ZodMiniTransform<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBuffer>>>, z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniCustom<ArrayBuffer, ArrayBuffer>, z.ZodMiniTransform<ArrayBufferLike, ArrayBuffer>>, z.ZodMiniPipe<z.ZodMiniCustom<SharedArrayBuffer, SharedArrayBuffer>, z.ZodMiniTransform<ArrayBufferLike, SharedArrayBuffer>>]>, z.ZodMiniTransform<Uint8Array<ArrayBufferLike>, ArrayBufferLike>>, z.ZodMiniPipe<z.ZodMiniTuple<readonly [z.ZodMiniNumberFormat], z.ZodMiniNumberFormat>, z.ZodMiniTransform<Uint8Array<ArrayBufferLike>, [number, ...number[]]>>]>;
15
+ export declare const ZodBlobExport: z.ZodMiniTuple<readonly [z.ZodMiniNumberFormat], z.ZodMiniNumberFormat>;
14
16
  export declare const prefixedUuidRegex: RegExp;
15
17
  export declare const hexUuidRegex: RegExp;
16
18
  export declare const hexUuid4Regex: RegExp;
17
19
  export declare const prefixedUuid7Regex: RegExp;
18
20
  export declare const hexUuid7Regex: RegExp;
19
- export declare const prefixedUuid8Regex: RegExp;
20
- export declare const hexUuid8Regex: RegExp;
21
21
  export declare const PrefixedUuidRaw: z.ZodMiniString<string>;
22
22
  export declare const PrefixedUuid7Raw: z.ZodMiniString<string>;
23
- export declare const PrefixedUuid8Raw: z.ZodMiniString<string>;
24
23
  export declare const PrefixedUuid: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<{
25
24
  type: "dataspace" | "tenant" | "user";
26
25
  value: string;
@@ -31,18 +30,13 @@ export declare const PrefixedUuid7: z.ZodMiniPipe<z.ZodMiniString<string>, z.Zod
31
30
  value: string;
32
31
  preview: boolean;
33
32
  }, string>>;
34
- export declare const PrefixedUuid8: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<{
35
- type: "dataspace" | "tenant" | "user";
36
- value: string;
37
- preview: boolean;
38
- }, string>>;
39
33
  export declare const ZodUuid: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniUUID, z.ZodMiniCustomStringFormat<"hex">, z.ZodMiniBase64, z.ZodMiniBase64URL]>;
40
34
  export declare const ZodUuid4: z.ZodMiniUnion<readonly [z.ZodMiniUUID, z.ZodMiniCustomStringFormat<"hex">, z.ZodMiniBase64, z.ZodMiniBase64URL]>;
41
35
  export declare const ZodUuid7: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniUUID, z.ZodMiniCustomStringFormat<"hex">, z.ZodMiniBase64, z.ZodMiniBase64URL]>;
42
- export declare const ZodUuid8: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniUUID, z.ZodMiniCustomStringFormat<"hex">, z.ZodMiniBase64, z.ZodMiniBase64URL]>;
43
36
  export declare const Zod4FakeUuidExport: ZodMiniObject<{
44
37
  utf8: z.ZodMiniUUID;
45
38
  hex: z.ZodMiniCustomStringFormat<"hex">;
46
39
  base64: z.ZodMiniBase64;
47
40
  base64url: z.ZodMiniBase64URL;
48
41
  }, z.core.$strip>;
42
+ export declare const ZodSuruId: z.ZodMiniUnion<readonly [z.ZodMiniCustomStringFormat<"hex">, z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>, z.ZodMiniTransform<Uint8Array<ArrayBufferLike>, Buffer<ArrayBufferLike>>>, z.ZodMiniPipe<z.ZodMiniCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z.ZodMiniTransform<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBuffer>>>, z.ZodMiniPipe<z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniCustom<ArrayBuffer, ArrayBuffer>, z.ZodMiniTransform<ArrayBufferLike, ArrayBuffer>>, z.ZodMiniPipe<z.ZodMiniCustom<SharedArrayBuffer, SharedArrayBuffer>, z.ZodMiniTransform<ArrayBufferLike, SharedArrayBuffer>>]>, z.ZodMiniTransform<Uint8Array<ArrayBufferLike>, ArrayBufferLike>>, z.ZodMiniPipe<z.ZodMiniTuple<readonly [z.ZodMiniNumberFormat], z.ZodMiniNumberFormat>, z.ZodMiniTransform<Uint8Array<ArrayBufferLike>, [number, ...number[]]>>]>, z.ZodMiniBase64, z.ZodMiniBase64URL]>;
@@ -6,16 +6,28 @@ export const WorkflowId = z.string().check(z.trim(), z.maxLength(64),
6
6
  z.regex(/^[a-zA-Z0-9_][a-zA-Z0-9-_]*$/));
7
7
  export const DoId = z.hex().check(z.trim(), z.length(64), z.toLowerCase());
8
8
  export const ZodCoordinate = z.string().check(z.trim(), z.minLength(3), z.regex(new RegExp(/^-?\d+\.\d+$/i)));
9
+ export const ZodBlob = z.union([
10
+ // Literal `node:buffer` type
11
+ z.pipe(z.instanceof(Buffer), z.transform((b) => new Uint8Array(b))),
12
+ // Uint8Array
13
+ z.pipe(z.instanceof(Uint8Array), z.transform((ui8a) => ui8a)),
14
+ // ArrayBuffer
15
+ z.pipe(z.union([
16
+ // Each one has to be manually specified
17
+ z.pipe(z.instanceof(ArrayBuffer), z.transform((ab) => ab)),
18
+ z.pipe(z.instanceof(SharedArrayBuffer), z.transform((sab) => sab)),
19
+ ]), z.transform((abl) => new Uint8Array(abl))),
20
+ // D0Blob
21
+ z.pipe(z.tuple([z.int().check(z.minimum(0), z.maximum(255))], z.int().check(z.minimum(0), z.maximum(255))), z.transform((arr) => new Uint8Array(arr))),
22
+ ]);
23
+ export const ZodBlobExport = z.tuple([z.int().check(z.minimum(0), z.maximum(255))], z.int().check(z.minimum(0), z.maximum(255)));
9
24
  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
25
  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
26
  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
27
  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
28
  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;
16
29
  export const PrefixedUuidRaw = z.string().check(z.trim(), z.toLowerCase(), z.minLength(38), z.maxLength(40), z.regex(prefixedUuidRegex));
17
30
  export const PrefixedUuid7Raw = z.string().check(z.trim(), z.toLowerCase(), z.minLength(38), z.maxLength(40), z.regex(prefixedUuid7Regex));
18
- export const PrefixedUuid8Raw = z.string().check(z.trim(), z.toLowerCase(), z.minLength(38), z.maxLength(40), z.regex(prefixedUuid8Regex));
19
31
  export const PrefixedUuid = z.pipe(PrefixedUuidRaw, z.transform((value) => {
20
32
  let type;
21
33
  if (value.startsWith('d_')) {
@@ -48,22 +60,6 @@ export const PrefixedUuid7 = z.pipe(PrefixedUuid7Raw, z.transform((value) => {
48
60
  }
49
61
  return { type, value, preview: value.endsWith('_p') };
50
62
  }));
51
- export const PrefixedUuid8 = z.pipe(PrefixedUuid8Raw, z.transform((value) => {
52
- let type;
53
- if (value.startsWith('d_')) {
54
- type = 'dataspace';
55
- }
56
- else if (value.startsWith('t_')) {
57
- type = 'tenant';
58
- }
59
- else if (value.startsWith('u_')) {
60
- type = 'user';
61
- }
62
- else {
63
- throw new Error('Invalid UUID prefix');
64
- }
65
- return { type, value, preview: value.endsWith('_p') };
66
- }));
67
63
  export const ZodUuid = z.union([
68
64
  PrefixedUuidRaw,
69
65
  // utf-8
@@ -90,18 +86,16 @@ export const ZodUuid7 = z.union([
90
86
  z.base64().check(z.trim(), z.minLength(1)),
91
87
  z.base64url().check(z.trim(), z.minLength(1)),
92
88
  ]);
93
- export const ZodUuid8 = z.union([
94
- PrefixedUuid8Raw,
95
- // utf-8
96
- z.uuid({ version: 'v8' }).check(z.trim(), z.toLowerCase()),
97
- // hex
98
- z.hex().check(z.trim(), z.toLowerCase(), z.length(32), z.regex(hexUuid8Regex)),
99
- z.base64().check(z.trim(), z.minLength(1)),
100
- z.base64url().check(z.trim(), z.minLength(1)),
101
- ]);
102
89
  export const Zod4FakeUuidExport = z.object({
103
90
  utf8: z.uuid().check(z.trim(), z.toLowerCase()),
104
91
  hex: z.hex().check(z.trim(), z.toLowerCase(), z.length(32), z.regex(hexUuidRegex)),
105
92
  base64: z.base64().check(z.trim(), z.minLength(1)),
106
93
  base64url: z.base64url().check(z.trim(), z.minLength(1)),
107
94
  });
95
+ export const ZodSuruId = z.union([
96
+ //
97
+ z.hex().check(z.trim(), z.toLowerCase(), z.length(96)),
98
+ ZodBlob,
99
+ z.base64().check(z.trim(), z.maxLength(64)),
100
+ z.base64url().check(z.trim(), z.maxLength(64)),
101
+ ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainfuse/types",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "",
5
5
  "author": "ChainFuse",
6
6
  "homepage": "https://github.com/ChainFuse/packages/tree/main/packages/types#readme",
@@ -99,11 +99,11 @@
99
99
  "prettier": "@demosjarco/prettier-config",
100
100
  "dependencies": {
101
101
  "validator": "^13.15.15",
102
- "zod": "^4.1.8"
102
+ "zod": "^4.1.11"
103
103
  },
104
104
  "devDependencies": {
105
- "@cloudflare/workers-types": "^4.20250913.0",
105
+ "@cloudflare/workers-types": "^4.20250923.0",
106
106
  "@types/validator": "^13.15.3"
107
107
  },
108
- "gitHead": "024d8452ccb2992f76e33377742270639c53b7e9"
108
+ "gitHead": "05efde182f25d567fb93baaa9eed558f794f3fb7"
109
109
  }