@tailor-platform/sdk 1.16.0 → 1.17.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 +30 -0
- package/dist/application-D5ZEr4zk.mjs +4 -0
- package/dist/{application-DQ2F9UmJ.mjs → application-DYfVZVPT.mjs} +4806 -67
- package/dist/application-DYfVZVPT.mjs.map +1 -0
- package/dist/cli/index.mjs +3 -3
- package/dist/cli/lib.d.mts +147 -29
- package/dist/cli/lib.mjs +3 -3
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/configure/index.d.mts +3 -3
- package/dist/configure/index.mjs +46 -2
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{index-1V_2bvT4.d.mts → index-qQXpN674.d.mts} +136 -11
- package/dist/job-CULA2Pvf.mjs +51 -0
- package/dist/job-CULA2Pvf.mjs.map +1 -0
- package/dist/plugin/index.d.mts +1 -1
- package/dist/{schema-DRYB-nzA.mjs → schema-R5TxC5Pn.mjs} +143 -1
- package/dist/schema-R5TxC5Pn.mjs.map +1 -0
- package/dist/{index-Ds8lbSJb.d.mts → types-BeNtD-fA.d.mts} +88 -115
- package/dist/{types-_sYDzqHG.d.mts → types-DzvazVmg.d.mts} +169 -11
- package/dist/update-DQKCUNmr.mjs +10701 -0
- package/dist/update-DQKCUNmr.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +3 -3
- package/dist/utils/test/index.mjs +1 -1
- package/package.json +1 -1
- package/postinstall.mjs +2 -2
- package/dist/application-CNpRSiWJ.mjs +0 -4
- package/dist/application-DQ2F9UmJ.mjs.map +0 -1
- package/dist/job-XiwGyFJt.mjs +0 -21
- package/dist/job-XiwGyFJt.mjs.map +0 -1
- package/dist/schema-DRYB-nzA.mjs.map +0 -1
- package/dist/update-C5jgLxpK.mjs +0 -15436
- package/dist/update-C5jgLxpK.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference path="./user-defined.d.ts" />
|
|
2
|
-
import { Et as TailorDBServiceInput, c as BuiltinIdP, pt as ResolverServiceInput, r as AuthConfig } from "./types-
|
|
2
|
+
import { Et as TailorDBServiceInput, c as BuiltinIdP, pt as ResolverServiceInput, r as AuthConfig } from "./types-DzvazVmg.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/parser/service/executor/schema.d.ts
|
|
@@ -170,6 +170,68 @@ type ExecutorServiceConfig = {
|
|
|
170
170
|
};
|
|
171
171
|
type ExecutorServiceInput = ExecutorServiceConfig;
|
|
172
172
|
//#endregion
|
|
173
|
+
//#region src/parser/service/workflow/types.d.ts
|
|
174
|
+
type WorkflowServiceConfig = {
|
|
175
|
+
files: string[];
|
|
176
|
+
job_files?: string[];
|
|
177
|
+
ignores?: string[];
|
|
178
|
+
job_ignores?: string[];
|
|
179
|
+
};
|
|
180
|
+
type WorkflowServiceInput = WorkflowServiceConfig;
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/parser/generator-config/types.d.ts
|
|
183
|
+
type GeneratorConfig = z.input<typeof BaseGeneratorConfigSchema>;
|
|
184
|
+
type CodeGeneratorBase = Omit<z.output<typeof CodeGeneratorSchema>, "dependencies"> & {
|
|
185
|
+
dependencies: readonly DependencyKind[];
|
|
186
|
+
};
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region src/parser/generator-config/index.d.ts
|
|
189
|
+
declare const DependencyKindSchema: z.ZodEnum<{
|
|
190
|
+
executor: "executor";
|
|
191
|
+
tailordb: "tailordb";
|
|
192
|
+
resolver: "resolver";
|
|
193
|
+
}>;
|
|
194
|
+
type DependencyKind = z.infer<typeof DependencyKindSchema>;
|
|
195
|
+
declare const CodeGeneratorSchema: z.ZodObject<{
|
|
196
|
+
id: z.ZodString;
|
|
197
|
+
description: z.ZodString;
|
|
198
|
+
dependencies: z.ZodArray<z.ZodEnum<{
|
|
199
|
+
executor: "executor";
|
|
200
|
+
tailordb: "tailordb";
|
|
201
|
+
resolver: "resolver";
|
|
202
|
+
}>>;
|
|
203
|
+
processType: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
204
|
+
processResolver: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
205
|
+
processExecutor: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
206
|
+
processTailorDBNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
207
|
+
processResolverNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
208
|
+
aggregate: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodAny>;
|
|
209
|
+
}, z.core.$strip>;
|
|
210
|
+
declare const BaseGeneratorConfigSchema: z.ZodUnion<readonly [z.ZodTuple<[z.ZodLiteral<"@tailor-platform/kysely-type">, z.ZodObject<{
|
|
211
|
+
distPath: z.ZodString;
|
|
212
|
+
}, z.core.$strip>], null>, z.ZodTuple<[z.ZodLiteral<"@tailor-platform/seed">, z.ZodObject<{
|
|
213
|
+
distPath: z.ZodString;
|
|
214
|
+
machineUserName: z.ZodOptional<z.ZodString>;
|
|
215
|
+
}, z.core.$strip>], null>, z.ZodTuple<[z.ZodLiteral<"@tailor-platform/enum-constants">, z.ZodObject<{
|
|
216
|
+
distPath: z.ZodString;
|
|
217
|
+
}, z.core.$strip>], null>, z.ZodTuple<[z.ZodLiteral<"@tailor-platform/file-utils">, z.ZodObject<{
|
|
218
|
+
distPath: z.ZodString;
|
|
219
|
+
}, z.core.$strip>], null>, z.ZodObject<{
|
|
220
|
+
id: z.ZodString;
|
|
221
|
+
description: z.ZodString;
|
|
222
|
+
dependencies: z.ZodArray<z.ZodEnum<{
|
|
223
|
+
executor: "executor";
|
|
224
|
+
tailordb: "tailordb";
|
|
225
|
+
resolver: "resolver";
|
|
226
|
+
}>>;
|
|
227
|
+
processType: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
228
|
+
processResolver: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
229
|
+
processExecutor: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
230
|
+
processTailorDBNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
231
|
+
processResolverNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
232
|
+
aggregate: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodAny>;
|
|
233
|
+
}, z.core.$strip>]>;
|
|
234
|
+
//#endregion
|
|
173
235
|
//#region src/parser/service/staticwebsite/schema.d.ts
|
|
174
236
|
declare const StaticWebsiteSchema: z.core.$ZodBranded<z.ZodObject<{
|
|
175
237
|
name: z.ZodString;
|
|
@@ -199,15 +261,6 @@ declare function defineStaticWebSite(name: string, config: Omit<StaticWebsiteInp
|
|
|
199
261
|
} & StaticWebsiteDefinitionBrand;
|
|
200
262
|
type StaticWebsiteConfig = Omit<ReturnType<typeof defineStaticWebSite>, "url">;
|
|
201
263
|
//#endregion
|
|
202
|
-
//#region src/parser/service/workflow/types.d.ts
|
|
203
|
-
type WorkflowServiceConfig = {
|
|
204
|
-
files: string[];
|
|
205
|
-
job_files?: string[];
|
|
206
|
-
ignores?: string[];
|
|
207
|
-
job_ignores?: string[];
|
|
208
|
-
};
|
|
209
|
-
type WorkflowServiceInput = WorkflowServiceConfig;
|
|
210
|
-
//#endregion
|
|
211
264
|
//#region src/parser/service/idp/schema.d.ts
|
|
212
265
|
declare const IdPSchema: z.core.$ZodBranded<z.ZodObject<{
|
|
213
266
|
name: z.ZodString;
|
|
@@ -274,123 +327,43 @@ type IdPOwnConfig = Omit<DefinedIdp<string, IdPInput, string>, "provider">;
|
|
|
274
327
|
type IdPConfig = IdPOwnConfig | IdPExternalConfig;
|
|
275
328
|
//#endregion
|
|
276
329
|
//#region src/parser/app-config/types.d.ts
|
|
330
|
+
/**
|
|
331
|
+
* Application configuration for `defineConfig()`.
|
|
332
|
+
*
|
|
333
|
+
* Key fields:
|
|
334
|
+
* - `name` (required): Application name
|
|
335
|
+
* - `cors`: Array of allowed origins, e.g. `["https://example.com"]`
|
|
336
|
+
* - `auth`: Single auth config object (not an array)
|
|
337
|
+
* - `idp`: Array of IdP configs, e.g. `[myIdp]`
|
|
338
|
+
* - `staticWebsites`: Array of static website configs, e.g. `[website]`
|
|
339
|
+
* - `db`, `resolver`, `executor`, `workflow`: Service configs with file globs
|
|
340
|
+
*/
|
|
277
341
|
interface AppConfig<Auth extends AuthConfig = AuthConfig, Idp extends IdPConfig[] = IdPConfig[], StaticWebsites extends StaticWebsiteConfig[] = StaticWebsiteConfig[], Env extends Record<string, string | number | boolean> = Record<string, string | number | boolean>> {
|
|
342
|
+
/** Application name (required). */
|
|
278
343
|
name: string;
|
|
344
|
+
/** Environment variables accessible via `context.env` in resolvers and via the second argument `{ env }` in workflow job bodies. */
|
|
279
345
|
env?: Env;
|
|
346
|
+
/** Allowed CORS origins. Must be an array of strings, e.g. `["https://example.com"]`. */
|
|
280
347
|
cors?: string[];
|
|
348
|
+
/** IP addresses allowed to access the application. */
|
|
281
349
|
allowedIpAddresses?: string[];
|
|
350
|
+
/** Disable GraphQL introspection in production. */
|
|
282
351
|
disableIntrospection?: boolean;
|
|
352
|
+
/** TailorDB service configuration with type definition files. */
|
|
283
353
|
db?: TailorDBServiceInput;
|
|
354
|
+
/** Resolver service configuration with resolver files. */
|
|
284
355
|
resolver?: ResolverServiceInput;
|
|
356
|
+
/** Identity Provider configurations. Must be an array, e.g. `[myIdp]`. */
|
|
285
357
|
idp?: Idp;
|
|
358
|
+
/** Auth configuration (single object, not an array). */
|
|
286
359
|
auth?: Auth;
|
|
360
|
+
/** Executor service configuration with executor files. */
|
|
287
361
|
executor?: ExecutorServiceInput;
|
|
362
|
+
/** Workflow service configuration with workflow files. */
|
|
288
363
|
workflow?: WorkflowServiceInput;
|
|
364
|
+
/** Static website configurations. Must be an array, e.g. `[website]`. */
|
|
289
365
|
staticWebsites?: StaticWebsites;
|
|
290
366
|
}
|
|
291
367
|
//#endregion
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
type CodeGeneratorBase = Omit<z.output<typeof CodeGeneratorSchema>, "dependencies"> & {
|
|
295
|
-
dependencies: readonly DependencyKind[];
|
|
296
|
-
};
|
|
297
|
-
//#endregion
|
|
298
|
-
//#region src/parser/generator-config/index.d.ts
|
|
299
|
-
declare const DependencyKindSchema: z.ZodEnum<{
|
|
300
|
-
executor: "executor";
|
|
301
|
-
tailordb: "tailordb";
|
|
302
|
-
resolver: "resolver";
|
|
303
|
-
}>;
|
|
304
|
-
type DependencyKind = z.infer<typeof DependencyKindSchema>;
|
|
305
|
-
declare const CodeGeneratorSchema: z.ZodObject<{
|
|
306
|
-
id: z.ZodString;
|
|
307
|
-
description: z.ZodString;
|
|
308
|
-
dependencies: z.ZodArray<z.ZodEnum<{
|
|
309
|
-
executor: "executor";
|
|
310
|
-
tailordb: "tailordb";
|
|
311
|
-
resolver: "resolver";
|
|
312
|
-
}>>;
|
|
313
|
-
processType: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
314
|
-
processResolver: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
315
|
-
processExecutor: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
316
|
-
processTailorDBNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
317
|
-
processResolverNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
318
|
-
aggregate: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodAny>;
|
|
319
|
-
}, z.core.$strip>;
|
|
320
|
-
declare const BaseGeneratorConfigSchema: z.ZodUnion<readonly [z.ZodTuple<[z.ZodLiteral<"@tailor-platform/kysely-type">, z.ZodObject<{
|
|
321
|
-
distPath: z.ZodString;
|
|
322
|
-
}, z.core.$strip>], null>, z.ZodTuple<[z.ZodLiteral<"@tailor-platform/seed">, z.ZodObject<{
|
|
323
|
-
distPath: z.ZodString;
|
|
324
|
-
machineUserName: z.ZodOptional<z.ZodString>;
|
|
325
|
-
}, z.core.$strip>], null>, z.ZodTuple<[z.ZodLiteral<"@tailor-platform/enum-constants">, z.ZodObject<{
|
|
326
|
-
distPath: z.ZodString;
|
|
327
|
-
}, z.core.$strip>], null>, z.ZodTuple<[z.ZodLiteral<"@tailor-platform/file-utils">, z.ZodObject<{
|
|
328
|
-
distPath: z.ZodString;
|
|
329
|
-
}, z.core.$strip>], null>, z.ZodObject<{
|
|
330
|
-
id: z.ZodString;
|
|
331
|
-
description: z.ZodString;
|
|
332
|
-
dependencies: z.ZodArray<z.ZodEnum<{
|
|
333
|
-
executor: "executor";
|
|
334
|
-
tailordb: "tailordb";
|
|
335
|
-
resolver: "resolver";
|
|
336
|
-
}>>;
|
|
337
|
-
processType: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
338
|
-
processResolver: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
339
|
-
processExecutor: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
340
|
-
processTailorDBNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
341
|
-
processResolverNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
342
|
-
aggregate: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodAny>;
|
|
343
|
-
}, z.core.$strip>]>;
|
|
344
|
-
/**
|
|
345
|
-
* Creates a GeneratorConfigSchema with built-in generator support
|
|
346
|
-
* @param builtinGenerators - Map of generator IDs to their constructor functions
|
|
347
|
-
* @returns Generator config schema
|
|
348
|
-
*/
|
|
349
|
-
declare function createGeneratorConfigSchema(builtinGenerators: Map<string, (options: any) => CodeGeneratorBase>): z.core.$ZodBranded<z.ZodPipe<z.ZodUnion<readonly [z.ZodTuple<[z.ZodLiteral<"@tailor-platform/kysely-type">, z.ZodObject<{
|
|
350
|
-
distPath: z.ZodString;
|
|
351
|
-
}, z.core.$strip>], null>, z.ZodTuple<[z.ZodLiteral<"@tailor-platform/seed">, z.ZodObject<{
|
|
352
|
-
distPath: z.ZodString;
|
|
353
|
-
machineUserName: z.ZodOptional<z.ZodString>;
|
|
354
|
-
}, z.core.$strip>], null>, z.ZodTuple<[z.ZodLiteral<"@tailor-platform/enum-constants">, z.ZodObject<{
|
|
355
|
-
distPath: z.ZodString;
|
|
356
|
-
}, z.core.$strip>], null>, z.ZodTuple<[z.ZodLiteral<"@tailor-platform/file-utils">, z.ZodObject<{
|
|
357
|
-
distPath: z.ZodString;
|
|
358
|
-
}, z.core.$strip>], null>, z.ZodObject<{
|
|
359
|
-
id: z.ZodString;
|
|
360
|
-
description: z.ZodString;
|
|
361
|
-
dependencies: z.ZodArray<z.ZodEnum<{
|
|
362
|
-
executor: "executor";
|
|
363
|
-
tailordb: "tailordb";
|
|
364
|
-
resolver: "resolver";
|
|
365
|
-
}>>;
|
|
366
|
-
processType: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
367
|
-
processResolver: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
368
|
-
processExecutor: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
369
|
-
processTailorDBNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
370
|
-
processResolverNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
371
|
-
aggregate: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodAny>;
|
|
372
|
-
}, z.core.$strip>]>, z.ZodTransform<CodeGeneratorBase, ["@tailor-platform/kysely-type", {
|
|
373
|
-
distPath: string;
|
|
374
|
-
}] | ["@tailor-platform/seed", {
|
|
375
|
-
distPath: string;
|
|
376
|
-
machineUserName?: string | undefined;
|
|
377
|
-
}] | ["@tailor-platform/enum-constants", {
|
|
378
|
-
distPath: string;
|
|
379
|
-
}] | ["@tailor-platform/file-utils", {
|
|
380
|
-
distPath: string;
|
|
381
|
-
}] | {
|
|
382
|
-
id: string;
|
|
383
|
-
description: string;
|
|
384
|
-
dependencies: ("executor" | "tailordb" | "resolver")[];
|
|
385
|
-
aggregate: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodAny>;
|
|
386
|
-
processType?: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut> | undefined;
|
|
387
|
-
processResolver?: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut> | undefined;
|
|
388
|
-
processExecutor?: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut> | undefined;
|
|
389
|
-
processTailorDBNamespace?: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut> | undefined;
|
|
390
|
-
processResolverNamespace?: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut> | undefined;
|
|
391
|
-
}>>, "CodeGenerator", "out">;
|
|
392
|
-
type GeneratorConfigSchemaType = ReturnType<typeof createGeneratorConfigSchema>;
|
|
393
|
-
type Generator = z.output<GeneratorConfigSchemaType>;
|
|
394
|
-
//#endregion
|
|
395
|
-
export { ScheduleTriggerInput as C, ResolverExecutedTrigger as S, WorkflowOperation as T, FunctionOperation as _, IdPExternalConfig as a, IncomingWebhookTrigger as b, WorkflowServiceConfig as c, defineStaticWebSite as d, AuthAccessTokenTrigger as f, ExecutorServiceInput as g, ExecutorServiceConfig as h, IdPConfig as i, WorkflowServiceInput as l, ExecutorInput as m, GeneratorConfig as n, IdPInput as o, Executor as p, AppConfig as r, IdpDefinitionBrand as s, Generator as t, StaticWebsiteConfig as u, GqlOperation as v, WebhookOperation as w, RecordTrigger as x, IdpUserTrigger as y };
|
|
396
|
-
//# sourceMappingURL=index-Ds8lbSJb.d.mts.map
|
|
368
|
+
export { ScheduleTriggerInput as C, ResolverExecutedTrigger as S, WorkflowOperation as T, FunctionOperation as _, IdpDefinitionBrand as a, IncomingWebhookTrigger as b, CodeGeneratorBase as c, WorkflowServiceInput as d, AuthAccessTokenTrigger as f, ExecutorServiceInput as g, ExecutorServiceConfig as h, IdPInput as i, GeneratorConfig as l, ExecutorInput as m, IdPConfig as n, StaticWebsiteConfig as o, Executor as p, IdPExternalConfig as r, defineStaticWebSite as s, AppConfig as t, WorkflowServiceConfig as u, GqlOperation as v, WebhookOperation as w, RecordTrigger as x, IdpUserTrigger as y };
|
|
369
|
+
//# sourceMappingURL=types-BeNtD-fA.d.mts.map
|
|
@@ -534,8 +534,8 @@ declare const RawPermissionsSchema: z.ZodObject<{
|
|
|
534
534
|
}, z.core.$strict>, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodBoolean>]>], null>>>>;
|
|
535
535
|
actions: z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
536
536
|
create: "create";
|
|
537
|
-
update: "update";
|
|
538
537
|
delete: "delete";
|
|
538
|
+
update: "update";
|
|
539
539
|
aggregate: "aggregate";
|
|
540
540
|
bulkUpsert: "bulkUpsert";
|
|
541
541
|
read: "read";
|
|
@@ -951,6 +951,22 @@ type ArrayFieldOutput<T, O extends FieldOptions> = [O] extends [{
|
|
|
951
951
|
}] ? T[] : T;
|
|
952
952
|
//#endregion
|
|
953
953
|
//#region src/configure/services/tailordb/permission.d.ts
|
|
954
|
+
/**
|
|
955
|
+
* Record-level permission configuration for a TailorDB type.
|
|
956
|
+
* Defines create, read, update, and delete permissions.
|
|
957
|
+
*
|
|
958
|
+
* Prefer object format with explicit `conditions` and `permit` for readability.
|
|
959
|
+
* Shorthand array format is supported for compatibility, but less readable.
|
|
960
|
+
*
|
|
961
|
+
* For update operations, use `newRecord`/`oldRecord` operands instead of `record`.
|
|
962
|
+
* @example
|
|
963
|
+
* const permission: TailorTypePermission = {
|
|
964
|
+
* create: [{ conditions: [[{ user: "_loggedIn" }, "=", true]], permit: true }],
|
|
965
|
+
* read: [{ conditions: [[{ record: "isPublic" }, "=", true]], permit: true }],
|
|
966
|
+
* update: [{ conditions: [[{ newRecord: "ownerId" }, "=", { user: "id" }]], permit: true }],
|
|
967
|
+
* delete: [{ conditions: [[{ record: "ownerId" }, "=", { user: "id" }]], permit: true }],
|
|
968
|
+
* };
|
|
969
|
+
*/
|
|
954
970
|
type TailorTypePermission<User extends object = InferredAttributeMap, Type extends object = object> = {
|
|
955
971
|
create: readonly ActionPermission<"record", User, Type, false>[];
|
|
956
972
|
read: readonly ActionPermission<"record", User, Type, false>[];
|
|
@@ -1501,7 +1517,11 @@ interface TailorDBField<Defined extends DefinedDBFieldMetadata, Output> extends
|
|
|
1501
1517
|
description: true;
|
|
1502
1518
|
}>, Output>;
|
|
1503
1519
|
/**
|
|
1504
|
-
* Define a relation to another type
|
|
1520
|
+
* Define a relation to another type.
|
|
1521
|
+
* Relation types: "n-1" (many-to-one), "1-1" (one-to-one), "keyOnly" (key only).
|
|
1522
|
+
* Aliases "manyToOne", "oneToOne", and "N-1" are also accepted.
|
|
1523
|
+
* @example db.uuid().relation({ type: "n-1", toward: { type: otherModel } })
|
|
1524
|
+
* @example db.uuid().relation({ type: "1-1", toward: { type: profile } })
|
|
1505
1525
|
*/
|
|
1506
1526
|
relation<S extends RelationType, T extends TailorAnyDBType, CurrentDefined extends Defined>(this: CurrentDefined extends {
|
|
1507
1527
|
relation: unknown;
|
|
@@ -1559,7 +1579,10 @@ interface TailorDBField<Defined extends DefinedDBFieldMetadata, Output> extends
|
|
|
1559
1579
|
vector: true;
|
|
1560
1580
|
}>, Output>;
|
|
1561
1581
|
/**
|
|
1562
|
-
* Add hooks for create/update operations
|
|
1582
|
+
* Add hooks for create/update operations on this field.
|
|
1583
|
+
* The hook function receives `{ value, data, user }` and returns the computed value.
|
|
1584
|
+
* @example db.string().hooks({ create: ({ data }) => data.firstName + " " + data.lastName })
|
|
1585
|
+
* @example db.datetime().hooks({ create: () => new Date(), update: () => new Date() })
|
|
1563
1586
|
*/
|
|
1564
1587
|
hooks<CurrentDefined extends Defined, const H extends Hook<unknown, Output>>(this: CurrentDefined extends {
|
|
1565
1588
|
hooks: unknown;
|
|
@@ -1577,7 +1600,15 @@ interface TailorDBField<Defined extends DefinedDBFieldMetadata, Output> extends
|
|
|
1577
1600
|
serial: false;
|
|
1578
1601
|
}>, Output>;
|
|
1579
1602
|
/**
|
|
1580
|
-
* Add validation functions to the field
|
|
1603
|
+
* Add validation functions to the field.
|
|
1604
|
+
* Accepts a function or a tuple of [function, errorMessage].
|
|
1605
|
+
* Prefer the tuple form for diagnosable errors.
|
|
1606
|
+
* @example
|
|
1607
|
+
* // Function form (default error message):
|
|
1608
|
+
* db.int().validate(({ value }) => value >= 0)
|
|
1609
|
+
* @example
|
|
1610
|
+
* // Tuple form with custom error message (recommended):
|
|
1611
|
+
* db.string().validate([({ value }) => value.length >= 8, "Must be at least 8 characters"])
|
|
1581
1612
|
*/
|
|
1582
1613
|
validate<CurrentDefined extends Defined>(this: CurrentDefined extends {
|
|
1583
1614
|
validate: unknown;
|
|
@@ -1610,60 +1641,133 @@ interface TailorDBField<Defined extends DefinedDBFieldMetadata, Output> extends
|
|
|
1610
1641
|
} ? true : Defined["array"];
|
|
1611
1642
|
}>, FieldOutput$1<TailorToTs[Defined["type"]], NewOpt>>;
|
|
1612
1643
|
}
|
|
1644
|
+
/**
|
|
1645
|
+
* Create a UUID field.
|
|
1646
|
+
* @param options - Field configuration options
|
|
1647
|
+
* @returns A UUID field
|
|
1648
|
+
* @example db.uuid()
|
|
1649
|
+
* @example db.uuid({ optional: true })
|
|
1650
|
+
*/
|
|
1613
1651
|
declare function uuid<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
1614
1652
|
type: "uuid";
|
|
1615
1653
|
array: Opt extends {
|
|
1616
1654
|
array: true;
|
|
1617
1655
|
} ? true : false;
|
|
1618
1656
|
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
1657
|
+
/**
|
|
1658
|
+
* Create a string field.
|
|
1659
|
+
* @param options - Field configuration options
|
|
1660
|
+
* @returns A string field
|
|
1661
|
+
* @example db.string()
|
|
1662
|
+
* @example db.string({ optional: true })
|
|
1663
|
+
*/
|
|
1619
1664
|
declare function string<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
1620
1665
|
type: "string";
|
|
1621
1666
|
array: Opt extends {
|
|
1622
1667
|
array: true;
|
|
1623
1668
|
} ? true : false;
|
|
1624
1669
|
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
1670
|
+
/**
|
|
1671
|
+
* Create a boolean field.
|
|
1672
|
+
* Note: The method name is `bool` but creates a `boolean` type field.
|
|
1673
|
+
* @param options - Field configuration options
|
|
1674
|
+
* @returns A boolean field
|
|
1675
|
+
* @example db.bool()
|
|
1676
|
+
* @example db.bool({ optional: true })
|
|
1677
|
+
*/
|
|
1625
1678
|
declare function bool<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
1626
1679
|
type: "boolean";
|
|
1627
1680
|
array: Opt extends {
|
|
1628
1681
|
array: true;
|
|
1629
1682
|
} ? true : false;
|
|
1630
1683
|
}, Opt["optional"] extends true ? ArrayFieldOutput<boolean, Opt> | null : ArrayFieldOutput<boolean, Opt>>;
|
|
1684
|
+
/**
|
|
1685
|
+
* Create an integer field.
|
|
1686
|
+
* @param options - Field configuration options
|
|
1687
|
+
* @returns An integer field
|
|
1688
|
+
* @example db.int()
|
|
1689
|
+
* @example db.int({ optional: true })
|
|
1690
|
+
*/
|
|
1631
1691
|
declare function int<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
1632
1692
|
type: "integer";
|
|
1633
1693
|
array: Opt extends {
|
|
1634
1694
|
array: true;
|
|
1635
1695
|
} ? true : false;
|
|
1636
1696
|
}, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
|
|
1697
|
+
/**
|
|
1698
|
+
* Create a float (decimal number) field.
|
|
1699
|
+
* @param options - Field configuration options
|
|
1700
|
+
* @returns A float field
|
|
1701
|
+
* @example db.float()
|
|
1702
|
+
* @example db.float({ optional: true })
|
|
1703
|
+
*/
|
|
1637
1704
|
declare function float<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
1638
1705
|
type: "float";
|
|
1639
1706
|
array: Opt extends {
|
|
1640
1707
|
array: true;
|
|
1641
1708
|
} ? true : false;
|
|
1642
1709
|
}, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
|
|
1710
|
+
/**
|
|
1711
|
+
* Create a date field (date only, no time component).
|
|
1712
|
+
* Format: "yyyy-MM-dd"
|
|
1713
|
+
* @param options - Field configuration options
|
|
1714
|
+
* @returns A date field
|
|
1715
|
+
* @example db.date()
|
|
1716
|
+
*/
|
|
1643
1717
|
declare function date<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
1644
1718
|
type: "date";
|
|
1645
1719
|
array: Opt extends {
|
|
1646
1720
|
array: true;
|
|
1647
1721
|
} ? true : false;
|
|
1648
1722
|
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
1723
|
+
/**
|
|
1724
|
+
* Create a datetime field (date and time).
|
|
1725
|
+
* Format: ISO 8601 "yyyy-MM-ddTHH:mm:ssZ"
|
|
1726
|
+
* @param options - Field configuration options
|
|
1727
|
+
* @returns A datetime field
|
|
1728
|
+
* @example db.datetime()
|
|
1729
|
+
*/
|
|
1649
1730
|
declare function datetime<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
1650
1731
|
type: "datetime";
|
|
1651
1732
|
array: Opt extends {
|
|
1652
1733
|
array: true;
|
|
1653
1734
|
} ? true : false;
|
|
1654
1735
|
}, Opt["optional"] extends true ? ArrayFieldOutput<string | Date, Opt> | null : ArrayFieldOutput<string | Date, Opt>>;
|
|
1736
|
+
/**
|
|
1737
|
+
* Create a time field (time only, no date component).
|
|
1738
|
+
* Format: "HH:mm"
|
|
1739
|
+
* @param options - Field configuration options
|
|
1740
|
+
* @returns A time field
|
|
1741
|
+
* @example db.time()
|
|
1742
|
+
*/
|
|
1655
1743
|
declare function time<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
1656
1744
|
type: "time";
|
|
1657
1745
|
array: Opt extends {
|
|
1658
1746
|
array: true;
|
|
1659
1747
|
} ? true : false;
|
|
1660
1748
|
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
1749
|
+
/**
|
|
1750
|
+
* Create an enum field with a fixed set of allowed string values.
|
|
1751
|
+
* @param values - Array of allowed string values, or array of `{ value, description }` objects
|
|
1752
|
+
* @param options - Field configuration options
|
|
1753
|
+
* @returns An enum field
|
|
1754
|
+
* @example db.enum(["active", "inactive", "suspended"])
|
|
1755
|
+
* @example db.enum(["small", "medium", "large"], { optional: true })
|
|
1756
|
+
*/
|
|
1661
1757
|
declare function _enum<const V extends AllowedValues, const Opt extends FieldOptions>(values: V, options?: Opt): TailorDBField<{
|
|
1662
1758
|
type: "enum";
|
|
1663
1759
|
array: Opt extends {
|
|
1664
1760
|
array: true;
|
|
1665
1761
|
} ? true : false;
|
|
1666
1762
|
}, FieldOutput$1<AllowedValuesOutput<V>, Opt>>;
|
|
1763
|
+
/**
|
|
1764
|
+
* Create a nested object field with sub-fields.
|
|
1765
|
+
* @param fields - Record of nested field definitions
|
|
1766
|
+
* @param options - Field configuration options
|
|
1767
|
+
* @returns A nested object field
|
|
1768
|
+
* @example db.object({ street: db.string(), city: db.string(), zip: db.string() })
|
|
1769
|
+
* @example db.object({ name: db.string() }, { optional: true })
|
|
1770
|
+
*/
|
|
1667
1771
|
declare function object<const F extends Record<string, TailorAnyDBField> & ExcludeNestedDBFields<F>, const Opt extends FieldOptions>(fields: F, options?: Opt): TailorDBField<{
|
|
1668
1772
|
type: "nested";
|
|
1669
1773
|
array: Opt extends {
|
|
@@ -1681,11 +1785,26 @@ interface TailorDBType$1<Fields extends Record<string, TailorAnyDBField> = any,
|
|
|
1681
1785
|
/** Returns metadata for the type */
|
|
1682
1786
|
readonly metadata: TailorDBTypeMetadata;
|
|
1683
1787
|
/**
|
|
1684
|
-
* Add hooks for fields
|
|
1788
|
+
* Add hooks for fields at the type level.
|
|
1789
|
+
* Each key is a field name, and the value defines create/update hooks.
|
|
1790
|
+
* @example
|
|
1791
|
+
* db.type("Order", {
|
|
1792
|
+
* total: db.float(),
|
|
1793
|
+
* tax: db.float(),
|
|
1794
|
+
* ...db.fields.timestamps(),
|
|
1795
|
+
* }).hooks({
|
|
1796
|
+
* tax: { create: ({ data }) => data.total * 0.1, update: ({ data }) => data.total * 0.1 },
|
|
1797
|
+
* })
|
|
1685
1798
|
*/
|
|
1686
1799
|
hooks(hooks: Hooks<Fields>): TailorDBType$1<Fields, User>;
|
|
1687
1800
|
/**
|
|
1688
|
-
* Add validators for fields
|
|
1801
|
+
* Add validators for fields at the type level.
|
|
1802
|
+
* Each key is a field name, and the value is a validator or array of validators.
|
|
1803
|
+
* Prefer the tuple form [function, message] for diagnosable errors.
|
|
1804
|
+
* @example
|
|
1805
|
+
* db.type("User", { email: db.string() }).validate({
|
|
1806
|
+
* email: [({ value }) => value.includes("@"), "Email must contain @"],
|
|
1807
|
+
* })
|
|
1689
1808
|
*/
|
|
1690
1809
|
validate(validators: Validators<Fields>): TailorDBType$1<Fields, User>;
|
|
1691
1810
|
/**
|
|
@@ -1701,11 +1820,28 @@ interface TailorDBType$1<Fields extends Record<string, TailorAnyDBField> = any,
|
|
|
1701
1820
|
*/
|
|
1702
1821
|
files<const F extends string>(files: Record<F, string> & Partial<Record<keyof output<TailorDBType$1<Fields, User>>, never>>): TailorDBType$1<Fields, User>;
|
|
1703
1822
|
/**
|
|
1704
|
-
* Set record-level permissions
|
|
1823
|
+
* Set record-level permissions for create, read, update, and delete operations.
|
|
1824
|
+
* Prefer object format with explicit `conditions` and `permit` for readability.
|
|
1825
|
+
* For update operations, use `newRecord` and `oldRecord` operands.
|
|
1826
|
+
* @example
|
|
1827
|
+
* .permission({
|
|
1828
|
+
* create: [{ conditions: [[{ user: "_loggedIn" }, "=", true]], permit: true }],
|
|
1829
|
+
* read: [{ conditions: [[{ record: "isPublic" }, "=", true]], permit: true }],
|
|
1830
|
+
* update: [{ conditions: [[{ newRecord: "ownerId" }, "=", { user: "id" }]], permit: true }],
|
|
1831
|
+
* delete: [{ conditions: [[{ record: "ownerId" }, "=", { user: "id" }]], permit: true }],
|
|
1832
|
+
* })
|
|
1705
1833
|
*/
|
|
1706
1834
|
permission<U$1 extends object = User, P$1 extends TailorTypePermission<U$1, output<TailorDBType$1<Fields, User>>> = TailorTypePermission<U$1, output<TailorDBType$1<Fields, User>>>>(permission: P$1): TailorDBType$1<Fields, U$1>;
|
|
1707
1835
|
/**
|
|
1708
|
-
* Set GraphQL-level permissions
|
|
1836
|
+
* Set GraphQL-level permissions controlling access to GraphQL operations.
|
|
1837
|
+
* @example
|
|
1838
|
+
* .gqlPermission([
|
|
1839
|
+
* {
|
|
1840
|
+
* conditions: [[{ user: "_loggedIn" }, "=", true]],
|
|
1841
|
+
* actions: "all",
|
|
1842
|
+
* permit: true,
|
|
1843
|
+
* },
|
|
1844
|
+
* ])
|
|
1709
1845
|
*/
|
|
1710
1846
|
gqlPermission<U$1 extends object = User, P$1 extends TailorTypeGqlPermission<U$1> = TailorTypeGqlPermission<U$1>>(permission: P$1): TailorDBType$1<Fields, U$1>;
|
|
1711
1847
|
/**
|
|
@@ -1747,16 +1883,28 @@ type DBType<F extends {
|
|
|
1747
1883
|
id: idField;
|
|
1748
1884
|
} & F>;
|
|
1749
1885
|
/**
|
|
1750
|
-
* Creates a new database type with the specified fields
|
|
1886
|
+
* Creates a new database type with the specified fields.
|
|
1887
|
+
* An `id` field (UUID) is automatically added to every type.
|
|
1751
1888
|
* @param name - The name of the type, or a tuple of [name, pluralForm]
|
|
1752
1889
|
* @param fields - The field definitions for the type
|
|
1753
1890
|
* @returns A new TailorDBType instance
|
|
1891
|
+
* @example
|
|
1892
|
+
* export const user = db.type("User", {
|
|
1893
|
+
* name: db.string(),
|
|
1894
|
+
* email: db.string(),
|
|
1895
|
+
* age: db.int({ optional: true }),
|
|
1896
|
+
* role: db.enum(["admin", "member"]),
|
|
1897
|
+
* ...db.fields.timestamps(),
|
|
1898
|
+
* });
|
|
1899
|
+
* // Always export both the value and type:
|
|
1900
|
+
* export type user = typeof user;
|
|
1754
1901
|
*/
|
|
1755
1902
|
declare function dbType<const F extends {
|
|
1756
1903
|
id?: never;
|
|
1757
1904
|
} & Record<string, TailorAnyDBField>>(name: string | [string, string], fields: F): DBType<F>;
|
|
1758
1905
|
/**
|
|
1759
|
-
* Creates a new database type with the specified fields and description
|
|
1906
|
+
* Creates a new database type with the specified fields and description.
|
|
1907
|
+
* An `id` field (UUID) is automatically added to every type.
|
|
1760
1908
|
* @param name - The name of the type, or a tuple of [name, pluralForm]
|
|
1761
1909
|
* @param description - A description of the type
|
|
1762
1910
|
* @param fields - The field definitions for the type
|
|
@@ -1778,6 +1926,16 @@ declare const db: {
|
|
|
1778
1926
|
enum: typeof _enum;
|
|
1779
1927
|
object: typeof object;
|
|
1780
1928
|
fields: {
|
|
1929
|
+
/**
|
|
1930
|
+
* Creates standard timestamp fields (createdAt, updatedAt) with auto-hooks.
|
|
1931
|
+
* createdAt is set on create, updatedAt is set on update.
|
|
1932
|
+
* @returns An object with createdAt and updatedAt fields
|
|
1933
|
+
* @example
|
|
1934
|
+
* const model = db.type("Model", {
|
|
1935
|
+
* name: db.string(),
|
|
1936
|
+
* ...db.fields.timestamps(),
|
|
1937
|
+
* });
|
|
1938
|
+
*/
|
|
1781
1939
|
timestamps: () => {
|
|
1782
1940
|
createdAt: TailorDBField<{
|
|
1783
1941
|
type: "datetime";
|
|
@@ -2281,4 +2439,4 @@ interface TailorDBType {
|
|
|
2281
2439
|
}
|
|
2282
2440
|
//#endregion
|
|
2283
2441
|
export { unsafeAllowAllTypePermission as $, TailorDBField as A, PluginGeneratedExecutor as B, UserAttributeKey as C, unauthenticatedTailorUser as Ct, ValueOperand as D, UsernameFieldKey as E, TailorDBServiceInput as Et, Plugin as F, PluginOutput as G, PluginGeneratedResolver as H, PluginAttachment as I, TypePluginOutput as J, PluginProcessContext as K, PluginConfigs as L, TailorDBType$1 as M, db as N, TailorAnyDBField as O, NamespacePluginOutput as P, unsafeAllowAllGqlPermission as Q, PluginExecutorContext as R, TenantProviderConfig as S, TailorUser as St, UserAttributeMap as T, AllowedValuesOutput as Tt, PluginGeneratedType as U, PluginGeneratedExecutorWithFile as V, PluginNamespaceProcessContext as W, TailorTypeGqlPermission as X, PermissionCondition as Y, TailorTypePermission as Z, SCIMAttributeMapping as _, Env as _t, AuthInvoker as a, TailorFieldType as at, SCIMConfig as b, AttributeList as bt, BuiltinIdP as c, QueryType as ct, IdProviderConfig as d, ResolverInput as dt, ArrayFieldOutput as et, OAuth2ClientGrantType as f, ResolverServiceConfig as ft, SCIMAttribute as g, output as gt, SAML as h, JsonCompatible as ht, AuthExternalConfig as i, FieldOutput$1 as it, TailorDBInstance as j, TailorAnyDBType as k, DefinedAuth as l, Resolver as lt, OIDC as m, InferFieldsOutput as mt, TypeSourceInfoEntry as n, FieldMetadata as nt, AuthOwnConfig as o, TailorAnyField as ot, OAuth2ClientInput as p, ResolverServiceInput as pt, TailorDBTypeForPlugin as q, AuthConfig as r, FieldOptions as rt, AuthServiceInput as s, TailorField as st, TailorDBType as t, DefinedFieldMetadata as tt, IDToken as u, ResolverExternalConfig as ut, SCIMAttributeType as v, TailorEnv as vt, UserAttributeListKey as w, AllowedValues as wt, SCIMResource as x, AttributeMap as xt, SCIMAuthorization as y, TailorActor as yt, PluginExecutorContextBase as z };
|
|
2284
|
-
//# sourceMappingURL=types-
|
|
2442
|
+
//# sourceMappingURL=types-DzvazVmg.d.mts.map
|