@tailor-platform/sdk 1.69.0 → 1.70.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/application-BakHtldG.mjs +4 -0
  3. package/dist/{application-Cr-limKC.mjs → application-Df5_I83n.mjs} +318 -78
  4. package/dist/application-Df5_I83n.mjs.map +1 -0
  5. package/dist/cli/erd-viewer-assets/app.js +279 -36
  6. package/dist/cli/erd-viewer-assets/index.html +4 -0
  7. package/dist/cli/erd-viewer-assets/styles.css +252 -5
  8. package/dist/cli/index.mjs +641 -90
  9. package/dist/cli/index.mjs.map +1 -1
  10. package/dist/cli/lib.d.mts +14 -8
  11. package/dist/cli/lib.mjs +2 -2
  12. package/dist/completion/zsh-worker.zsh +153 -2
  13. package/dist/configure/index.d.mts +5 -5
  14. package/dist/configure/index.mjs +8 -6
  15. package/dist/configure/index.mjs.map +1 -1
  16. package/dist/{index-B7VbJm0_.d.mts → index-BAEaAqmz.d.mts} +90 -40
  17. package/dist/{index-CklcVeMG.d.mts → index-C-vsbx27.d.mts} +2 -2
  18. package/dist/{index-hXoO-AOC.d.mts → index-CKI0eZP6.d.mts} +2 -2
  19. package/dist/{index-DYhnxXYR.d.mts → index-CrqOgUF2.d.mts} +2 -2
  20. package/dist/{index-DlDRSzFZ.d.mts → index-DESLU9kI.d.mts} +2 -2
  21. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  22. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  23. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  24. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  25. package/dist/plugin/index.d.mts +1 -1
  26. package/dist/{runtime-jowoN6qC.mjs → runtime-CSY0eD4_.mjs} +330 -190
  27. package/dist/runtime-CSY0eD4_.mjs.map +1 -0
  28. package/dist/{schema-1msIhXwA.mjs → schema-C4fkpWV_.mjs} +9 -15
  29. package/dist/schema-C4fkpWV_.mjs.map +1 -0
  30. package/dist/{types-2Be3wSMc.mjs → types-32lUMToj.mjs} +1 -1
  31. package/dist/{types-CmzfQP_m.mjs → types-D4QMmNWh.mjs} +1 -12
  32. package/dist/types-D4QMmNWh.mjs.map +1 -0
  33. package/dist/{types-Bzr0RQME.d.mts → types-Dynq4AJv.d.mts} +2 -2
  34. package/dist/{types-DZrtN6-H.d.mts → types-rj8YJcEe.d.mts} +5 -2
  35. package/dist/utils/test/index.d.mts +2 -2
  36. package/dist/{workflow.generated-Br9bmLdX.d.mts → workflow.generated-DJULCuRr.d.mts} +177 -172
  37. package/docs/cli/application.md +37 -2
  38. package/docs/cli/setup.md +1 -0
  39. package/docs/cli/tailordb.md +24 -0
  40. package/docs/cli/user.md +11 -1
  41. package/docs/cli/workspace.md +13 -7
  42. package/docs/cli-reference.md +6 -0
  43. package/docs/github-actions.md +27 -0
  44. package/docs/multi-environment.md +22 -0
  45. package/docs/services/aigateway.md +4 -2
  46. package/docs/services/http-adapter.md +16 -1
  47. package/package.json +1 -1
  48. package/dist/application-Br48NXBD.mjs +0 -4
  49. package/dist/application-Cr-limKC.mjs.map +0 -1
  50. package/dist/runtime-jowoN6qC.mjs.map +0 -1
  51. package/dist/schema-1msIhXwA.mjs.map +0 -1
  52. package/dist/types-CmzfQP_m.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { c as TailorUser, i as InferredAttributeMap } from "./types-DTcZ2Yax.mjs";
2
- import { A as Validators, D as TailorField, E as FieldValidateInput, F as output, P as Prettify, S as EnumValue, T as FieldOutput, a as Hooks, b as ArrayFieldOutput, g as TailorDBType$1, h as TailorDBServiceInput, i as Hook, j as InferFieldsOutput, k as TailorToTs, l as RelationType, n as DefinedDBFieldMetadata, o as IndexDef, p as TailorDBField$1, r as ExcludeNestedDBFields, t as DBFieldMetadata, u as SerialConfig, v as TypeFeatures, w as FieldOptions } from "./types-DZrtN6-H.mjs";
3
- import { it as BuiltinIdP, o as PluginConfigs, z as AuthConfig } from "./types-Bzr0RQME.mjs";
2
+ import { A as Validators, E as FieldValidateInput, F as output, O as TailorFieldType, P as TypeLevelError, S as EnumValue, T as FieldOutput, a as Hooks, g as TailorDBType$1, h as TailorDBServiceInput, i as Hook, j as InferFieldsOutput, k as TailorToTs, l as RelationType, n as DefinedDBFieldMetadata, o as IndexDef, p as TailorDBField$1, r as ExcludeNestedDBFields, t as DBFieldMetadata, u as SerialConfig, v as TypeFeatures, w as FieldOptions } from "./types-rj8YJcEe.mjs";
3
+ import { it as BuiltinIdP, o as PluginConfigs, z as AuthConfig } from "./types-Dynq4AJv.mjs";
4
4
  import { StandardSchemaV1 } from "@standard-schema/spec";
