@tailor-platform/sdk 1.2.1 → 1.2.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.
@@ -1,11 +1,22 @@
1
1
  /// <reference path="./user-defined.d.ts" />
2
- import * as zod0 from "zod";
2
+ import * as zod38 from "zod";
3
3
  import { z } from "zod";
4
4
  import * as type_fest0 from "type-fest";
5
5
  import { IsAny, NonEmptyObject } from "type-fest";
6
6
  import { StandardSchemaV1 } from "@standard-schema/spec";
7
- import * as zod_v4_core0 from "zod/v4/core";
7
+ import * as zod_v4_core33 from "zod/v4/core";
8
8
 
9
+ //#region src/parser/service/tailordb/relation.d.ts
10
+ declare const relationTypes: {
11
+ readonly "1-1": "1-1";
12
+ readonly oneToOne: "1-1";
13
+ readonly "n-1": "n-1";
14
+ readonly manyToOne: "n-1";
15
+ readonly "N-1": "n-1";
16
+ readonly keyOnly: "keyOnly";
17
+ };
18
+ type RelationType = keyof typeof relationTypes;
19
+ //#endregion
9
20
  //#region src/configure/types/helpers.d.ts
10
21
  type Prettify<T$1> = { [K in keyof T$1 as string extends K ? never : K]: T$1[K] } & {};
11
22
  type DeepWritable<T$1> = T$1 extends Date | RegExp | Function ? T$1 : T$1 extends object ? { -readonly [P in keyof T$1]: DeepWritable<T$1[P]> } & {} : T$1;
@@ -217,15 +228,16 @@ type ResolverInput = z.input<typeof ResolverSchema>;
217
228
  type Resolver = z.output<typeof ResolverSchema>;
218
229
  //#endregion
219
230
  //#region src/configure/types/type.d.ts
