@tailor-platform/sdk 1.63.0 → 1.65.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/{actor-J2gJ0eK5.d.mts → actor-D_2aJjYO.d.mts} +2 -2
  3. package/dist/{application-BezXGbrU.mjs → application-76hhIhnJ.mjs} +42 -5
  4. package/dist/application-76hhIhnJ.mjs.map +1 -0
  5. package/dist/application-av2raLs6.mjs +4 -0
  6. package/dist/cli/index.mjs +63 -19
  7. package/dist/cli/index.mjs.map +1 -1
  8. package/dist/cli/lib.d.mts +24 -31
  9. package/dist/cli/lib.mjs +2 -2
  10. package/dist/configure/index.d.mts +5 -5
  11. package/dist/configure/index.mjs.map +1 -1
  12. package/dist/{index-CfRFkXIO.d.mts → index-Bhjep8cS.d.mts} +2 -2
  13. package/dist/{index-DUupuPhZ.d.mts → index-CZ2r3qiO.d.mts} +2 -2
  14. package/dist/{index-CPRnOjjt.d.mts → index-Db2RvnEH.d.mts} +2 -2
  15. package/dist/{index-CLxubakC.d.mts → index-DcXIjt9F.d.mts} +5 -5
  16. package/dist/{index-CQZVJ5SX.d.mts → index-QpC0TNbH.d.mts} +2 -2
  17. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  18. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  19. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  20. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  21. package/dist/plugin/index.d.mts +2 -2
  22. package/dist/{plugin-C_FyVSdl.d.mts → plugin-DylAsA4Z.d.mts} +2 -2
  23. package/dist/{runtime-CW3jcQCc.mjs → runtime-C7qTBDD2.mjs} +491 -96
  24. package/dist/runtime-C7qTBDD2.mjs.map +1 -0
  25. package/dist/{tailordb-BlBGmQK-.d.mts → tailordb-C-ar4XCX.d.mts} +4 -4
  26. package/dist/utils/test/index.d.mts +3 -3
  27. package/dist/{workflow.generated-Bf1tWylx.d.mts → workflow.generated-CCDsY0ce.d.mts} +42 -6
  28. package/docs/cli/auth.md +4 -4
  29. package/docs/cli/function.md +8 -8
  30. package/docs/cli/query.md +1 -1
  31. package/docs/cli/workflow.md +10 -10
  32. package/docs/cli/workspace.md +14 -10
  33. package/docs/cli-reference.md +1 -1
  34. package/docs/services/auth.md +19 -0
  35. package/docs/services/idp.md +96 -0
  36. package/docs/services/tailordb-migration.md +17 -6
  37. package/package.json +10 -10
  38. package/dist/application-BezXGbrU.mjs.map +0 -1
  39. package/dist/application-DSXntqnV.mjs +0 -4
  40. package/dist/runtime-CW3jcQCc.mjs.map +0 -1
@@ -11,8 +11,8 @@ type InferFieldsOutput<F extends Record<string, {
11
11
  _output: any;
12
12
  [key: string]: any;
13
13
  }>> = DeepWritable<Prettify<NullableToOptional<{ [K in keyof F]: output<F[K]> }>>>;
