@chainfuse/types 2.6.0 → 2.8.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.
- package/dist/ai-tools/index.d.ts +8 -4
- package/dist/ai-tools/index.js +16 -0
- package/dist/d0/index.d.ts +2 -0
- package/dist/d0/index.js +24 -1
- package/dist/index.d.ts +4 -0
- package/dist/wf/index.js +1 -1
- package/package.json +2 -2
package/dist/ai-tools/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { EnumOrEnumLike } from '../index.js';
|
|
1
3
|
import { type CloudflareFunctionModelsEnum, type CloudflareModelsEnum } from './workers-ai/index.js';
|
|
2
4
|
export * from './azure/index.js';
|
|
3
5
|
export * from './workers-ai/index.js';
|
|
@@ -68,10 +70,12 @@ export declare namespace AiModels {
|
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
|
-
export
|
|
72
|
-
export type LanguageModelValues =
|
|
73
|
-
export
|
|
74
|
-
export type
|
|
73
|
+
export declare const ZodLanguageModelValues: z.ZodEnum<[EnumOrEnumLike<Readonly<CloudflareModelsEnum<"Text Generation">> | Readonly<CloudflareFunctionModelsEnum> | typeof AiModels.LanguageModels.Azure | typeof AiModels.LanguageModels.Anthropic | typeof AiModels.LanguageModels.GoogleGenerativeAi | typeof AiModels.LanguageModels.OpenAi>, ...EnumOrEnumLike<Readonly<CloudflareModelsEnum<"Text Generation">> | Readonly<CloudflareFunctionModelsEnum> | typeof AiModels.LanguageModels.Azure | typeof AiModels.LanguageModels.Anthropic | typeof AiModels.LanguageModels.GoogleGenerativeAi | typeof AiModels.LanguageModels.OpenAi>[]]>;
|
|
74
|
+
export type LanguageModelValues = z.infer<typeof ZodLanguageModelValues>;
|
|
75
|
+
export declare const ZodImageModelValues: z.ZodEnum<[EnumOrEnumLike<Readonly<CloudflareModelsEnum<"Text-to-Image">> | typeof AiModels.ImageModels.Azure | typeof AiModels.ImageModels.GoogleGenerativeAi | typeof AiModels.ImageModels.OpenAi>, ...EnumOrEnumLike<Readonly<CloudflareModelsEnum<"Text-to-Image">> | typeof AiModels.ImageModels.Azure | typeof AiModels.ImageModels.GoogleGenerativeAi | typeof AiModels.ImageModels.OpenAi>[]]>;
|
|
76
|
+
export type ImageModelValues = z.infer<typeof ZodImageModelValues>;
|
|
77
|
+
export declare const ZodTextEmbeddingModelValues: z.ZodEnum<[EnumOrEnumLike<Readonly<CloudflareModelsEnum<"Text Embeddings">> | typeof AiModels.TextEmbeddingModels.Azure | typeof AiModels.TextEmbeddingModels.GoogleGenerativeAi | typeof AiModels.TextEmbeddingModels.OpenAi>, ...EnumOrEnumLike<Readonly<CloudflareModelsEnum<"Text Embeddings">> | typeof AiModels.TextEmbeddingModels.Azure | typeof AiModels.TextEmbeddingModels.GoogleGenerativeAi | typeof AiModels.TextEmbeddingModels.OpenAi>[]]>;
|
|
78
|
+
export type TextEmbeddingModelValues = z.infer<typeof ZodTextEmbeddingModelValues>;
|
|
75
79
|
export declare const default_mc_generic: LanguageModelValues;
|
|
76
80
|
export declare const default_mc_summary: LanguageModelValues;
|
|
77
81
|
export declare const default_mc_extraction: LanguageModelValues;
|
package/dist/ai-tools/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import { enabledCloudflareLlmEmbeddingProviders, enabledCloudflareLlmFunctionProviders, enabledCloudflareLlmImageProviders, enabledCloudflareLlmProviders } from './workers-ai/index.js';
|
|
2
3
|
export * from './azure/index.js';
|
|
3
4
|
export * from './workers-ai/index.js';
|
|
@@ -80,6 +81,21 @@ export var AiModels;
|
|
|
80
81
|
})(OpenAi = TextEmbeddingModels.OpenAi || (TextEmbeddingModels.OpenAi = {}));
|
|
81
82
|
})(TextEmbeddingModels = AiModels.TextEmbeddingModels || (AiModels.TextEmbeddingModels = {}));
|
|
82
83
|
})(AiModels || (AiModels = {}));
|
|
84
|
+
const ZodLanguageModelValuesRaw = Object.entries(AiModels.LanguageModels).reduce((acc, [, value]) => {
|
|
85
|
+
acc.push(value);
|
|
86
|
+
return acc;
|
|
87
|
+
}, []);
|
|
88
|
+
export const ZodLanguageModelValues = z.enum(ZodLanguageModelValuesRaw);
|
|
89
|
+
const ZodImageModelValuesRaw = Object.entries(AiModels.ImageModels).reduce((acc, [, value]) => {
|
|
90
|
+
acc.push(value);
|
|
91
|
+
return acc;
|
|
92
|
+
}, []);
|
|
93
|
+
export const ZodImageModelValues = z.enum(ZodImageModelValuesRaw);
|
|
94
|
+
const ZodTextEmbeddingModelValuesRaw = Object.entries(AiModels.TextEmbeddingModels).reduce((acc, [, value]) => {
|
|
95
|
+
acc.push(value);
|
|
96
|
+
return acc;
|
|
97
|
+
}, []);
|
|
98
|
+
export const ZodTextEmbeddingModelValues = z.enum(ZodTextEmbeddingModelValuesRaw);
|
|
83
99
|
export const default_mc_generic = AiModels.LanguageModels.Azure.gpt4o_mini;
|
|
84
100
|
export const default_mc_summary = AiModels.LanguageModels.Azure.gpt4o;
|
|
85
101
|
export const default_mc_extraction = AiModels.LanguageModels.Azure.gpt4o_mini;
|
package/dist/d0/index.d.ts
CHANGED
package/dist/d0/index.js
CHANGED
|
@@ -1 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const ZodUuid = z.union([
|
|
3
|
+
// PrefixedUuid
|
|
4
|
+
z
|
|
5
|
+
.string()
|
|
6
|
+
.trim()
|
|
7
|
+
.min(38)
|
|
8
|
+
.max(40)
|
|
9
|
+
.regex(new RegExp(/^((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)),
|
|
10
|
+
// utf=8
|
|
11
|
+
z
|
|
12
|
+
.string()
|
|
13
|
+
.trim()
|
|
14
|
+
.uuid()
|
|
15
|
+
.refine((value) => import('validator/es/lib/isUUID').then(({ default: isUUID }) => isUUID(value, 7)).catch(() => import('validator').then(({ default: validator }) => validator.isUUID(value, 7)))),
|
|
16
|
+
// hex
|
|
17
|
+
z
|
|
18
|
+
.string()
|
|
19
|
+
.trim()
|
|
20
|
+
.length(32)
|
|
21
|
+
.refine((value) => import('validator/es/lib/isHexadecimal').then(({ default: isHexadecimal }) => isHexadecimal(value)).catch(() => import('validator').then(({ default: validator }) => validator.isHexadecimal(value)))),
|
|
22
|
+
z.string().trim().nonempty().base64(),
|
|
23
|
+
z.string().trim().nonempty().base64url(),
|
|
24
|
+
]);
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ export * from './ai-tools/index.js';
|
|
|
2
2
|
export * from './d0/index.js';
|
|
3
3
|
export * from './d1/index.js';
|
|
4
4
|
export * from './discourse/index.js';
|
|
5
|
+
export type EnumOrEnumLike<T> = T extends Record<string, infer V> ? V : T extends Readonly<Record<string, infer V>> ? V : never;
|
|
6
|
+
export type NamespaceEnumObject<T> = {
|
|
7
|
+
[K in keyof T as EnumOrEnumLike<T[K]> extends never ? never : K]?: T[K] extends Record<any, any> ? T[K][keyof T[K]] : never;
|
|
8
|
+
};
|
|
5
9
|
type MethodKeys<T> = {
|
|
6
10
|
[P in keyof T]: T[P] extends (...args: any[]) => any ? P : never;
|
|
7
11
|
}[keyof T];
|
package/dist/wf/index.js
CHANGED
|
@@ -14,7 +14,7 @@ export const ZodUuidExportInput = z.union([
|
|
|
14
14
|
.string()
|
|
15
15
|
.trim()
|
|
16
16
|
.length(32)
|
|
17
|
-
.refine((
|
|
17
|
+
.refine((value) => import('validator/es/lib/isHexadecimal').then(({ default: isHexadecimal }) => isHexadecimal(value)).catch(() => import('validator').then(({ default: validator }) => validator.isHexadecimal(value)))),
|
|
18
18
|
z.string().trim().nonempty().base64(),
|
|
19
19
|
z.string().trim().nonempty().base64url(),
|
|
20
20
|
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainfuse/types",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "ChainFuse",
|
|
6
6
|
"homepage": "https://github.com/ChainFuse/packages/tree/main/packages/types#readme",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"@cloudflare/workers-types": "^4.20250409.0",
|
|
98
98
|
"@types/validator": "^13.12.3"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "726051ba6c7f31753cdd6e4c86ee5e2e5c132601"
|
|
101
101
|
}
|