@tailor-platform/sdk 1.44.2 → 1.45.1

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 (73) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/{actor-DzCuoMlP.d.mts → actor-BmxQeMFP.d.mts} +2 -2
  3. package/dist/{application-7wtQzifE.mjs → application-B4zVVNRS.mjs} +28 -27
  4. package/dist/application-B4zVVNRS.mjs.map +1 -0
  5. package/dist/application-BIzicxMA.mjs +4 -0
  6. package/dist/cli/index.mjs +29 -29
  7. package/dist/cli/index.mjs.map +1 -1
  8. package/dist/cli/lib.d.mts +6 -6
  9. package/dist/cli/lib.mjs +8 -8
  10. package/dist/cli/lib.mjs.map +1 -1
  11. package/dist/{client-DcuQRqSd.mjs → client-BwXkoiMq.mjs} +3 -3
  12. package/dist/{client-DcuQRqSd.mjs.map → client-BwXkoiMq.mjs.map} +1 -1
  13. package/dist/{client-IsYnTV5A.mjs → client-DTaArWQr.mjs} +1 -1
  14. package/dist/configure/index.d.mts +5 -5
  15. package/dist/configure/index.mjs +16 -4
  16. package/dist/configure/index.mjs.map +1 -1
  17. package/dist/{crash-report-DQen2i_W.mjs → crash-report-BUHzuzDn.mjs} +1 -1
  18. package/dist/{crash-report-DVZsX1bs.mjs → crash-report-CtYCva4d.mjs} +3 -3
  19. package/dist/{crash-report-DVZsX1bs.mjs.map → crash-report-CtYCva4d.mjs.map} +1 -1
  20. package/dist/{errors-_M2TVoWh.mjs → errors-wNQxQQBH.mjs} +1 -1
  21. package/dist/{errors-_M2TVoWh.mjs.map → errors-wNQxQQBH.mjs.map} +1 -1
  22. package/dist/{file-utils-775qWKoo.mjs → file-utils-DjNi_3U_.mjs} +9 -9
  23. package/dist/file-utils-DjNi_3U_.mjs.map +1 -0
  24. package/dist/{index-DdsUV-aA.d.mts → index-B5_4Tzm2.d.mts} +2 -2
  25. package/dist/{index-BEEL1-6Z.d.mts → index-BBvPd9Uv.d.mts} +2 -2
  26. package/dist/{index-BOfTiouP.d.mts → index-DUKJPEwq.d.mts} +41 -8
  27. package/dist/{index-0Dk-fDWi.d.mts → index-DV-5OIEv.d.mts} +2 -2
  28. package/dist/{index-ZZYEd_0R.d.mts → index-Dxe6alSZ.d.mts} +2 -2
  29. package/dist/{interceptor-4UC-KTno.mjs → interceptor-CrcDfLPq.mjs} +1 -1
  30. package/dist/{interceptor-4UC-KTno.mjs.map → interceptor-CrcDfLPq.mjs.map} +1 -1
  31. package/dist/{kysely-type-BQsYEZoY.mjs → kysely-type-B8aRz_oC.mjs} +6 -6
  32. package/dist/kysely-type-B8aRz_oC.mjs.map +1 -0
  33. package/dist/multiline-e3IpANmS.mjs +39 -0
  34. package/dist/multiline-e3IpANmS.mjs.map +1 -0
  35. package/dist/{package-json-CRzw5eUf.mjs → package-json-6Px8bDpG.mjs} +1 -1
  36. package/dist/{package-json-CRzw5eUf.mjs.map → package-json-6Px8bDpG.mjs.map} +1 -1
  37. package/dist/package-json-7sRXVndJ.mjs +4 -0
  38. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  39. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  40. package/dist/plugin/builtin/file-utils/index.mjs +1 -1
  41. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  42. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  43. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  44. package/dist/plugin/builtin/seed/index.mjs +1 -1
  45. package/dist/plugin/index.d.mts +2 -2
  46. package/dist/{repl-editor-DjycioU-.mjs → repl-editor-BlT2dFtm.mjs} +1 -1
  47. package/dist/{repl-editor-DjycioU-.mjs.map → repl-editor-BlT2dFtm.mjs.map} +1 -1
  48. package/dist/{runtime-CEj_sAfP.mjs → runtime-D5AJYWnF.mjs} +85 -39
  49. package/dist/runtime-D5AJYWnF.mjs.map +1 -0
  50. package/dist/{seed-BkVKgsxf.mjs → seed-DrKY5yIF.mjs} +15 -15
  51. package/dist/seed-DrKY5yIF.mjs.map +1 -0
  52. package/dist/{service-CCnx_IFw.mjs → service-CCgw66c6.mjs} +2 -2
  53. package/dist/{service-CCnx_IFw.mjs.map → service-CCgw66c6.mjs.map} +1 -1
  54. package/dist/{tailor-db-field-D_z185oq.d.mts → tailor-db-field-Hx9OqPWY.d.mts} +5 -2
  55. package/dist/telemetry-BvI1EgMG.mjs +4 -0
  56. package/dist/{telemetry-B6Le9XT-.mjs → telemetry-DXitz4RH.mjs} +2 -2
  57. package/dist/{telemetry-B6Le9XT-.mjs.map → telemetry-DXitz4RH.mjs.map} +1 -1
  58. package/dist/utils/test/index.d.mts +3 -3
  59. package/dist/{workflow.generated-B7Mupf5V.d.mts → workflow.generated-DFljpJh7.d.mts} +2 -2
  60. package/docs/cli/tailordb.md +35 -415
  61. package/docs/services/executor.md +15 -1
  62. package/docs/services/idp.md +2 -2
  63. package/docs/services/tailordb-migration.md +418 -0
  64. package/docs/services/tailordb.md +6 -0
  65. package/package.json +4 -5
  66. package/dist/application-7wtQzifE.mjs.map +0 -1
  67. package/dist/application-P55ZFKHG.mjs +0 -4
  68. package/dist/file-utils-775qWKoo.mjs.map +0 -1
  69. package/dist/kysely-type-BQsYEZoY.mjs.map +0 -1
  70. package/dist/package-json-DR_mqrCW.mjs +0 -4
  71. package/dist/runtime-CEj_sAfP.mjs.map +0 -1
  72. package/dist/seed-BkVKgsxf.mjs.map +0 -1
  73. package/dist/telemetry-C_WXxIo0.mjs +0 -4
