@lakeql/schema-generator 0.2.1 → 0.3.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.
|
@@ -15,14 +15,27 @@ declare const metadataFieldPattern: RegExp;
|
|
|
15
15
|
*/
|
|
16
16
|
declare const loadStrategies: readonly ["full_load", "full_load_append", "append"];
|
|
17
17
|
type LoadStrategy = (typeof loadStrategies)[number];
|
|
18
|
+
/**
|
|
19
|
+
* Supported storage adapter types.
|
|
20
|
+
*/
|
|
21
|
+
declare const storageTypes: readonly ["s3", "minio"];
|
|
22
|
+
type StorageType = (typeof storageTypes)[number];
|
|
18
23
|
/**
|
|
19
24
|
* Mutation pipeline configuration for an endpoint.
|
|
20
25
|
*/
|
|
21
26
|
interface MutationConfig {
|
|
22
27
|
/** Load strategy for the write pipeline. */
|
|
23
28
|
loadStrategy: LoadStrategy;
|
|
24
|
-
/**
|
|
29
|
+
/** Storage adapter type. Defaults to "s3". */
|
|
30
|
+
type: StorageType;
|
|
31
|
+
/** S3/MinIO bucket name for endpoint data. */
|
|
32
|
+
bucket: string;
|
|
33
|
+
/** Base path for endpoint data. */
|
|
25
34
|
basePath: string;
|
|
35
|
+
/** Optional region override (falls back to AWS_DEFAULT_REGION env var for S3). */
|
|
36
|
+
region?: string;
|
|
37
|
+
/** Optional custom endpoint. Required for MinIO, optional for S3. */
|
|
38
|
+
endpoint?: string;
|
|
26
39
|
}
|
|
27
40
|
/**
|
|
28
41
|
* Zod schema for the mutation configuration object.
|
|
@@ -33,7 +46,14 @@ declare const mutationConfigSchema: z.ZodObject<{
|
|
|
33
46
|
full_load_append: "full_load_append";
|
|
34
47
|
append: "append";
|
|
35
48
|
}>;
|
|
49
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
50
|
+
s3: "s3";
|
|
51
|
+
minio: "minio";
|
|
52
|
+
}>>;
|
|
53
|
+
bucket: z.ZodString;
|
|
36
54
|
basePath: z.ZodString;
|
|
55
|
+
region: z.ZodOptional<z.ZodString>;
|
|
56
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
37
57
|
}, z.core.$strip>;
|
|
38
58
|
/**
|
|
39
59
|
* Zod schema for the mutation field: either `false` (disabled) or a config object (enabled).
|
|
@@ -44,7 +64,14 @@ declare const mutationSchema: z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObj
|
|
|
44
64
|
full_load_append: "full_load_append";
|
|
45
65
|
append: "append";
|
|
46
66
|
}>;
|
|
67
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
68
|
+
s3: "s3";
|
|
69
|
+
minio: "minio";
|
|
70
|
+
}>>;
|
|
71
|
+
bucket: z.ZodString;
|
|
47
72
|
basePath: z.ZodString;
|
|
73
|
+
region: z.ZodOptional<z.ZodString>;
|
|
74
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
48
75
|
}, z.core.$strip>]>;
|
|
49
76
|
/**
|
|
50
77
|
* Supported primitive types for field definitions.
|
|
@@ -118,7 +145,14 @@ declare const endpointDefinitionSchema: z.ZodObject<{
|
|
|
118
145
|
full_load_append: "full_load_append";
|
|
119
146
|
append: "append";
|
|
120
147
|
}>;
|
|
148
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
149
|
+
s3: "s3";
|
|
150
|
+
minio: "minio";
|
|
151
|
+
}>>;
|
|
152
|
+
bucket: z.ZodString;
|
|
121
153
|
basePath: z.ZodString;
|
|
154
|
+
region: z.ZodOptional<z.ZodString>;
|
|
155
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
122
156
|
}, z.core.$strip>]>>;
|
|
123
157
|
}, z.core.$strip>;
|
|
124
158
|
type EndpointDefinitionFormat = z.infer<typeof endpointDefinitionSchema>;
|
|
@@ -131,4 +165,4 @@ declare function findDuplicateFieldNames(fields: FieldDefinition[], path?: strin
|
|
|
131
165
|
path: string[];
|
|
132
166
|
}[];
|
|
133
167
|
//#endregion
|
|
134
|
-
export { ArrayItemDefinition, EndpointDefinitionFormat, FieldDefinition, FieldOptions, FieldValidation, LoadStrategy, MutationConfig, PrimitiveType, endpointDefinitionSchema, fieldDefinitionSchema, fieldNamePattern, fieldOptionsSchema, fieldValidationSchema, findDuplicateFieldNames, loadStrategies, metadataFieldPattern, mutationConfigSchema, mutationSchema, primitiveTypes };
|
|
168
|
+
export { ArrayItemDefinition, EndpointDefinitionFormat, FieldDefinition, FieldOptions, FieldValidation, LoadStrategy, MutationConfig, PrimitiveType, StorageType, endpointDefinitionSchema, fieldDefinitionSchema, fieldNamePattern, fieldOptionsSchema, fieldValidationSchema, findDuplicateFieldNames, loadStrategies, metadataFieldPattern, mutationConfigSchema, mutationSchema, primitiveTypes, storageTypes };
|
package/dist/endpoint-schema.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e}from"zod";const t=/^[a-zA-Z_][a-zA-Z0-9_]{0,63}$/u,n=/^[a-zA-Z_][a-zA-Z0-9_]{0,127}$/u,r=[`full_load`,`full_load_append`,`append`],i=e.object({loadStrategy:e.enum(r),basePath:e.string().min(1)}),
|
|
1
|
+
import{z as e}from"zod";const t=/^[a-zA-Z_][a-zA-Z0-9_]{0,63}$/u,n=/^[a-zA-Z_][a-zA-Z0-9_]{0,127}$/u,r=[`full_load`,`full_load_append`,`append`],i=[`s3`,`minio`],a=e.object({loadStrategy:e.enum(r),type:e.enum(i).default(`s3`),bucket:e.string().min(1),basePath:e.string().min(1),region:e.string().optional(),endpoint:e.string().optional()}),o=e.union([e.literal(!1),a]),s=[`String`,`Integer`,`Float`,`Boolean`,`Date`,`DateTime`],c=e.union([e.object({type:e.literal(`email`)}),e.object({type:e.literal(`url`)}),e.object({type:e.literal(`uuid`)}),e.object({type:e.literal(`min`),value:e.number()}),e.object({type:e.literal(`max`),value:e.number()}),e.object({type:e.literal(`regex`),pattern:e.string()})]),l=e.object({required:e.boolean().optional(),validations:e.array(c).optional()}),u=e.lazy(()=>e.discriminatedUnion(`type`,[e.object({name:e.string().regex(t),type:e.literal(`String`),options:l.optional()}),e.object({name:e.string().regex(t),type:e.literal(`Integer`),options:l.optional()}),e.object({name:e.string().regex(t),type:e.literal(`Float`),options:l.optional()}),e.object({name:e.string().regex(t),type:e.literal(`Boolean`),options:l.optional()}),e.object({name:e.string().regex(t),type:e.literal(`Date`),options:l.optional()}),e.object({name:e.string().regex(t),type:e.literal(`DateTime`),options:l.optional()}),e.object({name:e.string().regex(t),type:e.literal(`Object`),fields:e.array(u).min(1),options:l.optional()}),e.object({name:e.string().regex(t),type:e.literal(`Array`),items:e.union([e.object({type:e.enum(s)}),e.object({type:e.literal(`Object`),fields:e.array(u).min(1)})]),options:l.optional()})])),d=e.object({version:e.literal(`1.0`),tableName:e.string().regex(n),catalog:e.string().regex(n),schema:e.string().regex(n),fields:e.array(u),mutation:o.optional()});function f(e,t=[]){let n=[],r=new Set;for(let i of e)r.has(i.name)?n.push({name:i.name,path:t}):r.add(i.name),i.type===`Object`&&i.fields&&n.push(...f(i.fields,[...t,i.name])),i.type===`Array`&&i.items?.type===`Object`&&i.items.fields&&n.push(...f(i.items.fields,[...t,i.name,`items`]));return n}export{d as endpointDefinitionSchema,u as fieldDefinitionSchema,t as fieldNamePattern,l as fieldOptionsSchema,c as fieldValidationSchema,f as findDuplicateFieldNames,r as loadStrategies,n as metadataFieldPattern,a as mutationConfigSchema,o as mutationSchema,s as primitiveTypes,i as storageTypes};
|