@tailor-platform/sdk 2.1.0 → 2.2.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 +84 -0
- package/{dist/cli/index.mjs → bin/tailor.mjs} +1 -1
- package/dist/{application-D77KJFKD.mjs → application-BpLeawBg.mjs} +6 -6
- package/dist/{application-D77KJFKD.mjs.map → application-BpLeawBg.mjs.map} +1 -1
- package/dist/application-BxLLiLsr.mjs +3 -0
- package/dist/cli/commands/deploy/tailordb/index.d.mts +2 -1
- package/dist/cli/commands/deploy/types.d.mts +2 -1
- package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +11 -4
- package/dist/cli/commands/tailordb/migrate/file-state.d.mts +1 -0
- package/dist/cli/commands/tailordb/migrate/schema-checks.d.mts +2 -2
- package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +8 -1
- package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +5 -3
- package/dist/cli/lib.d.mts +4 -4
- package/dist/cli/lib.mjs +3 -482
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/main.mjs +975 -193
- package/dist/cli/main.mjs.map +1 -1
- package/dist/completion/zsh-worker.zsh +145 -2
- package/dist/configure/index.d.mts +2 -2
- package/dist/configure/services/index.d.mts +2 -1
- package/dist/configure/services/tailordb/index.d.mts +2 -1
- package/dist/configure/services/tailordb/schema.d.mts +46 -46
- package/dist/configure/services/tailordb/types.d.mts +30 -4
- package/dist/{crashreport-B5LqCTfF.mjs → crashreport-CIIfLnoO.mjs} +2 -2
- package/dist/{crashreport-B5LqCTfF.mjs.map → crashreport-CIIfLnoO.mjs.map} +1 -1
- package/dist/{crashreport-eI7ty7ok.mjs → crashreport-CINZ5dVN.mjs} +1 -1
- package/dist/errors-CWj21238.mjs +75 -0
- package/dist/errors-CWj21238.mjs.map +1 -0
- package/dist/kysely/index.d.mts +52 -5
- package/dist/kysely/index.mjs +7 -2
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/{logger-CXQq9YIp.mjs → logger-DSdExfor.mjs} +83 -42
- package/dist/logger-DSdExfor.mjs.map +1 -0
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/{register-ts-hook-BU18uU44.mjs → register-ts-hook-CTth1eqj.mjs} +1587 -272
- package/dist/register-ts-hook-CTth1eqj.mjs.map +1 -0
- package/dist/schema--xYWRGfe.mjs.map +1 -1
- package/dist/seed/index.d.mts +52 -3
- package/dist/seed/index.mjs +200 -44
- package/dist/seed/index.mjs.map +1 -1
- package/dist/{seed-B-yckgQY.mjs → seed-xqM9WIHP.mjs} +8 -8
- package/dist/seed-xqM9WIHP.mjs.map +1 -0
- package/dist/{service-B5WynBHQ.mjs → service-CCwl3Avt.mjs} +3 -3
- package/dist/{service-B5WynBHQ.mjs.map → service-CCwl3Avt.mjs.map} +1 -1
- package/dist/service-_XmjSEGr.mjs +3 -0
- package/dist/{service-k1xy_A5G.mjs → service-goqlJJgA.mjs} +2 -2
- package/dist/{service-k1xy_A5G.mjs.map → service-goqlJJgA.mjs.map} +1 -1
- package/dist/{service_pb-D5--My_M.mjs → service_pb-BEWj1pOV.mjs} +2 -2
- package/dist/{service_pb-D5--My_M.mjs.map → service_pb-BEWj1pOV.mjs.map} +1 -1
- package/dist/{service_pb-i8CmnQP4.mjs → service_pb-BjlhvK9E.mjs} +1 -1
- package/dist/utils/test/index.d.mts +6 -3
- package/dist/utils/test/index.mjs +25 -13
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/index.d.mts +2 -1
- package/dist/vitest/index.mjs +84 -2
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mocks/file.d.mts +1 -1
- package/dist/vitest/pglite-kysely.d.mts +43 -0
- package/dist/{workspace_resource_pb-DXnO2AT-.mjs → workspace_resource_pb-HNIL_Vfj.mjs} +10 -2
- package/dist/{workspace_resource_pb-DXnO2AT-.mjs.map → workspace_resource_pb-HNIL_Vfj.mjs.map} +1 -1
- package/docs/cli/tailordb.md +87 -22
- package/docs/cli-reference.md +13 -11
- package/docs/configuration.md +1 -1
- package/docs/migration/v2.md +1 -1
- package/docs/plugin/custom.md +48 -48
- package/docs/plugin/index.md +24 -24
- package/docs/services/auth.md +10 -10
- package/docs/services/executor.md +1 -1
- package/docs/services/resolver.md +2 -2
- package/docs/services/tailordb-migration.md +375 -76
- package/docs/services/tailordb.md +28 -28
- package/docs/testing.md +2 -0
- package/package.json +12 -7
- package/dist/application-Af1zIqSI.mjs +0 -3
- package/dist/errors-D7583Zz7.mjs +0 -58
- package/dist/errors-D7583Zz7.mjs.map +0 -1
- package/dist/logger-CXQq9YIp.mjs.map +0 -1
- package/dist/register-ts-hook-BU18uU44.mjs.map +0 -1
- package/dist/seed-B-yckgQY.mjs.map +0 -1
- package/dist/service-M7OYziQP.mjs +0 -3
package/dist/cli/lib.mjs
CHANGED
|
@@ -1,489 +1,10 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
import { A as getDistDir, E as createBundleLog, K as initOperatorClient, S as platformBundleDefinePlugin, b as createTsconfigPathsPlugin, g as assertUniqueLocalTailorDBTypeNames, t as defineApplication, y as createGeneratedEntryResolverPlugin } from "../application-D77KJFKD.mjs";
|
|
4
|
-
import { t as multiline } from "../multiline-sfHpTZZK.mjs";
|
|
1
|
+
import { $n as formatDiffSummary, $t as listWorkspaces, A as truncate, At as triggerExecutor, Bn as getMigrationDirPath, D as resumeWorkflow, Dn as INITIAL_SCHEMA_NUMBER, Dr as loadWorkspaceId, Dt as listWebhookExecutors, En as DIFF_FILE_NAME, Et as getFunctionRegistry, F as chunkSeedData, Fn as compareLocalTypesWithSnapshot, Hn as getMigrationFiles, I as bundleSeedScript, In as compareSnapshots, It as listExecutorJobs, J as remove, Jt as deploy, L as generate$1, Ln as createSnapshotFromLocalTypes, Lt as watchExecutorJob, M as loadSeedContext, Mt as listExecutors, Nt as getExecutorJob, On as MIGRATE_FILE_NAME, P as loadTailorDBNamespaces, Pt as getExecutorWaitFailureMessage, Q as organizationTree, S as getAppHealth, St as generate, T as waitWorkflowExecution, Tn as DB_TYPES_FILE_NAME, U as deployStaticWebsite, Un as getNextMigrationNumber, Ut as getWorkflowExecution, Vn as getMigrationFilePath, Vt as getWorkflow, W as show, Wt as listWorkflowExecutions, Yn as MIGRATION_LABEL_KEY, Z as updateOrganization, _ as getWorkspace, _t as getOAuth2Client, at as updateFolder, b as listApps, cn as executeScript, d as listUsers, dn as bundleMigrationScript, dt as deleteFolder, er as formatMigrationDiff, gr as loadConfig, h as restoreWorkspace, hr as assertWritable, ht as listOAuth2Clients, i as query, jn as SCHEMA_FILE_NAME, k as listWorkflows, kn as MIGRATE_TEST_FILE_NAME, l as removeUser, ln as waitForExecution, lt as getFolder, mr as apiCall, n as errorToJson, nn as createWorkspace, nr as getNamespacesWithMigrations, p as inviteUser, pt as createFolder, qn as reconstructSnapshotFromMigrations, qt as getExecutor, r as serializeError, rt as getOrganization, s as updateUser, st as listFolders, t as registerTsHook, tr as hasChanges, tt as listOrganizations, ur as generateUserTypes, vt as getMachineUserToken, wt as listFunctionRegistries, xr as loadAccessToken, xt as listMachineUsers, y as deleteWorkspace, zn as getLatestMigrationNumber, zt as startWorkflow } from "../register-ts-hook-CTth1eqj.mjs";
|
|
2
|
+
import { K as initOperatorClient } from "../application-BpLeawBg.mjs";
|
|
5
3
|
import { t as isPluginGeneratedType } from "../type-source-DH_LH20p.mjs";
|
|
6
|
-
import { a as generateIdpTruncateScriptCode, i as generateIdpSeedScriptCode, o as processIdpUser, r as processLinesDb, t as SeedGeneratorID } from "../seed-B-yckgQY.mjs";
|
|
7
|
-
import * as path from "pathe";
|
|
8
|
-
import { resolveTSConfig } from "pkg-types";
|
|
9
|
-
import * as fs from "node:fs";
|
|
10
|
-
import * as rolldown from "rolldown";
|
|
11
4
|
|
|
12
|
-
//#region src/cli/shared/tailordb-namespaces.ts
|
|
13
|
-
/**
|
|
14
|
-
* Load local TailorDB namespaces along with the config plugins and the
|
|
15
|
-
* defined application. Internal superset of {@link loadTailorDBNamespaces}.
|
|
16
|
-
* @param options - Namespace loading options.
|
|
17
|
-
* @returns The loaded config, plugins, application, and TailorDB namespace data.
|
|
18
|
-
*/
|
|
19
|
-
async function loadApplicationNamespaces(options = {}) {
|
|
20
|
-
const { config, plugins } = await loadConfig(options.configPath);
|
|
21
|
-
await generateUserTypes({
|
|
22
|
-
config,
|
|
23
|
-
configPath: config.path
|
|
24
|
-
});
|
|
25
|
-
const application = defineApplication({
|
|
26
|
-
config,
|
|
27
|
-
pluginManager: plugins.length > 0 ? new PluginManager(plugins) : void 0
|
|
28
|
-
});
|
|
29
|
-
const namespaceNames = typeof options.namespaces === "function" ? options.namespaces(config, plugins) : options.namespaces;
|
|
30
|
-
const namespaceFilter = namespaceNames ? new Set(namespaceNames) : void 0;
|
|
31
|
-
const services = namespaceFilter ? application.tailorDBServices.filter((db) => namespaceFilter.has(db.namespace)) : application.tailorDBServices;
|
|
32
|
-
if (namespaceFilter && services.length !== namespaceFilter.size) {
|
|
33
|
-
const found = new Set(services.map((db) => db.namespace));
|
|
34
|
-
const missing = [...namespaceFilter].filter((ns) => !found.has(ns)).join(", ");
|
|
35
|
-
const available = application.tailorDBServices.map((db) => db.namespace).join(", ");
|
|
36
|
-
throw new Error(`TailorDB namespace "${missing}" not found in local config.db.` + (available ? ` Available owned namespaces: ${available}` : ""));
|
|
37
|
-
}
|
|
38
|
-
const namespaces = [];
|
|
39
|
-
for (const db of services) {
|
|
40
|
-
await db.loadTypes();
|
|
41
|
-
await db.processNamespacePlugins();
|
|
42
|
-
namespaces.push({
|
|
43
|
-
namespace: db.namespace,
|
|
44
|
-
types: { ...db.types },
|
|
45
|
-
sourceInfo: new Map(Object.entries(db.typeSourceInfo)),
|
|
46
|
-
pluginAttachments: db.pluginAttachments
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
config,
|
|
51
|
-
plugins,
|
|
52
|
-
application,
|
|
53
|
-
namespaces
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Load local TailorDB namespaces exactly as SDK generation/deploy sees them:
|
|
58
|
-
* the config is loaded, user types are generated, and each selected
|
|
59
|
-
* namespace's types are loaded with namespace plugins applied.
|
|
60
|
-
* @param options - Namespace loading options.
|
|
61
|
-
* @returns The loaded config and TailorDB namespace data.
|
|
62
|
-
*/
|
|
63
|
-
async function loadTailorDBNamespaces(options = {}) {
|
|
64
|
-
const { config, plugins, namespaces } = await loadApplicationNamespaces(options);
|
|
65
|
-
return {
|
|
66
|
-
config,
|
|
67
|
-
plugins,
|
|
68
|
-
namespaces
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
//#endregion
|
|
73
|
-
//#region src/plugin/builtin/seed/seed-type-processor.ts
|
|
74
|
-
/**
|
|
75
|
-
* Processes TailorDB types to extract seed type information
|
|
76
|
-
* @param type - Parsed TailorDB type
|
|
77
|
-
* @param namespace - Namespace of the type
|
|
78
|
-
* @returns Seed type information
|
|
79
|
-
*/
|
|
80
|
-
function processSeedTypeInfo(type, namespace) {
|
|
81
|
-
const dependencies = /* @__PURE__ */ new Set();
|
|
82
|
-
const selfRefFields = [];
|
|
83
|
-
for (const [fieldName, field] of Object.entries(type.fields)) {
|
|
84
|
-
const targetType = field.relation?.targetType ?? field.config.foreignKeyType;
|
|
85
|
-
if (!targetType) continue;
|
|
86
|
-
if (targetType === type.name) selfRefFields.push(fieldName);
|
|
87
|
-
else dependencies.add(targetType);
|
|
88
|
-
}
|
|
89
|
-
return {
|
|
90
|
-
name: type.name,
|
|
91
|
-
namespace,
|
|
92
|
-
dependencies: Array.from(dependencies),
|
|
93
|
-
selfRefFields,
|
|
94
|
-
dataFile: `data/${type.name}.jsonl`
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Build per-namespace seed ordering information from TailorDB namespace data.
|
|
99
|
-
* @param tailordb - TailorDB namespaces with their types
|
|
100
|
-
* @returns Seed namespace configs, in namespace order
|
|
101
|
-
*/
|
|
102
|
-
function buildSeedNamespaceConfigs(tailordb) {
|
|
103
|
-
return tailordb.map((ns) => {
|
|
104
|
-
const types = [];
|
|
105
|
-
const dependencies = {};
|
|
106
|
-
const selfRefTypes = [];
|
|
107
|
-
const requiredFields = {};
|
|
108
|
-
for (const [typeName, type] of Object.entries(ns.types)) {
|
|
109
|
-
const typeInfo = processSeedTypeInfo(type, ns.namespace);
|
|
110
|
-
types.push(typeInfo.name);
|
|
111
|
-
dependencies[typeInfo.name] = typeInfo.dependencies;
|
|
112
|
-
if (typeInfo.selfRefFields.length > 0) selfRefTypes.push(typeInfo.name);
|
|
113
|
-
const linesDb = processLinesDb(type, assertDefined(ns.sourceInfo.get(typeName), `source info missing for type: ${typeName}`));
|
|
114
|
-
requiredFields[typeInfo.name] = Object.entries(type.fields).filter(([fieldName, field]) => field.config.required !== false && !linesDb.optionalFields.includes(fieldName) && !linesDb.omitFields.includes(fieldName)).map(([fieldName]) => fieldName);
|
|
115
|
-
}
|
|
116
|
-
return {
|
|
117
|
-
namespace: ns.namespace,
|
|
118
|
-
types,
|
|
119
|
-
dependencies,
|
|
120
|
-
selfRefTypes,
|
|
121
|
-
requiredFields
|
|
122
|
-
};
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
//#endregion
|
|
127
|
-
//#region src/cli/shared/seed-context.ts
|
|
128
|
-
/**
|
|
129
|
-
* Load the seed context from the local config. Requires `seedPlugin` to be
|
|
130
|
-
* configured in the config's plugins. A relative `distPath` in the seedPlugin
|
|
131
|
-
* options is resolved against the current working directory — the same base
|
|
132
|
-
* `tailor generate` writes it to.
|
|
133
|
-
* @param options - Seed context loading options.
|
|
134
|
-
* @returns The seed context computed from the local config.
|
|
135
|
-
*/
|
|
136
|
-
async function loadSeedContext(options = {}) {
|
|
137
|
-
const { config, plugins, application, namespaces } = await loadApplicationNamespaces({ configPath: options.configPath });
|
|
138
|
-
assertUniqueLocalTailorDBTypeNames({ tailorDBServices: application.tailorDBServices });
|
|
139
|
-
const seedPlugin = plugins.find((plugin) => plugin.id === SeedGeneratorID);
|
|
140
|
-
if (!seedPlugin) throw new Error(`seedPlugin is not configured in ${config.path}. Add seedPlugin({ distPath: "./seed" }) from "@tailor-platform/sdk/plugin/seed" to definePlugins().`);
|
|
141
|
-
const pluginOptions = seedPlugin.pluginConfig;
|
|
142
|
-
if (typeof pluginOptions?.distPath !== "string" || pluginOptions.distPath === "") throw new Error(`seedPlugin in ${config.path} has no distPath option. Pass seedPlugin({ distPath: "./seed" }) so seed data has a location.`);
|
|
143
|
-
await application.authService?.resolveNamespaces();
|
|
144
|
-
const authInput = getAuthInput(application);
|
|
145
|
-
const idpUserMeta = authInput ? processIdpUser(authInput) : void 0;
|
|
146
|
-
const idpUser = idpUserMeta ? {
|
|
147
|
-
idpNamespace: idpUserMeta.idpNamespace,
|
|
148
|
-
seedScriptCode: generateIdpSeedScriptCode(idpUserMeta.idpNamespace),
|
|
149
|
-
truncateScriptCode: generateIdpTruncateScriptCode(idpUserMeta.idpNamespace)
|
|
150
|
-
} : null;
|
|
151
|
-
return {
|
|
152
|
-
config,
|
|
153
|
-
distPath: path.resolve(pluginOptions.distPath),
|
|
154
|
-
machineUserName: pluginOptions.machineUserName,
|
|
155
|
-
namespaces: buildSeedNamespaceConfigs(namespaces),
|
|
156
|
-
idpUser
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
//#endregion
|
|
161
|
-
//#region src/cli/shared/seed-chunker.ts
|
|
162
|
-
/**
|
|
163
|
-
* Seed data chunker for splitting large seed data into manageable message sizes.
|
|
164
|
-
*
|
|
165
|
-
* When seed data exceeds the gRPC message size limit, this module splits the data
|
|
166
|
-
* into multiple chunks at type boundaries (or record boundaries for large types).
|
|
167
|
-
*/
|
|
168
|
-
/** Default maximum message size: 3.5MB (conservative limit for gRPC) */
|
|
169
|
-
const DEFAULT_MAX_MESSAGE_SIZE = 3.5 * 1024 * 1024;
|
|
170
|
-
/** Reserved bytes for message metadata overhead */
|
|
171
|
-
const METADATA_OVERHEAD = 1024;
|
|
172
|
-
/**
|
|
173
|
-
* Split seed data into chunks that fit within the gRPC message size limit.
|
|
174
|
-
*
|
|
175
|
-
* Algorithm:
|
|
176
|
-
* 1. Calculate the available budget for the arg field (maxMessageSize - codeByteSize - overhead)
|
|
177
|
-
* 2. If all data fits in one message, return a single chunk
|
|
178
|
-
* 3. Otherwise, iterate through types in dependency order:
|
|
179
|
-
* - If a type fits in the current chunk, add it
|
|
180
|
-
* - If adding a type would exceed the budget, finalize the current chunk and start a new one
|
|
181
|
-
* - If a single type exceeds the budget, split its records across multiple chunks
|
|
182
|
-
* - If a single record exceeds the budget, throw an error
|
|
183
|
-
* @param options - Chunking options
|
|
184
|
-
* @returns Array of seed chunks
|
|
185
|
-
*/
|
|
186
|
-
function chunkSeedData(options) {
|
|
187
|
-
const { data, order, codeByteSize, maxMessageSize = DEFAULT_MAX_MESSAGE_SIZE } = options;
|
|
188
|
-
const argBudget = maxMessageSize - codeByteSize - METADATA_OVERHEAD;
|
|
189
|
-
if (argBudget <= 0) throw new Error(`Code size (${codeByteSize} bytes) exceeds the message size limit (${maxMessageSize} bytes). No space left for seed data.`);
|
|
190
|
-
const typesWithData = order.filter((type) => (data[type]?.length ?? 0) > 0);
|
|
191
|
-
if (typesWithData.length === 0) return [];
|
|
192
|
-
if (byteSize(JSON.stringify({
|
|
193
|
-
data,
|
|
194
|
-
order
|
|
195
|
-
})) <= argBudget) return [{
|
|
196
|
-
data,
|
|
197
|
-
order,
|
|
198
|
-
index: 0,
|
|
199
|
-
total: 1
|
|
200
|
-
}];
|
|
201
|
-
const chunks = [];
|
|
202
|
-
let currentData = {};
|
|
203
|
-
let currentOrder = [];
|
|
204
|
-
for (const type of typesWithData) {
|
|
205
|
-
const typeRecords = assertDefined(data[type], `seed data missing for type: ${type}`);
|
|
206
|
-
if (currentOrder.length > 0) {
|
|
207
|
-
const testData = {
|
|
208
|
-
...currentData,
|
|
209
|
-
[type]: typeRecords
|
|
210
|
-
};
|
|
211
|
-
const testOrder = [...currentOrder, type];
|
|
212
|
-
if (byteSize(JSON.stringify({
|
|
213
|
-
data: testData,
|
|
214
|
-
order: testOrder
|
|
215
|
-
})) > argBudget) {
|
|
216
|
-
chunks.push({
|
|
217
|
-
data: currentData,
|
|
218
|
-
order: currentOrder,
|
|
219
|
-
index: chunks.length
|
|
220
|
-
});
|
|
221
|
-
currentData = {};
|
|
222
|
-
currentOrder = [];
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
if (byteSize(JSON.stringify({
|
|
226
|
-
data: { [type]: typeRecords },
|
|
227
|
-
order: [type]
|
|
228
|
-
})) <= argBudget) {
|
|
229
|
-
currentData[type] = typeRecords;
|
|
230
|
-
currentOrder.push(type);
|
|
231
|
-
continue;
|
|
232
|
-
}
|
|
233
|
-
if (currentOrder.length > 0) {
|
|
234
|
-
chunks.push({
|
|
235
|
-
data: currentData,
|
|
236
|
-
order: currentOrder,
|
|
237
|
-
index: chunks.length
|
|
238
|
-
});
|
|
239
|
-
currentData = {};
|
|
240
|
-
currentOrder = [];
|
|
241
|
-
}
|
|
242
|
-
let recordBatch = [];
|
|
243
|
-
for (const record of typeRecords) {
|
|
244
|
-
if (byteSize(JSON.stringify({
|
|
245
|
-
data: { [type]: [record] },
|
|
246
|
-
order: [type]
|
|
247
|
-
})) > argBudget) {
|
|
248
|
-
const singleRecordSize = byteSize(JSON.stringify(record));
|
|
249
|
-
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.`);
|
|
250
|
-
}
|
|
251
|
-
const testBatch = [...recordBatch, record];
|
|
252
|
-
const testData = {
|
|
253
|
-
...currentData,
|
|
254
|
-
[type]: testBatch
|
|
255
|
-
};
|
|
256
|
-
const testOrder = currentOrder.includes(type) ? currentOrder : [...currentOrder, type];
|
|
257
|
-
if (byteSize(JSON.stringify({
|
|
258
|
-
data: testData,
|
|
259
|
-
order: testOrder
|
|
260
|
-
})) > argBudget && recordBatch.length > 0) {
|
|
261
|
-
currentData[type] = recordBatch;
|
|
262
|
-
if (!currentOrder.includes(type)) currentOrder.push(type);
|
|
263
|
-
chunks.push({
|
|
264
|
-
data: currentData,
|
|
265
|
-
order: currentOrder,
|
|
266
|
-
index: chunks.length
|
|
267
|
-
});
|
|
268
|
-
currentData = {};
|
|
269
|
-
currentOrder = [];
|
|
270
|
-
recordBatch = [record];
|
|
271
|
-
} else recordBatch = testBatch;
|
|
272
|
-
}
|
|
273
|
-
if (recordBatch.length > 0) {
|
|
274
|
-
currentData[type] = recordBatch;
|
|
275
|
-
if (!currentOrder.includes(type)) currentOrder.push(type);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
if (currentOrder.length > 0) chunks.push({
|
|
279
|
-
data: currentData,
|
|
280
|
-
order: currentOrder,
|
|
281
|
-
index: chunks.length
|
|
282
|
-
});
|
|
283
|
-
const total = chunks.length;
|
|
284
|
-
return chunks.map((chunk) => ({
|
|
285
|
-
...chunk,
|
|
286
|
-
total
|
|
287
|
-
}));
|
|
288
|
-
}
|
|
289
|
-
function byteSize(str) {
|
|
290
|
-
return new TextEncoder().encode(str).length;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
//#endregion
|
|
294
|
-
//#region src/cli/commands/generate/seed/bundler.ts
|
|
295
|
-
/**
|
|
296
|
-
* Seed script bundler for TailorDB seed data
|
|
297
|
-
*
|
|
298
|
-
* Bundles seed scripts to be executed via TestExecScript API
|
|
299
|
-
*/
|
|
300
|
-
const BATCH_SIZE = 100;
|
|
301
|
-
/**
|
|
302
|
-
* Generate seed script content for server-side execution
|
|
303
|
-
* @param namespace - TailorDB namespace
|
|
304
|
-
* @returns Generated seed script content
|
|
305
|
-
*/
|
|
306
|
-
function generateSeedScriptContent(namespace) {
|
|
307
|
-
return multiline`
|
|
308
|
-
import { Kysely, TailordbDialect } from "@tailor-platform/sdk/kysely";
|
|
309
|
-
|
|
310
|
-
type SeedInput = {
|
|
311
|
-
data: Record<string, Record<string, unknown>[]>;
|
|
312
|
-
order: string[];
|
|
313
|
-
selfRefTypes: string[];
|
|
314
|
-
upsert?: boolean;
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
type SeedResult = {
|
|
318
|
-
success: boolean;
|
|
319
|
-
processed: Record<string, { inserted: number; updated: number; skipped: number }>;
|
|
320
|
-
errors: string[];
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
function getDB(namespace: string) {
|
|
324
|
-
const client = new tailordb.Client({ namespace });
|
|
325
|
-
return new Kysely<Record<string, Record<string, unknown>>>({
|
|
326
|
-
dialect: new TailordbDialect(client),
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
export async function main(input: SeedInput): Promise<SeedResult> {
|
|
331
|
-
const db = getDB("${namespace}");
|
|
332
|
-
const processed: Record<
|
|
333
|
-
string,
|
|
334
|
-
{ inserted: number; updated: number; skipped: number }
|
|
335
|
-
> = {};
|
|
336
|
-
const errors: string[] = [];
|
|
337
|
-
const BATCH_SIZE = ${String(BATCH_SIZE)};
|
|
338
|
-
const upsert = input.upsert === true;
|
|
339
|
-
|
|
340
|
-
for (const typeName of input.order) {
|
|
341
|
-
const records = input.data[typeName];
|
|
342
|
-
if (!records || records.length === 0) {
|
|
343
|
-
console.log(\`[${namespace}] \${typeName}: skipped (no data)\`);
|
|
344
|
-
continue;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
processed[typeName] = { inserted: 0, updated: 0, skipped: 0 };
|
|
348
|
-
const hasSelfRef = (input.selfRefTypes || []).includes(typeName);
|
|
349
|
-
|
|
350
|
-
try {
|
|
351
|
-
let recordsToInsert = records;
|
|
352
|
-
let recordsToUpdate: Record<string, unknown>[] = [];
|
|
353
|
-
if (upsert) {
|
|
354
|
-
const existing = await db
|
|
355
|
-
.selectFrom(typeName)
|
|
356
|
-
.select("id")
|
|
357
|
-
.where(
|
|
358
|
-
"id",
|
|
359
|
-
"in",
|
|
360
|
-
records.map((record) => record.id),
|
|
361
|
-
)
|
|
362
|
-
.execute();
|
|
363
|
-
const existingIds = new Set(existing.map((record) => record.id));
|
|
364
|
-
recordsToInsert = records.filter((record) => !existingIds.has(record.id));
|
|
365
|
-
recordsToUpdate = records.filter((record) => existingIds.has(record.id));
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
if (hasSelfRef) {
|
|
369
|
-
// Insert one-by-one to respect self-referencing foreign key order
|
|
370
|
-
for (const record of recordsToInsert) {
|
|
371
|
-
await db.insertInto(typeName).values(record).execute();
|
|
372
|
-
processed[typeName].inserted += 1;
|
|
373
|
-
}
|
|
374
|
-
if (!upsert) {
|
|
375
|
-
console.log(
|
|
376
|
-
\`[${namespace}] \${typeName}: \${processed[typeName].inserted}/\${records.length} (one-by-one)\`,
|
|
377
|
-
);
|
|
378
|
-
}
|
|
379
|
-
} else {
|
|
380
|
-
for (let i = 0; i < recordsToInsert.length; i += BATCH_SIZE) {
|
|
381
|
-
const batch = recordsToInsert.slice(i, i + BATCH_SIZE);
|
|
382
|
-
await db.insertInto(typeName).values(batch).execute();
|
|
383
|
-
processed[typeName].inserted += batch.length;
|
|
384
|
-
if (!upsert) {
|
|
385
|
-
console.log(
|
|
386
|
-
\`[${namespace}] \${typeName}: \${processed[typeName].inserted}/\${records.length}\`,
|
|
387
|
-
);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
for (const record of recordsToUpdate) {
|
|
393
|
-
const { id, ...values } = record;
|
|
394
|
-
if (Object.keys(values).length === 0) {
|
|
395
|
-
processed[typeName].skipped += 1;
|
|
396
|
-
continue;
|
|
397
|
-
}
|
|
398
|
-
await db.updateTable(typeName).set(values).where("id", "=", id).execute();
|
|
399
|
-
processed[typeName].updated += 1;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
const counts = processed[typeName];
|
|
403
|
-
if (upsert) {
|
|
404
|
-
const skipped = counts.skipped > 0 ? \`, \${counts.skipped} skipped\` : "";
|
|
405
|
-
console.log(
|
|
406
|
-
\`[${namespace}] \${typeName}: \${counts.inserted} inserted, \${counts.updated} updated\${skipped}\`,
|
|
407
|
-
);
|
|
408
|
-
}
|
|
409
|
-
} catch (error) {
|
|
410
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
411
|
-
errors.push(\`\${typeName}: \${message}\`);
|
|
412
|
-
console.error(\`[${namespace}] \${typeName}: failed - \${message}\`);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
return {
|
|
417
|
-
success: errors.length === 0,
|
|
418
|
-
processed,
|
|
419
|
-
errors,
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
`;
|
|
423
|
-
}
|
|
424
|
-
/**
|
|
425
|
-
* Bundle a seed script for server-side execution
|
|
426
|
-
*
|
|
427
|
-
* Creates an entry that:
|
|
428
|
-
* 1. Defines getDB() function inline
|
|
429
|
-
* 2. Processes data in batches using Kysely
|
|
430
|
-
* 3. Reports progress via console.log
|
|
431
|
-
* 4. Exports as main() for TestExecScript
|
|
432
|
-
* @param namespace - TailorDB namespace
|
|
433
|
-
* @param typeNames - List of type names to include in the seed
|
|
434
|
-
* @param baseDir - Directory whose dependencies and tsconfig the generated entry uses
|
|
435
|
-
* @returns Bundled seed script result
|
|
436
|
-
*/
|
|
437
|
-
async function bundleSeedScript(namespace, typeNames, baseDir = process.cwd()) {
|
|
438
|
-
const outputDir = path.resolve(getDistDir(), "seed");
|
|
439
|
-
fs.mkdirSync(outputDir, { recursive: true });
|
|
440
|
-
const entryPath = path.join(outputDir, `seed_${namespace}.entry.ts`);
|
|
441
|
-
const entryContent = generateSeedScriptContent(namespace);
|
|
442
|
-
fs.writeFileSync(entryPath, entryContent);
|
|
443
|
-
let tsconfig;
|
|
444
|
-
try {
|
|
445
|
-
tsconfig = await resolveTSConfig(baseDir);
|
|
446
|
-
} catch {
|
|
447
|
-
tsconfig = void 0;
|
|
448
|
-
}
|
|
449
|
-
const bundleLog = createBundleLog({ tsconfig });
|
|
450
|
-
const result = await rolldown.build({
|
|
451
|
-
plugins: [
|
|
452
|
-
createGeneratedEntryResolverPlugin(entryPath, baseDir),
|
|
453
|
-
createTsconfigPathsPlugin(),
|
|
454
|
-
platformBundleDefinePlugin
|
|
455
|
-
],
|
|
456
|
-
input: entryPath,
|
|
457
|
-
write: false,
|
|
458
|
-
output: {
|
|
459
|
-
format: "esm",
|
|
460
|
-
sourcemap: false,
|
|
461
|
-
minify: false,
|
|
462
|
-
codeSplitting: false,
|
|
463
|
-
globals: { tailordb: "tailordb" }
|
|
464
|
-
},
|
|
465
|
-
external: ["tailordb"],
|
|
466
|
-
resolve: { conditionNames: ["node", "import"] },
|
|
467
|
-
tsconfig,
|
|
468
|
-
treeshake: {
|
|
469
|
-
moduleSideEffects: false,
|
|
470
|
-
annotations: true,
|
|
471
|
-
unknownGlobalSideEffects: false
|
|
472
|
-
},
|
|
473
|
-
...bundleLog.options
|
|
474
|
-
});
|
|
475
|
-
bundleLog.assertAllResolved();
|
|
476
|
-
return {
|
|
477
|
-
namespace,
|
|
478
|
-
bundledCode: result.output[0].code,
|
|
479
|
-
typesIncluded: typeNames
|
|
480
|
-
};
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
//#endregion
|
|
484
5
|
//#region src/cli/lib.ts
|
|
485
6
|
await registerTsHook(new URL("./ts-hook.mjs", import.meta.url));
|
|
486
7
|
|
|
487
8
|
//#endregion
|
|
488
|
-
export { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, MIGRATION_LABEL_KEY, SCHEMA_FILE_NAME, apiCall, deploy as apply, deploy, assertWritable, bundleMigrationScript, bundleSeedScript, chunkSeedData, compareLocalTypesWithSnapshot, compareSnapshots, createFolder, createSnapshotFromLocalTypes, createWorkspace, deleteFolder, deleteWorkspace, deployStaticWebsite, errorToJson, executeScript, 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, isPluginGeneratedType, listApps, listExecutorJobs, listExecutors, listFolders, listFunctionRegistries, listMachineUsers, listOAuth2Clients, listOrganizations, listUsers, listWebhookExecutors, listWorkflowExecutions, listWorkflows, listWorkspaces, loadAccessToken, loadConfig, loadSeedContext, loadTailorDBNamespaces, loadWorkspaceId, generate$1 as migrateGenerate, organizationTree, query, reconstructSnapshotFromMigrations, remove, removeUser, restoreWorkspace, resumeWorkflow, serializeError, show, startWorkflow, triggerExecutor, truncate, updateFolder, updateOrganization, updateUser, waitForExecution, waitWorkflowExecution, watchExecutorJob };
|
|
9
|
+
export { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, MIGRATE_TEST_FILE_NAME, MIGRATION_LABEL_KEY, SCHEMA_FILE_NAME, apiCall, deploy as apply, deploy, assertWritable, bundleMigrationScript, bundleSeedScript, chunkSeedData, compareLocalTypesWithSnapshot, compareSnapshots, createFolder, createSnapshotFromLocalTypes, createWorkspace, deleteFolder, deleteWorkspace, deployStaticWebsite, errorToJson, executeScript, 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, isPluginGeneratedType, listApps, listExecutorJobs, listExecutors, listFolders, listFunctionRegistries, listMachineUsers, listOAuth2Clients, listOrganizations, listUsers, listWebhookExecutors, listWorkflowExecutions, listWorkflows, listWorkspaces, loadAccessToken, loadConfig, loadSeedContext, loadTailorDBNamespaces, loadWorkspaceId, generate$1 as migrateGenerate, organizationTree, query, reconstructSnapshotFromMigrations, remove, removeUser, restoreWorkspace, resumeWorkflow, serializeError, show, startWorkflow, triggerExecutor, truncate, updateFolder, updateOrganization, updateUser, waitForExecution, waitWorkflowExecution, watchExecutorJob };
|
|
489
10
|
//# sourceMappingURL=lib.mjs.map
|
package/dist/cli/lib.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.mjs","names":[],"sources":["../../src/cli/shared/tailordb-namespaces.ts","../../src/plugin/builtin/seed/seed-type-processor.ts","../../src/cli/shared/seed-context.ts","../../src/cli/shared/seed-chunker.ts","../../src/cli/commands/generate/seed/bundler.ts","../../src/cli/lib.ts"],"sourcesContent":["import { defineApplication, type Application } from \"#/cli/services/application\";\nimport { PluginManager } from \"#/plugin/manager\";\nimport { loadConfig, type LoadedConfig } from \"./config-loader\";\nimport { generateUserTypes } from \"./type-generator\";\nimport type { Plugin, TailorDBNamespaceData } from \"#/plugin/types\";\n\n/**\n * Namespace selection for {@link loadTailorDBNamespaces}: explicit namespace\n * names, or a selector deriving them from the loaded config and its plugins.\n * Returning `undefined` (or omitting the option) loads all owned namespaces.\n */\nexport type TailorDBNamespaceSelector =\n | string[]\n | ((config: LoadedConfig, plugins: Plugin[]) => string[] | undefined);\n\n/**\n * Options for {@link loadTailorDBNamespaces}.\n */\nexport interface LoadTailorDBNamespacesOptions {\n /** Path to tailor.config.ts. Defaults to searching from the current directory. */\n configPath?: string;\n /** Namespaces to load. Omit to load all owned namespaces. */\n namespaces?: TailorDBNamespaceSelector;\n}\n\n/**\n * Result of {@link loadTailorDBNamespaces}.\n */\nexport interface LoadedTailorDBNamespaces {\n /** The loaded Tailor config. */\n config: LoadedConfig;\n /** Plugins collected from the config module's plugin-array exports (typically `definePlugins()`). */\n plugins: Plugin[];\n /** Loaded TailorDB namespace data, in config order. */\n namespaces: TailorDBNamespaceData[];\n}\n\n/**\n * Result of {@link loadApplicationNamespaces}: the loaded namespaces plus the\n * config plugins and application they were loaded through.\n */\nexport interface LoadedApplicationNamespaces extends LoadedTailorDBNamespaces {\n /** Application defined from the loaded config. */\n application: Application;\n}\n\n/**\n * Load local TailorDB namespaces along with the config plugins and the\n * defined application. Internal superset of {@link loadTailorDBNamespaces}.\n * @param options - Namespace loading options.\n * @returns The loaded config, plugins, application, and TailorDB namespace data.\n */\nexport async function loadApplicationNamespaces(\n options: LoadTailorDBNamespacesOptions = {},\n): Promise<LoadedApplicationNamespaces> {\n const { config, plugins } = await loadConfig(options.configPath);\n\n await generateUserTypes({ config, configPath: config.path });\n\n const pluginManager = plugins.length > 0 ? new PluginManager(plugins) : undefined;\n const application = defineApplication({\n config,\n pluginManager,\n });\n const namespaceNames =\n typeof options.namespaces === \"function\"\n ? options.namespaces(config, plugins)\n : options.namespaces;\n const namespaceFilter = namespaceNames ? new Set(namespaceNames) : undefined;\n const services = namespaceFilter\n ? application.tailorDBServices.filter((db) => namespaceFilter.has(db.namespace))\n : application.tailorDBServices;\n\n if (namespaceFilter && services.length !== namespaceFilter.size) {\n const found = new Set(services.map((db) => db.namespace));\n const missing = [...namespaceFilter].filter((ns) => !found.has(ns)).join(\", \");\n const available = application.tailorDBServices.map((db) => db.namespace).join(\", \");\n throw new Error(\n `TailorDB namespace \"${missing}\" not found in local config.db.` +\n (available ? ` Available owned namespaces: ${available}` : \"\"),\n );\n }\n\n const namespaces: TailorDBNamespaceData[] = [];\n\n for (const db of services) {\n await db.loadTypes();\n await db.processNamespacePlugins();\n namespaces.push({\n namespace: db.namespace,\n types: { ...db.types },\n sourceInfo: new Map(Object.entries(db.typeSourceInfo)),\n pluginAttachments: db.pluginAttachments,\n });\n }\n\n return { config, plugins, application, namespaces };\n}\n\n/**\n * Load local TailorDB namespaces exactly as SDK generation/deploy sees them:\n * the config is loaded, user types are generated, and each selected\n * namespace's types are loaded with namespace plugins applied.\n * @param options - Namespace loading options.\n * @returns The loaded config and TailorDB namespace data.\n */\nexport async function loadTailorDBNamespaces(\n options: LoadTailorDBNamespacesOptions = {},\n): Promise<LoadedTailorDBNamespaces> {\n const { config, plugins, namespaces } = await loadApplicationNamespaces(options);\n return { config, plugins, namespaces };\n}\n","import { assertDefined } from \"#/utils/assert\";\nimport { processLinesDb } from \"./lines-db-processor\";\nimport type { TailorDBType } from \"#/parser/service/tailordb/types\";\nimport type { TailorDBNamespaceData } from \"#/plugin/types\";\nimport type { SeedTypeInfo } from \"./types\";\n\n/**\n * Processes TailorDB types to extract seed type information\n * @param type - Parsed TailorDB type\n * @param namespace - Namespace of the type\n * @returns Seed type information\n */\nexport function processSeedTypeInfo(type: TailorDBType, namespace: string): SeedTypeInfo {\n // Extract dependencies from relations (including keyOnly which only sets foreignKeyType)\n const dependencies: Set<string> = new Set();\n const selfRefFields: string[] = [];\n\n for (const [fieldName, field] of Object.entries(type.fields)) {\n const targetType = field.relation?.targetType ?? field.config.foreignKeyType;\n if (!targetType) continue;\n\n if (targetType === type.name) {\n selfRefFields.push(fieldName);\n } else {\n dependencies.add(targetType);\n }\n }\n\n return {\n name: type.name,\n namespace,\n dependencies: Array.from(dependencies),\n selfRefFields,\n dataFile: `data/${type.name}.jsonl`,\n };\n}\n\n/**\n * Seed ordering information for a TailorDB namespace.\n */\nexport interface SeedNamespaceConfig {\n /** TailorDB namespace name. */\n namespace: string;\n /** Type names in the namespace, in definition order. */\n types: string[];\n /** Seed dependencies (referenced type names) per type. */\n dependencies: Record<string, string[]>;\n /** Types with self-referencing fields, seeded in two passes. */\n selfRefTypes: string[];\n /** Field names a seed row must supply per type, enforced with `--upsert`. */\n requiredFields: Record<string, string[]>;\n}\n\n/**\n * Build per-namespace seed ordering information from TailorDB namespace data.\n * @param tailordb - TailorDB namespaces with their types\n * @returns Seed namespace configs, in namespace order\n */\nexport function buildSeedNamespaceConfigs(\n tailordb: TailorDBNamespaceData[],\n): SeedNamespaceConfig[] {\n return tailordb.map((ns) => {\n const types: string[] = [];\n const dependencies: Record<string, string[]> = {};\n const selfRefTypes: string[] = [];\n const requiredFields: Record<string, string[]> = {};\n\n for (const [typeName, type] of Object.entries(ns.types)) {\n const typeInfo = processSeedTypeInfo(type, ns.namespace);\n types.push(typeInfo.name);\n dependencies[typeInfo.name] = typeInfo.dependencies;\n if (typeInfo.selfRefFields.length > 0) {\n selfRefTypes.push(typeInfo.name);\n }\n\n const source = assertDefined(\n ns.sourceInfo.get(typeName),\n `source info missing for type: ${typeName}`,\n );\n const linesDb = processLinesDb(type, source);\n requiredFields[typeInfo.name] = Object.entries(type.fields)\n .filter(\n ([fieldName, field]) =>\n field.config.required !== false &&\n !linesDb.optionalFields.includes(fieldName) &&\n !linesDb.omitFields.includes(fieldName),\n )\n .map(([fieldName]) => fieldName);\n }\n\n return {\n namespace: ns.namespace,\n types,\n dependencies,\n selfRefTypes,\n requiredFields,\n };\n });\n}\n","import * as path from \"pathe\";\nimport { assertUniqueLocalTailorDBTypeNames } from \"#/cli/services/tailordb/type-name-validation\";\nimport {\n generateIdpSeedScriptCode,\n generateIdpTruncateScriptCode,\n processIdpUser,\n} from \"#/plugin/builtin/seed/idp-user-processor\";\nimport { SeedGeneratorID, type SeedPluginOptions } from \"#/plugin/builtin/seed/index\";\nimport {\n buildSeedNamespaceConfigs,\n type SeedNamespaceConfig,\n} from \"#/plugin/builtin/seed/seed-type-processor\";\nimport { getAuthInput } from \"./auth-input\";\nimport { loadApplicationNamespaces } from \"./tailordb-namespaces\";\nimport type { LoadedConfig } from \"./config-loader\";\n\nexport type { SeedNamespaceConfig };\n\n/**\n * IdP `_User` seeding context, present when the config uses the built-in IdP\n * with a user profile type.\n */\nexport interface SeedIdpUserContext {\n /** IdP namespace the `_User` records belong to. */\n idpNamespace: string;\n /** Server-side script that creates `_User` records from seed rows. */\n seedScriptCode: string;\n /** Server-side script that deletes all `_User` records. */\n truncateScriptCode: string;\n}\n\n/**\n * Everything a seed run needs from the local config: the seed data location,\n * per-namespace seeding order, and IdP user context.\n */\nexport interface SeedContext {\n /** The loaded Tailor config. */\n config: LoadedConfig;\n /** Absolute path to the seedPlugin output directory. */\n distPath: string;\n /** Default machine user name from seedPlugin options, if configured. */\n machineUserName?: string | undefined;\n /** Seed ordering information per TailorDB namespace. */\n namespaces: SeedNamespaceConfig[];\n /** IdP `_User` seeding context, or null when not applicable. */\n idpUser: SeedIdpUserContext | null;\n}\n\n/**\n * Options for {@link loadSeedContext}.\n */\nexport interface LoadSeedContextOptions {\n /** Path to tailor.config.ts. Defaults to searching from the current directory. */\n configPath?: string;\n}\n\n/**\n * Load the seed context from the local config. Requires `seedPlugin` to be\n * configured in the config's plugins. A relative `distPath` in the seedPlugin\n * options is resolved against the current working directory — the same base\n * `tailor generate` writes it to.\n * @param options - Seed context loading options.\n * @returns The seed context computed from the local config.\n */\nexport async function loadSeedContext(options: LoadSeedContextOptions = {}): Promise<SeedContext> {\n const { config, plugins, application, namespaces } = await loadApplicationNamespaces({\n configPath: options.configPath,\n });\n\n // Seed files and type filters identify types by bare name, so enforce the\n // same cross-namespace uniqueness that generation and deploy enforce.\n assertUniqueLocalTailorDBTypeNames({ tailorDBServices: application.tailorDBServices });\n\n const seedPlugin = plugins.find((plugin) => plugin.id === SeedGeneratorID);\n if (!seedPlugin) {\n throw new Error(\n `seedPlugin is not configured in ${config.path}. ` +\n 'Add seedPlugin({ distPath: \"./seed\" }) from \"@tailor-platform/sdk/plugin/seed\" to definePlugins().',\n );\n }\n const pluginOptions = seedPlugin.pluginConfig as SeedPluginOptions | undefined;\n if (typeof pluginOptions?.distPath !== \"string\" || pluginOptions.distPath === \"\") {\n throw new Error(\n `seedPlugin in ${config.path} has no distPath option. ` +\n 'Pass seedPlugin({ distPath: \"./seed\" }) so seed data has a location.',\n );\n }\n\n // userProfile is only populated once auth namespaces are resolved (the\n // generate flow does the same after loading TailorDB namespaces).\n await application.authService?.resolveNamespaces();\n const authInput = getAuthInput(application);\n const idpUserMeta = authInput ? processIdpUser(authInput) : undefined;\n const idpUser: SeedIdpUserContext | null = idpUserMeta\n ? {\n idpNamespace: idpUserMeta.idpNamespace,\n seedScriptCode: generateIdpSeedScriptCode(idpUserMeta.idpNamespace),\n truncateScriptCode: generateIdpTruncateScriptCode(idpUserMeta.idpNamespace),\n }\n : null;\n\n return {\n config,\n distPath: path.resolve(pluginOptions.distPath),\n machineUserName: pluginOptions.machineUserName,\n namespaces: buildSeedNamespaceConfigs(namespaces),\n idpUser,\n };\n}\n","/**\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\nimport { assertDefined } from \"#/utils/assert\";\nimport type { JsonObject } from \"type-fest\";\n\n/**\n * Seed data keyed by type name, with an array of records per type.\n */\nexport type SeedData = Record<string, JsonObject[]>;\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]?.length ?? 0) > 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 = assertDefined(data[type], `seed data missing for type: ${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: JsonObject[] = [];\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 * as path from \"pathe\";\nimport { resolveTSConfig } from \"pkg-types\";\nimport * as rolldown from \"rolldown\";\nimport { createBundleLog } from \"#/cli/shared/bundle-log\";\nimport { getDistDir } from \"#/cli/shared/dist-dir\";\nimport { platformBundleDefinePlugin } from \"#/cli/shared/platform-bundle-plugin\";\nimport { createTsconfigPathsPlugin } from \"#/cli/shared/tsconfig-paths-plugin\";\nimport { createGeneratedEntryResolverPlugin } from \"#/cli/shared/virtual-entry\";\nimport ml from \"#/utils/multiline\";\n\nexport type SeedBundleResult = {\n namespace: string;\n bundledCode: string;\n typesIncluded: string[];\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, TailordbDialect } from \"@tailor-platform/sdk/kysely\";\n\n type SeedInput = {\n data: Record<string, Record<string, unknown>[]>;\n order: string[];\n selfRefTypes: string[];\n upsert?: boolean;\n };\n\n type SeedResult = {\n success: boolean;\n processed: Record<string, { inserted: number; updated: number; skipped: 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<\n string,\n { inserted: number; updated: number; skipped: number }\n > = {};\n const errors: string[] = [];\n const BATCH_SIZE = ${String(BATCH_SIZE)};\n const upsert = input.upsert === true;\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] = { inserted: 0, updated: 0, skipped: 0 };\n const hasSelfRef = (input.selfRefTypes || []).includes(typeName);\n\n try {\n let recordsToInsert = records;\n let recordsToUpdate: Record<string, unknown>[] = [];\n if (upsert) {\n const existing = await db\n .selectFrom(typeName)\n .select(\"id\")\n .where(\n \"id\",\n \"in\",\n records.map((record) => record.id),\n )\n .execute();\n const existingIds = new Set(existing.map((record) => record.id));\n recordsToInsert = records.filter((record) => !existingIds.has(record.id));\n recordsToUpdate = records.filter((record) => existingIds.has(record.id));\n }\n\n if (hasSelfRef) {\n // Insert one-by-one to respect self-referencing foreign key order\n for (const record of recordsToInsert) {\n await db.insertInto(typeName).values(record).execute();\n processed[typeName].inserted += 1;\n }\n if (!upsert) {\n console.log(\n \\`[${namespace}] \\${typeName}: \\${processed[typeName].inserted}/\\${records.length} (one-by-one)\\`,\n );\n }\n } else {\n for (let i = 0; i < recordsToInsert.length; i += BATCH_SIZE) {\n const batch = recordsToInsert.slice(i, i + BATCH_SIZE);\n await db.insertInto(typeName).values(batch).execute();\n processed[typeName].inserted += batch.length;\n if (!upsert) {\n console.log(\n \\`[${namespace}] \\${typeName}: \\${processed[typeName].inserted}/\\${records.length}\\`,\n );\n }\n }\n }\n\n for (const record of recordsToUpdate) {\n const { id, ...values } = record;\n if (Object.keys(values).length === 0) {\n processed[typeName].skipped += 1;\n continue;\n }\n await db.updateTable(typeName).set(values).where(\"id\", \"=\", id).execute();\n processed[typeName].updated += 1;\n }\n\n const counts = processed[typeName];\n if (upsert) {\n const skipped = counts.skipped > 0 ? \\`, \\${counts.skipped} skipped\\` : \"\";\n console.log(\n \\`[${namespace}] \\${typeName}: \\${counts.inserted} inserted, \\${counts.updated} updated\\${skipped}\\`,\n );\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 * @param baseDir - Directory whose dependencies and tsconfig the generated entry uses\n * @returns Bundled seed script result\n */\nexport async function bundleSeedScript(\n namespace: string,\n typeNames: string[],\n baseDir: string = process.cwd(),\n): Promise<SeedBundleResult> {\n // Output directory in .tailor (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\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(baseDir);\n } catch {\n tsconfig = undefined;\n }\n\n // Bundle with tree-shaking (write: false to avoid unnecessary disk I/O)\n const bundleLog = createBundleLog({ tsconfig });\n const result = await rolldown.build({\n plugins: [\n createGeneratedEntryResolverPlugin(entryPath, baseDir),\n createTsconfigPathsPlugin(),\n platformBundleDefinePlugin,\n ],\n input: entryPath,\n write: false,\n output: {\n format: \"esm\",\n sourcemap: false,\n minify: false,\n codeSplitting: false,\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 ...bundleLog.options,\n } as rolldown.BuildOptions);\n bundleLog.assertAllResolved();\n\n const bundledCode = result.output[0].code;\n\n return {\n namespace,\n bundledCode,\n typesIncluded: typeNames,\n };\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\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 { generate } from \"./commands/generate/service\";\nexport type { GenerateOptions } from \"./commands/generate/options\";\nexport { loadConfig, type LoadedConfig } from \"./shared/config-loader\";\nexport { errorToJson, serializeError, type ErrorToJsonOptions } from \"./shared/error-json\";\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 { isPluginGeneratedType } 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 PluginGeneratedTypeSource,\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} 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 {\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} from \"./commands/tailordb/migrate/generate\";\nexport {\n createSnapshotFromLocalTypes,\n reconstructSnapshotFromMigrations,\n compareSnapshots,\n getNextMigrationNumber,\n getLatestMigrationNumber,\n getMigrationFiles,\n compareLocalTypesWithSnapshot,\n} from \"./commands/tailordb/migrate/snapshot\";\nexport {\n getNamespacesWithMigrations,\n type NamespaceWithMigrations,\n} from \"./commands/tailordb/migrate/config\";\nexport {\n hasChanges,\n formatMigrationDiff,\n formatDiffSummary,\n type MigrationDiff,\n type BreakingChangeInfo,\n} from \"./commands/tailordb/migrate/diff-calculator\";\nexport {\n SCHEMA_FILE_NAME,\n DIFF_FILE_NAME,\n MIGRATE_FILE_NAME,\n DB_TYPES_FILE_NAME,\n INITIAL_SCHEMA_NUMBER,\n getMigrationDirPath,\n getMigrationFilePath,\n type SchemaSnapshot,\n type 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 { bundleSeedScript, type SeedBundleResult } from \"./commands/generate/seed/bundler\";\nexport {\n bundleMigrationScript,\n type MigrationBundleResult,\n} from \"./commands/tailordb/migrate/bundler\";\nexport {\n executeScript,\n waitForExecution,\n type ScriptExecutionOptions,\n type ScriptExecutionResult,\n type 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":";;;;;;;;;;;;;;;;;;AAoDA,eAAsB,0BACpB,UAAyC,CAAC,GACJ;CACtC,MAAM,EAAE,QAAQ,YAAY,MAAM,WAAW,QAAQ,UAAU;CAE/D,MAAM,kBAAkB;EAAE;EAAQ,YAAY,OAAO;CAAK,CAAC;CAG3D,MAAM,cAAc,kBAAkB;EACpC;EACA,eAHoB,QAAQ,SAAS,IAAI,IAAI,cAAc,OAAO,IAAI;CAIxE,CAAC;CACD,MAA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;CAG3C,MAAM,YAAY,KAAK,KAAK,WAAW,QAAQ,UAAU,UAAU;CAGnE,MAAM,eAAe,0BAA0B,SAAS;CACxD,GAAG,cAAc,WAAW,YAAY;CAExC,IAAI;CACJ,IAAI;EACF,WAAW,MAAM,gBAAgB,OAAO;CAC1C,QAAQ;EACN,WAAW;CACb;CAGA,MAAM,YAAY,gBAAgB,EAAE,SAAS,CAAC;CAC9C,MAAM,SAAS,MAAM,SAAS,MAAM;EAClC,SAAS;GACP,mCAAmC,WAAW,OAAO;GACrD,0BAA0B;GAC1B;EACF;EACA,OAAO;EACP,OAAO;EACP,QAAQ;GACN,QAAQ;GACR,WAAW;GACX,QAAQ;GACR,eAAe;GACf,SAAS,EACP,UAAU,WACZ;EACF;EACA,UAAU,CAAC,UAAU;EACrB,SAAS,EACP,gBAAgB,CAAC,QAAQ,QAAQ,EACnC;EACA;EACA,WAAW;GACT,mBAAmB;GACnB,aAAa;GACb,0BAA0B;EAC5B;EACA,GAAG,UAAU;CACf,CAA0B;CAC1B,UAAU,kBAAkB;CAI5B,OAAO;EACL;EACA,aAJkB,OAAO,OAAO,EAAE,CAAC;EAKnC,eAAe;CACjB;AACF;;;;AC9NA,MAAM,eAAe,IAAI,IAAI,iBAAiB,OAAO,KAAK,GAAG,CAAC"}
|
|
1
|
+
{"version":3,"file":"lib.mjs","names":[],"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\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 { generate } from \"./commands/generate/service\";\nexport type { GenerateOptions } from \"./commands/generate/options\";\nexport { loadConfig, type LoadedConfig } from \"./shared/config-loader\";\nexport { errorToJson, serializeError, type ErrorToJsonOptions } from \"./shared/error-json\";\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 { isPluginGeneratedType } 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 PluginGeneratedTypeSource,\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} 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 {\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} 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 DB_TYPES_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 { bundleSeedScript, type SeedBundleResult } from \"./commands/generate/seed/bundler\";\nexport {\n bundleMigrationScript,\n type MigrationBundleResult,\n} from \"./commands/tailordb/migrate/bundler\";\nexport {\n executeScript,\n waitForExecution,\n type ScriptExecutionOptions,\n type ScriptExecutionResult,\n type 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":";;;;;AAGA,MAAM,eAAe,IAAI,IAAI,iBAAiB,OAAO,KAAK,GAAG,CAAC"}
|