@tailor-platform/sdk 1.2.3 → 1.2.4
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 +40 -0
- package/dist/cli/index.mjs +4 -2
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +7 -3
- package/dist/cli/lib.mjs +2 -2
- package/dist/{config-CJPKA-ui.mjs → config-BmQRlW1j.mjs} +18 -1
- package/dist/config-BmQRlW1j.mjs.map +1 -0
- package/dist/configure/index.d.mts +2 -2
- package/dist/configure/index.mjs +3 -1
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{index-DXZMT4aO.d.mts → index-Dkyvjk4D.d.mts} +4 -2
- package/dist/jiti-31_Wx1yz.mjs +4482 -0
- package/dist/jiti-31_Wx1yz.mjs.map +1 -0
- package/dist/{list-nW4EfF7C.mjs → list-BCSBAjwc.mjs} +2766 -2643
- package/dist/list-BCSBAjwc.mjs.map +1 -0
- package/dist/{types-Dg_zk_OZ.d.mts → types-BeinUo7W.d.mts} +243 -187
- package/dist/utils/test/index.d.mts +2 -2
- package/package.json +11 -9
- package/dist/config-CJPKA-ui.mjs.map +0 -1
- package/dist/jiti-1z3eKztL.mjs +0 -45561
- package/dist/jiti-1z3eKztL.mjs.map +0 -1
- package/dist/list-nW4EfF7C.mjs.map +0 -1
|
@@ -263,6 +263,11 @@ declare class TailorField<const Defined extends DefinedFieldMetadata = DefinedFi
|
|
|
263
263
|
/**
|
|
264
264
|
* Parse and validate a value against this field's validation rules
|
|
265
265
|
* Returns StandardSchema Result type with success or failure
|
|
266
|
+
* @param {{ value: unknown; data: unknown; user: TailorUser }} args - Value, context data, and user
|
|
267
|
+
* @param {unknown} args.value - Value to validate
|
|
268
|
+
* @param {unknown} args.data - Context data
|
|
269
|
+
* @param {TailorUser} args.user - Tailor user information
|
|
270
|
+
* @returns {StandardSchemaV1.Result<Output>} Validation result
|
|
266
271
|
*/
|
|
267
272
|
parse(args: {
|
|
268
273
|
value: unknown;
|
|
@@ -273,11 +278,23 @@ declare class TailorField<const Defined extends DefinedFieldMetadata = DefinedFi
|
|
|
273
278
|
* Validate a single value (not an array element)
|
|
274
279
|
* Used internally for array element validation
|
|
275
280
|
* @private
|
|
281
|
+
* @param {{ value: TailorToTs[T]; data: unknown; user: TailorUser; pathArray: string[] }} args - Validation arguments
|
|
282
|
+
* @param {TailorToTs[T]} args.value - Value to validate
|
|
283
|
+
* @param {unknown} args.data - Context data
|
|
284
|
+
* @param {TailorUser} args.user - Tailor user information
|
|
285
|
+
* @param {string[]} args.pathArray - Field path array for nested validation
|
|
286
|
+
* @returns {StandardSchemaV1.Issue[]} Validation issues
|
|
276
287
|
*/
|
|
277
288
|
private _validateValue;
|
|
278
289
|
/**
|
|
279
290
|
* Internal parse method that tracks field path for nested validation
|
|
280
291
|
* @private
|
|
292
|
+
* @param {{ value: unknown; data: unknown; user: TailorUser; pathArray: string[] }} args - Parse arguments
|
|
293
|
+
* @param {unknown} args.value - Value to parse
|
|
294
|
+
* @param {unknown} args.data - Context data
|
|
295
|
+
* @param {TailorUser} args.user - Tailor user information
|
|
296
|
+
* @param {string[]} args.pathArray - Field path array for nested validation
|
|
297
|
+
* @returns {StandardSchemaV1.Result<Output>} Validation result
|
|
281
298
|
*/
|
|
282
299
|
private _parseInternal;
|
|
283
300
|
}
|
|
@@ -317,6 +334,167 @@ type TailorUser = {
|
|
|
317
334
|
/** Represents an unauthenticated user in the Tailor platform. */
|
|
318
335
|
declare const unauthenticatedTailorUser: TailorUser;
|
|
319
336
|
//#endregion
|
|
337
|
+
//#region src/configure/services/tailordb/permission.d.ts
|
|
338
|
+
type TailorTypePermission<User extends object = InferredAttributeMap, Type extends object = object> = {
|
|
339
|
+
create: readonly ActionPermission<"record", User, Type, false>[];
|
|
340
|
+
read: readonly ActionPermission<"record", User, Type, false>[];
|
|
341
|
+
update: readonly ActionPermission<"record", User, Type, true>[];
|
|
342
|
+
delete: readonly ActionPermission<"record", User, Type, false>[];
|
|
343
|
+
};
|
|
344
|
+
type ActionPermission<Level extends "record" | "gql" = "record" | "gql", User extends object = InferredAttributeMap, Type extends object = object, Update extends boolean = boolean> = {
|
|
345
|
+
conditions: PermissionCondition<Level, User, Update, Type> | readonly PermissionCondition<Level, User, Update, Type>[];
|
|
346
|
+
description?: string | undefined;
|
|
347
|
+
permit?: boolean;
|
|
348
|
+
} | readonly [...PermissionCondition<Level, User, Update, Type>, ...([] | [boolean])] | readonly [...PermissionCondition<Level, User, Update, Type>[], ...([] | [boolean])];
|
|
349
|
+
type TailorTypeGqlPermission<User extends object = InferredAttributeMap, Type extends object = object> = readonly GqlPermissionPolicy<User, Type>[];
|
|
350
|
+
type GqlPermissionPolicy<User extends object = InferredAttributeMap, Type extends object = object> = {
|
|
351
|
+
conditions: readonly PermissionCondition<"gql", User, boolean, Type>[];
|
|
352
|
+
actions: "all" | readonly GqlPermissionAction$1[];
|
|
353
|
+
permit?: boolean;
|
|
354
|
+
description?: string;
|
|
355
|
+
};
|
|
356
|
+
type GqlPermissionAction$1 = "read" | "create" | "update" | "delete" | "aggregate" | "bulkUpsert";
|
|
357
|
+
type EqualityOperator = "=" | "!=";
|
|
358
|
+
type ContainsOperator = "in" | "not in";
|
|
359
|
+
type StringFieldKeys<User extends object> = { [K in keyof User]: User[K] extends string ? K : never }[keyof User];
|
|
360
|
+
type StringArrayFieldKeys<User extends object> = { [K in keyof User]: User[K] extends string[] ? K : never }[keyof User];
|
|
361
|
+
type BooleanFieldKeys<User extends object> = { [K in keyof User]: User[K] extends boolean ? K : never }[keyof User];
|
|
362
|
+
type BooleanArrayFieldKeys<User extends object> = { [K in keyof User]: User[K] extends boolean[] ? K : never }[keyof User];
|
|
363
|
+
type UserStringOperand<User extends object = InferredAttributeMap> = {
|
|
364
|
+
user: StringFieldKeys<User> | "id";
|
|
365
|
+
};
|
|
366
|
+
type UserStringArrayOperand<User extends object = InferredAttributeMap> = {
|
|
367
|
+
user: StringArrayFieldKeys<User>;
|
|
368
|
+
};
|
|
369
|
+
type UserBooleanOperand<User extends object = InferredAttributeMap> = {
|
|
370
|
+
user: BooleanFieldKeys<User> | "_loggedIn";
|
|
371
|
+
};
|
|
372
|
+
type UserBooleanArrayOperand<User extends object = InferredAttributeMap> = {
|
|
373
|
+
user: BooleanArrayFieldKeys<User>;
|
|
374
|
+
};
|
|
375
|
+
type RecordOperand$1<Type extends object, Update extends boolean = false> = Update extends true ? {
|
|
376
|
+
oldRecord: (keyof Type & string) | "id";
|
|
377
|
+
} | {
|
|
378
|
+
newRecord: (keyof Type & string) | "id";
|
|
379
|
+
} : {
|
|
380
|
+
record: (keyof Type & string) | "id";
|
|
381
|
+
};
|
|
382
|
+
type StringEqualityCondition<Level extends "record" | "gql", User extends object, Update extends boolean, Type extends object> = (Level extends "gql" ? readonly [string, EqualityOperator, boolean] : never) | readonly [string, EqualityOperator, string] | readonly [UserStringOperand<User>, EqualityOperator, string] | readonly [string, EqualityOperator, UserStringOperand<User>] | (Level extends "record" ? readonly [RecordOperand$1<Type, Update>, EqualityOperator, string | UserStringOperand<User>] | readonly [string | UserStringOperand<User>, EqualityOperator, RecordOperand$1<Type, Update>] : never);
|
|
383
|
+
type BooleanEqualityCondition<Level extends "record" | "gql", User extends object, Update extends boolean, Type extends object> = readonly [boolean, EqualityOperator, boolean] | readonly [UserBooleanOperand<User>, EqualityOperator, boolean] | readonly [boolean, EqualityOperator, UserBooleanOperand<User>] | (Level extends "record" ? readonly [RecordOperand$1<Type, Update>, EqualityOperator, boolean | UserBooleanOperand<User>] | readonly [boolean | UserBooleanOperand<User>, EqualityOperator, RecordOperand$1<Type, Update>] : never);
|
|
384
|
+
type EqualityCondition<Level extends "record" | "gql" = "record", User extends object = InferredAttributeMap, Update extends boolean = boolean, Type extends object = object> = StringEqualityCondition<Level, User, Update, Type> | BooleanEqualityCondition<Level, User, Update, Type>;
|
|
385
|
+
type StringContainsCondition<Level extends "record" | "gql", User extends object, Update extends boolean, Type extends object> = readonly [string, ContainsOperator, string[]] | readonly [UserStringOperand<User>, ContainsOperator, string[]] | readonly [string, ContainsOperator, UserStringArrayOperand<User>] | (Level extends "record" ? readonly [RecordOperand$1<Type, Update>, ContainsOperator, string[] | UserStringArrayOperand<User>] | readonly [string | UserStringOperand<User>, ContainsOperator, RecordOperand$1<Type, Update>] : never);
|
|
386
|
+
type BooleanContainsCondition<Level extends "record" | "gql", User extends object, Update extends boolean, Type extends object> = (Level extends "gql" ? readonly [string, ContainsOperator, boolean[]] : never) | readonly [boolean, ContainsOperator, boolean[]] | readonly [UserBooleanOperand<User>, ContainsOperator, boolean[]] | readonly [boolean, ContainsOperator, UserBooleanArrayOperand<User>] | (Level extends "record" ? readonly [RecordOperand$1<Type, Update>, ContainsOperator, boolean[] | UserBooleanArrayOperand<User>] | readonly [boolean | UserBooleanOperand<User>, ContainsOperator, RecordOperand$1<Type, Update>] : never);
|
|
387
|
+
type ContainsCondition<Level extends "record" | "gql" = "record", User extends object = InferredAttributeMap, Update extends boolean = boolean, Type extends object = object> = StringContainsCondition<Level, User, Update, Type> | BooleanContainsCondition<Level, User, Update, Type>;
|
|
388
|
+
/**
|
|
389
|
+
* Type representing a permission condition that combines user attributes, record fields, and literal values using comparison operators.
|
|
390
|
+
*
|
|
391
|
+
* The User type is extended by `user-defined.d.ts`, which is automatically generated when running `tailor-sdk generate`.
|
|
392
|
+
* Attributes enabled in the config file's `auth.userProfile.attributes` become available as types.
|
|
393
|
+
* @example
|
|
394
|
+
* ```ts
|
|
395
|
+
* // tailor.config.ts
|
|
396
|
+
* export const auth = defineAuth("my-auth", {
|
|
397
|
+
* userProfile: {
|
|
398
|
+
* type: user,
|
|
399
|
+
* attributes: {
|
|
400
|
+
* isAdmin: true,
|
|
401
|
+
* roles: true,
|
|
402
|
+
* }
|
|
403
|
+
* }
|
|
404
|
+
* });
|
|
405
|
+
* ```
|
|
406
|
+
*/
|
|
407
|
+
type PermissionCondition<Level extends "record" | "gql" = "record", User extends object = InferredAttributeMap, Update extends boolean = boolean, Type extends object = object> = EqualityCondition<Level, User, Update, Type> | ContainsCondition<Level, User, Update, Type>;
|
|
408
|
+
/**
|
|
409
|
+
* Grants full record-level access without any conditions.
|
|
410
|
+
*
|
|
411
|
+
* Unsafe and intended only for local development, prototyping, or tests.
|
|
412
|
+
* Do not use this in production environments, as it effectively disables
|
|
413
|
+
* authorization checks.
|
|
414
|
+
*/
|
|
415
|
+
declare const unsafeAllowAllTypePermission: TailorTypePermission;
|
|
416
|
+
/**
|
|
417
|
+
* Grants full GraphQL access (all actions) without any conditions.
|
|
418
|
+
*
|
|
419
|
+
* Unsafe and intended only for local development, prototyping, or tests.
|
|
420
|
+
* Do not use this in production environments, as it effectively disables
|
|
421
|
+
* authorization checks.
|
|
422
|
+
*/
|
|
423
|
+
declare const unsafeAllowAllGqlPermission: TailorTypeGqlPermission;
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region src/configure/services/tailordb/types.d.ts
|
|
426
|
+
type SerialConfig<T$1 extends "string" | "integer" = "string" | "integer"> = Prettify<{
|
|
427
|
+
start: number;
|
|
428
|
+
maxValue?: number;
|
|
429
|
+
} & (T$1 extends "string" ? {
|
|
430
|
+
format?: string;
|
|
431
|
+
} : object)>;
|
|
432
|
+
interface DBFieldMetadata extends FieldMetadata {
|
|
433
|
+
index?: boolean;
|
|
434
|
+
unique?: boolean;
|
|
435
|
+
vector?: boolean;
|
|
436
|
+
foreignKey?: boolean;
|
|
437
|
+
foreignKeyType?: string;
|
|
438
|
+
foreignKeyField?: string;
|
|
439
|
+
hooks?: Hook<any, any>;
|
|
440
|
+
serial?: SerialConfig;
|
|
441
|
+
relation?: boolean;
|
|
442
|
+
}
|
|
443
|
+
interface DefinedDBFieldMetadata extends DefinedFieldMetadata {
|
|
444
|
+
index?: boolean;
|
|
445
|
+
unique?: boolean;
|
|
446
|
+
vector?: boolean;
|
|
447
|
+
foreignKey?: boolean;
|
|
448
|
+
foreignKeyType?: boolean;
|
|
449
|
+
validate?: boolean;
|
|
450
|
+
hooks?: {
|
|
451
|
+
create: boolean;
|
|
452
|
+
update: boolean;
|
|
453
|
+
};
|
|
454
|
+
serial?: boolean;
|
|
455
|
+
relation?: boolean;
|
|
456
|
+
}
|
|
457
|
+
type ExcludeNestedDBFields<T$1 extends Record<string, TailorAnyDBField>> = { [K in keyof T$1]: T$1[K] extends TailorDBField<{
|
|
458
|
+
type: "nested";
|
|
459
|
+
array: boolean;
|
|
460
|
+
}, any> ? never : T$1[K] };
|
|
461
|
+
type HookFn<TValue, TData, TReturn> = (args: {
|
|
462
|
+
value: TValue;
|
|
463
|
+
data: TData extends Record<string, unknown> ? { readonly [K in keyof TData]?: TData[K] | null | undefined } : unknown;
|
|
464
|
+
user: TailorUser;
|
|
465
|
+
}) => TReturn;
|
|
466
|
+
type Hook<TData, TReturn> = {
|
|
467
|
+
create?: HookFn<TReturn | null, TData, TReturn>;
|
|
468
|
+
update?: HookFn<TReturn | null, TData, TReturn>;
|
|
469
|
+
};
|
|
470
|
+
type Hooks<F extends Record<string, TailorAnyDBField>, TData = { [K in keyof F]: output<F[K]> }> = NonEmptyObject<{ [K in Exclude<keyof F, "id"> as F[K]["_defined"] extends {
|
|
471
|
+
hooks: unknown;
|
|
472
|
+
} ? never : F[K]["_defined"] extends {
|
|
473
|
+
type: "nested";
|
|
474
|
+
} ? never : K]?: Hook<TData, output<F[K]>> }>;
|
|
475
|
+
type TailorDBServiceConfig = {
|
|
476
|
+
files: string[];
|
|
477
|
+
ignores?: string[];
|
|
478
|
+
};
|
|
479
|
+
type TailorDBExternalConfig = {
|
|
480
|
+
external: true;
|
|
481
|
+
};
|
|
482
|
+
type TailorDBServiceInput = {
|
|
483
|
+
[namespace: string]: TailorDBServiceConfig | TailorDBExternalConfig;
|
|
484
|
+
};
|
|
485
|
+
type IndexDef<T$1 extends {
|
|
486
|
+
fields: Record<PropertyKey, unknown>;
|
|
487
|
+
}> = {
|
|
488
|
+
fields: [keyof T$1["fields"], keyof T$1["fields"], ...(keyof T$1["fields"])[]];
|
|
489
|
+
unique?: boolean;
|
|
490
|
+
name?: string;
|
|
491
|
+
};
|
|
492
|
+
interface TypeFeatures {
|
|
493
|
+
pluralForm?: string;
|
|
494
|
+
aggregation?: true;
|
|
495
|
+
bulkUpsert?: true;
|
|
496
|
+
}
|
|
497
|
+
//#endregion
|
|
320
498
|
//#region src/parser/service/auth/schema.d.ts
|
|
321
499
|
declare const AuthInvokerSchema: z.ZodObject<{
|
|
322
500
|
namespace: z.ZodString;
|
|
@@ -561,191 +739,6 @@ type AuthServiceInput<User extends TailorDBInstance, AttributeMap$1 extends User
|
|
|
561
739
|
tenantProvider?: TenantProviderConfig;
|
|
562
740
|
};
|
|
563
741
|
//#endregion
|
|
564
|
-
//#region src/configure/services/auth/index.d.ts
|
|
565
|
-
declare const authDefinitionBrand: unique symbol;
|
|
566
|
-
type AuthDefinitionBrand = {
|
|
567
|
-
readonly [authDefinitionBrand]: true;
|
|
568
|
-
};
|
|
569
|
-
/**
|
|
570
|
-
* Invoker type compatible with tailor.v1.AuthInvoker
|
|
571
|
-
* - namespace: auth service name
|
|
572
|
-
* - machineUserName: machine user name
|
|
573
|
-
*/
|
|
574
|
-
type AuthInvoker<M extends string> = Omit<AuthInvoker$1, "machineUserName"> & {
|
|
575
|
-
machineUserName: M;
|
|
576
|
-
};
|
|
577
|
-
/**
|
|
578
|
-
* Define an auth service for the Tailor SDK.
|
|
579
|
-
* @template Name
|
|
580
|
-
* @template User
|
|
581
|
-
* @template AttributeMap
|
|
582
|
-
* @template AttributeList
|
|
583
|
-
* @template MachineUserNames
|
|
584
|
-
* @template M
|
|
585
|
-
* @param {Name} name - Auth service name
|
|
586
|
-
* @param {AuthServiceInput<User, AttributeMap, AttributeList, MachineUserNames>} config - Auth service configuration
|
|
587
|
-
* @returns {AuthDefinitionBrand & AuthServiceInput<User, AttributeMap, AttributeList, MachineUserNames> & { name: string; invoker<M extends MachineUserNames>(machineUser: M): AuthInvoker<M> }} Defined auth service
|
|
588
|
-
*/
|
|
589
|
-
declare function defineAuth<const Name extends string, const User extends TailorDBInstance, const AttributeMap$1 extends UserAttributeMap<User>, const AttributeList$1 extends UserAttributeListKey<User>[], const MachineUserNames extends string>(name: Name, config: AuthServiceInput<User, AttributeMap$1, AttributeList$1, MachineUserNames>): {
|
|
590
|
-
readonly name: Name;
|
|
591
|
-
readonly invoker: <M extends MachineUserNames>(machineUser: M) => {
|
|
592
|
-
readonly namespace: Name;
|
|
593
|
-
readonly machineUserName: M;
|
|
594
|
-
};
|
|
595
|
-
readonly userProfile?: {
|
|
596
|
-
namespace?: string;
|
|
597
|
-
type: User;
|
|
598
|
-
usernameField: UsernameFieldKey<User>;
|
|
599
|
-
attributes?: (AttributeMap$1 & { [K in Exclude<keyof AttributeMap$1, UserAttributeKey<User>>]: never }) | undefined;
|
|
600
|
-
attributeList?: AttributeList$1 | undefined;
|
|
601
|
-
} | undefined;
|
|
602
|
-
readonly machineUsers?: Record<MachineUserNames, type_fest0.IsAny<User> extends true ? {
|
|
603
|
-
attributes: Record<string, AuthAttributeValue>;
|
|
604
|
-
attributeList?: string[];
|
|
605
|
-
} : (Extract<{ [K_1 in keyof AttributeMap$1]-?: undefined extends AttributeMap$1[K_1] ? never : K_1 }[keyof AttributeMap$1], UserAttributeKey<User>> extends never ? {
|
|
606
|
-
attributes?: never;
|
|
607
|
-
} : {
|
|
608
|
-
attributes: { [K_2 in Extract<{ [K_1 in keyof AttributeMap$1]-?: undefined extends AttributeMap$1[K_1] ? never : K_1 }[keyof AttributeMap$1], 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$1]-?: undefined extends AttributeMap$1[K_1] ? never : K_1 }[keyof AttributeMap$1], UserAttributeKey<User>>>]?: undefined };
|
|
609
|
-
}) & ([] extends AttributeList$1 ? {
|
|
610
|
-
attributeList?: never;
|
|
611
|
-
} : {
|
|
612
|
-
attributeList: { [Index in keyof AttributeList$1]: AttributeList$1[Index] extends UserAttributeListKey<User> ? AttributeList$1[Index] extends infer T ? T extends AttributeList$1[Index] ? T extends keyof output<User> ? output<User>[T] : never : never : never : never };
|
|
613
|
-
})> | undefined;
|
|
614
|
-
readonly oauth2Clients?: Record<string, OAuth2ClientInput>;
|
|
615
|
-
readonly idProvider?: IdProviderConfig;
|
|
616
|
-
readonly scim?: SCIMConfig;
|
|
617
|
-
readonly tenantProvider?: TenantProviderConfig;
|
|
618
|
-
} & AuthDefinitionBrand;
|
|
619
|
-
type AuthExternalConfig = {
|
|
620
|
-
name: string;
|
|
621
|
-
external: true;
|
|
622
|
-
};
|
|
623
|
-
type AuthOwnConfig = ReturnType<typeof defineAuth<string, any, any, any, string>>;
|
|
624
|
-
type AuthConfig = AuthOwnConfig | AuthExternalConfig;
|
|
625
|
-
//#endregion
|
|
626
|
-
//#region src/configure/services/tailordb/permission.d.ts
|
|
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 ActionPermission<Level extends "record" | "gql" = "record" | "gql", User extends object = InferredAttributeMap, Type extends object = object, Update extends boolean = boolean> = {
|
|
634
|
-
conditions: PermissionCondition<Level, User, Update, Type> | readonly PermissionCondition<Level, User, Update, Type>[];
|
|
635
|
-
description?: string | undefined;
|
|
636
|
-
permit?: boolean;
|
|
637
|
-
} | readonly [...PermissionCondition<Level, User, Update, Type>, ...([] | [boolean])] | readonly [...PermissionCondition<Level, User, Update, Type>[], ...([] | [boolean])];
|
|
638
|
-
type TailorTypeGqlPermission<User extends object = InferredAttributeMap, Type extends object = object> = readonly GqlPermissionPolicy<User, Type>[];
|
|
639
|
-
type GqlPermissionPolicy<User extends object = InferredAttributeMap, Type extends object = object> = {
|
|
640
|
-
conditions: readonly PermissionCondition<"gql", User, boolean, Type>[];
|
|
641
|
-
actions: "all" | readonly GqlPermissionAction$1[];
|
|
642
|
-
permit?: boolean;
|
|
643
|
-
description?: string;
|
|
644
|
-
};
|
|
645
|
-
type GqlPermissionAction$1 = "read" | "create" | "update" | "delete" | "aggregate" | "bulkUpsert";
|
|
646
|
-
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>];
|
|
647
|
-
type UserOperand$1<User extends object = InferredAttributeMap> = {
|
|
648
|
-
user: { [K in keyof User]: User[K] extends string | string[] | boolean | boolean[] ? K : never }[keyof User] | "id" | "_loggedIn";
|
|
649
|
-
};
|
|
650
|
-
type RecordOperand$1<Type extends object, Update extends boolean = false> = Update extends true ? {
|
|
651
|
-
oldRecord: (keyof Type & string) | "id";
|
|
652
|
-
} | {
|
|
653
|
-
newRecord: (keyof Type & string) | "id";
|
|
654
|
-
} : {
|
|
655
|
-
record: (keyof Type & string) | "id";
|
|
656
|
-
};
|
|
657
|
-
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);
|
|
658
|
-
type PermissionOperator = "=" | "!=" | "in" | "not in";
|
|
659
|
-
/**
|
|
660
|
-
* Grants full record-level access without any conditions.
|
|
661
|
-
*
|
|
662
|
-
* Unsafe and intended only for local development, prototyping, or tests.
|
|
663
|
-
* Do not use this in production environments, as it effectively disables
|
|
664
|
-
* authorization checks.
|
|
665
|
-
*/
|
|
666
|
-
declare const unsafeAllowAllTypePermission: TailorTypePermission;
|
|
667
|
-
/**
|
|
668
|
-
* Grants full GraphQL access (all actions) without any conditions.
|
|
669
|
-
*
|
|
670
|
-
* Unsafe and intended only for local development, prototyping, or tests.
|
|
671
|
-
* Do not use this in production environments, as it effectively disables
|
|
672
|
-
* authorization checks.
|
|
673
|
-
*/
|
|
674
|
-
declare const unsafeAllowAllGqlPermission: TailorTypeGqlPermission;
|
|
675
|
-
//#endregion
|
|
676
|
-
//#region src/configure/services/tailordb/types.d.ts
|
|
677
|
-
type SerialConfig<T$1 extends "string" | "integer" = "string" | "integer"> = Prettify<{
|
|
678
|
-
start: number;
|
|
679
|
-
maxValue?: number;
|
|
680
|
-
} & (T$1 extends "string" ? {
|
|
681
|
-
format?: string;
|
|
682
|
-
} : object)>;
|
|
683
|
-
interface DBFieldMetadata extends FieldMetadata {
|
|
684
|
-
index?: boolean;
|
|
685
|
-
unique?: boolean;
|
|
686
|
-
vector?: boolean;
|
|
687
|
-
foreignKey?: boolean;
|
|
688
|
-
foreignKeyType?: string;
|
|
689
|
-
foreignKeyField?: string;
|
|
690
|
-
hooks?: Hook<any, any>;
|
|
691
|
-
serial?: SerialConfig;
|
|
692
|
-
relation?: boolean;
|
|
693
|
-
}
|
|
694
|
-
interface DefinedDBFieldMetadata extends DefinedFieldMetadata {
|
|
695
|
-
index?: boolean;
|
|
696
|
-
unique?: boolean;
|
|
697
|
-
vector?: boolean;
|
|
698
|
-
foreignKey?: boolean;
|
|
699
|
-
foreignKeyType?: boolean;
|
|
700
|
-
validate?: boolean;
|
|
701
|
-
hooks?: {
|
|
702
|
-
create: boolean;
|
|
703
|
-
update: boolean;
|
|
704
|
-
};
|
|
705
|
-
serial?: boolean;
|
|
706
|
-
relation?: boolean;
|
|
707
|
-
}
|
|
708
|
-
type ExcludeNestedDBFields<T$1 extends Record<string, TailorAnyDBField>> = { [K in keyof T$1]: T$1[K] extends TailorDBField<{
|
|
709
|
-
type: "nested";
|
|
710
|
-
array: boolean;
|
|
711
|
-
}, any> ? never : T$1[K] };
|
|
712
|
-
type HookFn<TValue, TData, TReturn> = (args: {
|
|
713
|
-
value: TValue;
|
|
714
|
-
data: TData extends Record<string, unknown> ? { readonly [K in keyof TData]?: TData[K] | null | undefined } : unknown;
|
|
715
|
-
user: TailorUser;
|
|
716
|
-
}) => TReturn;
|
|
717
|
-
type Hook<TData, TReturn> = {
|
|
718
|
-
create?: HookFn<TReturn | null, TData, TReturn>;
|
|
719
|
-
update?: HookFn<TReturn | null, TData, TReturn>;
|
|
720
|
-
};
|
|
721
|
-
type Hooks<F extends Record<string, TailorAnyDBField>, TData = { [K in keyof F]: output<F[K]> }> = NonEmptyObject<{ [K in Exclude<keyof F, "id"> as F[K]["_defined"] extends {
|
|
722
|
-
hooks: unknown;
|
|
723
|
-
} ? never : F[K]["_defined"] extends {
|
|
724
|
-
type: "nested";
|
|
725
|
-
} ? never : K]?: Hook<TData, output<F[K]>> }>;
|
|
726
|
-
type TailorDBServiceConfig = {
|
|
727
|
-
files: string[];
|
|
728
|
-
ignores?: string[];
|
|
729
|
-
};
|
|
730
|
-
type TailorDBExternalConfig = {
|
|
731
|
-
external: true;
|
|
732
|
-
};
|
|
733
|
-
type TailorDBServiceInput = {
|
|
734
|
-
[namespace: string]: TailorDBServiceConfig | TailorDBExternalConfig;
|
|
735
|
-
};
|
|
736
|
-
type IndexDef<T$1 extends {
|
|
737
|
-
fields: Record<PropertyKey, unknown>;
|
|
738
|
-
}> = {
|
|
739
|
-
fields: [keyof T$1["fields"], keyof T$1["fields"], ...(keyof T$1["fields"])[]];
|
|
740
|
-
unique?: boolean;
|
|
741
|
-
name?: string;
|
|
742
|
-
};
|
|
743
|
-
interface TypeFeatures {
|
|
744
|
-
pluralForm?: string;
|
|
745
|
-
aggregation?: true;
|
|
746
|
-
bulkUpsert?: true;
|
|
747
|
-
}
|
|
748
|
-
//#endregion
|
|
749
742
|
//#region src/parser/service/tailordb/types.d.ts
|
|
750
743
|
interface Script {
|
|
751
744
|
expr: string;
|
|
@@ -1209,6 +1202,68 @@ declare const db: {
|
|
|
1209
1202
|
};
|
|
1210
1203
|
};
|
|
1211
1204
|
//#endregion
|
|
1205
|
+
//#region src/configure/services/auth/index.d.ts
|
|
1206
|
+
declare const authDefinitionBrand: unique symbol;
|
|
1207
|
+
type AuthDefinitionBrand = {
|
|
1208
|
+
readonly [authDefinitionBrand]: true;
|
|
1209
|
+
};
|
|
1210
|
+
/**
|
|
1211
|
+
* Invoker type compatible with tailor.v1.AuthInvoker
|
|
1212
|
+
* - namespace: auth service name
|
|
1213
|
+
* - machineUserName: machine user name
|
|
1214
|
+
*/
|
|
1215
|
+
type AuthInvoker<M extends string> = Omit<AuthInvoker$1, "machineUserName"> & {
|
|
1216
|
+
machineUserName: M;
|
|
1217
|
+
};
|
|
1218
|
+
/**
|
|
1219
|
+
* Define an auth service for the Tailor SDK.
|
|
1220
|
+
* @template Name
|
|
1221
|
+
* @template User
|
|
1222
|
+
* @template AttributeMap
|
|
1223
|
+
* @template AttributeList
|
|
1224
|
+
* @template MachineUserNames
|
|
1225
|
+
* @template M
|
|
1226
|
+
* @param {Name} name - Auth service name
|
|
1227
|
+
* @param {AuthServiceInput<User, AttributeMap, AttributeList, MachineUserNames>} config - Auth service configuration
|
|
1228
|
+
* @returns {AuthDefinitionBrand & AuthServiceInput<User, AttributeMap, AttributeList, MachineUserNames> & { name: string; invoker<M extends MachineUserNames>(machineUser: M): AuthInvoker<M> }} Defined auth service
|
|
1229
|
+
*/
|
|
1230
|
+
declare function defineAuth<const Name extends string, const User extends TailorDBInstance, const AttributeMap$1 extends UserAttributeMap<User>, const AttributeList$1 extends UserAttributeListKey<User>[], const MachineUserNames extends string>(name: Name, config: AuthServiceInput<User, AttributeMap$1, AttributeList$1, MachineUserNames>): {
|
|
1231
|
+
readonly name: Name;
|
|
1232
|
+
readonly invoker: <M extends MachineUserNames>(machineUser: M) => {
|
|
1233
|
+
readonly namespace: Name;
|
|
1234
|
+
readonly machineUserName: M;
|
|
1235
|
+
};
|
|
1236
|
+
readonly userProfile?: {
|
|
1237
|
+
namespace?: string;
|
|
1238
|
+
type: User;
|
|
1239
|
+
usernameField: UsernameFieldKey<User>;
|
|
1240
|
+
attributes?: (AttributeMap$1 & { [K in Exclude<keyof AttributeMap$1, UserAttributeKey<User>>]: never }) | undefined;
|
|
1241
|
+
attributeList?: AttributeList$1 | undefined;
|
|
1242
|
+
} | undefined;
|
|
1243
|
+
readonly machineUsers?: Record<MachineUserNames, type_fest0.IsAny<User> extends true ? {
|
|
1244
|
+
attributes: Record<string, AuthAttributeValue>;
|
|
1245
|
+
attributeList?: string[];
|
|
1246
|
+
} : (Extract<{ [K_1 in keyof AttributeMap$1]-?: undefined extends AttributeMap$1[K_1] ? never : K_1 }[keyof AttributeMap$1], UserAttributeKey<User>> extends never ? {
|
|
1247
|
+
attributes?: never;
|
|
1248
|
+
} : {
|
|
1249
|
+
attributes: { [K_2 in Extract<{ [K_1 in keyof AttributeMap$1]-?: undefined extends AttributeMap$1[K_1] ? never : K_1 }[keyof AttributeMap$1], 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$1]-?: undefined extends AttributeMap$1[K_1] ? never : K_1 }[keyof AttributeMap$1], UserAttributeKey<User>>>]?: undefined };
|
|
1250
|
+
}) & ([] extends AttributeList$1 ? {
|
|
1251
|
+
attributeList?: never;
|
|
1252
|
+
} : {
|
|
1253
|
+
attributeList: { [Index in keyof AttributeList$1]: AttributeList$1[Index] extends UserAttributeListKey<User> ? AttributeList$1[Index] extends infer T ? T extends AttributeList$1[Index] ? T extends keyof output<User> ? output<User>[T] : never : never : never : never };
|
|
1254
|
+
})> | undefined;
|
|
1255
|
+
readonly oauth2Clients?: Record<string, OAuth2ClientInput>;
|
|
1256
|
+
readonly idProvider?: IdProviderConfig;
|
|
1257
|
+
readonly scim?: SCIMConfig;
|
|
1258
|
+
readonly tenantProvider?: TenantProviderConfig;
|
|
1259
|
+
} & AuthDefinitionBrand;
|
|
1260
|
+
type AuthExternalConfig = {
|
|
1261
|
+
name: string;
|
|
1262
|
+
external: true;
|
|
1263
|
+
};
|
|
1264
|
+
type AuthOwnConfig = ReturnType<typeof defineAuth<string, any, any, any, string>>;
|
|
1265
|
+
type AuthConfig = AuthOwnConfig | AuthExternalConfig;
|
|
1266
|
+
//#endregion
|
|
1212
1267
|
//#region src/configure/services/executor/types.d.ts
|
|
1213
1268
|
type ExecutorServiceConfig = {
|
|
1214
1269
|
files: string[];
|
|
@@ -1403,6 +1458,7 @@ declare const BaseGeneratorConfigSchema: z.ZodUnion<readonly [z.ZodTuple<[z.ZodL
|
|
|
1403
1458
|
/**
|
|
1404
1459
|
* Creates a GeneratorConfigSchema with built-in generator support
|
|
1405
1460
|
* @param {Map<string, (options: unknown) => CodeGeneratorBase>} builtinGenerators - Map of generator IDs to their constructor functions
|
|
1461
|
+
* @returns {z.ZodEffects<z.ZodUnion<[typeof KyselyTypeConfigSchema, typeof SeedConfigSchema, typeof EnumConstantsConfigSchema, typeof FileUtilsConfigSchema, typeof CodeGeneratorSchema]>, CodeGeneratorBase, unknown> | z.ZodUnion<[typeof KyselyTypeConfigSchema, typeof SeedConfigSchema, typeof EnumConstantsConfigSchema, typeof FileUtilsConfigSchema, typeof CodeGeneratorSchema]>} Generator config schema
|
|
1406
1462
|
*/
|
|
1407
1463
|
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<{
|
|
1408
1464
|
distPath: z.ZodString;
|
|
@@ -1639,5 +1695,5 @@ type WorkflowOperation = z.infer<typeof WorkflowOperationSchema>;
|
|
|
1639
1695
|
type Executor = z.infer<typeof ExecutorSchema>;
|
|
1640
1696
|
type ExecutorInput = z.input<typeof ExecutorSchema>;
|
|
1641
1697
|
//#endregion
|
|
1642
|
-
export {
|
|
1643
|
-
//# sourceMappingURL=types-
|
|
1698
|
+
export { TenantProviderConfig as $, AuthOwnConfig as A, BuiltinIdP as B, ResolverServiceConfig as C, TailorFieldType as Ct, AuthConfig as D, ExecutorServiceInput as E, output as Et, db as F, OIDC as G, IdProviderConfig as H, AllowedValues as I, SCIMAttributeMapping as J, SAML as K, AllowedValuesOutput as L, TailorDBField as M, TailorDBInstance as N, AuthExternalConfig as O, TailorDBType as P, SCIMResource as Q, ParsedTailorDBType as R, ResolverExternalConfig as S, FieldOutput$1 as St, ExecutorServiceConfig as T, JsonCompatible as Tt, OAuth2ClientGrantType as U, IDToken as V, OAuth2ClientInput as W, SCIMAuthorization as X, SCIMAttributeType as Y, SCIMConfig as Z, StaticWebsiteConfig as _, Resolver as _t, IncomingWebhookTrigger as a, PermissionCondition as at, IdPExternalConfig as b, FieldMetadata as bt, ScheduleTriggerInput as c, unsafeAllowAllGqlPermission as ct, AppConfig as d, AttributeMap as dt, UserAttributeKey as et, defineConfig as f, TailorUser as ft, WorkflowServiceInput as g, QueryType as gt, WorkflowServiceConfig as h, TailorField as ht, GqlOperation as i, ValueOperand as it, defineAuth as j, AuthInvoker as k, WebhookOperation as l, unsafeAllowAllTypePermission as lt, Generator as m, TailorAnyField as mt, ExecutorInput as n, UserAttributeMap as nt, RecordTrigger as o, TailorTypeGqlPermission as ot, defineGenerators as p, unauthenticatedTailorUser as pt, SCIMAttribute as q, FunctionOperation as r, UsernameFieldKey as rt, ResolverExecutedTrigger as s, TailorTypePermission as st, Executor as t, UserAttributeListKey as tt, WorkflowOperation as u, AttributeList as ut, defineStaticWebSite as v, ResolverInput as vt, ResolverServiceInput as w, InferFieldsOutput as wt, defineIdp as x, FieldOptions as xt, IdPConfig as y, ArrayFieldOutput as yt, AuthServiceInput as z };
|
|
1699
|
+
//# sourceMappingURL=types-BeinUo7W.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="./../../user-defined.d.ts" />
|
|
2
|
-
import {
|
|
3
|
-
import { n as output } from "../../index-
|
|
2
|
+
import { P as TailorDBType, ht as TailorField } from "../../types-BeinUo7W.mjs";
|
|
3
|
+
import { n as output } from "../../index-Dkyvjk4D.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": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"@bufbuild/protobuf": "2.10.2",
|
|
44
44
|
"@connectrpc/connect": "2.1.1",
|
|
45
45
|
"@connectrpc/connect-node": "2.1.1",
|
|
46
|
+
"@oxc-project/types": "0.106.0",
|
|
46
47
|
"@standard-schema/spec": "1.1.0",
|
|
47
48
|
"@urql/core": "6.0.1",
|
|
48
49
|
"chalk": "5.6.2",
|
|
@@ -51,7 +52,6 @@
|
|
|
51
52
|
"confbox": "0.2.2",
|
|
52
53
|
"consola": "3.4.2",
|
|
53
54
|
"date-fns": "4.1.0",
|
|
54
|
-
"es-toolkit": "1.43.0",
|
|
55
55
|
"find-up-simple": "1.0.1",
|
|
56
56
|
"inflection": "3.0.2",
|
|
57
57
|
"madge": "8.0.0",
|
|
@@ -63,33 +63,34 @@
|
|
|
63
63
|
"p-limit": "7.2.0",
|
|
64
64
|
"pkg-types": "2.3.0",
|
|
65
65
|
"rolldown": "1.0.0-beta.58",
|
|
66
|
+
"std-env": "3.10.0",
|
|
66
67
|
"table": "6.9.0",
|
|
67
68
|
"ts-cron-validator": "1.1.5",
|
|
68
69
|
"tsx": "4.21.0",
|
|
69
70
|
"type-fest": "5.3.1",
|
|
70
|
-
"uuid": "13.0.0",
|
|
71
71
|
"xdg-basedir": "5.1.0",
|
|
72
|
-
"zod": "4.3.
|
|
72
|
+
"zod": "4.3.5"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@eslint/js": "9.39.2",
|
|
76
76
|
"@tailor-platform/function-types": "0.8.0",
|
|
77
|
+
"@toiroakr/lines-db": "0.6.1",
|
|
77
78
|
"@types/madge": "5.0.3",
|
|
78
79
|
"@types/mime-types": "3.0.1",
|
|
79
80
|
"@types/node": "24.10.4",
|
|
80
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
81
|
+
"@typescript/native-preview": "7.0.0-dev.20260106.1",
|
|
81
82
|
"@vitest/coverage-v8": "4.0.16",
|
|
82
83
|
"cross-env": "10.1.0",
|
|
83
84
|
"eslint": "9.39.2",
|
|
84
|
-
"eslint-plugin-jsdoc": "
|
|
85
|
+
"eslint-plugin-jsdoc": "62.0.0",
|
|
85
86
|
"eslint-plugin-oxlint": "1.36.0",
|
|
86
87
|
"globals": "17.0.0",
|
|
87
88
|
"oxlint": "1.36.0",
|
|
88
|
-
"oxlint-tsgolint": "0.
|
|
89
|
+
"oxlint-tsgolint": "0.11.0",
|
|
89
90
|
"sonda": "0.10.1",
|
|
90
91
|
"tsdown": "0.18.4",
|
|
91
92
|
"typescript": "5.9.3",
|
|
92
|
-
"typescript-eslint": "8.
|
|
93
|
+
"typescript-eslint": "8.52.0",
|
|
93
94
|
"vitest": "4.0.16"
|
|
94
95
|
},
|
|
95
96
|
"scripts": {
|
|
@@ -106,6 +107,7 @@
|
|
|
106
107
|
"perf:runtime": "bash scripts/perf/runtime-perf.sh",
|
|
107
108
|
"prepublish": "pnpm run build",
|
|
108
109
|
"postinstall": "node postinstall.mjs",
|
|
109
|
-
"measure:bundle": "node ../../scripts/measure-bundle-size-sonda.js"
|
|
110
|
+
"measure:bundle": "node ../../scripts/measure-bundle-size-sonda.js",
|
|
111
|
+
"knip": "knip"
|
|
110
112
|
}
|
|
111
113
|
}
|