@tailor-platform/sdk 2.38.0 → 2.39.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 +64 -0
- package/dist/{application-Bz80INH4.mjs → application-OeNMQzOC.mjs} +1 -1
- package/dist/{application-CeqD1OK-.mjs → application-mNOJx9Y2.mjs} +4 -4
- package/dist/{application-CeqD1OK-.mjs.map → application-mNOJx9Y2.mjs.map} +1 -1
- package/dist/cli/commands/executor/trigger.d.mts +1 -0
- package/dist/cli/commands/generate/seed/bundler.d.mts +7 -5
- package/dist/cli/commands/workspace/transform.d.mts +1 -2
- package/dist/cli/lib.d.mts +4 -2
- package/dist/cli/lib.mjs +1 -1
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/main.mjs +30 -30
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/shared/build-options.d.mts +13 -0
- package/dist/cli/shared/client.d.mts +1 -0
- package/dist/cli/shared/script-workflow.d.mts +65 -0
- package/dist/cli/shared/seed-chunker.d.mts +3 -3
- package/dist/{client-DOQv-BP8.mjs → client-CqiPQgMG.mjs} +2 -2
- package/dist/client-CqiPQgMG.mjs.map +1 -0
- package/dist/client-DO2_Xz_z.mjs +1 -0
- package/dist/completion/zsh-worker.zsh +61 -6
- package/dist/configure/index.mjs +1 -1
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/auth/types.d.mts +20 -3
- package/dist/configure/services/executor/trigger/webhook.d.mts +8 -1
- package/dist/{context-OOASEQLA.mjs → context-CYBcQZyO.mjs} +1 -1
- package/dist/{context-DSi5kfqr.mjs → context-aAgFGDBD.mjs} +4 -4
- package/dist/{context-DSi5kfqr.mjs.map → context-aAgFGDBD.mjs.map} +1 -1
- package/dist/{register-ts-hook-CXYYYgCl.mjs → register-ts-hook-CORbtrSN.mjs} +82 -71
- package/dist/register-ts-hook-CORbtrSN.mjs.map +1 -0
- package/dist/{service-DB-RHn25.mjs → service-Bkz_TB5v.mjs} +2 -2
- package/dist/{service-DB-RHn25.mjs.map → service-Bkz_TB5v.mjs.map} +1 -1
- package/dist/service-Dffd4how.mjs +1 -0
- package/dist/syntax-diagnostic-BQgOV8Fz.mjs +2 -0
- package/dist/syntax-diagnostic-BQgOV8Fz.mjs.map +1 -0
- package/dist/validation-errors-ChvCG6wT.mjs +3 -0
- package/dist/validation-errors-ChvCG6wT.mjs.map +1 -0
- package/dist/vitest/index.mjs +1 -1
- package/dist/vitest/index.mjs.map +1 -1
- package/docs/cli/application.md +3 -3
- package/docs/cli/executor.md +13 -17
- package/docs/cli/function.md +1 -1
- package/docs/cli/workspace.md +2 -3
- package/docs/configuration.md +28 -0
- package/docs/github-actions.md +82 -15
- package/docs/migration/v2.md +5 -3
- package/docs/services/auth.md +5 -0
- package/docs/services/executor.md +2 -0
- package/docs/services/tailordb/migration.md +3 -3
- package/package.json +12 -12
- package/dist/client-CHXix4LD.mjs +0 -1
- package/dist/client-DOQv-BP8.mjs.map +0 -1
- package/dist/register-ts-hook-CXYYYgCl.mjs.map +0 -1
- package/dist/service-DsAWXbVX.mjs +0 -1
- package/dist/validation-errors-DqCeUW4L.mjs +0 -3
- package/dist/validation-errors-DqCeUW4L.mjs.map +0 -1
|
@@ -12,6 +12,7 @@ type TriggerExecutorBaseOptions<E extends ManualTriggerExecutor> = {
|
|
|
12
12
|
profile?: string;
|
|
13
13
|
};
|
|
14
14
|
export type TriggerExecutorTypedOptions<E extends ManualTriggerExecutor = ManualTriggerExecutor> = E extends ManualTriggerExecutor<IncomingWebhookTrigger> ? TriggerExecutorBaseOptions<E> & {
|
|
15
|
+
/** JSON object the executor receives as `body`. */
|
|
15
16
|
payload?: JsonObject;
|
|
16
17
|
} : TriggerExecutorBaseOptions<E> & {
|
|
17
18
|
payload?: never;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { BuildOptions } from "../../../../configure/config/types.mjs";
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Bundles seed scripts for server-side execution
|
|
3
|
+
* Bundling options of the config that apply to a seed script.
|
|
5
4
|
*/
|
|
5
|
+
export type SeedBundleBuildOptions = Pick<BuildOptions, "inlineSourcemap" | "inlineSourcemapDependencySources">;
|
|
6
6
|
export type SeedBundleResult = {
|
|
7
7
|
namespace: string;
|
|
8
8
|
bundledCode: string;
|
|
@@ -26,9 +26,10 @@ export type SeedDumpBundleResult = {
|
|
|
26
26
|
* @param namespace - TailorDB namespace
|
|
27
27
|
* @param tableNames - List of table names to include in the seed
|
|
28
28
|
* @param baseDir - Directory whose dependencies and tsconfig the generated entry uses
|
|
29
|
+
* @param buildOptions - Sourcemap options of the config
|
|
29
30
|
* @returns Bundled seed script result
|
|
30
31
|
*/
|
|
31
|
-
export declare function bundleSeedScript(namespace: string, tableNames: string[], baseDir?: string): Promise<SeedBundleResult>;
|
|
32
|
+
export declare function bundleSeedScript(namespace: string, tableNames: string[], baseDir?: string, buildOptions?: SeedBundleBuildOptions): Promise<SeedBundleResult>;
|
|
32
33
|
/**
|
|
33
34
|
* Bundle a seed dump script for server-side execution
|
|
34
35
|
*
|
|
@@ -37,6 +38,7 @@ export declare function bundleSeedScript(namespace: string, tableNames: string[]
|
|
|
37
38
|
* a keyset cursor instead of holding it all in one message.
|
|
38
39
|
* @param namespace - TailorDB namespace
|
|
39
40
|
* @param baseDir - Directory whose dependencies and tsconfig the generated entry uses
|
|
41
|
+
* @param buildOptions - Sourcemap options of the config
|
|
40
42
|
* @returns Bundled seed dump script result
|
|
41
43
|
*/
|
|
42
|
-
export declare function bundleSeedDumpScript(namespace: string, baseDir?: string): Promise<SeedDumpBundleResult>;
|
|
44
|
+
export declare function bundleSeedDumpScript(namespace: string, baseDir?: string, buildOptions?: SeedBundleBuildOptions): Promise<SeedDumpBundleResult>;
|
|
@@ -4,7 +4,7 @@ export interface WorkspaceInfo {
|
|
|
4
4
|
id: string;
|
|
5
5
|
name: string;
|
|
6
6
|
folderName?: string;
|
|
7
|
-
organizationId
|
|
7
|
+
organizationId: string;
|
|
8
8
|
folderId?: string;
|
|
9
9
|
region: string;
|
|
10
10
|
createdAt: Date | null;
|
|
@@ -12,6 +12,5 @@ export interface WorkspaceInfo {
|
|
|
12
12
|
}
|
|
13
13
|
export interface WorkspaceDetails extends WorkspaceInfo {
|
|
14
14
|
deleteProtection: boolean;
|
|
15
|
-
organizationId: string;
|
|
16
15
|
folderId: string;
|
|
17
16
|
}
|
package/dist/cli/lib.d.mts
CHANGED
|
@@ -95,9 +95,11 @@ import { GenerateOptions as GenerateOptions$1, GenerateResult, generate as gener
|
|
|
95
95
|
import { SeedNamespaceConfig } from "../plugin/builtin/seed/seed-type-processor.mjs";
|
|
96
96
|
import { LoadSeedContextOptions, SeedContext, SeedIdpUserContext, loadSeedContext } from "./shared/seed-context.mjs";
|
|
97
97
|
import { ChunkSeedDataOptions, SeedChunk, SeedData, chunkSeedData } from "./shared/seed-chunker.mjs";
|
|
98
|
-
import { SeedBundleResult, SeedDumpBundleResult, bundleSeedDumpScript, bundleSeedScript } from "./commands/generate/seed/bundler.mjs";
|
|
98
|
+
import { SeedBundleBuildOptions, SeedBundleResult, SeedDumpBundleResult, bundleSeedDumpScript, bundleSeedScript } from "./commands/generate/seed/bundler.mjs";
|
|
99
|
+
import { buildOptionsOf } from "./shared/build-options.mjs";
|
|
99
100
|
import { MigrationBundleResult, bundleMigrationScript } from "./commands/tailordb/migrate/bundler.mjs";
|
|
100
101
|
import { ExecutionWaitResult, ScriptExecutionOptions, ScriptExecutionResult, ScriptInvoker, executeScript, waitForExecution } from "./shared/script-executor.mjs";
|
|
102
|
+
import { RunScript, ScriptWorkflowOptions, assertNoActiveScriptWorkflow, withScriptWorkflow } from "./shared/script-workflow.mjs";
|
|
101
103
|
import { arg, defineCommand, runCommand, runMain } from "@politty/zod";
|
|
102
104
|
import { MachineUserName } from "@tailor-platform/sdk";
|
|
103
|
-
export { type AIGatewayInfo, type ApiCallOptions, type ApiCallResult, type AppHealthInfo, type AppIdEntry, type AppIdEntryInput, type AppIdLock, type AppIdPlan, type AppIdPlanMode, type AppIds, type AppInfo, type ApplicationInfo, type DeployOptions as ApplyOptions, type AuthInvoker, type BreakingChangeInfo, type BundledScripts, type ChunkSeedDataOptions, type CommonArgsType, type CreateFolderOptions, type CreateWorkspaceOptions, DB_PGLITE_SCHEMA_FILE_NAME, DB_TYPES_FILE_NAME, DIFF_FILE_NAME, type DeleteFolderOptions, type DeleteWorkspaceOptions, type DeployOptions, type ErrorSourceLocation, type ErrorToJsonOptions, type ExecutionWaitResult, type Executor, type ExecutorInfo, type ExecutorJobAttemptInfo, type ExecutorJobDetailInfo, type ExecutorJobInfo, type ExecutorJobListInfo, type ExecutorListInfo, type FolderInfo, type FolderListInfo, type FunctionLogEntryInfo, type FunctionRegistryInfo, type GenerateOptions, type GeneratorResult, type HealthOptions as GetAppHealthOptions, type GetExecutorJobTypedOptions, type GetExecutorTypedOptions, type GetFolderOptions, type GetFunctionRegistryOptions, type GetMachineUserTokenOptions, type GetOAuth2ClientOptions, type GetOrganizationOptions, type GetWorkflowExecutionOptions, type GetWorkflowExecutionResult, type GetWorkflowTypedOptions, type GetWorkspaceOptions, INITIAL_SCHEMA_NUMBER, type InviteUserOptions, type ListAppsOptions, type ListExecutorJobsTypedOptions, type ListExecutorsOptions, type ListFoldersOptions, type ListFunctionRegistriesOptions, type ListMachineUsersOptions, type ListOAuth2ClientsOptions, type ListOrganizationsOptions, type ListUsersOptions, type ListWebhookExecutorsOptions, type ListWorkflowExecutionsTypedOptions, type ListWorkflowsOptions, type ListWorkspacesOptions, type LoadSeedContextOptions, type LoadTailorDBNamespacesOptions, type LoadedConfig, type LoadedTailorDBNamespaces, type LogMode, type LogOptions, MIGRATE_FILE_NAME, MIGRATE_PGLITE_TEST_FILE_NAME, MIGRATE_TEST_FILE_NAME, MIGRATION_LABEL_KEY, type MachineUserInfo, type MachineUserName, type MachineUserTokenInfo, type GenerateOptions$1 as MigrateGenerateOptions, type GenerateResult as MigrateGenerateResult, type MigrationBundleResult, type MigrationDiff, type NamespaceWithMigrations, type NormalizedSchemaSnapshot, type OAuth2ClientCredentials, type OAuth2ClientInfo, type OperatorClient, type OperatorFieldConfig, type OrganizationInfo, type OrganizationTreeOptions, type OutOptions, type ParsedField, type PlanAppIdsParams, type Plugin, type PluginAttachment, type PluginGeneratedTableSource, type RemoveAdoptedConfigIdsResult, type RemoveOptions, type RemoveUserOptions, type ResolveAppIdParams, type Resolver, type RestoreWorkspaceOptions, type ResumeWorkflowOptions, type ResumeWorkflowResultWithWait, SCHEMA_FILE_NAME, type SchemaSnapshot, type ScriptExecutionOptions, type ScriptExecutionResult, type ScriptInvoker, type SeedBundleResult, type SeedChunk, type SeedContext, type SeedData, type SeedDumpBundleResult, type SeedIdpUserContext, type SeedNamespaceConfig, type ShowInfo, type ShowOAuth2ClientInfo, type ShowOptions, type ShowStaticWebsiteInfo, type SnapshotFieldConfig, type StartWorkflowResultWithWait, type StartWorkflowTypedOptions, type DeployResult as StaticWebsiteDeployResult, TAILOR_LOCK_FILENAME, TAILOR_LOCK_VERSION, type TailorDBNamespaceData, type TailorDBNamespaceSelector, type TailorDBSnapshotType, type TailorDBType, type TriggerExecutorResult, type TriggerExecutorTypedOptions, type TruncateOptions, type TypeSourceInfoEntry, type UpdateFolderOptions, type UpdateOrganizationOptions, type UpdateUserOptions, type UserInfo, type UserOrganizationInfo, WORKSPACE_NAME_MAX_LENGTH, type WaitOptions, type WaitWorkflowExecutionOptions, type WatchExecutorJobResult, type WatchExecutorJobTypedOptions, type WebhookExecutorInfo, type WorkflowExecutionInfo, type WorkflowExecutionWaitInfo, type WorkflowInfo, type WorkflowJobExecutionInfo, type WorkflowListInfo, type WorkflowWaitOutput, type WorkflowWaitResult, type WorkspaceDetails, type WorkspaceInfo, annotateTerminalError, apiCall, appIdLockKey, deploy as apply, arg, assertWritable, bundleMigrationScript, bundleSeedDumpScript, bundleSeedScript, chunkSeedData, compareLocalTypesWithSnapshot, compareSnapshots, configArg, confirmationArgs, createCommonArgs, createFolder, createSnapshotFromLocalTypes, createWorkspace, defineAppCommand, defineCommand, deleteFolder, deleteWorkspace, deploy, deployStaticWebsite, deploymentArgs, ensureConfigId, errorToJson, executeScript, extractOwnedNamespaces, findAppIdLock, formatDiffSummary, formatMigrationDiff, generate, generateUserTypes, getAppHealth, getExecutor, getExecutorJob, getExecutorWaitFailureMessage, getFolder, getFunctionRegistry, getLatestMigrationNumber, getMachineUserToken, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNamespacesWithMigrations, getNextMigrationNumber, getOAuth2Client, getOrganization, getWorkflow, getWorkflowExecution, getWorkspace, hasChanges, initOperatorClient, inviteUser, isPluginGeneratedTable, listApps, listExecutorJobs, listExecutors, listFolders, listFunctionRegistries, listMachineUsers, listOAuth2Clients, listOrganizations, listUsers, listWebhookExecutors, listWorkflowExecutions, listWorkflows, listWorkspaces, loadAccessToken, loadConfig, loadEnvFiles, loadEnvFilesFromArgv, loadSeedContext, loadTailorDBNamespaces, loadWorkspaceId, logBetaWarning, logger, generate$1 as migrateGenerate, organizationTree, parseAppIds, planAppIds, prompt, query, reconstructSnapshotFromMigrations, remove, removeAdoptedConfigIds, removeUser, resolveAppId, restoreWorkspace, resumeWorkflow, runCommand, runMain, serializeError, show, startWorkflow, styles, triggerExecutor, truncate, updateFolder, updateOrganization, updateUser, waitForExecution, waitWorkflowExecution, watchExecutorJob, withSourceLocation, workspaceArgs, workspaceNameSchema };
|
|
105
|
+
export { type AIGatewayInfo, type ApiCallOptions, type ApiCallResult, type AppHealthInfo, type AppIdEntry, type AppIdEntryInput, type AppIdLock, type AppIdPlan, type AppIdPlanMode, type AppIds, type AppInfo, type ApplicationInfo, type DeployOptions as ApplyOptions, type AuthInvoker, type BreakingChangeInfo, type BundledScripts, type ChunkSeedDataOptions, type CommonArgsType, type CreateFolderOptions, type CreateWorkspaceOptions, DB_PGLITE_SCHEMA_FILE_NAME, DB_TYPES_FILE_NAME, DIFF_FILE_NAME, type DeleteFolderOptions, type DeleteWorkspaceOptions, type DeployOptions, type ErrorSourceLocation, type ErrorToJsonOptions, type ExecutionWaitResult, type Executor, type ExecutorInfo, type ExecutorJobAttemptInfo, type ExecutorJobDetailInfo, type ExecutorJobInfo, type ExecutorJobListInfo, type ExecutorListInfo, type FolderInfo, type FolderListInfo, type FunctionLogEntryInfo, type FunctionRegistryInfo, type GenerateOptions, type GeneratorResult, type HealthOptions as GetAppHealthOptions, type GetExecutorJobTypedOptions, type GetExecutorTypedOptions, type GetFolderOptions, type GetFunctionRegistryOptions, type GetMachineUserTokenOptions, type GetOAuth2ClientOptions, type GetOrganizationOptions, type GetWorkflowExecutionOptions, type GetWorkflowExecutionResult, type GetWorkflowTypedOptions, type GetWorkspaceOptions, INITIAL_SCHEMA_NUMBER, type InviteUserOptions, type ListAppsOptions, type ListExecutorJobsTypedOptions, type ListExecutorsOptions, type ListFoldersOptions, type ListFunctionRegistriesOptions, type ListMachineUsersOptions, type ListOAuth2ClientsOptions, type ListOrganizationsOptions, type ListUsersOptions, type ListWebhookExecutorsOptions, type ListWorkflowExecutionsTypedOptions, type ListWorkflowsOptions, type ListWorkspacesOptions, type LoadSeedContextOptions, type LoadTailorDBNamespacesOptions, type LoadedConfig, type LoadedTailorDBNamespaces, type LogMode, type LogOptions, MIGRATE_FILE_NAME, MIGRATE_PGLITE_TEST_FILE_NAME, MIGRATE_TEST_FILE_NAME, MIGRATION_LABEL_KEY, type MachineUserInfo, type MachineUserName, type MachineUserTokenInfo, type GenerateOptions$1 as MigrateGenerateOptions, type GenerateResult as MigrateGenerateResult, type MigrationBundleResult, type MigrationDiff, type NamespaceWithMigrations, type NormalizedSchemaSnapshot, type OAuth2ClientCredentials, type OAuth2ClientInfo, type OperatorClient, type OperatorFieldConfig, type OrganizationInfo, type OrganizationTreeOptions, type OutOptions, type ParsedField, type PlanAppIdsParams, type Plugin, type PluginAttachment, type PluginGeneratedTableSource, type RemoveAdoptedConfigIdsResult, type RemoveOptions, type RemoveUserOptions, type ResolveAppIdParams, type Resolver, type RestoreWorkspaceOptions, type ResumeWorkflowOptions, type ResumeWorkflowResultWithWait, type RunScript, SCHEMA_FILE_NAME, type SchemaSnapshot, type ScriptExecutionOptions, type ScriptExecutionResult, type ScriptInvoker, type ScriptWorkflowOptions, type SeedBundleBuildOptions, type SeedBundleResult, type SeedChunk, type SeedContext, type SeedData, type SeedDumpBundleResult, type SeedIdpUserContext, type SeedNamespaceConfig, type ShowInfo, type ShowOAuth2ClientInfo, type ShowOptions, type ShowStaticWebsiteInfo, type SnapshotFieldConfig, type StartWorkflowResultWithWait, type StartWorkflowTypedOptions, type DeployResult as StaticWebsiteDeployResult, TAILOR_LOCK_FILENAME, TAILOR_LOCK_VERSION, type TailorDBNamespaceData, type TailorDBNamespaceSelector, type TailorDBSnapshotType, type TailorDBType, type TriggerExecutorResult, type TriggerExecutorTypedOptions, type TruncateOptions, type TypeSourceInfoEntry, type UpdateFolderOptions, type UpdateOrganizationOptions, type UpdateUserOptions, type UserInfo, type UserOrganizationInfo, WORKSPACE_NAME_MAX_LENGTH, type WaitOptions, type WaitWorkflowExecutionOptions, type WatchExecutorJobResult, type WatchExecutorJobTypedOptions, type WebhookExecutorInfo, type WorkflowExecutionInfo, type WorkflowExecutionWaitInfo, type WorkflowInfo, type WorkflowJobExecutionInfo, type WorkflowListInfo, type WorkflowWaitOutput, type WorkflowWaitResult, type WorkspaceDetails, type WorkspaceInfo, annotateTerminalError, apiCall, appIdLockKey, deploy as apply, arg, assertNoActiveScriptWorkflow, assertWritable, buildOptionsOf, bundleMigrationScript, bundleSeedDumpScript, bundleSeedScript, chunkSeedData, compareLocalTypesWithSnapshot, compareSnapshots, configArg, confirmationArgs, createCommonArgs, createFolder, createSnapshotFromLocalTypes, createWorkspace, defineAppCommand, defineCommand, deleteFolder, deleteWorkspace, deploy, deployStaticWebsite, deploymentArgs, ensureConfigId, errorToJson, executeScript, extractOwnedNamespaces, findAppIdLock, formatDiffSummary, formatMigrationDiff, generate, generateUserTypes, getAppHealth, getExecutor, getExecutorJob, getExecutorWaitFailureMessage, getFolder, getFunctionRegistry, getLatestMigrationNumber, getMachineUserToken, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNamespacesWithMigrations, getNextMigrationNumber, getOAuth2Client, getOrganization, getWorkflow, getWorkflowExecution, getWorkspace, hasChanges, initOperatorClient, inviteUser, isPluginGeneratedTable, listApps, listExecutorJobs, listExecutors, listFolders, listFunctionRegistries, listMachineUsers, listOAuth2Clients, listOrganizations, listUsers, listWebhookExecutors, listWorkflowExecutions, listWorkflows, listWorkspaces, loadAccessToken, loadConfig, loadEnvFiles, loadEnvFilesFromArgv, loadSeedContext, loadTailorDBNamespaces, loadWorkspaceId, logBetaWarning, logger, generate$1 as migrateGenerate, organizationTree, parseAppIds, planAppIds, prompt, query, reconstructSnapshotFromMigrations, remove, removeAdoptedConfigIds, removeUser, resolveAppId, restoreWorkspace, resumeWorkflow, runCommand, runMain, serializeError, show, startWorkflow, styles, triggerExecutor, truncate, updateFolder, updateOrganization, updateUser, waitForExecution, waitWorkflowExecution, watchExecutorJob, withScriptWorkflow, withSourceLocation, workspaceArgs, workspaceNameSchema };
|
package/dist/cli/lib.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as e,p as t,r as n,t as r}from"../errors-9OOL3xOM.mjs";import{F as i,H as a,M as o,N as s,P as c,U as l,a as u,m as d,nt as f,st as ee}from"../context-aAgFGDBD.mjs";import{$ as te,A as ne,An as re,At as ie,B as ae,Bt as oe,C as p,Ct as m,Dn as h,E as g,En as _,Et as v,Fi as y,Ft as b,Gr as x,Gt as S,Ht as C,Ii as w,In as T,Jt as E,Ki as D,L as O,Li as k,Lt as A,Mn as j,Mt as M,N,Nn as P,Nt as F,O as I,Oi as L,On as R,Ot as z,Pn as B,Qi as V,Qr as H,Qt as U,R as W,Si as G,Sn as K,St as q,Ti as se,Tn as ce,U as le,Ut as ue,W as de,Xi as fe,Xt as pe,Y as me,Yi as he,Yt as ge,Z as _e,Zi as ve,Zt as ye,_ as be,ar as J,at as xe,bi as Se,bt as Ce,ci as we,cr as Te,d as Ee,di as De,er as Oe,fi as ke,gi as Ae,gt as je,h as Me,ht as Ne,i as Pe,ir as Fe,j as Ie,jn as Le,ki as Re,kn as ze,kt as Be,l as Ve,li as He,lt as Ue,mr as We,mt as Ge,n as Ke,nr as qe,on as Je,or as Ye,p as Xe,pi as Ze,pt as Qe,q as $e,qt as et,r as tt,rn as nt,rr as rt,rt as it,s as at,si as ot,st,t as ct,ti as lt,tr as ut,tt as dt,ui as ft,ut as pt,vi as mt,vr as ht,vt as gt,x as _t,xi as vt,xn as yt,y as bt,yi as xt,zt as St}from"../register-ts-hook-CORbtrSN.mjs";import{l as Ct}from"../application-mNOJx9Y2.mjs";import{E as Y}from"../client-CqiPQgMG.mjs";import{l as X}from"../workspace_resource_pb-Cow7mrJY.mjs";import{t as wt}from"../type-source--ZNcV8RJ.mjs";import{arg as Tt,defineCommand as Et,runCommand as Dt,runMain as Ot}from"@politty/zod";import{Code as Z,ConnectError as Q}from"@connectrpc/connect";const $=`script`;async function withScriptWorkflow(e,t){let{client:n,workspaceId:r,name:i,appName:a,invoker:o,leftoverNote:s,profile:c}=e,l=e.pollIntervalMs??3e3;await assertMachineUserExists({client:n,workspaceId:r,invoker:o}),await assertNoActiveScriptWorkflow({client:n,workspaceId:r,names:[i],profile:c}),await Fe({client:n,workspaceId:r,name:i,subject:$,leftoverNote:s});let u={},d;try{await Ye({client:n,workspaceId:r,name:i,code:e.code,description:e.description,appName:a,appId:void 0}),d=await Oe({client:n,workspaceId:r,name:i,jobFunctionNames:[i],appName:a,appId:void 0,subject:$},u)}catch(e){throw await J({client:n,workspaceId:r,name:i,workflowId:u.workflowId,subject:$,leftoverNote:s}),e}let run=async e=>{let{executionId:t}=await n.startWorkflow({workspaceId:r,workflowId:d,authInvoker:o,arg:JSON.stringify(e)}),i=await rt({client:n,workspaceId:r,executionId:t,pollInterval:l,subject:`Script`});return await readOutcome({client:n,workspaceId:r,execution:i,pollInterval:l})};try{return await t(run)}finally{await J({client:n,workspaceId:r,name:i,workflowId:d,subject:$,leftoverNote:s})}}async function assertMachineUserExists(e){let{client:t,workspaceId:n,invoker:i}=e;if(!await t.getAuthMachineUser({workspaceId:n,authNamespace:i.namespace,name:i.machineUserName}).then(e=>e.machineUser).catch(e=>{if(!(e instanceof Q&&e.code===Z.NotFound))throw e}))throw r({code:`MACHINE_USER_NOT_FOUND`,message:`Machine user ${i.machineUserName} not found in the auth namespace ${i.namespace}.`})}async function assertNoActiveScriptWorkflow(e){let{client:t,workspaceId:i,names:a,profile:o}=e;for(let e of a){let a=(await qe(t,i,e)).find(ut);if(a)throw r({code:`SCRIPT_WORKFLOW_EXECUTION_ACTIVE`,message:`The temporary workflow '${e}' still has an execution that is running (${a.id}).`,suggestion:`An earlier command that was interrupted can still be applying its chunk. Wait for the execution to finish (${n({command:`tailor`,args:[`workflow`,`executions`,a.id,...f({workspaceId:i,profile:o})]})}), then run the command again.`,context:{workflowName:e,executionId:a.id}})}}async function readOutcome(e){let{client:t,workspaceId:n,execution:r,pollInterval:i}=e,a=r.jobExecutions.at(-1)?.executionId,o;for(let e=1;a&&e<=3;e++)try{({execution:o}=await t.getFunctionExecution({workspaceId:n,executionId:a}));break}catch(t){if(t instanceof Q&&t.code===Z.NotFound)break;if(e===3||!Te(t))throw t;await new Promise(e=>setTimeout(e,i))}let s=o?We(o.logEntries):``,c=o?.result??``;if(r.status===X.SUCCESS)return o?{success:!0,logs:s,result:c}:{success:!1,logs:s,result:c,error:`The workflow finished, but the result of its job could not be read, so it is unknown whether the script's changes were applied`};let l=r.status===X.CANCELED;return{success:!1,logs:s,result:c,error:o?.error?.message.trim()||c.trim()||(l?`Script execution was canceled`:`Script execution failed with unknown error`)}}await ct(new URL(`./ts-hook.mjs`,import.meta.url));export{ot as DB_PGLITE_SCHEMA_FILE_NAME,we as DB_TYPES_FILE_NAME,He as DIFF_FILE_NAME,ft as INITIAL_SCHEMA_NUMBER,De as MIGRATE_FILE_NAME,ke as MIGRATE_PGLITE_TEST_FILE_NAME,Ze as MIGRATE_TEST_FILE_NAME,se as MIGRATION_LABEL_KEY,Ae as SCHEMA_FILE_NAME,ce as TAILOR_LOCK_FILENAME,_ as TAILOR_LOCK_VERSION,yt as WORKSPACE_NAME_MAX_LENGTH,Ke as annotateTerminalError,he as apiCall,h as appIdLockKey,U as apply,U as deploy,Tt as arg,assertNoActiveScriptWorkflow,fe as assertWritable,Ct as buildOptionsOf,ht as bundleMigrationScript,pe as bundleSeedDumpScript,ye as bundleSeedScript,et as chunkSeedData,L as compareLocalTypesWithSnapshot,Re as compareSnapshots,o as configArg,s as confirmationArgs,c as createCommonArgs,xe as createFolder,H as createSnapshotFromLocalTypes,Je as createWorkspace,V as defineAppCommand,Et as defineCommand,it as deleteFolder,bt as deleteWorkspace,T as deployStaticWebsite,i as deploymentArgs,P as ensureConfigId,Ne as errorToJson,E as executeScript,gt as extractOwnedNamespaces,R as findAppIdLock,y as formatDiffSummary,w as formatMigrationDiff,Ge as generate,B as generateUserTypes,p as getAppHealth,C as getExecutor,Be as getExecutorJob,ie as getExecutorWaitFailureMessage,dt as getFolder,q as getFunctionRegistry,mt as getLatestMigrationNumber,pt as getMachineUserToken,xt as getMigrationDirPath,Se as getMigrationFilePath,vt as getMigrationFiles,x as getNamespacesWithMigrations,G as getNextMigrationNumber,Ue as getOAuth2Client,me as getOrganization,A as getWorkflow,St as getWorkflowExecution,be as getWorkspace,k as hasChanges,Y as initOperatorClient,Xe as inviteUser,wt as isPluginGeneratedTable,_t as listApps,M as listExecutorJobs,z as listExecutors,te as listFolders,Ce as listFunctionRegistries,Qe as listMachineUsers,st as listOAuth2Clients,$e as listOrganizations,Ee as listUsers,m as listWebhookExecutors,oe as listWorkflowExecutions,ne as listWorkflows,nt as listWorkspaces,u as loadAccessToken,ve as loadConfig,a as loadEnvFiles,l as loadEnvFilesFromArgv,ue as loadSeedContext,S as loadTailorDBNamespaces,d as loadWorkspaceId,O as logBetaWarning,t as logger,N as migrateGenerate,de as organizationTree,ze as parseAppIds,re as planAppIds,D as prompt,Pe as query,lt as reconstructSnapshotFromMigrations,ae as remove,Le as removeAdoptedConfigIds,Ve as removeUser,j as resolveAppId,Me as restoreWorkspace,I as resumeWorkflow,Dt as runCommand,Ot as runMain,je as serializeError,W as show,b as startWorkflow,e as styles,v as triggerExecutor,Ie as truncate,_e as updateFolder,le as updateOrganization,at as updateUser,ge as waitForExecution,g as waitWorkflowExecution,F as watchExecutorJob,withScriptWorkflow,tt as withSourceLocation,ee as workspaceArgs,K as workspaceNameSchema};
|
|
2
2
|
//# sourceMappingURL=lib.mjs.map
|
package/dist/cli/lib.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.mjs","names":["styles","logger","deploymentArgs","loadEnvFiles","configArg","confirmationArgs","createCommonArgs","loadEnvFilesFromArgv","loadAccessToken","loadWorkspaceId","workspaceArgs","listFolders","listWorkflows","hasChanges","planAppIds","getExecutorWaitFailureMessage","remove","listWorkflowExecutions","getAppHealth","listWebhookExecutors","appIdLockKey","waitWorkflowExecution","TAILOR_LOCK_VERSION","triggerExecutor","startWorkflow","defineAppCommand","createSnapshotFromLocalTypes","loadTailorDBNamespaces","apiCall","getExecutor","deployStaticWebsite","reconstructSnapshotFromMigrations","executeScript","logBetaWarning","getWorkflow","resolveAppId","listExecutorJobs","generate$1","ensureConfigId","watchExecutorJob","resumeWorkflow","formatDiffSummary","findAppIdLock","listExecutors","generateUserTypes","deploy","show","getNamespacesWithMigrations","compareSnapshots","workspaceNameSchema","getFunctionRegistry","TAILOR_LOCK_FILENAME","updateOrganization","assertWritable","loadSeedContext","organizationTree","loadConfig","bundleSeedDumpScript","getOrganization","waitForExecution","updateFolder","bundleSeedScript","getWorkspace","MIGRATE_PGLITE_TEST_FILE_NAME","createFolder","listFunctionRegistries","listUsers","getLatestMigrationNumber","bundleMigrationScript","DB_PGLITE_SCHEMA_FILE_NAME","getMigrationDirPath","serializeError","restoreWorkspace","getNextMigrationNumber","errorToJson","query","MIGRATE_FILE_NAME","truncate","removeAdoptedConfigIds","formatMigrationDiff","parseAppIds","getExecutorJob","removeUser","SCHEMA_FILE_NAME","getOAuth2Client","getMigrationFiles","generate","annotateTerminalError","DIFF_FILE_NAME","MIGRATE_TEST_FILE_NAME","createWorkspace","inviteUser","getMigrationFilePath","listMachineUsers","listOrganizations","chunkSeedData","withSourceLocation","INITIAL_SCHEMA_NUMBER","listWorkspaces","deleteFolder","updateUser","listOAuth2Clients","registerTsHook","DB_TYPES_FILE_NAME","getFolder","getMachineUserToken","MIGRATION_LABEL_KEY","extractOwnedNamespaces","listApps","compareLocalTypesWithSnapshot","WORKSPACE_NAME_MAX_LENGTH","deleteWorkspace","prompt","getWorkflowExecution","initOperatorClient","isPluginGeneratedTable","arg","defineCommand","runCommand","runMain"],"sources":["../../src/cli/lib.ts"],"sourcesContent":["// CLI API exports for programmatic usage\nimport { registerTsHook } from \"./shared/register-ts-hook\";\n\nawait registerTsHook(new URL(\"./ts-hook.mjs\", import.meta.url));\n\n// CLI foundation shared with plugins. Plugins resolve this package at runtime,\n// so logger state (--json / --verbose) set through these args reaches the SDK\n// code paths they call into. The @politty/zod surface is re-exported for the\n// same reason: arg metadata (aliases, env bindings, effects) lives in a\n// @politty/zod module-level registry, so registration and parsing must use\n// one @politty/zod copy.\nexport { arg, defineCommand, runCommand, runMain } from \"@politty/zod\";\nexport { logger, styles, type LogMode, type LogOptions, type OutOptions } from \"./shared/logger\";\nexport { defineAppCommand } from \"./shared/command\";\nexport { logBetaWarning } from \"./shared/beta\";\nexport { prompt } from \"./shared/prompt\";\nexport { WORKSPACE_NAME_MAX_LENGTH, workspaceNameSchema } from \"./shared/workspace-name\";\nexport {\n createCommonArgs,\n workspaceArgs,\n configArg,\n confirmationArgs,\n deploymentArgs,\n loadEnvFiles,\n loadEnvFilesFromArgv,\n type CommonArgsType,\n} from \"./shared/args\";\nexport { deploy, deploy as apply } from \"./commands/deploy/deploy\";\nexport type { DeployOptions, DeployOptions as ApplyOptions } from \"./commands/deploy/deploy\";\nexport type { BundledScripts } from \"./commands/deploy/function-registry\";\nexport { ensureConfigId } from \"./commands/deploy/config-id-injector\";\nexport {\n TAILOR_LOCK_FILENAME,\n TAILOR_LOCK_VERSION,\n appIdLockKey,\n findAppIdLock,\n parseAppIds,\n planAppIds,\n removeAdoptedConfigIds,\n resolveAppId,\n type AppIdEntry,\n type AppIdEntryInput,\n type AppIdLock,\n type AppIdPlan,\n type AppIdPlanMode,\n type AppIds,\n type PlanAppIdsParams,\n type RemoveAdoptedConfigIdsResult,\n type ResolveAppIdParams,\n} from \"./commands/deploy/app-id-lock\";\nexport { generate } from \"./commands/generate/service\";\nexport type { GenerateOptions } from \"./commands/generate/options\";\nexport { loadConfig, type LoadedConfig } from \"./shared/config-loader\";\nexport { extractOwnedNamespaces } from \"./shared/config\";\nexport { errorToJson, serializeError, type ErrorToJsonOptions } from \"./shared/error-json\";\nexport { annotateTerminalError, withSourceLocation } from \"./shared/github-actions\";\nexport type { ErrorSourceLocation } from \"./shared/error-diagnostics\";\nexport { generateUserTypes } from \"./shared/type-generator\";\nexport {\n loadTailorDBNamespaces,\n type TailorDBNamespaceSelector,\n type LoadTailorDBNamespacesOptions,\n type LoadedTailorDBNamespaces,\n} from \"./shared/tailordb-namespaces\";\nexport {\n deployStaticWebsite,\n type DeployResult as StaticWebsiteDeployResult,\n} from \"./commands/staticwebsite/deploy\";\nexport { assertWritable } from \"./shared/readonly-guard\";\nexport { isPluginGeneratedTable } from \"#/parser/service/tailordb/type-source\";\nexport type {\n GeneratorResult,\n Plugin,\n PluginAttachment,\n TailorDBNamespaceData,\n} from \"#/plugin/types\";\nexport type {\n TailorDBType,\n TypeSourceInfoEntry,\n ParsedField,\n OperatorFieldConfig,\n PluginGeneratedTableSource,\n} from \"#/parser/service/tailordb/types\";\nexport type { Resolver } from \"#/types/resolver.generated\";\nexport type { Executor } from \"#/types/executor.generated\";\n\nexport {\n show,\n type ShowOptions,\n type ApplicationInfo,\n type ShowInfo,\n type AIGatewayInfo,\n type ShowStaticWebsiteInfo,\n type ShowOAuth2ClientInfo,\n} from \"./commands/show\";\nexport { remove, type RemoveOptions } from \"./commands/remove\";\nexport { createWorkspace, type CreateWorkspaceOptions } from \"./commands/workspace/create\";\nexport { listWorkspaces, type ListWorkspacesOptions } from \"./commands/workspace/list\";\nexport { deleteWorkspace, type DeleteWorkspaceOptions } from \"./commands/workspace/delete\";\nexport { getWorkspace, type GetWorkspaceOptions } from \"./commands/workspace/get\";\nexport { restoreWorkspace, type RestoreWorkspaceOptions } from \"./commands/workspace/restore\";\nexport type { WorkspaceInfo, WorkspaceDetails } from \"./commands/workspace/transform\";\nexport { listUsers, type ListUsersOptions } from \"./commands/workspace/user/list\";\nexport { inviteUser, type InviteUserOptions } from \"./commands/workspace/user/invite\";\nexport { updateUser, type UpdateUserOptions } from \"./commands/workspace/user/update\";\nexport { removeUser, type RemoveUserOptions } from \"./commands/workspace/user/remove\";\nexport type { UserInfo } from \"./commands/workspace/user/transform\";\nexport { listApps, type ListAppsOptions } from \"./commands/workspace/app/list\";\nexport {\n getAppHealth,\n type HealthOptions as GetAppHealthOptions,\n} from \"./commands/workspace/app/health\";\nexport type { AppInfo, AppHealthInfo } from \"./commands/workspace/app/transform\";\nexport { getFunctionRegistry, type GetFunctionRegistryOptions } from \"./commands/function/get\";\nexport {\n listFunctionRegistries,\n type ListFunctionRegistriesOptions,\n} from \"./commands/function/list\";\nexport type { FunctionRegistryInfo } from \"./commands/function/transform\";\nexport {\n listMachineUsers,\n type ListMachineUsersOptions,\n type MachineUserInfo,\n} from \"./commands/machineuser/list\";\nexport {\n getMachineUserToken,\n type GetMachineUserTokenOptions,\n type MachineUserTokenInfo,\n} from \"./commands/machineuser/token\";\nexport { getOAuth2Client, type GetOAuth2ClientOptions } from \"./commands/oauth2client/get\";\nexport { listOAuth2Clients, type ListOAuth2ClientsOptions } from \"./commands/oauth2client/list\";\nexport type { OAuth2ClientInfo, OAuth2ClientCredentials } from \"./commands/oauth2client/transform\";\nexport { listWorkflows, type ListWorkflowsOptions } from \"./commands/workflow/list\";\nexport { getWorkflow, type GetWorkflowTypedOptions } from \"./commands/workflow/get\";\nexport type { MachineUserName } from \"@tailor-platform/sdk\";\nexport {\n startWorkflow,\n type StartWorkflowTypedOptions,\n type StartWorkflowResultWithWait,\n type WaitOptions,\n} from \"./commands/workflow/start\";\nexport {\n listWorkflowExecutions,\n getWorkflowExecution,\n type ListWorkflowExecutionsTypedOptions,\n type GetWorkflowExecutionOptions,\n type GetWorkflowExecutionResult,\n type WorkflowExecutionWaitInfo,\n} from \"./commands/workflow/executions\";\nexport { waitWorkflowExecution, type WorkflowWaitOutput } from \"./commands/workflow/wait\";\nexport type { WaitWorkflowExecutionOptions, WorkflowWaitResult } from \"./commands/workflow/waiter\";\nexport {\n resumeWorkflow,\n type ResumeWorkflowOptions,\n type ResumeWorkflowResultWithWait,\n} from \"./commands/workflow/resume\";\nexport type {\n WorkflowListInfo,\n WorkflowInfo,\n WorkflowExecutionInfo,\n WorkflowJobExecutionInfo,\n} from \"./commands/workflow/transform\";\nexport type { FunctionLogEntryInfo } from \"./shared/function-execution\";\nexport {\n triggerExecutor,\n type TriggerExecutorTypedOptions,\n type TriggerExecutorResult,\n} from \"./commands/executor/trigger\";\nexport {\n listExecutorJobs,\n getExecutorJob,\n getExecutorWaitFailureMessage,\n watchExecutorJob,\n type ListExecutorJobsTypedOptions,\n type GetExecutorJobTypedOptions,\n type WatchExecutorJobTypedOptions,\n type ExecutorJobDetailInfo,\n type WatchExecutorJobResult,\n} from \"./commands/executor/jobs\";\nexport { listExecutors, type ListExecutorsOptions } from \"./commands/executor/list\";\nexport { getExecutor, type GetExecutorTypedOptions } from \"./commands/executor/get\";\nexport {\n listWebhookExecutors,\n type ListWebhookExecutorsOptions,\n type WebhookExecutorInfo,\n} from \"./commands/executor/webhook\";\nexport type {\n ExecutorJobListInfo,\n ExecutorJobInfo,\n ExecutorJobAttemptInfo,\n ExecutorListInfo,\n ExecutorInfo,\n} from \"./commands/executor/transform\";\nexport { listOrganizations, type ListOrganizationsOptions } from \"./commands/organization/list\";\nexport { getOrganization, type GetOrganizationOptions } from \"./commands/organization/get\";\nexport { updateOrganization, type UpdateOrganizationOptions } from \"./commands/organization/update\";\nexport { organizationTree, type OrganizationTreeOptions } from \"./commands/organization/tree\";\nexport type {\n UserOrganizationInfo,\n OrganizationInfo,\n FolderListInfo,\n FolderInfo,\n} from \"./commands/organization/transform\";\nexport { listFolders, type ListFoldersOptions } from \"./commands/organization/folder/list\";\nexport { getFolder, type GetFolderOptions } from \"./commands/organization/folder/get\";\nexport { createFolder, type CreateFolderOptions } from \"./commands/organization/folder/create\";\nexport { updateFolder, type UpdateFolderOptions } from \"./commands/organization/folder/update\";\nexport { deleteFolder, type DeleteFolderOptions } from \"./commands/organization/folder/delete\";\nexport { loadAccessToken, loadWorkspaceId } from \"./shared/context\";\nexport { apiCall, type ApiCallOptions, type ApiCallResult } from \"./commands/api\";\nexport { query } from \"./query\";\nexport { truncate, type TruncateOptions } from \"./commands/tailordb/truncate\";\n\n// Migration exports\nexport {\n generate as migrateGenerate,\n type GenerateOptions as MigrateGenerateOptions,\n type GenerateResult as MigrateGenerateResult,\n} from \"./commands/tailordb/migrate/generate\";\nexport {\n createSnapshotFromLocalTypes,\n reconstructSnapshotFromMigrations,\n compareSnapshots,\n getNextMigrationNumber,\n getLatestMigrationNumber,\n getMigrationFiles,\n compareLocalTypesWithSnapshot,\n} from \"./commands/tailordb/migrate/snapshot\";\nexport {\n getNamespacesWithMigrations,\n type NamespaceWithMigrations,\n} from \"./commands/tailordb/migrate/config\";\nexport {\n hasChanges,\n formatMigrationDiff,\n formatDiffSummary,\n type MigrationDiff,\n type BreakingChangeInfo,\n} from \"./commands/tailordb/migrate/diff-calculator\";\nexport {\n SCHEMA_FILE_NAME,\n DIFF_FILE_NAME,\n MIGRATE_FILE_NAME,\n MIGRATE_TEST_FILE_NAME,\n MIGRATE_PGLITE_TEST_FILE_NAME,\n DB_TYPES_FILE_NAME,\n DB_PGLITE_SCHEMA_FILE_NAME,\n INITIAL_SCHEMA_NUMBER,\n getMigrationDirPath,\n getMigrationFilePath,\n type SchemaSnapshot,\n type NormalizedSchemaSnapshot,\n type TailorDBSnapshotType,\n type SnapshotFieldConfig,\n} from \"./commands/tailordb/migrate/snapshot\";\nexport { MIGRATION_LABEL_KEY } from \"./commands/tailordb/migrate/types\";\n\n// Seed exports\nexport {\n loadSeedContext,\n type LoadSeedContextOptions,\n type SeedContext,\n type SeedIdpUserContext,\n type SeedNamespaceConfig,\n} from \"./shared/seed-context\";\nexport {\n chunkSeedData,\n type SeedChunk,\n type ChunkSeedDataOptions,\n type SeedData,\n} from \"./shared/seed-chunker\";\nexport {\n bundleSeedScript,\n bundleSeedDumpScript,\n type SeedBundleResult,\n type SeedDumpBundleResult,\n} from \"./commands/generate/seed/bundler\";\nexport {\n bundleMigrationScript,\n type MigrationBundleResult,\n} from \"./commands/tailordb/migrate/bundler\";\nexport {\n executeScript,\n waitForExecution,\n type ScriptExecutionOptions,\n type ScriptExecutionResult,\n type ScriptInvoker,\n type ExecutionWaitResult,\n} from \"./shared/script-executor\";\nexport { initOperatorClient, type OperatorClient } from \"./shared/client\";\nexport type { AuthInvoker } from \"@tailor-platform/tailor-proto/auth_resource_pb\";\n"],"mappings":"A,ktCAGA,MAAMsG,GAAe,IAAI,IAAI,gBAAiB,YAAY,GAAG,CAAC,E"}
|
|
1
|
+
{"version":3,"file":"lib.mjs","names":["styles","logger","formatCommandHint","CLIError","deploymentArgs","loadEnvFiles","configArg","confirmationArgs","createCommonArgs","loadEnvFilesFromArgv","loadAccessToken","loadWorkspaceId","recoveryContextArgs","workspaceArgs","listFolders","listWorkflows","planAppIds","getExecutorWaitFailureMessage","remove","listWorkflowExecutions","getAppHealth","listWebhookExecutors","appIdLockKey","waitWorkflowExecution","TAILOR_LOCK_VERSION","triggerExecutor","formatDiffSummary","startWorkflow","getNamespacesWithMigrations","loadTailorDBNamespaces","getExecutor","formatMigrationDiff","deployStaticWebsite","executeScript","prompt","logBetaWarning","hasChanges","getWorkflow","resolveAppId","listExecutorJobs","ensureConfigId","watchExecutorJob","resumeWorkflow","compareLocalTypesWithSnapshot","findAppIdLock","listExecutors","generateUserTypes","defineAppCommand","createSnapshotFromLocalTypes","deploy","show","getNextMigrationNumber","workspaceNameSchema","getFunctionRegistry","MIGRATION_LABEL_KEY","TAILOR_LOCK_FILENAME","updateOrganization","loadSeedContext","organizationTree","assertWritable","bundleSeedDumpScript","getOrganization","apiCall","waitForExecution","updateFolder","loadConfig","bundleSeedScript","getWorkspace","teardownTemporaryWorkflow","createFolder","getMigrationFilePath","listFunctionRegistries","DB_TYPES_FILE_NAME","isRetryableWaitError","listUsers","MIGRATE_FILE_NAME","createTemporaryWorkflow","MIGRATE_PGLITE_TEST_FILE_NAME","SCHEMA_FILE_NAME","serializeError","restoreWorkspace","errorToJson","query","reclaimTemporaryWorkflow","truncate","removeAdoptedConfigIds","compareSnapshots","parseAppIds","getExecutorJob","removeUser","DIFF_FILE_NAME","getOAuth2Client","joinFunctionLogMessages","generate","annotateTerminalError","listTemporaryWorkflowExecutions","createWorkspace","uploadTemporaryFunction","inviteUser","MIGRATE_TEST_FILE_NAME","listMachineUsers","listOrganizations","chunkSeedData","withSourceLocation","listWorkspaces","pollUntilTerminal","deleteFolder","updateUser","DB_PGLITE_SCHEMA_FILE_NAME","registerTsHook","reconstructSnapshotFromMigrations","isExecutionActive","getFolder","INITIAL_SCHEMA_NUMBER","getMachineUserToken","getLatestMigrationNumber","bundleMigrationScript","extractOwnedNamespaces","listApps","getMigrationFiles","WORKSPACE_NAME_MAX_LENGTH","deleteWorkspace","getMigrationDirPath","getWorkflowExecution","buildOptionsOf","initOperatorClient","WorkflowExecution_Status","isPluginGeneratedTable","SUBJECT","options","pollInterval","name","created","workflowId","error","client","invoker","arg","execution","use","params","response","ConnectError","Code","names","active","workspaceId","executionId","job","attempt","resolve","logs","result","canceled","defineCommand","listOAuth2Clients","generate$1","runCommand","runMain"],"sources":["../../src/cli/shared/script-workflow.ts","../../src/cli/lib.ts"],"sourcesContent":["/**\n * Script execution through a temporary workflow\n *\n * Synchronous script execution is bound by the platform's 60s function\n * deadline. A script that has to outlive it is registered once as a temporary\n * workflow, started once per argument, and removed when the caller is done.\n * Every start passes its argument to the job as the argument of `main`, the\n * same contract synchronous execution has.\n */\n\nimport { Code, ConnectError } from \"@connectrpc/connect\";\nimport { WorkflowExecution_Status } from \"@tailor-platform/tailor-proto/workflow_resource_pb\";\nimport { recoveryContextArgs } from \"#/cli/shared/args\";\nimport { CLIError, formatCommandHint } from \"#/cli/shared/errors\";\nimport { joinFunctionLogMessages } from \"#/cli/shared/function-execution\";\nimport {\n createTemporaryWorkflow,\n isExecutionActive,\n listTemporaryWorkflowExecutions,\n pollUntilTerminal,\n reclaimTemporaryWorkflow,\n teardownTemporaryWorkflow,\n uploadTemporaryFunction,\n} from \"#/cli/shared/temporary-workflow\";\nimport { isRetryableWaitError } from \"#/cli/shared/wait-error\";\nimport type { OperatorClient } from \"#/cli/shared/client\";\nimport type { ScriptExecutionResult, ScriptInvoker } from \"#/cli/shared/script-executor\";\nimport type { CreatedTemporaryWorkflow } from \"#/cli/shared/temporary-workflow\";\nimport type { FunctionExecution } from \"@tailor-platform/tailor-proto/function_resource_pb\";\nimport type { WorkflowExecution } from \"@tailor-platform/tailor-proto/workflow_resource_pb\";\nimport type { Jsonifiable } from \"type-fest\";\n\n/** Poll interval while waiting for a started script to finish. */\nconst POLL_INTERVAL_MS = 3000;\n\n/** Subject of the temporary resources in messages. */\nconst SUBJECT = \"script\";\n\n/**\n * Options for {@link withScriptWorkflow}\n */\nexport interface ScriptWorkflowOptions {\n /** Operator client instance */\n client: OperatorClient;\n /** Workspace ID */\n workspaceId: string;\n /**\n * Name shared by the function, job function and workflow. Stable per kind of\n * run, so a retry reclaims the leftovers of an interrupted one.\n */\n name: string;\n /** Description recorded on the registered function */\n description: string;\n /** Bundled script code exporting `main` */\n code: string;\n /** Auth invoker for the script */\n invoker: ScriptInvoker;\n /** Name of the owning application, recorded in the resources' labels */\n appName: string;\n /** Sentence telling how a resource left behind after a failed removal gets removed */\n leftoverNote: string;\n /** Profile the run uses, carried into the hint of a refusal so the hinted command selects it too */\n profile?: string | undefined;\n /** Poll interval in milliseconds (default: 3000ms) */\n pollIntervalMs?: number;\n}\n\n/**\n * Start the script with an argument and wait for it to finish.\n */\nexport type RunScript = (arg: Jsonifiable) => Promise<ScriptExecutionResult>;\n\n/**\n * Register the script as a temporary workflow, hand `use` a function that runs\n * it once per argument, and remove the resources afterwards, whether or not\n * `use` threw.\n * @param options - Script and where to register it\n * @param use - Receives the function that starts the script\n * @returns What `use` returned\n */\nexport async function withScriptWorkflow<T>(\n options: ScriptWorkflowOptions,\n use: (run: RunScript) => Promise<T>,\n): Promise<T> {\n const { client, workspaceId, name, appName, invoker, leftoverNote, profile } = options;\n const pollInterval = options.pollIntervalMs ?? POLL_INTERVAL_MS;\n\n await assertMachineUserExists({ client, workspaceId, invoker });\n await assertNoActiveScriptWorkflow({ client, workspaceId, names: [name], profile });\n await reclaimTemporaryWorkflow({\n client,\n workspaceId,\n name,\n subject: SUBJECT,\n leftoverNote,\n });\n\n const created: CreatedTemporaryWorkflow = {};\n let workflowId: string;\n try {\n await uploadTemporaryFunction({\n client,\n workspaceId,\n name,\n code: options.code,\n description: options.description,\n appName,\n appId: undefined,\n });\n workflowId = await createTemporaryWorkflow(\n {\n client,\n workspaceId,\n name,\n jobFunctionNames: [name],\n appName,\n appId: undefined,\n subject: SUBJECT,\n },\n created,\n );\n } catch (error) {\n await teardownTemporaryWorkflow({\n client,\n workspaceId,\n name,\n workflowId: created.workflowId,\n subject: SUBJECT,\n leftoverNote,\n });\n throw error;\n }\n\n const run: RunScript = async (arg) => {\n const { executionId } = await client.startWorkflow({\n workspaceId,\n workflowId,\n authInvoker: invoker,\n arg: JSON.stringify(arg),\n });\n const execution = await pollUntilTerminal({\n client,\n workspaceId,\n executionId,\n pollInterval,\n subject: \"Script\",\n });\n return await readOutcome({ client, workspaceId, execution, pollInterval });\n };\n\n try {\n return await use(run);\n } finally {\n await teardownTemporaryWorkflow({\n client,\n workspaceId,\n name,\n workflowId,\n subject: SUBJECT,\n leftoverNote,\n });\n }\n}\n\ninterface AssertMachineUserExistsParams {\n client: OperatorClient;\n workspaceId: string;\n invoker: ScriptInvoker;\n}\n\n/**\n * Fail before anything is registered when the machine user does not exist: the platform accepts the\n * start anyway and ends the execution before any job runs, which leaves no message naming the cause.\n * @param params - Machine user the script runs as\n */\nasync function assertMachineUserExists(params: AssertMachineUserExistsParams): Promise<void> {\n const { client, workspaceId, invoker } = params;\n const machineUser = await client\n .getAuthMachineUser({\n workspaceId,\n authNamespace: invoker.namespace,\n name: invoker.machineUserName,\n })\n .then((response) => response.machineUser)\n .catch((error: unknown) => {\n if (error instanceof ConnectError && error.code === Code.NotFound) return undefined;\n throw error;\n });\n if (!machineUser) {\n throw CLIError({\n code: \"MACHINE_USER_NOT_FOUND\",\n message: `Machine user ${invoker.machineUserName} not found in the auth namespace ${invoker.namespace}.`,\n });\n }\n}\n\n/**\n * Options for {@link assertNoActiveScriptWorkflow}\n */\nexport interface AssertNoActiveScriptWorkflowOptions {\n /** Operator client instance */\n client: OperatorClient;\n /** Workspace ID */\n workspaceId: string;\n /** Names of the temporary workflows to check */\n names: readonly string[];\n /** Profile the run uses, carried into the hint so the hinted command selects it too */\n profile?: string | undefined;\n}\n\n/**\n * Refuse to go on while an earlier run of one of the workflows is still executing: an interrupted\n * command leaves its chunk running on the platform, and removing the workflow under it would make\n * the chunk's outcome unknowable. A caller that deletes data before it runs a script calls this\n * first, so the refusal comes before anything is deleted.\n * @param options - Workflows to check and the workspace they live in\n */\nexport async function assertNoActiveScriptWorkflow(\n options: AssertNoActiveScriptWorkflowOptions,\n): Promise<void> {\n const { client, workspaceId, names, profile } = options;\n for (const name of names) {\n const executions = await listTemporaryWorkflowExecutions(client, workspaceId, name);\n const active = executions.find(isExecutionActive);\n if (!active) continue;\n\n throw CLIError({\n code: \"SCRIPT_WORKFLOW_EXECUTION_ACTIVE\",\n message: `The temporary workflow '${name}' still has an execution that is running (${active.id}).`,\n suggestion:\n \"An earlier command that was interrupted can still be applying its chunk. \" +\n `Wait for the execution to finish (${formatCommandHint({\n command: \"tailor\",\n args: [\n \"workflow\",\n \"executions\",\n active.id,\n ...recoveryContextArgs({ workspaceId, profile }),\n ],\n })}), then run the command again.`,\n context: { workflowName: name, executionId: active.id },\n });\n }\n}\n\n/** Reads of the job's function execution tried through transient errors. */\nconst READ_ATTEMPTS = 3;\n\ninterface ReadOutcomeParams {\n client: OperatorClient;\n workspaceId: string;\n /** Workflow execution in a terminal state */\n execution: WorkflowExecution;\n /** Wait between reads in milliseconds */\n pollInterval: number;\n}\n\n/**\n * Read the logs and result of the job that ran the script. A workflow\n * execution carries neither; both live on the job's function execution, and\n * the run's outcome is lost if they cannot be read, so a transient error is\n * retried.\n * @param params - Execution to read the outcome of\n * @returns Result in the shape synchronous execution reports\n */\nasync function readOutcome(params: ReadOutcomeParams): Promise<ScriptExecutionResult> {\n const { client, workspaceId, execution, pollInterval } = params;\n const executionId = execution.jobExecutions.at(-1)?.executionId;\n let job: FunctionExecution | undefined;\n for (let attempt = 1; executionId && attempt <= READ_ATTEMPTS; attempt++) {\n try {\n ({ execution: job } = await client.getFunctionExecution({ workspaceId, executionId }));\n break;\n } catch (error) {\n if (error instanceof ConnectError && error.code === Code.NotFound) break;\n if (attempt === READ_ATTEMPTS || !isRetryableWaitError(error)) throw error;\n await new Promise((resolve) => setTimeout(resolve, pollInterval));\n }\n }\n const logs = job ? joinFunctionLogMessages(job.logEntries) : \"\";\n const result = job?.result ?? \"\";\n\n if (execution.status === WorkflowExecution_Status.SUCCESS) {\n if (!job) {\n return {\n success: false,\n logs,\n result,\n error:\n \"The workflow finished, but the result of its job could not be read, so it is unknown whether the script's changes were applied\",\n };\n }\n return { success: true, logs, result };\n }\n const canceled = execution.status === WorkflowExecution_Status.CANCELED;\n const error =\n job?.error?.message.trim() ||\n result.trim() ||\n (canceled ? \"Script execution was canceled\" : \"Script execution failed with unknown error\");\n return { success: false, logs, result, error };\n}\n","// CLI API exports for programmatic usage\nimport { registerTsHook } from \"./shared/register-ts-hook\";\n\nawait registerTsHook(new URL(\"./ts-hook.mjs\", import.meta.url));\n\n// CLI foundation shared with plugins. Plugins resolve this package at runtime,\n// so logger state (--json / --verbose) set through these args reaches the SDK\n// code paths they call into. The @politty/zod surface is re-exported for the\n// same reason: arg metadata (aliases, env bindings, effects) lives in a\n// @politty/zod module-level registry, so registration and parsing must use\n// one @politty/zod copy.\nexport { arg, defineCommand, runCommand, runMain } from \"@politty/zod\";\nexport { logger, styles, type LogMode, type LogOptions, type OutOptions } from \"./shared/logger\";\nexport { defineAppCommand } from \"./shared/command\";\nexport { logBetaWarning } from \"./shared/beta\";\nexport { prompt } from \"./shared/prompt\";\nexport { WORKSPACE_NAME_MAX_LENGTH, workspaceNameSchema } from \"./shared/workspace-name\";\nexport {\n createCommonArgs,\n workspaceArgs,\n configArg,\n confirmationArgs,\n deploymentArgs,\n loadEnvFiles,\n loadEnvFilesFromArgv,\n type CommonArgsType,\n} from \"./shared/args\";\nexport { deploy, deploy as apply } from \"./commands/deploy/deploy\";\nexport type { DeployOptions, DeployOptions as ApplyOptions } from \"./commands/deploy/deploy\";\nexport type { BundledScripts } from \"./commands/deploy/function-registry\";\nexport { ensureConfigId } from \"./commands/deploy/config-id-injector\";\nexport {\n TAILOR_LOCK_FILENAME,\n TAILOR_LOCK_VERSION,\n appIdLockKey,\n findAppIdLock,\n parseAppIds,\n planAppIds,\n removeAdoptedConfigIds,\n resolveAppId,\n type AppIdEntry,\n type AppIdEntryInput,\n type AppIdLock,\n type AppIdPlan,\n type AppIdPlanMode,\n type AppIds,\n type PlanAppIdsParams,\n type RemoveAdoptedConfigIdsResult,\n type ResolveAppIdParams,\n} from \"./commands/deploy/app-id-lock\";\nexport { generate } from \"./commands/generate/service\";\nexport type { GenerateOptions } from \"./commands/generate/options\";\nexport { loadConfig, type LoadedConfig } from \"./shared/config-loader\";\nexport { extractOwnedNamespaces } from \"./shared/config\";\nexport { errorToJson, serializeError, type ErrorToJsonOptions } from \"./shared/error-json\";\nexport { annotateTerminalError, withSourceLocation } from \"./shared/github-actions\";\nexport type { ErrorSourceLocation } from \"./shared/error-diagnostics\";\nexport { generateUserTypes } from \"./shared/type-generator\";\nexport {\n loadTailorDBNamespaces,\n type TailorDBNamespaceSelector,\n type LoadTailorDBNamespacesOptions,\n type LoadedTailorDBNamespaces,\n} from \"./shared/tailordb-namespaces\";\nexport {\n deployStaticWebsite,\n type DeployResult as StaticWebsiteDeployResult,\n} from \"./commands/staticwebsite/deploy\";\nexport { assertWritable } from \"./shared/readonly-guard\";\nexport { isPluginGeneratedTable } from \"#/parser/service/tailordb/type-source\";\nexport type {\n GeneratorResult,\n Plugin,\n PluginAttachment,\n TailorDBNamespaceData,\n} from \"#/plugin/types\";\nexport type {\n TailorDBType,\n TypeSourceInfoEntry,\n ParsedField,\n OperatorFieldConfig,\n PluginGeneratedTableSource,\n} from \"#/parser/service/tailordb/types\";\nexport type { Resolver } from \"#/types/resolver.generated\";\nexport type { Executor } from \"#/types/executor.generated\";\n\nexport {\n show,\n type ShowOptions,\n type ApplicationInfo,\n type ShowInfo,\n type AIGatewayInfo,\n type ShowStaticWebsiteInfo,\n type ShowOAuth2ClientInfo,\n} from \"./commands/show\";\nexport { remove, type RemoveOptions } from \"./commands/remove\";\nexport { createWorkspace, type CreateWorkspaceOptions } from \"./commands/workspace/create\";\nexport { listWorkspaces, type ListWorkspacesOptions } from \"./commands/workspace/list\";\nexport { deleteWorkspace, type DeleteWorkspaceOptions } from \"./commands/workspace/delete\";\nexport { getWorkspace, type GetWorkspaceOptions } from \"./commands/workspace/get\";\nexport { restoreWorkspace, type RestoreWorkspaceOptions } from \"./commands/workspace/restore\";\nexport type { WorkspaceInfo, WorkspaceDetails } from \"./commands/workspace/transform\";\nexport { listUsers, type ListUsersOptions } from \"./commands/workspace/user/list\";\nexport { inviteUser, type InviteUserOptions } from \"./commands/workspace/user/invite\";\nexport { updateUser, type UpdateUserOptions } from \"./commands/workspace/user/update\";\nexport { removeUser, type RemoveUserOptions } from \"./commands/workspace/user/remove\";\nexport type { UserInfo } from \"./commands/workspace/user/transform\";\nexport { listApps, type ListAppsOptions } from \"./commands/workspace/app/list\";\nexport {\n getAppHealth,\n type HealthOptions as GetAppHealthOptions,\n} from \"./commands/workspace/app/health\";\nexport type { AppInfo, AppHealthInfo } from \"./commands/workspace/app/transform\";\nexport { getFunctionRegistry, type GetFunctionRegistryOptions } from \"./commands/function/get\";\nexport {\n listFunctionRegistries,\n type ListFunctionRegistriesOptions,\n} from \"./commands/function/list\";\nexport type { FunctionRegistryInfo } from \"./commands/function/transform\";\nexport {\n listMachineUsers,\n type ListMachineUsersOptions,\n type MachineUserInfo,\n} from \"./commands/machineuser/list\";\nexport {\n getMachineUserToken,\n type GetMachineUserTokenOptions,\n type MachineUserTokenInfo,\n} from \"./commands/machineuser/token\";\nexport { getOAuth2Client, type GetOAuth2ClientOptions } from \"./commands/oauth2client/get\";\nexport { listOAuth2Clients, type ListOAuth2ClientsOptions } from \"./commands/oauth2client/list\";\nexport type { OAuth2ClientInfo, OAuth2ClientCredentials } from \"./commands/oauth2client/transform\";\nexport { listWorkflows, type ListWorkflowsOptions } from \"./commands/workflow/list\";\nexport { getWorkflow, type GetWorkflowTypedOptions } from \"./commands/workflow/get\";\nexport type { MachineUserName } from \"@tailor-platform/sdk\";\nexport {\n startWorkflow,\n type StartWorkflowTypedOptions,\n type StartWorkflowResultWithWait,\n type WaitOptions,\n} from \"./commands/workflow/start\";\nexport {\n listWorkflowExecutions,\n getWorkflowExecution,\n type ListWorkflowExecutionsTypedOptions,\n type GetWorkflowExecutionOptions,\n type GetWorkflowExecutionResult,\n type WorkflowExecutionWaitInfo,\n} from \"./commands/workflow/executions\";\nexport { waitWorkflowExecution, type WorkflowWaitOutput } from \"./commands/workflow/wait\";\nexport type { WaitWorkflowExecutionOptions, WorkflowWaitResult } from \"./commands/workflow/waiter\";\nexport {\n resumeWorkflow,\n type ResumeWorkflowOptions,\n type ResumeWorkflowResultWithWait,\n} from \"./commands/workflow/resume\";\nexport type {\n WorkflowListInfo,\n WorkflowInfo,\n WorkflowExecutionInfo,\n WorkflowJobExecutionInfo,\n} from \"./commands/workflow/transform\";\nexport type { FunctionLogEntryInfo } from \"./shared/function-execution\";\nexport {\n triggerExecutor,\n type TriggerExecutorTypedOptions,\n type TriggerExecutorResult,\n} from \"./commands/executor/trigger\";\nexport {\n listExecutorJobs,\n getExecutorJob,\n getExecutorWaitFailureMessage,\n watchExecutorJob,\n type ListExecutorJobsTypedOptions,\n type GetExecutorJobTypedOptions,\n type WatchExecutorJobTypedOptions,\n type ExecutorJobDetailInfo,\n type WatchExecutorJobResult,\n} from \"./commands/executor/jobs\";\nexport { listExecutors, type ListExecutorsOptions } from \"./commands/executor/list\";\nexport { getExecutor, type GetExecutorTypedOptions } from \"./commands/executor/get\";\nexport {\n listWebhookExecutors,\n type ListWebhookExecutorsOptions,\n type WebhookExecutorInfo,\n} from \"./commands/executor/webhook\";\nexport type {\n ExecutorJobListInfo,\n ExecutorJobInfo,\n ExecutorJobAttemptInfo,\n ExecutorListInfo,\n ExecutorInfo,\n} from \"./commands/executor/transform\";\nexport { listOrganizations, type ListOrganizationsOptions } from \"./commands/organization/list\";\nexport { getOrganization, type GetOrganizationOptions } from \"./commands/organization/get\";\nexport { updateOrganization, type UpdateOrganizationOptions } from \"./commands/organization/update\";\nexport { organizationTree, type OrganizationTreeOptions } from \"./commands/organization/tree\";\nexport type {\n UserOrganizationInfo,\n OrganizationInfo,\n FolderListInfo,\n FolderInfo,\n} from \"./commands/organization/transform\";\nexport { listFolders, type ListFoldersOptions } from \"./commands/organization/folder/list\";\nexport { getFolder, type GetFolderOptions } from \"./commands/organization/folder/get\";\nexport { createFolder, type CreateFolderOptions } from \"./commands/organization/folder/create\";\nexport { updateFolder, type UpdateFolderOptions } from \"./commands/organization/folder/update\";\nexport { deleteFolder, type DeleteFolderOptions } from \"./commands/organization/folder/delete\";\nexport { loadAccessToken, loadWorkspaceId } from \"./shared/context\";\nexport { apiCall, type ApiCallOptions, type ApiCallResult } from \"./commands/api\";\nexport { query } from \"./query\";\nexport { truncate, type TruncateOptions } from \"./commands/tailordb/truncate\";\n\n// Migration exports\nexport {\n generate as migrateGenerate,\n type GenerateOptions as MigrateGenerateOptions,\n type GenerateResult as MigrateGenerateResult,\n} from \"./commands/tailordb/migrate/generate\";\nexport {\n createSnapshotFromLocalTypes,\n reconstructSnapshotFromMigrations,\n compareSnapshots,\n getNextMigrationNumber,\n getLatestMigrationNumber,\n getMigrationFiles,\n compareLocalTypesWithSnapshot,\n} from \"./commands/tailordb/migrate/snapshot\";\nexport {\n getNamespacesWithMigrations,\n type NamespaceWithMigrations,\n} from \"./commands/tailordb/migrate/config\";\nexport {\n hasChanges,\n formatMigrationDiff,\n formatDiffSummary,\n type MigrationDiff,\n type BreakingChangeInfo,\n} from \"./commands/tailordb/migrate/diff-calculator\";\nexport {\n SCHEMA_FILE_NAME,\n DIFF_FILE_NAME,\n MIGRATE_FILE_NAME,\n MIGRATE_TEST_FILE_NAME,\n MIGRATE_PGLITE_TEST_FILE_NAME,\n DB_TYPES_FILE_NAME,\n DB_PGLITE_SCHEMA_FILE_NAME,\n INITIAL_SCHEMA_NUMBER,\n getMigrationDirPath,\n getMigrationFilePath,\n type SchemaSnapshot,\n type NormalizedSchemaSnapshot,\n type TailorDBSnapshotType,\n type SnapshotFieldConfig,\n} from \"./commands/tailordb/migrate/snapshot\";\nexport { MIGRATION_LABEL_KEY } from \"./commands/tailordb/migrate/types\";\n\n// Seed exports\nexport {\n loadSeedContext,\n type LoadSeedContextOptions,\n type SeedContext,\n type SeedIdpUserContext,\n type SeedNamespaceConfig,\n} from \"./shared/seed-context\";\nexport {\n chunkSeedData,\n type SeedChunk,\n type ChunkSeedDataOptions,\n type SeedData,\n} from \"./shared/seed-chunker\";\nexport {\n bundleSeedScript,\n bundleSeedDumpScript,\n type SeedBundleBuildOptions,\n type SeedBundleResult,\n type SeedDumpBundleResult,\n} from \"./commands/generate/seed/bundler\";\nexport { buildOptionsOf } from \"./shared/build-options\";\nexport {\n bundleMigrationScript,\n type MigrationBundleResult,\n} from \"./commands/tailordb/migrate/bundler\";\nexport {\n executeScript,\n waitForExecution,\n type ScriptExecutionOptions,\n type ScriptExecutionResult,\n type ScriptInvoker,\n type ExecutionWaitResult,\n} from \"./shared/script-executor\";\nexport {\n assertNoActiveScriptWorkflow,\n withScriptWorkflow,\n type RunScript,\n type ScriptWorkflowOptions,\n} from \"./shared/script-workflow\";\nexport { initOperatorClient, type OperatorClient } from \"./shared/client\";\nexport type { AuthInvoker } from \"@tailor-platform/tailor-proto/auth_resource_pb\";\n"],"mappings":"A,69CAiCA,MAGMgI,EAAU,SA4ChB,eAAsB,mBACpB,EACA,EACY,CACZ,GAAM,CAAE,SAAQ,cAAa,OAAM,UAAS,UAAS,eAAc,WAAYC,EACzEC,EAAeD,EAAQ,gBAAkB,IAE/C,MAAM,wBAAwB,CAAE,SAAQ,cAAa,SAAQ,CAAC,EAC9D,MAAM,6BAA6B,CAAE,SAAQ,cAAa,MAAO,CAACE,CAAI,EAAG,SAAQ,CAAC,EAClF,MAAMhD,GAAyB,CAC7B,SACA,cACA,OACA,QAAS6C,EACT,cACF,CAAC,EAED,IAAMI,EAAoC,CAAC,EACvCC,EACJ,GAAI,CACF,MAAMpC,GAAwB,CAC5B,SACA,cACA,OACA,KAAMgC,EAAQ,KACd,YAAaA,EAAQ,YACrB,UACA,MAAO,IAAA,EACT,CAAC,EACD,EAAa,MAAMrD,GACjB,CACE,SACA,cACA,OACA,iBAAkB,CAACuD,CAAI,EACvB,UACA,MAAO,IAAA,GACP,QAASH,CACX,EACAI,CACF,CACF,OAASE,EAAO,CASd,MARA,MAAMlE,EAA0B,CAC9B,SACA,cACA,OACA,WAAYgE,EAAQ,WACpB,QAASJ,EACT,cACF,CAAC,EACKM,CACR,CAEA,IAAM,IAAiB,KAAO,IAAQ,CACpC,GAAM,CAAE,eAAgB,MAAMC,EAAO,cAAc,CACjD,cACA,aACA,YAAaC,EACb,IAAK,KAAK,UAAUC,CAAG,CACzB,CAAC,EACKC,EAAY,MAAMjC,GAAkB,CACxC,SACA,cACA,cACA,eACA,QAAS,QACX,CAAC,EACD,OAAO,MAAM,YAAY,CAAE,SAAQ,cAAa,YAAW,cAAa,CAAC,CAC3E,EAEA,GAAI,CACF,OAAO,MAAMkC,EAAI,GAAG,CACtB,QAAU,CACR,MAAMvE,EAA0B,CAC9B,SACA,cACA,OACA,aACA,QAAS4D,EACT,cACF,CAAC,CACH,CACF,CAaA,eAAe,wBAAwB,EAAsD,CAC3F,GAAM,CAAE,SAAQ,cAAa,WAAYY,EAYzC,GAAI,CAAC,MAXqBL,EACvB,mBAAmB,CAClB,cACA,cAAeC,EAAQ,UACvB,KAAMA,EAAQ,eAChB,CAAC,CAAC,CACD,KAAM,GAAaK,EAAS,WAAW,CAAC,CACxC,MAAO,GAAmB,CACzB,GAAI,eAAiBC,GAAgBR,EAAM,OAASS,EAAK,UACzD,MAAMT,CACR,CAAC,EAED,MAAMnI,EAAS,CACb,KAAM,yBACN,QAAS,gBAAgBqI,EAAQ,gBAAgB,mCAAmCA,EAAQ,UAAU,EACxG,CAAC,CAEL,CAuBA,eAAsB,6BACpB,EACe,CACf,GAAM,CAAE,SAAQ,cAAa,QAAO,WAAYP,EAChD,IAAK,IAAME,KAAQa,EAAO,CAExB,IAAMC,GAAS,MADUlD,GAAgCwC,EAAQW,EAAaf,CAAI,EAAA,CACxD,KAAKpB,EAAiB,EAChD,GAAKkC,EAEL,MAAM9I,EAAS,CACb,KAAM,mCACN,QAAS,2BAA2BgI,EAAK,4CAA4Cc,EAAO,GAAG,IAC/F,WACE,8GACqC/I,EAAkB,CACrD,QAAS,SACT,KAAM,CACJ,WACA,aACA+I,EAAO,GACP,GAAGrI,EAAoB,CAAE,cAAa,SAAQ,CAAC,CACjD,CACF,CAAC,EAAE,gCACL,QAAS,CAAE,aAAcuH,EAAM,YAAac,EAAO,EAAG,CACxD,CAAC,CACH,CACF,CAsBA,eAAe,YAAY,EAA2D,CACpF,GAAM,CAAE,SAAQ,cAAa,YAAW,gBAAiBL,EACnDO,EAAcT,EAAU,cAAc,GAAG,EAAE,CAAC,EAAE,YAChDU,EACJ,IAAK,IAAIC,EAAU,EAAGF,GAAeE,GAAW,EAAe,IAC7D,GAAI,EACD,CAAE,UAAWD,GAAQ,MAAMb,EAAO,qBAAqB,CAAE,cAAa,aAAY,CAAC,GACpF,KACF,OAASD,EAAO,CACd,GAAIA,aAAiBQ,GAAgBR,EAAM,OAASS,EAAK,SAAU,MACnE,GAAIM,IAAY,GAAiB,CAAC5E,GAAqB6D,CAAK,EAAG,MAAMA,EACrE,MAAM,IAAI,QAAS,GAAY,WAAWgB,EAASpB,CAAY,CAAC,CAClE,CAEF,IAAMqB,EAAOH,EAAMxD,GAAwBwD,EAAI,UAAU,EAAI,GACvDI,EAASJ,GAAK,QAAU,GAE9B,GAAIV,EAAU,SAAWZ,EAAyB,QAUhD,OATKsB,EASE,CAAE,QAAS,GAAM,OAAM,QAAO,EAR5B,CACL,QAAS,GACT,OACA,SACA,MACE,gIACJ,EAIJ,IAAMK,EAAWf,EAAU,SAAWZ,EAAyB,SAK/D,MAAO,CAAE,QAAS,GAAO,OAAM,SAAQ,MAHrCsB,GAAK,OAAO,QAAQ,KAAK,GACzBI,EAAO,KAAK,IACXC,EAAW,gCAAkC,6CACH,CAC/C,CCzSA,MAAM5C,GAAe,IAAI,IAAI,gBAAiB,YAAY,GAAG,CAAC,E"}
|