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

//#region src/configure/services/resolver/resolver.ts
/**
* Create a resolver definition for the Tailor SDK.
* @template Input
* @template Output
* @param config - Resolver configuration
* @returns Normalized resolver configuration
*/
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
/**
* Create an executor configuration for the Tailor SDK.
* @template Args
* @template O
* @param config - Executor configuration
* @returns The same executor configuration
*/
function createExecutor(config) {
	return config;
}

//#endregion
//#region src/configure/services/executor/trigger/event.ts
/**
* Create a trigger that fires when a TailorDB record is created.
* @template T
* @param options - Trigger options
* @returns Record created trigger
*/
function recordCreatedTrigger(options) {
	const { type, condition } = options;
	return {
		kind: "recordCreated",
		typeName: type.name,
		condition,
		__args: {}
	};
}
/**
* Create a trigger that fires when a TailorDB record is updated.
* @template T
* @param options - Trigger options
* @returns Record updated trigger
*/
function recordUpdatedTrigger(options) {
	const { type, condition } = options;
	return {
		kind: "recordUpdated",
		typeName: type.name,
		condition,
		__args: {}
	};
}
/**
* Create a trigger that fires when a TailorDB record is deleted.
* @template T
* @param options - Trigger options
* @returns Record deleted trigger
*/
function recordDeletedTrigger(options) {
	const { type, condition } = options;
	return {
		kind: "recordDeleted",
		typeName: type.name,
		condition,
		__args: {}
	};
}
/**
* Create a trigger that fires when a resolver is executed.
* @template R
* @param options - Trigger options
* @returns Resolver executed trigger
*/
function resolverExecutedTrigger(options) {
	const { resolver, condition } = options;
	return {
		kind: "resolverExecuted",
		resolverName: resolver.name,
		condition,
		__args: {}
	};
}

//#endregion
//#region src/configure/services/executor/trigger/schedule.ts
/**
* Create a schedule-based trigger using a CRON expression and optional timezone.
* @template T
* @param options - Schedule options
* @returns Schedule trigger
*/
function scheduleTrigger(options) {
	const { cron, timezone } = options;
	return {
		kind: "schedule",
		cron,
		timezone,
		__args: {}
	};
}

//#endregion
//#region src/configure/services/executor/trigger/webhook.ts
/**
* Create a trigger for incoming webhook requests.
* @template T
* @returns Incoming webhook trigger
*/
function incomingWebhookTrigger() {
	return {
		kind: "incomingWebhook",
		__args: {}
	};
}

//#endregion
//#region src/configure/services/workflow/workflow.ts
/**
* Create a workflow definition that can be triggered via the Tailor SDK.
* @template Job
* @param config - Workflow configuration
* @returns Defined workflow
*/
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
/**
* Define a static website configuration for the Tailor SDK.
* @param name - Static website name
* @param config - Static website configuration
* @returns Defined static website
*/
function defineStaticWebSite(name, config) {
	return {
		...config,
		name,
		get url() {
			return `${name}:url`;
		}
	};
}

//#endregion
//#region src/configure/services/idp/index.ts
/**
* Define an IdP service configuration for the Tailor SDK.
* @template TClients
* @param name - IdP service name
* @param config - IdP configuration
* @returns Defined IdP service
*/
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