@tailor-platform/sdk 1.33.2 → 1.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/{application-CYPU-WIc.mjs → application-BnJRroGX.mjs} +19 -3
- package/dist/application-BnJRroGX.mjs.map +1 -0
- package/dist/application-mGasp_EX.mjs +4 -0
- package/dist/cli/index.mjs +291 -40
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +6 -6
- package/dist/cli/lib.mjs +4 -4
- package/dist/{client-ea1w8SmG.mjs → client-BmQP4kKS.mjs} +1 -1
- package/dist/{client-CYGsf3Zl.mjs → client-CA2NM_4R.mjs} +10 -2
- package/dist/{client-CYGsf3Zl.mjs.map → client-CA2NM_4R.mjs.map} +1 -1
- package/dist/configure/index.d.mts +5 -5
- package/dist/configure/index.mjs +3 -0
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{crash-report-CbueUPaP.mjs → crash-report-Bd2T8BhU.mjs} +1 -1
- package/dist/{crash-report-OXafT1iS.mjs → crash-report-CPkI2-cp.mjs} +2 -2
- package/dist/{crash-report-OXafT1iS.mjs.map → crash-report-CPkI2-cp.mjs.map} +1 -1
- package/dist/{env-BvIWsJxg.d.mts → env-MSlwZt8l.d.mts} +2 -2
- package/dist/{index-0H-YH8Ya.d.mts → index-B1Fgxi8D.d.mts} +2 -2
- package/dist/{index-BM2SqNfO.d.mts → index-BBlE_vQF.d.mts} +2 -2
- package/dist/{index-mAV9kYJA.d.mts → index-BG7YCyXF.d.mts} +2 -2
- package/dist/{index-BU6fmwJC.d.mts → index-D-tMAFVp.d.mts} +2 -2
- package/dist/{index-DlivLpTN.d.mts → index-wCoQup4y.d.mts} +8 -8
- package/dist/kysely/index.d.mts +2 -1
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/{kysely-type-BwMqaL3z.mjs → kysely-type-DtnNdHn3.mjs} +5 -2
- package/dist/kysely-type-DtnNdHn3.mjs.map +1 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/index.d.mts +2 -2
- package/dist/{plugin-DQqzlulP.d.mts → plugin-CZaJ3_QR.d.mts} +34 -3
- package/dist/{runtime-CxDrzUC0.mjs → runtime-D4O-RfcH.mjs} +286 -52
- package/dist/runtime-D4O-RfcH.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/{workflow.generated-u9MgzqbM.d.mts → workflow.generated-IZ3kLjC_.d.mts} +2 -2
- package/docs/cli/auth.md +162 -1
- package/docs/cli-reference.md +9 -6
- package/docs/services/auth.md +115 -0
- package/package.json +1 -1
- package/dist/application-CYPU-WIc.mjs.map +0 -1
- package/dist/application-dnB8CQiT.mjs +0 -4
- package/dist/kysely-type-BwMqaL3z.mjs.map +0 -1
- package/dist/runtime-CxDrzUC0.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { $ as
|
|
3
|
-
import { n as TailorEnv, r as TailorActor } from "./env-
|
|
4
|
-
import { b as IdPInput, g as IdpDefinitionBrand, n as AppConfig, t as RetryPolicy } from "./workflow.generated-
|
|
2
|
+
import { $ as FieldOptions, At as WebhookOperation$1, Ct as FunctionOperation$1, Dt as ResolverExecutedTrigger$1, Et as IncomingWebhookTrigger$1, F as UserAttributeListKey, H as TailorDBInstance, I as UserAttributeMap, Mt as AuthInvoker$1, Ot as ScheduleTriggerInput, Q as FieldMetadata, St as ExecutorInput, Tt as IdpUserTrigger$1, U as TailorDBType, X as ArrayFieldOutput, Z as DefinedFieldMetadata, _t as Resolver, at as JsonCompatible, bt as AuthAccessTokenTrigger$1, dt as TailorUser, et as FieldOutput, it as InferFieldsOutput, j as DefinedAuth, jt as WorkflowOperation$1, k as AuthServiceInput, kt as TailorDBTrigger$1, mt as AllowedValuesOutput, n as Plugin, nt as TailorAnyField, ot as output$1, pt as AllowedValues, rt as TailorField, tt as TailorFieldType, vt as ResolverInput, wt as GqlOperation$1, yt as GeneratorConfig } from "./plugin-CZaJ3_QR.mjs";
|
|
3
|
+
import { n as TailorEnv, r as TailorActor } from "./env-MSlwZt8l.mjs";
|
|
4
|
+
import { b as IdPInput, g as IdpDefinitionBrand, n as AppConfig, t as RetryPolicy } from "./workflow.generated-IZ3kLjC_.mjs";
|
|
5
5
|
import * as _$zod from "zod";
|
|
6
6
|
import { JsonPrimitive, Jsonifiable, Jsonify } from "type-fest";
|
|
7
7
|
import { Client } from "@urql/core";
|
|
@@ -13,11 +13,11 @@ type MachineUserAttributeFields = Record<string, TailorField<DefinedFieldMetadat
|
|
|
13
13
|
type PlaceholderUser = TailorDBInstance<Record<string, never>, Record<string, never>>;
|
|
14
14
|
type PlaceholderAttributeMap = UserAttributeMap<PlaceholderUser>;
|
|
15
15
|
type PlaceholderAttributeList = UserAttributeListKey<PlaceholderUser>[];
|
|
16
|
-
type UserProfileAuthInput<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[], MachineUserNames extends string> = Omit<AuthServiceInput<User, AttributeMap, AttributeList, MachineUserNames, undefined>, "userProfile" | "machineUserAttributes"> & {
|
|
16
|
+
type UserProfileAuthInput<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[], MachineUserNames extends string, ConnectionNames extends string = string> = Omit<AuthServiceInput<User, AttributeMap, AttributeList, MachineUserNames, undefined, ConnectionNames>, "userProfile" | "machineUserAttributes"> & {
|
|
17
17
|
userProfile: NonNullable<AuthServiceInput<User, AttributeMap, AttributeList, MachineUserNames, undefined>["userProfile"]>;
|
|
18
18
|
machineUserAttributes?: never;
|
|
19
19
|
};
|
|
20
|
-
type MachineUserOnlyAuthInput<MachineUserNames extends string, MachineUserAttributes extends MachineUserAttributeFields> = Omit<AuthServiceInput<PlaceholderUser, PlaceholderAttributeMap, PlaceholderAttributeList, MachineUserNames, MachineUserAttributes>, "userProfile" | "machineUserAttributes"> & {
|
|
20
|
+
type MachineUserOnlyAuthInput<MachineUserNames extends string, MachineUserAttributes extends MachineUserAttributeFields, ConnectionNames extends string = string> = Omit<AuthServiceInput<PlaceholderUser, PlaceholderAttributeMap, PlaceholderAttributeList, MachineUserNames, MachineUserAttributes, ConnectionNames>, "userProfile" | "machineUserAttributes"> & {
|
|
21
21
|
userProfile?: never;
|
|
22
22
|
machineUserAttributes: MachineUserAttributes;
|
|
23
23
|
};
|
|
@@ -41,8 +41,8 @@ type AuthInvoker<M extends string> = Omit<AuthInvoker$1, "machineUserName"> & {
|
|
|
41
41
|
* @param config - Auth service configuration
|
|
42
42
|
* @returns Defined auth service
|
|
43
43
|
*/
|
|
44
|
-
declare function defineAuth<const Name extends string, const User extends TailorDBInstance, const AttributeMap extends UserAttributeMap<User>, const AttributeList extends UserAttributeListKey<User>[], const MachineUserNames extends string>(name: Name, config: UserProfileAuthInput<User, AttributeMap, AttributeList, MachineUserNames>): DefinedAuth<Name, UserProfileAuthInput<User, AttributeMap, AttributeList, MachineUserNames>, MachineUserNames>;
|
|
45
|
-
declare function defineAuth<const Name extends string, const MachineUserAttributes extends MachineUserAttributeFields, const MachineUserNames extends string>(name: Name, config: MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes>): DefinedAuth<Name, MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes>, MachineUserNames>;
|
|
44
|
+
declare function defineAuth<const Name extends string, const User extends TailorDBInstance, const AttributeMap extends UserAttributeMap<User>, const AttributeList extends UserAttributeListKey<User>[], const MachineUserNames extends string, const ConnectionNames extends string = string>(name: Name, config: UserProfileAuthInput<User, AttributeMap, AttributeList, MachineUserNames, ConnectionNames>): DefinedAuth<Name, UserProfileAuthInput<User, AttributeMap, AttributeList, MachineUserNames, ConnectionNames>, MachineUserNames>;
|
|
45
|
+
declare function defineAuth<const Name extends string, const MachineUserAttributes extends MachineUserAttributeFields, const MachineUserNames extends string, const ConnectionNames extends string = string>(name: Name, config: MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes, ConnectionNames>): DefinedAuth<Name, MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes, ConnectionNames>, MachineUserNames>;
|
|
46
46
|
//#endregion
|
|
47
47
|
//#region src/configure/services/resolver/resolver.d.ts
|
|
48
48
|
type Context<Input extends Record<string, TailorAnyField> | undefined> = {
|
|
@@ -871,4 +871,4 @@ declare namespace t {
|
|
|
871
871
|
}
|
|
872
872
|
//#endregion
|
|
873
873
|
export { createWorkflow as $, ResolverExecutedArgs as A, idpUserUpdatedTrigger as B, IdpUserCreatedArgs as C, RecordCreatedArgs as D, IdpUserUpdatedArgs as E, authAccessTokenRevokedTrigger as F, resolverExecutedTrigger as G, recordDeletedTrigger as H, authAccessTokenTrigger as I, Operation as J, FunctionOperation as K, idpUserCreatedTrigger as L, TailorDBTrigger as M, authAccessTokenIssuedTrigger as N, RecordDeletedArgs as O, authAccessTokenRefreshedTrigger as P, WorkflowConfig as Q, idpUserDeletedTrigger as R, IdpUserArgs as S, IdpUserTrigger as T, recordTrigger as U, recordCreatedTrigger as V, recordUpdatedTrigger as W, WorkflowOperation as X, WebhookOperation as Y, Workflow as Z, AuthAccessTokenArgs as _, defineGenerators as a, createWorkflowJob as at, AuthAccessTokenRevokedArgs as b, createExecutor as c, AuthInvoker as ct, IncomingWebhookRequest as d, WORKFLOW_TEST_ENV_KEY as et, IncomingWebhookTrigger as f, scheduleTrigger as g, ScheduleTrigger as h, defineConfig as i, WorkflowJobOutput as it, ResolverExecutedTrigger as j, RecordUpdatedArgs as k, Trigger as l, defineAuth as lt, ScheduleArgs as m, output as n, WorkflowJobContext as nt, definePlugins as o, QueryType as ot, incomingWebhookTrigger as p, GqlOperation as q, t as r, WorkflowJobInput as rt, defineIdp as s, createResolver as st, infer as t, WorkflowJob as tt, IncomingWebhookArgs as u, AuthAccessTokenIssuedArgs as v, IdpUserDeletedArgs as w, AuthAccessTokenTrigger as x, AuthAccessTokenRefreshedArgs as y, idpUserTrigger as z };
|
|
874
|
-
//# sourceMappingURL=index-
|
|
874
|
+
//# sourceMappingURL=index-wCoQup4y.d.mts.map
|
package/dist/kysely/index.d.mts
CHANGED
|
@@ -8,6 +8,7 @@ type ResolveSelect<T> = T extends ColumnType$1<infer S, unknown, unknown> ? S :
|
|
|
8
8
|
type ResolveInsert<T> = T extends ColumnType$1<unknown, infer I, unknown> ? I : T;
|
|
9
9
|
type ResolveUpdate<T> = T extends ColumnType$1<unknown, unknown, infer U> ? U : T;
|
|
10
10
|
type ObjectColumnType<T> = ColumnType$1<{ [K in keyof T]-?: Exclude<ResolveSelect<T[K]>, undefined> }, { [K in keyof T]: ResolveInsert<T[K]> }, { [K in keyof T]: ResolveUpdate<T[K]> }>;
|
|
11
|
+
type ArrayColumnType<T> = ColumnType$1<ResolveSelect<T>[], ResolveInsert<T>[], ResolveUpdate<T>[]>;
|
|
11
12
|
type Generated<T> = T extends ColumnType$1<infer S, infer I, infer U> ? ColumnType$1<S, I | undefined, U> : ColumnType$1<T, T | undefined, T>;
|
|
12
13
|
type Serial<T = string | number> = ColumnType$1<T, never, never>;
|
|
13
14
|
type TailordbKysely<DB> = Kysely$1<DB>;
|
|
@@ -24,5 +25,5 @@ type NamespaceInsertable<NS, T extends NamespaceTableName<NS>> = Insertable$1<Na
|
|
|
24
25
|
type NamespaceSelectable<NS, T extends NamespaceTableName<NS>> = Selectable$1<NamespaceTable<NS, T>>;
|
|
25
26
|
type NamespaceUpdateable<NS, T extends NamespaceTableName<NS>> = Updateable$1<NamespaceTable<NS, T>>;
|
|
26
27
|
//#endregion
|
|
27
|
-
export { type ColumnType, Generated, type Insertable, Kysely, type KyselyConfig, NamespaceDB, NamespaceInsertable, NamespaceSelectable, NamespaceTable, NamespaceTableName, NamespaceTransaction, NamespaceUpdateable, ObjectColumnType, type Selectable, Serial, TailordbDialect, TailordbKysely, Timestamp, type Transaction, type Updateable, createGetDB, sql };
|
|
28
|
+
export { ArrayColumnType, type ColumnType, Generated, type Insertable, Kysely, type KyselyConfig, NamespaceDB, NamespaceInsertable, NamespaceSelectable, NamespaceTable, NamespaceTableName, NamespaceTransaction, NamespaceUpdateable, ObjectColumnType, type Selectable, Serial, TailordbDialect, TailordbKysely, Timestamp, type Transaction, type Updateable, createGetDB, sql };
|
|
28
29
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["Kysely","TailordbDialect"],"sources":["../../src/kysely/index.ts"],"sourcesContent":["/**\n * Kysely integration module for generated TailorDB code.\n *\n * Re-exports kysely and function-kysely-tailordb types through a single import path\n * to avoid phantom dependency issues with pnpm, and provides namespace-aware\n * utility types and factory functions used by the code generator.\n */\n\nimport { TailordbDialect } from \"@tailor-platform/function-kysely-tailordb\";\nimport {\n type ColumnType,\n Kysely,\n type Insertable,\n type KyselyConfig,\n type Selectable,\n sql,\n type Transaction as KyselyTransaction,\n type Updateable,\n} from \"kysely\";\n\nexport {\n type ColumnType,\n Kysely,\n type KyselyConfig,\n type Transaction,\n type Insertable,\n type Selectable,\n sql,\n type Updateable,\n} from \"kysely\";\n\nexport { TailordbDialect } from \"@tailor-platform/function-kysely-tailordb\";\n\nexport type Timestamp = ColumnType<Date, Date | string, Date | string>;\ntype ResolveSelect<T> = T extends ColumnType<infer S, unknown, unknown> ? S : T;\ntype ResolveInsert<T> = T extends ColumnType<unknown, infer I, unknown> ? I : T;\ntype ResolveUpdate<T> = T extends ColumnType<unknown, unknown, infer U> ? U : T;\nexport type ObjectColumnType<T> = ColumnType<\n { [K in keyof T]-?: Exclude<ResolveSelect<T[K]>, undefined> },\n { [K in keyof T]: ResolveInsert<T[K]> },\n { [K in keyof T]: ResolveUpdate<T[K]> }\n>;\nexport type Generated<T> =\n T extends ColumnType<infer S, infer I, infer U>\n ? ColumnType<S, I | undefined, U>\n : ColumnType<T, T | undefined, T>;\nexport type Serial<T = string | number> = ColumnType<T, never, never>;\n\nexport type TailordbKysely<DB> = Kysely<DB>;\nexport type NamespaceDB<NS, N extends keyof NS = keyof NS> = TailordbKysely<NS[N]>;\n\n/**\n * Create a namespace-aware getDB function for generated code.\n * @returns A getDB function that creates Kysely instances for specific namespaces\n */\nexport function createGetDB<NS>() {\n return function getDB<const N extends keyof NS & string>(\n namespace: N,\n config?: Omit<KyselyConfig, \"dialect\">,\n ): TailordbKysely<NS[N]> {\n const client = new tailordb.Client({ namespace });\n return new Kysely<NS[N]>({\n dialect: new TailordbDialect(client),\n ...config,\n });\n };\n}\n\nexport type NamespaceTransaction<NS, K extends keyof NS | TailordbKysely<NS[keyof NS]> = keyof NS> =\n K extends TailordbKysely<infer DB>\n ? KyselyTransaction<DB>\n : K extends keyof NS\n ? KyselyTransaction<NS[K]>\n : never;\n\nexport type NamespaceTableName<NS> = {\n [N in keyof NS]: keyof NS[N];\n}[keyof NS];\n\nexport type NamespaceTable<NS, T extends NamespaceTableName<NS>> = {\n [N in keyof NS]: T extends keyof NS[N] ? NS[N][T] : never;\n}[keyof NS];\n\nexport type NamespaceInsertable<NS, T extends NamespaceTableName<NS>> = Insertable<\n NamespaceTable<NS, T>\n>;\nexport type NamespaceSelectable<NS, T extends NamespaceTableName<NS>> = Selectable<\n NamespaceTable<NS, T>\n>;\nexport type NamespaceUpdateable<NS, T extends NamespaceTableName<NS>> = Updateable<\n NamespaceTable<NS, T>\n>;\n"],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["Kysely","TailordbDialect"],"sources":["../../src/kysely/index.ts"],"sourcesContent":["/**\n * Kysely integration module for generated TailorDB code.\n *\n * Re-exports kysely and function-kysely-tailordb types through a single import path\n * to avoid phantom dependency issues with pnpm, and provides namespace-aware\n * utility types and factory functions used by the code generator.\n */\n\nimport { TailordbDialect } from \"@tailor-platform/function-kysely-tailordb\";\nimport {\n type ColumnType,\n Kysely,\n type Insertable,\n type KyselyConfig,\n type Selectable,\n sql,\n type Transaction as KyselyTransaction,\n type Updateable,\n} from \"kysely\";\n\nexport {\n type ColumnType,\n Kysely,\n type KyselyConfig,\n type Transaction,\n type Insertable,\n type Selectable,\n sql,\n type Updateable,\n} from \"kysely\";\n\nexport { TailordbDialect } from \"@tailor-platform/function-kysely-tailordb\";\n\nexport type Timestamp = ColumnType<Date, Date | string, Date | string>;\ntype ResolveSelect<T> = T extends ColumnType<infer S, unknown, unknown> ? S : T;\ntype ResolveInsert<T> = T extends ColumnType<unknown, infer I, unknown> ? I : T;\ntype ResolveUpdate<T> = T extends ColumnType<unknown, unknown, infer U> ? U : T;\nexport type ObjectColumnType<T> = ColumnType<\n { [K in keyof T]-?: Exclude<ResolveSelect<T[K]>, undefined> },\n { [K in keyof T]: ResolveInsert<T[K]> },\n { [K in keyof T]: ResolveUpdate<T[K]> }\n>;\nexport type ArrayColumnType<T> = ColumnType<\n ResolveSelect<T>[],\n ResolveInsert<T>[],\n ResolveUpdate<T>[]\n>;\nexport type Generated<T> =\n T extends ColumnType<infer S, infer I, infer U>\n ? ColumnType<S, I | undefined, U>\n : ColumnType<T, T | undefined, T>;\nexport type Serial<T = string | number> = ColumnType<T, never, never>;\n\nexport type TailordbKysely<DB> = Kysely<DB>;\nexport type NamespaceDB<NS, N extends keyof NS = keyof NS> = TailordbKysely<NS[N]>;\n\n/**\n * Create a namespace-aware getDB function for generated code.\n * @returns A getDB function that creates Kysely instances for specific namespaces\n */\nexport function createGetDB<NS>() {\n return function getDB<const N extends keyof NS & string>(\n namespace: N,\n config?: Omit<KyselyConfig, \"dialect\">,\n ): TailordbKysely<NS[N]> {\n const client = new tailordb.Client({ namespace });\n return new Kysely<NS[N]>({\n dialect: new TailordbDialect(client),\n ...config,\n });\n };\n}\n\nexport type NamespaceTransaction<NS, K extends keyof NS | TailordbKysely<NS[keyof NS]> = keyof NS> =\n K extends TailordbKysely<infer DB>\n ? KyselyTransaction<DB>\n : K extends keyof NS\n ? KyselyTransaction<NS[K]>\n : never;\n\nexport type NamespaceTableName<NS> = {\n [N in keyof NS]: keyof NS[N];\n}[keyof NS];\n\nexport type NamespaceTable<NS, T extends NamespaceTableName<NS>> = {\n [N in keyof NS]: T extends keyof NS[N] ? NS[N][T] : never;\n}[keyof NS];\n\nexport type NamespaceInsertable<NS, T extends NamespaceTableName<NS>> = Insertable<\n NamespaceTable<NS, T>\n>;\nexport type NamespaceSelectable<NS, T extends NamespaceTableName<NS>> = Selectable<\n NamespaceTable<NS, T>\n>;\nexport type NamespaceUpdateable<NS, T extends NamespaceTableName<NS>> = Updateable<\n NamespaceTable<NS, T>\n>;\n"],"mappings":";;;;;;;;;;;;;;;;AA4DA,SAAgB,cAAkB;AAChC,QAAO,SAAS,MACd,WACA,QACuB;AAEvB,SAAO,IAAIA,SAAc;GACvB,SAAS,IAAIC,kBAFA,IAAI,SAAS,OAAO,EAAE,WAAW,CAAC,CAEX;GACpC,GAAG;GACJ,CAAC"}
|
|
@@ -108,8 +108,10 @@ function generateFieldType(fieldConfig) {
|
|
|
108
108
|
const usedUtilityTypes = { ...baseTypeResult.usedUtilityTypes };
|
|
109
109
|
const isArray = fieldConfig.array === true;
|
|
110
110
|
const isNullable = fieldConfig.required !== true;
|
|
111
|
+
const isColumnTypeBase = new Set(["Timestamp"]).has(baseTypeResult.type);
|
|
111
112
|
let finalType = baseTypeResult.type;
|
|
112
|
-
if (isArray)
|
|
113
|
+
if (isArray) if (isColumnTypeBase || finalType.startsWith("ObjectColumnType<")) finalType = `ArrayColumnType<${baseTypeResult.type}>`;
|
|
114
|
+
else finalType = fieldConfig.type === "enum" ? `(${baseTypeResult.type})[]` : `${baseTypeResult.type}[]`;
|
|
113
115
|
if (isNullable) finalType = `${finalType} | null`;
|
|
114
116
|
if (fieldConfig.serial) {
|
|
115
117
|
usedUtilityTypes.Serial = true;
|
|
@@ -178,6 +180,7 @@ function generateUnifiedKyselyTypes(namespaceData) {
|
|
|
178
180
|
const utilityTypeImports = ["type Generated"];
|
|
179
181
|
if (globalUsedUtilityTypes.Timestamp) utilityTypeImports.push("type Timestamp");
|
|
180
182
|
if (namespaceData.some((ns) => ns.types.some((t) => t.typeDef.includes("ObjectColumnType<")))) utilityTypeImports.push("type ObjectColumnType");
|
|
183
|
+
if (namespaceData.some((ns) => ns.types.some((t) => t.typeDef.includes("ArrayColumnType<")))) utilityTypeImports.push("type ArrayColumnType");
|
|
181
184
|
if (globalUsedUtilityTypes.Serial) utilityTypeImports.push("type Serial");
|
|
182
185
|
return [
|
|
183
186
|
ml`
|
|
@@ -269,4 +272,4 @@ function kyselyTypePlugin(options) {
|
|
|
269
272
|
|
|
270
273
|
//#endregion
|
|
271
274
|
export { kyselyTypePlugin as n, KyselyGeneratorID as t };
|
|
272
|
-
//# sourceMappingURL=kysely-type-
|
|
275
|
+
//# sourceMappingURL=kysely-type-DtnNdHn3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kysely-type-DtnNdHn3.mjs","names":[],"sources":["../src/plugin/builtin/kysely-type/type-processor.ts","../src/plugin/builtin/kysely-type/index.ts"],"sourcesContent":["import multiline from \"multiline-ts\";\nimport { type KyselyNamespaceMetadata, type KyselyTypeMetadata } from \"./types\";\nimport type { OperatorFieldConfig, TailorDBType } from \"@/types/tailordb\";\n\ntype UsedUtilityTypes = { Timestamp: boolean; Serial: boolean };\n\ntype FieldTypeResult = {\n type: string;\n usedUtilityTypes: UsedUtilityTypes;\n};\n\n/**\n * Get the enum type definition.\n * @param fieldConfig - The field configuration\n * @returns The enum type as a string union\n */\nfunction getEnumType(fieldConfig: OperatorFieldConfig): string {\n const allowedValues = fieldConfig.allowedValues;\n\n if (allowedValues && Array.isArray(allowedValues)) {\n return allowedValues\n .map((v: string | { value: string }) => {\n const value = typeof v === \"string\" ? v : v.value;\n return `\"${value}\"`;\n })\n .join(\" | \");\n }\n return \"string\";\n}\n\n/**\n * Get the nested object type definition.\n * @param fieldConfig - The field configuration\n * @returns The nested type with used utility types\n */\nfunction getNestedType(fieldConfig: OperatorFieldConfig): FieldTypeResult {\n const fields = fieldConfig.fields;\n if (!fields || typeof fields !== \"object\") {\n return {\n type: \"string\",\n usedUtilityTypes: { Timestamp: false, Serial: false },\n };\n }\n\n const fieldResults = Object.entries(fields).map(([fieldName, config]) => {\n const result = generateFieldType(config);\n const optional = config.required !== true ? \"?\" : \"\";\n return {\n fieldType: `${fieldName}${optional}: ${result.type}`,\n usedUtilityTypes: result.usedUtilityTypes,\n };\n });\n\n const aggregatedUtilityTypes = fieldResults.reduce(\n (acc, result) => ({\n Timestamp: acc.Timestamp || result.usedUtilityTypes.Timestamp,\n Serial: acc.Serial || result.usedUtilityTypes.Serial,\n }),\n { Timestamp: false, Serial: false },\n );\n\n const fieldTypes = fieldResults.map((r) => r.fieldType);\n const obj = `{\\n ${fieldTypes.join(\";\\n \")}${fieldTypes.length > 0 ? \";\" : \"\"}\\n}`;\n\n const hasOptionalFields = Object.values(fields).some((config) => config.required !== true);\n if (aggregatedUtilityTypes.Timestamp || hasOptionalFields) {\n return { type: `ObjectColumnType<${obj}>`, usedUtilityTypes: aggregatedUtilityTypes };\n }\n return { type: obj, usedUtilityTypes: aggregatedUtilityTypes };\n}\n\n/**\n * Get the base Kysely type for a field (without array/null modifiers).\n * @param fieldConfig - The field configuration\n * @returns The base type with used utility types\n */\nfunction getBaseType(fieldConfig: OperatorFieldConfig): FieldTypeResult {\n const fieldType = fieldConfig.type;\n const usedUtilityTypes = { Timestamp: false, Serial: false };\n\n let type: string;\n switch (fieldType) {\n case \"uuid\":\n case \"string\":\n case \"decimal\":\n type = \"string\";\n break;\n case \"integer\":\n case \"float\":\n type = \"number\";\n break;\n case \"date\":\n case \"datetime\":\n usedUtilityTypes.Timestamp = true;\n type = \"Timestamp\";\n break;\n case \"bool\":\n case \"boolean\":\n type = \"boolean\";\n break;\n case \"enum\":\n type = getEnumType(fieldConfig);\n break;\n case \"nested\": {\n const nestedResult = getNestedType(fieldConfig);\n return nestedResult;\n }\n default:\n type = \"string\";\n break;\n }\n\n return { type, usedUtilityTypes };\n}\n\n/**\n * Generate the complete field type including array and null modifiers.\n * @param fieldConfig - The field configuration\n * @returns The complete field type with used utility types\n */\nfunction generateFieldType(fieldConfig: OperatorFieldConfig): FieldTypeResult {\n const baseTypeResult = getBaseType(fieldConfig);\n const usedUtilityTypes = { ...baseTypeResult.usedUtilityTypes };\n\n const isArray = fieldConfig.array === true;\n const isNullable = fieldConfig.required !== true;\n\n // Types that use ColumnType internally (Timestamp, ObjectColumnType) cannot be\n // directly wrapped with [] for arrays, because Kysely only resolves ColumnType at\n // the top-level table property. Use ArrayColumnType/ObjectArrayColumnType to keep\n // the ColumnType at the top level with arrays inside.\n const columnTypeBaseTypes = new Set([\"Timestamp\"]);\n const isColumnTypeBase = columnTypeBaseTypes.has(baseTypeResult.type);\n\n let finalType = baseTypeResult.type;\n if (isArray) {\n if (isColumnTypeBase || finalType.startsWith(\"ObjectColumnType<\")) {\n finalType = `ArrayColumnType<${baseTypeResult.type}>`;\n } else {\n const needsParens = fieldConfig.type === \"enum\";\n finalType = needsParens ? `(${baseTypeResult.type})[]` : `${baseTypeResult.type}[]`;\n }\n }\n if (isNullable) {\n finalType = `${finalType} | null`;\n }\n\n if (fieldConfig.serial) {\n usedUtilityTypes.Serial = true;\n finalType = `Serial<${finalType}>`;\n }\n if (fieldConfig.hooks?.create) {\n finalType = `Generated<${finalType}>`;\n }\n\n return { type: finalType, usedUtilityTypes };\n}\n\n/**\n * Generate the table interface.\n * @param type - The parsed TailorDB type\n * @returns The type definition and used utility types\n */\nfunction generateTableInterface(type: TailorDBType): {\n typeDef: string;\n usedUtilityTypes: UsedUtilityTypes;\n} {\n const fieldEntries = Object.entries(type.fields).filter(([fieldName]) => fieldName !== \"id\");\n\n const fieldResults = fieldEntries.map(([fieldName, parsedField]) => ({\n fieldName,\n ...generateFieldType(parsedField.config),\n }));\n\n const fields = [\n \"id: Generated<string>;\",\n ...fieldResults.map((result) => `${result.fieldName}: ${result.type};`),\n ];\n\n const aggregatedUtilityTypes = fieldResults.reduce(\n (acc, result) => ({\n Timestamp: acc.Timestamp || result.usedUtilityTypes.Timestamp,\n\n Serial: acc.Serial || result.usedUtilityTypes.Serial,\n }),\n { Timestamp: false, Serial: false },\n );\n\n const typeDef = multiline /* ts */ `\n ${type.name}: {\n ${fields.join(\"\\n\")}\n }\n `;\n\n return { typeDef, usedUtilityTypes: aggregatedUtilityTypes };\n}\n\n/**\n * Convert a TailorDBType into KyselyTypeMetadata.\n * @param type - Parsed TailorDB type\n * @returns Generated Kysely type metadata\n */\nexport async function processKyselyType(type: TailorDBType): Promise<KyselyTypeMetadata> {\n const result = generateTableInterface(type);\n\n return {\n name: type.name,\n typeDef: result.typeDef,\n usedUtilityTypes: result.usedUtilityTypes,\n };\n}\n\n/**\n * Generate unified types file from multiple namespaces.\n * @param namespaceData - Namespace metadata\n * @returns Generated types file contents\n */\nexport function generateUnifiedKyselyTypes(namespaceData: KyselyNamespaceMetadata[]): string {\n if (namespaceData.length === 0) {\n return \"\";\n }\n\n // Aggregate used utility types from all namespaces\n const globalUsedUtilityTypes = namespaceData.reduce(\n (acc, ns) => ({\n Timestamp: acc.Timestamp || ns.usedUtilityTypes.Timestamp,\n Serial: acc.Serial || ns.usedUtilityTypes.Serial,\n }),\n { Timestamp: false, Serial: false },\n );\n\n const utilityTypeImports: string[] = [\"type Generated\"];\n if (globalUsedUtilityTypes.Timestamp) {\n utilityTypeImports.push(\"type Timestamp\");\n }\n const hasObjectColumnType = namespaceData.some((ns) =>\n ns.types.some((t) => t.typeDef.includes(\"ObjectColumnType<\")),\n );\n if (hasObjectColumnType) {\n utilityTypeImports.push(\"type ObjectColumnType\");\n }\n const hasArrayColumnType = namespaceData.some((ns) =>\n ns.types.some((t) => t.typeDef.includes(\"ArrayColumnType<\")),\n );\n if (hasArrayColumnType) {\n utilityTypeImports.push(\"type ArrayColumnType\");\n }\n if (globalUsedUtilityTypes.Serial) {\n utilityTypeImports.push(\"type Serial\");\n }\n\n const importsSection = multiline /* ts */ `\n import {\n createGetDB,\n ${utilityTypeImports.join(\",\\n\")},\n type NamespaceDB,\n type NamespaceInsertable,\n type NamespaceSelectable,\n type NamespaceTable,\n type NamespaceTableName,\n type NamespaceTransaction,\n type NamespaceUpdateable,\n } from \"@tailor-platform/sdk/kysely\";\n `;\n\n // Generate Namespace interface with multiple namespaces\n const namespaceInterfaces = namespaceData\n .map(({ namespace, types }) => {\n const typeDefsWithIndent = types\n .map((type) => {\n return type.typeDef\n .split(\"\\n\")\n .map((line) => (line.trim() ? ` ${line}` : \"\"))\n .join(\"\\n\");\n })\n .join(\"\\n\\n\");\n\n return ` \"${namespace}\": {\\n${typeDefsWithIndent}\\n }`;\n })\n .join(\",\\n\");\n\n const namespaceInterface = `export interface Namespace {\\n${namespaceInterfaces}\\n}`;\n\n const getDBFunction = multiline /* ts */ `\n export const getDB = createGetDB<Namespace>();\n\n export type DB<N extends keyof Namespace = keyof Namespace> = NamespaceDB<Namespace, N>;\n `;\n\n const utilityTypeExports = multiline /* ts */ `\n export type Transaction<K extends keyof Namespace | DB = keyof Namespace> =\n NamespaceTransaction<Namespace, K>;\n\n type TableName = NamespaceTableName<Namespace>;\n export type Table<T extends TableName> = NamespaceTable<Namespace, T>;\n\n export type Insertable<T extends TableName> = NamespaceInsertable<Namespace, T>;\n export type Selectable<T extends TableName> = NamespaceSelectable<Namespace, T>;\n export type Updateable<T extends TableName> = NamespaceUpdateable<Namespace, T>;\n `;\n\n return (\n [importsSection, namespaceInterface, getDBFunction, utilityTypeExports].join(\"\\n\\n\") + \"\\n\"\n );\n}\n","import { processKyselyType, generateUnifiedKyselyTypes } from \"./type-processor\";\nimport type { KyselyTypeMetadata, KyselyNamespaceMetadata } from \"./types\";\nimport type { Plugin } from \"@/types/plugin\";\nimport type { GeneratorResult, TailorDBReadyContext } from \"@/types/plugin-generation\";\n\n/** Unique identifier for the Kysely type generator plugin. */\nexport const KyselyGeneratorID = \"@tailor-platform/kysely-type\";\n\ntype KyselyTypePluginOptions = {\n distPath: string;\n};\n\n/**\n * Plugin that generates Kysely type definitions for TailorDB types.\n * @param options - Plugin options\n * @param options.distPath - Output file path for generated types\n * @returns Plugin instance with onTailorDBReady hook\n */\nexport function kyselyTypePlugin(\n options: KyselyTypePluginOptions,\n): Plugin<unknown, KyselyTypePluginOptions> {\n return {\n id: KyselyGeneratorID,\n description: \"Generates Kysely type definitions for TailorDB types\",\n pluginConfig: options,\n\n async onTailorDBReady(\n ctx: TailorDBReadyContext<KyselyTypePluginOptions>,\n ): Promise<GeneratorResult> {\n const allNamespaceData: KyselyNamespaceMetadata[] = [];\n\n for (const ns of ctx.tailordb) {\n const typeMetadataList: KyselyTypeMetadata[] = [];\n\n for (const type of Object.values(ns.types)) {\n const metadata = await processKyselyType(type);\n typeMetadataList.push(metadata);\n }\n\n if (typeMetadataList.length === 0) continue;\n\n const usedUtilityTypes = typeMetadataList.reduce(\n (acc, type) => ({\n Timestamp: acc.Timestamp || type.usedUtilityTypes.Timestamp,\n Serial: acc.Serial || type.usedUtilityTypes.Serial,\n }),\n { Timestamp: false, Serial: false },\n );\n\n allNamespaceData.push({\n namespace: ns.namespace,\n types: typeMetadataList,\n usedUtilityTypes,\n });\n }\n\n const files: GeneratorResult[\"files\"] = [];\n if (allNamespaceData.length > 0) {\n const content = generateUnifiedKyselyTypes(allNamespaceData);\n files.push({\n path: ctx.pluginConfig.distPath,\n content,\n });\n }\n\n return { files };\n },\n };\n}\n"],"mappings":";;;;;;;;;AAgBA,SAAS,YAAY,aAA0C;CAC7D,MAAM,gBAAgB,YAAY;AAElC,KAAI,iBAAiB,MAAM,QAAQ,cAAc,CAC/C,QAAO,cACJ,KAAK,MAAkC;AAEtC,SAAO,IADO,OAAO,MAAM,WAAW,IAAI,EAAE,MAC3B;GACjB,CACD,KAAK,MAA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B;;;;;EAMd,EAAmB;;;;;;;;;;;EAa2B,CAAC,KAAK,OAAO,GAAG;;;;;;ACxS3F,MAAa,oBAAoB;;;;;;;AAYjC,SAAgB,iBACd,SAC0C;AAC1C,QAAO;EACL,IAAI;EACJ,aAAa;EACb,cAAc;EAEd,MAAM,gBACJ,KAC0B;GAC1B,MAAM,mBAA8C,EAAE;AAEtD,QAAK,MAAM,MAAM,IAAI,UAAU;IAC7B,MAAM,mBAAyC,EAAE;AAEjD,SAAK,MAAM,QAAQ,OAAO,OAAO,GAAG,MAAM,EAAE;KAC1C,MAAM,WAAW,MAAM,kBAAkB,KAAK;AAC9C,sBAAiB,KAAK,SAAS;;AAGjC,QAAI,iBAAiB,WAAW,EAAG;IAEnC,MAAM,mBAAmB,iBAAiB,QACvC,KAAK,UAAU;KACd,WAAW,IAAI,aAAa,KAAK,iBAAiB;KAClD,QAAQ,IAAI,UAAU,KAAK,iBAAiB;KAC7C,GACD;KAAE,WAAW;KAAO,QAAQ;KAAO,CACpC;AAED,qBAAiB,KAAK;KACpB,WAAW,GAAG;KACd,OAAO;KACP;KACD,CAAC;;GAGJ,MAAM,QAAkC,EAAE;AAC1C,OAAI,iBAAiB,SAAS,GAAG;IAC/B,MAAM,UAAU,2BAA2B,iBAAiB;AAC5D,UAAM,KAAK;KACT,MAAM,IAAI,aAAa;KACvB;KACD,CAAC;;AAGJ,UAAO,EAAE,OAAO;;EAEnB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "../../../index-
|
|
2
|
+
import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "../../../index-BBlE_vQF.mjs";
|
|
3
3
|
export { EnumConstantsGeneratorID, enumConstantsPlugin };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "../../../index-
|
|
2
|
+
import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "../../../index-BG7YCyXF.mjs";
|
|
3
3
|
export { FileUtilsGeneratorID, fileUtilsPlugin };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "../../../index-
|
|
2
|
+
import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "../../../index-B1Fgxi8D.mjs";
|
|
3
3
|
export { KyselyGeneratorID, kyselyTypePlugin };
|
package/dist/plugin/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import {
|
|
3
|
-
import { n as TailorEnv, r as TailorActor } from "../env-
|
|
2
|
+
import { B as TailorAnyDBType } from "../plugin-CZaJ3_QR.mjs";
|
|
3
|
+
import { n as TailorEnv, r as TailorActor } from "../env-MSlwZt8l.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/plugin/with-context.d.ts
|
|
6
6
|
/**
|
|
@@ -377,6 +377,25 @@ type Resolver = {
|
|
|
377
377
|
};
|
|
378
378
|
type ResolverInput = Resolver;
|
|
379
379
|
//#endregion
|
|
380
|
+
//#region src/types/auth-connection.generated.d.ts
|
|
381
|
+
type AuthConnectionOAuth2Config = {
|
|
382
|
+
/** OAuth2 provider URL */providerUrl: string; /** OAuth2 issuer URL */
|
|
383
|
+
issuerUrl: string; /** OAuth2 client ID */
|
|
384
|
+
clientId: string; /** OAuth2 client secret */
|
|
385
|
+
clientSecret: string; /** OAuth2 authorization endpoint override */
|
|
386
|
+
authUrl?: string | undefined; /** OAuth2 token endpoint override */
|
|
387
|
+
tokenUrl?: string | undefined;
|
|
388
|
+
};
|
|
389
|
+
type AuthConnectionConfig = {
|
|
390
|
+
type: "oauth2";
|
|
391
|
+
providerUrl: string;
|
|
392
|
+
issuerUrl: string;
|
|
393
|
+
clientId: string;
|
|
394
|
+
clientSecret: string;
|
|
395
|
+
authUrl?: string | undefined;
|
|
396
|
+
tokenUrl?: string | undefined;
|
|
397
|
+
};
|
|
398
|
+
//#endregion
|
|
380
399
|
//#region src/configure/types/field.d.ts
|
|
381
400
|
type AllowedValue = EnumValue;
|
|
382
401
|
type AllowedValues = readonly [string | EnumValue, ...(string | EnumValue)[]];
|
|
@@ -1525,6 +1544,13 @@ type SCIMAttributeType = SCIMAttribute["type"];
|
|
|
1525
1544
|
type AuthInvokerWithName<M extends string> = Omit<AuthInvoker, "machineUserName"> & {
|
|
1526
1545
|
machineUserName: M;
|
|
1527
1546
|
};
|
|
1547
|
+
/** Result of retrieving a connection token at runtime. */
|
|
1548
|
+
type AuthConnectionTokenResult = {
|
|
1549
|
+
access_token: string;
|
|
1550
|
+
refresh_token?: string;
|
|
1551
|
+
token_type?: string;
|
|
1552
|
+
expiry?: string;
|
|
1553
|
+
};
|
|
1528
1554
|
type ValueOperand = string | boolean | string[] | boolean[];
|
|
1529
1555
|
type AuthAttributeValue = ValueOperand | null | undefined;
|
|
1530
1556
|
type UserFieldKeys<User extends TailorDBInstance> = keyof output<User> & string;
|
|
@@ -1608,7 +1634,7 @@ type BeforeLoginHook<MachineUserNames extends string> = {
|
|
|
1608
1634
|
type AuthHooks<MachineUserNames extends string> = {
|
|
1609
1635
|
beforeLogin?: BeforeLoginHook<MachineUserNames>;
|
|
1610
1636
|
};
|
|
1611
|
-
type AuthServiceInput<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[], MachineUserNames extends string, MachineUserAttributes extends MachineUserAttributeFields | undefined = MachineUserAttributeFields | undefined> = {
|
|
1637
|
+
type AuthServiceInput<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[], MachineUserNames extends string, MachineUserAttributes extends MachineUserAttributeFields | undefined = MachineUserAttributeFields | undefined, ConnectionNames extends string = string> = {
|
|
1612
1638
|
hooks?: AuthHooks<MachineUserNames>;
|
|
1613
1639
|
userProfile?: UserProfile<User, AttributeMap, AttributeList>;
|
|
1614
1640
|
machineUserAttributes?: MachineUserAttributes;
|
|
@@ -1617,15 +1643,20 @@ type AuthServiceInput<User extends TailorDBInstance, AttributeMap extends UserAt
|
|
|
1617
1643
|
idProvider?: IdProvider;
|
|
1618
1644
|
scim?: SCIMConfig;
|
|
1619
1645
|
tenantProvider?: TenantProvider;
|
|
1646
|
+
connections?: Record<ConnectionNames, AuthConnectionConfig>;
|
|
1620
1647
|
publishSessionEvents?: boolean;
|
|
1621
1648
|
};
|
|
1622
1649
|
declare const authDefinitionBrand: unique symbol;
|
|
1623
1650
|
type AuthDefinitionBrand = {
|
|
1624
1651
|
readonly [authDefinitionBrand]: true;
|
|
1625
1652
|
};
|
|
1653
|
+
type ConnectionNames<Config> = Config extends {
|
|
1654
|
+
connections?: Record<infer K, unknown>;
|
|
1655
|
+
} ? K & string : string;
|
|
1626
1656
|
type DefinedAuth<Name extends string, Config, MachineUserNames extends string> = Config & {
|
|
1627
1657
|
name: Name;
|
|
1628
1658
|
invoker<M extends MachineUserNames>(machineUser: M): AuthInvokerWithName<M>;
|
|
1659
|
+
getConnectionToken<C extends ConnectionNames<Config>>(connectionName: C): Promise<AuthConnectionTokenResult>;
|
|
1629
1660
|
} & AuthDefinitionBrand;
|
|
1630
1661
|
type AuthExternalConfig = {
|
|
1631
1662
|
name: string;
|
|
@@ -2037,5 +2068,5 @@ interface Plugin<TypeConfig = unknown, PluginConfig = unknown> {
|
|
|
2037
2068
|
onExecutorReady?(context: ExecutorReadyContext<PluginConfig>): GeneratorResult | Promise<GeneratorResult>;
|
|
2038
2069
|
}
|
|
2039
2070
|
//#endregion
|
|
2040
|
-
export {
|
|
2041
|
-
//# sourceMappingURL=plugin-
|
|
2071
|
+
export { FieldOptions as $, BeforeLoginHookArgs as A, WebhookOperation as At, TailorAnyDBType as B, SCIMAttributeMapping as Bt, TailorDBType as C, FunctionOperation as Ct, AuthExternalConfig as D, ResolverExecutedTrigger as Dt, AuthConnectionTokenResult as E, IncomingWebhookTrigger as Et, UserAttributeListKey as F, IdProvider as Ft, PermissionCondition as G, TailorDBInstance as H, SCIMConfig as Ht, UserAttributeMap as I, OAuth2ClientInput as It, unsafeAllowAllGqlPermission as J, TailorTypeGqlPermission as K, UsernameFieldKey as L, OIDC as Lt, OAuth2ClientGrantType as M, AuthInvoker as Mt, SCIMAttributeType as N, BuiltinIdP as Nt, AuthOwnConfig as O, ScheduleTriggerInput as Ot, UserAttributeKey as P, IDToken as Pt, FieldMetadata as Q, ValueOperand as R, SAML as Rt, TailorDBServiceInput as S, ExecutorInput as St, AuthConfig as T, IdpUserTrigger as Tt, TailorDBType$1 as U, SCIMResource as Ut, TailorDBField as V, SCIMAuthorization as Vt, db as W, TenantProvider as Wt, ArrayFieldOutput as X, unsafeAllowAllTypePermission as Y, DefinedFieldMetadata as Z, GeneratorResult as _, Resolver as _t, PluginExecutorContext as a, JsonCompatible as at, TailorDBNamespaceData as b, AuthAccessTokenTrigger as bt, PluginGeneratedExecutorWithFile as c, AttributeMap as ct, PluginNamespaceProcessContext as d, TailorUser as dt, FieldOutput$1 as et, PluginOutput as f, unauthenticatedTailorUser as ft, ExecutorReadyContext as g, AuthConnectionOAuth2Config as gt, TypePluginOutput as h, AuthConnectionConfig as ht, PluginConfigs as i, InferFieldsOutput as it, DefinedAuth as j, WorkflowOperation as jt, AuthServiceInput as k, TailorDBTrigger as kt, PluginGeneratedResolver as l, InferredAttributeList as lt, TailorDBTypeForPlugin as m, AllowedValuesOutput as mt, Plugin as n, TailorAnyField as nt, PluginExecutorContextBase as o, output as ot, PluginProcessContext as p, AllowedValues as pt, TailorTypePermission as q, PluginAttachment as r, TailorField as rt, PluginGeneratedExecutor as s, AttributeList as st, NamespacePluginOutput as t, TailorFieldType as tt, PluginGeneratedType as u, InferredAttributeMap as ut, ResolverNamespaceData as v, ResolverInput as vt, TypeSourceInfoEntry as w, GqlOperation as wt, TailorDBReadyContext as x, Executor as xt, ResolverReadyContext as y, GeneratorConfig as yt, TailorAnyDBField as z, SCIMAttribute as zt };
|
|
2072
|
+
//# sourceMappingURL=plugin-CZaJ3_QR.d.mts.map
|