231
+ type TailorAnyField = TailorField<any>;
220
232
  declare class TailorField<const Defined extends DefinedFieldMetadata = DefinedFieldMetadata, const Output = any, M extends FieldMetadata = FieldMetadata, T$1 extends TailorFieldType = TailorFieldType> implements TailorFieldInput {
221
233
  readonly type: T$1;
222
- readonly fields: Record<string, TailorField<any>>;
234
+ readonly fields: Record<string, TailorAnyField>;
223
235
  protected _metadata: M;
224
236
  readonly _defined: Defined;
225
237
  readonly _output: Output;
226
238
  get metadata(): M;
227
- protected constructor(type: T$1, options?: FieldOptions, fields?: Record<string, TailorField<any>>, values?: AllowedValues);
228
- static create<const TType extends TailorFieldType, const TOptions extends FieldOptions, const OutputBase = TailorToTs[TType]>(type: TType, options?: TOptions, fields?: Record<string, TailorField<any>>, values?: AllowedValues): TailorField<{
239
+ protected constructor(type: T$1, options?: FieldOptions, fields?: Record<string, TailorAnyField>, values?: AllowedValues);
240
+ static create<const TType extends TailorFieldType, const TOptions extends FieldOptions, const OutputBase = TailorToTs[TType]>(type: TType, options?: TOptions, fields?: Record<string, TailorAnyField>, values?: AllowedValues): TailorField<{
229
241
  type: TType;
230
242
  array: TOptions extends {
231
243
  array: true;
@@ -562,6 +574,18 @@ type AuthDefinitionBrand = {
562
574
  type AuthInvoker<M extends string> = Omit<AuthInvoker$1, "machineUserName"> & {
563
575
  machineUserName: M;
564
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
+ */
565
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>): {
566
590
  readonly name: Name;
567
591
  readonly invoker: <M extends MachineUserNames>(machineUser: M) => {
@@ -681,7 +705,7 @@ interface DefinedDBFieldMetadata extends DefinedFieldMetadata {
681
705
  serial?: boolean;
682
706
  relation?: boolean;
683
707
  }
684
- type ExcludeNestedDBFields<T$1 extends Record<string, TailorDBField<any, any>>> = { [K in keyof T$1]: T$1[K] extends TailorDBField<{
708
+ type ExcludeNestedDBFields<T$1 extends Record<string, TailorAnyDBField>> = { [K in keyof T$1]: T$1[K] extends TailorDBField<{
685
709
  type: "nested";
686
710
  array: boolean;
687
711
  }, any> ? never : T$1[K] };
@@ -694,7 +718,7 @@ type Hook<TData, TReturn> = {
694
718
  create?: HookFn<TReturn | null, TData, TReturn>;
695
719
  update?: HookFn<TReturn | null, TData, TReturn>;
696
720
  };
697
- 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 {
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 {
698
722
  hooks: unknown;
699
723
  } ? never : F[K]["_defined"] extends {
700
724
  type: "nested";
@@ -738,6 +762,20 @@ interface OperatorFieldHook {
738
762
  create?: Script;
739
763
  update?: Script;
740
764
  }
765
+ /**
766
+ * Raw relation config stored in configure layer, processed in parser layer.
767
+ * This is the serialized form of RelationConfig from schema.ts where
768
+ * the TailorDBType reference is replaced with the type name string.
769
+ */
770
+ interface RawRelationConfig {
771
+ type: RelationType;
772
+ toward: {
773
+ type: string;
774
+ as?: string;
775
+ key?: string;
776
+ };
777
+ backward?: string;
778
+ }
741
779
  interface OperatorFieldConfig {
742
780
  type: string;
743
781
  required?: boolean;
@@ -750,6 +788,7 @@ interface OperatorFieldConfig {
750
788
  foreignKey?: boolean;
751
789
  foreignKeyType?: string;
752
790
  foreignKeyField?: string;
791
+ rawRelation?: RawRelationConfig;
753
792
  validate?: OperatorValidateConfig[];
754
793
  hooks?: OperatorFieldHook;
755
794
  serial?: {
@@ -863,7 +902,6 @@ type AllowedValuesOutput<V extends AllowedValues> = V[number] extends infer T ?
863
902
  } ? K : never : never;
864
903
  //#endregion
865
904
  //#region src/configure/services/tailordb/schema.d.ts
866
- type RelationType = "oneToOne" | "1-1" | "manyToOne" | "n-1" | "N-1" | "keyOnly";
867
905
  interface RelationConfig<S extends RelationType, T$1 extends TailorDBType> {
868
906
  type: S;
869
907
  toward: {
@@ -882,15 +920,10 @@ type RelationSelfConfig = {
882
920
  };
883
921
  backward?: string;
884
922
  };
885
- interface ReferenceConfig<T$1 extends TailorDBType<any, any>> {
886
- type: TailorDBType<any, any>;
887
- key: keyof T$1["fields"] & string;
888
- nameMap: [string | undefined, string];
889
- }
923
+ type TailorAnyDBField = TailorDBField<any, any>;
890
924
  declare class TailorDBField<const Defined extends DefinedDBFieldMetadata, const Output> extends TailorField<Defined, Output, DBFieldMetadata> {
891
- private _ref;
892
- private _pendingSelfRelation;
893
- get reference(): Readonly<ReferenceConfig<TailorDBType>> | undefined;
925
+ private _rawRelation;
926
+ get rawRelation(): Readonly<RawRelationConfig> | undefined;
894
927
  get metadata(): {
895
928
  index?: boolean;
896
929
  unique?: boolean;
@@ -909,7 +942,7 @@ declare class TailorDBField<const Defined extends DefinedDBFieldMetadata, const
909
942
  typeName?: string;
910
943
  };
911
944
  private constructor();
912
- 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<{
945
+ static create<const T$1 extends TailorFieldType, const TOptions extends FieldOptions, const OutputBase = TailorToTs[T$1]>(type: T$1, options?: TOptions, fields?: Record<string, TailorAnyDBField>, values?: AllowedValues): TailorDBField<{
913
946
  type: T$1;
914
947
  array: TOptions extends {
915
948
  array: true;
@@ -920,7 +953,7 @@ declare class TailorDBField<const Defined extends DefinedDBFieldMetadata, const
920
953
  } ? never : TailorField<CurrentDefined, Output>, description: string): TailorDBField<Prettify<CurrentDefined & {
921
954
  description: true;
922
955
  }>, Output>;
923
- relation<S extends RelationType, T$1 extends TailorDBType<any, any>, CurrentDefined extends Defined>(this: CurrentDefined extends {
956
+ relation<S extends RelationType, T$1 extends TailorAnyDBType, CurrentDefined extends Defined>(this: CurrentDefined extends {
924
957
  relation: unknown;
925
958
  } ? never : TailorDBField<CurrentDefined, Output>, config: RelationConfig<S, T$1>): TailorDBField<S extends "oneToOne" | "1-1" ? Prettify<CurrentDefined & {
926
959
  unique: true;
@@ -942,11 +975,15 @@ declare class TailorDBField<const Defined extends DefinedDBFieldMetadata, const
942
975
  }>, Output>;
943
976
  index<CurrentDefined extends Defined>(this: CurrentDefined extends {
944
977
  index: unknown;
978
+ } ? never : CurrentDefined extends {
979
+ array: true;
945
980
  } ? never : TailorDBField<CurrentDefined, Output>): TailorDBField<Prettify<CurrentDefined & {
946
981
  index: true;
947
982
  }>, Output>;
948
983
  unique<CurrentDefined extends Defined>(this: CurrentDefined extends {
949
984
  unique: unknown;
985
+ } ? never : CurrentDefined extends {
986
+ array: true;
950
987
  } ? never : TailorDBField<CurrentDefined, Output>): TailorDBField<Prettify<CurrentDefined & {
951
988
  unique: true;
952
989
  index: true;
@@ -993,8 +1030,8 @@ declare class TailorDBField<const Defined extends DefinedDBFieldMetadata, const
993
1030
  }>, Output>;
994
1031
  /**
995
1032
  * Clone the field with optional overrides for field options
996
- * @param options - Optional field options to override
997
- * @returns A new TailorDBField instance with the same configuration
1033
+ * @param {FieldOptions} [options] - Optional field options to override
1034
+ * @returns {TailorDBField<unknown, unknown>} A new TailorDBField instance with the same configuration
998
1035
  */
999
1036
  clone<const NewOpt extends FieldOptions>(options?: NewOpt): TailorDBField<Prettify<Omit<Defined, "array"> & {
1000
1037
  array: NewOpt extends {
@@ -1056,13 +1093,14 @@ declare function _enum<const V extends AllowedValues, const Opt extends FieldOpt
1056
1093
  array: true;
1057
1094
  } ? true : false;
1058
1095
  }, FieldOutput$1<AllowedValuesOutput<V>, Opt>>;
1059
- declare function object<const F extends Record<string, TailorDBField<any, any>> & ExcludeNestedDBFields<F>, const Opt extends FieldOptions>(fields: F, options?: Opt): TailorDBField<{
1096
+ declare function object<const F extends Record<string, TailorAnyDBField> & ExcludeNestedDBFields<F>, const Opt extends FieldOptions>(fields: F, options?: Opt): TailorDBField<{
1060
1097
  type: "nested";
1061
1098
  array: Opt extends {
1062
1099
  array: true;
1063
1100
  } ? true : false;
1064
1101
  }, FieldOutput$1<InferFieldsOutput<F>, Opt>>;
1065
- declare class TailorDBType<const Fields extends Record<string, TailorDBField<any, any>> = any, User extends object = InferredAttributeMap> {
1102
+ type TailorAnyDBType = TailorDBType<any, any>;
1103
+ declare class TailorDBType<const Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> {
1066
1104
  readonly name: string;
1067
1105
  readonly fields: Fields;
1068
1106
  readonly _output: InferFieldsOutput<Fields>;
@@ -1086,9 +1124,9 @@ declare class TailorDBType<const Fields extends Record<string, TailorDBField<any
1086
1124
  description(description: string): this;
1087
1125
  /**
1088
1126
  * Pick specific fields from the type
1089
- * @param keys - Array of field keys to pick
1090
- * @param options - Optional field options to apply to picked fields
1091
- * @returns An object containing only the specified fields
1127
+ * @param {(keyof Fields)[]} keys - Array of field keys to pick
1128
+ * @param {FieldOptions} options - Optional field options to apply to picked fields
1129
+ * @returns {Record<string, TailorDBField<unknown, unknown>>} An object containing only the specified fields
1092
1130
  */
1093
1131
  pickFields<K$1 extends keyof Fields, const Opt extends FieldOptions>(keys: K$1[], options: Opt): { [P in K$1]: Fields[P$1] extends TailorDBField<infer D, infer _O> ? TailorDBField<Omit<D, "array"> & {
1094
1132
  array: Opt extends {
@@ -1097,12 +1135,13 @@ declare class TailorDBType<const Fields extends Record<string, TailorDBField<any
1097
1135
  }, FieldOutput$1<TailorToTs[D["type"]], Opt>> : never };
1098
1136
  /**
1099
1137
  * Omit specific fields from the type
1100
- * @param keys - Array of field keys to omit
1101
- * @returns An object containing all fields except the specified ones
1138
+ * @template K
1139
+ * @param {(keyof Fields)[]} keys - Array of field keys to omit
1140
+ * @returns {Omit<Fields, K>} An object containing all fields except the specified ones
1102
1141
  */
1103
1142
  omitFields<K$1 extends keyof Fields>(keys: K$1[]): Omit<Fields, K$1>;
1104
1143
  }
1105
- type TailorDBInstance<Fields extends Record<string, TailorDBField<any, any>> = any, User extends object = InferredAttributeMap> = InstanceType<typeof TailorDBType<Fields, User>>;
1144
+ type TailorDBInstance<Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> = InstanceType<typeof TailorDBType<Fields, User>>;
1106
1145
  declare const idField: TailorDBField<{
1107
1146
  type: "uuid";
1108
1147
  array: false;
@@ -1110,28 +1149,28 @@ declare const idField: TailorDBField<{
1110
1149
  type idField = typeof idField;
1111
1150
  type DBType<F extends {
1112
1151
  id?: never;
1113
- } & Record<string, TailorDBField<any, any>>> = TailorDBInstance<{
1152
+ } & Record<string, TailorAnyDBField>> = TailorDBInstance<{
1114
1153
  id: idField;
1115
1154
  } & F>;
1116
1155
  /**
1117
1156
  * Creates a new database type with the specified fields
1118
- * @param name - The name of the type, or a tuple of [name, pluralForm]
1119
- * @param fields - The field definitions for the type
1120
- * @returns A new TailorDBType instance
1157
+ * @param {string | [string, string]} name - The name of the type, or a tuple of [name, pluralForm]
1158
+ * @param {Record<string, TailorDBField<unknown, unknown>>} fields - The field definitions for the type
1159
+ * @returns {DBType<F>} A new TailorDBType instance
1121
1160
  */
1122
1161
  declare function dbType<const F extends {
1123
1162
  id?: never;
1124
- } & Record<string, TailorDBField<any, any>>>(name: string | [string, string], fields: F): DBType<F>;
1163
+ } & Record<string, TailorAnyDBField>>(name: string | [string, string], fields: F): DBType<F>;
1125
1164
  /**
1126
1165
  * Creates a new database type with the specified fields and description
1127
- * @param name - The name of the type, or a tuple of [name, pluralForm]
1128
- * @param description - A description of the type
1129
- * @param fields - The field definitions for the type
1130
- * @returns A new TailorDBType instance
1166
+ * @param {string | [string, string]} name - The name of the type, or a tuple of [name, pluralForm]
1167
+ * @param {string} description - A description of the type
1168
+ * @param {Record<string, TailorDBField<unknown, unknown>>} fields - The field definitions for the type
1169
+ * @returns {DBType<F>} A new TailorDBType instance
1131
1170
  */
1132
1171
  declare function dbType<const F extends {
1133
1172
  id?: never;
1134
- } & Record<string, TailorDBField<any, any>>>(name: string | [string, string], description: string, fields: F): DBType<F>;
1173
+ } & Record<string, TailorAnyDBField>>(name: string | [string, string], description: string, fields: F): DBType<F>;
1135
1174
  declare const db: {
1136
1175
  type: typeof dbType;
1137
1176
  uuid: typeof uuid;
@@ -1238,6 +1277,13 @@ declare const idpDefinitionBrand: unique symbol;
1238
1277
  type IdpDefinitionBrand = {
1239
1278
  readonly [idpDefinitionBrand]: true;
1240
1279
  };
1280
+ /**
1281
+ * Define an IdP service configuration for the Tailor SDK.
1282
+ * @template TClients
1283
+ * @param {string} name - IdP service name
1284
+ * @param {Omit<IdPInput, "name" | "clients"> & { clients: TClients }} config - IdP configuration
1285
+ * @returns {IdpDefinitionBrand & IdPInput} Defined IdP service
1286
+ */
1241
1287
  declare function defineIdp<const TClients extends string[]>(name: string, config: Omit<IdPInput, "name" | "clients"> & {
1242
1288
  clients: TClients;
1243
1289
  }): {
@@ -1285,6 +1331,12 @@ declare const staticWebsiteDefinitionBrand: unique symbol;
1285
1331
  type StaticWebsiteDefinitionBrand = {
1286
1332
  readonly [staticWebsiteDefinitionBrand]: true;
1287
1333
  };
1334
+ /**
1335
+ * Define a static website configuration for the Tailor SDK.
1336
+ * @param {string} name - Static website name
1337
+ * @param {Omit<StaticWebsiteInput, "name">} config - Static website configuration
1338
+ * @returns {StaticWebsiteDefinitionBrand & StaticWebsiteInput & { readonly url: string }} Defined static website
1339
+ */
1288
1340
  declare function defineStaticWebSite(name: string, config: Omit<StaticWebsiteInput, "name">): {
1289
1341
  readonly name: string;
1290
1342
  readonly url: `${string}:url`;
@@ -1350,7 +1402,7 @@ declare const BaseGeneratorConfigSchema: z.ZodUnion<readonly [z.ZodTuple<[z.ZodL
1350
1402
  }, z.core.$strip>]>;
1351
1403
  /**
1352
1404
  * Creates a GeneratorConfigSchema with built-in generator support
1353
- * @param builtinGenerators - Map of generator IDs to their constructor functions
1405
+ * @param {Map<string, (options: unknown) => CodeGeneratorBase>} builtinGenerators - Map of generator IDs to their constructor functions
1354
1406
  */
1355
1407
  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<{
1356
1408
  distPath: z.ZodString;
@@ -1419,7 +1471,18 @@ interface AppConfig<Auth extends AuthConfig = AuthConfig, Idp extends IdPConfig[
1419
1471
  workflow?: WorkflowServiceInput;
1420
1472
  staticWebsites?: StaticWebsites;
1421
1473
  }
1474
+ /**
1475
+ * Define a Tailor SDK application configuration with shallow exactness.
1476
+ * @template Config
1477
+ * @param {Config} config - Application configuration
1478
+ * @returns {Config} The same configuration object
1479
+ */
1422
1480
  declare function defineConfig<const Config extends AppConfig & Record<Exclude<keyof Config, keyof AppConfig>, never>>(config: Config): Config;
1481
+ /**
1482
+ * Define generators to be used with the Tailor SDK.
1483
+ * @param {...GeneratorConfig} configs - Generator configurations
1484
+ * @returns {GeneratorConfig[]} Generator configurations as given
1485
+ */
1423
1486
  declare function defineGenerators(...configs: GeneratorConfig[]): (["@tailor-platform/kysely-type", {
1424
1487
  distPath: string;
1425
1488
  }] | ["@tailor-platform/seed", {
@@ -1433,12 +1496,12 @@ declare function defineGenerators(...configs: GeneratorConfig[]): (["@tailor-pla
1433
1496
  id: string;
1434
1497
  description: string;
1435
1498
  dependencies: ("tailordb" | "resolver" | "executor")[];
1436
- aggregate: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod0.ZodAny>;
1437
- processType?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
1438
- processResolver?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
1439
- processExecutor?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
1440
- processTailorDBNamespace?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
1441
- processResolverNamespace?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
1499
+ aggregate: zod_v4_core33.$InferInnerFunctionType<zod_v4_core33.$ZodFunctionArgs, zod38.ZodAny>;
1500
+ processType?: zod_v4_core33.$InferInnerFunctionType<zod_v4_core33.$ZodFunctionArgs, zod_v4_core33.$ZodFunctionOut> | undefined;
1501
+ processResolver?: zod_v4_core33.$InferInnerFunctionType<zod_v4_core33.$ZodFunctionArgs, zod_v4_core33.$ZodFunctionOut> | undefined;
1502
+ processExecutor?: zod_v4_core33.$InferInnerFunctionType<zod_v4_core33.$ZodFunctionArgs, zod_v4_core33.$ZodFunctionOut> | undefined;
1503
+ processTailorDBNamespace?: zod_v4_core33.$InferInnerFunctionType<zod_v4_core33.$ZodFunctionArgs, zod_v4_core33.$ZodFunctionOut> | undefined;
1504
+ processResolverNamespace?: zod_v4_core33.$InferInnerFunctionType<zod_v4_core33.$ZodFunctionArgs, zod_v4_core33.$ZodFunctionOut> | undefined;
1442
1505
  })[];
1443
1506
  //#endregion
1444
1507
  //#region src/parser/service/executor/schema.d.ts
@@ -1576,5 +1639,5 @@ type WorkflowOperation = z.infer<typeof WorkflowOperationSchema>;
1576
1639
  type Executor = z.infer<typeof ExecutorSchema>;
1577
1640
  type ExecutorInput = z.input<typeof ExecutorSchema>;
1578
1641
  //#endregion
1579
- export { SCIMAttributeMapping as $, db as A, AuthExternalConfig as B, ResolverServiceConfig as C, InferFieldsOutput as Ct, TailorDBField as D, ExecutorServiceInput as E, TailorTypeGqlPermission as F, BuiltinIdP as G, AuthOwnConfig as H, TailorTypePermission as I, OAuth2ClientGrantType as J, IDToken as K, unsafeAllowAllGqlPermission as L, AllowedValuesOutput as M, ParsedTailorDBType as N, TailorDBInstance as O, PermissionCondition as P, SCIMAttribute as Q, unsafeAllowAllTypePermission as R, ResolverExternalConfig as S, TailorFieldType as St, ExecutorServiceConfig as T, output as Tt, defineAuth as U, AuthInvoker as V, AuthServiceInput as W, OIDC as X, OAuth2ClientInput as Y, SAML as Z, StaticWebsiteConfig as _, ResolverInput as _t, IncomingWebhookTrigger as a, UserAttributeKey as at, IdPExternalConfig as b, FieldOptions as bt, ScheduleTriggerInput as c, UsernameFieldKey as ct, AppConfig as d, AttributeMap as dt, SCIMAttributeType as et, defineConfig as f, TailorUser as ft, WorkflowServiceInput as g, Resolver as gt, WorkflowServiceConfig as h, QueryType as ht, GqlOperation as i, TenantProviderConfig as it, AllowedValues as j, TailorDBType as k, WebhookOperation as l, ValueOperand as lt, Generator as m, TailorField as mt, ExecutorInput as n, SCIMConfig as nt, RecordTrigger as o, UserAttributeListKey as ot, defineGenerators as p, unauthenticatedTailorUser as pt, IdProviderConfig as q, FunctionOperation as r, SCIMResource as rt, ResolverExecutedTrigger as s, UserAttributeMap as st, Executor as t, SCIMAuthorization as tt, WorkflowOperation as u, AttributeList as ut, defineStaticWebSite as v, ArrayFieldOutput as vt, ResolverServiceInput as w, JsonCompatible as wt, defineIdp as x, FieldOutput$1 as xt, IdPConfig as y, FieldMetadata as yt, AuthConfig as z };
1580
- //# sourceMappingURL=types-Du-lo0MV.d.mts.map
1642
+ export { SCIMAttributeMapping as $, db as A, AuthExternalConfig as B, ResolverServiceConfig as C, TailorFieldType as Ct, TailorDBField as D, ExecutorServiceInput as E, output as Et, TailorTypeGqlPermission as F, BuiltinIdP as G, AuthOwnConfig as H, TailorTypePermission as I, OAuth2ClientGrantType as J, IDToken as K, unsafeAllowAllGqlPermission as L, AllowedValuesOutput as M, ParsedTailorDBType as N, TailorDBInstance as O, PermissionCondition as P, SCIMAttribute as Q, unsafeAllowAllTypePermission as R, ResolverExternalConfig as S, FieldOutput$1 as St, ExecutorServiceConfig as T, JsonCompatible as Tt, defineAuth as U, AuthInvoker as V, AuthServiceInput as W, OIDC as X, OAuth2ClientInput as Y, SAML as Z, StaticWebsiteConfig as _, Resolver as _t, IncomingWebhookTrigger as a, UserAttributeKey as at, IdPExternalConfig as b, FieldMetadata as bt, ScheduleTriggerInput as c, UsernameFieldKey as ct, AppConfig as d, AttributeMap as dt, SCIMAttributeType as et, defineConfig as f, TailorUser as ft, WorkflowServiceInput as g, QueryType as gt, WorkflowServiceConfig as h, TailorField as ht, GqlOperation as i, TenantProviderConfig as it, AllowedValues as j, TailorDBType as k, WebhookOperation as l, ValueOperand as lt, Generator as m, TailorAnyField as mt, ExecutorInput as n, SCIMConfig as nt, RecordTrigger as o, UserAttributeListKey as ot, defineGenerators as p, unauthenticatedTailorUser as pt, IdProviderConfig as q, FunctionOperation as r, SCIMResource as rt, ResolverExecutedTrigger as s, UserAttributeMap as st, Executor as t, SCIMAuthorization 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, AuthConfig as z };
1643
+ //# sourceMappingURL=types-Dg_zk_OZ.d.mts.map
@@ -7,6 +7,7 @@ declare module "@tailor-platform/sdk" {
7
7
  interface AttributeList {
8
8
  __tuple: string[];
9
9
  }
10
+ interface Env {}
10
11
  }
11
12
 
12
13
  export {};
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./../../user-defined.d.ts" />
2
- import { k as TailorDBType, mt as TailorField } from "../../types-Du-lo0MV.mjs";
3
- import { n as output } from "../../index-C4nvv_Ew.mjs";
2
+ import { ht as TailorField, k as TailorDBType } from "../../types-Dg_zk_OZ.mjs";
3
+ import { n as output } from "../../index-DXZMT4aO.mjs";
4
4
  import { StandardSchemaV1 } from "@standard-schema/spec";
5
5
 
6
6
  //#region src/utils/test/index.d.ts
@@ -17,20 +17,18 @@ declare const unauthenticatedTailorUser: {
17
17
  * - Uses existing id from data if provided, otherwise generates UUID for id fields
18
18
  * - Recursively processes nested types
19
19
  * - Executes hooks.create for fields with create hooks
20
- *
21
20
  * @template T - The output type of the hook function
22
- * @param type - TailorDB type definition
23
- * @returns A function that transforms input data according to field hooks
21
+ * @param {TailorDBType<unknown, unknown>} type - TailorDB type definition
22
+ * @returns {(data: unknown) => Partial<output<T>>} A function that transforms input data according to field hooks
24
23
  */
25
24
  declare function createTailorDBHook<T extends TailorDBType<any, any>>(type: T): (data: unknown) => Partial<output<T>>;
26
25
  /**
27
26
  * Creates the standard schema definition for lines-db
28
27
  * This returns the first argument for defineSchema with the ~standard section
29
- *
30
28
  * @template T - The output type after validation
31
- * @param schemaType - TailorDB field schema for validation
32
- * @param hook - Hook function to transform data before validation
33
- * @returns Schema object with ~standard section for defineSchema
29
+ * @param {TailorField<unknown, T>} schemaType - TailorDB field schema for validation
30
+ * @param {(data: unknown) => Partial<T>} hook - Hook function to transform data before validation
31
+ * @returns {{ "~standard": StandardSchemaV1<T>["~standard"] }} Schema object with ~standard section for defineSchema
34
32
  */
35
33
  declare function createStandardSchema<T = Record<string, unknown>>(schemaType: TailorField<any, T>, hook: (data: unknown) => Partial<T>): {
36
34
  readonly "~standard": {
@@ -12,10 +12,9 @@ const unauthenticatedTailorUser = {
12
12
  * - Uses existing id from data if provided, otherwise generates UUID for id fields
13
13
  * - Recursively processes nested types
14
14
  * - Executes hooks.create for fields with create hooks
15
- *
16
15
  * @template T - The output type of the hook function
17
- * @param type - TailorDB type definition
18
- * @returns A function that transforms input data according to field hooks
16
+ * @param {TailorDBType<unknown, unknown>} type - TailorDB type definition
17
+ * @returns {(data: unknown) => Partial<output<T>>} A function that transforms input data according to field hooks
19
18
  */
20
19
  function createTailorDBHook(type) {
21
20
  return (data) => {
@@ -38,11 +37,10 @@ function createTailorDBHook(type) {
38
37
  /**
39
38
  * Creates the standard schema definition for lines-db
40
39
  * This returns the first argument for defineSchema with the ~standard section
41
- *
42
40
  * @template T - The output type after validation
43
- * @param schemaType - TailorDB field schema for validation
44
- * @param hook - Hook function to transform data before validation
45
- * @returns Schema object with ~standard section for defineSchema
41
+ * @param {TailorField<unknown, T>} schemaType - TailorDB field schema for validation
42
+ * @param {(data: unknown) => Partial<T>} hook - Hook function to transform data before validation
43
+ * @returns {{ "~standard": StandardSchemaV1<T>["~standard"] }} Schema object with ~standard section for defineSchema
46
44
  */
47
45
  function createStandardSchema(schemaType, hook) {
48
46
  return { "~standard": {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/utils/test/index.ts"],"sourcesContent":["import type { output, TailorUser } from \"@/configure\";\nimport type { TailorDBType } from \"@/configure/services/tailordb/schema\";\nimport type { TailorField } from \"@/configure/types/type\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\n/** Represents an unauthenticated user in the Tailor platform. */\nexport const unauthenticatedTailorUser = {\n id: \"00000000-0000-0000-0000-000000000000\",\n type: \"\",\n workspaceId: \"00000000-0000-0000-0000-000000000000\",\n attributes: null,\n attributeList: [],\n} as const satisfies TailorUser;\n\n/**\n * Creates a hook function that processes TailorDB type fields\n * - Uses existing id from data if provided, otherwise generates UUID for id fields\n * - Recursively processes nested types\n * - Executes hooks.create for fields with create hooks\n *\n * @template T - The output type of the hook function\n * @param type - TailorDB type definition\n * @returns A function that transforms input data according to field hooks\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function createTailorDBHook<T extends TailorDBType<any, any>>(type: T) {\n return (data: unknown) => {\n return Object.entries(type.fields).reduce(\n (hooked, [key, value]) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const field = value as TailorField<any, any, any>;\n if (key === \"id\") {\n // Use existing id from data if provided, otherwise generate new UUID\n const existingId =\n data && typeof data === \"object\" ? (data as Record<string, unknown>)[key] : undefined;\n hooked[key] = existingId ?? crypto.randomUUID();\n } else if (field.type === \"nested\") {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n hooked[key] = createTailorDBHook({ fields: field.fields } as any)(\n (data as Record<string, unknown>)[key],\n );\n } else if (field.metadata.hooks?.create) {\n hooked[key] = field.metadata.hooks.create({\n value: (data as Record<string, unknown>)[key],\n data: data,\n user: unauthenticatedTailorUser,\n });\n if (hooked[key] instanceof Date) {\n hooked[key] = hooked[key].toISOString();\n }\n } else if (data && typeof data === \"object\") {\n hooked[key] = (data as Record<string, unknown>)[key];\n }\n return hooked;\n },\n {} as Record<string, unknown>,\n ) as Partial<output<T>>;\n };\n}\n\n/**\n * Creates the standard schema definition for lines-db\n * This returns the first argument for defineSchema with the ~standard section\n *\n * @template T - The output type after validation\n * @param schemaType - TailorDB field schema for validation\n * @param hook - Hook function to transform data before validation\n * @returns Schema object with ~standard section for defineSchema\n */\nexport function createStandardSchema<T = Record<string, unknown>>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n schemaType: TailorField<any, T>,\n hook: (data: unknown) => Partial<T>,\n) {\n return {\n \"~standard\": {\n version: 1,\n vendor: \"@tailor-platform/sdk\",\n validate: (value: unknown) => {\n const hooked = hook(value);\n const result = schemaType.parse({\n value: hooked,\n data: hooked,\n user: unauthenticatedTailorUser,\n });\n if (result.issues) {\n return result;\n }\n return { value: hooked as T };\n },\n },\n } as const satisfies StandardSchemaV1<T>;\n}\n"],"mappings":";;AAMA,MAAa,4BAA4B;CACvC,IAAI;CACJ,MAAM;CACN,aAAa;CACb,YAAY;CACZ,eAAe,EAAE;CAClB;;;;;;;;;;;AAaD,SAAgB,mBAAqD,MAAS;AAC5E,SAAQ,SAAkB;AACxB,SAAO,OAAO,QAAQ,KAAK,OAAO,CAAC,QAChC,QAAQ,CAAC,KAAK,WAAW;GAExB,MAAM,QAAQ;AACd,OAAI,QAAQ,KAIV,QAAO,QADL,QAAQ,OAAO,SAAS,WAAY,KAAiC,OAAO,WAClD,OAAO,YAAY;YACtC,MAAM,SAAS,SAExB,QAAO,OAAO,mBAAmB,EAAE,QAAQ,MAAM,QAAQ,CAAQ,CAC9D,KAAiC,KACnC;YACQ,MAAM,SAAS,OAAO,QAAQ;AACvC,WAAO,OAAO,MAAM,SAAS,MAAM,OAAO;KACxC,OAAQ,KAAiC;KACnC;KACN,MAAM;KACP,CAAC;AACF,QAAI,OAAO,gBAAgB,KACzB,QAAO,OAAO,OAAO,KAAK,aAAa;cAEhC,QAAQ,OAAO,SAAS,SACjC,QAAO,OAAQ,KAAiC;AAElD,UAAO;KAET,EAAE,CACH;;;;;;;;;;;;AAaL,SAAgB,qBAEd,YACA,MACA;AACA,QAAO,EACL,aAAa;EACX,SAAS;EACT,QAAQ;EACR,WAAW,UAAmB;GAC5B,MAAM,SAAS,KAAK,MAAM;GAC1B,MAAM,SAAS,WAAW,MAAM;IAC9B,OAAO;IACP,MAAM;IACN,MAAM;IACP,CAAC;AACF,OAAI,OAAO,OACT,QAAO;AAET,UAAO,EAAE,OAAO,QAAa;;EAEhC,EACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/utils/test/index.ts"],"sourcesContent":["import type { output, TailorUser } from \"@/configure\";\nimport type { TailorDBType } from \"@/configure/services/tailordb/schema\";\nimport type { TailorField } from \"@/configure/types/type\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\n/** Represents an unauthenticated user in the Tailor platform. */\nexport const unauthenticatedTailorUser = {\n id: \"00000000-0000-0000-0000-000000000000\",\n type: \"\",\n workspaceId: \"00000000-0000-0000-0000-000000000000\",\n attributes: null,\n attributeList: [],\n} as const satisfies TailorUser;\n\n/**\n * Creates a hook function that processes TailorDB type fields\n * - Uses existing id from data if provided, otherwise generates UUID for id fields\n * - Recursively processes nested types\n * - Executes hooks.create for fields with create hooks\n * @template T - The output type of the hook function\n * @param {TailorDBType<unknown, unknown>} type - TailorDB type definition\n * @returns {(data: unknown) => Partial<output<T>>} A function that transforms input data according to field hooks\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function createTailorDBHook<T extends TailorDBType<any, any>>(type: T) {\n return (data: unknown) => {\n return Object.entries(type.fields).reduce(\n (hooked, [key, value]) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const field = value as TailorField<any, any, any>;\n if (key === \"id\") {\n // Use existing id from data if provided, otherwise generate new UUID\n const existingId =\n data && typeof data === \"object\" ? (data as Record<string, unknown>)[key] : undefined;\n hooked[key] = existingId ?? crypto.randomUUID();\n } else if (field.type === \"nested\") {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n hooked[key] = createTailorDBHook({ fields: field.fields } as any)(\n (data as Record<string, unknown>)[key],\n );\n } else if (field.metadata.hooks?.create) {\n hooked[key] = field.metadata.hooks.create({\n value: (data as Record<string, unknown>)[key],\n data: data,\n user: unauthenticatedTailorUser,\n });\n if (hooked[key] instanceof Date) {\n hooked[key] = hooked[key].toISOString();\n }\n } else if (data && typeof data === \"object\") {\n hooked[key] = (data as Record<string, unknown>)[key];\n }\n return hooked;\n },\n {} as Record<string, unknown>,\n ) as Partial<output<T>>;\n };\n}\n\n/**\n * Creates the standard schema definition for lines-db\n * This returns the first argument for defineSchema with the ~standard section\n * @template T - The output type after validation\n * @param {TailorField<unknown, T>} schemaType - TailorDB field schema for validation\n * @param {(data: unknown) => Partial<T>} hook - Hook function to transform data before validation\n * @returns {{ \"~standard\": StandardSchemaV1<T>[\"~standard\"] }} Schema object with ~standard section for defineSchema\n */\nexport function createStandardSchema<T = Record<string, unknown>>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n schemaType: TailorField<any, T>,\n hook: (data: unknown) => Partial<T>,\n) {\n return {\n \"~standard\": {\n version: 1,\n vendor: \"@tailor-platform/sdk\",\n validate: (value: unknown) => {\n const hooked = hook(value);\n const result = schemaType.parse({\n value: hooked,\n data: hooked,\n user: unauthenticatedTailorUser,\n });\n if (result.issues) {\n return result;\n }\n return { value: hooked as T };\n },\n },\n } as const satisfies StandardSchemaV1<T>;\n}\n"],"mappings":";;AAMA,MAAa,4BAA4B;CACvC,IAAI;CACJ,MAAM;CACN,aAAa;CACb,YAAY;CACZ,eAAe,EAAE;CAClB;;;;;;;;;;AAYD,SAAgB,mBAAqD,MAAS;AAC5E,SAAQ,SAAkB;AACxB,SAAO,OAAO,QAAQ,KAAK,OAAO,CAAC,QAChC,QAAQ,CAAC,KAAK,WAAW;GAExB,MAAM,QAAQ;AACd,OAAI,QAAQ,KAIV,QAAO,QADL,QAAQ,OAAO,SAAS,WAAY,KAAiC,OAAO,WAClD,OAAO,YAAY;YACtC,MAAM,SAAS,SAExB,QAAO,OAAO,mBAAmB,EAAE,QAAQ,MAAM,QAAQ,CAAQ,CAC9D,KAAiC,KACnC;YACQ,MAAM,SAAS,OAAO,QAAQ;AACvC,WAAO,OAAO,MAAM,SAAS,MAAM,OAAO;KACxC,OAAQ,KAAiC;KACnC;KACN,MAAM;KACP,CAAC;AACF,QAAI,OAAO,gBAAgB,KACzB,QAAO,OAAO,OAAO,KAAK,aAAa;cAEhC,QAAQ,OAAO,SAAS,SACjC,QAAO,OAAQ,KAAiC;AAElD,UAAO;KAET,EAAE,CACH;;;;;;;;;;;AAYL,SAAgB,qBAEd,YACA,MACA;AACA,QAAO,EACL,aAAa;EACX,SAAS;EACT,QAAQ;EACR,WAAW,UAAmB;GAC5B,MAAM,SAAS,KAAK,MAAM;GAC1B,MAAM,SAAS,WAAW,MAAM;IAC9B,OAAO;IACP,MAAM;IACN,MAAM;IACP,CAAC;AACF,OAAI,OAAO,OACT,QAAO;AAET,UAAO,EAAE,OAAO,QAAa;;EAEhC,EACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/sdk",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -77,13 +77,15 @@
77
77
  "@types/madge": "5.0.3",
78
78
  "@types/mime-types": "3.0.1",
79
79
  "@types/node": "24.10.4",
80
+ "@typescript/native-preview": "7.0.0-dev.20260103.1",
80
81
  "@vitest/coverage-v8": "4.0.16",
81
82
  "cross-env": "10.1.0",
82
83
  "eslint": "9.39.2",
83
84
  "eslint-plugin-jsdoc": "61.5.0",
84
- "eslint-plugin-oxlint": "1.35.0",
85
- "globals": "16.5.0",
86
- "oxlint": "1.35.0",
85
+ "eslint-plugin-oxlint": "1.36.0",
86
+ "globals": "17.0.0",
87
+ "oxlint": "1.36.0",
88
+ "oxlint-tsgolint": "0.10.1",
87
89
  "sonda": "0.10.1",
88
90
  "tsdown": "0.18.4",
89
91
  "typescript": "5.9.3",
@@ -96,9 +98,10 @@
96
98
  "test:e2e": "vitest --project=e2e",
97
99
  "test:coverage": "vitest --coverage",
98
100
  "build": "tsdown && cross-env FORCE_CREATE=1 node postinstall.mjs",
99
- "lint": "oxlint . && eslint --cache .",
100
- "lint:fix": "oxlint . --fix && eslint --cache . --fix",
101
+ "lint": "oxlint --type-aware . && eslint --cache .",
102
+ "lint:fix": "oxlint --type-aware . --fix && eslint --cache . --fix",
101
103
  "typecheck": "tsc --noEmit",
104
+ "typecheck:go": "tsgo",
102
105
  "perf:typecheck": "bash scripts/perf/exec.sh",
103
106
  "perf:runtime": "bash scripts/perf/runtime-perf.sh",
104
107
  "prepublish": "pnpm run build",
package/postinstall.mjs CHANGED
@@ -65,6 +65,7 @@ declare module "@tailor-platform/sdk" {
65
65
  interface AttributeList {
66
66
  __tuple: string[];
67
67
  }
68
+ interface Env {}
68
69
  }
69
70
 
70
71
  export {};