@@ -93,6 +93,36 @@ tailor-sdk tailordb truncate [options] [types]
93
93
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
94
94
 
95
95
  <!-- politty:command:tailordb truncate:global-options-link:end -->
96
+
97
+ **Usage Examples:**
98
+
99
+ ```bash
100
+ # Truncate all tables in all namespaces (requires confirmation)
101
+ tailor-sdk tailordb truncate --all
102
+
103
+ # Truncate all tables in all namespaces (skip confirmation)
104
+ tailor-sdk tailordb truncate --all --yes
105
+
106
+ # Truncate all tables in a specific namespace
107
+ tailor-sdk tailordb truncate --namespace myNamespace
108
+
109
+ # Truncate specific types (namespace is auto-detected)
110
+ tailor-sdk tailordb truncate User Post Comment
111
+
112
+ # Truncate specific types with confirmation skipped
113
+ tailor-sdk tailordb truncate User Post --yes
114
+ ```
115
+
116
+ **Notes:**
117
+
118
+ - You must specify exactly one of: `--all`, `--namespace`, or type names
119
+ - When truncating specific types, the namespace is automatically detected from your config
120
+ - Confirmation prompts vary based on the operation:
121
+ - `--all`: requires typing `truncate all`
122
+ - `--namespace`: requires typing `truncate <namespace-name>`
123
+ - Specific types: requires typing `yes`
124
+ - Use `--yes` flag to skip confirmation prompts (useful for scripts and CI/CD)
125
+
96
126
  <!-- politty:command:tailordb migration:heading:start -->
97
127
 
98
128
  ### tailordb migration
@@ -105,7 +135,7 @@ Manage TailorDB schema migrations.
105
135
 
