@tailor-platform/sdk 2.4.0 → 2.5.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 (234) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/dist/aigateway-DsWDjzk4.mjs +2 -0
  3. package/dist/{aigateway-DR4Kwuik.mjs.map → aigateway-DsWDjzk4.mjs.map} +1 -1
  4. package/dist/application-DFOUovmN.mjs +1 -0
  5. package/dist/application-D_4vg1KR.mjs +192 -0
  6. package/dist/application-D_4vg1KR.mjs.map +1 -0
  7. package/dist/assert-WeXvmG4j.mjs +2 -0
  8. package/dist/{assert-DBxo8jPo.mjs.map → assert-WeXvmG4j.mjs.map} +1 -1
  9. package/dist/authconnection-CynFBIv8.mjs +2 -0
  10. package/dist/{authconnection-CZvi9ANm.mjs.map → authconnection-CynFBIv8.mjs.map} +1 -1
  11. package/dist/brand-C8nMKhJC.mjs +2 -0
  12. package/dist/{brand-Eo4pLXPJ.mjs.map → brand-C8nMKhJC.mjs.map} +1 -1
  13. package/dist/cli/commands/deploy/deploy.d.mts +2 -2
  14. package/dist/cli/commands/deploy/deployment-target.d.mts +2 -0
  15. package/dist/cli/commands/deploy/event-subscriptions.d.mts +3 -0
  16. package/dist/cli/commands/deploy/tailordb/apply.d.mts +3 -0
  17. package/dist/cli/commands/deploy/tailordb/index.d.mts +3 -10
  18. package/dist/cli/commands/deploy/tailordb/migration-validation.d.mts +5 -0
  19. package/dist/cli/commands/deploy/tailordb/plan.d.mts +8 -0
  20. package/dist/cli/commands/executor/jobs.d.mts +1 -1
  21. package/dist/cli/commands/generate/seed/bundler.d.mts +2 -2
  22. package/dist/cli/commands/show.d.mts +1 -1
  23. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +11 -11
  24. package/dist/cli/commands/tailordb/migrate/generate.d.mts +4 -0
  25. package/dist/cli/commands/tailordb/migrate/rename-detection.d.mts +1 -1
  26. package/dist/cli/commands/tailordb/migrate/snapshot-comparison.d.mts +43 -0
  27. package/dist/cli/commands/tailordb/migrate/snapshot-files.d.mts +62 -0
  28. package/dist/cli/commands/tailordb/migrate/snapshot-local.d.mts +12 -0
  29. package/dist/cli/commands/tailordb/migrate/snapshot-migrations.d.mts +12 -0
  30. package/dist/cli/commands/tailordb/migrate/snapshot-remote.d.mts +1 -0
  31. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +3 -1
  32. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +5 -117
  33. package/dist/cli/lib.d.mts +8 -4
  34. package/dist/cli/lib.mjs +1 -9
  35. package/dist/cli/lib.mjs.map +1 -1
  36. package/dist/cli/main.mjs +1170 -7754
  37. package/dist/cli/main.mjs.map +1 -1
  38. package/dist/cli/shared/seed-chunker.d.mts +5 -5
  39. package/dist/completion/zsh-worker.zsh +82 -9
  40. package/dist/configure/config/index.d.mts +1 -1
  41. package/dist/configure/config/types.d.mts +2 -2
  42. package/dist/configure/index.d.mts +48 -12
  43. package/dist/configure/index.mjs +1 -1267
  44. package/dist/configure/index.mjs.map +1 -1
  45. package/dist/configure/services/auth/types.d.mts +1 -1
  46. package/dist/configure/services/idp/types.d.mts +1 -1
  47. package/dist/configure/services/tailordb/schema.d.mts +4 -8
  48. package/dist/configure/services/tailordb/types.d.mts +1 -1
  49. package/dist/configure/services/workflow/execution-policy.d.mts +3 -3
  50. package/dist/configure/services/workflow/job.d.mts +12 -2
  51. package/dist/configure/types/field.types.d.mts +1 -1
  52. package/dist/configure/types/permission-operand.types.d.mts +1 -1
  53. package/dist/context-D0QjfxzD.mjs +2 -0
  54. package/dist/{context-DYQVYWqZ.mjs.map → context-D0QjfxzD.mjs.map} +1 -1
  55. package/dist/crashreport-B-_HTKLr.mjs +42 -0
  56. package/dist/{crashreport-Q0pDAlrj.mjs.map → crashreport-B-_HTKLr.mjs.map} +1 -1
  57. package/dist/crashreport-BmsRIdpy.mjs +1 -0
  58. package/dist/errors-DSEXKRVD.mjs +2 -0
  59. package/dist/errors-DSEXKRVD.mjs.map +1 -0
  60. package/dist/file-COPYfju_.mjs +2 -0
  61. package/dist/file-COPYfju_.mjs.map +1 -0
  62. package/dist/globals-CMHSnj4w.mjs +2 -0
  63. package/dist/{globals-B2nlxBrz.mjs.map → globals-CMHSnj4w.mjs.map} +1 -1
  64. package/dist/iconv-DlFMt2gW.mjs +2 -0
  65. package/dist/{iconv-QWaZh0TT.mjs.map → iconv-DlFMt2gW.mjs.map} +1 -1
  66. package/dist/idp-G_ojPBB5.mjs +2 -0
  67. package/dist/{idp-RA_swu-h.mjs.map → idp-G_ojPBB5.mjs.map} +1 -1
  68. package/dist/interceptor-DQg3cR_9.mjs +2 -0
  69. package/dist/{interceptor-e33JtsC-.mjs.map → interceptor-DQg3cR_9.mjs.map} +1 -1
  70. package/dist/kysely/index.mjs +1 -32
  71. package/dist/kysely/index.mjs.map +1 -1
  72. package/dist/kysely-type-BTi3BMtL.mjs +43 -0
  73. package/dist/kysely-type-BTi3BMtL.mjs.map +1 -0
  74. package/dist/logger-BcGy-u7G.mjs +9 -0
  75. package/dist/{logger-D0bEznPv.mjs.map → logger-BcGy-u7G.mjs.map} +1 -1
  76. package/dist/logger-DP2BjQ93.mjs +2 -0
  77. package/dist/{logger-BtX0suGY.mjs.map → logger-DP2BjQ93.mjs.map} +1 -1
  78. package/dist/multiline-EyzjEwn9.mjs +3 -0
  79. package/dist/{multiline-sfHpTZZK.mjs.map → multiline-EyzjEwn9.mjs.map} +1 -1
  80. package/dist/node-builtins-oBl7EbyV.mjs +2 -0
  81. package/dist/{node-builtins-CmaL2Cbq.mjs.map → node-builtins-oBl7EbyV.mjs.map} +1 -1
  82. package/dist/package-json-C690ceex.mjs +2 -0
  83. package/dist/{package-json-8b0O9TlX.mjs.map → package-json-C690ceex.mjs.map} +1 -1
  84. package/dist/package-json-CmqhDJ__.mjs +1 -0
  85. package/dist/parser/service/tailordb/type-source.d.mts +5 -5
  86. package/dist/parser/service/tailordb/types.d.mts +4 -4
  87. package/dist/platform-serialize-DkiTdHOt.mjs +2 -0
  88. package/dist/{platform-serialize-RoRtBS0v.mjs.map → platform-serialize-DkiTdHOt.mjs.map} +1 -1
  89. package/dist/plugin/builtin/enum-constants/index.mjs +5 -114
  90. package/dist/plugin/builtin/enum-constants/index.mjs.map +1 -1
  91. package/dist/plugin/builtin/file-utils/index.mjs +22 -104
  92. package/dist/plugin/builtin/file-utils/index.mjs.map +1 -1
  93. package/dist/plugin/builtin/kysely-type/index.d.mts +8 -1
  94. package/dist/plugin/builtin/kysely-type/index.mjs +1 -275
  95. package/dist/plugin/builtin/seed/index.d.mts +5 -0
  96. package/dist/plugin/builtin/seed/index.mjs +1 -3
  97. package/dist/plugin/builtin/seed/seed-type-processor.d.mts +0 -2
  98. package/dist/plugin/{get-generated-type.d.mts → get-generated-table.d.mts} +5 -5
  99. package/dist/plugin/index.d.mts +3 -2
  100. package/dist/plugin/index.mjs +1 -251
  101. package/dist/plugin/index.mjs.map +1 -1
  102. package/dist/plugin/types.d.mts +30 -23
  103. package/dist/plugin/with-context.d.mts +3 -3
  104. package/dist/register-ts-hook-Drnaproy.mjs +640 -0
  105. package/dist/register-ts-hook-Drnaproy.mjs.map +1 -0
  106. package/dist/registry-HlEaGvl5.mjs +2 -0
  107. package/dist/{registry-BIGVUrMB.mjs.map → registry-HlEaGvl5.mjs.map} +1 -1
  108. package/dist/repl-editor-BG1aDOfH.mjs +2 -0
  109. package/dist/{repl-editor-F9LotMNx.mjs.map → repl-editor-BG1aDOfH.mjs.map} +1 -1
  110. package/dist/runtime/aigateway.mjs +1 -3
  111. package/dist/runtime/authconnection.mjs +1 -3
  112. package/dist/runtime/context.mjs +1 -3
  113. package/dist/runtime/file.d.mts +21 -21
  114. package/dist/runtime/file.mjs +1 -3
  115. package/dist/runtime/globals.mjs +1 -1
  116. package/dist/runtime/iconv.mjs +1 -3
  117. package/dist/runtime/idp.mjs +1 -3
  118. package/dist/runtime/index.mjs +1 -11
  119. package/dist/runtime/logger.mjs +1 -3
  120. package/dist/runtime/secretmanager.mjs +1 -3
  121. package/dist/runtime/types.d.mts +1 -1
  122. package/dist/runtime/workflow.mjs +1 -3
  123. package/dist/schema-Ze_dI5VX.mjs +2 -0
  124. package/dist/schema-Ze_dI5VX.mjs.map +1 -0
  125. package/dist/secret-file-C9wp_FCX.mjs +2 -0
  126. package/dist/{secret-file-C3J4Gy8r.mjs.map → secret-file-C9wp_FCX.mjs.map} +1 -1
  127. package/dist/secretmanager-5olfnI1b.mjs +2 -0
  128. package/dist/{secretmanager-IY4UvinW.mjs.map → secretmanager-5olfnI1b.mjs.map} +1 -1
  129. package/dist/secretmanager-vHQoXdQz.mjs +2 -0
  130. package/dist/{secretmanager-CYlpffsz.mjs.map → secretmanager-vHQoXdQz.mjs.map} +1 -1
  131. package/dist/seed/index.mjs +8 -244
  132. package/dist/seed/index.mjs.map +1 -1
  133. package/dist/seed-DwqRFdqP.mjs +207 -0
  134. package/dist/seed-DwqRFdqP.mjs.map +1 -0
  135. package/dist/service-BVe9u2Rt.mjs +7 -0
  136. package/dist/service-BVe9u2Rt.mjs.map +1 -0
  137. package/dist/service-CpZELSBa.mjs +1 -0
  138. package/dist/service-DlgaUO4V.mjs +2 -0
  139. package/dist/{service-LTfp03ZZ.mjs.map → service-DlgaUO4V.mjs.map} +1 -1
  140. package/dist/service_pb-DGKCLuAs.mjs +2 -0
  141. package/dist/{service_pb-BEWj1pOV.mjs.map → service_pb-DGKCLuAs.mjs.map} +1 -1
  142. package/dist/service_pb-_aeFE-Nv.mjs +1 -0
  143. package/dist/telemetry-Bklv9kQY.mjs +2 -0
  144. package/dist/{telemetry-BRVdwh14.mjs.map → telemetry-Bklv9kQY.mjs.map} +1 -1
  145. package/dist/telemetry-DXHP3VVi.mjs +1 -0
  146. package/dist/type-source--ZNcV8RJ.mjs +2 -0
  147. package/dist/type-source--ZNcV8RJ.mjs.map +1 -0
  148. package/dist/types/executor.generated.d.mts +1 -1
  149. package/dist/user-agent-vdHYF3QL.mjs +2 -0
  150. package/dist/{user-agent-Bgsszb5I.mjs.map → user-agent-vdHYF3QL.mjs.map} +1 -1
  151. package/dist/utils/test/index.mjs +1 -109
  152. package/dist/utils/test/index.mjs.map +1 -1
  153. package/dist/vitest/environment.mjs +1 -41
  154. package/dist/vitest/environment.mjs.map +1 -1
  155. package/dist/vitest/index.mjs +1 -1986
  156. package/dist/vitest/index.mjs.map +1 -1
  157. package/dist/vitest/mocks/file.d.mts +8 -8
  158. package/dist/vitest/setup.mjs +1 -140
  159. package/dist/vitest/setup.mjs.map +1 -1
  160. package/dist/wait-point-invoker-eiP-IIux.mjs +2 -0
  161. package/dist/wait-point-invoker-eiP-IIux.mjs.map +1 -0
  162. package/dist/wait-point-registry-BrkwfyjS.mjs +2 -0
  163. package/dist/{wait-point-registry-TL99zotw.mjs.map → wait-point-registry-BrkwfyjS.mjs.map} +1 -1
  164. package/dist/workflow-Cs9ISw6j.mjs +2 -0
  165. package/dist/{workflow-Bamae_Yc.mjs.map → workflow-Cs9ISw6j.mjs.map} +1 -1
  166. package/dist/workspace_resource_pb--GeYQPXu.mjs +2 -0
  167. package/dist/{workspace_resource_pb-HNIL_Vfj.mjs.map → workspace_resource_pb--GeYQPXu.mjs.map} +1 -1
  168. package/docs/cli/function.md +66 -6
  169. package/docs/cli/setup.md +24 -14
  170. package/docs/cli/tailordb.md +2 -0
  171. package/docs/cli-reference.md +9 -8
  172. package/docs/github-actions.md +10 -9
  173. package/docs/migration/v2.md +13 -1
  174. package/docs/migration/v3.md +82 -0
  175. package/docs/plugin/custom.md +130 -85
  176. package/docs/plugin/index.md +3 -3
  177. package/docs/services/tailordb-migration.md +21 -7
  178. package/docs/services/workflow.md +10 -9
  179. package/package.json +11 -11
  180. package/postinstall.mjs +1 -1
  181. package/dist/aigateway-DR4Kwuik.mjs +0 -9
  182. package/dist/application-C8a0UJ-z.mjs +0 -6071
  183. package/dist/application-C8a0UJ-z.mjs.map +0 -1
  184. package/dist/application-D4zOiLLa.mjs +0 -3
  185. package/dist/assert-DBxo8jPo.mjs +0 -9
  186. package/dist/authconnection-CZvi9ANm.mjs +0 -9
  187. package/dist/brand-Eo4pLXPJ.mjs +0 -36
  188. package/dist/context-DYQVYWqZ.mjs +0 -23
  189. package/dist/crashreport-Cd4TqfZq.mjs +0 -3
  190. package/dist/crashreport-Q0pDAlrj.mjs +0 -427
  191. package/dist/errors-Bxut5_Sy.mjs +0 -89
  192. package/dist/errors-Bxut5_Sy.mjs.map +0 -1
  193. package/dist/file-BUcmVIH2.mjs +0 -58
  194. package/dist/file-BUcmVIH2.mjs.map +0 -1
  195. package/dist/globals-B2nlxBrz.mjs +0 -126
  196. package/dist/iconv-QWaZh0TT.mjs +0 -38
  197. package/dist/idp-RA_swu-h.mjs +0 -82
  198. package/dist/interceptor-e33JtsC-.mjs +0 -33
  199. package/dist/logger-BtX0suGY.mjs +0 -48
  200. package/dist/logger-D0bEznPv.mjs +0 -362
  201. package/dist/multiline-sfHpTZZK.mjs +0 -38
  202. package/dist/node-builtins-CmaL2Cbq.mjs +0 -36
  203. package/dist/package-json-8b0O9TlX.mjs +0 -17
  204. package/dist/package-json-Cv2Z-TqQ.mjs +0 -3
  205. package/dist/platform-serialize-RoRtBS0v.mjs +0 -46
  206. package/dist/plugin/builtin/kysely-type/index.mjs.map +0 -1
  207. package/dist/plugin/builtin/seed/types.d.mts +0 -2
  208. package/dist/register-ts-hook-Vqjza10T.mjs +0 -25679
  209. package/dist/register-ts-hook-Vqjza10T.mjs.map +0 -1
  210. package/dist/registry-BIGVUrMB.mjs +0 -54
  211. package/dist/repl-editor-F9LotMNx.mjs +0 -252
  212. package/dist/schema-D4TC4BC3.mjs +0 -640
  213. package/dist/schema-D4TC4BC3.mjs.map +0 -1
  214. package/dist/secret-file-C3J4Gy8r.mjs +0 -64
  215. package/dist/secretmanager-CYlpffsz.mjs +0 -13
  216. package/dist/secretmanager-IY4UvinW.mjs +0 -131
  217. package/dist/seed-Cibjmtry.mjs +0 -489
  218. package/dist/seed-Cibjmtry.mjs.map +0 -1
  219. package/dist/service-2grcAOCJ.mjs +0 -898
  220. package/dist/service-2grcAOCJ.mjs.map +0 -1
  221. package/dist/service-CaBPNDIZ.mjs +0 -3
  222. package/dist/service-LTfp03ZZ.mjs +0 -133
  223. package/dist/service_pb-BEWj1pOV.mjs +0 -167
  224. package/dist/service_pb-BjlhvK9E.mjs +0 -3
  225. package/dist/telemetry-BRVdwh14.mjs +0 -84
  226. package/dist/telemetry-CkbkeJxl.mjs +0 -3
  227. package/dist/type-source-DH_LH20p.mjs +0 -13
  228. package/dist/type-source-DH_LH20p.mjs.map +0 -1
  229. package/dist/user-agent-Bgsszb5I.mjs +0 -28
  230. package/dist/wait-point-invoker-__oE88_P.mjs +0 -148
  231. package/dist/wait-point-invoker-__oE88_P.mjs.map +0 -1
  232. package/dist/wait-point-registry-TL99zotw.mjs +0 -47
  233. package/dist/workflow-Bamae_Yc.mjs +0 -34
  234. package/dist/workspace_resource_pb-HNIL_Vfj.mjs +0 -860
