@tailor-platform/sdk 1.19.0 → 1.21.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-A6PZjujv.mjs → application-CEv5c7TU.mjs} +97929 -97634
- package/dist/application-CEv5c7TU.mjs.map +1 -0
- package/dist/{application-nPS5veK6.mjs → application-DiCzM9b0.mjs} +3 -3
- package/dist/cli/index.mjs +118 -63
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +117 -58
- package/dist/cli/lib.mjs +7 -7
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/skills.mjs +1 -1
- package/dist/cli/skills.mjs.map +1 -1
- package/dist/configure/index.d.mts +4 -4
- package/dist/configure/index.mjs +5 -0
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{index-B91ZpOcd.d.mts → index-BWVAwea4.d.mts} +2 -2
- package/dist/{index-ClLZCbcm.d.mts → index-CnHd6BNg.d.mts} +9 -43
- package/dist/{index-DDqKNFh4.d.mts → index-Dn61THJK.d.mts} +2 -2
- package/dist/{index-B6pvy1MK.d.mts → index-DxlmLUag.d.mts} +2 -2
- package/dist/{index-CPzbMghQ.d.mts → index-oZXVKyfX.d.mts} +2 -2
- package/dist/{package-json-DUY2kB6z.mjs → package-json-3H5gfhA4.mjs} +2 -2
- package/dist/package-json-3H5gfhA4.mjs.map +1 -0
- package/dist/package-json-DTDAqRRJ.mjs +3 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +2 -2
- package/dist/plugin/builtin/file-utils/index.d.mts +2 -2
- package/dist/plugin/builtin/kysely-type/index.d.mts +2 -2
- 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/{seed-CeUEANfQ.mjs → seed-D-rYCN5F.mjs} +2 -2
- package/dist/{seed-CeUEANfQ.mjs.map → seed-D-rYCN5F.mjs.map} +1 -1
- package/dist/telemetry-Dhzj9Ncm.mjs +3 -0
- package/dist/{telemetry-rFq0QdvJ.mjs → telemetry-DuBhnd0X.mjs} +2 -2
- package/dist/telemetry-DuBhnd0X.mjs.map +1 -0
- package/dist/{types-CJF3Y1x8.d.mts → types-C0o90Cmb.d.mts} +87 -3
- package/dist/types-ClK_HJ0G.mjs.map +1 -1
- package/dist/{types-CblXasFV.d.mts → types-QKq1usl7.d.mts} +20 -9
- package/dist/{update-Cr5c7h1r.mjs → update-9MTRN1UA.mjs} +456 -244
- package/dist/update-9MTRN1UA.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +3 -3
- package/docs/cli/application.md +2 -0
- package/docs/services/resolver.md +61 -0
- package/docs/services/tailordb.md +55 -0
- package/package.json +1 -1
- package/dist/application-A6PZjujv.mjs.map +0 -1
- package/dist/package-json-DUY2kB6z.mjs.map +0 -1
- package/dist/package-json-Dd1AnA5F.mjs +0 -3
- package/dist/telemetry-9A1BZqbl.mjs +0 -3
- package/dist/telemetry-rFq0QdvJ.mjs.map +0 -1
- package/dist/update-Cr5c7h1r.mjs.map +0 -1
package/dist/cli/lib.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.mjs","names":["fs"],"sources":["../../src/cli/utils/seed-chunker.ts","../../src/cli/bundler/seed/seed-bundler.ts","../../src/cli/lib.ts"],"sourcesContent":["/**\n * Seed data chunker for splitting large seed data into manageable message sizes.\n *\n * When seed data exceeds the gRPC message size limit, this module splits the data\n * into multiple chunks at type boundaries (or record boundaries for large types).\n */\n\n/**\n * Seed data keyed by type name, with an array of records per type.\n */\nexport type SeedData = Record<string, Record<string, unknown>[]>;\n\n/**\n * A single chunk of seed data with metadata for ordered execution.\n */\nexport type SeedChunk = {\n data: SeedData;\n order: string[];\n index: number;\n total: number;\n};\n\n/**\n * Options for chunking seed data.\n */\nexport type ChunkSeedDataOptions = {\n /** Seed data keyed by type name */\n data: SeedData;\n /** Ordered list of type names (dependency order) */\n order: string[];\n /** Byte size of the bundled seed script code */\n codeByteSize: number;\n /** Maximum gRPC message size in bytes (default: 3.5MB) */\n maxMessageSize?: number;\n};\n\n/** Default maximum message size: 3.5MB (conservative limit for gRPC) */\nexport const DEFAULT_MAX_MESSAGE_SIZE = 3.5 * 1024 * 1024;\n\n/** Reserved bytes for message metadata overhead */\nconst METADATA_OVERHEAD = 1024;\n\n/**\n * Split seed data into chunks that fit within the gRPC message size limit.\n *\n * Algorithm:\n * 1. Calculate the available budget for the arg field (maxMessageSize - codeByteSize - overhead)\n * 2. If all data fits in one message, return a single chunk\n * 3. Otherwise, iterate through types in dependency order:\n * - If a type fits in the current chunk, add it\n * - If adding a type would exceed the budget, finalize the current chunk and start a new one\n * - If a single type exceeds the budget, split its records across multiple chunks\n * - If a single record exceeds the budget, throw an error\n * @param options - Chunking options\n * @returns Array of seed chunks\n */\nexport function chunkSeedData(options: ChunkSeedDataOptions): SeedChunk[] {\n const { data, order, codeByteSize, maxMessageSize = DEFAULT_MAX_MESSAGE_SIZE } = options;\n\n const argBudget = maxMessageSize - codeByteSize - METADATA_OVERHEAD;\n if (argBudget <= 0) {\n throw new Error(\n `Code size (${codeByteSize} bytes) exceeds the message size limit (${maxMessageSize} bytes). ` +\n `No space left for seed data.`,\n );\n }\n\n // Filter to types that have data\n const typesWithData = order.filter((type) => data[type] && data[type].length > 0);\n\n if (typesWithData.length === 0) {\n return [];\n }\n\n // Check if all data fits in a single message\n const fullArg = JSON.stringify({ data, order });\n if (byteSize(fullArg) <= argBudget) {\n return [{ data, order, index: 0, total: 1 }];\n }\n\n // Split into multiple chunks\n const chunks: Omit<SeedChunk, \"total\">[] = [];\n let currentData: SeedData = {};\n let currentOrder: string[] = [];\n\n for (const type of typesWithData) {\n const typeRecords = data[type];\n\n // Check if the type fits in the current chunk\n if (currentOrder.length > 0) {\n const testData = { ...currentData, [type]: typeRecords };\n const testOrder = [...currentOrder, type];\n if (byteSize(JSON.stringify({ data: testData, order: testOrder })) > argBudget) {\n // Finalize the current chunk\n chunks.push({ data: currentData, order: currentOrder, index: chunks.length });\n currentData = {};\n currentOrder = [];\n }\n }\n\n // Check if the entire type fits in an empty chunk\n if (byteSize(JSON.stringify({ data: { [type]: typeRecords }, order: [type] })) <= argBudget) {\n currentData[type] = typeRecords;\n currentOrder.push(type);\n continue;\n }\n\n // Type is too large — split by records\n if (currentOrder.length > 0) {\n chunks.push({ data: currentData, order: currentOrder, index: chunks.length });\n currentData = {};\n currentOrder = [];\n }\n\n let recordBatch: Record<string, unknown>[] = [];\n for (const record of typeRecords) {\n if (byteSize(JSON.stringify({ data: { [type]: [record] }, order: [type] })) > argBudget) {\n const singleRecordSize = byteSize(JSON.stringify(record));\n throw new Error(\n `A single record in type \"${type}\" (${singleRecordSize} bytes) exceeds the message size budget ` +\n `(${argBudget} bytes). Consider increasing maxMessageSize or reducing the record size.`,\n );\n }\n\n const testBatch = [...recordBatch, record];\n const testData = { ...currentData, [type]: testBatch };\n const testOrder = currentOrder.includes(type) ? currentOrder : [...currentOrder, type];\n const testSize = byteSize(JSON.stringify({ data: testData, order: testOrder }));\n\n if (testSize > argBudget && recordBatch.length > 0) {\n // Finalize current chunk with accumulated records\n currentData[type] = recordBatch;\n if (!currentOrder.includes(type)) {\n currentOrder.push(type);\n }\n chunks.push({ data: currentData, order: currentOrder, index: chunks.length });\n currentData = {};\n currentOrder = [];\n recordBatch = [record];\n } else {\n recordBatch = testBatch;\n }\n }\n\n // Add remaining records\n if (recordBatch.length > 0) {\n currentData[type] = recordBatch;\n if (!currentOrder.includes(type)) {\n currentOrder.push(type);\n }\n }\n }\n\n // Finalize the last chunk\n if (currentOrder.length > 0) {\n chunks.push({ data: currentData, order: currentOrder, index: chunks.length });\n }\n\n const total = chunks.length;\n return chunks.map((chunk) => ({ ...chunk, total }));\n}\n\nfunction byteSize(str: string): number {\n return new TextEncoder().encode(str).length;\n}\n","/**\n * Seed script bundler for TailorDB seed data\n *\n * Bundles seed scripts to be executed via TestExecScript API\n */\n\nimport * as fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport ml from \"multiline-ts\";\nimport * as path from \"pathe\";\nimport { resolveTSConfig } from \"pkg-types\";\nimport * as rolldown from \"rolldown\";\nimport { getDistDir } from \"@/cli/utils/dist-dir\";\nimport { logger } from \"@/cli/utils/logger\";\n\nexport type SeedBundleResult = {\n namespace: string;\n bundledCode: string;\n typesIncluded: string[];\n};\n\nconst REQUIRED_PACKAGES = [\"kysely\", \"@tailor-platform/function-kysely-tailordb\"] as const;\n\nlet dependencyCheckDone = false;\n\n/**\n * Check if required packages for seed bundling are installed.\n * Logs a warning if any are missing.\n */\nfunction checkSeedDependencies(): void {\n if (dependencyCheckDone) return;\n dependencyCheckDone = true;\n\n const require = createRequire(path.resolve(process.cwd(), \"package.json\"));\n const missing: string[] = [];\n\n for (const pkg of REQUIRED_PACKAGES) {\n try {\n require.resolve(pkg);\n } catch {\n missing.push(pkg);\n }\n }\n\n if (missing.length > 0) {\n logger.warn(\n `Missing optional dependencies for seed bundling: ${missing.join(\", \")}. ` +\n `Install them in your project: pnpm add -D ${missing.join(\" \")}`,\n );\n }\n}\n\nconst BATCH_SIZE = 100;\n\n/**\n * Generate seed script content for server-side execution\n * @param namespace - TailorDB namespace\n * @returns Generated seed script content\n */\nfunction generateSeedScriptContent(namespace: string): string {\n return ml /* ts */ `\n import { Kysely } from \"kysely\";\n import { TailordbDialect } from \"@tailor-platform/function-kysely-tailordb\";\n\n type SeedInput = {\n data: Record<string, Record<string, unknown>[]>;\n order: string[];\n };\n\n type SeedResult = {\n success: boolean;\n processed: Record<string, number>;\n errors: string[];\n };\n\n function getDB(namespace: string) {\n const client = new tailordb.Client({ namespace });\n return new Kysely<Record<string, Record<string, unknown>>>({\n dialect: new TailordbDialect(client),\n });\n }\n\n export async function main(input: SeedInput): Promise<SeedResult> {\n const db = getDB(\"${namespace}\");\n const processed: Record<string, number> = {};\n const errors: string[] = [];\n const BATCH_SIZE = ${String(BATCH_SIZE)};\n\n for (const typeName of input.order) {\n const records = input.data[typeName];\n if (!records || records.length === 0) {\n console.log(\\`[${namespace}] \\${typeName}: skipped (no data)\\`);\n continue;\n }\n\n processed[typeName] = 0;\n\n try {\n for (let i = 0; i < records.length; i += BATCH_SIZE) {\n const batch = records.slice(i, i + BATCH_SIZE);\n await db.insertInto(typeName).values(batch).execute();\n processed[typeName] += batch.length;\n console.log(\\`[${namespace}] \\${typeName}: \\${processed[typeName]}/\\${records.length}\\`);\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n errors.push(\\`\\${typeName}: \\${message}\\`);\n console.error(\\`[${namespace}] \\${typeName}: failed - \\${message}\\`);\n }\n }\n\n return {\n success: errors.length === 0,\n processed,\n errors,\n };\n }\n `;\n}\n\n/**\n * Bundle a seed script for server-side execution\n *\n * Creates an entry that:\n * 1. Defines getDB() function inline\n * 2. Processes data in batches using Kysely\n * 3. Reports progress via console.log\n * 4. Exports as main() for TestExecScript\n * @param namespace - TailorDB namespace\n * @param typeNames - List of type names to include in the seed\n * @returns Bundled seed script result\n */\nexport async function bundleSeedScript(\n namespace: string,\n typeNames: string[],\n): Promise<SeedBundleResult> {\n // Check for required dependencies (only once per session)\n checkSeedDependencies();\n\n // Output directory in .tailor-sdk (relative to project root)\n const outputDir = path.resolve(getDistDir(), \"seed\");\n fs.mkdirSync(outputDir, { recursive: true });\n\n // Entry file in output directory\n const entryPath = path.join(outputDir, `seed_${namespace}.entry.ts`);\n const outputPath = path.join(outputDir, `seed_${namespace}.js`);\n\n // Generate seed script content\n const entryContent = generateSeedScriptContent(namespace);\n fs.writeFileSync(entryPath, entryContent);\n\n let tsconfig: string | undefined;\n try {\n tsconfig = await resolveTSConfig();\n } catch {\n tsconfig = undefined;\n }\n\n // Bundle with tree-shaking\n await rolldown.build(\n rolldown.defineConfig({\n input: entryPath,\n output: {\n file: outputPath,\n format: \"esm\",\n sourcemap: false,\n minify: false,\n inlineDynamicImports: true,\n globals: {\n tailordb: \"tailordb\",\n },\n },\n external: [\"tailordb\"],\n resolve: {\n conditionNames: [\"node\", \"import\"],\n },\n tsconfig,\n treeshake: {\n moduleSideEffects: false,\n annotations: true,\n unknownGlobalSideEffects: false,\n },\n logLevel: \"silent\",\n }) as rolldown.BuildOptions,\n );\n\n // Read bundled output\n const bundledCode = fs.readFileSync(outputPath, \"utf-8\");\n\n return {\n namespace,\n bundledCode,\n typesIncluded: typeNames,\n };\n}\n","// CLI API exports for programmatic usage\nimport { register } from \"node:module\";\n\n// Register tsx to handle TypeScript files when using CLI API programmatically\nregister(\"tsx\", import.meta.url, { data: {} });\n\nexport { apply } from \"./apply/index\";\nexport type { ApplyOptions } from \"./apply/index\";\nexport { generate } from \"./generator/index\";\nexport type { GenerateOptions } from \"./generator/options\";\nexport { loadConfig, type LoadedConfig } from \"./config-loader\";\nexport { generateUserTypes } from \"./type-generator\";\nexport type {\n CodeGenerator,\n TailorDBGenerator,\n ResolverGenerator,\n ExecutorGenerator,\n TailorDBResolverGenerator,\n FullCodeGenerator,\n TailorDBInput,\n ResolverInput,\n ExecutorInput,\n FullInput,\n AggregateArgs,\n GeneratorResult,\n DependencyKind,\n PluginAttachment,\n TypeSourceInfoEntry,\n} from \"./generator/types\";\nexport type { TailorDBType } from \"@/parser/service/tailordb/types\";\nexport type { Resolver } from \"@/parser/service/resolver\";\nexport type { Executor } from \"@/parser/service/executor\";\n\n/** @deprecated Import from '@tailor-platform/sdk/plugin/kysely-type' instead */\nexport { kyselyTypePlugin } from \"@/plugin/builtin/kysely-type\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/enum-constants' instead */\nexport { enumConstantsPlugin } from \"@/plugin/builtin/enum-constants\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/file-utils' instead */\nexport { fileUtilsPlugin } from \"@/plugin/builtin/file-utils\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/seed' instead */\nexport { seedPlugin } from \"@/plugin/builtin/seed\";\n\nexport { show, type ShowOptions, type ApplicationInfo } from \"./show\";\nexport { remove, type RemoveOptions } from \"./remove\";\nexport { createWorkspace, type CreateWorkspaceOptions } from \"./workspace/create\";\nexport { listWorkspaces, type ListWorkspacesOptions } from \"./workspace/list\";\nexport { deleteWorkspace, type DeleteWorkspaceOptions } from \"./workspace/delete\";\nexport { getWorkspace, type GetWorkspaceOptions } from \"./workspace/get\";\nexport { restoreWorkspace, type RestoreWorkspaceOptions } from \"./workspace/restore\";\nexport type { WorkspaceInfo, WorkspaceDetails } from \"./workspace/transform\";\nexport { listUsers, type ListUsersOptions } from \"./workspace/user/list\";\nexport { inviteUser, type InviteUserOptions } from \"./workspace/user/invite\";\nexport { updateUser, type UpdateUserOptions } from \"./workspace/user/update\";\nexport { removeUser, type RemoveUserOptions } from \"./workspace/user/remove\";\nexport type { UserInfo } from \"./workspace/user/transform\";\nexport { listApps, type ListAppsOptions } from \"./workspace/app/list\";\nexport { getAppHealth, type HealthOptions as GetAppHealthOptions } from \"./workspace/app/health\";\nexport type { AppInfo, AppHealthInfo } from \"./workspace/app/transform\";\nexport {\n listMachineUsers,\n type ListMachineUsersOptions,\n type MachineUserInfo,\n} from \"./machineuser/list\";\nexport {\n getMachineUserToken,\n type GetMachineUserTokenOptions,\n type MachineUserTokenInfo,\n} from \"./machineuser/token\";\nexport { getOAuth2Client, type GetOAuth2ClientOptions } from \"./oauth2client/get\";\nexport { listOAuth2Clients, type ListOAuth2ClientsOptions } from \"./oauth2client/list\";\nexport type { OAuth2ClientInfo, OAuth2ClientCredentials } from \"./oauth2client/transform\";\nexport { listWorkflows, type ListWorkflowsOptions } from \"./workflow/list\";\nexport { getWorkflow, type GetWorkflowOptions, type GetWorkflowTypedOptions } from \"./workflow/get\";\nexport {\n startWorkflow,\n type StartWorkflowOptions,\n type StartWorkflowTypedOptions,\n type StartWorkflowResultWithWait,\n type WaitOptions,\n} from \"./workflow/start\";\nexport {\n listWorkflowExecutions,\n getWorkflowExecution,\n type ListWorkflowExecutionsOptions,\n type ListWorkflowExecutionsTypedOptions,\n type GetWorkflowExecutionOptions,\n type GetWorkflowExecutionResult,\n} from \"./workflow/executions\";\nexport {\n resumeWorkflow,\n type ResumeWorkflowOptions,\n type ResumeWorkflowResultWithWait,\n} from \"./workflow/resume\";\nexport type {\n WorkflowListInfo,\n WorkflowInfo,\n WorkflowExecutionInfo,\n WorkflowJobExecutionInfo,\n} from \"./workflow/transform\";\nexport {\n triggerExecutor,\n type TriggerExecutorOptions,\n type TriggerExecutorTypedOptions,\n type TriggerExecutorResult,\n} from \"./executor/trigger\";\nexport {\n listExecutorJobs,\n getExecutorJob,\n watchExecutorJob,\n type ListExecutorJobsOptions,\n type ListExecutorJobsTypedOptions,\n type GetExecutorJobOptions,\n type GetExecutorJobTypedOptions,\n type WatchExecutorJobOptions,\n type WatchExecutorJobTypedOptions,\n type ExecutorJobDetailInfo,\n type WatchExecutorJobResult,\n} from \"./executor/jobs\";\nexport { listExecutors, type ListExecutorsOptions } from \"./executor/list\";\nexport { getExecutor, type GetExecutorOptions, type GetExecutorTypedOptions } from \"./executor/get\";\nexport {\n listWebhookExecutors,\n type ListWebhookExecutorsOptions,\n type WebhookExecutorInfo,\n} from \"./executor/webhook\";\nexport type {\n ExecutorJobListInfo,\n ExecutorJobInfo,\n ExecutorJobAttemptInfo,\n ExecutorListInfo,\n ExecutorInfo,\n} from \"./executor/transform\";\nexport { loadAccessToken, loadWorkspaceId } from \"./context\";\nexport { apiCall, type ApiCallOptions, type ApiCallResult } from \"./api\";\nexport { truncate, type TruncateOptions } from \"./tailordb/truncate\";\n\n// Migration exports\nexport {\n generate as migrateGenerate,\n type GenerateOptions as MigrateGenerateOptions,\n} from \"./tailordb/migrate/generate\";\nexport {\n createSnapshotFromLocalTypes,\n reconstructSnapshotFromMigrations,\n compareSnapshots,\n getNextMigrationNumber,\n getLatestMigrationNumber,\n getMigrationFiles,\n compareLocalTypesWithSnapshot,\n} from \"./tailordb/migrate/snapshot\";\nexport {\n getNamespacesWithMigrations,\n type NamespaceWithMigrations,\n} from \"./tailordb/migrate/config\";\nexport {\n hasChanges,\n formatMigrationDiff,\n formatDiffSummary,\n type MigrationDiff,\n type BreakingChangeInfo,\n} from \"./tailordb/migrate/diff-calculator\";\nexport {\n SCHEMA_FILE_NAME,\n DIFF_FILE_NAME,\n MIGRATE_FILE_NAME,\n DB_TYPES_FILE_NAME,\n INITIAL_SCHEMA_NUMBER,\n getMigrationDirPath,\n getMigrationFilePath,\n type SchemaSnapshot,\n type SnapshotType,\n type SnapshotFieldConfig,\n type MigrationInfo,\n} from \"./tailordb/migrate/snapshot\";\nexport { MIGRATION_LABEL_KEY } from \"./tailordb/migrate/types\";\n\n// Seed exports\nexport { chunkSeedData, type SeedChunk, type ChunkSeedDataOptions } from \"./utils/seed-chunker\";\nexport { bundleSeedScript, type SeedBundleResult } from \"./bundler/seed/seed-bundler\";\nexport {\n bundleMigrationScript,\n type MigrationBundleResult,\n} from \"./bundler/migration/migration-bundler\";\nexport {\n executeScript,\n waitForExecution,\n type ScriptExecutionOptions,\n type ScriptExecutionResult,\n type ExecutionWaitResult,\n} from \"./utils/script-executor\";\nexport { initOperatorClient, type OperatorClient } from \"./client\";\nexport type { AuthInvoker } from \"@tailor-proto/tailor/v1/auth_resource_pb\";\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"lib.mjs","names":["fs"],"sources":["../../src/cli/shared/seed-chunker.ts","../../src/cli/commands/generate/seed/bundler.ts","../../src/cli/lib.ts"],"sourcesContent":["/**\n * Seed data chunker for splitting large seed data into manageable message sizes.\n *\n * When seed data exceeds the gRPC message size limit, this module splits the data\n * into multiple chunks at type boundaries (or record boundaries for large types).\n */\n\n/**\n * Seed data keyed by type name, with an array of records per type.\n */\nexport type SeedData = Record<string, Record<string, unknown>[]>;\n\n/**\n * A single chunk of seed data with metadata for ordered execution.\n */\nexport type SeedChunk = {\n data: SeedData;\n order: string[];\n index: number;\n total: number;\n};\n\n/**\n * Options for chunking seed data.\n */\nexport type ChunkSeedDataOptions = {\n /** Seed data keyed by type name */\n data: SeedData;\n /** Ordered list of type names (dependency order) */\n order: string[];\n /** Byte size of the bundled seed script code */\n codeByteSize: number;\n /** Maximum gRPC message size in bytes (default: 3.5MB) */\n maxMessageSize?: number;\n};\n\n/** Default maximum message size: 3.5MB (conservative limit for gRPC) */\nexport const DEFAULT_MAX_MESSAGE_SIZE = 3.5 * 1024 * 1024;\n\n/** Reserved bytes for message metadata overhead */\nconst METADATA_OVERHEAD = 1024;\n\n/**\n * Split seed data into chunks that fit within the gRPC message size limit.\n *\n * Algorithm:\n * 1. Calculate the available budget for the arg field (maxMessageSize - codeByteSize - overhead)\n * 2. If all data fits in one message, return a single chunk\n * 3. Otherwise, iterate through types in dependency order:\n * - If a type fits in the current chunk, add it\n * - If adding a type would exceed the budget, finalize the current chunk and start a new one\n * - If a single type exceeds the budget, split its records across multiple chunks\n * - If a single record exceeds the budget, throw an error\n * @param options - Chunking options\n * @returns Array of seed chunks\n */\nexport function chunkSeedData(options: ChunkSeedDataOptions): SeedChunk[] {\n const { data, order, codeByteSize, maxMessageSize = DEFAULT_MAX_MESSAGE_SIZE } = options;\n\n const argBudget = maxMessageSize - codeByteSize - METADATA_OVERHEAD;\n if (argBudget <= 0) {\n throw new Error(\n `Code size (${codeByteSize} bytes) exceeds the message size limit (${maxMessageSize} bytes). ` +\n `No space left for seed data.`,\n );\n }\n\n // Filter to types that have data\n const typesWithData = order.filter((type) => data[type] && data[type].length > 0);\n\n if (typesWithData.length === 0) {\n return [];\n }\n\n // Check if all data fits in a single message\n const fullArg = JSON.stringify({ data, order });\n if (byteSize(fullArg) <= argBudget) {\n return [{ data, order, index: 0, total: 1 }];\n }\n\n // Split into multiple chunks\n const chunks: Omit<SeedChunk, \"total\">[] = [];\n let currentData: SeedData = {};\n let currentOrder: string[] = [];\n\n for (const type of typesWithData) {\n const typeRecords = data[type];\n\n // Check if the type fits in the current chunk\n if (currentOrder.length > 0) {\n const testData = { ...currentData, [type]: typeRecords };\n const testOrder = [...currentOrder, type];\n if (byteSize(JSON.stringify({ data: testData, order: testOrder })) > argBudget) {\n // Finalize the current chunk\n chunks.push({ data: currentData, order: currentOrder, index: chunks.length });\n currentData = {};\n currentOrder = [];\n }\n }\n\n // Check if the entire type fits in an empty chunk\n if (byteSize(JSON.stringify({ data: { [type]: typeRecords }, order: [type] })) <= argBudget) {\n currentData[type] = typeRecords;\n currentOrder.push(type);\n continue;\n }\n\n // Type is too large — split by records\n if (currentOrder.length > 0) {\n chunks.push({ data: currentData, order: currentOrder, index: chunks.length });\n currentData = {};\n currentOrder = [];\n }\n\n let recordBatch: Record<string, unknown>[] = [];\n for (const record of typeRecords) {\n if (byteSize(JSON.stringify({ data: { [type]: [record] }, order: [type] })) > argBudget) {\n const singleRecordSize = byteSize(JSON.stringify(record));\n throw new Error(\n `A single record in type \"${type}\" (${singleRecordSize} bytes) exceeds the message size budget ` +\n `(${argBudget} bytes). Consider increasing maxMessageSize or reducing the record size.`,\n );\n }\n\n const testBatch = [...recordBatch, record];\n const testData = { ...currentData, [type]: testBatch };\n const testOrder = currentOrder.includes(type) ? currentOrder : [...currentOrder, type];\n const testSize = byteSize(JSON.stringify({ data: testData, order: testOrder }));\n\n if (testSize > argBudget && recordBatch.length > 0) {\n // Finalize current chunk with accumulated records\n currentData[type] = recordBatch;\n if (!currentOrder.includes(type)) {\n currentOrder.push(type);\n }\n chunks.push({ data: currentData, order: currentOrder, index: chunks.length });\n currentData = {};\n currentOrder = [];\n recordBatch = [record];\n } else {\n recordBatch = testBatch;\n }\n }\n\n // Add remaining records\n if (recordBatch.length > 0) {\n currentData[type] = recordBatch;\n if (!currentOrder.includes(type)) {\n currentOrder.push(type);\n }\n }\n }\n\n // Finalize the last chunk\n if (currentOrder.length > 0) {\n chunks.push({ data: currentData, order: currentOrder, index: chunks.length });\n }\n\n const total = chunks.length;\n return chunks.map((chunk) => ({ ...chunk, total }));\n}\n\nfunction byteSize(str: string): number {\n return new TextEncoder().encode(str).length;\n}\n","/**\n * Seed script bundler for TailorDB seed data\n *\n * Bundles seed scripts to be executed via TestExecScript API\n */\n\nimport * as fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport ml from \"multiline-ts\";\nimport * as path from \"pathe\";\nimport { resolveTSConfig } from \"pkg-types\";\nimport * as rolldown from \"rolldown\";\nimport { getDistDir } from \"@/cli/shared/dist-dir\";\nimport { logger } from \"@/cli/shared/logger\";\n\nexport type SeedBundleResult = {\n namespace: string;\n bundledCode: string;\n typesIncluded: string[];\n};\n\nconst REQUIRED_PACKAGES = [\"kysely\", \"@tailor-platform/function-kysely-tailordb\"] as const;\n\nlet dependencyCheckDone = false;\n\n/**\n * Check if required packages for seed bundling are installed.\n * Logs a warning if any are missing.\n */\nfunction checkSeedDependencies(): void {\n if (dependencyCheckDone) return;\n dependencyCheckDone = true;\n\n const require = createRequire(path.resolve(process.cwd(), \"package.json\"));\n const missing: string[] = [];\n\n for (const pkg of REQUIRED_PACKAGES) {\n try {\n require.resolve(pkg);\n } catch {\n missing.push(pkg);\n }\n }\n\n if (missing.length > 0) {\n logger.warn(\n `Missing optional dependencies for seed bundling: ${missing.join(\", \")}. ` +\n `Install them in your project: pnpm add -D ${missing.join(\" \")}`,\n );\n }\n}\n\nconst BATCH_SIZE = 100;\n\n/**\n * Generate seed script content for server-side execution\n * @param namespace - TailorDB namespace\n * @returns Generated seed script content\n */\nfunction generateSeedScriptContent(namespace: string): string {\n return ml /* ts */ `\n import { Kysely } from \"kysely\";\n import { TailordbDialect } from \"@tailor-platform/function-kysely-tailordb\";\n\n type SeedInput = {\n data: Record<string, Record<string, unknown>[]>;\n order: string[];\n };\n\n type SeedResult = {\n success: boolean;\n processed: Record<string, number>;\n errors: string[];\n };\n\n function getDB(namespace: string) {\n const client = new tailordb.Client({ namespace });\n return new Kysely<Record<string, Record<string, unknown>>>({\n dialect: new TailordbDialect(client),\n });\n }\n\n export async function main(input: SeedInput): Promise<SeedResult> {\n const db = getDB(\"${namespace}\");\n const processed: Record<string, number> = {};\n const errors: string[] = [];\n const BATCH_SIZE = ${String(BATCH_SIZE)};\n\n for (const typeName of input.order) {\n const records = input.data[typeName];\n if (!records || records.length === 0) {\n console.log(\\`[${namespace}] \\${typeName}: skipped (no data)\\`);\n continue;\n }\n\n processed[typeName] = 0;\n\n try {\n for (let i = 0; i < records.length; i += BATCH_SIZE) {\n const batch = records.slice(i, i + BATCH_SIZE);\n await db.insertInto(typeName).values(batch).execute();\n processed[typeName] += batch.length;\n console.log(\\`[${namespace}] \\${typeName}: \\${processed[typeName]}/\\${records.length}\\`);\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n errors.push(\\`\\${typeName}: \\${message}\\`);\n console.error(\\`[${namespace}] \\${typeName}: failed - \\${message}\\`);\n }\n }\n\n return {\n success: errors.length === 0,\n processed,\n errors,\n };\n }\n `;\n}\n\n/**\n * Bundle a seed script for server-side execution\n *\n * Creates an entry that:\n * 1. Defines getDB() function inline\n * 2. Processes data in batches using Kysely\n * 3. Reports progress via console.log\n * 4. Exports as main() for TestExecScript\n * @param namespace - TailorDB namespace\n * @param typeNames - List of type names to include in the seed\n * @returns Bundled seed script result\n */\nexport async function bundleSeedScript(\n namespace: string,\n typeNames: string[],\n): Promise<SeedBundleResult> {\n // Check for required dependencies (only once per session)\n checkSeedDependencies();\n\n // Output directory in .tailor-sdk (relative to project root)\n const outputDir = path.resolve(getDistDir(), \"seed\");\n fs.mkdirSync(outputDir, { recursive: true });\n\n // Entry file in output directory\n const entryPath = path.join(outputDir, `seed_${namespace}.entry.ts`);\n const outputPath = path.join(outputDir, `seed_${namespace}.js`);\n\n // Generate seed script content\n const entryContent = generateSeedScriptContent(namespace);\n fs.writeFileSync(entryPath, entryContent);\n\n let tsconfig: string | undefined;\n try {\n tsconfig = await resolveTSConfig();\n } catch {\n tsconfig = undefined;\n }\n\n // Bundle with tree-shaking\n await rolldown.build(\n rolldown.defineConfig({\n input: entryPath,\n output: {\n file: outputPath,\n format: \"esm\",\n sourcemap: false,\n minify: false,\n inlineDynamicImports: true,\n globals: {\n tailordb: \"tailordb\",\n },\n },\n external: [\"tailordb\"],\n resolve: {\n conditionNames: [\"node\", \"import\"],\n },\n tsconfig,\n treeshake: {\n moduleSideEffects: false,\n annotations: true,\n unknownGlobalSideEffects: false,\n },\n logLevel: \"silent\",\n }) as rolldown.BuildOptions,\n );\n\n // Read bundled output\n const bundledCode = fs.readFileSync(outputPath, \"utf-8\");\n\n return {\n namespace,\n bundledCode,\n typesIncluded: typeNames,\n };\n}\n","// CLI API exports for programmatic usage\nimport { register } from \"node:module\";\n\n// Register tsx to handle TypeScript files when using CLI API programmatically\nregister(\"tsx\", import.meta.url, { data: {} });\n\nexport { apply } from \"./commands/apply/apply\";\nexport type { ApplyOptions } from \"./commands/apply/apply\";\nexport { generate } from \"./commands/generate/service\";\nexport type { GenerateOptions } from \"./commands/generate/options\";\nexport { loadConfig, type LoadedConfig } from \"./shared/config-loader\";\nexport { generateUserTypes } from \"./shared/type-generator\";\nexport type {\n CodeGenerator,\n TailorDBGenerator,\n ResolverGenerator,\n ExecutorGenerator,\n TailorDBResolverGenerator,\n FullCodeGenerator,\n TailorDBInput,\n ResolverInput,\n ExecutorInput,\n FullInput,\n AggregateArgs,\n GeneratorResult,\n DependencyKind,\n PluginAttachment,\n TypeSourceInfoEntry,\n} from \"./commands/generate/types\";\nexport type { TailorDBType } from \"@/parser/service/tailordb/types\";\nexport type { Resolver } from \"@/parser/service/resolver\";\nexport type { Executor } from \"@/parser/service/executor\";\n\n/** @deprecated Import from '@tailor-platform/sdk/plugin/kysely-type' instead */\nexport { kyselyTypePlugin } from \"@/plugin/builtin/kysely-type\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/enum-constants' instead */\nexport { enumConstantsPlugin } from \"@/plugin/builtin/enum-constants\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/file-utils' instead */\nexport { fileUtilsPlugin } from \"@/plugin/builtin/file-utils\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/seed' instead */\nexport { seedPlugin } from \"@/plugin/builtin/seed\";\n\nexport { show, type ShowOptions, type ApplicationInfo } from \"./commands/show\";\nexport { remove, type RemoveOptions } from \"./commands/remove\";\nexport { createWorkspace, type CreateWorkspaceOptions } from \"./commands/workspace/create\";\nexport { listWorkspaces, type ListWorkspacesOptions } from \"./commands/workspace/list\";\nexport { deleteWorkspace, type DeleteWorkspaceOptions } from \"./commands/workspace/delete\";\nexport { getWorkspace, type GetWorkspaceOptions } from \"./commands/workspace/get\";\nexport { restoreWorkspace, type RestoreWorkspaceOptions } from \"./commands/workspace/restore\";\nexport type { WorkspaceInfo, WorkspaceDetails } from \"./commands/workspace/transform\";\nexport { listUsers, type ListUsersOptions } from \"./commands/workspace/user/list\";\nexport { inviteUser, type InviteUserOptions } from \"./commands/workspace/user/invite\";\nexport { updateUser, type UpdateUserOptions } from \"./commands/workspace/user/update\";\nexport { removeUser, type RemoveUserOptions } from \"./commands/workspace/user/remove\";\nexport type { UserInfo } from \"./commands/workspace/user/transform\";\nexport { listApps, type ListAppsOptions } from \"./commands/workspace/app/list\";\nexport {\n getAppHealth,\n type HealthOptions as GetAppHealthOptions,\n} from \"./commands/workspace/app/health\";\nexport type { AppInfo, AppHealthInfo } from \"./commands/workspace/app/transform\";\nexport {\n listMachineUsers,\n type ListMachineUsersOptions,\n type MachineUserInfo,\n} from \"./commands/machineuser/list\";\nexport {\n getMachineUserToken,\n type GetMachineUserTokenOptions,\n type MachineUserTokenInfo,\n} from \"./commands/machineuser/token\";\nexport { getOAuth2Client, type GetOAuth2ClientOptions } from \"./commands/oauth2client/get\";\nexport { listOAuth2Clients, type ListOAuth2ClientsOptions } from \"./commands/oauth2client/list\";\nexport type { OAuth2ClientInfo, OAuth2ClientCredentials } from \"./commands/oauth2client/transform\";\nexport { listWorkflows, type ListWorkflowsOptions } from \"./commands/workflow/list\";\nexport {\n getWorkflow,\n type GetWorkflowOptions,\n type GetWorkflowTypedOptions,\n} from \"./commands/workflow/get\";\nexport {\n startWorkflow,\n type StartWorkflowOptions,\n type StartWorkflowTypedOptions,\n type StartWorkflowResultWithWait,\n type WaitOptions,\n} from \"./commands/workflow/start\";\nexport {\n listWorkflowExecutions,\n getWorkflowExecution,\n type ListWorkflowExecutionsOptions,\n type ListWorkflowExecutionsTypedOptions,\n type GetWorkflowExecutionOptions,\n type GetWorkflowExecutionResult,\n} from \"./commands/workflow/executions\";\nexport {\n resumeWorkflow,\n type ResumeWorkflowOptions,\n type ResumeWorkflowResultWithWait,\n} from \"./commands/workflow/resume\";\nexport type {\n WorkflowListInfo,\n WorkflowInfo,\n WorkflowExecutionInfo,\n WorkflowJobExecutionInfo,\n} from \"./commands/workflow/transform\";\nexport {\n triggerExecutor,\n type TriggerExecutorOptions,\n type TriggerExecutorTypedOptions,\n type TriggerExecutorResult,\n} from \"./commands/executor/trigger\";\nexport {\n listExecutorJobs,\n getExecutorJob,\n watchExecutorJob,\n type ListExecutorJobsOptions,\n type ListExecutorJobsTypedOptions,\n type GetExecutorJobOptions,\n type GetExecutorJobTypedOptions,\n type WatchExecutorJobOptions,\n type WatchExecutorJobTypedOptions,\n type ExecutorJobDetailInfo,\n type WatchExecutorJobResult,\n} from \"./commands/executor/jobs\";\nexport { listExecutors, type ListExecutorsOptions } from \"./commands/executor/list\";\nexport {\n getExecutor,\n type GetExecutorOptions,\n type GetExecutorTypedOptions,\n} from \"./commands/executor/get\";\nexport {\n listWebhookExecutors,\n type ListWebhookExecutorsOptions,\n type WebhookExecutorInfo,\n} from \"./commands/executor/webhook\";\nexport type {\n ExecutorJobListInfo,\n ExecutorJobInfo,\n ExecutorJobAttemptInfo,\n ExecutorListInfo,\n ExecutorInfo,\n} from \"./commands/executor/transform\";\nexport { loadAccessToken, loadWorkspaceId } from \"./shared/context\";\nexport { apiCall, type ApiCallOptions, type ApiCallResult } from \"./commands/api\";\nexport { truncate, type TruncateOptions } from \"./commands/tailordb/truncate\";\n\n// Migration exports\nexport {\n generate as migrateGenerate,\n type GenerateOptions as MigrateGenerateOptions,\n} from \"./commands/tailordb/migrate/generate\";\nexport {\n createSnapshotFromLocalTypes,\n reconstructSnapshotFromMigrations,\n compareSnapshots,\n getNextMigrationNumber,\n getLatestMigrationNumber,\n getMigrationFiles,\n compareLocalTypesWithSnapshot,\n} from \"./commands/tailordb/migrate/snapshot\";\nexport {\n getNamespacesWithMigrations,\n type NamespaceWithMigrations,\n} from \"./commands/tailordb/migrate/config\";\nexport {\n hasChanges,\n formatMigrationDiff,\n formatDiffSummary,\n type MigrationDiff,\n type BreakingChangeInfo,\n} from \"./commands/tailordb/migrate/diff-calculator\";\nexport {\n SCHEMA_FILE_NAME,\n DIFF_FILE_NAME,\n MIGRATE_FILE_NAME,\n DB_TYPES_FILE_NAME,\n INITIAL_SCHEMA_NUMBER,\n getMigrationDirPath,\n getMigrationFilePath,\n type SchemaSnapshot,\n type SnapshotType,\n type SnapshotFieldConfig,\n type MigrationInfo,\n} from \"./commands/tailordb/migrate/snapshot\";\nexport { MIGRATION_LABEL_KEY } from \"./commands/tailordb/migrate/types\";\n\n// Seed exports\nexport { chunkSeedData, type SeedChunk, type ChunkSeedDataOptions } from \"./shared/seed-chunker\";\nexport { bundleSeedScript, type SeedBundleResult } from \"./commands/generate/seed/bundler\";\nexport {\n bundleMigrationScript,\n type MigrationBundleResult,\n} from \"./commands/tailordb/migrate/bundler\";\nexport {\n executeScript,\n waitForExecution,\n type ScriptExecutionOptions,\n type ScriptExecutionResult,\n type ExecutionWaitResult,\n} from \"./shared/script-executor\";\nexport { initOperatorClient, type OperatorClient } from \"./shared/client\";\nexport type { AuthInvoker } from \"@tailor-proto/tailor/v1/auth_resource_pb\";\n"],"mappings":"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"}
|
package/dist/cli/skills.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
3
|
|
|
4
|
-
//#region src/cli/skills-installer.ts
|
|
4
|
+
//#region src/cli/shared/skills-installer.ts
|
|
5
5
|
const SKILL_NAME = "tailor-sdk";
|
|
6
6
|
const DEFAULT_SKILLS_SOURCE = "https://github.com/tailor-platform/sdk/tree/main/packages/sdk/skills";
|
|
7
7
|
const SKILLS_SOURCE_ENV_KEY = "TAILOR_SDK_SKILLS_SOURCE";
|
package/dist/cli/skills.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.mjs","names":[],"sources":["../../src/cli/skills-installer.ts","../../src/cli/skills.ts"],"sourcesContent":["import { spawn } from \"node:child_process\";\n\nexport const SKILL_NAME = \"tailor-sdk\";\nexport const DEFAULT_SKILLS_SOURCE =\n \"https://github.com/tailor-platform/sdk/tree/main/packages/sdk/skills\";\nconst SKILLS_SOURCE_ENV_KEY = \"TAILOR_SDK_SKILLS_SOURCE\";\n\ninterface ChildProcessLike {\n on(event: \"close\", listener: (code: number | null) => void): ChildProcessLike;\n on(event: \"error\", listener: (error: Error) => void): ChildProcessLike;\n}\n\ntype SpawnLike = (\n command: string,\n args: string[],\n options: { stdio: \"inherit\" },\n) => ChildProcessLike;\n\ninterface RunSkillsInstallerOptions {\n additionalArgs?: string[];\n source?: string;\n spawnFn?: SpawnLike;\n}\n\nfunction resolveNpxCommand(platform: NodeJS.Platform = process.platform): string {\n return platform === \"win32\" ? \"npx.cmd\" : \"npx\";\n}\n\nfunction resolveSkillsSource(source?: string): string {\n return source ?? process.env[SKILLS_SOURCE_ENV_KEY] ?? DEFAULT_SKILLS_SOURCE;\n}\n\n/**\n * Build CLI arguments for `skills add` with the fixed tailor-sdk skill target.\n * @param additionalArgs - Additional options to pass through to `skills add`\n * @param source - Optional skill source URL or path\n * @returns CLI arguments for `npx skills add`\n */\nexport function buildSkillsAddArgs(additionalArgs: readonly string[], source?: string): string[] {\n return [\"skills\", \"add\", resolveSkillsSource(source), \"--skill\", SKILL_NAME, ...additionalArgs];\n}\n\n/**\n * Run `npx skills add` to install the tailor-sdk skill.\n * @param options - Runtime options for skill installation\n * @returns Process exit code from the spawned `npx` command\n */\nexport async function runSkillsInstaller(options: RunSkillsInstallerOptions = {}): Promise<number> {\n const args = buildSkillsAddArgs(options.additionalArgs ?? [], options.source);\n const spawnFn =\n options.spawnFn ??\n ((command: string, spawnArgs: string[], spawnOptions: { stdio: \"inherit\" }) =>\n spawn(command, spawnArgs, spawnOptions));\n\n const childProcess = spawnFn(resolveNpxCommand(), args, { stdio: \"inherit\" });\n\n return await new Promise<number>((resolve, reject) => {\n childProcess.on(\"error\", (error) => reject(error));\n childProcess.on(\"close\", (code) => resolve(code ?? 1));\n });\n}\n","#!/usr/bin/env node\n\nimport { runSkillsInstaller } from \"./skills-installer\";\n\nconst exitCode = await runSkillsInstaller({\n additionalArgs: process.argv.slice(2),\n});\n\nprocess.exit(exitCode);\n"],"mappings":";;;;AAEA,MAAa,aAAa;AAC1B,MAAa,wBACX;AACF,MAAM,wBAAwB;AAmB9B,SAAS,kBAAkB,WAA4B,QAAQ,UAAkB;AAC/E,QAAO,aAAa,UAAU,YAAY;;AAG5C,SAAS,oBAAoB,QAAyB;AACpD,QAAO,UAAU,QAAQ,IAAI,0BAA0B;;;;;;;;AASzD,SAAgB,mBAAmB,gBAAmC,QAA2B;AAC/F,QAAO;EAAC;EAAU;EAAO,oBAAoB,OAAO;EAAE;EAAW;EAAY,GAAG;EAAe;;;;;;;AAQjG,eAAsB,mBAAmB,UAAqC,EAAE,EAAmB;CACjG,MAAM,OAAO,mBAAmB,QAAQ,kBAAkB,EAAE,EAAE,QAAQ,OAAO;CAM7E,MAAM,gBAJJ,QAAQ,aACN,SAAiB,WAAqB,iBACtC,MAAM,SAAS,WAAW,aAAa,GAEd,mBAAmB,EAAE,MAAM,EAAE,OAAO,WAAW,CAAC;AAE7E,QAAO,MAAM,IAAI,SAAiB,SAAS,WAAW;AACpD,eAAa,GAAG,UAAU,UAAU,OAAO,MAAM,CAAC;AAClD,eAAa,GAAG,UAAU,SAAS,QAAQ,QAAQ,EAAE,CAAC;GACtD;;;;;ACvDJ,MAAM,WAAW,MAAM,mBAAmB,EACxC,gBAAgB,QAAQ,KAAK,MAAM,EAAE,EACtC,CAAC;AAEF,QAAQ,KAAK,SAAS"}
|
|
1
|
+
{"version":3,"file":"skills.mjs","names":[],"sources":["../../src/cli/shared/skills-installer.ts","../../src/cli/skills.ts"],"sourcesContent":["import { spawn } from \"node:child_process\";\n\nexport const SKILL_NAME = \"tailor-sdk\";\nexport const DEFAULT_SKILLS_SOURCE =\n \"https://github.com/tailor-platform/sdk/tree/main/packages/sdk/skills\";\nconst SKILLS_SOURCE_ENV_KEY = \"TAILOR_SDK_SKILLS_SOURCE\";\n\ninterface ChildProcessLike {\n on(event: \"close\", listener: (code: number | null) => void): ChildProcessLike;\n on(event: \"error\", listener: (error: Error) => void): ChildProcessLike;\n}\n\ntype SpawnLike = (\n command: string,\n args: string[],\n options: { stdio: \"inherit\" },\n) => ChildProcessLike;\n\ninterface RunSkillsInstallerOptions {\n additionalArgs?: string[];\n source?: string;\n spawnFn?: SpawnLike;\n}\n\nfunction resolveNpxCommand(platform: NodeJS.Platform = process.platform): string {\n return platform === \"win32\" ? \"npx.cmd\" : \"npx\";\n}\n\nfunction resolveSkillsSource(source?: string): string {\n return source ?? process.env[SKILLS_SOURCE_ENV_KEY] ?? DEFAULT_SKILLS_SOURCE;\n}\n\n/**\n * Build CLI arguments for `skills add` with the fixed tailor-sdk skill target.\n * @param additionalArgs - Additional options to pass through to `skills add`\n * @param source - Optional skill source URL or path\n * @returns CLI arguments for `npx skills add`\n */\nexport function buildSkillsAddArgs(additionalArgs: readonly string[], source?: string): string[] {\n return [\"skills\", \"add\", resolveSkillsSource(source), \"--skill\", SKILL_NAME, ...additionalArgs];\n}\n\n/**\n * Run `npx skills add` to install the tailor-sdk skill.\n * @param options - Runtime options for skill installation\n * @returns Process exit code from the spawned `npx` command\n */\nexport async function runSkillsInstaller(options: RunSkillsInstallerOptions = {}): Promise<number> {\n const args = buildSkillsAddArgs(options.additionalArgs ?? [], options.source);\n const spawnFn =\n options.spawnFn ??\n ((command: string, spawnArgs: string[], spawnOptions: { stdio: \"inherit\" }) =>\n spawn(command, spawnArgs, spawnOptions));\n\n const childProcess = spawnFn(resolveNpxCommand(), args, { stdio: \"inherit\" });\n\n return await new Promise<number>((resolve, reject) => {\n childProcess.on(\"error\", (error) => reject(error));\n childProcess.on(\"close\", (code) => resolve(code ?? 1));\n });\n}\n","#!/usr/bin/env node\n\nimport { runSkillsInstaller } from \"./shared/skills-installer\";\n\nconst exitCode = await runSkillsInstaller({\n additionalArgs: process.argv.slice(2),\n});\n\nprocess.exit(exitCode);\n"],"mappings":";;;;AAEA,MAAa,aAAa;AAC1B,MAAa,wBACX;AACF,MAAM,wBAAwB;AAmB9B,SAAS,kBAAkB,WAA4B,QAAQ,UAAkB;AAC/E,QAAO,aAAa,UAAU,YAAY;;AAG5C,SAAS,oBAAoB,QAAyB;AACpD,QAAO,UAAU,QAAQ,IAAI,0BAA0B;;;;;;;;AASzD,SAAgB,mBAAmB,gBAAmC,QAA2B;AAC/F,QAAO;EAAC;EAAU;EAAO,oBAAoB,OAAO;EAAE;EAAW;EAAY,GAAG;EAAe;;;;;;;AAQjG,eAAsB,mBAAmB,UAAqC,EAAE,EAAmB;CACjG,MAAM,OAAO,mBAAmB,QAAQ,kBAAkB,EAAE,EAAE,QAAQ,OAAO;CAM7E,MAAM,gBAJJ,QAAQ,aACN,SAAiB,WAAqB,iBACtC,MAAM,SAAS,WAAW,aAAa,GAEd,mBAAmB,EAAE,MAAM,EAAE,OAAO,WAAW,CAAC;AAE7E,QAAO,MAAM,IAAI,SAAiB,SAAS,WAAW;AACpD,eAAa,GAAG,UAAU,UAAU,OAAO,MAAM,CAAC;AAClD,eAAa,GAAG,UAAU,SAAS,QAAQ,QAAQ,EAAE,CAAC;GACtD;;;;;ACvDJ,MAAM,WAAW,MAAM,mBAAmB,EACxC,gBAAgB,QAAQ,KAAK,MAAM,EAAE,EACtC,CAAC;AAEF,QAAQ,KAAK,SAAS"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference path="./../user-defined.d.ts" />
|
|
2
|
-
import { $ as OAuth2ClientGrantType, At as Resolver, C as TypePluginOutput, D as ResolverReadyContext, E as ResolverNamespaceData, G as AuthExternalConfig, Ht as AttributeMap, J as AuthServiceInput, N as ExecutorServiceConfig, Nt as ResolverServiceConfig, O as TailorDBNamespaceData, Ot as TailorField, P as ExecutorServiceInput, Pt as ResolverServiceInput, Q as IdProviderConfig, Rt as Env, S as TailorDBTypeForPlugin, T as GeneratorResult, Ut as TailorUser, Vt as AttributeList, W as AuthConfig, Wt as unauthenticatedTailorUser, X as DefinedAuth, Y as BuiltinIdP, Z as IDToken, _ as PluginGeneratedResolver, _t as TailorTypeGqlPermission, a as TailorDBField, at as SCIMAttributeType, b as PluginOutput, bt as unsafeAllowAllTypePermission, c as db, ct as SCIMResource, d as PluginAttachment, dt as UserAttributeListKey, et as OAuth2ClientInput, f as PluginConfigs, ft as UserAttributeMap, g as PluginGeneratedExecutorWithFile, gt as PermissionCondition, h as PluginGeneratedExecutor, i as TailorAnyDBType, it as SCIMAttributeMapping, jt as ResolverExternalConfig, k as TailorDBReadyContext, kt as QueryType, l as NamespacePluginOutput, lt as TenantProviderConfig, m as PluginExecutorContextBase, mt as ValueOperand, nt as SAML, o as TailorDBInstance, ot as SCIMAuthorization, p as PluginExecutorContext, pt as UsernameFieldKey, q as AuthOwnConfig, r as TailorAnyDBField, rt as SCIMAttribute, s as TailorDBType, st as SCIMConfig, tt as OIDC, u as Plugin, ut as UserAttributeKey, v as PluginGeneratedType, vt as TailorTypePermission, w as ExecutorReadyContext, x as PluginProcessContext, y as PluginNamespaceProcessContext, yt as unsafeAllowAllGqlPermission } from "../types-
|
|
3
|
-
import { c as
|
|
4
|
-
import { $ as
|
|
5
|
-
export { AttributeList, AttributeMap, AuthAccessTokenArgs, AuthAccessTokenTrigger, AuthConfig, AuthExternalConfig, AuthInvoker, AuthOwnConfig, AuthServiceInput, BuiltinIdP, DefinedAuth, Env, ExecutorReadyContext, ExecutorServiceConfig, ExecutorServiceInput, FunctionOperation, GeneratorResult, GqlOperation, IDToken, IdPConfig, IdPExternalConfig, IdProviderConfig, IdpUserArgs, IdpUserTrigger, IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookTrigger, NamespacePluginOutput, OAuth2ClientInput as OAuth2Client, OAuth2ClientGrantType, OIDC, Operation, PermissionCondition, Plugin, PluginAttachment, PluginConfigs, PluginExecutorContext, PluginExecutorContextBase, PluginGeneratedExecutor, PluginGeneratedExecutorWithFile, PluginGeneratedResolver, PluginGeneratedType, PluginNamespaceProcessContext, PluginOutput, PluginProcessContext, QueryType, RecordCreatedArgs, RecordDeletedArgs, RecordTrigger, RecordUpdatedArgs, Resolver, ResolverExecutedArgs, ResolverExecutedTrigger, ResolverExternalConfig, ResolverNamespaceData, ResolverReadyContext, ResolverServiceConfig, ResolverServiceInput, SAML, SCIMAttribute, SCIMAttributeMapping, SCIMAttributeType, SCIMAuthorization, SCIMConfig, SCIMResource, ScheduleArgs, ScheduleTrigger, StaticWebsiteConfig, TailorAnyDBField, TailorAnyDBType, TailorDBField, TailorDBInstance, TailorDBNamespaceData, TailorDBReadyContext, TailorDBType, TailorDBTypeForPlugin, TailorField, TailorTypeGqlPermission, TailorTypePermission, TailorUser, TenantProviderConfig, Trigger, TypePluginOutput, UserAttributeKey, UserAttributeListKey, UserAttributeMap, UsernameFieldKey, ValueOperand, WORKFLOW_TEST_ENV_KEY, WORKFLOW_TEST_USER_KEY, WebhookOperation, Workflow, WorkflowConfig, WorkflowJob, WorkflowJobContext, WorkflowJobInput, WorkflowJobOutput, WorkflowOperation, WorkflowServiceConfig, WorkflowServiceInput, authAccessTokenIssuedTrigger, authAccessTokenRefreshedTrigger, authAccessTokenRevokedTrigger, createExecutor, createResolver, createWorkflow, createWorkflowJob, db, defineAuth, defineConfig, defineGenerators, defineIdp, definePlugins, defineStaticWebSite, idpUserCreatedTrigger, idpUserDeletedTrigger, idpUserUpdatedTrigger, incomingWebhookTrigger, infer, output, recordCreatedTrigger, recordDeletedTrigger, recordUpdatedTrigger, resolverExecutedTrigger, scheduleTrigger, t, unauthenticatedTailorUser, unsafeAllowAllGqlPermission, unsafeAllowAllTypePermission };
|
|
2
|
+
import { $ as OAuth2ClientGrantType, At as Resolver, C as TypePluginOutput, D as ResolverReadyContext, E as ResolverNamespaceData, G as AuthExternalConfig, Ht as AttributeMap, J as AuthServiceInput, N as ExecutorServiceConfig, Nt as ResolverServiceConfig, O as TailorDBNamespaceData, Ot as TailorField, P as ExecutorServiceInput, Pt as ResolverServiceInput, Q as IdProviderConfig, Rt as Env, S as TailorDBTypeForPlugin, T as GeneratorResult, Ut as TailorUser, Vt as AttributeList, W as AuthConfig, Wt as unauthenticatedTailorUser, X as DefinedAuth, Y as BuiltinIdP, Z as IDToken, _ as PluginGeneratedResolver, _t as TailorTypeGqlPermission, a as TailorDBField, at as SCIMAttributeType, b as PluginOutput, bt as unsafeAllowAllTypePermission, c as db, ct as SCIMResource, d as PluginAttachment, dt as UserAttributeListKey, et as OAuth2ClientInput, f as PluginConfigs, ft as UserAttributeMap, g as PluginGeneratedExecutorWithFile, gt as PermissionCondition, h as PluginGeneratedExecutor, i as TailorAnyDBType, it as SCIMAttributeMapping, jt as ResolverExternalConfig, k as TailorDBReadyContext, kt as QueryType, l as NamespacePluginOutput, lt as TenantProviderConfig, m as PluginExecutorContextBase, mt as ValueOperand, nt as SAML, o as TailorDBInstance, ot as SCIMAuthorization, p as PluginExecutorContext, pt as UsernameFieldKey, q as AuthOwnConfig, r as TailorAnyDBField, rt as SCIMAttribute, s as TailorDBType, st as SCIMConfig, tt as OIDC, u as Plugin, ut as UserAttributeKey, v as PluginGeneratedType, vt as TailorTypePermission, w as ExecutorReadyContext, x as PluginProcessContext, y as PluginNamespaceProcessContext, yt as unsafeAllowAllGqlPermission } from "../types-QKq1usl7.mjs";
|
|
3
|
+
import { a as IdPGqlOperationsAliasQuery, c as StaticWebsiteConfig, d as WorkflowServiceInput, i as IdPGqlOperations, l as defineStaticWebSite, n as IdPConfig, o as IdPGqlOperationsConfig, r as IdPExternalConfig, s as defineIdp, u as WorkflowServiceConfig } from "../types-C0o90Cmb.mjs";
|
|
4
|
+
import { $ as defineAuth, A as idpUserDeletedTrigger, B as WorkflowOperation, C as RecordUpdatedArgs, D as authAccessTokenRefreshedTrigger, E as authAccessTokenIssuedTrigger, F as resolverExecutedTrigger, G as WORKFLOW_TEST_USER_KEY, H as WorkflowConfig, I as FunctionOperation, J as WorkflowJobInput, K as WorkflowJob, L as GqlOperation, M as recordCreatedTrigger, N as recordDeletedTrigger, O as authAccessTokenRevokedTrigger, P as recordUpdatedTrigger, Q as AuthInvoker, R as Operation, S as RecordTrigger, T as ResolverExecutedTrigger, U as createWorkflow, V as Workflow, W as WORKFLOW_TEST_ENV_KEY, X as createWorkflowJob, Y as WorkflowJobOutput, Z as createResolver, _ as AuthAccessTokenTrigger, a as defineGenerators, b as RecordCreatedArgs, c as Trigger, d as IncomingWebhookTrigger, f as incomingWebhookTrigger, g as AuthAccessTokenArgs, h as scheduleTrigger, i as defineConfig, j as idpUserUpdatedTrigger, k as idpUserCreatedTrigger, l as IncomingWebhookArgs, m as ScheduleTrigger, n as output, o as definePlugins, p as ScheduleArgs, q as WorkflowJobContext, r as t, s as createExecutor, t as infer, u as IncomingWebhookRequest, v as IdpUserArgs, w as ResolverExecutedArgs, x as RecordDeletedArgs, y as IdpUserTrigger, z as WebhookOperation } from "../index-CnHd6BNg.mjs";
|
|
5
|
+
export { AttributeList, AttributeMap, AuthAccessTokenArgs, AuthAccessTokenTrigger, AuthConfig, AuthExternalConfig, AuthInvoker, AuthOwnConfig, AuthServiceInput, BuiltinIdP, DefinedAuth, Env, ExecutorReadyContext, ExecutorServiceConfig, ExecutorServiceInput, FunctionOperation, GeneratorResult, GqlOperation, IDToken, IdPConfig, IdPExternalConfig, IdPGqlOperations, IdPGqlOperationsAliasQuery, IdPGqlOperationsConfig, IdProviderConfig, IdpUserArgs, IdpUserTrigger, IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookTrigger, NamespacePluginOutput, OAuth2ClientInput as OAuth2Client, OAuth2ClientGrantType, OIDC, Operation, PermissionCondition, Plugin, PluginAttachment, PluginConfigs, PluginExecutorContext, PluginExecutorContextBase, PluginGeneratedExecutor, PluginGeneratedExecutorWithFile, PluginGeneratedResolver, PluginGeneratedType, PluginNamespaceProcessContext, PluginOutput, PluginProcessContext, QueryType, RecordCreatedArgs, RecordDeletedArgs, RecordTrigger, RecordUpdatedArgs, Resolver, ResolverExecutedArgs, ResolverExecutedTrigger, ResolverExternalConfig, ResolverNamespaceData, ResolverReadyContext, ResolverServiceConfig, ResolverServiceInput, SAML, SCIMAttribute, SCIMAttributeMapping, SCIMAttributeType, SCIMAuthorization, SCIMConfig, SCIMResource, ScheduleArgs, ScheduleTrigger, StaticWebsiteConfig, TailorAnyDBField, TailorAnyDBType, TailorDBField, TailorDBInstance, TailorDBNamespaceData, TailorDBReadyContext, TailorDBType, TailorDBTypeForPlugin, TailorField, TailorTypeGqlPermission, TailorTypePermission, TailorUser, TenantProviderConfig, Trigger, TypePluginOutput, UserAttributeKey, UserAttributeListKey, UserAttributeMap, UsernameFieldKey, ValueOperand, WORKFLOW_TEST_ENV_KEY, WORKFLOW_TEST_USER_KEY, WebhookOperation, Workflow, WorkflowConfig, WorkflowJob, WorkflowJobContext, WorkflowJobInput, WorkflowJobOutput, WorkflowOperation, WorkflowServiceConfig, WorkflowServiceInput, authAccessTokenIssuedTrigger, authAccessTokenRefreshedTrigger, authAccessTokenRevokedTrigger, createExecutor, createResolver, createWorkflow, createWorkflowJob, db, defineAuth, defineConfig, defineGenerators, defineIdp, definePlugins, defineStaticWebSite, idpUserCreatedTrigger, idpUserDeletedTrigger, idpUserUpdatedTrigger, incomingWebhookTrigger, infer, output, recordCreatedTrigger, recordDeletedTrigger, recordUpdatedTrigger, resolverExecutedTrigger, scheduleTrigger, t, unauthenticatedTailorUser, unsafeAllowAllGqlPermission, unsafeAllowAllTypePermission };
|
package/dist/configure/index.mjs
CHANGED
|
@@ -34,6 +34,11 @@ function validateAuthConfig(config) {
|
|
|
34
34
|
*
|
|
35
35
|
* `output` accepts either a single TailorField (e.g. `t.string()`) or a
|
|
36
36
|
* Record of fields (e.g. `{ name: t.string(), age: t.int() }`).
|
|
37
|
+
*
|
|
38
|
+
* `publishEvents` enables publishing execution events for this resolver.
|
|
39
|
+
* If not specified, this is automatically set to true when an executor uses this resolver
|
|
40
|
+
* with `resolverExecutedTrigger`. If explicitly set to false while an executor uses this
|
|
41
|
+
* resolver, an error will be thrown during apply.
|
|
37
42
|
* @template Input
|
|
38
43
|
* @template Output
|
|
39
44
|
* @param config - Resolver configuration
|
|
@@ -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 * @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 * 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/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,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-QKq1usl7.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-BWVAwea4.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 {
|
|
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-QKq1usl7.mjs";
|
|
3
|
+
import { t as AppConfig } from "./types-C0o90Cmb.mjs";
|
|
4
4
|
import * as zod0 from "zod";
|
|
5
5
|
import { JsonPrimitive, Jsonifiable, Jsonify } from "type-fest";
|
|
6
6
|
import { Client } from "@urql/core";
|
|
@@ -73,6 +73,11 @@ type ResolverReturn<Input extends Record<string, TailorAnyField> | undefined, Ou
|
|
|
73
73
|
*
|
|
74
74
|
* `output` accepts either a single TailorField (e.g. `t.string()`) or a
|
|
75
75
|
* Record of fields (e.g. `{ name: t.string(), age: t.int() }`).
|
|
76
|
+
*
|
|
77
|
+
* `publishEvents` enables publishing execution events for this resolver.
|
|
78
|
+
* If not specified, this is automatically set to true when an executor uses this resolver
|
|
79
|
+
* with `resolverExecutedTrigger`. If explicitly set to false while an executor uses this
|
|
80
|
+
* resolver, an error will be thrown during apply.
|
|
76
81
|
* @template Input
|
|
77
82
|
* @template Output
|
|
78
83
|
* @param config - Resolver configuration
|
|
@@ -584,45 +589,6 @@ declare function createExecutor<Args, O extends Operation<Args> | {
|
|
|
584
589
|
workflow: Workflow;
|
|
585
590
|
}>(config: Executor<Trigger<Args>, O>): Executor<Trigger<Args>, O>;
|
|
586
591
|
//#endregion
|
|
587
|
-
//#region src/configure/services/idp/index.d.ts
|
|
588
|
-
/**
|
|
589
|
-
* Define an IdP service configuration for the Tailor SDK.
|
|
590
|
-
* @template TClients
|
|
591
|
-
* @param name - IdP service name
|
|
592
|
-
* @param config - IdP configuration
|
|
593
|
-
* @returns Defined IdP service
|
|
594
|
-
*/
|
|
595
|
-
declare function defineIdp<const TClients extends string[]>(name: string, config: Omit<IdPInput, "name" | "clients"> & {
|
|
596
|
-
clients: TClients;
|
|
597
|
-
}): {
|
|
598
|
-
readonly name: string;
|
|
599
|
-
readonly provider: (providerName: string, clientName: TClients[number]) => {
|
|
600
|
-
readonly name: string;
|
|
601
|
-
readonly kind: "BuiltInIdP";
|
|
602
|
-
readonly namespace: string;
|
|
603
|
-
readonly clientName: TClients[number];
|
|
604
|
-
};
|
|
605
|
-
readonly authorization: "insecure" | "loggedIn" | {
|
|
606
|
-
cel: string;
|
|
607
|
-
};
|
|
608
|
-
readonly lang?: "en" | "ja" | undefined;
|
|
609
|
-
readonly userAuthPolicy?: {
|
|
610
|
-
useNonEmailIdentifier?: boolean | undefined;
|
|
611
|
-
allowSelfPasswordReset?: boolean | undefined;
|
|
612
|
-
passwordRequireUppercase?: boolean | undefined;
|
|
613
|
-
passwordRequireLowercase?: boolean | undefined;
|
|
614
|
-
passwordRequireNonAlphanumeric?: boolean | undefined;
|
|
615
|
-
passwordRequireNumeric?: boolean | undefined;
|
|
616
|
-
passwordMinLength?: number | undefined;
|
|
617
|
-
passwordMaxLength?: number | undefined;
|
|
618
|
-
allowedEmailDomains?: string[] | undefined;
|
|
619
|
-
allowGoogleOauth?: boolean | undefined;
|
|
620
|
-
disablePasswordAuth?: boolean | undefined;
|
|
621
|
-
} | undefined;
|
|
622
|
-
readonly publishUserEvents?: boolean | undefined;
|
|
623
|
-
readonly clients: TClients;
|
|
624
|
-
} & IdpDefinitionBrand;
|
|
625
|
-
//#endregion
|
|
626
592
|
//#region src/configure/config.d.ts
|
|
627
593
|
/**
|
|
628
594
|
* Define a Tailor SDK application configuration with shallow exactness.
|
|
@@ -743,5 +709,5 @@ declare namespace t {
|
|
|
743
709
|
type infer<T> = TailorOutput<T>;
|
|
744
710
|
}
|
|
745
711
|
//#endregion
|
|
746
|
-
export {
|
|
747
|
-
//# sourceMappingURL=index-
|
|
712
|
+
export { defineAuth as $, idpUserDeletedTrigger as A, WorkflowOperation as B, RecordUpdatedArgs as C, authAccessTokenRefreshedTrigger as D, authAccessTokenIssuedTrigger as E, resolverExecutedTrigger as F, WORKFLOW_TEST_USER_KEY as G, WorkflowConfig as H, FunctionOperation as I, WorkflowJobInput as J, WorkflowJob as K, GqlOperation as L, recordCreatedTrigger as M, recordDeletedTrigger as N, authAccessTokenRevokedTrigger as O, recordUpdatedTrigger as P, AuthInvoker as Q, Operation as R, RecordTrigger as S, ResolverExecutedTrigger as T, createWorkflow as U, Workflow as V, WORKFLOW_TEST_ENV_KEY as W, createWorkflowJob as X, WorkflowJobOutput as Y, createResolver 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, WorkflowJobContext 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 };
|
|
713
|
+
//# sourceMappingURL=index-CnHd6BNg.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-QKq1usl7.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-Dn61THJK.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-QKq1usl7.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-DxlmLUag.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-QKq1usl7.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-oZXVKyfX.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readPackageJSON } from "pkg-types";
|
|
2
2
|
|
|
3
|
-
//#region src/cli/
|
|
3
|
+
//#region src/cli/shared/package-json.ts
|
|
4
4
|
let packageJson = null;
|
|
5
5
|
/**
|
|
6
6
|
* Read and cache the package.json of the SDK package.
|
|
@@ -14,4 +14,4 @@ async function readPackageJson() {
|
|
|
14
14
|
|
|
15
15
|
//#endregion
|
|
16
16
|
export { readPackageJson as t };
|
|
17
|
-
//# sourceMappingURL=package-json-
|
|
17
|
+
//# sourceMappingURL=package-json-3H5gfhA4.mjs.map
|