5
5
 
6
6
  //#region src/configure/types/field.d.ts
@@ -126,8 +126,138 @@ declare const unsafeAllowAllTypePermission: TailorTypePermission;
126
126
  declare const unsafeAllowAllGqlPermission: TailorTypeGqlPermission;
127
127
  //#endregion
128
128
  //#region src/configure/services/tailordb/schema.d.ts
129
- type TailorAnyDBField = TailorDBField<any, any>;
129
+ type AnyBuilderMethod = any;
130
+ type TailorAnyDBField = Omit<TailorDBField$1<AnyBuilderMethod, AnyBuilderMethod>, "fields"> & {
131
+ readonly fields: Record<string, AnyBuilderMethod>;
132
+ _metadata: DBFieldMetadata;
133
+ parse: AnyBuilderMethod;
134
+ _parseInternal: AnyBuilderMethod;
135
+ readonly typeName: TypeLevelError<string>;
136
+ description: AnyBuilderMethod;
137
+ relation: AnyBuilderMethod;
138
+ index: AnyBuilderMethod;
139
+ unique: AnyBuilderMethod;
140
+ vector: AnyBuilderMethod;
141
+ hooks: AnyBuilderMethod;
142
+ validate: AnyBuilderMethod;
143
+ serial: AnyBuilderMethod;
144
+ clone: AnyBuilderMethod;
145
+ };
130
146
  type TailorAnyDBType = TailorDBType<any, any>;
