@tailor-platform/sdk 1.2.1 → 1.2.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.
- package/CHANGELOG.md +16 -0
- package/dist/cli/index.mjs +2 -2
- package/dist/cli/lib.d.mts +1 -3
- package/dist/cli/lib.mjs +2 -2
- package/dist/{config-Bc_PBkyF.mjs → config-CnvbSTIP.mjs} +13 -10
- package/dist/config-CnvbSTIP.mjs.map +1 -0
- package/dist/configure/index.d.mts +2 -2
- package/dist/configure/index.mjs +1 -1
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{index-C4nvv_Ew.d.mts → index-aNF917Ib.d.mts} +11 -16
- package/dist/{list-9sLkfPfn.mjs → list-CinLZzZW.mjs} +655 -32
- package/dist/{list-9sLkfPfn.mjs.map → list-CinLZzZW.mjs.map} +1 -1
- package/dist/{types-Du-lo0MV.d.mts → types-C0n7Syhv.d.mts} +55 -42
- package/dist/user-defined.d.ts +1 -0
- package/dist/utils/test/index.d.mts +7 -9
- package/dist/utils/test/index.mjs +5 -7
- package/dist/utils/test/index.mjs.map +1 -1
- package/package.json +9 -6
- package/postinstall.mjs +1 -0
- package/dist/config-Bc_PBkyF.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 1.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#369](https://github.com/tailor-platform/sdk/pull/369) [`202e5a7`](https://github.com/tailor-platform/sdk/commit/202e5a7f5c170de18d98255ca798d19552d2905d) Thanks [@toiroakr](https://github.com/toiroakr)! - Prevent index/unique settings on array fields with type-level constraints and runtime validation
|
|
8
|
+
|
|
9
|
+
- [#371](https://github.com/tailor-platform/sdk/pull/371) [`1c5f2a8`](https://github.com/tailor-platform/sdk/commit/1c5f2a897ef0b346a8de9cb71c7359e09724ac00) Thanks [@riku99](https://github.com/riku99)! - Enable selected JSDoc-related lint rules
|
|
10
|
+
|
|
11
|
+
- [#370](https://github.com/tailor-platform/sdk/pull/370) [`78d4667`](https://github.com/tailor-platform/sdk/commit/78d4667b7f8fc649dd1d1fe8e0aa70bf8c456be9) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency bufbuild/buf to v1.63.0
|
|
12
|
+
|
|
13
|
+
- [#374](https://github.com/tailor-platform/sdk/pull/374) [`8c4bff8`](https://github.com/tailor-platform/sdk/commit/8c4bff8db7dedba16ab6572473d7b93cf9ac2211) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): pin dependency oxlint-tsgolint to 0.10.1
|
|
14
|
+
|
|
15
|
+
- [#375](https://github.com/tailor-platform/sdk/pull/375) [`f42a755`](https://github.com/tailor-platform/sdk/commit/f42a7556785bf97f6aedb3dc03d398f0d38c492d) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency @typescript/native-preview to v7.0.0-dev.20260103.1
|
|
16
|
+
|
|
17
|
+
- [#367](https://github.com/tailor-platform/sdk/pull/367) [`2edef96`](https://github.com/tailor-platform/sdk/commit/2edef96db3b1a6ed88e5fb1f64dab4e2d0dd7867) Thanks [@riku99](https://github.com/riku99)! - Use tsgo and tsgolint in packages/sdk and example
|
|
18
|
+
|
|
3
19
|
## 1.2.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "../chunk-CIV_ash9.mjs";
|
|
3
|
-
import "../config-
|
|
4
|
-
import { $ as withCommonArgs, B as loadWorkspaceId, D as tokenCommand, F as loadConfig, G as initOAuth2Client, H as writePlatformConfig, J as PATScope, K as initOperatorClient, L as apiCommand, N as applyCommand, O as listCommand$5, Q as jsonArgs, R as fetchLatestToken, S as listCommand$6, U as fetchAll, V as readPlatformConfig, W as fetchUserInfo, X as confirmationArgs, Y as commonArgs, Z as deploymentArgs, a as createCommand$3, d as listCommand$7, et as workspaceArgs, h as executionsCommand, j as generateCommand, l as startCommand, p as getCommand$2, q as readPackageJson, r as deleteCommand$3, s as resumeCommand, t as listCommand$8, tt as logger, w as getCommand$1, x as removeCommand, y as showCommand, z as loadAccessToken } from "../list-
|
|
3
|
+
import "../config-CnvbSTIP.mjs";
|
|
4
|
+
import { $ as withCommonArgs, B as loadWorkspaceId, D as tokenCommand, F as loadConfig, G as initOAuth2Client, H as writePlatformConfig, J as PATScope, K as initOperatorClient, L as apiCommand, N as applyCommand, O as listCommand$5, Q as jsonArgs, R as fetchLatestToken, S as listCommand$6, U as fetchAll, V as readPlatformConfig, W as fetchUserInfo, X as confirmationArgs, Y as commonArgs, Z as deploymentArgs, a as createCommand$3, d as listCommand$7, et as workspaceArgs, h as executionsCommand, j as generateCommand, l as startCommand, p as getCommand$2, q as readPackageJson, r as deleteCommand$3, s as resumeCommand, t as listCommand$8, tt as logger, w as getCommand$1, x as removeCommand, y as showCommand, z as loadAccessToken } from "../list-CinLZzZW.mjs";
|
|
5
5
|
import { register } from "node:module";
|
|
6
6
|
import { defineCommand, runCommand, runMain } from "citty";
|
|
7
7
|
import { generateCodeVerifier } from "@badgateway/oauth2-client";
|
package/dist/cli/lib.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference path="./../user-defined.d.ts" />
|
|
2
|
-
import { N as ParsedTailorDBType, Y as OAuth2ClientInput, d as AppConfig,
|
|
3
|
-
import "citty";
|
|
2
|
+
import { N as ParsedTailorDBType, Y as OAuth2ClientInput, d as AppConfig, m as Generator, q as IdProviderConfig, t as Executor, yt as Resolver } from "../types-C0n7Syhv.mjs";
|
|
4
3
|
import { z } from "zod";
|
|
5
4
|
import { OAuth2Client } from "@badgateway/oauth2-client";
|
|
6
5
|
import "@bufbuild/protobuf/wkt";
|
|
@@ -118,7 +117,6 @@ interface CodeGeneratorCore {
|
|
|
118
117
|
}
|
|
119
118
|
/**
|
|
120
119
|
* Generator interface with dependencies-based conditional methods.
|
|
121
|
-
*
|
|
122
120
|
* @template Deps - Dependencies array (e.g., ['tailordb'], ['tailordb', 'resolver'])
|
|
123
121
|
* @template T - Return type of processType
|
|
124
122
|
* @template R - Return type of processResolver
|
package/dist/cli/lib.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../chunk-CIV_ash9.mjs";
|
|
2
|
-
import "../config-
|
|
3
|
-
import { A as generate, B as loadWorkspaceId, C as listOAuth2Clients, E as getMachineUserToken, F as loadConfig, I as apiCall, M as apply, P as generateUserTypes, T as getOAuth2Client, _ as listWorkflowExecutions, b as remove, c as resumeWorkflow, f as listWorkflows, g as getWorkflowExecution, i as deleteWorkspace, k as listMachineUsers, m as getWorkflow, n as listWorkspaces, o as createWorkspace, u as startWorkflow, v as show, z as loadAccessToken } from "../list-
|
|
2
|
+
import "../config-CnvbSTIP.mjs";
|
|
3
|
+
import { A as generate, B as loadWorkspaceId, C as listOAuth2Clients, E as getMachineUserToken, F as loadConfig, I as apiCall, M as apply, P as generateUserTypes, T as getOAuth2Client, _ as listWorkflowExecutions, b as remove, c as resumeWorkflow, f as listWorkflows, g as getWorkflowExecution, i as deleteWorkspace, k as listMachineUsers, m as getWorkflow, n as listWorkspaces, o as createWorkspace, u as startWorkflow, v as show, z as loadAccessToken } from "../list-CinLZzZW.mjs";
|
|
4
4
|
import { register } from "node:module";
|
|
5
5
|
|
|
6
6
|
//#region src/cli/lib.ts
|
|
@@ -337,9 +337,11 @@ var TailorDBField = class TailorDBField extends TailorField {
|
|
|
337
337
|
return super.description(description);
|
|
338
338
|
}
|
|
339
339
|
relation(config) {
|
|
340
|
-
this._metadata.
|
|
340
|
+
if (!this._metadata.array) {
|
|
341
|
+
this._metadata.index = true;
|
|
342
|
+
this._metadata.unique = ["oneToOne", "1-1"].includes(config.type);
|
|
343
|
+
}
|
|
341
344
|
this._metadata.foreignKey = true;
|
|
342
|
-
this._metadata.unique = ["oneToOne", "1-1"].includes(config.type);
|
|
343
345
|
const key = config.toward.key ?? "id";
|
|
344
346
|
const backward = config.backward ?? "";
|
|
345
347
|
if (isRelationSelfConfig(config)) {
|
|
@@ -390,8 +392,8 @@ var TailorDBField = class TailorDBField extends TailorField {
|
|
|
390
392
|
}
|
|
391
393
|
/**
|
|
392
394
|
* Clone the field with optional overrides for field options
|
|
393
|
-
* @param options - Optional field options to override
|
|
394
|
-
* @returns A new TailorDBField instance with the same configuration
|
|
395
|
+
* @param {FieldOptions} [options] - Optional field options to override
|
|
396
|
+
* @returns {TailorDBField<unknown, unknown>} A new TailorDBField instance with the same configuration
|
|
395
397
|
*/
|
|
396
398
|
clone(options) {
|
|
397
399
|
const clonedField = Object.create(Object.getPrototypeOf(this));
|
|
@@ -542,9 +544,9 @@ var TailorDBType = class {
|
|
|
542
544
|
}
|
|
543
545
|
/**
|
|
544
546
|
* Pick specific fields from the type
|
|
545
|
-
* @param keys - Array of field keys to pick
|
|
546
|
-
* @param options - Optional field options to apply to picked fields
|
|
547
|
-
* @returns An object containing only the specified fields
|
|
547
|
+
* @param {(keyof Fields)[]} keys - Array of field keys to pick
|
|
548
|
+
* @param {FieldOptions} options - Optional field options to apply to picked fields
|
|
549
|
+
* @returns {Record<string, TailorDBField<unknown, unknown>>} An object containing only the specified fields
|
|
548
550
|
*/
|
|
549
551
|
pickFields(keys, options) {
|
|
550
552
|
const result = {};
|
|
@@ -554,8 +556,9 @@ var TailorDBType = class {
|
|
|
554
556
|
}
|
|
555
557
|
/**
|
|
556
558
|
* Omit specific fields from the type
|
|
557
|
-
* @
|
|
558
|
-
* @
|
|
559
|
+
* @template K
|
|
560
|
+
* @param {(keyof Fields)[]} keys - Array of field keys to omit
|
|
561
|
+
* @returns {Omit<Fields, K>} An object containing all fields except the specified ones
|
|
559
562
|
*/
|
|
560
563
|
omitFields(keys) {
|
|
561
564
|
const keysSet = new Set(keys);
|
|
@@ -653,4 +656,4 @@ function defineGenerators(...configs) {
|
|
|
653
656
|
|
|
654
657
|
//#endregion
|
|
655
658
|
export { createWorkflowJob as a, unsafeAllowAllGqlPermission as c, TailorField as d, t as f, WORKFLOW_JOB_BRAND as i, unsafeAllowAllTypePermission as l, defineGenerators as n, defineAuth as o, getDistDir as r, db as s, defineConfig as t, unauthenticatedTailorUser as u };
|
|
656
|
-
//# sourceMappingURL=config-
|
|
659
|
+
//# sourceMappingURL=config-CnvbSTIP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-CnvbSTIP.mjs","names":["type: T","fields: Record<string, TailorAnyField>","issues: StandardSchemaV1.Issue[]","createField","uuid","string","bool","int","float","date","datetime","time","_enum","object","unauthenticatedTailorUser: TailorUser","unsafeAllowAllTypePermission: TailorTypePermission","unsafeAllowAllGqlPermission: TailorTypeGqlPermission","name: string","fields: Fields","indexes: Record<string, { fields: string[]; unique?: boolean }>","validators","description: string | undefined","fieldDef: F","distPath: string | null"],"sources":["../src/configure/types/field.ts","../src/configure/types/type.ts","../src/configure/types/user.ts","../src/configure/services/tailordb/permission.ts","../src/configure/services/tailordb/schema.ts","../src/configure/services/auth/index.ts","../src/configure/services/workflow/job.ts","../src/configure/config.ts"],"sourcesContent":["import { type EnumValue } from \"@/parser/service/tailordb/types\";\n\nexport type AllowedValue = EnumValue;\n\nexport type AllowedValues = [string | EnumValue, ...(string | EnumValue)[]];\n\nexport function mapAllowedValues(values: AllowedValues): AllowedValue[] {\n return values.map((value) => {\n if (typeof value === \"string\") {\n return { value, description: \"\" };\n }\n return { ...value, description: value.description ?? \"\" };\n });\n}\n\nexport type AllowedValuesOutput<V extends AllowedValues> = V[number] extends infer T\n ? T extends string\n ? T\n : T extends { value: infer K }\n ? K\n : never\n : never;\n","import { type AllowedValues, type AllowedValuesOutput, mapAllowedValues } from \"./field\";\nimport {\n type TailorFieldType,\n type TailorToTs,\n type FieldMetadata,\n type DefinedFieldMetadata,\n type FieldOptions,\n type FieldOutput,\n} from \"./types\";\nimport type { Prettify, InferFieldsOutput } from \"./helpers\";\nimport type { FieldValidateInput } from \"./validation\";\nimport type { TailorUser } from \"@/configure/types\";\nimport type { TailorFieldInput } from \"@/parser/service/resolver/types\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\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} as const;\n\n// oxlint-disable-next-line no-explicit-any\nexport type TailorAnyField = TailorField<any>;\n\nexport class TailorField<\n const Defined extends DefinedFieldMetadata = DefinedFieldMetadata,\n const Output = any,\n M extends FieldMetadata = FieldMetadata,\n T extends TailorFieldType = TailorFieldType,\n> implements TailorFieldInput {\n protected _metadata: M;\n public readonly _defined: Defined = undefined as unknown as Defined;\n public readonly _output = undefined as Output;\n\n get metadata() {\n return { ...this._metadata };\n }\n\n protected constructor(\n public readonly type: T,\n options?: FieldOptions,\n public readonly fields: Record<string, TailorAnyField> = {},\n values?: AllowedValues,\n ) {\n this._metadata = { required: true } as M;\n if (options) {\n if (options.optional === true) {\n this._metadata.required = false;\n }\n if (options.array === true) {\n this._metadata.array = true;\n }\n }\n if (values) {\n this._metadata.allowedValues = mapAllowedValues(values);\n }\n }\n\n static create<\n const TType extends TailorFieldType,\n const TOptions extends FieldOptions,\n const OutputBase = TailorToTs[TType],\n >(\n type: TType,\n options?: TOptions,\n fields?: Record<string, TailorAnyField>,\n values?: AllowedValues,\n ) {\n return new TailorField<\n { type: TType; array: TOptions extends { array: true } ? true : false },\n FieldOutput<OutputBase, TOptions>\n >(type, options, fields, values);\n }\n\n description<CurrentDefined extends Defined>(\n this: CurrentDefined extends { description: unknown }\n ? never\n : TailorField<CurrentDefined, Output>,\n description: string,\n ) {\n this._metadata.description = description;\n return this as TailorField<Prettify<CurrentDefined & { description: true }>, Output>;\n }\n\n typeName<CurrentDefined extends Defined>(\n this: CurrentDefined extends { typeName: unknown }\n ? never\n : CurrentDefined extends { type: \"enum\" | \"nested\" }\n ? TailorField<CurrentDefined, Output>\n : never,\n typeName: string,\n ) {\n this._metadata.typeName = typeName;\n return this as TailorField<Prettify<CurrentDefined & { typeName: true }>, Output>;\n }\n\n validate<CurrentDefined extends Defined>(\n this: CurrentDefined extends { validate: unknown }\n ? never\n : TailorField<CurrentDefined, Output>,\n ...validate: FieldValidateInput<Output>[]\n ) {\n this._metadata.validate = validate;\n return this as TailorField<Prettify<CurrentDefined & { validate: true }>, Output>;\n }\n\n /**\n * Parse and validate a value against this field's validation rules\n * Returns StandardSchema Result type with success or failure\n */\n parse(args: {\n value: unknown;\n data: unknown;\n user: TailorUser;\n }): StandardSchemaV1.Result<Output> {\n return this._parseInternal({\n value: args.value,\n data: args.data,\n user: args.user,\n pathArray: [],\n });\n }\n\n /**\n * Validate a single value (not an array element)\n * Used internally for array element validation\n * @private\n */\n private _validateValue(args: {\n value: TailorToTs[T];\n data: unknown;\n user: TailorUser;\n pathArray: string[];\n }): StandardSchemaV1.Issue[] {\n const { value, data, user, pathArray } = args;\n const issues: StandardSchemaV1.Issue[] = [];\n\n // Type-specific validation\n switch (this.type) {\n case \"string\":\n if (typeof value !== \"string\") {\n issues.push({\n message: `Expected a string: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\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: pathArray.length > 0 ? pathArray : undefined,\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: pathArray.length > 0 ? pathArray : undefined,\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: pathArray.length > 0 ? pathArray : undefined,\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: pathArray.length > 0 ? pathArray : undefined,\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: pathArray.length > 0 ? pathArray : undefined,\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: pathArray.length > 0 ? pathArray : undefined,\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: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n case \"enum\":\n if (this.metadata.allowedValues) {\n const allowedValues = this.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: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n }\n break;\n\n case \"nested\":\n // Validate nested object fields\n if (\n typeof value !== \"object\" ||\n value === null ||\n Array.isArray(value) ||\n value instanceof Date\n ) {\n issues.push({\n message: `Expected an object: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n } else if (this.fields && Object.keys(this.fields).length > 0) {\n for (const [fieldName, field] of Object.entries(this.fields)) {\n const fieldValue = value?.[fieldName];\n const result = field._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 = this.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: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n }\n }\n\n return issues;\n }\n\n /**\n * Internal parse method that tracks field path for nested validation\n * @private\n */\n private _parseInternal(args: {\n value: any;\n data: unknown;\n user: TailorUser;\n pathArray: string[];\n }): StandardSchemaV1.Result<Output> {\n const { value, data, user, pathArray } = args;\n const issues: StandardSchemaV1.Issue[] = [];\n\n // 1. Check required/optional\n const isNullOrUndefined = value === null || value === undefined;\n if (this.metadata.required && isNullOrUndefined) {\n issues.push({\n message: \"Required field is missing\",\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n return { issues };\n }\n\n // If optional and null/undefined, skip further validation\n if (!this.metadata.required && isNullOrUndefined) {\n return { value };\n }\n\n // 2. Check array type\n if (this.metadata.array) {\n if (!Array.isArray(value)) {\n issues.push({\n message: \"Expected an array\",\n path: pathArray.length > 0 ? pathArray : undefined,\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 = this._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 Output };\n }\n\n // 3. Type-specific validation and custom validation\n const valueIssues = this._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\nconst createField = TailorField.create;\nfunction uuid<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"uuid\", options);\n}\n\nfunction string<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"string\", options);\n}\n\nfunction bool<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"boolean\", options);\n}\n\nfunction int<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"integer\", options);\n}\n\nfunction float<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"float\", options);\n}\n\nfunction date<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"date\", options);\n}\n\nfunction datetime<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"datetime\", options);\n}\n\nfunction time<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"time\", options);\n}\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 createField<\"enum\", Opt, AllowedValuesOutput<V>>(\"enum\", options, undefined, values);\n}\n\nfunction object<const F extends Record<string, TailorAnyField>, const Opt extends FieldOptions>(\n fields: F,\n options?: Opt,\n) {\n const objectField = createField(\"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 date,\n datetime,\n time,\n enum: _enum,\n object,\n};\n","// Interfaces for module augmentation\n// Users can extend these via: declare module \"@tailor-platform/sdk\" { interface AttributeMap { ... } }\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface AttributeMap {}\nexport interface AttributeList {\n __tuple?: []; // Marker for tuple type\n}\n\nexport type InferredAttributeMap = keyof AttributeMap extends never\n ? Record<string, string | string[] | boolean | boolean[] | undefined>\n : AttributeMap;\n\nexport type InferredAttributeList = AttributeList[\"__tuple\"] extends []\n ? string[]\n : AttributeList[\"__tuple\"];\n\n/** Represents a user in the Tailor platform. */\nexport type TailorUser = {\n /**\n * The ID of the user.\n * For unauthenticated users, this will be a nil UUID.\n */\n id: string;\n /**\n * The type of the user.\n * For unauthenticated users, this will be an empty string.\n */\n type: \"user\" | \"machine_user\" | \"\";\n /** The ID of the workspace the user belongs to. */\n workspaceId: string;\n /**\n * A map of the user's attributes.\n * For unauthenticated users, this will be null.\n */\n attributes: InferredAttributeMap | null;\n /**\n * A list of the user's attributes.\n * For unauthenticated users, this will be an empty array.\n */\n attributeList: InferredAttributeList;\n};\n\n/** Represents an unauthenticated user in the Tailor platform. */\nexport const unauthenticatedTailorUser: TailorUser = {\n id: \"00000000-0000-0000-0000-000000000000\",\n type: \"\",\n workspaceId: \"00000000-0000-0000-0000-000000000000\",\n attributes: null,\n attributeList: [],\n};\n","import type { InferredAttributeMap } from \"../../types\";\nimport type { ValueOperand } from \"../auth\";\n\nexport type TailorTypePermission<\n User extends object = InferredAttributeMap,\n Type extends object = object,\n> = {\n create: readonly ActionPermission<\"record\", User, Type, false>[];\n read: readonly ActionPermission<\"record\", User, Type, false>[];\n update: readonly ActionPermission<\"record\", User, Type, true>[];\n delete: readonly ActionPermission<\"record\", User, Type, false>[];\n};\n\ntype ActionPermission<\n Level extends \"record\" | \"gql\" = \"record\" | \"gql\",\n User extends object = InferredAttributeMap,\n Type extends object = object,\n Update extends boolean = boolean,\n> =\n | {\n conditions:\n | PermissionCondition<Level, User, Update, Type>\n | readonly PermissionCondition<Level, User, Update, Type>[];\n description?: string | undefined;\n permit?: boolean;\n }\n | readonly [...PermissionCondition<Level, User, Update, Type>, ...([] | [boolean])] // single array condition\n | readonly [...PermissionCondition<Level, User, Update, Type>[], ...([] | [boolean])]; // multiple array condition\n\nexport type TailorTypeGqlPermission<\n User extends object = InferredAttributeMap,\n Type extends object = object,\n> = readonly GqlPermissionPolicy<User, Type>[];\n\ntype GqlPermissionPolicy<\n User extends object = InferredAttributeMap,\n Type extends object = object,\n> = {\n conditions: readonly PermissionCondition<\"gql\", User, boolean, Type>[];\n actions: \"all\" | readonly GqlPermissionAction[];\n permit?: boolean;\n description?: string;\n};\n\ntype GqlPermissionAction = \"read\" | \"create\" | \"update\" | \"delete\" | \"aggregate\" | \"bulkUpsert\";\n\nexport type PermissionCondition<\n Level extends \"record\" | \"gql\" = \"record\" | \"gql\",\n User extends object = InferredAttributeMap,\n Update extends boolean = boolean,\n Type extends object = object,\n> = readonly [\n PermissionOperand<Level, User, Type, Update>,\n PermissionOperator,\n PermissionOperand<Level, User, Type, Update>,\n];\n\ntype UserOperand<User extends object = InferredAttributeMap> = {\n user:\n | {\n [K in keyof User]: User[K] extends string | string[] | boolean | boolean[] ? K : never;\n }[keyof User]\n | \"id\"\n | \"_loggedIn\";\n};\n\ntype RecordOperand<Type extends object, Update extends boolean = false> = Update extends true\n ? { oldRecord: (keyof Type & string) | \"id\" } | { newRecord: (keyof Type & string) | \"id\" }\n : { record: (keyof Type & string) | \"id\" };\n\nexport type PermissionOperand<\n Level extends \"record\" | \"gql\" = \"record\" | \"gql\",\n User extends object = InferredAttributeMap,\n Type extends object = object,\n Update extends boolean = boolean,\n> =\n | UserOperand<User>\n | ValueOperand\n | (Level extends \"record\" ? RecordOperand<Type, Update> : never);\n\ntype PermissionOperator = \"=\" | \"!=\" | \"in\" | \"not in\";\n\n/**\n * Grants full record-level access without any conditions.\n *\n * Unsafe and intended only for local development, prototyping, or tests.\n * Do not use this in production environments, as it effectively disables\n * authorization checks.\n */\nexport const unsafeAllowAllTypePermission: TailorTypePermission = {\n create: [{ conditions: [], permit: true }],\n read: [{ conditions: [], permit: true }],\n update: [{ conditions: [], permit: true }],\n delete: [{ conditions: [], permit: true }],\n};\n\n/**\n * Grants full GraphQL access (all actions) without any conditions.\n *\n * Unsafe and intended only for local development, prototyping, or tests.\n * Do not use this in production environments, as it effectively disables\n * authorization checks.\n */\nexport const unsafeAllowAllGqlPermission: TailorTypeGqlPermission = [\n { conditions: [], actions: \"all\", permit: true },\n];\n","import { clone } from \"es-toolkit\";\nimport { type AllowedValues, type AllowedValuesOutput } from \"@/configure/types/field\";\nimport { TailorField } from \"@/configure/types/type\";\nimport {\n type FieldOptions,\n type FieldOutput,\n type TailorFieldType,\n type TailorToTs,\n} from \"@/configure/types/types\";\nimport { type TailorDBTypeMetadata, type RawPermissions } from \"@/parser/service/tailordb/types\";\nimport { type TailorTypeGqlPermission, type TailorTypePermission } from \"./permission\";\nimport {\n type DBFieldMetadata,\n type DefinedDBFieldMetadata,\n type Hooks,\n type Hook,\n type SerialConfig,\n type IndexDef,\n type TypeFeatures,\n type ExcludeNestedDBFields,\n} from \"./types\";\nimport type { InferredAttributeMap } from \"@/configure/types\";\nimport type { Prettify, output, InferFieldsOutput } from \"@/configure/types/helpers\";\nimport type { FieldValidateInput, ValidateConfig, Validators } from \"@/configure/types/validation\";\n\ntype RelationType = \"oneToOne\" | \"1-1\" | \"manyToOne\" | \"n-1\" | \"N-1\" | \"keyOnly\";\n\ninterface RelationConfig<S extends RelationType, T extends TailorDBType> {\n type: S;\n toward: {\n type: T;\n as?: string;\n key?: keyof T[\"fields\"] & string;\n };\n backward?: string;\n}\n\n// Special config variant for self-referencing relations\ntype RelationSelfConfig = {\n type: RelationType;\n toward: {\n type: \"self\";\n as?: string;\n key?: string;\n };\n backward?: string;\n};\n\ninterface PendingSelfRelation {\n type: RelationType;\n as?: string;\n key: string;\n backward: string;\n}\n\nfunction isRelationSelfConfig(\n config: RelationConfig<RelationType, TailorDBType> | RelationSelfConfig,\n): config is RelationSelfConfig {\n return config.toward.type === \"self\";\n}\n\ninterface ReferenceConfig<T extends TailorAnyDBType> {\n type: TailorAnyDBType;\n key: keyof T[\"fields\"] & string;\n nameMap: [string | undefined, string];\n}\n\n// oxlint-disable-next-line no-explicit-any\nexport type TailorAnyDBField = TailorDBField<any, any>;\n\nexport class TailorDBField<\n const Defined extends DefinedDBFieldMetadata,\n const Output,\n> extends TailorField<Defined, Output, DBFieldMetadata> {\n private _ref: ReferenceConfig<TailorDBType> | undefined = undefined;\n private _pendingSelfRelation: PendingSelfRelation | undefined = undefined;\n\n get reference(): Readonly<ReferenceConfig<TailorDBType>> | undefined {\n return clone(this._ref);\n }\n\n get metadata() {\n return { ...this._metadata };\n }\n\n private constructor(\n type: TailorFieldType,\n options?: FieldOptions,\n fields?: Record<string, TailorAnyDBField>,\n values?: AllowedValues,\n ) {\n super(type, options, fields, values);\n }\n\n static create<\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, TailorAnyDBField>,\n values?: AllowedValues,\n ) {\n return new TailorDBField<\n { type: T; array: TOptions extends { array: true } ? true : false },\n FieldOutput<OutputBase, TOptions>\n >(type, options, fields, values);\n }\n\n description<CurrentDefined extends Defined>(\n this: CurrentDefined extends { description: unknown }\n ? never\n : TailorField<CurrentDefined, Output>,\n description: string,\n ): TailorDBField<Prettify<CurrentDefined & { description: true }>, Output> {\n return super.description(description) as any;\n }\n\n relation<S extends RelationType, T extends TailorAnyDBType, CurrentDefined extends Defined>(\n this: CurrentDefined extends { relation: unknown }\n ? never\n : TailorDBField<CurrentDefined, Output>,\n config: RelationConfig<S, T>,\n ): TailorDBField<\n S extends \"oneToOne\" | \"1-1\"\n ? Prettify<CurrentDefined & { unique: true; index: true; relation: true }>\n : Prettify<CurrentDefined & { index: true; relation: true }>,\n Output\n >;\n\n // Overload: self-referencing variant\n relation<S extends RelationSelfConfig, CurrentDefined extends Defined>(\n this: CurrentDefined extends { relation: unknown }\n ? never\n : TailorDBField<CurrentDefined, Output>,\n config: S,\n ): TailorDBField<\n S[\"type\"] extends \"oneToOne\" | \"1-1\"\n ? Prettify<CurrentDefined & { unique: true; index: true; relation: true }>\n : Prettify<CurrentDefined & { index: true; relation: true }>,\n Output\n >;\n\n // Implementation\n relation<CurrentDefined extends Defined>(\n this: CurrentDefined extends { relation: unknown }\n ? never\n : TailorDBField<CurrentDefined, Output>,\n config: RelationConfig<RelationType, TailorDBType> | RelationSelfConfig,\n ): TailorDBField<DefinedDBFieldMetadata, Output> {\n // Index and unique are not supported on array fields\n if (!this._metadata.array) {\n this._metadata.index = true;\n this._metadata.unique = [\"oneToOne\", \"1-1\"].includes(config.type);\n }\n this._metadata.foreignKey = true;\n\n const key = config.toward.key ?? \"id\";\n const backward = config.backward ?? \"\";\n\n if (isRelationSelfConfig(config)) {\n // Defer resolving the self reference until the type is constructed\n this._pendingSelfRelation = {\n type: config.type,\n as: config.toward.as,\n key,\n backward,\n };\n return this;\n }\n\n this._metadata.foreignKeyType = config.toward.type.name;\n this._metadata.foreignKeyField = key;\n if (config.type === \"keyOnly\") {\n return this;\n }\n\n const forward = config.toward.as;\n this._ref = {\n type: config.toward.type,\n nameMap: [forward, backward],\n key,\n };\n this._metadata.relation = true;\n return this;\n }\n\n index<CurrentDefined extends Defined>(\n this: CurrentDefined extends { index: unknown }\n ? never\n : CurrentDefined extends { array: true }\n ? never\n : TailorDBField<CurrentDefined, Output>,\n ) {\n this._metadata.index = true;\n return this as TailorDBField<Prettify<CurrentDefined & { index: true }>, Output>;\n }\n\n unique<CurrentDefined extends Defined>(\n this: CurrentDefined extends { unique: unknown }\n ? never\n : CurrentDefined extends { array: true }\n ? never\n : TailorDBField<CurrentDefined, Output>,\n ) {\n this._metadata.unique = true;\n this._metadata.index = true;\n return this as TailorDBField<Prettify<CurrentDefined & { unique: true; index: true }>, Output>;\n }\n\n vector<CurrentDefined extends Defined>(\n this: CurrentDefined extends { vector: unknown }\n ? never\n : CurrentDefined extends { type: \"string\"; array: false }\n ? TailorDBField<CurrentDefined, Output>\n : never,\n ) {\n this._metadata.vector = true;\n return this as TailorDBField<Prettify<CurrentDefined & { vector: true }>, Output>;\n }\n\n hooks<CurrentDefined extends Defined, const H extends Hook<unknown, Output>>(\n this: CurrentDefined extends { hooks: unknown }\n ? never\n : CurrentDefined extends { type: \"nested\" }\n ? never\n : TailorDBField<CurrentDefined, Output>,\n hooks: H,\n ) {\n this._metadata.hooks = hooks;\n return this as TailorDBField<\n Prettify<\n CurrentDefined & {\n hooks?: {\n create: H extends { create: unknown } ? true : false;\n update: H extends { update: unknown } ? true : false;\n };\n serial: false;\n }\n >,\n Output\n >;\n }\n\n validate<CurrentDefined extends Defined>(\n this: CurrentDefined extends { validate: unknown }\n ? never\n : TailorDBField<CurrentDefined, Output>,\n ...validate: FieldValidateInput<Output>[]\n ) {\n this._metadata.validate = validate;\n return this as TailorDBField<Prettify<CurrentDefined & { validate: true }>, Output>;\n }\n\n serial<CurrentDefined extends Defined>(\n this: CurrentDefined extends { serial: unknown }\n ? never\n : Output extends null\n ? never\n : CurrentDefined extends { type: \"integer\" | \"string\"; array: false }\n ? TailorDBField<CurrentDefined, Output>\n : never,\n config: SerialConfig<CurrentDefined[\"type\"] & (\"integer\" | \"string\")>,\n ) {\n (this as TailorDBField<CurrentDefined, Output>)._metadata.serial = config;\n return this as TailorDBField<\n Prettify<\n CurrentDefined & {\n serial: true;\n hooks: { create: false; update: false };\n }\n >,\n Output\n >;\n }\n\n /**\n * Clone the field with optional overrides for field options\n * @param {FieldOptions} [options] - Optional field options to override\n * @returns {TailorDBField<unknown, unknown>} A new TailorDBField instance with the same configuration\n */\n clone<const NewOpt extends FieldOptions>(\n options?: NewOpt,\n ): TailorDBField<\n Prettify<\n Omit<Defined, \"array\"> & {\n array: NewOpt extends { array: true } ? true : Defined[\"array\"];\n }\n >,\n FieldOutput<TailorToTs[Defined[\"type\"]], NewOpt>\n > {\n // Create a clone using Object.create to preserve prototype chain\n const clonedField = Object.create(Object.getPrototypeOf(this)) as TailorDBField<\n Defined,\n Output\n >;\n\n // Copy all properties\n Object.assign(clonedField, {\n type: this.type,\n fields: this.fields,\n _defined: this._defined,\n _output: this._output,\n });\n\n // Clone and merge metadata with new options\n clonedField._metadata = { ...this._metadata };\n if (options) {\n if (options.optional !== undefined) {\n clonedField._metadata.required = !options.optional;\n }\n if (options.array !== undefined) {\n clonedField._metadata.array = options.array;\n }\n }\n\n // Copy internal state\n if (this._ref) {\n clonedField._ref = clone(this._ref);\n }\n if (this._pendingSelfRelation) {\n clonedField._pendingSelfRelation = { ...this._pendingSelfRelation };\n }\n\n return clonedField as TailorAnyDBField;\n }\n}\n\nconst createField = TailorDBField.create;\nfunction uuid<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"uuid\", options);\n}\n\nfunction string<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"string\", options);\n}\n\nfunction bool<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"boolean\", options);\n}\n\nfunction int<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"integer\", options);\n}\n\nfunction float<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"float\", options);\n}\n\nfunction date<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"date\", options);\n}\n\nfunction datetime<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"datetime\", options);\n}\n\nfunction time<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"time\", options);\n}\n\nfunction _enum<const V extends AllowedValues, const Opt extends FieldOptions>(\n values: V,\n options?: Opt,\n): TailorDBField<\n { type: \"enum\"; array: Opt extends { array: true } ? true : false },\n FieldOutput<AllowedValuesOutput<V>, Opt>\n> {\n return createField<\"enum\", Opt, AllowedValuesOutput<V>>(\"enum\", options, undefined, values);\n}\n\nfunction object<\n const F extends Record<string, TailorAnyDBField> & ExcludeNestedDBFields<F>,\n const Opt extends FieldOptions,\n>(fields: F, options?: Opt) {\n return createField(\"nested\", options, fields) as unknown as TailorDBField<\n { type: \"nested\"; array: Opt extends { array: true } ? true : false },\n FieldOutput<InferFieldsOutput<F>, Opt>\n >;\n}\n\n// oxlint-disable-next-line no-explicit-any\nexport type TailorAnyDBType = TailorDBType<any, any>;\n\nexport class TailorDBType<\n const Fields extends Record<string, TailorAnyDBField> = any,\n User extends object = InferredAttributeMap,\n> {\n public readonly _output = null as unknown as InferFieldsOutput<Fields>;\n public _description?: string;\n private _settings: TypeFeatures = {};\n private _indexes: IndexDef<this>[] = [];\n private _permissions: RawPermissions = {};\n private _files: Record<string, string> = {};\n\n constructor(\n public readonly name: string,\n public readonly fields: Fields,\n options: { pluralForm?: string; description?: string },\n ) {\n this._description = options.description;\n\n if (options.pluralForm) {\n if (name === options.pluralForm) {\n throw new Error(`The name and the plural form must be different. name=${name}`);\n }\n this._settings.pluralForm = options.pluralForm;\n }\n\n // Resolve any pending self-references now that the type is constructed\n Object.entries(this.fields).forEach(([fieldName, field]) => {\n const f = field as unknown as {\n _pendingSelfRelation: PendingSelfRelation | undefined;\n _metadata: DBFieldMetadata;\n _ref: ReferenceConfig<TailorAnyDBType>;\n };\n const pending = f._pendingSelfRelation;\n if (pending) {\n f._metadata.foreignKeyType = this.name;\n f._metadata.foreignKeyField = pending.key;\n if (pending.type === \"keyOnly\") {\n return this;\n }\n\n const forward = pending.as ?? fieldName.replace(/(ID|Id|id)$/u, \"\");\n // Type conversion for manipulating private _ref.\n f._ref = {\n type: this,\n nameMap: [forward, pending.backward],\n key: pending.key,\n };\n }\n });\n }\n\n get metadata(): TailorDBTypeMetadata {\n // Convert indexes to the format expected by the manifest\n const indexes: Record<string, { fields: string[]; unique?: boolean }> = {};\n if (this._indexes && this._indexes.length > 0) {\n this._indexes.forEach((index) => {\n const fieldNames = index.fields.map((field) => String(field));\n const key = index.name || `idx_${fieldNames.join(\"_\")}`;\n indexes[key] = {\n fields: fieldNames,\n unique: index.unique,\n };\n });\n }\n\n return {\n name: this.name,\n description: this._description,\n settings: this._settings,\n permissions: this._permissions,\n files: this._files,\n ...(Object.keys(indexes).length > 0 && { indexes }),\n };\n }\n\n hooks(hooks: Hooks<Fields>) {\n Object.entries(hooks).forEach(([fieldName, fieldHooks]: [string, any]) => {\n this.fields[fieldName].hooks(fieldHooks);\n });\n return this;\n }\n\n validate(validators: Validators<Fields>) {\n Object.entries(validators).forEach(([fieldName, fieldValidators]) => {\n const field = this.fields[fieldName] as TailorAnyDBField;\n\n const validators = fieldValidators as\n | FieldValidateInput<unknown>\n | FieldValidateInput<unknown>[];\n\n const isValidateConfig = (v: unknown): v is ValidateConfig<unknown> => {\n return Array.isArray(v) && v.length === 2 && typeof v[1] === \"string\";\n };\n\n if (Array.isArray(validators)) {\n if (isValidateConfig(validators)) {\n field.validate(validators);\n } else {\n field.validate(...validators);\n }\n } else {\n field.validate(validators);\n }\n });\n return this;\n }\n\n features(features: Omit<TypeFeatures, \"pluralForm\">) {\n this._settings = { ...this._settings, ...features };\n return this;\n }\n\n indexes(...indexes: IndexDef<this>[]) {\n this._indexes = indexes;\n return this;\n }\n\n files<const F extends string>(\n files: Record<F, string> & Partial<Record<keyof output<this>, never>>,\n ) {\n this._files = files;\n return this;\n }\n\n permission<\n U extends object = User,\n P extends TailorTypePermission<U, output<this>> = TailorTypePermission<U, output<this>>,\n >(permission: P) {\n const ret = this as TailorDBType<Fields, U>;\n ret._permissions.record = permission;\n return ret;\n }\n\n gqlPermission<\n U extends object = User,\n P extends TailorTypeGqlPermission<U> = TailorTypeGqlPermission<U>,\n >(permission: P) {\n const ret = this as TailorDBType<Fields, U>;\n ret._permissions.gql = permission;\n return ret;\n }\n\n description(description: string) {\n this._description = description;\n return this;\n }\n\n /**\n * Pick specific fields from the type\n * @param {(keyof Fields)[]} keys - Array of field keys to pick\n * @param {FieldOptions} options - Optional field options to apply to picked fields\n * @returns {Record<string, TailorDBField<unknown, unknown>>} An object containing only the specified fields\n */\n pickFields<K extends keyof Fields, const Opt extends FieldOptions>(keys: K[], options: Opt) {\n const result = {} as Record<K, TailorAnyDBField>;\n for (const key of keys) {\n if (options) {\n result[key] = this.fields[key].clone(options);\n } else {\n result[key] = this.fields[key];\n }\n }\n return result as {\n [P in K]: Fields[P] extends TailorDBField<infer D, infer _O>\n ? TailorDBField<\n Omit<D, \"array\"> & {\n array: Opt extends { array: true } ? true : D[\"array\"];\n },\n FieldOutput<TailorToTs[D[\"type\"]], Opt>\n >\n : never;\n };\n }\n\n /**\n * Omit specific fields from the type\n * @template K\n * @param {(keyof Fields)[]} keys - Array of field keys to omit\n * @returns {Omit<Fields, K>} An object containing all fields except the specified ones\n */\n omitFields<K extends keyof Fields>(keys: K[]): Omit<Fields, K> {\n const keysSet = new Set(keys);\n const result = {} as Record<string, TailorAnyDBField>;\n for (const key in this.fields) {\n if (Object.hasOwn(this.fields, key) && !keysSet.has(key as unknown as K)) {\n result[key] = this.fields[key];\n }\n }\n return result as Omit<Fields, K>;\n }\n}\n\nexport type TailorDBInstance<\n Fields extends Record<string, TailorAnyDBField> = any,\n User extends object = InferredAttributeMap,\n> = InstanceType<typeof TailorDBType<Fields, User>>;\n\nconst idField = uuid();\ntype idField = typeof idField;\ntype DBType<F extends { id?: never } & Record<string, TailorAnyDBField>> = TailorDBInstance<\n { id: idField } & F\n>;\n\n/**\n * Creates a new database type with the specified fields\n * @param {string | [string, string]} name - The name of the type, or a tuple of [name, pluralForm]\n * @param {Record<string, TailorDBField<unknown, unknown>>} fields - The field definitions for the type\n * @returns {DBType<F>} A new TailorDBType instance\n */\nfunction dbType<const F extends { id?: never } & Record<string, TailorAnyDBField>>(\n name: string | [string, string],\n fields: F,\n): DBType<F>;\n/**\n * Creates a new database type with the specified fields and description\n * @param {string | [string, string]} name - The name of the type, or a tuple of [name, pluralForm]\n * @param {string} description - A description of the type\n * @param {Record<string, TailorDBField<unknown, unknown>>} fields - The field definitions for the type\n * @returns {DBType<F>} A new TailorDBType instance\n */\nfunction dbType<const F extends { id?: never } & Record<string, TailorAnyDBField>>(\n name: string | [string, string],\n description: string,\n fields: F,\n): DBType<F>;\nfunction dbType<const F extends { id?: never } & Record<string, TailorAnyDBField>>(\n name: string | [string, string],\n fieldsOrDescription: string | F,\n fields?: F,\n): DBType<F> {\n const typeName = Array.isArray(name) ? name[0] : name;\n const pluralForm = Array.isArray(name) ? name[1] : undefined;\n\n let description: string | undefined;\n let fieldDef: F;\n if (typeof fieldsOrDescription === \"string\") {\n description = fieldsOrDescription;\n fieldDef = fields as F;\n } else {\n fieldDef = fieldsOrDescription;\n }\n return new TailorDBType<{ id: idField } & F>(\n typeName,\n {\n id: idField,\n ...fieldDef,\n },\n { pluralForm, description },\n ) as DBType<F>;\n}\n\nexport const db = {\n type: dbType,\n uuid,\n string,\n bool,\n int,\n float,\n date,\n datetime,\n time,\n enum: _enum,\n object,\n fields: {\n timestamps: () => ({\n createdAt: datetime()\n .hooks({ create: () => new Date() })\n .description(\"Record creation timestamp\"),\n updatedAt: datetime({ optional: true })\n .hooks({ update: () => new Date() })\n .description(\"Record last update timestamp\"),\n }),\n },\n};\n","import { type TailorDBInstance } from \"../tailordb/schema\";\nimport type {\n AuthInvoker as ParserAuthInvoker,\n AuthServiceInput,\n UserAttributeListKey,\n UserAttributeMap,\n} from \"@/parser/service/auth/types\";\n\ndeclare const authDefinitionBrand: unique symbol;\ntype AuthDefinitionBrand = { readonly [authDefinitionBrand]: true };\n\nexport type {\n OIDC,\n SAML,\n IDToken,\n BuiltinIdP,\n IdProviderConfig,\n OAuth2ClientGrantType,\n OAuth2ClientInput as OAuth2Client,\n SCIMAuthorization,\n SCIMAttributeType,\n SCIMAttribute,\n SCIMAttributeMapping,\n SCIMResource,\n SCIMConfig,\n TenantProviderConfig,\n ValueOperand,\n UsernameFieldKey,\n UserAttributeKey,\n UserAttributeListKey,\n UserAttributeMap,\n AuthServiceInput,\n} from \"@/parser/service/auth/types\";\n\n/**\n * Invoker type compatible with tailor.v1.AuthInvoker\n * - namespace: auth service name\n * - machineUserName: machine user name\n */\nexport type AuthInvoker<M extends string> = Omit<ParserAuthInvoker, \"machineUserName\"> & {\n machineUserName: M;\n};\n\nexport function defineAuth<\n const Name extends string,\n const User extends TailorDBInstance,\n const AttributeMap extends UserAttributeMap<User>,\n const AttributeList extends UserAttributeListKey<User>[],\n const MachineUserNames extends string,\n>(name: Name, config: AuthServiceInput<User, AttributeMap, AttributeList, MachineUserNames>) {\n const result = {\n ...config,\n name,\n invoker<M extends MachineUserNames>(machineUser: M) {\n return { namespace: name, machineUserName: machineUser } as const;\n },\n } as const satisfies AuthServiceInput<User, AttributeMap, AttributeList, MachineUserNames> & {\n name: string;\n invoker<M extends MachineUserNames>(machineUser: M): AuthInvoker<M>;\n };\n\n return result as typeof result & AuthDefinitionBrand;\n}\n\nexport type AuthExternalConfig = { name: string; external: true };\n\nexport type AuthOwnConfig = ReturnType<typeof defineAuth<string, any, any, any, string>>;\n\nexport type AuthConfig = AuthOwnConfig | AuthExternalConfig;\n","import type { TailorEnv } from \"@/configure/types/env\";\nimport type { JsonCompatible } from \"@/configure/types/helpers\";\nimport type { Jsonifiable, Jsonify, JsonPrimitive } from \"type-fest\";\n\n/**\n * Symbol used to brand WorkflowJob objects created by createWorkflowJob.\n * This enables reliable runtime detection of workflow jobs regardless of\n * how they were imported or assigned (variable reassignment, destructuring, etc.)\n */\nexport const WORKFLOW_JOB_BRAND = Symbol.for(\"tailor:workflow-job\");\n\n/**\n * Context object passed as the second argument to workflow job body functions.\n */\nexport type WorkflowJobContext = {\n env: TailorEnv;\n};\n\n/**\n * Allowed output types for workflow job body functions.\n * Includes Jsonifiable (JSON-serializable values including objects with toJSON like Date),\n * undefined, and void.\n */\nexport type WorkflowJobOutput = Jsonifiable | undefined | void;\n\n/**\n * Convert output type to what trigger returns after JSON serialization.\n * - Jsonifiable values are converted via Jsonify (Date -> string, etc.)\n * - undefined remains undefined\n * - void becomes void\n */\ntype JsonifyOutput<T> = T extends Jsonifiable ? Jsonify<T> : T;\n\n/**\n * Input type constraint for workflow jobs.\n * Accepts any type that is JSON-compatible (primitives, arrays, objects with JSON-compatible values).\n * Excludes objects with toJSON method (like Date) since they won't be serialized in input.\n */\nexport type WorkflowJobInput = undefined | JsonCompatible<unknown>;\n\n/**\n * WorkflowJob represents a job that can be triggered in a workflow.\n *\n * Type constraints:\n * - Input: Must be JSON-compatible (no Date/toJSON objects) or undefined. Interfaces are allowed.\n * - Output: Must be Jsonifiable, undefined, or void\n * - Trigger returns Jsonify<Output> (Date becomes string after JSON.stringify)\n */\nexport interface WorkflowJob<Name extends string = string, Input = undefined, Output = undefined> {\n readonly [WORKFLOW_JOB_BRAND]?: true;\n name: Name;\n /**\n * Trigger this job with the given input.\n * At runtime, this is a placeholder that calls the body function.\n * During bundling, calls to .trigger() are transformed to\n * tailor.workflow.triggerJobFunction(\"<job-name>\", args).\n *\n * Returns Jsonify<Output> because the value passes through JSON.stringify.\n */\n trigger: [Input] extends [undefined]\n ? () => Promise<JsonifyOutput<Awaited<Output>>>\n : (input: Input) => Promise<JsonifyOutput<Awaited<Output>>>;\n body: (input: Input, context: WorkflowJobContext) => Output | Promise<Output>;\n}\n\n/**\n * Check if a type contains any non-JSON-compatible values.\n * Returns `true` if the type is valid for input, `false` otherwise.\n */\ntype IsValidInput<T> = T extends undefined\n ? true\n : T extends JsonPrimitive\n ? true\n : T extends readonly (infer U)[]\n ? IsValidInput<U>\n : T extends object\n ? T extends { toJSON: () => unknown }\n ? false\n : { [K in keyof T]: IsValidInput<T[K]> }[keyof T] extends true\n ? true\n : false\n : false;\n\n/**\n * Check if a type is valid for output.\n * Returns `true` if the type is valid, `false` otherwise.\n */\ntype IsValidOutput<T> = T extends undefined | void\n ? true\n : T extends JsonPrimitive\n ? true\n : T extends readonly (infer U)[]\n ? IsValidOutput<U>\n : T extends object\n ? { [K in keyof T]: IsValidOutput<T[K]> }[keyof T] extends true\n ? true\n : false\n : false;\n\n/**\n * Body function type with conditional constraint.\n * If input contains invalid types (like Date), the body type becomes `never` to cause an error.\n */\ntype WorkflowJobBody<I, O> =\n IsValidInput<I> extends true\n ? IsValidOutput<O> extends true\n ? (input: I, context: WorkflowJobContext) => O | Promise<O>\n : never\n : never;\n\nexport const createWorkflowJob = <const Name extends string, I = undefined, O = undefined>(config: {\n readonly name: Name;\n readonly body: WorkflowJobBody<I, O>;\n}): WorkflowJob<Name, I, Awaited<O>> => {\n return {\n [WORKFLOW_JOB_BRAND]: true,\n name: config.name,\n // JSON.parse(JSON.stringify(...)) ensures the return value matches Jsonify<Output> type.\n // This converts Date objects to strings, matching actual runtime behavior.\n trigger: async (args?: unknown) => {\n const ret = await tailor.workflow.triggerJobFunction(config.name, args);\n return ret ? JSON.parse(JSON.stringify(ret)) : ret;\n },\n body: config.body,\n } as WorkflowJob<Name, I, Awaited<O>>;\n};\n","import type { AuthConfig } from \"@/configure/services/auth\";\nimport type { ExecutorServiceInput } from \"@/configure/services/executor/types\";\nimport type { IdPConfig } from \"@/configure/services/idp\";\nimport type { ResolverServiceInput } from \"@/configure/services/resolver/types\";\nimport type { StaticWebsiteConfig } from \"@/configure/services/staticwebsite\";\nimport type { TailorDBServiceInput } from \"@/configure/services/tailordb/types\";\nimport type { WorkflowServiceInput } from \"@/configure/services/workflow/types\";\nimport type { GeneratorConfig } from \"@/parser/generator-config/types\";\n\nexport interface AppConfig<\n Auth extends AuthConfig = AuthConfig,\n Idp extends IdPConfig[] = IdPConfig[],\n StaticWebsites extends StaticWebsiteConfig[] = StaticWebsiteConfig[],\n Env extends Record<string, string | number | boolean> = Record<string, string | number | boolean>,\n> {\n name: string;\n env?: Env;\n cors?: string[];\n allowedIpAddresses?: string[];\n disableIntrospection?: boolean;\n db?: TailorDBServiceInput;\n resolver?: ResolverServiceInput;\n idp?: Idp;\n auth?: Auth;\n executor?: ExecutorServiceInput;\n workflow?: WorkflowServiceInput;\n staticWebsites?: StaticWebsites;\n}\n\nlet distPath: string | null = null;\nexport const getDistDir = (): string => {\n const configured = process.env.TAILOR_SDK_OUTPUT_DIR;\n if (configured && configured !== distPath) {\n distPath = configured;\n } else if (distPath === null) {\n distPath = configured || \".tailor-sdk\";\n }\n return distPath;\n};\n\nexport function defineConfig<\n const Config extends AppConfig &\n // type-fest's Exact works recursively and causes type errors, so we use a shallow version here.\n Record<Exclude<keyof Config, keyof AppConfig>, never>,\n>(config: Config) {\n return config;\n}\n\nexport function defineGenerators(...configs: GeneratorConfig[]) {\n return configs;\n}\n"],"mappings":";;;AAMA,SAAgB,iBAAiB,QAAuC;AACtE,QAAO,OAAO,KAAK,UAAU;AAC3B,MAAI,OAAO,UAAU,SACnB,QAA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AAgB,iBAAiB,GAAG,SAA4B;AAC9D,QAAO"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference path="./../user-defined.d.ts" />
|
|
2
|
-
import { $ as SCIMAttributeMapping, A as db, B as AuthExternalConfig, C as ResolverServiceConfig, D as TailorDBField, E as ExecutorServiceInput, F as TailorTypeGqlPermission, G as BuiltinIdP, H as AuthOwnConfig, I as TailorTypePermission, J as OAuth2ClientGrantType, K as IDToken, L as unsafeAllowAllGqlPermission, O as TailorDBInstance, P as PermissionCondition, Q as SCIMAttribute, R as unsafeAllowAllTypePermission, S as ResolverExternalConfig, T as ExecutorServiceConfig, U as defineAuth, V as AuthInvoker, W as AuthServiceInput, X as OIDC, Y as OAuth2ClientInput, Z as SAML, _ as StaticWebsiteConfig, at as UserAttributeKey, b as IdPExternalConfig, ct as UsernameFieldKey,
|
|
3
|
-
import { A as createWorkflow, C as FunctionOperation, D as WorkflowOperation, E as WebhookOperation, F as WorkflowJobOutput, I as createWorkflowJob, L as createResolver, M as WorkflowJob, N as WorkflowJobContext, O as Workflow, P as WorkflowJobInput,
|
|
2
|
+
import { $ as SCIMAttributeMapping, A as db, B as AuthExternalConfig, C as ResolverServiceConfig, D as TailorDBField, E as ExecutorServiceInput, F as TailorTypeGqlPermission, G as BuiltinIdP, H as AuthOwnConfig, I as TailorTypePermission, J as OAuth2ClientGrantType, K as IDToken, L as unsafeAllowAllGqlPermission, O as TailorDBInstance, P as PermissionCondition, Q as SCIMAttribute, R as unsafeAllowAllTypePermission, S as ResolverExternalConfig, T as ExecutorServiceConfig, U as defineAuth, V as AuthInvoker, W as AuthServiceInput, X as OIDC, Y as OAuth2ClientInput, Z as SAML, _ as StaticWebsiteConfig, _t as TailorField, at as UserAttributeKey, b as IdPExternalConfig, ct as UsernameFieldKey, et as SCIMAttributeType, f as defineConfig, ft as AttributeList, g as WorkflowServiceInput, h as WorkflowServiceConfig, ht as unauthenticatedTailorUser, it as TenantProviderConfig, k as TailorDBType, lt as ValueOperand, mt as TailorUser, nt as SCIMConfig, ot as UserAttributeListKey, p as defineGenerators, pt as AttributeMap, q as IdProviderConfig, rt as SCIMResource, st as UserAttributeMap, tt as SCIMAuthorization, ut as Env, v as defineStaticWebSite, vt as QueryType, w as ResolverServiceInput, x as defineIdp, y as IdPConfig, yt as Resolver, z as AuthConfig } from "../types-C0n7Syhv.mjs";
|
|
3
|
+
import { A as createWorkflow, C as FunctionOperation, D as WorkflowOperation, E as WebhookOperation, F as WorkflowJobOutput, I as createWorkflowJob, L as createResolver, M as WorkflowJob, N as WorkflowJobContext, O as Workflow, P as WorkflowJobInput, S as resolverExecutedTrigger, T as Operation, _ as ResolverExecutedArgs, a as Trigger, b as recordDeletedTrigger, c as IncomingWebhookTrigger, d as ScheduleTrigger, f as scheduleTrigger, g as RecordUpdatedArgs, h as RecordTrigger, i as createExecutor, j as WORKFLOW_JOB_BRAND, k as WorkflowConfig, l as incomingWebhookTrigger, m as RecordDeletedArgs, n as output, o as IncomingWebhookArgs, p as RecordCreatedArgs, r as t, s as IncomingWebhookRequest, t as infer, u as ScheduleArgs, v as ResolverExecutedTrigger, w as GqlOperation, x as recordUpdatedTrigger, y as recordCreatedTrigger } from "../index-aNF917Ib.mjs";
|
|
4
4
|
export { AttributeList, AttributeMap, AuthConfig, AuthExternalConfig, AuthInvoker, AuthOwnConfig, AuthServiceInput, BuiltinIdP, Env, ExecutorServiceConfig, ExecutorServiceInput, FunctionOperation, GqlOperation, IDToken, IdPConfig, IdPExternalConfig, IdProviderConfig, IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookTrigger, OAuth2ClientInput as OAuth2Client, OAuth2ClientGrantType, OIDC, Operation, PermissionCondition, QueryType, RecordCreatedArgs, RecordDeletedArgs, RecordTrigger, RecordUpdatedArgs, Resolver, ResolverExecutedArgs, ResolverExecutedTrigger, ResolverExternalConfig, ResolverServiceConfig, ResolverServiceInput, SAML, SCIMAttribute, SCIMAttributeMapping, SCIMAttributeType, SCIMAuthorization, SCIMConfig, SCIMResource, ScheduleArgs, ScheduleTrigger, StaticWebsiteConfig, TailorDBField, TailorDBInstance, TailorDBType, TailorField, TailorTypeGqlPermission, TailorTypePermission, TailorUser, TenantProviderConfig, Trigger, UserAttributeKey, UserAttributeListKey, UserAttributeMap, UsernameFieldKey, ValueOperand, WORKFLOW_JOB_BRAND, WebhookOperation, Workflow, WorkflowConfig, WorkflowJob, WorkflowJobContext, WorkflowJobInput, WorkflowJobOutput, WorkflowOperation, WorkflowServiceConfig, WorkflowServiceInput, createExecutor, createResolver, createWorkflow, createWorkflowJob, db, defineAuth, defineConfig, defineGenerators, defineIdp, defineStaticWebSite, incomingWebhookTrigger, infer, output, recordCreatedTrigger, recordDeletedTrigger, recordUpdatedTrigger, resolverExecutedTrigger, scheduleTrigger, t, unauthenticatedTailorUser, unsafeAllowAllGqlPermission, unsafeAllowAllTypePermission };
|
package/dist/configure/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as createWorkflowJob, c as unsafeAllowAllGqlPermission, d as TailorField, f as t$1, i as WORKFLOW_JOB_BRAND, l as unsafeAllowAllTypePermission, n as defineGenerators, o as defineAuth, s as db, t as defineConfig, u as unauthenticatedTailorUser } from "../config-
|
|
1
|
+
import { a as createWorkflowJob, c as unsafeAllowAllGqlPermission, d as TailorField, f as t$1, i as WORKFLOW_JOB_BRAND, l as unsafeAllowAllTypePermission, n as defineGenerators, o as defineAuth, s as db, t as defineConfig, u as unauthenticatedTailorUser } from "../config-CnvbSTIP.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/configure/services/resolver/resolver.ts
|
|
4
4
|
function createResolver(config) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["t","_t"],"sources":["../../src/configure/services/resolver/resolver.ts","../../src/configure/services/executor/executor.ts","../../src/configure/services/executor/trigger/event.ts","../../src/configure/services/executor/trigger/schedule.ts","../../src/configure/services/executor/trigger/webhook.ts","../../src/configure/services/workflow/workflow.ts","../../src/configure/services/staticwebsite/index.ts","../../src/configure/services/idp/index.ts","../../src/configure/index.ts"],"sourcesContent":["import { t, TailorField } from \"@/configure/types/type\";\nimport type { TailorUser } from \"@/configure/types\";\nimport type { TailorEnv } from \"@/configure/types/env\";\nimport type { InferFieldsOutput, output } from \"@/configure/types/helpers\";\nimport type { ResolverInput } from \"@/parser/service/resolver/types\";\n\ntype Context<Input extends Record<string, TailorField<any>> | undefined> = {\n input: Input extends Record<string, TailorField<any>> ? InferFieldsOutput<Input> : never;\n user: TailorUser;\n env: TailorEnv;\n};\n\ntype OutputType<O> =\n O extends TailorField<any>\n ? output<O>\n : O extends Record<string, TailorField<any>>\n ? InferFieldsOutput<O>\n : never;\n\n/**\n * Normalized output type that preserves generic type information.\n * - If Output is already a TailorField, use it as-is\n * - If Output is a Record of fields, wrap it as a nested TailorField\n */\ntype NormalizedOutput<Output extends TailorField<any> | Record<string, TailorField<any>>> =\n Output extends TailorField<any>\n ? Output\n : TailorField<\n { type: \"nested\"; array: false },\n InferFieldsOutput<Extract<Output, Record<string, TailorField<any>>>>\n >;\n\ntype ResolverReturn<\n Input extends Record<string, TailorField<any>> | undefined,\n Output extends TailorField<any> | Record<string, TailorField<any>>,\n> = Omit<ResolverInput, \"input\" | \"output\" | \"body\"> &\n Readonly<{\n input?: Input;\n output: NormalizedOutput<Output>;\n body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;\n }>;\n\nexport function createResolver<\n Input extends Record<string, TailorField<any>> | undefined = undefined,\n Output extends TailorField<any> | Record<string, TailorField<any>> = TailorField<any>,\n>(\n config: Omit<ResolverInput, \"input\" | \"output\" | \"body\"> &\n Readonly<{\n input?: Input;\n output: Output;\n body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;\n }>,\n): ResolverReturn<Input, Output> {\n const normalizedOutput =\n config.output instanceof TailorField ? config.output : t.object(config.output);\n\n return {\n ...config,\n output: normalizedOutput,\n } as ResolverReturn<Input, Output>;\n}\n\nexport type ResolverConfig = ReturnType<typeof createResolver<any, any>>;\n","import type { Operation } from \"./operation\";\nimport type { Trigger } from \"./trigger\";\nimport type { AuthInvoker } from \"@/configure/services/auth\";\nimport type { Workflow } from \"@/configure/services/workflow/workflow\";\nimport type { ExecutorInput } from \"@/parser/service/executor/types\";\n\n/**\n * Extract mainJob's Input type from Workflow.\n */\ntype WorkflowInput<W extends Workflow> = Parameters<W[\"trigger\"]>[0];\n\ntype ExecutorBase<Args> = Omit<ExecutorInput, \"trigger\" | \"operation\"> & {\n trigger: Trigger<Args>;\n};\n\n/**\n * Executor type with conditional inference for workflow operations.\n * When operation.kind is \"workflow\", infers W from the workflow property\n * to ensure args type matches the workflow's mainJob input type.\n */\ntype Executor<Args, O> = O extends {\n kind: \"workflow\";\n workflow: infer W extends Workflow;\n}\n ? ExecutorBase<Args> & {\n operation: {\n kind: \"workflow\";\n workflow: W;\n args?: WorkflowInput<W> | ((args: Args) => WorkflowInput<W>);\n authInvoker?: AuthInvoker<string>;\n };\n }\n : ExecutorBase<Args> & {\n operation: O;\n };\n\nexport function createExecutor<\n Args,\n O extends Operation<Args> | { kind: \"workflow\"; workflow: Workflow },\n>(config: Executor<Args, O>) {\n return config;\n}\n","import type { ResolverConfig } from \"@/configure/services/resolver/resolver\";\nimport type { TailorDBType } from \"@/configure/services/tailordb/schema\";\nimport type { TailorEnv } from \"@/configure/types/env\";\nimport type { output } from \"@/configure/types/helpers\";\nimport type {\n RecordTrigger as ParserRecordTrigger,\n ResolverExecutedTrigger as ParserResolverExecutedTrigger,\n} from \"@/parser/service/executor/types\";\n\ninterface EventArgs {\n workspaceId: string;\n appNamespace: string;\n env: TailorEnv;\n}\n\ninterface RecordArgs extends EventArgs {\n typeName: string;\n}\n\nexport interface RecordCreatedArgs<T extends TailorDBType> extends RecordArgs {\n newRecord: output<T>;\n}\n\nexport interface RecordUpdatedArgs<T extends TailorDBType> extends RecordArgs {\n newRecord: output<T>;\n oldRecord: output<T>;\n}\n\nexport interface RecordDeletedArgs<T extends TailorDBType> extends RecordArgs {\n oldRecord: output<T>;\n}\n\nexport type ResolverExecutedArgs<R extends ResolverConfig> = EventArgs & {\n resolverName: string;\n} & (\n | {\n success: true;\n result: output<R[\"output\"]>;\n error?: never;\n }\n | {\n success: false;\n result?: never;\n error: string;\n }\n );\n\nexport type RecordTrigger<Args> = ParserRecordTrigger & {\n __args: Args;\n};\n\nexport function recordCreatedTrigger<T extends TailorDBType>({\n type,\n condition,\n}: {\n type: T;\n condition?: (args: RecordCreatedArgs<T>) => boolean;\n}): RecordTrigger<RecordCreatedArgs<T>> {\n return {\n kind: \"recordCreated\",\n typeName: type.name,\n condition,\n __args: {} as RecordCreatedArgs<T>,\n };\n}\n\nexport function recordUpdatedTrigger<T extends TailorDBType>({\n type,\n condition,\n}: {\n type: T;\n condition?: (args: RecordUpdatedArgs<T>) => boolean;\n}): RecordTrigger<RecordUpdatedArgs<T>> {\n return {\n kind: \"recordUpdated\",\n typeName: type.name,\n condition,\n __args: {} as RecordUpdatedArgs<T>,\n };\n}\n\nexport function recordDeletedTrigger<T extends TailorDBType>({\n type,\n condition,\n}: {\n type: T;\n condition?: (args: RecordDeletedArgs<T>) => boolean;\n}): RecordTrigger<RecordDeletedArgs<T>> {\n return {\n kind: \"recordDeleted\",\n typeName: type.name,\n condition,\n __args: {} as RecordDeletedArgs<T>,\n };\n}\n\nexport type ResolverExecutedTrigger<Args> = ParserResolverExecutedTrigger & {\n __args: Args;\n};\n\nexport function resolverExecutedTrigger<R extends ResolverConfig>({\n resolver,\n condition,\n}: {\n resolver: R;\n condition?: (args: ResolverExecutedArgs<R>) => boolean;\n}): ResolverExecutedTrigger<ResolverExecutedArgs<R>> {\n return {\n kind: \"resolverExecuted\",\n resolverName: resolver.name,\n condition,\n __args: {} as ResolverExecutedArgs<R>,\n };\n}\n","import type { TailorEnv } from \"@/configure/types/env\";\nimport type { ScheduleTriggerInput as ParserScheduleTriggerInput } from \"@/parser/service/executor/types\";\nimport type { StandardCRON } from \"ts-cron-validator\";\n\ntype Timezone =\n | \"UTC\"\n | \"Pacific/Midway\"\n | \"Pacific/Niue\"\n | \"Pacific/Pago_Pago\"\n | \"America/Adak\"\n | \"Pacific/Honolulu\"\n | \"Pacific/Rarotonga\"\n | \"Pacific/Tahiti\"\n | \"Pacific/Marquesas\"\n | \"America/Anchorage\"\n | \"America/Juneau\"\n | \"America/Metlakatla\"\n | \"America/Nome\"\n | \"America/Sitka\"\n | \"America/Yakutat\"\n | \"Pacific/Gambier\"\n | \"America/Los_Angeles\"\n | \"America/Tijuana\"\n | \"America/Vancouver\"\n | \"Pacific/Pitcairn\"\n | \"America/Boise\"\n | \"America/Cambridge_Bay\"\n | \"America/Chihuahua\"\n | \"America/Creston\"\n | \"America/Dawson\"\n | \"America/Dawson_Creek\"\n | \"America/Denver\"\n | \"America/Edmonton\"\n | \"America/Fort_Nelson\"\n | \"America/Hermosillo\"\n | \"America/Inuvik\"\n | \"America/Mazatlan\"\n | \"America/Ojinaga\"\n | \"America/Phoenix\"\n | \"America/Whitehorse\"\n | \"America/Yellowknife\"\n | \"America/Bahia_Banderas\"\n | \"America/Belize\"\n | \"America/Chicago\"\n | \"America/Costa_Rica\"\n | \"America/El_Salvador\"\n | \"America/Guatemala\"\n | \"America/Indiana/Knox\"\n | \"America/Indiana/Tell_City\"\n | \"America/Managua\"\n | \"America/Matamoros\"\n | \"America/Menominee\"\n | \"America/Merida\"\n | \"America/Mexico_City\"\n | \"America/Monterrey\"\n | \"America/North_Dakota/Beulah\"\n | \"America/North_Dakota/Center\"\n | \"America/North_Dakota/New_Salem\"\n | \"America/Rainy_River\"\n | \"America/Rankin_Inlet\"\n | \"America/Regina\"\n | \"America/Resolute\"\n | \"America/Swift_Current\"\n | \"America/Tegucigalpa\"\n | \"America/Winnipeg\"\n | \"Pacific/Easter\"\n | \"Pacific/Galapagos\"\n | \"America/Atikokan\"\n | \"America/Bogota\"\n | \"America/Cancun\"\n | \"America/Cayman\"\n | \"America/Detroit\"\n | \"America/Eirunepe\"\n | \"America/Grand_Turk\"\n | \"America/Guayaquil\"\n | \"America/Havana\"\n | \"America/Indiana/Indianapolis\"\n | \"America/Indiana/Marengo\"\n | \"America/Indiana/Petersburg\"\n | \"America/Indiana/Vevay\"\n | \"America/Indiana/Vincennes\"\n | \"America/Indiana/Winamac\"\n | \"America/Iqaluit\"\n | \"America/Jamaica\"\n | \"America/Kentucky/Louisville\"\n | \"America/Kentucky/Monticello\"\n | \"America/Lima\"\n | \"America/Nassau\"\n | \"America/New_York\"\n | \"America/Nipigon\"\n | \"America/Panama\"\n | \"America/Pangnirtung\"\n | \"America/Port-au-Prince\"\n | \"America/Rio_Branco\"\n | \"America/Thunder_Bay\"\n | \"America/Toronto\"\n | \"America/Anguilla\"\n | \"America/Antigua\"\n | \"America/Aruba\"\n | \"America/Asuncion\"\n | \"America/Barbados\"\n | \"America/Blanc-Sablon\"\n | \"America/Boa_Vista\"\n | \"America/Campo_Grande\"\n | \"America/Caracas\"\n | \"America/Cuiaba\"\n | \"America/Curacao\"\n | \"America/Dominica\"\n | \"America/Glace_Bay\"\n | \"America/Goose_Bay\"\n | \"America/Grenada\"\n | \"America/Guadeloupe\"\n | \"America/Guyana\"\n | \"America/Halifax\"\n | \"America/Kralendijk\"\n | \"America/La_Paz\"\n | \"America/Lower_Princes\"\n | \"America/Manaus\"\n | \"America/Marigot\"\n | \"America/Martinique\"\n | \"America/Moncton\"\n | \"America/Montserrat\"\n | \"America/Porto_Velho\"\n | \"America/Port_of_Spain\"\n | \"America/Puerto_Rico\"\n | \"America/Santiago\"\n | \"America/Santo_Domingo\"\n | \"America/St_Barthelemy\"\n | \"America/St_Kitts\"\n | \"America/St_Lucia\"\n | \"America/St_Thomas\"\n | \"America/St_Vincent\"\n | \"America/Thule\"\n | \"America/Tortola\"\n | \"Atlantic/Bermuda\"\n | \"America/St_Johns\"\n | \"America/Araguaina\"\n | \"America/Argentina/Buenos_Aires\"\n | \"America/Argentina/Catamarca\"\n | \"America/Argentina/Cordoba\"\n | \"America/Argentina/Jujuy\"\n | \"America/Argentina/La_Rioja\"\n | \"America/Argentina/Mendoza\"\n | \"America/Argentina/Rio_Gallegos\"\n | \"America/Argentina/Salta\"\n | \"America/Argentina/San_Juan\"\n | \"America/Argentina/San_Luis\"\n | \"America/Argentina/Tucuman\"\n | \"America/Argentina/Ushuaia\"\n | \"America/Bahia\"\n | \"America/Belem\"\n | \"America/Cayenne\"\n | \"America/Fortaleza\"\n | \"America/Godthab\"\n | \"America/Maceio\"\n | \"America/Miquelon\"\n | \"America/Montevideo\"\n | \"America/Paramaribo\"\n | \"America/Punta_Arenas\"\n | \"America/Recife\"\n | \"America/Santarem\"\n | \"America/Sao_Paulo\"\n | \"Antarctica/Palmer\"\n | \"Antarctica/Rothera\"\n | \"Atlantic/Stanley\"\n | \"America/Noronha\"\n | \"Atlantic/South_Georgia\"\n | \"America/Scoresbysund\"\n | \"Atlantic/Azores\"\n | \"Atlantic/Cape_Verde\"\n | \"Africa/Abidjan\"\n | \"Africa/Accra\"\n | \"Africa/Bamako\"\n | \"Africa/Banjul\"\n | \"Africa/Bissau\"\n | \"Africa/Casablanca\"\n | \"Africa/Conakry\"\n | \"Africa/Dakar\"\n | \"Africa/El_Aaiun\"\n | \"Africa/Freetown\"\n | \"Africa/Lome\"\n | \"Africa/Monrovia\"\n | \"Africa/Nouakchott\"\n | \"Africa/Ouagadougou\"\n | \"Africa/Sao_Tome\"\n | \"America/Danmarkshavn\"\n | \"Antarctica/Troll\"\n | \"Atlantic/Canary\"\n | \"Atlantic/Faroe\"\n | \"Atlantic/Madeira\"\n | \"Atlantic/Reykjavik\"\n | \"Atlantic/St_Helena\"\n | \"Europe/Dublin\"\n | \"Europe/Guernsey\"\n | \"Europe/Isle_of_Man\"\n | \"Europe/Jersey\"\n | \"Europe/Lisbon\"\n | \"Europe/London\"\n | \"Africa/Algiers\"\n | \"Africa/Bangui\"\n | \"Africa/Brazzaville\"\n | \"Africa/Ceuta\"\n | \"Africa/Douala\"\n | \"Africa/Kinshasa\"\n | \"Africa/Lagos\"\n | \"Africa/Libreville\"\n | \"Africa/Luanda\"\n | \"Africa/Malabo\"\n | \"Africa/Ndjamena\"\n | \"Africa/Niamey\"\n | \"Africa/Porto-Novo\"\n | \"Africa/Tunis\"\n | \"Africa/Windhoek\"\n | \"Arctic/Longyearbyen\"\n | \"Europe/Amsterdam\"\n | \"Europe/Andorra\"\n | \"Europe/Belgrade\"\n | \"Europe/Berlin\"\n | \"Europe/Bratislava\"\n | \"Europe/Brussels\"\n | \"Europe/Budapest\"\n | \"Europe/Copenhagen\"\n | \"Europe/Gibraltar\"\n | \"Europe/Ljubljana\"\n | \"Europe/Luxembourg\"\n | \"Europe/Madrid\"\n | \"Europe/Malta\"\n | \"Europe/Monaco\"\n | \"Europe/Oslo\"\n | \"Europe/Paris\"\n | \"Europe/Podgorica\"\n | \"Europe/Prague\"\n | \"Europe/Rome\"\n | \"Europe/San_Marino\"\n | \"Europe/Sarajevo\"\n | \"Europe/Skopje\"\n | \"Europe/Stockholm\"\n | \"Europe/Tirane\"\n | \"Europe/Vaduz\"\n | \"Europe/Vatican\"\n | \"Europe/Vienna\"\n | \"Europe/Warsaw\"\n | \"Europe/Zagreb\"\n | \"Europe/Zurich\"\n | \"Africa/Blantyre\"\n | \"Africa/Bujumbura\"\n | \"Africa/Cairo\"\n | \"Africa/Gaborone\"\n | \"Africa/Harare\"\n | \"Africa/Johannesburg\"\n | \"Africa/Juba\"\n | \"Africa/Khartoum\"\n | \"Africa/Kigali\"\n | \"Africa/Lubumbashi\"\n | \"Africa/Lusaka\"\n | \"Africa/Maputo\"\n | \"Africa/Maseru\"\n | \"Africa/Mbabane\"\n | \"Africa/Tripoli\"\n | \"Asia/Amman\"\n | \"Asia/Beirut\"\n | \"Asia/Damascus\"\n | \"Asia/Famagusta\"\n | \"Asia/Gaza\"\n | \"Asia/Hebron\"\n | \"Asia/Jerusalem\"\n | \"Asia/Nicosia\"\n | \"Europe/Athens\"\n | \"Europe/Bucharest\"\n | \"Europe/Chisinau\"\n | \"Europe/Helsinki\"\n | \"Europe/Kaliningrad\"\n | \"Europe/Kyiv\"\n | \"Europe/Mariehamn\"\n | \"Europe/Riga\"\n | \"Europe/Sofia\"\n | \"Europe/Tallinn\"\n | \"Europe/Uzhgorod\"\n | \"Europe/Vilnius\"\n | \"Europe/Zaporizhzhia\"\n | \"Africa/Addis_Ababa\"\n | \"Africa/Asmara\"\n | \"Africa/Dar_es_Salaam\"\n | \"Africa/Djibouti\"\n | \"Africa/Kampala\"\n | \"Africa/Mogadishu\"\n | \"Africa/Nairobi\"\n | \"Antarctica/Syowa\"\n | \"Asia/Aden\"\n | \"Asia/Baghdad\"\n | \"Asia/Bahrain\"\n | \"Asia/Kuwait\"\n | \"Asia/Qatar\"\n | \"Asia/Riyadh\"\n | \"Europe/Istanbul\"\n | \"Europe/Kirov\"\n | \"Europe/Minsk\"\n | \"Europe/Moscow\"\n | \"Europe/Simferopol\"\n | \"Europe/Volgograd\"\n | \"Indian/Antananarivo\"\n | \"Indian/Comoro\"\n | \"Indian/Mayotte\"\n | \"Asia/Tehran\"\n | \"Asia/Baku\"\n | \"Asia/Dubai\"\n | \"Asia/Muscat\"\n | \"Asia/Tbilisi\"\n | \"Asia/Yerevan\"\n | \"Europe/Astrakhan\"\n | \"Europe/Samara\"\n | \"Europe/Saratov\"\n | \"Europe/Ulyanovsk\"\n | \"Indian/Mahe\"\n | \"Indian/Mauritius\"\n | \"Indian/Reunion\"\n | \"Asia/Kabul\"\n | \"Antarctica/Mawson\"\n | \"Asia/Aqtau\"\n | \"Asia/Aqtobe\"\n | \"Asia/Ashgabat\"\n | \"Asia/Atyrau\"\n | \"Asia/Dushanbe\"\n | \"Asia/Karachi\"\n | \"Asia/Oral\"\n | \"Asia/Qyzylorda\"\n | \"Asia/Samarkand\"\n | \"Asia/Tashkent\"\n | \"Asia/Yekaterinburg\"\n | \"Indian/Kerguelen\"\n | \"Indian/Maldives\"\n | \"Asia/Colombo\"\n | \"Asia/Kolkata\"\n | \"Asia/Kathmandu\"\n | \"Antarctica/Vostok\"\n | \"Asia/Almaty\"\n | \"Asia/Bishkek\"\n | \"Asia/Dhaka\"\n | \"Asia/Omsk\"\n | \"Asia/Qostanay\"\n | \"Asia/Thimphu\"\n | \"Asia/Urumqi\"\n | \"Indian/Chagos\"\n | \"Asia/Yangon\"\n | \"Indian/Cocos\"\n | \"Antarctica/Davis\"\n | \"Asia/Bangkok\"\n | \"Asia/Barnaul\"\n | \"Asia/Hovd\"\n | \"Asia/Ho_Chi_Minh\"\n | \"Asia/Jakarta\"\n | \"Asia/Krasnoyarsk\"\n | \"Asia/Novokuznetsk\"\n | \"Asia/Novosibirsk\"\n | \"Asia/Phnom_Penh\"\n | \"Asia/Pontianak\"\n | \"Asia/Tomsk\"\n | \"Asia/Vientiane\"\n | \"Indian/Christmas\"\n | \"Asia/Brunei\"\n | \"Asia/Choibalsan\"\n | \"Asia/Hong_Kong\"\n | \"Asia/Irkutsk\"\n | \"Asia/Kuala_Lumpur\"\n | \"Asia/Kuching\"\n | \"Asia/Macau\"\n | \"Asia/Makassar\"\n | \"Asia/Manila\"\n | \"Asia/Shanghai\"\n | \"Asia/Singapore\"\n | \"Asia/Taipei\"\n | \"Asia/Ulaanbaatar\"\n | \"Australia/Perth\"\n | \"Australia/Eucla\"\n | \"Asia/Chita\"\n | \"Asia/Dili\"\n | \"Asia/Jayapura\"\n | \"Asia/Khandyga\"\n | \"Asia/Pyongyang\"\n | \"Asia/Seoul\"\n | \"Asia/Tokyo\"\n | \"Asia/Yakutsk\"\n | \"Pacific/Palau\"\n | \"Australia/Adelaide\"\n | \"Australia/Broken_Hill\"\n | \"Australia/Darwin\"\n | \"Antarctica/DumontDUrville\"\n | \"Antarctica/Macquarie\"\n | \"Asia/Ust-Nera\"\n | \"Asia/Vladivostok\"\n | \"Australia/Brisbane\"\n | \"Australia/Currie\"\n | \"Australia/Hobart\"\n | \"Australia/Lindeman\"\n | \"Australia/Melbourne\"\n | \"Australia/Sydney\"\n | \"Pacific/Chuuk\"\n | \"Pacific/Guam\"\n | \"Pacific/Port_Moresby\"\n | \"Pacific/Saipan\"\n | \"Australia/Lord_Howe\"\n | \"Antarctica/Casey\"\n | \"Asia/Magadan\"\n | \"Asia/Sakhalin\"\n | \"Asia/Srednekolymsk\"\n | \"Pacific/Bougainville\"\n | \"Pacific/Efate\"\n | \"Pacific/Guadalcanal\"\n | \"Pacific/Kosrae\"\n | \"Pacific/Norfolk\"\n | \"Pacific/Noumea\"\n | \"Pacific/Pohnpei\"\n | \"Antarctica/McMurdo\"\n | \"Asia/Anadyr\"\n | \"Asia/Kamchatka\"\n | \"Pacific/Auckland\"\n | \"Pacific/Fiji\"\n | \"Pacific/Funafuti\"\n | \"Pacific/Kwajalein\"\n | \"Pacific/Majuro\"\n | \"Pacific/Nauru\"\n | \"Pacific/Tarawa\"\n | \"Pacific/Wake\"\n | \"Pacific/Wallis\"\n | \"Pacific/Chatham\"\n | \"Pacific/Apia\"\n | \"Pacific/Enderbury\"\n | \"Pacific/Fakaofo\"\n | \"Pacific/Tongatapu\"\n | \"Pacific/Kiritimati\";\n\nexport type ScheduleTrigger<Args> = ParserScheduleTriggerInput & {\n __args: Args;\n};\n\nexport interface ScheduleArgs {\n env: TailorEnv;\n}\n\nexport function scheduleTrigger<T extends string>({\n cron,\n timezone,\n}: {\n cron: StandardCRON<T> extends never ? never : T;\n timezone?: Timezone;\n}): ScheduleTrigger<ScheduleArgs> {\n return {\n kind: \"schedule\",\n cron,\n timezone,\n __args: {} as ScheduleArgs,\n };\n}\n","import type { TailorEnv } from \"@/configure/types/env\";\nimport type { IncomingWebhookTrigger as ParserIncomingWebhookTrigger } from \"@/parser/service/executor/types\";\n\nexport interface IncomingWebhookArgs<T extends IncomingWebhookRequest> {\n body: T[\"body\"];\n headers: T[\"headers\"];\n method: \"POST\" | \"GET\" | \"PUT\" | \"DELETE\";\n rawBody: string;\n env: TailorEnv;\n}\n\nexport interface IncomingWebhookRequest {\n body: Record<string, unknown>;\n headers: Record<string, string>;\n}\n\nexport type IncomingWebhookTrigger<Args> = ParserIncomingWebhookTrigger & {\n __args: Args;\n};\n\nexport function incomingWebhookTrigger<T extends IncomingWebhookRequest>(): IncomingWebhookTrigger<\n IncomingWebhookArgs<T>\n> {\n return {\n kind: \"incomingWebhook\",\n __args: {} as IncomingWebhookArgs<T>,\n };\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { WorkflowJob } from \"./job\";\nimport type { AuthInvoker } from \"../auth\";\n\nexport interface WorkflowConfig<\n Job extends WorkflowJob<any, any, any> = WorkflowJob<any, any, any>,\n> {\n name: string;\n mainJob: Job;\n}\n\nexport interface Workflow<Job extends WorkflowJob<any, any, any> = WorkflowJob<any, any, any>> {\n name: string;\n mainJob: Job;\n trigger: (\n args: Parameters<Job[\"trigger\"]>[0],\n options?: { authInvoker: AuthInvoker<string> },\n ) => Promise<string>;\n}\n\nexport function createWorkflow<Job extends WorkflowJob<any, any, any>>(config: {\n name: string;\n mainJob: Job;\n}): Workflow<Job> {\n return {\n ...config,\n trigger: async (args, options) => {\n return tailor.workflow.triggerWorkflow(\n config.name,\n args,\n options ? { authInvoker: options.authInvoker } : undefined,\n );\n },\n };\n}\n","import type { StaticWebsiteInput } from \"@/parser/service/staticwebsite/types\";\n\ndeclare const staticWebsiteDefinitionBrand: unique symbol;\ntype StaticWebsiteDefinitionBrand = {\n readonly [staticWebsiteDefinitionBrand]: true;\n};\n\nexport function defineStaticWebSite(name: string, config: Omit<StaticWebsiteInput, \"name\">) {\n const result = {\n ...config,\n name,\n get url() {\n return `${name}:url` as const;\n },\n } as const satisfies StaticWebsiteInput & { readonly url: string };\n\n return result as typeof result & StaticWebsiteDefinitionBrand;\n}\n\nexport type StaticWebsiteConfig = Omit<ReturnType<typeof defineStaticWebSite>, \"url\">;\n","import type { BuiltinIdP } from \"@/parser/service/auth/types\";\nimport type { IdPInput } from \"@/parser/service/idp/types\";\n\ndeclare const idpDefinitionBrand: unique symbol;\ntype IdpDefinitionBrand = { readonly [idpDefinitionBrand]: true };\n\nexport function defineIdp<const TClients extends string[]>(\n name: string,\n config: Omit<IdPInput, \"name\" | \"clients\"> & { clients: TClients },\n) {\n const result = {\n ...config,\n name,\n provider(providerName: string, clientName: TClients[number]) {\n return {\n name: providerName,\n kind: \"BuiltInIdP\",\n namespace: name,\n clientName,\n } as const satisfies BuiltinIdP;\n },\n } as const satisfies IdPInput & {\n provider: (providerName: string, clientName: TClients[number]) => BuiltinIdP;\n };\n\n return result as typeof result & IdpDefinitionBrand;\n}\n\nexport type IdPExternalConfig = { name: string; external: true };\n\nexport type IdPConfig = Omit<ReturnType<typeof defineIdp>, \"provider\"> | IdPExternalConfig;\n","import { t as _t } from \"@/configure/types\";\nimport type * as helperTypes from \"@/configure/types/helpers\";\n\ntype TailorOutput<T> = helperTypes.output<T>;\n\nexport type infer<T> = TailorOutput<T>;\nexport type output<T> = TailorOutput<T>;\n\n// eslint-disable-next-line import/export\nexport const t = { ..._t };\n// eslint-disable-next-line @typescript-eslint/no-namespace, import/export\nexport namespace t {\n export type output<T> = TailorOutput<T>;\n export type infer<T> = TailorOutput<T>;\n}\n\nexport {\n TailorField,\n type TailorUser,\n unauthenticatedTailorUser,\n type AttributeMap,\n type AttributeList,\n type Env,\n} from \"@/configure/types\";\n\nexport * from \"@/configure/services\";\n\nexport { defineConfig, defineGenerators } from \"@/configure/config\";\n"],"mappings":";;;AA0CA,SAAgB,eAId,QAM+B;CAC/B,MAAM,mBACJ,OAAO,kBAAkB,cAAc,OAAO,SAASA,IAAE,OAAO,OAAO,OAAO;AAEhF,QAAO;EACL,GAAG;EACH,QAAQ;EACT;;;;;ACvBH,SAAgB,eAGd,QAA2B;AAC3B,QAAO;;;;;ACWT,SAAgB,qBAA6C,EAC3D,MACA,aAIsC;AACtC,QAAO;EACL,MAAM;EACN,UAAU,KAAK;EACf;EACA,QAAQ,EAAE;EACX;;AAGH,SAAgB,qBAA6C,EAC3D,MACA,aAIsC;AACtC,QAAO;EACL,MAAM;EACN,UAAU,KAAK;EACf;EACA,QAAQ,EAAE;EACX;;AAGH,SAAgB,qBAA6C,EAC3D,MACA,aAIsC;AACtC,QAAO;EACL,MAAM;EACN,UAAU,KAAK;EACf;EACA,QAAQ,EAAE;EACX;;AAOH,SAAgB,wBAAkD,EAChE,UACA,aAImD;AACnD,QAAO;EACL,MAAM;EACN,cAAc,SAAS;EACvB;EACA,QAAQ,EAAE;EACX;;;;;ACuUH,SAAgB,gBAAkC,EAChD,MACA,YAIgC;AAChC,QAAO;EACL,MAAM;EACN;EACA;EACA,QAAQ,EAAE;EACX;;;;;AC/aH,SAAgB,yBAEd;AACA,QAAO;EACL,MAAM;EACN,QAAQ,EAAE;EACX;;;;;ACNH,SAAgB,eAAuD,QAGrD;AAChB,QAAO;EACL,GAAG;EACH,SAAS,OAAO,MAAM,YAAY;AAChC,UAAO,OAAO,SAAS,gBACrB,OAAO,MACP,MACA,UAAU,EAAE,aAAa,QAAQ,aAAa,GAAG,OAClD;;EAEJ;;;;;AC1BH,SAAgB,oBAAoB,MAAc,QAA0C;AAS1F,QARe;EACb,GAAG;EACH;EACA,IAAI,MAAM;AACR,UAAO,GAAG,KAAK;;EAElB;;;;;ACRH,SAAgB,UACd,MACA,QACA;AAgBA,QAfe;EACb,GAAG;EACH;EACA,SAAS,cAAsB,YAA8B;AAC3D,UAAO;IACL,MAAM;IACN,MAAM;IACN,WAAW;IACX;IACD;;EAEJ;;;;;ACZH,MAAa,IAAI,EAAE,GAAGC,KAAI"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["t","_t"],"sources":["../../src/configure/services/resolver/resolver.ts","../../src/configure/services/executor/executor.ts","../../src/configure/services/executor/trigger/event.ts","../../src/configure/services/executor/trigger/schedule.ts","../../src/configure/services/executor/trigger/webhook.ts","../../src/configure/services/workflow/workflow.ts","../../src/configure/services/staticwebsite/index.ts","../../src/configure/services/idp/index.ts","../../src/configure/index.ts"],"sourcesContent":["import { t, TailorField } from \"@/configure/types/type\";\nimport type { TailorAnyField, TailorUser } from \"@/configure/types\";\nimport type { TailorEnv } from \"@/configure/types/env\";\nimport type { InferFieldsOutput, output } from \"@/configure/types/helpers\";\nimport type { ResolverInput } from \"@/parser/service/resolver/types\";\n\ntype Context<Input extends Record<string, TailorAnyField> | undefined> = {\n input: Input extends Record<string, TailorAnyField> ? InferFieldsOutput<Input> : never;\n user: TailorUser;\n env: TailorEnv;\n};\n\ntype OutputType<O> = O extends TailorAnyField\n ? output<O>\n : O extends Record<string, TailorAnyField>\n ? InferFieldsOutput<O>\n : never;\n\n/**\n * Normalized output type that preserves generic type information.\n * - If Output is already a TailorField, use it as-is\n * - If Output is a Record of fields, wrap it as a nested TailorField\n */\ntype NormalizedOutput<Output extends TailorAnyField | Record<string, TailorAnyField>> =\n Output extends TailorAnyField\n ? Output\n : TailorField<\n { type: \"nested\"; array: false },\n InferFieldsOutput<Extract<Output, Record<string, TailorAnyField>>>\n >;\n\ntype ResolverReturn<\n Input extends Record<string, TailorAnyField> | undefined,\n Output extends TailorAnyField | Record<string, TailorAnyField>,\n> = Omit<ResolverInput, \"input\" | \"output\" | \"body\"> &\n Readonly<{\n input?: Input;\n output: NormalizedOutput<Output>;\n body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;\n }>;\n\nexport function createResolver<\n Input extends Record<string, TailorAnyField> | undefined = undefined,\n Output extends TailorAnyField | Record<string, TailorAnyField> = TailorAnyField,\n>(\n config: Omit<ResolverInput, \"input\" | \"output\" | \"body\"> &\n Readonly<{\n input?: Input;\n output: Output;\n body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;\n }>,\n): ResolverReturn<Input, Output> {\n const normalizedOutput =\n config.output instanceof TailorField ? config.output : t.object(config.output);\n\n return {\n ...config,\n output: normalizedOutput,\n } as ResolverReturn<Input, Output>;\n}\n\nexport type ResolverConfig = ReturnType<typeof createResolver<any, any>>;\n","import type { Operation } from \"./operation\";\nimport type { Trigger } from \"./trigger\";\nimport type { AuthInvoker } from \"@/configure/services/auth\";\nimport type { Workflow } from \"@/configure/services/workflow/workflow\";\nimport type { ExecutorInput } from \"@/parser/service/executor/types\";\n\n/**\n * Extract mainJob's Input type from Workflow.\n */\ntype WorkflowInput<W extends Workflow> = Parameters<W[\"trigger\"]>[0];\n\ntype ExecutorBase<Args> = Omit<ExecutorInput, \"trigger\" | \"operation\"> & {\n trigger: Trigger<Args>;\n};\n\n/**\n * Executor type with conditional inference for workflow operations.\n * When operation.kind is \"workflow\", infers W from the workflow property\n * to ensure args type matches the workflow's mainJob input type.\n */\ntype Executor<Args, O> = O extends {\n kind: \"workflow\";\n workflow: infer W extends Workflow;\n}\n ? ExecutorBase<Args> & {\n operation: {\n kind: \"workflow\";\n workflow: W;\n args?: WorkflowInput<W> | ((args: Args) => WorkflowInput<W>);\n authInvoker?: AuthInvoker<string>;\n };\n }\n : ExecutorBase<Args> & {\n operation: O;\n };\n\nexport function createExecutor<\n Args,\n O extends Operation<Args> | { kind: \"workflow\"; workflow: Workflow },\n>(config: Executor<Args, O>) {\n return config;\n}\n","import type { ResolverConfig } from \"@/configure/services/resolver/resolver\";\nimport type { TailorDBType } from \"@/configure/services/tailordb/schema\";\nimport type { TailorEnv } from \"@/configure/types/env\";\nimport type { output } from \"@/configure/types/helpers\";\nimport type {\n RecordTrigger as ParserRecordTrigger,\n ResolverExecutedTrigger as ParserResolverExecutedTrigger,\n} from \"@/parser/service/executor/types\";\n\ninterface EventArgs {\n workspaceId: string;\n appNamespace: string;\n env: TailorEnv;\n}\n\ninterface RecordArgs extends EventArgs {\n typeName: string;\n}\n\nexport interface RecordCreatedArgs<T extends TailorDBType> extends RecordArgs {\n newRecord: output<T>;\n}\n\nexport interface RecordUpdatedArgs<T extends TailorDBType> extends RecordArgs {\n newRecord: output<T>;\n oldRecord: output<T>;\n}\n\nexport interface RecordDeletedArgs<T extends TailorDBType> extends RecordArgs {\n oldRecord: output<T>;\n}\n\nexport type ResolverExecutedArgs<R extends ResolverConfig> = EventArgs & {\n resolverName: string;\n} & (\n | {\n success: true;\n result: output<R[\"output\"]>;\n error?: never;\n }\n | {\n success: false;\n result?: never;\n error: string;\n }\n );\n\nexport type RecordTrigger<Args> = ParserRecordTrigger & {\n __args: Args;\n};\n\nexport function recordCreatedTrigger<T extends TailorDBType>({\n type,\n condition,\n}: {\n type: T;\n condition?: (args: RecordCreatedArgs<T>) => boolean;\n}): RecordTrigger<RecordCreatedArgs<T>> {\n return {\n kind: \"recordCreated\",\n typeName: type.name,\n condition,\n __args: {} as RecordCreatedArgs<T>,\n };\n}\n\nexport function recordUpdatedTrigger<T extends TailorDBType>({\n type,\n condition,\n}: {\n type: T;\n condition?: (args: RecordUpdatedArgs<T>) => boolean;\n}): RecordTrigger<RecordUpdatedArgs<T>> {\n return {\n kind: \"recordUpdated\",\n typeName: type.name,\n condition,\n __args: {} as RecordUpdatedArgs<T>,\n };\n}\n\nexport function recordDeletedTrigger<T extends TailorDBType>({\n type,\n condition,\n}: {\n type: T;\n condition?: (args: RecordDeletedArgs<T>) => boolean;\n}): RecordTrigger<RecordDeletedArgs<T>> {\n return {\n kind: \"recordDeleted\",\n typeName: type.name,\n condition,\n __args: {} as RecordDeletedArgs<T>,\n };\n}\n\nexport type ResolverExecutedTrigger<Args> = ParserResolverExecutedTrigger & {\n __args: Args;\n};\n\nexport function resolverExecutedTrigger<R extends ResolverConfig>({\n resolver,\n condition,\n}: {\n resolver: R;\n condition?: (args: ResolverExecutedArgs<R>) => boolean;\n}): ResolverExecutedTrigger<ResolverExecutedArgs<R>> {\n return {\n kind: \"resolverExecuted\",\n resolverName: resolver.name,\n condition,\n __args: {} as ResolverExecutedArgs<R>,\n };\n}\n","import type { TailorEnv } from \"@/configure/types/env\";\nimport type { ScheduleTriggerInput as ParserScheduleTriggerInput } from \"@/parser/service/executor/types\";\nimport type { StandardCRON } from \"ts-cron-validator\";\n\ntype Timezone =\n | \"UTC\"\n | \"Pacific/Midway\"\n | \"Pacific/Niue\"\n | \"Pacific/Pago_Pago\"\n | \"America/Adak\"\n | \"Pacific/Honolulu\"\n | \"Pacific/Rarotonga\"\n | \"Pacific/Tahiti\"\n | \"Pacific/Marquesas\"\n | \"America/Anchorage\"\n | \"America/Juneau\"\n | \"America/Metlakatla\"\n | \"America/Nome\"\n | \"America/Sitka\"\n | \"America/Yakutat\"\n | \"Pacific/Gambier\"\n | \"America/Los_Angeles\"\n | \"America/Tijuana\"\n | \"America/Vancouver\"\n | \"Pacific/Pitcairn\"\n | \"America/Boise\"\n | \"America/Cambridge_Bay\"\n | \"America/Chihuahua\"\n | \"America/Creston\"\n | \"America/Dawson\"\n | \"America/Dawson_Creek\"\n | \"America/Denver\"\n | \"America/Edmonton\"\n | \"America/Fort_Nelson\"\n | \"America/Hermosillo\"\n | \"America/Inuvik\"\n | \"America/Mazatlan\"\n | \"America/Ojinaga\"\n | \"America/Phoenix\"\n | \"America/Whitehorse\"\n | \"America/Yellowknife\"\n | \"America/Bahia_Banderas\"\n | \"America/Belize\"\n | \"America/Chicago\"\n | \"America/Costa_Rica\"\n | \"America/El_Salvador\"\n | \"America/Guatemala\"\n | \"America/Indiana/Knox\"\n | \"America/Indiana/Tell_City\"\n | \"America/Managua\"\n | \"America/Matamoros\"\n | \"America/Menominee\"\n | \"America/Merida\"\n | \"America/Mexico_City\"\n | \"America/Monterrey\"\n | \"America/North_Dakota/Beulah\"\n | \"America/North_Dakota/Center\"\n | \"America/North_Dakota/New_Salem\"\n | \"America/Rainy_River\"\n | \"America/Rankin_Inlet\"\n | \"America/Regina\"\n | \"America/Resolute\"\n | \"America/Swift_Current\"\n | \"America/Tegucigalpa\"\n | \"America/Winnipeg\"\n | \"Pacific/Easter\"\n | \"Pacific/Galapagos\"\n | \"America/Atikokan\"\n | \"America/Bogota\"\n | \"America/Cancun\"\n | \"America/Cayman\"\n | \"America/Detroit\"\n | \"America/Eirunepe\"\n | \"America/Grand_Turk\"\n | \"America/Guayaquil\"\n | \"America/Havana\"\n | \"America/Indiana/Indianapolis\"\n | \"America/Indiana/Marengo\"\n | \"America/Indiana/Petersburg\"\n | \"America/Indiana/Vevay\"\n | \"America/Indiana/Vincennes\"\n | \"America/Indiana/Winamac\"\n | \"America/Iqaluit\"\n | \"America/Jamaica\"\n | \"America/Kentucky/Louisville\"\n | \"America/Kentucky/Monticello\"\n | \"America/Lima\"\n | \"America/Nassau\"\n | \"America/New_York\"\n | \"America/Nipigon\"\n | \"America/Panama\"\n | \"America/Pangnirtung\"\n | \"America/Port-au-Prince\"\n | \"America/Rio_Branco\"\n | \"America/Thunder_Bay\"\n | \"America/Toronto\"\n | \"America/Anguilla\"\n | \"America/Antigua\"\n | \"America/Aruba\"\n | \"America/Asuncion\"\n | \"America/Barbados\"\n | \"America/Blanc-Sablon\"\n | \"America/Boa_Vista\"\n | \"America/Campo_Grande\"\n | \"America/Caracas\"\n | \"America/Cuiaba\"\n | \"America/Curacao\"\n | \"America/Dominica\"\n | \"America/Glace_Bay\"\n | \"America/Goose_Bay\"\n | \"America/Grenada\"\n | \"America/Guadeloupe\"\n | \"America/Guyana\"\n | \"America/Halifax\"\n | \"America/Kralendijk\"\n | \"America/La_Paz\"\n | \"America/Lower_Princes\"\n | \"America/Manaus\"\n | \"America/Marigot\"\n | \"America/Martinique\"\n | \"America/Moncton\"\n | \"America/Montserrat\"\n | \"America/Porto_Velho\"\n | \"America/Port_of_Spain\"\n | \"America/Puerto_Rico\"\n | \"America/Santiago\"\n | \"America/Santo_Domingo\"\n | \"America/St_Barthelemy\"\n | \"America/St_Kitts\"\n | \"America/St_Lucia\"\n | \"America/St_Thomas\"\n | \"America/St_Vincent\"\n | \"America/Thule\"\n | \"America/Tortola\"\n | \"Atlantic/Bermuda\"\n | \"America/St_Johns\"\n | \"America/Araguaina\"\n | \"America/Argentina/Buenos_Aires\"\n | \"America/Argentina/Catamarca\"\n | \"America/Argentina/Cordoba\"\n | \"America/Argentina/Jujuy\"\n | \"America/Argentina/La_Rioja\"\n | \"America/Argentina/Mendoza\"\n | \"America/Argentina/Rio_Gallegos\"\n | \"America/Argentina/Salta\"\n | \"America/Argentina/San_Juan\"\n | \"America/Argentina/San_Luis\"\n | \"America/Argentina/Tucuman\"\n | \"America/Argentina/Ushuaia\"\n | \"America/Bahia\"\n | \"America/Belem\"\n | \"America/Cayenne\"\n | \"America/Fortaleza\"\n | \"America/Godthab\"\n | \"America/Maceio\"\n | \"America/Miquelon\"\n | \"America/Montevideo\"\n | \"America/Paramaribo\"\n | \"America/Punta_Arenas\"\n | \"America/Recife\"\n | \"America/Santarem\"\n | \"America/Sao_Paulo\"\n | \"Antarctica/Palmer\"\n | \"Antarctica/Rothera\"\n | \"Atlantic/Stanley\"\n | \"America/Noronha\"\n | \"Atlantic/South_Georgia\"\n | \"America/Scoresbysund\"\n | \"Atlantic/Azores\"\n | \"Atlantic/Cape_Verde\"\n | \"Africa/Abidjan\"\n | \"Africa/Accra\"\n | \"Africa/Bamako\"\n | \"Africa/Banjul\"\n | \"Africa/Bissau\"\n | \"Africa/Casablanca\"\n | \"Africa/Conakry\"\n | \"Africa/Dakar\"\n | \"Africa/El_Aaiun\"\n | \"Africa/Freetown\"\n | \"Africa/Lome\"\n | \"Africa/Monrovia\"\n | \"Africa/Nouakchott\"\n | \"Africa/Ouagadougou\"\n | \"Africa/Sao_Tome\"\n | \"America/Danmarkshavn\"\n | \"Antarctica/Troll\"\n | \"Atlantic/Canary\"\n | \"Atlantic/Faroe\"\n | \"Atlantic/Madeira\"\n | \"Atlantic/Reykjavik\"\n | \"Atlantic/St_Helena\"\n | \"Europe/Dublin\"\n | \"Europe/Guernsey\"\n | \"Europe/Isle_of_Man\"\n | \"Europe/Jersey\"\n | \"Europe/Lisbon\"\n | \"Europe/London\"\n | \"Africa/Algiers\"\n | \"Africa/Bangui\"\n | \"Africa/Brazzaville\"\n | \"Africa/Ceuta\"\n | \"Africa/Douala\"\n | \"Africa/Kinshasa\"\n | \"Africa/Lagos\"\n | \"Africa/Libreville\"\n | \"Africa/Luanda\"\n | \"Africa/Malabo\"\n | \"Africa/Ndjamena\"\n | \"Africa/Niamey\"\n | \"Africa/Porto-Novo\"\n | \"Africa/Tunis\"\n | \"Africa/Windhoek\"\n | \"Arctic/Longyearbyen\"\n | \"Europe/Amsterdam\"\n | \"Europe/Andorra\"\n | \"Europe/Belgrade\"\n | \"Europe/Berlin\"\n | \"Europe/Bratislava\"\n | \"Europe/Brussels\"\n | \"Europe/Budapest\"\n | \"Europe/Copenhagen\"\n | \"Europe/Gibraltar\"\n | \"Europe/Ljubljana\"\n | \"Europe/Luxembourg\"\n | \"Europe/Madrid\"\n | \"Europe/Malta\"\n | \"Europe/Monaco\"\n | \"Europe/Oslo\"\n | \"Europe/Paris\"\n | \"Europe/Podgorica\"\n | \"Europe/Prague\"\n | \"Europe/Rome\"\n | \"Europe/San_Marino\"\n | \"Europe/Sarajevo\"\n | \"Europe/Skopje\"\n | \"Europe/Stockholm\"\n | \"Europe/Tirane\"\n | \"Europe/Vaduz\"\n | \"Europe/Vatican\"\n | \"Europe/Vienna\"\n | \"Europe/Warsaw\"\n | \"Europe/Zagreb\"\n | \"Europe/Zurich\"\n | \"Africa/Blantyre\"\n | \"Africa/Bujumbura\"\n | \"Africa/Cairo\"\n | \"Africa/Gaborone\"\n | \"Africa/Harare\"\n | \"Africa/Johannesburg\"\n | \"Africa/Juba\"\n | \"Africa/Khartoum\"\n | \"Africa/Kigali\"\n | \"Africa/Lubumbashi\"\n | \"Africa/Lusaka\"\n | \"Africa/Maputo\"\n | \"Africa/Maseru\"\n | \"Africa/Mbabane\"\n | \"Africa/Tripoli\"\n | \"Asia/Amman\"\n | \"Asia/Beirut\"\n | \"Asia/Damascus\"\n | \"Asia/Famagusta\"\n | \"Asia/Gaza\"\n | \"Asia/Hebron\"\n | \"Asia/Jerusalem\"\n | \"Asia/Nicosia\"\n | \"Europe/Athens\"\n | \"Europe/Bucharest\"\n | \"Europe/Chisinau\"\n | \"Europe/Helsinki\"\n | \"Europe/Kaliningrad\"\n | \"Europe/Kyiv\"\n | \"Europe/Mariehamn\"\n | \"Europe/Riga\"\n | \"Europe/Sofia\"\n | \"Europe/Tallinn\"\n | \"Europe/Uzhgorod\"\n | \"Europe/Vilnius\"\n | \"Europe/Zaporizhzhia\"\n | \"Africa/Addis_Ababa\"\n | \"Africa/Asmara\"\n | \"Africa/Dar_es_Salaam\"\n | \"Africa/Djibouti\"\n | \"Africa/Kampala\"\n | \"Africa/Mogadishu\"\n | \"Africa/Nairobi\"\n | \"Antarctica/Syowa\"\n | \"Asia/Aden\"\n | \"Asia/Baghdad\"\n | \"Asia/Bahrain\"\n | \"Asia/Kuwait\"\n | \"Asia/Qatar\"\n | \"Asia/Riyadh\"\n | \"Europe/Istanbul\"\n | \"Europe/Kirov\"\n | \"Europe/Minsk\"\n | \"Europe/Moscow\"\n | \"Europe/Simferopol\"\n | \"Europe/Volgograd\"\n | \"Indian/Antananarivo\"\n | \"Indian/Comoro\"\n | \"Indian/Mayotte\"\n | \"Asia/Tehran\"\n | \"Asia/Baku\"\n | \"Asia/Dubai\"\n | \"Asia/Muscat\"\n | \"Asia/Tbilisi\"\n | \"Asia/Yerevan\"\n | \"Europe/Astrakhan\"\n | \"Europe/Samara\"\n | \"Europe/Saratov\"\n | \"Europe/Ulyanovsk\"\n | \"Indian/Mahe\"\n | \"Indian/Mauritius\"\n | \"Indian/Reunion\"\n | \"Asia/Kabul\"\n | \"Antarctica/Mawson\"\n | \"Asia/Aqtau\"\n | \"Asia/Aqtobe\"\n | \"Asia/Ashgabat\"\n | \"Asia/Atyrau\"\n | \"Asia/Dushanbe\"\n | \"Asia/Karachi\"\n | \"Asia/Oral\"\n | \"Asia/Qyzylorda\"\n | \"Asia/Samarkand\"\n | \"Asia/Tashkent\"\n | \"Asia/Yekaterinburg\"\n | \"Indian/Kerguelen\"\n | \"Indian/Maldives\"\n | \"Asia/Colombo\"\n | \"Asia/Kolkata\"\n | \"Asia/Kathmandu\"\n | \"Antarctica/Vostok\"\n | \"Asia/Almaty\"\n | \"Asia/Bishkek\"\n | \"Asia/Dhaka\"\n | \"Asia/Omsk\"\n | \"Asia/Qostanay\"\n | \"Asia/Thimphu\"\n | \"Asia/Urumqi\"\n | \"Indian/Chagos\"\n | \"Asia/Yangon\"\n | \"Indian/Cocos\"\n | \"Antarctica/Davis\"\n | \"Asia/Bangkok\"\n | \"Asia/Barnaul\"\n | \"Asia/Hovd\"\n | \"Asia/Ho_Chi_Minh\"\n | \"Asia/Jakarta\"\n | \"Asia/Krasnoyarsk\"\n | \"Asia/Novokuznetsk\"\n | \"Asia/Novosibirsk\"\n | \"Asia/Phnom_Penh\"\n | \"Asia/Pontianak\"\n | \"Asia/Tomsk\"\n | \"Asia/Vientiane\"\n | \"Indian/Christmas\"\n | \"Asia/Brunei\"\n | \"Asia/Choibalsan\"\n | \"Asia/Hong_Kong\"\n | \"Asia/Irkutsk\"\n | \"Asia/Kuala_Lumpur\"\n | \"Asia/Kuching\"\n | \"Asia/Macau\"\n | \"Asia/Makassar\"\n | \"Asia/Manila\"\n | \"Asia/Shanghai\"\n | \"Asia/Singapore\"\n | \"Asia/Taipei\"\n | \"Asia/Ulaanbaatar\"\n | \"Australia/Perth\"\n | \"Australia/Eucla\"\n | \"Asia/Chita\"\n | \"Asia/Dili\"\n | \"Asia/Jayapura\"\n | \"Asia/Khandyga\"\n | \"Asia/Pyongyang\"\n | \"Asia/Seoul\"\n | \"Asia/Tokyo\"\n | \"Asia/Yakutsk\"\n | \"Pacific/Palau\"\n | \"Australia/Adelaide\"\n | \"Australia/Broken_Hill\"\n | \"Australia/Darwin\"\n | \"Antarctica/DumontDUrville\"\n | \"Antarctica/Macquarie\"\n | \"Asia/Ust-Nera\"\n | \"Asia/Vladivostok\"\n | \"Australia/Brisbane\"\n | \"Australia/Currie\"\n | \"Australia/Hobart\"\n | \"Australia/Lindeman\"\n | \"Australia/Melbourne\"\n | \"Australia/Sydney\"\n | \"Pacific/Chuuk\"\n | \"Pacific/Guam\"\n | \"Pacific/Port_Moresby\"\n | \"Pacific/Saipan\"\n | \"Australia/Lord_Howe\"\n | \"Antarctica/Casey\"\n | \"Asia/Magadan\"\n | \"Asia/Sakhalin\"\n | \"Asia/Srednekolymsk\"\n | \"Pacific/Bougainville\"\n | \"Pacific/Efate\"\n | \"Pacific/Guadalcanal\"\n | \"Pacific/Kosrae\"\n | \"Pacific/Norfolk\"\n | \"Pacific/Noumea\"\n | \"Pacific/Pohnpei\"\n | \"Antarctica/McMurdo\"\n | \"Asia/Anadyr\"\n | \"Asia/Kamchatka\"\n | \"Pacific/Auckland\"\n | \"Pacific/Fiji\"\n | \"Pacific/Funafuti\"\n | \"Pacific/Kwajalein\"\n | \"Pacific/Majuro\"\n | \"Pacific/Nauru\"\n | \"Pacific/Tarawa\"\n | \"Pacific/Wake\"\n | \"Pacific/Wallis\"\n | \"Pacific/Chatham\"\n | \"Pacific/Apia\"\n | \"Pacific/Enderbury\"\n | \"Pacific/Fakaofo\"\n | \"Pacific/Tongatapu\"\n | \"Pacific/Kiritimati\";\n\nexport type ScheduleTrigger<Args> = ParserScheduleTriggerInput & {\n __args: Args;\n};\n\nexport interface ScheduleArgs {\n env: TailorEnv;\n}\n\nexport function scheduleTrigger<T extends string>({\n cron,\n timezone,\n}: {\n cron: StandardCRON<T> extends never ? never : T;\n timezone?: Timezone;\n}): ScheduleTrigger<ScheduleArgs> {\n return {\n kind: \"schedule\",\n cron,\n timezone,\n __args: {} as ScheduleArgs,\n };\n}\n","import type { TailorEnv } from \"@/configure/types/env\";\nimport type { IncomingWebhookTrigger as ParserIncomingWebhookTrigger } from \"@/parser/service/executor/types\";\n\nexport interface IncomingWebhookArgs<T extends IncomingWebhookRequest> {\n body: T[\"body\"];\n headers: T[\"headers\"];\n method: \"POST\" | \"GET\" | \"PUT\" | \"DELETE\";\n rawBody: string;\n env: TailorEnv;\n}\n\nexport interface IncomingWebhookRequest {\n body: Record<string, unknown>;\n headers: Record<string, string>;\n}\n\nexport type IncomingWebhookTrigger<Args> = ParserIncomingWebhookTrigger & {\n __args: Args;\n};\n\nexport function incomingWebhookTrigger<T extends IncomingWebhookRequest>(): IncomingWebhookTrigger<\n IncomingWebhookArgs<T>\n> {\n return {\n kind: \"incomingWebhook\",\n __args: {} as IncomingWebhookArgs<T>,\n };\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { WorkflowJob } from \"./job\";\nimport type { AuthInvoker } from \"../auth\";\n\nexport interface WorkflowConfig<\n Job extends WorkflowJob<any, any, any> = WorkflowJob<any, any, any>,\n> {\n name: string;\n mainJob: Job;\n}\n\nexport interface Workflow<Job extends WorkflowJob<any, any, any> = WorkflowJob<any, any, any>> {\n name: string;\n mainJob: Job;\n trigger: (\n args: Parameters<Job[\"trigger\"]>[0],\n options?: { authInvoker: AuthInvoker<string> },\n ) => Promise<string>;\n}\n\nexport function createWorkflow<Job extends WorkflowJob<any, any, any>>(config: {\n name: string;\n mainJob: Job;\n}): Workflow<Job> {\n return {\n ...config,\n trigger: async (args, options) => {\n return tailor.workflow.triggerWorkflow(\n config.name,\n args,\n options ? { authInvoker: options.authInvoker } : undefined,\n );\n },\n };\n}\n","import type { StaticWebsiteInput } from \"@/parser/service/staticwebsite/types\";\n\ndeclare const staticWebsiteDefinitionBrand: unique symbol;\ntype StaticWebsiteDefinitionBrand = {\n readonly [staticWebsiteDefinitionBrand]: true;\n};\n\nexport function defineStaticWebSite(name: string, config: Omit<StaticWebsiteInput, \"name\">) {\n const result = {\n ...config,\n name,\n get url() {\n return `${name}:url` as const;\n },\n } as const satisfies StaticWebsiteInput & { readonly url: string };\n\n return result as typeof result & StaticWebsiteDefinitionBrand;\n}\n\nexport type StaticWebsiteConfig = Omit<ReturnType<typeof defineStaticWebSite>, \"url\">;\n","import type { BuiltinIdP } from \"@/parser/service/auth/types\";\nimport type { IdPInput } from \"@/parser/service/idp/types\";\n\ndeclare const idpDefinitionBrand: unique symbol;\ntype IdpDefinitionBrand = { readonly [idpDefinitionBrand]: true };\n\nexport function defineIdp<const TClients extends string[]>(\n name: string,\n config: Omit<IdPInput, \"name\" | \"clients\"> & { clients: TClients },\n) {\n const result = {\n ...config,\n name,\n provider(providerName: string, clientName: TClients[number]) {\n return {\n name: providerName,\n kind: \"BuiltInIdP\",\n namespace: name,\n clientName,\n } as const satisfies BuiltinIdP;\n },\n } as const satisfies IdPInput & {\n provider: (providerName: string, clientName: TClients[number]) => BuiltinIdP;\n };\n\n return result as typeof result & IdpDefinitionBrand;\n}\n\nexport type IdPExternalConfig = { name: string; external: true };\n\nexport type IdPConfig = Omit<ReturnType<typeof defineIdp>, \"provider\"> | IdPExternalConfig;\n","import { t as _t } from \"@/configure/types\";\nimport type * as helperTypes from \"@/configure/types/helpers\";\n\ntype TailorOutput<T> = helperTypes.output<T>;\n\nexport type infer<T> = TailorOutput<T>;\nexport type output<T> = TailorOutput<T>;\n\n// eslint-disable-next-line import/export\nexport const t = { ..._t };\n// eslint-disable-next-line @typescript-eslint/no-namespace, import/export\nexport namespace t {\n export type output<T> = TailorOutput<T>;\n export type infer<T> = TailorOutput<T>;\n}\n\nexport {\n TailorField,\n type TailorUser,\n unauthenticatedTailorUser,\n type AttributeMap,\n type AttributeList,\n type Env,\n} from \"@/configure/types\";\n\nexport * from \"@/configure/services\";\n\nexport { defineConfig, defineGenerators } from \"@/configure/config\";\n"],"mappings":";;;AAyCA,SAAgB,eAId,QAM+B;CAC/B,MAAM,mBACJ,OAAO,kBAAkB,cAAc,OAAO,SAASA,IAAE,OAAO,OAAO,OAAO;AAEhF,QAAO;EACL,GAAG;EACH,QAAQ;EACT;;;;;ACtBH,SAAgB,eAGd,QAA2B;AAC3B,QAAO;;;;;ACWT,SAAgB,qBAA6C,EAC3D,MACA,aAIsC;AACtC,QAAO;EACL,MAAM;EACN,UAAU,KAAK;EACf;EACA,QAAQ,EAAE;EACX;;AAGH,SAAgB,qBAA6C,EAC3D,MACA,aAIsC;AACtC,QAAO;EACL,MAAM;EACN,UAAU,KAAK;EACf;EACA,QAAQ,EAAE;EACX;;AAGH,SAAgB,qBAA6C,EAC3D,MACA,aAIsC;AACtC,QAAO;EACL,MAAM;EACN,UAAU,KAAK;EACf;EACA,QAAQ,EAAE;EACX;;AAOH,SAAgB,wBAAkD,EAChE,UACA,aAImD;AACnD,QAAO;EACL,MAAM;EACN,cAAc,SAAS;EACvB;EACA,QAAQ,EAAE;EACX;;;;;ACuUH,SAAgB,gBAAkC,EAChD,MACA,YAIgC;AAChC,QAAO;EACL,MAAM;EACN;EACA;EACA,QAAQ,EAAE;EACX;;;;;AC/aH,SAAgB,yBAEd;AACA,QAAO;EACL,MAAM;EACN,QAAQ,EAAE;EACX;;;;;ACNH,SAAgB,eAAuD,QAGrD;AAChB,QAAO;EACL,GAAG;EACH,SAAS,OAAO,MAAM,YAAY;AAChC,UAAO,OAAO,SAAS,gBACrB,OAAO,MACP,MACA,UAAU,EAAE,aAAa,QAAQ,aAAa,GAAG,OAClD;;EAEJ;;;;;AC1BH,SAAgB,oBAAoB,MAAc,QAA0C;AAS1F,QARe;EACb,GAAG;EACH;EACA,IAAI,MAAM;AACR,UAAO,GAAG,KAAK;;EAElB;;;;;ACRH,SAAgB,UACd,MACA,QACA;AAgBA,QAfe;EACb,GAAG;EACH;EACA,SAAS,cAAsB,YAA8B;AAC3D,UAAO;IACL,MAAM;IACN,MAAM;IACN,WAAW;IACX;IACD;;EAEJ;;;;;ACZH,MAAa,IAAI,EAAE,GAAGC,KAAI"}
|
|
@@ -1,36 +1,31 @@
|
|
|
1
1
|
/// <reference path="./user-defined.d.ts" />
|
|
2
|
-
import { Ct as InferFieldsOutput, M as AllowedValuesOutput, St as
|
|
2
|
+
import { Ct as FieldOptions, Dt as JsonCompatible, Et as InferFieldsOutput, M as AllowedValuesOutput, Ot as output$1, St as FieldMetadata, Tt as TailorFieldType, V as AuthInvoker, _t as TailorField, a as IncomingWebhookTrigger$1, bt as ResolverInput, c as ScheduleTriggerInput, dt as TailorEnv, gt as TailorAnyField, i as GqlOperation$1, j as AllowedValues, k as TailorDBType, l as WebhookOperation$1, mt as TailorUser, n as ExecutorInput, o as RecordTrigger$1, r as FunctionOperation$1, s as ResolverExecutedTrigger$1, u as WorkflowOperation$1, wt as FieldOutput, xt as ArrayFieldOutput } from "./types-C0n7Syhv.mjs";
|
|
3
3
|
import { JsonPrimitive, Jsonifiable, Jsonify } from "type-fest";
|
|
4
4
|
import { Client } from "@urql/core";
|
|
5
5
|
import { StandardCRON } from "ts-cron-validator";
|
|
6
6
|
|
|
7
|
-
//#region src/configure/types/env.d.ts
|
|
8
|
-
interface Env {}
|
|
9
|
-
/** Represents environment variables in the Tailor platform. */
|
|
10
|
-
type TailorEnv = keyof Env extends never ? Record<string, string> : Env;
|
|
11
|
-
//#endregion
|
|
12
7
|
//#region src/configure/services/resolver/resolver.d.ts
|
|
13
|
-
type Context<Input extends Record<string,
|
|
14
|
-
input: Input extends Record<string,
|
|
8
|
+
type Context<Input extends Record<string, TailorAnyField> | undefined> = {
|
|
9
|
+
input: Input extends Record<string, TailorAnyField> ? InferFieldsOutput<Input> : never;
|
|
15
10
|
user: TailorUser;
|
|
16
11
|
env: TailorEnv;
|
|
17
12
|
};
|
|
18
|
-
type OutputType<O> = O extends
|
|
13
|
+
type OutputType<O> = O extends TailorAnyField ? output$1<O> : O extends Record<string, TailorAnyField> ? InferFieldsOutput<O> : never;
|
|
19
14
|
/**
|
|
20
15
|
* Normalized output type that preserves generic type information.
|
|
21
16
|
* - If Output is already a TailorField, use it as-is
|
|
22
17
|
* - If Output is a Record of fields, wrap it as a nested TailorField
|
|
23
18
|
*/
|
|
24
|
-
type NormalizedOutput<Output extends
|
|
19
|
+
type NormalizedOutput<Output extends TailorAnyField | Record<string, TailorAnyField>> = Output extends TailorAnyField ? Output : TailorField<{
|
|
25
20
|
type: "nested";
|
|
26
21
|
array: false;
|
|
27
|
-
}, InferFieldsOutput<Extract<Output, Record<string,
|
|
28
|
-
type ResolverReturn<Input extends Record<string,
|
|
22
|
+
}, InferFieldsOutput<Extract<Output, Record<string, TailorAnyField>>>>;
|
|
23
|
+
type ResolverReturn<Input extends Record<string, TailorAnyField> | undefined, Output extends TailorAnyField | Record<string, TailorAnyField>> = Omit<ResolverInput, "input" | "output" | "body"> & Readonly<{
|
|
29
24
|
input?: Input;
|
|
30
25
|
output: NormalizedOutput<Output>;
|
|
31
26
|
body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;
|
|
32
27
|
}>;
|
|
33
|
-
declare function createResolver<Input extends Record<string,
|
|
28
|
+
declare function createResolver<Input extends Record<string, TailorAnyField> | undefined = undefined, Output extends TailorAnyField | Record<string, TailorAnyField> = TailorAnyField>(config: Omit<ResolverInput, "input" | "output" | "body"> & Readonly<{
|
|
34
29
|
input?: Input;
|
|
35
30
|
output: Output;
|
|
36
31
|
body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;
|
|
@@ -351,7 +346,7 @@ declare const t: {
|
|
|
351
346
|
array: true;
|
|
352
347
|
} ? true : false;
|
|
353
348
|
}, FieldOutput<AllowedValuesOutput<V>, Opt>>;
|
|
354
|
-
object: <const F extends Record<string,
|
|
349
|
+
object: <const F extends Record<string, TailorAnyField>, const Opt extends FieldOptions>(fields: F, options?: Opt) => TailorField<{
|
|
355
350
|
type: "nested";
|
|
356
351
|
array: Opt extends {
|
|
357
352
|
array: true;
|
|
@@ -363,5 +358,5 @@ declare namespace t {
|
|
|
363
358
|
type infer<T> = TailorOutput<T>;
|
|
364
359
|
}
|
|
365
360
|
//#endregion
|
|
366
|
-
export { createWorkflow as A, FunctionOperation as C, WorkflowOperation as D, WebhookOperation as E, WorkflowJobOutput as F, createWorkflowJob as I, createResolver as L, WorkflowJob as M, WorkflowJobContext as N, Workflow as O, WorkflowJobInput as P,
|
|
367
|
-
//# sourceMappingURL=index-
|
|
361
|
+
export { createWorkflow as A, FunctionOperation as C, WorkflowOperation as D, WebhookOperation as E, WorkflowJobOutput as F, createWorkflowJob as I, createResolver as L, WorkflowJob as M, WorkflowJobContext as N, Workflow as O, WorkflowJobInput as P, resolverExecutedTrigger as S, Operation as T, ResolverExecutedArgs as _, Trigger as a, recordDeletedTrigger as b, IncomingWebhookTrigger as c, ScheduleTrigger as d, scheduleTrigger as f, RecordUpdatedArgs as g, RecordTrigger as h, createExecutor as i, WORKFLOW_JOB_BRAND as j, WorkflowConfig as k, incomingWebhookTrigger as l, RecordDeletedArgs as m, output as n, IncomingWebhookArgs as o, RecordCreatedArgs as p, t as r, IncomingWebhookRequest as s, infer as t, ScheduleArgs as u, ResolverExecutedTrigger as v, GqlOperation as w, recordUpdatedTrigger as x, recordCreatedTrigger as y };
|
|
362
|
+
//# sourceMappingURL=index-aNF917Ib.d.mts.map
|