@tailor-platform/sdk 2.24.0 → 2.26.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 +58 -0
- package/dist/application-ChqHuhZW.mjs +1 -0
- package/dist/{application-CfqvzV3I.mjs → application-DS0XKBtK.mjs} +4 -4
- package/dist/application-DS0XKBtK.mjs.map +1 -0
- package/dist/cli/commands/deploy/deployment-target.d.mts +1 -0
- package/dist/cli/commands/machineuser/list.d.mts +1 -0
- package/dist/cli/commands/show.d.mts +13 -1
- package/dist/cli/commands/tailordb/migrate/bundler.d.mts +4 -1
- package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +6 -0
- package/dist/cli/lib.d.mts +2 -2
- package/dist/cli/lib.mjs +1 -1
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/main.mjs +47 -47
- package/dist/cli/main.mjs.map +1 -1
- package/dist/completion/zsh-worker.zsh +3 -3
- package/dist/configure/index.d.mts +2 -2
- package/dist/configure/index.mjs.map +1 -1
- package/dist/kysely/index.d.mts +47 -15
- package/dist/kysely/index.mjs +1 -1
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/kysely-type-RDX59E1j.mjs +48 -0
- package/dist/kysely-type-RDX59E1j.mjs.map +1 -0
- package/dist/plugin/builtin/kysely-type/index.d.mts +11 -0
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- package/dist/plugin/index.mjs +1 -1
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/plugin/types.d.mts +97 -0
- package/dist/register-ts-hook-BuwkLuxC.mjs +925 -0
- package/dist/register-ts-hook-BuwkLuxC.mjs.map +1 -0
- package/dist/runtime/index.d.mts +8 -0
- package/dist/vitest/index.d.mts +3 -2
- package/dist/vitest/index.mjs +1 -1
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mocks/tailordb-pglite.d.mts +1 -0
- package/dist/vitest/pglite-kysely.d.mts +14 -1
- package/dist/vitest/pglite-temporal.d.mts +9 -0
- package/docs/cli/application.md +23 -0
- package/docs/cli/secret.md +24 -16
- package/docs/cli-reference.md +25 -13
- package/docs/github-actions.md +69 -4
- package/docs/plugin/custom.md +76 -1
- package/docs/plugin/frontend.md +124 -0
- package/docs/plugin/index.md +24 -2
- package/docs/services/auth.md +2 -0
- package/docs/services/resolver.md +1 -1
- package/docs/services/secret.md +5 -4
- package/docs/services/staticwebsite.md +2 -0
- package/docs/services/tailordb-migration.md +5 -3
- package/docs/testing.md +2 -1
- package/package.json +5 -5
- package/dist/application-BDqze-wy.mjs +0 -1
- package/dist/application-CfqvzV3I.mjs.map +0 -1
- package/dist/kysely-type-C-iyFFH7.mjs +0 -43
- package/dist/kysely-type-C-iyFFH7.mjs.map +0 -1
- package/dist/register-ts-hook-CVlI9Jzl.mjs +0 -922
- package/dist/register-ts-hook-CVlI9Jzl.mjs.map +0 -1
- package/dist/tailordb-ddl-DqInYupv.mjs +0 -7
- package/dist/tailordb-ddl-DqInYupv.mjs.map +0 -1
package/dist/plugin/types.d.mts
CHANGED
|
@@ -254,6 +254,103 @@ export interface Plugin<TableConfig = unknown, PluginConfig = unknown, FieldExte
|
|
|
254
254
|
onTailorDBReady?(context: TailorDBReadyContext<PluginConfig>): GeneratorResult | Promise<GeneratorResult>;
|
|
255
255
|
onResolverReady?(context: ResolverReadyContext<PluginConfig>): GeneratorResult | Promise<GeneratorResult>;
|
|
256
256
|
onExecutorReady?(context: ExecutorReadyContext<PluginConfig>): GeneratorResult | Promise<GeneratorResult>;
|
|
257
|
+
/** Runs after a successful deploy, including deploys with no resource changes. */
|
|
258
|
+
onDeployed?(context: DeployedContext<PluginConfig>): void | DeployedHookResult | Promise<void | DeployedHookResult>;
|
|
259
|
+
}
|
|
260
|
+
export interface PublishStaticWebsiteResult {
|
|
261
|
+
url: string;
|
|
262
|
+
skippedFiles: string[];
|
|
263
|
+
}
|
|
264
|
+
export interface DeployedStaticWebsite {
|
|
265
|
+
name: string;
|
|
266
|
+
url: string;
|
|
267
|
+
}
|
|
268
|
+
/** A static website declared in the config that registers the plugin, which the plugin can publish to. */
|
|
269
|
+
export interface PublishableStaticWebsite extends DeployedStaticWebsite {
|
|
270
|
+
/** Uploads the directory at the absolute path `dir` and publishes it to this website. */
|
|
271
|
+
publish(dir: string): Promise<PublishStaticWebsiteResult>;
|
|
272
|
+
}
|
|
273
|
+
export interface DeployedOAuth2Client {
|
|
274
|
+
name: string;
|
|
275
|
+
clientId: string;
|
|
276
|
+
}
|
|
277
|
+
export interface DeployedApplication<StaticWebsite extends DeployedStaticWebsite = DeployedStaticWebsite> {
|
|
278
|
+
/** SDK-managed application ID from defineConfig(); undefined when the config has none. */
|
|
279
|
+
id?: string;
|
|
280
|
+
name: string;
|
|
281
|
+
configPath: string;
|
|
282
|
+
/** Application endpoint URL, present when a matching Platform Application exists. */
|
|
283
|
+
url?: string;
|
|
284
|
+
domain?: string;
|
|
285
|
+
aiGateways: {
|
|
286
|
+
name: string;
|
|
287
|
+
url: string;
|
|
288
|
+
}[];
|
|
289
|
+
/** Static websites declared in this application's config, keyed by name. */
|
|
290
|
+
staticWebsites: Readonly<Partial<Record<string, StaticWebsite>>>;
|
|
291
|
+
auth?: {
|
|
292
|
+
namespace: string;
|
|
293
|
+
oauth2Clients: DeployedOAuth2Client[];
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
export interface PluginLogger {
|
|
297
|
+
info(message: string): void;
|
|
298
|
+
warn(message: string): void;
|
|
299
|
+
success(message: string): void;
|
|
300
|
+
}
|
|
301
|
+
export interface PluginExecOptions {
|
|
302
|
+
/** Directory to run the command in. */
|
|
303
|
+
workingDir: string;
|
|
304
|
+
/** Environment variables added to the environment `tailor` runs with. */
|
|
305
|
+
env?: Record<string, string>;
|
|
306
|
+
/**
|
|
307
|
+
* Where the command's output goes. `"stream"` (default) writes both stdout and stderr to stderr
|
|
308
|
+
* so `--json` results on stdout stay parseable, `"capture"` returns them, and `"ignore"` discards them.
|
|
309
|
+
*/
|
|
310
|
+
output?: "stream" | "capture" | "ignore";
|
|
311
|
+
}
|
|
312
|
+
export interface PluginExecResult {
|
|
313
|
+
/** Captured stdout. Empty unless `output` is `"capture"`. */
|
|
314
|
+
stdout: string;
|
|
315
|
+
/** Captured stderr. Empty unless `output` is `"capture"`. */
|
|
316
|
+
stderr: string;
|
|
317
|
+
}
|
|
318
|
+
/** Values available after all applications in this deploy run have been applied. */
|
|
319
|
+
export interface DeployedContext<PluginConfig = unknown> {
|
|
320
|
+
workspaceId: string;
|
|
321
|
+
/** Application whose config registers this plugin. Only its static websites can be published. */
|
|
322
|
+
application: DeployedApplication<PublishableStaticWebsite>;
|
|
323
|
+
/** Every application in this deploy run, including the registering one. */
|
|
324
|
+
applications: readonly DeployedApplication[];
|
|
325
|
+
/** Absolute path of the config registering this plugin. */
|
|
326
|
+
configPath: string;
|
|
327
|
+
pluginConfig: PluginConfig;
|
|
328
|
+
logger: PluginLogger;
|
|
329
|
+
/**
|
|
330
|
+
* Run a shell command on the machine running `tailor deploy`. Rejects when the command exits with a non-zero code.
|
|
331
|
+
* @param command - Shell command, such as `pnpm build`
|
|
332
|
+
* @param options - Working directory, added environment variables, and output handling
|
|
333
|
+
* @returns Captured output when `options.output` is `"capture"`
|
|
334
|
+
*/
|
|
335
|
+
exec(command: string, options: PluginExecOptions): Promise<PluginExecResult>;
|
|
336
|
+
}
|
|
337
|
+
type OutputObject = object & {
|
|
338
|
+
[Symbol.iterator]?: never;
|
|
339
|
+
[Symbol.toStringTag]?: never;
|
|
340
|
+
[Symbol.hasInstance]?: never;
|
|
341
|
+
[Symbol.toPrimitive]?: never;
|
|
342
|
+
[Symbol.match]?: never;
|
|
343
|
+
};
|
|
344
|
+
/**
|
|
345
|
+
* A value a plugin hook can return in `outputs`. Interface-typed objects are accepted;
|
|
346
|
+
* a `Date` or class instance nested inside one is rejected when the deploy runs.
|
|
347
|
+
*/
|
|
348
|
+
export type PluginOutputValue = string | number | boolean | null | readonly PluginOutputValue[] | {
|
|
349
|
+
[key: string]: PluginOutputValue;
|
|
350
|
+
} | OutputObject;
|
|
351
|
+
export interface DeployedHookResult {
|
|
352
|
+
/** Values included in deploy's JSON result. Interface-typed values are accepted, but a `Date` or class instance nested inside one fails the deploy instead of the type check. */
|
|
353
|
+
outputs?: Record<string, PluginOutputValue>;
|
|
257
354
|
}
|
|
258
355
|
//#endregion
|
|
259
356
|
export type { PluginAttachment };
|