147
+ type IsAny<T> = 0 extends 1 & T ? true : false;
148
+ type DBFieldTypeNameMethod<Defined extends DefinedDBFieldMetadata> = IsAny<Defined> extends true ? TypeLevelError<string> : TypeLevelError<"typeName cannot be used on TailorDB fields">;
149
+ type WithDBFieldDescription<Defined> = Defined & {
150
+ description: true;
151
+ };
152
+ type WithDBFieldRelation<Defined, S extends RelationType | RelationSelfConfig> = S extends "oneToOne" | "1-1" ? Defined & {
153
+ unique: true;
154
+ index: true;
155
+ relation: true;
156
+ } : S extends {
157
+ type: "oneToOne" | "1-1";
158
+ } ? Defined & {
159
+ unique: true;
160
+ index: true;
161
+ relation: true;
162
+ } : Defined & {
163
+ index: true;
164
+ relation: true;
165
+ };
166
+ type WithDBFieldIndex<Defined> = Defined & {
167
+ index: true;
168
+ };
169
+ type WithDBFieldUnique<Defined> = Defined & {
170
+ unique: true;
171
+ index: true;
172
+ };
173
+ type WithDBFieldVector<Defined> = Defined & {
174
+ vector: true;
175
+ };
176
+ type WithDBFieldHooks<Defined, H> = Defined & {
177
+ hooks: {
178
+ create: H extends {
179
+ create: unknown;
180
+ } ? true : false;
181
+ update: H extends {
182
+ update: unknown;
183
+ } ? true : false;
184
+ };
185
+ serial: false;
186
+ };
187
+ type WithDBFieldValidate<Defined> = Defined & {
188
+ validate: true;
189
+ };
190
+ type WithDBFieldSerial<Defined> = Defined & {
191
+ serial: true;
192
+ hooks: {
193
+ create: false;
194
+ update: false;
195
+ };
196
+ };
197
+ type WithDBFieldCloneOptions<Defined extends DefinedDBFieldMetadata, NewOpt extends FieldOptions> = Omit<Defined, "array"> & {
198
+ array: NewOpt extends {
199
+ array: true;
200
+ } ? true : Defined["array"];
201
+ };
202
+ type FileKeyConflictError<Fields extends Record<string, TailorAnyDBField>, User extends object> = Partial<Record<keyof output<TailorDBType<Fields, User>> & string, TypeLevelError<"file keys cannot use existing field names">>>;
203
+ type DBFieldDescriptionFn<Defined extends DefinedDBFieldMetadata, Output> = (description: string) => TailorDBField<WithDBFieldDescription<Defined>, Output>;
204
+ type DBFieldRelationFn<Defined extends DefinedDBFieldMetadata, Output> = {
205
+ <S extends RelationType, T extends TailorAnyDBType>(config: RelationConfig<S, T>): TailorDBField<WithDBFieldRelation<Defined, S>, Output>;
206
+ <S extends RelationSelfConfig>(config: S): TailorDBField<WithDBFieldRelation<Defined, S>, Output>;
207
+ };
208
+ type DBFieldIndexFn<Defined extends DefinedDBFieldMetadata, Output> = () => TailorDBField<WithDBFieldIndex<Defined>, Output>;
209
+ type DBFieldUniqueFn<Defined extends DefinedDBFieldMetadata, Output> = () => TailorDBField<WithDBFieldUnique<Defined>, Output>;
210
+ type DBFieldVectorFn<Defined extends DefinedDBFieldMetadata, Output> = () => TailorDBField<WithDBFieldVector<Defined>, Output>;
211
+ type DBFieldHooksFn<Defined extends DefinedDBFieldMetadata, Output> = <const H extends Hook<unknown, Output>>(hooks: H) => TailorDBField<WithDBFieldHooks<Defined, H>, Output>;
212
+ type DBFieldValidateFn<Defined extends DefinedDBFieldMetadata, Output> = (...validate: FieldValidateInput<Output>[]) => TailorDBField<WithDBFieldValidate<Defined>, Output>;
213
+ type DBFieldSerialFn<Defined extends DefinedDBFieldMetadata, Output> = (config: SerialConfig<Defined["type"] & ("integer" | "string")>) => TailorDBField<WithDBFieldSerial<Defined>, Output>;
214
+ type DBFieldDescriptionMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldDescriptionFn<Defined, Output> : Defined extends {
215
+ description: unknown;
216
+ } ? TypeLevelError<".description() has already been set"> : DBFieldDescriptionFn<Defined, Output>;
217
+ type DBFieldRelationMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldRelationFn<Defined, Output> : Defined extends {
218
+ relation: unknown;
219
+ } ? TypeLevelError<".relation() has already been set"> : DBFieldRelationFn<Defined, Output>;
220
+ type DBFieldIndexMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldIndexFn<Defined, Output> : Defined extends {
221
+ index: unknown;
222
+ } ? TypeLevelError<".index() has already been set"> : Defined extends {
223
+ array: true;
224
+ } ? TypeLevelError<"index cannot be set on array fields"> : DBFieldIndexFn<Defined, Output>;
225
+ type DBFieldUniqueMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldUniqueFn<Defined, Output> : Defined extends {
226
+ unique: unknown;
227
+ } ? TypeLevelError<".unique() has already been set"> : Defined extends {
228
+ array: true;
229
+ } ? TypeLevelError<"unique cannot be set on array fields"> : DBFieldUniqueFn<Defined, Output>;
230
+ type DBFieldVectorMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldVectorFn<Defined, Output> : Defined extends {
231
+ vector: unknown;
232
+ } ? TypeLevelError<".vector() has already been set"> : Defined extends {
233
+ type: "string";
234
+ array: false;
235
+ } ? DBFieldVectorFn<Defined, Output> : TypeLevelError<"vector can only be set on non-array string fields">;
236
+ type DBFieldHooksMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldHooksFn<Defined, Output> : Defined extends {
237
+ serial: true;
238
+ hooks: {
239
+ create: false;
240
+ update: false;
241
+ };
242
+ } ? TypeLevelError<"hooks cannot be set after serial"> : Defined extends {
243
+ hooks: unknown;
244
+ } ? TypeLevelError<".hooks() has already been set"> : Defined extends {
245
+ type: "nested";
246
+ } ? TypeLevelError<"hooks cannot be set on nested type fields"> : DBFieldHooksFn<Defined, Output>;
247
+ type DBFieldValidateMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldValidateFn<Defined, Output> : Defined extends {
248
+ validate: unknown;
249
+ } ? TypeLevelError<".validate() has already been set"> : DBFieldValidateFn<Defined, Output>;
250
+ type DBFieldSerialMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldSerialFn<Defined, Output> : Defined extends {
251
+ serial: true;
252
+ } ? TypeLevelError<".serial() has already been set"> : Defined extends {
253
+ serial: false;
254
+ } ? TypeLevelError<"serial cannot be set after hooks"> : IsAny<Output> extends true ? Defined extends {
255
+ type: "integer" | "string";
256
+ array: false;
257
+ } ? DBFieldSerialFn<Defined, Output> : TypeLevelError<"serial can only be set on non-array integer or string fields"> : null extends Output ? TypeLevelError<"serial can only be set on non-array integer or string fields"> : Defined extends {
258
+ type: "integer" | "string";
259
+ array: false;
260
+ } ? DBFieldSerialFn<Defined, Output> : TypeLevelError<"serial can only be set on non-array integer or string fields">;
131
261
  /**
132
262
  * Full TailorDBField interface with builder methods.
133
263
  * Extends the minimal structural interface from types/ with fluent API methods.
@@ -148,122 +278,43 @@ interface TailorDBField<Defined extends DefinedDBFieldMetadata = DefinedDBFieldM
148
278
  * typeName is not available on TailorDB fields.
149
279
  * Use typeName on pipeline fields (t.enum / t.object) instead.
150
280
  */
