@tailor-platform/sdk 2.0.0-next.1 → 2.0.0-next.2
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 +56 -0
- package/dist/application-Dtqap5jM.mjs +3 -0
- package/dist/{client-z_oHGVNy.mjs → application-XuMWK4eq.mjs} +5861 -20
- package/dist/application-XuMWK4eq.mjs.map +1 -0
- package/dist/cli/index.mjs +179 -122
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +75 -16
- package/dist/cli/lib.mjs +5 -6
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/completion/zsh-worker.zsh +105 -26
- package/dist/configure/index.d.mts +9 -8
- package/dist/configure/index.mjs +56 -19
- package/dist/configure/index.mjs.map +1 -1
- package/dist/context-Bd266-ru.mjs.map +1 -1
- package/dist/{context-BuuIb8CC.d.mts → context-C2lEi9uw.d.mts} +7 -28
- package/dist/{crashreport-pr6Rhvza.mjs → crashreport-BMWcxeSE.mjs} +1 -1
- package/dist/{crashreport-BsjAkFWw.mjs → crashreport-DFq-vsU0.mjs} +5 -7
- package/dist/{crashreport-BsjAkFWw.mjs.map → crashreport-DFq-vsU0.mjs.map} +1 -1
- package/dist/{file-_oUZo76X.mjs → file-BbdFGdMV.mjs} +2 -10
- package/dist/file-BbdFGdMV.mjs.map +1 -0
- package/dist/{file-BB8Vs9O_.d.mts → file-Dq3NIt_F.d.mts} +3 -42
- package/dist/{file-utils-DcyIPFQh.mjs → file-utils-CYZnO1pX.mjs} +5 -5
- package/dist/file-utils-CYZnO1pX.mjs.map +1 -0
- package/dist/{globals-Crz8o65k.mjs → globals-Cf0sxIt8.mjs} +2 -2
- package/dist/{globals-Crz8o65k.mjs.map → globals-Cf0sxIt8.mjs.map} +1 -1
- package/dist/{http-adapter.generated-WgMnb7Sb.d.mts → http-adapter.generated-DFsXDdm5.d.mts} +11 -10
- package/dist/{index-BlpzXncY.d.mts → index-BI-_j9Z3.d.mts} +29 -32
- package/dist/{index-DjUdWlzf.d.mts → index-C4JirJH8.d.mts} +2 -2
- package/dist/{index-5vPyRu1y.d.mts → index-CZfWhr0a.d.mts} +2 -2
- package/dist/{index-CK7u9isy.d.mts → index-Cg8VKAdN.d.mts} +4 -4
- package/dist/{index-B7AKc18V.d.mts → index-DYRjoLXD.d.mts} +2 -2
- package/dist/{index-ZePLwxw7.d.mts → index-lFpcjHPU.d.mts} +8 -15
- package/dist/{index-CNYe5lnW.d.mts → index-nW7hE6oE.d.mts} +2 -2
- package/dist/{mock-BjFj5o1I.mjs → mock-FPxmnt-y.mjs} +4 -49
- package/dist/{mock-BjFj5o1I.mjs.map → mock-FPxmnt-y.mjs.map} +1 -1
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.mjs +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/index.d.mts +4 -3
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/{registry-DdsYlL_P.mjs → registry-DH4m7eYo.mjs} +4 -2
- package/dist/registry-DH4m7eYo.mjs.map +1 -0
- package/dist/runtime/context.d.mts +1 -1
- package/dist/runtime/file.d.mts +2 -2
- package/dist/runtime/file.mjs +2 -2
- package/dist/runtime/globals.d.mts +6 -6
- package/dist/runtime/index.d.mts +4 -4
- package/dist/runtime/index.mjs +2 -2
- package/dist/runtime/workflow.d.mts +2 -2
- package/dist/runtime/workflow.mjs +1 -1
- package/dist/{runtime-n9NCkjee.mjs → runtime-CY4JvrDj.mjs} +777 -234
- package/dist/runtime-CY4JvrDj.mjs.map +1 -0
- package/dist/{schema-BhkpP5Hw.mjs → schema-Dtw9Orye.mjs} +16 -13
- package/dist/schema-Dtw9Orye.mjs.map +1 -0
- package/dist/{secret-file-DBqZhjFQ.mjs → secret-file-VSVGy1V0.mjs} +27 -2
- package/dist/{secret-file-DBqZhjFQ.mjs.map → secret-file-VSVGy1V0.mjs.map} +1 -1
- package/dist/{seed-jf3008-h.mjs → seed-izIEyP3z.mjs} +3 -4
- package/dist/seed-izIEyP3z.mjs.map +1 -0
- package/dist/service-DCqIWibD.mjs +3 -0
- package/dist/{service-DU1mVzri.mjs → service-DU1mVzri2.mjs} +1 -1
- package/dist/service-DU1mVzri2.mjs.map +1 -0
- package/dist/{service-CCL8ruDf.mjs → service-DjyqbCaJ.mjs} +7 -7
- package/dist/{service-CCL8ruDf.mjs.map → service-DjyqbCaJ.mjs.map} +1 -1
- package/dist/test-env-key-D7UkZp99.mjs +75 -0
- package/dist/test-env-key-D7UkZp99.mjs.map +1 -0
- package/dist/{types-ClhIrW_C.mjs → types-74etvaxy.mjs} +1 -1
- package/dist/{types-DhO_VEZd.d.mts → types-BDRml5C3.d.mts} +12 -12
- package/dist/{types-B2RpYyA_.mjs → types-BQijbo4m.mjs} +9 -9
- package/dist/types-BQijbo4m.mjs.map +1 -0
- package/dist/{types-DwDgacni.d.mts → types-BX4q6Mo6.d.mts} +3 -2
- package/dist/types-BZ7QKVE8.d.mts +21 -0
- package/dist/{types-DCUhgpyI.d.mts → types-CdcQh4Z2.d.mts} +5 -76
- package/dist/utils/test/index.d.mts +6 -15
- package/dist/utils/test/index.mjs +4 -13
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/environment.mjs +1 -1
- package/dist/vitest/index.d.mts +2 -2
- package/dist/vitest/index.mjs +4 -4
- package/dist/vitest/setup.mjs +2 -2
- package/dist/{workflow-DgemCAz3.mjs → workflow-BOmaZwwG.mjs} +8 -3
- package/dist/workflow-BOmaZwwG.mjs.map +1 -0
- package/dist/{workflow-BbKvGLQg.d.mts → workflow-BVy4XWjS.d.mts} +15 -10
- package/dist/{workflow.generated-DtQwEo-x.d.mts → workflow.generated-ClEjBYhm.d.mts} +3 -3
- package/docs/cli/executor.md +53 -0
- package/docs/cli/setup.md +35 -33
- package/docs/cli/workflow.md +157 -20
- package/docs/cli-reference.md +26 -20
- package/docs/github-actions.md +29 -16
- package/docs/migration/v2.md +475 -0
- package/docs/runtime.md +1 -1
- package/docs/services/auth.md +12 -12
- package/docs/services/executor.md +3 -3
- package/docs/services/resolver.md +6 -6
- package/docs/services/tailordb.md +14 -12
- package/docs/services/workflow.md +4 -4
- package/docs/testing.md +59 -47
- package/package.json +7 -7
- package/dist/application-DB2r36Et.mjs +0 -3
- package/dist/application-DqS1yBg3.mjs +0 -5680
- package/dist/application-DqS1yBg3.mjs.map +0 -1
- package/dist/client-Dbohmtkv.mjs +0 -3
- package/dist/client-z_oHGVNy.mjs.map +0 -1
- package/dist/file-_oUZo76X.mjs.map +0 -1
- package/dist/file-utils-DcyIPFQh.mjs.map +0 -1
- package/dist/job-fuc3j1Ma.mjs +0 -53
- package/dist/job-fuc3j1Ma.mjs.map +0 -1
- package/dist/registry-DdsYlL_P.mjs.map +0 -1
- package/dist/runtime-n9NCkjee.mjs.map +0 -1
- package/dist/schema-BhkpP5Hw.mjs.map +0 -1
- package/dist/seed-jf3008-h.mjs.map +0 -1
- package/dist/service-D6yonf2I.mjs +0 -3
- package/dist/service-DU1mVzri.mjs.map +0 -1
- package/dist/test-env-key-D9kM6ETE.mjs +0 -49
- package/dist/test-env-key-D9kM6ETE.mjs.map +0 -1
- package/dist/types-B2RpYyA_.mjs.map +0 -1
- package/dist/workflow-DgemCAz3.mjs.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "../../../index-
|
|
1
|
+
import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "../../../index-C4JirJH8.mjs";
|
|
2
2
|
export { EnumConstantsGeneratorID, enumConstantsPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "../../../index-
|
|
1
|
+
import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "../../../index-nW7hE6oE.mjs";
|
|
2
2
|
export { FileUtilsGeneratorID, fileUtilsPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "../../../index-
|
|
1
|
+
import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "../../../index-CZfWhr0a.mjs";
|
|
2
2
|
export { KyselyGeneratorID, kyselyTypePlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as seedPlugin, t as SeedGeneratorID } from "../../../index-
|
|
1
|
+
import { n as seedPlugin, t as SeedGeneratorID } from "../../../index-DYRjoLXD.mjs";
|
|
2
2
|
export { SeedGeneratorID, seedPlugin };
|
package/dist/plugin/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as TailorEnv, o as TailorPrincipal } from "../types-BZ7QKVE8.mjs";
|
|
2
|
+
import { f as TailorAnyDBType } from "../types-CdcQh4Z2.mjs";
|
|
2
3
|
|
|
3
4
|
//#region src/plugin/with-context.d.ts
|
|
4
5
|
/**
|
|
@@ -18,8 +19,8 @@ interface PluginFunctionArgs {
|
|
|
18
19
|
appNamespace: string;
|
|
19
20
|
/** Environment variables */
|
|
20
21
|
env: TailorEnv;
|
|
21
|
-
/**
|
|
22
|
-
actor:
|
|
22
|
+
/** Principal that triggered the event, null for system events */
|
|
23
|
+
actor: TailorPrincipal | null;
|
|
23
24
|
/** Name of the TailorDB type */
|
|
24
25
|
typeName: string;
|
|
25
26
|
/** TailorDB connections by namespace */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/plugin/with-context.ts","../../src/plugin/get-generated-type.ts"],"sourcesContent":["/**\n * Plugin executor context support for defining plugin executors in separate files.\n * This module provides utilities for creating type-safe plugin executors that receive\n * context (like type references and namespace) at runtime.\n */\n\nimport type { TailorActor, TailorEnv } from \"@/runtime/types\";\n\n/**\n * Plugin executor factory function type.\n * Takes context and returns an executor configuration.\n * Returns unknown since the exact return type depends on createExecutor's generic params.\n */\nexport type PluginExecutorFactory<Ctx> = (ctx: Ctx) => unknown;\n\n// ============================================================================\n// Plugin Executor Args Types\n// ============================================================================\n\n/**\n * Base args for plugin executor function operations.\n * Provides typed access to runtime context without requiring specific record types.\n */\nexport interface PluginFunctionArgs {\n /** Workspace ID where the executor runs */\n workspaceId: string;\n /** Application namespace */\n appNamespace: string;\n /** Environment variables */\n env: TailorEnv;\n /** Actor (user) who triggered the event, null for system events */\n actor: TailorActor | null;\n /** Name of the TailorDB type */\n typeName: string;\n /** TailorDB connections by namespace */\n tailordb: Record<string, unknown>;\n}\n\n/**\n * Args for plugin executors triggered on record creation.\n */\nexport interface PluginRecordCreatedArgs extends PluginFunctionArgs {\n /** The newly created record */\n newRecord: Record<string, unknown>;\n}\n\n/**\n * Args for plugin executors triggered on record update.\n */\nexport interface PluginRecordUpdatedArgs extends PluginFunctionArgs {\n /** The record after update */\n newRecord: Record<string, unknown>;\n /** The record before update */\n oldRecord: Record<string, unknown>;\n}\n\n/**\n * Args for plugin executors triggered on record deletion.\n */\nexport interface PluginRecordDeletedArgs extends PluginFunctionArgs {\n /** The deleted record */\n oldRecord: Record<string, unknown>;\n}\n\n/**\n * Database schema type for plugins.\n * Since plugins work with dynamic types, the schema uses Record types.\n */\nexport type PluginDBSchema = Record<string, Record<string, unknown>>;\n\n/**\n * Base record type for TailorDB records.\n * All records have an id field.\n */\nexport type PluginRecord = { id: string } & Record<string, unknown>;\n\n/**\n * Define a plugin executor that receives context at runtime.\n * This allows executor definitions to be in separate files while\n * still receiving dynamic values like typeName, generated types, and namespace.\n * @param factory - Function that takes context and returns executor configuration\n * @returns The same factory function (for type inference)\n * @example\n * ```typescript\n * // executors/on-create.ts\n * import { withPluginContext } from \"@tailor-platform/sdk/plugin\";\n * import { createExecutor, recordCreatedTrigger } from \"@tailor-platform/sdk\";\n * import { getDB } from \"@tailor-platform/function-kysely-tailordb\";\n *\n * interface MyContext {\n * sourceType: TailorAnyDBType;\n * historyType: TailorAnyDBType;\n * namespace: string;\n * }\n *\n * export default withPluginContext<MyContext>((ctx) =>\n * createExecutor({\n * name: `${ctx.sourceType.name.toLowerCase()}-on-create`,\n * trigger: recordCreatedTrigger({ type: ctx.sourceType }),\n * operation: {\n * kind: \"function\",\n * body: async (args) => {\n * const db = getDB(ctx.namespace);\n * await db.insertInto(ctx.historyType.name).values({\n * recordId: args.newRecord.id,\n * // ...\n * }).execute();\n * },\n * },\n * })\n * );\n * ```\n */\nexport function withPluginContext<Ctx>(\n factory: PluginExecutorFactory<Ctx>,\n): PluginExecutorFactory<Ctx> {\n return factory;\n}\n","import * as fs from \"node:fs\";\nimport { pathToFileURL } from \"node:url\";\nimport * as path from \"pathe\";\nimport type { TailorAnyDBType } from \"@/configure/services/tailordb/types\";\nimport type { Plugin, PluginOutput, TypePluginOutput } from \"@/plugin/types\";\n\n// ========================================\n// Config loading and caching\n// ========================================\n\ninterface PluginEntry {\n plugin: Plugin;\n pluginConfig: unknown;\n}\n\ninterface ConfigCache {\n config: { db?: Record<string, unknown> };\n plugins: Map<string, PluginEntry>;\n configDir: string;\n}\n\n/** Cache: resolved config path -> loaded config data */\nconst configCacheMap = new Map<string, ConfigCache>();\n\n/**\n * Check if a value is a Plugin instance.\n * @param value - Value to check\n * @returns True if value has the shape of Plugin\n */\nfunction isPlugin(value: unknown): value is Plugin {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as Record<string, unknown>).id === \"string\" &&\n typeof (value as Record<string, unknown>).description === \"string\"\n );\n}\n\n/**\n * Load and cache config module from the given path.\n * Extracts plugins from all array exports using definePlugins() format.\n * Returns null if the config file does not exist (e.g., in bundled executor on platform server).\n * @param configPath - Absolute or relative path to tailor.config.ts\n * @returns Cached config data with plugins map, or null if config file is not available\n */\nasync function loadAndCacheConfig(configPath: string): Promise<ConfigCache | null> {\n const resolvedPath = path.resolve(configPath);\n\n const cached = configCacheMap.get(resolvedPath);\n if (cached) return cached;\n\n // Config file may not exist in bundled environments (e.g., platform server)\n if (!fs.existsSync(resolvedPath)) {\n return null;\n }\n\n const configModule = await import(pathToFileURL(resolvedPath).href);\n if (!configModule?.default) {\n throw new Error(`Invalid config module at \"${resolvedPath}\": default export not found`);\n }\n\n const config = configModule.default as { db?: Record<string, unknown> };\n const configDir = path.dirname(resolvedPath);\n const plugins = new Map<string, PluginEntry>();\n\n // Find plugin arrays from exports (definePlugins returns PluginConfig[])\n for (const value of Object.values(configModule)) {\n if (!Array.isArray(value)) continue;\n\n for (const item of value) {\n if (isPlugin(item)) {\n plugins.set(item.id, { plugin: item, pluginConfig: item.pluginConfig });\n }\n }\n }\n\n const result: ConfigCache = { config, plugins, configDir };\n configCacheMap.set(resolvedPath, result);\n return result;\n}\n\n// ========================================\n// Namespace resolution\n// ========================================\n\ninterface DbNamespaceConfig {\n files?: string[];\n external?: boolean;\n}\n\n/**\n * Resolve the namespace for a type-attached sourceType by checking config.db file patterns.\n * Uses ESM module cache identity: same file path yields same object references.\n * @param config - App config with db namespace definitions\n * @param config.db - DB namespace definitions\n * @param configDir - Directory containing the config file\n * @param sourceType - The TailorDB type to look up\n * @returns The namespace name\n */\nasync function resolveNamespaceForType(\n config: { db?: Record<string, unknown> },\n configDir: string,\n sourceType: TailorAnyDBType,\n): Promise<string> {\n if (!config.db) {\n throw new Error(`No db configuration found in config`);\n }\n\n for (const [namespace, nsConfig] of Object.entries(config.db)) {\n const dbConfig = nsConfig as DbNamespaceConfig;\n // Skip external namespaces (no files to resolve)\n if (dbConfig.external || !dbConfig.files) continue;\n\n for (const pattern of dbConfig.files) {\n const absolutePattern = path.resolve(configDir, pattern);\n let matchedFiles: string[];\n try {\n matchedFiles = fs.globSync(absolutePattern);\n } catch {\n continue;\n }\n\n for (const file of matchedFiles) {\n const mod = await import(pathToFileURL(file).href);\n for (const exported of Object.values(mod)) {\n if (exported === sourceType) {\n return namespace;\n }\n }\n }\n }\n }\n\n throw new Error(\n `Could not resolve namespace for type \"${sourceType.name}\". ` +\n `Ensure the type file is included in a db namespace's files pattern.`,\n );\n}\n\n/**\n * Resolve the namespace for a namespace plugin by trying each namespace.\n * Calls onNamespaceLoaded() for each and returns the first whose output contains the requested kind.\n * @param config - App config with db namespace definitions\n * @param config.db - DB namespace definitions\n * @param plugin - Plugin instance\n * @param kind - The generated type kind to look for\n * @param pluginConfig - Plugin-level configuration\n * @returns The namespace name\n */\nasync function resolveNamespaceForNamespacePlugin(\n config: { db?: Record<string, unknown> },\n plugin: Plugin,\n kind: string,\n pluginConfig: unknown,\n): Promise<{ namespace: string; output: PluginOutput }> {\n if (!config.db) {\n throw new Error(`No db configuration found in config`);\n }\n\n if (!plugin.onNamespaceLoaded) {\n throw new Error(`Plugin \"${plugin.id}\" does not have a onNamespaceLoaded() method`);\n }\n\n for (const namespace of Object.keys(config.db)) {\n const dbConfig = config.db[namespace] as DbNamespaceConfig;\n if (dbConfig.external) continue;\n\n const output = await plugin.onNamespaceLoaded({\n pluginConfig,\n namespace,\n });\n\n if (output.types?.[kind]) {\n return { namespace, output };\n }\n }\n\n throw new Error(\n `Could not resolve namespace for plugin \"${plugin.id}\" with kind \"${kind}\". ` +\n `No namespace produced a type with that kind.`,\n );\n}\n\n// ========================================\n// Process caching\n// ========================================\n\n// Cache: plugin -> cacheKey -> TypePluginOutput\nconst processCache = new WeakMap<Plugin, Map<string, TypePluginOutput>>();\n\n// Cache for namespace plugins: plugin -> cacheKey -> PluginOutput\nconst namespaceProcessCache = new WeakMap<Plugin, Map<string, PluginOutput>>();\n\n/**\n * Generate a cache key that includes pluginConfig.\n * @param baseKey - Base key for the cache\n * @param pluginConfig - Plugin configuration to include in the key\n * @returns Cache key string\n */\nfunction getCacheKey(baseKey: string, pluginConfig: unknown): string {\n if (pluginConfig === undefined) {\n return baseKey;\n }\n try {\n return `${baseKey}:${JSON.stringify(pluginConfig)}`;\n } catch {\n throw new Error(\n `pluginConfig must be JSON-serializable for caching. Received non-serializable value.`,\n );\n }\n}\n\n// ========================================\n// Main API\n// ========================================\n\n/**\n * Get a generated type from a plugin by loading the config and resolving everything automatically.\n * For type-attached plugins, calls onTypeLoaded() with the sourceType.\n * For namespace plugins, calls onNamespaceLoaded() with auto-resolved namespace.\n * Results are cached per config path, plugin, namespace, and pluginConfig to avoid redundant processing.\n * @param configPath - Path to tailor.config.ts (absolute or relative to cwd)\n * @param pluginId - The plugin's unique identifier\n * @param sourceType - The source TailorDB type (null for namespace plugins)\n * @param kind - The generated type kind (e.g., \"request\", \"step\")\n * @returns The generated TailorDB type\n */\nexport async function getGeneratedType(\n configPath: string,\n pluginId: string,\n sourceType: TailorAnyDBType | null,\n kind: string,\n): Promise<TailorAnyDBType> {\n const cache = await loadAndCacheConfig(configPath);\n\n if (!cache) {\n // Config not available (e.g., running in bundled executor on platform server).\n // Return a placeholder. The actual type is resolved at generate/apply time.\n return { name: `__placeholder_${kind}__`, fields: {} } as TailorAnyDBType;\n }\n\n const { config, configDir, plugins } = cache;\n\n const pluginEntry = plugins.get(pluginId);\n if (!pluginEntry) {\n throw new Error(\n `Plugin \"${pluginId}\" not found in config at \"${configPath}\". ` +\n `Ensure the plugin is registered via definePlugins().`,\n );\n }\n\n const { plugin, pluginConfig } = pluginEntry;\n\n if (sourceType === null) {\n return getGeneratedTypeForNamespacePlugin(config, plugin, kind, pluginConfig);\n }\n\n const namespace = await resolveNamespaceForType(config, configDir, sourceType);\n return getGeneratedTypeForTypeAttachedPlugin(plugin, sourceType, kind, pluginConfig, namespace);\n}\n\n/**\n * Get a generated type from a type-attached plugin.\n * @param plugin - The plugin instance (must have onTypeLoaded() method)\n * @param sourceType - The source TailorDB type\n * @param kind - The generated type kind\n * @param pluginConfig - Plugin-level configuration\n * @param namespace - Resolved namespace\n * @returns The generated TailorDB type\n */\nasync function getGeneratedTypeForTypeAttachedPlugin(\n plugin: Plugin,\n sourceType: TailorAnyDBType,\n kind: string,\n pluginConfig: unknown,\n namespace: string,\n): Promise<TailorAnyDBType> {\n if (!plugin.onTypeLoaded) {\n throw new Error(`Plugin \"${plugin.id}\" does not have a onTypeLoaded() method`);\n }\n\n // Check cache first\n let pluginCache = processCache.get(plugin);\n if (!pluginCache) {\n pluginCache = new Map();\n processCache.set(plugin, pluginCache);\n }\n\n const cacheKey = getCacheKey(`${sourceType.name}:ns=${namespace}`, pluginConfig);\n let output = pluginCache.get(cacheKey);\n\n if (!output) {\n const typeConfig = sourceType.plugins.find((p) => p.pluginId === plugin.id)?.config;\n output = await plugin.onTypeLoaded({\n type: sourceType,\n typeConfig: typeConfig ?? {},\n pluginConfig,\n namespace,\n });\n pluginCache.set(cacheKey, output);\n }\n\n const generatedType = output.types?.[kind];\n if (!generatedType) {\n throw new Error(\n `Generated type not found: plugin=${plugin.id}, sourceType=${sourceType.name}, kind=${kind}`,\n );\n }\n\n return generatedType as TailorAnyDBType;\n}\n\n/**\n * Get a generated type from a namespace plugin.\n * Auto-resolves the namespace by trying each one.\n * @param config - App config with db namespace definitions\n * @param config.db - DB namespace definitions\n * @param plugin - The plugin instance (must have onNamespaceLoaded() method)\n * @param kind - The generated type kind\n * @param pluginConfig - Plugin-level configuration\n * @returns The generated TailorDB type\n */\nasync function getGeneratedTypeForNamespacePlugin(\n config: { db?: Record<string, unknown> },\n plugin: Plugin,\n kind: string,\n pluginConfig: unknown,\n): Promise<TailorAnyDBType> {\n if (!plugin.onNamespaceLoaded) {\n throw new Error(`Plugin \"${plugin.id}\" does not have a onNamespaceLoaded() method`);\n }\n\n // Check cache first - try all namespaces\n let pluginCache = namespaceProcessCache.get(plugin);\n if (!pluginCache) {\n pluginCache = new Map();\n namespaceProcessCache.set(plugin, pluginCache);\n }\n\n // Try cached results first\n if (config.db) {\n for (const namespace of Object.keys(config.db)) {\n const dbConfig = config.db[namespace] as DbNamespaceConfig;\n if (dbConfig.external) continue;\n\n const cacheKey = getCacheKey(`namespace:ns=${namespace}`, pluginConfig);\n const cached = pluginCache.get(cacheKey);\n if (cached?.types?.[kind]) {\n return cached.types[kind] as TailorAnyDBType;\n }\n }\n }\n\n // Not in cache - resolve namespace and process\n const { namespace, output } = await resolveNamespaceForNamespacePlugin(\n config,\n plugin,\n kind,\n pluginConfig,\n );\n\n const cacheKey = getCacheKey(`namespace:ns=${namespace}`, pluginConfig);\n pluginCache.set(cacheKey, output);\n\n const generatedType = output.types?.[kind];\n if (!generatedType) {\n throw new Error(`Generated type not found: plugin=${plugin.id}, kind=${kind}`);\n }\n\n return generatedType as TailorAnyDBType;\n}\n\n/**\n * Clear all internal caches. For testing only.\n */\nexport function _clearCacheForTesting(): void {\n configCacheMap.clear();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiHA,SAAgB,kBACd,SAC4B;CAC5B,OAAO;AACT;;;;;AC/FA,MAAM,iCAAiB,IAAI,IAAyB;;;;;;AAOpD,SAAS,SAAS,OAAiC;CACjD,OACE,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAAkC,OAAO,YACjD,OAAQ,MAAkC,gBAAgB;AAE9D;;;;;;;;AASA,eAAe,mBAAmB,YAAiD;CACjF,MAAM,eAAe,KAAK,QAAQ,UAAU;CAE5C,MAAM,SAAS,eAAe,IAAI,YAAY;CAC9C,IAAI,QAAQ,OAAO;CAGnB,IAAI,CAAC,GAAG,WAAW,YAAY,GAC7B,OAAO;CAGT,MAAM,eAAe,MAAM,OAAO,cAAc,YAAY,CAAC,CAAC;CAC9D,IAAI,CAAC,cAAc,SACjB,MAAM,IAAI,MAAM,6BAA6B,aAAa,4BAA4B;CAGxF,MAAM,SAAS,aAAa;CAC5B,MAAM,YAAY,KAAK,QAAQ,YAAY;CAC3C,MAAM,0BAAU,IAAI,IAAyB;CAG7C,KAAK,MAAM,SAAS,OAAO,OAAO,YAAY,GAAG;EAC/C,IAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;EAE3B,KAAK,MAAM,QAAQ,OACjB,IAAI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,MAAM,MAAM,EAAE,aAAa,OAAO,EAAE,CAAC,EAAE;EAC7E,SAAS,MAAM,OAAO,aAAa;GACjC,MAAM;GACN,YAAY,cAAc,CAAC;GAC3B;GACA;EACF,CAAC;EACD,YAAY,IAAI,UAAU,MAAM;CAClC;CAEA,MAAM,gBAAgB,OAAO,QAAQ;CACrC,IAAI,CAAC,eACH,MAAM,IAAI,MACR,oCAAoC,OAAO,GAAG,eAAe,WAAW,KAAK,SAAS,MACxF;CAGF,OAAO;AACT;;;;;;;;;;;AAYA,eAAe,mCACb,QACA,QACA,MACA,cAC0B;CAC1B,IAAI,CAAC,OAAO,mBACV,MAAM,IAAI,MAAM,WAAW,OAAO,GAAG,6CAA6C;CAIpF,IAAI,cAAc,sBAAsB,IAAI,MAAM;CAClD,IAAI,CAAC,aAAa;EAChB,8BAAc,IAAI,IAAI;EACtB,sBAAsB,IAAI,QAAQ,WAAW;CAC/C;CAGA,IAAI,OAAO,IACT,KAAK,MAAM,aAAa,OAAO,KAAK,OAAO,EAAE,GAAG;EAE9C,IADiB,OAAO,GAAG,UACf,CAAC,UAAU;EAEvB,MAAM,WAAW,YAAY,gBAAgB,aAAa,YAAY;EACtE,MAAM,SAAS,YAAY,IAAI,QAAQ;EACvC,IAAI,QAAQ,QAAQ,OAClB,OAAO,OAAO,MAAM;CAExB;CAIF,MAAM,EAAE,WAAW,WAAW,MAAM,mCAClC,QACA,QACA,MACA,YACF;CAEA,MAAM,WAAW,YAAY,gBAAgB,aAAa,YAAY;CACtE,YAAY,IAAI,UAAU,MAAM;CAEhC,MAAM,gBAAgB,OAAO,QAAQ;CACrC,IAAI,CAAC,eACH,MAAM,IAAI,MAAM,oCAAoC,OAAO,GAAG,SAAS,MAAM;CAG/E,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/plugin/with-context.ts","../../src/plugin/get-generated-type.ts"],"sourcesContent":["/**\n * Plugin executor context support for defining plugin executors in separate files.\n * This module provides utilities for creating type-safe plugin executors that receive\n * context (like type references and namespace) at runtime.\n */\n\nimport type { TailorEnv, TailorPrincipal } from \"@/runtime/types\";\n\n/**\n * Plugin executor factory function type.\n * Takes context and returns an executor configuration.\n * Returns unknown since the exact return type depends on createExecutor's generic params.\n */\nexport type PluginExecutorFactory<Ctx> = (ctx: Ctx) => unknown;\n\n// ============================================================================\n// Plugin Executor Args Types\n// ============================================================================\n\n/**\n * Base args for plugin executor function operations.\n * Provides typed access to runtime context without requiring specific record types.\n */\nexport interface PluginFunctionArgs {\n /** Workspace ID where the executor runs */\n workspaceId: string;\n /** Application namespace */\n appNamespace: string;\n /** Environment variables */\n env: TailorEnv;\n /** Principal that triggered the event, null for system events */\n actor: TailorPrincipal | null;\n /** Name of the TailorDB type */\n typeName: string;\n /** TailorDB connections by namespace */\n tailordb: Record<string, unknown>;\n}\n\n/**\n * Args for plugin executors triggered on record creation.\n */\nexport interface PluginRecordCreatedArgs extends PluginFunctionArgs {\n /** The newly created record */\n newRecord: Record<string, unknown>;\n}\n\n/**\n * Args for plugin executors triggered on record update.\n */\nexport interface PluginRecordUpdatedArgs extends PluginFunctionArgs {\n /** The record after update */\n newRecord: Record<string, unknown>;\n /** The record before update */\n oldRecord: Record<string, unknown>;\n}\n\n/**\n * Args for plugin executors triggered on record deletion.\n */\nexport interface PluginRecordDeletedArgs extends PluginFunctionArgs {\n /** The deleted record */\n oldRecord: Record<string, unknown>;\n}\n\n/**\n * Database schema type for plugins.\n * Since plugins work with dynamic types, the schema uses Record types.\n */\nexport type PluginDBSchema = Record<string, Record<string, unknown>>;\n\n/**\n * Base record type for TailorDB records.\n * All records have an id field.\n */\nexport type PluginRecord = { id: string } & Record<string, unknown>;\n\n/**\n * Define a plugin executor that receives context at runtime.\n * This allows executor definitions to be in separate files while\n * still receiving dynamic values like typeName, generated types, and namespace.\n * @param factory - Function that takes context and returns executor configuration\n * @returns The same factory function (for type inference)\n * @example\n * ```typescript\n * // executors/on-create.ts\n * import { withPluginContext } from \"@tailor-platform/sdk/plugin\";\n * import { createExecutor, recordCreatedTrigger } from \"@tailor-platform/sdk\";\n * import { getDB } from \"@tailor-platform/function-kysely-tailordb\";\n *\n * interface MyContext {\n * sourceType: TailorAnyDBType;\n * historyType: TailorAnyDBType;\n * namespace: string;\n * }\n *\n * export default withPluginContext<MyContext>((ctx) =>\n * createExecutor({\n * name: `${ctx.sourceType.name.toLowerCase()}-on-create`,\n * trigger: recordCreatedTrigger({ type: ctx.sourceType }),\n * operation: {\n * kind: \"function\",\n * body: async (args) => {\n * const db = getDB(ctx.namespace);\n * await db.insertInto(ctx.historyType.name).values({\n * recordId: args.newRecord.id,\n * // ...\n * }).execute();\n * },\n * },\n * })\n * );\n * ```\n */\nexport function withPluginContext<Ctx>(\n factory: PluginExecutorFactory<Ctx>,\n): PluginExecutorFactory<Ctx> {\n return factory;\n}\n","import * as fs from \"node:fs\";\nimport { pathToFileURL } from \"node:url\";\nimport * as path from \"pathe\";\nimport type { TailorAnyDBType } from \"@/configure/services/tailordb/types\";\nimport type { Plugin, PluginOutput, TypePluginOutput } from \"@/plugin/types\";\n\n// ========================================\n// Config loading and caching\n// ========================================\n\ninterface PluginEntry {\n plugin: Plugin;\n pluginConfig: unknown;\n}\n\ninterface ConfigCache {\n config: { db?: Record<string, unknown> };\n plugins: Map<string, PluginEntry>;\n configDir: string;\n}\n\n/** Cache: resolved config path -> loaded config data */\nconst configCacheMap = new Map<string, ConfigCache>();\n\n/**\n * Check if a value is a Plugin instance.\n * @param value - Value to check\n * @returns True if value has the shape of Plugin\n */\nfunction isPlugin(value: unknown): value is Plugin {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as Record<string, unknown>).id === \"string\" &&\n typeof (value as Record<string, unknown>).description === \"string\"\n );\n}\n\n/**\n * Load and cache config module from the given path.\n * Extracts plugins from all array exports using definePlugins() format.\n * Returns null if the config file does not exist (e.g., in bundled executor on platform server).\n * @param configPath - Absolute or relative path to tailor.config.ts\n * @returns Cached config data with plugins map, or null if config file is not available\n */\nasync function loadAndCacheConfig(configPath: string): Promise<ConfigCache | null> {\n const resolvedPath = path.resolve(configPath);\n\n const cached = configCacheMap.get(resolvedPath);\n if (cached) return cached;\n\n // Config file may not exist in bundled environments (e.g., platform server)\n if (!fs.existsSync(resolvedPath)) {\n return null;\n }\n\n const configModule = await import(pathToFileURL(resolvedPath).href);\n if (!configModule?.default) {\n throw new Error(`Invalid config module at \"${resolvedPath}\": default export not found`);\n }\n\n const config = configModule.default as { db?: Record<string, unknown> };\n const configDir = path.dirname(resolvedPath);\n const plugins = new Map<string, PluginEntry>();\n\n // Find plugin arrays from exports (definePlugins returns PluginConfig[])\n for (const value of Object.values(configModule)) {\n if (!Array.isArray(value)) continue;\n\n for (const item of value) {\n if (isPlugin(item)) {\n plugins.set(item.id, { plugin: item, pluginConfig: item.pluginConfig });\n }\n }\n }\n\n const result: ConfigCache = { config, plugins, configDir };\n configCacheMap.set(resolvedPath, result);\n return result;\n}\n\n// ========================================\n// Namespace resolution\n// ========================================\n\ninterface DbNamespaceConfig {\n files?: string[];\n external?: boolean;\n}\n\n/**\n * Resolve the namespace for a type-attached sourceType by checking config.db file patterns.\n * Uses ESM module cache identity: same file path yields same object references.\n * @param config - App config with db namespace definitions\n * @param config.db - DB namespace definitions\n * @param configDir - Directory containing the config file\n * @param sourceType - The TailorDB type to look up\n * @returns The namespace name\n */\nasync function resolveNamespaceForType(\n config: { db?: Record<string, unknown> },\n configDir: string,\n sourceType: TailorAnyDBType,\n): Promise<string> {\n if (!config.db) {\n throw new Error(`No db configuration found in config`);\n }\n\n for (const [namespace, nsConfig] of Object.entries(config.db)) {\n const dbConfig = nsConfig as DbNamespaceConfig;\n // Skip external namespaces (no files to resolve)\n if (dbConfig.external || !dbConfig.files) continue;\n\n for (const pattern of dbConfig.files) {\n const absolutePattern = path.resolve(configDir, pattern);\n let matchedFiles: string[];\n try {\n matchedFiles = fs.globSync(absolutePattern);\n } catch {\n continue;\n }\n\n for (const file of matchedFiles) {\n const mod = await import(pathToFileURL(file).href);\n for (const exported of Object.values(mod)) {\n if (exported === sourceType) {\n return namespace;\n }\n }\n }\n }\n }\n\n throw new Error(\n `Could not resolve namespace for type \"${sourceType.name}\". ` +\n `Ensure the type file is included in a db namespace's files pattern.`,\n );\n}\n\n/**\n * Resolve the namespace for a namespace plugin by trying each namespace.\n * Calls onNamespaceLoaded() for each and returns the first whose output contains the requested kind.\n * @param config - App config with db namespace definitions\n * @param config.db - DB namespace definitions\n * @param plugin - Plugin instance\n * @param kind - The generated type kind to look for\n * @param pluginConfig - Plugin-level configuration\n * @returns The namespace name\n */\nasync function resolveNamespaceForNamespacePlugin(\n config: { db?: Record<string, unknown> },\n plugin: Plugin,\n kind: string,\n pluginConfig: unknown,\n): Promise<{ namespace: string; output: PluginOutput }> {\n if (!config.db) {\n throw new Error(`No db configuration found in config`);\n }\n\n if (!plugin.onNamespaceLoaded) {\n throw new Error(`Plugin \"${plugin.id}\" does not have a onNamespaceLoaded() method`);\n }\n\n for (const namespace of Object.keys(config.db)) {\n const dbConfig = config.db[namespace] as DbNamespaceConfig;\n if (dbConfig.external) continue;\n\n const output = await plugin.onNamespaceLoaded({\n pluginConfig,\n namespace,\n });\n\n if (output.types?.[kind]) {\n return { namespace, output };\n }\n }\n\n throw new Error(\n `Could not resolve namespace for plugin \"${plugin.id}\" with kind \"${kind}\". ` +\n `No namespace produced a type with that kind.`,\n );\n}\n\n// ========================================\n// Process caching\n// ========================================\n\n// Cache: plugin -> cacheKey -> TypePluginOutput\nconst processCache = new WeakMap<Plugin, Map<string, TypePluginOutput>>();\n\n// Cache for namespace plugins: plugin -> cacheKey -> PluginOutput\nconst namespaceProcessCache = new WeakMap<Plugin, Map<string, PluginOutput>>();\n\n/**\n * Generate a cache key that includes pluginConfig.\n * @param baseKey - Base key for the cache\n * @param pluginConfig - Plugin configuration to include in the key\n * @returns Cache key string\n */\nfunction getCacheKey(baseKey: string, pluginConfig: unknown): string {\n if (pluginConfig === undefined) {\n return baseKey;\n }\n try {\n return `${baseKey}:${JSON.stringify(pluginConfig)}`;\n } catch {\n throw new Error(\n `pluginConfig must be JSON-serializable for caching. Received non-serializable value.`,\n );\n }\n}\n\n// ========================================\n// Main API\n// ========================================\n\n/**\n * Get a generated type from a plugin by loading the config and resolving everything automatically.\n * For type-attached plugins, calls onTypeLoaded() with the sourceType.\n * For namespace plugins, calls onNamespaceLoaded() with auto-resolved namespace.\n * Results are cached per config path, plugin, namespace, and pluginConfig to avoid redundant processing.\n * @param configPath - Path to tailor.config.ts (absolute or relative to cwd)\n * @param pluginId - The plugin's unique identifier\n * @param sourceType - The source TailorDB type (null for namespace plugins)\n * @param kind - The generated type kind (e.g., \"request\", \"step\")\n * @returns The generated TailorDB type\n */\nexport async function getGeneratedType(\n configPath: string,\n pluginId: string,\n sourceType: TailorAnyDBType | null,\n kind: string,\n): Promise<TailorAnyDBType> {\n const cache = await loadAndCacheConfig(configPath);\n\n if (!cache) {\n // Config not available (e.g., running in bundled executor on platform server).\n // Return a placeholder. The actual type is resolved at generate/apply time.\n return { name: `__placeholder_${kind}__`, fields: {} } as TailorAnyDBType;\n }\n\n const { config, configDir, plugins } = cache;\n\n const pluginEntry = plugins.get(pluginId);\n if (!pluginEntry) {\n throw new Error(\n `Plugin \"${pluginId}\" not found in config at \"${configPath}\". ` +\n `Ensure the plugin is registered via definePlugins().`,\n );\n }\n\n const { plugin, pluginConfig } = pluginEntry;\n\n if (sourceType === null) {\n return getGeneratedTypeForNamespacePlugin(config, plugin, kind, pluginConfig);\n }\n\n const namespace = await resolveNamespaceForType(config, configDir, sourceType);\n return getGeneratedTypeForTypeAttachedPlugin(plugin, sourceType, kind, pluginConfig, namespace);\n}\n\n/**\n * Get a generated type from a type-attached plugin.\n * @param plugin - The plugin instance (must have onTypeLoaded() method)\n * @param sourceType - The source TailorDB type\n * @param kind - The generated type kind\n * @param pluginConfig - Plugin-level configuration\n * @param namespace - Resolved namespace\n * @returns The generated TailorDB type\n */\nasync function getGeneratedTypeForTypeAttachedPlugin(\n plugin: Plugin,\n sourceType: TailorAnyDBType,\n kind: string,\n pluginConfig: unknown,\n namespace: string,\n): Promise<TailorAnyDBType> {\n if (!plugin.onTypeLoaded) {\n throw new Error(`Plugin \"${plugin.id}\" does not have a onTypeLoaded() method`);\n }\n\n // Check cache first\n let pluginCache = processCache.get(plugin);\n if (!pluginCache) {\n pluginCache = new Map();\n processCache.set(plugin, pluginCache);\n }\n\n const cacheKey = getCacheKey(`${sourceType.name}:ns=${namespace}`, pluginConfig);\n let output = pluginCache.get(cacheKey);\n\n if (!output) {\n const typeConfig = sourceType.plugins.find((p) => p.pluginId === plugin.id)?.config;\n output = await plugin.onTypeLoaded({\n type: sourceType,\n typeConfig: typeConfig ?? {},\n pluginConfig,\n namespace,\n });\n pluginCache.set(cacheKey, output);\n }\n\n const generatedType = output.types?.[kind];\n if (!generatedType) {\n throw new Error(\n `Generated type not found: plugin=${plugin.id}, sourceType=${sourceType.name}, kind=${kind}`,\n );\n }\n\n return generatedType as TailorAnyDBType;\n}\n\n/**\n * Get a generated type from a namespace plugin.\n * Auto-resolves the namespace by trying each one.\n * @param config - App config with db namespace definitions\n * @param config.db - DB namespace definitions\n * @param plugin - The plugin instance (must have onNamespaceLoaded() method)\n * @param kind - The generated type kind\n * @param pluginConfig - Plugin-level configuration\n * @returns The generated TailorDB type\n */\nasync function getGeneratedTypeForNamespacePlugin(\n config: { db?: Record<string, unknown> },\n plugin: Plugin,\n kind: string,\n pluginConfig: unknown,\n): Promise<TailorAnyDBType> {\n if (!plugin.onNamespaceLoaded) {\n throw new Error(`Plugin \"${plugin.id}\" does not have a onNamespaceLoaded() method`);\n }\n\n // Check cache first - try all namespaces\n let pluginCache = namespaceProcessCache.get(plugin);\n if (!pluginCache) {\n pluginCache = new Map();\n namespaceProcessCache.set(plugin, pluginCache);\n }\n\n // Try cached results first\n if (config.db) {\n for (const namespace of Object.keys(config.db)) {\n const dbConfig = config.db[namespace] as DbNamespaceConfig;\n if (dbConfig.external) continue;\n\n const cacheKey = getCacheKey(`namespace:ns=${namespace}`, pluginConfig);\n const cached = pluginCache.get(cacheKey);\n if (cached?.types?.[kind]) {\n return cached.types[kind] as TailorAnyDBType;\n }\n }\n }\n\n // Not in cache - resolve namespace and process\n const { namespace, output } = await resolveNamespaceForNamespacePlugin(\n config,\n plugin,\n kind,\n pluginConfig,\n );\n\n const cacheKey = getCacheKey(`namespace:ns=${namespace}`, pluginConfig);\n pluginCache.set(cacheKey, output);\n\n const generatedType = output.types?.[kind];\n if (!generatedType) {\n throw new Error(`Generated type not found: plugin=${plugin.id}, kind=${kind}`);\n }\n\n return generatedType as TailorAnyDBType;\n}\n\n/**\n * Clear all internal caches. For testing only.\n */\nexport function _clearCacheForTesting(): void {\n configCacheMap.clear();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiHA,SAAgB,kBACd,SAC4B;CAC5B,OAAO;AACT;;;;;AC/FA,MAAM,iCAAiB,IAAI,IAAyB;;;;;;AAOpD,SAAS,SAAS,OAAiC;CACjD,OACE,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAAkC,OAAO,YACjD,OAAQ,MAAkC,gBAAgB;AAE9D;;;;;;;;AASA,eAAe,mBAAmB,YAAiD;CACjF,MAAM,eAAe,KAAK,QAAQ,UAAU;CAE5C,MAAM,SAAS,eAAe,IAAI,YAAY;CAC9C,IAAI,QAAQ,OAAO;CAGnB,IAAI,CAAC,GAAG,WAAW,YAAY,GAC7B,OAAO;CAGT,MAAM,eAAe,MAAM,OAAO,cAAc,YAAY,CAAC,CAAC;CAC9D,IAAI,CAAC,cAAc,SACjB,MAAM,IAAI,MAAM,6BAA6B,aAAa,4BAA4B;CAGxF,MAAM,SAAS,aAAa;CAC5B,MAAM,YAAY,KAAK,QAAQ,YAAY;CAC3C,MAAM,0BAAU,IAAI,IAAyB;CAG7C,KAAK,MAAM,SAAS,OAAO,OAAO,YAAY,GAAG;EAC/C,IAAI,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flow().triggerJobFunction(name, args);
|
|
44
44
|
}
|
|
45
45
|
function dispatchTriggerWorkflow(name, args, options) {
|
|
46
|
-
|
|
46
|
+
const workflow = requirePlatformWorkflow();
|
|
47
|
+
if (options?.invoker === void 0) return workflow.triggerWorkflow(name, args);
|
|
48
|
+
return workflow.triggerWorkflow(name, args, { authInvoker: options.invoker });
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
//#endregion
|
|
50
52
|
export { registerJob as a, getRegisteredJob as i, dispatchTriggerJob as n, dispatchTriggerWorkflow as r, TRIGGER_DEFAULT as t };
|
|
51
|
-
//# sourceMappingURL=registry-
|
|
53
|
+
//# sourceMappingURL=registry-DH4m7eYo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-DH4m7eYo.mjs","names":[],"sources":["../src/configure/services/workflow/registry.ts"],"sourcesContent":["import type { TailorEnv, TailorPrincipal } from \"@/runtime/types\";\n\n/**\n * Body signature shared by workflow jobs at registry-write time.\n * The user's `createWorkflowJob`/`createWorkflow` body uses concrete types,\n * but the registry erases them for storage.\n */\nexport type RegisteredJobBody = (\n args: unknown,\n context: { env: TailorEnv; invoker: TailorPrincipal | null },\n) => unknown | Promise<unknown>;\n\nconst JOB_REGISTRY_KEY: unique symbol = Symbol.for(\"tailor-platform/sdk:job-registry\");\n\ntype PlatformWorkflow = {\n triggerWorkflow: (name: string, args?: unknown, options?: unknown) => Promise<string>;\n triggerJobFunction: (name: string, args?: unknown) => unknown;\n};\n\ntype GlobalWithRegistry = typeof globalThis & {\n [JOB_REGISTRY_KEY]?: Map<string, RegisteredJobBody>;\n tailor?: { workflow?: PlatformWorkflow };\n};\n\nfunction jobs(): Map<string, RegisteredJobBody> {\n const g = globalThis as GlobalWithRegistry;\n let map = g[JOB_REGISTRY_KEY];\n if (!map) {\n map = new Map();\n g[JOB_REGISTRY_KEY] = map;\n }\n return map;\n}\n\n/**\n * Register a job body keyed by job name. Called as a side effect by\n * `createWorkflowJob` so `runWorkflowLocally()` can execute dependent job\n * bodies when `globalThis.tailor.workflow.triggerJobFunction(name, args)` is invoked.\n *\n * In production builds the bundler rewrites `.trigger()` calls so this registry\n * is never read; the gated write is dropped as dead code.\n * @param name - Job name\n * @param body - Job body function\n */\nexport function registerJob(name: string, body: RegisteredJobBody): void {\n jobs().set(name, body);\n}\n\n/**\n * Look up a registered job body by name.\n * @param name - Job name\n * @returns The registered body, or undefined when no job is registered\n */\nexport function getRegisteredJob(name: string): RegisteredJobBody | undefined {\n return jobs().get(name);\n}\n\nfunction currentPlatformWorkflow(): PlatformWorkflow | undefined {\n // globalThis may not have the tailor property at runtime\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n return (globalThis as GlobalWithRegistry).tailor?.workflow;\n}\n\nfunction requirePlatformWorkflow(): PlatformWorkflow {\n const workflow = currentPlatformWorkflow();\n if (!workflow) {\n throw new Error(\n \"tailor.workflow is not available. Run tests in the `tailor-runtime` Vitest environment and use mockWorkflow(), or use runWorkflowLocally() from @tailor-platform/sdk/vitest for local workflow execution.\",\n );\n }\n return workflow;\n}\n\n// A valid placeholder UUID, so callers that validate the execution id behave the\n// same locally as against the platform.\nexport const TRIGGER_DEFAULT = \"00000000-0000-4000-8000-000000000000\";\n\n// `.trigger()` routes through the installed `tailor.workflow` shim. Local body\n// execution is intentionally available only through `runWorkflowLocally()`.\nexport function dispatchTriggerJob(name: string, args?: unknown): unknown {\n return requirePlatformWorkflow().triggerJobFunction(name, args);\n}\n\nexport function dispatchTriggerWorkflow(\n name: string,\n args?: unknown,\n options?: { invoker?: unknown },\n): Promise<string> {\n const workflow = requirePlatformWorkflow();\n if (options?.invoker === undefined) {\n return workflow.triggerWorkflow(name, args);\n }\n return workflow.triggerWorkflow(name, args, { authInvoker: options.invoker });\n}\n"],"mappings":";AAYA,MAAM,mBAAkC,OAAO,IAAI,kCAAkC;AAYrF,SAAS,OAAuC;CAC9C,MAAM,IAAI;CACV,IAAI,MAAM,EAAE;CACZ,IAAI,CAAC,KAAK;EACR,sBAAM,IAAI,IAAI;EACd,EAAE,oBAAoB;CACxB;CACA,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,YAAY,MAAc,MAA+B;CACvE,KAAK,CAAC,CAAC,IAAI,MAAM,IAAI;AACvB;;;;;;AAOA,SAAgB,iBAAiB,MAA6C;CAC5E,OAAO,KAAK,CAAC,CAAC,IAAI,IAAI;AACxB;AAEA,SAAS,0BAAwD;CAG/D,OAAQ,WAAkC,QAAQ;AACpD;AAEA,SAAS,0BAA4C;CACnD,MAAM,WAAW,wBAAwB;CACzC,IAAI,CAAC,UACH,MAAM,IAAI,MACR,2MACF;CAEF,OAAO;AACT;AAIA,MAAa,kBAAkB;AAI/B,SAAgB,mBAAmB,MAAc,MAAyB;CACxE,OAAO,wBAAwB,CAAC,CAAC,mBAAmB,MAAM,IAAI;AAChE;AAEA,SAAgB,wBACd,MACA,MACA,SACiB;CACjB,MAAM,WAAW,wBAAwB;CACzC,IAAI,SAAS,YAAY,QACvB,OAAO,SAAS,gBAAgB,MAAM,IAAI;CAE5C,OAAO,SAAS,gBAAgB,MAAM,MAAM,EAAE,aAAa,QAAQ,QAAQ,CAAC;AAC9E"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as getInvoker, n as Invoker, r as TailorContextAPI, t as ContextInvoker } from "../context-
|
|
1
|
+
import { a as getInvoker, n as Invoker, r as TailorContextAPI, t as ContextInvoker } from "../context-C2lEi9uw.mjs";
|
|
2
2
|
export { ContextInvoker, Invoker, TailorContextAPI, getInvoker };
|
package/dist/runtime/file.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { DownloadMetadata, FileDownloadAsBase64Response, FileDownloadResponse, FileDownloadStreamResponse, FileMetadata,
|
|
1
|
+
import { a as FileMetadata, b as uploadStream, c as FileUploadStreamOptions, d as TailorDBFileErrorCode, f as UploadMetadata, g as downloadStream, h as downloadAsBase64, i as FileDownloadStreamResponse, l as TailorDBFileAPI, m as download, n as FileDownloadAsBase64Response, o as FileUploadOptions, p as deleteFile, r as FileDownloadResponse, s as FileUploadResponse, t as DownloadMetadata, u as TailorDBFileError, v as getMetadata, y as upload } from "../file-Dq3NIt_F.mjs";
|
|
2
|
+
export { DownloadMetadata, FileDownloadAsBase64Response, FileDownloadResponse, FileDownloadStreamResponse, FileMetadata, FileUploadOptions, FileUploadResponse, FileUploadStreamOptions, TailorDBFileAPI, TailorDBFileError, TailorDBFileErrorCode, UploadMetadata, deleteFile as delete, deleteFile, download, downloadAsBase64, downloadStream, getMetadata, upload, uploadStream };
|
package/dist/runtime/file.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { c as
|
|
1
|
+
import { c as uploadStream, i as downloadStream, n as download, o as getMetadata, r as downloadAsBase64, s as upload, t as deleteFile } from "../file-BbdFGdMV.mjs";
|
|
2
2
|
|
|
3
|
-
export { deleteFile as delete, deleteFile, download, downloadAsBase64, downloadStream, getMetadata,
|
|
3
|
+
export { deleteFile as delete, deleteFile, download, downloadAsBase64, downloadStream, getMetadata, upload, uploadStream };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as ContextInvoker } from "../context-
|
|
2
|
-
import {
|
|
1
|
+
import { t as ContextInvoker } from "../context-C2lEi9uw.mjs";
|
|
2
|
+
import { d as TailorDBFileErrorCode } from "../file-Dq3NIt_F.mjs";
|
|
3
3
|
import { r as IconvInstance } from "../iconv-Co-TOPuH.mjs";
|
|
4
4
|
import { a as IdpClientInstance, c as SendPasswordResetEmailInput, d as User, f as UserQuery, n as ClientConfig, o as ListUsersOptions, r as CreateUserInput, s as ListUsersResponse, u as UpdateUserInput } from "../idp-DrhVrLmV.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { a as TailordbQueryResult, i as TailordbCommandType, o as TailordbRuntime, r as TailordbClientInstance, t as TailorRuntime } from "../index-
|
|
5
|
+
import { n as PlatformTriggerWorkflowOptions, t as Invoker } from "../workflow-BVy4XWjS.mjs";
|
|
6
|
+
import { a as TailordbQueryResult, i as TailordbCommandType, o as TailordbRuntime, r as TailordbClientInstance, t as TailorRuntime } from "../index-Cg8VKAdN.mjs";
|
|
7
7
|
|
|
8
8
|
//#region src/runtime/globals.d.ts
|
|
9
9
|
declare global {
|
|
@@ -29,8 +29,8 @@ declare global {
|
|
|
29
29
|
type SendPasswordResetEmailInput = SendPasswordResetEmailInput;
|
|
30
30
|
}
|
|
31
31
|
namespace workflow {
|
|
32
|
-
type
|
|
33
|
-
type TriggerWorkflowOptions =
|
|
32
|
+
type Invoker = Invoker;
|
|
33
|
+
type TriggerWorkflowOptions = PlatformTriggerWorkflowOptions;
|
|
34
34
|
}
|
|
35
35
|
namespace context {
|
|
36
36
|
type Invoker = ContextInvoker;
|
package/dist/runtime/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as authconnection_d_exports } from "../authconnection-DvUQAjQS.mjs";
|
|
2
|
-
import { i as context_d_exports } from "../context-
|
|
3
|
-
import {
|
|
2
|
+
import { i as context_d_exports } from "../context-C2lEi9uw.mjs";
|
|
3
|
+
import { _ as file_d_exports } from "../file-Dq3NIt_F.mjs";
|
|
4
4
|
import { u as iconv_d_exports } from "../iconv-Co-TOPuH.mjs";
|
|
5
5
|
import { p as idp_d_exports } from "../idp-DrhVrLmV.mjs";
|
|
6
6
|
import { i as secretmanager_d_exports } from "../secretmanager-B3n4KHfm.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import { a as TailordbQueryResult, i as TailordbCommandType, n as TailordbClientConstructor, o as TailordbRuntime, r as TailordbClientInstance, t as TailorRuntime } from "../index-
|
|
7
|
+
import { l as workflow_d_exports } from "../workflow-BVy4XWjS.mjs";
|
|
8
|
+
import { a as TailordbQueryResult, i as TailordbCommandType, n as TailordbClientConstructor, o as TailordbRuntime, r as TailordbClientInstance, t as TailorRuntime } from "../index-Cg8VKAdN.mjs";
|
|
9
9
|
export { TailorRuntime, TailordbClientConstructor, TailordbClientInstance, TailordbCommandType, TailordbQueryResult, TailordbRuntime, authconnection_d_exports as authconnection, context_d_exports as context, file_d_exports as file, iconv_d_exports as iconv, idp_d_exports as idp, secretmanager_d_exports as secretmanager, workflow_d_exports as workflow };
|
package/dist/runtime/index.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { s as iconv_exports } from "../iconv-D2vi8G36.mjs";
|
|
|
2
2
|
import { r as secretmanager_exports } from "../secretmanager-BVxw3ih_.mjs";
|
|
3
3
|
import { t as authconnection_exports } from "../authconnection-D2MhtTN5.mjs";
|
|
4
4
|
import { n as idp_exports } from "../idp-BDbK5gjm.mjs";
|
|
5
|
-
import { a as workflow_exports } from "../workflow-
|
|
5
|
+
import { a as workflow_exports } from "../workflow-BOmaZwwG.mjs";
|
|
6
6
|
import { t as context_exports } from "../context-Bd266-ru.mjs";
|
|
7
|
-
import { a as file_exports } from "../file-
|
|
7
|
+
import { a as file_exports } from "../file-BbdFGdMV.mjs";
|
|
8
8
|
|
|
9
9
|
export { authconnection_exports as authconnection, context_exports as context, file_exports as file, iconv_exports as iconv, idp_exports as idp, secretmanager_exports as secretmanager, workflow_exports as workflow };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export {
|
|
1
|
+
import { a as resolve, c as wait, i as TriggerWorkflowOptions, n as PlatformTriggerWorkflowOptions, o as triggerJobFunction, r as TailorWorkflowAPI, s as triggerWorkflow, t as Invoker } from "../workflow-BVy4XWjS.mjs";
|
|
2
|
+
export { Invoker, PlatformTriggerWorkflowOptions, TailorWorkflowAPI, TriggerWorkflowOptions, resolve, triggerJobFunction, triggerWorkflow, wait };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as wait, n as triggerJobFunction, r as triggerWorkflow, t as resolve } from "../workflow-
|
|
1
|
+
import { i as wait, n as triggerJobFunction, r as triggerWorkflow, t as resolve } from "../workflow-BOmaZwwG.mjs";
|
|
2
2
|
|
|
3
3
|
export { resolve, triggerJobFunction, triggerWorkflow, wait };
|