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-CtRi0Lgg.mjs";

//#region src/configure/services/resolver/resolver.ts
function createResolver(config) {
	const normalizedOutput = config.output instanceof TailorField ? config.output : t$1.object(config.output);
	return {
		...config,
		output: normalizedOutput
	};
}

//#endregion
//#region src/configure/services/executor/executor.ts
function createExecutor(config) {
	return config;
}

//#endregion
//#region src/configure/services/executor/trigger/event.ts
function recordCreatedTrigger({ type, condition }) {
	return {
		kind: "recordCreated",
		typeName: type.name,
		condition,
		__args: {}
	};
}
function recordUpdatedTrigger({ type, condition }) {
	return {
		kind: "recordUpdated",
		typeName: type.name,
		condition,
		__args: {}
	};
}
function recordDeletedTrigger({ type, condition }) {
	return {
		kind: "recordDeleted",
		typeName: type.name,
		condition,
		__args: {}
	};
}
function resolverExecutedTrigger({ resolver, condition }) {
	return {
		kind: "resolverExecuted",
		resolverName: resolver.name,
		condition,
		__args: {}
	};
}

//#endregion
//#region src/configure/services/executor/trigger/schedule.ts
function scheduleTrigger({ cron, timezone }) {
	return {
		kind: "schedule",
		cron,
		timezone,
		__args: {}
	};
}

//#endregion
//#region src/configure/services/executor/trigger/webhook.ts
function incomingWebhookTrigger() {
	return {
		kind: "incomingWebhook",
		__args: {}
	};
}

//#endregion
//#region src/configure/services/workflow/workflow.ts
function createWorkflow(config) {
	return {
		...config,
		trigger: async (args, options) => {
			return tailor.workflow.triggerWorkflow(config.name, args, options ? { authInvoker: options.authInvoker } : void 0);
		}
	};
}

//#endregion
//#region src/configure/services/staticwebsite/index.ts
function defineStaticWebSite(name, config) {
	return {
		...config,
		name,
		get url() {
			return `${name}:url`;
		}
	};
}

//#endregion
//#region src/configure/services/idp/index.ts
function defineIdp(name, config) {
	return {
		...config,
		name,
		provider(providerName, clientName) {
			return {
				name: providerName,
				kind: "BuiltInIdP",
				namespace: name,
				clientName
			};
		}
	};
}

//#endregion
//#region src/configure/index.ts
const t = { ...t$1 };

//#endregion
export { TailorField, WORKFLOW_JOB_BRAND, createExecutor, createResolver, createWorkflow, createWorkflowJob, db, defineAuth, defineConfig, defineGenerators, defineIdp, defineStaticWebSite, incomingWebhookTrigger, recordCreatedTrigger, recordDeletedTrigger, recordUpdatedTrigger, resolverExecutedTrigger, scheduleTrigger, t, unauthenticatedTailorUser, unsafeAllowAllGqlPermission, unsafeAllowAllTypePermission };
//# sourceMappingURL=index.mjs.map