151
- typeName(this: never, typeName: string): never;
281
+ typeName: DBFieldTypeNameMethod<Defined>;
152
282
  /**
153
283
  * Set a description for the field
154
284
  */
155
- description<CurrentDefined extends Defined>(this: CurrentDefined extends {
156
- description: unknown;
157
- } ? never : TailorField<CurrentDefined, Output>, description: string): TailorDBField<Prettify<CurrentDefined & {
158
- description: true;
159
- }>, Output>;
285
+ description: DBFieldDescriptionMethod<Defined, Output>;
160
286
  /**
161
287
  * Define a relation to another type.
162
288
  */
163
- relation<S extends RelationType, T extends TailorAnyDBType, CurrentDefined extends Defined>(this: CurrentDefined extends {
164
- relation: unknown;
165
- } ? never : TailorDBField<CurrentDefined, Output>, config: RelationConfig<S, T>): TailorDBField<S extends "oneToOne" | "1-1" ? Prettify<CurrentDefined & {
166
- unique: true;
167
- index: true;
168
- relation: true;
169
- }> : Prettify<CurrentDefined & {
170
- index: true;
171
- relation: true;
172
- }>, Output>;
173
- /**
174
- * Define a self-referencing relation
175
- */
176
- relation<S extends RelationSelfConfig, CurrentDefined extends Defined>(this: CurrentDefined extends {
177
- relation: unknown;
178
- } ? never : TailorDBField<CurrentDefined, Output>, config: S): TailorDBField<S["type"] extends "oneToOne" | "1-1" ? Prettify<CurrentDefined & {
179
- unique: true;
180
- index: true;
181
- relation: true;
182
- }> : Prettify<CurrentDefined & {
183
- index: true;
184
- relation: true;
185
- }>, Output>;
289
+ relation: DBFieldRelationMethod<Defined, Output>;
186
290
  /**
187
291
  * Add an index to the field
188
292
  */
189
- index<CurrentDefined extends Defined>(this: CurrentDefined extends {
190
- index: unknown;
191
- } ? never : CurrentDefined extends {
192
- array: true;
193
- } ? never : TailorDBField<CurrentDefined, Output>): TailorDBField<Prettify<CurrentDefined & {
194
- index: true;
195
- }>, Output>;
293
+ index: DBFieldIndexMethod<Defined, Output>;
196
294
  /**
197
295
  * Make the field unique (also adds an index)
198
296
  */
199
- unique<CurrentDefined extends Defined>(this: CurrentDefined extends {
200
- unique: unknown;
201
- } ? never : CurrentDefined extends {
202
- array: true;
203
- } ? never : TailorDBField<CurrentDefined, Output>): TailorDBField<Prettify<CurrentDefined & {
204
- unique: true;
205
- index: true;
206
- }>, Output>;
297
+ unique: DBFieldUniqueMethod<Defined, Output>;
207
298
  /**
208
299
  * Enable vector search on the field (string type only)
209
300
  */
210
- vector<CurrentDefined extends Defined>(this: CurrentDefined extends {
211
- vector: unknown;
212
- } ? never : CurrentDefined extends {
213
- type: "string";
214
- array: false;
215
- } ? TailorDBField<CurrentDefined, Output> : never): TailorDBField<Prettify<CurrentDefined & {
216
- vector: true;
217
- }>, Output>;
301
+ vector: DBFieldVectorMethod<Defined, Output>;
218
302
  /**
219
303
  * Add hooks for create/update operations on this field.
220
304
  */
221
- hooks<CurrentDefined extends Defined, const H extends Hook<unknown, Output>>(this: CurrentDefined extends {
222
- hooks: unknown;
223
- } ? never : CurrentDefined extends {
224
- type: "nested";
225
- } ? never : TailorDBField<CurrentDefined, Output>, hooks: H): TailorDBField<Prettify<CurrentDefined & {
226
- hooks?: {
227
- create: H extends {
228
- create: unknown;
229
- } ? true : false;
230
- update: H extends {
231
- update: unknown;
232
- } ? true : false;
233
- };
234
- serial: false;
235
- }>, Output>;
305
+ hooks: DBFieldHooksMethod<Defined, Output>;
236
306
  /**
237
307
  * Add validation functions to the field.
238
308
  */
239
- validate<CurrentDefined extends Defined>(this: CurrentDefined extends {
240
- validate: unknown;
241
- } ? never : TailorDBField<CurrentDefined, Output>, ...validate: FieldValidateInput<Output>[]): TailorDBField<Prettify<CurrentDefined & {
242
- validate: true;
243
- }>, Output>;
309
+ validate: DBFieldValidateMethod<Defined, Output>;
244
310
  /**
245
311
  * Configure serial/auto-increment behavior
246
312
  */
