@tailor-platform/sdk 1.14.0 → 1.14.2

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 (44) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +19 -0
  3. package/dist/application-BznueWxG.mjs +4 -0
  4. package/dist/{application-DnWZVbDO.mjs → application-DhwHYQ3H.mjs} +95 -44
  5. package/dist/application-DhwHYQ3H.mjs.map +1 -0
  6. package/dist/cli/index.mjs +4 -4
  7. package/dist/cli/lib.d.mts +13 -49
  8. package/dist/cli/lib.mjs +4 -4
  9. package/dist/cli/skills.d.mts +2 -0
  10. package/dist/cli/skills.mjs +51 -0
  11. package/dist/cli/skills.mjs.map +1 -0
  12. package/dist/configure/index.d.mts +4 -4
  13. package/dist/configure/index.mjs +2 -2
  14. package/dist/configure/index.mjs.map +1 -1
  15. package/dist/index-YzESrtj0.d.mts +396 -0
  16. package/dist/{index-DMoFYBhB.d.mts → index-q3n7wQOs.d.mts} +13 -12
  17. package/dist/{jiti-DuCiUfMj.mjs → jiti-BrELlEYT.mjs} +2 -2
  18. package/dist/{jiti-DuCiUfMj.mjs.map → jiti-BrELlEYT.mjs.map} +1 -1
  19. package/dist/{job-zGAXCidt.mjs → job-XiwGyFJt.mjs} +1 -1
  20. package/dist/{job-zGAXCidt.mjs.map → job-XiwGyFJt.mjs.map} +1 -1
  21. package/dist/plugin/index.d.mts +16 -2
  22. package/dist/plugin/index.mjs +208 -1
  23. package/dist/plugin/index.mjs.map +1 -1
  24. package/dist/{schema-BmKdDzr1.mjs → schema-DRYB-nzA.mjs} +1 -1
  25. package/dist/{schema-BmKdDzr1.mjs.map → schema-DRYB-nzA.mjs.map} +1 -1
  26. package/dist/{src-QNTCsO6J.mjs → src-DMROgdcL.mjs} +2 -2
  27. package/dist/{src-QNTCsO6J.mjs.map → src-DMROgdcL.mjs.map} +1 -1
  28. package/dist/{index-Bw_huFr7.d.mts → types-DbvONSS-.d.mts} +576 -460
  29. package/dist/{types-r-ZratAg.mjs → types-b-ig8nW_.mjs} +1 -1
  30. package/dist/types-b-ig8nW_.mjs.map +1 -0
  31. package/dist/{update-BnKKm4aR.mjs → update-Dm8ERWHJ.mjs} +312 -151
  32. package/dist/update-Dm8ERWHJ.mjs.map +1 -0
  33. package/dist/utils/test/index.d.mts +3 -3
  34. package/dist/utils/test/index.mjs +1 -1
  35. package/docs/plugin/custom.md +105 -49
  36. package/docs/plugin/index.md +2 -2
  37. package/package.json +5 -3
  38. package/skills/tailor-sdk/SKILL.md +34 -0
  39. package/dist/application-DM4zTgXU.mjs +0 -4
  40. package/dist/application-DnWZVbDO.mjs.map +0 -1
  41. package/dist/env-4RO7szrH.d.mts +0 -66
  42. package/dist/types-r-ZratAg.mjs.map +0 -1
  43. package/dist/update-BnKKm4aR.mjs.map +0 -1
  44. /package/dist/{chunk-C3Kl5s5P.mjs → chunk-GMkBE123.mjs} +0 -0
@@ -1,6 +1,6 @@
1
- import { t as isPluginGeneratedType } from "./types-r-ZratAg.mjs";
2
- import { t as db } from "./schema-BmKdDzr1.mjs";
3
- import { a as ExecutorSchema, c as stringifyFunction, d as logger, f as styles, i as createExecutorService, l as tailorUserMap, n as WorkflowJobSchema, o as OAuth2ClientSchema, p as symbols, r as WorkflowSchema, s as ResolverSchema, t as defineApplication, u as loadFilesWithIgnores } from "./application-DnWZVbDO.mjs";
1
+ import { t as isPluginGeneratedType } from "./types-b-ig8nW_.mjs";
2
+ import { t as db } from "./schema-DRYB-nzA.mjs";
3
+ import { a as ExecutorSchema, c as TailorFieldSchema, d as tailorUserMap, f as loadFilesWithIgnores, h as symbols, i as createExecutorService, l as functionSchema, m as styles, n as WorkflowJobSchema, o as OAuth2ClientSchema, p as logger, r as WorkflowSchema, s as ResolverSchema, t as defineApplication, u as stringifyFunction } from "./application-DhwHYQ3H.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { cloneDeep } from "es-toolkit";
6
6
  import { arg, defineCommand, runCommand } from "politty";
