@tailor-platform/sdk 1.21.0 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/dist/application-CTQe2HSB.mjs +5723 -0
- package/dist/application-CTQe2HSB.mjs.map +1 -0
- package/dist/application-DdSu3baZ.mjs +8 -0
- package/dist/{brand-BZJCv6UY.mjs → brand-DyPrAzpM.mjs} +1 -1
- package/dist/{brand-BZJCv6UY.mjs.map → brand-DyPrAzpM.mjs.map} +1 -1
- package/dist/cli/index.mjs +544 -57
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +49 -8
- package/dist/cli/lib.mjs +15 -16
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/configure/index.d.mts +4 -4
- package/dist/configure/index.mjs +15 -4
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{enum-constants-CGVvu3dd.mjs → enum-constants-B5Nl-yzx.mjs} +1 -1
- package/dist/{enum-constants-CGVvu3dd.mjs.map → enum-constants-B5Nl-yzx.mjs.map} +1 -1
- package/dist/{file-utils-GX_tGWl4.mjs → file-utils-sEOwAdJ4.mjs} +1 -1
- package/dist/{file-utils-GX_tGWl4.mjs.map → file-utils-sEOwAdJ4.mjs.map} +1 -1
- package/dist/{index-Dn61THJK.d.mts → index-BGPX26_D.d.mts} +2 -2
- package/dist/{index-CnHd6BNg.d.mts → index-BiutQT7m.d.mts} +4 -10
- package/dist/{index-DxlmLUag.d.mts → index-ClS0NClx.d.mts} +2 -2
- package/dist/{index-BWVAwea4.d.mts → index-Cwi86SUR.d.mts} +2 -2
- package/dist/{index-oZXVKyfX.d.mts → index-DPN_P0w3.d.mts} +2 -2
- package/dist/{interceptor-D8MeZOxX.mjs → interceptor-DiARwPfw.mjs} +1 -1
- package/dist/{interceptor-D8MeZOxX.mjs.map → interceptor-DiARwPfw.mjs.map} +1 -1
- package/dist/{job-2Q82qQ6N.mjs → job-CRavYLLk.mjs} +4 -24
- package/dist/job-CRavYLLk.mjs.map +1 -0
- package/dist/kysely/index.d.mts +2 -2
- package/dist/kysely/index.mjs +2 -2
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/{kysely-type-Cpq5TNGY.mjs → kysely-type-CSlcwNFH.mjs} +1 -1
- package/dist/{kysely-type-Cpq5TNGY.mjs.map → kysely-type-CSlcwNFH.mjs.map} +1 -1
- package/dist/package-json-BI0ng3_5.mjs +3 -0
- package/dist/{package-json-3H5gfhA4.mjs → package-json-iVBhE5Ef.mjs} +1 -1
- package/dist/{package-json-3H5gfhA4.mjs.map → package-json-iVBhE5Ef.mjs.map} +1 -1
- package/dist/plugin/builtin/enum-constants/index.d.mts +2 -2
- package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +2 -2
- package/dist/plugin/builtin/file-utils/index.mjs +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +2 -2
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +2 -2
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/index.d.mts +1 -1
- package/dist/plugin/index.mjs +3 -3
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/{update-9MTRN1UA.mjs → query-Bz2oDGhw.mjs} +915 -174
- package/dist/query-Bz2oDGhw.mjs.map +1 -0
- package/dist/{schema-D5Cpd8fQ.mjs → schema-Cjm-OvPF.mjs} +2 -2
- package/dist/{schema-D5Cpd8fQ.mjs.map → schema-Cjm-OvPF.mjs.map} +1 -1
- package/dist/{seed-D-rYCN5F.mjs → seed-CXvCW3Xc.mjs} +2 -2
- package/dist/{seed-D-rYCN5F.mjs.map → seed-CXvCW3Xc.mjs.map} +1 -1
- package/dist/telemetry-BAxP8-PR.mjs +3 -0
- package/dist/{telemetry-DuBhnd0X.mjs → telemetry-C46fds1l.mjs} +2 -2
- package/dist/{telemetry-DuBhnd0X.mjs.map → telemetry-C46fds1l.mjs.map} +1 -1
- package/dist/{types-ClK_HJ0G.mjs → types-CBTSg-LK.mjs} +1 -1
- package/dist/{types-ClK_HJ0G.mjs.map → types-CBTSg-LK.mjs.map} +1 -1
- package/dist/{types-C0o90Cmb.d.mts → types-DVMQNdTs.d.mts} +6 -2
- package/dist/{types-QKq1usl7.d.mts → types-bcuNRo1Y.d.mts} +8 -8
- package/dist/utils/test/index.d.mts +42 -4
- package/dist/utils/test/index.mjs +78 -3
- package/dist/utils/test/index.mjs.map +1 -1
- package/docs/cli/function.md +83 -3
- package/package.json +7 -5
- package/dist/application-CEv5c7TU.mjs +0 -102207
- package/dist/application-CEv5c7TU.mjs.map +0 -1
- package/dist/application-DiCzM9b0.mjs +0 -9
- package/dist/chunk-CqAI0b6X.mjs +0 -47
- package/dist/jiti-DfS9jItj.mjs +0 -4482
- package/dist/jiti-DfS9jItj.mjs.map +0 -1
- package/dist/job-2Q82qQ6N.mjs.map +0 -1
- package/dist/package-json-DTDAqRRJ.mjs +0 -3
- package/dist/src-Bb1UVstT.mjs +0 -1038
- package/dist/src-Bb1UVstT.mjs.map +0 -1
- package/dist/telemetry-Dhzj9Ncm.mjs +0 -3
- package/dist/update-9MTRN1UA.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["t","_t"],"sources":["../../src/configure/services/auth/index.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/workflow.ts","../../src/configure/services/staticwebsite/index.ts","../../src/configure/services/idp/index.ts","../../src/configure/config.ts","../../src/configure/index.ts"],"sourcesContent":["import { type TailorDBInstance } from \"../tailordb/schema\";\nimport type { TailorField } from \"@/configure/types/type\";\nimport type { DefinedFieldMetadata, FieldMetadata, TailorFieldType } from \"@/configure/types/types\";\nimport type {\n AuthInvoker as ParserAuthInvoker,\n AuthDefinitionBrand,\n AuthServiceInput,\n DefinedAuth,\n UserAttributeListKey,\n UserAttributeMap,\n} from \"@/parser/service/auth/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 PlaceholderAttributeMap = UserAttributeMap<PlaceholderUser>;\ntype PlaceholderAttributeList = UserAttributeListKey<PlaceholderUser>[];\n\ntype UserProfileAuthInput<\n User extends TailorDBInstance,\n AttributeMap extends UserAttributeMap<User>,\n AttributeList extends UserAttributeListKey<User>[],\n MachineUserNames extends string,\n> = Omit<\n AuthServiceInput<User, AttributeMap, AttributeList, MachineUserNames, undefined>,\n \"userProfile\" | \"machineUserAttributes\"\n> & {\n userProfile: NonNullable<\n AuthServiceInput<User, AttributeMap, AttributeList, MachineUserNames, undefined>[\"userProfile\"]\n >;\n machineUserAttributes?: never;\n};\n\ntype MachineUserOnlyAuthInput<\n MachineUserNames extends string,\n MachineUserAttributes extends MachineUserAttributeFields,\n> = Omit<\n AuthServiceInput<\n PlaceholderUser,\n PlaceholderAttributeMap,\n PlaceholderAttributeList,\n MachineUserNames,\n MachineUserAttributes\n >,\n \"userProfile\" | \"machineUserAttributes\"\n> & {\n userProfile?: never;\n machineUserAttributes: MachineUserAttributes;\n};\n\nexport type {\n OIDC,\n SAML,\n IDToken,\n BuiltinIdP,\n IdProviderConfig,\n OAuth2ClientGrantType,\n OAuth2ClientInput as OAuth2Client,\n SCIMAuthorization,\n SCIMAttributeType,\n SCIMAttribute,\n SCIMAttributeMapping,\n SCIMResource,\n SCIMConfig,\n TenantProviderConfig,\n ValueOperand,\n UsernameFieldKey,\n UserAttributeKey,\n UserAttributeListKey,\n UserAttributeMap,\n AuthServiceInput,\n AuthConfig,\n AuthExternalConfig,\n AuthOwnConfig,\n DefinedAuth,\n} from \"@/parser/service/auth/types\";\n\n/**\n * Invoker type compatible with tailor.v1.AuthInvoker\n * - namespace: auth service name\n * - machineUserName: machine user name\n */\nexport type AuthInvoker<M extends string> = Omit<ParserAuthInvoker, \"machineUserName\"> & {\n machineUserName: M;\n};\n\n/**\n * Define an auth service for the Tailor SDK.\n * @template Name\n * @template User\n * @template AttributeMap\n * @template AttributeList\n * @template MachineUserNames\n * @template M\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 AttributeMap extends UserAttributeMap<User>,\n const AttributeList extends UserAttributeListKey<User>[],\n const MachineUserNames extends string,\n>(\n name: Name,\n config: UserProfileAuthInput<User, AttributeMap, AttributeList, MachineUserNames>,\n): DefinedAuth<\n Name,\n UserProfileAuthInput<User, AttributeMap, AttributeList, MachineUserNames>,\n MachineUserNames\n>;\nexport function defineAuth<\n const Name extends string,\n const MachineUserAttributes extends MachineUserAttributeFields,\n const MachineUserNames extends string,\n>(\n name: Name,\n config: MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes>,\n): DefinedAuth<\n Name,\n MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes>,\n MachineUserNames\n>;\nexport function defineAuth<\n const Name extends string,\n const User extends TailorDBInstance,\n const AttributeMap extends UserAttributeMap<User>,\n const AttributeList extends UserAttributeListKey<User>[],\n const MachineUserAttributes extends MachineUserAttributeFields,\n const MachineUserNames extends string,\n>(\n name: Name,\n config:\n | UserProfileAuthInput<User, AttributeMap, AttributeList, MachineUserNames>\n | MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes>,\n) {\n const result = {\n ...config,\n name,\n invoker<M extends MachineUserNames>(machineUser: M) {\n return { namespace: name, machineUserName: machineUser } as const;\n },\n } as const satisfies (\n | UserProfileAuthInput<User, AttributeMap, AttributeList, MachineUserNames>\n | MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes>\n ) & {\n name: string;\n invoker<M extends MachineUserNames>(machineUser: M): AuthInvoker<M>;\n };\n\n validateAuthConfig(result);\n\n return result as typeof result & AuthDefinitionBrand;\n}\n\nfunction validateAuthConfig(config: {\n userProfile?: unknown;\n machineUserAttributes?: unknown;\n}): void {\n const hasUserProfile = config.userProfile !== undefined;\n const hasMachineUserAttributes = config.machineUserAttributes !== undefined;\n\n if (hasUserProfile && hasMachineUserAttributes) {\n throw new Error(\"Provide either userProfile or machineUserAttributes, not both.\");\n }\n}\n","import { t } from \"@/configure/types/type\";\nimport { brandValue } from \"@/utils/brand\";\nimport type { TailorAnyField, TailorUser } from \"@/configure/types\";\nimport type { TailorEnv } from \"@/configure/types/env\";\nimport type { InferFieldsOutput, output } from \"@/configure/types/helpers\";\nimport type { TailorField } from \"@/configure/types/type\";\nimport type { ResolverInput } from \"@/parser/service/resolver/types\";\n\ntype Context<Input extends Record<string, TailorAnyField> | undefined> = {\n input: Input extends Record<string, TailorAnyField> ? InferFieldsOutput<Input> : never;\n user: TailorUser;\n env: TailorEnv;\n};\n\ntype OutputType<O> = O extends TailorAnyField\n ? output<O>\n : O extends Record<string, TailorAnyField>\n ? InferFieldsOutput<O>\n : never;\n\n/**\n * Normalized output type that preserves generic type information.\n * - If Output is already a TailorField, use it as-is\n * - If Output is a Record of fields, wrap it as a nested TailorField\n */\ntype NormalizedOutput<Output extends TailorAnyField | Record<string, TailorAnyField>> =\n Output extends TailorAnyField\n ? Output\n : TailorField<\n { type: \"nested\"; array: false },\n InferFieldsOutput<Extract<Output, Record<string, TailorAnyField>>>\n >;\n\ntype ResolverReturn<\n Input extends Record<string, TailorAnyField> | undefined,\n Output extends TailorAnyField | Record<string, TailorAnyField>,\n> = Omit<ResolverInput, \"input\" | \"output\" | \"body\"> &\n Readonly<{\n input?: Input;\n output: NormalizedOutput<Output>;\n body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;\n }>;\n\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 * `user` (TailorUser with id, type, workspaceId, attributes, attributeList), and `env` (TailorEnv).\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, user }) => {\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 */\nexport function createResolver<\n Input extends Record<string, TailorAnyField> | undefined = undefined,\n Output extends TailorAnyField | Record<string, TailorAnyField> = TailorAnyField,\n>(\n config: Omit<ResolverInput, \"input\" | \"output\" | \"body\"> &\n Readonly<{\n input?: Input;\n output: Output;\n body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;\n }>,\n): ResolverReturn<Input, Output> {\n // 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 ...config,\n output: normalizedOutput,\n } as ResolverReturn<Input, Output>);\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 { Operation } from \"./operation\";\nimport type { Trigger } from \"./trigger\";\nimport type { AuthInvoker } from \"@/configure/services/auth\";\nimport type { Workflow } from \"@/configure/services/workflow/workflow\";\nimport type { ExecutorInput } from \"@/parser/service/executor/types\";\n\n/**\n * Extract mainJob's Input type from Workflow.\n */\ntype WorkflowInput<W extends Workflow> = Parameters<W[\"trigger\"]>[0];\n\ntype 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: {\n kind: \"workflow\";\n workflow: W;\n args?: WorkflowInput<W> | ((args: TriggerArgs<T>) => WorkflowInput<W>);\n authInvoker?: AuthInvoker<string>;\n };\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\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);\n}\n","import type { ResolverConfig } from \"@/configure/services/resolver/resolver\";\nimport type { TailorDBType } from \"@/configure/services/tailordb/schema\";\nimport type { TailorActor } from \"@/configure/types/actor\";\nimport type { TailorEnv } from \"@/configure/types/env\";\nimport type { output } from \"@/configure/types/helpers\";\nimport type {\n RecordTrigger as ParserRecordTrigger,\n ResolverExecutedTrigger as ParserResolverExecutedTrigger,\n IdpUserTrigger as ParserIdpUserTrigger,\n AuthAccessTokenTrigger as ParserAuthAccessTokenTrigger,\n} from \"@/parser/service/executor/types\";\n\ninterface EventArgs {\n workspaceId: string;\n appNamespace: string;\n env: TailorEnv;\n actor: TailorActor | null;\n}\n\ninterface RecordArgs extends EventArgs {\n typeName: string;\n}\n\nexport interface RecordCreatedArgs<T extends TailorDBType> extends RecordArgs {\n newRecord: output<T>;\n}\n\nexport interface RecordUpdatedArgs<T extends TailorDBType> extends RecordArgs {\n newRecord: output<T>;\n oldRecord: output<T>;\n}\n\nexport interface RecordDeletedArgs<T extends TailorDBType> extends RecordArgs {\n oldRecord: output<T>;\n}\n\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\nexport type RecordTrigger<Args> = ParserRecordTrigger & {\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): RecordTrigger<RecordCreatedArgs<T>> {\n const { type, condition } = options;\n return {\n kind: \"recordCreated\",\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): RecordTrigger<RecordUpdatedArgs<T>> {\n const { type, condition } = options;\n return {\n kind: \"recordUpdated\",\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): RecordTrigger<RecordDeletedArgs<T>> {\n const { type, condition } = options;\n return {\n kind: \"recordDeleted\",\n typeName: type.name,\n condition,\n __args: {} as RecordDeletedArgs<T>,\n };\n}\n\nexport type ResolverExecutedTrigger<Args> = ParserResolverExecutedTrigger & {\n __args: Args;\n};\n\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// IdP User Event Triggers\nexport interface IdpUserArgs extends EventArgs {\n namespaceName: string;\n userId: string;\n}\n\nexport type IdpUserTrigger<Args> = ParserIdpUserTrigger & {\n __args: Args;\n};\n\n/**\n * Create a trigger that fires when an IdP user is created.\n * @returns IdP user created trigger\n */\nexport function idpUserCreatedTrigger(): IdpUserTrigger<IdpUserArgs> {\n return {\n kind: \"idpUserCreated\",\n __args: {} as IdpUserArgs,\n };\n}\n\n/**\n * Create a trigger that fires when an IdP user is updated.\n * @returns IdP user updated trigger\n */\nexport function idpUserUpdatedTrigger(): IdpUserTrigger<IdpUserArgs> {\n return {\n kind: \"idpUserUpdated\",\n __args: {} as IdpUserArgs,\n };\n}\n\n/**\n * Create a trigger that fires when an IdP user is deleted.\n * @returns IdP user deleted trigger\n */\nexport function idpUserDeletedTrigger(): IdpUserTrigger<IdpUserArgs> {\n return {\n kind: \"idpUserDeleted\",\n __args: {} as IdpUserArgs,\n };\n}\n\n// Auth Access Token Event Triggers\nexport interface AuthAccessTokenArgs extends EventArgs {\n namespaceName: string;\n userId: string;\n}\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<AuthAccessTokenArgs> {\n return {\n kind: \"authAccessTokenIssued\",\n __args: {} as AuthAccessTokenArgs,\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<AuthAccessTokenArgs> {\n return {\n kind: \"authAccessTokenRefreshed\",\n __args: {} as AuthAccessTokenArgs,\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<AuthAccessTokenArgs> {\n return {\n kind: \"authAccessTokenRevoked\",\n __args: {} as AuthAccessTokenArgs,\n };\n}\n","import type { TailorEnv } from \"@/configure/types/env\";\nimport type { ScheduleTriggerInput as ParserScheduleTriggerInput } from \"@/parser/service/executor/types\";\nimport type { StandardCRON } from \"ts-cron-validator\";\n\ntype Timezone =\n | \"UTC\"\n | \"Pacific/Midway\"\n | \"Pacific/Niue\"\n | \"Pacific/Pago_Pago\"\n | \"America/Adak\"\n | \"Pacific/Honolulu\"\n | \"Pacific/Rarotonga\"\n | \"Pacific/Tahiti\"\n | \"Pacific/Marquesas\"\n | \"America/Anchorage\"\n | \"America/Juneau\"\n | \"America/Metlakatla\"\n | \"America/Nome\"\n | \"America/Sitka\"\n | \"America/Yakutat\"\n | \"Pacific/Gambier\"\n | \"America/Los_Angeles\"\n | \"America/Tijuana\"\n | \"America/Vancouver\"\n | \"Pacific/Pitcairn\"\n | \"America/Boise\"\n | \"America/Cambridge_Bay\"\n | \"America/Chihuahua\"\n | \"America/Creston\"\n | \"America/Dawson\"\n | \"America/Dawson_Creek\"\n | \"America/Denver\"\n | \"America/Edmonton\"\n | \"America/Fort_Nelson\"\n | \"America/Hermosillo\"\n | \"America/Inuvik\"\n | \"America/Mazatlan\"\n | \"America/Ojinaga\"\n | \"America/Phoenix\"\n | \"America/Whitehorse\"\n | \"America/Yellowknife\"\n | \"America/Bahia_Banderas\"\n | \"America/Belize\"\n | \"America/Chicago\"\n | \"America/Costa_Rica\"\n | \"America/El_Salvador\"\n | \"America/Guatemala\"\n | \"America/Indiana/Knox\"\n | \"America/Indiana/Tell_City\"\n | \"America/Managua\"\n | \"America/Matamoros\"\n | \"America/Menominee\"\n | \"America/Merida\"\n | \"America/Mexico_City\"\n | \"America/Monterrey\"\n | \"America/North_Dakota/Beulah\"\n | \"America/North_Dakota/Center\"\n | \"America/North_Dakota/New_Salem\"\n | \"America/Rainy_River\"\n | \"America/Rankin_Inlet\"\n | \"America/Regina\"\n | \"America/Resolute\"\n | \"America/Swift_Current\"\n | \"America/Tegucigalpa\"\n | \"America/Winnipeg\"\n | \"Pacific/Easter\"\n | \"Pacific/Galapagos\"\n | \"America/Atikokan\"\n | \"America/Bogota\"\n | \"America/Cancun\"\n | \"America/Cayman\"\n | \"America/Detroit\"\n | \"America/Eirunepe\"\n | \"America/Grand_Turk\"\n | \"America/Guayaquil\"\n | \"America/Havana\"\n | \"America/Indiana/Indianapolis\"\n | \"America/Indiana/Marengo\"\n | \"America/Indiana/Petersburg\"\n | \"America/Indiana/Vevay\"\n | \"America/Indiana/Vincennes\"\n | \"America/Indiana/Winamac\"\n | \"America/Iqaluit\"\n | \"America/Jamaica\"\n | \"America/Kentucky/Louisville\"\n | \"America/Kentucky/Monticello\"\n | \"America/Lima\"\n | \"America/Nassau\"\n | \"America/New_York\"\n | \"America/Nipigon\"\n | \"America/Panama\"\n | \"America/Pangnirtung\"\n | \"America/Port-au-Prince\"\n | \"America/Rio_Branco\"\n | \"America/Thunder_Bay\"\n | \"America/Toronto\"\n | \"America/Anguilla\"\n | \"America/Antigua\"\n | \"America/Aruba\"\n | \"America/Asuncion\"\n | \"America/Barbados\"\n | \"America/Blanc-Sablon\"\n | \"America/Boa_Vista\"\n | \"America/Campo_Grande\"\n | \"America/Caracas\"\n | \"America/Cuiaba\"\n | \"America/Curacao\"\n | \"America/Dominica\"\n | \"America/Glace_Bay\"\n | \"America/Goose_Bay\"\n | \"America/Grenada\"\n | \"America/Guadeloupe\"\n | \"America/Guyana\"\n | \"America/Halifax\"\n | \"America/Kralendijk\"\n | \"America/La_Paz\"\n | \"America/Lower_Princes\"\n | \"America/Manaus\"\n | \"America/Marigot\"\n | \"America/Martinique\"\n | \"America/Moncton\"\n | \"America/Montserrat\"\n | \"America/Porto_Velho\"\n | \"America/Port_of_Spain\"\n | \"America/Puerto_Rico\"\n | \"America/Santiago\"\n | \"America/Santo_Domingo\"\n | \"America/St_Barthelemy\"\n | \"America/St_Kitts\"\n | \"America/St_Lucia\"\n | \"America/St_Thomas\"\n | \"America/St_Vincent\"\n | \"America/Thule\"\n | \"America/Tortola\"\n | \"Atlantic/Bermuda\"\n | \"America/St_Johns\"\n | \"America/Araguaina\"\n | \"America/Argentina/Buenos_Aires\"\n | \"America/Argentina/Catamarca\"\n | \"America/Argentina/Cordoba\"\n | \"America/Argentina/Jujuy\"\n | \"America/Argentina/La_Rioja\"\n | \"America/Argentina/Mendoza\"\n | \"America/Argentina/Rio_Gallegos\"\n | \"America/Argentina/Salta\"\n | \"America/Argentina/San_Juan\"\n | \"America/Argentina/San_Luis\"\n | \"America/Argentina/Tucuman\"\n | \"America/Argentina/Ushuaia\"\n | \"America/Bahia\"\n | \"America/Belem\"\n | \"America/Cayenne\"\n | \"America/Fortaleza\"\n | \"America/Godthab\"\n | \"America/Maceio\"\n | \"America/Miquelon\"\n | \"America/Montevideo\"\n | \"America/Paramaribo\"\n | \"America/Punta_Arenas\"\n | \"America/Recife\"\n | \"America/Santarem\"\n | \"America/Sao_Paulo\"\n | \"Antarctica/Palmer\"\n | \"Antarctica/Rothera\"\n | \"Atlantic/Stanley\"\n | \"America/Noronha\"\n | \"Atlantic/South_Georgia\"\n | \"America/Scoresbysund\"\n | \"Atlantic/Azores\"\n | \"Atlantic/Cape_Verde\"\n | \"Africa/Abidjan\"\n | \"Africa/Accra\"\n | \"Africa/Bamako\"\n | \"Africa/Banjul\"\n | \"Africa/Bissau\"\n | \"Africa/Casablanca\"\n | \"Africa/Conakry\"\n | \"Africa/Dakar\"\n | \"Africa/El_Aaiun\"\n | \"Africa/Freetown\"\n | \"Africa/Lome\"\n | \"Africa/Monrovia\"\n | \"Africa/Nouakchott\"\n | \"Africa/Ouagadougou\"\n | \"Africa/Sao_Tome\"\n | \"America/Danmarkshavn\"\n | \"Antarctica/Troll\"\n | \"Atlantic/Canary\"\n | \"Atlantic/Faroe\"\n | \"Atlantic/Madeira\"\n | \"Atlantic/Reykjavik\"\n | \"Atlantic/St_Helena\"\n | \"Europe/Dublin\"\n | \"Europe/Guernsey\"\n | \"Europe/Isle_of_Man\"\n | \"Europe/Jersey\"\n | \"Europe/Lisbon\"\n | \"Europe/London\"\n | \"Africa/Algiers\"\n | \"Africa/Bangui\"\n | \"Africa/Brazzaville\"\n | \"Africa/Ceuta\"\n | \"Africa/Douala\"\n | \"Africa/Kinshasa\"\n | \"Africa/Lagos\"\n | \"Africa/Libreville\"\n | \"Africa/Luanda\"\n | \"Africa/Malabo\"\n | \"Africa/Ndjamena\"\n | \"Africa/Niamey\"\n | \"Africa/Porto-Novo\"\n | \"Africa/Tunis\"\n | \"Africa/Windhoek\"\n | \"Arctic/Longyearbyen\"\n | \"Europe/Amsterdam\"\n | \"Europe/Andorra\"\n | \"Europe/Belgrade\"\n | \"Europe/Berlin\"\n | \"Europe/Bratislava\"\n | \"Europe/Brussels\"\n | \"Europe/Budapest\"\n | \"Europe/Copenhagen\"\n | \"Europe/Gibraltar\"\n | \"Europe/Ljubljana\"\n | \"Europe/Luxembourg\"\n | \"Europe/Madrid\"\n | \"Europe/Malta\"\n | \"Europe/Monaco\"\n | \"Europe/Oslo\"\n | \"Europe/Paris\"\n | \"Europe/Podgorica\"\n | \"Europe/Prague\"\n | \"Europe/Rome\"\n | \"Europe/San_Marino\"\n | \"Europe/Sarajevo\"\n | \"Europe/Skopje\"\n | \"Europe/Stockholm\"\n | \"Europe/Tirane\"\n | \"Europe/Vaduz\"\n | \"Europe/Vatican\"\n | \"Europe/Vienna\"\n | \"Europe/Warsaw\"\n | \"Europe/Zagreb\"\n | \"Europe/Zurich\"\n | \"Africa/Blantyre\"\n | \"Africa/Bujumbura\"\n | \"Africa/Cairo\"\n | \"Africa/Gaborone\"\n | \"Africa/Harare\"\n | \"Africa/Johannesburg\"\n | \"Africa/Juba\"\n | \"Africa/Khartoum\"\n | \"Africa/Kigali\"\n | \"Africa/Lubumbashi\"\n | \"Africa/Lusaka\"\n | \"Africa/Maputo\"\n | \"Africa/Maseru\"\n | \"Africa/Mbabane\"\n | \"Africa/Tripoli\"\n | \"Asia/Amman\"\n | \"Asia/Beirut\"\n | \"Asia/Damascus\"\n | \"Asia/Famagusta\"\n | \"Asia/Gaza\"\n | \"Asia/Hebron\"\n | \"Asia/Jerusalem\"\n | \"Asia/Nicosia\"\n | \"Europe/Athens\"\n | \"Europe/Bucharest\"\n | \"Europe/Chisinau\"\n | \"Europe/Helsinki\"\n | \"Europe/Kaliningrad\"\n | \"Europe/Kyiv\"\n | \"Europe/Mariehamn\"\n | \"Europe/Riga\"\n | \"Europe/Sofia\"\n | \"Europe/Tallinn\"\n | \"Europe/Uzhgorod\"\n | \"Europe/Vilnius\"\n | \"Europe/Zaporizhzhia\"\n | \"Africa/Addis_Ababa\"\n | \"Africa/Asmara\"\n | \"Africa/Dar_es_Salaam\"\n | \"Africa/Djibouti\"\n | \"Africa/Kampala\"\n | \"Africa/Mogadishu\"\n | \"Africa/Nairobi\"\n | \"Antarctica/Syowa\"\n | \"Asia/Aden\"\n | \"Asia/Baghdad\"\n | \"Asia/Bahrain\"\n | \"Asia/Kuwait\"\n | \"Asia/Qatar\"\n | \"Asia/Riyadh\"\n | \"Europe/Istanbul\"\n | \"Europe/Kirov\"\n | \"Europe/Minsk\"\n | \"Europe/Moscow\"\n | \"Europe/Simferopol\"\n | \"Europe/Volgograd\"\n | \"Indian/Antananarivo\"\n | \"Indian/Comoro\"\n | \"Indian/Mayotte\"\n | \"Asia/Tehran\"\n | \"Asia/Baku\"\n | \"Asia/Dubai\"\n | \"Asia/Muscat\"\n | \"Asia/Tbilisi\"\n | \"Asia/Yerevan\"\n | \"Europe/Astrakhan\"\n | \"Europe/Samara\"\n | \"Europe/Saratov\"\n | \"Europe/Ulyanovsk\"\n | \"Indian/Mahe\"\n | \"Indian/Mauritius\"\n | \"Indian/Reunion\"\n | \"Asia/Kabul\"\n | \"Antarctica/Mawson\"\n | \"Asia/Aqtau\"\n | \"Asia/Aqtobe\"\n | \"Asia/Ashgabat\"\n | \"Asia/Atyrau\"\n | \"Asia/Dushanbe\"\n | \"Asia/Karachi\"\n | \"Asia/Oral\"\n | \"Asia/Qyzylorda\"\n | \"Asia/Samarkand\"\n | \"Asia/Tashkent\"\n | \"Asia/Yekaterinburg\"\n | \"Indian/Kerguelen\"\n | \"Indian/Maldives\"\n | \"Asia/Colombo\"\n | \"Asia/Kolkata\"\n | \"Asia/Kathmandu\"\n | \"Antarctica/Vostok\"\n | \"Asia/Almaty\"\n | \"Asia/Bishkek\"\n | \"Asia/Dhaka\"\n | \"Asia/Omsk\"\n | \"Asia/Qostanay\"\n | \"Asia/Thimphu\"\n | \"Asia/Urumqi\"\n | \"Indian/Chagos\"\n | \"Asia/Yangon\"\n | \"Indian/Cocos\"\n | \"Antarctica/Davis\"\n | \"Asia/Bangkok\"\n | \"Asia/Barnaul\"\n | \"Asia/Hovd\"\n | \"Asia/Ho_Chi_Minh\"\n | \"Asia/Jakarta\"\n | \"Asia/Krasnoyarsk\"\n | \"Asia/Novokuznetsk\"\n | \"Asia/Novosibirsk\"\n | \"Asia/Phnom_Penh\"\n | \"Asia/Pontianak\"\n | \"Asia/Tomsk\"\n | \"Asia/Vientiane\"\n | \"Indian/Christmas\"\n | \"Asia/Brunei\"\n | \"Asia/Choibalsan\"\n | \"Asia/Hong_Kong\"\n | \"Asia/Irkutsk\"\n | \"Asia/Kuala_Lumpur\"\n | \"Asia/Kuching\"\n | \"Asia/Macau\"\n | \"Asia/Makassar\"\n | \"Asia/Manila\"\n | \"Asia/Shanghai\"\n | \"Asia/Singapore\"\n | \"Asia/Taipei\"\n | \"Asia/Ulaanbaatar\"\n | \"Australia/Perth\"\n | \"Australia/Eucla\"\n | \"Asia/Chita\"\n | \"Asia/Dili\"\n | \"Asia/Jayapura\"\n | \"Asia/Khandyga\"\n | \"Asia/Pyongyang\"\n | \"Asia/Seoul\"\n | \"Asia/Tokyo\"\n | \"Asia/Yakutsk\"\n | \"Pacific/Palau\"\n | \"Australia/Adelaide\"\n | \"Australia/Broken_Hill\"\n | \"Australia/Darwin\"\n | \"Antarctica/DumontDUrville\"\n | \"Antarctica/Macquarie\"\n | \"Asia/Ust-Nera\"\n | \"Asia/Vladivostok\"\n | \"Australia/Brisbane\"\n | \"Australia/Currie\"\n | \"Australia/Hobart\"\n | \"Australia/Lindeman\"\n | \"Australia/Melbourne\"\n | \"Australia/Sydney\"\n | \"Pacific/Chuuk\"\n | \"Pacific/Guam\"\n | \"Pacific/Port_Moresby\"\n | \"Pacific/Saipan\"\n | \"Australia/Lord_Howe\"\n | \"Antarctica/Casey\"\n | \"Asia/Magadan\"\n | \"Asia/Sakhalin\"\n | \"Asia/Srednekolymsk\"\n | \"Pacific/Bougainville\"\n | \"Pacific/Efate\"\n | \"Pacific/Guadalcanal\"\n | \"Pacific/Kosrae\"\n | \"Pacific/Norfolk\"\n | \"Pacific/Noumea\"\n | \"Pacific/Pohnpei\"\n | \"Antarctica/McMurdo\"\n | \"Asia/Anadyr\"\n | \"Asia/Kamchatka\"\n | \"Pacific/Auckland\"\n | \"Pacific/Fiji\"\n | \"Pacific/Funafuti\"\n | \"Pacific/Kwajalein\"\n | \"Pacific/Majuro\"\n | \"Pacific/Nauru\"\n | \"Pacific/Tarawa\"\n | \"Pacific/Wake\"\n | \"Pacific/Wallis\"\n | \"Pacific/Chatham\"\n | \"Pacific/Apia\"\n | \"Pacific/Enderbury\"\n | \"Pacific/Fakaofo\"\n | \"Pacific/Tongatapu\"\n | \"Pacific/Kiritimati\";\n\nexport type ScheduleTrigger<Args> = ParserScheduleTriggerInput & {\n __args: Args;\n};\n\nexport interface ScheduleArgs {\n env: TailorEnv;\n}\n\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 \"@/configure/types/env\";\nimport type { IncomingWebhookTrigger as ParserIncomingWebhookTrigger } from \"@/parser/service/executor/types\";\n\nexport interface IncomingWebhookArgs<T extends IncomingWebhookRequest> {\n body: T[\"body\"];\n headers: T[\"headers\"];\n method: \"POST\" | \"GET\" | \"PUT\" | \"DELETE\";\n rawBody: string;\n env: TailorEnv;\n}\n\nexport interface IncomingWebhookRequest {\n body: Record<string, unknown>;\n headers: Record<string, string>;\n}\n\nexport type IncomingWebhookTrigger<Args> = ParserIncomingWebhookTrigger & {\n __args: Args;\n};\n\n/**\n * Create a trigger for incoming webhook requests.\n * @template T\n * @returns Incoming webhook trigger\n */\nexport function incomingWebhookTrigger<T extends IncomingWebhookRequest>(): IncomingWebhookTrigger<\n IncomingWebhookArgs<T>\n> {\n return {\n kind: \"incomingWebhook\",\n __args: {} as IncomingWebhookArgs<T>,\n };\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { brandValue } from \"@/utils/brand\";\nimport type { WorkflowJob } from \"./job\";\nimport type { AuthInvoker } from \"../auth\";\n\nexport interface WorkflowConfig<\n Job extends WorkflowJob<any, any, any> = WorkflowJob<any, any, any>,\n> {\n name: string;\n mainJob: Job;\n}\n\nexport interface Workflow<Job extends WorkflowJob<any, any, any> = WorkflowJob<any, any, any>> {\n name: string;\n mainJob: Job;\n trigger: (\n args: Parameters<Job[\"trigger\"]>[0],\n options?: { authInvoker: AuthInvoker<string> },\n ) => Promise<string>;\n}\n\ninterface WorkflowDefinition<Job extends WorkflowJob<any, any, any>> {\n name: string;\n mainJob: Job;\n}\n\n/**\n * Create a workflow definition that can be triggered via the Tailor SDK.\n * In production, bundler transforms .trigger() calls to tailor.workflow.triggerWorkflow().\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: async (input: { id: string }) => {\n * const data = await fetchData.trigger({ id: input.id }); // await is optional — stripped by bundler\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 ...config,\n // For local execution, directly call mainJob.trigger()\n // In production, bundler transforms this to tailor.workflow.triggerWorkflow()\n trigger: async (args) => {\n await config.mainJob.trigger(...([args] as unknown as []));\n return \"00000000-0000-0000-0000-000000000000\";\n },\n });\n}\n","import type { StaticWebsiteInput } from \"@/parser/service/staticwebsite/types\";\n\ndeclare const staticWebsiteDefinitionBrand: unique symbol;\ntype StaticWebsiteDefinitionBrand = {\n readonly [staticWebsiteDefinitionBrand]: true;\n};\n\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 */\nexport function defineStaticWebSite(name: string, config: Omit<StaticWebsiteInput, \"name\">) {\n const result = {\n ...config,\n name,\n get url() {\n return `${name}:url` as const;\n },\n } as const satisfies StaticWebsiteInput & { readonly url: string };\n\n return result as typeof result & StaticWebsiteDefinitionBrand;\n}\n\nexport type StaticWebsiteConfig = Omit<ReturnType<typeof defineStaticWebSite>, \"url\">;\n","import type { BuiltinIdP } from \"@/parser/service/auth/types\";\nimport type { IdPInput, IdpDefinitionBrand } from \"@/parser/service/idp/types\";\n\n/**\n * Configuration for GraphQL operations on IdP users.\n * All operations are enabled by default (undefined or true = enabled, false = disabled).\n */\nexport interface IdPGqlOperations {\n /** Enable _createUser mutation (default: true) */\n create?: boolean;\n /** Enable _updateUser mutation (default: true) */\n update?: boolean;\n /** Enable _deleteUser mutation (default: true) */\n delete?: boolean;\n /** Enable _users and _user queries (default: true) */\n read?: boolean;\n /** Enable _sendPasswordResetEmail mutation (default: true) */\n sendPasswordResetEmail?: boolean;\n}\n\n/**\n * Alias for common IdPGqlOperations configurations.\n * - \"query\": Read-only mode - disables all mutations (create, update, delete, sendPasswordResetEmail)\n */\nexport type IdPGqlOperationsAliasQuery = \"query\";\n\n/**\n * Configuration for GraphQL operations - either an alias string or detailed object.\n */\nexport type IdPGqlOperationsConfig = IdPGqlOperationsAliasQuery | IdPGqlOperations;\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 */\nexport function defineIdp<const TClients extends string[]>(\n name: string,\n config: Omit<IdPInput, \"name\" | \"clients\"> & { clients: TClients },\n) {\n const result = {\n ...config,\n name,\n provider(providerName: string, clientName: TClients[number]) {\n return {\n name: providerName,\n kind: \"BuiltInIdP\",\n namespace: name,\n clientName,\n } as const satisfies BuiltinIdP;\n },\n } as const satisfies IdPInput & {\n provider: (providerName: string, clientName: TClients[number]) => BuiltinIdP;\n };\n\n return result as typeof result & IdpDefinitionBrand;\n}\n\nexport type { IdPConfig, IdPExternalConfig } from \"@/parser/service/idp/types\";\n","import type { AppConfig } from \"@/parser/app-config/types\";\nimport type { GeneratorConfig } from \"@/parser/generator-config/types\";\nimport type { Plugin } from \"@/parser/plugin-config/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__ */\n// eslint-disable-next-line jsdoc/require-jsdoc\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 generators to be used with the Tailor SDK.\n * @deprecated Use definePlugins() with generation hooks (onTypeLoaded, generate, etc.) instead.\n * @param configs - Generator configurations\n * @returns Generator configurations as given\n */\n/* @__NO_SIDE_EFFECTS__ */\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport function defineGenerators(...configs: GeneratorConfig[]) {\n return configs;\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 jsdoc/require-jsdoc, @typescript-eslint/no-explicit-any\nexport function definePlugins(...configs: Plugin<any, any>[]) {\n return configs;\n}\n","import { t as _t } from \"@/configure/types\";\nimport type * as helperTypes from \"@/configure/types/helpers\";\n\ntype TailorOutput<T> = helperTypes.output<T>;\n\nexport type infer<T> = TailorOutput<T>;\nexport type output<T> = TailorOutput<T>;\n\n// eslint-disable-next-line import/export\nexport const t = { ..._t };\n// eslint-disable-next-line @typescript-eslint/no-namespace, import/export\nexport namespace t {\n export type output<T> = TailorOutput<T>;\n export type infer<T> = TailorOutput<T>;\n}\n\nexport {\n type TailorField,\n type TailorUser,\n unauthenticatedTailorUser,\n type AttributeMap,\n type AttributeList,\n type Env,\n} from \"@/configure/types\";\n\nexport * from \"@/configure/services\";\n\nexport { defineConfig, defineGenerators, definePlugins } from \"@/configure/config\";\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 \"@/parser/plugin-config/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 \"@/parser/plugin-config/generation-types\";\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["t","_t"],"sources":["../../src/configure/types/user.ts","../../src/configure/services/auth/index.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/workflow.ts","../../src/configure/services/staticwebsite/index.ts","../../src/configure/services/idp/index.ts","../../src/configure/config.ts","../../src/configure/index.ts"],"sourcesContent":["// Interfaces for module augmentation\n// Users can extend these via: declare module \"@tailor-platform/sdk\" { interface AttributeMap { ... } }\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface AttributeMap {}\nexport interface AttributeList {\n __tuple?: []; // Marker for tuple type\n}\n\nexport type InferredAttributeMap = keyof AttributeMap extends never\n ? Record<string, string | string[] | boolean | boolean[] | undefined>\n : AttributeMap;\n\nexport type InferredAttributeList = AttributeList[\"__tuple\"] extends []\n ? string[]\n : AttributeList[\"__tuple\"];\n\n/** Represents a user in the Tailor platform. */\nexport type TailorUser = {\n /**\n * The ID of the user.\n * For unauthenticated users, this will be a nil UUID.\n */\n id: string;\n /**\n * The type of the user.\n * For unauthenticated users, this will be an empty string.\n */\n type: \"user\" | \"machine_user\" | \"\";\n /** The ID of the workspace the user belongs to. */\n workspaceId: string;\n /**\n * A map of the user's attributes.\n * For unauthenticated users, this will be null.\n */\n attributes: InferredAttributeMap | null;\n /**\n * A list of the user's attributes.\n * For unauthenticated users, this will be an empty array.\n */\n attributeList: InferredAttributeList;\n};\n\n/** Represents an unauthenticated user in the Tailor platform. */\nexport const unauthenticatedTailorUser: TailorUser = {\n id: \"00000000-0000-0000-0000-000000000000\",\n type: \"\",\n workspaceId: \"00000000-0000-0000-0000-000000000000\",\n attributes: null,\n attributeList: [],\n};\n","import { type TailorDBInstance } from \"../tailordb/schema\";\nimport type { TailorField } from \"@/configure/types/type\";\nimport type { DefinedFieldMetadata, FieldMetadata, TailorFieldType } from \"@/configure/types/types\";\nimport type {\n AuthInvoker as ParserAuthInvoker,\n AuthDefinitionBrand,\n AuthServiceInput,\n DefinedAuth,\n UserAttributeListKey,\n UserAttributeMap,\n} from \"@/parser/service/auth/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 PlaceholderAttributeMap = UserAttributeMap<PlaceholderUser>;\ntype PlaceholderAttributeList = UserAttributeListKey<PlaceholderUser>[];\n\ntype UserProfileAuthInput<\n User extends TailorDBInstance,\n AttributeMap extends UserAttributeMap<User>,\n AttributeList extends UserAttributeListKey<User>[],\n MachineUserNames extends string,\n> = Omit<\n AuthServiceInput<User, AttributeMap, AttributeList, MachineUserNames, undefined>,\n \"userProfile\" | \"machineUserAttributes\"\n> & {\n userProfile: NonNullable<\n AuthServiceInput<User, AttributeMap, AttributeList, MachineUserNames, undefined>[\"userProfile\"]\n >;\n machineUserAttributes?: never;\n};\n\ntype MachineUserOnlyAuthInput<\n MachineUserNames extends string,\n MachineUserAttributes extends MachineUserAttributeFields,\n> = Omit<\n AuthServiceInput<\n PlaceholderUser,\n PlaceholderAttributeMap,\n PlaceholderAttributeList,\n MachineUserNames,\n MachineUserAttributes\n >,\n \"userProfile\" | \"machineUserAttributes\"\n> & {\n userProfile?: never;\n machineUserAttributes: MachineUserAttributes;\n};\n\nexport type {\n OIDC,\n SAML,\n IDToken,\n BuiltinIdP,\n IdProviderConfig,\n OAuth2ClientGrantType,\n OAuth2ClientInput as OAuth2Client,\n SCIMAuthorization,\n SCIMAttributeType,\n SCIMAttribute,\n SCIMAttributeMapping,\n SCIMResource,\n SCIMConfig,\n TenantProviderConfig,\n ValueOperand,\n UsernameFieldKey,\n UserAttributeKey,\n UserAttributeListKey,\n UserAttributeMap,\n AuthServiceInput,\n AuthConfig,\n AuthExternalConfig,\n AuthOwnConfig,\n DefinedAuth,\n} from \"@/parser/service/auth/types\";\n\n/**\n * Invoker type compatible with tailor.v1.AuthInvoker\n * - namespace: auth service name\n * - machineUserName: machine user name\n */\nexport type AuthInvoker<M extends string> = Omit<ParserAuthInvoker, \"machineUserName\"> & {\n machineUserName: M;\n};\n\n/**\n * Define an auth service for the Tailor SDK.\n * @template Name\n * @template User\n * @template AttributeMap\n * @template AttributeList\n * @template MachineUserNames\n * @template M\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 AttributeMap extends UserAttributeMap<User>,\n const AttributeList extends UserAttributeListKey<User>[],\n const MachineUserNames extends string,\n>(\n name: Name,\n config: UserProfileAuthInput<User, AttributeMap, AttributeList, MachineUserNames>,\n): DefinedAuth<\n Name,\n UserProfileAuthInput<User, AttributeMap, AttributeList, MachineUserNames>,\n MachineUserNames\n>;\nexport function defineAuth<\n const Name extends string,\n const MachineUserAttributes extends MachineUserAttributeFields,\n const MachineUserNames extends string,\n>(\n name: Name,\n config: MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes>,\n): DefinedAuth<\n Name,\n MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes>,\n MachineUserNames\n>;\nexport function defineAuth<\n const Name extends string,\n const User extends TailorDBInstance,\n const AttributeMap extends UserAttributeMap<User>,\n const AttributeList extends UserAttributeListKey<User>[],\n const MachineUserAttributes extends MachineUserAttributeFields,\n const MachineUserNames extends string,\n>(\n name: Name,\n config:\n | UserProfileAuthInput<User, AttributeMap, AttributeList, MachineUserNames>\n | MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes>,\n) {\n const result = {\n ...config,\n name,\n invoker<M extends MachineUserNames>(machineUser: M) {\n return { namespace: name, machineUserName: machineUser } as const;\n },\n } as const satisfies (\n | UserProfileAuthInput<User, AttributeMap, AttributeList, MachineUserNames>\n | MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes>\n ) & {\n name: string;\n invoker<M extends MachineUserNames>(machineUser: M): AuthInvoker<M>;\n };\n\n validateAuthConfig(result);\n\n return result as typeof result & AuthDefinitionBrand;\n}\n\nfunction validateAuthConfig(config: {\n userProfile?: unknown;\n machineUserAttributes?: unknown;\n}): void {\n const hasUserProfile = config.userProfile !== undefined;\n const hasMachineUserAttributes = config.machineUserAttributes !== undefined;\n\n if (hasUserProfile && hasMachineUserAttributes) {\n throw new Error(\"Provide either userProfile or machineUserAttributes, not both.\");\n }\n}\n","import { t } from \"@/configure/types/type\";\nimport { brandValue } from \"@/utils/brand\";\nimport type { TailorAnyField, TailorUser } from \"@/configure/types\";\nimport type { TailorEnv } from \"@/configure/types/env\";\nimport type { InferFieldsOutput, output } from \"@/configure/types/helpers\";\nimport type { TailorField } from \"@/configure/types/type\";\nimport type { ResolverInput } from \"@/parser/service/resolver/types\";\n\ntype Context<Input extends Record<string, TailorAnyField> | undefined> = {\n input: Input extends Record<string, TailorAnyField> ? InferFieldsOutput<Input> : never;\n user: TailorUser;\n env: TailorEnv;\n};\n\ntype OutputType<O> = O extends TailorAnyField\n ? output<O>\n : O extends Record<string, TailorAnyField>\n ? InferFieldsOutput<O>\n : never;\n\n/**\n * Normalized output type that preserves generic type information.\n * - If Output is already a TailorField, use it as-is\n * - If Output is a Record of fields, wrap it as a nested TailorField\n */\ntype NormalizedOutput<Output extends TailorAnyField | Record<string, TailorAnyField>> =\n Output extends TailorAnyField\n ? Output\n : TailorField<\n { type: \"nested\"; array: false },\n InferFieldsOutput<Extract<Output, Record<string, TailorAnyField>>>\n >;\n\ntype ResolverReturn<\n Input extends Record<string, TailorAnyField> | undefined,\n Output extends TailorAnyField | Record<string, TailorAnyField>,\n> = Omit<ResolverInput, \"input\" | \"output\" | \"body\"> &\n Readonly<{\n input?: Input;\n output: NormalizedOutput<Output>;\n body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;\n }>;\n\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 * `user` (TailorUser with id, type, workspaceId, attributes, attributeList), and `env` (TailorEnv).\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, user }) => {\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 */\nexport function createResolver<\n Input extends Record<string, TailorAnyField> | undefined = undefined,\n Output extends TailorAnyField | Record<string, TailorAnyField> = TailorAnyField,\n>(\n config: Omit<ResolverInput, \"input\" | \"output\" | \"body\"> &\n Readonly<{\n input?: Input;\n output: Output;\n body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;\n }>,\n): ResolverReturn<Input, Output> {\n // 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 ...config,\n output: normalizedOutput,\n } as ResolverReturn<Input, Output>);\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 { Operation } from \"./operation\";\nimport type { Trigger } from \"./trigger\";\nimport type { AuthInvoker } from \"@/configure/services/auth\";\nimport type { Workflow } from \"@/configure/services/workflow/workflow\";\nimport type { ExecutorInput } from \"@/parser/service/executor/types\";\n\n/**\n * Extract mainJob's Input type from Workflow.\n */\ntype WorkflowInput<W extends Workflow> = Parameters<W[\"trigger\"]>[0];\n\ntype 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: {\n kind: \"workflow\";\n workflow: W;\n args?: WorkflowInput<W> | ((args: TriggerArgs<T>) => WorkflowInput<W>);\n authInvoker?: AuthInvoker<string>;\n };\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\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);\n}\n","import type { ResolverConfig } from \"@/configure/services/resolver/resolver\";\nimport type { TailorDBType } from \"@/configure/services/tailordb/schema\";\nimport type { TailorActor } from \"@/configure/types/actor\";\nimport type { TailorEnv } from \"@/configure/types/env\";\nimport type { output } from \"@/configure/types/helpers\";\nimport type {\n RecordTrigger as ParserRecordTrigger,\n ResolverExecutedTrigger as ParserResolverExecutedTrigger,\n IdpUserTrigger as ParserIdpUserTrigger,\n AuthAccessTokenTrigger as ParserAuthAccessTokenTrigger,\n} from \"@/parser/service/executor/types\";\n\ninterface EventArgs {\n workspaceId: string;\n appNamespace: string;\n env: TailorEnv;\n actor: TailorActor | null;\n}\n\ninterface RecordArgs extends EventArgs {\n typeName: string;\n}\n\nexport interface RecordCreatedArgs<T extends TailorDBType> extends RecordArgs {\n newRecord: output<T>;\n}\n\nexport interface RecordUpdatedArgs<T extends TailorDBType> extends RecordArgs {\n newRecord: output<T>;\n oldRecord: output<T>;\n}\n\nexport interface RecordDeletedArgs<T extends TailorDBType> extends RecordArgs {\n oldRecord: output<T>;\n}\n\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\nexport type RecordTrigger<Args> = ParserRecordTrigger & {\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): RecordTrigger<RecordCreatedArgs<T>> {\n const { type, condition } = options;\n return {\n kind: \"recordCreated\",\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): RecordTrigger<RecordUpdatedArgs<T>> {\n const { type, condition } = options;\n return {\n kind: \"recordUpdated\",\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): RecordTrigger<RecordDeletedArgs<T>> {\n const { type, condition } = options;\n return {\n kind: \"recordDeleted\",\n typeName: type.name,\n condition,\n __args: {} as RecordDeletedArgs<T>,\n };\n}\n\nexport type ResolverExecutedTrigger<Args> = ParserResolverExecutedTrigger & {\n __args: Args;\n};\n\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// IdP User Event Triggers\nexport interface IdpUserArgs extends EventArgs {\n namespaceName: string;\n userId: string;\n}\n\nexport type IdpUserTrigger<Args> = ParserIdpUserTrigger & {\n __args: Args;\n};\n\n/**\n * Create a trigger that fires when an IdP user is created.\n * @returns IdP user created trigger\n */\nexport function idpUserCreatedTrigger(): IdpUserTrigger<IdpUserArgs> {\n return {\n kind: \"idpUserCreated\",\n __args: {} as IdpUserArgs,\n };\n}\n\n/**\n * Create a trigger that fires when an IdP user is updated.\n * @returns IdP user updated trigger\n */\nexport function idpUserUpdatedTrigger(): IdpUserTrigger<IdpUserArgs> {\n return {\n kind: \"idpUserUpdated\",\n __args: {} as IdpUserArgs,\n };\n}\n\n/**\n * Create a trigger that fires when an IdP user is deleted.\n * @returns IdP user deleted trigger\n */\nexport function idpUserDeletedTrigger(): IdpUserTrigger<IdpUserArgs> {\n return {\n kind: \"idpUserDeleted\",\n __args: {} as IdpUserArgs,\n };\n}\n\n// Auth Access Token Event Triggers\nexport interface AuthAccessTokenArgs extends EventArgs {\n namespaceName: string;\n userId: string;\n}\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<AuthAccessTokenArgs> {\n return {\n kind: \"authAccessTokenIssued\",\n __args: {} as AuthAccessTokenArgs,\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<AuthAccessTokenArgs> {\n return {\n kind: \"authAccessTokenRefreshed\",\n __args: {} as AuthAccessTokenArgs,\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<AuthAccessTokenArgs> {\n return {\n kind: \"authAccessTokenRevoked\",\n __args: {} as AuthAccessTokenArgs,\n };\n}\n","import type { TailorEnv } from \"@/configure/types/env\";\nimport type { ScheduleTriggerInput as ParserScheduleTriggerInput } from \"@/parser/service/executor/types\";\nimport type { StandardCRON } from \"ts-cron-validator\";\n\ntype Timezone =\n | \"UTC\"\n | \"Pacific/Midway\"\n | \"Pacific/Niue\"\n | \"Pacific/Pago_Pago\"\n | \"America/Adak\"\n | \"Pacific/Honolulu\"\n | \"Pacific/Rarotonga\"\n | \"Pacific/Tahiti\"\n | \"Pacific/Marquesas\"\n | \"America/Anchorage\"\n | \"America/Juneau\"\n | \"America/Metlakatla\"\n | \"America/Nome\"\n | \"America/Sitka\"\n | \"America/Yakutat\"\n | \"Pacific/Gambier\"\n | \"America/Los_Angeles\"\n | \"America/Tijuana\"\n | \"America/Vancouver\"\n | \"Pacific/Pitcairn\"\n | \"America/Boise\"\n | \"America/Cambridge_Bay\"\n | \"America/Chihuahua\"\n | \"America/Creston\"\n | \"America/Dawson\"\n | \"America/Dawson_Creek\"\n | \"America/Denver\"\n | \"America/Edmonton\"\n | \"America/Fort_Nelson\"\n | \"America/Hermosillo\"\n | \"America/Inuvik\"\n | \"America/Mazatlan\"\n | \"America/Ojinaga\"\n | \"America/Phoenix\"\n | \"America/Whitehorse\"\n | \"America/Yellowknife\"\n | \"America/Bahia_Banderas\"\n | \"America/Belize\"\n | \"America/Chicago\"\n | \"America/Costa_Rica\"\n | \"America/El_Salvador\"\n | \"America/Guatemala\"\n | \"America/Indiana/Knox\"\n | \"America/Indiana/Tell_City\"\n | \"America/Managua\"\n | \"America/Matamoros\"\n | \"America/Menominee\"\n | \"America/Merida\"\n | \"America/Mexico_City\"\n | \"America/Monterrey\"\n | \"America/North_Dakota/Beulah\"\n | \"America/North_Dakota/Center\"\n | \"America/North_Dakota/New_Salem\"\n | \"America/Rainy_River\"\n | \"America/Rankin_Inlet\"\n | \"America/Regina\"\n | \"America/Resolute\"\n | \"America/Swift_Current\"\n | \"America/Tegucigalpa\"\n | \"America/Winnipeg\"\n | \"Pacific/Easter\"\n | \"Pacific/Galapagos\"\n | \"America/Atikokan\"\n | \"America/Bogota\"\n | \"America/Cancun\"\n | \"America/Cayman\"\n | \"America/Detroit\"\n | \"America/Eirunepe\"\n | \"America/Grand_Turk\"\n | \"America/Guayaquil\"\n | \"America/Havana\"\n | \"America/Indiana/Indianapolis\"\n | \"America/Indiana/Marengo\"\n | \"America/Indiana/Petersburg\"\n | \"America/Indiana/Vevay\"\n | \"America/Indiana/Vincennes\"\n | \"America/Indiana/Winamac\"\n | \"America/Iqaluit\"\n | \"America/Jamaica\"\n | \"America/Kentucky/Louisville\"\n | \"America/Kentucky/Monticello\"\n | \"America/Lima\"\n | \"America/Nassau\"\n | \"America/New_York\"\n | \"America/Nipigon\"\n | \"America/Panama\"\n | \"America/Pangnirtung\"\n | \"America/Port-au-Prince\"\n | \"America/Rio_Branco\"\n | \"America/Thunder_Bay\"\n | \"America/Toronto\"\n | \"America/Anguilla\"\n | \"America/Antigua\"\n | \"America/Aruba\"\n | \"America/Asuncion\"\n | \"America/Barbados\"\n | \"America/Blanc-Sablon\"\n | \"America/Boa_Vista\"\n | \"America/Campo_Grande\"\n | \"America/Caracas\"\n | \"America/Cuiaba\"\n | \"America/Curacao\"\n | \"America/Dominica\"\n | \"America/Glace_Bay\"\n | \"America/Goose_Bay\"\n | \"America/Grenada\"\n | \"America/Guadeloupe\"\n | \"America/Guyana\"\n | \"America/Halifax\"\n | \"America/Kralendijk\"\n | \"America/La_Paz\"\n | \"America/Lower_Princes\"\n | \"America/Manaus\"\n | \"America/Marigot\"\n | \"America/Martinique\"\n | \"America/Moncton\"\n | \"America/Montserrat\"\n | \"America/Porto_Velho\"\n | \"America/Port_of_Spain\"\n | \"America/Puerto_Rico\"\n | \"America/Santiago\"\n | \"America/Santo_Domingo\"\n | \"America/St_Barthelemy\"\n | \"America/St_Kitts\"\n | \"America/St_Lucia\"\n | \"America/St_Thomas\"\n | \"America/St_Vincent\"\n | \"America/Thule\"\n | \"America/Tortola\"\n | \"Atlantic/Bermuda\"\n | \"America/St_Johns\"\n | \"America/Araguaina\"\n | \"America/Argentina/Buenos_Aires\"\n | \"America/Argentina/Catamarca\"\n | \"America/Argentina/Cordoba\"\n | \"America/Argentina/Jujuy\"\n | \"America/Argentina/La_Rioja\"\n | \"America/Argentina/Mendoza\"\n | \"America/Argentina/Rio_Gallegos\"\n | \"America/Argentina/Salta\"\n | \"America/Argentina/San_Juan\"\n | \"America/Argentina/San_Luis\"\n | \"America/Argentina/Tucuman\"\n | \"America/Argentina/Ushuaia\"\n | \"America/Bahia\"\n | \"America/Belem\"\n | \"America/Cayenne\"\n | \"America/Fortaleza\"\n | \"America/Godthab\"\n | \"America/Maceio\"\n | \"America/Miquelon\"\n | \"America/Montevideo\"\n | \"America/Paramaribo\"\n | \"America/Punta_Arenas\"\n | \"America/Recife\"\n | \"America/Santarem\"\n | \"America/Sao_Paulo\"\n | \"Antarctica/Palmer\"\n | \"Antarctica/Rothera\"\n | \"Atlantic/Stanley\"\n | \"America/Noronha\"\n | \"Atlantic/South_Georgia\"\n | \"America/Scoresbysund\"\n | \"Atlantic/Azores\"\n | \"Atlantic/Cape_Verde\"\n | \"Africa/Abidjan\"\n | \"Africa/Accra\"\n | \"Africa/Bamako\"\n | \"Africa/Banjul\"\n | \"Africa/Bissau\"\n | \"Africa/Casablanca\"\n | \"Africa/Conakry\"\n | \"Africa/Dakar\"\n | \"Africa/El_Aaiun\"\n | \"Africa/Freetown\"\n | \"Africa/Lome\"\n | \"Africa/Monrovia\"\n | \"Africa/Nouakchott\"\n | \"Africa/Ouagadougou\"\n | \"Africa/Sao_Tome\"\n | \"America/Danmarkshavn\"\n | \"Antarctica/Troll\"\n | \"Atlantic/Canary\"\n | \"Atlantic/Faroe\"\n | \"Atlantic/Madeira\"\n | \"Atlantic/Reykjavik\"\n | \"Atlantic/St_Helena\"\n | \"Europe/Dublin\"\n | \"Europe/Guernsey\"\n | \"Europe/Isle_of_Man\"\n | \"Europe/Jersey\"\n | \"Europe/Lisbon\"\n | \"Europe/London\"\n | \"Africa/Algiers\"\n | \"Africa/Bangui\"\n | \"Africa/Brazzaville\"\n | \"Africa/Ceuta\"\n | \"Africa/Douala\"\n | \"Africa/Kinshasa\"\n | \"Africa/Lagos\"\n | \"Africa/Libreville\"\n | \"Africa/Luanda\"\n | \"Africa/Malabo\"\n | \"Africa/Ndjamena\"\n | \"Africa/Niamey\"\n | \"Africa/Porto-Novo\"\n | \"Africa/Tunis\"\n | \"Africa/Windhoek\"\n | \"Arctic/Longyearbyen\"\n | \"Europe/Amsterdam\"\n | \"Europe/Andorra\"\n | \"Europe/Belgrade\"\n | \"Europe/Berlin\"\n | \"Europe/Bratislava\"\n | \"Europe/Brussels\"\n | \"Europe/Budapest\"\n | \"Europe/Copenhagen\"\n | \"Europe/Gibraltar\"\n | \"Europe/Ljubljana\"\n | \"Europe/Luxembourg\"\n | \"Europe/Madrid\"\n | \"Europe/Malta\"\n | \"Europe/Monaco\"\n | \"Europe/Oslo\"\n | \"Europe/Paris\"\n | \"Europe/Podgorica\"\n | \"Europe/Prague\"\n | \"Europe/Rome\"\n | \"Europe/San_Marino\"\n | \"Europe/Sarajevo\"\n | \"Europe/Skopje\"\n | \"Europe/Stockholm\"\n | \"Europe/Tirane\"\n | \"Europe/Vaduz\"\n | \"Europe/Vatican\"\n | \"Europe/Vienna\"\n | \"Europe/Warsaw\"\n | \"Europe/Zagreb\"\n | \"Europe/Zurich\"\n | \"Africa/Blantyre\"\n | \"Africa/Bujumbura\"\n | \"Africa/Cairo\"\n | \"Africa/Gaborone\"\n | \"Africa/Harare\"\n | \"Africa/Johannesburg\"\n | \"Africa/Juba\"\n | \"Africa/Khartoum\"\n | \"Africa/Kigali\"\n | \"Africa/Lubumbashi\"\n | \"Africa/Lusaka\"\n | \"Africa/Maputo\"\n | \"Africa/Maseru\"\n | \"Africa/Mbabane\"\n | \"Africa/Tripoli\"\n | \"Asia/Amman\"\n | \"Asia/Beirut\"\n | \"Asia/Damascus\"\n | \"Asia/Famagusta\"\n | \"Asia/Gaza\"\n | \"Asia/Hebron\"\n | \"Asia/Jerusalem\"\n | \"Asia/Nicosia\"\n | \"Europe/Athens\"\n | \"Europe/Bucharest\"\n | \"Europe/Chisinau\"\n | \"Europe/Helsinki\"\n | \"Europe/Kaliningrad\"\n | \"Europe/Kyiv\"\n | \"Europe/Mariehamn\"\n | \"Europe/Riga\"\n | \"Europe/Sofia\"\n | \"Europe/Tallinn\"\n | \"Europe/Uzhgorod\"\n | \"Europe/Vilnius\"\n | \"Europe/Zaporizhzhia\"\n | \"Africa/Addis_Ababa\"\n | \"Africa/Asmara\"\n | \"Africa/Dar_es_Salaam\"\n | \"Africa/Djibouti\"\n | \"Africa/Kampala\"\n | \"Africa/Mogadishu\"\n | \"Africa/Nairobi\"\n | \"Antarctica/Syowa\"\n | \"Asia/Aden\"\n | \"Asia/Baghdad\"\n | \"Asia/Bahrain\"\n | \"Asia/Kuwait\"\n | \"Asia/Qatar\"\n | \"Asia/Riyadh\"\n | \"Europe/Istanbul\"\n | \"Europe/Kirov\"\n | \"Europe/Minsk\"\n | \"Europe/Moscow\"\n | \"Europe/Simferopol\"\n | \"Europe/Volgograd\"\n | \"Indian/Antananarivo\"\n | \"Indian/Comoro\"\n | \"Indian/Mayotte\"\n | \"Asia/Tehran\"\n | \"Asia/Baku\"\n | \"Asia/Dubai\"\n | \"Asia/Muscat\"\n | \"Asia/Tbilisi\"\n | \"Asia/Yerevan\"\n | \"Europe/Astrakhan\"\n | \"Europe/Samara\"\n | \"Europe/Saratov\"\n | \"Europe/Ulyanovsk\"\n | \"Indian/Mahe\"\n | \"Indian/Mauritius\"\n | \"Indian/Reunion\"\n | \"Asia/Kabul\"\n | \"Antarctica/Mawson\"\n | \"Asia/Aqtau\"\n | \"Asia/Aqtobe\"\n | \"Asia/Ashgabat\"\n | \"Asia/Atyrau\"\n | \"Asia/Dushanbe\"\n | \"Asia/Karachi\"\n | \"Asia/Oral\"\n | \"Asia/Qyzylorda\"\n | \"Asia/Samarkand\"\n | \"Asia/Tashkent\"\n | \"Asia/Yekaterinburg\"\n | \"Indian/Kerguelen\"\n | \"Indian/Maldives\"\n | \"Asia/Colombo\"\n | \"Asia/Kolkata\"\n | \"Asia/Kathmandu\"\n | \"Antarctica/Vostok\"\n | \"Asia/Almaty\"\n | \"Asia/Bishkek\"\n | \"Asia/Dhaka\"\n | \"Asia/Omsk\"\n | \"Asia/Qostanay\"\n | \"Asia/Thimphu\"\n | \"Asia/Urumqi\"\n | \"Indian/Chagos\"\n | \"Asia/Yangon\"\n | \"Indian/Cocos\"\n | \"Antarctica/Davis\"\n | \"Asia/Bangkok\"\n | \"Asia/Barnaul\"\n | \"Asia/Hovd\"\n | \"Asia/Ho_Chi_Minh\"\n | \"Asia/Jakarta\"\n | \"Asia/Krasnoyarsk\"\n | \"Asia/Novokuznetsk\"\n | \"Asia/Novosibirsk\"\n | \"Asia/Phnom_Penh\"\n | \"Asia/Pontianak\"\n | \"Asia/Tomsk\"\n | \"Asia/Vientiane\"\n | \"Indian/Christmas\"\n | \"Asia/Brunei\"\n | \"Asia/Choibalsan\"\n | \"Asia/Hong_Kong\"\n | \"Asia/Irkutsk\"\n | \"Asia/Kuala_Lumpur\"\n | \"Asia/Kuching\"\n | \"Asia/Macau\"\n | \"Asia/Makassar\"\n | \"Asia/Manila\"\n | \"Asia/Shanghai\"\n | \"Asia/Singapore\"\n | \"Asia/Taipei\"\n | \"Asia/Ulaanbaatar\"\n | \"Australia/Perth\"\n | \"Australia/Eucla\"\n | \"Asia/Chita\"\n | \"Asia/Dili\"\n | \"Asia/Jayapura\"\n | \"Asia/Khandyga\"\n | \"Asia/Pyongyang\"\n | \"Asia/Seoul\"\n | \"Asia/Tokyo\"\n | \"Asia/Yakutsk\"\n | \"Pacific/Palau\"\n | \"Australia/Adelaide\"\n | \"Australia/Broken_Hill\"\n | \"Australia/Darwin\"\n | \"Antarctica/DumontDUrville\"\n | \"Antarctica/Macquarie\"\n | \"Asia/Ust-Nera\"\n | \"Asia/Vladivostok\"\n | \"Australia/Brisbane\"\n | \"Australia/Currie\"\n | \"Australia/Hobart\"\n | \"Australia/Lindeman\"\n | \"Australia/Melbourne\"\n | \"Australia/Sydney\"\n | \"Pacific/Chuuk\"\n | \"Pacific/Guam\"\n | \"Pacific/Port_Moresby\"\n | \"Pacific/Saipan\"\n | \"Australia/Lord_Howe\"\n | \"Antarctica/Casey\"\n | \"Asia/Magadan\"\n | \"Asia/Sakhalin\"\n | \"Asia/Srednekolymsk\"\n | \"Pacific/Bougainville\"\n | \"Pacific/Efate\"\n | \"Pacific/Guadalcanal\"\n | \"Pacific/Kosrae\"\n | \"Pacific/Norfolk\"\n | \"Pacific/Noumea\"\n | \"Pacific/Pohnpei\"\n | \"Antarctica/McMurdo\"\n | \"Asia/Anadyr\"\n | \"Asia/Kamchatka\"\n | \"Pacific/Auckland\"\n | \"Pacific/Fiji\"\n | \"Pacific/Funafuti\"\n | \"Pacific/Kwajalein\"\n | \"Pacific/Majuro\"\n | \"Pacific/Nauru\"\n | \"Pacific/Tarawa\"\n | \"Pacific/Wake\"\n | \"Pacific/Wallis\"\n | \"Pacific/Chatham\"\n | \"Pacific/Apia\"\n | \"Pacific/Enderbury\"\n | \"Pacific/Fakaofo\"\n | \"Pacific/Tongatapu\"\n | \"Pacific/Kiritimati\";\n\nexport type ScheduleTrigger<Args> = ParserScheduleTriggerInput & {\n __args: Args;\n};\n\nexport interface ScheduleArgs {\n env: TailorEnv;\n}\n\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 \"@/configure/types/env\";\nimport type { IncomingWebhookTrigger as ParserIncomingWebhookTrigger } from \"@/parser/service/executor/types\";\n\nexport interface IncomingWebhookArgs<T extends IncomingWebhookRequest> {\n body: T[\"body\"];\n headers: T[\"headers\"];\n method: \"POST\" | \"GET\" | \"PUT\" | \"DELETE\";\n rawBody: string;\n env: TailorEnv;\n}\n\nexport interface IncomingWebhookRequest {\n body: Record<string, unknown>;\n headers: Record<string, string>;\n}\n\nexport type IncomingWebhookTrigger<Args> = ParserIncomingWebhookTrigger & {\n __args: Args;\n};\n\n/**\n * Create a trigger for incoming webhook requests.\n * @template T\n * @returns Incoming webhook trigger\n */\nexport function incomingWebhookTrigger<T extends IncomingWebhookRequest>(): IncomingWebhookTrigger<\n IncomingWebhookArgs<T>\n> {\n return {\n kind: \"incomingWebhook\",\n __args: {} as IncomingWebhookArgs<T>,\n };\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { brandValue } from \"@/utils/brand\";\nimport type { WorkflowJob } from \"./job\";\nimport type { AuthInvoker } from \"../auth\";\n\nexport interface WorkflowConfig<\n Job extends WorkflowJob<any, any, any> = WorkflowJob<any, any, any>,\n> {\n name: string;\n mainJob: Job;\n}\n\nexport interface Workflow<Job extends WorkflowJob<any, any, any> = WorkflowJob<any, any, any>> {\n name: string;\n mainJob: Job;\n trigger: (\n args: Parameters<Job[\"trigger\"]>[0],\n options?: { authInvoker: AuthInvoker<string> },\n ) => Promise<string>;\n}\n\ninterface WorkflowDefinition<Job extends WorkflowJob<any, any, any>> {\n name: string;\n mainJob: Job;\n}\n\n/**\n * Create a workflow definition that can be triggered via the Tailor SDK.\n * In production, bundler transforms .trigger() calls to tailor.workflow.triggerWorkflow().\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: async (input: { id: string }) => {\n * const data = await fetchData.trigger({ id: input.id }); // await is optional — stripped by bundler\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 ...config,\n // For local execution, directly call mainJob.trigger()\n // In production, bundler transforms this to tailor.workflow.triggerWorkflow()\n trigger: async (args) => {\n await config.mainJob.trigger(...([args] as unknown as []));\n return \"00000000-0000-0000-0000-000000000000\";\n },\n });\n}\n","import type { StaticWebsiteInput } from \"@/parser/service/staticwebsite/types\";\n\ndeclare const staticWebsiteDefinitionBrand: unique symbol;\ntype StaticWebsiteDefinitionBrand = {\n readonly [staticWebsiteDefinitionBrand]: true;\n};\n\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 */\nexport function defineStaticWebSite(name: string, config: Omit<StaticWebsiteInput, \"name\">) {\n const result = {\n ...config,\n name,\n get url() {\n return `${name}:url` as const;\n },\n } as const satisfies StaticWebsiteInput & { readonly url: string };\n\n return result as typeof result & StaticWebsiteDefinitionBrand;\n}\n\nexport type StaticWebsiteConfig = Omit<ReturnType<typeof defineStaticWebSite>, \"url\">;\n","import type { BuiltinIdP } from \"@/parser/service/auth/types\";\nimport type { IdPInput, IdpDefinitionBrand } from \"@/parser/service/idp/types\";\n\n/**\n * Configuration for GraphQL operations on IdP users.\n * All operations are enabled by default (undefined or true = enabled, false = disabled).\n */\nexport interface IdPGqlOperations {\n /** Enable _createUser mutation (default: true) */\n create?: boolean;\n /** Enable _updateUser mutation (default: true) */\n update?: boolean;\n /** Enable _deleteUser mutation (default: true) */\n delete?: boolean;\n /** Enable _users and _user queries (default: true) */\n read?: boolean;\n /** Enable _sendPasswordResetEmail mutation (default: true) */\n sendPasswordResetEmail?: boolean;\n}\n\n/**\n * Alias for common IdPGqlOperations configurations.\n * - \"query\": Read-only mode - disables all mutations (create, update, delete, sendPasswordResetEmail)\n */\nexport type IdPGqlOperationsAliasQuery = \"query\";\n\n/**\n * Configuration for GraphQL operations - either an alias string or detailed object.\n */\nexport type IdPGqlOperationsConfig = IdPGqlOperationsAliasQuery | IdPGqlOperations;\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 */\nexport function defineIdp<const TClients extends string[]>(\n name: string,\n config: Omit<IdPInput, \"name\" | \"clients\"> & { clients: TClients },\n) {\n const result = {\n ...config,\n name,\n provider(providerName: string, clientName: TClients[number]) {\n return {\n name: providerName,\n kind: \"BuiltInIdP\",\n namespace: name,\n clientName,\n } as const satisfies BuiltinIdP;\n },\n } as const satisfies IdPInput & {\n provider: (providerName: string, clientName: TClients[number]) => BuiltinIdP;\n };\n\n return result as typeof result & IdpDefinitionBrand;\n}\n\nexport type { IdPConfig, IdPExternalConfig } from \"@/parser/service/idp/types\";\n","import type { AppConfig } from \"@/parser/app-config/types\";\nimport type { GeneratorConfig } from \"@/parser/generator-config/types\";\nimport type { Plugin } from \"@/parser/plugin-config/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__ */\n// eslint-disable-next-line jsdoc/require-jsdoc\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 generators to be used with the Tailor SDK.\n * @deprecated Use definePlugins() with generation hooks (onTypeLoaded, generate, etc.) instead.\n * @param configs - Generator configurations\n * @returns Generator configurations as given\n */\n/* @__NO_SIDE_EFFECTS__ */\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport function defineGenerators(...configs: GeneratorConfig[]) {\n return configs;\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 jsdoc/require-jsdoc, @typescript-eslint/no-explicit-any\nexport function definePlugins(...configs: Plugin<any, any>[]) {\n return configs;\n}\n","import { t as _t } from \"@/configure/types\";\nimport type * as helperTypes from \"@/configure/types/helpers\";\n\ntype TailorOutput<T> = helperTypes.output<T>;\n\nexport type infer<T> = TailorOutput<T>;\nexport type output<T> = TailorOutput<T>;\n\n// eslint-disable-next-line import/export\nexport const t = { ..._t };\n// eslint-disable-next-line @typescript-eslint/no-namespace, import/export\nexport namespace t {\n export type output<T> = TailorOutput<T>;\n export type infer<T> = TailorOutput<T>;\n}\n\nexport {\n type TailorField,\n type TailorUser,\n unauthenticatedTailorUser,\n type AttributeMap,\n type AttributeList,\n type Env,\n} from \"@/configure/types\";\n\nexport * from \"@/configure/services\";\n\nexport { defineConfig, defineGenerators, definePlugins } from \"@/configure/config\";\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 \"@/parser/plugin-config/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 \"@/parser/plugin-config/generation-types\";\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum-constants-
|
|
1
|
+
{"version":3,"file":"enum-constants-B5Nl-yzx.mjs","names":[],"sources":["../src/plugin/builtin/enum-constants/generate-enum-constants.ts","../src/plugin/builtin/enum-constants/process-enum-type.ts","../src/plugin/builtin/enum-constants/index.ts"],"sourcesContent":["import type { EnumDefinition } from \"./types\";\n\n/**\n * Generate enum constant definitions from collected metadata.\n * @param allEnums - All collected enum definitions\n * @returns Generated enum constant definitions\n */\nexport function generateUnifiedEnumConstants(allEnums: EnumDefinition[]): string {\n if (allEnums.length === 0) {\n return \"\";\n }\n\n const enumMap = new Map<string, EnumDefinition>();\n for (const enumDef of allEnums) {\n enumMap.set(enumDef.name, enumDef);\n }\n\n const enumDefs = Array.from(enumMap.values())\n .map((e) => {\n const members = e.values\n .map((v) => {\n const key = v.value.replace(/[-\\s]/g, \"_\");\n return ` \"${key}\": \"${v.value}\"`;\n })\n .join(\",\\n\");\n\n const hasDescriptions = e.values.some((v) => v.description);\n let jsDoc = \"\";\n if (e.fieldDescription || hasDescriptions) {\n const lines: string[] = [];\n\n if (e.fieldDescription) {\n lines.push(` * ${e.fieldDescription}`);\n if (hasDescriptions) {\n lines.push(\" *\");\n }\n }\n\n if (hasDescriptions) {\n const propertyDocs = e.values.map((v) => {\n const key = v.value.replace(/[-\\s]/g, \"_\");\n return ` * @property ${[key, v.description].filter(Boolean).join(\" - \")}`;\n });\n lines.push(...propertyDocs);\n }\n\n if (lines.length > 0) {\n jsDoc = `/**\\n${lines.join(\"\\n\")}\\n */\\n`;\n }\n }\n\n const constDef = `${jsDoc}export const ${e.name} = {\\n${members}\\n} as const;`;\n const typeDef = `export type ${e.name} = (typeof ${e.name})[keyof typeof ${e.name}];`;\n return `${constDef}\\n${typeDef}`;\n })\n .join(\"\\n\\n\");\n\n if (!enumDefs) {\n return \"\";\n }\n\n return enumDefs + \"\\n\";\n}\n","import type { EnumConstantMetadata } from \"./types\";\nimport type { TailorDBType } from \"@/parser/service/tailordb/types\";\n\nfunction capitalizeFirst(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nfunction collectEnums(type: TailorDBType): EnumConstantMetadata[\"enums\"] {\n const enums: EnumConstantMetadata[\"enums\"] = [];\n\n for (const [fieldName, parsedField] of Object.entries(type.fields)) {\n if (parsedField.config.type === \"enum\" && parsedField.config.allowedValues) {\n const enumTypeName = `${type.name}${capitalizeFirst(fieldName)}`;\n enums.push({\n name: enumTypeName,\n values: parsedField.config.allowedValues,\n fieldDescription: parsedField.config.description,\n });\n }\n\n // Process nested fields\n if (parsedField.config.type === \"nested\" && parsedField.config.fields) {\n for (const [nestedFieldName, nestedFieldConfig] of Object.entries(\n parsedField.config.fields,\n )) {\n if (nestedFieldConfig.type === \"enum\" && nestedFieldConfig.allowedValues) {\n const fullFieldName = `${fieldName}${capitalizeFirst(nestedFieldName)}`;\n const enumTypeName = `${type.name}${capitalizeFirst(fullFieldName)}`;\n enums.push({\n name: enumTypeName,\n values: nestedFieldConfig.allowedValues,\n fieldDescription: nestedFieldConfig.description,\n });\n }\n }\n }\n }\n\n return enums;\n}\n\n/**\n * Process a TailorDB type and extract enum metadata.\n * @param type - The parsed TailorDB type to process\n * @returns Enum constant metadata for the type\n */\nexport async function processEnumType(type: TailorDBType): Promise<EnumConstantMetadata> {\n const enums = collectEnums(type);\n\n return {\n name: type.name,\n enums,\n };\n}\n","import { generateUnifiedEnumConstants } from \"./generate-enum-constants\";\nimport { processEnumType } from \"./process-enum-type\";\nimport type { EnumDefinition } from \"./types\";\nimport type {\n GeneratorResult,\n TailorDBReadyContext,\n} from \"@/parser/plugin-config/generation-types\";\nimport type { Plugin } from \"@/parser/plugin-config/types\";\n\nexport const EnumConstantsGeneratorID = \"@tailor-platform/enum-constants\";\n\ntype EnumConstantsPluginOptions = {\n distPath: string;\n};\n\n/**\n * Plugin that generates enum constants from TailorDB type definitions.\n * @param options - Plugin options\n * @param options.distPath - Output file path for generated constants\n * @returns Plugin instance with onTailorDBReady hook\n */\nexport function enumConstantsPlugin(\n options: EnumConstantsPluginOptions,\n): Plugin<unknown, EnumConstantsPluginOptions> {\n return {\n id: EnumConstantsGeneratorID,\n description: \"Generates enum constants from TailorDB type definitions\",\n pluginConfig: options,\n\n async onTailorDBReady(\n ctx: TailorDBReadyContext<EnumConstantsPluginOptions>,\n ): Promise<GeneratorResult> {\n const allEnums: EnumDefinition[] = [];\n\n for (const ns of ctx.tailordb) {\n for (const type of Object.values(ns.types)) {\n const metadata = await processEnumType(type);\n allEnums.push(...metadata.enums);\n }\n }\n\n const files: GeneratorResult[\"files\"] = [];\n if (allEnums.length > 0) {\n const content = generateUnifiedEnumConstants(allEnums);\n files.push({\n path: ctx.pluginConfig.distPath,\n content,\n });\n }\n\n return { files };\n },\n };\n}\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-utils-
|
|
1
|
+
{"version":3,"file":"file-utils-sEOwAdJ4.mjs","names":[],"sources":["../src/plugin/builtin/file-utils/generate-file-utils.ts","../src/plugin/builtin/file-utils/process-file-type.ts","../src/plugin/builtin/file-utils/index.ts"],"sourcesContent":["import multiline from \"multiline-ts\";\nimport type { FileUtilMetadata } from \"./types\";\n\n/**\n * Generate unified file utility functions from collected metadata.\n * @param namespaceData - Namespace data with file utility metadata\n * @returns Generated file utility code\n */\nexport function generateUnifiedFileUtils(\n namespaceData: { namespace: string; types: FileUtilMetadata[] }[],\n): string {\n if (namespaceData.length === 0) {\n return \"\";\n }\n\n // Collect all types with their namespace\n const typeNamespaceMap = new Map<string, string>();\n const typeFieldsMap = new Map<string, string[]>();\n\n for (const { namespace, types } of namespaceData) {\n for (const type of types) {\n typeNamespaceMap.set(type.name, namespace);\n typeFieldsMap.set(type.name, type.fileFields);\n }\n }\n\n if (typeNamespaceMap.size === 0) {\n return \"\";\n }\n\n // Generate interface fields\n const interfaceFields = Array.from(typeFieldsMap.entries())\n .map(([typeName, fields]) => {\n const fieldNamesUnion = fields.map((field) => `\"${field}\"`).join(\" | \");\n return ` ${typeName}: {\\n fields: ${fieldNamesUnion};\\n };`;\n })\n .join(\"\\n\");\n\n const interfaceDefinition =\n multiline /* ts */ `\n export interface TypeWithFiles {\n ${interfaceFields}\n }\n ` + \"\\n\";\n\n // Generate namespaces object\n const namespaceEntries = Array.from(typeNamespaceMap.entries())\n .map(([typeName, namespace]) => ` ${typeName}: \"${namespace}\"`)\n .join(\",\\n\");\n\n const namespacesDefinition =\n multiline /* ts */ `\n const namespaces: Record<keyof TypeWithFiles, string> = {\n ${namespaceEntries},\n };\n ` + \"\\n\";\n\n // Generate downloadFile helper function\n const downloadFunction =\n multiline /* ts */ `\n export async function downloadFile<T extends keyof TypeWithFiles>(\n type: T,\n field: TypeWithFiles[T][\"fields\"],\n recordId: string,\n ) {\n return await tailordb.file.download(namespaces[type], type, field, recordId);\n }\n ` + \"\\n\";\n\n // Generate uploadFile helper function\n const uploadFunction =\n multiline /* ts */ `\n export async function uploadFile<T extends keyof TypeWithFiles>(\n type: T,\n field: TypeWithFiles[T][\"fields\"],\n recordId: string,\n data: string | ArrayBuffer | Uint8Array<ArrayBufferLike> | number[],\n options?: FileUploadOptions,\n ): Promise<FileUploadResponse> {\n return await tailordb.file.upload(namespaces[type], type, field, recordId, data, options);\n }\n ` + \"\\n\";\n\n // Generate deleteFile helper function\n const deleteFunction =\n multiline /* ts */ `\n export async function deleteFile<T extends keyof TypeWithFiles>(\n type: T,\n field: TypeWithFiles[T][\"fields\"],\n recordId: string,\n ): Promise<void> {\n return await tailordb.file.delete(namespaces[type], type, field, recordId);\n }\n ` + \"\\n\";\n\n // Generate getFileMetadata helper function\n const getMetadataFunction =\n multiline /* ts */ `\n export async function getFileMetadata<T extends keyof TypeWithFiles>(\n type: T,\n field: TypeWithFiles[T][\"fields\"],\n recordId: string,\n ): Promise<FileMetadata> {\n return await tailordb.file.getMetadata(namespaces[type], type, field, recordId);\n }\n ` + \"\\n\";\n\n // Generate openFileDownloadStream helper function\n const openDownloadStreamFunction =\n multiline /* ts */ `\n export async function openFileDownloadStream<T extends keyof TypeWithFiles>(\n type: T,\n field: TypeWithFiles[T][\"fields\"],\n recordId: string,\n ): Promise<FileStreamIterator> {\n return await tailordb.file.openDownloadStream(namespaces[type], type, field, recordId);\n }\n ` + \"\\n\";\n\n return [\n interfaceDefinition,\n namespacesDefinition,\n downloadFunction,\n uploadFunction,\n deleteFunction,\n getMetadataFunction,\n openDownloadStreamFunction,\n ].join(\"\\n\");\n}\n","import type { FileUtilMetadata } from \"./types\";\nimport type { TailorDBType } from \"@/parser/service/tailordb/types\";\n\n/**\n * Process a TailorDB type and extract file field metadata.\n * @param type - The parsed TailorDB type to process\n * @returns File utility metadata for the type\n */\nexport async function processFileType(type: TailorDBType): Promise<FileUtilMetadata> {\n const fileFields: string[] = [];\n\n if (type.files) {\n for (const fileFieldName of Object.keys(type.files)) {\n fileFields.push(fileFieldName);\n }\n }\n\n return {\n name: type.name,\n fileFields,\n };\n}\n","import { generateUnifiedFileUtils } from \"./generate-file-utils\";\nimport { processFileType } from \"./process-file-type\";\nimport type { FileUtilMetadata } from \"./types\";\nimport type {\n GeneratorResult,\n TailorDBReadyContext,\n} from \"@/parser/plugin-config/generation-types\";\nimport type { Plugin } from \"@/parser/plugin-config/types\";\n\nexport const FileUtilsGeneratorID = \"@tailor-platform/file-utils\";\n\ntype FileUtilsPluginOptions = {\n distPath: string;\n};\n\n/**\n * Plugin that generates TypeWithFiles interface from TailorDB type definitions.\n * @param options - Plugin options\n * @param options.distPath - Output file path for generated file utilities\n * @returns Plugin instance with onTailorDBReady hook\n */\nexport function fileUtilsPlugin(\n options: FileUtilsPluginOptions,\n): Plugin<unknown, FileUtilsPluginOptions> {\n return {\n id: FileUtilsGeneratorID,\n description: \"Generates TypeWithFiles interface from TailorDB type definitions\",\n pluginConfig: options,\n\n async onTailorDBReady(\n ctx: TailorDBReadyContext<FileUtilsPluginOptions>,\n ): Promise<GeneratorResult> {\n const namespaceData: { namespace: string; types: FileUtilMetadata[] }[] = [];\n\n for (const ns of ctx.tailordb) {\n const typesWithFiles: FileUtilMetadata[] = [];\n\n for (const type of Object.values(ns.types)) {\n const metadata = await processFileType(type);\n if (metadata.fileFields.length > 0) {\n typesWithFiles.push(metadata);\n }\n }\n\n if (typesWithFiles.length > 0) {\n namespaceData.push({\n namespace: ns.namespace,\n types: typesWithFiles,\n });\n }\n }\n\n const files: GeneratorResult[\"files\"] = [];\n if (namespaceData.length > 0) {\n const content = generateUnifiedFileUtils(namespaceData);\n if (content) {\n files.push({\n path: ctx.pluginConfig.distPath,\n content,\n });\n }\n }\n\n return { files };\n },\n };\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,yBACd,eACQ;AACR,KAAI,cAAc,WAAW,EAC3B,QAAO;CAIT,MAAM,mCAAmB,IAAI,KAAqB;CAClD,MAAM,gCAAgB,IAAI,KAAuB;AAEjD,MAAK,MAAM,EAAE,WAAW,WAAW,cACjC,MAAK,MAAM,QAAQ,OAAO;AACxB,mBAAiB,IAAI,KAAK,MAAM,UAAU;AAC1C,gBAAc,IAAI,KAAK,MAAM,KAAK,WAAW;;AAIjD,KAAI,iBAAiB,SAAS,EAC5B,QAAO;AA4FT,QAAO;EAhFL,EAAmB;;QARG,MAAM,KAAK,cAAc,SAAS,CAAC,CACxD,KAAK,CAAC,UAAU,YAAY;AAE3B,UAAO,KAAK,SAAS,mBADG,OAAO,KAAK,UAAU,IAAI,MAAM,GAAG,CAAC,KAAK,MAAM,CACf;IACxD,CACD,KAAK,KAAK,CAKS;;QAEhB;EAQJ,EAAmB;;QALI,MAAM,KAAK,iBAAiB,SAAS,CAAC,CAC5D,KAAK,CAAC,UAAU,eAAe,KAAK,SAAS,KAAK,UAAU,GAAG,CAC/D,KAAK,MAAM,CAKS;;QAEjB;EAIJ,EAAmB;;;;;;;;QAQf;EAIJ,EAAmB;;;;;;;;;;QAUf;EAIJ,EAAmB;;;;;;;;QAQf;EAIJ,EAAmB;;;;;;;;QAQf;EAIJ,EAAmB;;;;;;;;QAQf;EAUL,CAAC,KAAK,KAAK;;;;;;;;;;ACvHd,eAAsB,gBAAgB,MAA+C;CACnF,MAAM,aAAuB,EAAE;AAE/B,KAAI,KAAK,MACP,MAAK,MAAM,iBAAiB,OAAO,KAAK,KAAK,MAAM,CACjD,YAAW,KAAK,cAAc;AAIlC,QAAO;EACL,MAAM,KAAK;EACX;EACD;;;;;ACXH,MAAa,uBAAuB;;;;;;;AAYpC,SAAgB,gBACd,SACyC;AACzC,QAAO;EACL,IAAI;EACJ,aAAa;EACb,cAAc;EAEd,MAAM,gBACJ,KAC0B;GAC1B,MAAM,gBAAoE,EAAE;AAE5E,QAAK,MAAM,MAAM,IAAI,UAAU;IAC7B,MAAM,iBAAqC,EAAE;AAE7C,SAAK,MAAM,QAAQ,OAAO,OAAO,GAAG,MAAM,EAAE;KAC1C,MAAM,WAAW,MAAM,gBAAgB,KAAK;AAC5C,SAAI,SAAS,WAAW,SAAS,EAC/B,gBAAe,KAAK,SAAS;;AAIjC,QAAI,eAAe,SAAS,EAC1B,eAAc,KAAK;KACjB,WAAW,GAAG;KACd,OAAO;KACR,CAAC;;GAIN,MAAM,QAAkC,EAAE;AAC1C,OAAI,cAAc,SAAS,GAAG;IAC5B,MAAM,UAAU,yBAAyB,cAAc;AACvD,QAAI,QACF,OAAM,KAAK;KACT,MAAM,IAAI,aAAa;KACvB;KACD,CAAC;;AAIN,UAAO,EAAE,OAAO;;EAEnB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference path="./user-defined.d.ts" />
|
|
2
|
-
import { u as Plugin } from "./types-
|
|
2
|
+
import { u as Plugin } from "./types-bcuNRo1Y.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin/builtin/file-utils/index.d.ts
|
|
5
5
|
declare const FileUtilsGeneratorID = "@tailor-platform/file-utils";
|
|
@@ -15,4 +15,4 @@ type FileUtilsPluginOptions = {
|
|
|
15
15
|
declare function fileUtilsPlugin(options: FileUtilsPluginOptions): Plugin<unknown, FileUtilsPluginOptions>;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { fileUtilsPlugin as n, FileUtilsGeneratorID as t };
|
|
18
|
-
//# sourceMappingURL=index-
|
|
18
|
+
//# sourceMappingURL=index-BGPX26_D.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="./user-defined.d.ts" />
|
|
2
|
-
import { A as AuthAccessTokenTrigger$1, B as ResolverExecutedTrigger$1, Bt as TailorActor, Ct as FieldMetadata, Dt as TailorAnyField, Et as TailorFieldType, F as FunctionOperation$1, Ft as InferFieldsOutput, Gt as AllowedValues, H as WebhookOperation$1, I as GqlOperation$1, It as JsonCompatible, J as AuthServiceInput, K as AuthInvoker$1, Kt as AllowedValuesOutput, L as IdpUserTrigger$1, Lt as output$1, M as ExecutorInput, Mt as ResolverInput, Ot as TailorField, R as IncomingWebhookTrigger$1, St as DefinedFieldMetadata, Tt as FieldOutput, U as WorkflowOperation$1, Ut as TailorUser, V as ScheduleTriggerInput, X as DefinedAuth, dt as UserAttributeListKey, ft as UserAttributeMap, ht as GeneratorConfig, o as TailorDBInstance, s as TailorDBType, u as Plugin, wt as FieldOptions, xt as ArrayFieldOutput, z as RecordTrigger$1, zt as TailorEnv } from "./types-
|
|
3
|
-
import { t as AppConfig } from "./types-
|
|
2
|
+
import { A as AuthAccessTokenTrigger$1, B as ResolverExecutedTrigger$1, Bt as TailorActor, Ct as FieldMetadata, Dt as TailorAnyField, Et as TailorFieldType, F as FunctionOperation$1, Ft as InferFieldsOutput, Gt as AllowedValues, H as WebhookOperation$1, I as GqlOperation$1, It as JsonCompatible, J as AuthServiceInput, K as AuthInvoker$1, Kt as AllowedValuesOutput, L as IdpUserTrigger$1, Lt as output$1, M as ExecutorInput, Mt as ResolverInput, Ot as TailorField, R as IncomingWebhookTrigger$1, St as DefinedFieldMetadata, Tt as FieldOutput, U as WorkflowOperation$1, Ut as TailorUser, V as ScheduleTriggerInput, X as DefinedAuth, dt as UserAttributeListKey, ft as UserAttributeMap, ht as GeneratorConfig, o as TailorDBInstance, s as TailorDBType, u as Plugin, wt as FieldOptions, xt as ArrayFieldOutput, z as RecordTrigger$1, zt as TailorEnv } from "./types-bcuNRo1Y.mjs";
|
|
3
|
+
import { t as AppConfig } from "./types-DVMQNdTs.mjs";
|
|
4
4
|
import * as zod0 from "zod";
|
|
5
5
|
import { JsonPrimitive, Jsonifiable, Jsonify } from "type-fest";
|
|
6
6
|
import { Client } from "@urql/core";
|
|
@@ -115,7 +115,6 @@ type ResolverConfig = ReturnType<typeof createResolver<any, any>>;
|
|
|
115
115
|
*/
|
|
116
116
|
type WorkflowJobContext = {
|
|
117
117
|
env: TailorEnv;
|
|
118
|
-
user: TailorUser;
|
|
119
118
|
};
|
|
120
119
|
/**
|
|
121
120
|
* Allowed output types for workflow job body functions.
|
|
@@ -219,11 +218,6 @@ type WorkflowJobBody<I, O> = IsValidInput<I> extends true ? IsValidOutput<O> ext
|
|
|
219
218
|
* Contains JSON-serialized TailorEnv object.
|
|
220
219
|
*/
|
|
221
220
|
declare const WORKFLOW_TEST_ENV_KEY = "TAILOR_TEST_WORKFLOW_ENV";
|
|
222
|
-
/**
|
|
223
|
-
* Environment variable key for workflow user testing.
|
|
224
|
-
* Contains JSON-serialized TailorUser object.
|
|
225
|
-
*/
|
|
226
|
-
declare const WORKFLOW_TEST_USER_KEY = "TAILOR_TEST_WORKFLOW_USER";
|
|
227
221
|
/**
|
|
228
222
|
* Create a workflow job definition.
|
|
229
223
|
*
|
|
@@ -709,5 +703,5 @@ declare namespace t {
|
|
|
709
703
|
type infer<T> = TailorOutput<T>;
|
|
710
704
|
}
|
|
711
705
|
//#endregion
|
|
712
|
-
export {
|
|
713
|
-
//# sourceMappingURL=index-
|
|
706
|
+
export { idpUserDeletedTrigger as A, WorkflowOperation as B, RecordUpdatedArgs as C, authAccessTokenRefreshedTrigger as D, authAccessTokenIssuedTrigger as E, resolverExecutedTrigger as F, WorkflowJob as G, WorkflowConfig as H, FunctionOperation as I, WorkflowJobOutput as J, WorkflowJobContext as K, GqlOperation as L, recordCreatedTrigger as M, recordDeletedTrigger as N, authAccessTokenRevokedTrigger as O, recordUpdatedTrigger as P, defineAuth as Q, Operation as R, RecordTrigger as S, ResolverExecutedTrigger as T, createWorkflow as U, Workflow as V, WORKFLOW_TEST_ENV_KEY as W, createResolver as X, createWorkflowJob as Y, AuthInvoker as Z, AuthAccessTokenTrigger as _, defineGenerators as a, RecordCreatedArgs as b, Trigger as c, IncomingWebhookTrigger as d, incomingWebhookTrigger as f, AuthAccessTokenArgs as g, scheduleTrigger as h, defineConfig as i, idpUserUpdatedTrigger as j, idpUserCreatedTrigger as k, IncomingWebhookArgs as l, ScheduleTrigger as m, output as n, definePlugins as o, ScheduleArgs as p, WorkflowJobInput as q, t as r, createExecutor as s, infer as t, IncomingWebhookRequest as u, IdpUserArgs as v, ResolverExecutedArgs as w, RecordDeletedArgs as x, IdpUserTrigger as y, WebhookOperation as z };
|
|
707
|
+
//# sourceMappingURL=index-BiutQT7m.d.mts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference path="./user-defined.d.ts" />
|
|
2
|
-
import { u as Plugin } from "./types-
|
|
2
|
+
import { u as Plugin } from "./types-bcuNRo1Y.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin/builtin/seed/index.d.ts
|
|
5
5
|
declare const SeedGeneratorID = "@tailor-platform/seed";
|
|
@@ -17,4 +17,4 @@ type SeedPluginOptions = {
|
|
|
17
17
|
declare function seedPlugin(options: SeedPluginOptions): Plugin<unknown, SeedPluginOptions>;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { seedPlugin as n, SeedGeneratorID as t };
|
|
20
|
-
//# sourceMappingURL=index-
|
|
20
|
+
//# sourceMappingURL=index-ClS0NClx.d.mts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference path="./user-defined.d.ts" />
|
|
2
|
-
import { u as Plugin } from "./types-
|
|
2
|
+
import { u as Plugin } from "./types-bcuNRo1Y.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin/builtin/enum-constants/index.d.ts
|
|
5
5
|
declare const EnumConstantsGeneratorID = "@tailor-platform/enum-constants";
|
|
@@ -15,4 +15,4 @@ type EnumConstantsPluginOptions = {
|
|
|
15
15
|
declare function enumConstantsPlugin(options: EnumConstantsPluginOptions): Plugin<unknown, EnumConstantsPluginOptions>;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { enumConstantsPlugin as n, EnumConstantsGeneratorID as t };
|
|
18
|
-
//# sourceMappingURL=index-
|
|
18
|
+
//# sourceMappingURL=index-Cwi86SUR.d.mts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference path="./user-defined.d.ts" />
|
|
2
|
-
import { u as Plugin } from "./types-
|
|
2
|
+
import { u as Plugin } from "./types-bcuNRo1Y.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin/builtin/kysely-type/index.d.ts
|
|
5
5
|
declare const KyselyGeneratorID = "@tailor-platform/kysely-type";
|
|
@@ -15,4 +15,4 @@ type KyselyTypePluginOptions = {
|
|
|
15
15
|
declare function kyselyTypePlugin(options: KyselyTypePluginOptions): Plugin<unknown, KyselyTypePluginOptions>;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { kyselyTypePlugin as n, KyselyGeneratorID as t };
|
|
18
|
-
//# sourceMappingURL=index-
|
|
18
|
+
//# sourceMappingURL=index-DPN_P0w3.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interceptor-
|
|
1
|
+
{"version":3,"file":"interceptor-DiARwPfw.mjs","names":[],"sources":["../src/cli/telemetry/interceptor.ts"],"sourcesContent":["import { trace, SpanStatusCode } from \"@opentelemetry/api\";\nimport type { Interceptor } from \"@connectrpc/connect\";\n\n/**\n * Create a Connect-RPC interceptor that records OTLP spans for each RPC call.\n * When no TracerProvider is registered, the OTel API automatically provides\n * noop spans with zero overhead.\n * @returns Tracing interceptor\n */\nexport function createTracingInterceptor(): Interceptor {\n return (next) => async (req) => {\n const tracer = trace.getTracer(\"tailor-sdk\");\n\n return tracer.startActiveSpan(`rpc.${req.method.name}`, async (span) => {\n span.setAttribute(\"rpc.method\", req.method.name);\n span.setAttribute(\"rpc.service\", \"OperatorService\");\n span.setAttribute(\"rpc.system\", \"connect-rpc\");\n\n try {\n const response = await next(req);\n span.setStatus({ code: SpanStatusCode.OK });\n return response;\n } catch (error) {\n span.setStatus({ code: SpanStatusCode.ERROR });\n if (error instanceof Error) {\n span.recordException(error);\n }\n throw error;\n } finally {\n span.end();\n }\n });\n };\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,2BAAwC;AACtD,SAAQ,SAAS,OAAO,QAAQ;AAG9B,SAFe,MAAM,UAAU,aAAa,CAE9B,gBAAgB,OAAO,IAAI,OAAO,QAAQ,OAAO,SAAS;AACtE,QAAK,aAAa,cAAc,IAAI,OAAO,KAAK;AAChD,QAAK,aAAa,eAAe,kBAAkB;AACnD,QAAK,aAAa,cAAc,cAAc;AAE9C,OAAI;IACF,MAAM,WAAW,MAAM,KAAK,IAAI;AAChC,SAAK,UAAU,EAAE,MAAM,eAAe,IAAI,CAAC;AAC3C,WAAO;YACA,OAAO;AACd,SAAK,UAAU,EAAE,MAAM,eAAe,OAAO,CAAC;AAC9C,QAAI,iBAAiB,MACnB,MAAK,gBAAgB,MAAM;AAE7B,UAAM;aACE;AACR,SAAK,KAAK;;IAEZ"}
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import { t as brandValue } from "./brand-
|
|
1
|
+
import { t as brandValue } from "./brand-DyPrAzpM.mjs";
|
|
2
2
|
|
|
3
|
-
//#region src/configure/types/user.ts
|
|
4
|
-
/** Represents an unauthenticated user in the Tailor platform. */
|
|
5
|
-
const unauthenticatedTailorUser = {
|
|
6
|
-
id: "00000000-0000-0000-0000-000000000000",
|
|
7
|
-
type: "",
|
|
8
|
-
workspaceId: "00000000-0000-0000-0000-000000000000",
|
|
9
|
-
attributes: null,
|
|
10
|
-
attributeList: []
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
3
|
//#region src/configure/services/workflow/job.ts
|
|
15
4
|
/**
|
|
16
5
|
* Environment variable key for workflow testing.
|
|
@@ -18,11 +7,6 @@ const unauthenticatedTailorUser = {
|
|
|
18
7
|
*/
|
|
19
8
|
const WORKFLOW_TEST_ENV_KEY = "TAILOR_TEST_WORKFLOW_ENV";
|
|
20
9
|
/**
|
|
21
|
-
* Environment variable key for workflow user testing.
|
|
22
|
-
* Contains JSON-serialized TailorUser object.
|
|
23
|
-
*/
|
|
24
|
-
const WORKFLOW_TEST_USER_KEY = "TAILOR_TEST_WORKFLOW_USER";
|
|
25
|
-
/**
|
|
26
10
|
* Create a workflow job definition.
|
|
27
11
|
*
|
|
28
12
|
* All jobs must be named exports from the workflow file.
|
|
@@ -57,11 +41,7 @@ const createWorkflowJob = (config) => {
|
|
|
57
41
|
name: config.name,
|
|
58
42
|
trigger: async (args) => {
|
|
59
43
|
const env = JSON.parse(process.env[WORKFLOW_TEST_ENV_KEY] || "{}");
|
|
60
|
-
const
|
|
61
|
-
const result = await config.body(args, {
|
|
62
|
-
env,
|
|
63
|
-
user
|
|
64
|
-
});
|
|
44
|
+
const result = await config.body(args, { env });
|
|
65
45
|
return result ? JSON.parse(JSON.stringify(result)) : result;
|
|
66
46
|
},
|
|
67
47
|
body: config.body
|
|
@@ -69,5 +49,5 @@ const createWorkflowJob = (config) => {
|
|
|
69
49
|
};
|
|
70
50
|
|
|
71
51
|
//#endregion
|
|
72
|
-
export {
|
|
73
|
-
//# sourceMappingURL=job-
|
|
52
|
+
export { createWorkflowJob as n, WORKFLOW_TEST_ENV_KEY as t };
|
|
53
|
+
//# sourceMappingURL=job-CRavYLLk.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-CRavYLLk.mjs","names":[],"sources":["../src/configure/services/workflow/job.ts"],"sourcesContent":["import { brandValue } from \"@/utils/brand\";\nimport type { TailorEnv } from \"@/configure/types/env\";\nimport type { JsonCompatible } from \"@/configure/types/helpers\";\nimport type { Jsonifiable, Jsonify, JsonPrimitive } from \"type-fest\";\n\n/**\n * Context object passed as the second argument to workflow job body functions.\n */\nexport type WorkflowJobContext = {\n env: TailorEnv;\n};\n\n/**\n * Allowed output types for workflow job body functions.\n * Includes Jsonifiable (JSON-serializable values including objects with toJSON like Date),\n * undefined, and void.\n */\nexport type WorkflowJobOutput = Jsonifiable | undefined | void;\n\n/**\n * Convert output type to what trigger returns after JSON serialization.\n * - Jsonifiable values are converted via Jsonify (Date -> string, etc.)\n * - undefined remains undefined\n * - void becomes void\n */\ntype JsonifyOutput<T> = T extends Jsonifiable ? Jsonify<T> : T;\n\n/**\n * Input type constraint for workflow jobs.\n * Accepts any type that is JSON-compatible (primitives, arrays, objects with JSON-compatible values).\n * Excludes objects with toJSON method (like Date) since they won't be serialized in input.\n */\nexport type WorkflowJobInput = undefined | JsonCompatible<unknown>;\n\n/**\n * WorkflowJob represents a job that can be triggered in a workflow.\n *\n * Type constraints:\n * - Input: Must be JSON-compatible (no Date/toJSON objects) or undefined. Interfaces are allowed.\n * - Output: Must be Jsonifiable, undefined, or void\n * - Trigger returns Jsonify<Output> (Date becomes string after JSON.stringify)\n */\nexport interface WorkflowJob<Name extends string = string, Input = undefined, Output = undefined> {\n name: Name;\n /**\n * Trigger this job with the given input.\n * At runtime, this is a placeholder that calls the body function.\n * During bundling, calls to .trigger() are transformed to\n * tailor.workflow.triggerJobFunction(\"<job-name>\", args).\n *\n * Returns Jsonify<Output> because the value passes through JSON.stringify.\n *\n * Inside a workflow job body, .trigger() calls are transformed by the bundler\n * into synchronous `triggerJobFunction` calls. You may use `await` for\n * readability — the bundler strips it automatically at build time.\n * @example\n * // Both styles work — await is stripped by the bundler:\n * body: async (input) => {\n * const a = await jobA.trigger({ id: input.id });\n * const b = await jobB.trigger({ id: input.id });\n * return { a, b };\n * }\n */\n trigger: [Input] extends [undefined]\n ? () => Promise<JsonifyOutput<Awaited<Output>>>\n : (input: Input) => Promise<JsonifyOutput<Awaited<Output>>>;\n body: (input: Input, context: WorkflowJobContext) => Output | Promise<Output>;\n}\n\n/**\n * Helper type to check if all property types are valid.\n * Uses -? to remove optional modifiers so all properties are treated uniformly.\n */\ntype AllPropertiesValid<T> = {\n [K in keyof T]-?: IsValidInput<T[K]> extends true ? true : false;\n}[keyof T] extends true\n ? true\n : false;\n\n/**\n * Check if a type contains any non-JSON-compatible values.\n * Returns `true` if the type is valid for input, `false` otherwise.\n *\n * Accepts:\n * - JSON primitives (string, number, boolean, null)\n * - undefined\n * - Optional primitives (e.g., string | undefined)\n * - Arrays of valid types\n * - Objects with valid field types\n *\n * Rejects:\n * - Objects with toJSON methods (like Date)\n * - Other non-JSON-serializable types\n */\ntype IsValidInput<T> = T extends undefined\n ? true\n : T extends JsonPrimitive\n ? true\n : T extends readonly (infer U)[]\n ? IsValidInput<U>\n : T extends object\n ? T extends { toJSON: () => unknown }\n ? false\n : AllPropertiesValid<T>\n : false;\n\n/**\n * Helper type to check if all property types are valid for output.\n * Uses -? to remove optional modifiers so all properties are treated uniformly.\n */\ntype AllPropertiesValidOutput<T> = {\n [K in keyof T]-?: IsValidOutput<T[K]> extends true ? true : false;\n}[keyof T] extends true\n ? true\n : false;\n\n/**\n * Check if a type is valid for output.\n * Returns `true` if the type is valid, `false` otherwise.\n *\n * Accepts:\n * - JSON primitives (string, number, boolean, null)\n * - undefined and void\n * - Optional primitives (e.g., string | undefined)\n * - Jsonifiable types (Date, objects with toJSON)\n * - Arrays of valid types\n * - Objects with valid field types\n */\ntype IsValidOutput<T> = T extends undefined | void\n ? true\n : T extends JsonPrimitive\n ? true\n : T extends readonly (infer U)[]\n ? IsValidOutput<U>\n : T extends object\n ? AllPropertiesValidOutput<T>\n : false;\n\n/**\n * Body function type with conditional constraint.\n * If input contains invalid types (like Date), the body type becomes `never` to cause an error.\n */\ntype WorkflowJobBody<I, O> =\n IsValidInput<I> extends true\n ? IsValidOutput<O> extends true\n ? (input: I, context: WorkflowJobContext) => O | Promise<O>\n : never\n : never;\n\n/**\n * Environment variable key for workflow testing.\n * Contains JSON-serialized TailorEnv object.\n */\nexport const WORKFLOW_TEST_ENV_KEY = \"TAILOR_TEST_WORKFLOW_ENV\";\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 * @param config - Job configuration with name and body function\n * @param config.name - Unique job name across the project\n * @param config.body - Async function that processes the job input\n * @returns A WorkflowJob that can be triggered 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 * // await is optional — the bundler strips it at build time.\n * export const orchestrate = createWorkflowJob({\n * name: \"orchestrate\",\n * body: async (input: { orderId: string }) => {\n * const inventory = await checkInventory.trigger({ orderId: input.orderId });\n * const payment = await processPayment.trigger({ orderId: input.orderId });\n * return { inventory, payment };\n * },\n * });\n */\nexport const createWorkflowJob = <const Name extends string, I = undefined, O = undefined>(config: {\n readonly name: Name;\n readonly body: WorkflowJobBody<I, O>;\n}): WorkflowJob<Name, I, Awaited<O>> => {\n return brandValue({\n name: config.name,\n // JSON.parse(JSON.stringify(...)) ensures the return value matches Jsonify<Output> type.\n // This converts Date objects to strings, matching actual runtime behavior.\n // In production, bundler transforms .trigger() calls to tailor.workflow.triggerJobFunction().\n trigger: async (args?: unknown) => {\n const env: TailorEnv = JSON.parse(process.env[WORKFLOW_TEST_ENV_KEY] || \"{}\");\n const result = await config.body(args as I, { env });\n return result ? JSON.parse(JSON.stringify(result)) : result;\n },\n body: config.body,\n } as WorkflowJob<Name, I, Awaited<O>>);\n};\n"],"mappings":";;;;;;;AAyJA,MAAa,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCrC,MAAa,qBAA8E,WAGnD;AACtC,QAAO,WAAW;EAChB,MAAM,OAAO;EAIb,SAAS,OAAO,SAAmB;GACjC,MAAM,MAAiB,KAAK,MAAM,QAAQ,IAAI,0BAA0B,KAAK;GAC7E,MAAM,SAAS,MAAM,OAAO,KAAK,MAAW,EAAE,KAAK,CAAC;AACpD,UAAO,SAAS,KAAK,MAAM,KAAK,UAAU,OAAO,CAAC,GAAG;;EAEvD,MAAM,OAAO;EACd,CAAqC"}
|
package/dist/kysely/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="./../user-defined.d.ts" />
|
|
2
2
|
import { TailordbDialect } from "@tailor-platform/function-kysely-tailordb";
|
|
3
|
-
import { ColumnType, ColumnType as ColumnType$1, Insertable, Insertable as Insertable$1, Kysely, Kysely as Kysely$1, KyselyConfig, KyselyConfig as KyselyConfig$1, Selectable, Selectable as Selectable$1, Transaction, Transaction as Transaction$1, Updateable, Updateable as Updateable$1 } from "kysely";
|
|
3
|
+
import { ColumnType, ColumnType as ColumnType$1, Insertable, Insertable as Insertable$1, Kysely, Kysely as Kysely$1, KyselyConfig, KyselyConfig as KyselyConfig$1, Selectable, Selectable as Selectable$1, Transaction, Transaction as Transaction$1, Updateable, Updateable as Updateable$1, sql } from "kysely";
|
|
4
4
|
|
|
5
5
|
//#region src/kysely/index.d.ts
|
|
6
6
|
|
|
@@ -21,5 +21,5 @@ type NamespaceInsertable<NS, T extends NamespaceTableName<NS>> = Insertable$1<Na
|
|
|
21
21
|
type NamespaceSelectable<NS, T extends NamespaceTableName<NS>> = Selectable$1<NamespaceTable<NS, T>>;
|
|
22
22
|
type NamespaceUpdateable<NS, T extends NamespaceTableName<NS>> = Updateable$1<NamespaceTable<NS, T>>;
|
|
23
23
|
//#endregion
|
|
24
|
-
export { type ColumnType, Generated, type Insertable, Kysely, type KyselyConfig, NamespaceDB, NamespaceInsertable, NamespaceSelectable, NamespaceTable, NamespaceTableName, NamespaceTransaction, NamespaceUpdateable, type Selectable, Serial, TailordbDialect, TailordbKysely, Timestamp, type Transaction, type Updateable, createGetDB };
|
|
24
|
+
export { type ColumnType, Generated, type Insertable, Kysely, type KyselyConfig, NamespaceDB, NamespaceInsertable, NamespaceSelectable, NamespaceTable, NamespaceTableName, NamespaceTransaction, NamespaceUpdateable, type Selectable, Serial, TailordbDialect, TailordbKysely, Timestamp, type Transaction, type Updateable, createGetDB, sql };
|
|
25
25
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/kysely/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TailordbDialect, TailordbDialect as TailordbDialect$1 } from "@tailor-platform/function-kysely-tailordb";
|
|
2
|
-
import { Kysely, Kysely as Kysely$1 } from "kysely";
|
|
2
|
+
import { Kysely, Kysely as Kysely$1, sql } from "kysely";
|
|
3
3
|
|
|
4
4
|
//#region src/kysely/index.ts
|
|
5
5
|
/**
|
|
@@ -23,5 +23,5 @@ function createGetDB() {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
//#endregion
|
|
26
|
-
export { Kysely, TailordbDialect, createGetDB };
|
|
26
|
+
export { Kysely, TailordbDialect, createGetDB, sql };
|
|
27
27
|
//# sourceMappingURL=index.mjs.map
|