247
- serial<CurrentDefined extends Defined>(this: CurrentDefined extends {
248
- serial: unknown;
249
- } ? never : Output extends null ? never : CurrentDefined extends {
250
- type: "integer" | "string";
251
- array: false;
252
- } ? TailorDBField<CurrentDefined, Output> : never, config: SerialConfig<CurrentDefined["type"] & ("integer" | "string")>): TailorDBField<Prettify<CurrentDefined & {
253
- serial: true;
254
- hooks: {
255
- create: false;
256
- update: false;
257
- };
258
- }>, Output>;
313
+ serial: DBFieldSerialMethod<Defined, Output>;
259
314
  /**
260
315
  * Clone the field with optional overrides for field options
261
316
  */
262
- clone<const NewOpt extends FieldOptions>(options?: NewOpt): TailorDBField<Prettify<Omit<Defined, "array"> & {
263
- array: NewOpt extends {
264
- array: true;
265
- } ? true : Defined["array"];
266
- }>, FieldOutput<TailorToTs[Defined["type"]], NewOpt>>;
317
+ clone<const NewOpt extends FieldOptions>(options?: NewOpt): TailorDBField<WithDBFieldCloneOptions<Defined, NewOpt>, FieldOutput<TailorToTs[Defined["type"]], NewOpt>>;
267
318
  }
268
319
  /**
269
320
  * Full TailorDBType interface with builder methods.
@@ -275,7 +326,7 @@ interface TailorDBType<Fields extends Record<string, TailorAnyDBField> = any, Us
275
326
  validate(validators: Validators<Fields>): TailorDBType<Fields, User>;
276
327
  features(features: Omit<TypeFeatures, "pluralForm">): TailorDBType<Fields, User>;
277
328
  indexes(...indexes: IndexDef<TailorDBType<Fields, User>>[]): TailorDBType<Fields, User>;
278
- files<const F extends string>(files: Record<F, string> & Partial<Record<keyof output<TailorDBType<Fields, User>>, never>>): TailorDBType<Fields, User>;
329
+ files<const F extends string>(files: Record<F, string> & FileKeyConflictError<Fields, User>): TailorDBType<Fields, User>;
279
330
  permission<U extends object = User, P extends TailorTypePermission<U, output<TailorDBType<Fields, User>>> = TailorTypePermission<U, output<TailorDBType<Fields, User>>>>(permission: P): TailorDBType<Fields, U>;
280
331
  gqlPermission<U extends object = User, P extends TailorTypeGqlPermission<U> = TailorTypeGqlPermission<U>>(permission: P): TailorDBType<Fields, U>;
281
332
  description(description: string): TailorDBType<Fields, User>;
@@ -318,6 +369,14 @@ type FieldParseInternalArgs = {
318
369
  user: TailorUser;
319
370
  pathArray: string[];
320
371
  };
372
+ type DBFieldDefined<T extends TailorFieldType, Opt extends FieldOptions> = {
373
+ type: T;
374
+ array: Opt extends {
375
+ array: true;
376
+ } ? true : false;
377
+ };
378
+ type DBFieldOutput<T extends TailorFieldType, Opt extends FieldOptions, OutputBase = TailorToTs[T]> = FieldOutput<OutputBase, Opt>;
379
+ type TailorDBFieldInstance<T extends TailorFieldType, Opt extends FieldOptions, OutputBase = TailorToTs[T]> = TailorDBField<DBFieldDefined<T, Opt>, DBFieldOutput<T, Opt, OutputBase>>;
321
380
  /**
322
381
  * Create a UUID field.
323
382
  * @param options - Field configuration options
@@ -325,12 +384,7 @@ type FieldParseInternalArgs = {
325
384
  * @example db.uuid()
326
385
  * @example db.uuid({ optional: true })
327
386
  */
328
- declare function uuid<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
329
- type: "uuid";
330
- array: Opt extends {
331
- array: true;
332
- } ? true : false;
333
- }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
387
+ declare function uuid<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"uuid", Opt, string>;
334
388
  /**
335
389
  * Create a string field.
336
390
  * @param options - Field configuration options
@@ -338,12 +392,7 @@ declare function uuid<const Opt extends FieldOptions>(options?: Opt): TailorDBFi
338
392
  * @example db.string()
339
393
  * @example db.string({ optional: true })
340
394
  */
341
- declare function string<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
342
- type: "string";
343
- array: Opt extends {
344
- array: true;
345
- } ? true : false;
346
- }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
395
+ declare function string<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"string", Opt, string>;
347
396
  /**
348
397
  * Create a boolean field.
349
398
  * Note: The method name is `bool` but creates a `boolean` type field.
@@ -352,12 +401,7 @@ declare function string<const Opt extends FieldOptions>(options?: Opt): TailorDB
352
401
  * @example db.bool()
353
402
  * @example db.bool({ optional: true })
354
403
  */
355
- declare function bool<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
356
- type: "boolean";
357
- array: Opt extends {
358
- array: true;
359
- } ? true : false;
360
- }, Opt["optional"] extends true ? ArrayFieldOutput<boolean, Opt> | null : ArrayFieldOutput<boolean, Opt>>;
404
+ declare function bool<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"boolean", Opt, boolean>;
361
405
  /**
362
406
  * Create an integer field.
363
407
  * @param options - Field configuration options
@@ -365,12 +409,7 @@ declare function bool<const Opt extends FieldOptions>(options?: Opt): TailorDBFi
365
409
  * @example db.int()
366
410
  * @example db.int({ optional: true })
367
411
  */
