@tailor-platform/sdk 2.0.0-next.7 → 2.0.0-next.8
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
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 2.0.0-next.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1808](https://github.com/tailor-platform/sdk/pull/1808) [`61ac76c`](https://github.com/tailor-platform/sdk/commit/61ac76cff992ef30e6115ba96c7d3a676010204f) Thanks [@toiroakr](https://github.com/toiroakr)! - Fix IdP and TailorDB permission condition types breaking when `Attributes` fields are optional. Since machine user attribute keys started mirroring the source field's optionality, the `user` operand key helpers leaked `undefined` into their key unions — failing typecheck against the generated permission types even for `_loggedIn`-only conditions — and rejected attribute keys derived from optional fields. Optional attribute fields are now valid operand keys and `undefined` no longer appears in the unions.
|
|
8
|
+
|
|
3
9
|
## 2.0.0-next.7
|
|
4
10
|
|
|
5
11
|
### Major Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["parseInternal","parseFieldInternal","t","t","platform","_t"],"sources":["../../src/configure/types/type.ts","../../src/configure/services/auth/index.ts","../../src/configure/services/tailordb/permission.ts","../../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/execution-policy.ts","../../src/configure/services/workflow/job.ts","../../src/configure/services/workflow/wait-point.ts","../../src/configure/services/workflow/workflow.ts","../../src/configure/services/staticwebsite/index.ts","../../src/configure/services/aigateway/index.ts","../../src/configure/services/idp/permission.ts","../../src/configure/services/idp/index.ts","../../src/configure/services/secrets/index.ts","../../src/configure/services/http-adapter/http-adapter.ts","../../src/configure/config/index.ts","../../src/configure/index.ts"],"sourcesContent":["import {\n parseInternal as parseFieldInternal,\n type FieldParseArgs,\n type FieldParseInternalArgs,\n} from \"#/runtime/field-parse\";\nimport { type AllowedValues, type AllowedValuesOutput, mapAllowedValues } from \"./field\";\nimport type {\n DefinedFieldMetadata,\n TailorFieldType,\n TailorToTs,\n FieldMetadata,\n FieldOptions,\n FieldOutput,\n TailorField as TailorFieldBase,\n FieldValidateInput,\n} from \"#/configure/types/field.types\";\nimport type { InferFieldsOutput, Prettify, TypeLevelError, output } from \"#/types/helpers\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\n// Erased fields stay assignable across builder method-state changes.\n// oxlint-disable-next-line no-explicit-any\ntype AnyBuilderMethod = any;\n\nexport type TailorAnyField = Omit<\n TailorFieldBase<AnyBuilderMethod, AnyBuilderMethod, FieldMetadata, TailorFieldType>,\n \"fields\"\n> & {\n readonly fields: Record<string, AnyBuilderMethod>;\n _metadata: FieldMetadata;\n description: AnyBuilderMethod;\n typeName: AnyBuilderMethod;\n validate: AnyBuilderMethod;\n parse: AnyBuilderMethod;\n};\n\ntype IsAny<T> = 0 extends 1 & T ? true : false;\ntype WithFieldDescription<Defined> = Defined & { description: true };\ntype WithFieldTypeName<Defined> = Defined & { typeName: true };\ntype WithFieldValidate<Defined> = Defined & { validate: true };\ntype FieldDescriptionFn<Defined extends DefinedFieldMetadata, Output> = (\n description: string,\n) => TailorField<WithFieldDescription<Defined>, Output>;\ntype FieldTypeNameFn<Defined extends DefinedFieldMetadata, Output> = (\n typeName: string,\n) => TailorField<WithFieldTypeName<Defined>, Output>;\ntype FieldValidateFn<Defined extends DefinedFieldMetadata, Output> = (\n ...validate: FieldValidateInput<Output>[]\n) => TailorField<WithFieldValidate<Defined>, Output>;\ntype FieldDescriptionMethod<Defined extends DefinedFieldMetadata, Output> =\n IsAny<Defined> extends true\n ? FieldDescriptionFn<Defined, Output>\n : Defined extends { description: unknown }\n ? TypeLevelError<\".description() has already been set\">\n : FieldDescriptionFn<Defined, Output>;\ntype FieldTypeNameMethod<Defined extends DefinedFieldMetadata, Output> =\n IsAny<Defined> extends true\n ? TypeLevelError<string>\n : Defined extends { typeName: unknown }\n ? TypeLevelError<\".typeName() has already been set\">\n : Defined extends { type: \"enum\" | \"nested\" }\n ? FieldTypeNameFn<Defined, Output>\n : TypeLevelError<\"typeName can only be set on enum or object fields\">;\ntype FieldValidateMethod<Defined extends DefinedFieldMetadata, Output> =\n IsAny<Defined> extends true\n ? FieldValidateFn<Defined, Output>\n : Defined extends { validate: unknown }\n ? TypeLevelError<\".validate() has already been set\">\n : FieldValidateFn<Defined, Output>;\n\n/**\n * Full TailorField interface with builder methods.\n * Extends the minimal structural interface from types/ with fluent API methods.\n */\nexport interface TailorField<\n Defined extends DefinedFieldMetadata = DefinedFieldMetadata,\n // Generic default output type (kept loose on purpose for library ergonomics).\n // oxlint-disable-next-line no-explicit-any\n Output = any,\n M extends FieldMetadata = FieldMetadata,\n T extends TailorFieldType = TailorFieldType,\n> extends TailorFieldBase<Defined, Output, M, T> {\n readonly fields: Record<string, TailorAnyField>;\n _metadata: M;\n\n /**\n * Set a description for the field\n * @param description - The description text\n * @returns The field with updated metadata\n */\n description: FieldDescriptionMethod<Defined, Output>;\n\n /**\n * Set a custom type name for enum or nested types\n * @param typeName - The custom type name\n * @returns The field with updated metadata\n */\n typeName: FieldTypeNameMethod<Defined, Output>;\n\n /**\n * Add validation functions to the field\n * @param validate - One or more validation functions\n * @returns The field with updated metadata\n */\n validate: FieldValidateMethod<Defined, Output>;\n\n /**\n * Parse and validate a value against this field's validation rules\n * Returns StandardSchema Result type with success or failure\n * @param args - Value, context data, and invoker\n * @returns Validation result\n */\n parse(args: FieldParseArgs): StandardSchemaV1.Result<Output>;\n}\n\n/**\n * Internal shape carried by every runtime field for clone-on-write support.\n *\n * `clone()` is intentionally kept off the public {@link TailorField} interface:\n * adding it there would force `TailorDBField` (which has a differently-typed\n * `clone`) to stop being assignable to `TailorField`, breaking the supported\n * `t.object({ field: db.string() })` usage. Every `t.*` and `db.*` field carries\n * a `clone()` at runtime, so the internal cast in `clone()` is safe.\n */\ntype CloneableField = { clone(): TailorAnyField };\n\ntype TailorFieldRuntime<\n Defined extends DefinedFieldMetadata,\n Output,\n M extends FieldMetadata = FieldMetadata,\n T extends TailorFieldType = TailorFieldType,\n> = TailorFieldBase<Defined, Output, M, T> & {\n readonly fields: Record<string, TailorAnyField>;\n _metadata: M;\n description(description: string): object;\n typeName(typeName: string): object;\n validate(...validate: FieldValidateInput<Output>[]): object;\n parse(args: FieldParseArgs): StandardSchemaV1.Result<Output>;\n clone(): TailorAnyField;\n};\n\n/**\n * Creates a new TailorField instance.\n * @param type - Field type\n * @param options - Field options\n * @param fields - Nested fields for object-like types\n * @param values - Allowed values for enum-like fields\n * @param metadata - Pre-built metadata to clone from (used by `clone()`); when\n * given, the mutable containers are deep-copied here and `options`/`values` are\n * ignored for metadata construction\n * @returns A new TailorField\n */\nfunction createTailorField<\n const T extends TailorFieldType,\n const TOptions extends FieldOptions,\n const OutputBase = TailorToTs[T],\n>(\n type: T,\n options?: TOptions,\n fields?: Record<string, TailorAnyField>,\n values?: AllowedValues,\n metadata?: FieldMetadata,\n): TailorField<\n { type: T; array: TOptions extends { array: true } ? true : false },\n FieldOutput<OutputBase, TOptions>\n>;\nfunction createTailorField<\n const T extends TailorFieldType,\n const TOptions extends FieldOptions,\n const OutputBase = TailorToTs[T],\n>(\n type: T,\n options?: TOptions,\n fields?: Record<string, TailorAnyField>,\n values?: AllowedValues,\n metadata?: FieldMetadata,\n): object {\n type FieldValue = FieldOutput<OutputBase, TOptions>;\n\n // When cloning, take ownership of the source metadata and deep-copy its mutable\n // containers (enum value objects and `[fn, message]` validator tuples; validator\n // functions are kept by reference) so no two instances share mutable state.\n const _metadata: FieldMetadata = metadata\n ? {\n ...metadata,\n ...(metadata.allowedValues && {\n allowedValues: metadata.allowedValues.map((v) => ({ ...v })),\n }),\n ...(metadata.validate && {\n validate: metadata.validate.map((v) => (Array.isArray(v) ? ([...v] as typeof v) : v)),\n }),\n }\n : { required: true };\n\n if (!metadata) {\n if (options) {\n if (options.optional === true) {\n _metadata.required = false;\n }\n if (options.array === true) {\n _metadata.array = true;\n }\n }\n if (values) {\n _metadata.allowedValues = mapAllowedValues(values);\n }\n }\n\n function parseInternal(\n args: FieldParseInternalArgs,\n ): StandardSchemaV1.Result<FieldOutput<OutputBase, TOptions>> {\n return parseFieldInternal<T, FieldOutput<OutputBase, TOptions>>({\n ...args,\n field,\n });\n }\n\n /**\n * Clone the field and apply metadata updates to the clone.\n * The original instance is never mutated, so a field shared across places\n * cannot leak metadata between them.\n * @param metadataUpdates - Metadata properties to overwrite on the clone\n * @returns A new field with the updated metadata\n */\n function cloneWith(metadataUpdates: Partial<FieldMetadata>) {\n const cloned = field.clone();\n Object.assign(cloned._metadata, metadataUpdates);\n return cloned;\n }\n\n const field: TailorFieldRuntime<\n { type: T; array: TOptions extends { array: true } ? true : false },\n FieldValue,\n FieldMetadata,\n T\n > = {\n type,\n fields: fields ?? {},\n _defined: undefined as unknown as {\n type: T;\n array: TOptions extends { array: true } ? true : false;\n },\n _output: undefined as FieldOutput<OutputBase, TOptions>,\n _metadata,\n\n get metadata() {\n return { ...this._metadata };\n },\n\n description(description: string) {\n // Clone-on-write so a shared field instance never leaks metadata.\n return cloneWith({ description });\n },\n\n typeName(typeName: string) {\n // Clone-on-write so a shared field instance never leaks metadata.\n return cloneWith({ typeName });\n },\n\n validate(...validateInputs: FieldValidateInput<FieldValue>[]) {\n // Clone-on-write so a shared field instance never leaks metadata.\n return cloneWith({ validate: validateInputs });\n },\n\n parse(args: FieldParseArgs): StandardSchemaV1.Result<FieldOutput<OutputBase, TOptions>> {\n return parseInternal({\n value: args.value,\n data: args.data,\n invoker: args.invoker,\n pathArray: [],\n });\n },\n\n clone() {\n // Deep clone nested object fields so the new instance shares no mutable state.\n let clonedFields = fields;\n if (fields) {\n const cloned: Record<string, TailorAnyField> = {};\n for (const [key, nestedField] of Object.entries(fields)) {\n // Both t.* and db.* fields carry clone() at runtime (see CloneableField).\n cloned[key] = (nestedField as TailorAnyField & CloneableField).clone();\n }\n clonedFields = cloned;\n }\n\n // Rebuild via the factory, handing it this field's metadata so the new\n // parseInternal closure rebinds to the clone and the factory owns the metadata deep-copy.\n // oxlint-disable-next-line no-explicit-any\n return createTailorField(type, options, clonedFields, values, this._metadata) as any;\n },\n };\n\n return field;\n}\n\n/**\n * Create a UUID field for resolver input/output.\n * @param options - Field configuration options\n * @returns A UUID field\n * @example t.uuid()\n */\nfunction uuid<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"uuid\", options);\n}\n\n/**\n * Create a string field for resolver input/output.\n * @param options - Field configuration options\n * @returns A string field\n * @example t.string()\n * @example t.string({ optional: true })\n * @example t.string({ array: true })\n */\nfunction string<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"string\", options);\n}\n\n/**\n * Create a boolean field for resolver input/output.\n * @param options - Field configuration options\n * @returns A boolean field\n * @example t.bool()\n */\nfunction bool<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"boolean\", options);\n}\n\n/**\n * Create an integer field for resolver input/output.\n * @param options - Field configuration options\n * @returns An integer field\n * @example t.int()\n */\nfunction int<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"integer\", options);\n}\n\n/**\n * Create a float field for resolver input/output.\n * @param options - Field configuration options\n * @returns A float field\n * @example t.float()\n */\nfunction float<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"float\", options);\n}\n\n/**\n * Create a decimal field for resolver input/output (stored as string for precision).\n * @param options - Field configuration options\n * @returns A decimal field\n * @example t.decimal()\n * @example t.decimal({ optional: true })\n */\nfunction decimal<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"decimal\", options);\n}\n\n/**\n * Create a date field for resolver input/output.\n * @param options - Field configuration options\n * @returns A date field\n * @example t.date()\n */\nfunction date<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"date\", options);\n}\n\n/**\n * Create a datetime field for resolver input/output.\n * @param options - Field configuration options\n * @returns A datetime field\n * @example t.datetime()\n */\nfunction datetime<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"datetime\", options);\n}\n\n/**\n * Create a time field for resolver input/output.\n * @param options - Field configuration options\n * @returns A time field\n * @example t.time()\n */\nfunction time<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"time\", options);\n}\n\n/**\n * Create an enum field for resolver input/output.\n * @param values - Array of allowed string values\n * @param options - Field configuration options\n * @returns An enum field\n * @example t.enum([\"active\", \"inactive\"])\n */\nfunction _enum<const V extends AllowedValues, const Opt extends FieldOptions>(\n values: V,\n options?: Opt,\n): TailorField<\n { type: \"enum\"; array: Opt extends { array: true } ? true : false },\n FieldOutput<AllowedValuesOutput<V>, Opt>\n> {\n return createTailorField<\"enum\", Opt, AllowedValuesOutput<V>>(\"enum\", options, undefined, values);\n}\n\ntype DefaultFieldKeys<F> = {\n [K in keyof F]: F[K] extends { _defined: { default: true } } ? K : never;\n}[keyof F];\n\ntype InferFieldsOutputWithDefaults<\n // oxlint-disable-next-line no-explicit-any\n F extends Record<string, { _output: any; [key: string]: any }>,\n> = Prettify<\n Omit<InferFieldsOutput<F>, DefaultFieldKeys<F> & string> & {\n [K in DefaultFieldKeys<F> & keyof F]?: output<F[K]>;\n }\n>;\n\n/**\n * Create a nested object field for resolver input/output.\n * @param fields - Record of field definitions\n * @param options - Field options (optional, array)\n * @returns A nested object field\n * @example\n * // Single object:\n * output: t.object({ name: t.string(), email: t.string() })\n * @example\n * // Array of objects:\n * items: t.object({ name: t.string() }, { array: true })\n */\nfunction object<const F extends Record<string, TailorAnyField>, const Opt extends FieldOptions>(\n fields: F,\n options?: Opt,\n) {\n const objectField = createTailorField(\"nested\", options, fields) as TailorField<\n { type: \"nested\"; array: Opt extends { array: true } ? true : false },\n FieldOutput<InferFieldsOutputWithDefaults<F>, Opt>\n >;\n return objectField;\n}\n\nexport const t = {\n uuid,\n string,\n bool,\n int,\n float,\n decimal,\n date,\n datetime,\n time,\n enum: _enum,\n object,\n};\n","import { type TailorDBInstance } from \"../tailordb/schema\";\nimport type {\n AuthDefinitionBrand,\n AuthServiceInput,\n DefinedAuth,\n UserAttributeListKey,\n UserAttributes,\n} from \"#/configure/services/auth/types\";\nimport type {\n DefinedFieldMetadata,\n FieldMetadata,\n TailorFieldType,\n TailorField,\n} from \"#/configure/types/field.types\";\n\ntype MachineUserAttributeFields = Record<\n string,\n TailorField<DefinedFieldMetadata, unknown, FieldMetadata, TailorFieldType>\n>;\n\ntype PlaceholderUser = TailorDBInstance<Record<string, never>, Record<string, never>>;\ntype PlaceholderAttributes = UserAttributes<PlaceholderUser>;\ntype PlaceholderAttributeList = UserAttributeListKey<PlaceholderUser>[];\n\ntype UserProfileAuthInput<\n User extends TailorDBInstance,\n Attributes extends UserAttributes<User>,\n AttributeList extends UserAttributeListKey<User>[],\n MachineUserNames extends string,\n ConnectionNames extends string = string,\n> = Omit<\n AuthServiceInput<User, Attributes, AttributeList, MachineUserNames, undefined, ConnectionNames>,\n \"userProfile\" | \"machineUserAttributes\"\n> & {\n userProfile: NonNullable<\n AuthServiceInput<User, Attributes, AttributeList, MachineUserNames, undefined>[\"userProfile\"]\n >;\n machineUserAttributes?: never;\n};\n\ntype MachineUserOnlyAuthInput<\n MachineUserNames extends string,\n MachineUserAttributes extends MachineUserAttributeFields,\n ConnectionNames extends string = string,\n> = Omit<\n AuthServiceInput<\n PlaceholderUser,\n PlaceholderAttributes,\n PlaceholderAttributeList,\n MachineUserNames,\n MachineUserAttributes,\n ConnectionNames\n >,\n \"userProfile\" | \"machineUserAttributes\"\n> & {\n userProfile?: never;\n machineUserAttributes: MachineUserAttributes;\n};\n\nexport type {\n OIDC,\n SAML,\n IDToken,\n BuiltinIdP,\n IdProvider as IdProviderConfig,\n OAuth2ClientInput as OAuth2Client,\n SCIMAuthorization,\n SCIMAttribute,\n SCIMAttributeMapping,\n SCIMResource,\n SCIMConfig,\n TenantProvider as TenantProviderConfig,\n} from \"#/types/auth.generated\";\nexport type {\n OAuth2ClientGrantType,\n SCIMAttributeType,\n BeforeLoginHookArgs,\n BeforeLoginClaims,\n FederatedIdentity,\n FederatedIdentityClaims,\n FederatedIdentityProvider,\n} from \"#/configure/services/auth/types\";\nexport type {\n AuthConnectionOAuth2Config,\n AuthConnectionConfig,\n} from \"#/types/auth-connection.generated\";\nexport type {\n ValueOperand,\n UsernameFieldKey,\n UserAttributeKey,\n UserAttributeListKey,\n UserAttributes,\n AuthConnectionTokenResult,\n AuthServiceInput,\n AuthConfig,\n AuthExternalConfig,\n AuthOwnConfig,\n DefinedAuth,\n} from \"#/configure/services/auth/types\";\n\n/**\n * Define an auth service for the Tailor SDK.\n * @template Name\n * @template User\n * @template Attributes\n * @template AttributeList\n * @template MachineUserNames\n * @param name - Auth service name\n * @param config - Auth service configuration\n * @returns Defined auth service\n */\nexport function defineAuth<\n const Name extends string,\n const User extends TailorDBInstance,\n const Attributes extends UserAttributes<User>,\n const AttributeList extends UserAttributeListKey<User>[],\n const MachineUserNames extends string,\n const ConnectionNames extends string = string,\n>(\n name: Name,\n config: UserProfileAuthInput<User, Attributes, AttributeList, MachineUserNames, ConnectionNames>,\n): DefinedAuth<\n Name,\n UserProfileAuthInput<User, Attributes, AttributeList, MachineUserNames, ConnectionNames>\n>;\nexport function defineAuth<\n const Name extends string,\n const MachineUserAttributes extends MachineUserAttributeFields,\n const MachineUserNames extends string,\n const ConnectionNames extends string = string,\n>(\n name: Name,\n config: MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes, ConnectionNames>,\n): DefinedAuth<\n Name,\n MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes, ConnectionNames>\n>;\n/* @__NO_SIDE_EFFECTS__ */\nexport function defineAuth<\n const Name extends string,\n const User extends TailorDBInstance,\n const Attributes extends UserAttributes<User>,\n const AttributeList extends UserAttributeListKey<User>[],\n const MachineUserAttributes extends MachineUserAttributeFields,\n const MachineUserNames extends string,\n const ConnectionNames extends string = string,\n>(\n name: Name,\n config:\n | UserProfileAuthInput<User, Attributes, AttributeList, MachineUserNames, ConnectionNames>\n | MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes, ConnectionNames>,\n) {\n const result = {\n ...config,\n name,\n } as const satisfies (\n | UserProfileAuthInput<User, Attributes, AttributeList, MachineUserNames, ConnectionNames>\n | MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes, ConnectionNames>\n ) & {\n name: string;\n };\n\n return result as typeof result & AuthDefinitionBrand;\n}\n","import type { InferredAttributes } from \"#/runtime/types\";\n\n// --- Permission types (UX-focused, for configure layer) ---\n\n/**\n * Record-level permission configuration for a TailorDB type.\n * Defines create, read, update, and delete permissions.\n *\n * Prefer object format with explicit `conditions` and `permit` for readability.\n * Shorthand array format is supported for compatibility, but less readable.\n *\n * For update operations, use `newRecord`/`oldRecord` operands instead of `record`.\n * @example\n * const permission: TailorTypePermission = {\n * create: [{ conditions: [[{ user: \"_loggedIn\" }, \"=\", true]], permit: true }],\n * read: [{ conditions: [[{ record: \"isPublic\" }, \"=\", true]], permit: true }],\n * update: [{ conditions: [[{ newRecord: \"ownerId\" }, \"=\", { user: \"id\" }]], permit: true }],\n * delete: [{ conditions: [[{ record: \"ownerId\" }, \"=\", { user: \"id\" }]], permit: true }],\n * };\n */\nexport type TailorTypePermission<\n User extends object = InferredAttributes,\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 = InferredAttributes,\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 /**\n * Whether matching records are granted (`true`) or denied (`false`).\n * Omitting `permit` in this object form defaults to `deny` and emits a\n * warning; set it explicitly. (The array shorthand defaults to `allow`.)\n */\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 = InferredAttributes,\n Type extends object = object,\n> = readonly GqlPermissionPolicy<User, Type>[];\n\ntype GqlPermissionPolicy<User extends object = InferredAttributes, Type extends object = object> = {\n conditions: readonly PermissionCondition<\"gql\", User, boolean, Type>[];\n actions: \"all\" | readonly GqlPermissionAction[];\n /**\n * Whether matching requests are granted (`true`) or denied (`false`).\n * Omitting `permit` defaults to `deny` and emits a warning; set it explicitly.\n */\n permit?: boolean;\n description?: string;\n};\n\ntype GqlPermissionAction = \"read\" | \"create\" | \"update\" | \"delete\" | \"aggregate\" | \"bulkUpsert\";\n\ntype EqualityOperator = \"=\" | \"!=\";\ntype ContainsOperator = \"in\" | \"not in\";\ntype HasAnyOperator = \"hasAny\" | \"not hasAny\";\n\n// Helper types for User field extraction\ntype StringFieldKeys<User extends object> = {\n [K in keyof User]: User[K] extends string ? K : never;\n}[keyof User];\n\ntype StringArrayFieldKeys<User extends object> = {\n [K in keyof User]: User[K] extends string[] ? K : never;\n}[keyof User];\n\ntype BooleanFieldKeys<User extends object> = {\n [K in keyof User]: User[K] extends boolean ? K : never;\n}[keyof User];\n\ntype BooleanArrayFieldKeys<User extends object> = {\n [K in keyof User]: User[K] extends boolean[] ? K : never;\n}[keyof User];\n\ntype UserStringOperand<User extends object = InferredAttributes> = {\n user: StringFieldKeys<User> | \"id\";\n};\n\ntype UserStringArrayOperand<User extends object = InferredAttributes> = {\n user: StringArrayFieldKeys<User>;\n};\n\ntype UserBooleanOperand<User extends object = InferredAttributes> = {\n user: BooleanFieldKeys<User> | \"_loggedIn\";\n};\n\ntype UserBooleanArrayOperand<User extends object = InferredAttributes> = {\n user: BooleanArrayFieldKeys<User>;\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\ntype StringEqualityCondition<\n Level extends \"record\" | \"gql\",\n User extends object,\n Update extends boolean,\n Type extends object,\n> =\n | (Level extends \"gql\" ? readonly [string, EqualityOperator, boolean] : never)\n | readonly [string, EqualityOperator, string]\n | readonly [UserStringOperand<User>, EqualityOperator, string]\n | readonly [string, EqualityOperator, UserStringOperand<User>]\n | (Level extends \"record\"\n ?\n | readonly [\n RecordOperand<Type, Update>,\n EqualityOperator,\n string | UserStringOperand<User>,\n ]\n | readonly [\n string | UserStringOperand<User>,\n EqualityOperator,\n RecordOperand<Type, Update>,\n ]\n : never);\n\ntype BooleanEqualityCondition<\n Level extends \"record\" | \"gql\",\n User extends object,\n Update extends boolean,\n Type extends object,\n> =\n | readonly [boolean, EqualityOperator, boolean]\n | readonly [UserBooleanOperand<User>, EqualityOperator, boolean]\n | readonly [boolean, EqualityOperator, UserBooleanOperand<User>]\n | (Level extends \"record\"\n ?\n | readonly [\n RecordOperand<Type, Update>,\n EqualityOperator,\n boolean | UserBooleanOperand<User>,\n ]\n | readonly [\n boolean | UserBooleanOperand<User>,\n EqualityOperator,\n RecordOperand<Type, Update>,\n ]\n : never);\n\ntype EqualityCondition<\n Level extends \"record\" | \"gql\" = \"record\",\n User extends object = InferredAttributes,\n Update extends boolean = boolean,\n Type extends object = object,\n> =\n | StringEqualityCondition<Level, User, Update, Type>\n | BooleanEqualityCondition<Level, User, Update, Type>;\n\ntype StringContainsCondition<\n Level extends \"record\" | \"gql\",\n User extends object,\n Update extends boolean,\n Type extends object,\n> =\n | readonly [string, ContainsOperator, string[]]\n | readonly [UserStringOperand<User>, ContainsOperator, string[]]\n | readonly [string, ContainsOperator, UserStringArrayOperand<User>]\n | (Level extends \"record\"\n ?\n | readonly [\n RecordOperand<Type, Update>,\n ContainsOperator,\n string[] | UserStringArrayOperand<User>,\n ]\n | readonly [\n string | UserStringOperand<User>,\n ContainsOperator,\n RecordOperand<Type, Update>,\n ]\n : never);\n\ntype BooleanContainsCondition<\n Level extends \"record\" | \"gql\",\n User extends object,\n Update extends boolean,\n Type extends object,\n> =\n | (Level extends \"gql\" ? readonly [string, ContainsOperator, boolean[]] : never)\n | readonly [boolean, ContainsOperator, boolean[]]\n | readonly [UserBooleanOperand<User>, ContainsOperator, boolean[]]\n | readonly [boolean, ContainsOperator, UserBooleanArrayOperand<User>]\n | (Level extends \"record\"\n ?\n | readonly [\n RecordOperand<Type, Update>,\n ContainsOperator,\n boolean[] | UserBooleanArrayOperand<User>,\n ]\n | readonly [\n boolean | UserBooleanOperand<User>,\n ContainsOperator,\n RecordOperand<Type, Update>,\n ]\n : never);\n\ntype ContainsCondition<\n Level extends \"record\" | \"gql\" = \"record\",\n User extends object = InferredAttributes,\n Update extends boolean = boolean,\n Type extends object = object,\n> =\n | StringContainsCondition<Level, User, Update, Type>\n | BooleanContainsCondition<Level, User, Update, Type>;\n\ntype HasAnyCondition<\n Level extends \"record\" | \"gql\",\n User extends object,\n Update extends boolean,\n Type extends object,\n> =\n | readonly [\n string[] | UserStringArrayOperand<User>,\n HasAnyOperator,\n string[] | UserStringArrayOperand<User>,\n ]\n | (Level extends \"record\"\n ?\n | readonly [\n RecordOperand<Type, Update>,\n HasAnyOperator,\n string[] | UserStringArrayOperand<User>,\n ]\n | readonly [\n string[] | UserStringArrayOperand<User>,\n HasAnyOperator,\n RecordOperand<Type, Update>,\n ]\n : never);\n\n/**\n * Type representing a permission condition that combines user attributes, record fields, and literal values using comparison operators.\n *\n * The User type is extended by `tailor.d.ts`, which is automatically generated when running `tailor generate`.\n * Attributes enabled in the config file's `auth.userProfile.attributes` (or\n * `auth.machineUserAttributes` when userProfile is omitted) become available as types.\n * @example\n * ```ts\n * // tailor.config.ts\n * export const auth = defineAuth(\"my-auth\", {\n * userProfile: {\n * type: user,\n * attributes: {\n * isAdmin: true,\n * roles: true,\n * }\n * }\n * });\n * ```\n */\nexport type PermissionCondition<\n Level extends \"record\" | \"gql\" = \"record\",\n User extends object = InferredAttributes,\n Update extends boolean = boolean,\n Type extends object = object,\n> =\n | EqualityCondition<Level, User, Update, Type>\n | ContainsCondition<Level, User, Update, Type>\n | HasAnyCondition<Level, User, Update, Type>;\n\n// --- Runtime constants ---\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 { t, type TailorAnyField, type TailorField } from \"#/configure/types/type\";\nimport { brandValue } from \"#/utils/brand\";\nimport type { MachineUserName } from \"#/configure/types/machine-user\";\nimport type { TailorEnv, TailorPrincipal } from \"#/runtime/types\";\nimport type { InferFieldsOutput, output } from \"#/types/helpers\";\nimport type { ResolverInput } from \"#/types/resolver.generated\";\n\ntype Context<Input extends Record<string, TailorAnyField> | undefined> = {\n input: Input extends Record<string, TailorAnyField> ? InferFieldsOutput<Input> : never;\n caller: TailorPrincipal | null;\n invoker: TailorPrincipal | null;\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\" | \"invoker\"> &\n Readonly<{\n input?: Input;\n output: NormalizedOutput<Output>;\n body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;\n invoker?: MachineUserName;\n }>;\n\n/**\n * Create a resolver definition for the Tailor SDK.\n *\n * The `body` function receives a context with `input` (typed from `config.input`),\n * `caller`, `invoker` (reflects configured machine-user delegation), and `env`.\n * The return value of `body` must match the `output` type.\n *\n * `output` accepts either a single TailorField (e.g. `t.string()`) or a\n * Record of fields (e.g. `{ name: t.string(), age: t.int() }`).\n *\n * `publishEvents` enables publishing execution events for this resolver.\n * If not specified, this is automatically set to true when an executor uses this resolver\n * with `resolverExecutedTrigger`. If explicitly set to false while an executor uses this\n * resolver, an error will be thrown during apply.\n * @template Input\n * @template Output\n * @param config - Resolver configuration\n * @returns Normalized resolver configuration\n * @example\n * import { createResolver, t } from \"@tailor-platform/sdk\";\n *\n * export default createResolver({\n * name: \"getUser\",\n * operation: \"query\",\n * input: {\n * id: t.string(),\n * },\n * body: async ({ input, caller }) => {\n * const db = getDB(\"tailordb\");\n * const result = await db.selectFrom(\"User\").selectAll().where(\"id\", \"=\", input.id).executeTakeFirst();\n * return { name: result?.name ?? \"\", email: result?.email ?? \"\" };\n * },\n * output: t.object({\n * name: t.string(),\n * email: t.string(),\n * }),\n * });\n */\n/* @__NO_SIDE_EFFECTS__ */\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\" | \"invoker\"> &\n Readonly<{\n input?: Input;\n output: Output;\n body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;\n invoker?: MachineUserName;\n }>,\n): ResolverReturn<Input, Output> {\n // Check if output is already a TailorField using duck typing.\n // TailorField has `type: string` (e.g., \"uuid\", \"string\"), while\n // Record<string, TailorField> either lacks `type` or has TailorField as value.\n const isTailorField = (obj: unknown): obj is TailorAnyField =>\n typeof obj === \"object\" &&\n obj !== null &&\n \"type\" in obj &&\n typeof (obj as { type: unknown }).type === \"string\";\n\n const normalizedOutput = isTailorField(config.output) ? config.output : t.object(config.output);\n\n return brandValue(\n {\n ...config,\n output: normalizedOutput,\n } as ResolverReturn<Input, Output>,\n \"resolver\",\n );\n}\n\n// A loose config alias for userland use-cases\n// oxlint-disable-next-line no-explicit-any\nexport type ResolverConfig = ReturnType<typeof createResolver<any, any>>;\n","import { brandValue } from \"#/utils/brand\";\nimport type { Workflow } from \"#/configure/services/workflow/workflow\";\nimport type { ExecutorInput } from \"#/types/executor.generated\";\nimport type { Operation, WorkflowOperation } from \"./operation\";\nimport type { Trigger } from \"./trigger\";\n\ntype TriggerArgs<T extends Trigger<unknown>> = T extends { __args: infer Args } ? Args : never;\n\ntype ExecutorBase<T extends Trigger<unknown>> = Omit<ExecutorInput, \"trigger\" | \"operation\"> & {\n trigger: T;\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<T extends Trigger<unknown>, O> = O extends {\n kind: \"workflow\";\n workflow: infer W extends Workflow;\n}\n ? ExecutorBase<T> & {\n operation: WorkflowOperation<TriggerArgs<T>, W>;\n }\n : ExecutorBase<T> & {\n operation: O;\n };\n\n/**\n * Create an executor configuration for the Tailor SDK.\n *\n * Executors are event-driven handlers that respond to record changes,\n * resolver executions, or other events.\n *\n * Operation kinds: \"function\", \"graphql\", \"webhook\", \"workflow\".\n * @template T\n * @template O\n * @param config - Executor configuration\n * @returns The same executor configuration\n * @example\n * import { createExecutor, recordCreatedTrigger } from \"@tailor-platform/sdk\";\n * import { order } from \"../tailordb/order\";\n *\n * export default createExecutor({\n * name: \"order-created\",\n * description: \"Handles new order creation\",\n * trigger: recordCreatedTrigger({ type: order }),\n * operation: {\n * kind: \"function\",\n * body: async ({ newRecord }) => {\n * console.log(\"New order:\", newRecord.id);\n * },\n * },\n * });\n */\nexport function createExecutor<\n T extends Trigger<unknown>,\n O extends Operation<TriggerArgs<T>> | { kind: \"workflow\"; workflow: Workflow },\n>(config: Executor<T, O>): Executor<T, O>;\n\n/**\n * Create an executor configuration for the Tailor SDK.\n * This overload preserves source compatibility for legacy explicit generic calls,\n * where the first generic argument represents trigger args.\n * @template Args\n * @template O\n * @param config - Executor configuration\n * @returns The same executor configuration\n */\nexport function createExecutor<\n Args,\n O extends Operation<Args> | { kind: \"workflow\"; workflow: Workflow },\n>(config: Executor<Trigger<Args>, O>): Executor<Trigger<Args>, O>;\n\n/* @__NO_SIDE_EFFECTS__ */\nexport function createExecutor<\n T extends Trigger<unknown>,\n O extends Operation<TriggerArgs<T>> | { kind: \"workflow\"; workflow: Workflow },\n>(config: Executor<T, O>) {\n return brandValue(config, \"executor\");\n}\n","import type { ResolverConfig } from \"#/configure/services/resolver/resolver\";\nimport type { TailorDBType } from \"#/configure/services/tailordb/schema\";\nimport type { IdpName } from \"#/configure/types/idp-name\";\nimport type { TailorEnv, TailorPrincipal } from \"#/runtime/types\";\nimport type {\n TailorDBTrigger as ParserTailorDBTrigger,\n ResolverExecutedTrigger as ParserResolverExecutedTrigger,\n IdpUserTrigger as ParserIdpUserTrigger,\n AuthAccessTokenTrigger as ParserAuthAccessTokenTrigger,\n} from \"#/types/executor.generated\";\nimport type { output } from \"#/types/helpers\";\n\ninterface EventArgs {\n workspaceId: string;\n appNamespace: string;\n env: TailorEnv;\n actor: TailorPrincipal | null;\n}\n\ninterface RecordArgs extends EventArgs {\n typeName: string;\n}\n\nexport interface RecordCreatedArgs<T extends TailorDBType> extends RecordArgs {\n event: \"created\";\n rawEvent: \"tailordb.type_record.created\";\n newRecord: output<T>;\n}\n\nexport interface RecordUpdatedArgs<T extends TailorDBType> extends RecordArgs {\n event: \"updated\";\n rawEvent: \"tailordb.type_record.updated\";\n newRecord: output<T>;\n oldRecord: output<T>;\n}\n\nexport interface RecordDeletedArgs<T extends TailorDBType> extends RecordArgs {\n event: \"deleted\";\n rawEvent: \"tailordb.type_record.deleted\";\n oldRecord: output<T>;\n}\n\n/**\n * Args for resolverExecutedTrigger. This is a discriminated union on `success`.\n *\n * When `success` is true, `result` contains the resolver output and `error` is never.\n * When `success` is false, `error` contains the error message and `result` is never.\n *\n * Narrow on `success` to safely access either `result` or `error`.\n * @example\n * body: async (args) => {\n * if (args.success) {\n * console.log(args.result);\n * } else {\n * console.error(args.error);\n * }\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\n// IdP User Event Args\nexport interface IdpUserCreatedArgs extends EventArgs {\n event: \"created\";\n rawEvent: \"idp.user.created\";\n namespaceName: string;\n userId: string;\n}\n\nexport interface IdpUserUpdatedArgs extends EventArgs {\n event: \"updated\";\n rawEvent: \"idp.user.updated\";\n namespaceName: string;\n userId: string;\n}\n\nexport interface IdpUserDeletedArgs extends EventArgs {\n event: \"deleted\";\n rawEvent: \"idp.user.deleted\";\n namespaceName: string;\n userId: string;\n}\n\nexport type IdpUserArgs = IdpUserCreatedArgs | IdpUserUpdatedArgs | IdpUserDeletedArgs;\n\n// Auth Access Token Event Args\nexport interface AuthAccessTokenIssuedArgs extends EventArgs {\n event: \"issued\";\n rawEvent: \"auth.access_token.issued\";\n namespaceName: string;\n userId: string;\n}\n\nexport interface AuthAccessTokenRefreshedArgs extends EventArgs {\n event: \"refreshed\";\n rawEvent: \"auth.access_token.refreshed\";\n namespaceName: string;\n userId: string;\n}\n\nexport interface AuthAccessTokenRevokedArgs extends EventArgs {\n event: \"revoked\";\n rawEvent: \"auth.access_token.revoked\";\n namespaceName: string;\n userId: string;\n}\n\nexport type AuthAccessTokenArgs =\n | AuthAccessTokenIssuedArgs\n | AuthAccessTokenRefreshedArgs\n | AuthAccessTokenRevokedArgs;\n\n// ---------------------------------------------------------------------------\n// TailorDB trigger types and factories\n// ---------------------------------------------------------------------------\n\nconst recordEventMap = {\n created: \"tailordb.type_record.created\",\n updated: \"tailordb.type_record.updated\",\n deleted: \"tailordb.type_record.deleted\",\n} as const;\ntype RecordEventMap = typeof recordEventMap;\ntype RecordEventKind = keyof RecordEventMap;\n\ntype RecordArgsMap<T extends TailorDBType> = {\n created: RecordCreatedArgs<T>;\n updated: RecordUpdatedArgs<T>;\n deleted: RecordDeletedArgs<T>;\n};\n\ntype RecordMultiArgs<\n T extends TailorDBType,\n K extends RecordEventKind[],\n> = RecordArgsMap<T>[K[number]];\n\nexport type TailorDBTrigger<Args> = ParserTailorDBTrigger & {\n __args: Args;\n};\n\ntype RecordTriggerOptions<T extends TailorDBType, Args> = {\n type: T;\n condition?: (args: Args) => boolean;\n};\n\n/**\n * Create a trigger that fires when a TailorDB record is created.\n * @template T\n * @param options - Trigger options\n * @returns Record created trigger\n */\nexport function recordCreatedTrigger<T extends TailorDBType>(\n options: RecordTriggerOptions<T, RecordCreatedArgs<T>>,\n): TailorDBTrigger<RecordCreatedArgs<T>> {\n const { type, condition } = options;\n return {\n kind: \"tailordb\",\n events: [\"tailordb.type_record.created\"],\n typeName: type.name,\n condition,\n __args: {} as RecordCreatedArgs<T>,\n };\n}\n\n/**\n * Create a trigger that fires when a TailorDB record is updated.\n * @template T\n * @param options - Trigger options\n * @returns Record updated trigger\n */\nexport function recordUpdatedTrigger<T extends TailorDBType>(\n options: RecordTriggerOptions<T, RecordUpdatedArgs<T>>,\n): TailorDBTrigger<RecordUpdatedArgs<T>> {\n const { type, condition } = options;\n return {\n kind: \"tailordb\",\n events: [\"tailordb.type_record.updated\"],\n typeName: type.name,\n condition,\n __args: {} as RecordUpdatedArgs<T>,\n };\n}\n\n/**\n * Create a trigger that fires when a TailorDB record is deleted.\n * @template T\n * @param options - Trigger options\n * @returns Record deleted trigger\n */\nexport function recordDeletedTrigger<T extends TailorDBType>(\n options: RecordTriggerOptions<T, RecordDeletedArgs<T>>,\n): TailorDBTrigger<RecordDeletedArgs<T>> {\n const { type, condition } = options;\n return {\n kind: \"tailordb\",\n events: [\"tailordb.type_record.deleted\"],\n typeName: type.name,\n condition,\n __args: {} as RecordDeletedArgs<T>,\n };\n}\n\ntype RecordTriggerMultiOptions<T extends TailorDBType, K extends RecordEventKind[]> = {\n type: T;\n events: K;\n condition?: (args: RecordMultiArgs<T, K>) => boolean;\n};\n\n/**\n * Create a trigger that fires on multiple TailorDB record event types.\n * @template T\n * @template K\n * @param options - Trigger options with events array\n * @returns TailorDB record trigger\n */\nexport function recordTrigger<\n T extends TailorDBType,\n const K extends [RecordEventKind, ...RecordEventKind[]],\n>(options: RecordTriggerMultiOptions<T, K>): TailorDBTrigger<RecordMultiArgs<T, K>> {\n const { type, events, condition } = options;\n return {\n kind: \"tailordb\",\n events: events.map((k) => recordEventMap[k]),\n typeName: type.name,\n condition,\n __args: {} as RecordMultiArgs<T, K>,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Resolver trigger\n// ---------------------------------------------------------------------------\n\nexport type ResolverExecutedTrigger<Args> = ParserResolverExecutedTrigger & {\n __args: Args;\n};\n\ntype ResolverExecutedTriggerOptions<R extends ResolverConfig> = {\n resolver: R;\n condition?: (args: ResolverExecutedArgs<R>) => boolean;\n};\n\n/**\n * Create a trigger that fires when a resolver is executed.\n * @template R\n * @param options - Trigger options\n * @returns Resolver executed trigger\n */\nexport function resolverExecutedTrigger<R extends ResolverConfig>(\n options: ResolverExecutedTriggerOptions<R>,\n): ResolverExecutedTrigger<ResolverExecutedArgs<R>> {\n const { resolver, condition } = options;\n return {\n kind: \"resolverExecuted\",\n resolverName: resolver.name,\n condition,\n __args: {} as ResolverExecutedArgs<R>,\n };\n}\n\n// ---------------------------------------------------------------------------\n// IdP User trigger types and factories\n// ---------------------------------------------------------------------------\n\nconst idpUserEventMap = {\n created: \"idp.user.created\",\n updated: \"idp.user.updated\",\n deleted: \"idp.user.deleted\",\n} as const;\ntype IdpUserEventMap = typeof idpUserEventMap;\ntype IdpUserEventKind = keyof IdpUserEventMap;\n\ntype IdpUserArgsMap = {\n created: IdpUserCreatedArgs;\n updated: IdpUserUpdatedArgs;\n deleted: IdpUserDeletedArgs;\n};\n\ntype IdpUserMultiArgs<K extends IdpUserEventKind[]> = IdpUserArgsMap[K[number]];\n\nexport type IdpUserTrigger<Args> = ParserIdpUserTrigger & {\n __args: Args;\n};\n\ntype IdpUserSingleTriggerOptions = {\n /**\n * IdP namespace name to subscribe to. Required when the project defines\n * multiple IdPs; optional when a single IdP exists. Must match an IdP name\n * declared in `defineConfig({ idp: [...] })`.\n */\n idp?: IdpName;\n};\n\n/**\n * Create a trigger that fires when an IdP user is created.\n * @param options - Trigger options\n * @param options.idp - IdP namespace name to subscribe to\n * @returns IdP user created trigger\n */\nexport function idpUserCreatedTrigger(\n options?: IdpUserSingleTriggerOptions,\n): IdpUserTrigger<IdpUserCreatedArgs> {\n return {\n kind: \"idpUser\",\n events: [\"idp.user.created\"],\n ...(options?.idp != null ? { idp: options.idp } : {}),\n __args: {} as IdpUserCreatedArgs,\n };\n}\n\n/**\n * Create a trigger that fires when an IdP user is updated.\n * @param options - Trigger options\n * @param options.idp - IdP namespace name to subscribe to\n * @returns IdP user updated trigger\n */\nexport function idpUserUpdatedTrigger(\n options?: IdpUserSingleTriggerOptions,\n): IdpUserTrigger<IdpUserUpdatedArgs> {\n return {\n kind: \"idpUser\",\n events: [\"idp.user.updated\"],\n ...(options?.idp != null ? { idp: options.idp } : {}),\n __args: {} as IdpUserUpdatedArgs,\n };\n}\n\n/**\n * Create a trigger that fires when an IdP user is deleted.\n * @param options - Trigger options\n * @param options.idp - IdP namespace name to subscribe to\n * @returns IdP user deleted trigger\n */\nexport function idpUserDeletedTrigger(\n options?: IdpUserSingleTriggerOptions,\n): IdpUserTrigger<IdpUserDeletedArgs> {\n return {\n kind: \"idpUser\",\n events: [\"idp.user.deleted\"],\n ...(options?.idp != null ? { idp: options.idp } : {}),\n __args: {} as IdpUserDeletedArgs,\n };\n}\n\ntype IdpUserTriggerOptions<K extends IdpUserEventKind[]> = {\n events: K;\n /**\n * IdP namespace name to subscribe to. Required when the project defines\n * multiple IdPs; optional when a single IdP exists. Must match an IdP name\n * declared in `defineConfig({ idp: [...] })`.\n */\n idp?: IdpName;\n};\n\n/**\n * Create a trigger that fires on multiple IdP user event types.\n * @template K\n * @param options - Trigger options with events array\n * @param options.events - IdP user event kinds to subscribe to\n * @param options.idp - IdP namespace name to subscribe to\n * @returns IdP user trigger\n */\nexport function idpUserTrigger<const K extends [IdpUserEventKind, ...IdpUserEventKind[]]>(\n options: IdpUserTriggerOptions<K>,\n): IdpUserTrigger<IdpUserMultiArgs<K>> {\n const { events, idp } = options;\n return {\n kind: \"idpUser\",\n events: events.map((k) => idpUserEventMap[k]),\n ...(idp != null ? { idp } : {}),\n __args: {} as IdpUserMultiArgs<K>,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Auth Access Token trigger types and factories\n// ---------------------------------------------------------------------------\n\nconst authAccessTokenEventMap = {\n issued: \"auth.access_token.issued\",\n refreshed: \"auth.access_token.refreshed\",\n revoked: \"auth.access_token.revoked\",\n} as const;\ntype AuthAccessTokenEventMap = typeof authAccessTokenEventMap;\ntype AuthAccessTokenEventKind = keyof AuthAccessTokenEventMap;\n\ntype AuthAccessTokenArgsMap = {\n issued: AuthAccessTokenIssuedArgs;\n refreshed: AuthAccessTokenRefreshedArgs;\n revoked: AuthAccessTokenRevokedArgs;\n};\n\ntype AuthAccessTokenMultiArgs<K extends AuthAccessTokenEventKind[]> =\n AuthAccessTokenArgsMap[K[number]];\n\nexport type AuthAccessTokenTrigger<Args> = ParserAuthAccessTokenTrigger & {\n __args: Args;\n};\n\n/**\n * Create a trigger that fires when an access token is issued.\n * @returns Auth access token issued trigger\n */\nexport function authAccessTokenIssuedTrigger(): AuthAccessTokenTrigger<AuthAccessTokenIssuedArgs> {\n return {\n kind: \"authAccessToken\",\n events: [\"auth.access_token.issued\"],\n __args: {} as AuthAccessTokenIssuedArgs,\n };\n}\n\n/**\n * Create a trigger that fires when an access token is refreshed.\n * @returns Auth access token refreshed trigger\n */\nexport function authAccessTokenRefreshedTrigger(): AuthAccessTokenTrigger<AuthAccessTokenRefreshedArgs> {\n return {\n kind: \"authAccessToken\",\n events: [\"auth.access_token.refreshed\"],\n __args: {} as AuthAccessTokenRefreshedArgs,\n };\n}\n\n/**\n * Create a trigger that fires when an access token is revoked.\n * @returns Auth access token revoked trigger\n */\nexport function authAccessTokenRevokedTrigger(): AuthAccessTokenTrigger<AuthAccessTokenRevokedArgs> {\n return {\n kind: \"authAccessToken\",\n events: [\"auth.access_token.revoked\"],\n __args: {} as AuthAccessTokenRevokedArgs,\n };\n}\n\ntype AuthAccessTokenTriggerOptions<K extends AuthAccessTokenEventKind[]> = {\n events: K;\n};\n\n/**\n * Create a trigger that fires on multiple auth access token event types.\n * @template K\n * @param options - Trigger options with events array\n * @returns Auth access token trigger\n */\nexport function authAccessTokenTrigger<\n const K extends [AuthAccessTokenEventKind, ...AuthAccessTokenEventKind[]],\n>(options: AuthAccessTokenTriggerOptions<K>): AuthAccessTokenTrigger<AuthAccessTokenMultiArgs<K>> {\n const { events } = options;\n return {\n kind: \"authAccessToken\",\n events: events.map((k) => authAccessTokenEventMap[k]),\n __args: {} as AuthAccessTokenMultiArgs<K>,\n };\n}\n","import type { TailorEnv } from \"#/runtime/types\";\nimport type { ScheduleTriggerInput as ParserScheduleTriggerInput } from \"#/types/executor.generated\";\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\ninterface ScheduleTriggerOptions<T extends string> {\n cron: StandardCRON<T> extends never ? never : T;\n timezone?: Timezone;\n}\n\n/**\n * Create a schedule-based trigger using a CRON expression and optional timezone.\n * @template T\n * @param options - Schedule options\n * @returns Schedule trigger\n */\nexport function scheduleTrigger<T extends string>(\n options: ScheduleTriggerOptions<T>,\n): ScheduleTrigger<ScheduleArgs> {\n const { cron, timezone } = options;\n return {\n kind: \"schedule\",\n cron,\n timezone,\n __args: {} as ScheduleArgs,\n };\n}\n","import type { TailorEnv } from \"#/runtime/types\";\nimport type { IncomingWebhookTrigger as ParserIncomingWebhookTrigger } from \"#/types/executor.generated\";\nimport type { JsonValue } from \"#/types/helpers\";\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 interface IncomingWebhookResponseConfig<Args> {\n /**\n * Expression that returns the webhook HTTP response body.\n * Receives the same args as the executor operation.\n */\n body?: (args: Args) => JsonValue;\n /**\n * HTTP status code for the response.\n * If omitted and `body` is set, the platform uses 200.\n */\n statusCode?: number;\n}\n\nexport type IncomingWebhookResponse<Args> =\n | ((args: Args) => JsonValue)\n | IncomingWebhookResponseConfig<Args>;\n\nexport interface IncomingWebhookTriggerOptions<Args> {\n response?: IncomingWebhookResponse<Args>;\n}\n\nexport type IncomingWebhookTrigger<Args> = ParserIncomingWebhookTrigger & {\n __args: Args;\n};\n\n/**\n * Create a trigger for incoming webhook requests.\n * @template T\n * @param options - Optional trigger options including response configuration\n * @returns Incoming webhook trigger\n */\nexport function incomingWebhookTrigger<T extends IncomingWebhookRequest>(\n options?: IncomingWebhookTriggerOptions<IncomingWebhookArgs<T>>,\n): IncomingWebhookTrigger<IncomingWebhookArgs<T>> {\n const response =\n typeof options?.response === \"function\" ? { body: options.response } : options?.response;\n return {\n kind: \"incomingWebhook\",\n ...(response ? { response } : {}),\n __args: {} as IncomingWebhookArgs<T>,\n };\n}\n","import { brandValue } from \"#/utils/brand\";\nimport type {\n ExecutionPolicyConcurrency,\n ExecutionPolicyDefInput,\n ExecutionPolicyGroupOptions,\n ExecutionPolicyInstance,\n ResolvedExecutionPolicyInstance,\n} from \"./execution-policy.types\";\n\nexport type {\n ExecutionPolicyConcurrency,\n ExecutionPolicyDefInput,\n ExecutionPolicyExactInstance,\n ExecutionPolicyGroupOptions,\n ExecutionPolicyInstance,\n ExecutionPolicyWildcardInstance,\n ResolvedExecutionPolicyInstance,\n} from \"./execution-policy.types\";\n\n// Mirrors the non-wildcard branch of ExecutionPolicyKeySchema's grammar\n// (parser/service/workflow/schema.ts). Duplicated, not imported, because\n// configure code must stay zod-free — it ships inside the same runtime\n// bundle as user workflow job functions.\nconst EXECUTION_POLICY_EXACT_KEY_REGEX = /^[a-z0-9][a-z0-9_:.-]{0,62}[a-z0-9]$/;\n\n// Resolves to the literal type of `Def[\"key\"]` when the caller passed an\n// explicit `key`, otherwise to `Fallback`.\ntype ResolveKey<Def, Fallback extends string> = Def extends { key: infer K extends string }\n ? K\n : Fallback;\n\n// Resolves to the literal type of `Def[\"matchType\"]`, defaulting to\n// `\"exact\"`. Always known from `def` directly — never derived from a\n// property name — so it resolves the same way regardless of where `key`\n// comes from.\ntype ResolveMatchType<Def> = Def extends { matchType: infer M extends \"exact\" | \"prefix\" }\n ? M\n : \"exact\";\n\ninterface ExecutionPolicyWithSetters {\n instance: ExecutionPolicyInstance;\n setName: ((name: string) => void) | undefined;\n setKey: ((key: string) => void) | undefined;\n}\n\nfunction createExecutionPolicyInstance(\n initialName: string,\n initialKey: string,\n concurrencyPolicy: ExecutionPolicyConcurrency | undefined,\n matchType: \"exact\" | \"prefix\",\n separator: string,\n allowNameSetter: boolean,\n allowKeySetter: boolean,\n): ExecutionPolicyWithSetters {\n const isPrefix = matchType === \"prefix\";\n const raw: {\n name: string;\n key: string;\n matchType: \"exact\" | \"prefix\";\n concurrencyPolicy?: ExecutionPolicyConcurrency;\n keyFor?: (suffix: string) => string;\n } = {\n name: initialName,\n key: initialKey,\n matchType,\n ...(concurrencyPolicy && { concurrencyPolicy }),\n // Reads raw.key (not the initialKey param) so a property-name-derived\n // key patched in later via setKey is reflected too.\n ...(isPrefix && {\n keyFor: (suffix: string) => {\n const key = `${raw.key}${separator}${suffix}`;\n if (!EXECUTION_POLICY_EXACT_KEY_REGEX.test(key)) {\n throw new Error(\n `Invalid execution policy key \"${key}\" built by keyFor(\"${suffix}\"): must match [a-z0-9_:.-] (2-64 chars; must start and end with [a-z0-9]).`,\n );\n }\n return key;\n },\n }),\n };\n // `raw` always carries `key`, including for prefix policies — it backs\n // keyFor()'s closure — but ExecutionPolicyWildcardInstance omits it from\n // its public type, so this cast can't go directly to the union.\n const instance = brandValue(raw, \"execution-policy\") as unknown as ExecutionPolicyInstance;\n return {\n instance,\n setName: allowNameSetter\n ? (n: string) => {\n raw.name = n;\n }\n : undefined,\n setKey: allowKeySetter\n ? (k: string) => {\n raw.key = k;\n }\n : undefined,\n };\n}\n\n/**\n * Define a single workflow job function execution policy.\n *\n * Use this when declaring a policy outside the\n * {@link defineWorkflowExecutionPolicies} builder — for example, when the\n * runtime key prefix needs to differ from the corresponding workspace-unique\n * name.\n *\n * When `matchType: \"prefix\"` is set, the returned instance has `keyFor(suffix)`\n * instead of a directly-usable `key` (see {@link ExecutionPolicyWildcardInstance}).\n * @param name - Workspace-unique name. Must match `^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$`.\n * @param def - Optional overrides for `key` (defaults to `name`), `matchType`, `separator` (the `keyFor` join character, defaults to `.`), and concurrency\n * @returns An execution policy instance\n * @example\n * export const perTenant = defineWorkflowExecutionPolicy(\"tenant-api\", {\n * matchType: \"prefix\",\n * concurrencyPolicy: { maxConcurrentExecutions: 3 },\n * });\n *\n * perTenant.keyFor(tenantId); // \"tenant-api.<tenantId>\"\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function defineWorkflowExecutionPolicy<\n const N extends string,\n const D extends (Omit<ExecutionPolicyDefInput, \"name\"> & { separator?: string }) | undefined =\n undefined,\n>(name: N, def?: D): ResolvedExecutionPolicyInstance<ResolveKey<D, N>, ResolveMatchType<D>> {\n return createExecutionPolicyInstance(\n name,\n def?.key ?? name,\n def?.concurrencyPolicy,\n def?.matchType ?? \"exact\",\n def?.separator ?? \".\",\n false,\n false,\n ).instance as ResolvedExecutionPolicyInstance<ResolveKey<D, N>, ResolveMatchType<D>>;\n}\n\n/**\n * Define a group of workflow job function execution policies. Property names\n * become the workspace-unique `name` and default `key` verbatim, matching the\n * mental model of {@link defineWaitPoints}. Provide `name` / `key` explicitly\n * to override the property-name default (for example, when the property name\n * is not valid for the execution policy grammar or when the runtime key\n * prefix needs to differ).\n *\n * When `matchType: \"prefix\"` is set, the returned instance has `keyFor(suffix)`\n * instead of a directly-usable `key` (see {@link ExecutionPolicyWildcardInstance}).\n * `matchType` can be combined with an explicit `key`, or left to apply to\n * the property-name-derived prefix.\n *\n * The return type mirrors the builder's return type so JSDoc on each property\n * is preserved in IDE autocompletion.\n * @param builder - Callback that receives a `define` factory and returns a record of policies\n * @param options - Group-wide options; `separator` overrides the `.` `keyFor` uses to join the prefix and suffix for every prefix policy in the group\n * @returns The same object returned by the builder (with `name` / `key` resolved on each instance)\n * @example\n * export const executionPolicies = defineWorkflowExecutionPolicies((define) => ({\n * premium: define({ concurrencyPolicy: { maxConcurrentExecutions: 5 } }),\n * \"tenant-api\": define({\n * matchType: \"prefix\",\n * concurrencyPolicy: { maxConcurrentExecutions: 3 },\n * }),\n * }));\n *\n * // In a workflow job function:\n * await tailor.workflow.startJobFunction(\"worker\", args, {\n * executionPolicyKey: executionPolicies.premium.key,\n * });\n * await tailor.workflow.startJobFunction(\"worker\", args, {\n * executionPolicyKey: executionPolicies[\"tenant-api\"].keyFor(input.tenantId),\n * });\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function defineWorkflowExecutionPolicies<T extends Record<string, ExecutionPolicyInstance>>(\n builder: (\n define: <const D extends ExecutionPolicyDefInput | undefined = undefined>(\n def?: D,\n ) => ResolvedExecutionPolicyInstance<ResolveKey<D, string>, ResolveMatchType<D>>,\n ) => T,\n options?: ExecutionPolicyGroupOptions,\n): T {\n const separator = options?.separator ?? \".\";\n const nameSetters = new Map<ExecutionPolicyInstance, (name: string) => void>();\n const keySetters = new Map<ExecutionPolicyInstance, (key: string) => void>();\n\n const define = <const D extends ExecutionPolicyDefInput | undefined = undefined>(\n def?: D,\n ): ResolvedExecutionPolicyInstance<ResolveKey<D, string>, ResolveMatchType<D>> => {\n const explicitName = def?.name;\n const explicitKey = def?.key;\n const { instance, setName, setKey } = createExecutionPolicyInstance(\n explicitName ?? \"__pending__\",\n explicitKey ?? explicitName ?? \"__pending__\",\n def?.concurrencyPolicy,\n def?.matchType ?? \"exact\",\n separator,\n explicitName === undefined,\n // Only fall back to the property name when neither `name` nor `key`\n // was given — an explicit `name` already resolved `key` above and\n // must not be overwritten by the property name.\n explicitKey === undefined && explicitName === undefined,\n );\n if (setName) nameSetters.set(instance, setName);\n if (setKey) keySetters.set(instance, setKey);\n return instance as ResolvedExecutionPolicyInstance<ResolveKey<D, string>, ResolveMatchType<D>>;\n };\n\n const result = builder(define);\n\n for (const propName of Object.keys(result)) {\n const instance = result[propName] as ExecutionPolicyInstance;\n nameSetters.get(instance)?.(propName);\n keySetters.get(instance)?.(propName);\n }\n\n return result;\n}\n","import { brandValue } from \"#/utils/brand\";\nimport { dispatchStartJob, registerJob, type RegisteredJobBody } from \"./registry\";\nimport { withWorkflowTestInvoker } from \"./test-env-key\";\nimport type { TailorEnv, TailorPrincipal } from \"#/runtime/types\";\nimport type { StartJobFunctionOptions } from \"#/runtime/workflow\";\nimport type { JsonCompatible, TypeLevelError } from \"#/types/helpers\";\n\n/**\n * Context object passed as the second argument to workflow job body functions.\n */\nexport type WorkflowJobContext = {\n env: TailorEnv;\n invoker: TailorPrincipal | null;\n};\n\n/**\n * The body function type for a workflow job.\n * Resolves to the callable signature when `I` / `O` are JsonValue-compatible,\n * or to a type-level error that surfaces at the `body:` property.\n */\ntype JobBody<I, O> = [null] extends [I]\n ? TypeLevelError<\"Input cannot be null at the top level\">\n : [I] extends [undefined]\n ? [O] extends [JsonCompatible<O> | undefined | void]\n ? (input: I, context: WorkflowJobContext) => O | Promise<O>\n : TypeLevelError<\"Output must be JsonValue-compatible (plain objects/arrays; no class instances or functions)\">\n : [undefined] extends [I]\n ? TypeLevelError<\"Input cannot include undefined at the top level\">\n : [I] extends [JsonCompatible<I>]\n ? [O] extends [JsonCompatible<O> | undefined | void]\n ? (input: I, context: WorkflowJobContext) => O | Promise<O>\n : TypeLevelError<\"Output must be JsonValue-compatible (plain objects/arrays; no class instances or functions)\">\n : TypeLevelError<\"Input must be JsonValue-compatible (plain objects/arrays; no class instances or functions)\">;\n\n/**\n * WorkflowJob represents a job that can be started from a workflow.\n *\n * Type constraints:\n * - Input: Must be JsonValue-compatible (plain objects/arrays; no class instances or functions) or undefined.\n * - Output: Must be JsonValue-compatible (plain objects/arrays; no class instances or functions), undefined, or void.\n * - Start returns `Awaited<Output>` as-is (no Promise or Jsonify transformation).\n */\nexport interface WorkflowJob<Name extends string = string, Input = undefined, Output = undefined> {\n name: Name;\n /**\n * Start this job with the given input and return the job's output value.\n * Accepts an optional second argument to pass `executionPolicyKey` for\n * platform-side concurrency enforcement.\n * @example\n * body: async (input) => {\n * const a = jobA.start({ id: input.id });\n * const b = jobB.start({ id: input.id }, {\n * executionPolicyKey: `tenant-api.${input.tenantId}`,\n * });\n * return { a, b };\n * }\n */\n start: [Input] extends [undefined]\n ? (input?: undefined, options?: StartJobFunctionOptions) => Awaited<Output>\n : (input: Input, options?: StartJobFunctionOptions) => Awaited<Output>;\n body: (input: Input, context: WorkflowJobContext) => Output | Promise<Output>;\n}\n\ninterface CreateWorkflowJobConfig<Name extends string, I, O> {\n readonly name: Name;\n readonly body: JobBody<I, O>;\n}\n\n/**\n * Create a workflow job definition.\n *\n * All jobs must be named exports from the workflow file.\n * Job names must be unique across the entire project.\n *\n * Input and output must be JsonValue-compatible (primitives, plain objects, arrays).\n * Functions and objects with a `toJSON` method are rejected at the type level;\n * class instances exposing methods are rejected via the property walk.\n * @param config - Job configuration with name and body function.\n * @param config.name - Unique job name across the project.\n * @param config.body - Function that processes the job input.\n * @returns A WorkflowJob that can be started from other jobs.\n * @example\n * // Simple job with async body:\n * export const fetchData = createWorkflowJob({\n * name: \"fetch-data\",\n * body: async (input: { id: string }) => {\n * const db = getDB(\"tailordb\");\n * return await db.selectFrom(\"Table\").selectAll().where(\"id\", \"=\", input.id).executeTakeFirst();\n * },\n * });\n * @example\n * // Orchestrator job that fans out to other jobs.\n * export const orchestrate = createWorkflowJob({\n * name: \"orchestrate\",\n * body: (input: { orderId: string }) => {\n * const inventory = checkInventory.start({ orderId: input.orderId });\n * const payment = processPayment.start({ orderId: input.orderId });\n * return { inventory, payment };\n * },\n * });\n */\nexport function createWorkflowJob<const Name extends string, I = undefined, O = undefined>(\n config: CreateWorkflowJobConfig<Name, I, O>,\n): WorkflowJob<Name, I, Awaited<O>> {\n const userBody = config.body as (input: I, context: WorkflowJobContext) => O | Promise<O>;\n const body = process.env.__TAILOR_PLATFORM_BUNDLE\n ? userBody\n : (input: I, context: WorkflowJobContext): O | Promise<O> =>\n withWorkflowTestInvoker(context.invoker, () => userBody(input, context));\n\n // Test-only local runner registry; the platform bundle sets the flag so it is DCE'd.\n if (!process.env.__TAILOR_PLATFORM_BUNDLE) {\n registerJob(config.name, body as RegisteredJobBody);\n }\n\n const start = process.env.__TAILOR_PLATFORM_BUNDLE\n ? () => {\n throw new Error(\n \"This workflow job's .start() is rewritten at build time and is unavailable in the bundle\",\n );\n }\n : // Preserve arity: use `arguments.length` (regular function, not arrow) so\n // `.start(args, undefined)` is treated as \"options passed\" — matching\n // the bundler rewrite, which forwards the literal `undefined` from the\n // AST as a third argument. Without this, local execution and bundled\n // workflows would hand mocks different call shapes.\n function start(args?: unknown, options?: StartJobFunctionOptions) {\n // oxlint-disable-next-line prefer-rest-params\n return (\n arguments.length >= 2\n ? dispatchStartJob(config.name, args, options)\n : dispatchStartJob(config.name, args)\n ) as Awaited<O>;\n };\n\n return brandValue(\n { name: config.name, start, body } as WorkflowJob<Name, I, Awaited<O>>,\n \"workflow-job\",\n );\n}\n","import { brandValue } from \"#/utils/brand\";\nimport type { PlatformWorkflowAPI } from \"#/runtime/workflow\";\nimport type { JsonCompatible, TypeLevelError } from \"#/types/helpers\";\n\n/**\n * A single wait point instance with typed `.wait()` and `.resolve()` methods.\n *\n * - `.wait(payload?)` suspends execution until resolved. Returns the result from `.resolve()`.\n * - `.resolve(executionId, callback)` resumes a suspended execution.\n *\n * Both `Payload` and `Result` must be JsonValue-compatible (primitives, plain objects, arrays).\n * Functions and objects with a `toJSON` method are rejected at the type level.\n */\nexport interface WaitPointInstance<Payload = undefined, Result = undefined> {\n wait: [Payload] extends [undefined]\n ? () => Promise<Result>\n : (payload: Payload) => Promise<Result>;\n resolve: (\n executionId: string,\n callback: (\n payload: [Payload] extends [undefined] ? undefined : Payload,\n ) => Result | Promise<Result>,\n ) => Promise<void>;\n}\n\ninterface InternalWaitPointInstance {\n wait: (payload?: unknown) => Promise<unknown>;\n resolve: (\n executionId: string,\n callback: (payload: unknown) => unknown | Promise<unknown>,\n ) => Promise<void>;\n}\n\ninterface WaitPointWithSetter {\n instance: InternalWaitPointInstance;\n setKey: (key: string) => void;\n}\n\nfunction getPlatformWorkflow() {\n const platform = globalThis as { tailor?: { workflow?: PlatformWorkflowAPI } };\n const workflow = platform.tailor?.workflow;\n if (!workflow) {\n throw new Error(\n \"tailor.workflow is not available. Run tests in the `tailor-runtime` Vitest environment, \" +\n \"or acquire mockWorkflow() from @tailor-platform/sdk/vitest and set a wait/resolve handler.\",\n );\n }\n return workflow;\n}\n\n/**\n * Create a WaitPointInstance that delegates to the platform runtime.\n * Use `mockWorkflow` from `@tailor-platform/sdk/vitest` to mock\n * `globalThis.tailor.workflow.wait/resolve` in tests.\n * @param initialKey - Initial key (can be updated via the returned setter)\n * @returns The instance and a setter to update the key after construction\n */\nfunction createWaitPointInstance(initialKey: string): WaitPointWithSetter {\n let key = initialKey;\n\n const instance = brandValue(\n {\n wait(payload?: unknown) {\n return Promise.resolve(getPlatformWorkflow().wait(key, payload));\n },\n async resolve(executionId: string, callback: (p: unknown) => unknown | Promise<unknown>) {\n await getPlatformWorkflow().resolve(executionId, key, callback);\n },\n },\n \"wait-point\",\n ) as InternalWaitPointInstance;\n\n return {\n instance,\n setKey: (k: string) => {\n key = k;\n },\n };\n}\n\n/**\n * The type produced by `define<Payload, Result>()` / `createWaitPoint<Payload, Result>(key)`.\n * Resolves to `WaitPointInstance<Payload, Result>` when both types are JsonValue-compatible,\n * or to a type-level error that surfaces at the call site.\n */\ntype WaitPointDef<Payload, Result> = [null] extends [Payload]\n ? TypeLevelError<\"Payload cannot be null at the top level\">\n : [undefined] extends [Result]\n ? TypeLevelError<\"Result cannot be (or include) undefined (resolve callback must return a value)\">\n : [Payload] extends [undefined]\n ? [Result] extends [JsonCompatible<Result>]\n ? WaitPointInstance<Payload, Result>\n : TypeLevelError<\"Result must be JsonValue-compatible (plain objects/arrays; no class instances or functions)\">\n : [undefined] extends [Payload]\n ? TypeLevelError<\"Payload cannot include undefined at the top level\">\n : [Payload] extends [JsonCompatible<Payload>]\n ? [Result] extends [JsonCompatible<Result>]\n ? WaitPointInstance<Payload, Result>\n : TypeLevelError<\"Result must be JsonValue-compatible (plain objects/arrays; no class instances or functions)\">\n : TypeLevelError<\"Payload must be JsonValue-compatible (plain objects/arrays; no class instances or functions)\">;\n\n/**\n * The `define` function passed to the `createWaitPoints` builder callback.\n * Returns an actual WaitPointInstance (not a phantom marker) so that the\n * builder's return type can flow through as-is, preserving JSDoc comments\n * on each property for IDE autocompletion.\n *\n * JSON validation is encoded in the return type rather than in type-parameter\n * constraints, because tsgo rejects self-referential constraints like\n * `Payload extends JsonCompatible<Payload>` as circular.\n */\ntype DefineFn = <Payload = undefined, Result = undefined>() => WaitPointDef<Payload, Result>;\n\n/**\n * Create a single typed wait point with an explicit key.\n *\n * `Payload` and `Result` must be JsonValue-compatible.\n * Functions and objects with a `toJSON` method are rejected at the type level;\n * class instances exposing methods are rejected via the property walk.\n * @param key - The wait point key used to match wait and resolve calls\n * @returns A WaitPointInstance with typed `.wait()` and `.resolve()` methods\n * @example\n * export const approval = createWaitPoint<{ message: string }, { approved: boolean }>(\"approval\");\n *\n * await approval.wait({ message: \"Please approve\" });\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function createWaitPoint<Payload = undefined, Result = undefined>(\n key: string,\n): WaitPointDef<Payload, Result> {\n return createWaitPointInstance(key).instance as unknown as WaitPointDef<Payload, Result>;\n}\n\n/**\n * Create a group of typed wait points for human-in-the-loop workflows.\n * Property names become the wait point keys.\n *\n * The return type is the same as the builder's return type, so JSDoc on each\n * property is preserved and visible in IDE autocompletion.\n *\n * `Payload` and `Result` must be JsonValue-compatible.\n * Functions and objects with a `toJSON` method are rejected at the type level;\n * class instances exposing methods are rejected via the property walk.\n * @param builder - Callback that receives a `define` factory and returns an object of wait points\n * @returns The same object returned by the builder (with correct keys set on each instance)\n * @example\n * export const waitPoints = createWaitPoints(define => ({\n * // Preceding JSDoc on this property is shown in IDE autocompletion\n * approval: define<{ message: string }, { approved: boolean }>(),\n * }));\n *\n * // IDE shows the JSDoc when typing `waitPoints.`\n * await waitPoints.approval.wait({ message: \"Please approve\" });\n *\n * // For 2-level access, use destructured export with JSDoc attached to the export itself.\n */\n/* @__NO_SIDE_EFFECTS__ */\n// oxlint-disable-next-line no-explicit-any\nexport function createWaitPoints<T extends Record<string, WaitPointInstance<any, any>>>(\n builder: (define: DefineFn) => T,\n): T {\n const setters = new Map<InternalWaitPointInstance, (key: string) => void>();\n\n const define = (<Payload, Result>() => {\n const { instance, setKey } = createWaitPointInstance(\"__pending__\");\n setters.set(instance, setKey);\n return instance as unknown as WaitPointDef<Payload, Result>;\n }) as DefineFn;\n\n const result = builder(define);\n\n // Set the correct key on each instance based on the property name\n for (const key of Object.keys(result)) {\n const setter = setters.get(result[key] as unknown as InternalWaitPointInstance);\n setter?.(key);\n }\n\n return result;\n}\n","/* oxlint-disable typescript/no-explicit-any */\nimport { brandValue } from \"#/utils/brand\";\nimport { dispatchStartWorkflow } from \"./registry\";\nimport type { MachineUserName } from \"#/configure/types/machine-user\";\nimport type { ConcurrencyPolicy, RetryPolicy } from \"#/types/workflow.generated\";\nimport type { WorkflowJob } from \"./job\";\n\nexport type { ConcurrencyPolicy, RetryPolicy };\n\nexport interface WorkflowConfig<\n Job extends WorkflowJob<any, any, any> = WorkflowJob<any, any, any>,\n> {\n name: string;\n mainJob: Job;\n retryPolicy?: RetryPolicy;\n concurrencyPolicy?: ConcurrencyPolicy;\n}\n\nexport interface Workflow<Job extends WorkflowJob<any, any, any> = WorkflowJob<any, any, any>> {\n name: string;\n mainJob: Job;\n retryPolicy?: RetryPolicy;\n concurrencyPolicy?: ConcurrencyPolicy;\n start: [Parameters<Job[\"start\"]>[0]] extends [undefined]\n ? (args?: undefined, options?: { invoker: MachineUserName }) => Promise<string>\n : (\n args: Parameters<Job[\"start\"]>[0],\n options?: { invoker: MachineUserName },\n ) => Promise<string>;\n}\n\ninterface WorkflowDefinition<Job extends WorkflowJob<any, any, any>> {\n name: string;\n mainJob: Job;\n retryPolicy?: RetryPolicy;\n concurrencyPolicy?: ConcurrencyPolicy;\n}\n\n/**\n * Create a workflow definition that can be started via the Tailor SDK.\n * In production, the bundler rewrites `.start()` calls into direct platform workflow calls.\n *\n * The workflow MUST be the default export of the file.\n * All jobs referenced by the workflow MUST be named exports.\n * @template Job\n * @param config - Workflow configuration\n * @returns Defined workflow\n * @example\n * export const fetchData = createWorkflowJob({ name: \"fetch-data\", body: async (input: { id: string }) => ({ id: input.id }) });\n * export const processData = createWorkflowJob({\n * name: \"process-data\",\n * body: (input: { id: string }) => {\n * const data = fetchData.start({ id: input.id });\n * return { data };\n * },\n * });\n *\n * // Workflow must be default export; mainJob is the entry point\n * export default createWorkflow({\n * name: \"data-processing\",\n * mainJob: processData,\n * });\n */\nexport function createWorkflow<Job extends WorkflowJob<any, any, any>>(\n config: WorkflowDefinition<Job>,\n): Workflow<Job> {\n return brandValue(\n {\n ...config,\n start: process.env.__TAILOR_PLATFORM_BUNDLE\n ? async () => {\n throw new Error(\n \"workflow.start() is rewritten at build time and unavailable in the bundle\",\n );\n }\n : // Preserve arity: use `arguments.length` (regular function, not arrow) so\n // `.start(args, undefined)` is treated as \"options passed\" — matching\n // the bundler rewrite, which forwards the literal `undefined` from the\n // AST as a third argument. Without this, local execution and bundled\n // workflows would hand mocks different call shapes.\n async function start(\n args: Parameters<Job[\"start\"]>[0],\n options?: { invoker: MachineUserName },\n ) {\n // oxlint-disable-next-line prefer-rest-params\n return arguments.length >= 2\n ? await dispatchStartWorkflow(config.name, args, options)\n : await dispatchStartWorkflow(config.name, args);\n },\n } as Workflow<Job>,\n \"workflow\",\n );\n}\n","import type { StaticWebsiteDefinitionBrand } from \"#/configure/services/staticwebsite/types\";\nimport type { StaticWebsiteInput } from \"#/types/staticwebsite.generated\";\nexport type { StaticWebsiteConfig } from \"#/configure/services/staticwebsite/types\";\n\n/**\n * Define a static website configuration for the Tailor SDK.\n * @param name - Static website name\n * @param config - Static website configuration\n * @returns Defined static website\n */\n/* @__NO_SIDE_EFFECTS__ */\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","import type { AIGatewayInput } from \"#/types/aigateway.generated\";\nimport type { AIGatewayDefinitionBrand } from \"./types\";\nexport type { AIGatewayConfig } from \"./types\";\n\n/**\n * Define an AI Gateway configuration for the Tailor SDK.\n * @param name - AI Gateway name\n * @param config - AI Gateway configuration\n * @returns Defined AI Gateway\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function defineAIGateway(name: string, config: Omit<AIGatewayInput, \"name\">) {\n const result = {\n ...config,\n name,\n } as const satisfies AIGatewayInput;\n\n return result as typeof result & AIGatewayDefinitionBrand;\n}\n","import type { IdPUserField } from \"#/parser/service/idp/types\";\nimport type { InferredAttributes } from \"#/runtime/types\";\n\ntype EqualityOperator = \"=\" | \"!=\";\ntype ContainsOperator = \"in\" | \"not in\";\n\ntype StringFieldKeys<User extends object> = {\n [K in keyof User]: User[K] extends string ? K : never;\n}[keyof User];\n\ntype StringArrayFieldKeys<User extends object> = {\n [K in keyof User]: User[K] extends string[] ? K : never;\n}[keyof User];\n\ntype BooleanFieldKeys<User extends object> = {\n [K in keyof User]: User[K] extends boolean ? K : never;\n}[keyof User];\n\ntype BooleanArrayFieldKeys<User extends object> = {\n [K in keyof User]: User[K] extends boolean[] ? K : never;\n}[keyof User];\n\ntype UserStringOperand<User extends object = InferredAttributes> = {\n user: StringFieldKeys<User> | \"id\";\n};\n\ntype UserStringArrayOperand<User extends object = InferredAttributes> = {\n user: StringArrayFieldKeys<User>;\n};\n\ntype UserBooleanOperand<User extends object = InferredAttributes> = {\n user: BooleanFieldKeys<User> | \"_loggedIn\";\n};\n\ntype UserBooleanArrayOperand<User extends object = InferredAttributes> = {\n user: BooleanArrayFieldKeys<User>;\n};\n\ntype IdPUserOperand<Update extends boolean = false> = Update extends true\n ? { oldIdpUser: IdPUserField } | { newIdpUser: IdPUserField }\n : { idpUser: IdPUserField };\n\ntype StringEqualityCondition<User extends object, Update extends boolean> =\n | readonly [string, EqualityOperator, string]\n | readonly [UserStringOperand<User>, EqualityOperator, string]\n | readonly [string, EqualityOperator, UserStringOperand<User>]\n | readonly [\n IdPUserOperand<Update>,\n EqualityOperator,\n string | UserStringOperand<User> | IdPUserOperand<Update>,\n ]\n | readonly [string | UserStringOperand<User>, EqualityOperator, IdPUserOperand<Update>];\n\ntype BooleanEqualityCondition<User extends object, Update extends boolean> =\n | readonly [boolean, EqualityOperator, boolean]\n | readonly [UserBooleanOperand<User>, EqualityOperator, boolean]\n | readonly [boolean, EqualityOperator, UserBooleanOperand<User>]\n | readonly [\n IdPUserOperand<Update>,\n EqualityOperator,\n boolean | UserBooleanOperand<User> | IdPUserOperand<Update>,\n ]\n | readonly [boolean | UserBooleanOperand<User>, EqualityOperator, IdPUserOperand<Update>];\n\ntype EqualityCondition<\n User extends object = InferredAttributes,\n Update extends boolean = boolean,\n> = StringEqualityCondition<User, Update> | BooleanEqualityCondition<User, Update>;\n\ntype StringContainsCondition<User extends object, Update extends boolean> =\n | readonly [string, ContainsOperator, string[]]\n | readonly [UserStringOperand<User>, ContainsOperator, string[]]\n | readonly [string, ContainsOperator, UserStringArrayOperand<User>]\n | readonly [IdPUserOperand<Update>, ContainsOperator, string[] | UserStringArrayOperand<User>];\n\ntype BooleanContainsCondition<User extends object, Update extends boolean> =\n | readonly [boolean, ContainsOperator, boolean[]]\n | readonly [UserBooleanOperand<User>, ContainsOperator, boolean[]]\n | readonly [boolean, ContainsOperator, UserBooleanArrayOperand<User>]\n | readonly [IdPUserOperand<Update>, ContainsOperator, boolean[] | UserBooleanArrayOperand<User>];\n\ntype ContainsCondition<\n User extends object = InferredAttributes,\n Update extends boolean = boolean,\n> = StringContainsCondition<User, Update> | BooleanContainsCondition<User, Update>;\n\nexport type IdPPermissionCondition<\n User extends object = InferredAttributes,\n Update extends boolean = boolean,\n> = EqualityCondition<User, Update> | ContainsCondition<User, Update>;\n\ntype IdPActionPermission<\n User extends object = InferredAttributes,\n Update extends boolean = boolean,\n> =\n | {\n conditions:\n | IdPPermissionCondition<User, Update>\n | readonly IdPPermissionCondition<User, Update>[];\n description?: string | undefined;\n /**\n * Whether matching users are granted (`true`) or denied (`false`).\n * Omitting `permit` in this object form defaults to `deny` and emits a\n * warning; set it explicitly. (The array shorthand defaults to `allow`.)\n */\n permit?: boolean;\n }\n | readonly [...IdPPermissionCondition<User, Update>, ...([] | [boolean])]\n | readonly [...IdPPermissionCondition<User, Update>[], ...([] | [boolean])];\n\n/**\n * Per-operation permission policies for an IdP service.\n * Defines create, read, update, delete, sendPasswordResetEmail, and\n * unenrollMfa permissions.\n *\n * For update operations, use `newIdpUser`/`oldIdpUser` operands instead of `idpUser`.\n * @example\n * const permission: IdPPermission = {\n * create: [{ conditions: [[{ user: \"role\" }, \"=\", \"ADMIN\"]], permit: true }],\n * read: [{ conditions: [[{ user: \"_loggedIn\" }, \"=\", true]], permit: true }],\n * update: [{ conditions: [[{ newIdpUser: \"name\" }, \"=\", { user: \"id\" }]], permit: true }],\n * delete: [{ conditions: [[{ user: \"role\" }, \"=\", \"ADMIN\"]], permit: true }],\n * sendPasswordResetEmail: [{ conditions: [], permit: true }],\n * unenrollMfa: [{ conditions: [[{ user: \"role\" }, \"=\", \"ADMIN\"]], permit: true }],\n * };\n */\nexport type IdPPermission<User extends object = InferredAttributes> = {\n create: readonly IdPActionPermission<User, false>[];\n read: readonly IdPActionPermission<User, false>[];\n update: readonly IdPActionPermission<User, true>[];\n delete: readonly IdPActionPermission<User, false>[];\n sendPasswordResetEmail?: readonly IdPActionPermission<User, false>[];\n unenrollMfa?: readonly IdPActionPermission<User, false>[];\n};\n\n/**\n * Grants full IdP permission 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 unsafeAllowAllIdPPermission: IdPPermission = {\n create: [{ conditions: [], permit: true }],\n read: [{ conditions: [], permit: true }],\n update: [{ conditions: [], permit: true }],\n delete: [{ conditions: [], permit: true }],\n sendPasswordResetEmail: [{ conditions: [], permit: true }],\n unenrollMfa: [{ conditions: [], permit: true }],\n};\n","import type { IdpDefinitionBrand } from \"#/configure/services/idp/types\";\nimport type { BuiltinIdP } from \"#/types/auth.generated\";\nimport type { IdPInput } from \"#/types/idp.generated\";\nimport type { IdPPermission } from \"./permission\";\n\nexport type {\n IdPEmailConfig,\n IdPGqlOperations,\n IdPGqlOperationsInput as IdPGqlOperationsConfig,\n} from \"#/types/idp.generated\";\n\n/**\n * Define an IdP service configuration for the Tailor SDK.\n * @template TClients\n * @param name - IdP service name\n * @param config - IdP configuration\n * @returns Defined IdP service\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function defineIdp<const TClients extends string[]>(\n name: string,\n config: Omit<IdPInput, \"name\" | \"clients\" | \"permission\"> & {\n clients: TClients;\n permission?: IdPPermission;\n },\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 { IdPConfig, IdPExternalConfig } from \"#/configure/services/idp/types\";\n\nexport type { IdPPermission, IdPPermissionCondition } from \"./permission\";\nexport { unsafeAllowAllIdPPermission } from \"./permission\";\n","import type { SecretsDefinitionBrand } from \"#/configure/services/secrets/types\";\nexport type { SecretsConfig } from \"#/configure/services/secrets/types\";\n\ntype SecretsVaultInput = Record<string, string>;\ntype SecretsVaultInputNullish = Record<string, string | undefined | null>;\ntype SecretsInput = Record<string, SecretsVaultInput>;\ntype SecretsInputNullish = Record<string, SecretsVaultInputNullish>;\n\ntype SecretsOptions = {\n readonly ignoreNullishValues: boolean;\n};\n\ntype DefinedSecrets<T extends SecretsInputNullish> = {\n readonly vaults: T;\n readonly options: SecretsOptions;\n get<V extends Extract<keyof T, string>, S extends Extract<keyof T[V], string>>(\n vault: V,\n secret: S,\n ): Promise<string | undefined>;\n getAll<V extends Extract<keyof T, string>, S extends Extract<keyof T[V], string>>(\n vault: V,\n secrets: readonly S[],\n ): Promise<(string | undefined)[]>;\n} & SecretsDefinitionBrand;\n\n/**\n * Define secrets configuration for the Tailor SDK.\n * Each key is a vault name, and its value is a record of secret name to secret value.\n * @param config - Secrets configuration mapping vault names to their secrets\n * @returns Defined secrets with typed runtime access methods\n */\nexport function defineSecretManager<const T extends SecretsInput>(config: T): DefinedSecrets<T>;\n/**\n * Define secrets configuration for the Tailor SDK with ignoreNullishValues option.\n * When `ignoreNullishValues` is true, secrets with nullish values are skipped during deploy\n * instead of causing an error. This is useful for CI environments where not all\n * secret values are available.\n * @param config - Secrets configuration mapping vault names to their secrets\n * @param options - Options for secret management behavior\n * @param options.ignoreNullishValues - When true, secrets with nullish values are skipped during deploy\n * @returns Defined secrets with typed runtime access methods\n */\nexport function defineSecretManager<const T extends SecretsInputNullish>(\n config: T,\n options: { ignoreNullishValues: true },\n): DefinedSecrets<T>;\n/* @__NO_SIDE_EFFECTS__ */\nexport function defineSecretManager<const T extends SecretsInputNullish>(\n config: T,\n options?: { ignoreNullishValues?: boolean },\n): DefinedSecrets<T> {\n const result: Record<string, unknown> = {\n vaults: config,\n options: { ignoreNullishValues: options?.ignoreNullishValues ?? false },\n };\n\n // Non-enumerable so Zod's z.object validation ignores them\n Object.defineProperty(result, \"get\", {\n value: async (vault: string, secret: string) => {\n return tailor.secretmanager.getSecret(vault, secret);\n },\n enumerable: false,\n });\n Object.defineProperty(result, \"getAll\", {\n value: async (vault: string, secrets: readonly string[]) => {\n const record = await tailor.secretmanager.getSecrets(vault, secrets);\n return secrets.map((s) => record[s]);\n },\n enumerable: false,\n });\n\n return result as DefinedSecrets<T>;\n}\n","import { brandValue } from \"#/utils/brand\";\nimport type { HttpAdapterConfigInput } from \"#/types/http-adapter.generated\";\nimport type { DocumentNode } from \"graphql\";\n\n/**\n * Lowercase HTTP method keys accepted in `input`, derived from the config\n * schema via the generated type so they cannot drift.\n */\ntype HttpMethodKey = keyof Required<HttpAdapterConfigInput[\"input\"]>;\n\n/** Incoming HTTP request passed to an `input` handler. */\nexport type HttpAdapterRequest = {\n method: Uppercase<HttpMethodKey>;\n path: string;\n headers: Record<string, string>;\n query: Record<string, string>;\n body: string;\n};\n\n/** GraphQL request returned by an `input` handler. */\nexport type HttpAdapterGraphQLRequest<Query extends HttpAdapterGraphQLQuery = string> = {\n query: Query;\n operationName?: string;\n} & HttpAdapterGraphQLRequestVariables<Query>;\n\n/**\n * Typed GraphQL document accepted by an HTTP adapter input handler.\n * Compatible with generated `TypedDocumentNode` values.\n */\nexport type HttpAdapterTypedDocumentNode<\n TResult = unknown,\n TVariables = Record<string, unknown>,\n> = DocumentNode & {\n __apiType?: (variables: TVariables) => TResult;\n __ensureTypesOfVariablesAndResultMatching?: (variables: TVariables) => TResult;\n};\n\n/** GraphQL query value accepted by an HTTP adapter input handler. */\nexport type HttpAdapterGraphQLQuery = string | DocumentNode;\n\ntype HttpAdapterGraphQLData<Query> =\n Query extends HttpAdapterTypedDocumentNode<infer Result, infer _Variables> ? Result : unknown;\n\ntype HttpAdapterGraphQLVariables<Query> =\n Query extends HttpAdapterTypedDocumentNode<infer _Result, infer Variables>\n ? Variables\n : Record<string, unknown>;\n\ntype HttpAdapterHasRequiredVariables<T> = [T] extends [never]\n ? false\n : T extends object\n ? Record<never, never> extends T\n ? false\n : true\n : false;\n\ntype HttpAdapterGraphQLRequestVariables<Query> =\n true extends HttpAdapterHasRequiredVariables<HttpAdapterGraphQLVariables<Query>>\n ? { variables: HttpAdapterGraphQLVariables<Query> }\n : { variables?: HttpAdapterGraphQLVariables<Query> };\n\n/**\n * Converts an incoming HTTP request into a GraphQL request.\n * Pass a typed document type as `Query` when annotating extracted handlers.\n */\nexport type HttpAdapterInputFn<Query extends HttpAdapterGraphQLQuery = string> = (\n req: HttpAdapterRequest,\n) => HttpAdapterGraphQLRequest<Query>;\n\n/** GraphQL execution result passed to the `output` handler. */\nexport type HttpAdapterGraphQLResponse<Data = unknown> = {\n data?: Data | null;\n errors?: unknown;\n extensions?: unknown;\n};\n\n/** HTTP response returned by the `output` handler. */\nexport type HttpAdapterResponse = {\n statusCode?: number;\n headers?: Record<string, string>;\n body: string;\n};\n\n/** Converts a GraphQL response into an HTTP response. */\nexport type HttpAdapterOutputFn<Data = unknown> = (\n resp: HttpAdapterGraphQLResponse<Data>,\n) => HttpAdapterResponse;\n\n/**\n * Per-method input handlers. At least one method must be provided.\n * Each handler transforms an HTTP request into a GraphQL request.\n */\nexport type HttpAdapterInput = Partial<\n Record<HttpMethodKey, HttpAdapterInputFn<HttpAdapterGraphQLQuery>>\n>;\n\ntype HttpAdapterInputHandlerData<Handler> = Handler extends (\n req: HttpAdapterRequest,\n) => infer Request\n ? Request extends { query: infer Query }\n ? HttpAdapterGraphQLData<Query>\n : unknown\n : never;\n\ntype HttpAdapterInputData<Input extends HttpAdapterInput> = [\n HttpAdapterInputHandlerData<Input[keyof Input]>,\n] extends [never]\n ? unknown\n : HttpAdapterInputHandlerData<Input[keyof Input]>;\n\ntype HttpAdapterValidatedRequest<Request> = Request extends {\n query: infer Query extends HttpAdapterGraphQLQuery;\n}\n ? Request & HttpAdapterGraphQLRequest<Query>\n : never;\n\ntype HttpAdapterValidatedInput<Input extends HttpAdapterInput> = {\n [Method in keyof Input]: Input[Method] extends (req: HttpAdapterRequest) => infer Request\n ? (req: HttpAdapterRequest) => HttpAdapterValidatedRequest<Request>\n : Input[Method];\n};\n\n/**\n * HTTP adapter configuration accepted by `createHttpAdapter` with typed\n * `input` and `output` signatures.\n */\n// Internally, the parser-side representation is the looser `HttpAdapterConfig`\n// from `@/types/http-adapter.generated`, where the function fields are typed\n// as `Function`.\nexport type HttpAdapter<Input extends HttpAdapterInput = HttpAdapterInput> = Omit<\n HttpAdapterConfigInput,\n \"input\" | \"output\"\n> & {\n input: Input & HttpAdapterValidatedInput<Input>;\n output?: HttpAdapterOutputFn<HttpAdapterInputData<Input>>;\n};\n\n/**\n * Defines an HTTP adapter that translates HTTP requests to GraphQL queries\n * and shapes the GraphQL response back into an HTTP response.\n *\n * The adapter MUST be the default export of its file.\n * Files are discovered via the `httpAdapter.files` glob in `defineConfig()`.\n *\n * `input` is an object keyed by lowercase HTTP method (`get`, `post`, `put`,\n * `patch`, `delete`). Each handler can return a GraphQL query string or a\n * typed document node. At least one method must be declared; the methods the\n * adapter serves are derived from these keys.\n *\n * `output` is optional and shared across all methods. If `input` returns typed\n * document nodes, `output` receives the corresponding result type as\n * `resp.data`. If you need different response shapes per method, discriminate\n * inside `output` based on the GraphQL response shape.\n *\n * Each handler runs server-side and must be synchronous: Node APIs, `fetch`,\n * `async`/`await`, Promises, and top-level `await` are not available.\n *\n * Optional fields: `enabled` (default `true`; set `false` to deploy the adapter\n * without serving it) and `priority` (non-negative integer, default `0`; when\n * multiple adapters match the same request path, the lowest value wins).\n * @param config - HTTP adapter configuration\n * @returns Branded HTTP adapter definition\n * @example\n * export default createHttpAdapter({\n * name: \"get-user\",\n * pathPattern: \"/users/*\",\n * input: {\n * get: (req) => ({\n * query: `query($id: ID!) { user(id: $id) { id name } }`,\n * variables: { id: req.path.split(\"/\")[2] },\n * }),\n * },\n * output: (resp) => ({\n * statusCode: 200,\n * headers: { \"content-type\": \"application/json\" },\n * body: JSON.stringify(resp.data),\n * }),\n * });\n */\nexport function createHttpAdapter<const Input extends HttpAdapterInput>(\n config: HttpAdapter<Input>,\n): HttpAdapter<Input> {\n return brandValue({ ...config }, \"http-adapter\");\n}\n","import type { AppConfig } from \"#/configure/config/types\";\nimport type { Plugin } from \"#/plugin/types\";\n\n/**\n * Define a Tailor SDK application configuration with shallow exactness.\n * @template Config\n * @param config - Application configuration\n * @returns The same configuration object\n */\n/* @__NO_SIDE_EFFECTS__ */\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\n/**\n * Define plugins to be used with the Tailor SDK.\n * Plugins can generate additional types, resolvers, and executors\n * based on existing TailorDB types.\n * @param configs - Plugin configurations\n * @returns Plugin configurations as given\n */\n/* @__NO_SIDE_EFFECTS__ */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function definePlugins(...configs: Plugin<any, any>[]) {\n return configs;\n}\n","import { t as _t } from \"#/configure/types/index\";\nimport type * as helperTypes from \"#/types/helpers\";\n\ntype TailorOutput<T> = helperTypes.output<T>;\n\nexport type infer<T> = TailorOutput<T>;\nexport type output<T> = TailorOutput<T>;\n\n/** TailorDB field type builders. */\n// eslint-disable-next-line import-x/export\nexport const t = _t;\n// eslint-disable-next-line @typescript-eslint/no-namespace, import-x/export\nexport namespace t {\n export type output<T> = TailorOutput<T>;\n export type infer<T> = TailorOutput<T>;\n}\n\nexport { type TailorField } from \"#/configure/types/type\";\nexport {\n type TailorPrincipal,\n type Attributes,\n type AttributeList,\n type Env,\n} from \"#/runtime/types\";\nexport { type MachineUserNameRegistry, type MachineUserName } from \"#/configure/types/machine-user\";\nexport { type IdpNameRegistry, type IdpName } from \"#/configure/types/idp-name\";\nexport {\n type ConnectionNameRegistry,\n type ConnectionName,\n} from \"#/configure/types/connection-name\";\nexport { type AIGatewayNameRegistry, type AIGatewayName } from \"#/configure/types/aigateway-name\";\n\nexport * from \"#/configure/services/index\";\n\nexport { defineConfig, definePlugins } from \"#/configure/config/index\";\n\n// Plugin types for custom plugin development\nexport type {\n Plugin,\n PluginConfigs,\n PluginOutput,\n TypePluginOutput,\n NamespacePluginOutput,\n PluginProcessContext,\n PluginNamespaceProcessContext,\n PluginAttachment,\n PluginGeneratedType,\n PluginGeneratedResolver,\n PluginGeneratedExecutor,\n PluginGeneratedExecutorWithFile,\n PluginExecutorContext,\n PluginExecutorContextBase,\n TailorDBTypeForPlugin,\n} from \"#/plugin/types\";\n\n// Generation-time hook context types for plugin development\nexport type {\n TailorDBReadyContext,\n ResolverReadyContext,\n ExecutorReadyContext,\n TailorDBNamespaceData,\n ResolverNamespaceData,\n GeneratorResult,\n} from \"#/plugin/types\";\n"],"mappings":";;;;;;AAqKA,SAAS,kBAKP,MACA,SACA,QACA,QACA,UACQ;CAMR,MAAM,YAA2B,WAC7B;EACE,GAAG;EACH,GAAI,SAAS,iBAAiB,EAC5B,eAAe,SAAS,cAAc,KAAK,OAAO,EAAE,GAAG,EAAE,EAAE,EAC7D;EACA,GAAI,SAAS,YAAY,EACvB,UAAU,SAAS,SAAS,KAAK,MAAO,MAAM,QAAQ,CAAC,IAAK,CAAC,GAAG,CAAC,IAAiB,CAAE,EACtF;CACF,IACA,EAAE,UAAU,KAAK;CAErB,IAAI,CAAC,UAAU;EACb,IAAI,SAAS;GACX,IAAI,QAAQ,aAAa,MACvB,UAAU,WAAW;GAEvB,IAAI,QAAQ,UAAU,MACpB,UAAU,QAAQ;EAEtB;EACA,IAAI,QACF,UAAU,gBAAgB,iBAAiB,MAAM;CAErD;CAEA,SAASA,gBACP,MAC4D;EAC5D,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CAChB,OAAO;AACT;;;;;;;;;AAWA,SAAgB,cAAc,GAAG,SAA6B;CAC5D,OAAO;AACT;;;;;ACnBA,MAAa,IAAIC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["parseInternal","parseFieldInternal","t","t","platform","_t"],"sources":["../../src/configure/types/type.ts","../../src/configure/services/auth/index.ts","../../src/configure/services/tailordb/permission.ts","../../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/execution-policy.ts","../../src/configure/services/workflow/job.ts","../../src/configure/services/workflow/wait-point.ts","../../src/configure/services/workflow/workflow.ts","../../src/configure/services/staticwebsite/index.ts","../../src/configure/services/aigateway/index.ts","../../src/configure/services/idp/permission.ts","../../src/configure/services/idp/index.ts","../../src/configure/services/secrets/index.ts","../../src/configure/services/http-adapter/http-adapter.ts","../../src/configure/config/index.ts","../../src/configure/index.ts"],"sourcesContent":["import {\n parseInternal as parseFieldInternal,\n type FieldParseArgs,\n type FieldParseInternalArgs,\n} from \"#/runtime/field-parse\";\nimport { type AllowedValues, type AllowedValuesOutput, mapAllowedValues } from \"./field\";\nimport type {\n DefinedFieldMetadata,\n TailorFieldType,\n TailorToTs,\n FieldMetadata,\n FieldOptions,\n FieldOutput,\n TailorField as TailorFieldBase,\n FieldValidateInput,\n} from \"#/configure/types/field.types\";\nimport type { InferFieldsOutput, Prettify, TypeLevelError, output } from \"#/types/helpers\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\n// Erased fields stay assignable across builder method-state changes.\n// oxlint-disable-next-line no-explicit-any\ntype AnyBuilderMethod = any;\n\nexport type TailorAnyField = Omit<\n TailorFieldBase<AnyBuilderMethod, AnyBuilderMethod, FieldMetadata, TailorFieldType>,\n \"fields\"\n> & {\n readonly fields: Record<string, AnyBuilderMethod>;\n _metadata: FieldMetadata;\n description: AnyBuilderMethod;\n typeName: AnyBuilderMethod;\n validate: AnyBuilderMethod;\n parse: AnyBuilderMethod;\n};\n\ntype IsAny<T> = 0 extends 1 & T ? true : false;\ntype WithFieldDescription<Defined> = Defined & { description: true };\ntype WithFieldTypeName<Defined> = Defined & { typeName: true };\ntype WithFieldValidate<Defined> = Defined & { validate: true };\ntype FieldDescriptionFn<Defined extends DefinedFieldMetadata, Output> = (\n description: string,\n) => TailorField<WithFieldDescription<Defined>, Output>;\ntype FieldTypeNameFn<Defined extends DefinedFieldMetadata, Output> = (\n typeName: string,\n) => TailorField<WithFieldTypeName<Defined>, Output>;\ntype FieldValidateFn<Defined extends DefinedFieldMetadata, Output> = (\n ...validate: FieldValidateInput<Output>[]\n) => TailorField<WithFieldValidate<Defined>, Output>;\ntype FieldDescriptionMethod<Defined extends DefinedFieldMetadata, Output> =\n IsAny<Defined> extends true\n ? FieldDescriptionFn<Defined, Output>\n : Defined extends { description: unknown }\n ? TypeLevelError<\".description() has already been set\">\n : FieldDescriptionFn<Defined, Output>;\ntype FieldTypeNameMethod<Defined extends DefinedFieldMetadata, Output> =\n IsAny<Defined> extends true\n ? TypeLevelError<string>\n : Defined extends { typeName: unknown }\n ? TypeLevelError<\".typeName() has already been set\">\n : Defined extends { type: \"enum\" | \"nested\" }\n ? FieldTypeNameFn<Defined, Output>\n : TypeLevelError<\"typeName can only be set on enum or object fields\">;\ntype FieldValidateMethod<Defined extends DefinedFieldMetadata, Output> =\n IsAny<Defined> extends true\n ? FieldValidateFn<Defined, Output>\n : Defined extends { validate: unknown }\n ? TypeLevelError<\".validate() has already been set\">\n : FieldValidateFn<Defined, Output>;\n\n/**\n * Full TailorField interface with builder methods.\n * Extends the minimal structural interface from types/ with fluent API methods.\n */\nexport interface TailorField<\n Defined extends DefinedFieldMetadata = DefinedFieldMetadata,\n // Generic default output type (kept loose on purpose for library ergonomics).\n // oxlint-disable-next-line no-explicit-any\n Output = any,\n M extends FieldMetadata = FieldMetadata,\n T extends TailorFieldType = TailorFieldType,\n> extends TailorFieldBase<Defined, Output, M, T> {\n readonly fields: Record<string, TailorAnyField>;\n _metadata: M;\n\n /**\n * Set a description for the field\n * @param description - The description text\n * @returns The field with updated metadata\n */\n description: FieldDescriptionMethod<Defined, Output>;\n\n /**\n * Set a custom type name for enum or nested types\n * @param typeName - The custom type name\n * @returns The field with updated metadata\n */\n typeName: FieldTypeNameMethod<Defined, Output>;\n\n /**\n * Add validation functions to the field\n * @param validate - One or more validation functions\n * @returns The field with updated metadata\n */\n validate: FieldValidateMethod<Defined, Output>;\n\n /**\n * Parse and validate a value against this field's validation rules\n * Returns StandardSchema Result type with success or failure\n * @param args - Value, context data, and invoker\n * @returns Validation result\n */\n parse(args: FieldParseArgs): StandardSchemaV1.Result<Output>;\n}\n\n/**\n * Internal shape carried by every runtime field for clone-on-write support.\n *\n * `clone()` is intentionally kept off the public {@link TailorField} interface:\n * adding it there would force `TailorDBField` (which has a differently-typed\n * `clone`) to stop being assignable to `TailorField`, breaking the supported\n * `t.object({ field: db.string() })` usage. Every `t.*` and `db.*` field carries\n * a `clone()` at runtime, so the internal cast in `clone()` is safe.\n */\ntype CloneableField = { clone(): TailorAnyField };\n\ntype TailorFieldRuntime<\n Defined extends DefinedFieldMetadata,\n Output,\n M extends FieldMetadata = FieldMetadata,\n T extends TailorFieldType = TailorFieldType,\n> = TailorFieldBase<Defined, Output, M, T> & {\n readonly fields: Record<string, TailorAnyField>;\n _metadata: M;\n description(description: string): object;\n typeName(typeName: string): object;\n validate(...validate: FieldValidateInput<Output>[]): object;\n parse(args: FieldParseArgs): StandardSchemaV1.Result<Output>;\n clone(): TailorAnyField;\n};\n\n/**\n * Creates a new TailorField instance.\n * @param type - Field type\n * @param options - Field options\n * @param fields - Nested fields for object-like types\n * @param values - Allowed values for enum-like fields\n * @param metadata - Pre-built metadata to clone from (used by `clone()`); when\n * given, the mutable containers are deep-copied here and `options`/`values` are\n * ignored for metadata construction\n * @returns A new TailorField\n */\nfunction createTailorField<\n const T extends TailorFieldType,\n const TOptions extends FieldOptions,\n const OutputBase = TailorToTs[T],\n>(\n type: T,\n options?: TOptions,\n fields?: Record<string, TailorAnyField>,\n values?: AllowedValues,\n metadata?: FieldMetadata,\n): TailorField<\n { type: T; array: TOptions extends { array: true } ? true : false },\n FieldOutput<OutputBase, TOptions>\n>;\nfunction createTailorField<\n const T extends TailorFieldType,\n const TOptions extends FieldOptions,\n const OutputBase = TailorToTs[T],\n>(\n type: T,\n options?: TOptions,\n fields?: Record<string, TailorAnyField>,\n values?: AllowedValues,\n metadata?: FieldMetadata,\n): object {\n type FieldValue = FieldOutput<OutputBase, TOptions>;\n\n // When cloning, take ownership of the source metadata and deep-copy its mutable\n // containers (enum value objects and `[fn, message]` validator tuples; validator\n // functions are kept by reference) so no two instances share mutable state.\n const _metadata: FieldMetadata = metadata\n ? {\n ...metadata,\n ...(metadata.allowedValues && {\n allowedValues: metadata.allowedValues.map((v) => ({ ...v })),\n }),\n ...(metadata.validate && {\n validate: metadata.validate.map((v) => (Array.isArray(v) ? ([...v] as typeof v) : v)),\n }),\n }\n : { required: true };\n\n if (!metadata) {\n if (options) {\n if (options.optional === true) {\n _metadata.required = false;\n }\n if (options.array === true) {\n _metadata.array = true;\n }\n }\n if (values) {\n _metadata.allowedValues = mapAllowedValues(values);\n }\n }\n\n function parseInternal(\n args: FieldParseInternalArgs,\n ): StandardSchemaV1.Result<FieldOutput<OutputBase, TOptions>> {\n return parseFieldInternal<T, FieldOutput<OutputBase, TOptions>>({\n ...args,\n field,\n });\n }\n\n /**\n * Clone the field and apply metadata updates to the clone.\n * The original instance is never mutated, so a field shared across places\n * cannot leak metadata between them.\n * @param metadataUpdates - Metadata properties to overwrite on the clone\n * @returns A new field with the updated metadata\n */\n function cloneWith(metadataUpdates: Partial<FieldMetadata>) {\n const cloned = field.clone();\n Object.assign(cloned._metadata, metadataUpdates);\n return cloned;\n }\n\n const field: TailorFieldRuntime<\n { type: T; array: TOptions extends { array: true } ? true : false },\n FieldValue,\n FieldMetadata,\n T\n > = {\n type,\n fields: fields ?? {},\n _defined: undefined as unknown as {\n type: T;\n array: TOptions extends { array: true } ? true : false;\n },\n _output: undefined as FieldOutput<OutputBase, TOptions>,\n _metadata,\n\n get metadata() {\n return { ...this._metadata };\n },\n\n description(description: string) {\n // Clone-on-write so a shared field instance never leaks metadata.\n return cloneWith({ description });\n },\n\n typeName(typeName: string) {\n // Clone-on-write so a shared field instance never leaks metadata.\n return cloneWith({ typeName });\n },\n\n validate(...validateInputs: FieldValidateInput<FieldValue>[]) {\n // Clone-on-write so a shared field instance never leaks metadata.\n return cloneWith({ validate: validateInputs });\n },\n\n parse(args: FieldParseArgs): StandardSchemaV1.Result<FieldOutput<OutputBase, TOptions>> {\n return parseInternal({\n value: args.value,\n data: args.data,\n invoker: args.invoker,\n pathArray: [],\n });\n },\n\n clone() {\n // Deep clone nested object fields so the new instance shares no mutable state.\n let clonedFields = fields;\n if (fields) {\n const cloned: Record<string, TailorAnyField> = {};\n for (const [key, nestedField] of Object.entries(fields)) {\n // Both t.* and db.* fields carry clone() at runtime (see CloneableField).\n cloned[key] = (nestedField as TailorAnyField & CloneableField).clone();\n }\n clonedFields = cloned;\n }\n\n // Rebuild via the factory, handing it this field's metadata so the new\n // parseInternal closure rebinds to the clone and the factory owns the metadata deep-copy.\n // oxlint-disable-next-line no-explicit-any\n return createTailorField(type, options, clonedFields, values, this._metadata) as any;\n },\n };\n\n return field;\n}\n\n/**\n * Create a UUID field for resolver input/output.\n * @param options - Field configuration options\n * @returns A UUID field\n * @example t.uuid()\n */\nfunction uuid<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"uuid\", options);\n}\n\n/**\n * Create a string field for resolver input/output.\n * @param options - Field configuration options\n * @returns A string field\n * @example t.string()\n * @example t.string({ optional: true })\n * @example t.string({ array: true })\n */\nfunction string<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"string\", options);\n}\n\n/**\n * Create a boolean field for resolver input/output.\n * @param options - Field configuration options\n * @returns A boolean field\n * @example t.bool()\n */\nfunction bool<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"boolean\", options);\n}\n\n/**\n * Create an integer field for resolver input/output.\n * @param options - Field configuration options\n * @returns An integer field\n * @example t.int()\n */\nfunction int<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"integer\", options);\n}\n\n/**\n * Create a float field for resolver input/output.\n * @param options - Field configuration options\n * @returns A float field\n * @example t.float()\n */\nfunction float<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"float\", options);\n}\n\n/**\n * Create a decimal field for resolver input/output (stored as string for precision).\n * @param options - Field configuration options\n * @returns A decimal field\n * @example t.decimal()\n * @example t.decimal({ optional: true })\n */\nfunction decimal<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"decimal\", options);\n}\n\n/**\n * Create a date field for resolver input/output.\n * @param options - Field configuration options\n * @returns A date field\n * @example t.date()\n */\nfunction date<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"date\", options);\n}\n\n/**\n * Create a datetime field for resolver input/output.\n * @param options - Field configuration options\n * @returns A datetime field\n * @example t.datetime()\n */\nfunction datetime<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"datetime\", options);\n}\n\n/**\n * Create a time field for resolver input/output.\n * @param options - Field configuration options\n * @returns A time field\n * @example t.time()\n */\nfunction time<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"time\", options);\n}\n\n/**\n * Create an enum field for resolver input/output.\n * @param values - Array of allowed string values\n * @param options - Field configuration options\n * @returns An enum field\n * @example t.enum([\"active\", \"inactive\"])\n */\nfunction _enum<const V extends AllowedValues, const Opt extends FieldOptions>(\n values: V,\n options?: Opt,\n): TailorField<\n { type: \"enum\"; array: Opt extends { array: true } ? true : false },\n FieldOutput<AllowedValuesOutput<V>, Opt>\n> {\n return createTailorField<\"enum\", Opt, AllowedValuesOutput<V>>(\"enum\", options, undefined, values);\n}\n\ntype DefaultFieldKeys<F> = {\n [K in keyof F]: F[K] extends { _defined: { default: true } } ? K : never;\n}[keyof F];\n\ntype InferFieldsOutputWithDefaults<\n // oxlint-disable-next-line no-explicit-any\n F extends Record<string, { _output: any; [key: string]: any }>,\n> = Prettify<\n Omit<InferFieldsOutput<F>, DefaultFieldKeys<F> & string> & {\n [K in DefaultFieldKeys<F> & keyof F]?: output<F[K]>;\n }\n>;\n\n/**\n * Create a nested object field for resolver input/output.\n * @param fields - Record of field definitions\n * @param options - Field options (optional, array)\n * @returns A nested object field\n * @example\n * // Single object:\n * output: t.object({ name: t.string(), email: t.string() })\n * @example\n * // Array of objects:\n * items: t.object({ name: t.string() }, { array: true })\n */\nfunction object<const F extends Record<string, TailorAnyField>, const Opt extends FieldOptions>(\n fields: F,\n options?: Opt,\n) {\n const objectField = createTailorField(\"nested\", options, fields) as TailorField<\n { type: \"nested\"; array: Opt extends { array: true } ? true : false },\n FieldOutput<InferFieldsOutputWithDefaults<F>, Opt>\n >;\n return objectField;\n}\n\nexport const t = {\n uuid,\n string,\n bool,\n int,\n float,\n decimal,\n date,\n datetime,\n time,\n enum: _enum,\n object,\n};\n","import { type TailorDBInstance } from \"../tailordb/schema\";\nimport type {\n AuthDefinitionBrand,\n AuthServiceInput,\n DefinedAuth,\n UserAttributeListKey,\n UserAttributes,\n} from \"#/configure/services/auth/types\";\nimport type {\n DefinedFieldMetadata,\n FieldMetadata,\n TailorFieldType,\n TailorField,\n} from \"#/configure/types/field.types\";\n\ntype MachineUserAttributeFields = Record<\n string,\n TailorField<DefinedFieldMetadata, unknown, FieldMetadata, TailorFieldType>\n>;\n\ntype PlaceholderUser = TailorDBInstance<Record<string, never>, Record<string, never>>;\ntype PlaceholderAttributes = UserAttributes<PlaceholderUser>;\ntype PlaceholderAttributeList = UserAttributeListKey<PlaceholderUser>[];\n\ntype UserProfileAuthInput<\n User extends TailorDBInstance,\n Attributes extends UserAttributes<User>,\n AttributeList extends UserAttributeListKey<User>[],\n MachineUserNames extends string,\n ConnectionNames extends string = string,\n> = Omit<\n AuthServiceInput<User, Attributes, AttributeList, MachineUserNames, undefined, ConnectionNames>,\n \"userProfile\" | \"machineUserAttributes\"\n> & {\n userProfile: NonNullable<\n AuthServiceInput<User, Attributes, AttributeList, MachineUserNames, undefined>[\"userProfile\"]\n >;\n machineUserAttributes?: never;\n};\n\ntype MachineUserOnlyAuthInput<\n MachineUserNames extends string,\n MachineUserAttributes extends MachineUserAttributeFields,\n ConnectionNames extends string = string,\n> = Omit<\n AuthServiceInput<\n PlaceholderUser,\n PlaceholderAttributes,\n PlaceholderAttributeList,\n MachineUserNames,\n MachineUserAttributes,\n ConnectionNames\n >,\n \"userProfile\" | \"machineUserAttributes\"\n> & {\n userProfile?: never;\n machineUserAttributes: MachineUserAttributes;\n};\n\nexport type {\n OIDC,\n SAML,\n IDToken,\n BuiltinIdP,\n IdProvider as IdProviderConfig,\n OAuth2ClientInput as OAuth2Client,\n SCIMAuthorization,\n SCIMAttribute,\n SCIMAttributeMapping,\n SCIMResource,\n SCIMConfig,\n TenantProvider as TenantProviderConfig,\n} from \"#/types/auth.generated\";\nexport type {\n OAuth2ClientGrantType,\n SCIMAttributeType,\n BeforeLoginHookArgs,\n BeforeLoginClaims,\n FederatedIdentity,\n FederatedIdentityClaims,\n FederatedIdentityProvider,\n} from \"#/configure/services/auth/types\";\nexport type {\n AuthConnectionOAuth2Config,\n AuthConnectionConfig,\n} from \"#/types/auth-connection.generated\";\nexport type {\n ValueOperand,\n UsernameFieldKey,\n UserAttributeKey,\n UserAttributeListKey,\n UserAttributes,\n AuthConnectionTokenResult,\n AuthServiceInput,\n AuthConfig,\n AuthExternalConfig,\n AuthOwnConfig,\n DefinedAuth,\n} from \"#/configure/services/auth/types\";\n\n/**\n * Define an auth service for the Tailor SDK.\n * @template Name\n * @template User\n * @template Attributes\n * @template AttributeList\n * @template MachineUserNames\n * @param name - Auth service name\n * @param config - Auth service configuration\n * @returns Defined auth service\n */\nexport function defineAuth<\n const Name extends string,\n const User extends TailorDBInstance,\n const Attributes extends UserAttributes<User>,\n const AttributeList extends UserAttributeListKey<User>[],\n const MachineUserNames extends string,\n const ConnectionNames extends string = string,\n>(\n name: Name,\n config: UserProfileAuthInput<User, Attributes, AttributeList, MachineUserNames, ConnectionNames>,\n): DefinedAuth<\n Name,\n UserProfileAuthInput<User, Attributes, AttributeList, MachineUserNames, ConnectionNames>\n>;\nexport function defineAuth<\n const Name extends string,\n const MachineUserAttributes extends MachineUserAttributeFields,\n const MachineUserNames extends string,\n const ConnectionNames extends string = string,\n>(\n name: Name,\n config: MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes, ConnectionNames>,\n): DefinedAuth<\n Name,\n MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes, ConnectionNames>\n>;\n/* @__NO_SIDE_EFFECTS__ */\nexport function defineAuth<\n const Name extends string,\n const User extends TailorDBInstance,\n const Attributes extends UserAttributes<User>,\n const AttributeList extends UserAttributeListKey<User>[],\n const MachineUserAttributes extends MachineUserAttributeFields,\n const MachineUserNames extends string,\n const ConnectionNames extends string = string,\n>(\n name: Name,\n config:\n | UserProfileAuthInput<User, Attributes, AttributeList, MachineUserNames, ConnectionNames>\n | MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes, ConnectionNames>,\n) {\n const result = {\n ...config,\n name,\n } as const satisfies (\n | UserProfileAuthInput<User, Attributes, AttributeList, MachineUserNames, ConnectionNames>\n | MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes, ConnectionNames>\n ) & {\n name: string;\n };\n\n return result as typeof result & AuthDefinitionBrand;\n}\n","import type { InferredAttributes } from \"#/runtime/types\";\n\n// --- Permission types (UX-focused, for configure layer) ---\n\n/**\n * Record-level permission configuration for a TailorDB type.\n * Defines create, read, update, and delete permissions.\n *\n * Prefer object format with explicit `conditions` and `permit` for readability.\n * Shorthand array format is supported for compatibility, but less readable.\n *\n * For update operations, use `newRecord`/`oldRecord` operands instead of `record`.\n * @example\n * const permission: TailorTypePermission = {\n * create: [{ conditions: [[{ user: \"_loggedIn\" }, \"=\", true]], permit: true }],\n * read: [{ conditions: [[{ record: \"isPublic\" }, \"=\", true]], permit: true }],\n * update: [{ conditions: [[{ newRecord: \"ownerId\" }, \"=\", { user: \"id\" }]], permit: true }],\n * delete: [{ conditions: [[{ record: \"ownerId\" }, \"=\", { user: \"id\" }]], permit: true }],\n * };\n */\nexport type TailorTypePermission<\n User extends object = InferredAttributes,\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 = InferredAttributes,\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 /**\n * Whether matching records are granted (`true`) or denied (`false`).\n * Omitting `permit` in this object form defaults to `deny` and emits a\n * warning; set it explicitly. (The array shorthand defaults to `allow`.)\n */\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 = InferredAttributes,\n Type extends object = object,\n> = readonly GqlPermissionPolicy<User, Type>[];\n\ntype GqlPermissionPolicy<User extends object = InferredAttributes, Type extends object = object> = {\n conditions: readonly PermissionCondition<\"gql\", User, boolean, Type>[];\n actions: \"all\" | readonly GqlPermissionAction[];\n /**\n * Whether matching requests are granted (`true`) or denied (`false`).\n * Omitting `permit` defaults to `deny` and emits a warning; set it explicitly.\n */\n permit?: boolean;\n description?: string;\n};\n\ntype GqlPermissionAction = \"read\" | \"create\" | \"update\" | \"delete\" | \"aggregate\" | \"bulkUpsert\";\n\ntype EqualityOperator = \"=\" | \"!=\";\ntype ContainsOperator = \"in\" | \"not in\";\ntype HasAnyOperator = \"hasAny\" | \"not hasAny\";\n\n// Helper types for User field extraction\n// `-?` keeps the indexed access from folding optional fields' `never` into\n// `undefined`; `Exclude` lets an optional field's value type still match.\ntype StringFieldKeys<User extends object> = {\n [K in keyof User]-?: Exclude<User[K], undefined> extends string ? K : never;\n}[keyof User];\n\ntype StringArrayFieldKeys<User extends object> = {\n [K in keyof User]-?: Exclude<User[K], undefined> extends string[] ? K : never;\n}[keyof User];\n\ntype BooleanFieldKeys<User extends object> = {\n [K in keyof User]-?: Exclude<User[K], undefined> extends boolean ? K : never;\n}[keyof User];\n\ntype BooleanArrayFieldKeys<User extends object> = {\n [K in keyof User]-?: Exclude<User[K], undefined> extends boolean[] ? K : never;\n}[keyof User];\n\ntype UserStringOperand<User extends object = InferredAttributes> = {\n user: StringFieldKeys<User> | \"id\";\n};\n\ntype UserStringArrayOperand<User extends object = InferredAttributes> = {\n user: StringArrayFieldKeys<User>;\n};\n\ntype UserBooleanOperand<User extends object = InferredAttributes> = {\n user: BooleanFieldKeys<User> | \"_loggedIn\";\n};\n\ntype UserBooleanArrayOperand<User extends object = InferredAttributes> = {\n user: BooleanArrayFieldKeys<User>;\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\ntype StringEqualityCondition<\n Level extends \"record\" | \"gql\",\n User extends object,\n Update extends boolean,\n Type extends object,\n> =\n | (Level extends \"gql\" ? readonly [string, EqualityOperator, boolean] : never)\n | readonly [string, EqualityOperator, string]\n | readonly [UserStringOperand<User>, EqualityOperator, string]\n | readonly [string, EqualityOperator, UserStringOperand<User>]\n | (Level extends \"record\"\n ?\n | readonly [\n RecordOperand<Type, Update>,\n EqualityOperator,\n string | UserStringOperand<User>,\n ]\n | readonly [\n string | UserStringOperand<User>,\n EqualityOperator,\n RecordOperand<Type, Update>,\n ]\n : never);\n\ntype BooleanEqualityCondition<\n Level extends \"record\" | \"gql\",\n User extends object,\n Update extends boolean,\n Type extends object,\n> =\n | readonly [boolean, EqualityOperator, boolean]\n | readonly [UserBooleanOperand<User>, EqualityOperator, boolean]\n | readonly [boolean, EqualityOperator, UserBooleanOperand<User>]\n | (Level extends \"record\"\n ?\n | readonly [\n RecordOperand<Type, Update>,\n EqualityOperator,\n boolean | UserBooleanOperand<User>,\n ]\n | readonly [\n boolean | UserBooleanOperand<User>,\n EqualityOperator,\n RecordOperand<Type, Update>,\n ]\n : never);\n\ntype EqualityCondition<\n Level extends \"record\" | \"gql\" = \"record\",\n User extends object = InferredAttributes,\n Update extends boolean = boolean,\n Type extends object = object,\n> =\n | StringEqualityCondition<Level, User, Update, Type>\n | BooleanEqualityCondition<Level, User, Update, Type>;\n\ntype StringContainsCondition<\n Level extends \"record\" | \"gql\",\n User extends object,\n Update extends boolean,\n Type extends object,\n> =\n | readonly [string, ContainsOperator, string[]]\n | readonly [UserStringOperand<User>, ContainsOperator, string[]]\n | readonly [string, ContainsOperator, UserStringArrayOperand<User>]\n | (Level extends \"record\"\n ?\n | readonly [\n RecordOperand<Type, Update>,\n ContainsOperator,\n string[] | UserStringArrayOperand<User>,\n ]\n | readonly [\n string | UserStringOperand<User>,\n ContainsOperator,\n RecordOperand<Type, Update>,\n ]\n : never);\n\ntype BooleanContainsCondition<\n Level extends \"record\" | \"gql\",\n User extends object,\n Update extends boolean,\n Type extends object,\n> =\n | (Level extends \"gql\" ? readonly [string, ContainsOperator, boolean[]] : never)\n | readonly [boolean, ContainsOperator, boolean[]]\n | readonly [UserBooleanOperand<User>, ContainsOperator, boolean[]]\n | readonly [boolean, ContainsOperator, UserBooleanArrayOperand<User>]\n | (Level extends \"record\"\n ?\n | readonly [\n RecordOperand<Type, Update>,\n ContainsOperator,\n boolean[] | UserBooleanArrayOperand<User>,\n ]\n | readonly [\n boolean | UserBooleanOperand<User>,\n ContainsOperator,\n RecordOperand<Type, Update>,\n ]\n : never);\n\ntype ContainsCondition<\n Level extends \"record\" | \"gql\" = \"record\",\n User extends object = InferredAttributes,\n Update extends boolean = boolean,\n Type extends object = object,\n> =\n | StringContainsCondition<Level, User, Update, Type>\n | BooleanContainsCondition<Level, User, Update, Type>;\n\ntype HasAnyCondition<\n Level extends \"record\" | \"gql\",\n User extends object,\n Update extends boolean,\n Type extends object,\n> =\n | readonly [\n string[] | UserStringArrayOperand<User>,\n HasAnyOperator,\n string[] | UserStringArrayOperand<User>,\n ]\n | (Level extends \"record\"\n ?\n | readonly [\n RecordOperand<Type, Update>,\n HasAnyOperator,\n string[] | UserStringArrayOperand<User>,\n ]\n | readonly [\n string[] | UserStringArrayOperand<User>,\n HasAnyOperator,\n RecordOperand<Type, Update>,\n ]\n : never);\n\n/**\n * Type representing a permission condition that combines user attributes, record fields, and literal values using comparison operators.\n *\n * The User type is extended by `tailor.d.ts`, which is automatically generated when running `tailor generate`.\n * Attributes enabled in the config file's `auth.userProfile.attributes` (or\n * `auth.machineUserAttributes` when userProfile is omitted) become available as types.\n * @example\n * ```ts\n * // tailor.config.ts\n * export const auth = defineAuth(\"my-auth\", {\n * userProfile: {\n * type: user,\n * attributes: {\n * isAdmin: true,\n * roles: true,\n * }\n * }\n * });\n * ```\n */\nexport type PermissionCondition<\n Level extends \"record\" | \"gql\" = \"record\",\n User extends object = InferredAttributes,\n Update extends boolean = boolean,\n Type extends object = object,\n> =\n | EqualityCondition<Level, User, Update, Type>\n | ContainsCondition<Level, User, Update, Type>\n | HasAnyCondition<Level, User, Update, Type>;\n\n// --- Runtime constants ---\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 { t, type TailorAnyField, type TailorField } from \"#/configure/types/type\";\nimport { brandValue } from \"#/utils/brand\";\nimport type { MachineUserName } from \"#/configure/types/machine-user\";\nimport type { TailorEnv, TailorPrincipal } from \"#/runtime/types\";\nimport type { InferFieldsOutput, output } from \"#/types/helpers\";\nimport type { ResolverInput } from \"#/types/resolver.generated\";\n\ntype Context<Input extends Record<string, TailorAnyField> | undefined> = {\n input: Input extends Record<string, TailorAnyField> ? InferFieldsOutput<Input> : never;\n caller: TailorPrincipal | null;\n invoker: TailorPrincipal | null;\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\" | \"invoker\"> &\n Readonly<{\n input?: Input;\n output: NormalizedOutput<Output>;\n body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;\n invoker?: MachineUserName;\n }>;\n\n/**\n * Create a resolver definition for the Tailor SDK.\n *\n * The `body` function receives a context with `input` (typed from `config.input`),\n * `caller`, `invoker` (reflects configured machine-user delegation), and `env`.\n * The return value of `body` must match the `output` type.\n *\n * `output` accepts either a single TailorField (e.g. `t.string()`) or a\n * Record of fields (e.g. `{ name: t.string(), age: t.int() }`).\n *\n * `publishEvents` enables publishing execution events for this resolver.\n * If not specified, this is automatically set to true when an executor uses this resolver\n * with `resolverExecutedTrigger`. If explicitly set to false while an executor uses this\n * resolver, an error will be thrown during apply.\n * @template Input\n * @template Output\n * @param config - Resolver configuration\n * @returns Normalized resolver configuration\n * @example\n * import { createResolver, t } from \"@tailor-platform/sdk\";\n *\n * export default createResolver({\n * name: \"getUser\",\n * operation: \"query\",\n * input: {\n * id: t.string(),\n * },\n * body: async ({ input, caller }) => {\n * const db = getDB(\"tailordb\");\n * const result = await db.selectFrom(\"User\").selectAll().where(\"id\", \"=\", input.id).executeTakeFirst();\n * return { name: result?.name ?? \"\", email: result?.email ?? \"\" };\n * },\n * output: t.object({\n * name: t.string(),\n * email: t.string(),\n * }),\n * });\n */\n/* @__NO_SIDE_EFFECTS__ */\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\" | \"invoker\"> &\n Readonly<{\n input?: Input;\n output: Output;\n body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;\n invoker?: MachineUserName;\n }>,\n): ResolverReturn<Input, Output> {\n // Check if output is already a TailorField using duck typing.\n // TailorField has `type: string` (e.g., \"uuid\", \"string\"), while\n // Record<string, TailorField> either lacks `type` or has TailorField as value.\n const isTailorField = (obj: unknown): obj is TailorAnyField =>\n typeof obj === \"object\" &&\n obj !== null &&\n \"type\" in obj &&\n typeof (obj as { type: unknown }).type === \"string\";\n\n const normalizedOutput = isTailorField(config.output) ? config.output : t.object(config.output);\n\n return brandValue(\n {\n ...config,\n output: normalizedOutput,\n } as ResolverReturn<Input, Output>,\n \"resolver\",\n );\n}\n\n// A loose config alias for userland use-cases\n// oxlint-disable-next-line no-explicit-any\nexport type ResolverConfig = ReturnType<typeof createResolver<any, any>>;\n","import { brandValue } from \"#/utils/brand\";\nimport type { Workflow } from \"#/configure/services/workflow/workflow\";\nimport type { ExecutorInput } from \"#/types/executor.generated\";\nimport type { Operation, WorkflowOperation } from \"./operation\";\nimport type { Trigger } from \"./trigger\";\n\ntype TriggerArgs<T extends Trigger<unknown>> = T extends { __args: infer Args } ? Args : never;\n\ntype ExecutorBase<T extends Trigger<unknown>> = Omit<ExecutorInput, \"trigger\" | \"operation\"> & {\n trigger: T;\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<T extends Trigger<unknown>, O> = O extends {\n kind: \"workflow\";\n workflow: infer W extends Workflow;\n}\n ? ExecutorBase<T> & {\n operation: WorkflowOperation<TriggerArgs<T>, W>;\n }\n : ExecutorBase<T> & {\n operation: O;\n };\n\n/**\n * Create an executor configuration for the Tailor SDK.\n *\n * Executors are event-driven handlers that respond to record changes,\n * resolver executions, or other events.\n *\n * Operation kinds: \"function\", \"graphql\", \"webhook\", \"workflow\".\n * @template T\n * @template O\n * @param config - Executor configuration\n * @returns The same executor configuration\n * @example\n * import { createExecutor, recordCreatedTrigger } from \"@tailor-platform/sdk\";\n * import { order } from \"../tailordb/order\";\n *\n * export default createExecutor({\n * name: \"order-created\",\n * description: \"Handles new order creation\",\n * trigger: recordCreatedTrigger({ type: order }),\n * operation: {\n * kind: \"function\",\n * body: async ({ newRecord }) => {\n * console.log(\"New order:\", newRecord.id);\n * },\n * },\n * });\n */\nexport function createExecutor<\n T extends Trigger<unknown>,\n O extends Operation<TriggerArgs<T>> | { kind: \"workflow\"; workflow: Workflow },\n>(config: Executor<T, O>): Executor<T, O>;\n\n/**\n * Create an executor configuration for the Tailor SDK.\n * This overload preserves source compatibility for legacy explicit generic calls,\n * where the first generic argument represents trigger args.\n * @template Args\n * @template O\n * @param config - Executor configuration\n * @returns The same executor configuration\n */\nexport function createExecutor<\n Args,\n O extends Operation<Args> | { kind: \"workflow\"; workflow: Workflow },\n>(config: Executor<Trigger<Args>, O>): Executor<Trigger<Args>, O>;\n\n/* @__NO_SIDE_EFFECTS__ */\nexport function createExecutor<\n T extends Trigger<unknown>,\n O extends Operation<TriggerArgs<T>> | { kind: \"workflow\"; workflow: Workflow },\n>(config: Executor<T, O>) {\n return brandValue(config, \"executor\");\n}\n","import type { ResolverConfig } from \"#/configure/services/resolver/resolver\";\nimport type { TailorDBType } from \"#/configure/services/tailordb/schema\";\nimport type { IdpName } from \"#/configure/types/idp-name\";\nimport type { TailorEnv, TailorPrincipal } from \"#/runtime/types\";\nimport type {\n TailorDBTrigger as ParserTailorDBTrigger,\n ResolverExecutedTrigger as ParserResolverExecutedTrigger,\n IdpUserTrigger as ParserIdpUserTrigger,\n AuthAccessTokenTrigger as ParserAuthAccessTokenTrigger,\n} from \"#/types/executor.generated\";\nimport type { output } from \"#/types/helpers\";\n\ninterface EventArgs {\n workspaceId: string;\n appNamespace: string;\n env: TailorEnv;\n actor: TailorPrincipal | null;\n}\n\ninterface RecordArgs extends EventArgs {\n typeName: string;\n}\n\nexport interface RecordCreatedArgs<T extends TailorDBType> extends RecordArgs {\n event: \"created\";\n rawEvent: \"tailordb.type_record.created\";\n newRecord: output<T>;\n}\n\nexport interface RecordUpdatedArgs<T extends TailorDBType> extends RecordArgs {\n event: \"updated\";\n rawEvent: \"tailordb.type_record.updated\";\n newRecord: output<T>;\n oldRecord: output<T>;\n}\n\nexport interface RecordDeletedArgs<T extends TailorDBType> extends RecordArgs {\n event: \"deleted\";\n rawEvent: \"tailordb.type_record.deleted\";\n oldRecord: output<T>;\n}\n\n/**\n * Args for resolverExecutedTrigger. This is a discriminated union on `success`.\n *\n * When `success` is true, `result` contains the resolver output and `error` is never.\n * When `success` is false, `error` contains the error message and `result` is never.\n *\n * Narrow on `success` to safely access either `result` or `error`.\n * @example\n * body: async (args) => {\n * if (args.success) {\n * console.log(args.result);\n * } else {\n * console.error(args.error);\n * }\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\n// IdP User Event Args\nexport interface IdpUserCreatedArgs extends EventArgs {\n event: \"created\";\n rawEvent: \"idp.user.created\";\n namespaceName: string;\n userId: string;\n}\n\nexport interface IdpUserUpdatedArgs extends EventArgs {\n event: \"updated\";\n rawEvent: \"idp.user.updated\";\n namespaceName: string;\n userId: string;\n}\n\nexport interface IdpUserDeletedArgs extends EventArgs {\n event: \"deleted\";\n rawEvent: \"idp.user.deleted\";\n namespaceName: string;\n userId: string;\n}\n\nexport type IdpUserArgs = IdpUserCreatedArgs | IdpUserUpdatedArgs | IdpUserDeletedArgs;\n\n// Auth Access Token Event Args\nexport interface AuthAccessTokenIssuedArgs extends EventArgs {\n event: \"issued\";\n rawEvent: \"auth.access_token.issued\";\n namespaceName: string;\n userId: string;\n}\n\nexport interface AuthAccessTokenRefreshedArgs extends EventArgs {\n event: \"refreshed\";\n rawEvent: \"auth.access_token.refreshed\";\n namespaceName: string;\n userId: string;\n}\n\nexport interface AuthAccessTokenRevokedArgs extends EventArgs {\n event: \"revoked\";\n rawEvent: \"auth.access_token.revoked\";\n namespaceName: string;\n userId: string;\n}\n\nexport type AuthAccessTokenArgs =\n | AuthAccessTokenIssuedArgs\n | AuthAccessTokenRefreshedArgs\n | AuthAccessTokenRevokedArgs;\n\n// ---------------------------------------------------------------------------\n// TailorDB trigger types and factories\n// ---------------------------------------------------------------------------\n\nconst recordEventMap = {\n created: \"tailordb.type_record.created\",\n updated: \"tailordb.type_record.updated\",\n deleted: \"tailordb.type_record.deleted\",\n} as const;\ntype RecordEventMap = typeof recordEventMap;\ntype RecordEventKind = keyof RecordEventMap;\n\ntype RecordArgsMap<T extends TailorDBType> = {\n created: RecordCreatedArgs<T>;\n updated: RecordUpdatedArgs<T>;\n deleted: RecordDeletedArgs<T>;\n};\n\ntype RecordMultiArgs<\n T extends TailorDBType,\n K extends RecordEventKind[],\n> = RecordArgsMap<T>[K[number]];\n\nexport type TailorDBTrigger<Args> = ParserTailorDBTrigger & {\n __args: Args;\n};\n\ntype RecordTriggerOptions<T extends TailorDBType, Args> = {\n type: T;\n condition?: (args: Args) => boolean;\n};\n\n/**\n * Create a trigger that fires when a TailorDB record is created.\n * @template T\n * @param options - Trigger options\n * @returns Record created trigger\n */\nexport function recordCreatedTrigger<T extends TailorDBType>(\n options: RecordTriggerOptions<T, RecordCreatedArgs<T>>,\n): TailorDBTrigger<RecordCreatedArgs<T>> {\n const { type, condition } = options;\n return {\n kind: \"tailordb\",\n events: [\"tailordb.type_record.created\"],\n typeName: type.name,\n condition,\n __args: {} as RecordCreatedArgs<T>,\n };\n}\n\n/**\n * Create a trigger that fires when a TailorDB record is updated.\n * @template T\n * @param options - Trigger options\n * @returns Record updated trigger\n */\nexport function recordUpdatedTrigger<T extends TailorDBType>(\n options: RecordTriggerOptions<T, RecordUpdatedArgs<T>>,\n): TailorDBTrigger<RecordUpdatedArgs<T>> {\n const { type, condition } = options;\n return {\n kind: \"tailordb\",\n events: [\"tailordb.type_record.updated\"],\n typeName: type.name,\n condition,\n __args: {} as RecordUpdatedArgs<T>,\n };\n}\n\n/**\n * Create a trigger that fires when a TailorDB record is deleted.\n * @template T\n * @param options - Trigger options\n * @returns Record deleted trigger\n */\nexport function recordDeletedTrigger<T extends TailorDBType>(\n options: RecordTriggerOptions<T, RecordDeletedArgs<T>>,\n): TailorDBTrigger<RecordDeletedArgs<T>> {\n const { type, condition } = options;\n return {\n kind: \"tailordb\",\n events: [\"tailordb.type_record.deleted\"],\n typeName: type.name,\n condition,\n __args: {} as RecordDeletedArgs<T>,\n };\n}\n\ntype RecordTriggerMultiOptions<T extends TailorDBType, K extends RecordEventKind[]> = {\n type: T;\n events: K;\n condition?: (args: RecordMultiArgs<T, K>) => boolean;\n};\n\n/**\n * Create a trigger that fires on multiple TailorDB record event types.\n * @template T\n * @template K\n * @param options - Trigger options with events array\n * @returns TailorDB record trigger\n */\nexport function recordTrigger<\n T extends TailorDBType,\n const K extends [RecordEventKind, ...RecordEventKind[]],\n>(options: RecordTriggerMultiOptions<T, K>): TailorDBTrigger<RecordMultiArgs<T, K>> {\n const { type, events, condition } = options;\n return {\n kind: \"tailordb\",\n events: events.map((k) => recordEventMap[k]),\n typeName: type.name,\n condition,\n __args: {} as RecordMultiArgs<T, K>,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Resolver trigger\n// ---------------------------------------------------------------------------\n\nexport type ResolverExecutedTrigger<Args> = ParserResolverExecutedTrigger & {\n __args: Args;\n};\n\ntype ResolverExecutedTriggerOptions<R extends ResolverConfig> = {\n resolver: R;\n condition?: (args: ResolverExecutedArgs<R>) => boolean;\n};\n\n/**\n * Create a trigger that fires when a resolver is executed.\n * @template R\n * @param options - Trigger options\n * @returns Resolver executed trigger\n */\nexport function resolverExecutedTrigger<R extends ResolverConfig>(\n options: ResolverExecutedTriggerOptions<R>,\n): ResolverExecutedTrigger<ResolverExecutedArgs<R>> {\n const { resolver, condition } = options;\n return {\n kind: \"resolverExecuted\",\n resolverName: resolver.name,\n condition,\n __args: {} as ResolverExecutedArgs<R>,\n };\n}\n\n// ---------------------------------------------------------------------------\n// IdP User trigger types and factories\n// ---------------------------------------------------------------------------\n\nconst idpUserEventMap = {\n created: \"idp.user.created\",\n updated: \"idp.user.updated\",\n deleted: \"idp.user.deleted\",\n} as const;\ntype IdpUserEventMap = typeof idpUserEventMap;\ntype IdpUserEventKind = keyof IdpUserEventMap;\n\ntype IdpUserArgsMap = {\n created: IdpUserCreatedArgs;\n updated: IdpUserUpdatedArgs;\n deleted: IdpUserDeletedArgs;\n};\n\ntype IdpUserMultiArgs<K extends IdpUserEventKind[]> = IdpUserArgsMap[K[number]];\n\nexport type IdpUserTrigger<Args> = ParserIdpUserTrigger & {\n __args: Args;\n};\n\ntype IdpUserSingleTriggerOptions = {\n /**\n * IdP namespace name to subscribe to. Required when the project defines\n * multiple IdPs; optional when a single IdP exists. Must match an IdP name\n * declared in `defineConfig({ idp: [...] })`.\n */\n idp?: IdpName;\n};\n\n/**\n * Create a trigger that fires when an IdP user is created.\n * @param options - Trigger options\n * @param options.idp - IdP namespace name to subscribe to\n * @returns IdP user created trigger\n */\nexport function idpUserCreatedTrigger(\n options?: IdpUserSingleTriggerOptions,\n): IdpUserTrigger<IdpUserCreatedArgs> {\n return {\n kind: \"idpUser\",\n events: [\"idp.user.created\"],\n ...(options?.idp != null ? { idp: options.idp } : {}),\n __args: {} as IdpUserCreatedArgs,\n };\n}\n\n/**\n * Create a trigger that fires when an IdP user is updated.\n * @param options - Trigger options\n * @param options.idp - IdP namespace name to subscribe to\n * @returns IdP user updated trigger\n */\nexport function idpUserUpdatedTrigger(\n options?: IdpUserSingleTriggerOptions,\n): IdpUserTrigger<IdpUserUpdatedArgs> {\n return {\n kind: \"idpUser\",\n events: [\"idp.user.updated\"],\n ...(options?.idp != null ? { idp: options.idp } : {}),\n __args: {} as IdpUserUpdatedArgs,\n };\n}\n\n/**\n * Create a trigger that fires when an IdP user is deleted.\n * @param options - Trigger options\n * @param options.idp - IdP namespace name to subscribe to\n * @returns IdP user deleted trigger\n */\nexport function idpUserDeletedTrigger(\n options?: IdpUserSingleTriggerOptions,\n): IdpUserTrigger<IdpUserDeletedArgs> {\n return {\n kind: \"idpUser\",\n events: [\"idp.user.deleted\"],\n ...(options?.idp != null ? { idp: options.idp } : {}),\n __args: {} as IdpUserDeletedArgs,\n };\n}\n\ntype IdpUserTriggerOptions<K extends IdpUserEventKind[]> = {\n events: K;\n /**\n * IdP namespace name to subscribe to. Required when the project defines\n * multiple IdPs; optional when a single IdP exists. Must match an IdP name\n * declared in `defineConfig({ idp: [...] })`.\n */\n idp?: IdpName;\n};\n\n/**\n * Create a trigger that fires on multiple IdP user event types.\n * @template K\n * @param options - Trigger options with events array\n * @param options.events - IdP user event kinds to subscribe to\n * @param options.idp - IdP namespace name to subscribe to\n * @returns IdP user trigger\n */\nexport function idpUserTrigger<const K extends [IdpUserEventKind, ...IdpUserEventKind[]]>(\n options: IdpUserTriggerOptions<K>,\n): IdpUserTrigger<IdpUserMultiArgs<K>> {\n const { events, idp } = options;\n return {\n kind: \"idpUser\",\n events: events.map((k) => idpUserEventMap[k]),\n ...(idp != null ? { idp } : {}),\n __args: {} as IdpUserMultiArgs<K>,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Auth Access Token trigger types and factories\n// ---------------------------------------------------------------------------\n\nconst authAccessTokenEventMap = {\n issued: \"auth.access_token.issued\",\n refreshed: \"auth.access_token.refreshed\",\n revoked: \"auth.access_token.revoked\",\n} as const;\ntype AuthAccessTokenEventMap = typeof authAccessTokenEventMap;\ntype AuthAccessTokenEventKind = keyof AuthAccessTokenEventMap;\n\ntype AuthAccessTokenArgsMap = {\n issued: AuthAccessTokenIssuedArgs;\n refreshed: AuthAccessTokenRefreshedArgs;\n revoked: AuthAccessTokenRevokedArgs;\n};\n\ntype AuthAccessTokenMultiArgs<K extends AuthAccessTokenEventKind[]> =\n AuthAccessTokenArgsMap[K[number]];\n\nexport type AuthAccessTokenTrigger<Args> = ParserAuthAccessTokenTrigger & {\n __args: Args;\n};\n\n/**\n * Create a trigger that fires when an access token is issued.\n * @returns Auth access token issued trigger\n */\nexport function authAccessTokenIssuedTrigger(): AuthAccessTokenTrigger<AuthAccessTokenIssuedArgs> {\n return {\n kind: \"authAccessToken\",\n events: [\"auth.access_token.issued\"],\n __args: {} as AuthAccessTokenIssuedArgs,\n };\n}\n\n/**\n * Create a trigger that fires when an access token is refreshed.\n * @returns Auth access token refreshed trigger\n */\nexport function authAccessTokenRefreshedTrigger(): AuthAccessTokenTrigger<AuthAccessTokenRefreshedArgs> {\n return {\n kind: \"authAccessToken\",\n events: [\"auth.access_token.refreshed\"],\n __args: {} as AuthAccessTokenRefreshedArgs,\n };\n}\n\n/**\n * Create a trigger that fires when an access token is revoked.\n * @returns Auth access token revoked trigger\n */\nexport function authAccessTokenRevokedTrigger(): AuthAccessTokenTrigger<AuthAccessTokenRevokedArgs> {\n return {\n kind: \"authAccessToken\",\n events: [\"auth.access_token.revoked\"],\n __args: {} as AuthAccessTokenRevokedArgs,\n };\n}\n\ntype AuthAccessTokenTriggerOptions<K extends AuthAccessTokenEventKind[]> = {\n events: K;\n};\n\n/**\n * Create a trigger that fires on multiple auth access token event types.\n * @template K\n * @param options - Trigger options with events array\n * @returns Auth access token trigger\n */\nexport function authAccessTokenTrigger<\n const K extends [AuthAccessTokenEventKind, ...AuthAccessTokenEventKind[]],\n>(options: AuthAccessTokenTriggerOptions<K>): AuthAccessTokenTrigger<AuthAccessTokenMultiArgs<K>> {\n const { events } = options;\n return {\n kind: \"authAccessToken\",\n events: events.map((k) => authAccessTokenEventMap[k]),\n __args: {} as AuthAccessTokenMultiArgs<K>,\n };\n}\n","import type { TailorEnv } from \"#/runtime/types\";\nimport type { ScheduleTriggerInput as ParserScheduleTriggerInput } from \"#/types/executor.generated\";\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\ninterface ScheduleTriggerOptions<T extends string> {\n cron: StandardCRON<T> extends never ? never : T;\n timezone?: Timezone;\n}\n\n/**\n * Create a schedule-based trigger using a CRON expression and optional timezone.\n * @template T\n * @param options - Schedule options\n * @returns Schedule trigger\n */\nexport function scheduleTrigger<T extends string>(\n options: ScheduleTriggerOptions<T>,\n): ScheduleTrigger<ScheduleArgs> {\n const { cron, timezone } = options;\n return {\n kind: \"schedule\",\n cron,\n timezone,\n __args: {} as ScheduleArgs,\n };\n}\n","import type { TailorEnv } from \"#/runtime/types\";\nimport type { IncomingWebhookTrigger as ParserIncomingWebhookTrigger } from \"#/types/executor.generated\";\nimport type { JsonValue } from \"#/types/helpers\";\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 interface IncomingWebhookResponseConfig<Args> {\n /**\n * Expression that returns the webhook HTTP response body.\n * Receives the same args as the executor operation.\n */\n body?: (args: Args) => JsonValue;\n /**\n * HTTP status code for the response.\n * If omitted and `body` is set, the platform uses 200.\n */\n statusCode?: number;\n}\n\nexport type IncomingWebhookResponse<Args> =\n | ((args: Args) => JsonValue)\n | IncomingWebhookResponseConfig<Args>;\n\nexport interface IncomingWebhookTriggerOptions<Args> {\n response?: IncomingWebhookResponse<Args>;\n}\n\nexport type IncomingWebhookTrigger<Args> = ParserIncomingWebhookTrigger & {\n __args: Args;\n};\n\n/**\n * Create a trigger for incoming webhook requests.\n * @template T\n * @param options - Optional trigger options including response configuration\n * @returns Incoming webhook trigger\n */\nexport function incomingWebhookTrigger<T extends IncomingWebhookRequest>(\n options?: IncomingWebhookTriggerOptions<IncomingWebhookArgs<T>>,\n): IncomingWebhookTrigger<IncomingWebhookArgs<T>> {\n const response =\n typeof options?.response === \"function\" ? { body: options.response } : options?.response;\n return {\n kind: \"incomingWebhook\",\n ...(response ? { response } : {}),\n __args: {} as IncomingWebhookArgs<T>,\n };\n}\n","import { brandValue } from \"#/utils/brand\";\nimport type {\n ExecutionPolicyConcurrency,\n ExecutionPolicyDefInput,\n ExecutionPolicyGroupOptions,\n ExecutionPolicyInstance,\n ResolvedExecutionPolicyInstance,\n} from \"./execution-policy.types\";\n\nexport type {\n ExecutionPolicyConcurrency,\n ExecutionPolicyDefInput,\n ExecutionPolicyExactInstance,\n ExecutionPolicyGroupOptions,\n ExecutionPolicyInstance,\n ExecutionPolicyWildcardInstance,\n ResolvedExecutionPolicyInstance,\n} from \"./execution-policy.types\";\n\n// Mirrors the non-wildcard branch of ExecutionPolicyKeySchema's grammar\n// (parser/service/workflow/schema.ts). Duplicated, not imported, because\n// configure code must stay zod-free — it ships inside the same runtime\n// bundle as user workflow job functions.\nconst EXECUTION_POLICY_EXACT_KEY_REGEX = /^[a-z0-9][a-z0-9_:.-]{0,62}[a-z0-9]$/;\n\n// Resolves to the literal type of `Def[\"key\"]` when the caller passed an\n// explicit `key`, otherwise to `Fallback`.\ntype ResolveKey<Def, Fallback extends string> = Def extends { key: infer K extends string }\n ? K\n : Fallback;\n\n// Resolves to the literal type of `Def[\"matchType\"]`, defaulting to\n// `\"exact\"`. Always known from `def` directly — never derived from a\n// property name — so it resolves the same way regardless of where `key`\n// comes from.\ntype ResolveMatchType<Def> = Def extends { matchType: infer M extends \"exact\" | \"prefix\" }\n ? M\n : \"exact\";\n\ninterface ExecutionPolicyWithSetters {\n instance: ExecutionPolicyInstance;\n setName: ((name: string) => void) | undefined;\n setKey: ((key: string) => void) | undefined;\n}\n\nfunction createExecutionPolicyInstance(\n initialName: string,\n initialKey: string,\n concurrencyPolicy: ExecutionPolicyConcurrency | undefined,\n matchType: \"exact\" | \"prefix\",\n separator: string,\n allowNameSetter: boolean,\n allowKeySetter: boolean,\n): ExecutionPolicyWithSetters {\n const isPrefix = matchType === \"prefix\";\n const raw: {\n name: string;\n key: string;\n matchType: \"exact\" | \"prefix\";\n concurrencyPolicy?: ExecutionPolicyConcurrency;\n keyFor?: (suffix: string) => string;\n } = {\n name: initialName,\n key: initialKey,\n matchType,\n ...(concurrencyPolicy && { concurrencyPolicy }),\n // Reads raw.key (not the initialKey param) so a property-name-derived\n // key patched in later via setKey is reflected too.\n ...(isPrefix && {\n keyFor: (suffix: string) => {\n const key = `${raw.key}${separator}${suffix}`;\n if (!EXECUTION_POLICY_EXACT_KEY_REGEX.test(key)) {\n throw new Error(\n `Invalid execution policy key \"${key}\" built by keyFor(\"${suffix}\"): must match [a-z0-9_:.-] (2-64 chars; must start and end with [a-z0-9]).`,\n );\n }\n return key;\n },\n }),\n };\n // `raw` always carries `key`, including for prefix policies — it backs\n // keyFor()'s closure — but ExecutionPolicyWildcardInstance omits it from\n // its public type, so this cast can't go directly to the union.\n const instance = brandValue(raw, \"execution-policy\") as unknown as ExecutionPolicyInstance;\n return {\n instance,\n setName: allowNameSetter\n ? (n: string) => {\n raw.name = n;\n }\n : undefined,\n setKey: allowKeySetter\n ? (k: string) => {\n raw.key = k;\n }\n : undefined,\n };\n}\n\n/**\n * Define a single workflow job function execution policy.\n *\n * Use this when declaring a policy outside the\n * {@link defineWorkflowExecutionPolicies} builder — for example, when the\n * runtime key prefix needs to differ from the corresponding workspace-unique\n * name.\n *\n * When `matchType: \"prefix\"` is set, the returned instance has `keyFor(suffix)`\n * instead of a directly-usable `key` (see {@link ExecutionPolicyWildcardInstance}).\n * @param name - Workspace-unique name. Must match `^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$`.\n * @param def - Optional overrides for `key` (defaults to `name`), `matchType`, `separator` (the `keyFor` join character, defaults to `.`), and concurrency\n * @returns An execution policy instance\n * @example\n * export const perTenant = defineWorkflowExecutionPolicy(\"tenant-api\", {\n * matchType: \"prefix\",\n * concurrencyPolicy: { maxConcurrentExecutions: 3 },\n * });\n *\n * perTenant.keyFor(tenantId); // \"tenant-api.<tenantId>\"\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function defineWorkflowExecutionPolicy<\n const N extends string,\n const D extends (Omit<ExecutionPolicyDefInput, \"name\"> & { separator?: string }) | undefined =\n undefined,\n>(name: N, def?: D): ResolvedExecutionPolicyInstance<ResolveKey<D, N>, ResolveMatchType<D>> {\n return createExecutionPolicyInstance(\n name,\n def?.key ?? name,\n def?.concurrencyPolicy,\n def?.matchType ?? \"exact\",\n def?.separator ?? \".\",\n false,\n false,\n ).instance as ResolvedExecutionPolicyInstance<ResolveKey<D, N>, ResolveMatchType<D>>;\n}\n\n/**\n * Define a group of workflow job function execution policies. Property names\n * become the workspace-unique `name` and default `key` verbatim, matching the\n * mental model of {@link defineWaitPoints}. Provide `name` / `key` explicitly\n * to override the property-name default (for example, when the property name\n * is not valid for the execution policy grammar or when the runtime key\n * prefix needs to differ).\n *\n * When `matchType: \"prefix\"` is set, the returned instance has `keyFor(suffix)`\n * instead of a directly-usable `key` (see {@link ExecutionPolicyWildcardInstance}).\n * `matchType` can be combined with an explicit `key`, or left to apply to\n * the property-name-derived prefix.\n *\n * The return type mirrors the builder's return type so JSDoc on each property\n * is preserved in IDE autocompletion.\n * @param builder - Callback that receives a `define` factory and returns a record of policies\n * @param options - Group-wide options; `separator` overrides the `.` `keyFor` uses to join the prefix and suffix for every prefix policy in the group\n * @returns The same object returned by the builder (with `name` / `key` resolved on each instance)\n * @example\n * export const executionPolicies = defineWorkflowExecutionPolicies((define) => ({\n * premium: define({ concurrencyPolicy: { maxConcurrentExecutions: 5 } }),\n * \"tenant-api\": define({\n * matchType: \"prefix\",\n * concurrencyPolicy: { maxConcurrentExecutions: 3 },\n * }),\n * }));\n *\n * // In a workflow job function:\n * await tailor.workflow.startJobFunction(\"worker\", args, {\n * executionPolicyKey: executionPolicies.premium.key,\n * });\n * await tailor.workflow.startJobFunction(\"worker\", args, {\n * executionPolicyKey: executionPolicies[\"tenant-api\"].keyFor(input.tenantId),\n * });\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function defineWorkflowExecutionPolicies<T extends Record<string, ExecutionPolicyInstance>>(\n builder: (\n define: <const D extends ExecutionPolicyDefInput | undefined = undefined>(\n def?: D,\n ) => ResolvedExecutionPolicyInstance<ResolveKey<D, string>, ResolveMatchType<D>>,\n ) => T,\n options?: ExecutionPolicyGroupOptions,\n): T {\n const separator = options?.separator ?? \".\";\n const nameSetters = new Map<ExecutionPolicyInstance, (name: string) => void>();\n const keySetters = new Map<ExecutionPolicyInstance, (key: string) => void>();\n\n const define = <const D extends ExecutionPolicyDefInput | undefined = undefined>(\n def?: D,\n ): ResolvedExecutionPolicyInstance<ResolveKey<D, string>, ResolveMatchType<D>> => {\n const explicitName = def?.name;\n const explicitKey = def?.key;\n const { instance, setName, setKey } = createExecutionPolicyInstance(\n explicitName ?? \"__pending__\",\n explicitKey ?? explicitName ?? \"__pending__\",\n def?.concurrencyPolicy,\n def?.matchType ?? \"exact\",\n separator,\n explicitName === undefined,\n // Only fall back to the property name when neither `name` nor `key`\n // was given — an explicit `name` already resolved `key` above and\n // must not be overwritten by the property name.\n explicitKey === undefined && explicitName === undefined,\n );\n if (setName) nameSetters.set(instance, setName);\n if (setKey) keySetters.set(instance, setKey);\n return instance as ResolvedExecutionPolicyInstance<ResolveKey<D, string>, ResolveMatchType<D>>;\n };\n\n const result = builder(define);\n\n for (const propName of Object.keys(result)) {\n const instance = result[propName] as ExecutionPolicyInstance;\n nameSetters.get(instance)?.(propName);\n keySetters.get(instance)?.(propName);\n }\n\n return result;\n}\n","import { brandValue } from \"#/utils/brand\";\nimport { dispatchStartJob, registerJob, type RegisteredJobBody } from \"./registry\";\nimport { withWorkflowTestInvoker } from \"./test-env-key\";\nimport type { TailorEnv, TailorPrincipal } from \"#/runtime/types\";\nimport type { StartJobFunctionOptions } from \"#/runtime/workflow\";\nimport type { JsonCompatible, TypeLevelError } from \"#/types/helpers\";\n\n/**\n * Context object passed as the second argument to workflow job body functions.\n */\nexport type WorkflowJobContext = {\n env: TailorEnv;\n invoker: TailorPrincipal | null;\n};\n\n/**\n * The body function type for a workflow job.\n * Resolves to the callable signature when `I` / `O` are JsonValue-compatible,\n * or to a type-level error that surfaces at the `body:` property.\n */\ntype JobBody<I, O> = [null] extends [I]\n ? TypeLevelError<\"Input cannot be null at the top level\">\n : [I] extends [undefined]\n ? [O] extends [JsonCompatible<O> | undefined | void]\n ? (input: I, context: WorkflowJobContext) => O | Promise<O>\n : TypeLevelError<\"Output must be JsonValue-compatible (plain objects/arrays; no class instances or functions)\">\n : [undefined] extends [I]\n ? TypeLevelError<\"Input cannot include undefined at the top level\">\n : [I] extends [JsonCompatible<I>]\n ? [O] extends [JsonCompatible<O> | undefined | void]\n ? (input: I, context: WorkflowJobContext) => O | Promise<O>\n : TypeLevelError<\"Output must be JsonValue-compatible (plain objects/arrays; no class instances or functions)\">\n : TypeLevelError<\"Input must be JsonValue-compatible (plain objects/arrays; no class instances or functions)\">;\n\n/**\n * WorkflowJob represents a job that can be started from a workflow.\n *\n * Type constraints:\n * - Input: Must be JsonValue-compatible (plain objects/arrays; no class instances or functions) or undefined.\n * - Output: Must be JsonValue-compatible (plain objects/arrays; no class instances or functions), undefined, or void.\n * - Start returns `Awaited<Output>` as-is (no Promise or Jsonify transformation).\n */\nexport interface WorkflowJob<Name extends string = string, Input = undefined, Output = undefined> {\n name: Name;\n /**\n * Start this job with the given input and return the job's output value.\n * Accepts an optional second argument to pass `executionPolicyKey` for\n * platform-side concurrency enforcement.\n * @example\n * body: async (input) => {\n * const a = jobA.start({ id: input.id });\n * const b = jobB.start({ id: input.id }, {\n * executionPolicyKey: `tenant-api.${input.tenantId}`,\n * });\n * return { a, b };\n * }\n */\n start: [Input] extends [undefined]\n ? (input?: undefined, options?: StartJobFunctionOptions) => Awaited<Output>\n : (input: Input, options?: StartJobFunctionOptions) => Awaited<Output>;\n body: (input: Input, context: WorkflowJobContext) => Output | Promise<Output>;\n}\n\ninterface CreateWorkflowJobConfig<Name extends string, I, O> {\n readonly name: Name;\n readonly body: JobBody<I, O>;\n}\n\n/**\n * Create a workflow job definition.\n *\n * All jobs must be named exports from the workflow file.\n * Job names must be unique across the entire project.\n *\n * Input and output must be JsonValue-compatible (primitives, plain objects, arrays).\n * Functions and objects with a `toJSON` method are rejected at the type level;\n * class instances exposing methods are rejected via the property walk.\n * @param config - Job configuration with name and body function.\n * @param config.name - Unique job name across the project.\n * @param config.body - Function that processes the job input.\n * @returns A WorkflowJob that can be started from other jobs.\n * @example\n * // Simple job with async body:\n * export const fetchData = createWorkflowJob({\n * name: \"fetch-data\",\n * body: async (input: { id: string }) => {\n * const db = getDB(\"tailordb\");\n * return await db.selectFrom(\"Table\").selectAll().where(\"id\", \"=\", input.id).executeTakeFirst();\n * },\n * });\n * @example\n * // Orchestrator job that fans out to other jobs.\n * export const orchestrate = createWorkflowJob({\n * name: \"orchestrate\",\n * body: (input: { orderId: string }) => {\n * const inventory = checkInventory.start({ orderId: input.orderId });\n * const payment = processPayment.start({ orderId: input.orderId });\n * return { inventory, payment };\n * },\n * });\n */\nexport function createWorkflowJob<const Name extends string, I = undefined, O = undefined>(\n config: CreateWorkflowJobConfig<Name, I, O>,\n): WorkflowJob<Name, I, Awaited<O>> {\n const userBody = config.body as (input: I, context: WorkflowJobContext) => O | Promise<O>;\n const body = process.env.__TAILOR_PLATFORM_BUNDLE\n ? userBody\n : (input: I, context: WorkflowJobContext): O | Promise<O> =>\n withWorkflowTestInvoker(context.invoker, () => userBody(input, context));\n\n // Test-only local runner registry; the platform bundle sets the flag so it is DCE'd.\n if (!process.env.__TAILOR_PLATFORM_BUNDLE) {\n registerJob(config.name, body as RegisteredJobBody);\n }\n\n const start = process.env.__TAILOR_PLATFORM_BUNDLE\n ? () => {\n throw new Error(\n \"This workflow job's .start() is rewritten at build time and is unavailable in the bundle\",\n );\n }\n : // Preserve arity: use `arguments.length` (regular function, not arrow) so\n // `.start(args, undefined)` is treated as \"options passed\" — matching\n // the bundler rewrite, which forwards the literal `undefined` from the\n // AST as a third argument. Without this, local execution and bundled\n // workflows would hand mocks different call shapes.\n function start(args?: unknown, options?: StartJobFunctionOptions) {\n // oxlint-disable-next-line prefer-rest-params\n return (\n arguments.length >= 2\n ? dispatchStartJob(config.name, args, options)\n : dispatchStartJob(config.name, args)\n ) as Awaited<O>;\n };\n\n return brandValue(\n { name: config.name, start, body } as WorkflowJob<Name, I, Awaited<O>>,\n \"workflow-job\",\n );\n}\n","import { brandValue } from \"#/utils/brand\";\nimport type { PlatformWorkflowAPI } from \"#/runtime/workflow\";\nimport type { JsonCompatible, TypeLevelError } from \"#/types/helpers\";\n\n/**\n * A single wait point instance with typed `.wait()` and `.resolve()` methods.\n *\n * - `.wait(payload?)` suspends execution until resolved. Returns the result from `.resolve()`.\n * - `.resolve(executionId, callback)` resumes a suspended execution.\n *\n * Both `Payload` and `Result` must be JsonValue-compatible (primitives, plain objects, arrays).\n * Functions and objects with a `toJSON` method are rejected at the type level.\n */\nexport interface WaitPointInstance<Payload = undefined, Result = undefined> {\n wait: [Payload] extends [undefined]\n ? () => Promise<Result>\n : (payload: Payload) => Promise<Result>;\n resolve: (\n executionId: string,\n callback: (\n payload: [Payload] extends [undefined] ? undefined : Payload,\n ) => Result | Promise<Result>,\n ) => Promise<void>;\n}\n\ninterface InternalWaitPointInstance {\n wait: (payload?: unknown) => Promise<unknown>;\n resolve: (\n executionId: string,\n callback: (payload: unknown) => unknown | Promise<unknown>,\n ) => Promise<void>;\n}\n\ninterface WaitPointWithSetter {\n instance: InternalWaitPointInstance;\n setKey: (key: string) => void;\n}\n\nfunction getPlatformWorkflow() {\n const platform = globalThis as { tailor?: { workflow?: PlatformWorkflowAPI } };\n const workflow = platform.tailor?.workflow;\n if (!workflow) {\n throw new Error(\n \"tailor.workflow is not available. Run tests in the `tailor-runtime` Vitest environment, \" +\n \"or acquire mockWorkflow() from @tailor-platform/sdk/vitest and set a wait/resolve handler.\",\n );\n }\n return workflow;\n}\n\n/**\n * Create a WaitPointInstance that delegates to the platform runtime.\n * Use `mockWorkflow` from `@tailor-platform/sdk/vitest` to mock\n * `globalThis.tailor.workflow.wait/resolve` in tests.\n * @param initialKey - Initial key (can be updated via the returned setter)\n * @returns The instance and a setter to update the key after construction\n */\nfunction createWaitPointInstance(initialKey: string): WaitPointWithSetter {\n let key = initialKey;\n\n const instance = brandValue(\n {\n wait(payload?: unknown) {\n return Promise.resolve(getPlatformWorkflow().wait(key, payload));\n },\n async resolve(executionId: string, callback: (p: unknown) => unknown | Promise<unknown>) {\n await getPlatformWorkflow().resolve(executionId, key, callback);\n },\n },\n \"wait-point\",\n ) as InternalWaitPointInstance;\n\n return {\n instance,\n setKey: (k: string) => {\n key = k;\n },\n };\n}\n\n/**\n * The type produced by `define<Payload, Result>()` / `createWaitPoint<Payload, Result>(key)`.\n * Resolves to `WaitPointInstance<Payload, Result>` when both types are JsonValue-compatible,\n * or to a type-level error that surfaces at the call site.\n */\ntype WaitPointDef<Payload, Result> = [null] extends [Payload]\n ? TypeLevelError<\"Payload cannot be null at the top level\">\n : [undefined] extends [Result]\n ? TypeLevelError<\"Result cannot be (or include) undefined (resolve callback must return a value)\">\n : [Payload] extends [undefined]\n ? [Result] extends [JsonCompatible<Result>]\n ? WaitPointInstance<Payload, Result>\n : TypeLevelError<\"Result must be JsonValue-compatible (plain objects/arrays; no class instances or functions)\">\n : [undefined] extends [Payload]\n ? TypeLevelError<\"Payload cannot include undefined at the top level\">\n : [Payload] extends [JsonCompatible<Payload>]\n ? [Result] extends [JsonCompatible<Result>]\n ? WaitPointInstance<Payload, Result>\n : TypeLevelError<\"Result must be JsonValue-compatible (plain objects/arrays; no class instances or functions)\">\n : TypeLevelError<\"Payload must be JsonValue-compatible (plain objects/arrays; no class instances or functions)\">;\n\n/**\n * The `define` function passed to the `createWaitPoints` builder callback.\n * Returns an actual WaitPointInstance (not a phantom marker) so that the\n * builder's return type can flow through as-is, preserving JSDoc comments\n * on each property for IDE autocompletion.\n *\n * JSON validation is encoded in the return type rather than in type-parameter\n * constraints, because tsgo rejects self-referential constraints like\n * `Payload extends JsonCompatible<Payload>` as circular.\n */\ntype DefineFn = <Payload = undefined, Result = undefined>() => WaitPointDef<Payload, Result>;\n\n/**\n * Create a single typed wait point with an explicit key.\n *\n * `Payload` and `Result` must be JsonValue-compatible.\n * Functions and objects with a `toJSON` method are rejected at the type level;\n * class instances exposing methods are rejected via the property walk.\n * @param key - The wait point key used to match wait and resolve calls\n * @returns A WaitPointInstance with typed `.wait()` and `.resolve()` methods\n * @example\n * export const approval = createWaitPoint<{ message: string }, { approved: boolean }>(\"approval\");\n *\n * await approval.wait({ message: \"Please approve\" });\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function createWaitPoint<Payload = undefined, Result = undefined>(\n key: string,\n): WaitPointDef<Payload, Result> {\n return createWaitPointInstance(key).instance as unknown as WaitPointDef<Payload, Result>;\n}\n\n/**\n * Create a group of typed wait points for human-in-the-loop workflows.\n * Property names become the wait point keys.\n *\n * The return type is the same as the builder's return type, so JSDoc on each\n * property is preserved and visible in IDE autocompletion.\n *\n * `Payload` and `Result` must be JsonValue-compatible.\n * Functions and objects with a `toJSON` method are rejected at the type level;\n * class instances exposing methods are rejected via the property walk.\n * @param builder - Callback that receives a `define` factory and returns an object of wait points\n * @returns The same object returned by the builder (with correct keys set on each instance)\n * @example\n * export const waitPoints = createWaitPoints(define => ({\n * // Preceding JSDoc on this property is shown in IDE autocompletion\n * approval: define<{ message: string }, { approved: boolean }>(),\n * }));\n *\n * // IDE shows the JSDoc when typing `waitPoints.`\n * await waitPoints.approval.wait({ message: \"Please approve\" });\n *\n * // For 2-level access, use destructured export with JSDoc attached to the export itself.\n */\n/* @__NO_SIDE_EFFECTS__ */\n// oxlint-disable-next-line no-explicit-any\nexport function createWaitPoints<T extends Record<string, WaitPointInstance<any, any>>>(\n builder: (define: DefineFn) => T,\n): T {\n const setters = new Map<InternalWaitPointInstance, (key: string) => void>();\n\n const define = (<Payload, Result>() => {\n const { instance, setKey } = createWaitPointInstance(\"__pending__\");\n setters.set(instance, setKey);\n return instance as unknown as WaitPointDef<Payload, Result>;\n }) as DefineFn;\n\n const result = builder(define);\n\n // Set the correct key on each instance based on the property name\n for (const key of Object.keys(result)) {\n const setter = setters.get(result[key] as unknown as InternalWaitPointInstance);\n setter?.(key);\n }\n\n return result;\n}\n","/* oxlint-disable typescript/no-explicit-any */\nimport { brandValue } from \"#/utils/brand\";\nimport { dispatchStartWorkflow } from \"./registry\";\nimport type { MachineUserName } from \"#/configure/types/machine-user\";\nimport type { ConcurrencyPolicy, RetryPolicy } from \"#/types/workflow.generated\";\nimport type { WorkflowJob } from \"./job\";\n\nexport type { ConcurrencyPolicy, RetryPolicy };\n\nexport interface WorkflowConfig<\n Job extends WorkflowJob<any, any, any> = WorkflowJob<any, any, any>,\n> {\n name: string;\n mainJob: Job;\n retryPolicy?: RetryPolicy;\n concurrencyPolicy?: ConcurrencyPolicy;\n}\n\nexport interface Workflow<Job extends WorkflowJob<any, any, any> = WorkflowJob<any, any, any>> {\n name: string;\n mainJob: Job;\n retryPolicy?: RetryPolicy;\n concurrencyPolicy?: ConcurrencyPolicy;\n start: [Parameters<Job[\"start\"]>[0]] extends [undefined]\n ? (args?: undefined, options?: { invoker: MachineUserName }) => Promise<string>\n : (\n args: Parameters<Job[\"start\"]>[0],\n options?: { invoker: MachineUserName },\n ) => Promise<string>;\n}\n\ninterface WorkflowDefinition<Job extends WorkflowJob<any, any, any>> {\n name: string;\n mainJob: Job;\n retryPolicy?: RetryPolicy;\n concurrencyPolicy?: ConcurrencyPolicy;\n}\n\n/**\n * Create a workflow definition that can be started via the Tailor SDK.\n * In production, the bundler rewrites `.start()` calls into direct platform workflow calls.\n *\n * The workflow MUST be the default export of the file.\n * All jobs referenced by the workflow MUST be named exports.\n * @template Job\n * @param config - Workflow configuration\n * @returns Defined workflow\n * @example\n * export const fetchData = createWorkflowJob({ name: \"fetch-data\", body: async (input: { id: string }) => ({ id: input.id }) });\n * export const processData = createWorkflowJob({\n * name: \"process-data\",\n * body: (input: { id: string }) => {\n * const data = fetchData.start({ id: input.id });\n * return { data };\n * },\n * });\n *\n * // Workflow must be default export; mainJob is the entry point\n * export default createWorkflow({\n * name: \"data-processing\",\n * mainJob: processData,\n * });\n */\nexport function createWorkflow<Job extends WorkflowJob<any, any, any>>(\n config: WorkflowDefinition<Job>,\n): Workflow<Job> {\n return brandValue(\n {\n ...config,\n start: process.env.__TAILOR_PLATFORM_BUNDLE\n ? async () => {\n throw new Error(\n \"workflow.start() is rewritten at build time and unavailable in the bundle\",\n );\n }\n : // Preserve arity: use `arguments.length` (regular function, not arrow) so\n // `.start(args, undefined)` is treated as \"options passed\" — matching\n // the bundler rewrite, which forwards the literal `undefined` from the\n // AST as a third argument. Without this, local execution and bundled\n // workflows would hand mocks different call shapes.\n async function start(\n args: Parameters<Job[\"start\"]>[0],\n options?: { invoker: MachineUserName },\n ) {\n // oxlint-disable-next-line prefer-rest-params\n return arguments.length >= 2\n ? await dispatchStartWorkflow(config.name, args, options)\n : await dispatchStartWorkflow(config.name, args);\n },\n } as Workflow<Job>,\n \"workflow\",\n );\n}\n","import type { StaticWebsiteDefinitionBrand } from \"#/configure/services/staticwebsite/types\";\nimport type { StaticWebsiteInput } from \"#/types/staticwebsite.generated\";\nexport type { StaticWebsiteConfig } from \"#/configure/services/staticwebsite/types\";\n\n/**\n * Define a static website configuration for the Tailor SDK.\n * @param name - Static website name\n * @param config - Static website configuration\n * @returns Defined static website\n */\n/* @__NO_SIDE_EFFECTS__ */\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","import type { AIGatewayInput } from \"#/types/aigateway.generated\";\nimport type { AIGatewayDefinitionBrand } from \"./types\";\nexport type { AIGatewayConfig } from \"./types\";\n\n/**\n * Define an AI Gateway configuration for the Tailor SDK.\n * @param name - AI Gateway name\n * @param config - AI Gateway configuration\n * @returns Defined AI Gateway\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function defineAIGateway(name: string, config: Omit<AIGatewayInput, \"name\">) {\n const result = {\n ...config,\n name,\n } as const satisfies AIGatewayInput;\n\n return result as typeof result & AIGatewayDefinitionBrand;\n}\n","import type { IdPUserField } from \"#/parser/service/idp/types\";\nimport type { InferredAttributes } from \"#/runtime/types\";\n\ntype EqualityOperator = \"=\" | \"!=\";\ntype ContainsOperator = \"in\" | \"not in\";\n\n// `-?` keeps the indexed access from folding optional fields' `never` into\n// `undefined`; `Exclude` lets an optional field's value type still match.\ntype StringFieldKeys<User extends object> = {\n [K in keyof User]-?: Exclude<User[K], undefined> extends string ? K : never;\n}[keyof User];\n\ntype StringArrayFieldKeys<User extends object> = {\n [K in keyof User]-?: Exclude<User[K], undefined> extends string[] ? K : never;\n}[keyof User];\n\ntype BooleanFieldKeys<User extends object> = {\n [K in keyof User]-?: Exclude<User[K], undefined> extends boolean ? K : never;\n}[keyof User];\n\ntype BooleanArrayFieldKeys<User extends object> = {\n [K in keyof User]-?: Exclude<User[K], undefined> extends boolean[] ? K : never;\n}[keyof User];\n\ntype UserStringOperand<User extends object = InferredAttributes> = {\n user: StringFieldKeys<User> | \"id\";\n};\n\ntype UserStringArrayOperand<User extends object = InferredAttributes> = {\n user: StringArrayFieldKeys<User>;\n};\n\ntype UserBooleanOperand<User extends object = InferredAttributes> = {\n user: BooleanFieldKeys<User> | \"_loggedIn\";\n};\n\ntype UserBooleanArrayOperand<User extends object = InferredAttributes> = {\n user: BooleanArrayFieldKeys<User>;\n};\n\ntype IdPUserOperand<Update extends boolean = false> = Update extends true\n ? { oldIdpUser: IdPUserField } | { newIdpUser: IdPUserField }\n : { idpUser: IdPUserField };\n\ntype StringEqualityCondition<User extends object, Update extends boolean> =\n | readonly [string, EqualityOperator, string]\n | readonly [UserStringOperand<User>, EqualityOperator, string]\n | readonly [string, EqualityOperator, UserStringOperand<User>]\n | readonly [\n IdPUserOperand<Update>,\n EqualityOperator,\n string | UserStringOperand<User> | IdPUserOperand<Update>,\n ]\n | readonly [string | UserStringOperand<User>, EqualityOperator, IdPUserOperand<Update>];\n\ntype BooleanEqualityCondition<User extends object, Update extends boolean> =\n | readonly [boolean, EqualityOperator, boolean]\n | readonly [UserBooleanOperand<User>, EqualityOperator, boolean]\n | readonly [boolean, EqualityOperator, UserBooleanOperand<User>]\n | readonly [\n IdPUserOperand<Update>,\n EqualityOperator,\n boolean | UserBooleanOperand<User> | IdPUserOperand<Update>,\n ]\n | readonly [boolean | UserBooleanOperand<User>, EqualityOperator, IdPUserOperand<Update>];\n\ntype EqualityCondition<\n User extends object = InferredAttributes,\n Update extends boolean = boolean,\n> = StringEqualityCondition<User, Update> | BooleanEqualityCondition<User, Update>;\n\ntype StringContainsCondition<User extends object, Update extends boolean> =\n | readonly [string, ContainsOperator, string[]]\n | readonly [UserStringOperand<User>, ContainsOperator, string[]]\n | readonly [string, ContainsOperator, UserStringArrayOperand<User>]\n | readonly [IdPUserOperand<Update>, ContainsOperator, string[] | UserStringArrayOperand<User>];\n\ntype BooleanContainsCondition<User extends object, Update extends boolean> =\n | readonly [boolean, ContainsOperator, boolean[]]\n | readonly [UserBooleanOperand<User>, ContainsOperator, boolean[]]\n | readonly [boolean, ContainsOperator, UserBooleanArrayOperand<User>]\n | readonly [IdPUserOperand<Update>, ContainsOperator, boolean[] | UserBooleanArrayOperand<User>];\n\ntype ContainsCondition<\n User extends object = InferredAttributes,\n Update extends boolean = boolean,\n> = StringContainsCondition<User, Update> | BooleanContainsCondition<User, Update>;\n\nexport type IdPPermissionCondition<\n User extends object = InferredAttributes,\n Update extends boolean = boolean,\n> = EqualityCondition<User, Update> | ContainsCondition<User, Update>;\n\ntype IdPActionPermission<\n User extends object = InferredAttributes,\n Update extends boolean = boolean,\n> =\n | {\n conditions:\n | IdPPermissionCondition<User, Update>\n | readonly IdPPermissionCondition<User, Update>[];\n description?: string | undefined;\n /**\n * Whether matching users are granted (`true`) or denied (`false`).\n * Omitting `permit` in this object form defaults to `deny` and emits a\n * warning; set it explicitly. (The array shorthand defaults to `allow`.)\n */\n permit?: boolean;\n }\n | readonly [...IdPPermissionCondition<User, Update>, ...([] | [boolean])]\n | readonly [...IdPPermissionCondition<User, Update>[], ...([] | [boolean])];\n\n/**\n * Per-operation permission policies for an IdP service.\n * Defines create, read, update, delete, sendPasswordResetEmail, and\n * unenrollMfa permissions.\n *\n * For update operations, use `newIdpUser`/`oldIdpUser` operands instead of `idpUser`.\n * @example\n * const permission: IdPPermission = {\n * create: [{ conditions: [[{ user: \"role\" }, \"=\", \"ADMIN\"]], permit: true }],\n * read: [{ conditions: [[{ user: \"_loggedIn\" }, \"=\", true]], permit: true }],\n * update: [{ conditions: [[{ newIdpUser: \"name\" }, \"=\", { user: \"id\" }]], permit: true }],\n * delete: [{ conditions: [[{ user: \"role\" }, \"=\", \"ADMIN\"]], permit: true }],\n * sendPasswordResetEmail: [{ conditions: [], permit: true }],\n * unenrollMfa: [{ conditions: [[{ user: \"role\" }, \"=\", \"ADMIN\"]], permit: true }],\n * };\n */\nexport type IdPPermission<User extends object = InferredAttributes> = {\n create: readonly IdPActionPermission<User, false>[];\n read: readonly IdPActionPermission<User, false>[];\n update: readonly IdPActionPermission<User, true>[];\n delete: readonly IdPActionPermission<User, false>[];\n sendPasswordResetEmail?: readonly IdPActionPermission<User, false>[];\n unenrollMfa?: readonly IdPActionPermission<User, false>[];\n};\n\n/**\n * Grants full IdP permission 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 unsafeAllowAllIdPPermission: IdPPermission = {\n create: [{ conditions: [], permit: true }],\n read: [{ conditions: [], permit: true }],\n update: [{ conditions: [], permit: true }],\n delete: [{ conditions: [], permit: true }],\n sendPasswordResetEmail: [{ conditions: [], permit: true }],\n unenrollMfa: [{ conditions: [], permit: true }],\n};\n","import type { IdpDefinitionBrand } from \"#/configure/services/idp/types\";\nimport type { BuiltinIdP } from \"#/types/auth.generated\";\nimport type { IdPInput } from \"#/types/idp.generated\";\nimport type { IdPPermission } from \"./permission\";\n\nexport type {\n IdPEmailConfig,\n IdPGqlOperations,\n IdPGqlOperationsInput as IdPGqlOperationsConfig,\n} from \"#/types/idp.generated\";\n\n/**\n * Define an IdP service configuration for the Tailor SDK.\n * @template TClients\n * @param name - IdP service name\n * @param config - IdP configuration\n * @returns Defined IdP service\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function defineIdp<const TClients extends string[]>(\n name: string,\n config: Omit<IdPInput, \"name\" | \"clients\" | \"permission\"> & {\n clients: TClients;\n permission?: IdPPermission;\n },\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 { IdPConfig, IdPExternalConfig } from \"#/configure/services/idp/types\";\n\nexport type { IdPPermission, IdPPermissionCondition } from \"./permission\";\nexport { unsafeAllowAllIdPPermission } from \"./permission\";\n","import type { SecretsDefinitionBrand } from \"#/configure/services/secrets/types\";\nexport type { SecretsConfig } from \"#/configure/services/secrets/types\";\n\ntype SecretsVaultInput = Record<string, string>;\ntype SecretsVaultInputNullish = Record<string, string | undefined | null>;\ntype SecretsInput = Record<string, SecretsVaultInput>;\ntype SecretsInputNullish = Record<string, SecretsVaultInputNullish>;\n\ntype SecretsOptions = {\n readonly ignoreNullishValues: boolean;\n};\n\ntype DefinedSecrets<T extends SecretsInputNullish> = {\n readonly vaults: T;\n readonly options: SecretsOptions;\n get<V extends Extract<keyof T, string>, S extends Extract<keyof T[V], string>>(\n vault: V,\n secret: S,\n ): Promise<string | undefined>;\n getAll<V extends Extract<keyof T, string>, S extends Extract<keyof T[V], string>>(\n vault: V,\n secrets: readonly S[],\n ): Promise<(string | undefined)[]>;\n} & SecretsDefinitionBrand;\n\n/**\n * Define secrets configuration for the Tailor SDK.\n * Each key is a vault name, and its value is a record of secret name to secret value.\n * @param config - Secrets configuration mapping vault names to their secrets\n * @returns Defined secrets with typed runtime access methods\n */\nexport function defineSecretManager<const T extends SecretsInput>(config: T): DefinedSecrets<T>;\n/**\n * Define secrets configuration for the Tailor SDK with ignoreNullishValues option.\n * When `ignoreNullishValues` is true, secrets with nullish values are skipped during deploy\n * instead of causing an error. This is useful for CI environments where not all\n * secret values are available.\n * @param config - Secrets configuration mapping vault names to their secrets\n * @param options - Options for secret management behavior\n * @param options.ignoreNullishValues - When true, secrets with nullish values are skipped during deploy\n * @returns Defined secrets with typed runtime access methods\n */\nexport function defineSecretManager<const T extends SecretsInputNullish>(\n config: T,\n options: { ignoreNullishValues: true },\n): DefinedSecrets<T>;\n/* @__NO_SIDE_EFFECTS__ */\nexport function defineSecretManager<const T extends SecretsInputNullish>(\n config: T,\n options?: { ignoreNullishValues?: boolean },\n): DefinedSecrets<T> {\n const result: Record<string, unknown> = {\n vaults: config,\n options: { ignoreNullishValues: options?.ignoreNullishValues ?? false },\n };\n\n // Non-enumerable so Zod's z.object validation ignores them\n Object.defineProperty(result, \"get\", {\n value: async (vault: string, secret: string) => {\n return tailor.secretmanager.getSecret(vault, secret);\n },\n enumerable: false,\n });\n Object.defineProperty(result, \"getAll\", {\n value: async (vault: string, secrets: readonly string[]) => {\n const record = await tailor.secretmanager.getSecrets(vault, secrets);\n return secrets.map((s) => record[s]);\n },\n enumerable: false,\n });\n\n return result as DefinedSecrets<T>;\n}\n","import { brandValue } from \"#/utils/brand\";\nimport type { HttpAdapterConfigInput } from \"#/types/http-adapter.generated\";\nimport type { DocumentNode } from \"graphql\";\n\n/**\n * Lowercase HTTP method keys accepted in `input`, derived from the config\n * schema via the generated type so they cannot drift.\n */\ntype HttpMethodKey = keyof Required<HttpAdapterConfigInput[\"input\"]>;\n\n/** Incoming HTTP request passed to an `input` handler. */\nexport type HttpAdapterRequest = {\n method: Uppercase<HttpMethodKey>;\n path: string;\n headers: Record<string, string>;\n query: Record<string, string>;\n body: string;\n};\n\n/** GraphQL request returned by an `input` handler. */\nexport type HttpAdapterGraphQLRequest<Query extends HttpAdapterGraphQLQuery = string> = {\n query: Query;\n operationName?: string;\n} & HttpAdapterGraphQLRequestVariables<Query>;\n\n/**\n * Typed GraphQL document accepted by an HTTP adapter input handler.\n * Compatible with generated `TypedDocumentNode` values.\n */\nexport type HttpAdapterTypedDocumentNode<\n TResult = unknown,\n TVariables = Record<string, unknown>,\n> = DocumentNode & {\n __apiType?: (variables: TVariables) => TResult;\n __ensureTypesOfVariablesAndResultMatching?: (variables: TVariables) => TResult;\n};\n\n/** GraphQL query value accepted by an HTTP adapter input handler. */\nexport type HttpAdapterGraphQLQuery = string | DocumentNode;\n\ntype HttpAdapterGraphQLData<Query> =\n Query extends HttpAdapterTypedDocumentNode<infer Result, infer _Variables> ? Result : unknown;\n\ntype HttpAdapterGraphQLVariables<Query> =\n Query extends HttpAdapterTypedDocumentNode<infer _Result, infer Variables>\n ? Variables\n : Record<string, unknown>;\n\ntype HttpAdapterHasRequiredVariables<T> = [T] extends [never]\n ? false\n : T extends object\n ? Record<never, never> extends T\n ? false\n : true\n : false;\n\ntype HttpAdapterGraphQLRequestVariables<Query> =\n true extends HttpAdapterHasRequiredVariables<HttpAdapterGraphQLVariables<Query>>\n ? { variables: HttpAdapterGraphQLVariables<Query> }\n : { variables?: HttpAdapterGraphQLVariables<Query> };\n\n/**\n * Converts an incoming HTTP request into a GraphQL request.\n * Pass a typed document type as `Query` when annotating extracted handlers.\n */\nexport type HttpAdapterInputFn<Query extends HttpAdapterGraphQLQuery = string> = (\n req: HttpAdapterRequest,\n) => HttpAdapterGraphQLRequest<Query>;\n\n/** GraphQL execution result passed to the `output` handler. */\nexport type HttpAdapterGraphQLResponse<Data = unknown> = {\n data?: Data | null;\n errors?: unknown;\n extensions?: unknown;\n};\n\n/** HTTP response returned by the `output` handler. */\nexport type HttpAdapterResponse = {\n statusCode?: number;\n headers?: Record<string, string>;\n body: string;\n};\n\n/** Converts a GraphQL response into an HTTP response. */\nexport type HttpAdapterOutputFn<Data = unknown> = (\n resp: HttpAdapterGraphQLResponse<Data>,\n) => HttpAdapterResponse;\n\n/**\n * Per-method input handlers. At least one method must be provided.\n * Each handler transforms an HTTP request into a GraphQL request.\n */\nexport type HttpAdapterInput = Partial<\n Record<HttpMethodKey, HttpAdapterInputFn<HttpAdapterGraphQLQuery>>\n>;\n\ntype HttpAdapterInputHandlerData<Handler> = Handler extends (\n req: HttpAdapterRequest,\n) => infer Request\n ? Request extends { query: infer Query }\n ? HttpAdapterGraphQLData<Query>\n : unknown\n : never;\n\ntype HttpAdapterInputData<Input extends HttpAdapterInput> = [\n HttpAdapterInputHandlerData<Input[keyof Input]>,\n] extends [never]\n ? unknown\n : HttpAdapterInputHandlerData<Input[keyof Input]>;\n\ntype HttpAdapterValidatedRequest<Request> = Request extends {\n query: infer Query extends HttpAdapterGraphQLQuery;\n}\n ? Request & HttpAdapterGraphQLRequest<Query>\n : never;\n\ntype HttpAdapterValidatedInput<Input extends HttpAdapterInput> = {\n [Method in keyof Input]: Input[Method] extends (req: HttpAdapterRequest) => infer Request\n ? (req: HttpAdapterRequest) => HttpAdapterValidatedRequest<Request>\n : Input[Method];\n};\n\n/**\n * HTTP adapter configuration accepted by `createHttpAdapter` with typed\n * `input` and `output` signatures.\n */\n// Internally, the parser-side representation is the looser `HttpAdapterConfig`\n// from `@/types/http-adapter.generated`, where the function fields are typed\n// as `Function`.\nexport type HttpAdapter<Input extends HttpAdapterInput = HttpAdapterInput> = Omit<\n HttpAdapterConfigInput,\n \"input\" | \"output\"\n> & {\n input: Input & HttpAdapterValidatedInput<Input>;\n output?: HttpAdapterOutputFn<HttpAdapterInputData<Input>>;\n};\n\n/**\n * Defines an HTTP adapter that translates HTTP requests to GraphQL queries\n * and shapes the GraphQL response back into an HTTP response.\n *\n * The adapter MUST be the default export of its file.\n * Files are discovered via the `httpAdapter.files` glob in `defineConfig()`.\n *\n * `input` is an object keyed by lowercase HTTP method (`get`, `post`, `put`,\n * `patch`, `delete`). Each handler can return a GraphQL query string or a\n * typed document node. At least one method must be declared; the methods the\n * adapter serves are derived from these keys.\n *\n * `output` is optional and shared across all methods. If `input` returns typed\n * document nodes, `output` receives the corresponding result type as\n * `resp.data`. If you need different response shapes per method, discriminate\n * inside `output` based on the GraphQL response shape.\n *\n * Each handler runs server-side and must be synchronous: Node APIs, `fetch`,\n * `async`/`await`, Promises, and top-level `await` are not available.\n *\n * Optional fields: `enabled` (default `true`; set `false` to deploy the adapter\n * without serving it) and `priority` (non-negative integer, default `0`; when\n * multiple adapters match the same request path, the lowest value wins).\n * @param config - HTTP adapter configuration\n * @returns Branded HTTP adapter definition\n * @example\n * export default createHttpAdapter({\n * name: \"get-user\",\n * pathPattern: \"/users/*\",\n * input: {\n * get: (req) => ({\n * query: `query($id: ID!) { user(id: $id) { id name } }`,\n * variables: { id: req.path.split(\"/\")[2] },\n * }),\n * },\n * output: (resp) => ({\n * statusCode: 200,\n * headers: { \"content-type\": \"application/json\" },\n * body: JSON.stringify(resp.data),\n * }),\n * });\n */\nexport function createHttpAdapter<const Input extends HttpAdapterInput>(\n config: HttpAdapter<Input>,\n): HttpAdapter<Input> {\n return brandValue({ ...config }, \"http-adapter\");\n}\n","import type { AppConfig } from \"#/configure/config/types\";\nimport type { Plugin } from \"#/plugin/types\";\n\n/**\n * Define a Tailor SDK application configuration with shallow exactness.\n * @template Config\n * @param config - Application configuration\n * @returns The same configuration object\n */\n/* @__NO_SIDE_EFFECTS__ */\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\n/**\n * Define plugins to be used with the Tailor SDK.\n * Plugins can generate additional types, resolvers, and executors\n * based on existing TailorDB types.\n * @param configs - Plugin configurations\n * @returns Plugin configurations as given\n */\n/* @__NO_SIDE_EFFECTS__ */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function definePlugins(...configs: Plugin<any, any>[]) {\n return configs;\n}\n","import { t as _t } from \"#/configure/types/index\";\nimport type * as helperTypes from \"#/types/helpers\";\n\ntype TailorOutput<T> = helperTypes.output<T>;\n\nexport type infer<T> = TailorOutput<T>;\nexport type output<T> = TailorOutput<T>;\n\n/** TailorDB field type builders. */\n// eslint-disable-next-line import-x/export\nexport const t = _t;\n// eslint-disable-next-line @typescript-eslint/no-namespace, import-x/export\nexport namespace t {\n export type output<T> = TailorOutput<T>;\n export type infer<T> = TailorOutput<T>;\n}\n\nexport { type TailorField } from \"#/configure/types/type\";\nexport {\n type TailorPrincipal,\n type Attributes,\n type AttributeList,\n type Env,\n} from \"#/runtime/types\";\nexport { type MachineUserNameRegistry, type MachineUserName } from \"#/configure/types/machine-user\";\nexport { type IdpNameRegistry, type IdpName } from \"#/configure/types/idp-name\";\nexport {\n type ConnectionNameRegistry,\n type ConnectionName,\n} from \"#/configure/types/connection-name\";\nexport { type AIGatewayNameRegistry, type AIGatewayName } from \"#/configure/types/aigateway-name\";\n\nexport * from \"#/configure/services/index\";\n\nexport { defineConfig, definePlugins } from \"#/configure/config/index\";\n\n// Plugin types for custom plugin development\nexport type {\n Plugin,\n PluginConfigs,\n PluginOutput,\n TypePluginOutput,\n NamespacePluginOutput,\n PluginProcessContext,\n PluginNamespaceProcessContext,\n PluginAttachment,\n PluginGeneratedType,\n PluginGeneratedResolver,\n PluginGeneratedExecutor,\n PluginGeneratedExecutorWithFile,\n PluginExecutorContext,\n PluginExecutorContextBase,\n TailorDBTypeForPlugin,\n} from \"#/plugin/types\";\n\n// Generation-time hook context types for plugin development\nexport type {\n TailorDBReadyContext,\n ResolverReadyContext,\n ExecutorReadyContext,\n TailorDBNamespaceData,\n ResolverNamespaceData,\n GeneratorResult,\n} from \"#/plugin/types\";\n"],"mappings":";;;;;;AAqKA,SAAS,kBAKP,MACA,SACA,QACA,QACA,UACQ;CAMR,MAAM,YAA2B,WAC7B;EACE,GAAG;EACH,GAAI,SAAS,iBAAiB,EAC5B,eAAe,SAAS,cAAc,KAAK,OAAO,EAAE,GAAG,EAAE,EAAE,EAC7D;EACA,GAAI,SAAS,YAAY,EACvB,UAAU,SAAS,SAAS,KAAK,MAAO,MAAM,QAAQ,CAAC,IAAK,CAAC,GAAG,CAAC,IAAiB,CAAE,EACtF;CACF,IACA,EAAE,UAAU,KAAK;CAErB,IAAI,CAAC,UAAU;EACb,IAAI,SAAS;GACX,IAAI,QAAQ,aAAa,MACvB,UAAU,WAAW;GAEvB,IAAI,QAAQ,UAAU,MACpB,UAAU,QAAQ;EAEtB;EACA,IAAI,QACF,UAAU,gBAAgB,iBAAiB,MAAM;CAErD;CAEA,SAASA,gBACP,MAC4D;EAC5D,OAAOC,cAAyD;GAC9D,GAAG;GACH;EACF,CAAC;CACH;;;;;;;;CASA,SAAS,UAAU,iBAAyC;EAC1D,MAAM,SAAS,MAAM,MAAM;EAC3B,OAAO,OAAO,OAAO,WAAW,eAAe;EAC/C,OAAO;CACT;CAEA,MAAM,QAKF;EACF;EACA,QAAQ,UAAU,CAAC;EACnB,UAAU;EAIV,SAAS;EACT;EAEA,IAAI,WAAW;GACb,OAAO,EAAE,GAAG,KAAK,UAAU;EAC7B;EAEA,YAAY,aAAqB;GAE/B,OAAO,UAAU,EAAE,YAAY,CAAC;EAClC;EA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zD,aAAa,CAAC;EAAE,YAAY,CAAC;EAAG,QAAQ;CAAK,CAAC;AAChD;;;;;;;;;;;;ACpIA,SAAgB,UACd,MACA,QAIA;CAgBA,OAAO;EAdL,GAAG;EACH;EACA,SAAS,cAAsB,YAA8B;GAC3D,OAAO;IACL,MAAM;IACN,MAAM;IACN,WAAW;IACX;GACF;EACF;CAKU;AACd;;;;;ACKA,SAAgB,oBACd,QACA,SACmB;CACnB,MAAM,SAAkC;EACtC,QAAQ;EACR,SAAS,EAAE,qBAAqB,SAAS,uBAAuB,MAAM;CACxE;CAGA,OAAO,eAAe,QAAQ,OAAO;EACnC,OAAO,OAAO,OAAe,WAAmB;GAC9C,OAAO,OAAO,cAAc,UAAU,OAAO,MAAM;EACrD;EACA,YAAY;CACd,CAAC;CACD,OAAO,eAAe,QAAQ,UAAU;EACtC,OAAO,OAAO,OAAe,YAA+B;GAC1D,MAAM,SAAS,MAAM,OAAO,cAAc,WAAW,OAAO,OAAO;GACnE,OAAO,QAAQ,KAAK,MAAM,OAAO,EAAE;EACrC;EACA,YAAY;CACd,CAAC;CAED,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC2GA,SAAgB,kBACd,QACoB;CACpB,OAAO,WAAW,EAAE,GAAG,OAAO,GAAG,cAAc;AACjD;;;;;;;;;;;AC7KA,SAAgB,aAId,QAAgB;CAChB,OAAO;AACT;;;;;;;;;AAWA,SAAgB,cAAc,GAAG,SAA6B;CAC5D,OAAO;AACT;;;;;ACnBA,MAAa,IAAIC"}
|
|
@@ -3,10 +3,10 @@ import { IdPUserField } from "../../../parser/service/idp/types.mjs";
|
|
|
3
3
|
//#region src/configure/services/idp/permission.d.ts
|
|
4
4
|
type EqualityOperator = "=" | "!=";
|
|
5
5
|
type ContainsOperator = "in" | "not in";
|
|
6
|
-
type StringFieldKeys<User extends object> = { [K in keyof User]
|
|
7
|
-
type StringArrayFieldKeys<User extends object> = { [K in keyof User]
|
|
8
|
-
type BooleanFieldKeys<User extends object> = { [K in keyof User]
|
|
9
|
-
type BooleanArrayFieldKeys<User extends object> = { [K in keyof User]
|
|
6
|
+
type StringFieldKeys<User extends object> = { [K in keyof User]-?: Exclude<User[K], undefined> extends string ? K : never; }[keyof User];
|
|
7
|
+
type StringArrayFieldKeys<User extends object> = { [K in keyof User]-?: Exclude<User[K], undefined> extends string[] ? K : never; }[keyof User];
|
|
8
|
+
type BooleanFieldKeys<User extends object> = { [K in keyof User]-?: Exclude<User[K], undefined> extends boolean ? K : never; }[keyof User];
|
|
9
|
+
type BooleanArrayFieldKeys<User extends object> = { [K in keyof User]-?: Exclude<User[K], undefined> extends boolean[] ? K : never; }[keyof User];
|
|
10
10
|
type UserStringOperand<User extends object = InferredAttributes> = {
|
|
11
11
|
user: StringFieldKeys<User> | "id";
|
|
12
12
|
};
|
|
@@ -47,10 +47,10 @@ type GqlPermissionAction = "read" | "create" | "update" | "delete" | "aggregate"
|
|
|
47
47
|
type EqualityOperator = "=" | "!=";
|
|
48
48
|
type ContainsOperator = "in" | "not in";
|
|
49
49
|
type HasAnyOperator = "hasAny" | "not hasAny";
|
|
50
|
-
type StringFieldKeys<User extends object> = { [K in keyof User]
|
|
51
|
-
type StringArrayFieldKeys<User extends object> = { [K in keyof User]
|
|
52
|
-
type BooleanFieldKeys<User extends object> = { [K in keyof User]
|
|
53
|
-
type BooleanArrayFieldKeys<User extends object> = { [K in keyof User]
|
|
50
|
+
type StringFieldKeys<User extends object> = { [K in keyof User]-?: Exclude<User[K], undefined> extends string ? K : never; }[keyof User];
|
|
51
|
+
type StringArrayFieldKeys<User extends object> = { [K in keyof User]-?: Exclude<User[K], undefined> extends string[] ? K : never; }[keyof User];
|
|
52
|
+
type BooleanFieldKeys<User extends object> = { [K in keyof User]-?: Exclude<User[K], undefined> extends boolean ? K : never; }[keyof User];
|
|
53
|
+
type BooleanArrayFieldKeys<User extends object> = { [K in keyof User]-?: Exclude<User[K], undefined> extends boolean[] ? K : never; }[keyof User];
|
|
54
54
|
type UserStringOperand<User extends object = InferredAttributes> = {
|
|
55
55
|
user: StringFieldKeys<User> | "id";
|
|
56
56
|
};
|