@@ -522,7 +522,7 @@ const file_tailor_v1_function_registry = /* @__PURE__ */ fileDesc("CiF0YWlsb3Ivd
522
522
  /**
523
523
  * Describes the file tailor/v1/idp_resource.proto.
524
524
  */
525
- const file_tailor_v1_idp_resource = /* @__PURE__ */ fileDesc("Chx0YWlsb3IvdjEvaWRwX3Jlc291cmNlLnByb3RvEgl0YWlsb3IudjEi3gEKCklkUFNlcnZpY2USJwoJbmFtZXNwYWNlGAEgASgLMhQudGFpbG9yLnYxLk5hbWVzcGFjZRIVCg1hdXRob3JpemF0aW9uGAIgASgJEhkKDHByb3ZpZGVyX3VybBgDIAEoCUID4EEDEjYKEHVzZXJfYXV0aF9wb2xpY3kYBCABKAsyHC50YWlsb3IudjEuSWRQVXNlckF1dGhQb2xpY3kSIAoEbGFuZxgFIAEoDjISLnRhaWxvci52MS5JZFBMYW5nEhsKE3B1Ymxpc2hfdXNlcl9ldmVudHMYBiABKAgiTQoJSWRQQ2xpZW50EgwKBG5hbWUYASABKAkSFgoJY2xpZW50X2lkGAIgASgJQgPgQQMSGgoNY2xpZW50X3NlY3JldBgDIAEoCUID4EEDIrEIChFJZFBVc2VyQXV0aFBvbGljeRIgChh1c2Vfbm9uX2VtYWlsX2lkZW50aWZpZXIYASABKAgSIQoZYWxsb3dfc2VsZl9wYXNzd29yZF9yZXNldBgCIAEoCBIiChpwYXNzd29yZF9yZXF1aXJlX3VwcGVyY2FzZRgDIAEoCBIiChpwYXNzd29yZF9yZXF1aXJlX2xvd2VyY2FzZRgEIAEoCBIpCiFwYXNzd29yZF9yZXF1aXJlX25vbl9hbHBoYW51bWVyaWMYBSABKAgSIAoYcGFzc3dvcmRfcmVxdWlyZV9udW1lcmljGAYgASgIEqYBChNwYXNzd29yZF9taW5fbGVuZ3RoGAcgASgFQogBukiEAboBgAEKGXBhc3N3b3JkX21pbl9sZW5ndGhfcmFuZ2USO3Bhc3N3b3JkX21pbl9sZW5ndGggbXVzdCBiZSAwIChkZWZhdWx0KSBvciBiZXR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F0aGlzLmFsbG93X2dvb2dsZV9vYXV0aCB8fCAhdGhpcy51c2Vfbm9uX2VtYWlsX2lkZW50aWZpZXIqSAoHSWRQTGFuZxIZChVJRF9QX0xBTkdfVU5TUEVDSUZJRUQQABIQCgxJRF9QX0xBTkdfRU4QARIQCgxJRF9QX0xBTkdfSkEQAmIGcHJvdG8z", [
526
526
  file_buf_validate_validate,
527
527
  file_google_api_field_behavior,
528
528
  file_tailor_v1_resource
@@ -2736,31 +2736,25 @@ z.object({
2736
2736
  resolvers: z.array(PluginGeneratedResolverSchema).optional(),
2737
2737
  executors: z.array(PluginGeneratedExecutorSchema).optional()
2738
2738
  });
2739
+ const tailorAnyFieldSchema = z.custom((val) => TailorFieldSchema.safeParse(val).success);
2739
2740
  const CustomPluginSchema = z.object({
2740
2741
  id: z.string(),
2741
2742
  description: z.string(),
2742
2743
  importPath: z.string(),
2743
- configSchema: z.any().optional(),
2744
- pluginConfigSchema: z.any().optional(),
2745
- pluginConfig: z.any().optional(),
2746
- process: z.any().optional(),
2747
- processNamespace: z.any().optional()
2744
+ configSchema: tailorAnyFieldSchema.optional(),
2745
+ pluginConfigSchema: tailorAnyFieldSchema.optional(),
2746
+ pluginConfig: z.unknown().optional(),
2747
+ processType: functionSchema.optional(),
2748
+ processNamespace: functionSchema.optional(),
2749
+ typeConfigRequired: z.union([z.boolean(), functionSchema]).optional(),
2750
+ configTypeTemplate: z.string().optional()
2748
2751
  }).superRefine((plugin, ctx) => {
2749
- if (plugin.process && !plugin.configSchema) ctx.addIssue({
2752
+ if (plugin.processType && !plugin.configSchema) ctx.addIssue({
2750
2753
  code: z.ZodIssueCode.custom,
2751
- message: "process requires configSchema to be defined.",
2754
+ message: "processType requires configSchema to be defined.",
2752
2755
  path: ["configSchema"]
2753
2756
  });
2754
2757
  }).passthrough();
2755
- const CustomPluginTupleSchema = z.tuple([CustomPluginSchema, z.unknown()]);
2756
- /**
2757
- * Type guard to check if a value is a PluginBase object
2758
- * @param value - Value to check
2759
- * @returns True if value is a PluginBase object
2760
- */
2761
- function isPluginBase(value) {
2762
- return CustomPluginSchema.safeParse(value).success;
2763
- }
2764
2758
  function normalizePluginConfigSchema(schema) {
2765
2759
  const seen = /* @__PURE__ */ new Set();
2766
2760
  const stack = [schema];
@@ -2777,7 +2771,7 @@ function normalizePluginConfigSchema(schema) {
2777
2771
  function clonePluginConfigSchema(schema) {
2778
2772
  return cloneDeep(schema);
2779
2773
  }
2780
- function normalizePluginBase(plugin) {
2774
+ function normalizePlugin(plugin) {
2781
2775
  let normalized = plugin;
2782
2776
  if (normalized.configSchema) {
2783
2777
  const clonedConfigSchema = clonePluginConfigSchema(normalized.configSchema);
@@ -2824,20 +2818,10 @@ function validatePluginConfig$1(config, schema) {
2824
2818
  }
2825
2819
  /**
2826
2820
  * Creates a PluginConfigSchema for custom plugins
2827
- * @returns Plugin config schema that validates and transforms PluginBase instances
2821
+ * @returns Plugin config schema that validates and transforms Plugin instances
2828
2822
  */
2829
2823
  function createPluginConfigSchema() {
2830
- return z.union([CustomPluginSchema, CustomPluginTupleSchema]).transform((plugin) => {
2831
- if (Array.isArray(plugin)) {
2832
- const [first, options] = plugin;
2833
- if (isPluginBase(first)) return normalizePluginBase({
2834
- ...first,
2835
- pluginConfig: options
2836
- });
2837
- throw new Error(`Invalid plugin configuration: expected PluginBase object`);
2838
- }
2839
- return normalizePluginBase(plugin);
2840
- }).brand("Plugin");
2824
+ return CustomPluginSchema.transform((plugin) => normalizePlugin(plugin)).brand("Plugin");
2841
2825
  }
2842
2826
 
2843
2827
  //#endregion
@@ -3367,32 +3351,6 @@ function createKyselyGenerator(options) {
3367
3351
  };
3368
3352
  }
3369
3353
 
3370
- //#endregion
3371
- //#region src/cli/utils/plugin-import.ts
3372
- /**
3373
- * Collect base directories for resolving plugin import paths.
3374
- * @param configPath - Path to tailor.config.ts
3375
- * @returns Ordered list of base directories
3376
- */
3377
- function getPluginImportBaseDirs(configPath) {
3378
- if (configPath) return [path.dirname(configPath)];
3379
- return [process.cwd()];
3380
- }
3381
- /**
3382
- * Resolve a relative plugin import path against candidate base directories.
3383
- * @param pluginImportPath - Relative plugin import path
3384
- * @param baseDirs - Candidate base directories
3385
- * @returns Absolute path if found, otherwise null
3386
- */
3387
- function resolveRelativePluginImportPath(pluginImportPath, baseDirs) {
3388
- if (!pluginImportPath.startsWith(".")) return null;
3389
- for (const baseDir of baseDirs) {
3390
- const absolutePath = path.resolve(baseDir, pluginImportPath);
3391
- if (fs$2.existsSync(absolutePath)) return absolutePath;
3392
- }
3393
- return null;
3394
- }
3395
-
3396
3354
  //#endregion
3397
3355
  //#region src/cli/generator/builtin/seed/idp-user-processor.ts
3398
3356
  /**
@@ -3407,12 +3365,7 @@ function processIdpUser(auth) {
3407
3365
  name: "_User",
3408
3366
  dependencies: [typeName],
3409
3367
  dataFile: "data/_User.jsonl",
3410
- mutation: `mutation CreateUser($input: _CreateUserInput!) {
3411
- _createUser(input: $input) {
3412
- id
3413
- }
3414
- }
3415
- `,
3368
+ idpNamespace: auth.idProvider.namespace,
3416
3369
  schema: {
3417
3370
  usernameField,
3418
3371
  userTypeName: typeName
@@ -3420,6 +3373,84 @@ function processIdpUser(auth) {
3420
3373
  };
3421
3374
  }
3422
3375
  /**
3376
+ * Generates the server-side IDP seed script code for testExecScript execution.
3377
+ * Uses the global tailor.idp.Client - no bundling required.
3378
+ * @param idpNamespace - The IDP namespace name
3379
+ * @returns Script code string
3380
+ */
3381
+ function generateIdpSeedScriptCode(idpNamespace) {
3382
+ return ml`
3383
+ export async function main(input) {
3384
+ const client = new tailor.idp.Client({ namespace: "${idpNamespace}" });
3385
+ const errors = [];
3386
+ let processed = 0;
3387
+
3388
+ for (let i = 0; i < input.users.length; i++) {
3389
+ try {
3390
+ await client.createUser(input.users[i]);
3391
+ processed++;
3392
+ console.log(\`[_User] \${i + 1}/\${input.users.length}: \${input.users[i].name}\`);
3393
+ } catch (error) {
3394
+ const message = error instanceof Error ? error.message : String(error);
3395
+ errors.push(\`Row \${i} (\${input.users[i].name}): \${message}\`);
3396
+ console.error(\`[_User] Row \${i} failed: \${message}\`);
3397
+ }
3398
+ }
3399
+
3400
+ return {
3401
+ success: errors.length === 0,
3402
+ processed,
3403
+ errors,
3404
+ };
3405
+ }
3406
+ `;
3407
+ }
3408
+ /**
3409
+ * Generates the server-side IDP truncation script code for testExecScript execution.
3410
+ * Lists all users with pagination and deletes each one.
3411
+ * @param idpNamespace - The IDP namespace name
3412
+ * @returns Script code string
3413
+ */
3414
+ function generateIdpTruncateScriptCode(idpNamespace) {
3415
+ return ml`
3416
+ export async function main() {
3417
+ const client = new tailor.idp.Client({ namespace: "${idpNamespace}" });
3418
+ const errors = [];
3419
+ let deleted = 0;
3420
+
3421
+ // List all users with pagination
3422
+ let nextToken = undefined;
3423
+ const allUsers = [];
3424
+ do {
3425
+ const response = await client.users(nextToken ? { nextToken } : undefined);
3426
+ allUsers.push(...(response.users || []));
3427
+ nextToken = response.nextToken;
3428
+ } while (nextToken);
3429
+
3430
+ console.log(\`Found \${allUsers.length} IDP users to delete\`);
3431
+
3432
+ for (const user of allUsers) {
3433
+ try {
3434
+ await client.deleteUser(user.id);
3435
+ deleted++;
3436
+ console.log(\`[_User] Deleted \${deleted}/\${allUsers.length}: \${user.name}\`);
3437
+ } catch (error) {
3438
+ const message = error instanceof Error ? error.message : String(error);
3439
+ errors.push(\`User \${user.id} (\${user.name}): \${message}\`);
3440
+ console.error(\`[_User] Delete failed for \${user.name}: \${message}\`);
3441
+ }
3442
+ }
3443
+
3444
+ return {
3445
+ success: errors.length === 0,
3446
+ deleted,
3447
+ total: allUsers.length,
3448
+ errors,
3449
+ };
3450
+ }
3451
+ `;
3452
+ }
3453
+ /**
3423
3454
  * Generates the schema file content for IdP users with foreign key
3424
3455
  * @param usernameField - Username field name
3425
3456
  * @param userTypeName - TailorDB user type name
@@ -3608,7 +3639,7 @@ function generateLinesDbSchemaFile(metadata, importPath) {
3608
3639
  function generateLinesDbSchemaFileWithPluginAPI(metadata, params) {
3609
3640
  const { typeName, exportName, optionalFields, omitFields, foreignKeys, indexes, pluginSource } = metadata;
3610
3641
  if (!pluginSource) throw new Error(`pluginSource is required for plugin-generated type "${typeName}"`);
3611
- const { pluginImportPath, originalImportPath } = params;
3642
+ const { configImportPath, originalImportPath } = params;
3612
3643
  const schemaTypeCode = ml`
3613
3644
  const schemaType = t.object({
3614
3645
  ...${exportName}.pickFields(${JSON.stringify(optionalFields)}, { optional: true }),
@@ -3617,13 +3648,15 @@ function generateLinesDbSchemaFileWithPluginAPI(metadata, params) {
3617
3648
  `;
3618
3649
  const schemaOptionsCode = generateSchemaOptions(foreignKeys, indexes);
3619
3650
  if (pluginSource.originalExportName && originalImportPath && pluginSource.generatedTypeKind) return ml`
3651
+ import { join } from "node:path";
3620
3652
  import { t } from "@tailor-platform/sdk";
3653
+ import { getGeneratedType } from "@tailor-platform/sdk/plugin";
3621
3654
  import { createTailorDBHook, createStandardSchema } from "@tailor-platform/sdk/test";
3622
3655
  import { defineSchema } from "@toiroakr/lines-db";
3623
- import { getGeneratedType } from "${pluginImportPath}";
3624
3656
  import { ${pluginSource.originalExportName} } from "${originalImportPath}";
3625
3657
 
3626
- const ${exportName} = getGeneratedType(${pluginSource.originalExportName}, "${pluginSource.generatedTypeKind}");
3658
+ const configPath = join(import.meta.dirname, "${configImportPath}");
3659
+ const ${exportName} = await getGeneratedType(configPath, "${pluginSource.pluginId}", ${pluginSource.originalExportName}, "${pluginSource.generatedTypeKind}");
3627
3660
 
3628
3661
  ${schemaTypeCode}
3629
3662
 
@@ -3636,12 +3669,14 @@ function generateLinesDbSchemaFileWithPluginAPI(metadata, params) {
3636
3669
  `;
3637
3670
  if (!pluginSource.generatedTypeKind) throw new Error(`Namespace plugin "${pluginSource.pluginId}" must provide generatedTypeKind for type "${typeName}"`);
3638
3671
  return ml`
3672
+ import { join } from "node:path";
3639
3673
  import { t } from "@tailor-platform/sdk";
3674
+ import { getGeneratedType } from "@tailor-platform/sdk/plugin";
3640
3675
  import { createTailorDBHook, createStandardSchema } from "@tailor-platform/sdk/test";
3641
3676
  import { defineSchema } from "@toiroakr/lines-db";
3642
- import { getGeneratedType } from "${pluginImportPath}";
3643
3677
 
3644
- const ${exportName} = getGeneratedType(null, "${pluginSource.generatedTypeKind}");
3678
+ const configPath = join(import.meta.dirname, "${configImportPath}");
3679
+ const ${exportName} = await getGeneratedType(configPath, "${pluginSource.pluginId}", null, "${pluginSource.generatedTypeKind}");
3645
3680
 
3646
3681
  ${schemaTypeCode}
3647
3682
 
@@ -3680,16 +3715,17 @@ function processSeedTypeInfo(type, namespace) {
3680
3715
  //#region src/cli/generator/builtin/seed/index.ts
3681
3716
  const SeedGeneratorID = "@tailor-platform/seed";
3682
3717
  /**
3683
- * Generate the IdP user seed function code
3718
+ * Generate the IdP user seed function code using tailor.idp.Client via testExecScript
3684
3719
  * @param hasIdpUser - Whether IdP user is included
3720
+ * @param idpNamespace - The IDP namespace name
3685
3721
  * @returns JavaScript code for IdP user seeding function
3686
3722
  */
3687
- function generateIdpUserSeedFunction(hasIdpUser) {
3688
- if (!hasIdpUser) return "";
3723
+ function generateIdpUserSeedFunction(hasIdpUser, idpNamespace) {
3724
+ if (!hasIdpUser || !idpNamespace) return "";
3689
3725
  return ml`
3690
- // Seed _User via GraphQL mutation
3726
+ // Seed _User via tailor.idp.Client (server-side)
3691
3727
  const seedIdpUser = async () => {
3692
- console.log(styleText("cyan", " Seeding _User via GraphQL mutation..."));
3728
+ console.log(styleText("cyan", " Seeding _User via tailor.idp.Client..."));
3693
3729
  const dataDir = join(configDir, "data");
3694
3730
  const data = loadSeedData(dataDir, ["_User"]);
3695
3731
  const rows = data["_User"] || [];
@@ -3697,34 +3733,54 @@ function generateIdpUserSeedFunction(hasIdpUser) {
3697
3733
  console.log(styleText("dim", " No _User data to seed"));
3698
3734
  return { success: true };
3699
3735
  }
3700
- console.log(styleText("dim", \` Processing _User...\`));
3701
- const mutation = \`mutation CreateUser($input: _CreateUserInput!) { _createUser(input: $input) { id } }\`;
3702
- let successCount = 0;
3703
- let failCount = 0;
3704
- for (let i = 0; i < rows.length; i++) {
3736
+ console.log(styleText("dim", \` Processing \${rows.length} _User records...\`));
3737
+
3738
+ const idpSeedCode = \/* js *\/\`${generateIdpSeedScriptCode(idpNamespace).replace(/`/g, "\\`").replace(/\$/g, "\\$")}\`;
3739
+
3740
+ const result = await executeScript({
3741
+ client: operatorClient,
3742
+ workspaceId,
3743
+ name: "seed-idp-user.ts",
3744
+ code: idpSeedCode,
3745
+ arg: JSON.stringify({ users: rows }),
3746
+ invoker: {
3747
+ namespace: authNamespace,
3748
+ machineUserName,
3749
+ },
3750
+ });
3751
+
3752
+ if (result.logs) {
3753
+ for (const line of result.logs.split("\\n").filter(Boolean)) {
3754
+ console.log(styleText("dim", \` \${line}\`));
3755
+ }
3756
+ }
3757
+
3758
+ if (result.success) {
3759
+ let parsed;
3705
3760
  try {
3706
- const response = await fetch(endpoint, {
3707
- method: "POST",
3708
- headers: { "Content-Type": "application/json", Authorization: \`Bearer \${tokenInfo.accessToken}\` },
3709
- body: JSON.stringify({ query: mutation, variables: { input: rows[i] } }),
3710
- });
3711
- const result = await response.json();
3712
- if (result.errors) {
3713
- failCount++;
3714
- console.error(styleText("red", \` ✗ Row \${i} in _User failed: \${result.errors[0].message}\`));
3715
- } else {
3716
- successCount++;
3761
+ parsed = JSON.parse(result.result || "{}");
3762
+ } catch (e) {
3763
+ console.error(styleText("red", \` ✗ Failed to parse seed result: \${e.message}\`));
3764
+ return { success: false };
3765
+ }
3766
+
3767
+ if (parsed.processed) {
3768
+ console.log(styleText("green", \` ✓ _User: \${parsed.processed} rows processed\`));
3769
+ }
3770
+
3771
+ if (!parsed.success) {
3772
+ const errors = Array.isArray(parsed.errors) ? parsed.errors : [];
3773
+ for (const err of errors) {
3774
+ console.error(styleText("red", \` ✗ \${err}\`));
3717
3775
  }
3718
- } catch (error) {
3719
- failCount++;
3720
- console.error(styleText("red", \` ✗ Row \${i} in _User failed: \${error.message}\`));
3776
+ return { success: false };
3721
3777
  }
3778
+
3779
+ return { success: true };
3780
+ } else {
3781
+ console.error(styleText("red", \` ✗ Seed failed: \${result.error}\`));
3782
+ return { success: false };
3722
3783
  }
3723
- console.log(styleText("green", \` ✓ _User: \${successCount} rows processed\`));
3724
- if (failCount > 0) {
3725
- console.error(styleText("red", \` ✗ _User: \${failCount} rows failed\`));
3726
- }
3727
- return { success: failCount === 0 };
3728
3784
  };
3729
3785
  `;
3730
3786
  }
@@ -3747,15 +3803,97 @@ function generateIdpUserSeedCall(hasIdpUser) {
3747
3803
  `;
3748
3804
  }
3749
3805
  /**
3806
+ * Generate the IdP user truncation function code using tailor.idp.Client via testExecScript
3807
+ * @param hasIdpUser - Whether IdP user is included
3808
+ * @param idpNamespace - The IDP namespace name
3809
+ * @returns JavaScript code for IdP user truncation function
3810
+ */
3811
+ function generateIdpUserTruncateFunction(hasIdpUser, idpNamespace) {
3812
+ if (!hasIdpUser || !idpNamespace) return "";
3813
+ return ml`
3814
+ // Truncate _User via tailor.idp.Client (server-side)
3815
+ const truncateIdpUser = async () => {
3816
+ console.log(styleText("cyan", "Truncating _User via tailor.idp.Client..."));
3817
+
3818
+ const idpTruncateCode = \/* js *\/\`${generateIdpTruncateScriptCode(idpNamespace).replace(/`/g, "\\`").replace(/\$/g, "\\$")}\`;
3819
+
3820
+ const result = await executeScript({
3821
+ client: operatorClient,
3822
+ workspaceId,
3823
+ name: "truncate-idp-user.ts",
3824
+ code: idpTruncateCode,
3825
+ arg: JSON.stringify({}),
3826
+ invoker: {
3827
+ namespace: authNamespace,
3828
+ machineUserName,
3829
+ },
3830
+ });
3831
+
3832
+ if (result.logs) {
3833
+ for (const line of result.logs.split("\\n").filter(Boolean)) {
3834
+ console.log(styleText("dim", \` \${line}\`));
3835
+ }
3836
+ }
3837
+
3838
+ if (result.success) {
3839
+ let parsed;
3840
+ try {
3841
+ parsed = JSON.parse(result.result || "{}");
3842
+ } catch (e) {
3843
+ console.error(styleText("red", \` ✗ Failed to parse truncation result: \${e.message}\`));
3844
+ return { success: false };
3845
+ }
3846
+
3847
+ if (parsed.deleted !== undefined) {
3848
+ console.log(styleText("green", \` ✓ _User: \${parsed.deleted} users deleted\`));
3849
+ }
3850
+
3851
+ if (!parsed.success) {
3852
+ const errors = Array.isArray(parsed.errors) ? parsed.errors : [];
3853
+ for (const err of errors) {
3854
+ console.error(styleText("red", \` ✗ \${err}\`));
3855
+ }
3856
+ return { success: false };
3857
+ }
3858
+
3859
+ return { success: true };
3860
+ } else {
3861
+ console.error(styleText("red", \` ✗ Truncation failed: \${result.error}\`));
3862
+ return { success: false };
3863
+ }
3864
+ };
3865
+ `;
3866
+ }
3867
+ /**
3868
+ * Generate the IdP user truncation call code within the truncate block
3869
+ * @param hasIdpUser - Whether IdP user is included
3870
+ * @returns JavaScript code for calling IdP user truncation
3871
+ */
3872
+ function generateIdpUserTruncateCall(hasIdpUser) {
3873
+ if (!hasIdpUser) return "";
3874
+ return ml`
3875
+ // Truncate _User if applicable
3876
+ const shouldTruncateUser = !skipIdp && !hasNamespace && (!hasTypes || entitiesToProcess.includes("_User"));
3877
+ if (hasIdpUser && shouldTruncateUser) {
3878
+ const truncResult = await truncateIdpUser();
3879
+ if (!truncResult.success) {
3880
+ console.error(styleText("red", "IDP user truncation failed."));
3881
+ process.exit(1);
3882
+ }
3883
+ }
3884
+ `;
3885
+ }
3886
+ /**
3750
3887
  * Generates the exec.mjs script content using testExecScript API for TailorDB types
3751
- * and GraphQL mutation for _User (IdP managed)
3888
+ * and tailor.idp.Client for _User (IdP managed)
3752
3889
  * @param defaultMachineUserName - Default machine user name from generator config (can be overridden at runtime)
3753
3890
  * @param relativeConfigPath - Config path relative to exec script
3754
3891
  * @param namespaceConfigs - Namespace configurations with types and dependencies
3755
3892
  * @param hasIdpUser - Whether _User is included
3893
+ * @param idpNamespace - The IDP namespace name, or null if not applicable
3756
3894
  * @returns exec.mjs file contents
3757
3895
  */
3758
- function generateExecScript(defaultMachineUserName, relativeConfigPath, namespaceConfigs, hasIdpUser) {
3896
+ function generateExecScript(defaultMachineUserName, relativeConfigPath, namespaceConfigs, hasIdpUser, idpNamespace) {
3759
3897
  const namespaceEntitiesEntries = namespaceConfigs.map(({ namespace, types }) => {
3760
3898
  return ` "${namespace}": [\n${types.map((e) => ` "${e}",`).join("\n")}\n ]`;
3761
3899
  }).join(",\n");
@@ -3769,7 +3907,6 @@ function generateExecScript(defaultMachineUserName, relativeConfigPath, namespac
3769
3907
  import { createInterface } from "node:readline";
3770
3908
  import {
3771
3909
  show,
3772
- getMachineUserToken,
3773
3910
  truncate,
3774
3911
  bundleSeedScript,
3775
3912
  chunkSeedData,
@@ -3923,6 +4060,17 @@ ${namespaceDepsEntries}
3923
4060
  }
3924
4061
  }
3925
4062
 
4063
+ // Get application info
4064
+ const appInfo = await show({ configPath, profile: values.profile });
4065
+ const authNamespace = appInfo.auth;
4066
+
4067
+ // Initialize operator client (once for all namespaces)
4068
+ const accessToken = await loadAccessToken({ profile: values.profile, useProfile: true });
4069
+ const workspaceId = await loadWorkspaceId({ profile: values.profile });
4070
+ const operatorClient = await initOperatorClient(accessToken);
4071
+
4072
+ ${generateIdpUserTruncateFunction(hasIdpUser, idpNamespace)}
4073
+
3926
4074
  // Truncate tables if requested
3927
4075
  if (values.truncate) {
3928
4076
  const answer = values.yes ? "y" : await promptConfirmation("Are you sure you want to truncate? (y/n): ");
@@ -3958,11 +4106,14 @@ ${namespaceDepsEntries}
3958
4106
  all: true,
3959
4107
  });
3960
4108
  }
3961
- console.log(styleText("green", "Truncate completed."));
3962
4109
  } catch (error) {
3963
4110
  console.error(styleText("red", \`Truncate failed: \${error.message}\`));
3964
4111
  process.exit(1);
3965
4112
  }
4113
+
4114
+ ${generateIdpUserTruncateCall(hasIdpUser)}
4115
+
4116
+ console.log(styleText("green", "Truncate completed."));
3966
4117
  }
3967
4118
 
3968
4119
  console.log(styleText("cyan", "\\nStarting seed data generation..."));
@@ -3970,18 +4121,6 @@ ${namespaceDepsEntries}
3970
4121
  console.log(styleText("dim", \` Skipping IdP user (_User)\`));
3971
4122
  }
3972
4123
 
3973
- // Get application info
3974
- const appInfo = await show({ configPath, profile: values.profile });
3975
- const endpoint = \`\${appInfo.url}/query\`;
3976
- const authNamespace = appInfo.auth;
3977
-
3978
- // Get machine user token
3979
- const tokenInfo = await getMachineUserToken({
3980
- name: machineUserName,
3981
- configPath,
3982
- profile: values.profile,
3983
- });
3984
-
3985
4124
  // Load seed data from JSONL files
3986
4125
  const loadSeedData = (dataDir, typeNames) => {
3987
4126
  const data = {};
@@ -4028,11 +4167,6 @@ ${namespaceDepsEntries}
4028
4167
  return result;
4029
4168
  };
4030
4169
 
4031
- // Initialize operator client (once for all namespaces)
4032
- const accessToken = await loadAccessToken({ profile: values.profile, useProfile: true });
4033
- const workspaceId = await loadWorkspaceId({ profile: values.profile });
4034
- const operatorClient = await initOperatorClient(accessToken);
4035
-
4036
4170
  // Seed TailorDB types via testExecScript
4037
4171
  const seedViaTestExecScript = async (namespace, typesToSeed, deps) => {
4038
4172
  const dataDir = join(configDir, "data");
@@ -4118,8 +4252,8 @@ ${namespaceDepsEntries}
4118
4252
  if (!parsed.success) {
4119
4253
  const errors = Array.isArray(parsed.errors) ? parsed.errors : [];
4120
4254
  const errorMessage =
4121
- errors.length > 0 ? errors.join("\\n") : "Seed script reported failure";
4122
- console.error(styleText("red", \` ✗ Seed failed: \${errorMessage}\`));
4255
+ errors.length > 0 ? errors.join("\\n ") : "Seed script reported failure";
4256
+ console.error(styleText("red", \` ✗ Seed failed:\\n \${errorMessage}\`));
4123
4257
  hasError = true;
4124
4258
  allErrors.push(errorMessage);
4125
4259
  }
@@ -4136,7 +4270,7 @@ ${namespaceDepsEntries}
4136
4270
  return { success: true, processed: allProcessed };
4137
4271
  };
4138
4272
 
4139
- ${generateIdpUserSeedFunction(hasIdpUser)}
4273
+ ${generateIdpUserSeedFunction(hasIdpUser, idpNamespace)}
4140
4274
 
4141
4275
  // Main execution
4142
4276
  try {
@@ -4188,7 +4322,7 @@ ${namespaceDepsEntries}
4188
4322
  function createSeedGenerator(options) {
4189
4323
  return {
4190
4324
  id: SeedGeneratorID,
4191
- description: "Generates seed data files (Kysely batch insert + GraphQL mutation for _User)",
4325
+ description: "Generates seed data files (Kysely batch insert + tailor.idp.Client for _User)",
4192
4326
  dependencies: ["tailordb"],
4193
4327
  processType: ({ type, source, namespace }) => {
4194
4328
  return {
@@ -4199,7 +4333,6 @@ function createSeedGenerator(options) {
4199
4333
  processTailorDBNamespace: ({ types }) => types,
4200
4334
  aggregate: ({ input, configPath }) => {
4201
4335
  const files = [];
4202
- const pluginImportBaseDirs = getPluginImportBaseDirs(configPath);
4203
4336
  const namespaceConfigs = [];
4204
4337
  for (const nsResult of input.tailordb) {
4205
4338
  if (!nsResult.types) continue;
@@ -4222,14 +4355,8 @@ function createSeedGenerator(options) {
4222
4355
  const relativePath = path.relative(path.dirname(schemaOutputPath), linesDb.pluginSource.originalFilePath);
4223
4356
  originalImportPath = relativePath.replace(/\.ts$/, "").startsWith(".") ? relativePath.replace(/\.ts$/, "") : `./${relativePath.replace(/\.ts$/, "")}`;
4224
4357
  }
4225
- let pluginImportPath = linesDb.pluginSource.pluginImportPath;
4226
- if (pluginImportPath.startsWith("./") || pluginImportPath.startsWith("../")) {
4227
- const resolvedPluginPath = resolveRelativePluginImportPath(pluginImportPath, pluginImportBaseDirs) ?? path.resolve(pluginImportBaseDirs[0] ?? process.cwd(), pluginImportPath);
4228
- const relativePluginPath = path.relative(path.dirname(schemaOutputPath), resolvedPluginPath);
4229
- pluginImportPath = relativePluginPath.startsWith(".") ? relativePluginPath : `./${relativePluginPath}`;
4230
- }
4231
4358
  const schemaContent = generateLinesDbSchemaFileWithPluginAPI(linesDb, {
4232
- pluginImportPath,
4359
+ configImportPath: path.relative(path.dirname(schemaOutputPath), configPath),
4233
4360
  originalImportPath
4234
4361
  });
4235
4362
  files.push({
@@ -4268,7 +4395,7 @@ function createSeedGenerator(options) {
4268
4395
  const relativeConfigPath = path.relative(options.distPath, configPath);
4269
4396
  files.push({
4270
4397
  path: path.join(options.distPath, "exec.mjs"),
4271
- content: generateExecScript(options.machineUserName, relativeConfigPath, namespaceConfigs, hasIdpUser)
4398
+ content: generateExecScript(options.machineUserName, relativeConfigPath, namespaceConfigs, hasIdpUser, idpUser?.idpNamespace ?? null)
4272
4399
  });
4273
4400
  return { files };
4274
4401
  }
@@ -4347,6 +4474,32 @@ async function loadConfig(configPath) {
4347
4474
  };
4348
4475
  }
4349
4476
 
4477
+ //#endregion
4478
+ //#region src/cli/utils/plugin-import.ts
4479
+ /**
4480
+ * Collect base directories for resolving plugin import paths.
4481
+ * @param configPath - Path to tailor.config.ts
4482
+ * @returns Ordered list of base directories
4483
+ */
4484
+ function getPluginImportBaseDirs(configPath) {
4485
+ if (configPath) return [path.dirname(configPath)];
4486
+ return [process.cwd()];
4487
+ }
4488
+ /**
4489
+ * Resolve a relative plugin import path against candidate base directories.
4490
+ * @param pluginImportPath - Relative plugin import path
4491
+ * @param baseDirs - Candidate base directories
4492
+ * @returns Absolute path if found, otherwise null
4493
+ */
4494
+ function resolveRelativePluginImportPath(pluginImportPath, baseDirs) {
4495
+ if (!pluginImportPath.startsWith(".")) return null;
4496
+ for (const baseDir of baseDirs) {
4497
+ const absolutePath = path.resolve(baseDir, pluginImportPath);
4498
+ if (fs$2.existsSync(absolutePath)) return absolutePath;
4499
+ }
4500
+ return null;
4501
+ }
4502
+
4350
4503
  //#endregion
4351
4504
  //#region src/parser/plugin-config/types.ts
4352
4505
  /**
@@ -5133,29 +5286,29 @@ var PluginManager = class {
5133
5286
  error: `Plugin "${context.pluginId}" not found`
5134
5287
  };
5135
5288
  const typeConfigRequired = plugin.typeConfigRequired;
5136
- if ((typeof typeConfigRequired === "function" ? typeConfigRequired(plugin.pluginConfig) : typeConfigRequired === true) && (context.config === void 0 || context.config === null)) return {
5289
+ if ((typeof typeConfigRequired === "function" ? typeConfigRequired(plugin.pluginConfig) : typeConfigRequired === true) && (context.typeConfig === void 0 || context.typeConfig === null)) return {
5137
5290
  success: false,
5138
- error: `Plugin "${plugin.id}" requires config, but none was provided for type "${context.type.name}".`
5291
+ error: `Plugin "${plugin.id}" requires typeConfig, but none was provided for type "${context.type.name}".`
5139
5292
  };
5140
5293
  if (plugin.configSchema) {
5141
- const validationErrors = validatePluginConfig(context.config, plugin.configSchema);
5294
+ const validationErrors = validatePluginConfig(context.typeConfig, plugin.configSchema);
5142
5295
  if (validationErrors.length > 0) {
5143
5296
  const errorDetails = validationErrors.map((e) => e.field ? `${e.field}: ${e.message}` : e.message).join("; ");
5144
5297
  return {
5145
5298
  success: false,
5146
- error: `Invalid config for plugin "${plugin.id}" on type "${context.type.name}": ${errorDetails}`
5299
+ error: `Invalid typeConfig for plugin "${plugin.id}" on type "${context.type.name}": ${errorDetails}`
5147
5300
  };
5148
5301
  }
5149
5302
  }
5150
- if (!plugin.process) return {
5303
+ if (!plugin.processType) return {
5151
5304
  success: false,
5152
- error: `Plugin "${plugin.id}" does not support type-attached processing (missing process method). Use processNamespace via definePlugins() instead.`
5305
+ error: `Plugin "${plugin.id}" does not support type-attached processing (missing processType method). Use processNamespace via definePlugins() instead.`
5153
5306
  };
5154
5307
  let output;
5155
5308
  try {
5156
- output = await plugin.process({
5309
+ output = await plugin.processType({
5157
5310
  type: context.type,
5158
- config: context.config,
5311
+ typeConfig: context.typeConfig,
5159
5312
  pluginConfig: plugin.pluginConfig,
5160
5313
  namespace: context.namespace
5161
5314
  });
@@ -5173,7 +5326,9 @@ var PluginManager = class {
5173
5326
  pluginImportPath: importPath,
5174
5327
  sourceTypeName: context.type.name,
5175
5328
  kind,
5176
- type
5329
+ type,
5330
+ namespace: context.namespace,
5331
+ pluginConfig: plugin.pluginConfig
5177
5332
  });
5178
5333
  }
5179
5334
  if (output.executors && output.executors.length > 0) for (const executor of output.executors) this.generatedExecutors.push({
@@ -5191,11 +5346,9 @@ var PluginManager = class {
5191
5346
  * Process namespace plugins that don't require a source type.
5192
5347
  * This method is called once per namespace for plugins with processNamespace method.
5193
5348
  * @param namespace - The target namespace for generated types
5194
- * @param types - TailorDB types in the namespace (after type-attached processing)
5195
- * @param generatedTypes - Plugin-generated types in the namespace
5196
5349
  * @returns Array of results with plugin outputs and configs
5197
5350
  */
5198
- async processNamespacePlugins(namespace, types, generatedTypes) {
5351
+ async processNamespacePlugins(namespace) {
5199
5352
  const results = [];
5200
5353
  for (const [pluginId, plugin] of this.plugins) {
5201
5354
  if (!plugin.processNamespace) continue;
@@ -5217,9 +5370,7 @@ var PluginManager = class {
5217
5370
  }
5218
5371
  const context = {
5219
5372
  pluginConfig: config,
5220
- namespace,
5221
- types,
5222
- generatedTypes
5373
+ namespace
5223
5374
  };
5224
5375
  let output;
5225
5376
  try {
@@ -5257,7 +5408,9 @@ var PluginManager = class {
5257
5408
  pluginImportPath: importPath,
5258
5409
  sourceTypeName: "(namespace)",
5259
5410
  kind,
5260
- type
5411
+ type,
5412
+ namespace,
5413
+ pluginConfig: plugin.pluginConfig
5261
5414
  });
5262
5415
  }
5263
5416
  }
@@ -5287,6 +5440,14 @@ var PluginManager = class {
5287
5440
  return this.plugins.size;
5288
5441
  }
5289
5442
  /**
5443
+ * Get a plugin by its ID
5444
+ * @param pluginId - The plugin ID to look up
5445
+ * @returns The plugin instance, or undefined if not found
5446
+ */
5447
+ getPlugin(pluginId) {
5448
+ return this.plugins.get(pluginId);
5449
+ }
5450
+ /**
5290
5451
  * Get the import path for a plugin
5291
5452
  * @param pluginId - The plugin ID to look up
5292
5453
  * @returns The plugin's import path, or undefined if not found
@@ -14044,7 +14205,7 @@ async function generate(options) {
14044
14205
  if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
14045
14206
  let pluginManager;
14046
14207
  if (plugins.length > 0) pluginManager = new PluginManager(plugins);
14047
- const { defineApplication: defineApplication$1 } = await import("./application-DM4zTgXU.mjs");
14208
+ const { defineApplication: defineApplication$1 } = await import("./application-BznueWxG.mjs");
14048
14209
  const application = defineApplication$1({
14049
14210
  config,
14050
14211
  pluginManager
@@ -15255,4 +15416,4 @@ const updateCommand = defineCommand({
15255
15416
 
15256
15417
  //#endregion
15257
15418
  export { jobsCommand as $, initOperatorClient as $t, generateCommand as A, getMigrationFiles as At, getMachineUserToken as B, generateUserTypes as Bt, resumeCommand as C, compareLocalTypesWithSnapshot as Ct, truncate as D, getLatestMigrationNumber as Dt, listWorkflows as E, formatMigrationNumber as Et, removeCommand$1 as F, formatDiffSummary as Ft, generateCommand$1 as G, fetchLatestToken as Gt, listCommand$5 as H, getDistDir as Ht, listCommand$4 as I, formatMigrationDiff as It, triggerCommand as J, readPlatformConfig as Jt, listWebhookExecutors as K, loadAccessToken as Kt, listOAuth2Clients as L, hasChanges as Lt, show as M, isValidMigrationNumber as Mt, showCommand as N, loadDiff as Nt, truncateCommand as O, getMigrationDirPath as Ot, remove as P, reconstructSnapshotFromMigrations as Pt, getExecutorJob as Q, initOAuth2Client as Qt, getCommand$1 as R, getNamespacesWithMigrations as Rt, healthCommand as S, SCHEMA_FILE_NAME as St, listCommand$3 as T, createSnapshotFromLocalTypes as Tt, listMachineUsers as U, apiCall as Ut, tokenCommand as V, loadConfig as Vt, generate$1 as W, apiCommand as Wt, listCommand$6 as X, fetchAll as Xt, triggerExecutor as Y, writePlatformConfig as Yt, listExecutors as Z, fetchUserInfo as Zt, createCommand as _, bundleMigrationScript as _t, listCommand as a, jsonArgs as an, getWorkflow as at, listCommand$2 as b, INITIAL_SCHEMA_NUMBER as bt, inviteUser as c, listWorkflowExecutions as ct, listCommand$1 as d, apply as dt, readPackageJson as en, listExecutorJobs as et, listWorkspaces as f, applyCommand as ft, deleteWorkspace as g, parseMigrationLabelNumber as gt, deleteCommand as h, MIGRATION_LABEL_KEY as ht, removeUser as i, deploymentArgs as in, getCommand$2 as it, logBetaWarning as j, getNextMigrationNumber as jt, generate as k, getMigrationFilePath as kt, restoreCommand as l, getCommand$3 as lt, getWorkspace as m, waitForExecution$1 as mt, updateUser as n, commonArgs as nn, startCommand as nt, listUsers as o, withCommonArgs as on, executionsCommand as ot, getCommand as p, executeScript as pt, webhookCommand as q, loadWorkspaceId as qt, removeCommand as r, confirmationArgs as rn, startWorkflow as rt, inviteCommand as s, workspaceArgs as sn, getWorkflowExecution as st, updateCommand as t, PATScope as tn, watchExecutorJob as tt, restoreWorkspace as u, getExecutor as ut, createWorkspace as v, DB_TYPES_FILE_NAME as vt, resumeWorkflow as w, compareSnapshots as wt, getAppHealth as x, MIGRATE_FILE_NAME as xt, listApps as y, DIFF_FILE_NAME as yt, getOAuth2Client as z, trnPrefix as zt };
15258
- //# sourceMappingURL=update-BnKKm4aR.mjs.map
15419
+ //# sourceMappingURL=update-Dm8ERWHJ.mjs.map