368
- declare function int<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
369
- type: "integer";
370
- array: Opt extends {
371
- array: true;
372
- } ? true : false;
373
- }, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
412
+ declare function int<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"integer", Opt, number>;
374
413
  /**
375
414
  * Create a float (decimal number) field.
376
415
  * @param options - Field configuration options
@@ -378,12 +417,7 @@ declare function int<const Opt extends FieldOptions>(options?: Opt): TailorDBFie
378
417
  * @example db.float()
379
418
  * @example db.float({ optional: true })
380
419
  */
381
- declare function float<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
382
- type: "float";
383
- array: Opt extends {
384
- array: true;
385
- } ? true : false;
386
- }, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
420
+ declare function float<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"float", Opt, number>;
387
421
  interface DecimalFieldOptions extends FieldOptions {
388
422
  scale?: number;
389
423
  }
@@ -395,12 +429,7 @@ interface DecimalFieldOptions extends FieldOptions {
395
429
  * @example db.decimal({ scale: 2 })
396
430
  * @example db.decimal({ scale: 2, optional: true })
397
431
  */
398
- declare function decimal<const Opt extends DecimalFieldOptions>(options?: Opt): TailorDBField<{
399
- type: "decimal";
400
- array: Opt extends {
401
- array: true;
402
- } ? true : false;
403
- }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
432
+ declare function decimal<const Opt extends DecimalFieldOptions>(options?: Opt): TailorDBFieldInstance<"decimal", Opt, string>;
404
433
  /**
405
434
  * Create a date field (date only, no time component).
406
435
  * Format: "yyyy-MM-dd"
@@ -408,12 +437,7 @@ declare function decimal<const Opt extends DecimalFieldOptions>(options?: Opt):
408
437
  * @returns A date field
409
438
  * @example db.date()
410
439
  */
411
- declare function date<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
412
- type: "date";
413
- array: Opt extends {
414
- array: true;
415
- } ? true : false;
416
- }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
440
+ declare function date<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"date", Opt, string>;
417
441
  /**
418
442
  * Create a datetime field (date and time).
419
443
  * Format: ISO 8601 "yyyy-MM-ddTHH:mm:ssZ"
@@ -421,12 +445,7 @@ declare function date<const Opt extends FieldOptions>(options?: Opt): TailorDBFi
421
445
  * @returns A datetime field
422
446
  * @example db.datetime()
423
447
  */
424
- declare function datetime<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
425
- type: "datetime";
426
- array: Opt extends {
427
- array: true;
428
- } ? true : false;
429
- }, Opt["optional"] extends true ? ArrayFieldOutput<string | Date, Opt> | null : ArrayFieldOutput<string | Date, Opt>>;
448
+ declare function datetime<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"datetime", Opt, string | Date>;
430
449
  /**
431
450
  * Create a time field (time only, no date component).
432
451
  * Format: "HH:mm"
@@ -434,12 +453,7 @@ declare function datetime<const Opt extends FieldOptions>(options?: Opt): Tailor
434
453
  * @returns A time field
435
454
  * @example db.time()
436
455
  */
437
- declare function time<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
438
- type: "time";
439
- array: Opt extends {
440
- array: true;
441
- } ? true : false;
442
- }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
456
+ declare function time<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"time", Opt, string>;
443
457
  /**
444
458
  * Create an enum field with a fixed set of allowed string values.
445
459
  * @param values - Array of allowed string values, or array of `{ value, description }` objects
@@ -468,10 +482,7 @@ declare function object<const F extends Record<string, TailorAnyDBField> & Exclu
468
482
  array: true;
469
483
  } ? true : false;
470
484
  }, FieldOutput<InferFieldsOutput<F>, Opt>>;
471
- declare const idField: TailorDBField<{
472
- type: "uuid";
473
- array: false;
474
- }, string>;
485
+ declare const idField: TailorDBFieldInstance<"uuid", FieldOptions, string>;
475
486
  type idField = typeof idField;
476
487
  type DBType<F extends {
477
488
  id?: never;
@@ -537,26 +548,20 @@ declare const db: {
537
548
  * });
538
549
  */