@@ -1,489 +0,0 @@
1
- import { t as assertDefined } from "./assert-DBxo8jPo.mjs";
2
- import { t as multiline } from "./multiline-sfHpTZZK.mjs";
3
- import { t as isPluginGeneratedType } from "./type-source-DH_LH20p.mjs";
4
- import * as path from "pathe";
5
-
6
- //#region src/plugin/builtin/seed/idp-user-processor.ts
7
- /**
8
- * Processes auth configuration to generate IdP user seed metadata
9
- * @param auth - Auth configuration from generator
10
- * @returns IdP user metadata or undefined if not applicable
11
- */
12
- function processIdpUser(auth) {
13
- if (auth.idProvider?.kind !== "BuiltInIdP" || !auth.userProfile) return;
14
- const { typeName, usernameField } = auth.userProfile;
15
- return {
16
- name: "_User",
17
- dependencies: [typeName],
18
- dataFile: "data/_User.jsonl",
19
- idpNamespace: auth.idProvider.namespace,
20
- schema: {
21
- usernameField,
22
- userTypeName: typeName
23
- }
24
- };
25
- }
26
- /**
27
- * Generates the server-side IDP seed script code for testExecScript execution.
28
- * Uses the global tailor.idp.Client - no bundling required.
29
- * @param idpNamespace - The IDP namespace name
30
- * @returns Script code string
31
- */
32
- function generateIdpSeedScriptCode(idpNamespace) {
33
- return multiline`
34
- export async function main(input) {
35
- const client = new tailor.idp.Client({ namespace: "${idpNamespace}" });
36
- const errors = [];
37
- let processed = 0;
38
- let created = 0;
39
- let updated = 0;
40
- let skipped = 0;
41
- const upsert = input.upsert === true;
42
-
43
- for (let i = 0; i < input.users.length; i++) {
44
- try {
45
- if (upsert) {
46
- let existing;
47
- let lookupError;
48
- try {
49
- existing = await client.userByName(input.users[i].name);
50
- } catch (error) {
51
- existing = undefined;
52
- lookupError = error instanceof Error ? error.message : String(error);
53
- }
54
-
55
- if (existing) {
56
- const { name, ...attributes } = input.users[i];
57
- if (Object.keys(attributes).length === 0) {
58
- skipped++;
59
- } else {
60
- await client.updateUser({ id: existing.id, ...attributes });
61
- updated++;
62
- }
63
- } else {
64
- try {
65
- await client.createUser(input.users[i]);
66
- created++;
67
- } catch (error) {
68
- const message = error instanceof Error ? error.message : String(error);
69
- throw new Error(
70
- lookupError ? \`create failed (\${message}); lookup failed (\${lookupError})\` : message,
71
- );
72
- }
73
- }
74
- } else {
75
- await client.createUser(input.users[i]);
76
- created++;
77
- }
78
- processed++;
79
- console.log(\`[_User] \${i + 1}/\${input.users.length}: \${input.users[i].name}\`);
80
- } catch (error) {
81
- const message = error instanceof Error ? error.message : String(error);
82
- errors.push(\`Row \${i} (\${input.users[i].name}): \${message}\`);
83
- console.error(\`[_User] Row \${i} failed: \${message}\`);
84
- }
85
- }
86
-
87
- return {
88
- success: errors.length === 0,
89
- processed,
90
- created,
91
- updated,
92
- skipped,
93
- errors,
94
- };
95
- }
96
- `;
97
- }
98
- /**
99
- * Generates the server-side IDP truncation script code for testExecScript execution.
100
- * Lists all users with pagination and deletes each one.
101
- * @param idpNamespace - The IDP namespace name
102
- * @returns Script code string
103
- */
104
- function generateIdpTruncateScriptCode(idpNamespace) {
105
- return multiline`
106
- export async function main() {
107
- const client = new tailor.idp.Client({ namespace: "${idpNamespace}" });
108
- const errors = [];
109
- let deleted = 0;
110
-
111
- // List all users with pagination
112
- let after = undefined;
113
- const allUsers = [];
114
- do {
115
- const response = await client.users(after ? { after } : undefined);
116
- allUsers.push(...(response.users || []));
117
- after = response.nextPageToken;
118
- } while (after);
119
-
120
- console.log(\`Found \${allUsers.length} IDP users to delete\`);
121
-
122
- for (const user of allUsers) {
123
- try {
124
- await client.deleteUser(user.id);
125
- deleted++;
126
- console.log(\`[_User] Deleted \${deleted}/\${allUsers.length}: \${user.name}\`);
127
- } catch (error) {
128
- const message = error instanceof Error ? error.message : String(error);
129
- errors.push(\`User \${user.id} (\${user.name}): \${message}\`);
130
- console.error(\`[_User] Delete failed for \${user.name}: \${message}\`);
131
- }
132
- }
133
-
134
- return {
135
- success: errors.length === 0,
136
- deleted,
137
- total: allUsers.length,
138
- errors,
139
- };
140
- }
141
- `;
142
- }
143
- /**
144
- * Generates the schema file content for IdP users. Emits the
145
- * `_User.name -> <userProfile>.<usernameField>` foreign key by default; pass
146
- * `includeUserProfileFK: false` to omit it (e.g. when seeding `_User` rows
147
- * that do not yet have a corresponding userProfile row).
148
- * @param options - Schema generation options
149
- * @param options.usernameField - Username field name
150
- * @param options.userTypeName - TailorDB user type name
151
- * @param options.includeUserProfileFK - Whether to emit the `_User -> userProfile` foreign key (default `true`)
152
- * @returns Schema file contents
153
- */
154
- function generateIdpUserSchemaFile(options) {
155
- const { usernameField, userTypeName, includeUserProfileFK = true } = options;
156
- const schemaBody = includeUserProfileFK ? multiline`
157
- primaryKey: "name",
158
- indexes: [
159
- { name: "_user_name_unique_idx", columns: ["name"], unique: true },
160
- ],
161
- foreignKeys: [
162
- {
163
- column: "name",
164
- references: {
165
- table: "${userTypeName}",
166
- column: "${usernameField}",
167
- },
168
- },
169
- ],
170
- ` : multiline`
171
- primaryKey: "name",
172
- indexes: [
173
- { name: "_user_name_unique_idx", columns: ["name"], unique: true },
174
- ],
175
- `;
176
- return multiline`
177
- import { t } from "@tailor-platform/sdk";
178
- import { defineSchema } from "@tailor-platform/sdk/seed";
179
- import { createStandardSchema } from "@tailor-platform/sdk/test";
180
-
181
- const schemaType = t.object({
182
- name: t.string(),
183
- password: t.string(),
184
- });
185
-
186
- // Simple identity hook for _User (no TailorDB backing table)
187
- export const hook = <T>(data: unknown) => data as T;
188
-
189
- export const schema = defineSchema(
190
- createStandardSchema(schemaType, hook),
191
- {
192
- ${schemaBody}
193
- }
194
- );
195
-
196
- `;
197
- }
198
-
199
- //#endregion
200
- //#region src/plugin/builtin/seed/lines-db-processor.ts
201
- /**
202
- * Processes TailorDB tables to generate lines-db metadata
203
- * @param type - Parsed TailorDB table
204
- * @param source - Source file info
205
- * @returns Generated lines-db metadata
206
- */
207
- function processLinesDb(type, source) {
208
- if (isPluginGeneratedType(source)) return processLinesDbForPluginType(type, source);
209
- if (!source.filePath) throw new Error(`Missing source info for table ${type.name}`);
210
- if (!source.exportName) throw new Error(`Missing export name for table ${type.name}`);
211
- const { optionalFields, omitFields, indexes, foreignKeys } = extractFieldMetadata(type);
212
- return {
213
- typeName: type.name,
214
- exportName: source.exportName,
215
- importPath: source.filePath,
216
- optionalFields,
217
- omitFields,
218
- foreignKeys,
219
- indexes
220
- };
221
- }
222
- /**
223
- * Process lines-db metadata for plugin-generated types
224
- * @param type - Parsed TailorDB table
225
- * @param source - Plugin-generated table source info
226
- * @returns Generated lines-db metadata with plugin source
227
- */
228
- function processLinesDbForPluginType(type, source) {
229
- const { optionalFields, omitFields, indexes, foreignKeys } = extractFieldMetadata(type);
230
- return {
231
- typeName: type.name,
232
- exportName: source.exportName,
233
- importPath: "",
234
- optionalFields,
235
- omitFields,
236
- foreignKeys,
237
- indexes,
238
- pluginSource: source
239
- };
240
- }
241
- /**
242
- * Extract field metadata from TailorDB table
243
- * @param type - Parsed TailorDB table
244
- * @returns Field metadata including optional fields, omit fields, indexes, and foreign keys
245
- */
246
- function extractFieldMetadata(type) {
247
- const optionalFields = ["id"];
248
- const omitFields = [];
249
- const indexes = [];
250
- const foreignKeys = [];
251
- for (const [fieldName, field] of Object.entries(type.fields)) {
252
- if (field.config.hooks?.create) optionalFields.push(fieldName);
253
- if (field.config.serial) omitFields.push(fieldName);
254
- if (field.config.unique) indexes.push({
255
- name: `${type.name.toLowerCase()}_${fieldName}_unique_idx`,
256
- columns: [fieldName],
257
- unique: true
258
- });
259
- }
260
- if (type.indexes) for (const [indexName, indexDef] of Object.entries(type.indexes)) indexes.push({
261
- name: indexName,
262
- columns: indexDef.fields,
263
- unique: indexDef.unique
264
- });
265
- for (const [fieldName, field] of Object.entries(type.fields)) if (field.relation) foreignKeys.push({
266
- column: fieldName,
267
- references: {
268
- table: field.relation.targetType,
269
- column: field.relation.key
270
- }
271
- });
272
- return {
273
- optionalFields,
274
- omitFields,
275
- indexes,
276
- foreignKeys
277
- };
278
- }
279
- /**
280
- * Generate schema options code for lines-db
281
- * @param foreignKeys - Foreign key definitions
282
- * @param indexes - Index definitions
283
- * @returns Schema options code string
284
- */
285
- function generateSchemaOptions(foreignKeys, indexes) {
286
- const schemaOptions = [];
287
- if (foreignKeys.length > 0) {
288
- schemaOptions.push(`foreignKeys: [`);
289
- foreignKeys.forEach((fk) => {
290
- schemaOptions.push(` ${JSON.stringify(fk)},`);
291
- });
292
- schemaOptions.push(`],`);
293
- }
294
- if (indexes.length > 0) {
295
- schemaOptions.push(`indexes: [`);
296
- indexes.forEach((index) => {
297
- schemaOptions.push(` ${JSON.stringify(index)},`);
298
- });
299
- schemaOptions.push("],");
300
- }
301
- return schemaOptions.length > 0 ? [
302
- "\n {",
303
- ...schemaOptions.map((option) => ` ${option}`),
304
- " }"
305
- ].join("\n") : "";
306
- }
307
- /**
308
- * Generates the schema file content for lines-db (for user-defined tables with import)
309
- * @param metadata - lines-db metadata
310
- * @param importPath - Import path for the TailorDB table
311
- * @returns Schema file contents
312
- */
313
- function generateLinesDbSchemaFile(metadata, importPath) {
314
- const { exportName, optionalFields, omitFields, foreignKeys, indexes } = metadata;
315
- const schemaTypeCode = multiline`
316
- const schemaType = t.object({
317
- ...${exportName}.pickFields(${JSON.stringify(optionalFields)}, { optional: true }),
318
- ...${exportName}.omitFields(${JSON.stringify([...optionalFields, ...omitFields])}),
319
- });
320
- `;
321
- const schemaOptionsCode = generateSchemaOptions(foreignKeys, indexes);
322
- return multiline`
323
- import { t } from "@tailor-platform/sdk";
324
- import { defineSchema } from "@tailor-platform/sdk/seed";
325
- import { createTailorDBHook, createStandardSchema } from "@tailor-platform/sdk/test";
326
- import { ${exportName} } from "${importPath}";
327
-
328
- ${schemaTypeCode}
329
-
330
- export const hook = createTailorDBHook(${exportName});
331
-
332
- export const schema = defineSchema(
333
- createStandardSchema(schemaType, hook, ${exportName}),${schemaOptionsCode}
334
- );
335
-
336
- `;
337
- }
338
- /**
339
- * Generates the schema file content using getGeneratedType API
340
- * (for plugin-generated types)
341
- * @param metadata - lines-db metadata (must have pluginSource)
342
- * @param params - Plugin import paths
343
- * @returns Schema file contents
344
- */
345
- function generateLinesDbSchemaFileWithPluginAPI(metadata, params) {
346
- const { typeName, exportName, optionalFields, omitFields, foreignKeys, indexes, pluginSource } = metadata;
347
- if (!pluginSource) throw new Error(`pluginSource is required for plugin-generated type "${typeName}"`);
348
- const { configImportPath, originalImportPath } = params;
349
- const schemaTypeCode = multiline`
350
- const schemaType = t.object({
351
- ...${exportName}.pickFields(${JSON.stringify(optionalFields)}, { optional: true }),
352
- ...${exportName}.omitFields(${JSON.stringify([...optionalFields, ...omitFields])}),
353
- });
354
- `;
355
- const schemaOptionsCode = generateSchemaOptions(foreignKeys, indexes);
356
- if (pluginSource.originalExportName && originalImportPath && pluginSource.generatedTypeKind) return multiline`
357
- import { join } from "node:path";
358
- import { t } from "@tailor-platform/sdk";
359
- import { getGeneratedType } from "@tailor-platform/sdk/plugin";
360
- import { defineSchema } from "@tailor-platform/sdk/seed";
361
- import { createTailorDBHook, createStandardSchema } from "@tailor-platform/sdk/test";
362
- import { ${pluginSource.originalExportName} } from "${originalImportPath}";
363
-
364
- const configPath = join(import.meta.dirname, "${configImportPath}");
365
- const ${exportName} = await getGeneratedType(configPath, "${pluginSource.pluginId}", ${pluginSource.originalExportName}, "${pluginSource.generatedTypeKind}");
366
-
367
- ${schemaTypeCode}
368
-
369
- export const hook = createTailorDBHook(${exportName});
370
-
371
- export const schema = defineSchema(
372
- createStandardSchema(schemaType, hook, ${exportName}),${schemaOptionsCode}
373
- );
374
-
375
- `;
376
- if (!pluginSource.generatedTypeKind) throw new Error(`Namespace plugin "${pluginSource.pluginId}" must provide generatedTypeKind for type "${typeName}"`);
377
- return multiline`
378
- import { join } from "node:path";
379
- import { t } from "@tailor-platform/sdk";
380
- import { getGeneratedType } from "@tailor-platform/sdk/plugin";
381
- import { defineSchema } from "@tailor-platform/sdk/seed";
382
- import { createTailorDBHook, createStandardSchema } from "@tailor-platform/sdk/test";
383
-
384
- const configPath = join(import.meta.dirname, "${configImportPath}");
385
- const ${exportName} = await getGeneratedType(configPath, "${pluginSource.pluginId}", null, "${pluginSource.generatedTypeKind}");
386
-
387
- ${schemaTypeCode}
388
-
389
- export const hook = createTailorDBHook(${exportName});
390
-
391
- export const schema = defineSchema(
392
- createStandardSchema(schemaType, hook, ${exportName}),${schemaOptionsCode}
393
- );
394
-
395
- `;
396
- }
397
-
398
- //#endregion
399
- //#region src/plugin/builtin/seed/index.ts
400
- /** Unique identifier for the seed generator plugin. */
401
- const SeedGeneratorID = "@tailor-platform/seed";
402
- function resolveIdpUserSyncFKs(option) {
403
- return {
404
- emitUserToIdpFK: !(option?.userToIdp ?? false),
405
- emitIdpToUserFK: !(option?.idpToUser ?? false)
406
- };
407
- }
408
- /**
409
- * Plugin that generates seed data and schema files consumed by the
410
- * `tailor seed` commands (@tailor-platform/sdk-plugin-seed).
411
- * @param options - Plugin options
412
- * @param options.distPath - Output directory path for generated seed files
413
- * @param options.machineUserName - Default machine user name for authentication
414
- * @param options.disableIdpUserSync - Skip emitting individual `_User <-> userProfile` foreign keys. Both directions are emitted by default; set a direction to `true` to relax that side.
415
- * @returns Plugin instance with onTailorDBReady hook
416
- */
417
- function seedPlugin(options) {
418
- return {
419
- id: SeedGeneratorID,
420
- description: "Generates seed data and schema files for the tailor seed CLI plugin",
421
- pluginConfig: options,
422
- async onTailorDBReady(ctx) {
423
- const files = [];
424
- const idpUser = ctx.auth ? processIdpUser(ctx.auth) ?? null : null;
425
- const idpUserSyncFKs = resolveIdpUserSyncFKs(ctx.pluginConfig.disableIdpUserSync);
426
- for (const ns of ctx.tailordb) for (const [typeName, type] of Object.entries(ns.types)) {
427
- const source = assertDefined(ns.sourceInfo.get(typeName), `source info missing for type: ${typeName}`);
428
- const linesDb = processLinesDb(type, source);
429
- if (idpUserSyncFKs.emitUserToIdpFK && idpUser && typeName === idpUser.schema.userTypeName) linesDb.foreignKeys.push({
430
- column: idpUser.schema.usernameField,
431
- references: {
432
- table: "_User",
433
- column: "name"
434
- }
435
- });
436
- files.push({
437
- path: path.join(ctx.pluginConfig.distPath, "data", `${linesDb.typeName}.jsonl`),
438
- content: "",
439
- skipIfExists: true
440
- });
441
- const schemaOutputPath = path.join(ctx.pluginConfig.distPath, "data", `${linesDb.typeName}.schema.ts`);
442
- if (linesDb.pluginSource && linesDb.pluginSource.pluginImportPath) {
443
- let originalImportPath;
444
- if (linesDb.pluginSource.originalFilePath && linesDb.pluginSource.originalExportName) {
445
- const relativePath = path.relative(path.dirname(schemaOutputPath), linesDb.pluginSource.originalFilePath);
446
- originalImportPath = relativePath.replace(/\.ts$/, "").startsWith(".") ? relativePath.replace(/\.ts$/, "") : `./${relativePath.replace(/\.ts$/, "")}`;
447
- }
448
- const params = {
449
- configImportPath: path.relative(path.dirname(schemaOutputPath), ctx.configPath),
450
- originalImportPath
451
- };
452
- const schemaContent = generateLinesDbSchemaFileWithPluginAPI(linesDb, params);
453
- files.push({
454
- path: schemaOutputPath,
455
- content: schemaContent
456
- });
457
- } else {
458
- const relativePath = path.relative(path.dirname(schemaOutputPath), linesDb.importPath);
459
- const typeImportPath = relativePath.replace(/\.ts$/, "").startsWith(".") ? relativePath.replace(/\.ts$/, "") : `./${relativePath.replace(/\.ts$/, "")}`;
460
- const schemaContent = generateLinesDbSchemaFile(linesDb, typeImportPath);
461
- files.push({
462
- path: schemaOutputPath,
463
- content: schemaContent
464
- });
465
- }
466
- }
467
- if (idpUser) {
468
- files.push({
469
- path: path.join(ctx.pluginConfig.distPath, idpUser.dataFile),
470
- content: "",
471
- skipIfExists: true
472
- });
473
- files.push({
474
- path: path.join(ctx.pluginConfig.distPath, "data", `${idpUser.name}.schema.ts`),
475
- content: generateIdpUserSchemaFile({
476
- usernameField: idpUser.schema.usernameField,
477
- userTypeName: idpUser.schema.userTypeName,
478
- includeUserProfileFK: idpUserSyncFKs.emitIdpToUserFK
479
- })
480
- });
481
- }
482
- return { files };
483
- }
484
- };
485
- }
486
-
487
- //#endregion
488
- export { generateIdpTruncateScriptCode as a, generateIdpSeedScriptCode as i, seedPlugin as n, processIdpUser as o, processLinesDb as r, SeedGeneratorID as t };
489
- //# sourceMappingURL=seed-Cibjmtry.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"seed-Cibjmtry.mjs","names":[],"sources":["../src/plugin/builtin/seed/idp-user-processor.ts","../src/plugin/builtin/seed/lines-db-processor.ts","../src/plugin/builtin/seed/index.ts"],"sourcesContent":["import ml from \"#/utils/multiline\";\nimport type { GeneratorAuthInput } from \"#/plugin/types\";\n\nexport interface IdpUserMetadata {\n name: \"_User\";\n dependencies: string[];\n dataFile: string;\n idpNamespace: string;\n schema: {\n usernameField: string;\n userTypeName: string;\n };\n}\n\n/**\n * Processes auth configuration to generate IdP user seed metadata\n * @param auth - Auth configuration from generator\n * @returns IdP user metadata or undefined if not applicable\n */\nexport function processIdpUser(auth: GeneratorAuthInput): IdpUserMetadata | undefined {\n // Only process if idProvider is BuiltInIdP and userProfile is defined\n if (auth.idProvider?.kind !== \"BuiltInIdP\" || !auth.userProfile) {\n return undefined;\n }\n\n const { typeName, usernameField } = auth.userProfile;\n\n return {\n name: \"_User\",\n dependencies: [typeName],\n dataFile: \"data/_User.jsonl\",\n idpNamespace: auth.idProvider.namespace,\n schema: {\n usernameField,\n userTypeName: typeName,\n },\n };\n}\n\n/**\n * Generates the server-side IDP seed script code for testExecScript execution.\n * Uses the global tailor.idp.Client - no bundling required.\n * @param idpNamespace - The IDP namespace name\n * @returns Script code string\n */\nexport function generateIdpSeedScriptCode(idpNamespace: string): string {\n return ml /* ts */ `\n export async function main(input) {\n const client = new tailor.idp.Client({ namespace: \"${idpNamespace}\" });\n const errors = [];\n let processed = 0;\n let created = 0;\n let updated = 0;\n let skipped = 0;\n const upsert = input.upsert === true;\n\n for (let i = 0; i < input.users.length; i++) {\n try {\n if (upsert) {\n let existing;\n let lookupError;\n try {\n existing = await client.userByName(input.users[i].name);\n } catch (error) {\n existing = undefined;\n lookupError = error instanceof Error ? error.message : String(error);\n }\n\n if (existing) {\n const { name, ...attributes } = input.users[i];\n if (Object.keys(attributes).length === 0) {\n skipped++;\n } else {\n await client.updateUser({ id: existing.id, ...attributes });\n updated++;\n }\n } else {\n try {\n await client.createUser(input.users[i]);\n created++;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(\n lookupError ? \\`create failed (\\${message}); lookup failed (\\${lookupError})\\` : message,\n );\n }\n }\n } else {\n await client.createUser(input.users[i]);\n created++;\n }\n processed++;\n console.log(\\`[_User] \\${i + 1}/\\${input.users.length}: \\${input.users[i].name}\\`);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n errors.push(\\`Row \\${i} (\\${input.users[i].name}): \\${message}\\`);\n console.error(\\`[_User] Row \\${i} failed: \\${message}\\`);\n }\n }\n\n return {\n success: errors.length === 0,\n processed,\n created,\n updated,\n skipped,\n errors,\n };\n }\n `;\n}\n\n/**\n * Generates the server-side IDP truncation script code for testExecScript execution.\n * Lists all users with pagination and deletes each one.\n * @param idpNamespace - The IDP namespace name\n * @returns Script code string\n */\nexport function generateIdpTruncateScriptCode(idpNamespace: string): string {\n return ml /* ts */ `\n export async function main() {\n const client = new tailor.idp.Client({ namespace: \"${idpNamespace}\" });\n const errors = [];\n let deleted = 0;\n\n // List all users with pagination\n let after = undefined;\n const allUsers = [];\n do {\n const response = await client.users(after ? { after } : undefined);\n allUsers.push(...(response.users || []));\n after = response.nextPageToken;\n } while (after);\n\n console.log(\\`Found \\${allUsers.length} IDP users to delete\\`);\n\n for (const user of allUsers) {\n try {\n await client.deleteUser(user.id);\n deleted++;\n console.log(\\`[_User] Deleted \\${deleted}/\\${allUsers.length}: \\${user.name}\\`);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n errors.push(\\`User \\${user.id} (\\${user.name}): \\${message}\\`);\n console.error(\\`[_User] Delete failed for \\${user.name}: \\${message}\\`);\n }\n }\n\n return {\n success: errors.length === 0,\n deleted,\n total: allUsers.length,\n errors,\n };\n }\n `;\n}\n\ntype GenerateIdpUserSchemaFileOptions = {\n usernameField: string;\n userTypeName: string;\n /**\n * When `true` (default), emit a foreign key from `_User.name` to the\n * userProfile type's username field so that seed validation rejects `_User`\n * rows without a matching userProfile row. Set to `false` to seed `_User`\n * rows that do not yet have a corresponding userProfile row.\n */\n includeUserProfileFK?: boolean;\n};\n\n/**\n * Generates the schema file content for IdP users. Emits the\n * `_User.name -> <userProfile>.<usernameField>` foreign key by default; pass\n * `includeUserProfileFK: false` to omit it (e.g. when seeding `_User` rows\n * that do not yet have a corresponding userProfile row).\n * @param options - Schema generation options\n * @param options.usernameField - Username field name\n * @param options.userTypeName - TailorDB user type name\n * @param options.includeUserProfileFK - Whether to emit the `_User -> userProfile` foreign key (default `true`)\n * @returns Schema file contents\n */\nexport function generateIdpUserSchemaFile(options: GenerateIdpUserSchemaFileOptions): string {\n const { usernameField, userTypeName, includeUserProfileFK = true } = options;\n const schemaBody = includeUserProfileFK\n ? ml`\n primaryKey: \"name\",\n indexes: [\n { name: \"_user_name_unique_idx\", columns: [\"name\"], unique: true },\n ],\n foreignKeys: [\n {\n column: \"name\",\n references: {\n table: \"${userTypeName}\",\n column: \"${usernameField}\",\n },\n },\n ],\n `\n : ml`\n primaryKey: \"name\",\n indexes: [\n { name: \"_user_name_unique_idx\", columns: [\"name\"], unique: true },\n ],\n `;\n\n return ml /* ts */ `\n import { t } from \"@tailor-platform/sdk\";\n import { defineSchema } from \"@tailor-platform/sdk/seed\";\n import { createStandardSchema } from \"@tailor-platform/sdk/test\";\n\n const schemaType = t.object({\n name: t.string(),\n password: t.string(),\n });\n\n // Simple identity hook for _User (no TailorDB backing table)\n export const hook = <T>(data: unknown) => data as T;\n\n export const schema = defineSchema(\n createStandardSchema(schemaType, hook),\n {\n ${schemaBody}\n }\n );\n\n `;\n}\n","import { isPluginGeneratedType } from \"#/parser/service/tailordb/type-source\";\nimport ml from \"#/utils/multiline\";\nimport type {\n PluginGeneratedTypeSource,\n TailorDBType,\n TypeSourceInfoEntry,\n} from \"#/parser/service/tailordb/types\";\nimport type { LinesDbMetadata } from \"./types\";\nimport type { ForeignKeyDefinition, IndexDefinition } from \"@toiroakr/lines-db\";\n\n/**\n * Processes TailorDB tables to generate lines-db metadata\n * @param type - Parsed TailorDB table\n * @param source - Source file info\n * @returns Generated lines-db metadata\n */\nexport function processLinesDb(type: TailorDBType, source: TypeSourceInfoEntry): LinesDbMetadata {\n if (isPluginGeneratedType(source)) {\n // Plugin-generated table\n return processLinesDbForPluginType(type, source);\n }\n\n // User-defined table\n if (!source.filePath) {\n throw new Error(`Missing source info for table ${type.name}`);\n }\n if (!source.exportName) {\n throw new Error(`Missing export name for table ${type.name}`);\n }\n\n const { optionalFields, omitFields, indexes, foreignKeys } = extractFieldMetadata(type);\n\n return {\n typeName: type.name,\n exportName: source.exportName,\n importPath: source.filePath,\n optionalFields,\n omitFields,\n foreignKeys,\n indexes,\n };\n}\n\n/**\n * Process lines-db metadata for plugin-generated types\n * @param type - Parsed TailorDB table\n * @param source - Plugin-generated table source info\n * @returns Generated lines-db metadata with plugin source\n */\nfunction processLinesDbForPluginType(\n type: TailorDBType,\n source: PluginGeneratedTypeSource,\n): LinesDbMetadata {\n const { optionalFields, omitFields, indexes, foreignKeys } = extractFieldMetadata(type);\n\n return {\n typeName: type.name,\n exportName: source.exportName,\n importPath: \"\",\n optionalFields,\n omitFields,\n foreignKeys,\n indexes,\n pluginSource: source,\n };\n}\n\n/**\n * Extract field metadata from TailorDB table\n * @param type - Parsed TailorDB table\n * @returns Field metadata including optional fields, omit fields, indexes, and foreign keys\n */\nfunction extractFieldMetadata(type: TailorDBType): {\n optionalFields: string[];\n omitFields: string[];\n indexes: IndexDefinition[];\n foreignKeys: ForeignKeyDefinition[];\n} {\n const optionalFields = [\"id\"]; // id is always optional\n const omitFields: string[] = [];\n const indexes: IndexDefinition[] = [];\n const foreignKeys: ForeignKeyDefinition[] = [];\n\n // Find fields with hooks.create or serial\n for (const [fieldName, field] of Object.entries(type.fields)) {\n if (field.config.hooks?.create) {\n optionalFields.push(fieldName);\n }\n // Serial fields are auto-generated, so they should be optional in seed data\n if (field.config.serial) {\n omitFields.push(fieldName);\n }\n if (field.config.unique) {\n indexes.push({\n name: `${type.name.toLowerCase()}_${fieldName}_unique_idx`,\n columns: [fieldName],\n unique: true,\n });\n }\n }\n\n // Extract indexes\n if (type.indexes) {\n for (const [indexName, indexDef] of Object.entries(type.indexes)) {\n indexes.push({\n name: indexName,\n columns: indexDef.fields,\n unique: indexDef.unique,\n });\n }\n }\n\n // Extract foreign keys from relations\n for (const [fieldName, field] of Object.entries(type.fields)) {\n if (field.relation) {\n foreignKeys.push({\n column: fieldName,\n references: {\n table: field.relation.targetType,\n column: field.relation.key,\n },\n });\n }\n }\n\n return { optionalFields, omitFields, indexes, foreignKeys };\n}\n\n/**\n * Generate schema options code for lines-db\n * @param foreignKeys - Foreign key definitions\n * @param indexes - Index definitions\n * @returns Schema options code string\n */\nfunction generateSchemaOptions(\n foreignKeys: ForeignKeyDefinition[],\n indexes: IndexDefinition[],\n): string {\n const schemaOptions: string[] = [];\n\n if (foreignKeys.length > 0) {\n schemaOptions.push(`foreignKeys: [`);\n foreignKeys.forEach((fk) => {\n schemaOptions.push(` ${JSON.stringify(fk)},`);\n });\n schemaOptions.push(`],`);\n }\n\n if (indexes.length > 0) {\n schemaOptions.push(`indexes: [`);\n indexes.forEach((index) => {\n schemaOptions.push(` ${JSON.stringify(index)},`);\n });\n schemaOptions.push(\"],\");\n }\n\n return schemaOptions.length > 0\n ? [\"\\n {\", ...schemaOptions.map((option) => ` ${option}`), \" }\"].join(\"\\n\")\n : \"\";\n}\n\n/**\n * Generates the schema file content for lines-db (for user-defined tables with import)\n * @param metadata - lines-db metadata\n * @param importPath - Import path for the TailorDB table\n * @returns Schema file contents\n */\nexport function generateLinesDbSchemaFile(metadata: LinesDbMetadata, importPath: string): string {\n const { exportName, optionalFields, omitFields, foreignKeys, indexes } = metadata;\n\n const schemaTypeCode = ml /* ts */ `\n const schemaType = t.object({\n ...${exportName}.pickFields(${JSON.stringify(optionalFields)}, { optional: true }),\n ...${exportName}.omitFields(${JSON.stringify([...optionalFields, ...omitFields])}),\n });\n `;\n\n const schemaOptionsCode = generateSchemaOptions(foreignKeys, indexes);\n\n return ml /* ts */ `\n import { t } from \"@tailor-platform/sdk\";\n import { defineSchema } from \"@tailor-platform/sdk/seed\";\n import { createTailorDBHook, createStandardSchema } from \"@tailor-platform/sdk/test\";\n import { ${exportName} } from \"${importPath}\";\n\n ${schemaTypeCode}\n\n export const hook = createTailorDBHook(${exportName});\n\n export const schema = defineSchema(\n createStandardSchema(schemaType, hook, ${exportName}),${schemaOptionsCode}\n );\n\n `;\n}\n\n/**\n * Parameters for generating plugin-type schema file\n */\nexport interface PluginSchemaParams {\n /** Relative path from schema output to tailor.config.ts */\n configImportPath: string;\n /** Relative import path to the original table file (for type-attached plugins) */\n originalImportPath?: string;\n}\n\n/**\n * Generates the schema file content using getGeneratedType API\n * (for plugin-generated types)\n * @param metadata - lines-db metadata (must have pluginSource)\n * @param params - Plugin import paths\n * @returns Schema file contents\n */\nexport function generateLinesDbSchemaFileWithPluginAPI(\n metadata: LinesDbMetadata,\n params: PluginSchemaParams,\n): string {\n const { typeName, exportName, optionalFields, omitFields, foreignKeys, indexes, pluginSource } =\n metadata;\n\n if (!pluginSource) {\n throw new Error(`pluginSource is required for plugin-generated type \"${typeName}\"`);\n }\n\n const { configImportPath, originalImportPath } = params;\n\n const schemaTypeCode = ml /* ts */ `\n const schemaType = t.object({\n ...${exportName}.pickFields(${JSON.stringify(optionalFields)}, { optional: true }),\n ...${exportName}.omitFields(${JSON.stringify([...optionalFields, ...omitFields])}),\n });\n `;\n\n const schemaOptionsCode = generateSchemaOptions(foreignKeys, indexes);\n\n // Type-attached plugin (e.g., changeset): import the original table and use getGeneratedType(configPath, pluginId, type, kind)\n if (pluginSource.originalExportName && originalImportPath && pluginSource.generatedTypeKind) {\n return ml /* ts */ `\n import { join } from \"node:path\";\n import { t } from \"@tailor-platform/sdk\";\n import { getGeneratedType } from \"@tailor-platform/sdk/plugin\";\n import { defineSchema } from \"@tailor-platform/sdk/seed\";\n import { createTailorDBHook, createStandardSchema } from \"@tailor-platform/sdk/test\";\n import { ${pluginSource.originalExportName} } from \"${originalImportPath}\";\n\n const configPath = join(import.meta.dirname, \"${configImportPath}\");\n const ${exportName} = await getGeneratedType(configPath, \"${pluginSource.pluginId}\", ${pluginSource.originalExportName}, \"${pluginSource.generatedTypeKind}\");\n\n ${schemaTypeCode}\n\n export const hook = createTailorDBHook(${exportName});\n\n export const schema = defineSchema(\n createStandardSchema(schemaType, hook, ${exportName}),${schemaOptionsCode}\n );\n\n `;\n }\n\n // Namespace plugin (e.g., audit-log): use getGeneratedType(configPath, pluginId, null, kind)\n // For namespace plugins, generatedTypeKind is required\n if (!pluginSource.generatedTypeKind) {\n throw new Error(\n `Namespace plugin \"${pluginSource.pluginId}\" must provide generatedTypeKind for type \"${typeName}\"`,\n );\n }\n\n return ml /* ts */ `\n import { join } from \"node:path\";\n import { t } from \"@tailor-platform/sdk\";\n import { getGeneratedType } from \"@tailor-platform/sdk/plugin\";\n import { defineSchema } from \"@tailor-platform/sdk/seed\";\n import { createTailorDBHook, createStandardSchema } from \"@tailor-platform/sdk/test\";\n\n const configPath = join(import.meta.dirname, \"${configImportPath}\");\n const ${exportName} = await getGeneratedType(configPath, \"${pluginSource.pluginId}\", null, \"${pluginSource.generatedTypeKind}\");\n\n ${schemaTypeCode}\n\n export const hook = createTailorDBHook(${exportName});\n\n export const schema = defineSchema(\n createStandardSchema(schemaType, hook, ${exportName}),${schemaOptionsCode}\n );\n\n `;\n}\n","import * as path from \"pathe\";\nimport { assertDefined } from \"#/utils/assert\";\nimport { processIdpUser, generateIdpUserSchemaFile } from \"./idp-user-processor\";\nimport {\n processLinesDb,\n generateLinesDbSchemaFile,\n generateLinesDbSchemaFileWithPluginAPI,\n type PluginSchemaParams,\n} from \"./lines-db-processor\";\nimport type { Plugin, GeneratorResult, TailorDBReadyContext } from \"#/plugin/types\";\n\n/** Unique identifier for the seed generator plugin. */\nexport const SeedGeneratorID = \"@tailor-platform/seed\";\n\ntype DisableIdpUserSyncDirections = {\n /**\n * Skip emitting the foreign key from `<userProfile>.<usernameField>` to\n * `_User.name`. Defaults to `false` (FK emitted).\n *\n * Set to `true` to seed pre-registration states such as\n * invited-but-not-registered users.\n */\n userToIdp?: boolean;\n /**\n * Skip emitting the foreign key from `_User.name` to\n * `<userProfile>.<usernameField>`. Defaults to `false` (FK emitted).\n *\n * Set to `true` to seed `_User` rows that do not yet have a corresponding\n * userProfile row.\n */\n idpToUser?: boolean;\n};\n\nexport type SeedPluginOptions = {\n distPath: string;\n machineUserName?: string;\n /**\n * Disable individual `_User <-> userProfile` foreign keys emitted into\n * the generated seed schema. Both directions are emitted by default.\n *\n * Set a direction to `true` to relax it — for example to seed invited\n * users that do not yet have an IdP credential.\n */\n disableIdpUserSync?: DisableIdpUserSyncDirections;\n};\n\nfunction resolveIdpUserSyncFKs(option: SeedPluginOptions[\"disableIdpUserSync\"]): {\n emitUserToIdpFK: boolean;\n emitIdpToUserFK: boolean;\n} {\n return {\n emitUserToIdpFK: !(option?.userToIdp ?? false),\n emitIdpToUserFK: !(option?.idpToUser ?? false),\n };\n}\n/**\n * Plugin that generates seed data and schema files consumed by the\n * `tailor seed` commands (@tailor-platform/sdk-plugin-seed).\n * @param options - Plugin options\n * @param options.distPath - Output directory path for generated seed files\n * @param options.machineUserName - Default machine user name for authentication\n * @param options.disableIdpUserSync - Skip emitting individual `_User <-> userProfile` foreign keys. Both directions are emitted by default; set a direction to `true` to relax that side.\n * @returns Plugin instance with onTailorDBReady hook\n */\nexport function seedPlugin(options: SeedPluginOptions): Plugin<unknown, SeedPluginOptions> {\n return {\n id: SeedGeneratorID,\n description: \"Generates seed data and schema files for the tailor seed CLI plugin\",\n pluginConfig: options,\n\n async onTailorDBReady(ctx: TailorDBReadyContext<SeedPluginOptions>): Promise<GeneratorResult> {\n const files: GeneratorResult[\"files\"] = [];\n\n // Process IdP user early so we can add reverse FK to the user profile type\n const idpUser = ctx.auth ? (processIdpUser(ctx.auth) ?? null) : null;\n const idpUserSyncFKs = resolveIdpUserSyncFKs(ctx.pluginConfig.disableIdpUserSync);\n\n for (const ns of ctx.tailordb) {\n for (const [typeName, type] of Object.entries(ns.types)) {\n const source = assertDefined(\n ns.sourceInfo.get(typeName),\n `source info missing for type: ${typeName}`,\n );\n const linesDb = processLinesDb(type, source);\n\n // Add reverse FK from userProfile type to _User (opt-out via disableIdpUserSync.userToIdp: true)\n if (\n idpUserSyncFKs.emitUserToIdpFK &&\n idpUser &&\n typeName === idpUser.schema.userTypeName\n ) {\n linesDb.foreignKeys.push({\n column: idpUser.schema.usernameField,\n references: {\n table: \"_User\",\n column: \"name\",\n },\n });\n }\n\n // Generate empty JSONL data file\n files.push({\n path: path.join(ctx.pluginConfig.distPath, \"data\", `${linesDb.typeName}.jsonl`),\n content: \"\",\n skipIfExists: true,\n });\n\n const schemaOutputPath = path.join(\n ctx.pluginConfig.distPath,\n \"data\",\n `${linesDb.typeName}.schema.ts`,\n );\n\n // Plugin-generated type: use getGeneratedType API\n if (linesDb.pluginSource && linesDb.pluginSource.pluginImportPath) {\n // Build original type import path\n let originalImportPath: string | undefined;\n if (linesDb.pluginSource.originalFilePath && linesDb.pluginSource.originalExportName) {\n const relativePath = path.relative(\n path.dirname(schemaOutputPath),\n linesDb.pluginSource.originalFilePath,\n );\n originalImportPath = relativePath.replace(/\\.ts$/, \"\").startsWith(\".\")\n ? relativePath.replace(/\\.ts$/, \"\")\n : `./${relativePath.replace(/\\.ts$/, \"\")}`;\n }\n\n // Compute relative path from schema output to config file\n const configImportPath = path.relative(path.dirname(schemaOutputPath), ctx.configPath);\n\n const params: PluginSchemaParams = {\n configImportPath,\n originalImportPath,\n };\n\n const schemaContent = generateLinesDbSchemaFileWithPluginAPI(linesDb, params);\n\n files.push({\n path: schemaOutputPath,\n content: schemaContent,\n });\n } else {\n // User-defined type: import from source file\n const relativePath = path.relative(path.dirname(schemaOutputPath), linesDb.importPath);\n const typeImportPath = relativePath.replace(/\\.ts$/, \"\").startsWith(\".\")\n ? relativePath.replace(/\\.ts$/, \"\")\n : `./${relativePath.replace(/\\.ts$/, \"\")}`;\n const schemaContent = generateLinesDbSchemaFile(linesDb, typeImportPath);\n\n files.push({\n path: schemaOutputPath,\n content: schemaContent,\n });\n }\n }\n }\n\n if (idpUser) {\n // Generate empty JSONL data file\n files.push({\n path: path.join(ctx.pluginConfig.distPath, idpUser.dataFile),\n content: \"\",\n skipIfExists: true,\n });\n\n // Generate schema file with foreign key (opt-out via disableIdpUserSync.idpToUser: true)\n files.push({\n path: path.join(ctx.pluginConfig.distPath, \"data\", `${idpUser.name}.schema.ts`),\n content: generateIdpUserSchemaFile({\n usernameField: idpUser.schema.usernameField,\n userTypeName: idpUser.schema.userTypeName,\n includeUserProfileFK: idpUserSyncFKs.emitIdpToUserFK,\n }),\n });\n }\n\n return { files };\n },\n };\n}\n"],"mappings":";;;;;;;;;;;AAmBA,SAAgB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