@xeno-js/shared 1.0.0 → 2.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.
- package/README.md +678 -678
- package/dist/index.cjs +47 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +47 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -6057,18 +6057,20 @@ declare class SupabaseSessionMapper implements IBaseMapper<Session$1, Session> {
|
|
|
6057
6057
|
declare const ZodUtils: Readonly<{
|
|
6058
6058
|
/**
|
|
6059
6059
|
* @description Creates a Zod schema for a command by extending the base command schema with additional properties.
|
|
6060
|
+
* @param intent - The intent of the command.
|
|
6060
6061
|
* @param additionalSchema - An object representing additional properties to be added to the command schema.
|
|
6061
6062
|
* @returns A Zod schema for the command.
|
|
6062
6063
|
*/
|
|
6063
|
-
createCommandSchema: (additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6064
|
+
createCommandSchema: (intent: string, additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6064
6065
|
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
6065
6066
|
}, z.core.$strict>;
|
|
6066
6067
|
/**
|
|
6067
6068
|
* @description Creates a Zod schema for a query by extending the base query schema with additional properties.
|
|
6069
|
+
* @param intent - The intent of the query.
|
|
6068
6070
|
* @param additionalSchema - An object representing additional properties to be added to the query schema.
|
|
6069
6071
|
* @returns A Zod schema for the query.
|
|
6070
6072
|
*/
|
|
6071
|
-
createQuerySchema: (additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6073
|
+
createQuerySchema: (intent: string, additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6072
6074
|
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
6073
6075
|
}, z.core.$strict>;
|
|
6074
6076
|
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -6057,18 +6057,20 @@ declare class SupabaseSessionMapper implements IBaseMapper<Session$1, Session> {
|
|
|
6057
6057
|
declare const ZodUtils: Readonly<{
|
|
6058
6058
|
/**
|
|
6059
6059
|
* @description Creates a Zod schema for a command by extending the base command schema with additional properties.
|
|
6060
|
+
* @param intent - The intent of the command.
|
|
6060
6061
|
* @param additionalSchema - An object representing additional properties to be added to the command schema.
|
|
6061
6062
|
* @returns A Zod schema for the command.
|
|
6062
6063
|
*/
|
|
6063
|
-
createCommandSchema: (additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6064
|
+
createCommandSchema: (intent: string, additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6064
6065
|
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
6065
6066
|
}, z.core.$strict>;
|
|
6066
6067
|
/**
|
|
6067
6068
|
* @description Creates a Zod schema for a query by extending the base query schema with additional properties.
|
|
6069
|
+
* @param intent - The intent of the query.
|
|
6068
6070
|
* @param additionalSchema - An object representing additional properties to be added to the query schema.
|
|
6069
6071
|
* @returns A Zod schema for the query.
|
|
6070
6072
|
*/
|
|
6071
|
-
createQuerySchema: (additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6073
|
+
createQuerySchema: (intent: string, additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6072
6074
|
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
6073
6075
|
}, z.core.$strict>;
|
|
6074
6076
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -2844,41 +2844,67 @@ var SupabaseSessionMapper = class {
|
|
|
2844
2844
|
|
|
2845
2845
|
// src/infrastructure/validators/base-schema.constant.ts
|
|
2846
2846
|
import { z } from "zod";
|
|
2847
|
-
var
|
|
2848
|
-
intent
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
}
|
|
2855
|
-
var cacheableOptionsZodSchema =
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
}
|
|
2847
|
+
var baseZodSchema = {
|
|
2848
|
+
get(intent, type) {
|
|
2849
|
+
return z.object({
|
|
2850
|
+
intent: z.literal(intent),
|
|
2851
|
+
type: z.literal(type)
|
|
2852
|
+
});
|
|
2853
|
+
}
|
|
2854
|
+
};
|
|
2855
|
+
var cacheableOptionsZodSchema = {
|
|
2856
|
+
get() {
|
|
2857
|
+
return z.object({
|
|
2858
|
+
cacheKey: z.string().min(1, "Cache key is required"),
|
|
2859
|
+
ttl: z.number().int().positive().optional(),
|
|
2860
|
+
bypassCache: z.boolean().optional(),
|
|
2861
|
+
consistentRead: z.boolean().optional()
|
|
2862
|
+
});
|
|
2863
|
+
}
|
|
2864
|
+
};
|
|
2865
|
+
var baseCommandZodSchema = {
|
|
2866
|
+
/**
|
|
2867
|
+
* @description Gets the base schema for a command with the given intent.
|
|
2868
|
+
* @param intent The intent of the command.
|
|
2869
|
+
* @returns The base schema for the command.
|
|
2870
|
+
*/
|
|
2871
|
+
get(intent) {
|
|
2872
|
+
return baseZodSchema.get(intent, REQUEST_TYPE.COMMAND);
|
|
2873
|
+
}
|
|
2874
|
+
};
|
|
2875
|
+
var baseQueryZodSchema = {
|
|
2876
|
+
/**
|
|
2877
|
+
* @description Gets the base schema for a query with the given intent and chache key.
|
|
2878
|
+
* @param intent The intent of the query.
|
|
2879
|
+
* @returns The base schema for the query.
|
|
2880
|
+
*/
|
|
2881
|
+
get(intent) {
|
|
2882
|
+
const baseSchema = baseZodSchema.get(intent, REQUEST_TYPE.QUERY);
|
|
2883
|
+
return baseSchema.extend({
|
|
2884
|
+
cacheOptions: cacheableOptionsZodSchema.get()
|
|
2885
|
+
});
|
|
2886
|
+
}
|
|
2887
|
+
};
|
|
2864
2888
|
|
|
2865
2889
|
// src/infrastructure/validators/schema-zod.utils.ts
|
|
2866
2890
|
var ZodUtils = Object.freeze({
|
|
2867
2891
|
/**
|
|
2868
2892
|
* @description Creates a Zod schema for a command by extending the base command schema with additional properties.
|
|
2893
|
+
* @param intent - The intent of the command.
|
|
2869
2894
|
* @param additionalSchema - An object representing additional properties to be added to the command schema.
|
|
2870
2895
|
* @returns A Zod schema for the command.
|
|
2871
2896
|
*/
|
|
2872
|
-
createCommandSchema: (additionalSchema) => {
|
|
2873
|
-
return baseCommandZodSchema.extend(additionalSchema).strict();
|
|
2897
|
+
createCommandSchema: (intent, additionalSchema) => {
|
|
2898
|
+
return baseCommandZodSchema.get(intent).extend(additionalSchema).strict();
|
|
2874
2899
|
},
|
|
2875
2900
|
/**
|
|
2876
2901
|
* @description Creates a Zod schema for a query by extending the base query schema with additional properties.
|
|
2902
|
+
* @param intent - The intent of the query.
|
|
2877
2903
|
* @param additionalSchema - An object representing additional properties to be added to the query schema.
|
|
2878
2904
|
* @returns A Zod schema for the query.
|
|
2879
2905
|
*/
|
|
2880
|
-
createQuerySchema: (additionalSchema) => {
|
|
2881
|
-
return baseQueryZodSchema.extend(additionalSchema).strict();
|
|
2906
|
+
createQuerySchema: (intent, additionalSchema) => {
|
|
2907
|
+
return baseQueryZodSchema.get(intent).extend(additionalSchema).strict();
|
|
2882
2908
|
}
|
|
2883
2909
|
});
|
|
2884
2910
|
|