@tailor-platform/sdk 1.69.0 → 1.70.1
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/CHANGELOG.md +73 -0
- package/dist/{application-Cr-limKC.mjs → application-DmjIKQ-a.mjs} +319 -79
- package/dist/application-DmjIKQ-a.mjs.map +1 -0
- package/dist/application-a_ApFuPh.mjs +4 -0
- package/dist/cli/erd-viewer-assets/app.js +279 -36
- package/dist/cli/erd-viewer-assets/index.html +4 -0
- package/dist/cli/erd-viewer-assets/styles.css +252 -5
- package/dist/cli/index.mjs +642 -91
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +87 -13
- package/dist/cli/lib.mjs +2 -2
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/completion/zsh-worker.zsh +159 -6
- package/dist/configure/index.d.mts +5 -5
- package/dist/configure/index.mjs +8 -6
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{index-B7VbJm0_.d.mts → index-BAEaAqmz.d.mts} +90 -40
- package/dist/{index-CklcVeMG.d.mts → index-C-vsbx27.d.mts} +2 -2
- package/dist/{index-hXoO-AOC.d.mts → index-CKI0eZP6.d.mts} +2 -2
- package/dist/{index-DYhnxXYR.d.mts → index-CrqOgUF2.d.mts} +2 -2
- package/dist/{index-DlDRSzFZ.d.mts → index-DESLU9kI.d.mts} +2 -2
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/index.d.mts +1 -1
- package/dist/{runtime-jowoN6qC.mjs → runtime-BpHVwifd.mjs} +525 -311
- package/dist/runtime-BpHVwifd.mjs.map +1 -0
- package/dist/{schema-1msIhXwA.mjs → schema-C4fkpWV_.mjs} +9 -15
- package/dist/schema-C4fkpWV_.mjs.map +1 -0
- package/dist/{service_pb-DGSmn-aF.mjs → service_pb-BJ9GsAnW.mjs} +1 -1
- package/dist/{service_pb-DSNjrcbW.mjs → service_pb-BsBR6yW5.mjs} +22 -7
- package/dist/service_pb-BsBR6yW5.mjs.map +1 -0
- package/dist/{types-2Be3wSMc.mjs → types-32lUMToj.mjs} +1 -1
- package/dist/{types-CmzfQP_m.mjs → types-D4QMmNWh.mjs} +1 -12
- package/dist/types-D4QMmNWh.mjs.map +1 -0
- package/dist/{types-Bzr0RQME.d.mts → types-Dynq4AJv.d.mts} +2 -2
- package/dist/{types-DZrtN6-H.d.mts → types-rj8YJcEe.d.mts} +5 -2
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/{workflow.generated-Br9bmLdX.d.mts → workflow.generated-DJULCuRr.d.mts} +177 -172
- package/docs/cli/application.md +37 -2
- package/docs/cli/setup.md +1 -0
- package/docs/cli/tailordb.md +24 -0
- package/docs/cli/user.md +11 -1
- package/docs/cli/workspace.md +13 -7
- package/docs/cli-reference.md +6 -0
- package/docs/github-actions.md +27 -0
- package/docs/multi-environment.md +22 -0
- package/docs/services/aigateway.md +4 -2
- package/docs/services/auth.md +4 -14
- package/docs/services/http-adapter.md +16 -1
- package/package.json +11 -11
- package/dist/application-Br48NXBD.mjs +0 -4
- package/dist/application-Cr-limKC.mjs.map +0 -1
- package/dist/runtime-jowoN6qC.mjs.map +0 -1
- package/dist/schema-1msIhXwA.mjs.map +0 -1
- package/dist/service_pb-DSNjrcbW.mjs.map +0 -1
- package/dist/types-CmzfQP_m.mjs.map +0 -1
|
@@ -9,17 +9,6 @@ const regex = {
|
|
|
9
9
|
datetime: /^(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})T(?<hour>\d{2}):(?<minute>\d{2}):(?<second>\d{2})(.(?<millisec>\d{3}))?Z$/,
|
|
10
10
|
decimal: /^-?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/
|
|
11
11
|
};
|
|
12
|
-
/**
|
|
13
|
-
* Creates a new TailorField instance.
|
|
14
|
-
* @param type - Field type
|
|
15
|
-
* @param options - Field options
|
|
16
|
-
* @param fields - Nested fields for object-like types
|
|
17
|
-
* @param values - Allowed values for enum-like fields
|
|
18
|
-
* @param metadata - Pre-built metadata to clone from (used by `clone()`); when
|
|
19
|
-
* given, the mutable containers are deep-copied here and `options`/`values` are
|
|
20
|
-
* ignored for metadata construction
|
|
21
|
-
* @returns A new TailorField
|
|
22
|
-
*/
|
|
23
12
|
function createTailorField(type, options, fields, values, metadata) {
|
|
24
13
|
const _metadata = metadata ? {
|
|
25
14
|
...metadata,
|
|
@@ -369,4 +358,4 @@ const t = {
|
|
|
369
358
|
|
|
370
359
|
//#endregion
|
|
371
360
|
export { t };
|
|
372
|
-
//# sourceMappingURL=types-
|
|
361
|
+
//# sourceMappingURL=types-D4QMmNWh.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-D4QMmNWh.mjs","names":[],"sources":["../src/configure/types/type.ts"],"sourcesContent":["import { type AllowedValues, type AllowedValuesOutput, mapAllowedValues } from \"./field\";\nimport type {\n DefinedFieldMetadata,\n TailorFieldType,\n TailorToTs,\n FieldMetadata,\n FieldOptions,\n FieldOutput,\n TailorField as TailorFieldBase,\n FieldValidateInput,\n} from \"#/configure/types/field.types\";\nimport type { TailorUser } from \"#/runtime/types\";\nimport type { InferFieldsOutput, TypeLevelError } from \"#/types/helpers\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\n// Erased fields stay assignable across builder method-state changes.\n// oxlint-disable-next-line no-explicit-any\ntype AnyBuilderMethod = any;\n\nexport type TailorAnyField = Omit<\n TailorFieldBase<AnyBuilderMethod, AnyBuilderMethod, FieldMetadata, TailorFieldType>,\n \"fields\"\n> & {\n readonly fields: Record<string, AnyBuilderMethod>;\n _metadata: FieldMetadata;\n description: AnyBuilderMethod;\n typeName: AnyBuilderMethod;\n validate: AnyBuilderMethod;\n parse: AnyBuilderMethod;\n _parseInternal: AnyBuilderMethod;\n};\n\ntype IsAny<T> = 0 extends 1 & T ? true : false;\ntype WithFieldDescription<Defined> = Defined & { description: true };\ntype WithFieldTypeName<Defined> = Defined & { typeName: true };\ntype WithFieldValidate<Defined> = Defined & { validate: true };\ntype FieldDescriptionFn<Defined extends DefinedFieldMetadata, Output> = (\n description: string,\n) => TailorField<WithFieldDescription<Defined>, Output>;\ntype FieldTypeNameFn<Defined extends DefinedFieldMetadata, Output> = (\n typeName: string,\n) => TailorField<WithFieldTypeName<Defined>, Output>;\ntype FieldValidateFn<Defined extends DefinedFieldMetadata, Output> = (\n ...validate: FieldValidateInput<Output>[]\n) => TailorField<WithFieldValidate<Defined>, Output>;\ntype FieldDescriptionMethod<Defined extends DefinedFieldMetadata, Output> =\n IsAny<Defined> extends true\n ? FieldDescriptionFn<Defined, Output>\n : Defined extends { description: unknown }\n ? TypeLevelError<\".description() has already been set\">\n : FieldDescriptionFn<Defined, Output>;\ntype FieldTypeNameMethod<Defined extends DefinedFieldMetadata, Output> =\n IsAny<Defined> extends true\n ? TypeLevelError<string>\n : Defined extends { typeName: unknown }\n ? TypeLevelError<\".typeName() has already been set\">\n : Defined extends { type: \"enum\" | \"nested\" }\n ? FieldTypeNameFn<Defined, Output>\n : TypeLevelError<\"typeName can only be set on enum or object fields\">;\ntype FieldValidateMethod<Defined extends DefinedFieldMetadata, Output> =\n IsAny<Defined> extends true\n ? FieldValidateFn<Defined, Output>\n : Defined extends { validate: unknown }\n ? TypeLevelError<\".validate() has already been set\">\n : FieldValidateFn<Defined, Output>;\n\n/**\n * Full TailorField interface with builder methods.\n * Extends the minimal structural interface from types/ with fluent API methods.\n */\nexport interface TailorField<\n Defined extends DefinedFieldMetadata = DefinedFieldMetadata,\n // Generic default output type (kept loose on purpose for library ergonomics).\n // oxlint-disable-next-line no-explicit-any\n Output = any,\n M extends FieldMetadata = FieldMetadata,\n T extends TailorFieldType = TailorFieldType,\n> extends TailorFieldBase<Defined, Output, M, T> {\n readonly fields: Record<string, TailorAnyField>;\n _metadata: M;\n\n /**\n * Set a description for the field\n * @param description - The description text\n * @returns The field with updated metadata\n */\n description: FieldDescriptionMethod<Defined, Output>;\n\n /**\n * Set a custom type name for enum or nested types\n * @param typeName - The custom type name\n * @returns The field with updated metadata\n */\n typeName: FieldTypeNameMethod<Defined, Output>;\n\n /**\n * Add validation functions to the field\n * @param validate - One or more validation functions\n * @returns The field with updated metadata\n */\n validate: FieldValidateMethod<Defined, Output>;\n\n /**\n * Parse and validate a value against this field's validation rules\n * Returns StandardSchema Result type with success or failure\n * @param args - Value, context data, and user\n * @returns Validation result\n */\n parse(args: FieldParseArgs): StandardSchemaV1.Result<Output>;\n\n /**\n * Internal parse method that tracks field path for nested validation\n * @private\n * @param args - Parse arguments\n * @returns Validation result\n */\n _parseInternal(args: FieldParseInternalArgs): StandardSchemaV1.Result<Output>;\n}\n\n/**\n * Internal shape carried by every runtime field for clone-on-write support.\n *\n * `clone()` is intentionally kept off the public {@link TailorField} interface:\n * adding it there would force `TailorDBField` (which has a differently-typed\n * `clone`) to stop being assignable to `TailorField`, breaking the supported\n * `t.object({ field: db.string() })` usage. Every `t.*` and `db.*` field carries\n * a `clone()` at runtime, so the internal cast in `clone()` is safe.\n */\ntype CloneableField = { clone(): TailorAnyField };\n\nconst regex = {\n uuid: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,\n date: /^(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})$/,\n time: /^(?<hour>\\d{2}):(?<minute>\\d{2})$/,\n datetime:\n /^(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})T(?<hour>\\d{2}):(?<minute>\\d{2}):(?<second>\\d{2})(.(?<millisec>\\d{3}))?Z$/,\n decimal: /^-?(\\d+\\.?\\d*|\\.\\d+)([eE][+-]?\\d+)?$/,\n} as const;\n\ntype FieldParseArgs = {\n value: unknown;\n data: unknown;\n user: TailorUser;\n};\n\ntype FieldValidateValueArgs<T extends TailorFieldType> = {\n value: TailorToTs[T];\n data: unknown;\n user: TailorUser;\n pathArray: string[];\n};\n\ntype FieldParseInternalArgs = {\n // Runtime input is unknown/untyped; we validate and narrow it inside the parser.\n // oxlint-disable-next-line no-explicit-any\n value: any;\n data: unknown;\n user: TailorUser;\n pathArray: string[];\n};\n\ntype TailorFieldRuntime<\n Defined extends DefinedFieldMetadata,\n Output,\n M extends FieldMetadata = FieldMetadata,\n T extends TailorFieldType = TailorFieldType,\n> = TailorFieldBase<Defined, Output, M, T> & {\n readonly fields: Record<string, TailorAnyField>;\n _metadata: M;\n description(description: string): object;\n typeName(typeName: string): object;\n validate(...validate: FieldValidateInput<Output>[]): object;\n parse(args: FieldParseArgs): StandardSchemaV1.Result<Output>;\n _parseInternal(args: FieldParseInternalArgs): StandardSchemaV1.Result<Output>;\n clone(): TailorAnyField;\n};\n\n/**\n * Creates a new TailorField instance.\n * @param type - Field type\n * @param options - Field options\n * @param fields - Nested fields for object-like types\n * @param values - Allowed values for enum-like fields\n * @param metadata - Pre-built metadata to clone from (used by `clone()`); when\n * given, the mutable containers are deep-copied here and `options`/`values` are\n * ignored for metadata construction\n * @returns A new TailorField\n */\nfunction createTailorField<\n const T extends TailorFieldType,\n const TOptions extends FieldOptions,\n const OutputBase = TailorToTs[T],\n>(\n type: T,\n options?: TOptions,\n fields?: Record<string, TailorAnyField>,\n values?: AllowedValues,\n metadata?: FieldMetadata,\n): TailorField<\n { type: T; array: TOptions extends { array: true } ? true : false },\n FieldOutput<OutputBase, TOptions>\n>;\nfunction createTailorField<\n const T extends TailorFieldType,\n const TOptions extends FieldOptions,\n const OutputBase = TailorToTs[T],\n>(\n type: T,\n options?: TOptions,\n fields?: Record<string, TailorAnyField>,\n values?: AllowedValues,\n metadata?: FieldMetadata,\n): object {\n type FieldValue = FieldOutput<OutputBase, TOptions>;\n\n // When cloning, take ownership of the source metadata and deep-copy its mutable\n // containers (enum value objects and `[fn, message]` validator tuples; validator\n // functions are kept by reference) so no two instances share mutable state.\n const _metadata: FieldMetadata = metadata\n ? {\n ...metadata,\n ...(metadata.allowedValues && {\n allowedValues: metadata.allowedValues.map((v) => ({ ...v })),\n }),\n ...(metadata.validate && {\n validate: metadata.validate.map((v) => (Array.isArray(v) ? ([...v] as typeof v) : v)),\n }),\n }\n : { required: true };\n\n if (!metadata) {\n if (options) {\n if (options.optional === true) {\n _metadata.required = false;\n }\n if (options.array === true) {\n _metadata.array = true;\n }\n }\n if (values) {\n _metadata.allowedValues = mapAllowedValues(values);\n }\n }\n\n /**\n * Validate a single value (not an array element)\n * Used internally for array element validation\n * @param args - Value, context data, and user\n * @returns Array of validation issues\n */\n function validateValue(args: FieldValidateValueArgs<T>): StandardSchemaV1.Issue[] {\n const { value, data, user, pathArray } = args;\n const issues: StandardSchemaV1.Issue[] = [];\n const path = pathArray.length > 0 ? pathArray : undefined;\n\n // Type-specific validation\n switch (type) {\n case \"string\":\n if (typeof value !== \"string\") {\n issues.push({\n message: `Expected a string: received ${String(value)}`,\n path,\n });\n }\n break;\n\n case \"integer\":\n if (typeof value !== \"number\" || !Number.isInteger(value)) {\n issues.push({\n message: `Expected an integer: received ${String(value)}`,\n path,\n });\n }\n break;\n\n case \"float\":\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n issues.push({\n message: `Expected a number: received ${String(value)}`,\n path,\n });\n }\n break;\n\n case \"boolean\":\n if (typeof value !== \"boolean\") {\n issues.push({\n message: `Expected a boolean: received ${String(value)}`,\n path,\n });\n }\n break;\n\n case \"uuid\":\n if (typeof value !== \"string\" || !regex.uuid.test(value)) {\n issues.push({\n message: `Expected a valid UUID: received ${String(value)}`,\n path,\n });\n }\n break;\n case \"date\":\n if (typeof value !== \"string\" || !regex.date.test(value)) {\n issues.push({\n message: `Expected to match \"yyyy-MM-dd\" format: received ${String(value)}`,\n path,\n });\n }\n break;\n case \"datetime\":\n if (typeof value !== \"string\" || !regex.datetime.test(value)) {\n issues.push({\n message: `Expected to match ISO format: received ${String(value)}`,\n path,\n });\n }\n break;\n case \"time\":\n if (typeof value !== \"string\" || !regex.time.test(value)) {\n issues.push({\n message: `Expected to match \"HH:mm\" format: received ${String(value)}`,\n path,\n });\n }\n break;\n case \"decimal\":\n if (typeof value !== \"string\" || !regex.decimal.test(value)) {\n issues.push({\n message: `Expected a decimal string: received ${String(value)}`,\n path,\n });\n }\n break;\n\n case \"enum\":\n if (field._metadata.allowedValues) {\n const allowedValues = field._metadata.allowedValues.map((v) => v.value);\n if (typeof value !== \"string\" || !allowedValues.includes(value)) {\n issues.push({\n message: `Must be one of [${allowedValues.join(\", \")}]: received ${String(value)}`,\n path,\n });\n }\n }\n break;\n\n case \"nested\":\n // Validate nested object fields\n // runtime value may not match the declared type\n // oxlint-disable typescript/no-unnecessary-condition\n if (\n typeof value !== \"object\" ||\n value === null ||\n Array.isArray(value) ||\n value instanceof Date\n ) {\n // oxlint-enable typescript/no-unnecessary-condition\n issues.push({\n message: `Expected an object: received ${String(value)}`,\n path,\n });\n } else if (Object.keys(field.fields).length > 0) {\n for (const [fieldName, nestedField] of Object.entries(field.fields)) {\n const fieldValue = (value as Record<string, unknown>)[fieldName];\n const result = nestedField._parseInternal({\n value: fieldValue,\n data,\n user,\n pathArray: pathArray.concat(fieldName),\n });\n if (result.issues) {\n issues.push(...result.issues);\n }\n }\n }\n break;\n }\n\n // Custom validation functions\n const validateFns = field._metadata.validate;\n if (validateFns && validateFns.length > 0) {\n for (const validateInput of validateFns) {\n const { fn, message } =\n typeof validateInput === \"function\"\n ? { fn: validateInput, message: \"Validation failed\" }\n : { fn: validateInput[0], message: validateInput[1] };\n\n if (!fn({ value, data, user })) {\n issues.push({\n message,\n path,\n });\n }\n }\n }\n\n return issues;\n }\n\n /**\n * Internal parse method that tracks field path for nested validation\n * @param args - Parse arguments\n * @returns Parse result with value or issues\n */\n function parseInternal(\n args: FieldParseInternalArgs,\n ): StandardSchemaV1.Result<FieldOutput<OutputBase, TOptions>> {\n const { value, data, user, pathArray } = args;\n const issues: StandardSchemaV1.Issue[] = [];\n const path = pathArray.length > 0 ? pathArray : undefined;\n\n // 1. Check required/optional\n const isNullOrUndefined = value === null || value === undefined;\n if (field._metadata.required && isNullOrUndefined) {\n issues.push({\n message: \"Required field is missing\",\n path,\n });\n return { issues };\n }\n\n // If optional and null/undefined, skip further validation and normalize to null\n if (!field._metadata.required && isNullOrUndefined) {\n return { value: value ?? null };\n }\n\n // 2. Check array type\n if (field._metadata.array) {\n if (!Array.isArray(value)) {\n issues.push({\n message: \"Expected an array\",\n path,\n });\n return { issues };\n }\n\n // Validate each array element (without array flag)\n for (let i = 0; i < value.length; i++) {\n const elementValue = value[i];\n const elementPath = pathArray.concat(`[${i}]`);\n\n // Validate element with same type but without array flag\n const elementIssues = validateValue({\n value: elementValue,\n data,\n user,\n pathArray: elementPath,\n });\n if (elementIssues.length > 0) {\n issues.push(...elementIssues);\n }\n }\n\n if (issues.length > 0) {\n return { issues };\n }\n return { value: value as FieldOutput<OutputBase, TOptions> };\n }\n\n // 3. Type-specific validation and custom validation\n const valueIssues = validateValue({ value, data, user, pathArray });\n issues.push(...valueIssues);\n\n if (issues.length > 0) {\n return { issues };\n }\n\n return { value };\n }\n\n /**\n * Clone the field and apply metadata updates to the clone.\n * The original instance is never mutated, so a field shared across places\n * cannot leak metadata between them.\n * @param metadataUpdates - Metadata properties to overwrite on the clone\n * @returns A new field with the updated metadata\n */\n function cloneWith(metadataUpdates: Partial<FieldMetadata>) {\n const cloned = field.clone();\n Object.assign(cloned._metadata, metadataUpdates);\n return cloned;\n }\n\n const field: TailorFieldRuntime<\n { type: T; array: TOptions extends { array: true } ? true : false },\n FieldValue\n > = {\n type,\n fields: fields ?? {},\n _defined: undefined as unknown as {\n type: T;\n array: TOptions extends { array: true } ? true : false;\n },\n _output: undefined as FieldOutput<OutputBase, TOptions>,\n _metadata,\n\n get metadata() {\n return { ...this._metadata };\n },\n\n description(description: string) {\n // Clone-on-write so a shared field instance never leaks metadata.\n return cloneWith({ description });\n },\n\n typeName(typeName: string) {\n // Clone-on-write so a shared field instance never leaks metadata.\n return cloneWith({ typeName });\n },\n\n validate(...validateInputs: FieldValidateInput<FieldValue>[]) {\n // Clone-on-write so a shared field instance never leaks metadata.\n return cloneWith({ validate: validateInputs });\n },\n\n parse(args: FieldParseArgs): StandardSchemaV1.Result<FieldOutput<OutputBase, TOptions>> {\n return parseInternal({\n value: args.value,\n data: args.data,\n user: args.user,\n pathArray: [],\n });\n },\n\n _parseInternal: parseInternal,\n\n clone() {\n // Deep clone nested object fields so the new instance shares no mutable state.\n let clonedFields = fields;\n if (fields) {\n const cloned: Record<string, TailorAnyField> = {};\n for (const [key, nestedField] of Object.entries(fields)) {\n // Both t.* and db.* fields carry clone() at runtime (see CloneableField).\n cloned[key] = (nestedField as TailorAnyField & CloneableField).clone();\n }\n clonedFields = cloned;\n }\n\n // Rebuild via the factory, handing it this field's metadata so the new\n // parseInternal/validateValue closures rebind to the clone and the factory\n // owns the metadata deep-copy.\n // oxlint-disable-next-line no-explicit-any\n return createTailorField(type, options, clonedFields, values, this._metadata) as any;\n },\n };\n\n return field;\n}\n\n/**\n * Create a UUID field for resolver input/output.\n * @param options - Field configuration options\n * @returns A UUID field\n * @example t.uuid()\n */\nfunction uuid<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"uuid\", options);\n}\n\n/**\n * Create a string field for resolver input/output.\n * @param options - Field configuration options\n * @returns A string field\n * @example t.string()\n * @example t.string({ optional: true })\n * @example t.string({ array: true })\n */\nfunction string<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"string\", options);\n}\n\n/**\n * Create a boolean field for resolver input/output.\n * @param options - Field configuration options\n * @returns A boolean field\n * @example t.bool()\n */\nfunction bool<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"boolean\", options);\n}\n\n/**\n * Create an integer field for resolver input/output.\n * @param options - Field configuration options\n * @returns An integer field\n * @example t.int()\n */\nfunction int<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"integer\", options);\n}\n\n/**\n * Create a float field for resolver input/output.\n * @param options - Field configuration options\n * @returns A float field\n * @example t.float()\n */\nfunction float<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"float\", options);\n}\n\n/**\n * Create a decimal field for resolver input/output (stored as string for precision).\n * @param options - Field configuration options\n * @returns A decimal field\n * @example t.decimal()\n * @example t.decimal({ optional: true })\n */\nfunction decimal<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"decimal\", options);\n}\n\n/**\n * Create a date field for resolver input/output.\n * @param options - Field configuration options\n * @returns A date field\n * @example t.date()\n */\nfunction date<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"date\", options);\n}\n\n/**\n * Create a datetime field for resolver input/output.\n * @param options - Field configuration options\n * @returns A datetime field\n * @example t.datetime()\n */\nfunction datetime<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"datetime\", options);\n}\n\n/**\n * Create a time field for resolver input/output.\n * @param options - Field configuration options\n * @returns A time field\n * @example t.time()\n */\nfunction time<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"time\", options);\n}\n\n/**\n * Create an enum field for resolver input/output.\n * @param values - Array of allowed string values\n * @param options - Field configuration options\n * @returns An enum field\n * @example t.enum([\"active\", \"inactive\"])\n */\nfunction _enum<const V extends AllowedValues, const Opt extends FieldOptions>(\n values: V,\n options?: Opt,\n): TailorField<\n { type: \"enum\"; array: Opt extends { array: true } ? true : false },\n FieldOutput<AllowedValuesOutput<V>, Opt>\n> {\n return createTailorField<\"enum\", Opt, AllowedValuesOutput<V>>(\"enum\", options, undefined, values);\n}\n\n/**\n * Create a nested object field for resolver input/output.\n * @param fields - Record of field definitions\n * @param options - Field options (optional, array)\n * @returns A nested object field\n * @example\n * // Single object:\n * output: t.object({ name: t.string(), email: t.string() })\n * @example\n * // Array of objects:\n * items: t.object({ name: t.string() }, { array: true })\n */\nfunction object<const F extends Record<string, TailorAnyField>, const Opt extends FieldOptions>(\n fields: F,\n options?: Opt,\n) {\n const objectField = createTailorField(\"nested\", options, fields) as TailorField<\n { type: \"nested\"; array: Opt extends { array: true } ? true : false },\n FieldOutput<InferFieldsOutput<F>, Opt>\n >;\n return objectField;\n}\n\nexport const t = {\n uuid,\n string,\n bool,\n int,\n float,\n decimal,\n date,\n datetime,\n time,\n enum: _enum,\n object,\n};\n"],"mappings":";;;;AAkIA,MAAM,QAAQ;CACZ,MAAM;CACN,MAAM;CACN,MAAM;CACN,UACE;CACF,SAAS;AACX;AAiEA,SAAS,kBAKP,MACA,SACA,QACA,QACA,UACQ;CAMR,MAAM,YAA2B,WAC7B;EACE,GAAG;EACH,GAAI,SAAS,iBAAiB,EAC5B,eAAe,SAAS,cAAc,KAAK,OAAO,EAAE,GAAG,EAAE,EAAE,EAC7D;EACA,GAAI,SAAS,YAAY,EACvB,UAAU,SAAS,SAAS,KAAK,MAAO,MAAM,QAAQ,CAAC,IAAK,CAAC,GAAG,CAAC,IAAiB,CAAE,EACtF;CACF,IACA,EAAE,UAAU,KAAK;CAErB,IAAI,CAAC,UAAU;EACb,IAAI,SAAS;GACX,IAAI,QAAQ,aAAa,MACvB,UAAU,WAAW;GAEvB,IAAI,QAAQ,UAAU,MACpB,UAAU,QAAQ;EAEtB;EACA,IAAI,QACF,UAAU,gBAAgB,iBAAiB,MAAM;CAErD;;;;;;;CAQA,SAAS,cAAc,MAA2D;EAChF,MAAM,EAAE,OAAO,MAAM,MAAM,cAAc;EACzC,MAAM,SAAmC,CAAC;EAC1C,MAAM,OAAO,UAAU,SAAS,IAAI,YAAY;EAGhD,QAAQ,MAAR;GACE,KAAK;IACH,IAAI,OAAO,UAAU,UACnB,OAAO,KAAK;KACV,SAAS,+BAA+B,OAAO,KAAK;KACpD;IACF,CAAC;IAEH;GAEF,KAAK;IACH,IAAI,OAAO,UAAU,YAAY,CAAC,OAAO,UAAU,KAAK,GACtD,OAAO,KAAK;KACV,SAAS,iCAAiC,OAAO,KAAK;KACtD;IACF,CAAC;IAEH;GAEF,KAAK;I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TailorField, F as output, O as TailorFieldType, S as EnumValue, _ as TailorDBTypeMetadata, c as RawRelationConfig, d as TailorAnyDBField, f as TailorAnyDBType, m as TailorDBInstance, s as PluginAttachment, x as DefinedFieldMetadata, y as TailorDBTypeParsedSettings } from "./types-
|
|
2
|
+
import { C as FieldMetadata, D as TailorField, F as output, O as TailorFieldType, S as EnumValue, _ as TailorDBTypeMetadata, c as RawRelationConfig, d as TailorAnyDBField, f as TailorAnyDBType, m as TailorDBInstance, s as PluginAttachment, x as DefinedFieldMetadata, y as TailorDBTypeParsedSettings } from "./types-rj8YJcEe.mjs";
|
|
3
3
|
import { IsAny, JsonObject, JsonValue } from "type-fest";
|
|
4
4
|
|
|
5
5
|
//#region src/types/auth-connection.generated.d.ts
|
|
@@ -937,4 +937,4 @@ interface Plugin<TypeConfig = unknown, PluginConfig = unknown> {
|
|
|
937
937
|
}
|
|
938
938
|
//#endregion
|
|
939
939
|
export { UserAttributeListKey as $, IncomingWebhookTrigger as A, AuthConnectionTokenResult as B, ResolverInput as C, FunctionOperation as D, ExecutorInput as E, WorkflowOperation as F, BeforeLoginHookArgs as G, AuthOwnConfig as H, BaseGeneratorConfig as I, FederatedIdentityClaims as J, DefinedAuth as K, TailorDBType as L, ScheduleTriggerInput as M, TailorDBTrigger as N, GqlOperation as O, WebhookOperation as P, UserAttributeKey as Q, TypeSourceInfoEntry as R, Resolver as S, Executor as T, AuthServiceInput as U, AuthExternalConfig as V, BeforeLoginClaims as W, OAuth2ClientGrantType as X, FederatedIdentityProvider as Y, SCIMAttributeType as Z, ResolverReadyContext as _, AuthConnectionConfig as _t, Plugin as a, IDToken as at, TailorDBTypeForPlugin as b, PluginExecutorContextBase as c, OAuth2ClientInput as ct, PluginGeneratedResolver as d, SCIMAttribute as dt, UserAttributeMap as et, PluginGeneratedType as f, SCIMAttributeMapping as ft, ResolverNamespaceData as g, TenantProvider as gt, PluginProcessContext as h, SCIMResource as ht, NamespacePluginOutput as i, BuiltinIdP as it, ResolverExecutedTrigger as j, IdpUserTrigger as k, PluginGeneratedExecutor as l, OIDC as lt, PluginOutput as m, SCIMConfig as mt, GeneratorConfig as n, ValueOperand as nt, PluginConfigs as o, IdProvider as ot, PluginNamespaceProcessContext as p, SCIMAuthorization as pt, FederatedIdentity as q, GeneratorResult as r, AuthInvoker as rt, PluginExecutorContext as s, OAuth2Client as st, ExecutorReadyContext as t, UsernameFieldKey as tt, PluginGeneratedExecutorWithFile as u, SAML as ut, TailorDBNamespaceData as v, AuthConnectionOAuth2Config as vt, AuthAccessTokenTrigger as w, TypePluginOutput as x, TailorDBReadyContext as y, AuthConfig as z };
|
|
940
|
-
//# sourceMappingURL=types-
|
|
940
|
+
//# sourceMappingURL=types-Dynq4AJv.d.mts.map
|
|
@@ -3,6 +3,9 @@ import { NonEmptyObject } from "type-fest";
|
|
|
3
3
|
|
|
4
4
|
//#region src/types/helpers.d.ts
|
|
5
5
|
type Prettify<T> = { [K in keyof T as string extends K ? never : K]: T[K] } & {};
|
|
6
|
+
type TypeLevelError<Message extends string> = {
|
|
7
|
+
readonly $error: Message;
|
|
8
|
+
};
|
|
6
9
|
type DeepWritable<T> = T extends Date | RegExp | Function ? T : T extends object ? { -readonly [P in keyof T]: DeepWritable<T[P]> } & {} : T;
|
|
7
10
|
type output<T> = T extends {
|
|
8
11
|
_output: infer U;
|
|
@@ -709,5 +712,5 @@ type TailorDBServiceInput = {
|
|
|
709
712
|
[namespace: string]: TailorDBServiceConfigInput | TailorDBExternalConfig;
|
|
710
713
|
};
|
|
711
714
|
//#endregion
|
|
712
|
-
export { Validators as A, FieldMetadata as C, TailorField as D, FieldValidateInput as E, output as F, JsonCompatible as M, JsonValue$1 as N, TailorFieldType as O,
|
|
713
|
-
//# sourceMappingURL=types-
|
|
715
|
+
export { Validators as A, FieldMetadata as C, TailorField as D, FieldValidateInput as E, output as F, JsonCompatible as M, JsonValue$1 as N, TailorFieldType as O, TypeLevelError as P, EnumValue as S, FieldOutput as T, TailorDBTypeMetadata as _, Hooks as a, ArrayFieldOutput as b, RawRelationConfig as c, TailorAnyDBField as d, TailorAnyDBType as f, TailorDBType as g, TailorDBServiceInput as h, Hook as i, InferFieldsOutput as j, TailorToTs as k, RelationType as l, TailorDBInstance as m, DefinedDBFieldMetadata as n, IndexDef as o, TailorDBField as p, ExcludeNestedDBFields as r, PluginAttachment as s, DBFieldMetadata as t, SerialConfig as u, TypeFeatures as v, FieldOptions as w, DefinedFieldMetadata as x, TailorDBTypeParsedSettings as y };
|
|
716
|
+
//# sourceMappingURL=types-rj8YJcEe.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { s as TailorInvoker } from "../../types-DTcZ2Yax.mjs";
|
|
2
|
-
import { j as TailorDBType } from "../../workflow.generated-
|
|
3
|
-
import {
|
|
2
|
+
import { j as TailorDBType } from "../../workflow.generated-DJULCuRr.mjs";
|
|
3
|
+
import { Et as WORKFLOW_TEST_ENV_KEY, It as TailorField, n as output } from "../../index-BAEaAqmz.mjs";
|
|
4
4
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/test/mock.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as TailorUser, i as InferredAttributeMap } from "./types-DTcZ2Yax.mjs";
|
|
2
|
-
import { A as Validators,
|
|
3
|
-
import { it as BuiltinIdP, o as PluginConfigs, z as AuthConfig } from "./types-
|
|
2
|
+
import { A as Validators, E as FieldValidateInput, F as output, O as TailorFieldType, P as TypeLevelError, S as EnumValue, T as FieldOutput, a as Hooks, g as TailorDBType$1, h as TailorDBServiceInput, i as Hook, j as InferFieldsOutput, k as TailorToTs, l as RelationType, n as DefinedDBFieldMetadata, o as IndexDef, p as TailorDBField$1, r as ExcludeNestedDBFields, t as DBFieldMetadata, u as SerialConfig, v as TypeFeatures, w as FieldOptions } from "./types-rj8YJcEe.mjs";
|
|
3
|
+
import { it as BuiltinIdP, o as PluginConfigs, z as AuthConfig } from "./types-Dynq4AJv.mjs";
|
|
4
4
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
5
5
|
|
|
6
6
|
//#region src/configure/types/field.d.ts
|
|
@@ -126,8 +126,138 @@ declare const unsafeAllowAllTypePermission: TailorTypePermission;
|
|
|
126
126
|
declare const unsafeAllowAllGqlPermission: TailorTypeGqlPermission;
|
|
127
127
|
//#endregion
|
|
128
128
|
//#region src/configure/services/tailordb/schema.d.ts
|
|
129
|
-
type
|
|
129
|
+
type AnyBuilderMethod = any;
|
|
130
|
+
type TailorAnyDBField = Omit<TailorDBField$1<AnyBuilderMethod, AnyBuilderMethod>, "fields"> & {
|
|
131
|
+
readonly fields: Record<string, AnyBuilderMethod>;
|
|
132
|
+
_metadata: DBFieldMetadata;
|
|
133
|
+
parse: AnyBuilderMethod;
|
|
134
|
+
_parseInternal: AnyBuilderMethod;
|
|
135
|
+
readonly typeName: TypeLevelError<string>;
|
|
136
|
+
description: AnyBuilderMethod;
|
|
137
|
+
relation: AnyBuilderMethod;
|
|
138
|
+
index: AnyBuilderMethod;
|
|
139
|
+
unique: AnyBuilderMethod;
|
|
140
|
+
vector: AnyBuilderMethod;
|
|
141
|
+
hooks: AnyBuilderMethod;
|
|
142
|
+
validate: AnyBuilderMethod;
|
|
143
|
+
serial: AnyBuilderMethod;
|
|
144
|
+
clone: AnyBuilderMethod;
|
|
145
|
+
};
|
|
130
146
|
type TailorAnyDBType = TailorDBType<any, any>;
|
|
147
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
148
|
+
type DBFieldTypeNameMethod<Defined extends DefinedDBFieldMetadata> = IsAny<Defined> extends true ? TypeLevelError<string> : TypeLevelError<"typeName cannot be used on TailorDB fields">;
|
|
149
|
+
type WithDBFieldDescription<Defined> = Defined & {
|
|
150
|
+
description: true;
|
|
151
|
+
};
|
|
152
|
+
type WithDBFieldRelation<Defined, S extends RelationType | RelationSelfConfig> = S extends "oneToOne" | "1-1" ? Defined & {
|
|
153
|
+
unique: true;
|
|
154
|
+
index: true;
|
|
155
|
+
relation: true;
|
|
156
|
+
} : S extends {
|
|
157
|
+
type: "oneToOne" | "1-1";
|
|
158
|
+
} ? Defined & {
|
|
159
|
+
unique: true;
|
|
160
|
+
index: true;
|
|
161
|
+
relation: true;
|
|
162
|
+
} : Defined & {
|
|
163
|
+
index: true;
|
|
164
|
+
relation: true;
|
|
165
|
+
};
|
|
166
|
+
type WithDBFieldIndex<Defined> = Defined & {
|
|
167
|
+
index: true;
|
|
168
|
+
};
|
|
169
|
+
type WithDBFieldUnique<Defined> = Defined & {
|
|
170
|
+
unique: true;
|
|
171
|
+
index: true;
|
|
172
|
+
};
|
|
173
|
+
type WithDBFieldVector<Defined> = Defined & {
|
|
174
|
+
vector: true;
|
|
175
|
+
};
|
|
176
|
+
type WithDBFieldHooks<Defined, H> = Defined & {
|
|
177
|
+
hooks: {
|
|
178
|
+
create: H extends {
|
|
179
|
+
create: unknown;
|
|
180
|
+
} ? true : false;
|
|
181
|
+
update: H extends {
|
|
182
|
+
update: unknown;
|
|
183
|
+
} ? true : false;
|
|
184
|
+
};
|
|
185
|
+
serial: false;
|
|
186
|
+
};
|
|
187
|
+
type WithDBFieldValidate<Defined> = Defined & {
|
|
188
|
+
validate: true;
|
|
189
|
+
};
|
|
190
|
+
type WithDBFieldSerial<Defined> = Defined & {
|
|
191
|
+
serial: true;
|
|
192
|
+
hooks: {
|
|
193
|
+
create: false;
|
|
194
|
+
update: false;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
type WithDBFieldCloneOptions<Defined extends DefinedDBFieldMetadata, NewOpt extends FieldOptions> = Omit<Defined, "array"> & {
|
|
198
|
+
array: NewOpt extends {
|
|
199
|
+
array: true;
|
|
200
|
+
} ? true : Defined["array"];
|
|
201
|
+
};
|
|
202
|
+
type FileKeyConflictError<Fields extends Record<string, TailorAnyDBField>, User extends object> = Partial<Record<keyof output<TailorDBType<Fields, User>> & string, TypeLevelError<"file keys cannot use existing field names">>>;
|
|
203
|
+
type DBFieldDescriptionFn<Defined extends DefinedDBFieldMetadata, Output> = (description: string) => TailorDBField<WithDBFieldDescription<Defined>, Output>;
|
|
204
|
+
type DBFieldRelationFn<Defined extends DefinedDBFieldMetadata, Output> = {
|
|
205
|
+
<S extends RelationType, T extends TailorAnyDBType>(config: RelationConfig<S, T>): TailorDBField<WithDBFieldRelation<Defined, S>, Output>;
|
|
206
|
+
<S extends RelationSelfConfig>(config: S): TailorDBField<WithDBFieldRelation<Defined, S>, Output>;
|
|
207
|
+
};
|
|
208
|
+
type DBFieldIndexFn<Defined extends DefinedDBFieldMetadata, Output> = () => TailorDBField<WithDBFieldIndex<Defined>, Output>;
|
|
209
|
+
type DBFieldUniqueFn<Defined extends DefinedDBFieldMetadata, Output> = () => TailorDBField<WithDBFieldUnique<Defined>, Output>;
|
|
210
|
+
type DBFieldVectorFn<Defined extends DefinedDBFieldMetadata, Output> = () => TailorDBField<WithDBFieldVector<Defined>, Output>;
|
|
211
|
+
type DBFieldHooksFn<Defined extends DefinedDBFieldMetadata, Output> = <const H extends Hook<unknown, Output>>(hooks: H) => TailorDBField<WithDBFieldHooks<Defined, H>, Output>;
|
|
212
|
+
type DBFieldValidateFn<Defined extends DefinedDBFieldMetadata, Output> = (...validate: FieldValidateInput<Output>[]) => TailorDBField<WithDBFieldValidate<Defined>, Output>;
|
|
213
|
+
type DBFieldSerialFn<Defined extends DefinedDBFieldMetadata, Output> = (config: SerialConfig<Defined["type"] & ("integer" | "string")>) => TailorDBField<WithDBFieldSerial<Defined>, Output>;
|
|
214
|
+
type DBFieldDescriptionMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldDescriptionFn<Defined, Output> : Defined extends {
|
|
215
|
+
description: unknown;
|
|
216
|
+
} ? TypeLevelError<".description() has already been set"> : DBFieldDescriptionFn<Defined, Output>;
|
|
217
|
+
type DBFieldRelationMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldRelationFn<Defined, Output> : Defined extends {
|
|
218
|
+
relation: unknown;
|
|
219
|
+
} ? TypeLevelError<".relation() has already been set"> : DBFieldRelationFn<Defined, Output>;
|
|
220
|
+
type DBFieldIndexMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldIndexFn<Defined, Output> : Defined extends {
|
|
221
|
+
index: unknown;
|
|
222
|
+
} ? TypeLevelError<".index() has already been set"> : Defined extends {
|
|
223
|
+
array: true;
|
|
224
|
+
} ? TypeLevelError<"index cannot be set on array fields"> : DBFieldIndexFn<Defined, Output>;
|
|
225
|
+
type DBFieldUniqueMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldUniqueFn<Defined, Output> : Defined extends {
|
|
226
|
+
unique: unknown;
|
|
227
|
+
} ? TypeLevelError<".unique() has already been set"> : Defined extends {
|
|
228
|
+
array: true;
|
|
229
|
+
} ? TypeLevelError<"unique cannot be set on array fields"> : DBFieldUniqueFn<Defined, Output>;
|
|
230
|
+
type DBFieldVectorMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldVectorFn<Defined, Output> : Defined extends {
|
|
231
|
+
vector: unknown;
|
|
232
|
+
} ? TypeLevelError<".vector() has already been set"> : Defined extends {
|
|
233
|
+
type: "string";
|
|
234
|
+
array: false;
|
|
235
|
+
} ? DBFieldVectorFn<Defined, Output> : TypeLevelError<"vector can only be set on non-array string fields">;
|
|
236
|
+
type DBFieldHooksMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldHooksFn<Defined, Output> : Defined extends {
|
|
237
|
+
serial: true;
|
|
238
|
+
hooks: {
|
|
239
|
+
create: false;
|
|
240
|
+
update: false;
|
|
241
|
+
};
|
|
242
|
+
} ? TypeLevelError<"hooks cannot be set after serial"> : Defined extends {
|
|
243
|
+
hooks: unknown;
|
|
244
|
+
} ? TypeLevelError<".hooks() has already been set"> : Defined extends {
|
|
245
|
+
type: "nested";
|
|
246
|
+
} ? TypeLevelError<"hooks cannot be set on nested type fields"> : DBFieldHooksFn<Defined, Output>;
|
|
247
|
+
type DBFieldValidateMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldValidateFn<Defined, Output> : Defined extends {
|
|
248
|
+
validate: unknown;
|
|
249
|
+
} ? TypeLevelError<".validate() has already been set"> : DBFieldValidateFn<Defined, Output>;
|
|
250
|
+
type DBFieldSerialMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldSerialFn<Defined, Output> : Defined extends {
|
|
251
|
+
serial: true;
|
|
252
|
+
} ? TypeLevelError<".serial() has already been set"> : Defined extends {
|
|
253
|
+
serial: false;
|
|
254
|
+
} ? TypeLevelError<"serial cannot be set after hooks"> : IsAny<Output> extends true ? Defined extends {
|
|
255
|
+
type: "integer" | "string";
|
|
256
|
+
array: false;
|
|
257
|
+
} ? DBFieldSerialFn<Defined, Output> : TypeLevelError<"serial can only be set on non-array integer or string fields"> : null extends Output ? TypeLevelError<"serial can only be set on non-array integer or string fields"> : Defined extends {
|
|
258
|
+
type: "integer" | "string";
|
|
259
|
+
array: false;
|
|
260
|
+
} ? DBFieldSerialFn<Defined, Output> : TypeLevelError<"serial can only be set on non-array integer or string fields">;
|
|
131
261
|
/**
|
|
132
262
|
* Full TailorDBField interface with builder methods.
|
|
133
263
|
* Extends the minimal structural interface from types/ with fluent API methods.
|
|
@@ -148,122 +278,43 @@ interface TailorDBField<Defined extends DefinedDBFieldMetadata = DefinedDBFieldM
|
|
|
148
278
|
* typeName is not available on TailorDB fields.
|
|
149
279
|
* Use typeName on pipeline fields (t.enum / t.object) instead.
|
|
150
280
|
*/
|
|
151
|
-
typeName
|
|
281
|
+
typeName: DBFieldTypeNameMethod<Defined>;
|
|
152
282
|
/**
|
|
153
283
|
* Set a description for the field
|
|
154
284
|
*/
|
|
155
|
-
description<
|
|
156
|
-
description: unknown;
|
|
157
|
-
} ? never : TailorField<CurrentDefined, Output>, description: string): TailorDBField<Prettify<CurrentDefined & {
|
|
158
|
-
description: true;
|
|
159
|
-
}>, Output>;
|
|
285
|
+
description: DBFieldDescriptionMethod<Defined, Output>;
|
|
160
286
|
/**
|
|
161
287
|
* Define a relation to another type.
|
|
162
288
|
*/
|
|
163
|
-
relation<
|
|
164
|
-
relation: unknown;
|
|
165
|
-
} ? never : TailorDBField<CurrentDefined, Output>, config: RelationConfig<S, T>): TailorDBField<S extends "oneToOne" | "1-1" ? Prettify<CurrentDefined & {
|
|
166
|
-
unique: true;
|
|
167
|
-
index: true;
|
|
168
|
-
relation: true;
|
|
169
|
-
}> : Prettify<CurrentDefined & {
|
|
170
|
-
index: true;
|
|
171
|
-
relation: true;
|
|
172
|
-
}>, Output>;
|
|
173
|
-
/**
|
|
174
|
-
* Define a self-referencing relation
|
|
175
|
-
*/
|
|
176
|
-
relation<S extends RelationSelfConfig, CurrentDefined extends Defined>(this: CurrentDefined extends {
|
|
177
|
-
relation: unknown;
|
|
178
|
-
} ? never : TailorDBField<CurrentDefined, Output>, config: S): TailorDBField<S["type"] extends "oneToOne" | "1-1" ? Prettify<CurrentDefined & {
|
|
179
|
-
unique: true;
|
|
180
|
-
index: true;
|
|
181
|
-
relation: true;
|
|
182
|
-
}> : Prettify<CurrentDefined & {
|
|
183
|
-
index: true;
|
|
184
|
-
relation: true;
|
|
185
|
-
}>, Output>;
|
|
289
|
+
relation: DBFieldRelationMethod<Defined, Output>;
|
|
186
290
|
/**
|
|
187
291
|
* Add an index to the field
|
|
188
292
|
*/
|
|
189
|
-
index<
|
|
190
|
-
index: unknown;
|
|
191
|
-
} ? never : CurrentDefined extends {
|
|
192
|
-
array: true;
|
|
193
|
-
} ? never : TailorDBField<CurrentDefined, Output>): TailorDBField<Prettify<CurrentDefined & {
|
|
194
|
-
index: true;
|
|
195
|
-
}>, Output>;
|
|
293
|
+
index: DBFieldIndexMethod<Defined, Output>;
|
|
196
294
|
/**
|
|
197
295
|
* Make the field unique (also adds an index)
|
|
198
296
|
*/
|
|
199
|
-
unique<
|
|
200
|
-
unique: unknown;
|
|
201
|
-
} ? never : CurrentDefined extends {
|
|
202
|
-
array: true;
|
|
203
|
-
} ? never : TailorDBField<CurrentDefined, Output>): TailorDBField<Prettify<CurrentDefined & {
|
|
204
|
-
unique: true;
|
|
205
|
-
index: true;
|
|
206
|
-
}>, Output>;
|
|
297
|
+
unique: DBFieldUniqueMethod<Defined, Output>;
|
|
207
298
|
/**
|
|
208
299
|
* Enable vector search on the field (string type only)
|
|
209
300
|
*/
|
|
210
|
-
vector<
|
|
211
|
-
vector: unknown;
|
|
212
|
-
} ? never : CurrentDefined extends {
|
|
213
|
-
type: "string";
|
|
214
|
-
array: false;
|
|
215
|
-
} ? TailorDBField<CurrentDefined, Output> : never): TailorDBField<Prettify<CurrentDefined & {
|
|
216
|
-
vector: true;
|
|
217
|
-
}>, Output>;
|
|
301
|
+
vector: DBFieldVectorMethod<Defined, Output>;
|
|
218
302
|
/**
|
|
219
303
|
* Add hooks for create/update operations on this field.
|
|
220
304
|
*/
|
|
221
|
-
hooks<
|
|
222
|
-
hooks: unknown;
|
|
223
|
-
} ? never : CurrentDefined extends {
|
|
224
|
-
type: "nested";
|
|
225
|
-
} ? never : TailorDBField<CurrentDefined, Output>, hooks: H): TailorDBField<Prettify<CurrentDefined & {
|
|
226
|
-
hooks?: {
|
|
227
|
-
create: H extends {
|
|
228
|
-
create: unknown;
|
|
229
|
-
} ? true : false;
|
|
230
|
-
update: H extends {
|
|
231
|
-
update: unknown;
|
|
232
|
-
} ? true : false;
|
|
233
|
-
};
|
|
234
|
-
serial: false;
|
|
235
|
-
}>, Output>;
|
|
305
|
+
hooks: DBFieldHooksMethod<Defined, Output>;
|
|
236
306
|
/**
|
|
237
307
|
* Add validation functions to the field.
|
|
238
308
|
*/
|
|
239
|
-
validate<
|
|
240
|
-
validate: unknown;
|
|
241
|
-
} ? never : TailorDBField<CurrentDefined, Output>, ...validate: FieldValidateInput<Output>[]): TailorDBField<Prettify<CurrentDefined & {
|
|
242
|
-
validate: true;
|
|
243
|
-
}>, Output>;
|
|
309
|
+
validate: DBFieldValidateMethod<Defined, Output>;
|
|
244
310
|
/**
|
|
245
311
|
* Configure serial/auto-increment behavior
|
|
246
312
|
*/
|
|
247
|
-
serial<
|
|
248
|
-
serial: unknown;
|
|
249
|
-
} ? never : Output extends null ? never : CurrentDefined extends {
|
|
250
|
-
type: "integer" | "string";
|
|
251
|
-
array: false;
|
|
252
|
-
} ? TailorDBField<CurrentDefined, Output> : never, config: SerialConfig<CurrentDefined["type"] & ("integer" | "string")>): TailorDBField<Prettify<CurrentDefined & {
|
|
253
|
-
serial: true;
|
|
254
|
-
hooks: {
|
|
255
|
-
create: false;
|
|
256
|
-
update: false;
|
|
257
|
-
};
|
|
258
|
-
}>, Output>;
|
|
313
|
+
serial: DBFieldSerialMethod<Defined, Output>;
|
|
259
314
|
/**
|
|
260
315
|
* Clone the field with optional overrides for field options
|
|
261
316
|
*/
|
|
262
|
-
clone<const NewOpt extends FieldOptions>(options?: NewOpt): TailorDBField<
|
|
263
|
-
array: NewOpt extends {
|
|
264
|
-
array: true;
|
|
265
|
-
} ? true : Defined["array"];
|
|
266
|
-
}>, FieldOutput<TailorToTs[Defined["type"]], NewOpt>>;
|
|
317
|
+
clone<const NewOpt extends FieldOptions>(options?: NewOpt): TailorDBField<WithDBFieldCloneOptions<Defined, NewOpt>, FieldOutput<TailorToTs[Defined["type"]], NewOpt>>;
|
|
267
318
|
}
|
|
268
319
|
/**
|
|
269
320
|
* Full TailorDBType interface with builder methods.
|
|
@@ -275,7 +326,7 @@ interface TailorDBType<Fields extends Record<string, TailorAnyDBField> = any, Us
|
|
|
275
326
|
validate(validators: Validators<Fields>): TailorDBType<Fields, User>;
|
|
276
327
|
features(features: Omit<TypeFeatures, "pluralForm">): TailorDBType<Fields, User>;
|
|
277
328
|
indexes(...indexes: IndexDef<TailorDBType<Fields, User>>[]): TailorDBType<Fields, User>;
|
|
278
|
-
files<const F extends string>(files: Record<F, string> &
|
|
329
|
+
files<const F extends string>(files: Record<F, string> & FileKeyConflictError<Fields, User>): TailorDBType<Fields, User>;
|
|
279
330
|
permission<U extends object = User, P extends TailorTypePermission<U, output<TailorDBType<Fields, User>>> = TailorTypePermission<U, output<TailorDBType<Fields, User>>>>(permission: P): TailorDBType<Fields, U>;
|
|
280
331
|
gqlPermission<U extends object = User, P extends TailorTypeGqlPermission<U> = TailorTypeGqlPermission<U>>(permission: P): TailorDBType<Fields, U>;
|
|
281
332
|
description(description: string): TailorDBType<Fields, User>;
|
|
@@ -318,6 +369,14 @@ type FieldParseInternalArgs = {
|
|
|
318
369
|
user: TailorUser;
|
|
319
370
|
pathArray: string[];
|
|
320
371
|
};
|
|
372
|
+
type DBFieldDefined<T extends TailorFieldType, Opt extends FieldOptions> = {
|
|
373
|
+
type: T;
|
|
374
|
+
array: Opt extends {
|
|
375
|
+
array: true;
|
|
376
|
+
} ? true : false;
|
|
377
|
+
};
|
|
378
|
+
type DBFieldOutput<T extends TailorFieldType, Opt extends FieldOptions, OutputBase = TailorToTs[T]> = FieldOutput<OutputBase, Opt>;
|
|
379
|
+
type TailorDBFieldInstance<T extends TailorFieldType, Opt extends FieldOptions, OutputBase = TailorToTs[T]> = TailorDBField<DBFieldDefined<T, Opt>, DBFieldOutput<T, Opt, OutputBase>>;
|
|
321
380
|
/**
|
|
322
381
|
* Create a UUID field.
|
|
323
382
|
* @param options - Field configuration options
|
|
@@ -325,12 +384,7 @@ type FieldParseInternalArgs = {
|
|
|
325
384
|
* @example db.uuid()
|
|
326
385
|
* @example db.uuid({ optional: true })
|
|
327
386
|
*/
|
|
328
|
-
declare function uuid<const Opt extends FieldOptions>(options?: Opt):
|
|
329
|
-
type: "uuid";
|
|
330
|
-
array: Opt extends {
|
|
331
|
-
array: true;
|
|
332
|
-
} ? true : false;
|
|
333
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
387
|
+
declare function uuid<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"uuid", Opt, string>;
|
|
334
388
|
/**
|
|
335
389
|
* Create a string field.
|
|
336
390
|
* @param options - Field configuration options
|
|
@@ -338,12 +392,7 @@ declare function uuid<const Opt extends FieldOptions>(options?: Opt): TailorDBFi
|
|
|
338
392
|
* @example db.string()
|
|
339
393
|
* @example db.string({ optional: true })
|
|
340
394
|
*/
|
|
341
|
-
declare function string<const Opt extends FieldOptions>(options?: Opt):
|
|
342
|
-
type: "string";
|
|
343
|
-
array: Opt extends {
|
|
344
|
-
array: true;
|
|
345
|
-
} ? true : false;
|
|
346
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
395
|
+
declare function string<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"string", Opt, string>;
|
|
347
396
|
/**
|
|
348
397
|
* Create a boolean field.
|
|
349
398
|
* Note: The method name is `bool` but creates a `boolean` type field.
|
|
@@ -352,12 +401,7 @@ declare function string<const Opt extends FieldOptions>(options?: Opt): TailorDB
|
|
|
352
401
|
* @example db.bool()
|
|
353
402
|
* @example db.bool({ optional: true })
|
|
354
403
|
*/
|
|
355
|
-
declare function bool<const Opt extends FieldOptions>(options?: Opt):
|
|
356
|
-
type: "boolean";
|
|
357
|
-
array: Opt extends {
|
|
358
|
-
array: true;
|
|
359
|
-
} ? true : false;
|
|
360
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<boolean, Opt> | null : ArrayFieldOutput<boolean, Opt>>;
|
|
404
|
+
declare function bool<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"boolean", Opt, boolean>;
|
|
361
405
|
/**
|
|
362
406
|
* Create an integer field.
|
|
363
407
|
* @param options - Field configuration options
|
|
@@ -365,12 +409,7 @@ declare function bool<const Opt extends FieldOptions>(options?: Opt): TailorDBFi
|
|
|
365
409
|
* @example db.int()
|
|
366
410
|
* @example db.int({ optional: true })
|
|
367
411
|
*/
|
|
368
|
-
declare function int<const Opt extends FieldOptions>(options?: Opt):
|
|
369
|
-
type: "integer";
|
|
370
|
-
array: Opt extends {
|
|
371
|
-
array: true;
|
|
372
|
-
} ? true : false;
|
|
373
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
|
|
412
|
+
declare function int<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"integer", Opt, number>;
|
|
374
413
|
/**
|
|
375
414
|
* Create a float (decimal number) field.
|
|
376
415
|
* @param options - Field configuration options
|
|
@@ -378,12 +417,7 @@ declare function int<const Opt extends FieldOptions>(options?: Opt): TailorDBFie
|
|
|
378
417
|
* @example db.float()
|
|
379
418
|
* @example db.float({ optional: true })
|
|
380
419
|
*/
|
|
381
|
-
declare function float<const Opt extends FieldOptions>(options?: Opt):
|
|
382
|
-
type: "float";
|
|
383
|
-
array: Opt extends {
|
|
384
|
-
array: true;
|
|
385
|
-
} ? true : false;
|
|
386
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
|
|
420
|
+
declare function float<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"float", Opt, number>;
|
|
387
421
|
interface DecimalFieldOptions extends FieldOptions {
|
|
388
422
|
scale?: number;
|
|
389
423
|
}
|
|
@@ -395,12 +429,7 @@ interface DecimalFieldOptions extends FieldOptions {
|
|
|
395
429
|
* @example db.decimal({ scale: 2 })
|
|
396
430
|
* @example db.decimal({ scale: 2, optional: true })
|
|
397
431
|
*/
|
|
398
|
-
declare function decimal<const Opt extends DecimalFieldOptions>(options?: Opt):
|
|
399
|
-
type: "decimal";
|
|
400
|
-
array: Opt extends {
|
|
401
|
-
array: true;
|
|
402
|
-
} ? true : false;
|
|
403
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
432
|
+
declare function decimal<const Opt extends DecimalFieldOptions>(options?: Opt): TailorDBFieldInstance<"decimal", Opt, string>;
|
|
404
433
|
/**
|
|
405
434
|
* Create a date field (date only, no time component).
|
|
406
435
|
* Format: "yyyy-MM-dd"
|
|
@@ -408,12 +437,7 @@ declare function decimal<const Opt extends DecimalFieldOptions>(options?: Opt):
|
|
|
408
437
|
* @returns A date field
|
|
409
438
|
* @example db.date()
|
|
410
439
|
*/
|
|
411
|
-
declare function date<const Opt extends FieldOptions>(options?: Opt):
|
|
412
|
-
type: "date";
|
|
413
|
-
array: Opt extends {
|
|
414
|
-
array: true;
|
|
415
|
-
} ? true : false;
|
|
416
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
440
|
+
declare function date<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"date", Opt, string>;
|
|
417
441
|
/**
|
|
418
442
|
* Create a datetime field (date and time).
|
|
419
443
|
* Format: ISO 8601 "yyyy-MM-ddTHH:mm:ssZ"
|
|
@@ -421,12 +445,7 @@ declare function date<const Opt extends FieldOptions>(options?: Opt): TailorDBFi
|
|
|
421
445
|
* @returns A datetime field
|
|
422
446
|
* @example db.datetime()
|
|
423
447
|
*/
|
|
424
|
-
declare function datetime<const Opt extends FieldOptions>(options?: Opt):
|
|
425
|
-
type: "datetime";
|
|
426
|
-
array: Opt extends {
|
|
427
|
-
array: true;
|
|
428
|
-
} ? true : false;
|
|
429
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<string | Date, Opt> | null : ArrayFieldOutput<string | Date, Opt>>;
|
|
448
|
+
declare function datetime<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"datetime", Opt, string | Date>;
|
|
430
449
|
/**
|
|
431
450
|
* Create a time field (time only, no date component).
|
|
432
451
|
* Format: "HH:mm"
|
|
@@ -434,12 +453,7 @@ declare function datetime<const Opt extends FieldOptions>(options?: Opt): Tailor
|
|
|
434
453
|
* @returns A time field
|
|
435
454
|
* @example db.time()
|
|
436
455
|
*/
|
|
437
|
-
declare function time<const Opt extends FieldOptions>(options?: Opt):
|
|
438
|
-
type: "time";
|
|
439
|
-
array: Opt extends {
|
|
440
|
-
array: true;
|
|
441
|
-
} ? true : false;
|
|
442
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
456
|
+
declare function time<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"time", Opt, string>;
|
|
443
457
|
/**
|
|
444
458
|
* Create an enum field with a fixed set of allowed string values.
|
|
445
459
|
* @param values - Array of allowed string values, or array of `{ value, description }` objects
|
|
@@ -468,10 +482,7 @@ declare function object<const F extends Record<string, TailorAnyDBField> & Exclu
|
|
|
468
482
|
array: true;
|
|
469
483
|
} ? true : false;
|
|
470
484
|
}, FieldOutput<InferFieldsOutput<F>, Opt>>;
|
|
471
|
-
declare const idField:
|
|
472
|
-
type: "uuid";
|
|
473
|
-
array: false;
|
|
474
|
-
}, string>;
|
|
485
|
+
declare const idField: TailorDBFieldInstance<"uuid", FieldOptions, string>;
|
|
475
486
|
type idField = typeof idField;
|
|
476
487
|
type DBType<F extends {
|
|
477
488
|
id?: never;
|
|
@@ -537,26 +548,20 @@ declare const db: {
|
|
|
537
548
|
* });
|
|
538
549
|
*/
|
|
539
550
|
timestamps: () => {
|
|
540
|
-
createdAt: TailorDBField<{
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
create: false;
|
|
555
|
-
update: true;
|
|
556
|
-
} | undefined;
|
|
557
|
-
serial: false;
|
|
558
|
-
description: true;
|
|
559
|
-
}, string | Date | null>;
|
|
551
|
+
createdAt: TailorDBField<WithDBFieldDescription<WithDBFieldHooks<DBFieldDefined<"datetime", FieldOptions>, {
|
|
552
|
+
readonly create: ({
|
|
553
|
+
value
|
|
554
|
+
}: {
|
|
555
|
+
value: string | Date | null;
|
|
556
|
+
data: unknown;
|
|
557
|
+
user: TailorUser;
|
|
558
|
+
}) => string | Date;
|
|
559
|
+
}>>, string | Date>;
|
|
560
|
+
updatedAt: TailorDBField<WithDBFieldDescription<WithDBFieldHooks<DBFieldDefined<"datetime", {
|
|
561
|
+
readonly optional: true;
|
|
562
|
+
}>, {
|
|
563
|
+
readonly update: () => Date;
|
|
564
|
+
}>>, string | Date | null>;
|
|
560
565
|
};
|
|
561
566
|
};
|
|
562
567
|
};
|
|
@@ -1339,4 +1344,4 @@ type ConcurrencyPolicy = {
|
|
|
1339
1344
|
};
|
|
1340
1345
|
//#endregion
|
|
1341
1346
|
export { TailorDBInstance as A, IdPInput as C, TailorAnyDBField as D, AIGatewayInput as E, TailorTypePermission as F, unsafeAllowAllGqlPermission as I, unsafeAllowAllTypePermission as L, db as M, PermissionCondition as N, TailorAnyDBType as O, TailorTypeGqlPermission as P, AllowedValues as R, IdPGqlOperationsInput as S, AIGatewayDefinitionBrand as T, IdPConfig as _, ExecutorServiceConfig as a, IdPEmailConfig as b, ResolverServiceConfig as c, WorkflowServiceInput as d, StaticWebsiteConfig as f, SecretsDefinitionBrand as g, SecretsConfig as h, AppConfig as i, TailorDBType as j, TailorDBField as k, ResolverServiceInput as l, StaticWebsiteInput as m, RetryPolicy as n, ExecutorServiceInput as o, StaticWebsiteDefinitionBrand as p, HttpAdapterConfigInput as r, ResolverExternalConfig as s, ConcurrencyPolicy as t, WorkflowServiceConfig as u, IdPExternalConfig as v, AIGatewayConfig as w, IdPGqlOperations as x, IdpDefinitionBrand as y, AllowedValuesOutput as z };
|
|
1342
|
-
//# sourceMappingURL=workflow.generated-
|
|
1347
|
+
//# sourceMappingURL=workflow.generated-DJULCuRr.d.mts.map
|