@tailor-platform/sdk 1.11.0 → 1.12.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 +34 -0
- package/dist/application-DM4zTgXU.mjs +4 -0
- package/dist/{application-BKBo5tGD.mjs → application-DnWZVbDO.mjs} +164 -26
- package/dist/application-DnWZVbDO.mjs.map +1 -0
- package/dist/cli/index.mjs +13 -19
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +149 -17
- package/dist/cli/lib.mjs +132 -4
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/configure/index.d.mts +4 -3
- package/dist/configure/index.mjs +16 -757
- package/dist/configure/index.mjs.map +1 -1
- package/dist/env-4RO7szrH.d.mts +66 -0
- package/dist/{index-D8zIUsWi.d.mts → index-BBr_q3vB.d.mts} +20 -11
- package/dist/{index-DcOTucF6.d.mts → index-Bid18Opo.d.mts} +473 -84
- package/dist/{jiti-ygK9KoRA.mjs → jiti-DuCiUfMj.mjs} +2 -2
- package/dist/{jiti-ygK9KoRA.mjs.map → jiti-DuCiUfMj.mjs.map} +1 -1
- package/dist/{job-l-pIR9IY.mjs → job-zGAXCidt.mjs} +1 -1
- package/dist/{job-l-pIR9IY.mjs.map → job-zGAXCidt.mjs.map} +1 -1
- package/dist/kysely/index.d.mts +25 -0
- package/dist/kysely/index.mjs +27 -0
- package/dist/kysely/index.mjs.map +1 -0
- package/dist/plugin/index.d.mts +105 -0
- package/dist/plugin/index.mjs +45 -0
- package/dist/plugin/index.mjs.map +1 -0
- package/dist/schema-BmKdDzr1.mjs +784 -0
- package/dist/schema-BmKdDzr1.mjs.map +1 -0
- package/dist/{src-CG8kJBI9.mjs → src-QNTCsO6J.mjs} +2 -2
- package/dist/{src-CG8kJBI9.mjs.map → src-QNTCsO6J.mjs.map} +1 -1
- package/dist/types-r-ZratAg.mjs +13 -0
- package/dist/types-r-ZratAg.mjs.map +1 -0
- package/dist/{update-D0muqqOP.mjs → update-B_W-UQnS.mjs} +1626 -390
- package/dist/update-B_W-UQnS.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/utils/test/index.mjs +1 -1
- package/docs/cli/tailordb.md +0 -12
- package/docs/generator/builtin.md +2 -2
- package/docs/plugin/custom.md +389 -0
- package/docs/plugin/index.md +112 -0
- package/docs/services/workflow.md +28 -0
- package/package.json +16 -23
- package/dist/application-BKBo5tGD.mjs.map +0 -1
- package/dist/application-a12-7TT3.mjs +0 -4
- package/dist/update-D0muqqOP.mjs.map +0 -1
- /package/dist/{chunk-CIV_ash9.mjs → chunk-C3Kl5s5P.mjs} +0 -0
package/dist/cli/lib.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference path="./../user-defined.d.ts" />
|
|
2
|
-
import { E as TailorDBType,
|
|
2
|
+
import { D as TypeSourceInfoEntry, E as TailorDBType, I as IdProviderConfig, Lt as Resolver, R as OAuth2ClientInput, ct as PluginBaseNamespace, lt as PluginBaseWithConfig, ot as PluginAttachment, p as Executor, r as AppConfig, st as PluginBase, t as Generator } from "../index-Bid18Opo.mjs";
|
|
3
3
|
import "politty";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { OAuth2Client } from "@badgateway/oauth2-client";
|
|
@@ -16902,6 +16902,53 @@ declare function initOperatorClient(accessToken: string): Promise<Client<_bufbui
|
|
|
16902
16902
|
};
|
|
16903
16903
|
}>>>;
|
|
16904
16904
|
//#endregion
|
|
16905
|
+
//#region src/parser/plugin-config/schema.d.ts
|
|
16906
|
+
/**
|
|
16907
|
+
* Creates a PluginConfigSchema for custom plugins
|
|
16908
|
+
* @returns Plugin config schema that validates and transforms PluginBase instances
|
|
16909
|
+
*/
|
|
16910
|
+
declare function createPluginConfigSchema(): z.core.$ZodBranded<z.ZodPipe<z.ZodUnion<readonly [z.ZodObject<{
|
|
16911
|
+
id: z.ZodString;
|
|
16912
|
+
description: z.ZodString;
|
|
16913
|
+
importPath: z.ZodString;
|
|
16914
|
+
configSchema: z.ZodOptional<z.ZodAny>;
|
|
16915
|
+
pluginConfigSchema: z.ZodOptional<z.ZodAny>;
|
|
16916
|
+
pluginConfig: z.ZodOptional<z.ZodAny>;
|
|
16917
|
+
process: z.ZodOptional<z.ZodAny>;
|
|
16918
|
+
processNamespace: z.ZodOptional<z.ZodAny>;
|
|
16919
|
+
}, z.core.$loose>, z.ZodTuple<[z.ZodObject<{
|
|
16920
|
+
id: z.ZodString;
|
|
16921
|
+
description: z.ZodString;
|
|
16922
|
+
importPath: z.ZodString;
|
|
16923
|
+
configSchema: z.ZodOptional<z.ZodAny>;
|
|
16924
|
+
pluginConfigSchema: z.ZodOptional<z.ZodAny>;
|
|
16925
|
+
pluginConfig: z.ZodOptional<z.ZodAny>;
|
|
16926
|
+
process: z.ZodOptional<z.ZodAny>;
|
|
16927
|
+
processNamespace: z.ZodOptional<z.ZodAny>;
|
|
16928
|
+
}, z.core.$loose>, z.ZodUnknown], null>]>, z.ZodTransform<PluginBaseWithConfig<unknown> | PluginBaseNamespace<unknown>, {
|
|
16929
|
+
[x: string]: unknown;
|
|
16930
|
+
id: string;
|
|
16931
|
+
description: string;
|
|
16932
|
+
importPath: string;
|
|
16933
|
+
configSchema?: any;
|
|
16934
|
+
pluginConfigSchema?: any;
|
|
16935
|
+
pluginConfig?: any;
|
|
16936
|
+
process?: any;
|
|
16937
|
+
processNamespace?: any;
|
|
16938
|
+
} | [{
|
|
16939
|
+
[x: string]: unknown;
|
|
16940
|
+
id: string;
|
|
16941
|
+
description: string;
|
|
16942
|
+
importPath: string;
|
|
16943
|
+
configSchema?: any;
|
|
16944
|
+
pluginConfigSchema?: any;
|
|
16945
|
+
pluginConfig?: any;
|
|
16946
|
+
process?: any;
|
|
16947
|
+
processNamespace?: any;
|
|
16948
|
+
}, unknown]>>, "Plugin", "out">;
|
|
16949
|
+
type PluginConfigSchemaType = ReturnType<typeof createPluginConfigSchema>;
|
|
16950
|
+
type Plugin = z.output<PluginConfigSchemaType>;
|
|
16951
|
+
//#endregion
|
|
16905
16952
|
//#region src/cli/config-loader.d.ts
|
|
16906
16953
|
/**
|
|
16907
16954
|
* Loaded configuration with resolved path
|
|
@@ -16910,13 +16957,14 @@ type LoadedConfig = AppConfig & {
|
|
|
16910
16957
|
path: string;
|
|
16911
16958
|
};
|
|
16912
16959
|
/**
|
|
16913
|
-
* Load Tailor configuration file and associated generators.
|
|
16960
|
+
* Load Tailor configuration file and associated generators and plugins.
|
|
16914
16961
|
* @param configPath - Optional explicit config path
|
|
16915
|
-
* @returns Loaded config and
|
|
16962
|
+
* @returns Loaded config, generators, plugins, and config path
|
|
16916
16963
|
*/
|
|
16917
16964
|
declare function loadConfig(configPath?: string): Promise<{
|
|
16918
16965
|
config: LoadedConfig;
|
|
16919
16966
|
generators: Generator[];
|
|
16967
|
+
plugins: Plugin[];
|
|
16920
16968
|
}>;
|
|
16921
16969
|
//#endregion
|
|
16922
16970
|
//#region src/cli/apply/index.d.ts
|
|
@@ -16936,12 +16984,6 @@ interface ApplyOptions {
|
|
|
16936
16984
|
*/
|
|
16937
16985
|
declare function apply(options?: ApplyOptions): Promise<void>;
|
|
16938
16986
|
//#endregion
|
|
16939
|
-
//#region src/cli/generator/options.d.ts
|
|
16940
|
-
type GenerateOptions = {
|
|
16941
|
-
configPath?: string;
|
|
16942
|
-
watch?: boolean;
|
|
16943
|
-
};
|
|
16944
|
-
//#endregion
|
|
16945
16987
|
//#region src/cli/generator/types.d.ts
|
|
16946
16988
|
interface GeneratedFile {
|
|
16947
16989
|
path: string;
|
|
@@ -16981,10 +17023,9 @@ interface TailorDBProcessMethods<T, Ts> {
|
|
|
16981
17023
|
processType(args: {
|
|
16982
17024
|
type: TailorDBType;
|
|
16983
17025
|
namespace: string;
|
|
16984
|
-
source:
|
|
16985
|
-
|
|
16986
|
-
|
|
16987
|
-
};
|
|
17026
|
+
source: TypeSourceInfoEntry;
|
|
17027
|
+
/** Plugin attachments configured on this type via .plugin() method */
|
|
17028
|
+
plugins: readonly PluginAttachment[];
|
|
16988
17029
|
}): T | Promise<T>;
|
|
16989
17030
|
processTailorDBNamespace?(args: {
|
|
16990
17031
|
namespace: string;
|
|
@@ -17064,6 +17105,12 @@ type TailorDBResolverGenerator<T = unknown, R = unknown, Ts = Record<string, T>,
|
|
|
17064
17105
|
/** Full generator (all dependencies) */
|
|
17065
17106
|
type FullCodeGenerator<T = unknown, R = unknown, E = unknown, Ts = Record<string, T>, Rs = Record<string, R>> = CodeGenerator<readonly ["tailordb", "resolver", "executor"], T, R, E, Ts, Rs>;
|
|
17066
17107
|
//#endregion
|
|
17108
|
+
//#region src/cli/generator/options.d.ts
|
|
17109
|
+
type GenerateOptions = {
|
|
17110
|
+
configPath?: string;
|
|
17111
|
+
watch?: boolean;
|
|
17112
|
+
};
|
|
17113
|
+
//#endregion
|
|
17067
17114
|
//#region src/cli/generator/index.d.ts
|
|
17068
17115
|
/**
|
|
17069
17116
|
* Run code generation using the Tailor configuration and generators.
|
|
@@ -17073,13 +17120,23 @@ type FullCodeGenerator<T = unknown, R = unknown, E = unknown, Ts = Record<string
|
|
|
17073
17120
|
declare function generate(options?: GenerateOptions): Promise<void>;
|
|
17074
17121
|
//#endregion
|
|
17075
17122
|
//#region src/cli/type-generator.d.ts
|
|
17123
|
+
/**
|
|
17124
|
+
* Options for generating user type definitions
|
|
17125
|
+
*/
|
|
17126
|
+
interface GenerateUserTypesOptions {
|
|
17127
|
+
/** Application config */
|
|
17128
|
+
config: AppConfig;
|
|
17129
|
+
/** Path to Tailor config file */
|
|
17130
|
+
configPath: string;
|
|
17131
|
+
/** Optional array of plugins to generate PluginConfigs for */
|
|
17132
|
+
plugins?: PluginBase[];
|
|
17133
|
+
}
|
|
17076
17134
|
/**
|
|
17077
17135
|
* Generate user type definitions from the app config and write them to disk.
|
|
17078
|
-
* @param
|
|
17079
|
-
* @param configPath - Path to Tailor config file
|
|
17136
|
+
* @param options - Generation options
|
|
17080
17137
|
* @returns Promise that resolves when types are generated
|
|
17081
17138
|
*/
|
|
17082
|
-
declare function generateUserTypes(
|
|
17139
|
+
declare function generateUserTypes(options: GenerateUserTypesOptions): Promise<void>;
|
|
17083
17140
|
//#endregion
|
|
17084
17141
|
//#region src/cli/show.d.ts
|
|
17085
17142
|
interface ShowOptions {
|
|
@@ -18034,6 +18091,55 @@ interface NamespaceWithMigrations {
|
|
|
18034
18091
|
*/
|
|
18035
18092
|
declare function getNamespacesWithMigrations(config: AppConfig, configDir: string): NamespaceWithMigrations[];
|
|
18036
18093
|
//#endregion
|
|
18094
|
+
//#region src/cli/utils/seed-chunker.d.ts
|
|
18095
|
+
/**
|
|
18096
|
+
* Seed data chunker for splitting large seed data into manageable message sizes.
|
|
18097
|
+
*
|
|
18098
|
+
* When seed data exceeds the gRPC message size limit, this module splits the data
|
|
18099
|
+
* into multiple chunks at type boundaries (or record boundaries for large types).
|
|
18100
|
+
*/
|
|
18101
|
+
/**
|
|
18102
|
+
* Seed data keyed by type name, with an array of records per type.
|
|
18103
|
+
*/
|
|
18104
|
+
type SeedData = Record<string, Record<string, unknown>[]>;
|
|
18105
|
+
/**
|
|
18106
|
+
* A single chunk of seed data with metadata for ordered execution.
|
|
18107
|
+
*/
|
|
18108
|
+
type SeedChunk = {
|
|
18109
|
+
data: SeedData;
|
|
18110
|
+
order: string[];
|
|
18111
|
+
index: number;
|
|
18112
|
+
total: number;
|
|
18113
|
+
};
|
|
18114
|
+
/**
|
|
18115
|
+
* Options for chunking seed data.
|
|
18116
|
+
*/
|
|
18117
|
+
type ChunkSeedDataOptions = {
|
|
18118
|
+
/** Seed data keyed by type name */
|
|
18119
|
+
data: SeedData;
|
|
18120
|
+
/** Ordered list of type names (dependency order) */
|
|
18121
|
+
order: string[];
|
|
18122
|
+
/** Byte size of the bundled seed script code */
|
|
18123
|
+
codeByteSize: number;
|
|
18124
|
+
/** Maximum gRPC message size in bytes (default: 3.5MB) */
|
|
18125
|
+
maxMessageSize?: number;
|
|
18126
|
+
};
|
|
18127
|
+
/**
|
|
18128
|
+
* Split seed data into chunks that fit within the gRPC message size limit.
|
|
18129
|
+
*
|
|
18130
|
+
* Algorithm:
|
|
18131
|
+
* 1. Calculate the available budget for the arg field (maxMessageSize - codeByteSize - overhead)
|
|
18132
|
+
* 2. If all data fits in one message, return a single chunk
|
|
18133
|
+
* 3. Otherwise, iterate through types in dependency order:
|
|
18134
|
+
* - If a type fits in the current chunk, add it
|
|
18135
|
+
* - If adding a type would exceed the budget, finalize the current chunk and start a new one
|
|
18136
|
+
* - If a single type exceeds the budget, split its records across multiple chunks
|
|
18137
|
+
* - If a single record exceeds the budget, throw an error
|
|
18138
|
+
* @param options - Chunking options
|
|
18139
|
+
* @returns Array of seed chunks
|
|
18140
|
+
*/
|
|
18141
|
+
declare function chunkSeedData(options: ChunkSeedDataOptions): SeedChunk[];
|
|
18142
|
+
//#endregion
|
|
18037
18143
|
//#region src/cli/bundler/seed/seed-bundler.d.ts
|
|
18038
18144
|
/**
|
|
18039
18145
|
* Seed script bundler for TailorDB seed data
|
|
@@ -18059,6 +18165,32 @@ type SeedBundleResult = {
|
|
|
18059
18165
|
*/
|
|
18060
18166
|
declare function bundleSeedScript(namespace: string, typeNames: string[]): Promise<SeedBundleResult>;
|
|
18061
18167
|
//#endregion
|
|
18168
|
+
//#region src/cli/bundler/migration/migration-bundler.d.ts
|
|
18169
|
+
/**
|
|
18170
|
+
* Migration script bundler for TailorDB migrations
|
|
18171
|
+
*
|
|
18172
|
+
* Bundles migration scripts to be executed via TestExecScript API
|
|
18173
|
+
*/
|
|
18174
|
+
interface MigrationBundleResult {
|
|
18175
|
+
namespace: string;
|
|
18176
|
+
migrationNumber: number;
|
|
18177
|
+
bundledCode: string;
|
|
18178
|
+
}
|
|
18179
|
+
/**
|
|
18180
|
+
* Bundle a single migration script
|
|
18181
|
+
*
|
|
18182
|
+
* Creates an entry that:
|
|
18183
|
+
* 1. Imports the migration script's main function
|
|
18184
|
+
* 2. Defines getDB() function inline
|
|
18185
|
+
* 3. Wraps migration in a transaction using getDB()
|
|
18186
|
+
* 4. Exports as main() for TestExecScript
|
|
18187
|
+
* @param {string} sourceFile - Path to the migration script file
|
|
18188
|
+
* @param {string} namespace - TailorDB namespace
|
|
18189
|
+
* @param {number} migrationNumber - Migration number
|
|
18190
|
+
* @returns {Promise<MigrationBundleResult>} Bundled migration result
|
|
18191
|
+
*/
|
|
18192
|
+
declare function bundleMigrationScript(sourceFile: string, namespace: string, migrationNumber: number): Promise<MigrationBundleResult>;
|
|
18193
|
+
//#endregion
|
|
18062
18194
|
//#region src/cli/utils/script-executor.d.ts
|
|
18063
18195
|
/**
|
|
18064
18196
|
* Options for script execution
|
|
@@ -18128,5 +18260,5 @@ declare function waitForExecution(client: OperatorClient, workspaceId: string, e
|
|
|
18128
18260
|
*/
|
|
18129
18261
|
declare function executeScript(options: ScriptExecutionOptions): Promise<ScriptExecutionResult>;
|
|
18130
18262
|
//#endregion
|
|
18131
|
-
export { type AggregateArgs, type ApiCallOptions, type ApiCallResult, type AppHealthInfo, type AppInfo, type ApplicationInfo, type ApplyOptions, type AuthInvoker, type BreakingChangeInfo, type CodeGenerator, type CreateWorkspaceOptions, DB_TYPES_FILE_NAME, DIFF_FILE_NAME, type DeleteWorkspaceOptions, type DependencyKind, type ExecutionWaitResult, type Executor, type ExecutorGenerator, type ExecutorInfo, type ExecutorInput, type ExecutorJobAttemptInfo, type ExecutorJobDetailInfo, type ExecutorJobInfo, type ExecutorJobListInfo, type ExecutorListInfo, type FullCodeGenerator, type FullInput, type GenerateOptions, type GeneratorResult, type HealthOptions as GetAppHealthOptions, type GetExecutorJobOptions, type GetExecutorOptions, type GetMachineUserTokenOptions, type GetOAuth2ClientOptions, type GetWorkflowExecutionOptions, type GetWorkflowExecutionResult, type GetWorkflowOptions, type GetWorkspaceOptions, INITIAL_SCHEMA_NUMBER, type InviteUserOptions, type ListAppsOptions, type ListExecutorJobsOptions, type ListExecutorsOptions, type ListMachineUsersOptions, type ListOAuth2ClientsOptions, type ListUsersOptions, type ListWebhookExecutorsOptions, type ListWorkflowExecutionsOptions, type ListWorkflowsOptions, type ListWorkspacesOptions, type LoadedConfig, MIGRATE_FILE_NAME, MIGRATION_LABEL_KEY, type MachineUserInfo, type MachineUserTokenInfo, type GenerateOptions$1 as MigrateGenerateOptions, type MigrationDiff, type MigrationInfo, type NamespaceWithMigrations, type OAuth2ClientCredentials, type OAuth2ClientInfo, type OperatorClient, type RemoveOptions, type RemoveUserOptions, type Resolver, type ResolverGenerator, type ResolverInput, type RestoreWorkspaceOptions, type ResumeWorkflowOptions, type ResumeWorkflowResultWithWait, SCHEMA_FILE_NAME, type SchemaSnapshot, type ScriptExecutionOptions, type ScriptExecutionResult, type SeedBundleResult, type ShowOptions, type SnapshotFieldConfig, type SnapshotType, type StartWorkflowOptions, type StartWorkflowResultWithWait, type TailorDBGenerator, type TailorDBInput, type TailorDBResolverGenerator, type TailorDBType, type TriggerExecutorOptions, type TriggerExecutorResult, type TruncateOptions, type UpdateUserOptions, type UserInfo, type WaitOptions, type WatchExecutorJobOptions, type WatchExecutorJobResult, type WebhookExecutorInfo, type WorkflowExecutionInfo, type WorkflowInfo, type WorkflowJobExecutionInfo, type WorkflowListInfo, type WorkspaceDetails, type WorkspaceInfo, apiCall, apply, bundleSeedScript, compareLocalTypesWithSnapshot, compareSnapshots, createSnapshotFromLocalTypes, createWorkspace, deleteWorkspace, executeScript, formatDiffSummary, formatMigrationDiff, generate, generateUserTypes, getAppHealth, getExecutor, getExecutorJob, getLatestMigrationNumber, getMachineUserToken, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNamespacesWithMigrations, getNextMigrationNumber, getOAuth2Client, getWorkflow, getWorkflowExecution, getWorkspace, hasChanges, initOperatorClient, inviteUser, listApps, listExecutorJobs, listExecutors, listMachineUsers, listOAuth2Clients, listUsers, listWebhookExecutors, listWorkflowExecutions, listWorkflows, listWorkspaces, loadAccessToken, loadConfig, loadWorkspaceId, generate$1 as migrateGenerate, reconstructSnapshotFromMigrations, remove, removeUser, restoreWorkspace, resumeWorkflow, show, startWorkflow, triggerExecutor, truncate, updateUser, waitForExecution, watchExecutorJob };
|
|
18263
|
+
export { type AggregateArgs, type ApiCallOptions, type ApiCallResult, type AppHealthInfo, type AppInfo, type ApplicationInfo, type ApplyOptions, type AuthInvoker, type BreakingChangeInfo, type ChunkSeedDataOptions, type CodeGenerator, type CreateWorkspaceOptions, DB_TYPES_FILE_NAME, DIFF_FILE_NAME, type DeleteWorkspaceOptions, type DependencyKind, type ExecutionWaitResult, type Executor, type ExecutorGenerator, type ExecutorInfo, type ExecutorInput, type ExecutorJobAttemptInfo, type ExecutorJobDetailInfo, type ExecutorJobInfo, type ExecutorJobListInfo, type ExecutorListInfo, type FullCodeGenerator, type FullInput, type GenerateOptions, type GeneratorResult, type HealthOptions as GetAppHealthOptions, type GetExecutorJobOptions, type GetExecutorOptions, type GetMachineUserTokenOptions, type GetOAuth2ClientOptions, type GetWorkflowExecutionOptions, type GetWorkflowExecutionResult, type GetWorkflowOptions, type GetWorkspaceOptions, INITIAL_SCHEMA_NUMBER, type InviteUserOptions, type ListAppsOptions, type ListExecutorJobsOptions, type ListExecutorsOptions, type ListMachineUsersOptions, type ListOAuth2ClientsOptions, type ListUsersOptions, type ListWebhookExecutorsOptions, type ListWorkflowExecutionsOptions, type ListWorkflowsOptions, type ListWorkspacesOptions, type LoadedConfig, MIGRATE_FILE_NAME, MIGRATION_LABEL_KEY, type MachineUserInfo, type MachineUserTokenInfo, type GenerateOptions$1 as MigrateGenerateOptions, type MigrationBundleResult, type MigrationDiff, type MigrationInfo, type NamespaceWithMigrations, type OAuth2ClientCredentials, type OAuth2ClientInfo, type OperatorClient, type PluginAttachment, type RemoveOptions, type RemoveUserOptions, type Resolver, type ResolverGenerator, type ResolverInput, type RestoreWorkspaceOptions, type ResumeWorkflowOptions, type ResumeWorkflowResultWithWait, SCHEMA_FILE_NAME, type SchemaSnapshot, type ScriptExecutionOptions, type ScriptExecutionResult, type SeedBundleResult, type SeedChunk, type ShowOptions, type SnapshotFieldConfig, type SnapshotType, type StartWorkflowOptions, type StartWorkflowResultWithWait, type TailorDBGenerator, type TailorDBInput, type TailorDBResolverGenerator, type TailorDBType, type TriggerExecutorOptions, type TriggerExecutorResult, type TruncateOptions, type TypeSourceInfoEntry, type UpdateUserOptions, type UserInfo, type WaitOptions, type WatchExecutorJobOptions, type WatchExecutorJobResult, type WebhookExecutorInfo, type WorkflowExecutionInfo, type WorkflowInfo, type WorkflowJobExecutionInfo, type WorkflowListInfo, type WorkspaceDetails, type WorkspaceInfo, apiCall, apply, bundleMigrationScript, bundleSeedScript, chunkSeedData, compareLocalTypesWithSnapshot, compareSnapshots, createSnapshotFromLocalTypes, createWorkspace, deleteWorkspace, executeScript, formatDiffSummary, formatMigrationDiff, generate, generateUserTypes, getAppHealth, getExecutor, getExecutorJob, getLatestMigrationNumber, getMachineUserToken, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNamespacesWithMigrations, getNextMigrationNumber, getOAuth2Client, getWorkflow, getWorkflowExecution, getWorkspace, hasChanges, initOperatorClient, inviteUser, listApps, listExecutorJobs, listExecutors, listMachineUsers, listOAuth2Clients, listUsers, listWebhookExecutors, listWorkflowExecutions, listWorkflows, listWorkspaces, loadAccessToken, loadConfig, loadWorkspaceId, generate$1 as migrateGenerate, reconstructSnapshotFromMigrations, remove, removeUser, restoreWorkspace, resumeWorkflow, show, startWorkflow, triggerExecutor, truncate, updateUser, waitForExecution, watchExecutorJob };
|
|
18132
18264
|
//# sourceMappingURL=lib.d.mts.map
|
package/dist/cli/lib.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import "../chunk-
|
|
2
|
-
import
|
|
3
|
-
import { u as
|
|
1
|
+
import "../chunk-C3Kl5s5P.mjs";
|
|
2
|
+
import "../schema-BmKdDzr1.mjs";
|
|
3
|
+
import { $t as initOperatorClient, At as getMigrationFiles, B as getMachineUserToken, Bt as generateUserTypes, Ct as compareLocalTypesWithSnapshot, D as truncate, Dt as getLatestMigrationNumber, E as listWorkflows, Ft as formatDiffSummary, Ht as getDistDir, It as formatMigrationDiff, K as listWebhookExecutors, Kt as loadAccessToken, L as listOAuth2Clients, Lt as hasChanges, M as show, Ot as getMigrationDirPath, P as remove, Pt as reconstructSnapshotFromMigrations, Q as getExecutorJob, Rt as getNamespacesWithMigrations, St as SCHEMA_FILE_NAME, Tt as createSnapshotFromLocalTypes, U as listMachineUsers, Ut as apiCall, Vt as loadConfig, W as generate, Y as triggerExecutor, Z as listExecutors, _t as bundleMigrationScript, at as getWorkflow, bt as INITIAL_SCHEMA_NUMBER, c as inviteUser, ct as listWorkflowExecutions, dt as apply, et as listExecutorJobs, f as listWorkspaces, g as deleteWorkspace, ht as MIGRATION_LABEL_KEY, i as removeUser, jt as getNextMigrationNumber, k as generate$1, kt as getMigrationFilePath, m as getWorkspace, mt as waitForExecution, n as updateUser, o as listUsers, pt as executeScript, qt as loadWorkspaceId, rt as startWorkflow, st as getWorkflowExecution, tt as watchExecutorJob, u as restoreWorkspace, ut as getExecutor, v as createWorkspace, vt as DB_TYPES_FILE_NAME, w as resumeWorkflow, wt as compareSnapshots, x as getAppHealth, xt as MIGRATE_FILE_NAME, y as listApps, yt as DIFF_FILE_NAME, z as getOAuth2Client } from "../update-B_W-UQnS.mjs";
|
|
4
|
+
import { d as logger } from "../application-DnWZVbDO.mjs";
|
|
4
5
|
import { createRequire, register } from "node:module";
|
|
5
6
|
import * as fs$1 from "node:fs";
|
|
6
7
|
import * as path from "pathe";
|
|
@@ -8,6 +9,133 @@ import { resolveTSConfig } from "pkg-types";
|
|
|
8
9
|
import ml from "multiline-ts";
|
|
9
10
|
import * as rolldown from "rolldown";
|
|
10
11
|
|
|
12
|
+
//#region src/cli/utils/seed-chunker.ts
|
|
13
|
+
/** Default maximum message size: 3.5MB (conservative limit for gRPC) */
|
|
14
|
+
const DEFAULT_MAX_MESSAGE_SIZE = 3.5 * 1024 * 1024;
|
|
15
|
+
/** Reserved bytes for message metadata overhead */
|
|
16
|
+
const METADATA_OVERHEAD = 1024;
|
|
17
|
+
/**
|
|
18
|
+
* Split seed data into chunks that fit within the gRPC message size limit.
|
|
19
|
+
*
|
|
20
|
+
* Algorithm:
|
|
21
|
+
* 1. Calculate the available budget for the arg field (maxMessageSize - codeByteSize - overhead)
|
|
22
|
+
* 2. If all data fits in one message, return a single chunk
|
|
23
|
+
* 3. Otherwise, iterate through types in dependency order:
|
|
24
|
+
* - If a type fits in the current chunk, add it
|
|
25
|
+
* - If adding a type would exceed the budget, finalize the current chunk and start a new one
|
|
26
|
+
* - If a single type exceeds the budget, split its records across multiple chunks
|
|
27
|
+
* - If a single record exceeds the budget, throw an error
|
|
28
|
+
* @param options - Chunking options
|
|
29
|
+
* @returns Array of seed chunks
|
|
30
|
+
*/
|
|
31
|
+
function chunkSeedData(options) {
|
|
32
|
+
const { data, order, codeByteSize, maxMessageSize = DEFAULT_MAX_MESSAGE_SIZE } = options;
|
|
33
|
+
const argBudget = maxMessageSize - codeByteSize - METADATA_OVERHEAD;
|
|
34
|
+
if (argBudget <= 0) throw new Error(`Code size (${codeByteSize} bytes) exceeds the message size limit (${maxMessageSize} bytes). No space left for seed data.`);
|
|
35
|
+
const typesWithData = order.filter((type) => data[type] && data[type].length > 0);
|
|
36
|
+
if (typesWithData.length === 0) return [];
|
|
37
|
+
if (byteSize(JSON.stringify({
|
|
38
|
+
data,
|
|
39
|
+
order
|
|
40
|
+
})) <= argBudget) return [{
|
|
41
|
+
data,
|
|
42
|
+
order,
|
|
43
|
+
index: 0,
|
|
44
|
+
total: 1
|
|
45
|
+
}];
|
|
46
|
+
const chunks = [];
|
|
47
|
+
let currentData = {};
|
|
48
|
+
let currentOrder = [];
|
|
49
|
+
for (const type of typesWithData) {
|
|
50
|
+
const typeRecords = data[type];
|
|
51
|
+
if (currentOrder.length > 0) {
|
|
52
|
+
const testData = {
|
|
53
|
+
...currentData,
|
|
54
|
+
[type]: typeRecords
|
|
55
|
+
};
|
|
56
|
+
const testOrder = [...currentOrder, type];
|
|
57
|
+
if (byteSize(JSON.stringify({
|
|
58
|
+
data: testData,
|
|
59
|
+
order: testOrder
|
|
60
|
+
})) > argBudget) {
|
|
61
|
+
chunks.push({
|
|
62
|
+
data: currentData,
|
|
63
|
+
order: currentOrder,
|
|
64
|
+
index: chunks.length
|
|
65
|
+
});
|
|
66
|
+
currentData = {};
|
|
67
|
+
currentOrder = [];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (byteSize(JSON.stringify({
|
|
71
|
+
data: { [type]: typeRecords },
|
|
72
|
+
order: [type]
|
|
73
|
+
})) <= argBudget) {
|
|
74
|
+
currentData[type] = typeRecords;
|
|
75
|
+
currentOrder.push(type);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (currentOrder.length > 0) {
|
|
79
|
+
chunks.push({
|
|
80
|
+
data: currentData,
|
|
81
|
+
order: currentOrder,
|
|
82
|
+
index: chunks.length
|
|
83
|
+
});
|
|
84
|
+
currentData = {};
|
|
85
|
+
currentOrder = [];
|
|
86
|
+
}
|
|
87
|
+
let recordBatch = [];
|
|
88
|
+
for (const record of typeRecords) {
|
|
89
|
+
if (byteSize(JSON.stringify({
|
|
90
|
+
data: { [type]: [record] },
|
|
91
|
+
order: [type]
|
|
92
|
+
})) > argBudget) {
|
|
93
|
+
const singleRecordSize = byteSize(JSON.stringify(record));
|
|
94
|
+
throw new Error(`A single record in type "${type}" (${singleRecordSize} bytes) exceeds the message size budget (${argBudget} bytes). Consider increasing maxMessageSize or reducing the record size.`);
|
|
95
|
+
}
|
|
96
|
+
const testBatch = [...recordBatch, record];
|
|
97
|
+
const testData = {
|
|
98
|
+
...currentData,
|
|
99
|
+
[type]: testBatch
|
|
100
|
+
};
|
|
101
|
+
const testOrder = currentOrder.includes(type) ? currentOrder : [...currentOrder, type];
|
|
102
|
+
if (byteSize(JSON.stringify({
|
|
103
|
+
data: testData,
|
|
104
|
+
order: testOrder
|
|
105
|
+
})) > argBudget && recordBatch.length > 0) {
|
|
106
|
+
currentData[type] = recordBatch;
|
|
107
|
+
if (!currentOrder.includes(type)) currentOrder.push(type);
|
|
108
|
+
chunks.push({
|
|
109
|
+
data: currentData,
|
|
110
|
+
order: currentOrder,
|
|
111
|
+
index: chunks.length
|
|
112
|
+
});
|
|
113
|
+
currentData = {};
|
|
114
|
+
currentOrder = [];
|
|
115
|
+
recordBatch = [record];
|
|
116
|
+
} else recordBatch = testBatch;
|
|
117
|
+
}
|
|
118
|
+
if (recordBatch.length > 0) {
|
|
119
|
+
currentData[type] = recordBatch;
|
|
120
|
+
if (!currentOrder.includes(type)) currentOrder.push(type);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (currentOrder.length > 0) chunks.push({
|
|
124
|
+
data: currentData,
|
|
125
|
+
order: currentOrder,
|
|
126
|
+
index: chunks.length
|
|
127
|
+
});
|
|
128
|
+
const total = chunks.length;
|
|
129
|
+
return chunks.map((chunk) => ({
|
|
130
|
+
...chunk,
|
|
131
|
+
total
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
function byteSize(str) {
|
|
135
|
+
return new TextEncoder().encode(str).length;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
//#endregion
|
|
11
139
|
//#region src/cli/bundler/seed/seed-bundler.ts
|
|
12
140
|
/**
|
|
13
141
|
* Seed script bundler for TailorDB seed data
|
|
@@ -156,5 +284,5 @@ async function bundleSeedScript(namespace, typeNames) {
|
|
|
156
284
|
register("tsx", import.meta.url, { data: {} });
|
|
157
285
|
|
|
158
286
|
//#endregion
|
|
159
|
-
export { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, MIGRATION_LABEL_KEY, SCHEMA_FILE_NAME, apiCall, apply, bundleSeedScript, compareLocalTypesWithSnapshot, compareSnapshots, createSnapshotFromLocalTypes, createWorkspace, deleteWorkspace, executeScript, formatDiffSummary, formatMigrationDiff, generate, generateUserTypes, getAppHealth, getExecutor, getExecutorJob, getLatestMigrationNumber, getMachineUserToken, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNamespacesWithMigrations, getNextMigrationNumber, getOAuth2Client, getWorkflow, getWorkflowExecution, getWorkspace, hasChanges, initOperatorClient, inviteUser, listApps, listExecutorJobs, listExecutors, listMachineUsers, listOAuth2Clients, listUsers, listWebhookExecutors, listWorkflowExecutions, listWorkflows, listWorkspaces, loadAccessToken, loadConfig, loadWorkspaceId, generate$1 as migrateGenerate, reconstructSnapshotFromMigrations, remove, removeUser, restoreWorkspace, resumeWorkflow, show, startWorkflow, triggerExecutor, truncate, updateUser, waitForExecution, watchExecutorJob };
|
|
287
|
+
export { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, MIGRATION_LABEL_KEY, SCHEMA_FILE_NAME, apiCall, apply, bundleMigrationScript, bundleSeedScript, chunkSeedData, compareLocalTypesWithSnapshot, compareSnapshots, createSnapshotFromLocalTypes, createWorkspace, deleteWorkspace, executeScript, formatDiffSummary, formatMigrationDiff, generate, generateUserTypes, getAppHealth, getExecutor, getExecutorJob, getLatestMigrationNumber, getMachineUserToken, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNamespacesWithMigrations, getNextMigrationNumber, getOAuth2Client, getWorkflow, getWorkflowExecution, getWorkspace, hasChanges, initOperatorClient, inviteUser, listApps, listExecutorJobs, listExecutors, listMachineUsers, listOAuth2Clients, listUsers, listWebhookExecutors, listWorkflowExecutions, listWorkflows, listWorkspaces, loadAccessToken, loadConfig, loadWorkspaceId, generate$1 as migrateGenerate, reconstructSnapshotFromMigrations, remove, removeUser, restoreWorkspace, resumeWorkflow, show, startWorkflow, triggerExecutor, truncate, updateUser, waitForExecution, watchExecutorJob };
|
|
160
288
|
//# sourceMappingURL=lib.mjs.map
|
package/dist/cli/lib.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.mjs","names":["fs"],"sources":["../../src/cli/bundler/seed/seed-bundler.ts","../../src/cli/lib.ts"],"sourcesContent":["/**\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} 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\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 } from \"./workflow/get\";\nexport {\n startWorkflow,\n type StartWorkflowOptions,\n type StartWorkflowResultWithWait,\n type WaitOptions,\n} from \"./workflow/start\";\nexport {\n listWorkflowExecutions,\n getWorkflowExecution,\n type ListWorkflowExecutionsOptions,\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 TriggerExecutorResult,\n} from \"./executor/trigger\";\nexport {\n listExecutorJobs,\n getExecutorJob,\n watchExecutorJob,\n type ListExecutorJobsOptions,\n type GetExecutorJobOptions,\n type WatchExecutorJobOptions,\n type ExecutorJobDetailInfo,\n type WatchExecutorJobResult,\n} from \"./executor/jobs\";\nexport { listExecutors, type ListExecutorsOptions } from \"./executor/list\";\nexport { getExecutor, type GetExecutorOptions } 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 { bundleSeedScript, type SeedBundleResult } from \"./bundler/seed/seed-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":";;;;;;;;;;;;;;;;AAqBA,MAAM,oBAAoB,CAAC,UAAU,4CAA4C;AAEjF,IAAI,sBAAsB;;;;;AAM1B,SAAS,wBAA8B;AACrC,KAAI,oBAAqB;AACzB,uBAAsB;CAEtB,MAAM,UAAU,cAAc,KAAK,QAAQ,QAAQ,KAAK,EAAE,eAAe,CAAC;CAC1E,MAAM,UAAoB,EAAE;AAE5B,MAAK,MAAM,OAAO,kBAChB,KAAI;AACF,UAAQ,QAAQ,IAAI;SACd;AACN,UAAQ,KAAK,IAAI;;AAIrB,KAAI,QAAQ,SAAS,EACnB,QAAO,KACL,oDAAoD,QAAQ,KAAK,KAAK,CAAC,8CACxB,QAAQ,KAAK,IAAI,GACjE;;AAIL,MAAM,aAAa;;;;;;AAOnB,SAAS,0BAA0B,WAA2B;AAC5D,QAAO,EAAY;;;;;;;;;;;;;;;;;;;;;;;0BAuBK,UAAU;;;2BAGT,OAAO,WAAW,CAAC;;;;;2BAKnB,UAAU;;;;;;;;;;;6BAWR,UAAU;;;;;6BAKV,UAAU;;;;;;;;;;;;;;;;;;;;;;;;AAyBvC,eAAsB,iBACpB,WACA,WAC2B;AAE3B,wBAAuB;CAGvB,MAAM,YAAY,KAAK,QAAQ,YAAY,EAAE,OAAO;AACpD,MAAG,UAAU,WAAW,EAAE,WAAW,MAAM,CAAC;CAG5C,MAAM,YAAY,KAAK,KAAK,WAAW,QAAQ,UAAU,WAAW;CACpE,MAAM,aAAa,KAAK,KAAK,WAAW,QAAQ,UAAU,KAAK;CAG/D,MAAM,eAAe,0BAA0B,UAAU;AACzD,MAAG,cAAc,WAAW,aAAa;CAEzC,IAAI;AACJ,KAAI;AACF,aAAW,MAAM,iBAAiB;SAC5B;AACN,aAAW;;AAIb,OAAM,SAAS,MACb,SAAS,aAAa;EACpB,OAAO;EACP,QAAQ;GACN,MAAM;GACN,QAAQ;GACR,WAAW;GACX,QAAQ;GACR,sBAAsB;GACtB,SAAS,EACP,UAAU,YACX;GACF;EACD,UAAU,CAAC,WAAW;EACtB,SAAS,EACP,gBAAgB,CAAC,QAAQ,SAAS,EACnC;EACD;EACA,WAAW;GACT,mBAAmB;GACnB,aAAa;GACb,0BAA0B;GAC3B;EACD,UAAU;EACX,CAAC,CACH;AAKD,QAAO;EACL;EACA,aAJkBA,KAAG,aAAa,YAAY,QAAQ;EAKtD,eAAe;EAChB;;;;;AC7LH,SAAS,OAAO,OAAO,KAAK,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC"}
|
|
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\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 } from \"./workflow/get\";\nexport {\n startWorkflow,\n type StartWorkflowOptions,\n type StartWorkflowResultWithWait,\n type WaitOptions,\n} from \"./workflow/start\";\nexport {\n listWorkflowExecutions,\n getWorkflowExecution,\n type ListWorkflowExecutionsOptions,\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 TriggerExecutorResult,\n} from \"./executor/trigger\";\nexport {\n listExecutorJobs,\n getExecutorJob,\n watchExecutorJob,\n type ListExecutorJobsOptions,\n type GetExecutorJobOptions,\n type WatchExecutorJobOptions,\n type ExecutorJobDetailInfo,\n type WatchExecutorJobResult,\n} from \"./executor/jobs\";\nexport { listExecutors, type ListExecutorsOptions } from \"./executor/list\";\nexport { getExecutor, type GetExecutorOptions } 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,4 +1,5 @@
|
|
|
1
1
|
/// <reference path="./../user-defined.d.ts" />
|
|
2
|
-
import { $ as
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { $ as TailorAnyDBField, B as SAML, Bt as ResolverServiceConfig, Ct as PermissionCondition, Dt as unsafeAllowAllTypePermission, Et as unsafeAllowAllGqlPermission, F as IDToken, Ft as TailorField, G as SCIMConfig, H as SCIMAttributeMapping, I as IdProviderConfig, It as QueryType, J as UserAttributeKey, K as SCIMResource, L as OAuth2ClientGrantType, Lt as Resolver, M as AuthServiceInput, N as BuiltinIdP, O as AuthConfig, P as DefinedAuth, Q as ValueOperand, R as OAuth2ClientInput, Rt as ResolverExternalConfig, St as TailorDBTypeForPlugin, Tt as TailorTypePermission, U as SCIMAttributeType, V as SCIMAttribute, Vt as ResolverServiceInput, W as SCIMAuthorization, X as UserAttributeMap, Y as UserAttributeListKey, Z as UsernameFieldKey, _t as PluginGeneratedType, a as IdPExternalConfig, at as NamespacePluginOutput, bt as PluginOutput, c as WorkflowServiceConfig, d as defineStaticWebSite, dt as PluginConfigs, et as TailorAnyDBType, ft as PluginExecutorContext, g as ExecutorServiceInput, gt as PluginGeneratedResolver, h as ExecutorServiceConfig, ht as PluginGeneratedExecutorWithFile, i as IdPConfig, it as db, j as AuthOwnConfig, k as AuthExternalConfig, l as WorkflowServiceInput, mt as PluginGeneratedExecutor, nt as TailorDBInstance, ot as PluginAttachment, pt as PluginExecutorContextBase, q as TenantProviderConfig, rt as TailorDBType, st as PluginBase, tt as TailorDBField, u as StaticWebsiteConfig, ut as PluginConfig, vt as PluginNamespaceGeneratedTypeEntry, wt as TailorTypeGqlPermission, xt as PluginProcessContext, yt as PluginNamespaceProcessContext, z as OIDC } from "../index-Bid18Opo.mjs";
|
|
3
|
+
import { a as AttributeMap, c as unauthenticatedTailorUser, i as AttributeList, s as TailorUser, t as Env } from "../env-4RO7szrH.mjs";
|
|
4
|
+
import { $ as defineAuth, A as idpUserCreatedTrigger, B as WebhookOperation, C as RecordTrigger, D as authAccessTokenIssuedTrigger, E as ResolverExecutedTrigger, F as recordUpdatedTrigger, G as WORKFLOW_TEST_ENV_KEY, H as Workflow, I as resolverExecutedTrigger, J as WorkflowJobInput, K as WorkflowJob, L as FunctionOperation, M as idpUserUpdatedTrigger, N as recordCreatedTrigger, O as authAccessTokenRefreshedTrigger, P as recordDeletedTrigger, Q as AuthInvoker, R as GqlOperation, S as RecordDeletedArgs, T as ResolverExecutedArgs, U as WorkflowConfig, V as WorkflowOperation, W as createWorkflow, X as createWorkflowJob, Y as WorkflowJobOutput, Z as createResolver, _ as AuthAccessTokenArgs, a as defineGenerators, b as IdpUserTrigger, c as createExecutor, d as IncomingWebhookRequest, f as IncomingWebhookTrigger, g as scheduleTrigger, h as ScheduleTrigger, i as defineConfig, j as idpUserDeletedTrigger, k as authAccessTokenRevokedTrigger, l as Trigger, m as ScheduleArgs, n as output, o as definePlugins, p as incomingWebhookTrigger, q as WorkflowJobContext, r as t, s as defineIdp, t as infer, u as IncomingWebhookArgs, v as AuthAccessTokenTrigger, w as RecordUpdatedArgs, x as RecordCreatedArgs, y as IdpUserArgs, z as Operation } from "../index-BBr_q3vB.mjs";
|
|
5
|
+
export { AttributeList, AttributeMap, AuthAccessTokenArgs, AuthAccessTokenTrigger, AuthConfig, AuthExternalConfig, AuthInvoker, AuthOwnConfig, AuthServiceInput, BuiltinIdP, DefinedAuth, Env, ExecutorServiceConfig, ExecutorServiceInput, FunctionOperation, GqlOperation, IDToken, IdPConfig, IdPExternalConfig, IdProviderConfig, IdpUserArgs, IdpUserTrigger, IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookTrigger, NamespacePluginOutput, OAuth2ClientInput as OAuth2Client, OAuth2ClientGrantType, OIDC, Operation, PermissionCondition, PluginAttachment, PluginBase, PluginConfig, PluginConfigs, PluginExecutorContext, PluginExecutorContextBase, PluginGeneratedExecutor, PluginGeneratedExecutorWithFile, PluginGeneratedResolver, PluginGeneratedType, PluginNamespaceGeneratedTypeEntry, PluginNamespaceProcessContext, PluginOutput, PluginProcessContext, QueryType, RecordCreatedArgs, RecordDeletedArgs, RecordTrigger, RecordUpdatedArgs, Resolver, ResolverExecutedArgs, ResolverExecutedTrigger, ResolverExternalConfig, ResolverServiceConfig, ResolverServiceInput, SAML, SCIMAttribute, SCIMAttributeMapping, SCIMAttributeType, SCIMAuthorization, SCIMConfig, SCIMResource, ScheduleArgs, ScheduleTrigger, StaticWebsiteConfig, TailorAnyDBField, TailorAnyDBType, TailorDBField, TailorDBInstance, TailorDBType, TailorDBTypeForPlugin, TailorField, TailorTypeGqlPermission, TailorTypePermission, TailorUser, TenantProviderConfig, Trigger, UserAttributeKey, UserAttributeListKey, UserAttributeMap, UsernameFieldKey, ValueOperand, WORKFLOW_TEST_ENV_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 };
|