106
136
  <!-- politty:command:tailordb migration:description:end -->
107
137
 
108
- Note: Migration scripts are automatically executed during `tailor-sdk apply`. See [Automatic Migration Execution](#automatic-migration-execution) for details.
138
+ Note: Migration scripts are automatically executed during `tailor-sdk apply`. See [Automatic Migration Execution](../services/tailordb-migration.md#automatic-migration-execution) for details.
109
139
 
110
140
  <!-- politty:command:tailordb migration:usage:start -->
111
141
 
@@ -265,6 +295,9 @@ tailor-sdk tailordb migration status [options]
265
295
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
266
296
 
267
297
  <!-- politty:command:tailordb migration status:global-options-link:end -->
298
+
299
+ **See also:** For migration concepts, configuration, workflow, and troubleshooting, see the [TailorDB Migrations guide](../services/tailordb-migration.md).
300
+
268
301
  <!-- politty:command:tailordb erd:heading:start -->
269
302
 
270
303
  ### tailordb erd
@@ -428,420 +461,6 @@ See [Global Options](../cli-reference.md#global-options) for options available t
428
461
 
429
462
  **Usage Examples:**
430
463
 
431
- ```bash
432
- # Truncate all tables in all namespaces (requires confirmation)
433
- tailor-sdk tailordb truncate --all
434
-
435
- # Truncate all tables in all namespaces (skip confirmation)
436
- tailor-sdk tailordb truncate --all --yes
437
-
438
- # Truncate all tables in a specific namespace
439
- tailor-sdk tailordb truncate --namespace myNamespace
440
-
441
- # Truncate specific types (namespace is auto-detected)
442
- tailor-sdk tailordb truncate User Post Comment
443
-
444
- # Truncate specific types with confirmation skipped
445
- tailor-sdk tailordb truncate User Post --yes
446
- ```
447
-
448
- **Notes:**
449
-
450
- - You must specify exactly one of: `--all`, `--namespace`, or type names
451
- - When truncating specific types, the namespace is automatically detected from your config
452
- - Confirmation prompts vary based on the operation:
453
- - `--all`: requires typing `truncate all`
454
- - `--namespace`: requires typing `truncate <namespace-name>`
455
- - Specific types: requires typing `yes`
456
- - Use `--yes` flag to skip confirmation prompts (useful for scripts and CI/CD)
457
-
458
- ### Overview
459
-
460
- The migration system detects field-level schema differences between your local type definitions and the previous snapshot, then generates migration files to safely apply those changes with data transformations.
461
-
462
- **Key Features:**
463
-
464
- - **Local snapshot-based diff detection** between current types and previous migration snapshot
465
- - **Transaction-wrapped data migrations** for atomicity - all changes commit or rollback together
466
- - **Automatic execution during apply** - pending migrations run as part of `tailor-sdk apply`
467
- - **TypeScript migration scripts** - type-safe data transformations using Kysely
468
-
469
- **Usage Examples:**
470
-
471
- ```bash
472
- # Generate migration for all schema changes
473
- tailor-sdk tailordb migration generate
474
-
475
- # Generate with a description
476
- tailor-sdk tailordb migration generate --name "add email field to user"
477
-
478
- # Generate without confirmation prompts
479
- tailor-sdk tailordb migration generate --yes
480
-
481
- # Delete existing migrations and start fresh (with confirmation)
482
- tailor-sdk tailordb migration generate --init
483
-
484
- # Delete existing migrations and start fresh (skip confirmation)
485
- tailor-sdk tailordb migration generate --init --yes
486
- ```
487
-
488
- **Generated Files:**
489
-
490
- Each migration creates a directory in the migrations folder with a 4-digit sequential number:
491
-
492
- | File | Description |
493
- | ------------------ | -------------------------------------------------- |
494
- | `0000/schema.json` | Initial schema snapshot (first migration only) |
495
- | `XXXX/diff.json` | Schema diff from previous snapshot |
496
- | `XXXX/migrate.ts` | Data migration script (only when breaking changes) |
497
- | `XXXX/db.ts` | Generated Kysely types for the migration script |
498
-
499
- **Migration Script Structure:**
500
-
501
- ```typescript
502
- import type { Transaction } from "./db";
503
-
504
- export async function main(trx: Transaction): Promise<void> {
505
- // Your data migration logic here
506
- // All operations use the transaction object (trx)
507
- await trx.updateTable("User").set({ newField: "default value" }).execute();
508
- }
509
- ```
510
-
511
- The `db.ts` file contains Kysely Transaction types that reflect the schema state **before** the migration runs. This ensures type-safe data transformations based on the actual database structure at that point in time.
512
-
513
- The `main` function receives a Kysely transaction object. All database operations should use this `trx` object to ensure atomicity - if any operation fails, all changes are rolled back.
514
-
515
- **Editor Integration:**
516
-
517
- If `VISUAL` or `EDITOR` is set, the generated script file will automatically open in your preferred editor:
518
-
519
- ```bash
520
- export EDITOR=vim
521
- tailor-sdk tailordb migration generate
522
- # → After generation, vim opens XXXX/migrate.ts
523
- ```
524
-
525
- **Usage Examples:**
526
-
527
- ```bash
528
- # Set migration checkpoint to 0001 (with confirmation)
529
- tailor-sdk tailordb migration set 1
530
-
531
- # Set migration checkpoint without confirmation
532
- tailor-sdk tailordb migration set 1 --yes
533
-
534
- # Set for specific namespace
535
- tailor-sdk tailordb migration set 2 --namespace tailordb
536
-
537
- # Reset to initial state (all migrations become pending)
538
- tailor-sdk tailordb migration set 0 --yes
539
- ```
540
-
541
- **Warning:**
542
-
543
- Setting the migration checkpoint changes which migrations will be executed on next apply:
544
-
545
- - **Forward** (e.g., 0001 → 0003): Skips migrations 0002 and 0003
546
- - **Backward** (e.g., 0003 → 0001): Migrations 0002 and 0003 become pending and will re-execute
547
-
548
- The command always displays a warning and requires confirmation unless `--yes` is specified.
549
-
550
- **Usage Examples:**
551
-
552
- ```bash
553
- # Show status for all namespaces
554
- tailor-sdk tailordb migration status
555
-
556
- # Show status for specific namespace
557
- tailor-sdk tailordb migration status --namespace tailordb
558
- ```
559
-
560
- **Example Output:**
561
-
562
- ```
563
- Namespace: tailordb
564
- Current migration: 0001
565
- Pending migrations:
566
- - 0002: Add email field to user
567
- - 0003: Remove deprecated status field
568
- ```
569
-
570
- ## Configuration
571
-
572
- Configure migrations in `tailor.config.ts`:
573
-
574
- ```typescript
575
- export default defineConfig({
576
- name: "my-app",
577
- db: {
578
- tailordb: {
579
- files: ["./tailordb/*.ts"],
580
- migration: {
581
- directory: "./migrations",
582
- // Optional: specify machine user for migration script execution
583
- // If not specified, the first machine user from auth.machineUsers is used
584
- machineUser: "admin-machine-user",
585
- },
586
- },
587
- },
588
- });
589
- ```
590
-
591
- ### Configuration Options
592
-
593
- | Option | Type | Description |
594
- | ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------ |
595
- | `files` | string[] | Glob patterns for TailorDB type definition files |
596
- | `ignores` | string[] | Glob patterns to ignore |
597
- | `migration.directory` | string | Directory path for migration files |
598
- | `migration.machineUser` | string | Machine user name for migration script execution (optional, defaults to first machine user from auth.machineUsers) |
599
-
600
- ### Machine User Selection
601
-
602
- When executing migration scripts, the system selects a machine user in the following priority:
603
-
604
- 1. **Explicit configuration**: `migration.machineUser` in db config
605
- 2. **Auto-selection**: First machine user from `auth.machineUsers`
606
-
607
- The machine user being used is logged during migration execution.
608
-
609
- ## Migration Directory Structure
610
-
611
- Migrations use a directory-based structure with 4-digit sequential numbering:
612
-
613
- ```
614
- migrations/
615
- ├── 0000/ # Initial schema (number 0)
616
- │ └── schema.json # Full schema snapshot
617
- ├── 0001/ # First change
618
- │ ├── diff.json # Schema diff
619
- │ ├── migrate.ts # Migration script (if breaking changes)
620
- │ └── db.ts # Kysely types (if breaking changes)
621
- ├── 0002/ # Second change
622
- │ └── diff.json
623
- └── ...
624
- ```
625
-
626
- - `0000` - Initial schema snapshot (always starts at 0)
627
- - `0001` - First schema change
628
- - `0002` - Second schema change, etc.
629
-
630
- ## Supported Schema Changes
631
-
632
- | Change Type | Breaking? | Migration Script | Notes |
633
- | ------------------------------- | --------- | ---------------- | --------------------------------------------- |
634
- | Add optional field | No | No | Schema change only |
635
- | Add required field | Yes | Yes | Script populates default values |
636
- | Remove field | No | No | Schema change only - data is preserved |
637
- | Change optional→required | Yes | Yes | Script sets defaults for null values |
638
- | Change required→optional | No | No | Schema change only |
639
- | Add index | No | No | Schema change only |
640
- | Remove index | No | No | Schema change only |
641
- | Add unique constraint | Yes | Yes | Script must resolve duplicate values |
642
- | Remove unique constraint | No | No | Schema change only |
643
- | Add enum value | No | No | Schema change only |
644
- | Remove enum value | Yes | Yes | Script migrates records with removed values |
645
- | Add type | No | No | Schema change only |
646
- | Remove type | No | No | Schema change only - data is preserved |
647
- | Change field type | - | - | **Not supported** - requires 3-step migration |
648
- | Change array to single value | - | - | **Not supported** - requires 3-step migration |
649
- | Change single value to array | - | - | **Not supported** - requires 3-step migration |
650
- | Change foreign key relationship | Yes | Yes | Script updates existing references |
651
-
652
- ### Unsupported Schema Changes
653
-
654
- The following changes require a 3-step migration process:
655
-
656
- #### Field Type Change
657
-
658
- Field type changes (e.g., `string` → `integer`) are not directly supported. Use this migration strategy:
659
-
660
- 1. **Migration 1**: Add a new field with the desired type (e.g., `fieldName_new`) and migrate data
661
- 2. **Migration 2**: Remove the old field
662
- 3. **Migration 3**: Add the field with the original name and new type, migrate data from temporary field, then remove temporary field
663
-
664
- #### Array Property Change
665
-
666
- Changing between single value and array (e.g., `array: false` → `array: true`) is not directly supported. Use the same 3-step migration strategy as field type changes.
667
-
668
- ## Example Workflow
669
-
670
- 1. **Modify your type definition:**
671
-
672
- ```typescript
673
- // tailordb/user.ts
674
- export const user = db.type("User", {
675
- name: db.string(),
676
- email: db.string(), // ← New required field
677
- ...db.fields.timestamps(),
678
- });
679
- ```
680
-
681
- 2. **Generate migration:**
682
-
683
- ```bash
684
- tailor-sdk tailordb migration generate
685
- # Output: Generated migration 0001
686
- # Diff file: ./migrations/0001/diff.json
687
- # Migration script: ./migrations/0001/migrate.ts
688
- # DB types: ./migrations/0001/db.ts
689
- ```
690
-
691
- 3. **Edit the migration script** (`0001/migrate.ts`):
692
-
693
- ```typescript
694
- import type { Transaction } from "./db";
695
-
696
- export async function main(trx: Transaction): Promise<void> {
697
- await trx
698
- .updateTable("User")
699
- .set({ email: "default@example.com" })
700
- .where("email", "is", null)
701
- .execute();
702
- }
703
- ```
704
-
705
- 4. **Apply migration:**
706
- ```bash
707
- tailor-sdk apply
708
- # Migrations are automatically executed during apply
709
- ```
710
-
711
- ## Automatic Migration Execution
712
-
713
- When running `tailor-sdk apply`, pending migration scripts are automatically executed as part of the deployment process.
714
-
715
- ### How It Works
716
-
717
- 1. **Pending Migration Detection**: Identifies migration scripts that haven't been executed yet
718
- 2. **Two-Stage Type Update**: For breaking changes (required fields, type changes):
719
- - **Pre-Migration**: New fields are added as `optional` first
720
- - **Script Execution**: Migration scripts run to populate data
721
- - **Post-Migration**: Fields are changed to `required`, deletions are applied
722
-
723
- ### Execution Flow
724
-
725
- ```
726
- tailor-sdk apply
727
-
728
- ├── Detect Pending Migrations
729
-
730
- ├── [If pending migrations exist]
731
- │ ├── Pre-Migration: Add fields as optional
732
- │ ├── Execute Migration Scripts (TestExecScript API)
733
- │ └── Post-Migration: Apply required, deletions
734
-
735
- └── Continue with normal apply flow
736
- ```
737
-
738
- ### Requirements for Automatic Migration
739
-
740
- 1. **Migrations configured**: `migrations` path set in db config
741
- 2. **Auth configured**: Auth service with machine users
742
- 3. **Kysely generator**: `@tailor-platform/kysely-type` generator configured
743
-
744
- ### Schema Verification
745
-
746
- By default, `tailor-sdk apply` performs two schema verifications:
747
-
748
- 1. **Local schema check**: Ensures local type definitions match the migration snapshot
749
- 2. **Remote schema check**: Ensures remote schema matches the expected state based on migration history
750
-
751
- If remote schema drift is detected, you'll see an error like:
752
-
753
- ```
754
- ✖ Remote schema drift detected:
755
- Namespace: tailordb
756
- Remote migration: 0007
757
- Differences:
758
- Type 'User':
759
- - Field 'email': required: remote=false, expected=true
760
-
761
- ℹ This may indicate:
762
- - Another developer applied different migrations
763
- - Manual schema changes were made directly
764
- - Migration history is out of sync
765
-
766
- ℹ Use '--no-schema-check' to skip this check (not recommended).
767
- ```
768
-
769
- ### Skipping Schema Check
770
-
771
- To skip both local and remote schema verification (not recommended for production):
772
-
773
- ```bash
774
- tailor-sdk apply --no-schema-check
775
- ```
776
-
777
- **Warning:** Skipping schema checks may result in applying migrations to an inconsistent state.
778
-
779
- ### Example Output
780
-
781
- ```
782
- ℹ Found 2 pending migration(s) to execute.
783
- ℹ Executing 2 pending migration(s)...
784
- ℹ Using machine user: admin-machine-user
785
-
786
- ✔ Migration tailordb/0002 completed successfully
787
- ✔ Migration tailordb/0003 completed successfully
788
-
789
- ✔ All migrations completed successfully.
790
- ✔ Successfully applied changes.
791
- ```
792
-
793
- ## Troubleshooting
794
-
795
- ### Remote schema drift detected
796
-
797
- **Cause:** The remote schema doesn't match the expected state based on migration history. This can happen when:
798
-
799
- - Another developer applied different migrations
800
- - Schema was changed manually outside of migrations
801
- - Migration history is out of sync
802
-
803
- **Solution:**
804
-
805
- 1. **Check migration status**: Run `tailor-sdk tailordb migration status` to see current state
806
- 2. **Sync with team**: Ensure all team members have the same migration files
807
- 3. **Reset if needed**: Use `tailor-sdk tailordb migration set <number>` to reset migration checkpoint
808
- 4. **Force apply** (use with caution): Use `--no-schema-check` to skip verification
809
-
810
- ### "Machine user not found"
811
-
812
- **Cause:** Specified machine user doesn't exist in auth configuration.
813
-
814
- **Solution:**
815
-
816
- 1. Check available users: The error message lists available machine users
817
- 2. Add machine user to your auth config:
818
- ```typescript
819
- machineUsers: {
820
- "your-user-name": {
821
- attributes: { role: "ADMIN" },
822
- },
823
- }
824
- ```
825
- 3. Run `tailor-sdk apply` to deploy the auth config
826
- 4. Retry migration
827
-
828
- ### Migration script execution fails
829
-
830
- **Cause:** Runtime error in your data migration logic.
831
-
832
- **Solution:**
833
-
834
- 1. Check the error message for the failing query/operation
835
- 2. Test your script logic locally if possible
836
- 3. Fix the script
837
- 4. Apply again: `tailor-sdk apply`
838
-
839
- **Notes:**
840
-
841
- - This command is a beta feature and may introduce breaking changes in future releases
842
-
843
- **Usage Examples:**
844
-
845
464
  ```bash
846
465
  # Deploy ERD for all namespaces with erdSite configured
847
466
  tailor-sdk tailordb erd deploy
@@ -855,6 +474,7 @@ tailor-sdk tailordb erd deploy --json
855
474
 
856
475
  **Notes:**
857
476
 
477
+ - This command is a beta feature and may introduce breaking changes in future releases
858
478
  - Requires `erdSite` to be configured in `tailor.config.ts` for each namespace you want to deploy
859
479
  - Example config:
860
480
  ```typescript
@@ -130,7 +130,15 @@ Fire when IdP users are created, updated, or deleted:
130
130
  idpUserCreatedTrigger();
131
131
  ```
132
132
 
133
- These triggers require the IdP to publish user lifecycle events. The SDK enables `publishUserEvents` on the IdP automatically during `apply` when any executor uses an `idpUser` trigger; set the value explicitly on `defineIdp()` to override. See [IdP service - publishUserEvents](./idp.md#publishuserevents).
133
+ When the project defines multiple IdPs, pass `idp` to target a specific one. The name is type-narrowed via the generated `IdpName` type:
134
+
135
+ ```typescript
136
+ idpUserCreatedTrigger({ idp: "my-idp" });
137
+ ```
138
+
139
+ Omitting `idp` is allowed only when the project has exactly one IdP; otherwise `apply` fails with an error listing the configured IdPs.
140
+
141
+ These triggers require the IdP to publish user lifecycle events. The SDK enables `publishUserEvents` automatically during `apply` on each IdP that is targeted by an `idpUser` trigger; set the value explicitly on `defineIdp()` to override. See [IdP service - publishUserEvents](./idp.md#publishuserevents).
134
142
 
135
143
  ### Auth Access Token Triggers
136
144
 
@@ -180,6 +188,12 @@ export default createExecutor({
180
188
  idpUserTrigger({ events: ["created", "deleted"] });
181
189
  ```
182
190
 
191
+ In multi-IdP projects, add `idp` to target a specific IdP:
192
+
193
+ ```typescript
194
+ idpUserTrigger({ events: ["created", "deleted"], idp: "my-idp" });
195
+ ```
196
+
183
197
  #### `authAccessTokenTrigger()`
184
198
 
185
199
  ```typescript
@@ -175,10 +175,10 @@ defineIdp("my-idp", {
175
175
  });
176
176
  ```
177
177
 
178
- **Auto-configuration:** When `publishUserEvents` is omitted, the SDK enables it automatically during `apply` if the project defines any executor with an `idpUser` trigger. Set the value explicitly to override:
178
+ **Auto-configuration:** When `publishUserEvents` is omitted, the SDK enables it automatically during `apply` for each IdP that is targeted by an executor's `idpUser` trigger. Targeting is per-IdP: an executor specifies which IdP it subscribes to via the trigger's `idp` option (required in multi-IdP projects). Set the value explicitly to override:
179
179
 
180
180
  - `publishUserEvents: true`: always publish events.
181
- - `publishUserEvents: false`: never publish events. The SDK warns when executors with `idpUser` triggers are present, since those executors will not fire for this IdP.
181
+ - `publishUserEvents: false`: never publish events. `apply` rejects this with an error if any executor's `idpUser` trigger targets this IdP either remove `publishUserEvents: false` or remove the matching trigger.
182
182
 
183
183
  ## Using idp.provider()
184
184