14
- type JsonValue = string | number | boolean | null | JsonValue[] | {
15
- [key: string]: JsonValue;
14
+ type JsonValue$1 = string | number | boolean | null | JsonValue$1[] | {
15
+ [key: string]: JsonValue$1;
16
16
  };
17
17
  /**
18
18
  * A looser version of JsonValue that accepts interfaces.
@@ -859,5 +859,5 @@ interface TailorDBType {
859
859
  files?: TailorDBTypeMetadata["files"];
860
860
  }
861
861
  //#endregion
862
- export { InferredAttributeList as A, FieldOutput as C, Validators as D, FieldValidateInput as E, InferFieldsOutput as F, JsonCompatible as I, JsonValue as L, TailorInvoker as M, TailorUser as N, AttributeList as O, unauthenticatedTailorUser as P, Prettify as R, FieldOptions as S, TailorToTs as T, PluginAttachment as _, TypeSourceInfoEntry as a, EnumValue as b, TailorAnyDBType as c, TailorDBType$1 as d, DBFieldMetadata as f, TailorField as g, SerialConfig as h, TailorDBType as i, InferredAttributeMap as j, AttributeMap as k, TailorDBField as l, GqlOperationsConfig as m, RelationType as n, ValueOperand as o, DefinedDBFieldMetadata as p, TailorDBServiceInput as r, TailorAnyDBField as s, IndexDef as t, TailorDBInstance as u, ArrayFieldOutput as v, TailorFieldType as w, FieldMetadata as x, DefinedFieldMetadata as y, output as z };
863
- //# sourceMappingURL=tailordb-BlBGmQK-.d.mts.map
862
+ export { InferredAttributeList as A, FieldOutput as C, Validators as D, FieldValidateInput as E, InferFieldsOutput as F, JsonCompatible as I, JsonValue$1 as L, TailorInvoker as M, TailorUser as N, AttributeList as O, unauthenticatedTailorUser as P, Prettify as R, FieldOptions as S, TailorToTs as T, PluginAttachment as _, TypeSourceInfoEntry as a, EnumValue as b, TailorAnyDBType as c, TailorDBType$1 as d, DBFieldMetadata as f, TailorField as g, SerialConfig as h, TailorDBType as i, InferredAttributeMap as j, AttributeMap as k, TailorDBField as l, GqlOperationsConfig as m, RelationType as n, ValueOperand as o, DefinedDBFieldMetadata as p, TailorDBServiceInput as r, TailorAnyDBField as s, IndexDef as t, TailorDBInstance as u, ArrayFieldOutput as v, TailorFieldType as w, FieldMetadata as x, DefinedFieldMetadata as y, output as z };
863
+ //# sourceMappingURL=tailordb-C-ar4XCX.d.mts.map
@@ -1,6 +1,6 @@
1
- import { M as TailorInvoker } from "../../tailordb-BlBGmQK-.mjs";
2
- import { W as TailorDBType } from "../../workflow.generated-Bf1tWylx.mjs";
3
- import { At as TailorField, Ct as WORKFLOW_TEST_ENV_KEY, n as output } from "../../index-CLxubakC.mjs";
1
+ import { M as TailorInvoker } from "../../tailordb-C-ar4XCX.mjs";
2
+ import { J as TailorDBType } from "../../workflow.generated-CCDsY0ce.mjs";
3
+ import { At as TailorField, Ct as WORKFLOW_TEST_ENV_KEY, n as output } from "../../index-DcXIjt9F.mjs";
4
4
  import { StandardSchemaV1 } from "@standard-schema/spec";
5
5
 
6
6
  //#region src/utils/test/mock.d.ts
@@ -1,7 +1,7 @@
1
- import { C as FieldOutput$1, D as Validators, E as FieldValidateInput, F as InferFieldsOutput, N as TailorUser, R as Prettify, S as FieldOptions, T as TailorToTs, b as EnumValue, d as TailorDBType$1, f as DBFieldMetadata, g as TailorField, h as SerialConfig, j as InferredAttributeMap, l as TailorDBField$1, m as GqlOperationsConfig, n as RelationType, o as ValueOperand, p as DefinedDBFieldMetadata, r as TailorDBServiceInput, s as TailorAnyDBField$1, t as IndexDef, u as TailorDBInstance$1, v as ArrayFieldOutput, w as TailorFieldType, x as FieldMetadata, y as DefinedFieldMetadata, z as output } from "./tailordb-BlBGmQK-.mjs";
2
- import { B as IdProvider, G as SCIMAttribute, H as OAuth2ClientInput, J as SCIMConfig, L as AuthInvoker, R as BuiltinIdP, V as OAuth2Client, X as TenantProvider, r as PluginConfigs } from "./plugin-C_FyVSdl.mjs";
1
+ import { C as FieldOutput$1, D as Validators, E as FieldValidateInput, F as InferFieldsOutput, N as TailorUser, R as Prettify, S as FieldOptions, T as TailorToTs, b as EnumValue, d as TailorDBType$1, f as DBFieldMetadata, g as TailorField, h as SerialConfig, j as InferredAttributeMap, l as TailorDBField$1, m as GqlOperationsConfig, n as RelationType, o as ValueOperand, p as DefinedDBFieldMetadata, r as TailorDBServiceInput, s as TailorAnyDBField$1, t as IndexDef, u as TailorDBInstance$1, v as ArrayFieldOutput, w as TailorFieldType, x as FieldMetadata, y as DefinedFieldMetadata, z as output } from "./tailordb-C-ar4XCX.mjs";
2
+ import { B as IdProvider, G as SCIMAttribute, H as OAuth2ClientInput, J as SCIMConfig, L as AuthInvoker, R as BuiltinIdP, V as OAuth2Client, X as TenantProvider, r as PluginConfigs } from "./plugin-DylAsA4Z.mjs";
3
3
  import { n as TailorEnv } from "./env-B-g-qgE4.mjs";
4
- import { IsAny, JsonObject, NonEmptyObject } from "type-fest";
4
+ import { IsAny, JsonObject, JsonValue, NonEmptyObject } from "type-fest";
5
5
  import { StandardSchemaV1 } from "@standard-schema/spec";
6
6
 
7
7
  //#region src/configure/types/field.d.ts
@@ -700,8 +700,44 @@ type MachineUser<User extends TailorDBInstance$1, AttributeMap extends UserAttri
700
700
  } : {
701
701
  attributeList: AttributeListToTuple<User, AttributeList>;
702
702
  });
703
+ /** Upstream OAuth provider that federated a login through the Built-in IdP. */
704
+ type FederatedIdentityProvider = "google" | "microsoft";
705
+ /**
706
+ * Profile claims forwarded from the upstream OAuth provider's ID token.
707
+ *
708
+ * Commonly present claims are typed; any other claim the provider issues is
709
+ * forwarded as-is and reachable through the index signature. Availability
710
+ * varies by provider (e.g. Microsoft does not issue `picture`).
711
+ */
712
+ type FederatedIdentityClaims = {
713
+ name?: string;
714
+ given_name?: string;
715
+ family_name?: string;
716
+ picture?: string;
717
+ locale?: string;
718
+ [claim: string]: JsonValue | undefined;
719
+ };
720
+ /**
721
+ * The upstream identity that federated this login, populated when a user signs
722
+ * in through a Built-in IdP OAuth provider (Google or Microsoft).
723
+ *
724
+ * Available on {@link BeforeLoginClaims.federated_identity}; `undefined` for
725
+ * password logins.
726
+ */
727
+ type FederatedIdentity = {
728
+ provider: FederatedIdentityProvider;
729
+ claims: FederatedIdentityClaims;
730
+ };
731
+ /**
732
+ * Token claims passed to the {@link BeforeLoginHook} handler. Carries the IdP's
733
+ * own claims (e.g. `sub`, `email`) plus, for federated logins, the upstream
734
+ * provider's profile under {@link BeforeLoginClaims.federated_identity}.
735
+ */
736
+ type BeforeLoginClaims = JsonObject & {
737
+ /** Present only for federated (Google/Microsoft) logins; `undefined` for password logins. */federated_identity?: FederatedIdentity;
738
+ };
703
739
  type BeforeLoginHookArgs = {
704
- claims: JsonObject;
740
+ claims: BeforeLoginClaims;
705
741
  idpConfigName: string; /** Environment variables defined in `defineConfig({ env })`. */
706
742
  env: TailorEnv;
707
743
  };
@@ -1412,5 +1448,5 @@ type ConcurrencyPolicy = {
1412
1448
  /** Maximum number of concurrent executions (1-1000) */maxConcurrentExecutions: number;
1413
1449
  };
1414
1450
  //#endregion
1415
- export { BeforeLoginHookArgs as A, TailorAnyDBField as B, IdPGqlOperationsInput as C, AuthExternalConfig as D, AuthConnectionTokenResult as E, UserAttributeListKey as F, db as G, TailorDBField as H, UserAttributeMap as I, TailorTypePermission as J, PermissionCondition as K, UsernameFieldKey as L, OAuth2ClientGrantType as M, SCIMAttributeType as N, AuthOwnConfig as O, UserAttributeKey as P, AllowedValuesOutput as Q, AuthConnectionConfig as R, IdPGqlOperations as S, AuthConfig as T, TailorDBInstance as U, TailorAnyDBType as V, TailorDBType as W, unsafeAllowAllTypePermission as X, unsafeAllowAllGqlPermission as Y, AllowedValues as Z, IdPConfig as _, ExecutorServiceConfig as a, IdpDefinitionBrand as b, ResolverServiceConfig as c, WorkflowServiceInput as d, StaticWebsiteConfig as f, SecretsDefinitionBrand as g, SecretsConfig as h, AppConfig as i, DefinedAuth as j, AuthServiceInput as k, ResolverServiceInput as l, StaticWebsiteInput as m, RetryPolicy as n, ExecutorServiceInput as o, StaticWebsiteDefinitionBrand as p, TailorTypeGqlPermission as q, HttpAdapterConfigInput as r, ResolverExternalConfig as s, ConcurrencyPolicy as t, WorkflowServiceConfig as u, IdPExternalConfig as v, IdPInput as w, IdPEmailConfig as x, IdPUserField as y, AuthConnectionOAuth2Config as z };
1416
- //# sourceMappingURL=workflow.generated-Bf1tWylx.d.mts.map
1451
+ export { unsafeAllowAllGqlPermission as $, BeforeLoginClaims as A, UserAttributeMap as B, IdPGqlOperationsInput as C, AuthExternalConfig as D, AuthConnectionTokenResult as E, FederatedIdentityProvider as F, TailorAnyDBType as G, AuthConnectionConfig as H, OAuth2ClientGrantType as I, TailorDBType as J, TailorDBField as K, SCIMAttributeType as L, DefinedAuth as M, FederatedIdentity as N, AuthOwnConfig as O, FederatedIdentityClaims as P, TailorTypePermission as Q, UserAttributeKey as R, IdPGqlOperations as S, AuthConfig as T, AuthConnectionOAuth2Config as U, UsernameFieldKey as V, TailorAnyDBField as W, PermissionCondition as X, db as Y, TailorTypeGqlPermission as Z, IdPConfig as _, ExecutorServiceConfig as a, IdpDefinitionBrand as b, ResolverServiceConfig as c, WorkflowServiceInput as d, unsafeAllowAllTypePermission as et, StaticWebsiteConfig as f, SecretsDefinitionBrand as g, SecretsConfig as h, AppConfig as i, BeforeLoginHookArgs as j, AuthServiceInput as k, ResolverServiceInput as l, StaticWebsiteInput as m, RetryPolicy as n, AllowedValuesOutput as nt, ExecutorServiceInput as o, StaticWebsiteDefinitionBrand as p, TailorDBInstance as q, HttpAdapterConfigInput as r, ResolverExternalConfig as s, ConcurrencyPolicy as t, AllowedValues as tt, WorkflowServiceConfig as u, IdPExternalConfig as v, IdPInput as w, IdPEmailConfig as x, IdPUserField as y, UserAttributeListKey as z };
1452
+ //# sourceMappingURL=workflow.generated-CCDsY0ce.d.mts.map
package/docs/cli/auth.md CHANGED
@@ -350,7 +350,7 @@ Get an access token for a machine user.
350
350
  **Usage**
351
351
 
352
352
  ```
353
- tailor-sdk machineuser token [options] <name>
353
+ tailor-sdk machineuser token [options] [name]
354
354
  ```
355
355
 
356
356
  <!-- politty:command:machineuser token:usage:end -->
@@ -359,9 +359,9 @@ tailor-sdk machineuser token [options] <name>
359
359
 
360
360
  **Arguments**
361
361
 
362
- | Argument | Description | Required |
363
- | -------- | ----------------- | -------- |
364
- | `name` | Machine user name | Yes |
362
+ | Argument | Description | Required |
363
+ | -------- | --------------------------------------------------------------------------- | -------- |
364
+ | `name` | Machine user name. Falls back to the active profile's default machine user. | No |
365
365
 
366
366
  <!-- politty:command:machineuser token:arguments:end -->
367
367
 
@@ -245,14 +245,14 @@ tailor-sdk function test-run [options] <file>
245
245
 
246
246
  **Options**
247
247
 
248
- | Option | Alias | Description | Required | Default | Env |
249
- | ------------------------------- | ----- | ------------------------------------------------------------------------ | -------- | -------------------- | ----------------------------------- |
250
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
251
- | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
252
- | `--name <NAME>` | `-n` | Workflow job name to run (matches the `name` field of createWorkflowJob) | No | - | - |
253
- | `--arg <ARG>` | `-a` | JSON argument to pass to the function | No | - | - |
254
- | `--machine-user <MACHINE_USER>` | `-m` | Machine user name for authentication | No | - | `TAILOR_PLATFORM_MACHINE_USER_NAME` |
255
- | `--config <CONFIG>` | `-c` | Path to SDK config file | No | `"tailor.config.ts"` | - |
248
+ | Option | Alias | Description | Required | Default | Env |
249
+ | ------------------------------- | ----- | ---------------------------------------------------------------------------------------------- | -------- | -------------------- | ----------------------------------- |
250
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
251
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
252
+ | `--name <NAME>` | `-n` | Workflow job name to run (matches the `name` field of createWorkflowJob) | No | - | - |
253
+ | `--arg <ARG>` | `-a` | JSON argument to pass to the function | No | - | - |
254
+ | `--machine-user <MACHINE_USER>` | `-m` | Machine user name for authentication. Falls back to the active profile's default machine user. | No | - | `TAILOR_PLATFORM_MACHINE_USER_NAME` |
255
+ | `--config <CONFIG>` | `-c` | Path to SDK config file | No | `"tailor.config.ts"` | - |
256
256
 
257
257
  <!-- politty:command:function test-run:options:end -->
258
258
  <!-- politty:command:function test-run:examples:start -->
package/docs/cli/query.md CHANGED
@@ -33,7 +33,7 @@ tailor-sdk query [options]
33
33
  | `--query <QUERY>` | `-q` | Query string to execute directly; omit to start REPL mode | No | - | - |
34
34
  | `--file <FILE>` | `-f` | Read query string from file; omit to start REPL mode | No | - | - |
35
35
  | `--edit` | - | Open a temporary file in your editor; omit to start REPL mode | No | `false` | - |
36
- | `--machine-user <MACHINE_USER>` | `-m` | Machine user name for query execution | Yes | - | `TAILOR_PLATFORM_MACHINE_USER_NAME` |
36
+ | `--machine-user <MACHINE_USER>` | `-m` | Machine user name for query execution. Falls back to the active profile's default machine user. | No | - | `TAILOR_PLATFORM_MACHINE_USER_NAME` |
37
37
  | `--newline-on-enter` | - | REPL: when true, Enter inserts a newline and Shift+Enter submits. Use --no-newline-on-enter to swap. | No | - | - |
38
38
 
39
39
  <!-- politty:command:query:options:end -->
@@ -167,16 +167,16 @@ tailor-sdk workflow start [options] <name>
167
167
 
168
168
  **Options**
169
169
 
170
- | Option | Alias | Description | Required | Default | Env |
171
- | ------------------------------- | ----- | -------------------------------------------------------------- | -------- | -------------------- | ----------------------------------- |
172
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
173
- | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
174
- | `--config <CONFIG>` | `-c` | Path to SDK config file | No | `"tailor.config.ts"` | `TAILOR_PLATFORM_SDK_CONFIG_PATH` |
175
- | `--machine-user <MACHINE_USER>` | `-m` | Machine user name | Yes | - | `TAILOR_PLATFORM_MACHINE_USER_NAME` |
176
- | `--arg <ARG>` | `-a` | Workflow argument (JSON string) | No | - | - |
177
- | `--wait` | `-W` | Wait for execution to complete | No | `false` | - |
178
- | `--interval <INTERVAL>` | `-i` | Polling interval when using --wait (e.g., '3s', '500ms', '1m') | No | `"3s"` | - |
179
- | `--logs` | `-l` | Display job execution logs after completion (requires --wait) | No | `false` | - |
170
+ | Option | Alias | Description | Required | Default | Env |
171
+ | ------------------------------- | ----- | --------------------------------------------------------------------------- | -------- | -------------------- | ----------------------------------- |
172
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
173
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
174
+ | `--config <CONFIG>` | `-c` | Path to SDK config file | No | `"tailor.config.ts"` | `TAILOR_PLATFORM_SDK_CONFIG_PATH` |
175
+ | `--machine-user <MACHINE_USER>` | `-m` | Machine user name. Falls back to the active profile's default machine user. | No | - | `TAILOR_PLATFORM_MACHINE_USER_NAME` |
176
+ | `--arg <ARG>` | `-a` | Workflow argument (JSON string) | No | - | - |
177
+ | `--wait` | `-W` | Wait for execution to complete | No | `false` | - |
178
+ | `--interval <INTERVAL>` | `-i` | Polling interval when using --wait (e.g., '3s', '500ms', '1m') | No | `"3s"` | - |
179
+ | `--logs` | `-l` | Display job execution logs after completion (requires --wait) | No | `false` | - |
180
180
 
181
181
  <!-- politty:command:workflow start:options:end -->
182
182
 
@@ -241,11 +241,13 @@ tailor-sdk profile create [options] <name>
241
241
 
242
242
  **Options**
243
243
 
244
- | Option | Alias | Description | Required | Default |
245
- | ------------------------------- | ----- | --------------------------------------------------------------------------------- | -------- | --------- |
246
- | `--user <USER>` | `-u` | User email | Yes | - |
247
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | Yes | - |
248
- | `--permission <PERMISSION>` | - | Profile permission. 'read' blocks all write commands while the profile is active. | No | `"write"` |
244
+ | Option | Alias | Description | Required | Default |
245
+ | ------------------------------------------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------- | -------- | --------- |
246
+ | `--user <USER>` | `-u` | User email | Yes | - |
247
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | Yes | - |
248
+ | `--permission <PERMISSION>` | - | Profile permission. 'read' blocks all write commands while the profile is active. | No | `"write"` |
249
+ | `--machine-user <MACHINE_USER>` | `-m` | Default machine user name for application-data commands (query, workflow start, function test-run, machineuser token). | No | - |
250
+ | `--machine-user-override <MACHINE_USER_OVERRIDE>` | - | Whether the command line or TAILOR_PLATFORM_MACHINE_USER_NAME may override the profile's machine user. 'deny' requires --machine-user. | No | - |
249
251
 
250
252
  <!-- politty:command:profile create:options:end -->
251
253
 
@@ -320,11 +322,13 @@ tailor-sdk profile update [options] <name>
320
322
 
321
323
  **Options**
322
324
 
323
- | Option | Alias | Description | Required | Default |
324
- | ------------------------------- | ----- | ------------------------------------------------------------------------------------ | -------- | ------- |
325
- | `--user <USER>` | `-u` | New user email | No | - |
326
- | `--workspace-id <WORKSPACE_ID>` | `-w` | New workspace ID | No | - |
327
- | `--permission <PERMISSION>` | - | Profile permission. 'read' blocks all write commands; 'write' lifts the restriction. | No | - |
325
+ | Option | Alias | Description | Required | Default |
326
+ | ------------------------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- |
327
+ | `--user <USER>` | `-u` | New user email | No | - |
328
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | New workspace ID | No | - |
329
+ | `--permission <PERMISSION>` | - | Profile permission. 'read' blocks all write commands; 'write' lifts the restriction. | No | - |
330
+ | `--machine-user <MACHINE_USER>` | `-m` | Default machine user name for application-data commands (query, workflow start, function test-run, machineuser token). Pass an empty string to clear. | No | - |
331
+ | `--machine-user-override <MACHINE_USER_OVERRIDE>` | - | Whether the command line or TAILOR_PLATFORM_MACHINE_USER_NAME may override the profile's machine user. 'deny' requires --machine-user; 'allow' lifts the restriction. | No | - |
328
332
 
329
333
  <!-- politty:command:profile update:options:end -->
330
334
 
@@ -77,7 +77,7 @@ You can use environment variables to configure workspace and authentication:
77
77
  | `TAILOR_PLATFORM_SDK_DTS_PATH` | Output path for generated `tailor.d.ts` type definition file |
78
78
  | `TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID` | Client ID for `login --machine-user` |
79
79
  | `TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET` | Client secret for `login --machine-user` |
80
- | `TAILOR_PLATFORM_MACHINE_USER_NAME` | Default machine user name for `query`, `workflow start`, `function test-run` |
80
+ | `TAILOR_PLATFORM_MACHINE_USER_NAME` | Default machine user name for `query`, `workflow start`, `function test-run`, `machineuser token` |
81
81
  | `TAILOR_BUNDLE_CONCURRENCY` | Max concurrent bundle workers for `deploy` (resolvers/executors/workflows). Defaults to CPU count |
82
82
  | `VISUAL` / `EDITOR` | Preferred editor for commands that open files (e.g., `vim`, `code`, `nano`) |
83
83
  | `TAILOR_CRASH_REPORTS_LOCAL` | Local crash log writing: `on` (default) or `off` |
@@ -515,6 +515,25 @@ export const auth = defineAuth("my-auth", {
515
515
 
516
516
  **invoker**: The machine user whose permissions are used to execute the hook. Must reference a machine user defined in the same auth configuration.
517
517
 
518
+ ### Federated identity claims
519
+
520
+ When a user signs in through a Built-in IdP OAuth provider (Google or Microsoft), the upstream provider's profile is available on `claims.federated_identity`. It is `undefined` for password logins, so guard before reading it. Commonly present claims (`name`, `given_name`, `family_name`, `picture`, `locale`) are typed; any other claim the provider issues is forwarded as-is. Availability varies by provider (for example, Microsoft does not issue `picture`).
521
+
522
+ ```typescript
523
+ hooks: {
524
+ beforeLogin: {
525
+ handler: async ({ claims }) => {
526
+ const federated = claims.federated_identity;
527
+ if (federated?.provider === "google") {
528
+ // Populate the user record from the upstream profile
529
+ const avatarUrl = federated.claims.picture;
530
+ }
531
+ },
532
+ invoker: "hook-invoker",
533
+ },
534
+ }
535
+ ```
536
+
518
537
  ## CLI Commands
519
538
 
520
539
  Manage Auth resources using the CLI:
@@ -125,6 +125,89 @@ defineIdp("my-idp", {
125
125
  });
126
126
  ```
127
127
 
128
+ ### userAuthPolicy
129
+
130
+ User authentication policy. Controls password requirements, the identifier used for login, allowed email domains, and social login providers. Every field is optional. The boolean options default to disabled, and the password length fields default to a minimum of 6 and a maximum of 4096.
131
+
132
+ ```typescript
133
+ defineIdp("my-idp", {
134
+ clients: ["my-client"],
135
+ userAuthPolicy: {
136
+ useNonEmailIdentifier: false,
137
+ allowSelfPasswordReset: true,
138
+ passwordRequireUppercase: true,
139
+ passwordRequireLowercase: true,
140
+ passwordRequireNonAlphanumeric: true,
141
+ passwordRequireNumeric: true,
142
+ passwordMinLength: 8,
143
+ passwordMaxLength: 128,
144
+ },
145
+ });
146
+ ```
147
+
148
+ **Login behavior:**
149
+
150
+ - `useNonEmailIdentifier` - Allow a non-email identifier (username) instead of requiring an email address. Default `false`.
151
+ - `allowSelfPasswordReset` - Show the "Forgot password?" flow so users can reset their own password. Default `false`.
152
+ - `disablePasswordAuth` - Remove password authentication entirely. Default `false`. Requires at least one social login provider to be enabled.
153
+
154
+ **Password requirements:**
155
+
156
+ - `passwordRequireUppercase` - Require at least one uppercase letter. Default `false`.
157
+ - `passwordRequireLowercase` - Require at least one lowercase letter. Default `false`.
158
+ - `passwordRequireNumeric` - Require at least one numeric character. Default `false`.
159
+ - `passwordRequireNonAlphanumeric` - Require at least one non-alphanumeric character. Default `false`.
160
+ - `passwordMinLength` - Minimum password length. Must be between 6 and 30. Default `6`.
161
+ - `passwordMaxLength` - Maximum password length. Must be between 6 and 4096. Default `4096`.
162
+
163
+ **Email domains and social login:**
164
+
165
+ - `allowedEmailDomains` - Restrict registration to these email domains. An empty list (the default) allows all domains, but a non-empty list is required when `allowGoogleOauth` or `allowMicrosoftOauth` is enabled.
166
+ - `allowGoogleOauth` - Enable the "Sign in with Google" button. Default `false`.
167
+ - `allowMicrosoftOauth` - Enable the "Sign in with Microsoft" button. Default `false`.
168
+
169
+ **Constraints:** the following combinations are rejected at parse time.
170
+
171
+ - `passwordMinLength` must be less than or equal to `passwordMaxLength`.
172
+ - A non-empty `allowedEmailDomains` cannot be combined with `useNonEmailIdentifier: true` (an empty list is allowed). Enabling `allowGoogleOauth` or `allowMicrosoftOauth` is likewise rejected with `useNonEmailIdentifier: true` (leaving them `false` or unset is fine).
173
+ - `allowGoogleOauth` requires a non-empty `allowedEmailDomains`.
174
+ - `allowMicrosoftOauth` requires both a non-empty `allowedEmailDomains` and `disablePasswordAuth: true`.
175
+ - `disablePasswordAuth` requires `allowGoogleOauth` or `allowMicrosoftOauth`, and cannot be combined with `allowSelfPasswordReset`.
176
+
177
+ ### gqlOperations
178
+
179
+ Controls which GraphQL user-management operations the IdP exposes. All operations are enabled by default. Use this to turn operations off entirely, independent of the `permission` policies that decide who may call them.
180
+
181
+ ```typescript
182
+ defineIdp("my-idp", {
183
+ clients: ["my-client"],
184
+ gqlOperations: {
185
+ create: true,
186
+ read: true,
187
+ update: true,
188
+ delete: false,
189
+ sendPasswordResetEmail: false,
190
+ },
191
+ });
192
+ ```
193
+
194
+ **Fields:** each field defaults to `true` (enabled). Set a field to `false` to disable that operation.
195
+
196
+ - `create` - The `_createUser` mutation.
197
+ - `read` - The `_users` and `_user` query operations.
198
+ - `update` - The `_updateUser` mutation.
199
+ - `delete` - The `_deleteUser` mutation.
200
+ - `sendPasswordResetEmail` - The `_sendPasswordResetEmail` mutation.
201
+
202
+ **Shortcut:** pass the string `"query"` to expose a read-only IdP. It enables `read` and disables every mutation.
203
+
204
+ ```typescript
205
+ defineIdp("my-idp", {
206
+ clients: ["my-client"],
207
+ gqlOperations: "query",
208
+ });
209
+ ```
210
+
128
211
  ### authorization (optional, legacy)
129
212
 
130
213
  Legacy access control field. Use `permission` instead for fine-grained per-operation control. This field is kept for backward compatibility.
@@ -170,6 +253,19 @@ defineIdp("my-idp", {
170
253
 
171
254
  **Validation:** Each field must be 200 characters or less and must not contain newline characters.
172
255
 
256
+ ### lang
257
+
258
+ UI language for the IdP-hosted pages such as the login and password reset screens.
259
+
260
+ ```typescript
261
+ defineIdp("my-idp", {
262
+ clients: ["my-client"],
263
+ lang: "ja",
264
+ });
265
+ ```
266
+
267
+ **Values:** `"en"` or `"ja"`.
268
+
173
269
  ### publishUserEvents
174
270
 
175
271
  Publish IdP user lifecycle events (`idp.user.created`, `idp.user.updated`, `idp.user.deleted`). These events are consumed by executors that use `idpUserCreatedTrigger`, `idpUserUpdatedTrigger`, `idpUserDeletedTrigger`, or `idpUserTrigger`.
@@ -355,20 +355,21 @@ Coordinate this with your team because everyone else's local migrations will be
355
355
 
356
356
  ## Failure Recovery
357
357
 
358
- If a `migrate.ts` throws:
358
+ If the pre-migration phase or `migrate.ts` fails:
359
359
 
360
360
  - **The transaction rolls back** for that migration's script. Database changes the script made are undone.
361
- - **The pre-migration phase already ran** before the script. Type-level relaxations (e.g., a field changed to optional) **are not undone**. The post-migration phase, including the label bump, does not run.
362
- - The whole `apply` aborts. Subsequent migrations in the same run do not execute.
361
+ - **The pre-migration schema changes are rolled back** to the prior checkpoint: types that already existed are restored to their previous shape, and types the migration newly introduced are dropped. The workspace is left at its prior checkpoint and prior schema — not half-applied.
362
+ - The whole `apply` aborts and the checkpoint label is not bumped. Subsequent migrations in the same run do not execute.
363
+
364
+ The rollback is best-effort per type; if reverting a type fails, a warning is logged and the original migration error is still reported.
363
365
 
364
366
  After a failure:
365
367
 
366
368
  1. Read the `Logs:` block in the apply output to find the cause.
367
369
  2. Fix `migrate.ts` (or the data it depends on).
368
- 3. Re-run `tailor-sdk deploy`. The same migration runs again because its label was never bumped.
369
- 4. If the pre-migration relaxation is causing problems for application code in the meantime, accept the temporary optionality or roll forward with a fix; do not try to manually re-tighten the schema, or you'll create remote drift.
370
+ 3. Re-run `tailor-sdk deploy`. The same migration runs again because its label was never bumped, and the prior-checkpoint schema is a clean baseline to retry against.
370
371
 
371
- If a migration **succeeds in script** but the post-migration phase fails (rare; usually due to constraint violation that the script should have prevented), the situation is the same as above plus the data changes from the script are persisted. Investigate, fix, and re-run.
372
+ If a migration **succeeds in script** but the **post-migration phase** fails (rare; usually a constraint violation the script should have prevented), the pre-migration changes are **not** rolled back: the script's data changes are already committed and the post-migration phase may have dropped removed columns or types, which cannot be reverted without data loss. Investigate, fix, and re-run.
372
373
 
373
374
  ## Rollback Strategy
374
375
 
@@ -444,6 +445,16 @@ For genuinely different schemas across environments, prefer separate workspaces
444
445
  4. To force the remote schema back to a known snapshot, use `migration sync <N>` (see [`migration sync` Semantics](#migration-sync-semantics)).
445
446
  5. As a last resort in non-production environments, `--no-schema-check` skips both checks. Do not use this as a routine workaround.
446
447
 
448
+ ### "Invalid schema snapshot" or "Invalid migration diff" error
449
+
450
+ **Cause:** A `schema.json` or `diff.json` file in the `migrations/` directory is corrupted or does not match the expected structure. Merge conflicts left in these files are a common cause.
451
+
452
+ **Resolution:**
453
+
454
+ 1. Read the error message — it includes the file path and the offending field.
455
+ 2. Restore the file from version control (`git checkout -- <path>`), or regenerate migration files with `migration generate` / `migration script`.
456
+ 3. Do not hand-edit `schema.json` or `diff.json`; they are managed by the CLI.
457
+
447
458
  ### "No machine user available for migration execution"
448
459
 
449
460
  **Cause:** Neither `migration.machineUser` is set nor are there any machine users in `auth.machineUsers`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/sdk",
3
- "version": "1.63.0",
3
+ "version": "1.65.0",
4
4
  "description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -146,11 +146,11 @@
146
146
  "@jridgewell/trace-mapping": "0.3.31",
147
147
  "@napi-rs/keyring": "1.3.0",
148
148
  "@opentelemetry/api": "1.9.1",
149
- "@opentelemetry/exporter-trace-otlp-proto": "0.218.0",
150
- "@opentelemetry/resources": "2.7.1",
151
- "@opentelemetry/sdk-trace-node": "2.7.1",
149
+ "@opentelemetry/exporter-trace-otlp-proto": "0.219.0",
150
+ "@opentelemetry/resources": "2.8.0",
151
+ "@opentelemetry/sdk-trace-node": "2.8.0",
152
152
  "@opentelemetry/semantic-conventions": "1.41.1",
153
- "@oxc-project/types": "0.134.0",
153
+ "@oxc-project/types": "0.135.0",
154
154
  "@standard-schema/spec": "1.1.0",
155
155
  "@tailor-platform/function-kysely-tailordb": "0.1.3",
156
156
  "@toiroakr/lines-db": "0.9.2",
@@ -169,7 +169,7 @@
169
169
  "madge": "8.0.0",
170
170
  "mime-types": "3.0.2",
171
171
  "open": "11.0.0",
172
- "oxc-parser": "0.134.0",
172
+ "oxc-parser": "0.135.0",
173
173
  "p-limit": "7.3.0",
174
174
  "pathe": "2.0.3",
175
175
  "pgsql-ast-parser": "12.0.2",
@@ -188,15 +188,15 @@
188
188
  "zod": "4.4.3"
189
189
  },
190
190
  "devDependencies": {
191
- "@opentelemetry/sdk-trace-base": "2.7.1",
191
+ "@opentelemetry/sdk-trace-base": "2.8.0",
192
192
  "@types/madge": "5.0.3",
193
193
  "@types/mime-types": "3.0.1",
194
194
  "@types/node": "24.13.1",
195
195
  "@types/semver": "7.7.1",
196
- "@typescript/native-preview": "7.0.0-dev.20260605.1",
196
+ "@typescript/native-preview": "7.0.0-dev.20260612.1",
197
197
  "@vitest/coverage-v8": "4.1.8",
198
- "oxfmt": "0.53.0",
199
- "oxlint": "1.68.0",
198
+ "oxfmt": "0.54.0",
199
+ "oxlint": "1.69.0",
200
200
  "oxlint-tsgolint": "0.23.0",
201
201
  "sonda": "0.11.1",
202
202
  "tsdown": "0.22.2",