539
550
  timestamps: () => {
540
- createdAt: TailorDBField<{
541
- type: "datetime";
542
- array: false;
543
- hooks?: {
544
- create: true;
545
- update: false;
546
- } | undefined;
547
- serial: false;
548
- description: true;
549
- }, string | Date>;
550
- updatedAt: TailorDBField<{
551
- type: "datetime";
552
- array: false;
553
- hooks?: {
554
- create: false;
555
- update: true;
556
- } | undefined;
557
- serial: false;
558
- description: true;
559
- }, string | Date | null>;
551
+ createdAt: TailorDBField<WithDBFieldDescription<WithDBFieldHooks<DBFieldDefined<"datetime", FieldOptions>, {
552
+ readonly create: ({
553
+ value
554
+ }: {
555
+ value: string | Date | null;
556
+ data: unknown;
557
+ user: TailorUser;
558
+ }) => string | Date;
559
+ }>>, string | Date>;
560
+ updatedAt: TailorDBField<WithDBFieldDescription<WithDBFieldHooks<DBFieldDefined<"datetime", {
561
+ readonly optional: true;
562
+ }>, {
563
+ readonly update: () => Date;
564
+ }>>, string | Date | null>;
560
565
  };
561
566
  };
562
567
  };
@@ -1339,4 +1344,4 @@ type ConcurrencyPolicy = {
1339
1344
  };
1340
1345
  //#endregion
1341
1346
  export { TailorDBInstance as A, IdPInput as C, TailorAnyDBField as D, AIGatewayInput as E, TailorTypePermission as F, unsafeAllowAllGqlPermission as I, unsafeAllowAllTypePermission as L, db as M, PermissionCondition as N, TailorAnyDBType as O, TailorTypeGqlPermission as P, AllowedValues as R, IdPGqlOperationsInput as S, AIGatewayDefinitionBrand as T, IdPConfig as _, ExecutorServiceConfig as a, IdPEmailConfig as b, ResolverServiceConfig as c, WorkflowServiceInput as d, StaticWebsiteConfig as f, SecretsDefinitionBrand as g, SecretsConfig as h, AppConfig as i, TailorDBType as j, TailorDBField as k, ResolverServiceInput as l, StaticWebsiteInput as m, RetryPolicy as n, ExecutorServiceInput as o, StaticWebsiteDefinitionBrand as p, HttpAdapterConfigInput as r, ResolverExternalConfig as s, ConcurrencyPolicy as t, WorkflowServiceConfig as u, IdPExternalConfig as v, AIGatewayConfig as w, IdPGqlOperations as x, IdpDefinitionBrand as y, AllowedValuesOutput as z };
1342
- //# sourceMappingURL=workflow.generated-Br9bmLdX.d.mts.map
1347
+ //# sourceMappingURL=workflow.generated-DJULCuRr.d.mts.map
@@ -110,10 +110,45 @@ Before applying changes, `deploy` shows a preview of the planned resource change
110
110
  After the detailed list, a summary line is printed:
111
111
 
112
112
  ```text
113
- Plan: 5 to create, 3 to update, 1 to delete, 25 unchanged
113
+ Plan: 5 to create, 3 to update, 1 to delete
114
114
  ```
115
115
 
116
- Use `--dry-run` to preview the plan without applying anything.
116
+ Use `--dry-run` to preview the plan without applying anything. In dry-run mode the plan is written to **stdout**, so it can be captured in CI without `2>&1`:
117
+
118
+ ```bash
119
+ tailor-sdk deploy --dry-run > plan.txt
120
+ ```
121
+
122
+ In apply mode, the plan is printed to stderr so it does not interfere with piped output.
123
+
124
+ **JSON Output:**
125
+
126
+ Pass the global `--json` / `-j` flag to get machine-readable output.
127
+
128
+ **Dry-run** (`--dry-run --json`): writes a JSON object to stdout:
129
+
130
+ ```json
131
+ {
132
+ "summary": { "create": 2, "update": 1, "delete": 0, "replace": 0 },
133
+ "changes": [{ "action": "create", "name": "Order", "labels": ["type"], "namespace": "tailordb" }],
134
+ "warnings": [
135
+ { "type": "unmanaged", "resourceType": "tailorDB", "name": "LegacyType" },
136
+ { "type": "skippedSecret", "resourceType": "secret", "name": "DB_PASSWORD" }
137
+ ],
138
+ "conflicts": [{ "resourceType": "tailorDB", "name": "User", "currentOwner": "other-app" }]
139
+ }
140
+ ```
141
+
142
+ - `summary` — counts of each change type.
143
+ - `changes` — planned resource changes, each with `action`, `name`, and optional `labels` / `namespace`.
144
+ - `warnings` — resources not in config (`type: "unmanaged"`) or secrets with missing values (`type: "skippedSecret"`). Unmanaged resources require confirmation in apply mode (apply is cancelled if declined); skipped secrets are non-blocking.
145
+ - `conflicts` — resources owned by another application that conflict with the current config. Require confirmation in apply mode; apply is cancelled if declined.
146
+
147
+ **Apply** (`--json`): writes a JSON object to stdout:
148
+
149
+ ```json
150
+ { "summary": { "create": 1, "update": 2, "delete": 0, "replace": 0 }, "status": "applied" }
151
+ ```
117
152
 
118
153
  ## remove
119
154
 
package/docs/cli/setup.md CHANGED
@@ -23,6 +23,7 @@ tailor-sdk setup [options] [command]
23
23
  | `--tag-pattern <TAG_PATTERN>` | - | Tag glob to match (requires --tag; defaults to v\*) | No | - |
