@tailor-platform/sdk 0.0.1 → 0.8.1
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 +790 -0
- package/LICENSE +21 -0
- package/README.md +8 -41
- package/dist/auth-Di3vQUrT.mjs +743 -0
- package/dist/cli/api.d.mts +213 -0
- package/dist/cli/api.mjs +4 -0
- package/dist/cli/index.d.mts +3 -0
- package/dist/cli/index.mjs +996 -0
- package/dist/configure/index.d.mts +5 -0
- package/dist/configure/index.mjs +108 -0
- package/dist/index-BWN4RmSt.d.mts +232 -0
- package/dist/plugin-generated.d.ts +14 -0
- package/dist/token-B9YK0eTP.mjs +5498 -0
- package/dist/types-DWQxkbYl.d.mts +1389 -0
- package/dist/utils/test/index.d.mts +40 -0
- package/dist/utils/test/index.mjs +63 -0
- package/docs/cli-reference.md +484 -0
- package/docs/configuration.md +132 -0
- package/docs/core-concepts.md +504 -0
- package/docs/quickstart.md +96 -0
- package/docs/testing.md +298 -0
- package/package.json +87 -8
- package/postinstall.mjs +87 -0
|
@@ -0,0 +1,1389 @@
|
|
|
1
|
+
/// <reference path="./plugin-generated.d.ts" />
|
|
2
|
+
|
|
3
|
+
import * as zod0 from "zod";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
|
+
import * as type_fest0 from "type-fest";
|
|
7
|
+
import { IsAny, NonEmptyObject } from "type-fest";
|
|
8
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
9
|
+
|
|
10
|
+
//#region src/configure/types/helpers.d.ts
|
|
11
|
+
type Prettify<T> = { [K in keyof T as string extends K ? never : K]: T[K] } & {};
|
|
12
|
+
type DeepWritable<T> = T extends Date | RegExp | Function ? T : T extends object ? { -readonly [P in keyof T]: DeepWritable<T[P]> } & {} : T;
|
|
13
|
+
type output<T> = T extends {
|
|
14
|
+
_output: infer U;
|
|
15
|
+
} ? DeepWritable<U> : never;
|
|
16
|
+
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] };
|
|
17
|
+
type InferFieldsOutput<F extends Record<string, {
|
|
18
|
+
_output: any;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}>> = DeepWritable<Prettify<NullableToOptional<{ [K in keyof F]: output<F[K]> }>>>;
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/parser/service/resolver/schema.d.ts
|
|
23
|
+
declare const QueryTypeSchema: z.ZodUnion<readonly [z.ZodLiteral<"query">, z.ZodLiteral<"mutation">]>;
|
|
24
|
+
declare const TailorFieldSchema: z.ZodObject<{
|
|
25
|
+
type: z.ZodEnum<{
|
|
26
|
+
string: "string";
|
|
27
|
+
boolean: "boolean";
|
|
28
|
+
uuid: "uuid";
|
|
29
|
+
integer: "integer";
|
|
30
|
+
float: "float";
|
|
31
|
+
enum: "enum";
|
|
32
|
+
date: "date";
|
|
33
|
+
datetime: "datetime";
|
|
34
|
+
time: "time";
|
|
35
|
+
nested: "nested";
|
|
36
|
+
}>;
|
|
37
|
+
metadata: z.ZodObject<{
|
|
38
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
array: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
description: z.ZodOptional<z.ZodString>;
|
|
41
|
+
allowedValues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
42
|
+
value: z.ZodString;
|
|
43
|
+
description: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>>>;
|
|
45
|
+
hooks: z.ZodOptional<z.ZodObject<{
|
|
46
|
+
create: z.ZodOptional<z.ZodCustom<Function, Function>>;
|
|
47
|
+
update: z.ZodOptional<z.ZodCustom<Function, Function>>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
typeName: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
fields: z.ZodRecord<z.ZodString, z.ZodObject< /*elided*/any, z.core.$strip>>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
declare const ResolverSchema: z.ZodObject<{
|
|
54
|
+
operation: z.ZodUnion<readonly [z.ZodLiteral<"query">, z.ZodLiteral<"mutation">]>;
|
|
55
|
+
name: z.ZodString;
|
|
56
|
+
description: z.ZodOptional<z.ZodString>;
|
|
57
|
+
input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
58
|
+
type: z.ZodEnum<{
|
|
59
|
+
string: "string";
|
|
60
|
+
boolean: "boolean";
|
|
61
|
+
uuid: "uuid";
|
|
62
|
+
integer: "integer";
|
|
63
|
+
float: "float";
|
|
64
|
+
enum: "enum";
|
|
65
|
+
date: "date";
|
|
66
|
+
datetime: "datetime";
|
|
67
|
+
time: "time";
|
|
68
|
+
nested: "nested";
|
|
69
|
+
}>;
|
|
70
|
+
metadata: z.ZodObject<{
|
|
71
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
72
|
+
array: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
description: z.ZodOptional<z.ZodString>;
|
|
74
|
+
allowedValues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
75
|
+
value: z.ZodString;
|
|
76
|
+
description: z.ZodOptional<z.ZodString>;
|
|
77
|
+
}, z.core.$strip>>>;
|
|
78
|
+
hooks: z.ZodOptional<z.ZodObject<{
|
|
79
|
+
create: z.ZodOptional<z.ZodCustom<Function, Function>>;
|
|
80
|
+
update: z.ZodOptional<z.ZodCustom<Function, Function>>;
|
|
81
|
+
}, z.core.$strip>>;
|
|
82
|
+
typeName: z.ZodOptional<z.ZodString>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
fields: z.ZodRecord<z.ZodString, z.ZodObject< /*elided*/any, z.core.$strip>>;
|
|
85
|
+
}, z.core.$strip>>>;
|
|
86
|
+
body: z.ZodCustom<Function, Function>;
|
|
87
|
+
output: z.ZodObject<{
|
|
88
|
+
type: z.ZodEnum<{
|
|
89
|
+
string: "string";
|
|
90
|
+
boolean: "boolean";
|
|
91
|
+
uuid: "uuid";
|
|
92
|
+
integer: "integer";
|
|
93
|
+
float: "float";
|
|
94
|
+
enum: "enum";
|
|
95
|
+
date: "date";
|
|
96
|
+
datetime: "datetime";
|
|
97
|
+
time: "time";
|
|
98
|
+
nested: "nested";
|
|
99
|
+
}>;
|
|
100
|
+
metadata: z.ZodObject<{
|
|
101
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
102
|
+
array: z.ZodOptional<z.ZodBoolean>;
|
|
103
|
+
description: z.ZodOptional<z.ZodString>;
|
|
104
|
+
allowedValues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
105
|
+
value: z.ZodString;
|
|
106
|
+
description: z.ZodOptional<z.ZodString>;
|
|
107
|
+
}, z.core.$strip>>>;
|
|
108
|
+
hooks: z.ZodOptional<z.ZodObject<{
|
|
109
|
+
create: z.ZodOptional<z.ZodCustom<Function, Function>>;
|
|
110
|
+
update: z.ZodOptional<z.ZodCustom<Function, Function>>;
|
|
111
|
+
}, z.core.$strip>>;
|
|
112
|
+
typeName: z.ZodOptional<z.ZodString>;
|
|
113
|
+
}, z.core.$strip>;
|
|
114
|
+
fields: z.ZodRecord<z.ZodString, z.ZodObject< /*elided*/any, z.core.$strip>>;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
}, z.core.$strip>;
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/parser/service/resolver/types.d.ts
|
|
119
|
+
type TailorFieldInput = z.input<typeof TailorFieldSchema>;
|
|
120
|
+
type QueryType = z.output<typeof QueryTypeSchema>;
|
|
121
|
+
type ResolverInput = z.input<typeof ResolverSchema>;
|
|
122
|
+
type Resolver = z.output<typeof ResolverSchema>;
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/configure/types/type.d.ts
|
|
125
|
+
declare class TailorField<const Defined extends DefinedFieldMetadata = DefinedFieldMetadata, const Output = any, M extends FieldMetadata = FieldMetadata> implements TailorFieldInput {
|
|
126
|
+
readonly type: TailorFieldType;
|
|
127
|
+
readonly fields: Record<string, TailorField<any>>;
|
|
128
|
+
protected _metadata: M;
|
|
129
|
+
readonly _defined: Defined;
|
|
130
|
+
readonly _output: Output;
|
|
131
|
+
get metadata(): M;
|
|
132
|
+
protected constructor(type: TailorFieldType, options?: FieldOptions, fields?: Record<string, TailorField<any>>, values?: AllowedValues);
|
|
133
|
+
static create<const TType extends TailorFieldType, const TOptions extends FieldOptions>(type: TType, options?: TOptions, fields?: Record<string, TailorField<any>>, values?: AllowedValues): TailorField<{
|
|
134
|
+
type: TType;
|
|
135
|
+
array: TOptions extends {
|
|
136
|
+
array: true;
|
|
137
|
+
} ? true : false;
|
|
138
|
+
}, FieldOutput<TailorToTs[TType], TOptions>, FieldMetadata>;
|
|
139
|
+
description<CurrentDefined extends Defined>(this: CurrentDefined extends {
|
|
140
|
+
description: unknown;
|
|
141
|
+
} ? never : TailorField<CurrentDefined, Output>, description: string): TailorField<Prettify<CurrentDefined & {
|
|
142
|
+
description: true;
|
|
143
|
+
}>, Output>;
|
|
144
|
+
typeName<CurrentDefined extends Defined>(this: CurrentDefined extends {
|
|
145
|
+
typeName: unknown;
|
|
146
|
+
} ? never : CurrentDefined extends {
|
|
147
|
+
type: "enum" | "nested";
|
|
148
|
+
} ? TailorField<CurrentDefined, Output> : never, typeName: string): TailorField<Prettify<CurrentDefined & {
|
|
149
|
+
typeName: true;
|
|
150
|
+
}>, Output>;
|
|
151
|
+
validate<CurrentDefined extends Defined>(this: CurrentDefined extends {
|
|
152
|
+
validate: unknown;
|
|
153
|
+
} ? never : TailorField<CurrentDefined, Output>, ...validate: FieldValidateInput<Output>[]): TailorField<Prettify<CurrentDefined & {
|
|
154
|
+
validate: true;
|
|
155
|
+
}>, Output>;
|
|
156
|
+
/**
|
|
157
|
+
* Parse and validate a value against this field's validation rules
|
|
158
|
+
* Returns StandardSchema Result type with success or failure
|
|
159
|
+
*/
|
|
160
|
+
parse(args: {
|
|
161
|
+
value: any;
|
|
162
|
+
data: any;
|
|
163
|
+
user: TailorUser;
|
|
164
|
+
}): StandardSchemaV1.Result<Output>;
|
|
165
|
+
/**
|
|
166
|
+
* Validate a single value (not an array element)
|
|
167
|
+
* Used internally for array element validation
|
|
168
|
+
* @private
|
|
169
|
+
*/
|
|
170
|
+
private _validateValue;
|
|
171
|
+
/**
|
|
172
|
+
* Internal parse method that tracks field path for nested validation
|
|
173
|
+
* @private
|
|
174
|
+
*/
|
|
175
|
+
private _parseInternal;
|
|
176
|
+
}
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/configure/types/user.d.ts
|
|
179
|
+
declare global {
|
|
180
|
+
namespace TailorSDK {
|
|
181
|
+
interface AttributeMap {}
|
|
182
|
+
interface AttributeList {
|
|
183
|
+
__tuple?: [];
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
type InferredAttributeMap = keyof TailorSDK.AttributeMap extends never ? Record<string, string | string[] | boolean | boolean[] | undefined> : TailorSDK.AttributeMap;
|
|
188
|
+
type InferredAttributeList = TailorSDK.AttributeList["__tuple"] extends [] ? string[] : TailorSDK.AttributeList["__tuple"];
|
|
189
|
+
/** Represents a user in the Tailor platform. */
|
|
190
|
+
type TailorUser = {
|
|
191
|
+
/**
|
|
192
|
+
* The ID of the user.
|
|
193
|
+
* For unauthenticated users, this will be a nil UUID.
|
|
194
|
+
*/
|
|
195
|
+
id: string;
|
|
196
|
+
/**
|
|
197
|
+
* The type of the user.
|
|
198
|
+
* For unauthenticated users, this will be an empty string.
|
|
199
|
+
*/
|
|
200
|
+
type: "user" | "machine_user" | "";
|
|
201
|
+
/** The ID of the workspace the user belongs to. */
|
|
202
|
+
workspaceId: string;
|
|
203
|
+
/**
|
|
204
|
+
* A map of the user's attributes.
|
|
205
|
+
* For unauthenticated users, this will be null.
|
|
206
|
+
*/
|
|
207
|
+
attributes: InferredAttributeMap | null;
|
|
208
|
+
/** A list of the user's attributes.
|
|
209
|
+
* For unauthenticated users, this will be an empty array.
|
|
210
|
+
*/
|
|
211
|
+
attributeList: InferredAttributeList;
|
|
212
|
+
};
|
|
213
|
+
/** Represents an unauthenticated user in the Tailor platform. */
|
|
214
|
+
declare const unauthenticatedTailorUser: TailorUser;
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/configure/types/validation.d.ts
|
|
217
|
+
/**
|
|
218
|
+
* Validation function type
|
|
219
|
+
*/
|
|
220
|
+
type ValidateFn<O, D = unknown> = (args: {
|
|
221
|
+
value: O;
|
|
222
|
+
data: D;
|
|
223
|
+
user: TailorUser;
|
|
224
|
+
}) => boolean;
|
|
225
|
+
/**
|
|
226
|
+
* Validation configuration with custom error message
|
|
227
|
+
*/
|
|
228
|
+
type ValidateConfig<O, D = unknown> = [ValidateFn<O, D>, string];
|
|
229
|
+
/**
|
|
230
|
+
* Field-level validation function
|
|
231
|
+
*/
|
|
232
|
+
type FieldValidateFn<O> = ValidateFn<O>;
|
|
233
|
+
/**
|
|
234
|
+
* Field-level validation configuration
|
|
235
|
+
*/
|
|
236
|
+
type FieldValidateConfig<O> = ValidateConfig<O>;
|
|
237
|
+
/**
|
|
238
|
+
* Input type for field validation - can be either a function or a tuple of [function, errorMessage]
|
|
239
|
+
*/
|
|
240
|
+
type FieldValidateInput<O> = FieldValidateFn<O> | FieldValidateConfig<O>;
|
|
241
|
+
/**
|
|
242
|
+
* Base validators type for field collections
|
|
243
|
+
* @template F - Record of fields
|
|
244
|
+
* @template ExcludeKeys - Keys to exclude from validation (default: "id" for TailorDB)
|
|
245
|
+
*/
|
|
246
|
+
type ValidatorsBase<F extends Record<string, {
|
|
247
|
+
_defined: any;
|
|
248
|
+
_output: any;
|
|
249
|
+
[key: string]: any;
|
|
250
|
+
}>, ExcludeKeys extends string = "id"> = NonEmptyObject<{ [K in Exclude<keyof F, ExcludeKeys> as F[K]["_defined"] extends {
|
|
251
|
+
validate: unknown;
|
|
252
|
+
} ? 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>>)[] }>;
|
|
253
|
+
/**
|
|
254
|
+
* Validators type (by default excludes "id" field for TailorDB compatibility)
|
|
255
|
+
* Can be used with both TailorField and TailorDBField
|
|
256
|
+
*/
|
|
257
|
+
type Validators<F extends Record<string, {
|
|
258
|
+
_defined: any;
|
|
259
|
+
_output: any;
|
|
260
|
+
[key: string]: any;
|
|
261
|
+
}>> = ValidatorsBase<F, "id">;
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/configure/types/types.d.ts
|
|
264
|
+
type TailorFieldType = "uuid" | "string" | "boolean" | "integer" | "float" | "enum" | "date" | "datetime" | "time" | "nested";
|
|
265
|
+
type TailorToTs = {
|
|
266
|
+
string: string;
|
|
267
|
+
integer: number;
|
|
268
|
+
float: number;
|
|
269
|
+
boolean: boolean;
|
|
270
|
+
uuid: string;
|
|
271
|
+
date: string;
|
|
272
|
+
datetime: string;
|
|
273
|
+
time: string;
|
|
274
|
+
enum: string;
|
|
275
|
+
object: Record<string, unknown>;
|
|
276
|
+
nested: Record<string, unknown>;
|
|
277
|
+
} & Record<TailorFieldType, unknown>;
|
|
278
|
+
interface Script {
|
|
279
|
+
expr: string;
|
|
280
|
+
}
|
|
281
|
+
interface EnumValue {
|
|
282
|
+
value: string;
|
|
283
|
+
description?: string;
|
|
284
|
+
}
|
|
285
|
+
interface FieldMetadata {
|
|
286
|
+
description?: string;
|
|
287
|
+
required?: boolean;
|
|
288
|
+
array?: boolean;
|
|
289
|
+
allowedValues?: AllowedValue[];
|
|
290
|
+
validate?: FieldValidateInput<any>[];
|
|
291
|
+
typeName?: string;
|
|
292
|
+
}
|
|
293
|
+
interface DefinedFieldMetadata {
|
|
294
|
+
type: TailorFieldType;
|
|
295
|
+
array: boolean;
|
|
296
|
+
description?: boolean;
|
|
297
|
+
validate?: boolean;
|
|
298
|
+
typeName?: boolean;
|
|
299
|
+
}
|
|
300
|
+
type FieldOptions = {
|
|
301
|
+
optional?: boolean;
|
|
302
|
+
array?: boolean;
|
|
303
|
+
};
|
|
304
|
+
type FieldOutput<T, O extends FieldOptions> = OptionalFieldOutput<ArrayFieldOutput<T, O>, O>;
|
|
305
|
+
type OptionalFieldOutput<T, O extends FieldOptions> = O["optional"] extends true ? T | null : T;
|
|
306
|
+
type ArrayFieldOutput<T, O extends FieldOptions> = [O] extends [{
|
|
307
|
+
array: true;
|
|
308
|
+
}] ? T[] : T;
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region src/configure/types/field.d.ts
|
|
311
|
+
type AllowedValue = EnumValue;
|
|
312
|
+
type AllowedValues = [string | EnumValue, ...(string | EnumValue)[]];
|
|
313
|
+
type AllowedValuesOutput<V extends AllowedValues> = V[number] extends infer T ? T extends string ? T : T extends {
|
|
314
|
+
value: infer K;
|
|
315
|
+
} ? K : never : never;
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region src/configure/types/operator.d.ts
|
|
318
|
+
interface OperatorValidateConfig {
|
|
319
|
+
script: Script;
|
|
320
|
+
errorMessage: string;
|
|
321
|
+
}
|
|
322
|
+
interface OperatorFieldHook {
|
|
323
|
+
create?: Script;
|
|
324
|
+
update?: Script;
|
|
325
|
+
}
|
|
326
|
+
interface OperatorFieldConfig {
|
|
327
|
+
type: string;
|
|
328
|
+
required?: boolean;
|
|
329
|
+
description?: string;
|
|
330
|
+
allowedValues?: EnumValue[];
|
|
331
|
+
array?: boolean;
|
|
332
|
+
index?: boolean;
|
|
333
|
+
unique?: boolean;
|
|
334
|
+
vector?: boolean;
|
|
335
|
+
foreignKey?: boolean;
|
|
336
|
+
foreignKeyType?: string;
|
|
337
|
+
foreignKeyField?: string;
|
|
338
|
+
validate?: OperatorValidateConfig[];
|
|
339
|
+
hooks?: OperatorFieldHook;
|
|
340
|
+
serial?: {
|
|
341
|
+
start: number;
|
|
342
|
+
maxValue?: number;
|
|
343
|
+
format?: string;
|
|
344
|
+
};
|
|
345
|
+
fields?: Record<string, OperatorFieldConfig>;
|
|
346
|
+
}
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/parser/service/auth/schema.d.ts
|
|
349
|
+
declare const OIDCSchema: z.ZodObject<{
|
|
350
|
+
name: z.ZodString;
|
|
351
|
+
kind: z.ZodLiteral<"OIDC">;
|
|
352
|
+
clientID: z.ZodString;
|
|
353
|
+
clientSecret: z.ZodObject<{
|
|
354
|
+
VaultName: z.ZodString;
|
|
355
|
+
SecretKey: z.ZodString;
|
|
356
|
+
}, z.core.$strip>;
|
|
357
|
+
providerURL: z.ZodString;
|
|
358
|
+
issuerURL: z.ZodOptional<z.ZodString>;
|
|
359
|
+
usernameClaim: z.ZodOptional<z.ZodString>;
|
|
360
|
+
}, z.core.$strip>;
|
|
361
|
+
declare const SAMLSchema: z.ZodObject<{
|
|
362
|
+
name: z.ZodString;
|
|
363
|
+
kind: z.ZodLiteral<"SAML">;
|
|
364
|
+
spCertBase64: z.ZodOptional<z.ZodObject<{
|
|
365
|
+
VaultName: z.ZodString;
|
|
366
|
+
SecretKey: z.ZodString;
|
|
367
|
+
}, z.core.$strip>>;
|
|
368
|
+
spKeyBase64: z.ZodOptional<z.ZodObject<{
|
|
369
|
+
VaultName: z.ZodString;
|
|
370
|
+
SecretKey: z.ZodString;
|
|
371
|
+
}, z.core.$strip>>;
|
|
372
|
+
metadataURL: z.ZodOptional<z.ZodString>;
|
|
373
|
+
rawMetadata: z.ZodOptional<z.ZodString>;
|
|
374
|
+
}, z.core.$strip>;
|
|
375
|
+
declare const IDTokenSchema: z.ZodObject<{
|
|
376
|
+
name: z.ZodString;
|
|
377
|
+
kind: z.ZodLiteral<"IDToken">;
|
|
378
|
+
providerURL: z.ZodString;
|
|
379
|
+
issuerURL: z.ZodOptional<z.ZodString>;
|
|
380
|
+
clientID: z.ZodString;
|
|
381
|
+
usernameClaim: z.ZodOptional<z.ZodString>;
|
|
382
|
+
}, z.core.$strip>;
|
|
383
|
+
declare const BuiltinIdPSchema: z.ZodObject<{
|
|
384
|
+
name: z.ZodString;
|
|
385
|
+
kind: z.ZodLiteral<"BuiltInIdP">;
|
|
386
|
+
namespace: z.ZodString;
|
|
387
|
+
clientName: z.ZodString;
|
|
388
|
+
}, z.core.$strip>;
|
|
389
|
+
declare const IdProviderSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
390
|
+
name: z.ZodString;
|
|
391
|
+
kind: z.ZodLiteral<"OIDC">;
|
|
392
|
+
clientID: z.ZodString;
|
|
393
|
+
clientSecret: z.ZodObject<{
|
|
394
|
+
VaultName: z.ZodString;
|
|
395
|
+
SecretKey: z.ZodString;
|
|
396
|
+
}, z.core.$strip>;
|
|
397
|
+
providerURL: z.ZodString;
|
|
398
|
+
issuerURL: z.ZodOptional<z.ZodString>;
|
|
399
|
+
usernameClaim: z.ZodOptional<z.ZodString>;
|
|
400
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
401
|
+
name: z.ZodString;
|
|
402
|
+
kind: z.ZodLiteral<"SAML">;
|
|
403
|
+
spCertBase64: z.ZodOptional<z.ZodObject<{
|
|
404
|
+
VaultName: z.ZodString;
|
|
405
|
+
SecretKey: z.ZodString;
|
|
406
|
+
}, z.core.$strip>>;
|
|
407
|
+
spKeyBase64: z.ZodOptional<z.ZodObject<{
|
|
408
|
+
VaultName: z.ZodString;
|
|
409
|
+
SecretKey: z.ZodString;
|
|
410
|
+
}, z.core.$strip>>;
|
|
411
|
+
metadataURL: z.ZodOptional<z.ZodString>;
|
|
412
|
+
rawMetadata: z.ZodOptional<z.ZodString>;
|
|
413
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
414
|
+
name: z.ZodString;
|
|
415
|
+
kind: z.ZodLiteral<"IDToken">;
|
|
416
|
+
providerURL: z.ZodString;
|
|
417
|
+
issuerURL: z.ZodOptional<z.ZodString>;
|
|
418
|
+
clientID: z.ZodString;
|
|
419
|
+
usernameClaim: z.ZodOptional<z.ZodString>;
|
|
420
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
421
|
+
name: z.ZodString;
|
|
422
|
+
kind: z.ZodLiteral<"BuiltInIdP">;
|
|
423
|
+
namespace: z.ZodString;
|
|
424
|
+
clientName: z.ZodString;
|
|
425
|
+
}, z.core.$strip>], "kind">;
|
|
426
|
+
declare const OAuth2ClientGrantTypeSchema: z.ZodUnion<readonly [z.ZodLiteral<"authorization_code">, z.ZodLiteral<"refresh_token">]>;
|
|
427
|
+
declare const OAuth2ClientSchema: z.ZodObject<{
|
|
428
|
+
description: z.ZodOptional<z.ZodString>;
|
|
429
|
+
grantTypes: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"authorization_code">, z.ZodLiteral<"refresh_token">]>>>;
|
|
430
|
+
redirectURIs: z.ZodArray<z.ZodUnion<readonly [z.ZodTemplateLiteral<`https://${string}`>, z.ZodTemplateLiteral<`http://${string}`>, z.ZodTemplateLiteral<`${string}:url`>, z.ZodTemplateLiteral<`${string}:url/${string}`>]>>;
|
|
431
|
+
clientType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"confidential">, z.ZodLiteral<"public">, z.ZodLiteral<"browser">]>>;
|
|
432
|
+
}, z.core.$strip>;
|
|
433
|
+
declare const SCIMAuthorizationSchema: z.ZodObject<{
|
|
434
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<"oauth2">, z.ZodLiteral<"bearer">]>;
|
|
435
|
+
bearerSecret: z.ZodOptional<z.ZodObject<{
|
|
436
|
+
VaultName: z.ZodString;
|
|
437
|
+
SecretKey: z.ZodString;
|
|
438
|
+
}, z.core.$strip>>;
|
|
439
|
+
}, z.core.$strip>;
|
|
440
|
+
declare const SCIMAttributeTypeSchema: z.ZodUnion<readonly [z.ZodLiteral<"string">, z.ZodLiteral<"number">, z.ZodLiteral<"boolean">, z.ZodLiteral<"datetime">, z.ZodLiteral<"complex">]>;
|
|
441
|
+
declare const SCIMAttributeSchema: z.ZodObject<{
|
|
442
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<"string">, z.ZodLiteral<"number">, z.ZodLiteral<"boolean">, z.ZodLiteral<"datetime">, z.ZodLiteral<"complex">]>;
|
|
443
|
+
name: z.ZodString;
|
|
444
|
+
description: z.ZodOptional<z.ZodString>;
|
|
445
|
+
mutability: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"readOnly">, z.ZodLiteral<"readWrite">, z.ZodLiteral<"writeOnly">]>>;
|
|
446
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
447
|
+
multiValued: z.ZodOptional<z.ZodBoolean>;
|
|
448
|
+
uniqueness: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"server">, z.ZodLiteral<"global">]>>;
|
|
449
|
+
canonicalValues: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
450
|
+
subAttributes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject< /*elided*/any, z.core.$strip>>>>;
|
|
451
|
+
}, z.core.$strip>;
|
|
452
|
+
declare const SCIMAttributeMappingSchema: z.ZodObject<{
|
|
453
|
+
tailorDBField: z.ZodString;
|
|
454
|
+
scimPath: z.ZodString;
|
|
455
|
+
}, z.core.$strip>;
|
|
456
|
+
declare const SCIMResourceSchema: z.ZodObject<{
|
|
457
|
+
name: z.ZodString;
|
|
458
|
+
tailorDBNamespace: z.ZodString;
|
|
459
|
+
tailorDBType: z.ZodString;
|
|
460
|
+
coreSchema: z.ZodObject<{
|
|
461
|
+
name: z.ZodString;
|
|
462
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
463
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<"string">, z.ZodLiteral<"number">, z.ZodLiteral<"boolean">, z.ZodLiteral<"datetime">, z.ZodLiteral<"complex">]>;
|
|
464
|
+
name: z.ZodString;
|
|
465
|
+
description: z.ZodOptional<z.ZodString>;
|
|
466
|
+
mutability: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"readOnly">, z.ZodLiteral<"readWrite">, z.ZodLiteral<"writeOnly">]>>;
|
|
467
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
468
|
+
multiValued: z.ZodOptional<z.ZodBoolean>;
|
|
469
|
+
uniqueness: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"server">, z.ZodLiteral<"global">]>>;
|
|
470
|
+
canonicalValues: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
471
|
+
subAttributes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject< /*elided*/any, z.core.$strip>>>>;
|
|
472
|
+
}, z.core.$strip>>;
|
|
473
|
+
}, z.core.$strip>;
|
|
474
|
+
attributeMapping: z.ZodArray<z.ZodObject<{
|
|
475
|
+
tailorDBField: z.ZodString;
|
|
476
|
+
scimPath: z.ZodString;
|
|
477
|
+
}, z.core.$strip>>;
|
|
478
|
+
}, z.core.$strip>;
|
|
479
|
+
declare const SCIMSchema: z.ZodObject<{
|
|
480
|
+
machineUserName: z.ZodString;
|
|
481
|
+
authorization: z.ZodObject<{
|
|
482
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<"oauth2">, z.ZodLiteral<"bearer">]>;
|
|
483
|
+
bearerSecret: z.ZodOptional<z.ZodObject<{
|
|
484
|
+
VaultName: z.ZodString;
|
|
485
|
+
SecretKey: z.ZodString;
|
|
486
|
+
}, z.core.$strip>>;
|
|
487
|
+
}, z.core.$strip>;
|
|
488
|
+
resources: z.ZodArray<z.ZodObject<{
|
|
489
|
+
name: z.ZodString;
|
|
490
|
+
tailorDBNamespace: z.ZodString;
|
|
491
|
+
tailorDBType: z.ZodString;
|
|
492
|
+
coreSchema: z.ZodObject<{
|
|
493
|
+
name: z.ZodString;
|
|
494
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
495
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<"string">, z.ZodLiteral<"number">, z.ZodLiteral<"boolean">, z.ZodLiteral<"datetime">, z.ZodLiteral<"complex">]>;
|
|
496
|
+
name: z.ZodString;
|
|
497
|
+
description: z.ZodOptional<z.ZodString>;
|
|
498
|
+
mutability: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"readOnly">, z.ZodLiteral<"readWrite">, z.ZodLiteral<"writeOnly">]>>;
|
|
499
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
500
|
+
multiValued: z.ZodOptional<z.ZodBoolean>;
|
|
501
|
+
uniqueness: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"server">, z.ZodLiteral<"global">]>>;
|
|
502
|
+
canonicalValues: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
503
|
+
subAttributes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject< /*elided*/any, z.core.$strip>>>>;
|
|
504
|
+
}, z.core.$strip>>;
|
|
505
|
+
}, z.core.$strip>;
|
|
506
|
+
attributeMapping: z.ZodArray<z.ZodObject<{
|
|
507
|
+
tailorDBField: z.ZodString;
|
|
508
|
+
scimPath: z.ZodString;
|
|
509
|
+
}, z.core.$strip>>;
|
|
510
|
+
}, z.core.$strip>>;
|
|
511
|
+
}, z.core.$strip>;
|
|
512
|
+
declare const TenantProviderSchema: z.ZodObject<{
|
|
513
|
+
namespace: z.ZodString;
|
|
514
|
+
type: z.ZodString;
|
|
515
|
+
signatureField: z.ZodString;
|
|
516
|
+
}, z.core.$strip>;
|
|
517
|
+
//#endregion
|
|
518
|
+
//#region src/parser/service/auth/types.d.ts
|
|
519
|
+
type OIDC = z.output<typeof OIDCSchema>;
|
|
520
|
+
type SAML = z.output<typeof SAMLSchema>;
|
|
521
|
+
type IDToken = z.output<typeof IDTokenSchema>;
|
|
522
|
+
type BuiltinIdP = z.output<typeof BuiltinIdPSchema>;
|
|
523
|
+
type IdProviderConfig = z.output<typeof IdProviderSchema>;
|
|
524
|
+
type OAuth2ClientGrantType = z.output<typeof OAuth2ClientGrantTypeSchema>;
|
|
525
|
+
type OAuth2Client = z.output<typeof OAuth2ClientSchema>;
|
|
526
|
+
type SCIMAuthorization = z.output<typeof SCIMAuthorizationSchema>;
|
|
527
|
+
type SCIMAttributeType = z.output<typeof SCIMAttributeTypeSchema>;
|
|
528
|
+
type SCIMAttribute = z.output<typeof SCIMAttributeSchema>;
|
|
529
|
+
type SCIMAttributeMapping = z.output<typeof SCIMAttributeMappingSchema>;
|
|
530
|
+
type SCIMResource = z.output<typeof SCIMResourceSchema>;
|
|
531
|
+
type SCIMConfig = z.output<typeof SCIMSchema>;
|
|
532
|
+
type TenantProviderConfig = z.output<typeof TenantProviderSchema>;
|
|
533
|
+
type ValueOperand = string | boolean | string[] | boolean[];
|
|
534
|
+
type AuthAttributeValue = ValueOperand | null | undefined;
|
|
535
|
+
type UserFieldKeys<User extends TailorDBInstance> = keyof output<User> & string;
|
|
536
|
+
type FieldDefined<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = User["fields"][Key] extends {
|
|
537
|
+
_defined: infer Defined;
|
|
538
|
+
} ? Defined : never;
|
|
539
|
+
type FieldOutput$1<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = output<User>[Key];
|
|
540
|
+
type FieldIsRequired<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = undefined extends FieldOutput$1<User, Key> ? false : true;
|
|
541
|
+
type FieldIsOfType<User extends TailorDBInstance, Key extends UserFieldKeys<User>, Type extends string> = FieldDefined<User, Key> extends {
|
|
542
|
+
type: Type;
|
|
543
|
+
} ? true : false;
|
|
544
|
+
type FieldIsArray<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldDefined<User, Key> extends {
|
|
545
|
+
array: true;
|
|
546
|
+
} ? true : false;
|
|
547
|
+
type FieldIsUnique<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldDefined<User, Key> extends {
|
|
548
|
+
unique: true;
|
|
549
|
+
} ? true : false;
|
|
550
|
+
type FieldSupportsValueOperand<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldOutput$1<User, Key> extends ValueOperand | null | undefined ? true : false;
|
|
551
|
+
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>];
|
|
552
|
+
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>];
|
|
553
|
+
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>];
|
|
554
|
+
type UserAttributeMap<User extends TailorDBInstance> = { [K in UserAttributeKey<User>]?: true };
|
|
555
|
+
type DisallowExtraKeys<T, Allowed extends PropertyKey> = T & { [K in Exclude<keyof T, Allowed>]: never };
|
|
556
|
+
type AttributeListValue<User extends TailorDBInstance, Key extends UserAttributeListKey<User>> = Key extends keyof output<User> ? output<User>[Key] : never;
|
|
557
|
+
type AttributeListToTuple<User extends TailorDBInstance, AttributeList extends readonly UserAttributeListKey<User>[]> = { [Index in keyof AttributeList]: AttributeList[Index] extends UserAttributeListKey<User> ? AttributeListValue<User, AttributeList[Index]> : never };
|
|
558
|
+
type AttributeMapSelectedKeys<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>> = Extract<{ [K in keyof AttributeMap]-?: undefined extends AttributeMap[K] ? never : K }[keyof AttributeMap], UserAttributeKey<User>>;
|
|
559
|
+
type UserProfile<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[]> = {
|
|
560
|
+
type: User;
|
|
561
|
+
usernameField: UsernameFieldKey<User>;
|
|
562
|
+
attributes?: DisallowExtraKeys<AttributeMap, UserAttributeKey<User>>;
|
|
563
|
+
attributeList?: AttributeList;
|
|
564
|
+
};
|
|
565
|
+
type MachineUser<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User> = UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[] = []> = IsAny<User> extends true ? {
|
|
566
|
+
attributes: Record<string, AuthAttributeValue>;
|
|
567
|
+
attributeList?: string[];
|
|
568
|
+
} : (AttributeMapSelectedKeys<User, AttributeMap> extends never ? {
|
|
569
|
+
attributes?: never;
|
|
570
|
+
} : {
|
|
571
|
+
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 };
|
|
572
|
+
}) & ([] extends AttributeList ? {
|
|
573
|
+
attributeList?: never;
|
|
574
|
+
} : {
|
|
575
|
+
attributeList: AttributeListToTuple<User, AttributeList>;
|
|
576
|
+
});
|
|
577
|
+
type AuthServiceInput<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[], MachineUserNames extends string> = {
|
|
578
|
+
userProfile?: UserProfile<User, AttributeMap, AttributeList>;
|
|
579
|
+
machineUsers?: Record<MachineUserNames, MachineUser<User, AttributeMap, AttributeList>>;
|
|
580
|
+
oauth2Clients?: Record<string, OAuth2Client>;
|
|
581
|
+
idProvider?: IdProviderConfig;
|
|
582
|
+
scim?: SCIMConfig;
|
|
583
|
+
tenantProvider?: TenantProviderConfig;
|
|
584
|
+
};
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region src/configure/services/auth/index.d.ts
|
|
587
|
+
declare const authDefinitionBrand: unique symbol;
|
|
588
|
+
type AuthDefinitionBrand = {
|
|
589
|
+
readonly [authDefinitionBrand]: true;
|
|
590
|
+
};
|
|
591
|
+
declare function defineAuth<const Name extends string, const User extends TailorDBInstance, const AttributeMap extends UserAttributeMap<User>, const AttributeList extends UserAttributeListKey<User>[], const MachineUserNames extends string>(name: Name, config: AuthServiceInput<User, AttributeMap, AttributeList, MachineUserNames>): {
|
|
592
|
+
readonly name: Name;
|
|
593
|
+
readonly invoker: <M extends MachineUserNames>(machineUser: M) => {
|
|
594
|
+
readonly authName: Name;
|
|
595
|
+
readonly machineUser: M;
|
|
596
|
+
};
|
|
597
|
+
readonly userProfile?: {
|
|
598
|
+
type: User;
|
|
599
|
+
usernameField: UsernameFieldKey<User>;
|
|
600
|
+
attributes?: (AttributeMap & { [K in Exclude<keyof AttributeMap, UserAttributeKey<User>>]: never }) | undefined;
|
|
601
|
+
attributeList?: AttributeList | undefined;
|
|
602
|
+
} | undefined;
|
|
603
|
+
readonly machineUsers?: Record<MachineUserNames, type_fest0.IsAny<User> extends true ? {
|
|
604
|
+
attributes: Record<string, AuthAttributeValue>;
|
|
605
|
+
attributeList?: string[];
|
|
606
|
+
} : (Extract<{ [K_1 in keyof AttributeMap]-?: undefined extends AttributeMap[K_1] ? never : K_1 }[keyof AttributeMap], UserAttributeKey<User>> extends never ? {
|
|
607
|
+
attributes?: never;
|
|
608
|
+
} : {
|
|
609
|
+
attributes: { [K_2 in Extract<{ [K_1 in keyof AttributeMap]-?: undefined extends AttributeMap[K_1] ? never : K_1 }[keyof AttributeMap], UserAttributeKey<User>>]: K_2 extends keyof output<User> ? output<User>[K_2] : never } & { [K_3 in Exclude<keyof output<User>, Extract<{ [K_1 in keyof AttributeMap]-?: undefined extends AttributeMap[K_1] ? never : K_1 }[keyof AttributeMap], UserAttributeKey<User>>>]?: undefined };
|
|
610
|
+
}) & ([] extends AttributeList ? {
|
|
611
|
+
attributeList?: never;
|
|
612
|
+
} : {
|
|
613
|
+
attributeList: { [Index in keyof AttributeList]: AttributeList[Index] extends UserAttributeListKey<User> ? AttributeList[Index] extends infer T ? T extends AttributeList[Index] ? T extends keyof output<User> ? output<User>[T] : never : never : never : never };
|
|
614
|
+
})> | undefined;
|
|
615
|
+
readonly oauth2Clients?: Record<string, OAuth2Client>;
|
|
616
|
+
readonly idProvider?: IdProviderConfig;
|
|
617
|
+
readonly scim?: SCIMConfig;
|
|
618
|
+
readonly tenantProvider?: TenantProviderConfig;
|
|
619
|
+
} & AuthDefinitionBrand;
|
|
620
|
+
type AuthConfig = ReturnType<typeof defineAuth<string, any, any, any, string>>;
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region src/configure/services/tailordb/permission.d.ts
|
|
623
|
+
interface Permissions {
|
|
624
|
+
record?: StandardTailorTypePermission;
|
|
625
|
+
gql?: StandardTailorTypeGqlPermission;
|
|
626
|
+
}
|
|
627
|
+
type TailorTypePermission<User extends object = InferredAttributeMap, Type extends object = object> = {
|
|
628
|
+
create: readonly ActionPermission<"record", User, Type, false>[];
|
|
629
|
+
read: readonly ActionPermission<"record", User, Type, false>[];
|
|
630
|
+
update: readonly ActionPermission<"record", User, Type, true>[];
|
|
631
|
+
delete: readonly ActionPermission<"record", User, Type, false>[];
|
|
632
|
+
};
|
|
633
|
+
type StandardTailorTypePermission = {
|
|
634
|
+
create: readonly StandardActionPermission<"record", false>[];
|
|
635
|
+
read: readonly StandardActionPermission<"record", false>[];
|
|
636
|
+
update: readonly StandardActionPermission<"record", true>[];
|
|
637
|
+
delete: readonly StandardActionPermission<"record", false>[];
|
|
638
|
+
};
|
|
639
|
+
type ActionPermission<Level extends "record" | "gql" = "record" | "gql", User extends object = InferredAttributeMap, Type extends object = object, Update extends boolean = boolean> = {
|
|
640
|
+
conditions: PermissionCondition<Level, User, Update, Type> | readonly PermissionCondition<Level, User, Update, Type>[];
|
|
641
|
+
description?: string | undefined;
|
|
642
|
+
permit?: boolean;
|
|
643
|
+
} | readonly [...PermissionCondition<Level, User, Update, Type>, ...([] | [boolean])] | readonly [...PermissionCondition<Level, User, Update, Type>[], ...([] | [boolean])];
|
|
644
|
+
type StandardActionPermission<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = {
|
|
645
|
+
conditions: readonly StandardPermissionCondition<Level, Update>[];
|
|
646
|
+
description?: string;
|
|
647
|
+
permit: "allow" | "deny";
|
|
648
|
+
};
|
|
649
|
+
type TailorTypeGqlPermission<User extends object = InferredAttributeMap, Type extends object = object> = readonly GqlPermissionPolicy<User, Type>[];
|
|
650
|
+
type StandardTailorTypeGqlPermission = readonly StandardGqlPermissionPolicy[];
|
|
651
|
+
type GqlPermissionPolicy<User extends object = InferredAttributeMap, Type extends object = object> = {
|
|
652
|
+
conditions: readonly PermissionCondition<"gql", User, boolean, Type>[];
|
|
653
|
+
actions: "all" | readonly GqlPermissionAction[];
|
|
654
|
+
permit?: boolean;
|
|
655
|
+
description?: string;
|
|
656
|
+
};
|
|
657
|
+
type StandardGqlPermissionPolicy = {
|
|
658
|
+
conditions: readonly StandardPermissionCondition<"gql">[];
|
|
659
|
+
actions: readonly ["all"] | readonly GqlPermissionAction[];
|
|
660
|
+
permit: "allow" | "deny";
|
|
661
|
+
description?: string;
|
|
662
|
+
};
|
|
663
|
+
type GqlPermissionAction = "read" | "create" | "update" | "delete" | "aggregate" | "bulkUpsert";
|
|
664
|
+
type PermissionCondition<Level extends "record" | "gql" = "record" | "gql", User extends object = InferredAttributeMap, Update extends boolean = boolean, Type extends object = object> = readonly [PermissionOperand<Level, User, Type, Update>, PermissionOperator, PermissionOperand<Level, User, Type, Update>];
|
|
665
|
+
type StandardPermissionCondition<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = readonly [PermissionOperand<Level, Record<string, unknown>, Record<string, unknown>, Update>, StandardPermissionOperator, PermissionOperand<Level, Record<string, unknown>, Record<string, unknown>, Update>];
|
|
666
|
+
type UserOperand<User extends object = InferredAttributeMap> = {
|
|
667
|
+
user: { [K in keyof User]: User[K] extends string | string[] | boolean | boolean[] ? K : never }[keyof User] | "id" | "_loggedIn";
|
|
668
|
+
};
|
|
669
|
+
type RecordOperand<Type extends object, Update extends boolean = false> = Update extends true ? {
|
|
670
|
+
oldRecord: (keyof Type & string) | "id";
|
|
671
|
+
} | {
|
|
672
|
+
newRecord: (keyof Type & string) | "id";
|
|
673
|
+
} : {
|
|
674
|
+
record: (keyof Type & string) | "id";
|
|
675
|
+
};
|
|
676
|
+
type PermissionOperand<Level extends "record" | "gql" = "record" | "gql", User extends object = InferredAttributeMap, Type extends object = object, Update extends boolean = boolean> = UserOperand<User> | ValueOperand | (Level extends "record" ? RecordOperand<Type, Update> : never);
|
|
677
|
+
type PermissionOperator = "=" | "!=" | "in" | "not in";
|
|
678
|
+
declare const operatorMap: {
|
|
679
|
+
readonly "=": "eq";
|
|
680
|
+
readonly "!=": "ne";
|
|
681
|
+
readonly in: "in";
|
|
682
|
+
readonly "not in": "nin";
|
|
683
|
+
};
|
|
684
|
+
type StandardPermissionOperator = (typeof operatorMap)[keyof typeof operatorMap];
|
|
685
|
+
//#endregion
|
|
686
|
+
//#region src/configure/services/tailordb/operator-types.d.ts
|
|
687
|
+
interface TailorDBTypeConfig {
|
|
688
|
+
name: string;
|
|
689
|
+
schema: {
|
|
690
|
+
description?: string;
|
|
691
|
+
extends: boolean;
|
|
692
|
+
fields: Record<string, OperatorFieldConfig>;
|
|
693
|
+
settings?: {
|
|
694
|
+
pluralForm?: string;
|
|
695
|
+
aggregation?: boolean;
|
|
696
|
+
bulkUpsert?: boolean;
|
|
697
|
+
};
|
|
698
|
+
permissions: Permissions;
|
|
699
|
+
files: Record<string, string>;
|
|
700
|
+
indexes?: Record<string, {
|
|
701
|
+
fields: string[];
|
|
702
|
+
unique?: boolean;
|
|
703
|
+
}>;
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
//#endregion
|
|
707
|
+
//#region src/configure/services/tailordb/types.d.ts
|
|
708
|
+
type SerialConfig<T extends "string" | "integer" = "string" | "integer"> = Prettify<{
|
|
709
|
+
start: number;
|
|
710
|
+
maxValue?: number;
|
|
711
|
+
} & (T extends "string" ? {
|
|
712
|
+
format?: string;
|
|
713
|
+
} : object)>;
|
|
714
|
+
interface DBFieldMetadata extends FieldMetadata {
|
|
715
|
+
index?: boolean;
|
|
716
|
+
unique?: boolean;
|
|
717
|
+
vector?: boolean;
|
|
718
|
+
foreignKey?: boolean;
|
|
719
|
+
foreignKeyType?: string;
|
|
720
|
+
foreignKeyField?: string;
|
|
721
|
+
hooks?: Hook<any, any>;
|
|
722
|
+
serial?: SerialConfig;
|
|
723
|
+
relation?: boolean;
|
|
724
|
+
}
|
|
725
|
+
interface DefinedDBFieldMetadata extends DefinedFieldMetadata {
|
|
726
|
+
index?: boolean;
|
|
727
|
+
unique?: boolean;
|
|
728
|
+
vector?: boolean;
|
|
729
|
+
foreignKey?: boolean;
|
|
730
|
+
foreignKeyType?: boolean;
|
|
731
|
+
validate?: boolean;
|
|
732
|
+
hooks?: {
|
|
733
|
+
create: boolean;
|
|
734
|
+
update: boolean;
|
|
735
|
+
};
|
|
736
|
+
serial?: boolean;
|
|
737
|
+
relation?: boolean;
|
|
738
|
+
}
|
|
739
|
+
type ExcludeNestedDBFields<T extends Record<string, TailorDBField<any, any>>> = { [K in keyof T]: T[K] extends TailorDBField<{
|
|
740
|
+
type: "nested";
|
|
741
|
+
array: boolean;
|
|
742
|
+
}, any> ? never : T[K] };
|
|
743
|
+
type HookFn<TValue, TData, TReturn> = (args: {
|
|
744
|
+
value: TValue;
|
|
745
|
+
data: TData extends Record<string, unknown> ? { readonly [K in keyof TData]?: TData[K] | null | undefined } : unknown;
|
|
746
|
+
user: TailorUser;
|
|
747
|
+
}) => TReturn;
|
|
748
|
+
type Hook<TData, TReturn> = {
|
|
749
|
+
create?: HookFn<TReturn | null, TData, TReturn>;
|
|
750
|
+
update?: HookFn<TReturn | null, TData, TReturn>;
|
|
751
|
+
};
|
|
752
|
+
type Hooks<F extends Record<string, TailorDBField<any, any>>, TData = { [K in keyof F]: output<F[K]> }> = NonEmptyObject<{ [K in Exclude<keyof F, "id"> as F[K]["_defined"] extends {
|
|
753
|
+
hooks: unknown;
|
|
754
|
+
} ? never : F[K]["_defined"] extends {
|
|
755
|
+
type: "nested";
|
|
756
|
+
} ? never : K]?: Hook<TData, output<F[K]>> }>;
|
|
757
|
+
type TailorDBServiceConfig = {
|
|
758
|
+
files: string[];
|
|
759
|
+
ignores?: string[];
|
|
760
|
+
};
|
|
761
|
+
type TailorDBServiceInput = {
|
|
762
|
+
[namespace: string]: TailorDBServiceConfig;
|
|
763
|
+
};
|
|
764
|
+
type IndexDef<T extends {
|
|
765
|
+
fields: Record<PropertyKey, unknown>;
|
|
766
|
+
}> = {
|
|
767
|
+
fields: [keyof T["fields"], keyof T["fields"], ...(keyof T["fields"])[]];
|
|
768
|
+
unique?: boolean;
|
|
769
|
+
name?: string;
|
|
770
|
+
};
|
|
771
|
+
interface TypeFeatures {
|
|
772
|
+
pluralForm?: string;
|
|
773
|
+
aggregation?: true;
|
|
774
|
+
bulkUpsert?: true;
|
|
775
|
+
}
|
|
776
|
+
//#endregion
|
|
777
|
+
//#region src/configure/services/tailordb/schema.d.ts
|
|
778
|
+
type RelationType = "oneToOne" | "1-1" | "manyToOne" | "n-1" | "N-1" | "keyOnly";
|
|
779
|
+
interface RelationConfig<S extends RelationType, T extends TailorDBType> {
|
|
780
|
+
type: S;
|
|
781
|
+
toward: {
|
|
782
|
+
type: T;
|
|
783
|
+
as?: string;
|
|
784
|
+
key?: keyof T["fields"] & string;
|
|
785
|
+
};
|
|
786
|
+
backward?: string;
|
|
787
|
+
}
|
|
788
|
+
type RelationSelfConfig = {
|
|
789
|
+
type: "oneToOne" | "1-1" | "manyToOne" | "n-1" | "N-1" | "keyOnly";
|
|
790
|
+
toward: {
|
|
791
|
+
type: "self";
|
|
792
|
+
as?: string;
|
|
793
|
+
key?: string;
|
|
794
|
+
};
|
|
795
|
+
backward?: string;
|
|
796
|
+
};
|
|
797
|
+
interface ReferenceConfig<T extends TailorDBType<any, any>> {
|
|
798
|
+
type: TailorDBType<any, any>;
|
|
799
|
+
key: keyof T["fields"] & string;
|
|
800
|
+
nameMap: [string | undefined, string];
|
|
801
|
+
}
|
|
802
|
+
declare class TailorDBField<const Defined extends DefinedDBFieldMetadata, const Output> extends TailorField<Defined, Output, DBFieldMetadata> {
|
|
803
|
+
private _ref;
|
|
804
|
+
private _pendingSelfRelation;
|
|
805
|
+
get reference(): Readonly<ReferenceConfig<TailorDBType>> | undefined;
|
|
806
|
+
get metadata(): {
|
|
807
|
+
index?: boolean;
|
|
808
|
+
unique?: boolean;
|
|
809
|
+
vector?: boolean;
|
|
810
|
+
foreignKey?: boolean;
|
|
811
|
+
foreignKeyType?: string;
|
|
812
|
+
foreignKeyField?: string;
|
|
813
|
+
hooks?: Hook<any, any>;
|
|
814
|
+
serial?: SerialConfig;
|
|
815
|
+
relation?: boolean;
|
|
816
|
+
description?: string;
|
|
817
|
+
required?: boolean;
|
|
818
|
+
array?: boolean;
|
|
819
|
+
allowedValues?: AllowedValue[];
|
|
820
|
+
validate?: FieldValidateInput<any>[];
|
|
821
|
+
typeName?: string;
|
|
822
|
+
};
|
|
823
|
+
get config(): OperatorFieldConfig;
|
|
824
|
+
private constructor();
|
|
825
|
+
static create<const T extends TailorFieldType, const TOptions extends FieldOptions>(type: T, options?: TOptions, fields?: Record<string, TailorDBField<any, any>>, values?: AllowedValues): TailorDBField<{
|
|
826
|
+
type: T;
|
|
827
|
+
array: TOptions extends {
|
|
828
|
+
array: true;
|
|
829
|
+
} ? true : false;
|
|
830
|
+
}, FieldOutput<TailorToTs[T], TOptions>>;
|
|
831
|
+
description<CurrentDefined extends Defined>(this: CurrentDefined extends {
|
|
832
|
+
description: unknown;
|
|
833
|
+
} ? never : TailorField<CurrentDefined, Output>, description: string): TailorDBField<Prettify<CurrentDefined & {
|
|
834
|
+
description: true;
|
|
835
|
+
}>, Output>;
|
|
836
|
+
relation<S extends RelationType, T extends TailorDBType<any, any>, CurrentDefined extends Defined>(this: CurrentDefined extends {
|
|
837
|
+
relation: unknown;
|
|
838
|
+
} ? never : TailorDBField<CurrentDefined, Output>, config: RelationConfig<S, T>): TailorDBField<S extends "oneToOne" | "1-1" ? Prettify<CurrentDefined & {
|
|
839
|
+
unique: true;
|
|
840
|
+
index: true;
|
|
841
|
+
relation: true;
|
|
842
|
+
}> : Prettify<CurrentDefined & {
|
|
843
|
+
index: true;
|
|
844
|
+
relation: true;
|
|
845
|
+
}>, Output>;
|
|
846
|
+
relation<S extends RelationSelfConfig, CurrentDefined extends Defined>(this: CurrentDefined extends {
|
|
847
|
+
relation: unknown;
|
|
848
|
+
} ? never : TailorDBField<CurrentDefined, Output>, config: S): TailorDBField<S["type"] extends "oneToOne" | "1-1" ? Prettify<CurrentDefined & {
|
|
849
|
+
unique: true;
|
|
850
|
+
index: true;
|
|
851
|
+
relation: true;
|
|
852
|
+
}> : Prettify<CurrentDefined & {
|
|
853
|
+
index: true;
|
|
854
|
+
relation: true;
|
|
855
|
+
}>, Output>;
|
|
856
|
+
index<CurrentDefined extends Defined>(this: CurrentDefined extends {
|
|
857
|
+
index: unknown;
|
|
858
|
+
} ? never : TailorDBField<CurrentDefined, Output>): TailorDBField<Prettify<CurrentDefined & {
|
|
859
|
+
index: true;
|
|
860
|
+
}>, Output>;
|
|
861
|
+
unique<CurrentDefined extends Defined>(this: CurrentDefined extends {
|
|
862
|
+
unique: unknown;
|
|
863
|
+
} ? never : TailorDBField<CurrentDefined, Output>): TailorDBField<Prettify<CurrentDefined & {
|
|
864
|
+
unique: true;
|
|
865
|
+
index: true;
|
|
866
|
+
}>, Output>;
|
|
867
|
+
vector<CurrentDefined extends Defined>(this: CurrentDefined extends {
|
|
868
|
+
vector: unknown;
|
|
869
|
+
} ? never : CurrentDefined extends {
|
|
870
|
+
type: "string";
|
|
871
|
+
array: false;
|
|
872
|
+
} ? TailorDBField<CurrentDefined, Output> : never): TailorDBField<Prettify<CurrentDefined & {
|
|
873
|
+
vector: true;
|
|
874
|
+
}>, Output>;
|
|
875
|
+
hooks<CurrentDefined extends Defined, const H extends Hook<unknown, Output>>(this: CurrentDefined extends {
|
|
876
|
+
hooks: unknown;
|
|
877
|
+
} ? never : CurrentDefined extends {
|
|
878
|
+
type: "nested";
|
|
879
|
+
} ? never : TailorDBField<CurrentDefined, Output>, hooks: H): TailorDBField<Prettify<CurrentDefined & {
|
|
880
|
+
hooks?: {
|
|
881
|
+
create: H extends {
|
|
882
|
+
create: unknown;
|
|
883
|
+
} ? true : false;
|
|
884
|
+
update: H extends {
|
|
885
|
+
update: unknown;
|
|
886
|
+
} ? true : false;
|
|
887
|
+
};
|
|
888
|
+
serial: false;
|
|
889
|
+
}>, Output>;
|
|
890
|
+
validate<CurrentDefined extends Defined>(this: CurrentDefined extends {
|
|
891
|
+
validate: unknown;
|
|
892
|
+
} ? never : TailorDBField<CurrentDefined, Output>, ...validate: FieldValidateInput<Output>[]): TailorDBField<Prettify<CurrentDefined & {
|
|
893
|
+
validate: true;
|
|
894
|
+
}>, Output>;
|
|
895
|
+
serial<CurrentDefined extends Defined>(this: CurrentDefined extends {
|
|
896
|
+
serial: unknown;
|
|
897
|
+
} ? never : Output extends null ? never : CurrentDefined extends {
|
|
898
|
+
type: "integer" | "string";
|
|
899
|
+
array: false;
|
|
900
|
+
} ? TailorDBField<CurrentDefined, Output> : never, config: SerialConfig<CurrentDefined["type"] & ("integer" | "string")>): TailorDBField<Prettify<CurrentDefined & {
|
|
901
|
+
serial: true;
|
|
902
|
+
hooks: {
|
|
903
|
+
create: false;
|
|
904
|
+
update: false;
|
|
905
|
+
};
|
|
906
|
+
}>, Output>;
|
|
907
|
+
/**
|
|
908
|
+
* Clone the field with optional overrides for field options
|
|
909
|
+
* @param options - Optional field options to override
|
|
910
|
+
* @returns A new TailorDBField instance with the same configuration
|
|
911
|
+
*/
|
|
912
|
+
clone<const NewOpt extends FieldOptions>(options?: NewOpt): TailorDBField<Prettify<Omit<Defined, "array"> & {
|
|
913
|
+
array: NewOpt extends {
|
|
914
|
+
array: true;
|
|
915
|
+
} ? true : Defined["array"];
|
|
916
|
+
}>, FieldOutput<TailorToTs[Defined["type"]], NewOpt>>;
|
|
917
|
+
}
|
|
918
|
+
declare function uuid<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
919
|
+
type: "uuid";
|
|
920
|
+
array: Opt extends {
|
|
921
|
+
array: true;
|
|
922
|
+
} ? true : false;
|
|
923
|
+
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
924
|
+
declare function string<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
925
|
+
type: "string";
|
|
926
|
+
array: Opt extends {
|
|
927
|
+
array: true;
|
|
928
|
+
} ? true : false;
|
|
929
|
+
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
930
|
+
declare function bool<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
931
|
+
type: "boolean";
|
|
932
|
+
array: Opt extends {
|
|
933
|
+
array: true;
|
|
934
|
+
} ? true : false;
|
|
935
|
+
}, Opt["optional"] extends true ? ArrayFieldOutput<boolean, Opt> | null : ArrayFieldOutput<boolean, Opt>>;
|
|
936
|
+
declare function int<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
937
|
+
type: "integer";
|
|
938
|
+
array: Opt extends {
|
|
939
|
+
array: true;
|
|
940
|
+
} ? true : false;
|
|
941
|
+
}, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
|
|
942
|
+
declare function float<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
943
|
+
type: "float";
|
|
944
|
+
array: Opt extends {
|
|
945
|
+
array: true;
|
|
946
|
+
} ? true : false;
|
|
947
|
+
}, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
|
|
948
|
+
declare function date<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
949
|
+
type: "date";
|
|
950
|
+
array: Opt extends {
|
|
951
|
+
array: true;
|
|
952
|
+
} ? true : false;
|
|
953
|
+
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
954
|
+
declare function datetime<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
955
|
+
type: "datetime";
|
|
956
|
+
array: Opt extends {
|
|
957
|
+
array: true;
|
|
958
|
+
} ? true : false;
|
|
959
|
+
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
960
|
+
declare function time<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
|
|
961
|
+
type: "time";
|
|
962
|
+
array: Opt extends {
|
|
963
|
+
array: true;
|
|
964
|
+
} ? true : false;
|
|
965
|
+
}, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
|
|
966
|
+
declare function _enum<const V extends AllowedValues>(...values: V): TailorDBField<{
|
|
967
|
+
type: "enum";
|
|
968
|
+
array: false;
|
|
969
|
+
}, FieldOutput<AllowedValuesOutput<V>, {
|
|
970
|
+
optional: false;
|
|
971
|
+
array: false;
|
|
972
|
+
}>>;
|
|
973
|
+
declare function _enum<const V extends AllowedValues, const Opt extends FieldOptions>(...args: [...V, Opt]): TailorDBField<{
|
|
974
|
+
type: "enum";
|
|
975
|
+
array: Opt extends {
|
|
976
|
+
array: true;
|
|
977
|
+
} ? true : false;
|
|
978
|
+
}, FieldOutput<AllowedValuesOutput<V>, Opt>>;
|
|
979
|
+
declare function object<const F extends Record<string, TailorDBField<any, any>> & ExcludeNestedDBFields<F>, const Opt extends FieldOptions>(fields: F, options?: Opt): TailorDBField<{
|
|
980
|
+
type: "nested";
|
|
981
|
+
array: Opt extends {
|
|
982
|
+
array: true;
|
|
983
|
+
} ? true : false;
|
|
984
|
+
}, FieldOutput<InferFieldsOutput<F>, Opt>>;
|
|
985
|
+
declare class TailorDBType<const Fields extends Record<string, TailorDBField<any, any>> = any, User extends object = InferredAttributeMap> {
|
|
986
|
+
readonly name: string;
|
|
987
|
+
readonly fields: Fields;
|
|
988
|
+
readonly _output: InferFieldsOutput<Fields>;
|
|
989
|
+
_description?: string;
|
|
990
|
+
readonly referenced: Record<string, [TailorDBType<any, any>, string]>;
|
|
991
|
+
private _settings;
|
|
992
|
+
private _indexes;
|
|
993
|
+
private _permissions;
|
|
994
|
+
private _files;
|
|
995
|
+
constructor(name: string, fields: Fields, options: {
|
|
996
|
+
pluralForm?: string;
|
|
997
|
+
description?: string;
|
|
998
|
+
});
|
|
999
|
+
get metadata(): TailorDBTypeConfig;
|
|
1000
|
+
hooks(hooks: Hooks<Fields>): this;
|
|
1001
|
+
validate(validators: Validators<Fields>): this;
|
|
1002
|
+
features(features: Omit<TypeFeatures, "pluralForm">): this;
|
|
1003
|
+
indexes(...indexes: IndexDef<this>[]): this;
|
|
1004
|
+
files<const F extends string>(files: Record<F, string> & Partial<Record<keyof output<this>, never>>): this;
|
|
1005
|
+
permission<U extends object = User, P extends TailorTypePermission<U, output<this>> = TailorTypePermission<U, output<this>>>(permission: P): TailorDBType<Fields, U>;
|
|
1006
|
+
gqlPermission<U extends object = User, P extends TailorTypeGqlPermission<U> = TailorTypeGqlPermission<U>>(permission: P): TailorDBType<Fields, U>;
|
|
1007
|
+
description(description: string): this;
|
|
1008
|
+
/**
|
|
1009
|
+
* Pick specific fields from the type
|
|
1010
|
+
* @param keys - Array of field keys to pick
|
|
1011
|
+
* @param options - Optional field options to apply to picked fields
|
|
1012
|
+
* @returns An object containing only the specified fields
|
|
1013
|
+
*/
|
|
1014
|
+
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"> & {
|
|
1015
|
+
array: Opt extends {
|
|
1016
|
+
array: true;
|
|
1017
|
+
} ? true : D["array"];
|
|
1018
|
+
}, FieldOutput<TailorToTs[D["type"]], Opt>> : never };
|
|
1019
|
+
/**
|
|
1020
|
+
* Omit specific fields from the type
|
|
1021
|
+
* @param keys - Array of field keys to omit
|
|
1022
|
+
* @returns An object containing all fields except the specified ones
|
|
1023
|
+
*/
|
|
1024
|
+
omitFields<K extends keyof Fields>(keys: K[]): Omit<Fields, K>;
|
|
1025
|
+
}
|
|
1026
|
+
type TailorDBInstance<Fields extends Record<string, TailorDBField<any, any>> = any, User extends object = InferredAttributeMap> = InstanceType<typeof TailorDBType<Fields, User>>;
|
|
1027
|
+
declare const idField: TailorDBField<{
|
|
1028
|
+
type: "uuid";
|
|
1029
|
+
array: false;
|
|
1030
|
+
}, string>;
|
|
1031
|
+
type idField = typeof idField;
|
|
1032
|
+
type DBType<F extends {
|
|
1033
|
+
id?: never;
|
|
1034
|
+
} & Record<string, TailorDBField<any, any>>> = TailorDBInstance<{
|
|
1035
|
+
id: idField;
|
|
1036
|
+
} & F>;
|
|
1037
|
+
/**
|
|
1038
|
+
* Creates a new database type with the specified fields
|
|
1039
|
+
* @param name - The name of the type, or a tuple of [name, pluralForm]
|
|
1040
|
+
* @param fields - The field definitions for the type
|
|
1041
|
+
* @returns A new TailorDBType instance
|
|
1042
|
+
*/
|
|
1043
|
+
declare function dbType<const F extends {
|
|
1044
|
+
id?: never;
|
|
1045
|
+
} & Record<string, TailorDBField<any, any>>>(name: string | [string, string], fields: F): DBType<F>;
|
|
1046
|
+
/**
|
|
1047
|
+
* Creates a new database type with the specified fields and description
|
|
1048
|
+
* @param name - The name of the type, or a tuple of [name, pluralForm]
|
|
1049
|
+
* @param description - A description of the type
|
|
1050
|
+
* @param fields - The field definitions for the type
|
|
1051
|
+
* @returns A new TailorDBType instance
|
|
1052
|
+
*/
|
|
1053
|
+
declare function dbType<const F extends {
|
|
1054
|
+
id?: never;
|
|
1055
|
+
} & Record<string, TailorDBField<any, any>>>(name: string | [string, string], description: string, fields: F): DBType<F>;
|
|
1056
|
+
declare const db: {
|
|
1057
|
+
type: typeof dbType;
|
|
1058
|
+
uuid: typeof uuid;
|
|
1059
|
+
string: typeof string;
|
|
1060
|
+
bool: typeof bool;
|
|
1061
|
+
int: typeof int;
|
|
1062
|
+
float: typeof float;
|
|
1063
|
+
date: typeof date;
|
|
1064
|
+
datetime: typeof datetime;
|
|
1065
|
+
time: typeof time;
|
|
1066
|
+
enum: typeof _enum;
|
|
1067
|
+
object: typeof object;
|
|
1068
|
+
fields: {
|
|
1069
|
+
timestamps: () => {
|
|
1070
|
+
createdAt: TailorDBField<{
|
|
1071
|
+
type: "datetime";
|
|
1072
|
+
array: false;
|
|
1073
|
+
hooks?: {
|
|
1074
|
+
create: true;
|
|
1075
|
+
update: false;
|
|
1076
|
+
} | undefined;
|
|
1077
|
+
serial: false;
|
|
1078
|
+
description: true;
|
|
1079
|
+
}, string>;
|
|
1080
|
+
updatedAt: TailorDBField<{
|
|
1081
|
+
type: "datetime";
|
|
1082
|
+
array: false;
|
|
1083
|
+
hooks?: {
|
|
1084
|
+
create: false;
|
|
1085
|
+
update: true;
|
|
1086
|
+
} | undefined;
|
|
1087
|
+
serial: false;
|
|
1088
|
+
description: true;
|
|
1089
|
+
}, string | null>;
|
|
1090
|
+
};
|
|
1091
|
+
};
|
|
1092
|
+
};
|
|
1093
|
+
//#endregion
|
|
1094
|
+
//#region src/configure/services/executor/types.d.ts
|
|
1095
|
+
type ExecutorServiceConfig = {
|
|
1096
|
+
files: string[];
|
|
1097
|
+
ignores?: string[];
|
|
1098
|
+
};
|
|
1099
|
+
type ExecutorServiceInput = ExecutorServiceConfig;
|
|
1100
|
+
//#endregion
|
|
1101
|
+
//#region src/configure/services/resolver/types.d.ts
|
|
1102
|
+
type ResolverServiceConfig = {
|
|
1103
|
+
files: string[];
|
|
1104
|
+
ignores?: string[];
|
|
1105
|
+
};
|
|
1106
|
+
type ResolverServiceInput = {
|
|
1107
|
+
[namespace: string]: ResolverServiceConfig;
|
|
1108
|
+
};
|
|
1109
|
+
//#endregion
|
|
1110
|
+
//#region src/parser/service/idp/schema.d.ts
|
|
1111
|
+
declare const IdPSchema: z.core.$ZodBranded<z.ZodObject<{
|
|
1112
|
+
name: z.ZodString;
|
|
1113
|
+
authorization: z.ZodUnion<readonly [z.ZodLiteral<"insecure">, z.ZodLiteral<"loggedIn">, z.ZodObject<{
|
|
1114
|
+
cel: z.ZodString;
|
|
1115
|
+
}, z.core.$strip>]>;
|
|
1116
|
+
clients: z.ZodArray<z.ZodString>;
|
|
1117
|
+
}, z.core.$strip>, "IdPConfig">;
|
|
1118
|
+
//#endregion
|
|
1119
|
+
//#region src/parser/service/idp/types.d.ts
|
|
1120
|
+
type IdPInput = z.input<typeof IdPSchema>;
|
|
1121
|
+
//#endregion
|
|
1122
|
+
//#region src/configure/services/idp/index.d.ts
|
|
1123
|
+
declare const idpDefinitionBrand: unique symbol;
|
|
1124
|
+
type IdpDefinitionBrand = {
|
|
1125
|
+
readonly [idpDefinitionBrand]: true;
|
|
1126
|
+
};
|
|
1127
|
+
declare function defineIdp<const TClients extends string[]>(name: string, config: Omit<IdPInput, "name" | "clients"> & {
|
|
1128
|
+
clients: TClients;
|
|
1129
|
+
}): {
|
|
1130
|
+
readonly name: string;
|
|
1131
|
+
readonly provider: (providerName: string, clientName: TClients[number]) => {
|
|
1132
|
+
readonly name: string;
|
|
1133
|
+
readonly kind: "BuiltInIdP";
|
|
1134
|
+
readonly namespace: string;
|
|
1135
|
+
readonly clientName: TClients[number];
|
|
1136
|
+
};
|
|
1137
|
+
readonly authorization: "insecure" | "loggedIn" | {
|
|
1138
|
+
cel: string;
|
|
1139
|
+
};
|
|
1140
|
+
readonly clients: TClients;
|
|
1141
|
+
} & IdpDefinitionBrand;
|
|
1142
|
+
type IdPConfig = Omit<ReturnType<typeof defineIdp>, "provider">;
|
|
1143
|
+
//#endregion
|
|
1144
|
+
//#region src/parser/service/staticwebsite/schema.d.ts
|
|
1145
|
+
declare const StaticWebsiteSchema: z.core.$ZodBranded<z.ZodObject<{
|
|
1146
|
+
name: z.ZodString;
|
|
1147
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1148
|
+
allowedIpAddresses: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1149
|
+
}, z.core.$strip>, "StaticWebsiteConfig">;
|
|
1150
|
+
//#endregion
|
|
1151
|
+
//#region src/parser/service/staticwebsite/types.d.ts
|
|
1152
|
+
type StaticWebsiteInput = z.input<typeof StaticWebsiteSchema>;
|
|
1153
|
+
//#endregion
|
|
1154
|
+
//#region src/configure/services/staticwebsite/index.d.ts
|
|
1155
|
+
declare const staticWebsiteDefinitionBrand: unique symbol;
|
|
1156
|
+
type StaticWebsiteDefinitionBrand = {
|
|
1157
|
+
readonly [staticWebsiteDefinitionBrand]: true;
|
|
1158
|
+
};
|
|
1159
|
+
declare function defineStaticWebSite(name: string, config: Omit<StaticWebsiteInput, "name">): {
|
|
1160
|
+
readonly name: string;
|
|
1161
|
+
readonly url: `${string}:url`;
|
|
1162
|
+
readonly description?: string | undefined;
|
|
1163
|
+
readonly allowedIpAddresses?: string[] | undefined;
|
|
1164
|
+
} & StaticWebsiteDefinitionBrand;
|
|
1165
|
+
type StaticWebsiteConfig = Omit<ReturnType<typeof defineStaticWebSite>, "url">;
|
|
1166
|
+
//#endregion
|
|
1167
|
+
//#region src/parser/generator-config/index.d.ts
|
|
1168
|
+
declare const CodeGeneratorSchema: z.ZodObject<{
|
|
1169
|
+
id: z.ZodString;
|
|
1170
|
+
description: z.ZodString;
|
|
1171
|
+
processType: z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
1172
|
+
processResolver: z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
1173
|
+
processExecutor: z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
1174
|
+
processTailorDBNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
1175
|
+
processResolverNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
1176
|
+
aggregate: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodAny>;
|
|
1177
|
+
}, z.core.$strip>;
|
|
1178
|
+
declare const BaseGeneratorConfigSchema: z.ZodUnion<readonly [z.ZodTuple<[z.ZodLiteral<"@tailor-platform/kysely-type">, z.ZodObject<{
|
|
1179
|
+
distPath: z.ZodString;
|
|
1180
|
+
}, z.core.$strip>], null>, z.ZodTuple<[z.ZodLiteral<"@tailor-platform/seed">, z.ZodObject<{
|
|
1181
|
+
distPath: z.ZodString;
|
|
1182
|
+
machineUserName: z.ZodOptional<z.ZodString>;
|
|
1183
|
+
}, z.core.$strip>], null>, z.ZodObject<{
|
|
1184
|
+
id: z.ZodString;
|
|
1185
|
+
description: z.ZodString;
|
|
1186
|
+
processType: z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
1187
|
+
processResolver: z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
1188
|
+
processExecutor: z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
1189
|
+
processTailorDBNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
1190
|
+
processResolverNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
1191
|
+
aggregate: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodAny>;
|
|
1192
|
+
}, z.core.$strip>]>;
|
|
1193
|
+
/**
|
|
1194
|
+
* Creates a GeneratorConfigSchema with built-in generator support
|
|
1195
|
+
* @param builtinGenerators - Map of generator IDs to their constructor functions
|
|
1196
|
+
*/
|
|
1197
|
+
declare function createGeneratorConfigSchema(builtinGenerators: Map<string, (options: any) => CodeGeneratorBase>): z.core.$ZodBranded<z.ZodPipe<z.ZodUnion<readonly [z.ZodTuple<[z.ZodLiteral<"@tailor-platform/kysely-type">, z.ZodObject<{
|
|
1198
|
+
distPath: z.ZodString;
|
|
1199
|
+
}, z.core.$strip>], null>, z.ZodTuple<[z.ZodLiteral<"@tailor-platform/seed">, z.ZodObject<{
|
|
1200
|
+
distPath: z.ZodString;
|
|
1201
|
+
machineUserName: z.ZodOptional<z.ZodString>;
|
|
1202
|
+
}, z.core.$strip>], null>, z.ZodObject<{
|
|
1203
|
+
id: z.ZodString;
|
|
1204
|
+
description: z.ZodString;
|
|
1205
|
+
processType: z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
1206
|
+
processResolver: z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
1207
|
+
processExecutor: z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
1208
|
+
processTailorDBNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
1209
|
+
processResolverNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
|
|
1210
|
+
aggregate: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodAny>;
|
|
1211
|
+
}, z.core.$strip>]>, z.ZodTransform<{
|
|
1212
|
+
id: string;
|
|
1213
|
+
description: string;
|
|
1214
|
+
processType: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
1215
|
+
processResolver: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
1216
|
+
processExecutor: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
1217
|
+
aggregate: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodAny>;
|
|
1218
|
+
processTailorDBNamespace?: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut> | undefined;
|
|
1219
|
+
processResolverNamespace?: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut> | undefined;
|
|
1220
|
+
}, ["@tailor-platform/kysely-type", {
|
|
1221
|
+
distPath: string;
|
|
1222
|
+
}] | ["@tailor-platform/seed", {
|
|
1223
|
+
distPath: string;
|
|
1224
|
+
machineUserName?: string | undefined;
|
|
1225
|
+
}] | {
|
|
1226
|
+
id: string;
|
|
1227
|
+
description: string;
|
|
1228
|
+
processType: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
1229
|
+
processResolver: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
1230
|
+
processExecutor: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
|
|
1231
|
+
aggregate: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodAny>;
|
|
1232
|
+
processTailorDBNamespace?: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut> | undefined;
|
|
1233
|
+
processResolverNamespace?: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut> | undefined;
|
|
1234
|
+
}>>, "CodeGenerator">;
|
|
1235
|
+
type GeneratorConfigSchemaType = ReturnType<typeof createGeneratorConfigSchema>;
|
|
1236
|
+
type Generator = z.output<GeneratorConfigSchemaType>;
|
|
1237
|
+
//#endregion
|
|
1238
|
+
//#region src/parser/generator-config/types.d.ts
|
|
1239
|
+
type GeneratorConfig = z.input<typeof BaseGeneratorConfigSchema>;
|
|
1240
|
+
type CodeGeneratorBase = z.output<typeof CodeGeneratorSchema>;
|
|
1241
|
+
//#endregion
|
|
1242
|
+
//#region src/configure/config.d.ts
|
|
1243
|
+
interface AppConfig<Auth extends AuthConfig = AuthConfig, Idp extends IdPConfig[] = IdPConfig[], StaticWebsites extends StaticWebsiteConfig[] = StaticWebsiteConfig[]> {
|
|
1244
|
+
name: string;
|
|
1245
|
+
cors?: string[];
|
|
1246
|
+
allowedIPAddresses?: string[];
|
|
1247
|
+
disableIntrospection?: boolean;
|
|
1248
|
+
db?: TailorDBServiceInput;
|
|
1249
|
+
resolver?: ResolverServiceInput;
|
|
1250
|
+
idp?: Idp;
|
|
1251
|
+
auth?: Auth;
|
|
1252
|
+
executor?: ExecutorServiceInput;
|
|
1253
|
+
staticWebsites?: StaticWebsites;
|
|
1254
|
+
}
|
|
1255
|
+
declare function defineConfig<const Config extends AppConfig>(config: Config): Config;
|
|
1256
|
+
declare function defineGenerators(...configs: GeneratorConfig[]): (["@tailor-platform/kysely-type", {
|
|
1257
|
+
distPath: string;
|
|
1258
|
+
}] | ["@tailor-platform/seed", {
|
|
1259
|
+
distPath: string;
|
|
1260
|
+
machineUserName?: string | undefined;
|
|
1261
|
+
}] | {
|
|
1262
|
+
id: string;
|
|
1263
|
+
description: string;
|
|
1264
|
+
processType: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut>;
|
|
1265
|
+
processResolver: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut>;
|
|
1266
|
+
processExecutor: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut>;
|
|
1267
|
+
aggregate: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod0.ZodAny>;
|
|
1268
|
+
processTailorDBNamespace?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
|
|
1269
|
+
processResolverNamespace?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
|
|
1270
|
+
})[];
|
|
1271
|
+
//#endregion
|
|
1272
|
+
//#region src/parser/service/executor/schema.d.ts
|
|
1273
|
+
declare const RecordTriggerSchema: z.ZodObject<{
|
|
1274
|
+
kind: z.ZodEnum<{
|
|
1275
|
+
recordCreated: "recordCreated";
|
|
1276
|
+
recordUpdated: "recordUpdated";
|
|
1277
|
+
recordDeleted: "recordDeleted";
|
|
1278
|
+
}>;
|
|
1279
|
+
typeName: z.ZodString;
|
|
1280
|
+
condition: z.ZodOptional<z.ZodCustom<Function, Function>>;
|
|
1281
|
+
}, z.core.$strip>;
|
|
1282
|
+
declare const ResolverExecutedTriggerSchema: z.ZodObject<{
|
|
1283
|
+
kind: z.ZodLiteral<"resolverExecuted">;
|
|
1284
|
+
resolverName: z.ZodString;
|
|
1285
|
+
condition: z.ZodOptional<z.ZodCustom<Function, Function>>;
|
|
1286
|
+
}, z.core.$strip>;
|
|
1287
|
+
declare const ScheduleTriggerSchema: z.ZodObject<{
|
|
1288
|
+
kind: z.ZodLiteral<"schedule">;
|
|
1289
|
+
cron: z.ZodString;
|
|
1290
|
+
timezone: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
1291
|
+
}, z.core.$strip>;
|
|
1292
|
+
declare const IncomingWebhookTriggerSchema: z.ZodObject<{
|
|
1293
|
+
kind: z.ZodLiteral<"incomingWebhook">;
|
|
1294
|
+
}, z.core.$strip>;
|
|
1295
|
+
declare const FunctionOperationSchema: z.ZodObject<{
|
|
1296
|
+
kind: z.ZodEnum<{
|
|
1297
|
+
function: "function";
|
|
1298
|
+
jobFunction: "jobFunction";
|
|
1299
|
+
}>;
|
|
1300
|
+
body: z.ZodCustom<Function, Function>;
|
|
1301
|
+
invoker: z.ZodOptional<z.ZodObject<{
|
|
1302
|
+
authName: z.ZodString;
|
|
1303
|
+
machineUser: z.ZodString;
|
|
1304
|
+
}, z.core.$strip>>;
|
|
1305
|
+
}, z.core.$strip>;
|
|
1306
|
+
declare const GqlOperationSchema: z.ZodObject<{
|
|
1307
|
+
kind: z.ZodLiteral<"graphql">;
|
|
1308
|
+
appName: z.ZodString;
|
|
1309
|
+
query: z.ZodString;
|
|
1310
|
+
variables: z.ZodOptional<z.ZodCustom<Function, Function>>;
|
|
1311
|
+
invoker: z.ZodOptional<z.ZodObject<{
|
|
1312
|
+
authName: z.ZodString;
|
|
1313
|
+
machineUser: z.ZodString;
|
|
1314
|
+
}, z.core.$strip>>;
|
|
1315
|
+
}, z.core.$strip>;
|
|
1316
|
+
declare const WebhookOperationSchema: z.ZodObject<{
|
|
1317
|
+
kind: z.ZodLiteral<"webhook">;
|
|
1318
|
+
url: z.ZodCustom<Function, Function>;
|
|
1319
|
+
body: z.ZodOptional<z.ZodCustom<Function, Function>>;
|
|
1320
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
1321
|
+
vault: z.ZodString;
|
|
1322
|
+
key: z.ZodString;
|
|
1323
|
+
}, z.core.$strip>]>>>;
|
|
1324
|
+
}, z.core.$strip>;
|
|
1325
|
+
declare const ExecutorSchema: z.ZodObject<{
|
|
1326
|
+
name: z.ZodString;
|
|
1327
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1328
|
+
disabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
1329
|
+
trigger: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1330
|
+
kind: z.ZodEnum<{
|
|
1331
|
+
recordCreated: "recordCreated";
|
|
1332
|
+
recordUpdated: "recordUpdated";
|
|
1333
|
+
recordDeleted: "recordDeleted";
|
|
1334
|
+
}>;
|
|
1335
|
+
typeName: z.ZodString;
|
|
1336
|
+
condition: z.ZodOptional<z.ZodCustom<Function, Function>>;
|
|
1337
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1338
|
+
kind: z.ZodLiteral<"resolverExecuted">;
|
|
1339
|
+
resolverName: z.ZodString;
|
|
1340
|
+
condition: z.ZodOptional<z.ZodCustom<Function, Function>>;
|
|
1341
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1342
|
+
kind: z.ZodLiteral<"schedule">;
|
|
1343
|
+
cron: z.ZodString;
|
|
1344
|
+
timezone: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
1345
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1346
|
+
kind: z.ZodLiteral<"incomingWebhook">;
|
|
1347
|
+
}, z.core.$strip>], "kind">;
|
|
1348
|
+
operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1349
|
+
kind: z.ZodEnum<{
|
|
1350
|
+
function: "function";
|
|
1351
|
+
jobFunction: "jobFunction";
|
|
1352
|
+
}>;
|
|
1353
|
+
body: z.ZodCustom<Function, Function>;
|
|
1354
|
+
invoker: z.ZodOptional<z.ZodObject<{
|
|
1355
|
+
authName: z.ZodString;
|
|
1356
|
+
machineUser: z.ZodString;
|
|
1357
|
+
}, z.core.$strip>>;
|
|
1358
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1359
|
+
kind: z.ZodLiteral<"graphql">;
|
|
1360
|
+
appName: z.ZodString;
|
|
1361
|
+
query: z.ZodString;
|
|
1362
|
+
variables: z.ZodOptional<z.ZodCustom<Function, Function>>;
|
|
1363
|
+
invoker: z.ZodOptional<z.ZodObject<{
|
|
1364
|
+
authName: z.ZodString;
|
|
1365
|
+
machineUser: z.ZodString;
|
|
1366
|
+
}, z.core.$strip>>;
|
|
1367
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1368
|
+
kind: z.ZodLiteral<"webhook">;
|
|
1369
|
+
url: z.ZodCustom<Function, Function>;
|
|
1370
|
+
body: z.ZodOptional<z.ZodCustom<Function, Function>>;
|
|
1371
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
1372
|
+
vault: z.ZodString;
|
|
1373
|
+
key: z.ZodString;
|
|
1374
|
+
}, z.core.$strip>]>>>;
|
|
1375
|
+
}, z.core.$strip>], "kind">;
|
|
1376
|
+
}, z.core.$strip>;
|
|
1377
|
+
//#endregion
|
|
1378
|
+
//#region src/parser/service/executor/types.d.ts
|
|
1379
|
+
type RecordTrigger = z.infer<typeof RecordTriggerSchema>;
|
|
1380
|
+
type ResolverExecutedTrigger = z.infer<typeof ResolverExecutedTriggerSchema>;
|
|
1381
|
+
type ScheduleTriggerInput = z.input<typeof ScheduleTriggerSchema>;
|
|
1382
|
+
type IncomingWebhookTrigger = z.infer<typeof IncomingWebhookTriggerSchema>;
|
|
1383
|
+
type FunctionOperation = z.infer<typeof FunctionOperationSchema>;
|
|
1384
|
+
type GqlOperation = z.infer<typeof GqlOperationSchema>;
|
|
1385
|
+
type WebhookOperation = z.infer<typeof WebhookOperationSchema>;
|
|
1386
|
+
type Executor = z.infer<typeof ExecutorSchema>;
|
|
1387
|
+
type ExecutorInput = z.input<typeof ExecutorSchema>;
|
|
1388
|
+
//#endregion
|
|
1389
|
+
export { AllowedValues, AllowedValuesOutput, AppConfig, ArrayFieldOutput, AuthConfig, type AuthServiceInput, type BuiltinIdP, CodeGeneratorBase, Executor, ExecutorInput, ExecutorServiceConfig, ExecutorServiceInput, FieldMetadata, FieldOptions, FieldOutput, FunctionOperation, Generator, GqlOperation, type IDToken, IdPConfig, type IdProviderConfig, IncomingWebhookTrigger, InferFieldsOutput, type OAuth2Client, type OAuth2ClientGrantType, type OIDC, PermissionCondition, QueryType, RecordTrigger, Resolver, ResolverExecutedTrigger, ResolverInput, ResolverServiceConfig, ResolverServiceInput, type SAML, type SCIMAttribute, type SCIMAttributeMapping, type SCIMAttributeType, type SCIMAuthorization, type SCIMConfig, type SCIMResource, ScheduleTriggerInput, StaticWebsiteConfig, TailorDBType, TailorDBTypeConfig, TailorField, TailorTypeGqlPermission, TailorTypePermission, TailorUser, type TenantProviderConfig, type UserAttributeKey, type UserAttributeListKey, type UserAttributeMap, type UsernameFieldKey, type ValueOperand, WebhookOperation, db, defineAuth, defineConfig, defineGenerators, defineIdp, defineStaticWebSite, output, unauthenticatedTailorUser };
|