@tailor-platform/sdk 1.39.0 → 1.40.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 +36 -0
- package/README.md +7 -10
- package/dist/{env-CgI46oPS.d.mts → actor-B2oEmlTc.d.mts} +9 -9
- package/dist/application-CEeKm4R-.mjs +4 -0
- package/dist/{application-DhQrXEld.mjs → application-C_LFXkKJ.mjs} +148 -148
- package/dist/application-C_LFXkKJ.mjs.map +1 -0
- package/dist/{brand-D-d15jx3.mjs → brand-Ll48SMXe.mjs} +1 -1
- package/dist/{brand-D-d15jx3.mjs.map → brand-Ll48SMXe.mjs.map} +1 -1
- package/dist/cli/index.mjs +163 -42
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +43 -9
- package/dist/cli/lib.mjs +4 -4
- package/dist/cli/skills.mjs +13 -43
- package/dist/cli/skills.mjs.map +1 -1
- package/dist/{client-xzPXtc_e.mjs → client-DjGFRjH4.mjs} +105 -47
- package/dist/client-DjGFRjH4.mjs.map +1 -0
- package/dist/client-Dtf48x0o.mjs +4 -0
- package/dist/configure/index.d.mts +4 -4
- package/dist/configure/index.mjs +55 -4
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{crash-report-BEAiCSCl.mjs → crash-report-CEIXtw4D.mjs} +1 -1
- package/dist/{crash-report-DXhPL8Ue.mjs → crash-report-CSWITsTz.mjs} +4 -4
- package/dist/{crash-report-DXhPL8Ue.mjs.map → crash-report-CSWITsTz.mjs.map} +1 -1
- package/dist/{errors-D9f2UJpT.mjs → errors-ChWX5ZG8.mjs} +1 -1
- package/dist/{errors-D9f2UJpT.mjs.map → errors-ChWX5ZG8.mjs.map} +1 -1
- package/dist/field-BY2vbJ8f.mjs +23 -0
- package/dist/field-BY2vbJ8f.mjs.map +1 -0
- package/dist/{index-DbzopC7M.d.mts → index-BtXZdz-F.d.mts} +2 -2
- package/dist/{index-y5790SX_.d.mts → index-Chvw1Eod.d.mts} +2 -2
- package/dist/{index-B2tsEXdh.d.mts → index-CiNNNpuH.d.mts} +2 -2
- package/dist/{index-31hm0Fq7.d.mts → index-D_ezppY7.d.mts} +133 -30
- package/dist/{index-DeBFa7oc.d.mts → index-reFAYSX7.d.mts} +2 -2
- package/dist/{interceptor-CzaH2Ur6.mjs → interceptor-4UC-KTno.mjs} +1 -1
- package/dist/{interceptor-CzaH2Ur6.mjs.map → interceptor-4UC-KTno.mjs.map} +1 -1
- package/dist/{job-DkAklmE4.mjs → job-p6zf8Qpg.mjs} +2 -2
- package/dist/job-p6zf8Qpg.mjs.map +1 -0
- package/dist/{logger-5_JMzHmw.mjs → logger-DTNAMYGy.mjs} +1 -1
- package/dist/{logger-5_JMzHmw.mjs.map → logger-DTNAMYGy.mjs.map} +1 -1
- package/dist/package-json-CPR7s5hf.mjs +4 -0
- package/dist/{package-json-BHViVisJ.mjs → package-json-CWp8s9dE.mjs} +1 -1
- package/dist/{package-json-BHViVisJ.mjs.map → package-json-CWp8s9dE.mjs.map} +1 -1
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/index.d.mts +2 -2
- package/dist/repl-editor-DjycioU-.mjs +255 -0
- package/dist/repl-editor-DjycioU-.mjs.map +1 -0
- package/dist/{runtime-DtSOnOHh.mjs → runtime-im7Sq4jO.mjs} +313 -182
- package/dist/runtime-im7Sq4jO.mjs.map +1 -0
- package/dist/{schema-CnwUqPyM.mjs → schema-CEcfEyPN.mjs} +4 -44
- package/dist/schema-CEcfEyPN.mjs.map +1 -0
- package/dist/{seed-DrbB1VXd.mjs → seed-CyYPhvNL.mjs} +12 -12
- package/dist/seed-CyYPhvNL.mjs.map +1 -0
- package/dist/{service-Bcp6JB3w.mjs → service-SrG26B9T.mjs} +3 -3
- package/dist/{service-Bcp6JB3w.mjs.map → service-SrG26B9T.mjs.map} +1 -1
- package/dist/{plugin-_K3ZfP8B.d.mts → tailor-db-field-CoFKRCYW.d.mts} +695 -1187
- package/dist/{telemetry-DwHuiNiR.mjs → telemetry-BuDto_2q.mjs} +2 -2
- package/dist/{telemetry-DwHuiNiR.mjs.map → telemetry-BuDto_2q.mjs.map} +1 -1
- package/dist/telemetry-C1hzFaiV.mjs +4 -0
- package/dist/types-BnphjkIJ.mjs +5 -0
- package/dist/{types-B9ZMosul.mjs → types-Duhhsx3R.mjs} +3 -32
- package/dist/types-Duhhsx3R.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/utils/test/index.mjs +1 -1
- package/dist/workflow.generated-Btz6srLR.d.mts +1207 -0
- package/docs/cli/application.md +21 -5
- package/docs/cli/auth.md +20 -14
- package/docs/cli/executor.md +17 -14
- package/docs/cli/function.md +6 -4
- package/docs/cli/query.md +45 -0
- package/docs/cli/secret.md +13 -9
- package/docs/cli/skills.md +75 -0
- package/docs/cli/staticwebsite.md +6 -4
- package/docs/cli/user.md +9 -1
- package/docs/cli/workflow.md +17 -13
- package/docs/cli-reference.md +16 -0
- package/docs/services/idp.md +4 -4
- package/docs/services/workflow.md +1 -1
- package/package.json +12 -9
- package/dist/application-C1ipG5Q6.mjs +0 -4
- package/dist/application-DhQrXEld.mjs.map +0 -1
- package/dist/client-BWAbbA1C.mjs +0 -4
- package/dist/client-xzPXtc_e.mjs.map +0 -1
- package/dist/job-DkAklmE4.mjs.map +0 -1
- package/dist/package-json--6dmp6-h.mjs +0 -4
- package/dist/runtime-DtSOnOHh.mjs.map +0 -1
- package/dist/schema-CnwUqPyM.mjs.map +0 -1
- package/dist/seed-DrbB1VXd.mjs.map +0 -1
- package/dist/telemetry-4IOPW6wE.mjs +0 -4
- package/dist/types-B9ZMosul.mjs.map +0 -1
- package/dist/types-C45jRrCM.mjs +0 -4
- package/dist/workflow.generated-BxbnuzAE.d.mts +0 -414
|
@@ -1,33 +1,155 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
2
|
import { IsAny, JsonObject, NonEmptyObject } from "type-fest";
|
|
5
3
|
|
|
6
|
-
//#region src/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
4
|
+
//#region src/types/helpers.d.ts
|
|
5
|
+
type Prettify<T> = { [K in keyof T as string extends K ? never : K]: T[K] } & {};
|
|
6
|
+
type DeepWritable<T> = T extends Date | RegExp | Function ? T : T extends object ? { -readonly [P in keyof T]: DeepWritable<T[P]> } & {} : T;
|
|
7
|
+
type output<T> = T extends {
|
|
8
|
+
_output: infer U;
|
|
9
|
+
} ? DeepWritable<U> : never;
|
|
10
|
+
type NullableToOptional<T> = { [K in keyof T as null extends T[K] ? never : K]: T[K] } & { [K in keyof T as null extends T[K] ? K : never]?: T[K] };
|
|
11
|
+
type InferFieldsOutput<F extends Record<string, {
|
|
12
|
+
_output: any;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}>> = DeepWritable<Prettify<NullableToOptional<{ [K in keyof F]: output<F[K]> }>>>;
|
|
15
|
+
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
16
|
+
[key: string]: JsonValue;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A looser version of JsonValue that accepts interfaces.
|
|
20
|
+
* TypeScript interfaces don't have index signatures by default,
|
|
21
|
+
* so they can't be assigned to JsonValue's {[Key in string]: JsonValue}.
|
|
22
|
+
* This type uses a recursive check instead.
|
|
23
|
+
*/
|
|
24
|
+
type JsonCompatible<T> = T extends string | number | boolean | null | undefined ? T : T extends readonly (infer U)[] ? JsonCompatible<U>[] : T extends object ? T extends {
|
|
25
|
+
toJSON: () => unknown;
|
|
26
|
+
} ? never : { [K in keyof T]: JsonCompatible<T[K]> } : never;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/types/user.d.ts
|
|
29
|
+
interface AttributeMap {}
|
|
30
|
+
interface AttributeList {
|
|
31
|
+
__tuple?: [];
|
|
32
|
+
}
|
|
33
|
+
type InferredAttributeMap = keyof AttributeMap extends never ? Record<string, string | string[] | boolean | boolean[] | undefined> : AttributeMap;
|
|
34
|
+
type InferredAttributeList = AttributeList["__tuple"] extends [] ? string[] : AttributeList["__tuple"];
|
|
35
|
+
/** Represents a user in the Tailor platform. */
|
|
36
|
+
type TailorUser = {
|
|
37
|
+
/**
|
|
38
|
+
* The ID of the user.
|
|
39
|
+
* For unauthenticated users, this will be a nil UUID.
|
|
40
|
+
*/
|
|
41
|
+
id: string;
|
|
42
|
+
/**
|
|
43
|
+
* The type of the user.
|
|
44
|
+
* For unauthenticated users, this will be an empty string.
|
|
45
|
+
*/
|
|
46
|
+
type: "user" | "machine_user" | ""; /** The ID of the workspace the user belongs to. */
|
|
47
|
+
workspaceId: string;
|
|
48
|
+
/**
|
|
49
|
+
* A map of the user's attributes.
|
|
50
|
+
* For unauthenticated users, this will be null.
|
|
51
|
+
*/
|
|
52
|
+
attributes: InferredAttributeMap | null;
|
|
53
|
+
/**
|
|
54
|
+
* A list of the user's attributes.
|
|
55
|
+
* For unauthenticated users, this will be an empty array.
|
|
56
|
+
*/
|
|
57
|
+
attributeList: InferredAttributeList;
|
|
58
|
+
};
|
|
59
|
+
/** Represents an unauthenticated user in the Tailor platform. */
|
|
60
|
+
declare const unauthenticatedTailorUser: TailorUser;
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/types/validation.d.ts
|
|
63
|
+
/**
|
|
64
|
+
* Validation function type
|
|
65
|
+
*/
|
|
66
|
+
type ValidateFn<O, D = unknown> = (args: {
|
|
67
|
+
value: O;
|
|
68
|
+
data: D;
|
|
69
|
+
user: TailorUser;
|
|
70
|
+
}) => boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Validation configuration with custom error message
|
|
73
|
+
*/
|
|
74
|
+
type ValidateConfig<O, D = unknown> = [ValidateFn<O, D>, string];
|
|
75
|
+
/**
|
|
76
|
+
* Field-level validation function
|
|
77
|
+
*/
|
|
78
|
+
type FieldValidateFn<O> = ValidateFn<O>;
|
|
79
|
+
/**
|
|
80
|
+
* Field-level validation configuration
|
|
81
|
+
*/
|
|
82
|
+
type FieldValidateConfig<O> = ValidateConfig<O>;
|
|
83
|
+
/**
|
|
84
|
+
* Input type for field validation - can be either a function or a tuple of [function, errorMessage]
|
|
85
|
+
*/
|
|
86
|
+
type FieldValidateInput<O> = FieldValidateFn<O> | FieldValidateConfig<O>;
|
|
87
|
+
/**
|
|
88
|
+
* Base validators type for field collections
|
|
89
|
+
* @template F - Record of fields
|
|
90
|
+
* @template ExcludeKeys - Keys to exclude from validation (default: "id" for TailorDB)
|
|
91
|
+
*/
|
|
92
|
+
type ValidatorsBase<F extends Record<string, {
|
|
93
|
+
_defined: any;
|
|
94
|
+
_output: any;
|
|
95
|
+
[key: string]: any;
|
|
96
|
+
}>, ExcludeKeys extends string = "id"> = NonEmptyObject<{ [K in Exclude<keyof F, ExcludeKeys> as F[K]["_defined"] extends {
|
|
97
|
+
validate: unknown;
|
|
98
|
+
} ? never : K]?: ValidateFn<output<F[K]>, InferFieldsOutput<F>> | ValidateConfig<output<F[K]>, InferFieldsOutput<F>> | (ValidateFn<output<F[K]>, InferFieldsOutput<F>> | ValidateConfig<output<F[K]>, InferFieldsOutput<F>>)[] }>;
|
|
99
|
+
/**
|
|
100
|
+
* Validators type (by default excludes "id" field for TailorDB compatibility)
|
|
101
|
+
* Can be used with both TailorField and TailorDBField
|
|
102
|
+
*/
|
|
103
|
+
type Validators<F extends Record<string, {
|
|
104
|
+
_defined: any;
|
|
105
|
+
_output: any;
|
|
106
|
+
[key: string]: any;
|
|
107
|
+
}>> = ValidatorsBase<F, "id">;
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/types/field-types.d.ts
|
|
110
|
+
interface EnumValue {
|
|
111
|
+
value: string;
|
|
112
|
+
description?: string;
|
|
113
|
+
}
|
|
114
|
+
type TailorFieldType = "uuid" | "string" | "boolean" | "integer" | "float" | "decimal" | "enum" | "date" | "datetime" | "time" | "nested";
|
|
115
|
+
type TailorToTs = {
|
|
116
|
+
string: string;
|
|
117
|
+
integer: number;
|
|
118
|
+
float: number;
|
|
119
|
+
decimal: string;
|
|
120
|
+
boolean: boolean;
|
|
121
|
+
uuid: string;
|
|
122
|
+
date: string;
|
|
123
|
+
datetime: string | Date;
|
|
124
|
+
time: string;
|
|
125
|
+
enum: string;
|
|
126
|
+
object: Record<string, unknown>;
|
|
127
|
+
nested: Record<string, unknown>;
|
|
128
|
+
} & Record<TailorFieldType, unknown>;
|
|
129
|
+
interface FieldMetadata {
|
|
130
|
+
description?: string;
|
|
131
|
+
required?: boolean;
|
|
132
|
+
array?: boolean;
|
|
133
|
+
allowedValues?: EnumValue[];
|
|
134
|
+
validate?: FieldValidateInput<any>[];
|
|
135
|
+
typeName?: string;
|
|
136
|
+
}
|
|
137
|
+
interface DefinedFieldMetadata {
|
|
138
|
+
type: TailorFieldType;
|
|
139
|
+
array: boolean;
|
|
140
|
+
description?: boolean;
|
|
141
|
+
validate?: boolean;
|
|
142
|
+
typeName?: boolean;
|
|
143
|
+
}
|
|
144
|
+
type FieldOptions = {
|
|
145
|
+
optional?: boolean;
|
|
146
|
+
array?: boolean;
|
|
147
|
+
};
|
|
148
|
+
type FieldOutput$1<T, O extends FieldOptions> = OptionalFieldOutput<ArrayFieldOutput<T, O>, O>;
|
|
149
|
+
type OptionalFieldOutput<T, O extends FieldOptions> = O["optional"] extends true ? T | null : T;
|
|
150
|
+
type ArrayFieldOutput<T, O extends FieldOptions> = [O] extends [{
|
|
151
|
+
array: true;
|
|
152
|
+
}] ? T[] : T;
|
|
31
153
|
//#endregion
|
|
32
154
|
//#region src/types/auth.generated.d.ts
|
|
33
155
|
type AuthInvokerObject = {
|
|
@@ -351,8 +473,31 @@ type Executor = {
|
|
|
351
473
|
description?: string | undefined;
|
|
352
474
|
};
|
|
353
475
|
//#endregion
|
|
476
|
+
//#region src/types/generator-config.generated.d.ts
|
|
477
|
+
type BaseGeneratorConfig = ["@tailor-platform/kysely-type", {
|
|
478
|
+
distPath: string;
|
|
479
|
+
}] | ["@tailor-platform/seed", {
|
|
480
|
+
distPath: string;
|
|
481
|
+
machineUserName?: string | undefined;
|
|
482
|
+
}] | ["@tailor-platform/enum-constants", {
|
|
483
|
+
distPath: string;
|
|
484
|
+
}] | ["@tailor-platform/file-utils", {
|
|
485
|
+
distPath: string;
|
|
486
|
+
}] | {
|
|
487
|
+
id: string;
|
|
488
|
+
description: string;
|
|
489
|
+
dependencies: ("tailordb" | "resolver" | "executor")[];
|
|
490
|
+
aggregate: Function;
|
|
491
|
+
processType?: Function | undefined;
|
|
492
|
+
processResolver?: Function | undefined;
|
|
493
|
+
processExecutor?: Function | undefined;
|
|
494
|
+
processTailorDBNamespace?: Function | undefined;
|
|
495
|
+
processResolverNamespace?: Function | undefined;
|
|
496
|
+
};
|
|
497
|
+
type BaseGeneratorConfigInput = BaseGeneratorConfig;
|
|
498
|
+
//#endregion
|
|
354
499
|
//#region src/types/generator-config.d.ts
|
|
355
|
-
type GeneratorConfig =
|
|
500
|
+
type GeneratorConfig = BaseGeneratorConfigInput;
|
|
356
501
|
//#endregion
|
|
357
502
|
//#region src/types/resolver.generated.d.ts
|
|
358
503
|
type Resolver = {
|
|
@@ -410,361 +555,153 @@ type AuthConnectionConfig = {
|
|
|
410
555
|
tokenUrl?: string | undefined;
|
|
411
556
|
};
|
|
412
557
|
//#endregion
|
|
413
|
-
//#region src/
|
|
414
|
-
type AllowedValue = EnumValue;
|
|
415
|
-
type AllowedValues = readonly [string | EnumValue, ...(string | EnumValue)[]];
|
|
416
|
-
type AllowedValuesOutput<V extends AllowedValues> = V[number] extends infer T ? T extends string ? T : T extends {
|
|
417
|
-
value: infer K;
|
|
418
|
-
} ? K : never : never;
|
|
419
|
-
//#endregion
|
|
420
|
-
//#region src/configure/types/user.d.ts
|
|
421
|
-
interface AttributeMap {}
|
|
422
|
-
interface AttributeList {
|
|
423
|
-
__tuple?: [];
|
|
424
|
-
}
|
|
425
|
-
type InferredAttributeMap = keyof AttributeMap extends never ? Record<string, string | string[] | boolean | boolean[] | undefined> : AttributeMap;
|
|
426
|
-
type InferredAttributeList = AttributeList["__tuple"] extends [] ? string[] : AttributeList["__tuple"];
|
|
427
|
-
/** Represents a user in the Tailor platform. */
|
|
428
|
-
type TailorUser = {
|
|
429
|
-
/**
|
|
430
|
-
* The ID of the user.
|
|
431
|
-
* For unauthenticated users, this will be a nil UUID.
|
|
432
|
-
*/
|
|
433
|
-
id: string;
|
|
434
|
-
/**
|
|
435
|
-
* The type of the user.
|
|
436
|
-
* For unauthenticated users, this will be an empty string.
|
|
437
|
-
*/
|
|
438
|
-
type: "user" | "machine_user" | ""; /** The ID of the workspace the user belongs to. */
|
|
439
|
-
workspaceId: string;
|
|
440
|
-
/**
|
|
441
|
-
* A map of the user's attributes.
|
|
442
|
-
* For unauthenticated users, this will be null.
|
|
443
|
-
*/
|
|
444
|
-
attributes: InferredAttributeMap | null;
|
|
445
|
-
/**
|
|
446
|
-
* A list of the user's attributes.
|
|
447
|
-
* For unauthenticated users, this will be an empty array.
|
|
448
|
-
*/
|
|
449
|
-
attributeList: InferredAttributeList;
|
|
450
|
-
};
|
|
451
|
-
/** Represents an unauthenticated user in the Tailor platform. */
|
|
452
|
-
declare const unauthenticatedTailorUser: TailorUser;
|
|
453
|
-
//#endregion
|
|
454
|
-
//#region src/configure/types/helpers.d.ts
|
|
455
|
-
type Prettify<T> = { [K in keyof T as string extends K ? never : K]: T[K] } & {};
|
|
456
|
-
type DeepWritable<T> = T extends Date | RegExp | Function ? T : T extends object ? { -readonly [P in keyof T]: DeepWritable<T[P]> } & {} : T;
|
|
457
|
-
type output<T> = T extends {
|
|
458
|
-
_output: infer U;
|
|
459
|
-
} ? DeepWritable<U> : never;
|
|
460
|
-
type NullableToOptional<T> = { [K in keyof T as null extends T[K] ? never : K]: T[K] } & { [K in keyof T as null extends T[K] ? K : never]?: T[K] };
|
|
461
|
-
type InferFieldsOutput<F extends Record<string, {
|
|
462
|
-
_output: any;
|
|
463
|
-
[key: string]: any;
|
|
464
|
-
}>> = DeepWritable<Prettify<NullableToOptional<{ [K in keyof F]: output<F[K]> }>>>;
|
|
465
|
-
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
466
|
-
[key: string]: JsonValue;
|
|
467
|
-
};
|
|
468
|
-
/**
|
|
469
|
-
* A looser version of JsonValue that accepts interfaces.
|
|
470
|
-
* TypeScript interfaces don't have index signatures by default,
|
|
471
|
-
* so they can't be assigned to JsonValue's {[Key in string]: JsonValue}.
|
|
472
|
-
* This type uses a recursive check instead.
|
|
473
|
-
*/
|
|
474
|
-
type JsonCompatible<T> = T extends string | number | boolean | null | undefined ? T : T extends readonly (infer U)[] ? JsonCompatible<U>[] : T extends object ? T extends {
|
|
475
|
-
toJSON: () => unknown;
|
|
476
|
-
} ? never : { [K in keyof T]: JsonCompatible<T[K]> } : never;
|
|
477
|
-
//#endregion
|
|
478
|
-
//#region src/types/field.generated.d.ts
|
|
479
|
-
type TailorFieldInput = {
|
|
480
|
-
/** Field data type */type: "string" | "boolean" | "uuid" | "integer" | "float" | "decimal" | "enum" | "date" | "datetime" | "time" | "nested"; /** Field metadata configuration */
|
|
481
|
-
metadata: {
|
|
482
|
-
required?: boolean | undefined;
|
|
483
|
-
array?: boolean | undefined;
|
|
484
|
-
description?: string | undefined;
|
|
485
|
-
allowedValues?: {
|
|
486
|
-
value: string;
|
|
487
|
-
description?: string | undefined;
|
|
488
|
-
}[] | undefined;
|
|
489
|
-
hooks?: {
|
|
490
|
-
create?: Function | undefined;
|
|
491
|
-
update?: Function | undefined;
|
|
492
|
-
} | undefined;
|
|
493
|
-
typeName?: string | undefined;
|
|
494
|
-
};
|
|
495
|
-
fields: {
|
|
496
|
-
[x: string]: TailorFieldInput;
|
|
497
|
-
};
|
|
498
|
-
};
|
|
499
|
-
//#endregion
|
|
500
|
-
//#region src/configure/types/type.d.ts
|
|
501
|
-
type TailorAnyField = TailorField<any>;
|
|
502
|
-
type FieldParseArgs = {
|
|
503
|
-
value: unknown;
|
|
504
|
-
data: unknown;
|
|
505
|
-
user: TailorUser;
|
|
506
|
-
};
|
|
507
|
-
type FieldParseInternalArgs = {
|
|
508
|
-
value: any;
|
|
509
|
-
data: unknown;
|
|
510
|
-
user: TailorUser;
|
|
511
|
-
pathArray: string[];
|
|
512
|
-
};
|
|
558
|
+
//#region src/types/tailor-field.d.ts
|
|
513
559
|
/**
|
|
514
|
-
*
|
|
515
|
-
*
|
|
516
|
-
*
|
|
560
|
+
* Minimal structural interface for TailorField.
|
|
561
|
+
* Defines only the properties needed by parser, plugin, cli, and types layers.
|
|
562
|
+
* The full interface with builder methods (description, typeName, validate, parse)
|
|
563
|
+
* is defined in configure/types/type.ts.
|
|
517
564
|
*/
|
|
518
|
-
interface TailorField<Defined extends DefinedFieldMetadata = DefinedFieldMetadata, Output = any, M extends FieldMetadata = FieldMetadata, T extends TailorFieldType = TailorFieldType>
|
|
565
|
+
interface TailorField<Defined extends DefinedFieldMetadata = DefinedFieldMetadata, Output = any, M extends FieldMetadata = FieldMetadata, T extends TailorFieldType = TailorFieldType> {
|
|
519
566
|
readonly type: T;
|
|
520
567
|
readonly fields: Record<string, TailorAnyField>;
|
|
521
568
|
readonly _defined: Defined;
|
|
522
569
|
readonly _output: Output;
|
|
523
|
-
_metadata: M;
|
|
524
|
-
/** Returns a shallow copy of the metadata */
|
|
525
570
|
readonly metadata: M;
|
|
526
|
-
/**
|
|
527
|
-
* Set a description for the field
|
|
528
|
-
* @param description - The description text
|
|
529
|
-
* @returns The field with updated metadata
|
|
530
|
-
*/
|
|
531
|
-
description<CurrentDefined extends Defined>(this: CurrentDefined extends {
|
|
532
|
-
description: unknown;
|
|
533
|
-
} ? never : TailorField<CurrentDefined, Output>, description: string): TailorField<Prettify<CurrentDefined & {
|
|
534
|
-
description: true;
|
|
535
|
-
}>, Output>;
|
|
536
|
-
/**
|
|
537
|
-
* Set a custom type name for enum or nested types
|
|
538
|
-
* @param typeName - The custom type name
|
|
539
|
-
* @returns The field with updated metadata
|
|
540
|
-
*/
|
|
541
|
-
typeName<CurrentDefined extends Defined>(this: CurrentDefined extends {
|
|
542
|
-
typeName: unknown;
|
|
543
|
-
} ? never : CurrentDefined extends {
|
|
544
|
-
type: "enum" | "nested";
|
|
545
|
-
} ? TailorField<CurrentDefined, Output> : never, typeName: string): TailorField<Prettify<CurrentDefined & {
|
|
546
|
-
typeName: true;
|
|
547
|
-
}>, Output>;
|
|
548
|
-
/**
|
|
549
|
-
* Add validation functions to the field
|
|
550
|
-
* @param validate - One or more validation functions
|
|
551
|
-
* @returns The field with updated metadata
|
|
552
|
-
*/
|
|
553
|
-
validate<CurrentDefined extends Defined>(this: CurrentDefined extends {
|
|
554
|
-
validate: unknown;
|
|
555
|
-
} ? never : TailorField<CurrentDefined, Output>, ...validate: FieldValidateInput<Output>[]): TailorField<Prettify<CurrentDefined & {
|
|
556
|
-
validate: true;
|
|
557
|
-
}>, Output>;
|
|
558
|
-
/**
|
|
559
|
-
* Parse and validate a value against this field's validation rules
|
|
560
|
-
* Returns StandardSchema Result type with success or failure
|
|
561
|
-
* @param args - Value, context data, and user
|
|
562
|
-
* @returns Validation result
|
|
563
|
-
*/
|
|
564
|
-
parse(args: FieldParseArgs): StandardSchemaV1.Result<Output>;
|
|
565
|
-
/**
|
|
566
|
-
* Internal parse method that tracks field path for nested validation
|
|
567
|
-
* @private
|
|
568
|
-
* @param args - Parse arguments
|
|
569
|
-
* @returns Validation result
|
|
570
|
-
*/
|
|
571
|
-
_parseInternal(args: FieldParseInternalArgs): StandardSchemaV1.Result<Output>;
|
|
572
571
|
}
|
|
572
|
+
type TailorAnyField = TailorField<any>;
|
|
573
573
|
//#endregion
|
|
574
|
-
//#region src/
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
value: O;
|
|
580
|
-
data: D;
|
|
581
|
-
user: TailorUser;
|
|
582
|
-
}) => boolean;
|
|
583
|
-
/**
|
|
584
|
-
* Validation configuration with custom error message
|
|
585
|
-
*/
|
|
586
|
-
type ValidateConfig<O, D = unknown> = [ValidateFn<O, D>, string];
|
|
587
|
-
/**
|
|
588
|
-
* Field-level validation function
|
|
589
|
-
*/
|
|
590
|
-
type FieldValidateFn<O> = ValidateFn<O>;
|
|
591
|
-
/**
|
|
592
|
-
* Field-level validation configuration
|
|
593
|
-
*/
|
|
594
|
-
type FieldValidateConfig<O> = ValidateConfig<O>;
|
|
595
|
-
/**
|
|
596
|
-
* Input type for field validation - can be either a function or a tuple of [function, errorMessage]
|
|
597
|
-
*/
|
|
598
|
-
type FieldValidateInput<O> = FieldValidateFn<O> | FieldValidateConfig<O>;
|
|
599
|
-
/**
|
|
600
|
-
* Base validators type for field collections
|
|
601
|
-
* @template F - Record of fields
|
|
602
|
-
* @template ExcludeKeys - Keys to exclude from validation (default: "id" for TailorDB)
|
|
603
|
-
*/
|
|
604
|
-
type ValidatorsBase<F extends Record<string, {
|
|
605
|
-
_defined: any;
|
|
606
|
-
_output: any;
|
|
607
|
-
[key: string]: any;
|
|
608
|
-
}>, ExcludeKeys extends string = "id"> = NonEmptyObject<{ [K in Exclude<keyof F, ExcludeKeys> as F[K]["_defined"] extends {
|
|
609
|
-
validate: unknown;
|
|
610
|
-
} ? never : K]?: ValidateFn<output<F[K]>, InferFieldsOutput<F>> | ValidateConfig<output<F[K]>, InferFieldsOutput<F>> | (ValidateFn<output<F[K]>, InferFieldsOutput<F>> | ValidateConfig<output<F[K]>, InferFieldsOutput<F>>)[] }>;
|
|
611
|
-
/**
|
|
612
|
-
* Validators type (by default excludes "id" field for TailorDB compatibility)
|
|
613
|
-
* Can be used with both TailorField and TailorDBField
|
|
614
|
-
*/
|
|
615
|
-
type Validators<F extends Record<string, {
|
|
616
|
-
_defined: any;
|
|
617
|
-
_output: any;
|
|
618
|
-
[key: string]: any;
|
|
619
|
-
}>> = ValidatorsBase<F, "id">;
|
|
620
|
-
//#endregion
|
|
621
|
-
//#region src/configure/types/types.d.ts
|
|
622
|
-
type TailorFieldType = "uuid" | "string" | "boolean" | "integer" | "float" | "decimal" | "enum" | "date" | "datetime" | "time" | "nested";
|
|
623
|
-
type TailorToTs = {
|
|
624
|
-
string: string;
|
|
625
|
-
integer: number;
|
|
626
|
-
float: number;
|
|
627
|
-
decimal: string;
|
|
628
|
-
boolean: boolean;
|
|
629
|
-
uuid: string;
|
|
630
|
-
date: string;
|
|
631
|
-
datetime: string | Date;
|
|
632
|
-
time: string;
|
|
633
|
-
enum: string;
|
|
634
|
-
object: Record<string, unknown>;
|
|
635
|
-
nested: Record<string, unknown>;
|
|
636
|
-
} & Record<TailorFieldType, unknown>;
|
|
637
|
-
interface FieldMetadata {
|
|
638
|
-
description?: string;
|
|
639
|
-
required?: boolean;
|
|
640
|
-
array?: boolean;
|
|
641
|
-
allowedValues?: AllowedValue[];
|
|
642
|
-
validate?: FieldValidateInput<any>[];
|
|
643
|
-
typeName?: string;
|
|
644
|
-
}
|
|
645
|
-
interface DefinedFieldMetadata {
|
|
646
|
-
type: TailorFieldType;
|
|
647
|
-
array: boolean;
|
|
648
|
-
description?: boolean;
|
|
649
|
-
validate?: boolean;
|
|
650
|
-
typeName?: boolean;
|
|
651
|
-
}
|
|
652
|
-
type FieldOptions = {
|
|
653
|
-
optional?: boolean;
|
|
654
|
-
array?: boolean;
|
|
574
|
+
//#region src/types/auth.d.ts
|
|
575
|
+
type OAuth2ClientGrantType = OAuth2Client["grantTypes"][number];
|
|
576
|
+
type SCIMAttributeType = SCIMAttribute["type"];
|
|
577
|
+
type AuthInvokerWithName<M extends string> = Omit<AuthInvoker, "machineUserName"> & {
|
|
578
|
+
machineUserName: M;
|
|
655
579
|
};
|
|
656
|
-
|
|
657
|
-
type
|
|
658
|
-
|
|
580
|
+
/** Result of retrieving a connection token at runtime. */
|
|
581
|
+
type AuthConnectionTokenResult = {
|
|
582
|
+
access_token: string;
|
|
583
|
+
refresh_token?: string;
|
|
584
|
+
token_type?: string;
|
|
585
|
+
expiry?: string;
|
|
586
|
+
};
|
|
587
|
+
type ValueOperand = string | boolean | string[] | boolean[];
|
|
588
|
+
type AuthAttributeValue = ValueOperand | null | undefined;
|
|
589
|
+
type UserFieldKeys<User extends TailorDBInstance> = keyof output<User> & string;
|
|
590
|
+
type FieldDefined<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = User["fields"][Key] extends {
|
|
591
|
+
_defined: infer Defined;
|
|
592
|
+
} ? Defined : never;
|
|
593
|
+
type FieldOutput<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = output<User>[Key];
|
|
594
|
+
type FieldIsRequired<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = undefined extends FieldOutput<User, Key> ? false : true;
|
|
595
|
+
type FieldIsOfType<User extends TailorDBInstance, Key extends UserFieldKeys<User>, Type extends string> = FieldDefined<User, Key> extends {
|
|
596
|
+
type: Type;
|
|
597
|
+
} ? true : false;
|
|
598
|
+
type FieldIsArray<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldDefined<User, Key> extends {
|
|
659
599
|
array: true;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
600
|
+
} ? true : false;
|
|
601
|
+
type FieldIsUnique<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldDefined<User, Key> extends {
|
|
602
|
+
unique: true;
|
|
603
|
+
} ? true : false;
|
|
604
|
+
type FieldSupportsValueOperand<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldOutput<User, Key> extends ValueOperand | null | undefined ? true : false;
|
|
605
|
+
type UsernameFieldKey<User extends TailorDBInstance> = IsAny<User> extends true ? string : { [K in UserFieldKeys<User>]: FieldIsRequired<User, K> extends true ? FieldIsOfType<User, K, "string"> extends true ? FieldIsArray<User, K> extends true ? never : FieldIsUnique<User, K> extends true ? K : never : never : never }[UserFieldKeys<User>];
|
|
606
|
+
type UserAttributeKey<User extends TailorDBInstance> = { [K in UserFieldKeys<User>]: K extends "id" ? never : FieldSupportsValueOperand<User, K> extends true ? FieldIsOfType<User, K, "datetime" | "date" | "time"> extends true ? never : K : never }[UserFieldKeys<User>];
|
|
607
|
+
type UserAttributeListKey<User extends TailorDBInstance> = { [K in UserFieldKeys<User>]: K extends "id" ? never : FieldIsOfType<User, K, "uuid"> extends true ? FieldIsArray<User, K> extends true ? never : K : never }[UserFieldKeys<User>];
|
|
608
|
+
type UserAttributeMap<User extends TailorDBInstance> = { [K in UserAttributeKey<User>]?: true };
|
|
609
|
+
type DisallowExtraKeys<T, Allowed extends PropertyKey> = T & { [K in Exclude<keyof T, Allowed>]: never };
|
|
610
|
+
type AttributeListValue<User extends TailorDBInstance, Key extends UserAttributeListKey<User>> = Key extends keyof output<User> ? output<User>[Key] : never;
|
|
611
|
+
type AttributeListToTuple<User extends TailorDBInstance, AttributeList extends readonly UserAttributeListKey<User>[]> = { [Index in keyof AttributeList]: AttributeList[Index] extends UserAttributeListKey<User> ? AttributeListValue<User, AttributeList[Index]> : never };
|
|
612
|
+
type AttributeMapSelectedKeys<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>> = Extract<{ [K in keyof AttributeMap]-?: undefined extends AttributeMap[K] ? never : K }[keyof AttributeMap], UserAttributeKey<User>>;
|
|
613
|
+
type UserProfile<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[]> = {
|
|
614
|
+
/**
|
|
615
|
+
* TailorDB namespace where the user type is defined.
|
|
616
|
+
*
|
|
617
|
+
* Usually auto-resolved, so you don't need to specify this.
|
|
618
|
+
* Required only when multiple TailorDBs exist and the type is in an external TailorDB.
|
|
619
|
+
*/
|
|
620
|
+
namespace?: string;
|
|
621
|
+
type: User;
|
|
622
|
+
usernameField: UsernameFieldKey<User>;
|
|
623
|
+
attributes?: DisallowExtraKeys<AttributeMap, UserAttributeKey<User>>;
|
|
624
|
+
attributeList?: AttributeList;
|
|
684
625
|
};
|
|
685
|
-
type
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
626
|
+
type MachineUserAttributeFields = Record<string, TailorField<DefinedFieldMetadata, unknown, FieldMetadata, TailorFieldType>>;
|
|
627
|
+
type TailorFieldOutputValue<Field> = Field extends TailorField<DefinedFieldMetadata, infer Output, FieldMetadata, TailorFieldType> ? Output : never;
|
|
628
|
+
type MachineUserAttributeValues<Fields extends MachineUserAttributeFields> = { [K in keyof Fields]: TailorFieldOutputValue<Fields[K]> extends ValueOperand | null | undefined ? TailorFieldOutputValue<Fields[K]> : never };
|
|
629
|
+
type MachineUserFromAttributes<Fields extends MachineUserAttributeFields> = (keyof Fields extends never ? {
|
|
630
|
+
attributes?: never;
|
|
631
|
+
} : {
|
|
632
|
+
attributes: DisallowExtraKeys<MachineUserAttributeValues<Fields>, keyof Fields>;
|
|
633
|
+
}) & {
|
|
634
|
+
attributeList?: string[];
|
|
635
|
+
};
|
|
636
|
+
type MachineUser<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User> = UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[] = [], MachineUserAttributes extends MachineUserAttributeFields | undefined = undefined> = IsAny<MachineUserAttributes> extends true ? IsAny<User> extends true ? {
|
|
637
|
+
attributes: Record<string, AuthAttributeValue>;
|
|
638
|
+
attributeList?: string[];
|
|
639
|
+
} : (AttributeMapSelectedKeys<User, AttributeMap> extends never ? {
|
|
640
|
+
attributes?: never;
|
|
641
|
+
} : {
|
|
642
|
+
attributes: { [K in AttributeMapSelectedKeys<User, AttributeMap>]: K extends keyof output<User> ? output<User>[K] : never } & { [K in Exclude<keyof output<User>, AttributeMapSelectedKeys<User, AttributeMap>>]?: never };
|
|
643
|
+
}) & ([] extends AttributeList ? {
|
|
644
|
+
attributeList?: never;
|
|
645
|
+
} : {
|
|
646
|
+
attributeList: AttributeListToTuple<User, AttributeList>;
|
|
647
|
+
}) : [MachineUserAttributes] extends [MachineUserAttributeFields] ? MachineUserFromAttributes<MachineUserAttributes> : IsAny<User> extends true ? {
|
|
648
|
+
attributes: Record<string, AuthAttributeValue>;
|
|
649
|
+
attributeList?: string[];
|
|
650
|
+
} : (AttributeMapSelectedKeys<User, AttributeMap> extends never ? {
|
|
651
|
+
attributes?: never;
|
|
652
|
+
} : {
|
|
653
|
+
attributes: { [K in AttributeMapSelectedKeys<User, AttributeMap>]: K extends keyof output<User> ? output<User>[K] : never } & { [K in Exclude<keyof output<User>, AttributeMapSelectedKeys<User, AttributeMap>>]?: never };
|
|
654
|
+
}) & ([] extends AttributeList ? {
|
|
655
|
+
attributeList?: never;
|
|
656
|
+
} : {
|
|
657
|
+
attributeList: AttributeListToTuple<User, AttributeList>;
|
|
658
|
+
});
|
|
659
|
+
type BeforeLoginHookArgs = {
|
|
660
|
+
claims: JsonObject;
|
|
661
|
+
idpConfigName: string;
|
|
696
662
|
};
|
|
697
|
-
type
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
type HasAnyOperator = "hasAny" | "not hasAny";
|
|
701
|
-
type StringFieldKeys<User extends object> = { [K in keyof User]: User[K] extends string ? K : never }[keyof User];
|
|
702
|
-
type StringArrayFieldKeys<User extends object> = { [K in keyof User]: User[K] extends string[] ? K : never }[keyof User];
|
|
703
|
-
type BooleanFieldKeys<User extends object> = { [K in keyof User]: User[K] extends boolean ? K : never }[keyof User];
|
|
704
|
-
type BooleanArrayFieldKeys<User extends object> = { [K in keyof User]: User[K] extends boolean[] ? K : never }[keyof User];
|
|
705
|
-
type UserStringOperand<User extends object = InferredAttributeMap> = {
|
|
706
|
-
user: StringFieldKeys<User> | "id";
|
|
663
|
+
type BeforeLoginHook<MachineUserNames extends string> = {
|
|
664
|
+
handler(args: BeforeLoginHookArgs): Promise<void>;
|
|
665
|
+
invoker: NoInfer<MachineUserNames>;
|
|
707
666
|
};
|
|
708
|
-
type
|
|
709
|
-
|
|
667
|
+
type AuthHooks<MachineUserNames extends string> = {
|
|
668
|
+
beforeLogin?: BeforeLoginHook<MachineUserNames>;
|
|
710
669
|
};
|
|
711
|
-
type
|
|
712
|
-
|
|
670
|
+
type AuthServiceInput<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[], MachineUserNames extends string, MachineUserAttributes extends MachineUserAttributeFields | undefined = MachineUserAttributeFields | undefined, ConnectionNames extends string = string> = {
|
|
671
|
+
hooks?: AuthHooks<MachineUserNames>;
|
|
672
|
+
userProfile?: UserProfile<User, AttributeMap, AttributeList>;
|
|
673
|
+
machineUserAttributes?: MachineUserAttributes;
|
|
674
|
+
machineUsers?: Record<MachineUserNames, MachineUser<User, AttributeMap, AttributeList, MachineUserAttributes>>;
|
|
675
|
+
oauth2Clients?: Record<string, OAuth2ClientInput>;
|
|
676
|
+
idProvider?: IdProvider;
|
|
677
|
+
scim?: SCIMConfig;
|
|
678
|
+
tenantProvider?: TenantProvider;
|
|
679
|
+
connections?: Record<ConnectionNames, AuthConnectionConfig>;
|
|
680
|
+
publishSessionEvents?: boolean;
|
|
713
681
|
};
|
|
714
|
-
|
|
715
|
-
|
|
682
|
+
declare const authDefinitionBrand: unique symbol;
|
|
683
|
+
type AuthDefinitionBrand = {
|
|
684
|
+
readonly [authDefinitionBrand]: true;
|
|
716
685
|
};
|
|
717
|
-
type
|
|
718
|
-
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
686
|
+
type ConnectionNames<Config> = Config extends {
|
|
687
|
+
connections?: Record<infer K, unknown>;
|
|
688
|
+
} ? K & string : string;
|
|
689
|
+
type DefinedAuth<Name extends string, Config, MachineUserNames extends string> = Config & {
|
|
690
|
+
name: Name;
|
|
691
|
+
/**
|
|
692
|
+
* @deprecated Pass the machine user name directly as a string instead, e.g. `authInvoker: "machine-user-name"`.
|
|
693
|
+
* Using this function pulls config-layer (Node-only) dependencies into runtime bundles.
|
|
694
|
+
*/
|
|
695
|
+
invoker<M extends MachineUserNames>(machineUser: M): AuthInvokerWithName<M>;
|
|
696
|
+
getConnectionToken<C extends ConnectionNames<Config>>(connectionName: C): Promise<AuthConnectionTokenResult>;
|
|
697
|
+
} & AuthDefinitionBrand;
|
|
698
|
+
type AuthExternalConfig = {
|
|
699
|
+
name: string;
|
|
700
|
+
external: true;
|
|
723
701
|
};
|
|
724
|
-
type
|
|
725
|
-
type
|
|
726
|
-
type
|
|
727
|
-
type StringContainsCondition<Level extends "record" | "gql", User extends object, Update extends boolean, Type extends object> = readonly [string, ContainsOperator, string[]] | readonly [UserStringOperand<User>, ContainsOperator, string[]] | readonly [string, ContainsOperator, UserStringArrayOperand<User>] | (Level extends "record" ? readonly [RecordOperand$1<Type, Update>, ContainsOperator, string[] | UserStringArrayOperand<User>] | readonly [string | UserStringOperand<User>, ContainsOperator, RecordOperand$1<Type, Update>] : never);
|
|
728
|
-
type BooleanContainsCondition<Level extends "record" | "gql", User extends object, Update extends boolean, Type extends object> = (Level extends "gql" ? readonly [string, ContainsOperator, boolean[]] : never) | readonly [boolean, ContainsOperator, boolean[]] | readonly [UserBooleanOperand<User>, ContainsOperator, boolean[]] | readonly [boolean, ContainsOperator, UserBooleanArrayOperand<User>] | (Level extends "record" ? readonly [RecordOperand$1<Type, Update>, ContainsOperator, boolean[] | UserBooleanArrayOperand<User>] | readonly [boolean | UserBooleanOperand<User>, ContainsOperator, RecordOperand$1<Type, Update>] : never);
|
|
729
|
-
type ContainsCondition<Level extends "record" | "gql" = "record", User extends object = InferredAttributeMap, Update extends boolean = boolean, Type extends object = object> = StringContainsCondition<Level, User, Update, Type> | BooleanContainsCondition<Level, User, Update, Type>;
|
|
730
|
-
type HasAnyCondition<Level extends "record" | "gql", User extends object, Update extends boolean, Type extends object> = readonly [string[] | UserStringArrayOperand<User>, HasAnyOperator, string[] | UserStringArrayOperand<User>] | (Level extends "record" ? readonly [RecordOperand$1<Type, Update>, HasAnyOperator, string[] | UserStringArrayOperand<User>] | readonly [string[] | UserStringArrayOperand<User>, HasAnyOperator, RecordOperand$1<Type, Update>] : never);
|
|
731
|
-
/**
|
|
732
|
-
* Type representing a permission condition that combines user attributes, record fields, and literal values using comparison operators.
|
|
733
|
-
*
|
|
734
|
-
* The User type is extended by `tailor.d.ts`, which is automatically generated when running `tailor-sdk generate`.
|
|
735
|
-
* Attributes enabled in the config file's `auth.userProfile.attributes` (or
|
|
736
|
-
* `auth.machineUserAttributes` when userProfile is omitted) become available as types.
|
|
737
|
-
* @example
|
|
738
|
-
* ```ts
|
|
739
|
-
* // tailor.config.ts
|
|
740
|
-
* export const auth = defineAuth("my-auth", {
|
|
741
|
-
* userProfile: {
|
|
742
|
-
* type: user,
|
|
743
|
-
* attributes: {
|
|
744
|
-
* isAdmin: true,
|
|
745
|
-
* roles: true,
|
|
746
|
-
* }
|
|
747
|
-
* }
|
|
748
|
-
* });
|
|
749
|
-
* ```
|
|
750
|
-
*/
|
|
751
|
-
type PermissionCondition<Level extends "record" | "gql" = "record", User extends object = InferredAttributeMap, Update extends boolean = boolean, Type extends object = object> = EqualityCondition<Level, User, Update, Type> | ContainsCondition<Level, User, Update, Type> | HasAnyCondition<Level, User, Update, Type>;
|
|
752
|
-
/**
|
|
753
|
-
* Grants full record-level access without any conditions.
|
|
754
|
-
*
|
|
755
|
-
* Unsafe and intended only for local development, prototyping, or tests.
|
|
756
|
-
* Do not use this in production environments, as it effectively disables
|
|
757
|
-
* authorization checks.
|
|
758
|
-
*/
|
|
759
|
-
declare const unsafeAllowAllTypePermission: TailorTypePermission;
|
|
760
|
-
/**
|
|
761
|
-
* Grants full GraphQL access (all actions) without any conditions.
|
|
762
|
-
*
|
|
763
|
-
* Unsafe and intended only for local development, prototyping, or tests.
|
|
764
|
-
* Do not use this in production environments, as it effectively disables
|
|
765
|
-
* authorization checks.
|
|
766
|
-
*/
|
|
767
|
-
declare const unsafeAllowAllGqlPermission: TailorTypeGqlPermission;
|
|
702
|
+
type AuthServiceInputLoose = AuthServiceInput<any, any, any, string, any>;
|
|
703
|
+
type AuthOwnConfig = DefinedAuth<string, AuthServiceInputLoose, string>;
|
|
704
|
+
type AuthConfig = AuthOwnConfig | AuthExternalConfig;
|
|
768
705
|
//#endregion
|
|
769
706
|
//#region src/types/tailordb.generated.d.ts
|
|
770
707
|
/**
|
|
@@ -777,6 +714,33 @@ type GqlOperationsInput = "query" | {
|
|
|
777
714
|
delete?: boolean | undefined;
|
|
778
715
|
read?: boolean | undefined;
|
|
779
716
|
};
|
|
717
|
+
type DBFieldMetadata$1 = {
|
|
718
|
+
/** Whether the field is required */required?: boolean | undefined; /** Whether the field is an array */
|
|
719
|
+
array?: boolean | undefined; /** Field description */
|
|
720
|
+
description?: string | undefined; /** Type name for nested or enum fields */
|
|
721
|
+
typeName?: string | undefined; /** Allowed values for enum fields */
|
|
722
|
+
allowedValues?: {
|
|
723
|
+
value: string; /** Field description */
|
|
724
|
+
description?: string | undefined;
|
|
725
|
+
}[] | undefined; /** Whether the field is indexed for faster queries */
|
|
726
|
+
index?: boolean | undefined; /** Whether the field value must be unique */
|
|
727
|
+
unique?: boolean | undefined; /** Whether the field is a vector field for similarity search */
|
|
728
|
+
vector?: boolean | undefined; /** Whether the field is a foreign key */
|
|
729
|
+
foreignKey?: boolean | undefined; /** Target type name for foreign key relations */
|
|
730
|
+
foreignKeyType?: string | undefined; /** Target field name for foreign key relations */
|
|
731
|
+
foreignKeyField?: string | undefined; /** Lifecycle hooks for the field */
|
|
732
|
+
hooks?: {
|
|
733
|
+
create?: Function | undefined;
|
|
734
|
+
update?: Function | undefined;
|
|
735
|
+
} | undefined; /** Validation functions for the field */
|
|
736
|
+
validate?: (Function | [Function, string])[] | undefined; /** Serial (auto-increment) configuration */
|
|
737
|
+
serial?: {
|
|
738
|
+
start: number;
|
|
739
|
+
maxValue?: number | undefined;
|
|
740
|
+
format?: string | undefined;
|
|
741
|
+
} | undefined; /** Decimal scale (number of digits after decimal point, 0-12) */
|
|
742
|
+
scale?: number | undefined;
|
|
743
|
+
};
|
|
780
744
|
type TailorDBTypeParsedSettings = {
|
|
781
745
|
/** Custom plural form of the type name for GraphQL */pluralForm?: string | undefined; /** Enable aggregation queries for this type */
|
|
782
746
|
aggregation?: boolean | undefined; /** Enable bulk upsert mutation for this type */
|
|
@@ -798,7 +762,7 @@ type TailorDBTypeParsedSettings = {
|
|
|
798
762
|
};
|
|
799
763
|
type RawPermissions = {
|
|
800
764
|
record?: {
|
|
801
|
-
create: readonly (readonly (string | boolean | string[] | boolean[] | {
|
|
765
|
+
create: readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
802
766
|
user: string;
|
|
803
767
|
} | {
|
|
804
768
|
record: string;
|
|
@@ -806,7 +770,7 @@ type RawPermissions = {
|
|
|
806
770
|
oldRecord: string;
|
|
807
771
|
} | {
|
|
808
772
|
newRecord: string;
|
|
809
|
-
})
|
|
773
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
810
774
|
user: string;
|
|
811
775
|
} | {
|
|
812
776
|
record: string;
|
|
@@ -814,28 +778,7 @@ type RawPermissions = {
|
|
|
814
778
|
oldRecord: string;
|
|
815
779
|
} | {
|
|
816
780
|
newRecord: string;
|
|
817
|
-
})[]
|
|
818
|
-
conditions: readonly (string | boolean | string[] | boolean[] | {
|
|
819
|
-
user: string;
|
|
820
|
-
} | {
|
|
821
|
-
record: string;
|
|
822
|
-
} | {
|
|
823
|
-
oldRecord: string;
|
|
824
|
-
} | {
|
|
825
|
-
newRecord: string;
|
|
826
|
-
})[] | readonly (readonly (string | boolean | string[] | boolean[] | {
|
|
827
|
-
user: string;
|
|
828
|
-
} | {
|
|
829
|
-
record: string;
|
|
830
|
-
} | {
|
|
831
|
-
oldRecord: string;
|
|
832
|
-
} | {
|
|
833
|
-
newRecord: string;
|
|
834
|
-
})[])[];
|
|
835
|
-
description?: string | undefined;
|
|
836
|
-
permit?: boolean | undefined;
|
|
837
|
-
})[];
|
|
838
|
-
read: readonly (readonly (string | boolean | string[] | boolean[] | {
|
|
781
|
+
})] | readonly [(string | boolean | string[] | boolean[] | {
|
|
839
782
|
user: string;
|
|
840
783
|
} | {
|
|
841
784
|
record: string;
|
|
@@ -843,7 +786,7 @@ type RawPermissions = {
|
|
|
843
786
|
oldRecord: string;
|
|
844
787
|
} | {
|
|
845
788
|
newRecord: string;
|
|
846
|
-
})
|
|
789
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
847
790
|
user: string;
|
|
848
791
|
} | {
|
|
849
792
|
record: string;
|
|
@@ -851,28 +794,7 @@ type RawPermissions = {
|
|
|
851
794
|
oldRecord: string;
|
|
852
795
|
} | {
|
|
853
796
|
newRecord: string;
|
|
854
|
-
})[]
|
|
855
|
-
conditions: readonly (string | boolean | string[] | boolean[] | {
|
|
856
|
-
user: string;
|
|
857
|
-
} | {
|
|
858
|
-
record: string;
|
|
859
|
-
} | {
|
|
860
|
-
oldRecord: string;
|
|
861
|
-
} | {
|
|
862
|
-
newRecord: string;
|
|
863
|
-
})[] | readonly (readonly (string | boolean | string[] | boolean[] | {
|
|
864
|
-
user: string;
|
|
865
|
-
} | {
|
|
866
|
-
record: string;
|
|
867
|
-
} | {
|
|
868
|
-
oldRecord: string;
|
|
869
|
-
} | {
|
|
870
|
-
newRecord: string;
|
|
871
|
-
})[])[];
|
|
872
|
-
description?: string | undefined;
|
|
873
|
-
permit?: boolean | undefined;
|
|
874
|
-
})[];
|
|
875
|
-
update: readonly (readonly (string | boolean | string[] | boolean[] | {
|
|
797
|
+
}), boolean] | readonly (boolean | readonly [(string | boolean | string[] | boolean[] | {
|
|
876
798
|
user: string;
|
|
877
799
|
} | {
|
|
878
800
|
record: string;
|
|
@@ -880,7 +802,7 @@ type RawPermissions = {
|
|
|
880
802
|
oldRecord: string;
|
|
881
803
|
} | {
|
|
882
804
|
newRecord: string;
|
|
883
|
-
})
|
|
805
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
884
806
|
user: string;
|
|
885
807
|
} | {
|
|
886
808
|
record: string;
|
|
@@ -888,8 +810,8 @@ type RawPermissions = {
|
|
|
888
810
|
oldRecord: string;
|
|
889
811
|
} | {
|
|
890
812
|
newRecord: string;
|
|
891
|
-
})
|
|
892
|
-
conditions: readonly (string | boolean | string[] | boolean[] | {
|
|
813
|
+
})])[] | {
|
|
814
|
+
conditions: readonly [(string | boolean | string[] | boolean[] | {
|
|
893
815
|
user: string;
|
|
894
816
|
} | {
|
|
895
817
|
record: string;
|
|
@@ -897,7 +819,7 @@ type RawPermissions = {
|
|
|
897
819
|
oldRecord: string;
|
|
898
820
|
} | {
|
|
899
821
|
newRecord: string;
|
|
900
|
-
})
|
|
822
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
901
823
|
user: string;
|
|
902
824
|
} | {
|
|
903
825
|
record: string;
|
|
@@ -905,28 +827,7 @@ type RawPermissions = {
|
|
|
905
827
|
oldRecord: string;
|
|
906
828
|
} | {
|
|
907
829
|
newRecord: string;
|
|
908
|
-
})[]
|
|
909
|
-
description?: string | undefined;
|
|
910
|
-
permit?: boolean | undefined;
|
|
911
|
-
})[];
|
|
912
|
-
delete: readonly (readonly (string | boolean | string[] | boolean[] | {
|
|
913
|
-
user: string;
|
|
914
|
-
} | {
|
|
915
|
-
record: string;
|
|
916
|
-
} | {
|
|
917
|
-
oldRecord: string;
|
|
918
|
-
} | {
|
|
919
|
-
newRecord: string;
|
|
920
|
-
})[] | readonly (boolean | readonly (string | boolean | string[] | boolean[] | {
|
|
921
|
-
user: string;
|
|
922
|
-
} | {
|
|
923
|
-
record: string;
|
|
924
|
-
} | {
|
|
925
|
-
oldRecord: string;
|
|
926
|
-
} | {
|
|
927
|
-
newRecord: string;
|
|
928
|
-
})[])[] | {
|
|
929
|
-
conditions: readonly (string | boolean | string[] | boolean[] | {
|
|
830
|
+
})] | readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
930
831
|
user: string;
|
|
931
832
|
} | {
|
|
932
833
|
record: string;
|
|
@@ -934,7 +835,7 @@ type RawPermissions = {
|
|
|
934
835
|
oldRecord: string;
|
|
935
836
|
} | {
|
|
936
837
|
newRecord: string;
|
|
937
|
-
})
|
|
838
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
938
839
|
user: string;
|
|
939
840
|
} | {
|
|
940
841
|
record: string;
|
|
@@ -942,752 +843,335 @@ type RawPermissions = {
|
|
|
942
843
|
oldRecord: string;
|
|
943
844
|
} | {
|
|
944
845
|
newRecord: string;
|
|
945
|
-
})
|
|
846
|
+
})])[];
|
|
946
847
|
description?: string | undefined;
|
|
947
848
|
permit?: boolean | undefined;
|
|
948
849
|
})[];
|
|
949
|
-
|
|
950
|
-
gql?: readonly {
|
|
951
|
-
conditions: readonly (readonly (string | boolean | string[] | boolean[] | {
|
|
850
|
+
read: readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
952
851
|
user: string;
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
}
|
|
980
|
-
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
})
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
};
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
};
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
/**
|
|
1219
|
-
* Create a UUID field.
|
|
1220
|
-
* @param options - Field configuration options
|
|
1221
|
-
* @returns A UUID field
|
|
1222
|
-
* @example db.uuid()
|
|
1223
|
-
* @example db.uuid({ optional: true })
|
|
1224
|
-
*/
|
|
1225
|
-
declare function uuid<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
1226
|
-
type: "uuid";
|
|
1227
|
-
array: Opt extends {
|
|
1228
|
-
array: true;
|
|
1229
|
-
} ? true : false;
|
|
1230
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
1231
|
-
/**
|
|
1232
|
-
* Create a string field.
|
|
1233
|
-
* @param options - Field configuration options
|
|
1234
|
-
* @returns A string field
|
|
1235
|
-
* @example db.string()
|
|
1236
|
-
* @example db.string({ optional: true })
|
|
1237
|
-
*/
|
|
1238
|
-
declare function string<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
1239
|
-
type: "string";
|
|
1240
|
-
array: Opt extends {
|
|
1241
|
-
array: true;
|
|
1242
|
-
} ? true : false;
|
|
1243
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
1244
|
-
/**
|
|
1245
|
-
* Create a boolean field.
|
|
1246
|
-
* Note: The method name is `bool` but creates a `boolean` type field.
|
|
1247
|
-
* @param options - Field configuration options
|
|
1248
|
-
* @returns A boolean field
|
|
1249
|
-
* @example db.bool()
|
|
1250
|
-
* @example db.bool({ optional: true })
|
|
1251
|
-
*/
|
|
1252
|
-
declare function bool<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
1253
|
-
type: "boolean";
|
|
1254
|
-
array: Opt extends {
|
|
1255
|
-
array: true;
|
|
1256
|
-
} ? true : false;
|
|
1257
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<boolean, Opt> | null : ArrayFieldOutput<boolean, Opt>>;
|
|
1258
|
-
/**
|
|
1259
|
-
* Create an integer field.
|
|
1260
|
-
* @param options - Field configuration options
|
|
1261
|
-
* @returns An integer field
|
|
1262
|
-
* @example db.int()
|
|
1263
|
-
* @example db.int({ optional: true })
|
|
1264
|
-
*/
|
|
1265
|
-
declare function int<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
1266
|
-
type: "integer";
|
|
1267
|
-
array: Opt extends {
|
|
1268
|
-
array: true;
|
|
1269
|
-
} ? true : false;
|
|
1270
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
|
|
1271
|
-
/**
|
|
1272
|
-
* Create a float (decimal number) field.
|
|
1273
|
-
* @param options - Field configuration options
|
|
1274
|
-
* @returns A float field
|
|
1275
|
-
* @example db.float()
|
|
1276
|
-
* @example db.float({ optional: true })
|
|
1277
|
-
*/
|
|
1278
|
-
declare function float<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
1279
|
-
type: "float";
|
|
1280
|
-
array: Opt extends {
|
|
1281
|
-
array: true;
|
|
1282
|
-
} ? true : false;
|
|
1283
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
|
|
1284
|
-
interface DecimalFieldOptions extends FieldOptions {
|
|
1285
|
-
scale?: number;
|
|
1286
|
-
}
|
|
1287
|
-
/**
|
|
1288
|
-
* Create a decimal field (stored as string for precision).
|
|
1289
|
-
* @param options - Field configuration options including optional scale (0-12)
|
|
1290
|
-
* @returns A decimal field
|
|
1291
|
-
* @example db.decimal()
|
|
1292
|
-
* @example db.decimal({ scale: 2 })
|
|
1293
|
-
* @example db.decimal({ scale: 2, optional: true })
|
|
1294
|
-
*/
|
|
1295
|
-
declare function decimal<const Opt extends DecimalFieldOptions>(options?: Opt): TailorDBField<{
|
|
1296
|
-
type: "decimal";
|
|
1297
|
-
array: Opt extends {
|
|
1298
|
-
array: true;
|
|
1299
|
-
} ? true : false;
|
|
1300
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
1301
|
-
/**
|
|
1302
|
-
* Create a date field (date only, no time component).
|
|
1303
|
-
* Format: "yyyy-MM-dd"
|
|
1304
|
-
* @param options - Field configuration options
|
|
1305
|
-
* @returns A date field
|
|
1306
|
-
* @example db.date()
|
|
1307
|
-
*/
|
|
1308
|
-
declare function date<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
1309
|
-
type: "date";
|
|
1310
|
-
array: Opt extends {
|
|
1311
|
-
array: true;
|
|
1312
|
-
} ? true : false;
|
|
1313
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
1314
|
-
/**
|
|
1315
|
-
* Create a datetime field (date and time).
|
|
1316
|
-
* Format: ISO 8601 "yyyy-MM-ddTHH:mm:ssZ"
|
|
1317
|
-
* @param options - Field configuration options
|
|
1318
|
-
* @returns A datetime field
|
|
1319
|
-
* @example db.datetime()
|
|
1320
|
-
*/
|
|
1321
|
-
declare function datetime<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
1322
|
-
type: "datetime";
|
|
1323
|
-
array: Opt extends {
|
|
1324
|
-
array: true;
|
|
1325
|
-
} ? true : false;
|
|
1326
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<string | Date, Opt> | null : ArrayFieldOutput<string | Date, Opt>>;
|
|
1327
|
-
/**
|
|
1328
|
-
* Create a time field (time only, no date component).
|
|
1329
|
-
* Format: "HH:mm"
|
|
1330
|
-
* @param options - Field configuration options
|
|
1331
|
-
* @returns A time field
|
|
1332
|
-
* @example db.time()
|
|
1333
|
-
*/
|
|
1334
|
-
declare function time<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
1335
|
-
type: "time";
|
|
1336
|
-
array: Opt extends {
|
|
1337
|
-
array: true;
|
|
1338
|
-
} ? true : false;
|
|
1339
|
-
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
1340
|
-
/**
|
|
1341
|
-
* Create an enum field with a fixed set of allowed string values.
|
|
1342
|
-
* @param values - Array of allowed string values, or array of `{ value, description }` objects
|
|
1343
|
-
* @param options - Field configuration options
|
|
1344
|
-
* @returns An enum field
|
|
1345
|
-
* @example db.enum(["active", "inactive", "suspended"])
|
|
1346
|
-
* @example db.enum(["small", "medium", "large"], { optional: true })
|
|
1347
|
-
*/
|
|
1348
|
-
declare function _enum<const V extends AllowedValues, const Opt extends FieldOptions>(values: V, options?: Opt): TailorDBField<{
|
|
1349
|
-
type: "enum";
|
|
1350
|
-
array: Opt extends {
|
|
1351
|
-
array: true;
|
|
1352
|
-
} ? true : false;
|
|
1353
|
-
}, FieldOutput$1<AllowedValuesOutput<V>, Opt>>;
|
|
1354
|
-
/**
|
|
1355
|
-
* Create a nested object field with sub-fields.
|
|
1356
|
-
* @param fields - Record of nested field definitions
|
|
1357
|
-
* @param options - Field configuration options
|
|
1358
|
-
* @returns A nested object field
|
|
1359
|
-
* @example db.object({ street: db.string(), city: db.string(), zip: db.string() })
|
|
1360
|
-
* @example db.object({ name: db.string() }, { optional: true })
|
|
1361
|
-
*/
|
|
1362
|
-
declare function object<const F extends Record<string, TailorAnyDBField> & ExcludeNestedDBFields<F>, const Opt extends FieldOptions>(fields: F, options?: Opt): TailorDBField<{
|
|
1363
|
-
type: "nested";
|
|
1364
|
-
array: Opt extends {
|
|
1365
|
-
array: true;
|
|
1366
|
-
} ? true : false;
|
|
1367
|
-
}, FieldOutput$1<InferFieldsOutput<F>, Opt>>;
|
|
1368
|
-
/**
|
|
1369
|
-
* TailorDBType interface representing a database type definition with fields, permissions, and settings.
|
|
1370
|
-
*/
|
|
1371
|
-
interface TailorDBType$1<Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> {
|
|
1372
|
-
readonly name: string;
|
|
1373
|
-
readonly fields: Fields;
|
|
1374
|
-
readonly _output: InferFieldsOutput<Fields>;
|
|
1375
|
-
_description?: string;
|
|
1376
|
-
/** Returns metadata for the type */
|
|
1377
|
-
readonly metadata: TailorDBTypeMetadata;
|
|
1378
|
-
/**
|
|
1379
|
-
* Add hooks for fields at the type level.
|
|
1380
|
-
* Each key is a field name, and the value defines create/update hooks.
|
|
1381
|
-
* @example
|
|
1382
|
-
* db.type("Order", {
|
|
1383
|
-
* total: db.float(),
|
|
1384
|
-
* tax: db.float(),
|
|
1385
|
-
* ...db.fields.timestamps(),
|
|
1386
|
-
* }).hooks({
|
|
1387
|
-
* tax: { create: ({ data }) => data.total * 0.1, update: ({ data }) => data.total * 0.1 },
|
|
1388
|
-
* })
|
|
1389
|
-
*/
|
|
1390
|
-
hooks(hooks: Hooks<Fields>): TailorDBType$1<Fields, User>;
|
|
1391
|
-
/**
|
|
1392
|
-
* Add validators for fields at the type level.
|
|
1393
|
-
* Each key is a field name, and the value is a validator or array of validators.
|
|
1394
|
-
* Prefer the tuple form [function, message] for diagnosable errors.
|
|
1395
|
-
* @example
|
|
1396
|
-
* db.type("User", { email: db.string() }).validate({
|
|
1397
|
-
* email: [({ value }) => value.includes("@"), "Email must contain @"],
|
|
1398
|
-
* })
|
|
1399
|
-
*/
|
|
1400
|
-
validate(validators: Validators<Fields>): TailorDBType$1<Fields, User>;
|
|
1401
|
-
/**
|
|
1402
|
-
* Configure type features
|
|
1403
|
-
*/
|
|
1404
|
-
features(features: Omit<TypeFeatures, "pluralForm">): TailorDBType$1<Fields, User>;
|
|
1405
|
-
/**
|
|
1406
|
-
* Define composite indexes
|
|
1407
|
-
*/
|
|
1408
|
-
indexes(...indexes: IndexDef<TailorDBType$1<Fields, User>>[]): TailorDBType$1<Fields, User>;
|
|
1409
|
-
/**
|
|
1410
|
-
* Define file fields
|
|
1411
|
-
*/
|
|
1412
|
-
files<const F extends string>(files: Record<F, string> & Partial<Record<keyof output<TailorDBType$1<Fields, User>>, never>>): TailorDBType$1<Fields, User>;
|
|
1413
|
-
/**
|
|
1414
|
-
* Set record-level permissions for create, read, update, and delete operations.
|
|
1415
|
-
* Prefer object format with explicit `conditions` and `permit` for readability.
|
|
1416
|
-
* For update operations, use `newRecord` and `oldRecord` operands.
|
|
1417
|
-
* @example
|
|
1418
|
-
* .permission({
|
|
1419
|
-
* create: [{ conditions: [[{ user: "_loggedIn" }, "=", true]], permit: true }],
|
|
1420
|
-
* read: [{ conditions: [[{ record: "isPublic" }, "=", true]], permit: true }],
|
|
1421
|
-
* update: [{ conditions: [[{ newRecord: "ownerId" }, "=", { user: "id" }]], permit: true }],
|
|
1422
|
-
* delete: [{ conditions: [[{ record: "ownerId" }, "=", { user: "id" }]], permit: true }],
|
|
1423
|
-
* })
|
|
1424
|
-
*/
|
|
1425
|
-
permission<U extends object = User, P extends TailorTypePermission<U, output<TailorDBType$1<Fields, User>>> = TailorTypePermission<U, output<TailorDBType$1<Fields, User>>>>(permission: P): TailorDBType$1<Fields, U>;
|
|
1426
|
-
/**
|
|
1427
|
-
* Set GraphQL-level permissions controlling access to GraphQL operations.
|
|
1428
|
-
* @example
|
|
1429
|
-
* .gqlPermission([
|
|
1430
|
-
* {
|
|
1431
|
-
* conditions: [[{ user: "_loggedIn" }, "=", true]],
|
|
1432
|
-
* actions: "all",
|
|
1433
|
-
* permit: true,
|
|
1434
|
-
* },
|
|
1435
|
-
* ])
|
|
1436
|
-
*/
|
|
1437
|
-
gqlPermission<U extends object = User, P extends TailorTypeGqlPermission<U> = TailorTypeGqlPermission<U>>(permission: P): TailorDBType$1<Fields, U>;
|
|
1438
|
-
/**
|
|
1439
|
-
* Set type description
|
|
1440
|
-
*/
|
|
1441
|
-
description(description: string): TailorDBType$1<Fields, User>;
|
|
1442
|
-
/**
|
|
1443
|
-
* Pick specific fields from the type
|
|
1444
|
-
*/
|
|
1445
|
-
pickFields<K extends keyof Fields>(keys: K[]): Pick<Fields, K>;
|
|
1446
|
-
pickFields<K extends keyof Fields, const Opt extends FieldOptions>(keys: K[], options: Opt): { [P in K]: Fields[P] extends TailorDBField<infer D, infer _O> ? TailorDBField<Omit<D, "array"> & {
|
|
1447
|
-
array: Opt extends {
|
|
1448
|
-
array: true;
|
|
1449
|
-
} ? true : D["array"];
|
|
1450
|
-
}, FieldOutput$1<TailorToTs[D["type"]], Opt>> : never };
|
|
1451
|
-
/**
|
|
1452
|
-
* Omit specific fields from the type
|
|
1453
|
-
*/
|
|
1454
|
-
omitFields<K extends keyof Fields>(keys: K[]): Omit<Fields, K>;
|
|
1455
|
-
/**
|
|
1456
|
-
* Plugin attachments for this type
|
|
1457
|
-
*/
|
|
1458
|
-
readonly plugins: PluginAttachment[];
|
|
1459
|
-
/**
|
|
1460
|
-
* Attach a plugin to this type
|
|
1461
|
-
* @param config - Plugin configuration in the format { pluginId: config }
|
|
1462
|
-
* @returns The type with the plugin attached
|
|
1463
|
-
*/
|
|
1464
|
-
plugin<P extends keyof PluginConfigs<keyof Fields & string>>(config: { [K in P]: PluginConfigs<keyof Fields & string>[K] }): TailorDBType$1<Fields, User>;
|
|
1465
|
-
}
|
|
1466
|
-
type TailorDBInstance<Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> = TailorDBType$1<Fields, User>;
|
|
1467
|
-
declare const idField: TailorDBField<{
|
|
1468
|
-
type: "uuid";
|
|
1469
|
-
array: false;
|
|
1470
|
-
}, string>;
|
|
1471
|
-
type idField = typeof idField;
|
|
1472
|
-
type DBType<F extends {
|
|
1473
|
-
id?: never;
|
|
1474
|
-
} & Record<string, TailorAnyDBField>> = TailorDBInstance<{
|
|
1475
|
-
id: idField;
|
|
1476
|
-
} & F>;
|
|
1477
|
-
/**
|
|
1478
|
-
* Creates a new database type with the specified fields.
|
|
1479
|
-
* An `id` field (UUID) is automatically added to every type.
|
|
1480
|
-
* @param name - The name of the type, or a tuple of [name, pluralForm]
|
|
1481
|
-
* @param fields - The field definitions for the type
|
|
1482
|
-
* @returns A new TailorDBType instance
|
|
1483
|
-
* @example
|
|
1484
|
-
* export const user = db.type("User", {
|
|
1485
|
-
* name: db.string(),
|
|
1486
|
-
* email: db.string(),
|
|
1487
|
-
* age: db.int({ optional: true }),
|
|
1488
|
-
* role: db.enum(["admin", "member"]),
|
|
1489
|
-
* ...db.fields.timestamps(),
|
|
1490
|
-
* });
|
|
1491
|
-
* // Always export both the value and type:
|
|
1492
|
-
* export type user = typeof user;
|
|
1493
|
-
*/
|
|
1494
|
-
declare function dbType<const F extends {
|
|
1495
|
-
id?: never;
|
|
1496
|
-
} & Record<string, TailorAnyDBField>>(name: string | [string, string], fields: F): DBType<F>;
|
|
1497
|
-
/**
|
|
1498
|
-
* Creates a new database type with the specified fields and description.
|
|
1499
|
-
* An `id` field (UUID) is automatically added to every type.
|
|
1500
|
-
* @param name - The name of the type, or a tuple of [name, pluralForm]
|
|
1501
|
-
* @param description - A description of the type
|
|
1502
|
-
* @param fields - The field definitions for the type
|
|
1503
|
-
* @returns A new TailorDBType instance
|
|
1504
|
-
*/
|
|
1505
|
-
declare function dbType<const F extends {
|
|
1506
|
-
id?: never;
|
|
1507
|
-
} & Record<string, TailorAnyDBField>>(name: string | [string, string], description: string, fields: F): DBType<F>;
|
|
1508
|
-
/** TailorDB schema builder utilities for defining types and fields. */
|
|
1509
|
-
declare const db: {
|
|
1510
|
-
type: typeof dbType;
|
|
1511
|
-
uuid: typeof uuid;
|
|
1512
|
-
string: typeof string;
|
|
1513
|
-
bool: typeof bool;
|
|
1514
|
-
int: typeof int;
|
|
1515
|
-
float: typeof float;
|
|
1516
|
-
decimal: typeof decimal;
|
|
1517
|
-
date: typeof date;
|
|
1518
|
-
datetime: typeof datetime;
|
|
1519
|
-
time: typeof time;
|
|
1520
|
-
enum: typeof _enum;
|
|
1521
|
-
object: typeof object;
|
|
1522
|
-
fields: {
|
|
1523
|
-
/**
|
|
1524
|
-
* Creates standard timestamp fields (createdAt, updatedAt) with auto-hooks.
|
|
1525
|
-
* createdAt is set on create, updatedAt is set on update.
|
|
1526
|
-
* @returns An object with createdAt and updatedAt fields
|
|
1527
|
-
* @example
|
|
1528
|
-
* const model = db.type("Model", {
|
|
1529
|
-
* name: db.string(),
|
|
1530
|
-
* ...db.fields.timestamps(),
|
|
1531
|
-
* });
|
|
1532
|
-
*/
|
|
1533
|
-
timestamps: () => {
|
|
1534
|
-
createdAt: TailorDBField<{
|
|
1535
|
-
type: "datetime";
|
|
1536
|
-
array: false;
|
|
1537
|
-
hooks?: {
|
|
1538
|
-
create: true;
|
|
1539
|
-
update: false;
|
|
1540
|
-
} | undefined;
|
|
1541
|
-
serial: false;
|
|
1542
|
-
description: true;
|
|
1543
|
-
}, string | Date>;
|
|
1544
|
-
updatedAt: TailorDBField<{
|
|
1545
|
-
type: "datetime";
|
|
1546
|
-
array: false;
|
|
1547
|
-
hooks?: {
|
|
1548
|
-
create: false;
|
|
1549
|
-
update: true;
|
|
1550
|
-
} | undefined;
|
|
1551
|
-
serial: false;
|
|
1552
|
-
description: true;
|
|
1553
|
-
}, string | Date | null>;
|
|
1554
|
-
};
|
|
1555
|
-
};
|
|
1556
|
-
};
|
|
1557
|
-
//#endregion
|
|
1558
|
-
//#region src/types/auth.d.ts
|
|
1559
|
-
type OAuth2ClientGrantType = OAuth2Client["grantTypes"][number];
|
|
1560
|
-
type SCIMAttributeType = SCIMAttribute["type"];
|
|
1561
|
-
type AuthInvokerWithName<M extends string> = Omit<AuthInvoker, "machineUserName"> & {
|
|
1562
|
-
machineUserName: M;
|
|
1563
|
-
};
|
|
1564
|
-
/** Result of retrieving a connection token at runtime. */
|
|
1565
|
-
type AuthConnectionTokenResult = {
|
|
1566
|
-
access_token: string;
|
|
1567
|
-
refresh_token?: string;
|
|
1568
|
-
token_type?: string;
|
|
1569
|
-
expiry?: string;
|
|
1570
|
-
};
|
|
1571
|
-
type ValueOperand = string | boolean | string[] | boolean[];
|
|
1572
|
-
type AuthAttributeValue = ValueOperand | null | undefined;
|
|
1573
|
-
type UserFieldKeys<User extends TailorDBInstance> = keyof output<User> & string;
|
|
1574
|
-
type FieldDefined<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = User["fields"][Key] extends {
|
|
1575
|
-
_defined: infer Defined;
|
|
1576
|
-
} ? Defined : never;
|
|
1577
|
-
type FieldOutput<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = output<User>[Key];
|
|
1578
|
-
type FieldIsRequired<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = undefined extends FieldOutput<User, Key> ? false : true;
|
|
1579
|
-
type FieldIsOfType<User extends TailorDBInstance, Key extends UserFieldKeys<User>, Type extends string> = FieldDefined<User, Key> extends {
|
|
1580
|
-
type: Type;
|
|
1581
|
-
} ? true : false;
|
|
1582
|
-
type FieldIsArray<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldDefined<User, Key> extends {
|
|
1583
|
-
array: true;
|
|
1584
|
-
} ? true : false;
|
|
1585
|
-
type FieldIsUnique<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldDefined<User, Key> extends {
|
|
1586
|
-
unique: true;
|
|
1587
|
-
} ? true : false;
|
|
1588
|
-
type FieldSupportsValueOperand<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldOutput<User, Key> extends ValueOperand | null | undefined ? true : false;
|
|
1589
|
-
type UsernameFieldKey<User extends TailorDBInstance> = IsAny<User> extends true ? string : { [K in UserFieldKeys<User>]: FieldIsRequired<User, K> extends true ? FieldIsOfType<User, K, "string"> extends true ? FieldIsArray<User, K> extends true ? never : FieldIsUnique<User, K> extends true ? K : never : never : never }[UserFieldKeys<User>];
|
|
1590
|
-
type UserAttributeKey<User extends TailorDBInstance> = { [K in UserFieldKeys<User>]: K extends "id" ? never : FieldSupportsValueOperand<User, K> extends true ? FieldIsOfType<User, K, "datetime" | "date" | "time"> extends true ? never : K : never }[UserFieldKeys<User>];
|
|
1591
|
-
type UserAttributeListKey<User extends TailorDBInstance> = { [K in UserFieldKeys<User>]: K extends "id" ? never : FieldIsOfType<User, K, "uuid"> extends true ? FieldIsArray<User, K> extends true ? never : K : never }[UserFieldKeys<User>];
|
|
1592
|
-
type UserAttributeMap<User extends TailorDBInstance> = { [K in UserAttributeKey<User>]?: true };
|
|
1593
|
-
type DisallowExtraKeys<T, Allowed extends PropertyKey> = T & { [K in Exclude<keyof T, Allowed>]: never };
|
|
1594
|
-
type AttributeListValue<User extends TailorDBInstance, Key extends UserAttributeListKey<User>> = Key extends keyof output<User> ? output<User>[Key] : never;
|
|
1595
|
-
type AttributeListToTuple<User extends TailorDBInstance, AttributeList extends readonly UserAttributeListKey<User>[]> = { [Index in keyof AttributeList]: AttributeList[Index] extends UserAttributeListKey<User> ? AttributeListValue<User, AttributeList[Index]> : never };
|
|
1596
|
-
type AttributeMapSelectedKeys<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>> = Extract<{ [K in keyof AttributeMap]-?: undefined extends AttributeMap[K] ? never : K }[keyof AttributeMap], UserAttributeKey<User>>;
|
|
1597
|
-
type UserProfile<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[]> = {
|
|
1598
|
-
/**
|
|
1599
|
-
* TailorDB namespace where the user type is defined.
|
|
1600
|
-
*
|
|
1601
|
-
* Usually auto-resolved, so you don't need to specify this.
|
|
1602
|
-
* Required only when multiple TailorDBs exist and the type is in an external TailorDB.
|
|
1603
|
-
*/
|
|
1604
|
-
namespace?: string;
|
|
1605
|
-
type: User;
|
|
1606
|
-
usernameField: UsernameFieldKey<User>;
|
|
1607
|
-
attributes?: DisallowExtraKeys<AttributeMap, UserAttributeKey<User>>;
|
|
1608
|
-
attributeList?: AttributeList;
|
|
1609
|
-
};
|
|
1610
|
-
type MachineUserAttributeFields = Record<string, TailorField<DefinedFieldMetadata, unknown, FieldMetadata, TailorFieldType>>;
|
|
1611
|
-
type TailorFieldOutputValue<Field> = Field extends TailorField<DefinedFieldMetadata, infer Output, FieldMetadata, TailorFieldType> ? Output : never;
|
|
1612
|
-
type MachineUserAttributeValues<Fields extends MachineUserAttributeFields> = { [K in keyof Fields]: TailorFieldOutputValue<Fields[K]> extends ValueOperand | null | undefined ? TailorFieldOutputValue<Fields[K]> : never };
|
|
1613
|
-
type MachineUserFromAttributes<Fields extends MachineUserAttributeFields> = (keyof Fields extends never ? {
|
|
1614
|
-
attributes?: never;
|
|
1615
|
-
} : {
|
|
1616
|
-
attributes: DisallowExtraKeys<MachineUserAttributeValues<Fields>, keyof Fields>;
|
|
1617
|
-
}) & {
|
|
1618
|
-
attributeList?: string[];
|
|
1619
|
-
};
|
|
1620
|
-
type MachineUser<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User> = UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[] = [], MachineUserAttributes extends MachineUserAttributeFields | undefined = undefined> = IsAny<MachineUserAttributes> extends true ? IsAny<User> extends true ? {
|
|
1621
|
-
attributes: Record<string, AuthAttributeValue>;
|
|
1622
|
-
attributeList?: string[];
|
|
1623
|
-
} : (AttributeMapSelectedKeys<User, AttributeMap> extends never ? {
|
|
1624
|
-
attributes?: never;
|
|
1625
|
-
} : {
|
|
1626
|
-
attributes: { [K in AttributeMapSelectedKeys<User, AttributeMap>]: K extends keyof output<User> ? output<User>[K] : never } & { [K in Exclude<keyof output<User>, AttributeMapSelectedKeys<User, AttributeMap>>]?: never };
|
|
1627
|
-
}) & ([] extends AttributeList ? {
|
|
1628
|
-
attributeList?: never;
|
|
1629
|
-
} : {
|
|
1630
|
-
attributeList: AttributeListToTuple<User, AttributeList>;
|
|
1631
|
-
}) : [MachineUserAttributes] extends [MachineUserAttributeFields] ? MachineUserFromAttributes<MachineUserAttributes> : IsAny<User> extends true ? {
|
|
1632
|
-
attributes: Record<string, AuthAttributeValue>;
|
|
1633
|
-
attributeList?: string[];
|
|
1634
|
-
} : (AttributeMapSelectedKeys<User, AttributeMap> extends never ? {
|
|
1635
|
-
attributes?: never;
|
|
1636
|
-
} : {
|
|
1637
|
-
attributes: { [K in AttributeMapSelectedKeys<User, AttributeMap>]: K extends keyof output<User> ? output<User>[K] : never } & { [K in Exclude<keyof output<User>, AttributeMapSelectedKeys<User, AttributeMap>>]?: never };
|
|
1638
|
-
}) & ([] extends AttributeList ? {
|
|
1639
|
-
attributeList?: never;
|
|
1640
|
-
} : {
|
|
1641
|
-
attributeList: AttributeListToTuple<User, AttributeList>;
|
|
1642
|
-
});
|
|
1643
|
-
type BeforeLoginHookArgs = {
|
|
1644
|
-
claims: JsonObject;
|
|
1645
|
-
idpConfigName: string;
|
|
1646
|
-
};
|
|
1647
|
-
type BeforeLoginHook<MachineUserNames extends string> = {
|
|
1648
|
-
handler(args: BeforeLoginHookArgs): Promise<void>;
|
|
1649
|
-
invoker: NoInfer<MachineUserNames>;
|
|
1650
|
-
};
|
|
1651
|
-
type AuthHooks<MachineUserNames extends string> = {
|
|
1652
|
-
beforeLogin?: BeforeLoginHook<MachineUserNames>;
|
|
1653
|
-
};
|
|
1654
|
-
type AuthServiceInput<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[], MachineUserNames extends string, MachineUserAttributes extends MachineUserAttributeFields | undefined = MachineUserAttributeFields | undefined, ConnectionNames extends string = string> = {
|
|
1655
|
-
hooks?: AuthHooks<MachineUserNames>;
|
|
1656
|
-
userProfile?: UserProfile<User, AttributeMap, AttributeList>;
|
|
1657
|
-
machineUserAttributes?: MachineUserAttributes;
|
|
1658
|
-
machineUsers?: Record<MachineUserNames, MachineUser<User, AttributeMap, AttributeList, MachineUserAttributes>>;
|
|
1659
|
-
oauth2Clients?: Record<string, OAuth2ClientInput>;
|
|
1660
|
-
idProvider?: IdProvider;
|
|
1661
|
-
scim?: SCIMConfig;
|
|
1662
|
-
tenantProvider?: TenantProvider;
|
|
1663
|
-
connections?: Record<ConnectionNames, AuthConnectionConfig>;
|
|
1664
|
-
publishSessionEvents?: boolean;
|
|
1665
|
-
};
|
|
1666
|
-
declare const authDefinitionBrand: unique symbol;
|
|
1667
|
-
type AuthDefinitionBrand = {
|
|
1668
|
-
readonly [authDefinitionBrand]: true;
|
|
852
|
+
} | {
|
|
853
|
+
record: string;
|
|
854
|
+
} | {
|
|
855
|
+
oldRecord: string;
|
|
856
|
+
} | {
|
|
857
|
+
newRecord: string;
|
|
858
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
859
|
+
user: string;
|
|
860
|
+
} | {
|
|
861
|
+
record: string;
|
|
862
|
+
} | {
|
|
863
|
+
oldRecord: string;
|
|
864
|
+
} | {
|
|
865
|
+
newRecord: string;
|
|
866
|
+
})] | readonly [(string | boolean | string[] | boolean[] | {
|
|
867
|
+
user: string;
|
|
868
|
+
} | {
|
|
869
|
+
record: string;
|
|
870
|
+
} | {
|
|
871
|
+
oldRecord: string;
|
|
872
|
+
} | {
|
|
873
|
+
newRecord: string;
|
|
874
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
875
|
+
user: string;
|
|
876
|
+
} | {
|
|
877
|
+
record: string;
|
|
878
|
+
} | {
|
|
879
|
+
oldRecord: string;
|
|
880
|
+
} | {
|
|
881
|
+
newRecord: string;
|
|
882
|
+
}), boolean] | readonly (boolean | readonly [(string | boolean | string[] | boolean[] | {
|
|
883
|
+
user: string;
|
|
884
|
+
} | {
|
|
885
|
+
record: string;
|
|
886
|
+
} | {
|
|
887
|
+
oldRecord: string;
|
|
888
|
+
} | {
|
|
889
|
+
newRecord: string;
|
|
890
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
891
|
+
user: string;
|
|
892
|
+
} | {
|
|
893
|
+
record: string;
|
|
894
|
+
} | {
|
|
895
|
+
oldRecord: string;
|
|
896
|
+
} | {
|
|
897
|
+
newRecord: string;
|
|
898
|
+
})])[] | {
|
|
899
|
+
conditions: readonly [(string | boolean | string[] | boolean[] | {
|
|
900
|
+
user: string;
|
|
901
|
+
} | {
|
|
902
|
+
record: string;
|
|
903
|
+
} | {
|
|
904
|
+
oldRecord: string;
|
|
905
|
+
} | {
|
|
906
|
+
newRecord: string;
|
|
907
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
908
|
+
user: string;
|
|
909
|
+
} | {
|
|
910
|
+
record: string;
|
|
911
|
+
} | {
|
|
912
|
+
oldRecord: string;
|
|
913
|
+
} | {
|
|
914
|
+
newRecord: string;
|
|
915
|
+
})] | readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
916
|
+
user: string;
|
|
917
|
+
} | {
|
|
918
|
+
record: string;
|
|
919
|
+
} | {
|
|
920
|
+
oldRecord: string;
|
|
921
|
+
} | {
|
|
922
|
+
newRecord: string;
|
|
923
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
924
|
+
user: string;
|
|
925
|
+
} | {
|
|
926
|
+
record: string;
|
|
927
|
+
} | {
|
|
928
|
+
oldRecord: string;
|
|
929
|
+
} | {
|
|
930
|
+
newRecord: string;
|
|
931
|
+
})])[];
|
|
932
|
+
description?: string | undefined;
|
|
933
|
+
permit?: boolean | undefined;
|
|
934
|
+
})[];
|
|
935
|
+
update: readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
936
|
+
user: string;
|
|
937
|
+
} | {
|
|
938
|
+
record: string;
|
|
939
|
+
} | {
|
|
940
|
+
oldRecord: string;
|
|
941
|
+
} | {
|
|
942
|
+
newRecord: string;
|
|
943
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
944
|
+
user: string;
|
|
945
|
+
} | {
|
|
946
|
+
record: string;
|
|
947
|
+
} | {
|
|
948
|
+
oldRecord: string;
|
|
949
|
+
} | {
|
|
950
|
+
newRecord: string;
|
|
951
|
+
})] | readonly [(string | boolean | string[] | boolean[] | {
|
|
952
|
+
user: string;
|
|
953
|
+
} | {
|
|
954
|
+
record: string;
|
|
955
|
+
} | {
|
|
956
|
+
oldRecord: string;
|
|
957
|
+
} | {
|
|
958
|
+
newRecord: string;
|
|
959
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
960
|
+
user: string;
|
|
961
|
+
} | {
|
|
962
|
+
record: string;
|
|
963
|
+
} | {
|
|
964
|
+
oldRecord: string;
|
|
965
|
+
} | {
|
|
966
|
+
newRecord: string;
|
|
967
|
+
}), boolean] | readonly (boolean | readonly [(string | boolean | string[] | boolean[] | {
|
|
968
|
+
user: string;
|
|
969
|
+
} | {
|
|
970
|
+
record: string;
|
|
971
|
+
} | {
|
|
972
|
+
oldRecord: string;
|
|
973
|
+
} | {
|
|
974
|
+
newRecord: string;
|
|
975
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
976
|
+
user: string;
|
|
977
|
+
} | {
|
|
978
|
+
record: string;
|
|
979
|
+
} | {
|
|
980
|
+
oldRecord: string;
|
|
981
|
+
} | {
|
|
982
|
+
newRecord: string;
|
|
983
|
+
})])[] | {
|
|
984
|
+
conditions: readonly [(string | boolean | string[] | boolean[] | {
|
|
985
|
+
user: string;
|
|
986
|
+
} | {
|
|
987
|
+
record: string;
|
|
988
|
+
} | {
|
|
989
|
+
oldRecord: string;
|
|
990
|
+
} | {
|
|
991
|
+
newRecord: string;
|
|
992
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
993
|
+
user: string;
|
|
994
|
+
} | {
|
|
995
|
+
record: string;
|
|
996
|
+
} | {
|
|
997
|
+
oldRecord: string;
|
|
998
|
+
} | {
|
|
999
|
+
newRecord: string;
|
|
1000
|
+
})] | readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
1001
|
+
user: string;
|
|
1002
|
+
} | {
|
|
1003
|
+
record: string;
|
|
1004
|
+
} | {
|
|
1005
|
+
oldRecord: string;
|
|
1006
|
+
} | {
|
|
1007
|
+
newRecord: string;
|
|
1008
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
1009
|
+
user: string;
|
|
1010
|
+
} | {
|
|
1011
|
+
record: string;
|
|
1012
|
+
} | {
|
|
1013
|
+
oldRecord: string;
|
|
1014
|
+
} | {
|
|
1015
|
+
newRecord: string;
|
|
1016
|
+
})])[];
|
|
1017
|
+
description?: string | undefined;
|
|
1018
|
+
permit?: boolean | undefined;
|
|
1019
|
+
})[];
|
|
1020
|
+
delete: readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
1021
|
+
user: string;
|
|
1022
|
+
} | {
|
|
1023
|
+
record: string;
|
|
1024
|
+
} | {
|
|
1025
|
+
oldRecord: string;
|
|
1026
|
+
} | {
|
|
1027
|
+
newRecord: string;
|
|
1028
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
1029
|
+
user: string;
|
|
1030
|
+
} | {
|
|
1031
|
+
record: string;
|
|
1032
|
+
} | {
|
|
1033
|
+
oldRecord: string;
|
|
1034
|
+
} | {
|
|
1035
|
+
newRecord: string;
|
|
1036
|
+
})] | readonly [(string | boolean | string[] | boolean[] | {
|
|
1037
|
+
user: string;
|
|
1038
|
+
} | {
|
|
1039
|
+
record: string;
|
|
1040
|
+
} | {
|
|
1041
|
+
oldRecord: string;
|
|
1042
|
+
} | {
|
|
1043
|
+
newRecord: string;
|
|
1044
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
1045
|
+
user: string;
|
|
1046
|
+
} | {
|
|
1047
|
+
record: string;
|
|
1048
|
+
} | {
|
|
1049
|
+
oldRecord: string;
|
|
1050
|
+
} | {
|
|
1051
|
+
newRecord: string;
|
|
1052
|
+
}), boolean] | readonly (boolean | readonly [(string | boolean | string[] | boolean[] | {
|
|
1053
|
+
user: string;
|
|
1054
|
+
} | {
|
|
1055
|
+
record: string;
|
|
1056
|
+
} | {
|
|
1057
|
+
oldRecord: string;
|
|
1058
|
+
} | {
|
|
1059
|
+
newRecord: string;
|
|
1060
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
1061
|
+
user: string;
|
|
1062
|
+
} | {
|
|
1063
|
+
record: string;
|
|
1064
|
+
} | {
|
|
1065
|
+
oldRecord: string;
|
|
1066
|
+
} | {
|
|
1067
|
+
newRecord: string;
|
|
1068
|
+
})])[] | {
|
|
1069
|
+
conditions: readonly [(string | boolean | string[] | boolean[] | {
|
|
1070
|
+
user: string;
|
|
1071
|
+
} | {
|
|
1072
|
+
record: string;
|
|
1073
|
+
} | {
|
|
1074
|
+
oldRecord: string;
|
|
1075
|
+
} | {
|
|
1076
|
+
newRecord: string;
|
|
1077
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
1078
|
+
user: string;
|
|
1079
|
+
} | {
|
|
1080
|
+
record: string;
|
|
1081
|
+
} | {
|
|
1082
|
+
oldRecord: string;
|
|
1083
|
+
} | {
|
|
1084
|
+
newRecord: string;
|
|
1085
|
+
})] | readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
1086
|
+
user: string;
|
|
1087
|
+
} | {
|
|
1088
|
+
record: string;
|
|
1089
|
+
} | {
|
|
1090
|
+
oldRecord: string;
|
|
1091
|
+
} | {
|
|
1092
|
+
newRecord: string;
|
|
1093
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
1094
|
+
user: string;
|
|
1095
|
+
} | {
|
|
1096
|
+
record: string;
|
|
1097
|
+
} | {
|
|
1098
|
+
oldRecord: string;
|
|
1099
|
+
} | {
|
|
1100
|
+
newRecord: string;
|
|
1101
|
+
})])[];
|
|
1102
|
+
description?: string | undefined;
|
|
1103
|
+
permit?: boolean | undefined;
|
|
1104
|
+
})[];
|
|
1105
|
+
} | undefined;
|
|
1106
|
+
gql?: readonly {
|
|
1107
|
+
conditions: readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
1108
|
+
user: string;
|
|
1109
|
+
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
1110
|
+
user: string;
|
|
1111
|
+
})])[];
|
|
1112
|
+
actions: "all" | readonly ("create" | "read" | "update" | "delete" | "aggregate" | "bulkUpsert")[];
|
|
1113
|
+
permit?: boolean | undefined;
|
|
1114
|
+
description?: string | undefined;
|
|
1115
|
+
}[] | undefined;
|
|
1669
1116
|
};
|
|
1670
|
-
type
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
external: true;
|
|
1117
|
+
type TailorDBServiceConfigInput = {
|
|
1118
|
+
/** Glob patterns for TailorDB type definition files */files: string[]; /** Glob patterns to exclude from type discovery */
|
|
1119
|
+
ignores?: string[] | undefined; /** URL for the ERD (Entity Relationship Diagram) site */
|
|
1120
|
+
erdSite?: string | undefined; /** Migration configuration */
|
|
1121
|
+
migration?: {
|
|
1122
|
+
directory: string;
|
|
1123
|
+
machineUser?: string | undefined;
|
|
1124
|
+
} | undefined; /** Default GraphQL operations for all types in this service */
|
|
1125
|
+
gqlOperations?: "query" | {
|
|
1126
|
+
create?: boolean | undefined;
|
|
1127
|
+
update?: boolean | undefined;
|
|
1128
|
+
delete?: boolean | undefined;
|
|
1129
|
+
read?: boolean | undefined;
|
|
1130
|
+
} | undefined;
|
|
1685
1131
|
};
|
|
1686
|
-
type AuthServiceInputLoose = AuthServiceInput<any, any, any, string, any>;
|
|
1687
|
-
type AuthOwnConfig = DefinedAuth<string, AuthServiceInputLoose, string>;
|
|
1688
|
-
type AuthConfig = AuthOwnConfig | AuthExternalConfig;
|
|
1689
1132
|
//#endregion
|
|
1690
1133
|
//#region src/types/tailordb.d.ts
|
|
1134
|
+
type SerialConfig<T extends "string" | "integer" = "string" | "integer"> = Prettify<{
|
|
1135
|
+
start: number;
|
|
1136
|
+
maxValue?: number;
|
|
1137
|
+
} & (T extends "string" ? {
|
|
1138
|
+
format?: string;
|
|
1139
|
+
} : object)>;
|
|
1140
|
+
interface DBFieldMetadata extends FieldMetadata {
|
|
1141
|
+
index?: boolean;
|
|
1142
|
+
unique?: boolean;
|
|
1143
|
+
vector?: boolean;
|
|
1144
|
+
foreignKey?: boolean;
|
|
1145
|
+
foreignKeyType?: string;
|
|
1146
|
+
foreignKeyField?: string;
|
|
1147
|
+
/** Lifecycle hooks for the field */
|
|
1148
|
+
hooks?: DBFieldMetadata$1["hooks"];
|
|
1149
|
+
serial?: SerialConfig;
|
|
1150
|
+
relation?: boolean;
|
|
1151
|
+
scale?: number;
|
|
1152
|
+
}
|
|
1153
|
+
interface DefinedDBFieldMetadata extends DefinedFieldMetadata {
|
|
1154
|
+
index?: boolean;
|
|
1155
|
+
unique?: boolean;
|
|
1156
|
+
vector?: boolean;
|
|
1157
|
+
foreignKey?: boolean;
|
|
1158
|
+
foreignKeyType?: boolean;
|
|
1159
|
+
validate?: boolean;
|
|
1160
|
+
hooks?: {
|
|
1161
|
+
create: boolean;
|
|
1162
|
+
update: boolean;
|
|
1163
|
+
};
|
|
1164
|
+
serial?: boolean;
|
|
1165
|
+
relation?: boolean;
|
|
1166
|
+
}
|
|
1167
|
+
type IndexDef<T extends {
|
|
1168
|
+
fields: Record<PropertyKey, unknown>;
|
|
1169
|
+
}> = {
|
|
1170
|
+
fields: [keyof T["fields"], keyof T["fields"], ...(keyof T["fields"])[]];
|
|
1171
|
+
unique?: boolean;
|
|
1172
|
+
name?: string;
|
|
1173
|
+
};
|
|
1174
|
+
type GqlOperationsConfig = GqlOperationsInput;
|
|
1691
1175
|
type RelationType = "1-1" | "oneToOne" | "n-1" | "manyToOne" | "N-1" | "keyOnly";
|
|
1692
1176
|
type TailorDBExternalConfig = {
|
|
1693
1177
|
external: true;
|
|
@@ -1715,10 +1199,6 @@ type TypeSourceInfoEntry = UserDefinedTypeSource | PluginGeneratedTypeSource;
|
|
|
1715
1199
|
interface Script {
|
|
1716
1200
|
expr: string;
|
|
1717
1201
|
}
|
|
1718
|
-
interface EnumValue {
|
|
1719
|
-
value: string;
|
|
1720
|
-
description?: string;
|
|
1721
|
-
}
|
|
1722
1202
|
interface OperatorValidateConfig {
|
|
1723
1203
|
script: Script;
|
|
1724
1204
|
errorMessage: string;
|
|
@@ -1764,14 +1244,14 @@ type StandardPermissionOperator = "eq" | "ne" | "in" | "nin" | "hasAny" | "nhasA
|
|
|
1764
1244
|
type UserOperand = {
|
|
1765
1245
|
user: string;
|
|
1766
1246
|
};
|
|
1767
|
-
type
|
|
1247
|
+
type StandardRecordOperand<Update extends boolean = false> = Update extends true ? {
|
|
1768
1248
|
oldRecord: string;
|
|
1769
1249
|
} | {
|
|
1770
1250
|
newRecord: string;
|
|
1771
1251
|
} : {
|
|
1772
1252
|
record: string;
|
|
1773
1253
|
};
|
|
1774
|
-
type PermissionOperand<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = UserOperand | ValueOperand | (Level extends "record" ?
|
|
1254
|
+
type PermissionOperand<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = UserOperand | ValueOperand | (Level extends "record" ? StandardRecordOperand<Update> : never);
|
|
1775
1255
|
type StandardPermissionCondition<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = readonly [PermissionOperand<Level, Update>, StandardPermissionOperator, PermissionOperand<Level, Update>];
|
|
1776
1256
|
type StandardActionPermission<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = {
|
|
1777
1257
|
conditions: readonly StandardPermissionCondition<Level, Update>[];
|
|
@@ -1831,7 +1311,7 @@ interface ParsedRelationship {
|
|
|
1831
1311
|
isArray: boolean;
|
|
1832
1312
|
description: string;
|
|
1833
1313
|
}
|
|
1834
|
-
interface TailorDBType {
|
|
1314
|
+
interface TailorDBType$1 {
|
|
1835
1315
|
name: string;
|
|
1836
1316
|
pluralForm: string;
|
|
1837
1317
|
description?: string;
|
|
@@ -1884,7 +1364,7 @@ interface TailorDBNamespaceData {
|
|
|
1884
1364
|
/** Namespace name */
|
|
1885
1365
|
namespace: string;
|
|
1886
1366
|
/** All TailorDB types in this namespace, keyed by type name */
|
|
1887
|
-
types: Record<string, TailorDBType>;
|
|
1367
|
+
types: Record<string, TailorDBType$1>;
|
|
1888
1368
|
/** Source info for each type (file path, export name, plugin info) */
|
|
1889
1369
|
sourceInfo: ReadonlyMap<string, TypeSourceInfoEntry>;
|
|
1890
1370
|
/** Plugin attachments configured on each type via .plugin() method */
|
|
@@ -2089,5 +1569,33 @@ interface Plugin<TypeConfig = unknown, PluginConfig = unknown> {
|
|
|
2089
1569
|
onExecutorReady?(context: ExecutorReadyContext<PluginConfig>): GeneratorResult | Promise<GeneratorResult>;
|
|
2090
1570
|
}
|
|
2091
1571
|
//#endregion
|
|
2092
|
-
|
|
2093
|
-
|
|
1572
|
+
//#region src/types/tailor-db-field.d.ts
|
|
1573
|
+
/**
|
|
1574
|
+
* Minimal structural interface for TailorDBField.
|
|
1575
|
+
* Defines only the properties needed by parser, plugin, cli, and types layers.
|
|
1576
|
+
* The full interface with builder methods (relation, index, unique, hooks, validate, etc.)
|
|
1577
|
+
* is defined in configure/services/tailordb/schema.ts.
|
|
1578
|
+
*/
|
|
1579
|
+
interface TailorDBField<Defined extends DefinedDBFieldMetadata = DefinedDBFieldMetadata, Output = any> extends Omit<TailorField<Defined, Output, DBFieldMetadata, Defined["type"]>, "fields"> {
|
|
1580
|
+
readonly fields: Record<string, TailorAnyDBField>;
|
|
1581
|
+
readonly rawRelation: Readonly<RawRelationConfig> | undefined;
|
|
1582
|
+
}
|
|
1583
|
+
type TailorAnyDBField = TailorDBField<any, any>;
|
|
1584
|
+
/**
|
|
1585
|
+
* Minimal structural interface for TailorDBType.
|
|
1586
|
+
* Defines only the properties needed by parser, plugin, cli, and types layers.
|
|
1587
|
+
* The full interface with builder methods (hooks, validate, features, permission, etc.)
|
|
1588
|
+
* is defined in configure/services/tailordb/schema.ts.
|
|
1589
|
+
*/
|
|
1590
|
+
interface TailorDBType<Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> {
|
|
1591
|
+
readonly name: string;
|
|
1592
|
+
readonly fields: Fields;
|
|
1593
|
+
readonly _output: InferFieldsOutput<Fields>;
|
|
1594
|
+
readonly metadata: TailorDBTypeMetadata;
|
|
1595
|
+
readonly plugins: PluginAttachment[];
|
|
1596
|
+
}
|
|
1597
|
+
type TailorAnyDBType = TailorDBType<any, any>;
|
|
1598
|
+
type TailorDBInstance<Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> = TailorDBType<Fields, User>;
|
|
1599
|
+
//#endregion
|
|
1600
|
+
export { ResolverInput as $, RelationType as A, FieldMetadata as At, BeforeLoginHookArgs as B, InferredAttributeMap as Bt, ResolverReadyContext as C, SCIMAuthorization as Ct, DefinedDBFieldMetadata as D, ArrayFieldOutput as Dt, DBFieldMetadata as E, TenantProvider as Et, AuthConfig as F, FieldValidateInput as Ft, UserAttributeListKey as G, JsonValue as Gt, OAuth2ClientGrantType as H, unauthenticatedTailorUser as Ht, AuthConnectionTokenResult as I, Validators as It, ValueOperand as J, UserAttributeMap as K, Prettify as Kt, AuthExternalConfig as L, AttributeList as Lt, TailorDBServiceInput as M, FieldOutput$1 as Mt, TailorDBType$1 as N, TailorFieldType as Nt, GqlOperationsConfig as O, DefinedFieldMetadata as Ot, TypeSourceInfoEntry as P, TailorToTs as Pt, Resolver as Q, AuthOwnConfig as R, AttributeMap as Rt, ResolverNamespaceData as S, SCIMAttributeMapping as St, TailorDBReadyContext as T, SCIMResource as Tt, SCIMAttributeType as U, InferFieldsOutput as Ut, DefinedAuth as V, TailorUser as Vt, UserAttributeKey as W, JsonCompatible as Wt, AuthConnectionConfig as X, TailorField as Y, AuthConnectionOAuth2Config as Z, PluginProcessContext as _, IdProvider as _t, NamespacePluginOutput as a, FunctionOperation as at, ExecutorReadyContext as b, SAML as bt, PluginConfigs as c, IncomingWebhookTrigger as ct, PluginGeneratedExecutor as d, TailorDBTrigger as dt, GeneratorConfig as et, PluginGeneratedExecutorWithFile as f, WebhookOperation as ft, PluginOutput as g, IDToken as gt, PluginNamespaceProcessContext as h, BuiltinIdP as ht, TailorDBType as i, ExecutorInput as it, SerialConfig as j, FieldOptions as jt, IndexDef as k, EnumValue as kt, PluginExecutorContext as l, ResolverExecutedTrigger as lt, PluginGeneratedType as m, AuthInvoker as mt, TailorAnyDBType as n, AuthAccessTokenTrigger as nt, Plugin as o, GqlOperation as ot, PluginGeneratedResolver as p, WorkflowOperation as pt, UsernameFieldKey as q, output as qt, TailorDBField as r, Executor as rt, PluginAttachment as s, IdpUserTrigger as st, TailorAnyDBField as t, BaseGeneratorConfig as tt, PluginExecutorContextBase as u, ScheduleTriggerInput as ut, TailorDBTypeForPlugin as v, OAuth2ClientInput as vt, TailorDBNamespaceData as w, SCIMConfig as wt, GeneratorResult as x, SCIMAttribute as xt, TypePluginOutput as y, OIDC as yt, AuthServiceInput as z, InferredAttributeList as zt };
|
|
1601
|
+
//# sourceMappingURL=tailor-db-field-CoFKRCYW.d.mts.map
|