@tailor-platform/sdk 1.2.1 → 1.2.3
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 +24 -0
- package/dist/cli/index.mjs +54 -2
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +109 -2
- package/dist/cli/lib.mjs +2 -2
- package/dist/{config-Bc_PBkyF.mjs → config-CJPKA-ui.mjs} +55 -53
- package/dist/config-CJPKA-ui.mjs.map +1 -0
- package/dist/configure/index.d.mts +2 -2
- package/dist/configure/index.mjs +69 -1
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{index-C4nvv_Ew.d.mts → index-DXZMT4aO.d.mts} +65 -10
- package/dist/{list-9sLkfPfn.mjs → list-nW4EfF7C.mjs} +1348 -166
- package/dist/list-nW4EfF7C.mjs.map +1 -0
- package/dist/{types-Du-lo0MV.d.mts → types-Dg_zk_OZ.d.mts} +110 -47
- package/dist/user-defined.d.ts +1 -0
- package/dist/utils/test/index.d.mts +7 -9
- package/dist/utils/test/index.mjs +5 -7
- package/dist/utils/test/index.mjs.map +1 -1
- package/package.json +9 -6
- package/postinstall.mjs +1 -0
- package/dist/config-Bc_PBkyF.mjs.map +0 -1
- package/dist/list-9sLkfPfn.mjs.map +0 -1
package/dist/configure/index.mjs
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import { a as createWorkflowJob, c as unsafeAllowAllGqlPermission, d as TailorField, f as t$1, i as WORKFLOW_JOB_BRAND, l as unsafeAllowAllTypePermission, n as defineGenerators, o as defineAuth, s as db, t as defineConfig, u as unauthenticatedTailorUser } from "../config-
|
|
1
|
+
import { a as createWorkflowJob, c as unsafeAllowAllGqlPermission, d as TailorField, f as t$1, i as WORKFLOW_JOB_BRAND, l as unsafeAllowAllTypePermission, n as defineGenerators, o as defineAuth, s as db, t as defineConfig, u as unauthenticatedTailorUser } from "../config-CJPKA-ui.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/configure/services/resolver/resolver.ts
|
|
4
|
+
/**
|
|
5
|
+
* Create a resolver definition for the Tailor SDK.
|
|
6
|
+
* @template Input
|
|
7
|
+
* @template Output
|
|
8
|
+
* @param {Omit<ResolverInput, "input" | "output" | "body"> & { input?: Input; output: Output; body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>> }} config - Resolver configuration
|
|
9
|
+
* @returns {ResolverReturn<Input, Output>} Normalized resolver configuration
|
|
10
|
+
*/
|
|
4
11
|
function createResolver(config) {
|
|
5
12
|
const normalizedOutput = config.output instanceof TailorField ? config.output : t$1.object(config.output);
|
|
6
13
|
return {
|
|
@@ -11,12 +18,25 @@ function createResolver(config) {
|
|
|
11
18
|
|
|
12
19
|
//#endregion
|
|
13
20
|
//#region src/configure/services/executor/executor.ts
|
|
21
|
+
/**
|
|
22
|
+
* Create an executor configuration for the Tailor SDK.
|
|
23
|
+
* @template Args
|
|
24
|
+
* @template O
|
|
25
|
+
* @param {Executor<Args, O>} config - Executor configuration
|
|
26
|
+
* @returns {Executor<Args, O>} The same executor configuration
|
|
27
|
+
*/
|
|
14
28
|
function createExecutor(config) {
|
|
15
29
|
return config;
|
|
16
30
|
}
|
|
17
31
|
|
|
18
32
|
//#endregion
|
|
19
33
|
//#region src/configure/services/executor/trigger/event.ts
|
|
34
|
+
/**
|
|
35
|
+
* Create a trigger that fires when a TailorDB record is created.
|
|
36
|
+
* @template T
|
|
37
|
+
* @param {{ type: T; condition?: (args: RecordCreatedArgs<T>) => boolean }} options - Trigger options
|
|
38
|
+
* @returns {RecordTrigger<RecordCreatedArgs<T>>} Record created trigger
|
|
39
|
+
*/
|
|
20
40
|
function recordCreatedTrigger({ type, condition }) {
|
|
21
41
|
return {
|
|
22
42
|
kind: "recordCreated",
|
|
@@ -25,6 +45,12 @@ function recordCreatedTrigger({ type, condition }) {
|
|
|
25
45
|
__args: {}
|
|
26
46
|
};
|
|
27
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Create a trigger that fires when a TailorDB record is updated.
|
|
50
|
+
* @template T
|
|
51
|
+
* @param {{ type: T; condition?: (args: RecordUpdatedArgs<T>) => boolean }} options - Trigger options
|
|
52
|
+
* @returns {RecordTrigger<RecordUpdatedArgs<T>>} Record updated trigger
|
|
53
|
+
*/
|
|
28
54
|
function recordUpdatedTrigger({ type, condition }) {
|
|
29
55
|
return {
|
|
30
56
|
kind: "recordUpdated",
|
|
@@ -33,6 +59,12 @@ function recordUpdatedTrigger({ type, condition }) {
|
|
|
33
59
|
__args: {}
|
|
34
60
|
};
|
|
35
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Create a trigger that fires when a TailorDB record is deleted.
|
|
64
|
+
* @template T
|
|
65
|
+
* @param {{ type: T; condition?: (args: RecordDeletedArgs<T>) => boolean }} options - Trigger options
|
|
66
|
+
* @returns {RecordTrigger<RecordDeletedArgs<T>>} Record deleted trigger
|
|
67
|
+
*/
|
|
36
68
|
function recordDeletedTrigger({ type, condition }) {
|
|
37
69
|
return {
|
|
38
70
|
kind: "recordDeleted",
|
|
@@ -41,6 +73,12 @@ function recordDeletedTrigger({ type, condition }) {
|
|
|
41
73
|
__args: {}
|
|
42
74
|
};
|
|
43
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Create a trigger that fires when a resolver is executed.
|
|
78
|
+
* @template R
|
|
79
|
+
* @param {{ resolver: R; condition?: (args: ResolverExecutedArgs<R>) => boolean }} options - Trigger options
|
|
80
|
+
* @returns {ResolverExecutedTrigger<ResolverExecutedArgs<R>>} Resolver executed trigger
|
|
81
|
+
*/
|
|
44
82
|
function resolverExecutedTrigger({ resolver, condition }) {
|
|
45
83
|
return {
|
|
46
84
|
kind: "resolverExecuted",
|
|
@@ -52,6 +90,12 @@ function resolverExecutedTrigger({ resolver, condition }) {
|
|
|
52
90
|
|
|
53
91
|
//#endregion
|
|
54
92
|
//#region src/configure/services/executor/trigger/schedule.ts
|
|
93
|
+
/**
|
|
94
|
+
* Create a schedule-based trigger using a CRON expression and optional timezone.
|
|
95
|
+
* @template T
|
|
96
|
+
* @param {{ cron: T; timezone?: Timezone }} options - Schedule options
|
|
97
|
+
* @returns {ScheduleTrigger<ScheduleArgs>} Schedule trigger
|
|
98
|
+
*/
|
|
55
99
|
function scheduleTrigger({ cron, timezone }) {
|
|
56
100
|
return {
|
|
57
101
|
kind: "schedule",
|
|
@@ -63,6 +107,11 @@ function scheduleTrigger({ cron, timezone }) {
|
|
|
63
107
|
|
|
64
108
|
//#endregion
|
|
65
109
|
//#region src/configure/services/executor/trigger/webhook.ts
|
|
110
|
+
/**
|
|
111
|
+
* Create a trigger for incoming webhook requests.
|
|
112
|
+
* @template T
|
|
113
|
+
* @returns {IncomingWebhookTrigger<IncomingWebhookArgs<T>>} Incoming webhook trigger
|
|
114
|
+
*/
|
|
66
115
|
function incomingWebhookTrigger() {
|
|
67
116
|
return {
|
|
68
117
|
kind: "incomingWebhook",
|
|
@@ -72,6 +121,12 @@ function incomingWebhookTrigger() {
|
|
|
72
121
|
|
|
73
122
|
//#endregion
|
|
74
123
|
//#region src/configure/services/workflow/workflow.ts
|
|
124
|
+
/**
|
|
125
|
+
* Create a workflow definition that can be triggered via the Tailor SDK.
|
|
126
|
+
* @template Job
|
|
127
|
+
* @param {{ name: string; mainJob: Job }} config - Workflow configuration
|
|
128
|
+
* @returns {Workflow<Job>} Defined workflow
|
|
129
|
+
*/
|
|
75
130
|
function createWorkflow(config) {
|
|
76
131
|
return {
|
|
77
132
|
...config,
|
|
@@ -83,6 +138,12 @@ function createWorkflow(config) {
|
|
|
83
138
|
|
|
84
139
|
//#endregion
|
|
85
140
|
//#region src/configure/services/staticwebsite/index.ts
|
|
141
|
+
/**
|
|
142
|
+
* Define a static website configuration for the Tailor SDK.
|
|
143
|
+
* @param {string} name - Static website name
|
|
144
|
+
* @param {Omit<StaticWebsiteInput, "name">} config - Static website configuration
|
|
145
|
+
* @returns {StaticWebsiteDefinitionBrand & StaticWebsiteInput & { readonly url: string }} Defined static website
|
|
146
|
+
*/
|
|
86
147
|
function defineStaticWebSite(name, config) {
|
|
87
148
|
return {
|
|
88
149
|
...config,
|
|
@@ -95,6 +156,13 @@ function defineStaticWebSite(name, config) {
|
|
|
95
156
|
|
|
96
157
|
//#endregion
|
|
97
158
|
//#region src/configure/services/idp/index.ts
|
|
159
|
+
/**
|
|
160
|
+
* Define an IdP service configuration for the Tailor SDK.
|
|
161
|
+
* @template TClients
|
|
162
|
+
* @param {string} name - IdP service name
|
|
163
|
+
* @param {Omit<IdPInput, "name" | "clients"> & { clients: TClients }} config - IdP configuration
|
|
164
|
+
* @returns {IdpDefinitionBrand & IdPInput} Defined IdP service
|
|
165
|
+
*/
|
|
98
166
|
function defineIdp(name, config) {
|
|
99
167
|
return {
|
|
100
168
|
...config,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["t","_t"],"sources":["../../src/configure/services/resolver/resolver.ts","../../src/configure/services/executor/executor.ts","../../src/configure/services/executor/trigger/event.ts","../../src/configure/services/executor/trigger/schedule.ts","../../src/configure/services/executor/trigger/webhook.ts","../../src/configure/services/workflow/workflow.ts","../../src/configure/services/staticwebsite/index.ts","../../src/configure/services/idp/index.ts","../../src/configure/index.ts"],"sourcesContent":["import { t, TailorField } from \"@/configure/types/type\";\nimport type { TailorUser } from \"@/configure/types\";\nimport type { TailorEnv } from \"@/configure/types/env\";\nimport type { InferFieldsOutput, output } from \"@/configure/types/helpers\";\nimport type { ResolverInput } from \"@/parser/service/resolver/types\";\n\ntype Context<Input extends Record<string, TailorField<any>> | undefined> = {\n input: Input extends Record<string, TailorField<any>> ? InferFieldsOutput<Input> : never;\n user: TailorUser;\n env: TailorEnv;\n};\n\ntype OutputType<O> =\n O extends TailorField<any>\n ? output<O>\n : O extends Record<string, TailorField<any>>\n ? InferFieldsOutput<O>\n : never;\n\n/**\n * Normalized output type that preserves generic type information.\n * - If Output is already a TailorField, use it as-is\n * - If Output is a Record of fields, wrap it as a nested TailorField\n */\ntype NormalizedOutput<Output extends TailorField<any> | Record<string, TailorField<any>>> =\n Output extends TailorField<any>\n ? Output\n : TailorField<\n { type: \"nested\"; array: false },\n InferFieldsOutput<Extract<Output, Record<string, TailorField<any>>>>\n >;\n\ntype ResolverReturn<\n Input extends Record<string, TailorField<any>> | undefined,\n Output extends TailorField<any> | Record<string, TailorField<any>>,\n> = Omit<ResolverInput, \"input\" | \"output\" | \"body\"> &\n Readonly<{\n input?: Input;\n output: NormalizedOutput<Output>;\n body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;\n }>;\n\nexport function createResolver<\n Input extends Record<string, TailorField<any>> | undefined = undefined,\n Output extends TailorField<any> | Record<string, TailorField<any>> = TailorField<any>,\n>(\n config: Omit<ResolverInput, \"input\" | \"output\" | \"body\"> &\n Readonly<{\n input?: Input;\n output: Output;\n body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;\n }>,\n): ResolverReturn<Input, Output> {\n const normalizedOutput =\n config.output instanceof TailorField ? config.output : t.object(config.output);\n\n return {\n ...config,\n output: normalizedOutput,\n } as ResolverReturn<Input, Output>;\n}\n\nexport type ResolverConfig = ReturnType<typeof createResolver<any, any>>;\n","import type { Operation } from \"./operation\";\nimport type { Trigger } from \"./trigger\";\nimport type { AuthInvoker } from \"@/configure/services/auth\";\nimport type { Workflow } from \"@/configure/services/workflow/workflow\";\nimport type { ExecutorInput } from \"@/parser/service/executor/types\";\n\n/**\n * Extract mainJob's Input type from Workflow.\n */\ntype WorkflowInput<W extends Workflow> = Parameters<W[\"trigger\"]>[0];\n\ntype ExecutorBase<Args> = Omit<ExecutorInput, \"trigger\" | \"operation\"> & {\n trigger: Trigger<Args>;\n};\n\n/**\n * Executor type with conditional inference for workflow operations.\n * When operation.kind is \"workflow\", infers W from the workflow property\n * to ensure args type matches the workflow's mainJob input type.\n */\ntype Executor<Args, O> = O extends {\n kind: \"workflow\";\n workflow: infer W extends Workflow;\n}\n ? ExecutorBase<Args> & {\n operation: {\n kind: \"workflow\";\n workflow: W;\n args?: WorkflowInput<W> | ((args: Args) => WorkflowInput<W>);\n authInvoker?: AuthInvoker<string>;\n };\n }\n : ExecutorBase<Args> & {\n operation: O;\n };\n\nexport function createExecutor<\n Args,\n O extends Operation<Args> | { kind: \"workflow\"; workflow: Workflow },\n>(config: Executor<Args, O>) {\n return config;\n}\n","import type { ResolverConfig } from \"@/configure/services/resolver/resolver\";\nimport type { TailorDBType } from \"@/configure/services/tailordb/schema\";\nimport type { TailorEnv } from \"@/configure/types/env\";\nimport type { output } from \"@/configure/types/helpers\";\nimport type {\n RecordTrigger as ParserRecordTrigger,\n ResolverExecutedTrigger as ParserResolverExecutedTrigger,\n} from \"@/parser/service/executor/types\";\n\ninterface EventArgs {\n workspaceId: string;\n appNamespace: string;\n env: TailorEnv;\n}\n\ninterface RecordArgs extends EventArgs {\n typeName: string;\n}\n\nexport interface RecordCreatedArgs<T extends TailorDBType> extends RecordArgs {\n newRecord: output<T>;\n}\n\nexport interface RecordUpdatedArgs<T extends TailorDBType> extends RecordArgs {\n newRecord: output<T>;\n oldRecord: output<T>;\n}\n\nexport interface RecordDeletedArgs<T extends TailorDBType> extends RecordArgs {\n oldRecord: output<T>;\n}\n\nexport type ResolverExecutedArgs<R extends ResolverConfig> = EventArgs & {\n resolverName: string;\n} & (\n | {\n success: true;\n result: output<R[\"output\"]>;\n error?: never;\n }\n | {\n success: false;\n result?: never;\n error: string;\n }\n );\n\nexport type RecordTrigger<Args> = ParserRecordTrigger & {\n __args: Args;\n};\n\nexport function recordCreatedTrigger<T extends TailorDBType>({\n type,\n condition,\n}: {\n type: T;\n condition?: (args: RecordCreatedArgs<T>) => boolean;\n}): RecordTrigger<RecordCreatedArgs<T>> {\n return {\n kind: \"recordCreated\",\n typeName: type.name,\n condition,\n __args: {} as RecordCreatedArgs<T>,\n };\n}\n\nexport function recordUpdatedTrigger<T extends TailorDBType>({\n type,\n condition,\n}: {\n type: T;\n condition?: (args: RecordUpdatedArgs<T>) => boolean;\n}): RecordTrigger<RecordUpdatedArgs<T>> {\n return {\n kind: \"recordUpdated\",\n typeName: type.name,\n condition,\n __args: {} as RecordUpdatedArgs<T>,\n };\n}\n\nexport function recordDeletedTrigger<T extends TailorDBType>({\n type,\n condition,\n}: {\n type: T;\n condition?: (args: RecordDeletedArgs<T>) => boolean;\n}): RecordTrigger<RecordDeletedArgs<T>> {\n return {\n kind: \"recordDeleted\",\n typeName: type.name,\n condition,\n __args: {} as RecordDeletedArgs<T>,\n };\n}\n\nexport type ResolverExecutedTrigger<Args> = ParserResolverExecutedTrigger & {\n __args: Args;\n};\n\nexport function resolverExecutedTrigger<R extends ResolverConfig>({\n resolver,\n condition,\n}: {\n resolver: R;\n condition?: (args: ResolverExecutedArgs<R>) => boolean;\n}): ResolverExecutedTrigger<ResolverExecutedArgs<R>> {\n return {\n kind: \"resolverExecuted\",\n resolverName: resolver.name,\n condition,\n __args: {} as ResolverExecutedArgs<R>,\n };\n}\n","import type { TailorEnv } from \"@/configure/types/env\";\nimport type { ScheduleTriggerInput as ParserScheduleTriggerInput } from \"@/parser/service/executor/types\";\nimport type { StandardCRON } from \"ts-cron-validator\";\n\ntype Timezone =\n | \"UTC\"\n | \"Pacific/Midway\"\n | \"Pacific/Niue\"\n | \"Pacific/Pago_Pago\"\n | \"America/Adak\"\n | \"Pacific/Honolulu\"\n | \"Pacific/Rarotonga\"\n | \"Pacific/Tahiti\"\n | \"Pacific/Marquesas\"\n | \"America/Anchorage\"\n | \"America/Juneau\"\n | \"America/Metlakatla\"\n | \"America/Nome\"\n | \"America/Sitka\"\n | \"America/Yakutat\"\n | \"Pacific/Gambier\"\n | \"America/Los_Angeles\"\n | \"America/Tijuana\"\n | \"America/Vancouver\"\n | \"Pacific/Pitcairn\"\n | \"America/Boise\"\n | \"America/Cambridge_Bay\"\n | \"America/Chihuahua\"\n | \"America/Creston\"\n | \"America/Dawson\"\n | \"America/Dawson_Creek\"\n | \"America/Denver\"\n | \"America/Edmonton\"\n | \"America/Fort_Nelson\"\n | \"America/Hermosillo\"\n | \"America/Inuvik\"\n | \"America/Mazatlan\"\n | \"America/Ojinaga\"\n | \"America/Phoenix\"\n | \"America/Whitehorse\"\n | \"America/Yellowknife\"\n | \"America/Bahia_Banderas\"\n | \"America/Belize\"\n | \"America/Chicago\"\n | \"America/Costa_Rica\"\n | \"America/El_Salvador\"\n | \"America/Guatemala\"\n | \"America/Indiana/Knox\"\n | \"America/Indiana/Tell_City\"\n | \"America/Managua\"\n | \"America/Matamoros\"\n | \"America/Menominee\"\n | \"America/Merida\"\n | \"America/Mexico_City\"\n | \"America/Monterrey\"\n | \"America/North_Dakota/Beulah\"\n | \"America/North_Dakota/Center\"\n | \"America/North_Dakota/New_Salem\"\n | \"America/Rainy_River\"\n | \"America/Rankin_Inlet\"\n | \"America/Regina\"\n | \"America/Resolute\"\n | \"America/Swift_Current\"\n | \"America/Tegucigalpa\"\n | \"America/Winnipeg\"\n | \"Pacific/Easter\"\n | \"Pacific/Galapagos\"\n | \"America/Atikokan\"\n | \"America/Bogota\"\n | \"America/Cancun\"\n | \"America/Cayman\"\n | \"America/Detroit\"\n | \"America/Eirunepe\"\n | \"America/Grand_Turk\"\n | \"America/Guayaquil\"\n | \"America/Havana\"\n | \"America/Indiana/Indianapolis\"\n | \"America/Indiana/Marengo\"\n | \"America/Indiana/Petersburg\"\n | \"America/Indiana/Vevay\"\n | \"America/Indiana/Vincennes\"\n | \"America/Indiana/Winamac\"\n | \"America/Iqaluit\"\n | \"America/Jamaica\"\n | \"America/Kentucky/Louisville\"\n | \"America/Kentucky/Monticello\"\n | \"America/Lima\"\n | \"America/Nassau\"\n | \"America/New_York\"\n | \"America/Nipigon\"\n | \"America/Panama\"\n | \"America/Pangnirtung\"\n | \"America/Port-au-Prince\"\n | \"America/Rio_Branco\"\n | \"America/Thunder_Bay\"\n | \"America/Toronto\"\n | \"America/Anguilla\"\n | \"America/Antigua\"\n | \"America/Aruba\"\n | \"America/Asuncion\"\n | \"America/Barbados\"\n | \"America/Blanc-Sablon\"\n | \"America/Boa_Vista\"\n | \"America/Campo_Grande\"\n | \"America/Caracas\"\n | \"America/Cuiaba\"\n | \"America/Curacao\"\n | \"America/Dominica\"\n | \"America/Glace_Bay\"\n | \"America/Goose_Bay\"\n | \"America/Grenada\"\n | \"America/Guadeloupe\"\n | \"America/Guyana\"\n | \"America/Halifax\"\n | \"America/Kralendijk\"\n | \"America/La_Paz\"\n | \"America/Lower_Princes\"\n | \"America/Manaus\"\n | \"America/Marigot\"\n | \"America/Martinique\"\n | \"America/Moncton\"\n | \"America/Montserrat\"\n | \"America/Porto_Velho\"\n | \"America/Port_of_Spain\"\n | \"America/Puerto_Rico\"\n | \"America/Santiago\"\n | \"America/Santo_Domingo\"\n | \"America/St_Barthelemy\"\n | \"America/St_Kitts\"\n | \"America/St_Lucia\"\n | \"America/St_Thomas\"\n | \"America/St_Vincent\"\n | \"America/Thule\"\n | \"America/Tortola\"\n | \"Atlantic/Bermuda\"\n | \"America/St_Johns\"\n | \"America/Araguaina\"\n | \"America/Argentina/Buenos_Aires\"\n | \"America/Argentina/Catamarca\"\n | \"America/Argentina/Cordoba\"\n | \"America/Argentina/Jujuy\"\n | \"America/Argentina/La_Rioja\"\n | \"America/Argentina/Mendoza\"\n | \"America/Argentina/Rio_Gallegos\"\n | \"America/Argentina/Salta\"\n | \"America/Argentina/San_Juan\"\n | \"America/Argentina/San_Luis\"\n | \"America/Argentina/Tucuman\"\n | \"America/Argentina/Ushuaia\"\n | \"America/Bahia\"\n | \"America/Belem\"\n | \"America/Cayenne\"\n | \"America/Fortaleza\"\n | \"America/Godthab\"\n | \"America/Maceio\"\n | \"America/Miquelon\"\n | \"America/Montevideo\"\n | \"America/Paramaribo\"\n | \"America/Punta_Arenas\"\n | \"America/Recife\"\n | \"America/Santarem\"\n | \"America/Sao_Paulo\"\n | \"Antarctica/Palmer\"\n | \"Antarctica/Rothera\"\n | \"Atlantic/Stanley\"\n | \"America/Noronha\"\n | \"Atlantic/South_Georgia\"\n | \"America/Scoresbysund\"\n | \"Atlantic/Azores\"\n | \"Atlantic/Cape_Verde\"\n | \"Africa/Abidjan\"\n | \"Africa/Accra\"\n | \"Africa/Bamako\"\n | \"Africa/Banjul\"\n | \"Africa/Bissau\"\n | \"Africa/Casablanca\"\n | \"Africa/Conakry\"\n | \"Africa/Dakar\"\n | \"Africa/El_Aaiun\"\n | \"Africa/Freetown\"\n | \"Africa/Lome\"\n | \"Africa/Monrovia\"\n | \"Africa/Nouakchott\"\n | \"Africa/Ouagadougou\"\n | \"Africa/Sao_Tome\"\n | \"America/Danmarkshavn\"\n | \"Antarctica/Troll\"\n | \"Atlantic/Canary\"\n | \"Atlantic/Faroe\"\n | \"Atlantic/Madeira\"\n | \"Atlantic/Reykjavik\"\n | \"Atlantic/St_Helena\"\n | \"Europe/Dublin\"\n | \"Europe/Guernsey\"\n | \"Europe/Isle_of_Man\"\n | \"Europe/Jersey\"\n | \"Europe/Lisbon\"\n | \"Europe/London\"\n | \"Africa/Algiers\"\n | \"Africa/Bangui\"\n | \"Africa/Brazzaville\"\n | \"Africa/Ceuta\"\n | \"Africa/Douala\"\n | \"Africa/Kinshasa\"\n | \"Africa/Lagos\"\n | \"Africa/Libreville\"\n | \"Africa/Luanda\"\n | \"Africa/Malabo\"\n | \"Africa/Ndjamena\"\n | \"Africa/Niamey\"\n | \"Africa/Porto-Novo\"\n | \"Africa/Tunis\"\n | \"Africa/Windhoek\"\n | \"Arctic/Longyearbyen\"\n | \"Europe/Amsterdam\"\n | \"Europe/Andorra\"\n | \"Europe/Belgrade\"\n | \"Europe/Berlin\"\n | \"Europe/Bratislava\"\n | \"Europe/Brussels\"\n | \"Europe/Budapest\"\n | \"Europe/Copenhagen\"\n | \"Europe/Gibraltar\"\n | \"Europe/Ljubljana\"\n | \"Europe/Luxembourg\"\n | \"Europe/Madrid\"\n | \"Europe/Malta\"\n | \"Europe/Monaco\"\n | \"Europe/Oslo\"\n | \"Europe/Paris\"\n | \"Europe/Podgorica\"\n | \"Europe/Prague\"\n | \"Europe/Rome\"\n | \"Europe/San_Marino\"\n | \"Europe/Sarajevo\"\n | \"Europe/Skopje\"\n | \"Europe/Stockholm\"\n | \"Europe/Tirane\"\n | \"Europe/Vaduz\"\n | \"Europe/Vatican\"\n | \"Europe/Vienna\"\n | \"Europe/Warsaw\"\n | \"Europe/Zagreb\"\n | \"Europe/Zurich\"\n | \"Africa/Blantyre\"\n | \"Africa/Bujumbura\"\n | \"Africa/Cairo\"\n | \"Africa/Gaborone\"\n | \"Africa/Harare\"\n | \"Africa/Johannesburg\"\n | \"Africa/Juba\"\n | \"Africa/Khartoum\"\n | \"Africa/Kigali\"\n | \"Africa/Lubumbashi\"\n | \"Africa/Lusaka\"\n | \"Africa/Maputo\"\n | \"Africa/Maseru\"\n | \"Africa/Mbabane\"\n | \"Africa/Tripoli\"\n | \"Asia/Amman\"\n | \"Asia/Beirut\"\n | \"Asia/Damascus\"\n | \"Asia/Famagusta\"\n | \"Asia/Gaza\"\n | \"Asia/Hebron\"\n | \"Asia/Jerusalem\"\n | \"Asia/Nicosia\"\n | \"Europe/Athens\"\n | \"Europe/Bucharest\"\n | \"Europe/Chisinau\"\n | \"Europe/Helsinki\"\n | \"Europe/Kaliningrad\"\n | \"Europe/Kyiv\"\n | \"Europe/Mariehamn\"\n | \"Europe/Riga\"\n | \"Europe/Sofia\"\n | \"Europe/Tallinn\"\n | \"Europe/Uzhgorod\"\n | \"Europe/Vilnius\"\n | \"Europe/Zaporizhzhia\"\n | \"Africa/Addis_Ababa\"\n | \"Africa/Asmara\"\n | \"Africa/Dar_es_Salaam\"\n | \"Africa/Djibouti\"\n | \"Africa/Kampala\"\n | \"Africa/Mogadishu\"\n | \"Africa/Nairobi\"\n | \"Antarctica/Syowa\"\n | \"Asia/Aden\"\n | \"Asia/Baghdad\"\n | \"Asia/Bahrain\"\n | \"Asia/Kuwait\"\n | \"Asia/Qatar\"\n | \"Asia/Riyadh\"\n | \"Europe/Istanbul\"\n | \"Europe/Kirov\"\n | \"Europe/Minsk\"\n | \"Europe/Moscow\"\n | \"Europe/Simferopol\"\n | \"Europe/Volgograd\"\n | \"Indian/Antananarivo\"\n | \"Indian/Comoro\"\n | \"Indian/Mayotte\"\n | \"Asia/Tehran\"\n | \"Asia/Baku\"\n | \"Asia/Dubai\"\n | \"Asia/Muscat\"\n | \"Asia/Tbilisi\"\n | \"Asia/Yerevan\"\n | \"Europe/Astrakhan\"\n | \"Europe/Samara\"\n | \"Europe/Saratov\"\n | \"Europe/Ulyanovsk\"\n | \"Indian/Mahe\"\n | \"Indian/Mauritius\"\n | \"Indian/Reunion\"\n | \"Asia/Kabul\"\n | \"Antarctica/Mawson\"\n | \"Asia/Aqtau\"\n | \"Asia/Aqtobe\"\n | \"Asia/Ashgabat\"\n | \"Asia/Atyrau\"\n | \"Asia/Dushanbe\"\n | \"Asia/Karachi\"\n | \"Asia/Oral\"\n | \"Asia/Qyzylorda\"\n | \"Asia/Samarkand\"\n | \"Asia/Tashkent\"\n | \"Asia/Yekaterinburg\"\n | \"Indian/Kerguelen\"\n | \"Indian/Maldives\"\n | \"Asia/Colombo\"\n | \"Asia/Kolkata\"\n | \"Asia/Kathmandu\"\n | \"Antarctica/Vostok\"\n | \"Asia/Almaty\"\n | \"Asia/Bishkek\"\n | \"Asia/Dhaka\"\n | \"Asia/Omsk\"\n | \"Asia/Qostanay\"\n | \"Asia/Thimphu\"\n | \"Asia/Urumqi\"\n | \"Indian/Chagos\"\n | \"Asia/Yangon\"\n | \"Indian/Cocos\"\n | \"Antarctica/Davis\"\n | \"Asia/Bangkok\"\n | \"Asia/Barnaul\"\n | \"Asia/Hovd\"\n | \"Asia/Ho_Chi_Minh\"\n | \"Asia/Jakarta\"\n | \"Asia/Krasnoyarsk\"\n | \"Asia/Novokuznetsk\"\n | \"Asia/Novosibirsk\"\n | \"Asia/Phnom_Penh\"\n | \"Asia/Pontianak\"\n | \"Asia/Tomsk\"\n | \"Asia/Vientiane\"\n | \"Indian/Christmas\"\n | \"Asia/Brunei\"\n | \"Asia/Choibalsan\"\n | \"Asia/Hong_Kong\"\n | \"Asia/Irkutsk\"\n | \"Asia/Kuala_Lumpur\"\n | \"Asia/Kuching\"\n | \"Asia/Macau\"\n | \"Asia/Makassar\"\n | \"Asia/Manila\"\n | \"Asia/Shanghai\"\n | \"Asia/Singapore\"\n | \"Asia/Taipei\"\n | \"Asia/Ulaanbaatar\"\n | \"Australia/Perth\"\n | \"Australia/Eucla\"\n | \"Asia/Chita\"\n | \"Asia/Dili\"\n | \"Asia/Jayapura\"\n | \"Asia/Khandyga\"\n | \"Asia/Pyongyang\"\n | \"Asia/Seoul\"\n | \"Asia/Tokyo\"\n | \"Asia/Yakutsk\"\n | \"Pacific/Palau\"\n | \"Australia/Adelaide\"\n | \"Australia/Broken_Hill\"\n | \"Australia/Darwin\"\n | \"Antarctica/DumontDUrville\"\n | \"Antarctica/Macquarie\"\n | \"Asia/Ust-Nera\"\n | \"Asia/Vladivostok\"\n | \"Australia/Brisbane\"\n | \"Australia/Currie\"\n | \"Australia/Hobart\"\n | \"Australia/Lindeman\"\n | \"Australia/Melbourne\"\n | \"Australia/Sydney\"\n | \"Pacific/Chuuk\"\n | \"Pacific/Guam\"\n | \"Pacific/Port_Moresby\"\n | \"Pacific/Saipan\"\n | \"Australia/Lord_Howe\"\n | \"Antarctica/Casey\"\n | \"Asia/Magadan\"\n | \"Asia/Sakhalin\"\n | \"Asia/Srednekolymsk\"\n | \"Pacific/Bougainville\"\n | \"Pacific/Efate\"\n | \"Pacific/Guadalcanal\"\n | \"Pacific/Kosrae\"\n | \"Pacific/Norfolk\"\n | \"Pacific/Noumea\"\n | \"Pacific/Pohnpei\"\n | \"Antarctica/McMurdo\"\n | \"Asia/Anadyr\"\n | \"Asia/Kamchatka\"\n | \"Pacific/Auckland\"\n | \"Pacific/Fiji\"\n | \"Pacific/Funafuti\"\n | \"Pacific/Kwajalein\"\n | \"Pacific/Majuro\"\n | \"Pacific/Nauru\"\n | \"Pacific/Tarawa\"\n | \"Pacific/Wake\"\n | \"Pacific/Wallis\"\n | \"Pacific/Chatham\"\n | \"Pacific/Apia\"\n | \"Pacific/Enderbury\"\n | \"Pacific/Fakaofo\"\n | \"Pacific/Tongatapu\"\n | \"Pacific/Kiritimati\";\n\nexport type ScheduleTrigger<Args> = ParserScheduleTriggerInput & {\n __args: Args;\n};\n\nexport interface ScheduleArgs {\n env: TailorEnv;\n}\n\nexport function scheduleTrigger<T extends string>({\n cron,\n timezone,\n}: {\n cron: StandardCRON<T> extends never ? never : T;\n timezone?: Timezone;\n}): ScheduleTrigger<ScheduleArgs> {\n return {\n kind: \"schedule\",\n cron,\n timezone,\n __args: {} as ScheduleArgs,\n };\n}\n","import type { TailorEnv } from \"@/configure/types/env\";\nimport type { IncomingWebhookTrigger as ParserIncomingWebhookTrigger } from \"@/parser/service/executor/types\";\n\nexport interface IncomingWebhookArgs<T extends IncomingWebhookRequest> {\n body: T[\"body\"];\n headers: T[\"headers\"];\n method: \"POST\" | \"GET\" | \"PUT\" | \"DELETE\";\n rawBody: string;\n env: TailorEnv;\n}\n\nexport interface IncomingWebhookRequest {\n body: Record<string, unknown>;\n headers: Record<string, string>;\n}\n\nexport type IncomingWebhookTrigger<Args> = ParserIncomingWebhookTrigger & {\n __args: Args;\n};\n\nexport function incomingWebhookTrigger<T extends IncomingWebhookRequest>(): IncomingWebhookTrigger<\n IncomingWebhookArgs<T>\n> {\n return {\n kind: \"incomingWebhook\",\n __args: {} as IncomingWebhookArgs<T>,\n };\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { WorkflowJob } from \"./job\";\nimport type { AuthInvoker } from \"../auth\";\n\nexport interface WorkflowConfig<\n Job extends WorkflowJob<any, any, any> = WorkflowJob<any, any, any>,\n> {\n name: string;\n mainJob: Job;\n}\n\nexport interface Workflow<Job extends WorkflowJob<any, any, any> = WorkflowJob<any, any, any>> {\n name: string;\n mainJob: Job;\n trigger: (\n args: Parameters<Job[\"trigger\"]>[0],\n options?: { authInvoker: AuthInvoker<string> },\n ) => Promise<string>;\n}\n\nexport function createWorkflow<Job extends WorkflowJob<any, any, any>>(config: {\n name: string;\n mainJob: Job;\n}): Workflow<Job> {\n return {\n ...config,\n trigger: async (args, options) => {\n return tailor.workflow.triggerWorkflow(\n config.name,\n args,\n options ? { authInvoker: options.authInvoker } : undefined,\n );\n },\n };\n}\n","import type { StaticWebsiteInput } from \"@/parser/service/staticwebsite/types\";\n\ndeclare const staticWebsiteDefinitionBrand: unique symbol;\ntype StaticWebsiteDefinitionBrand = {\n readonly [staticWebsiteDefinitionBrand]: true;\n};\n\nexport function defineStaticWebSite(name: string, config: Omit<StaticWebsiteInput, \"name\">) {\n const result = {\n ...config,\n name,\n get url() {\n return `${name}:url` as const;\n },\n } as const satisfies StaticWebsiteInput & { readonly url: string };\n\n return result as typeof result & StaticWebsiteDefinitionBrand;\n}\n\nexport type StaticWebsiteConfig = Omit<ReturnType<typeof defineStaticWebSite>, \"url\">;\n","import type { BuiltinIdP } from \"@/parser/service/auth/types\";\nimport type { IdPInput } from \"@/parser/service/idp/types\";\n\ndeclare const idpDefinitionBrand: unique symbol;\ntype IdpDefinitionBrand = { readonly [idpDefinitionBrand]: true };\n\nexport function defineIdp<const TClients extends string[]>(\n name: string,\n config: Omit<IdPInput, \"name\" | \"clients\"> & { clients: TClients },\n) {\n const result = {\n ...config,\n name,\n provider(providerName: string, clientName: TClients[number]) {\n return {\n name: providerName,\n kind: \"BuiltInIdP\",\n namespace: name,\n clientName,\n } as const satisfies BuiltinIdP;\n },\n } as const satisfies IdPInput & {\n provider: (providerName: string, clientName: TClients[number]) => BuiltinIdP;\n };\n\n return result as typeof result & IdpDefinitionBrand;\n}\n\nexport type IdPExternalConfig = { name: string; external: true };\n\nexport type IdPConfig = Omit<ReturnType<typeof defineIdp>, \"provider\"> | IdPExternalConfig;\n","import { t as _t } from \"@/configure/types\";\nimport type * as helperTypes from \"@/configure/types/helpers\";\n\ntype TailorOutput<T> = helperTypes.output<T>;\n\nexport type infer<T> = TailorOutput<T>;\nexport type output<T> = TailorOutput<T>;\n\n// eslint-disable-next-line import/export\nexport const t = { ..._t };\n// eslint-disable-next-line @typescript-eslint/no-namespace, import/export\nexport namespace t {\n export type output<T> = TailorOutput<T>;\n export type infer<T> = TailorOutput<T>;\n}\n\nexport {\n TailorField,\n type TailorUser,\n unauthenticatedTailorUser,\n type AttributeMap,\n type AttributeList,\n type Env,\n} from \"@/configure/types\";\n\nexport * from \"@/configure/services\";\n\nexport { defineConfig, defineGenerators } from \"@/configure/config\";\n"],"mappings":";;;AA0CA,SAAgB,eAId,QAM+B;CAC/B,MAAM,mBACJ,OAAO,kBAAkB,cAAc,OAAO,SAASA,IAAE,OAAO,OAAO,OAAO;AAEhF,QAAO;EACL,GAAG;EACH,QAAQ;EACT;;;;;ACvBH,SAAgB,eAGd,QAA2B;AAC3B,QAAO;;;;;ACWT,SAAgB,qBAA6C,EAC3D,MACA,aAIsC;AACtC,QAAO;EACL,MAAM;EACN,UAAU,KAAK;EACf;EACA,QAAQ,EAAE;EACX;;AAGH,SAAgB,qBAA6C,EAC3D,MACA,aAIsC;AACtC,QAAO;EACL,MAAM;EACN,UAAU,KAAK;EACf;EACA,QAAQ,EAAE;EACX;;AAGH,SAAgB,qBAA6C,EAC3D,MACA,aAIsC;AACtC,QAAO;EACL,MAAM;EACN,UAAU,KAAK;EACf;EACA,QAAQ,EAAE;EACX;;AAOH,SAAgB,wBAAkD,EAChE,UACA,aAImD;AACnD,QAAO;EACL,MAAM;EACN,cAAc,SAAS;EACvB;EACA,QAAQ,EAAE;EACX;;;;;ACuUH,SAAgB,gBAAkC,EAChD,MACA,YAIgC;AAChC,QAAO;EACL,MAAM;EACN;EACA;EACA,QAAQ,EAAE;EACX;;;;;AC/aH,SAAgB,yBAEd;AACA,QAAO;EACL,MAAM;EACN,QAAQ,EAAE;EACX;;;;;ACNH,SAAgB,eAAuD,QAGrD;AAChB,QAAO;EACL,GAAG;EACH,SAAS,OAAO,MAAM,YAAY;AAChC,UAAO,OAAO,SAAS,gBACrB,OAAO,MACP,MACA,UAAU,EAAE,aAAa,QAAQ,aAAa,GAAG,OAClD;;EAEJ;;;;;AC1BH,SAAgB,oBAAoB,MAAc,QAA0C;AAS1F,QARe;EACb,GAAG;EACH;EACA,IAAI,MAAM;AACR,UAAO,GAAG,KAAK;;EAElB;;;;;ACRH,SAAgB,UACd,MACA,QACA;AAgBA,QAfe;EACb,GAAG;EACH;EACA,SAAS,cAAsB,YAA8B;AAC3D,UAAO;IACL,MAAM;IACN,MAAM;IACN,WAAW;IACX;IACD;;EAEJ;;;;;ACZH,MAAa,IAAI,EAAE,GAAGC,KAAI"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["t","_t"],"sources":["../../src/configure/services/resolver/resolver.ts","../../src/configure/services/executor/executor.ts","../../src/configure/services/executor/trigger/event.ts","../../src/configure/services/executor/trigger/schedule.ts","../../src/configure/services/executor/trigger/webhook.ts","../../src/configure/services/workflow/workflow.ts","../../src/configure/services/staticwebsite/index.ts","../../src/configure/services/idp/index.ts","../../src/configure/index.ts"],"sourcesContent":["import { t, TailorField } from \"@/configure/types/type\";\nimport type { TailorAnyField, TailorUser } from \"@/configure/types\";\nimport type { TailorEnv } from \"@/configure/types/env\";\nimport type { InferFieldsOutput, output } from \"@/configure/types/helpers\";\nimport type { ResolverInput } from \"@/parser/service/resolver/types\";\n\ntype Context<Input extends Record<string, TailorAnyField> | undefined> = {\n input: Input extends Record<string, TailorAnyField> ? InferFieldsOutput<Input> : never;\n user: TailorUser;\n env: TailorEnv;\n};\n\ntype OutputType<O> = O extends TailorAnyField\n ? output<O>\n : O extends Record<string, TailorAnyField>\n ? InferFieldsOutput<O>\n : never;\n\n/**\n * Normalized output type that preserves generic type information.\n * - If Output is already a TailorField, use it as-is\n * - If Output is a Record of fields, wrap it as a nested TailorField\n */\ntype NormalizedOutput<Output extends TailorAnyField | Record<string, TailorAnyField>> =\n Output extends TailorAnyField\n ? Output\n : TailorField<\n { type: \"nested\"; array: false },\n InferFieldsOutput<Extract<Output, Record<string, TailorAnyField>>>\n >;\n\ntype ResolverReturn<\n Input extends Record<string, TailorAnyField> | undefined,\n Output extends TailorAnyField | Record<string, TailorAnyField>,\n> = Omit<ResolverInput, \"input\" | \"output\" | \"body\"> &\n Readonly<{\n input?: Input;\n output: NormalizedOutput<Output>;\n body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;\n }>;\n\n/**\n * Create a resolver definition for the Tailor SDK.\n * @template Input\n * @template Output\n * @param {Omit<ResolverInput, \"input\" | \"output\" | \"body\"> & { input?: Input; output: Output; body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>> }} config - Resolver configuration\n * @returns {ResolverReturn<Input, Output>} Normalized resolver configuration\n */\nexport function createResolver<\n Input extends Record<string, TailorAnyField> | undefined = undefined,\n Output extends TailorAnyField | Record<string, TailorAnyField> = TailorAnyField,\n>(\n config: Omit<ResolverInput, \"input\" | \"output\" | \"body\"> &\n Readonly<{\n input?: Input;\n output: Output;\n body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;\n }>,\n): ResolverReturn<Input, Output> {\n const normalizedOutput =\n config.output instanceof TailorField ? config.output : t.object(config.output);\n\n return {\n ...config,\n output: normalizedOutput,\n } as ResolverReturn<Input, Output>;\n}\n\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 type { Operation } from \"./operation\";\nimport type { Trigger } from \"./trigger\";\nimport type { AuthInvoker } from \"@/configure/services/auth\";\nimport type { Workflow } from \"@/configure/services/workflow/workflow\";\nimport type { ExecutorInput } from \"@/parser/service/executor/types\";\n\n/**\n * Extract mainJob's Input type from Workflow.\n */\ntype WorkflowInput<W extends Workflow> = Parameters<W[\"trigger\"]>[0];\n\ntype ExecutorBase<Args> = Omit<ExecutorInput, \"trigger\" | \"operation\"> & {\n trigger: Trigger<Args>;\n};\n\n/**\n * Executor type with conditional inference for workflow operations.\n * When operation.kind is \"workflow\", infers W from the workflow property\n * to ensure args type matches the workflow's mainJob input type.\n */\ntype Executor<Args, O> = O extends {\n kind: \"workflow\";\n workflow: infer W extends Workflow;\n}\n ? ExecutorBase<Args> & {\n operation: {\n kind: \"workflow\";\n workflow: W;\n args?: WorkflowInput<W> | ((args: Args) => WorkflowInput<W>);\n authInvoker?: AuthInvoker<string>;\n };\n }\n : ExecutorBase<Args> & {\n operation: O;\n };\n\n/**\n * Create an executor configuration for the Tailor SDK.\n * @template Args\n * @template O\n * @param {Executor<Args, O>} config - Executor configuration\n * @returns {Executor<Args, O>} The same executor configuration\n */\nexport function createExecutor<\n Args,\n O extends Operation<Args> | { kind: \"workflow\"; workflow: Workflow },\n>(config: Executor<Args, O>) {\n return config;\n}\n","import type { ResolverConfig } from \"@/configure/services/resolver/resolver\";\nimport type { TailorDBType } from \"@/configure/services/tailordb/schema\";\nimport type { TailorEnv } from \"@/configure/types/env\";\nimport type { output } from \"@/configure/types/helpers\";\nimport type {\n RecordTrigger as ParserRecordTrigger,\n ResolverExecutedTrigger as ParserResolverExecutedTrigger,\n} from \"@/parser/service/executor/types\";\n\ninterface EventArgs {\n workspaceId: string;\n appNamespace: string;\n env: TailorEnv;\n}\n\ninterface RecordArgs extends EventArgs {\n typeName: string;\n}\n\nexport interface RecordCreatedArgs<T extends TailorDBType> extends RecordArgs {\n newRecord: output<T>;\n}\n\nexport interface RecordUpdatedArgs<T extends TailorDBType> extends RecordArgs {\n newRecord: output<T>;\n oldRecord: output<T>;\n}\n\nexport interface RecordDeletedArgs<T extends TailorDBType> extends RecordArgs {\n oldRecord: output<T>;\n}\n\nexport type ResolverExecutedArgs<R extends ResolverConfig> = EventArgs & {\n resolverName: string;\n} & (\n | {\n success: true;\n result: output<R[\"output\"]>;\n error?: never;\n }\n | {\n success: false;\n result?: never;\n error: string;\n }\n );\n\nexport type RecordTrigger<Args> = ParserRecordTrigger & {\n __args: Args;\n};\n\n/**\n * Create a trigger that fires when a TailorDB record is created.\n * @template T\n * @param {{ type: T; condition?: (args: RecordCreatedArgs<T>) => boolean }} options - Trigger options\n * @returns {RecordTrigger<RecordCreatedArgs<T>>} Record created trigger\n */\nexport function recordCreatedTrigger<T extends TailorDBType>({\n type,\n condition,\n}: {\n type: T;\n condition?: (args: RecordCreatedArgs<T>) => boolean;\n}): RecordTrigger<RecordCreatedArgs<T>> {\n return {\n kind: \"recordCreated\",\n typeName: type.name,\n condition,\n __args: {} as RecordCreatedArgs<T>,\n };\n}\n\n/**\n * Create a trigger that fires when a TailorDB record is updated.\n * @template T\n * @param {{ type: T; condition?: (args: RecordUpdatedArgs<T>) => boolean }} options - Trigger options\n * @returns {RecordTrigger<RecordUpdatedArgs<T>>} Record updated trigger\n */\nexport function recordUpdatedTrigger<T extends TailorDBType>({\n type,\n condition,\n}: {\n type: T;\n condition?: (args: RecordUpdatedArgs<T>) => boolean;\n}): RecordTrigger<RecordUpdatedArgs<T>> {\n return {\n kind: \"recordUpdated\",\n typeName: type.name,\n condition,\n __args: {} as RecordUpdatedArgs<T>,\n };\n}\n\n/**\n * Create a trigger that fires when a TailorDB record is deleted.\n * @template T\n * @param {{ type: T; condition?: (args: RecordDeletedArgs<T>) => boolean }} options - Trigger options\n * @returns {RecordTrigger<RecordDeletedArgs<T>>} Record deleted trigger\n */\nexport function recordDeletedTrigger<T extends TailorDBType>({\n type,\n condition,\n}: {\n type: T;\n condition?: (args: RecordDeletedArgs<T>) => boolean;\n}): RecordTrigger<RecordDeletedArgs<T>> {\n return {\n kind: \"recordDeleted\",\n typeName: type.name,\n condition,\n __args: {} as RecordDeletedArgs<T>,\n };\n}\n\nexport type ResolverExecutedTrigger<Args> = ParserResolverExecutedTrigger & {\n __args: Args;\n};\n\n/**\n * Create a trigger that fires when a resolver is executed.\n * @template R\n * @param {{ resolver: R; condition?: (args: ResolverExecutedArgs<R>) => boolean }} options - Trigger options\n * @returns {ResolverExecutedTrigger<ResolverExecutedArgs<R>>} Resolver executed trigger\n */\nexport function resolverExecutedTrigger<R extends ResolverConfig>({\n resolver,\n condition,\n}: {\n resolver: R;\n condition?: (args: ResolverExecutedArgs<R>) => boolean;\n}): ResolverExecutedTrigger<ResolverExecutedArgs<R>> {\n return {\n kind: \"resolverExecuted\",\n resolverName: resolver.name,\n condition,\n __args: {} as ResolverExecutedArgs<R>,\n };\n}\n","import type { TailorEnv } from \"@/configure/types/env\";\nimport type { ScheduleTriggerInput as ParserScheduleTriggerInput } from \"@/parser/service/executor/types\";\nimport type { StandardCRON } from \"ts-cron-validator\";\n\ntype Timezone =\n | \"UTC\"\n | \"Pacific/Midway\"\n | \"Pacific/Niue\"\n | \"Pacific/Pago_Pago\"\n | \"America/Adak\"\n | \"Pacific/Honolulu\"\n | \"Pacific/Rarotonga\"\n | \"Pacific/Tahiti\"\n | \"Pacific/Marquesas\"\n | \"America/Anchorage\"\n | \"America/Juneau\"\n | \"America/Metlakatla\"\n | \"America/Nome\"\n | \"America/Sitka\"\n | \"America/Yakutat\"\n | \"Pacific/Gambier\"\n | \"America/Los_Angeles\"\n | \"America/Tijuana\"\n | \"America/Vancouver\"\n | \"Pacific/Pitcairn\"\n | \"America/Boise\"\n | \"America/Cambridge_Bay\"\n | \"America/Chihuahua\"\n | \"America/Creston\"\n | \"America/Dawson\"\n | \"America/Dawson_Creek\"\n | \"America/Denver\"\n | \"America/Edmonton\"\n | \"America/Fort_Nelson\"\n | \"America/Hermosillo\"\n | \"America/Inuvik\"\n | \"America/Mazatlan\"\n | \"America/Ojinaga\"\n | \"America/Phoenix\"\n | \"America/Whitehorse\"\n | \"America/Yellowknife\"\n | \"America/Bahia_Banderas\"\n | \"America/Belize\"\n | \"America/Chicago\"\n | \"America/Costa_Rica\"\n | \"America/El_Salvador\"\n | \"America/Guatemala\"\n | \"America/Indiana/Knox\"\n | \"America/Indiana/Tell_City\"\n | \"America/Managua\"\n | \"America/Matamoros\"\n | \"America/Menominee\"\n | \"America/Merida\"\n | \"America/Mexico_City\"\n | \"America/Monterrey\"\n | \"America/North_Dakota/Beulah\"\n | \"America/North_Dakota/Center\"\n | \"America/North_Dakota/New_Salem\"\n | \"America/Rainy_River\"\n | \"America/Rankin_Inlet\"\n | \"America/Regina\"\n | \"America/Resolute\"\n | \"America/Swift_Current\"\n | \"America/Tegucigalpa\"\n | \"America/Winnipeg\"\n | \"Pacific/Easter\"\n | \"Pacific/Galapagos\"\n | \"America/Atikokan\"\n | \"America/Bogota\"\n | \"America/Cancun\"\n | \"America/Cayman\"\n | \"America/Detroit\"\n | \"America/Eirunepe\"\n | \"America/Grand_Turk\"\n | \"America/Guayaquil\"\n | \"America/Havana\"\n | \"America/Indiana/Indianapolis\"\n | \"America/Indiana/Marengo\"\n | \"America/Indiana/Petersburg\"\n | \"America/Indiana/Vevay\"\n | \"America/Indiana/Vincennes\"\n | \"America/Indiana/Winamac\"\n | \"America/Iqaluit\"\n | \"America/Jamaica\"\n | \"America/Kentucky/Louisville\"\n | \"America/Kentucky/Monticello\"\n | \"America/Lima\"\n | \"America/Nassau\"\n | \"America/New_York\"\n | \"America/Nipigon\"\n | \"America/Panama\"\n | \"America/Pangnirtung\"\n | \"America/Port-au-Prince\"\n | \"America/Rio_Branco\"\n | \"America/Thunder_Bay\"\n | \"America/Toronto\"\n | \"America/Anguilla\"\n | \"America/Antigua\"\n | \"America/Aruba\"\n | \"America/Asuncion\"\n | \"America/Barbados\"\n | \"America/Blanc-Sablon\"\n | \"America/Boa_Vista\"\n | \"America/Campo_Grande\"\n | \"America/Caracas\"\n | \"America/Cuiaba\"\n | \"America/Curacao\"\n | \"America/Dominica\"\n | \"America/Glace_Bay\"\n | \"America/Goose_Bay\"\n | \"America/Grenada\"\n | \"America/Guadeloupe\"\n | \"America/Guyana\"\n | \"America/Halifax\"\n | \"America/Kralendijk\"\n | \"America/La_Paz\"\n | \"America/Lower_Princes\"\n | \"America/Manaus\"\n | \"America/Marigot\"\n | \"America/Martinique\"\n | \"America/Moncton\"\n | \"America/Montserrat\"\n | \"America/Porto_Velho\"\n | \"America/Port_of_Spain\"\n | \"America/Puerto_Rico\"\n | \"America/Santiago\"\n | \"America/Santo_Domingo\"\n | \"America/St_Barthelemy\"\n | \"America/St_Kitts\"\n | \"America/St_Lucia\"\n | \"America/St_Thomas\"\n | \"America/St_Vincent\"\n | \"America/Thule\"\n | \"America/Tortola\"\n | \"Atlantic/Bermuda\"\n | \"America/St_Johns\"\n | \"America/Araguaina\"\n | \"America/Argentina/Buenos_Aires\"\n | \"America/Argentina/Catamarca\"\n | \"America/Argentina/Cordoba\"\n | \"America/Argentina/Jujuy\"\n | \"America/Argentina/La_Rioja\"\n | \"America/Argentina/Mendoza\"\n | \"America/Argentina/Rio_Gallegos\"\n | \"America/Argentina/Salta\"\n | \"America/Argentina/San_Juan\"\n | \"America/Argentina/San_Luis\"\n | \"America/Argentina/Tucuman\"\n | \"America/Argentina/Ushuaia\"\n | \"America/Bahia\"\n | \"America/Belem\"\n | \"America/Cayenne\"\n | \"America/Fortaleza\"\n | \"America/Godthab\"\n | \"America/Maceio\"\n | \"America/Miquelon\"\n | \"America/Montevideo\"\n | \"America/Paramaribo\"\n | \"America/Punta_Arenas\"\n | \"America/Recife\"\n | \"America/Santarem\"\n | \"America/Sao_Paulo\"\n | \"Antarctica/Palmer\"\n | \"Antarctica/Rothera\"\n | \"Atlantic/Stanley\"\n | \"America/Noronha\"\n | \"Atlantic/South_Georgia\"\n | \"America/Scoresbysund\"\n | \"Atlantic/Azores\"\n | \"Atlantic/Cape_Verde\"\n | \"Africa/Abidjan\"\n | \"Africa/Accra\"\n | \"Africa/Bamako\"\n | \"Africa/Banjul\"\n | \"Africa/Bissau\"\n | \"Africa/Casablanca\"\n | \"Africa/Conakry\"\n | \"Africa/Dakar\"\n | \"Africa/El_Aaiun\"\n | \"Africa/Freetown\"\n | \"Africa/Lome\"\n | \"Africa/Monrovia\"\n | \"Africa/Nouakchott\"\n | \"Africa/Ouagadougou\"\n | \"Africa/Sao_Tome\"\n | \"America/Danmarkshavn\"\n | \"Antarctica/Troll\"\n | \"Atlantic/Canary\"\n | \"Atlantic/Faroe\"\n | \"Atlantic/Madeira\"\n | \"Atlantic/Reykjavik\"\n | \"Atlantic/St_Helena\"\n | \"Europe/Dublin\"\n | \"Europe/Guernsey\"\n | \"Europe/Isle_of_Man\"\n | \"Europe/Jersey\"\n | \"Europe/Lisbon\"\n | \"Europe/London\"\n | \"Africa/Algiers\"\n | \"Africa/Bangui\"\n | \"Africa/Brazzaville\"\n | \"Africa/Ceuta\"\n | \"Africa/Douala\"\n | \"Africa/Kinshasa\"\n | \"Africa/Lagos\"\n | \"Africa/Libreville\"\n | \"Africa/Luanda\"\n | \"Africa/Malabo\"\n | \"Africa/Ndjamena\"\n | \"Africa/Niamey\"\n | \"Africa/Porto-Novo\"\n | \"Africa/Tunis\"\n | \"Africa/Windhoek\"\n | \"Arctic/Longyearbyen\"\n | \"Europe/Amsterdam\"\n | \"Europe/Andorra\"\n | \"Europe/Belgrade\"\n | \"Europe/Berlin\"\n | \"Europe/Bratislava\"\n | \"Europe/Brussels\"\n | \"Europe/Budapest\"\n | \"Europe/Copenhagen\"\n | \"Europe/Gibraltar\"\n | \"Europe/Ljubljana\"\n | \"Europe/Luxembourg\"\n | \"Europe/Madrid\"\n | \"Europe/Malta\"\n | \"Europe/Monaco\"\n | \"Europe/Oslo\"\n | \"Europe/Paris\"\n | \"Europe/Podgorica\"\n | \"Europe/Prague\"\n | \"Europe/Rome\"\n | \"Europe/San_Marino\"\n | \"Europe/Sarajevo\"\n | \"Europe/Skopje\"\n | \"Europe/Stockholm\"\n | \"Europe/Tirane\"\n | \"Europe/Vaduz\"\n | \"Europe/Vatican\"\n | \"Europe/Vienna\"\n | \"Europe/Warsaw\"\n | \"Europe/Zagreb\"\n | \"Europe/Zurich\"\n | \"Africa/Blantyre\"\n | \"Africa/Bujumbura\"\n | \"Africa/Cairo\"\n | \"Africa/Gaborone\"\n | \"Africa/Harare\"\n | \"Africa/Johannesburg\"\n | \"Africa/Juba\"\n | \"Africa/Khartoum\"\n | \"Africa/Kigali\"\n | \"Africa/Lubumbashi\"\n | \"Africa/Lusaka\"\n | \"Africa/Maputo\"\n | \"Africa/Maseru\"\n | \"Africa/Mbabane\"\n | \"Africa/Tripoli\"\n | \"Asia/Amman\"\n | \"Asia/Beirut\"\n | \"Asia/Damascus\"\n | \"Asia/Famagusta\"\n | \"Asia/Gaza\"\n | \"Asia/Hebron\"\n | \"Asia/Jerusalem\"\n | \"Asia/Nicosia\"\n | \"Europe/Athens\"\n | \"Europe/Bucharest\"\n | \"Europe/Chisinau\"\n | \"Europe/Helsinki\"\n | \"Europe/Kaliningrad\"\n | \"Europe/Kyiv\"\n | \"Europe/Mariehamn\"\n | \"Europe/Riga\"\n | \"Europe/Sofia\"\n | \"Europe/Tallinn\"\n | \"Europe/Uzhgorod\"\n | \"Europe/Vilnius\"\n | \"Europe/Zaporizhzhia\"\n | \"Africa/Addis_Ababa\"\n | \"Africa/Asmara\"\n | \"Africa/Dar_es_Salaam\"\n | \"Africa/Djibouti\"\n | \"Africa/Kampala\"\n | \"Africa/Mogadishu\"\n | \"Africa/Nairobi\"\n | \"Antarctica/Syowa\"\n | \"Asia/Aden\"\n | \"Asia/Baghdad\"\n | \"Asia/Bahrain\"\n | \"Asia/Kuwait\"\n | \"Asia/Qatar\"\n | \"Asia/Riyadh\"\n | \"Europe/Istanbul\"\n | \"Europe/Kirov\"\n | \"Europe/Minsk\"\n | \"Europe/Moscow\"\n | \"Europe/Simferopol\"\n | \"Europe/Volgograd\"\n | \"Indian/Antananarivo\"\n | \"Indian/Comoro\"\n | \"Indian/Mayotte\"\n | \"Asia/Tehran\"\n | \"Asia/Baku\"\n | \"Asia/Dubai\"\n | \"Asia/Muscat\"\n | \"Asia/Tbilisi\"\n | \"Asia/Yerevan\"\n | \"Europe/Astrakhan\"\n | \"Europe/Samara\"\n | \"Europe/Saratov\"\n | \"Europe/Ulyanovsk\"\n | \"Indian/Mahe\"\n | \"Indian/Mauritius\"\n | \"Indian/Reunion\"\n | \"Asia/Kabul\"\n | \"Antarctica/Mawson\"\n | \"Asia/Aqtau\"\n | \"Asia/Aqtobe\"\n | \"Asia/Ashgabat\"\n | \"Asia/Atyrau\"\n | \"Asia/Dushanbe\"\n | \"Asia/Karachi\"\n | \"Asia/Oral\"\n | \"Asia/Qyzylorda\"\n | \"Asia/Samarkand\"\n | \"Asia/Tashkent\"\n | \"Asia/Yekaterinburg\"\n | \"Indian/Kerguelen\"\n | \"Indian/Maldives\"\n | \"Asia/Colombo\"\n | \"Asia/Kolkata\"\n | \"Asia/Kathmandu\"\n | \"Antarctica/Vostok\"\n | \"Asia/Almaty\"\n | \"Asia/Bishkek\"\n | \"Asia/Dhaka\"\n | \"Asia/Omsk\"\n | \"Asia/Qostanay\"\n | \"Asia/Thimphu\"\n | \"Asia/Urumqi\"\n | \"Indian/Chagos\"\n | \"Asia/Yangon\"\n | \"Indian/Cocos\"\n | \"Antarctica/Davis\"\n | \"Asia/Bangkok\"\n | \"Asia/Barnaul\"\n | \"Asia/Hovd\"\n | \"Asia/Ho_Chi_Minh\"\n | \"Asia/Jakarta\"\n | \"Asia/Krasnoyarsk\"\n | \"Asia/Novokuznetsk\"\n | \"Asia/Novosibirsk\"\n | \"Asia/Phnom_Penh\"\n | \"Asia/Pontianak\"\n | \"Asia/Tomsk\"\n | \"Asia/Vientiane\"\n | \"Indian/Christmas\"\n | \"Asia/Brunei\"\n | \"Asia/Choibalsan\"\n | \"Asia/Hong_Kong\"\n | \"Asia/Irkutsk\"\n | \"Asia/Kuala_Lumpur\"\n | \"Asia/Kuching\"\n | \"Asia/Macau\"\n | \"Asia/Makassar\"\n | \"Asia/Manila\"\n | \"Asia/Shanghai\"\n | \"Asia/Singapore\"\n | \"Asia/Taipei\"\n | \"Asia/Ulaanbaatar\"\n | \"Australia/Perth\"\n | \"Australia/Eucla\"\n | \"Asia/Chita\"\n | \"Asia/Dili\"\n | \"Asia/Jayapura\"\n | \"Asia/Khandyga\"\n | \"Asia/Pyongyang\"\n | \"Asia/Seoul\"\n | \"Asia/Tokyo\"\n | \"Asia/Yakutsk\"\n | \"Pacific/Palau\"\n | \"Australia/Adelaide\"\n | \"Australia/Broken_Hill\"\n | \"Australia/Darwin\"\n | \"Antarctica/DumontDUrville\"\n | \"Antarctica/Macquarie\"\n | \"Asia/Ust-Nera\"\n | \"Asia/Vladivostok\"\n | \"Australia/Brisbane\"\n | \"Australia/Currie\"\n | \"Australia/Hobart\"\n | \"Australia/Lindeman\"\n | \"Australia/Melbourne\"\n | \"Australia/Sydney\"\n | \"Pacific/Chuuk\"\n | \"Pacific/Guam\"\n | \"Pacific/Port_Moresby\"\n | \"Pacific/Saipan\"\n | \"Australia/Lord_Howe\"\n | \"Antarctica/Casey\"\n | \"Asia/Magadan\"\n | \"Asia/Sakhalin\"\n | \"Asia/Srednekolymsk\"\n | \"Pacific/Bougainville\"\n | \"Pacific/Efate\"\n | \"Pacific/Guadalcanal\"\n | \"Pacific/Kosrae\"\n | \"Pacific/Norfolk\"\n | \"Pacific/Noumea\"\n | \"Pacific/Pohnpei\"\n | \"Antarctica/McMurdo\"\n | \"Asia/Anadyr\"\n | \"Asia/Kamchatka\"\n | \"Pacific/Auckland\"\n | \"Pacific/Fiji\"\n | \"Pacific/Funafuti\"\n | \"Pacific/Kwajalein\"\n | \"Pacific/Majuro\"\n | \"Pacific/Nauru\"\n | \"Pacific/Tarawa\"\n | \"Pacific/Wake\"\n | \"Pacific/Wallis\"\n | \"Pacific/Chatham\"\n | \"Pacific/Apia\"\n | \"Pacific/Enderbury\"\n | \"Pacific/Fakaofo\"\n | \"Pacific/Tongatapu\"\n | \"Pacific/Kiritimati\";\n\nexport type ScheduleTrigger<Args> = ParserScheduleTriggerInput & {\n __args: Args;\n};\n\nexport interface ScheduleArgs {\n env: TailorEnv;\n}\n\n/**\n * Create a schedule-based trigger using a CRON expression and optional timezone.\n * @template T\n * @param {{ cron: T; timezone?: Timezone }} options - Schedule options\n * @returns {ScheduleTrigger<ScheduleArgs>} Schedule trigger\n */\nexport function scheduleTrigger<T extends string>({\n cron,\n timezone,\n}: {\n cron: StandardCRON<T> extends never ? never : T;\n timezone?: Timezone;\n}): ScheduleTrigger<ScheduleArgs> {\n return {\n kind: \"schedule\",\n cron,\n timezone,\n __args: {} as ScheduleArgs,\n };\n}\n","import type { TailorEnv } from \"@/configure/types/env\";\nimport type { IncomingWebhookTrigger as ParserIncomingWebhookTrigger } from \"@/parser/service/executor/types\";\n\nexport interface IncomingWebhookArgs<T extends IncomingWebhookRequest> {\n body: T[\"body\"];\n headers: T[\"headers\"];\n method: \"POST\" | \"GET\" | \"PUT\" | \"DELETE\";\n rawBody: string;\n env: TailorEnv;\n}\n\nexport interface IncomingWebhookRequest {\n body: Record<string, unknown>;\n headers: Record<string, string>;\n}\n\nexport type IncomingWebhookTrigger<Args> = ParserIncomingWebhookTrigger & {\n __args: Args;\n};\n\n/**\n * Create a trigger for incoming webhook requests.\n * @template T\n * @returns {IncomingWebhookTrigger<IncomingWebhookArgs<T>>} 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 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\n/**\n * Create a workflow definition that can be triggered via the Tailor SDK.\n * @template Job\n * @param {{ name: string; mainJob: Job }} config - Workflow configuration\n * @returns {Workflow<Job>} Defined workflow\n */\nexport function createWorkflow<Job extends WorkflowJob<any, any, any>>(config: {\n name: string;\n mainJob: Job;\n}): Workflow<Job> {\n return {\n ...config,\n trigger: async (args, options) => {\n return tailor.workflow.triggerWorkflow(\n config.name,\n args,\n options ? { authInvoker: options.authInvoker } : undefined,\n );\n },\n };\n}\n","import type { StaticWebsiteInput } from \"@/parser/service/staticwebsite/types\";\n\ndeclare const staticWebsiteDefinitionBrand: unique symbol;\ntype StaticWebsiteDefinitionBrand = {\n readonly [staticWebsiteDefinitionBrand]: true;\n};\n\n/**\n * Define a static website configuration for the Tailor SDK.\n * @param {string} name - Static website name\n * @param {Omit<StaticWebsiteInput, \"name\">} config - Static website configuration\n * @returns {StaticWebsiteDefinitionBrand & StaticWebsiteInput & { readonly url: string }} 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 } from \"@/parser/service/idp/types\";\n\ndeclare const idpDefinitionBrand: unique symbol;\ntype IdpDefinitionBrand = { readonly [idpDefinitionBrand]: true };\n\n/**\n * Define an IdP service configuration for the Tailor SDK.\n * @template TClients\n * @param {string} name - IdP service name\n * @param {Omit<IdPInput, \"name\" | \"clients\"> & { clients: TClients }} config - IdP configuration\n * @returns {IdpDefinitionBrand & IdPInput} 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 IdPExternalConfig = { name: string; external: true };\n\nexport type IdPConfig = Omit<ReturnType<typeof defineIdp>, \"provider\"> | IdPExternalConfig;\n","import { t as _t } from \"@/configure/types\";\nimport type * as helperTypes from \"@/configure/types/helpers\";\n\ntype TailorOutput<T> = helperTypes.output<T>;\n\nexport type infer<T> = TailorOutput<T>;\nexport type output<T> = TailorOutput<T>;\n\n// eslint-disable-next-line import/export\nexport const t = { ..._t };\n// eslint-disable-next-line @typescript-eslint/no-namespace, import/export\nexport namespace t {\n export type output<T> = TailorOutput<T>;\n export type infer<T> = TailorOutput<T>;\n}\n\nexport {\n TailorField,\n type TailorUser,\n unauthenticatedTailorUser,\n type AttributeMap,\n type AttributeList,\n type Env,\n} from \"@/configure/types\";\n\nexport * from \"@/configure/services\";\n\nexport { defineConfig, defineGenerators } from \"@/configure/config\";\n"],"mappings":";;;;;;;;;;AAgDA,SAAgB,eAId,QAM+B;CAC/B,MAAM,mBACJ,OAAO,kBAAkB,cAAc,OAAO,SAASA,IAAE,OAAO,OAAO,OAAO;AAEhF,QAAO;EACL,GAAG;EACH,QAAQ;EACT;;;;;;;;;;;;ACtBH,SAAgB,eAGd,QAA2B;AAC3B,QAAO;;;;;;;;;;;ACUT,SAAgB,qBAA6C,EAC3D,MACA,aAIsC;AACtC,QAAO;EACL,MAAM;EACN,UAAU,KAAK;EACf;EACA,QAAQ,EAAE;EACX;;;;;;;;AASH,SAAgB,qBAA6C,EAC3D,MACA,aAIsC;AACtC,QAAO;EACL,MAAM;EACN,UAAU,KAAK;EACf;EACA,QAAQ,EAAE;EACX;;;;;;;;AASH,SAAgB,qBAA6C,EAC3D,MACA,aAIsC;AACtC,QAAO;EACL,MAAM;EACN,UAAU,KAAK;EACf;EACA,QAAQ,EAAE;EACX;;;;;;;;AAaH,SAAgB,wBAAkD,EAChE,UACA,aAImD;AACnD,QAAO;EACL,MAAM;EACN,cAAc,SAAS;EACvB;EACA,QAAQ,EAAE;EACX;;;;;;;;;;;ACqTH,SAAgB,gBAAkC,EAChD,MACA,YAIgC;AAChC,QAAO;EACL,MAAM;EACN;EACA;EACA,QAAQ,EAAE;EACX;;;;;;;;;;AChbH,SAAgB,yBAEd;AACA,QAAO;EACL,MAAM;EACN,QAAQ,EAAE;EACX;;;;;;;;;;;ACLH,SAAgB,eAAuD,QAGrD;AAChB,QAAO;EACL,GAAG;EACH,SAAS,OAAO,MAAM,YAAY;AAChC,UAAO,OAAO,SAAS,gBACrB,OAAO,MACP,MACA,UAAU,EAAE,aAAa,QAAQ,aAAa,GAAG,OAClD;;EAEJ;;;;;;;;;;;AC1BH,SAAgB,oBAAoB,MAAc,QAA0C;AAS1F,QARe;EACb,GAAG;EACH;EACA,IAAI,MAAM;AACR,UAAO,GAAG,KAAK;;EAElB;;;;;;;;;;;;ACPH,SAAgB,UACd,MACA,QACA;AAgBA,QAfe;EACb,GAAG;EACH;EACA,SAAS,cAAsB,YAA8B;AAC3D,UAAO;IACL,MAAM;IACN,MAAM;IACN,WAAW;IACX;IACD;;EAEJ;;;;;ACnBH,MAAa,IAAI,EAAE,GAAGC,KAAI"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference path="./user-defined.d.ts" />
|
|
2
|
-
import { Ct as
|
|
2
|
+
import { Ct as TailorFieldType, Et as output$1, M as AllowedValuesOutput, St as FieldOutput, Tt as JsonCompatible, V as AuthInvoker, a as IncomingWebhookTrigger$1, bt as FieldMetadata, c as ScheduleTriggerInput, ft as TailorUser, ht as TailorField, i as GqlOperation$1, j as AllowedValues, k as TailorDBType, l as WebhookOperation$1, mt as TailorAnyField, n as ExecutorInput, o as RecordTrigger$1, r as FunctionOperation$1, s as ResolverExecutedTrigger$1, u as WorkflowOperation$1, vt as ResolverInput, wt as InferFieldsOutput, xt as FieldOptions, yt as ArrayFieldOutput } from "./types-Dg_zk_OZ.mjs";
|
|
3
3
|
import { JsonPrimitive, Jsonifiable, Jsonify } from "type-fest";
|
|
4
4
|
import { Client } from "@urql/core";
|
|
5
5
|
import { StandardCRON } from "ts-cron-validator";
|
|
@@ -10,27 +10,34 @@ interface Env {}
|
|
|
10
10
|
type TailorEnv = keyof Env extends never ? Record<string, string> : Env;
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/configure/services/resolver/resolver.d.ts
|
|
13
|
-
type Context<Input extends Record<string,
|
|
14
|
-
input: Input extends Record<string,
|
|
13
|
+
type Context<Input extends Record<string, TailorAnyField> | undefined> = {
|
|
14
|
+
input: Input extends Record<string, TailorAnyField> ? InferFieldsOutput<Input> : never;
|
|
15
15
|
user: TailorUser;
|
|
16
16
|
env: TailorEnv;
|
|
17
17
|
};
|
|
18
|
-
type OutputType<O> = O extends
|
|
18
|
+
type OutputType<O> = O extends TailorAnyField ? output$1<O> : O extends Record<string, TailorAnyField> ? InferFieldsOutput<O> : never;
|
|
19
19
|
/**
|
|
20
20
|
* Normalized output type that preserves generic type information.
|
|
21
21
|
* - If Output is already a TailorField, use it as-is
|
|
22
22
|
* - If Output is a Record of fields, wrap it as a nested TailorField
|
|
23
23
|
*/
|
|
24
|
-
type NormalizedOutput<Output extends
|
|
24
|
+
type NormalizedOutput<Output extends TailorAnyField | Record<string, TailorAnyField>> = Output extends TailorAnyField ? Output : TailorField<{
|
|
25
25
|
type: "nested";
|
|
26
26
|
array: false;
|
|
27
|
-
}, InferFieldsOutput<Extract<Output, Record<string,
|
|
28
|
-
type ResolverReturn<Input extends Record<string,
|
|
27
|
+
}, InferFieldsOutput<Extract<Output, Record<string, TailorAnyField>>>>;
|
|
28
|
+
type ResolverReturn<Input extends Record<string, TailorAnyField> | undefined, Output extends TailorAnyField | Record<string, TailorAnyField>> = Omit<ResolverInput, "input" | "output" | "body"> & Readonly<{
|
|
29
29
|
input?: Input;
|
|
30
30
|
output: NormalizedOutput<Output>;
|
|
31
31
|
body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;
|
|
32
32
|
}>;
|
|
33
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Create a resolver definition for the Tailor SDK.
|
|
35
|
+
* @template Input
|
|
36
|
+
* @template Output
|
|
37
|
+
* @param {Omit<ResolverInput, "input" | "output" | "body"> & { input?: Input; output: Output; body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>> }} config - Resolver configuration
|
|
38
|
+
* @returns {ResolverReturn<Input, Output>} Normalized resolver configuration
|
|
39
|
+
*/
|
|
40
|
+
declare function createResolver<Input extends Record<string, TailorAnyField> | undefined = undefined, Output extends TailorAnyField | Record<string, TailorAnyField> = TailorAnyField>(config: Omit<ResolverInput, "input" | "output" | "body"> & Readonly<{
|
|
34
41
|
input?: Input;
|
|
35
42
|
output: Output;
|
|
36
43
|
body: (context: Context<Input>) => OutputType<Output> | Promise<OutputType<Output>>;
|
|
@@ -125,6 +132,12 @@ interface Workflow<Job extends WorkflowJob<any, any, any> = WorkflowJob<any, any
|
|
|
125
132
|
authInvoker: AuthInvoker<string>;
|
|
126
133
|
}) => Promise<string>;
|
|
127
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Create a workflow definition that can be triggered via the Tailor SDK.
|
|
137
|
+
* @template Job
|
|
138
|
+
* @param {{ name: string; mainJob: Job }} config - Workflow configuration
|
|
139
|
+
* @returns {Workflow<Job>} Defined workflow
|
|
140
|
+
*/
|
|
128
141
|
declare function createWorkflow<Job extends WorkflowJob<any, any, any>>(config: {
|
|
129
142
|
name: string;
|
|
130
143
|
mainJob: Job;
|
|
@@ -193,6 +206,12 @@ type ResolverExecutedArgs<R extends ResolverConfig> = EventArgs & {
|
|
|
193
206
|
type RecordTrigger<Args> = RecordTrigger$1 & {
|
|
194
207
|
__args: Args;
|
|
195
208
|
};
|
|
209
|
+
/**
|
|
210
|
+
* Create a trigger that fires when a TailorDB record is created.
|
|
211
|
+
* @template T
|
|
212
|
+
* @param {{ type: T; condition?: (args: RecordCreatedArgs<T>) => boolean }} options - Trigger options
|
|
213
|
+
* @returns {RecordTrigger<RecordCreatedArgs<T>>} Record created trigger
|
|
214
|
+
*/
|
|
196
215
|
declare function recordCreatedTrigger<T extends TailorDBType>({
|
|
197
216
|
type,
|
|
198
217
|
condition
|
|
@@ -200,6 +219,12 @@ declare function recordCreatedTrigger<T extends TailorDBType>({
|
|
|
200
219
|
type: T;
|
|
201
220
|
condition?: (args: RecordCreatedArgs<T>) => boolean;
|
|
202
221
|
}): RecordTrigger<RecordCreatedArgs<T>>;
|
|
222
|
+
/**
|
|
223
|
+
* Create a trigger that fires when a TailorDB record is updated.
|
|
224
|
+
* @template T
|
|
225
|
+
* @param {{ type: T; condition?: (args: RecordUpdatedArgs<T>) => boolean }} options - Trigger options
|
|
226
|
+
* @returns {RecordTrigger<RecordUpdatedArgs<T>>} Record updated trigger
|
|
227
|
+
*/
|
|
203
228
|
declare function recordUpdatedTrigger<T extends TailorDBType>({
|
|
204
229
|
type,
|
|
205
230
|
condition
|
|
@@ -207,6 +232,12 @@ declare function recordUpdatedTrigger<T extends TailorDBType>({
|
|
|
207
232
|
type: T;
|
|
208
233
|
condition?: (args: RecordUpdatedArgs<T>) => boolean;
|
|
209
234
|
}): RecordTrigger<RecordUpdatedArgs<T>>;
|
|
235
|
+
/**
|
|
236
|
+
* Create a trigger that fires when a TailorDB record is deleted.
|
|
237
|
+
* @template T
|
|
238
|
+
* @param {{ type: T; condition?: (args: RecordDeletedArgs<T>) => boolean }} options - Trigger options
|
|
239
|
+
* @returns {RecordTrigger<RecordDeletedArgs<T>>} Record deleted trigger
|
|
240
|
+
*/
|
|
210
241
|
declare function recordDeletedTrigger<T extends TailorDBType>({
|
|
211
242
|
type,
|
|
212
243
|
condition
|
|
@@ -217,6 +248,12 @@ declare function recordDeletedTrigger<T extends TailorDBType>({
|
|
|
217
248
|
type ResolverExecutedTrigger<Args> = ResolverExecutedTrigger$1 & {
|
|
218
249
|
__args: Args;
|
|
219
250
|
};
|
|
251
|
+
/**
|
|
252
|
+
* Create a trigger that fires when a resolver is executed.
|
|
253
|
+
* @template R
|
|
254
|
+
* @param {{ resolver: R; condition?: (args: ResolverExecutedArgs<R>) => boolean }} options - Trigger options
|
|
255
|
+
* @returns {ResolverExecutedTrigger<ResolverExecutedArgs<R>>} Resolver executed trigger
|
|
256
|
+
*/
|
|
220
257
|
declare function resolverExecutedTrigger<R extends ResolverConfig>({
|
|
221
258
|
resolver,
|
|
222
259
|
condition
|
|
@@ -233,6 +270,12 @@ type ScheduleTrigger<Args> = ScheduleTriggerInput & {
|
|
|
233
270
|
interface ScheduleArgs {
|
|
234
271
|
env: TailorEnv;
|
|
235
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* Create a schedule-based trigger using a CRON expression and optional timezone.
|
|
275
|
+
* @template T
|
|
276
|
+
* @param {{ cron: T; timezone?: Timezone }} options - Schedule options
|
|
277
|
+
* @returns {ScheduleTrigger<ScheduleArgs>} Schedule trigger
|
|
278
|
+
*/
|
|
236
279
|
declare function scheduleTrigger<T extends string>({
|
|
237
280
|
cron,
|
|
238
281
|
timezone
|
|
@@ -256,6 +299,11 @@ interface IncomingWebhookRequest {
|
|
|
256
299
|
type IncomingWebhookTrigger<Args> = IncomingWebhookTrigger$1 & {
|
|
257
300
|
__args: Args;
|
|
258
301
|
};
|
|
302
|
+
/**
|
|
303
|
+
* Create a trigger for incoming webhook requests.
|
|
304
|
+
* @template T
|
|
305
|
+
* @returns {IncomingWebhookTrigger<IncomingWebhookArgs<T>>} Incoming webhook trigger
|
|
306
|
+
*/
|
|
259
307
|
declare function incomingWebhookTrigger<T extends IncomingWebhookRequest>(): IncomingWebhookTrigger<IncomingWebhookArgs<T>>;
|
|
260
308
|
//#endregion
|
|
261
309
|
//#region src/configure/services/executor/trigger/index.d.ts
|
|
@@ -287,6 +335,13 @@ type Executor<Args, O> = O extends {
|
|
|
287
335
|
} : ExecutorBase<Args> & {
|
|
288
336
|
operation: O;
|
|
289
337
|
};
|
|
338
|
+
/**
|
|
339
|
+
* Create an executor configuration for the Tailor SDK.
|
|
340
|
+
* @template Args
|
|
341
|
+
* @template O
|
|
342
|
+
* @param {Executor<Args, O>} config - Executor configuration
|
|
343
|
+
* @returns {Executor<Args, O>} The same executor configuration
|
|
344
|
+
*/
|
|
290
345
|
declare function createExecutor<Args, O extends Operation<Args> | {
|
|
291
346
|
kind: "workflow";
|
|
292
347
|
workflow: Workflow;
|
|
@@ -351,7 +406,7 @@ declare const t: {
|
|
|
351
406
|
array: true;
|
|
352
407
|
} ? true : false;
|
|
353
408
|
}, FieldOutput<AllowedValuesOutput<V>, Opt>>;
|
|
354
|
-
object: <const F extends Record<string,
|
|
409
|
+
object: <const F extends Record<string, TailorAnyField>, const Opt extends FieldOptions>(fields: F, options?: Opt) => TailorField<{
|
|
355
410
|
type: "nested";
|
|
356
411
|
array: Opt extends {
|
|
357
412
|
array: true;
|
|
@@ -364,4 +419,4 @@ declare namespace t {
|
|
|
364
419
|
}
|
|
365
420
|
//#endregion
|
|
366
421
|
export { createWorkflow as A, FunctionOperation as C, WorkflowOperation as D, WebhookOperation as E, WorkflowJobOutput as F, createWorkflowJob as I, createResolver as L, WorkflowJob as M, WorkflowJobContext as N, Workflow as O, WorkflowJobInput as P, Env as R, resolverExecutedTrigger as S, Operation as T, ResolverExecutedArgs as _, Trigger as a, recordDeletedTrigger as b, IncomingWebhookTrigger as c, ScheduleTrigger as d, scheduleTrigger as f, RecordUpdatedArgs as g, RecordTrigger as h, createExecutor as i, WORKFLOW_JOB_BRAND as j, WorkflowConfig as k, incomingWebhookTrigger as l, RecordDeletedArgs as m, output as n, IncomingWebhookArgs as o, RecordCreatedArgs as p, t as r, IncomingWebhookRequest as s, infer as t, ScheduleArgs as u, ResolverExecutedTrigger as v, GqlOperation as w, recordUpdatedTrigger as x, recordCreatedTrigger as y };
|
|
367
|
-
//# sourceMappingURL=index-
|
|
422
|
+
//# sourceMappingURL=index-DXZMT4aO.d.mts.map
|