@tailor-platform/sdk 0.22.0 → 0.22.3
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 +27 -0
- package/dist/cli/index.mjs +3 -3
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +1 -44
- package/dist/cli/lib.mjs +2 -2
- package/dist/{config-BGY8v5d7.mjs → config-CtRi0Lgg.mjs} +9 -142
- package/dist/config-CtRi0Lgg.mjs.map +1 -0
- package/dist/configure/index.d.mts +2 -2
- package/dist/configure/index.mjs +1 -1
- package/dist/{index--_tMHIHD.d.mts → index-Bz_i9lgm.d.mts} +8 -3
- package/dist/{list-B11wQhss.mjs → list-BHj1dQPk.mjs} +367 -213
- package/dist/list-BHj1dQPk.mjs.map +1 -0
- package/dist/{types-DhLfUYWN.d.mts → types-BaiXm10C.d.mts} +249 -225
- package/dist/utils/test/index.d.mts +2 -2
- package/package.json +10 -8
- package/dist/config-BGY8v5d7.mjs.map +0 -1
- package/dist/list-B11wQhss.mjs.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference path="./user-defined.d.ts" />
|
|
2
|
-
import * as
|
|
2
|
+
import * as zod0 from "zod";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
5
4
|
import * as type_fest0 from "type-fest";
|
|
6
5
|
import { IsAny, NonEmptyObject } from "type-fest";
|
|
7
|
-
import
|
|
6
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
7
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
8
8
|
|
|
9
9
|
//#region src/configure/types/helpers.d.ts
|
|
10
10
|
type Prettify<T$1> = { [K in keyof T$1 as string extends K ? never : K]: T$1[K] } & {};
|
|
@@ -27,6 +27,93 @@ type JsonCompatible<T$1> = T$1 extends string | number | boolean | null | undefi
|
|
|
27
27
|
toJSON: () => unknown;
|
|
28
28
|
} ? never : { [K in keyof T$1]: JsonCompatible<T$1[K]> } : never;
|
|
29
29
|
//#endregion
|
|
30
|
+
//#region src/configure/types/validation.d.ts
|
|
31
|
+
/**
|
|
32
|
+
* Validation function type
|
|
33
|
+
*/
|
|
34
|
+
type ValidateFn<O, D$1 = unknown> = (args: {
|
|
35
|
+
value: O;
|
|
36
|
+
data: D$1;
|
|
37
|
+
user: TailorUser;
|
|
38
|
+
}) => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Validation configuration with custom error message
|
|
41
|
+
*/
|
|
42
|
+
type ValidateConfig<O, D$1 = unknown> = [ValidateFn<O, D$1>, string];
|
|
43
|
+
/**
|
|
44
|
+
* Field-level validation function
|
|
45
|
+
*/
|
|
46
|
+
type FieldValidateFn<O> = ValidateFn<O>;
|
|
47
|
+
/**
|
|
48
|
+
* Field-level validation configuration
|
|
49
|
+
*/
|
|
50
|
+
type FieldValidateConfig<O> = ValidateConfig<O>;
|
|
51
|
+
/**
|
|
52
|
+
* Input type for field validation - can be either a function or a tuple of [function, errorMessage]
|
|
53
|
+
*/
|
|
54
|
+
type FieldValidateInput<O> = FieldValidateFn<O> | FieldValidateConfig<O>;
|
|
55
|
+
/**
|
|
56
|
+
* Base validators type for field collections
|
|
57
|
+
* @template F - Record of fields
|
|
58
|
+
* @template ExcludeKeys - Keys to exclude from validation (default: "id" for TailorDB)
|
|
59
|
+
*/
|
|
60
|
+
type ValidatorsBase<F extends Record<string, {
|
|
61
|
+
_defined: any;
|
|
62
|
+
_output: any;
|
|
63
|
+
[key: string]: any;
|
|
64
|
+
}>, ExcludeKeys extends string = "id"> = NonEmptyObject<{ [K in Exclude<keyof F, ExcludeKeys> as F[K]["_defined"] extends {
|
|
65
|
+
validate: unknown;
|
|
66
|
+
} ? 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>>)[] }>;
|
|
67
|
+
/**
|
|
68
|
+
* Validators type (by default excludes "id" field for TailorDB compatibility)
|
|
69
|
+
* Can be used with both TailorField and TailorDBField
|
|
70
|
+
*/
|
|
71
|
+
type Validators<F extends Record<string, {
|
|
72
|
+
_defined: any;
|
|
73
|
+
_output: any;
|
|
74
|
+
[key: string]: any;
|
|
75
|
+
}>> = ValidatorsBase<F, "id">;
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/configure/types/types.d.ts
|
|
78
|
+
type TailorFieldType = "uuid" | "string" | "boolean" | "integer" | "float" | "enum" | "date" | "datetime" | "time" | "nested";
|
|
79
|
+
type TailorToTs = {
|
|
80
|
+
string: string;
|
|
81
|
+
integer: number;
|
|
82
|
+
float: number;
|
|
83
|
+
boolean: boolean;
|
|
84
|
+
uuid: string;
|
|
85
|
+
date: string;
|
|
86
|
+
datetime: string | Date;
|
|
87
|
+
time: string;
|
|
88
|
+
enum: string;
|
|
89
|
+
object: Record<string, unknown>;
|
|
90
|
+
nested: Record<string, unknown>;
|
|
91
|
+
} & Record<TailorFieldType, unknown>;
|
|
92
|
+
interface FieldMetadata {
|
|
93
|
+
description?: string;
|
|
94
|
+
required?: boolean;
|
|
95
|
+
array?: boolean;
|
|
96
|
+
allowedValues?: AllowedValue[];
|
|
97
|
+
validate?: FieldValidateInput<any>[];
|
|
98
|
+
typeName?: string;
|
|
99
|
+
}
|
|
100
|
+
interface DefinedFieldMetadata {
|
|
101
|
+
type: TailorFieldType;
|
|
102
|
+
array: boolean;
|
|
103
|
+
description?: boolean;
|
|
104
|
+
validate?: boolean;
|
|
105
|
+
typeName?: boolean;
|
|
106
|
+
}
|
|
107
|
+
type FieldOptions = {
|
|
108
|
+
optional?: boolean;
|
|
109
|
+
array?: boolean;
|
|
110
|
+
};
|
|
111
|
+
type FieldOutput$1<T$1, O extends FieldOptions> = OptionalFieldOutput<ArrayFieldOutput<T$1, O>, O>;
|
|
112
|
+
type OptionalFieldOutput<T$1, O extends FieldOptions> = O["optional"] extends true ? T$1 | null : T$1;
|
|
113
|
+
type ArrayFieldOutput<T$1, O extends FieldOptions> = [O] extends [{
|
|
114
|
+
array: true;
|
|
115
|
+
}] ? T$1[] : T$1;
|
|
116
|
+
//#endregion
|
|
30
117
|
//#region src/parser/service/resolver/schema.d.ts
|
|
31
118
|
declare const QueryTypeSchema: z.ZodUnion<readonly [z.ZodLiteral<"query">, z.ZodLiteral<"mutation">]>;
|
|
32
119
|
declare const TailorFieldSchema: z.ZodObject<{
|
|
@@ -218,143 +305,6 @@ type TailorUser = {
|
|
|
218
305
|
/** Represents an unauthenticated user in the Tailor platform. */
|
|
219
306
|
declare const unauthenticatedTailorUser: TailorUser;
|
|
220
307
|
//#endregion
|
|
221
|
-
//#region src/configure/types/env.d.ts
|
|
222
|
-
interface Env {}
|
|
223
|
-
/** Represents environment variables in the Tailor platform. */
|
|
224
|
-
type TailorEnv = keyof Env extends never ? Record<string, string> : Env;
|
|
225
|
-
//#endregion
|
|
226
|
-
//#region src/configure/types/validation.d.ts
|
|
227
|
-
/**
|
|
228
|
-
* Validation function type
|
|
229
|
-
*/
|
|
230
|
-
type ValidateFn<O, D$1 = unknown> = (args: {
|
|
231
|
-
value: O;
|
|
232
|
-
data: D$1;
|
|
233
|
-
user: TailorUser;
|
|
234
|
-
}) => boolean;
|
|
235
|
-
/**
|
|
236
|
-
* Validation configuration with custom error message
|
|
237
|
-
*/
|
|
238
|
-
type ValidateConfig<O, D$1 = unknown> = [ValidateFn<O, D$1>, string];
|
|
239
|
-
/**
|
|
240
|
-
* Field-level validation function
|
|
241
|
-
*/
|
|
242
|
-
type FieldValidateFn<O> = ValidateFn<O>;
|
|
243
|
-
/**
|
|
244
|
-
* Field-level validation configuration
|
|
245
|
-
*/
|
|
246
|
-
type FieldValidateConfig<O> = ValidateConfig<O>;
|
|
247
|
-
/**
|
|
248
|
-
* Input type for field validation - can be either a function or a tuple of [function, errorMessage]
|
|
249
|
-
*/
|
|
250
|
-
type FieldValidateInput<O> = FieldValidateFn<O> | FieldValidateConfig<O>;
|
|
251
|
-
/**
|
|
252
|
-
* Base validators type for field collections
|
|
253
|
-
* @template F - Record of fields
|
|
254
|
-
* @template ExcludeKeys - Keys to exclude from validation (default: "id" for TailorDB)
|
|
255
|
-
*/
|
|
256
|
-
type ValidatorsBase<F extends Record<string, {
|
|
257
|
-
_defined: any;
|
|
258
|
-
_output: any;
|
|
259
|
-
[key: string]: any;
|
|
260
|
-
}>, ExcludeKeys extends string = "id"> = NonEmptyObject<{ [K in Exclude<keyof F, ExcludeKeys> as F[K]["_defined"] extends {
|
|
261
|
-
validate: unknown;
|
|
262
|
-
} ? 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>>)[] }>;
|
|
263
|
-
/**
|
|
264
|
-
* Validators type (by default excludes "id" field for TailorDB compatibility)
|
|
265
|
-
* Can be used with both TailorField and TailorDBField
|
|
266
|
-
*/
|
|
267
|
-
type Validators<F extends Record<string, {
|
|
268
|
-
_defined: any;
|
|
269
|
-
_output: any;
|
|
270
|
-
[key: string]: any;
|
|
271
|
-
}>> = ValidatorsBase<F, "id">;
|
|
272
|
-
//#endregion
|
|
273
|
-
//#region src/configure/types/types.d.ts
|
|
274
|
-
type TailorFieldType = "uuid" | "string" | "boolean" | "integer" | "float" | "enum" | "date" | "datetime" | "time" | "nested";
|
|
275
|
-
type TailorToTs = {
|
|
276
|
-
string: string;
|
|
277
|
-
integer: number;
|
|
278
|
-
float: number;
|
|
279
|
-
boolean: boolean;
|
|
280
|
-
uuid: string;
|
|
281
|
-
date: string;
|
|
282
|
-
datetime: string | Date;
|
|
283
|
-
time: string;
|
|
284
|
-
enum: string;
|
|
285
|
-
object: Record<string, unknown>;
|
|
286
|
-
nested: Record<string, unknown>;
|
|
287
|
-
} & Record<TailorFieldType, unknown>;
|
|
288
|
-
interface Script {
|
|
289
|
-
expr: string;
|
|
290
|
-
}
|
|
291
|
-
interface EnumValue {
|
|
292
|
-
value: string;
|
|
293
|
-
description?: string;
|
|
294
|
-
}
|
|
295
|
-
interface FieldMetadata {
|
|
296
|
-
description?: string;
|
|
297
|
-
required?: boolean;
|
|
298
|
-
array?: boolean;
|
|
299
|
-
allowedValues?: AllowedValue[];
|
|
300
|
-
validate?: FieldValidateInput<any>[];
|
|
301
|
-
typeName?: string;
|
|
302
|
-
}
|
|
303
|
-
interface DefinedFieldMetadata {
|
|
304
|
-
type: TailorFieldType;
|
|
305
|
-
array: boolean;
|
|
306
|
-
description?: boolean;
|
|
307
|
-
validate?: boolean;
|
|
308
|
-
typeName?: boolean;
|
|
309
|
-
}
|
|
310
|
-
type FieldOptions = {
|
|
311
|
-
optional?: boolean;
|
|
312
|
-
array?: boolean;
|
|
313
|
-
};
|
|
314
|
-
type FieldOutput$1<T$1, O extends FieldOptions> = OptionalFieldOutput<ArrayFieldOutput<T$1, O>, O>;
|
|
315
|
-
type OptionalFieldOutput<T$1, O extends FieldOptions> = O["optional"] extends true ? T$1 | null : T$1;
|
|
316
|
-
type ArrayFieldOutput<T$1, O extends FieldOptions> = [O] extends [{
|
|
317
|
-
array: true;
|
|
318
|
-
}] ? T$1[] : T$1;
|
|
319
|
-
//#endregion
|
|
320
|
-
//#region src/configure/types/field.d.ts
|
|
321
|
-
type AllowedValue = EnumValue;
|
|
322
|
-
type AllowedValues = [string | EnumValue, ...(string | EnumValue)[]];
|
|
323
|
-
type AllowedValuesOutput<V extends AllowedValues> = V[number] extends infer T ? T extends string ? T : T extends {
|
|
324
|
-
value: infer K;
|
|
325
|
-
} ? K : never : never;
|
|
326
|
-
//#endregion
|
|
327
|
-
//#region src/configure/types/operator.d.ts
|
|
328
|
-
interface OperatorValidateConfig {
|
|
329
|
-
script: Script;
|
|
330
|
-
errorMessage: string;
|
|
331
|
-
}
|
|
332
|
-
interface OperatorFieldHook {
|
|
333
|
-
create?: Script;
|
|
334
|
-
update?: Script;
|
|
335
|
-
}
|
|
336
|
-
interface OperatorFieldConfig {
|
|
337
|
-
type: string;
|
|
338
|
-
required?: boolean;
|
|
339
|
-
description?: string;
|
|
340
|
-
allowedValues?: EnumValue[];
|
|
341
|
-
array?: boolean;
|
|
342
|
-
index?: boolean;
|
|
343
|
-
unique?: boolean;
|
|
344
|
-
vector?: boolean;
|
|
345
|
-
foreignKey?: boolean;
|
|
346
|
-
foreignKeyType?: string;
|
|
347
|
-
foreignKeyField?: string;
|
|
348
|
-
validate?: OperatorValidateConfig[];
|
|
349
|
-
hooks?: OperatorFieldHook;
|
|
350
|
-
serial?: {
|
|
351
|
-
start: number;
|
|
352
|
-
maxValue?: number;
|
|
353
|
-
format?: string;
|
|
354
|
-
};
|
|
355
|
-
fields?: Record<string, OperatorFieldConfig>;
|
|
356
|
-
}
|
|
357
|
-
//#endregion
|
|
358
308
|
//#region src/parser/service/auth/schema.d.ts
|
|
359
309
|
declare const AuthInvokerSchema: z.ZodObject<{
|
|
360
310
|
namespace: z.ZodString;
|
|
@@ -375,14 +325,7 @@ declare const OIDCSchema: z.ZodObject<{
|
|
|
375
325
|
declare const SAMLSchema: z.ZodObject<{
|
|
376
326
|
name: z.ZodString;
|
|
377
327
|
kind: z.ZodLiteral<"SAML">;
|
|
378
|
-
|
|
379
|
-
vaultName: z.ZodString;
|
|
380
|
-
secretKey: z.ZodString;
|
|
381
|
-
}, z.core.$strip>>;
|
|
382
|
-
spKeyBase64: z.ZodOptional<z.ZodObject<{
|
|
383
|
-
vaultName: z.ZodString;
|
|
384
|
-
secretKey: z.ZodString;
|
|
385
|
-
}, z.core.$strip>>;
|
|
328
|
+
enableSignRequest: z.ZodDefault<z.ZodBoolean>;
|
|
386
329
|
metadataURL: z.ZodOptional<z.ZodString>;
|
|
387
330
|
rawMetadata: z.ZodOptional<z.ZodString>;
|
|
388
331
|
}, z.core.$strip>;
|
|
@@ -414,14 +357,7 @@ declare const IdProviderSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
414
357
|
}, z.core.$strip>, z.ZodObject<{
|
|
415
358
|
name: z.ZodString;
|
|
416
359
|
kind: z.ZodLiteral<"SAML">;
|
|
417
|
-
|
|
418
|
-
vaultName: z.ZodString;
|
|
419
|
-
secretKey: z.ZodString;
|
|
420
|
-
}, z.core.$strip>>;
|
|
421
|
-
spKeyBase64: z.ZodOptional<z.ZodObject<{
|
|
422
|
-
vaultName: z.ZodString;
|
|
423
|
-
secretKey: z.ZodString;
|
|
424
|
-
}, z.core.$strip>>;
|
|
360
|
+
enableSignRequest: z.ZodDefault<z.ZodBoolean>;
|
|
425
361
|
metadataURL: z.ZodOptional<z.ZodString>;
|
|
426
362
|
rawMetadata: z.ZodOptional<z.ZodString>;
|
|
427
363
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -656,68 +592,38 @@ type AuthOwnConfig = ReturnType<typeof defineAuth<string, any, any, any, string>
|
|
|
656
592
|
type AuthConfig = AuthOwnConfig | AuthExternalConfig;
|
|
657
593
|
//#endregion
|
|
658
594
|
//#region src/configure/services/tailordb/permission.d.ts
|
|
659
|
-
interface Permissions {
|
|
660
|
-
record?: StandardTailorTypePermission;
|
|
661
|
-
gql?: StandardTailorTypeGqlPermission;
|
|
662
|
-
}
|
|
663
595
|
type TailorTypePermission<User extends object = InferredAttributeMap, Type extends object = object> = {
|
|
664
596
|
create: readonly ActionPermission<"record", User, Type, false>[];
|
|
665
597
|
read: readonly ActionPermission<"record", User, Type, false>[];
|
|
666
598
|
update: readonly ActionPermission<"record", User, Type, true>[];
|
|
667
599
|
delete: readonly ActionPermission<"record", User, Type, false>[];
|
|
668
600
|
};
|
|
669
|
-
type StandardTailorTypePermission = {
|
|
670
|
-
create: readonly StandardActionPermission<"record", false>[];
|
|
671
|
-
read: readonly StandardActionPermission<"record", false>[];
|
|
672
|
-
update: readonly StandardActionPermission<"record", true>[];
|
|
673
|
-
delete: readonly StandardActionPermission<"record", false>[];
|
|
674
|
-
};
|
|
675
601
|
type ActionPermission<Level extends "record" | "gql" = "record" | "gql", User extends object = InferredAttributeMap, Type extends object = object, Update extends boolean = boolean> = {
|
|
676
602
|
conditions: PermissionCondition<Level, User, Update, Type> | readonly PermissionCondition<Level, User, Update, Type>[];
|
|
677
603
|
description?: string | undefined;
|
|
678
604
|
permit?: boolean;
|
|
679
605
|
} | readonly [...PermissionCondition<Level, User, Update, Type>, ...([] | [boolean])] | readonly [...PermissionCondition<Level, User, Update, Type>[], ...([] | [boolean])];
|
|
680
|
-
type StandardActionPermission<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = {
|
|
681
|
-
conditions: readonly StandardPermissionCondition<Level, Update>[];
|
|
682
|
-
description?: string;
|
|
683
|
-
permit: "allow" | "deny";
|
|
684
|
-
};
|
|
685
606
|
type TailorTypeGqlPermission<User extends object = InferredAttributeMap, Type extends object = object> = readonly GqlPermissionPolicy<User, Type>[];
|
|
686
|
-
type StandardTailorTypeGqlPermission = readonly StandardGqlPermissionPolicy[];
|
|
687
607
|
type GqlPermissionPolicy<User extends object = InferredAttributeMap, Type extends object = object> = {
|
|
688
608
|
conditions: readonly PermissionCondition<"gql", User, boolean, Type>[];
|
|
689
|
-
actions: "all" | readonly GqlPermissionAction[];
|
|
609
|
+
actions: "all" | readonly GqlPermissionAction$1[];
|
|
690
610
|
permit?: boolean;
|
|
691
611
|
description?: string;
|
|
692
612
|
};
|
|
693
|
-
type
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
permit: "allow" | "deny";
|
|
697
|
-
description?: string;
|
|
698
|
-
};
|
|
699
|
-
type GqlPermissionAction = "read" | "create" | "update" | "delete" | "aggregate" | "bulkUpsert";
|
|
700
|
-
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>];
|
|
701
|
-
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>];
|
|
702
|
-
type UserOperand<User extends object = InferredAttributeMap> = {
|
|
613
|
+
type GqlPermissionAction$1 = "read" | "create" | "update" | "delete" | "aggregate" | "bulkUpsert";
|
|
614
|
+
type PermissionCondition<Level extends "record" | "gql" = "record" | "gql", User extends object = InferredAttributeMap, Update extends boolean = boolean, Type extends object = object> = readonly [PermissionOperand$1<Level, User, Type, Update>, PermissionOperator, PermissionOperand$1<Level, User, Type, Update>];
|
|
615
|
+
type UserOperand$1<User extends object = InferredAttributeMap> = {
|
|
703
616
|
user: { [K in keyof User]: User[K] extends string | string[] | boolean | boolean[] ? K : never }[keyof User] | "id" | "_loggedIn";
|
|
704
617
|
};
|
|
705
|
-
type RecordOperand<Type extends object, Update extends boolean = false> = Update extends true ? {
|
|
618
|
+
type RecordOperand$1<Type extends object, Update extends boolean = false> = Update extends true ? {
|
|
706
619
|
oldRecord: (keyof Type & string) | "id";
|
|
707
620
|
} | {
|
|
708
621
|
newRecord: (keyof Type & string) | "id";
|
|
709
622
|
} : {
|
|
710
623
|
record: (keyof Type & string) | "id";
|
|
711
624
|
};
|
|
712
|
-
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);
|
|
625
|
+
type PermissionOperand$1<Level extends "record" | "gql" = "record" | "gql", User extends object = InferredAttributeMap, Type extends object = object, Update extends boolean = boolean> = UserOperand$1<User> | ValueOperand | (Level extends "record" ? RecordOperand$1<Type, Update> : never);
|
|
713
626
|
type PermissionOperator = "=" | "!=" | "in" | "not in";
|
|
714
|
-
declare const operatorMap: {
|
|
715
|
-
readonly "=": "eq";
|
|
716
|
-
readonly "!=": "ne";
|
|
717
|
-
readonly in: "in";
|
|
718
|
-
readonly "not in": "nin";
|
|
719
|
-
};
|
|
720
|
-
type StandardPermissionOperator = (typeof operatorMap)[keyof typeof operatorMap];
|
|
721
627
|
/**
|
|
722
628
|
* Grants full record-level access without any conditions.
|
|
723
629
|
*
|
|
@@ -735,27 +641,6 @@ declare const unsafeAllowAllTypePermission: TailorTypePermission;
|
|
|
735
641
|
*/
|
|
736
642
|
declare const unsafeAllowAllGqlPermission: TailorTypeGqlPermission;
|
|
737
643
|
//#endregion
|
|
738
|
-
//#region src/configure/services/tailordb/operator-types.d.ts
|
|
739
|
-
interface TailorDBTypeConfig {
|
|
740
|
-
name: string;
|
|
741
|
-
schema: {
|
|
742
|
-
description?: string;
|
|
743
|
-
extends: boolean;
|
|
744
|
-
fields: Record<string, OperatorFieldConfig>;
|
|
745
|
-
settings?: {
|
|
746
|
-
pluralForm?: string;
|
|
747
|
-
aggregation?: boolean;
|
|
748
|
-
bulkUpsert?: boolean;
|
|
749
|
-
};
|
|
750
|
-
permissions: Permissions;
|
|
751
|
-
files: Record<string, string>;
|
|
752
|
-
indexes?: Record<string, {
|
|
753
|
-
fields: string[];
|
|
754
|
-
unique?: boolean;
|
|
755
|
-
}>;
|
|
756
|
-
};
|
|
757
|
-
}
|
|
758
|
-
//#endregion
|
|
759
644
|
//#region src/configure/services/tailordb/types.d.ts
|
|
760
645
|
type SerialConfig<T$1 extends "string" | "integer" = "string" | "integer"> = Prettify<{
|
|
761
646
|
start: number;
|
|
@@ -829,6 +714,146 @@ interface TypeFeatures {
|
|
|
829
714
|
bulkUpsert?: true;
|
|
830
715
|
}
|
|
831
716
|
//#endregion
|
|
717
|
+
//#region src/parser/service/tailordb/types.d.ts
|
|
718
|
+
interface Script {
|
|
719
|
+
expr: string;
|
|
720
|
+
}
|
|
721
|
+
interface EnumValue {
|
|
722
|
+
value: string;
|
|
723
|
+
description?: string;
|
|
724
|
+
}
|
|
725
|
+
interface OperatorValidateConfig {
|
|
726
|
+
script: Script;
|
|
727
|
+
errorMessage: string;
|
|
728
|
+
}
|
|
729
|
+
interface OperatorFieldHook {
|
|
730
|
+
create?: Script;
|
|
731
|
+
update?: Script;
|
|
732
|
+
}
|
|
733
|
+
interface OperatorFieldConfig {
|
|
734
|
+
type: string;
|
|
735
|
+
required?: boolean;
|
|
736
|
+
description?: string;
|
|
737
|
+
allowedValues?: EnumValue[];
|
|
738
|
+
array?: boolean;
|
|
739
|
+
index?: boolean;
|
|
740
|
+
unique?: boolean;
|
|
741
|
+
vector?: boolean;
|
|
742
|
+
foreignKey?: boolean;
|
|
743
|
+
foreignKeyType?: string;
|
|
744
|
+
foreignKeyField?: string;
|
|
745
|
+
validate?: OperatorValidateConfig[];
|
|
746
|
+
hooks?: OperatorFieldHook;
|
|
747
|
+
serial?: {
|
|
748
|
+
start: number;
|
|
749
|
+
maxValue?: number;
|
|
750
|
+
format?: string;
|
|
751
|
+
};
|
|
752
|
+
fields?: Record<string, OperatorFieldConfig>;
|
|
753
|
+
}
|
|
754
|
+
type GqlPermissionAction = "read" | "create" | "update" | "delete" | "aggregate" | "bulkUpsert";
|
|
755
|
+
type StandardPermissionOperator = "eq" | "ne" | "in" | "nin";
|
|
756
|
+
type UserOperand = {
|
|
757
|
+
user: string;
|
|
758
|
+
};
|
|
759
|
+
type RecordOperand<Update extends boolean = false> = Update extends true ? {
|
|
760
|
+
oldRecord: string;
|
|
761
|
+
} | {
|
|
762
|
+
newRecord: string;
|
|
763
|
+
} : {
|
|
764
|
+
record: string;
|
|
765
|
+
};
|
|
766
|
+
type PermissionOperand<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = UserOperand | ValueOperand | (Level extends "record" ? RecordOperand<Update> : never);
|
|
767
|
+
type StandardPermissionCondition<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = readonly [PermissionOperand<Level, Update>, StandardPermissionOperator, PermissionOperand<Level, Update>];
|
|
768
|
+
type StandardActionPermission<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = {
|
|
769
|
+
conditions: readonly StandardPermissionCondition<Level, Update>[];
|
|
770
|
+
description?: string;
|
|
771
|
+
permit: "allow" | "deny";
|
|
772
|
+
};
|
|
773
|
+
type StandardTailorTypePermission = {
|
|
774
|
+
create: readonly StandardActionPermission<"record", false>[];
|
|
775
|
+
read: readonly StandardActionPermission<"record", false>[];
|
|
776
|
+
update: readonly StandardActionPermission<"record", true>[];
|
|
777
|
+
delete: readonly StandardActionPermission<"record", false>[];
|
|
778
|
+
};
|
|
779
|
+
type StandardGqlPermissionPolicy = {
|
|
780
|
+
conditions: readonly StandardPermissionCondition<"gql">[];
|
|
781
|
+
actions: readonly ["all"] | readonly GqlPermissionAction[];
|
|
782
|
+
permit: "allow" | "deny";
|
|
783
|
+
description?: string;
|
|
784
|
+
};
|
|
785
|
+
type StandardTailorTypeGqlPermission = readonly StandardGqlPermissionPolicy[];
|
|
786
|
+
interface Permissions {
|
|
787
|
+
record?: StandardTailorTypePermission;
|
|
788
|
+
gql?: StandardTailorTypeGqlPermission;
|
|
789
|
+
}
|
|
790
|
+
interface RawPermissions {
|
|
791
|
+
record?: TailorTypePermission<any, any>;
|
|
792
|
+
gql?: TailorTypeGqlPermission<any, any>;
|
|
793
|
+
}
|
|
794
|
+
interface TailorDBTypeMetadata {
|
|
795
|
+
name: string;
|
|
796
|
+
description?: string;
|
|
797
|
+
settings?: {
|
|
798
|
+
pluralForm?: string;
|
|
799
|
+
aggregation?: boolean;
|
|
800
|
+
bulkUpsert?: boolean;
|
|
801
|
+
};
|
|
802
|
+
permissions: RawPermissions;
|
|
803
|
+
files: Record<string, string>;
|
|
804
|
+
indexes?: Record<string, {
|
|
805
|
+
fields: string[];
|
|
806
|
+
unique?: boolean;
|
|
807
|
+
}>;
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Parsed and normalized TailorDB field information
|
|
811
|
+
*/
|
|
812
|
+
interface ParsedField {
|
|
813
|
+
name: string;
|
|
814
|
+
config: OperatorFieldConfig;
|
|
815
|
+
relation?: {
|
|
816
|
+
targetType: string;
|
|
817
|
+
forwardName: string;
|
|
818
|
+
backwardName: string;
|
|
819
|
+
key: string;
|
|
820
|
+
unique: boolean;
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* Parsed and normalized TailorDB relationship information
|
|
825
|
+
*/
|
|
826
|
+
interface ParsedRelationship {
|
|
827
|
+
name: string;
|
|
828
|
+
targetType: string;
|
|
829
|
+
targetField: string;
|
|
830
|
+
sourceField: string;
|
|
831
|
+
isArray: boolean;
|
|
832
|
+
description: string;
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* Parsed and normalized TailorDB type information
|
|
836
|
+
*/
|
|
837
|
+
interface ParsedTailorDBType {
|
|
838
|
+
name: string;
|
|
839
|
+
pluralForm: string;
|
|
840
|
+
description?: string;
|
|
841
|
+
fields: Record<string, ParsedField>;
|
|
842
|
+
forwardRelationships: Record<string, ParsedRelationship>;
|
|
843
|
+
backwardRelationships: Record<string, ParsedRelationship>;
|
|
844
|
+
settings: TailorDBTypeMetadata["settings"];
|
|
845
|
+
permissions: Permissions;
|
|
846
|
+
indexes?: TailorDBTypeMetadata["indexes"];
|
|
847
|
+
files?: TailorDBTypeMetadata["files"];
|
|
848
|
+
}
|
|
849
|
+
//#endregion
|
|
850
|
+
//#region src/configure/types/field.d.ts
|
|
851
|
+
type AllowedValue = EnumValue;
|
|
852
|
+
type AllowedValues = [string | EnumValue, ...(string | EnumValue)[]];
|
|
853
|
+
type AllowedValuesOutput<V extends AllowedValues> = V[number] extends infer T ? T extends string ? T : T extends {
|
|
854
|
+
value: infer K;
|
|
855
|
+
} ? K : never : never;
|
|
856
|
+
//#endregion
|
|
832
857
|
//#region src/configure/services/tailordb/schema.d.ts
|
|
833
858
|
type RelationType = "oneToOne" | "1-1" | "manyToOne" | "n-1" | "N-1" | "keyOnly";
|
|
834
859
|
interface RelationConfig<S extends RelationType, T$1 extends TailorDBType> {
|
|
@@ -875,7 +900,6 @@ declare class TailorDBField<const Defined extends DefinedDBFieldMetadata, const
|
|
|
875
900
|
validate?: FieldValidateInput<any>[];
|
|
876
901
|
typeName?: string;
|
|
877
902
|
};
|
|
878
|
-
get config(): OperatorFieldConfig;
|
|
879
903
|
private constructor();
|
|
880
904
|
static create<const T$1 extends TailorFieldType, const TOptions extends FieldOptions, const OutputBase = TailorToTs[T$1]>(type: T$1, options?: TOptions, fields?: Record<string, TailorDBField<any, any>>, values?: AllowedValues): TailorDBField<{
|
|
881
905
|
type: T$1;
|
|
@@ -1043,7 +1067,7 @@ declare class TailorDBType<const Fields extends Record<string, TailorDBField<any
|
|
|
1043
1067
|
pluralForm?: string;
|
|
1044
1068
|
description?: string;
|
|
1045
1069
|
});
|
|
1046
|
-
get metadata():
|
|
1070
|
+
get metadata(): TailorDBTypeMetadata;
|
|
1047
1071
|
hooks(hooks: Hooks<Fields>): this;
|
|
1048
1072
|
validate(validators: Validators<Fields>): this;
|
|
1049
1073
|
features(features: Omit<TypeFeatures, "pluralForm">): this;
|
|
@@ -1358,9 +1382,9 @@ type GeneratorConfig = z.input<typeof BaseGeneratorConfigSchema>;
|
|
|
1358
1382
|
type CodeGeneratorBase = z.output<typeof CodeGeneratorSchema>;
|
|
1359
1383
|
//#endregion
|
|
1360
1384
|
//#region src/configure/config.d.ts
|
|
1361
|
-
interface AppConfig<Auth extends AuthConfig = AuthConfig, Idp extends IdPConfig[] = IdPConfig[], StaticWebsites extends StaticWebsiteConfig[] = StaticWebsiteConfig[], Env
|
|
1385
|
+
interface AppConfig<Auth extends AuthConfig = AuthConfig, Idp extends IdPConfig[] = IdPConfig[], StaticWebsites extends StaticWebsiteConfig[] = StaticWebsiteConfig[], Env extends Record<string, string | number | boolean> = Record<string, string | number | boolean>> {
|
|
1362
1386
|
name: string;
|
|
1363
|
-
env?: Env
|
|
1387
|
+
env?: Env;
|
|
1364
1388
|
cors?: string[];
|
|
1365
1389
|
allowedIPAddresses?: string[];
|
|
1366
1390
|
disableIntrospection?: boolean;
|
|
@@ -1385,12 +1409,12 @@ declare function defineGenerators(...configs: GeneratorConfig[]): (["@tailor-pla
|
|
|
1385
1409
|
}] | {
|
|
1386
1410
|
id: string;
|
|
1387
1411
|
description: string;
|
|
1388
|
-
processType:
|
|
1389
|
-
processResolver:
|
|
1390
|
-
processExecutor:
|
|
1391
|
-
aggregate:
|
|
1392
|
-
processTailorDBNamespace?:
|
|
1393
|
-
processResolverNamespace?:
|
|
1412
|
+
processType: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut>;
|
|
1413
|
+
processResolver: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut>;
|
|
1414
|
+
processExecutor: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut>;
|
|
1415
|
+
aggregate: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod0.ZodAny>;
|
|
1416
|
+
processTailorDBNamespace?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
|
|
1417
|
+
processResolverNamespace?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
|
|
1394
1418
|
})[];
|
|
1395
1419
|
//#endregion
|
|
1396
1420
|
//#region src/parser/service/executor/schema.d.ts
|
|
@@ -1528,5 +1552,5 @@ type WorkflowOperation = z.infer<typeof WorkflowOperationSchema>;
|
|
|
1528
1552
|
type Executor = z.infer<typeof ExecutorSchema>;
|
|
1529
1553
|
type ExecutorInput = z.input<typeof ExecutorSchema>;
|
|
1530
1554
|
//#endregion
|
|
1531
|
-
export {
|
|
1532
|
-
//# sourceMappingURL=types-
|
|
1555
|
+
export { SCIMAttribute as $, TailorDBType as A, AuthConfig as B, ResolverExternalConfig as C, InferFieldsOutput as Ct, ExecutorServiceInput as D, ExecutorServiceConfig as E, PermissionCondition as F, AuthServiceInput as G, AuthInvoker as H, TailorTypeGqlPermission as I, IdProviderConfig as J, BuiltinIdP as K, TailorTypePermission as L, AllowedValues as M, AllowedValuesOutput as N, TailorDBField as O, ParsedTailorDBType as P, SAML as Q, unsafeAllowAllGqlPermission as R, defineIdp as S, FieldOutput$1 as St, ResolverServiceInput as T, output as Tt, AuthOwnConfig as U, AuthExternalConfig as V, defineAuth as W, OAuth2ClientInput as X, OAuth2ClientGrantType as Y, OIDC as Z, WorkflowServiceInput as _, Resolver as _t, IncomingWebhookTrigger as a, TenantProviderConfig as at, IdPConfig as b, FieldMetadata as bt, ScheduleTriggerInput as c, UserAttributeMap as ct, AppConfig as d, AttributeList as dt, SCIMAttributeMapping as et, defineConfig as f, AttributeMap as ft, WorkflowServiceConfig as g, QueryType as gt, Generator as h, TailorField as ht, GqlOperation as i, SCIMResource as it, db as j, TailorDBInstance as k, WebhookOperation as l, UsernameFieldKey as lt, CodeGeneratorBase as m, unauthenticatedTailorUser as mt, ExecutorInput as n, SCIMAuthorization as nt, RecordTrigger as o, UserAttributeKey as ot, defineGenerators as p, TailorUser as pt, IDToken as q, FunctionOperation as r, SCIMConfig as rt, ResolverExecutedTrigger as s, UserAttributeListKey as st, Executor as t, SCIMAttributeType as tt, WorkflowOperation as u, ValueOperand as ut, StaticWebsiteConfig as v, ResolverInput as vt, ResolverServiceConfig as w, JsonCompatible as wt, IdPExternalConfig as x, FieldOptions as xt, defineStaticWebSite as y, ArrayFieldOutput as yt, unsafeAllowAllTypePermission as z };
|
|
1556
|
+
//# sourceMappingURL=types-BaiXm10C.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="./../../user-defined.d.ts" />
|
|
2
|
-
import { A as TailorDBType,
|
|
3
|
-
import { n as output } from "../../index
|
|
2
|
+
import { A as TailorDBType, ht as TailorField } from "../../types-BaiXm10C.mjs";
|
|
3
|
+
import { n as output } from "../../index-Bz_i9lgm.mjs";
|
|
4
4
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/test/index.d.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/sdk",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.3",
|
|
4
4
|
"description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/configure/index.mjs",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"@connectrpc/connect": "2.1.1",
|
|
45
45
|
"@connectrpc/connect-node": "2.1.1",
|
|
46
46
|
"@standard-schema/spec": "1.1.0",
|
|
47
|
-
"@urql/core": "
|
|
47
|
+
"@urql/core": "6.0.1",
|
|
48
48
|
"chalk": "5.6.2",
|
|
49
|
-
"chokidar": "
|
|
49
|
+
"chokidar": "5.0.0",
|
|
50
50
|
"citty": "0.1.6",
|
|
51
51
|
"confbox": "0.2.2",
|
|
52
52
|
"consola": "3.4.2",
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"madge": "8.0.0",
|
|
57
57
|
"mime-types": "3.0.2",
|
|
58
58
|
"multiline-ts": "4.0.1",
|
|
59
|
-
"open": "
|
|
59
|
+
"open": "11.0.0",
|
|
60
60
|
"ora": "9.0.0",
|
|
61
|
-
"oxc-parser": "0.
|
|
62
|
-
"p-limit": "
|
|
61
|
+
"oxc-parser": "0.104.0",
|
|
62
|
+
"p-limit": "7.2.0",
|
|
63
63
|
"pkg-types": "2.3.0",
|
|
64
64
|
"rolldown": "1.0.0-beta.55",
|
|
65
65
|
"table": "6.9.0",
|
|
@@ -75,7 +75,8 @@
|
|
|
75
75
|
"@tailor-platform/function-types": "0.8.0",
|
|
76
76
|
"@types/madge": "5.0.3",
|
|
77
77
|
"@types/mime-types": "3.0.1",
|
|
78
|
-
"@types/node": "
|
|
78
|
+
"@types/node": "24.10.4",
|
|
79
|
+
"@vitest/coverage-v8": "4.0.16",
|
|
79
80
|
"cross-env": "10.1.0",
|
|
80
81
|
"eslint": "9.39.2",
|
|
81
82
|
"eslint-plugin-jsdoc": "61.5.0",
|
|
@@ -85,10 +86,11 @@
|
|
|
85
86
|
"tsdown": "0.18.1",
|
|
86
87
|
"typescript": "5.9.3",
|
|
87
88
|
"typescript-eslint": "8.50.0",
|
|
88
|
-
"vitest": "4.0.
|
|
89
|
+
"vitest": "4.0.16"
|
|
89
90
|
},
|
|
90
91
|
"scripts": {
|
|
91
92
|
"test": "vitest",
|
|
93
|
+
"test:coverage": "vitest --coverage",
|
|
92
94
|
"build": "tsdown && cross-env FORCE_CREATE=1 node postinstall.mjs",
|
|
93
95
|
"lint": "eslint --cache .",
|
|
94
96
|
"lint:fix": "eslint --cache . --fix",
|