@tailor-platform/sdk 1.70.1 → 1.72.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 +32 -0
- package/dist/{authconnection-BIYzEh2p.d.mts → authconnection-CqfaJfrC.d.mts} +8 -15
- package/dist/{authconnection-Ds2Ahpum.mjs → authconnection-D7lsvsKY.mjs} +2 -2
- package/dist/authconnection-D7lsvsKY.mjs.map +1 -0
- package/dist/cli/index.mjs +781 -185
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +7 -6
- package/dist/cli/lib.mjs +1 -1
- package/dist/completion/zsh-worker.zsh +124 -25
- package/dist/configure/index.d.mts +5 -4
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{index-C-vsbx27.d.mts → index-BDBU7x-i.d.mts} +2 -2
- package/dist/{index-dKNk8hjo.d.mts → index-BSlv_YrG.d.mts} +2 -2
- package/dist/{index-BAEaAqmz.d.mts → index-BzGqTY5x.d.mts} +16 -4
- package/dist/{index-CKI0eZP6.d.mts → index-D3_Au3wu.d.mts} +2 -2
- package/dist/{index-CrqOgUF2.d.mts → index-DtFRlrww.d.mts} +2 -2
- package/dist/{index-DESLU9kI.d.mts → index-jeE3UvF2.d.mts} +2 -2
- package/dist/mock-wf5qeZLi.mjs.map +1 -1
- 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/seed/index.d.mts +1 -1
- package/dist/runtime/authconnection.d.mts +1 -1
- package/dist/runtime/authconnection.mjs +1 -1
- package/dist/runtime/globals.d.mts +1 -1
- package/dist/runtime/index.d.mts +2 -2
- package/dist/runtime/index.mjs +1 -1
- package/dist/{runtime-BpHVwifd.mjs → runtime-Cd375HD-.mjs} +23 -10
- package/dist/runtime-Cd375HD-.mjs.map +1 -0
- package/dist/{types-Dynq4AJv.d.mts → types-aqnqTCfO.d.mts} +4 -342
- package/dist/types-v_ErzNUF.d.mts +345 -0
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/vitest/index.d.mts +4 -3
- package/dist/{workflow.generated-DJULCuRr.d.mts → workflow.generated-Da1zECDw.d.mts} +3 -2
- package/docs/cli/setup.md +129 -19
- package/docs/cli-reference.md +9 -4
- package/docs/services/auth.md +10 -8
- package/docs/testing.md +1 -1
- package/package.json +1 -1
- package/dist/authconnection-Ds2Ahpum.mjs.map +0 -1
- package/dist/runtime-BpHVwifd.mjs.map +0 -1
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import { o as TailorEnv } from "./types-DTcZ2Yax.mjs";
|
|
2
|
+
import { C as FieldMetadata, D as TailorField, F as output, O as TailorFieldType, m as TailorDBInstance, x as DefinedFieldMetadata } from "./types-rj8YJcEe.mjs";
|
|
3
|
+
import { IsAny, JsonObject, JsonValue } from "type-fest";
|
|
4
|
+
|
|
5
|
+
//#region src/types/auth-connection.generated.d.ts
|
|
6
|
+
type AuthConnectionOAuth2Config = {
|
|
7
|
+
/** OAuth2 provider URL */providerUrl: string; /** OAuth2 issuer URL */
|
|
8
|
+
issuerUrl: string; /** OAuth2 client ID */
|
|
9
|
+
clientId: string; /** OAuth2 client secret */
|
|
10
|
+
clientSecret: string; /** OAuth2 authorization endpoint override */
|
|
11
|
+
authUrl?: string | undefined; /** OAuth2 token endpoint override */
|
|
12
|
+
tokenUrl?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
type AuthConnectionConfig = {
|
|
15
|
+
type: "oauth2";
|
|
16
|
+
providerUrl: string;
|
|
17
|
+
issuerUrl: string;
|
|
18
|
+
clientId: string;
|
|
19
|
+
clientSecret: string;
|
|
20
|
+
authUrl?: string | undefined;
|
|
21
|
+
tokenUrl?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/types/auth.generated.d.ts
|
|
25
|
+
type AuthInvokerObject = {
|
|
26
|
+
/** Auth namespace */namespace: string; /** Machine user name for authentication */
|
|
27
|
+
machineUserName: string;
|
|
28
|
+
};
|
|
29
|
+
type AuthInvoker = AuthInvokerObject;
|
|
30
|
+
type OIDC = {
|
|
31
|
+
/** Identity provider name */name: string;
|
|
32
|
+
kind: "OIDC"; /** OAuth2 client ID */
|
|
33
|
+
clientID: string; /** OAuth2 client secret */
|
|
34
|
+
clientSecret: {
|
|
35
|
+
vaultName: string;
|
|
36
|
+
secretKey: string;
|
|
37
|
+
}; /** OIDC provider URL */
|
|
38
|
+
providerURL: string; /** OIDC issuer URL (defaults to providerURL) */
|
|
39
|
+
issuerURL?: string | undefined; /** JWT claim to use as username */
|
|
40
|
+
usernameClaim?: string | undefined;
|
|
41
|
+
};
|
|
42
|
+
type SAML = {
|
|
43
|
+
/** Identity provider name */name: string;
|
|
44
|
+
kind: "SAML"; /** Enable signing of SAML requests */
|
|
45
|
+
enableSignRequest: boolean; /** URL to fetch SAML metadata (mutually exclusive with rawMetadata) */
|
|
46
|
+
metadataURL?: string | undefined; /** Raw SAML metadata XML (mutually exclusive with metadataURL) */
|
|
47
|
+
rawMetadata?: string | undefined; /** URL to redirect to when SAML ACS receives a response with an empty RelayState. */
|
|
48
|
+
defaultRedirectURL?: string | undefined;
|
|
49
|
+
};
|
|
50
|
+
type IDToken = {
|
|
51
|
+
/** Identity provider name */name: string;
|
|
52
|
+
kind: "IDToken"; /** ID token provider URL */
|
|
53
|
+
providerURL: string; /** Client ID for ID token validation */
|
|
54
|
+
clientID: string; /** ID token issuer URL */
|
|
55
|
+
issuerURL?: string | undefined; /** JWT claim to use as username */
|
|
56
|
+
usernameClaim?: string | undefined;
|
|
57
|
+
};
|
|
58
|
+
type BuiltinIdP = {
|
|
59
|
+
/** Identity provider name */name: string;
|
|
60
|
+
kind: "BuiltInIdP"; /** IdP namespace */
|
|
61
|
+
namespace: string; /** OAuth2 client name in the IdP */
|
|
62
|
+
clientName: string;
|
|
63
|
+
};
|
|
64
|
+
type IdProvider = OIDC | SAML | IDToken | BuiltinIdP;
|
|
65
|
+
type OAuth2ClientInput = {
|
|
66
|
+
/** Allowed redirect URIs */redirectURIs: (`https://${string}` | `http://${string}` | `${string}:url` | `${string}:url/${string}`)[]; /** Client description */
|
|
67
|
+
description?: string | undefined; /** Allowed OAuth2 grant types */
|
|
68
|
+
grantTypes?: ("authorization_code" | "refresh_token")[] | undefined; /** OAuth2 client type */
|
|
69
|
+
clientType?: "confidential" | "public" | "browser" | undefined; /** Access token lifetime in seconds (60-86400) */
|
|
70
|
+
accessTokenLifetimeSeconds?: number | undefined; /** Refresh token lifetime in seconds (60-604800) */
|
|
71
|
+
refreshTokenLifetimeSeconds?: number | undefined; /** Require DPoP (Demonstrating Proof-of-Possession) for token requests */
|
|
72
|
+
requireDpop?: boolean | undefined;
|
|
73
|
+
};
|
|
74
|
+
type OAuth2Client = {
|
|
75
|
+
/** Allowed OAuth2 grant types */grantTypes: ("authorization_code" | "refresh_token")[]; /** Allowed redirect URIs */
|
|
76
|
+
redirectURIs: (`https://${string}` | `http://${string}` | `${string}:url` | `${string}:url/${string}`)[]; /** Access token lifetime in seconds (60-86400) */
|
|
77
|
+
accessTokenLifetimeSeconds: {
|
|
78
|
+
seconds: bigint;
|
|
79
|
+
nanos: number;
|
|
80
|
+
} | undefined; /** Refresh token lifetime in seconds (60-604800) */
|
|
81
|
+
refreshTokenLifetimeSeconds: {
|
|
82
|
+
seconds: bigint;
|
|
83
|
+
nanos: number;
|
|
84
|
+
} | undefined; /** Client description */
|
|
85
|
+
description?: string | undefined; /** OAuth2 client type */
|
|
86
|
+
clientType?: "confidential" | "public" | "browser" | undefined; /** Require DPoP (Demonstrating Proof-of-Possession) for token requests */
|
|
87
|
+
requireDpop?: boolean | undefined;
|
|
88
|
+
};
|
|
89
|
+
type SCIMAuthorization = {
|
|
90
|
+
/** SCIM authorization type */type: "oauth2" | "bearer"; /** Bearer token secret (required for bearer type) */
|
|
91
|
+
bearerSecret?: {
|
|
92
|
+
vaultName: string;
|
|
93
|
+
secretKey: string;
|
|
94
|
+
} | undefined;
|
|
95
|
+
};
|
|
96
|
+
type SCIMAttribute = {
|
|
97
|
+
/** Attribute data type */type: "string" | "number" | "boolean" | "datetime" | "complex"; /** Attribute name */
|
|
98
|
+
name: string; /** Attribute description */
|
|
99
|
+
description?: string | undefined; /** Attribute mutability */
|
|
100
|
+
mutability?: "readOnly" | "readWrite" | "writeOnly" | undefined; /** Whether the attribute is required */
|
|
101
|
+
required?: boolean | undefined; /** Whether the attribute can have multiple values */
|
|
102
|
+
multiValued?: boolean | undefined; /** Uniqueness constraint */
|
|
103
|
+
uniqueness?: "none" | "server" | "global" | undefined; /** List of canonical values */
|
|
104
|
+
canonicalValues?: string[] | null | undefined;
|
|
105
|
+
subAttributes?: SCIMAttribute[] | null | undefined;
|
|
106
|
+
};
|
|
107
|
+
type SCIMAttributeMapping = {
|
|
108
|
+
/** TailorDB field name to map to */tailorDBField: string; /** SCIM attribute path */
|
|
109
|
+
scimPath: string;
|
|
110
|
+
};
|
|
111
|
+
type SCIMResource = {
|
|
112
|
+
/** SCIM resource name */name: string; /** TailorDB namespace for the resource */
|
|
113
|
+
tailorDBNamespace: string; /** TailorDB type name for the resource */
|
|
114
|
+
tailorDBType: string; /** Core SCIM schema definition */
|
|
115
|
+
coreSchema: {
|
|
116
|
+
/** SCIM resource name */name: string;
|
|
117
|
+
attributes: {
|
|
118
|
+
type: "string" | "number" | "boolean" | "datetime" | "complex"; /** SCIM resource name */
|
|
119
|
+
name: string;
|
|
120
|
+
description?: string | undefined;
|
|
121
|
+
mutability?: "readOnly" | "readWrite" | "writeOnly" | undefined;
|
|
122
|
+
required?: boolean | undefined;
|
|
123
|
+
multiValued?: boolean | undefined;
|
|
124
|
+
uniqueness?: "none" | "server" | "global" | undefined;
|
|
125
|
+
canonicalValues?: string[] | null | undefined;
|
|
126
|
+
subAttributes?: any[] | null | undefined;
|
|
127
|
+
}[];
|
|
128
|
+
}; /** Attribute mapping configuration */
|
|
129
|
+
attributeMapping: {
|
|
130
|
+
tailorDBField: string;
|
|
131
|
+
scimPath: string;
|
|
132
|
+
}[];
|
|
133
|
+
};
|
|
134
|
+
type SCIMConfig = {
|
|
135
|
+
/** Machine user name for SCIM operations */machineUserName: string; /** SCIM authorization configuration */
|
|
136
|
+
authorization: {
|
|
137
|
+
type: "oauth2" | "bearer";
|
|
138
|
+
bearerSecret?: {
|
|
139
|
+
vaultName: string;
|
|
140
|
+
secretKey: string;
|
|
141
|
+
} | undefined;
|
|
142
|
+
}; /** SCIM resource definitions */
|
|
143
|
+
resources: {
|
|
144
|
+
name: string;
|
|
145
|
+
tailorDBNamespace: string;
|
|
146
|
+
tailorDBType: string;
|
|
147
|
+
coreSchema: {
|
|
148
|
+
name: string;
|
|
149
|
+
attributes: {
|
|
150
|
+
type: "string" | "number" | "boolean" | "datetime" | "complex";
|
|
151
|
+
name: string;
|
|
152
|
+
description?: string | undefined;
|
|
153
|
+
mutability?: "readOnly" | "readWrite" | "writeOnly" | undefined;
|
|
154
|
+
required?: boolean | undefined;
|
|
155
|
+
multiValued?: boolean | undefined;
|
|
156
|
+
uniqueness?: "none" | "server" | "global" | undefined;
|
|
157
|
+
canonicalValues?: string[] | null | undefined;
|
|
158
|
+
subAttributes?: any[] | null | undefined;
|
|
159
|
+
}[];
|
|
160
|
+
};
|
|
161
|
+
attributeMapping: {
|
|
162
|
+
tailorDBField: string;
|
|
163
|
+
scimPath: string;
|
|
164
|
+
}[];
|
|
165
|
+
}[];
|
|
166
|
+
};
|
|
167
|
+
type TenantProvider = {
|
|
168
|
+
/** TailorDB namespace for the tenant type */namespace: string; /** TailorDB type name for tenants */
|
|
169
|
+
type: string; /** Field used as the tenant signature */
|
|
170
|
+
signatureField: string;
|
|
171
|
+
};
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/configure/services/auth/types.d.ts
|
|
174
|
+
type OAuth2ClientGrantType = OAuth2Client["grantTypes"][number];
|
|
175
|
+
type SCIMAttributeType = SCIMAttribute["type"];
|
|
176
|
+
type AuthInvokerWithName<M extends string> = Omit<AuthInvoker, "machineUserName"> & {
|
|
177
|
+
machineUserName: M;
|
|
178
|
+
};
|
|
179
|
+
/** Result of retrieving a connection token at runtime. */
|
|
180
|
+
type AuthConnectionTokenResult = {
|
|
181
|
+
access_token: string;
|
|
182
|
+
};
|
|
183
|
+
type ValueOperand = string | boolean | string[] | boolean[];
|
|
184
|
+
type AuthAttributeValue = ValueOperand | null | undefined;
|
|
185
|
+
type UserFieldKeys<User extends TailorDBInstance> = keyof output<User> & string;
|
|
186
|
+
type FieldDefined<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = User["fields"][Key] extends {
|
|
187
|
+
_defined: infer Defined;
|
|
188
|
+
} ? Defined : never;
|
|
189
|
+
type FieldOutput<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = output<User>[Key];
|
|
190
|
+
type FieldIsRequired<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = undefined extends FieldOutput<User, Key> ? false : true;
|
|
191
|
+
type FieldIsOfType<User extends TailorDBInstance, Key extends UserFieldKeys<User>, Type extends string> = FieldDefined<User, Key> extends {
|
|
192
|
+
type: Type;
|
|
193
|
+
} ? true : false;
|
|
194
|
+
type FieldIsArray<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldDefined<User, Key> extends {
|
|
195
|
+
array: true;
|
|
196
|
+
} ? true : false;
|
|
197
|
+
type FieldIsUnique<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldDefined<User, Key> extends {
|
|
198
|
+
unique: true;
|
|
199
|
+
} ? true : false;
|
|
200
|
+
type FieldSupportsValueOperand<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldOutput<User, Key> extends ValueOperand | null | undefined ? true : false;
|
|
201
|
+
type UsernameFieldKey<User extends TailorDBInstance> = IsAny<User> extends true ? string : { [K in UserFieldKeys<User>]: FieldIsRequired<User, K> extends true ? FieldIsOfType<User, K, "string"> extends true ? FieldIsArray<User, K> extends true ? never : FieldIsUnique<User, K> extends true ? K : never : never : never }[UserFieldKeys<User>];
|
|
202
|
+
type UserAttributeKey<User extends TailorDBInstance> = { [K in UserFieldKeys<User>]: K extends "id" ? never : FieldSupportsValueOperand<User, K> extends true ? FieldIsOfType<User, K, "datetime" | "date" | "time"> extends true ? never : K : never }[UserFieldKeys<User>];
|
|
203
|
+
type UserAttributeListKey<User extends TailorDBInstance> = { [K in UserFieldKeys<User>]: K extends "id" ? never : FieldIsOfType<User, K, "uuid"> extends true ? FieldIsArray<User, K> extends true ? never : K : never }[UserFieldKeys<User>];
|
|
204
|
+
type UserAttributeMap<User extends TailorDBInstance> = { [K in UserAttributeKey<User>]?: true };
|
|
205
|
+
type DisallowExtraKeys<T, Allowed extends PropertyKey> = T & { [K in Exclude<keyof T, Allowed>]: never };
|
|
206
|
+
type AttributeListValue<User extends TailorDBInstance, Key extends UserAttributeListKey<User>> = Key extends keyof output<User> ? output<User>[Key] : never;
|
|
207
|
+
type AttributeListToTuple<User extends TailorDBInstance, AttributeList extends readonly UserAttributeListKey<User>[]> = { [Index in keyof AttributeList]: AttributeList[Index] extends UserAttributeListKey<User> ? AttributeListValue<User, AttributeList[Index]> : never };
|
|
208
|
+
type AttributeMapSelectedKeys<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>> = Extract<{ [K in keyof AttributeMap]-?: undefined extends AttributeMap[K] ? never : K }[keyof AttributeMap], UserAttributeKey<User>>;
|
|
209
|
+
type UserProfile<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[]> = {
|
|
210
|
+
/**
|
|
211
|
+
* TailorDB namespace where the user type is defined.
|
|
212
|
+
*
|
|
213
|
+
* Usually auto-resolved, so you don't need to specify this.
|
|
214
|
+
* Required only when multiple TailorDBs exist and the type is in an external TailorDB.
|
|
215
|
+
*/
|
|
216
|
+
namespace?: string;
|
|
217
|
+
type: User;
|
|
218
|
+
usernameField: UsernameFieldKey<User>;
|
|
219
|
+
attributes?: DisallowExtraKeys<AttributeMap, UserAttributeKey<User>>;
|
|
220
|
+
attributeList?: AttributeList;
|
|
221
|
+
};
|
|
222
|
+
type MachineUserAttributeFields = Record<string, TailorField<DefinedFieldMetadata, unknown, FieldMetadata, TailorFieldType>>;
|
|
223
|
+
type TailorFieldOutputValue<Field> = Field extends TailorField<DefinedFieldMetadata, infer Output, FieldMetadata, TailorFieldType> ? Output : never;
|
|
224
|
+
type MachineUserAttributeValues<Fields extends MachineUserAttributeFields> = { [K in keyof Fields]: TailorFieldOutputValue<Fields[K]> extends ValueOperand | null | undefined ? TailorFieldOutputValue<Fields[K]> : never };
|
|
225
|
+
type MachineUserFromAttributes<Fields extends MachineUserAttributeFields> = (keyof Fields extends never ? {
|
|
226
|
+
attributes?: never;
|
|
227
|
+
} : {
|
|
228
|
+
attributes: DisallowExtraKeys<MachineUserAttributeValues<Fields>, keyof Fields>;
|
|
229
|
+
}) & {
|
|
230
|
+
attributeList?: string[];
|
|
231
|
+
};
|
|
232
|
+
type MachineUser<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User> = UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[] = [], MachineUserAttributes extends MachineUserAttributeFields | undefined = undefined> = IsAny<MachineUserAttributes> extends true ? IsAny<User> extends true ? {
|
|
233
|
+
attributes: Record<string, AuthAttributeValue>;
|
|
234
|
+
attributeList?: string[];
|
|
235
|
+
} : (AttributeMapSelectedKeys<User, AttributeMap> extends never ? {
|
|
236
|
+
attributes?: never;
|
|
237
|
+
} : {
|
|
238
|
+
attributes: { [K in AttributeMapSelectedKeys<User, AttributeMap>]: K extends keyof output<User> ? output<User>[K] : never } & { [K in Exclude<keyof output<User>, AttributeMapSelectedKeys<User, AttributeMap>>]?: never };
|
|
239
|
+
}) & ([] extends AttributeList ? {
|
|
240
|
+
attributeList?: never;
|
|
241
|
+
} : {
|
|
242
|
+
attributeList: AttributeListToTuple<User, AttributeList>;
|
|
243
|
+
}) : [MachineUserAttributes] extends [MachineUserAttributeFields] ? MachineUserFromAttributes<MachineUserAttributes> : IsAny<User> extends true ? {
|
|
244
|
+
attributes: Record<string, AuthAttributeValue>;
|
|
245
|
+
attributeList?: string[];
|
|
246
|
+
} : (AttributeMapSelectedKeys<User, AttributeMap> extends never ? {
|
|
247
|
+
attributes?: never;
|
|
248
|
+
} : {
|
|
249
|
+
attributes: { [K in AttributeMapSelectedKeys<User, AttributeMap>]: K extends keyof output<User> ? output<User>[K] : never } & { [K in Exclude<keyof output<User>, AttributeMapSelectedKeys<User, AttributeMap>>]?: never };
|
|
250
|
+
}) & ([] extends AttributeList ? {
|
|
251
|
+
attributeList?: never;
|
|
252
|
+
} : {
|
|
253
|
+
attributeList: AttributeListToTuple<User, AttributeList>;
|
|
254
|
+
});
|
|
255
|
+
/** Upstream OAuth provider that federated a login through the Built-in IdP. */
|
|
256
|
+
type FederatedIdentityProvider = "google" | "microsoft";
|
|
257
|
+
/**
|
|
258
|
+
* Profile claims forwarded from the upstream OAuth provider's ID token.
|
|
259
|
+
*
|
|
260
|
+
* Commonly present claims are typed; any other claim the provider issues is
|
|
261
|
+
* forwarded as-is and reachable through the index signature. Availability
|
|
262
|
+
* varies by provider (e.g. Microsoft does not issue `picture`).
|
|
263
|
+
*/
|
|
264
|
+
type FederatedIdentityClaims = {
|
|
265
|
+
name?: string;
|
|
266
|
+
given_name?: string;
|
|
267
|
+
family_name?: string;
|
|
268
|
+
picture?: string;
|
|
269
|
+
locale?: string;
|
|
270
|
+
[claim: string]: JsonValue | undefined;
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* The upstream identity that federated this login, populated when a user signs
|
|
274
|
+
* in through a Built-in IdP OAuth provider (Google or Microsoft).
|
|
275
|
+
*
|
|
276
|
+
* Available on {@link BeforeLoginClaims.federated_identity}; `undefined` for
|
|
277
|
+
* password logins.
|
|
278
|
+
*/
|
|
279
|
+
type FederatedIdentity = {
|
|
280
|
+
provider: FederatedIdentityProvider;
|
|
281
|
+
claims: FederatedIdentityClaims;
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* Token claims passed to the {@link BeforeLoginHook} handler. Carries the IdP's
|
|
285
|
+
* own claims (e.g. `sub`, `email`) plus, for federated logins, the upstream
|
|
286
|
+
* provider's profile under {@link BeforeLoginClaims.federated_identity}.
|
|
287
|
+
*/
|
|
288
|
+
type BeforeLoginClaims = JsonObject & {
|
|
289
|
+
/** Present only for federated (Google/Microsoft) logins; `undefined` for password logins. */federated_identity?: FederatedIdentity;
|
|
290
|
+
};
|
|
291
|
+
type BeforeLoginHookArgs = {
|
|
292
|
+
claims: BeforeLoginClaims;
|
|
293
|
+
idpConfigName: string; /** Environment variables defined in `defineConfig({ env })`. */
|
|
294
|
+
env: TailorEnv;
|
|
295
|
+
};
|
|
296
|
+
type BeforeLoginHook<MachineUserNames extends string> = {
|
|
297
|
+
handler(args: BeforeLoginHookArgs): Promise<void>;
|
|
298
|
+
invoker: NoInfer<MachineUserNames>;
|
|
299
|
+
};
|
|
300
|
+
type AuthHooks<MachineUserNames extends string> = {
|
|
301
|
+
beforeLogin?: BeforeLoginHook<MachineUserNames>;
|
|
302
|
+
};
|
|
303
|
+
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> = {
|
|
304
|
+
hooks?: AuthHooks<MachineUserNames>;
|
|
305
|
+
userProfile?: UserProfile<User, AttributeMap, AttributeList>;
|
|
306
|
+
machineUserAttributes?: MachineUserAttributes;
|
|
307
|
+
machineUsers?: Record<MachineUserNames, MachineUser<User, AttributeMap, AttributeList, MachineUserAttributes>>;
|
|
308
|
+
oauth2Clients?: Record<string, OAuth2ClientInput>;
|
|
309
|
+
idProvider?: IdProvider;
|
|
310
|
+
scim?: SCIMConfig;
|
|
311
|
+
tenantProvider?: TenantProvider;
|
|
312
|
+
connections?: Record<ConnectionNames, AuthConnectionConfig>;
|
|
313
|
+
publishSessionEvents?: boolean;
|
|
314
|
+
};
|
|
315
|
+
declare const authDefinitionBrand: unique symbol;
|
|
316
|
+
type AuthDefinitionBrand = {
|
|
317
|
+
readonly [authDefinitionBrand]: true;
|
|
318
|
+
};
|
|
319
|
+
type ConnectionNames<Config> = Config extends {
|
|
320
|
+
connections?: Record<infer K, unknown>;
|
|
321
|
+
} ? K & string : string;
|
|
322
|
+
type DefinedAuth<Name extends string, Config, MachineUserNames extends string> = Config & {
|
|
323
|
+
name: Name;
|
|
324
|
+
/**
|
|
325
|
+
* @deprecated Pass the machine user name directly as a string instead, e.g. `authInvoker: "machine-user-name"`.
|
|
326
|
+
* Using this function pulls config-layer (Node-only) dependencies into runtime bundles.
|
|
327
|
+
*/
|
|
328
|
+
invoker<M extends MachineUserNames>(machineUser: M): AuthInvokerWithName<M>;
|
|
329
|
+
/**
|
|
330
|
+
* @deprecated Use `authconnection.getConnectionToken(...)` from `@tailor-platform/sdk/runtime` instead.
|
|
331
|
+
* Importing `auth` from `tailor.config.ts` into runtime files pulls config-layer (Node-only)
|
|
332
|
+
* dependencies into the bundle.
|
|
333
|
+
*/
|
|
334
|
+
getConnectionToken<C extends ConnectionNames<Config>>(connectionName: C): Promise<AuthConnectionTokenResult>;
|
|
335
|
+
} & AuthDefinitionBrand;
|
|
336
|
+
type AuthExternalConfig = {
|
|
337
|
+
name: string;
|
|
338
|
+
external: true;
|
|
339
|
+
};
|
|
340
|
+
type AuthServiceInputLoose = AuthServiceInput<any, any, any, string, any>;
|
|
341
|
+
type AuthOwnConfig = DefinedAuth<string, AuthServiceInputLoose, string>;
|
|
342
|
+
type AuthConfig = AuthOwnConfig | AuthExternalConfig;
|
|
343
|
+
//#endregion
|
|
344
|
+
export { SCIMConfig as A, OAuth2Client as C, SCIMAttribute as D, SAML as E, TenantProvider as M, AuthConnectionConfig as N, SCIMAttributeMapping as O, AuthConnectionOAuth2Config as P, IdProvider as S, OIDC as T, UsernameFieldKey as _, AuthServiceInput as a, BuiltinIdP as b, DefinedAuth as c, FederatedIdentityProvider as d, OAuth2ClientGrantType as f, UserAttributeMap as g, UserAttributeListKey as h, AuthOwnConfig as i, SCIMResource as j, SCIMAuthorization as k, FederatedIdentity as l, UserAttributeKey as m, AuthConnectionTokenResult as n, BeforeLoginClaims as o, SCIMAttributeType as p, AuthExternalConfig as r, BeforeLoginHookArgs as s, AuthConfig as t, FederatedIdentityClaims as u, ValueOperand as v, OAuth2ClientInput as w, IDToken as x, AuthInvoker as y };
|
|
345
|
+
//# sourceMappingURL=types-v_ErzNUF.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { s as TailorInvoker } from "../../types-DTcZ2Yax.mjs";
|
|
2
|
-
import { j as TailorDBType } from "../../workflow.generated-
|
|
3
|
-
import { Et as WORKFLOW_TEST_ENV_KEY,
|
|
2
|
+
import { j as TailorDBType } from "../../workflow.generated-Da1zECDw.mjs";
|
|
3
|
+
import { Et as WORKFLOW_TEST_ENV_KEY, Rt as TailorField, n as output } from "../../index-BzGqTY5x.mjs";
|
|
4
4
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/test/mock.d.ts
|
package/dist/vitest/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { o as TailorEnv } from "../types-DTcZ2Yax.mjs";
|
|
2
2
|
import { Kysely, OperationNode, OperationNodeKind, Transaction } from "kysely";
|
|
3
3
|
import { Mock } from "vitest";
|
|
4
|
+
import { AuthConnectionTokenResult, ConnectionName } from "@tailor-platform/sdk";
|
|
4
5
|
import { Plugin } from "vitest/config";
|
|
5
6
|
|
|
6
7
|
//#region src/vitest/mock.d.ts
|
|
@@ -41,7 +42,7 @@ interface SecretCall {
|
|
|
41
42
|
names?: readonly string[];
|
|
42
43
|
}
|
|
43
44
|
interface AuthConnectionCall {
|
|
44
|
-
connectionName:
|
|
45
|
+
connectionName: ConnectionName;
|
|
45
46
|
}
|
|
46
47
|
interface IdpCall {
|
|
47
48
|
method: string;
|
|
@@ -241,8 +242,8 @@ declare function mockSecretmanager(): {
|
|
|
241
242
|
* ```
|
|
242
243
|
*/
|
|
243
244
|
declare function mockAuthconnection(): {
|
|
244
|
-
/** The `getConnectionToken` `vi.fn`. */getConnectionToken: Mock<(connectionName:
|
|
245
|
-
setTokens(value: Record<
|
|
245
|
+
/** The `getConnectionToken` `vi.fn`. */getConnectionToken: Mock<(connectionName: ConnectionName) => Promise<AuthConnectionTokenResult>>;
|
|
246
|
+
setTokens(value: Partial<Record<ConnectionName, AuthConnectionTokenResult>>): void;
|
|
246
247
|
readonly calls: AuthConnectionCall[];
|
|
247
248
|
reset(): void;
|
|
248
249
|
} & Disposable;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { c as TailorUser, i as InferredAttributeMap } from "./types-DTcZ2Yax.mjs";
|
|
2
2
|
import { A as Validators, E as FieldValidateInput, F as output, O as TailorFieldType, P as TypeLevelError, S as EnumValue, T as FieldOutput, a as Hooks, g as TailorDBType$1, h as TailorDBServiceInput, i as Hook, j as InferFieldsOutput, k as TailorToTs, l as RelationType, n as DefinedDBFieldMetadata, o as IndexDef, p as TailorDBField$1, r as ExcludeNestedDBFields, t as DBFieldMetadata, u as SerialConfig, v as TypeFeatures, w as FieldOptions } from "./types-rj8YJcEe.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { b as BuiltinIdP, t as AuthConfig } from "./types-v_ErzNUF.mjs";
|
|
4
|
+
import { o as PluginConfigs } from "./types-aqnqTCfO.mjs";
|
|
4
5
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
5
6
|
|
|
6
7
|
//#region src/configure/types/field.d.ts
|
|
@@ -1344,4 +1345,4 @@ type ConcurrencyPolicy = {
|
|
|
1344
1345
|
};
|
|
1345
1346
|
//#endregion
|
|
1346
1347
|
export { TailorDBInstance as A, IdPInput as C, TailorAnyDBField as D, AIGatewayInput as E, TailorTypePermission as F, unsafeAllowAllGqlPermission as I, unsafeAllowAllTypePermission as L, db as M, PermissionCondition as N, TailorAnyDBType as O, TailorTypeGqlPermission as P, AllowedValues as R, IdPGqlOperationsInput as S, AIGatewayDefinitionBrand as T, IdPConfig as _, ExecutorServiceConfig as a, IdPEmailConfig as b, ResolverServiceConfig as c, WorkflowServiceInput as d, StaticWebsiteConfig as f, SecretsDefinitionBrand as g, SecretsConfig as h, AppConfig as i, TailorDBType as j, TailorDBField as k, ResolverServiceInput as l, StaticWebsiteInput as m, RetryPolicy as n, ExecutorServiceInput as o, StaticWebsiteDefinitionBrand as p, HttpAdapterConfigInput as r, ResolverExternalConfig as s, ConcurrencyPolicy as t, WorkflowServiceConfig as u, IdPExternalConfig as v, AIGatewayConfig as w, IdPGqlOperations as x, IdpDefinitionBrand as y, AllowedValuesOutput as z };
|
|
1347
|
-
//# sourceMappingURL=workflow.generated-
|
|
1348
|
+
//# sourceMappingURL=workflow.generated-Da1zECDw.d.mts.map
|
package/docs/cli/setup.md
CHANGED
|
@@ -4,36 +4,70 @@ Commands for setting up project infrastructure.
|
|
|
4
4
|
|
|
5
5
|
## setup
|
|
6
6
|
|
|
7
|
-
Generate
|
|
7
|
+
Generate CI deploy workflows for your project. (beta)
|
|
8
8
|
|
|
9
9
|
**Usage**
|
|
10
10
|
|
|
11
11
|
```
|
|
12
|
-
tailor-sdk setup
|
|
12
|
+
tailor-sdk setup <command>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
16
|
+
|
|
17
|
+
**Commands**
|
|
18
|
+
|
|
19
|
+
| Command | Description |
|
|
20
|
+
| --------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
21
|
+
| [`setup branch`](#setup-branch) | Generate a branch-target deploy workflow (push to branch triggers deploy). |
|
|
22
|
+
| [`setup tag`](#setup-tag) | Generate a tag-target deploy workflow (tag push triggers deploy). |
|
|
23
|
+
| [`setup preview`](#setup-preview) | Generate a preview workflow (PR open/sync triggers deploy to a per-PR workspace). |
|
|
24
|
+
| [`setup action`](#setup-action) | Generate a per-app composite action for use with setup coordinate (monorepo multi-app deploys). |
|
|
25
|
+
| [`setup coordinate`](#setup-coordinate) | Generate a coordinator workflow that orchestrates multiple --action-generated composite actions. |
|
|
26
|
+
| [`setup check`](#setup-check) | Audit generated workflows for drift against the current config/repo (read-only). |
|
|
27
|
+
|
|
28
|
+
### setup action
|
|
29
|
+
|
|
30
|
+
Generate a per-app composite action for use with setup coordinate (monorepo multi-app deploys).
|
|
31
|
+
|
|
32
|
+
**Usage**
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
tailor-sdk setup action [options]
|
|
13
36
|
```
|
|
14
37
|
|
|
15
38
|
**Options**
|
|
16
39
|
|
|
17
|
-
| Option
|
|
18
|
-
|
|
|
19
|
-
| `--
|
|
20
|
-
| `--
|
|
21
|
-
| `--
|
|
22
|
-
| `--
|
|
23
|
-
| `--tag-pattern <TAG_PATTERN>` | - | Tag glob to match (requires --tag; defaults to v\*) | No | - |
|
|
24
|
-
| `--environment <ENVIRONMENT>` | - | GitHub Environment for the plan/deploy jobs (defaults to the workspace name) | No | - |
|
|
25
|
-
| `--no-plan` | - | Disable the plan job for a branch target (cannot be combined with --tag) | No | `false` |
|
|
26
|
-
| `--erd-preview` | - | Add PR ERD viewer artifacts with current/diff previews for TailorDB namespaces | No | `false` |
|
|
27
|
-
| `--dir <DIR>` | `-d` | App directory (for monorepo setups) | No | `"."` |
|
|
28
|
-
| `--force` | - | Discard hand edits / take over unmanaged files and regenerate | No | `false` |
|
|
40
|
+
| Option | Alias | Description | Required | Default |
|
|
41
|
+
| ----------------------------- | ----- | --------------------------------------------------- | -------- | ------- |
|
|
42
|
+
| `--name <NAME>` | `-n` | Name (defaults to the config 'name') | No | - |
|
|
43
|
+
| `--dir <DIR>` | `-d` | App directory | No | `"."` |
|
|
44
|
+
| `--environment <ENVIRONMENT>` | - | GitHub Environment (defaults to the workspace name) | No | - |
|
|
45
|
+
| `--force` | - | Discard hand edits and regenerate | No | `false` |
|
|
29
46
|
|
|
30
47
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
31
48
|
|
|
32
|
-
|
|
49
|
+
### setup branch
|
|
50
|
+
|
|
51
|
+
Generate a branch-target deploy workflow (push to branch triggers deploy).
|
|
33
52
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
53
|
+
**Usage**
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
tailor-sdk setup branch [options]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Options**
|
|
60
|
+
|
|
61
|
+
| Option | Alias | Description | Required | Default |
|
|
62
|
+
| ----------------------------- | ----- | ------------------------------------------------------------------------------ | -------- | ------- |
|
|
63
|
+
| `--name <NAME>` | `-n` | Name (defaults to the config 'name') | No | - |
|
|
64
|
+
| `--branch <BRANCH>` | - | Deploy trigger branch (defaults to the detected default branch) | No | - |
|
|
65
|
+
| `--environment <ENVIRONMENT>` | - | GitHub Environment for the plan/deploy jobs (defaults to the workspace name) | No | - |
|
|
66
|
+
| `--erd-preview` | - | Add PR ERD viewer artifacts with current/diff previews for TailorDB namespaces | No | `false` |
|
|
67
|
+
| `--dir <DIR>` | `-d` | App directory (for monorepo setups) | No | `"."` |
|
|
68
|
+
| `--force` | - | Discard hand edits / take over unmanaged files and regenerate | No | `false` |
|
|
69
|
+
|
|
70
|
+
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
37
71
|
|
|
38
72
|
### setup check
|
|
39
73
|
|
|
@@ -42,9 +76,85 @@ Audit generated workflows for drift against the current config/repo (read-only).
|
|
|
42
76
|
**Usage**
|
|
43
77
|
|
|
44
78
|
```
|
|
45
|
-
tailor-sdk setup check
|
|
79
|
+
tailor-sdk setup check [options]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Options**
|
|
83
|
+
|
|
84
|
+
| Option | Alias | Description | Required | Default |
|
|
85
|
+
| ------ | ----- | ------------------------------------------------------------------------------------------------ | -------- | ------- |
|
|
86
|
+
| `--ci` | - | Run in CI mode: skip checks that are handled by the runtime (e.g. TAILOR_PLATFORM_WORKSPACE_ID). | No | `false` |
|
|
87
|
+
|
|
88
|
+
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
89
|
+
|
|
90
|
+
### setup coordinate
|
|
91
|
+
|
|
92
|
+
Generate a coordinator workflow that orchestrates multiple --action-generated composite actions.
|
|
93
|
+
|
|
94
|
+
**Usage**
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
tailor-sdk setup coordinate [options]
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Options**
|
|
101
|
+
|
|
102
|
+
| Option | Alias | Description | Required | Default |
|
|
103
|
+
| ----------------------------- | ----- | --------------------------------------------------------------------------------------- | -------- | ------- |
|
|
104
|
+
| `--name <NAME>` | `-n` | Coordinator name (used in the generated workflow file name and job names) | Yes | - |
|
|
105
|
+
| `--action <ACTION>` | - | Composite action to include (can be specified multiple times). tailor- prefix optional. | Yes | - |
|
|
106
|
+
| `--branch <BRANCH>` | - | Branch target: deploy trigger branch (defaults to the detected default branch) | No | - |
|
|
107
|
+
| `--tag` | - | Generate a tag target coordinator | No | `false` |
|
|
108
|
+
| `--environment <ENVIRONMENT>` | - | GitHub Environment for the plan/deploy jobs | No | - |
|
|
109
|
+
| `--force` | - | Discard hand edits and regenerate | No | `false` |
|
|
110
|
+
|
|
111
|
+
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
112
|
+
|
|
113
|
+
### setup preview
|
|
114
|
+
|
|
115
|
+
Generate a preview workflow (PR open/sync triggers deploy to a per-PR workspace).
|
|
116
|
+
|
|
117
|
+
**Usage**
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
tailor-sdk setup preview [options]
|
|
46
121
|
```
|
|
47
122
|
|
|
123
|
+
**Options**
|
|
124
|
+
|
|
125
|
+
| Option | Alias | Description | Required | Default |
|
|
126
|
+
| ----------------------------- | ----- | ------------------------------------------------------------------------- | -------- | ------- |
|
|
127
|
+
| `--name <NAME>` | `-n` | Name (defaults to the config 'name') | No | - |
|
|
128
|
+
| `--branch <BRANCH>` | - | Branch to filter PRs by (defaults to the detected default branch) | No | - |
|
|
129
|
+
| `--region <REGION>` | - | Workspace region for preview workspace creation (e.g. us-west). Required. | Yes | - |
|
|
130
|
+
| `--require-preview-label` | - | Deploy preview only for PRs labeled `tailor:preview` instead of all PRs. | No | `false` |
|
|
131
|
+
| `--environment <ENVIRONMENT>` | - | GitHub Environment for the preview jobs (defaults to the workspace name) | No | - |
|
|
132
|
+
| `--dir <DIR>` | `-d` | App directory (for monorepo setups) | No | `"."` |
|
|
133
|
+
| `--force` | - | Discard hand edits / take over unmanaged files and regenerate | No | `false` |
|
|
134
|
+
|
|
135
|
+
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
136
|
+
|
|
137
|
+
### setup tag
|
|
138
|
+
|
|
139
|
+
Generate a tag-target deploy workflow (tag push triggers deploy).
|
|
140
|
+
|
|
141
|
+
**Usage**
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
tailor-sdk setup tag [options]
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Options**
|
|
148
|
+
|
|
149
|
+
| Option | Alias | Description | Required | Default |
|
|
150
|
+
| ----------------------------- | ----- | ---------------------------------------------------------------------------- | -------- | ------- |
|
|
151
|
+
| `--name <NAME>` | `-n` | Name (defaults to the config 'name') | No | - |
|
|
152
|
+
| `--tag-pattern <TAG_PATTERN>` | - | Tag glob to match (defaults to v\*) | No | `"v*"` |
|
|
153
|
+
| `--branch <BRANCH>` | - | Tag-reachability guard branch (no guard when omitted) | No | - |
|
|
154
|
+
| `--environment <ENVIRONMENT>` | - | GitHub Environment for the plan/deploy jobs (defaults to the workspace name) | No | - |
|
|
155
|
+
| `--dir <DIR>` | `-d` | App directory (for monorepo setups) | No | `"."` |
|
|
156
|
+
| `--force` | - | Discard hand edits / take over unmanaged files and regenerate | No | `false` |
|
|
157
|
+
|
|
48
158
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
49
159
|
|
|
50
160
|
## Further reading
|
package/docs/cli-reference.md
CHANGED
|
@@ -313,10 +313,15 @@ Commands for managing crash reports.
|
|
|
313
313
|
|
|
314
314
|
Commands for setting up project infrastructure.
|
|
315
315
|
|
|
316
|
-
| Command
|
|
317
|
-
|
|
|
318
|
-
| [setup](./cli/setup.md#setup)
|
|
319
|
-
| [setup
|
|
316
|
+
| Command | Description |
|
|
317
|
+
| --------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
318
|
+
| [setup](./cli/setup.md#setup) | Generate CI deploy workflows for your project. (beta) |
|
|
319
|
+
| [setup action](./cli/setup.md#setup-action) | Generate a per-app composite action for use with setup coordinate (monorepo multi-app deploys). |
|
|
320
|
+
| [setup branch](./cli/setup.md#setup-branch) | Generate a branch-target deploy workflow (push to branch triggers deploy). |
|
|
321
|
+
| [setup check](./cli/setup.md#setup-check) | Audit generated workflows for drift against the current config/repo (read-only). |
|
|
322
|
+
| [setup coordinate](./cli/setup.md#setup-coordinate) | Generate a coordinator workflow that orchestrates multiple --action-generated composite actions. |
|
|
323
|
+
| [setup preview](./cli/setup.md#setup-preview) | Generate a preview workflow (PR open/sync triggers deploy to a per-PR workspace). |
|
|
324
|
+
| [setup tag](./cli/setup.md#setup-tag) | Generate a tag-target deploy workflow (tag push triggers deploy). |
|
|
320
325
|
|
|
321
326
|
### [Upgrade Commands](./cli/upgrade.md)
|
|
322
327
|
|