24
24
  | `--environment <ENVIRONMENT>` | - | GitHub Environment for the plan/deploy jobs (defaults to the workspace name) | No | - |
25
25
  | `--no-plan` | - | Disable the plan job for a branch target (cannot be combined with --tag) | No | `false` |
26
+ | `--erd-preview` | - | Add PR ERD viewer artifacts with current/diff previews for TailorDB namespaces | No | `false` |
26
27
  | `--dir <DIR>` | `-d` | App directory (for monorepo setups) | No | `"."` |
27
28
  | `--force` | - | Discard hand edits / take over unmanaged files and regenerate | No | `false` |
28
29
 
@@ -247,6 +247,7 @@ See [Global Options](../cli-reference.md#global-options) for options available t
247
247
  | Command | Description |
248
248
  | --------------------------------------------- | ----------------------------------------------------------------- |
249
249
  | [`tailordb erd export`](#tailordb-erd-export) | Export TailorDB ERD static viewer from local TailorDB schema. |
250
+ | [`tailordb erd diff`](#tailordb-erd-diff) | Render TailorDB ERD schema diff HTML from exported ERD viewers. |
250
251
  | [`tailordb erd serve`](#tailordb-erd-serve) | Generate and serve TailorDB ERD locally with watch reload. (beta) |
251
252
  | [`tailordb erd deploy`](#tailordb-erd-deploy) | Deploy ERD static website for TailorDB namespace(s). |
252
253
 
@@ -270,6 +271,28 @@ tailor-sdk tailordb erd export [options]
270
271
 
271
272
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
272
273
 
274
+ #### tailordb erd diff
275
+
276
+ Render TailorDB ERD schema diff HTML from exported ERD viewers.
277
+
278
+ **Usage**
279
+
280
+ ```
281
+ tailor-sdk tailordb erd diff [options]
282
+ ```
283
+
284
+ **Options**
285
+
286
+ | Option | Alias | Description | Required | Default |
287
+ | ----------------------------- | ----- | ----------------------------------------------------------------------- | -------- | ------- |
288
+ | `--base-html <BASE_HTML>` | - | Base ERD viewer HTML file | No | - |
289
+ | `--head-html <HEAD_HTML>` | - | Head ERD viewer HTML file | No | - |
290
+ | `--namespace <NAMESPACE>` | `-n` | TailorDB namespace name (defaults to the provided ERD schema namespace) | No | - |
291
+ | `--output <OUTPUT>` | `-o` | Output ERD diff HTML file | Yes | - |
292
+ | `--output-json <OUTPUT_JSON>` | - | Optional output JSON file for the computed diff | No | - |
293
+
294
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
295
+
273
296
  #### tailordb erd serve
274
297
 
275
298
  Generate and serve TailorDB ERD locally with watch reload. (beta)
@@ -316,6 +339,7 @@ See [Global Options](../cli-reference.md#global-options) for options available t
316
339
 
317
340
  - ERD commands build from the local TailorDB schema, including plugin-generated TailorDB types.
318
341
  - `tailordb erd export` writes a self-contained `index.html` viewer to `<output>/<namespace>/dist`.
342
+ - `tailordb erd diff` compares exported self-contained viewer HTML files and writes a visual ERD viewer that can switch between the current schema and the highlighted diff.
319
343
  - `tailordb erd serve` watches the config file and TailorDB type files, then reloads the browser viewer when the rebuilt `index.html` reports a new embedded schema revision.
320
344
  - `tailordb erd deploy` still requires `erdSite` in `tailor.config.ts` because it uploads the generated viewer to a configured Static Website.
321
345
 
package/docs/cli/user.md CHANGED
@@ -14,6 +14,10 @@ tailor-sdk login [options]
14
14
 
15
15
  **Options**
16
16
 
17
+ | Option | Alias | Description | Required | Default | Env |
18
+ | --------------------- | ----- | ------------------------------------------------------------------- | -------- | ------- | ------------------------- |
19
+ | `--profile <PROFILE>` | `-p` | Workspace profile whose platform settings should be used for login. | No | - | `TAILOR_PLATFORM_PROFILE` |
20
+
17
21
  > One of the following option groups is required:
18
22
 
19
23
  **User Login:**
@@ -37,9 +41,15 @@ Logout from Tailor Platform.
37
41
  **Usage**
38
42
 
39
43
  ```
40
- tailor-sdk logout
44
+ tailor-sdk logout [options]
41
45
  ```
42
46
 
47
+ **Options**
48
+
49
+ | Option | Alias | Description | Required | Default | Env |
50
+ | --------------------- | ----- | -------------------------------------------------------------------- | -------- | ------- | ------------------------- |
51
+ | `--profile <PROFILE>` | `-p` | Workspace profile whose platform settings should be used for logout. | No | - | `TAILOR_PLATFORM_PROFILE` |
52
+
43
53
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
44
54
 
45
55
  ## user