jazz-tools 2.0.0-alpha.70 → 2.0.0-beta.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 (238) hide show
  1. package/README.md +2 -3
  2. package/bin/jazz-tools.js +0 -3
  3. package/dist/accounts/account-manager-core.d.ts +54 -1
  4. package/dist/accounts/account-manager-core.d.ts.map +1 -1
  5. package/dist/accounts/account-manager-core.js +2 -2
  6. package/dist/accounts/account-manager-core.js.map +1 -1
  7. package/dist/accounts/context.js +1 -1
  8. package/dist/accounts/context.js.map +1 -1
  9. package/dist/backend/api.d.ts +1 -2
  10. package/dist/backend/api.d.ts.map +1 -1
  11. package/dist/backend/api.js +0 -2
  12. package/dist/backend/api.js.map +1 -1
  13. package/dist/backend/create-jazz.d.ts +0 -6
  14. package/dist/backend/create-jazz.d.ts.map +1 -1
  15. package/dist/backend/create-jazz.js +1 -1
  16. package/dist/backend/create-jazz.js.map +1 -1
  17. package/dist/backend/inspector-ui/11.js +2 -2
  18. package/dist/backend/inspector-ui/12.js +2 -2
  19. package/dist/backend/inspector-ui/13.js +2 -2
  20. package/dist/backend/inspector-ui/14.js +2 -2
  21. package/dist/backend/inspector-ui/20.js +1 -1
  22. package/dist/backend/inspector-ui-files.js +4 -4
  23. package/dist/backend/no-account-error.d.ts +1 -1
  24. package/dist/backend/no-account-error.js +1 -1
  25. package/dist/backend/no-account-error.js.map +1 -1
  26. package/dist/cli.d.ts +0 -1
  27. package/dist/cli.d.ts.map +1 -1
  28. package/dist/cli.js +8 -22
  29. package/dist/cli.js.map +1 -1
  30. package/dist/client/index.d.ts +0 -1
  31. package/dist/client/index.d.ts.map +1 -1
  32. package/dist/client/index.js +0 -2
  33. package/dist/client/index.js.map +1 -1
  34. package/dist/dev/app-files.js +1 -1
  35. package/dist/dev/app-files.js.map +1 -1
  36. package/dist/dev/catalogue-api.d.ts.map +1 -1
  37. package/dist/dev/catalogue-api.js +3 -6
  38. package/dist/dev/catalogue-api.js.map +1 -1
  39. package/dist/dev/inspector-overlay/embedded/assets/{index-D3RK8wNj.js → index-DUKUt96e.js} +3 -3
  40. package/dist/dev/inspector-overlay/embedded/assets/{jazz-broker-worker-EyaWhBtz.js → jazz-broker-worker-C_mr9Omd.js} +2 -2
  41. package/dist/dev/inspector-overlay/embedded/assets/{jazz_wasm-O10pptvY.js → jazz_wasm-BOvbCHn3.js} +1 -1
  42. package/dist/dev/inspector-overlay/embedded/assets/{jazz_wasm_bg-wI43fvvq.wasm → jazz_wasm_bg-BG8gazqt.wasm} +0 -0
  43. package/dist/dev/inspector-overlay/embedded/embedded.html +1 -1
  44. package/dist/dev/project.js +1 -1
  45. package/dist/dev/project.js.map +1 -1
  46. package/dist/dev/ts-project.d.ts.map +1 -1
  47. package/dist/dev/ts-project.js +3 -2
  48. package/dist/dev/ts-project.js.map +1 -1
  49. package/dist/expo/create-account-manager.d.ts +1 -1
  50. package/dist/expo/create-account-manager.js.map +1 -1
  51. package/dist/expo/index.d.ts +1 -2
  52. package/dist/expo/index.d.ts.map +1 -1
  53. package/dist/expo/index.js +1 -3
  54. package/dist/expo/index.js.map +1 -1
  55. package/dist/index.d.ts +0 -2
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +0 -4
  58. package/dist/index.js.map +1 -1
  59. package/dist/printer/index.d.ts +2 -2
  60. package/dist/printer/index.d.ts.map +1 -1
  61. package/dist/printer/index.js +4 -1
  62. package/dist/printer/index.js.map +1 -1
  63. package/dist/react/index.d.ts +1 -2
  64. package/dist/react/index.d.ts.map +1 -1
  65. package/dist/react/index.js +1 -3
  66. package/dist/react/index.js.map +1 -1
  67. package/dist/react/provider.d.ts +0 -2
  68. package/dist/react/provider.d.ts.map +1 -1
  69. package/dist/react/provider.js +1 -2
  70. package/dist/react/provider.js.map +1 -1
  71. package/dist/react-core/index.d.ts +1 -2
  72. package/dist/react-core/index.d.ts.map +1 -1
  73. package/dist/react-core/index.js +3 -5
  74. package/dist/react-core/index.js.map +1 -1
  75. package/dist/react-core/provider.d.ts +0 -8
  76. package/dist/react-core/provider.d.ts.map +1 -1
  77. package/dist/react-core/provider.js +0 -13
  78. package/dist/react-core/provider.js.map +1 -1
  79. package/dist/react-native/create-account-manager.d.ts +1 -1
  80. package/dist/react-native/create-account-manager.js.map +1 -1
  81. package/dist/react-native/index.d.ts +1 -3
  82. package/dist/react-native/index.d.ts.map +1 -1
  83. package/dist/react-native/index.js +1 -5
  84. package/dist/react-native/index.js.map +1 -1
  85. package/dist/react-native/provider.d.ts +0 -2
  86. package/dist/react-native/provider.d.ts.map +1 -1
  87. package/dist/react-native/provider.js +1 -2
  88. package/dist/react-native/provider.js.map +1 -1
  89. package/dist/runtime/db.d.ts +0 -5
  90. package/dist/runtime/db.d.ts.map +1 -1
  91. package/dist/runtime/db.js +0 -5
  92. package/dist/runtime/db.js.map +1 -1
  93. package/dist/runtime/native-artifact-fingerprint-napi.d.ts +1 -1
  94. package/dist/runtime/native-artifact-fingerprint-napi.js +1 -1
  95. package/dist/runtime/native-artifact-fingerprint-napi.js.map +1 -1
  96. package/dist/runtime/native-artifact-fingerprint-wasm.d.ts +1 -1
  97. package/dist/runtime/native-artifact-fingerprint-wasm.js +1 -1
  98. package/dist/runtime/native-artifact-fingerprint-wasm.js.map +1 -1
  99. package/dist/runtime/native-artifact-fingerprints.d.ts +2 -2
  100. package/dist/schema-builders.d.ts +0 -7
  101. package/dist/schema-builders.d.ts.map +1 -1
  102. package/dist/schema-builders.js +0 -7
  103. package/dist/schema-builders.js.map +1 -1
  104. package/dist/session/create-jazz-session.d.ts +1 -1
  105. package/dist/session/create-jazz-session.d.ts.map +1 -1
  106. package/dist/session/create-jazz-session.js.map +1 -1
  107. package/dist/solid/index.d.ts +1 -2
  108. package/dist/solid/index.d.ts.map +1 -1
  109. package/dist/solid/index.js +7 -8
  110. package/dist/solid/index.ssr.js +2 -3
  111. package/dist/solid/provider.d.ts +1 -12
  112. package/dist/solid/provider.d.ts.map +1 -1
  113. package/dist/solid/provider.js +12 -18
  114. package/dist/solid/provider.js.map +1 -1
  115. package/dist/solid/provider.ssr.js +1 -11
  116. package/dist/solid/provider.ssr.js.map +1 -1
  117. package/dist/svelte/context.svelte.d.ts +1 -12
  118. package/dist/svelte/context.svelte.d.ts.map +1 -1
  119. package/dist/svelte/context.svelte.js +2 -20
  120. package/dist/svelte/index.d.ts +1 -2
  121. package/dist/svelte/index.d.ts.map +1 -1
  122. package/dist/svelte/index.js +1 -3
  123. package/dist/thin/index.d.ts +0 -1
  124. package/dist/thin/index.d.ts.map +1 -1
  125. package/dist/thin/index.js +0 -2
  126. package/dist/thin/index.js.map +1 -1
  127. package/dist/typed-app.d.ts +1 -1
  128. package/dist/typed-app.js.map +1 -1
  129. package/dist/vue/index.d.ts +1 -2
  130. package/dist/vue/index.d.ts.map +1 -1
  131. package/dist/vue/index.js +1 -3
  132. package/dist/vue/index.js.map +1 -1
  133. package/dist/vue/provider.d.ts +2 -35
  134. package/dist/vue/provider.d.ts.map +1 -1
  135. package/dist/vue/provider.js +1 -135
  136. package/dist/vue/provider.js.map +1 -1
  137. package/dist/web/lazy-local-first.d.ts +0 -3
  138. package/dist/web/lazy-local-first.d.ts.map +1 -1
  139. package/dist/web/lazy-local-first.js +1 -6
  140. package/dist/web/lazy-local-first.js.map +1 -1
  141. package/dist/worker/jazz-broker-worker.js +2 -2
  142. package/dist/worker/jazz_wasm_bg.wasm +0 -0
  143. package/package.json +4 -8
  144. package/dist/accounts/create-account-manager.d.ts +0 -57
  145. package/dist/accounts/create-account-manager.d.ts.map +0 -1
  146. package/dist/accounts/create-account-manager.js +0 -17
  147. package/dist/accounts/create-account-manager.js.map +0 -1
  148. package/dist/permissions/index.d.ts +0 -5
  149. package/dist/permissions/index.d.ts.map +0 -1
  150. package/dist/permissions/index.js +0 -11
  151. package/dist/permissions/index.js.map +0 -1
  152. package/dist/removed-api.d.ts +0 -87
  153. package/dist/removed-api.d.ts.map +0 -1
  154. package/dist/removed-api.js +0 -95
  155. package/dist/removed-api.js.map +0 -1
  156. package/dist/removed-schema-api.d.ts +0 -80
  157. package/dist/removed-schema-api.d.ts.map +0 -1
  158. package/dist/removed-schema-api.js +0 -128
  159. package/dist/removed-schema-api.js.map +0 -1
  160. package/dist/session/deprecated-session-hook.d.ts +0 -8
  161. package/dist/session/deprecated-session-hook.d.ts.map +0 -1
  162. package/dist/session/deprecated-session-hook.js +0 -28
  163. package/dist/session/deprecated-session-hook.js.map +0 -1
  164. package/dist/svelte/JazzSvelteProvider.svelte +0 -181
  165. package/dist/svelte/JazzSvelteProvider.svelte.d.ts +0 -14
  166. package/dist/svelte/JazzSvelteProvider.svelte.d.ts.map +0 -1
  167. package/dist/upgrade/aliases.d.ts +0 -25
  168. package/dist/upgrade/aliases.d.ts.map +0 -1
  169. package/dist/upgrade/aliases.js +0 -80
  170. package/dist/upgrade/aliases.js.map +0 -1
  171. package/dist/upgrade/app-json.d.ts +0 -32
  172. package/dist/upgrade/app-json.d.ts.map +0 -1
  173. package/dist/upgrade/app-json.js +0 -145
  174. package/dist/upgrade/app-json.js.map +0 -1
  175. package/dist/upgrade/constants.d.ts +0 -25
  176. package/dist/upgrade/constants.d.ts.map +0 -1
  177. package/dist/upgrade/constants.js +0 -136
  178. package/dist/upgrade/constants.js.map +0 -1
  179. package/dist/upgrade/edits.d.ts +0 -10
  180. package/dist/upgrade/edits.d.ts.map +0 -1
  181. package/dist/upgrade/edits.js +0 -21
  182. package/dist/upgrade/edits.js.map +0 -1
  183. package/dist/upgrade/errors.d.ts +0 -12
  184. package/dist/upgrade/errors.d.ts.map +0 -1
  185. package/dist/upgrade/errors.js +0 -18
  186. package/dist/upgrade/errors.js.map +0 -1
  187. package/dist/upgrade/extras.d.ts +0 -42
  188. package/dist/upgrade/extras.d.ts.map +0 -1
  189. package/dist/upgrade/extras.js +0 -487
  190. package/dist/upgrade/extras.js.map +0 -1
  191. package/dist/upgrade/fresh.d.ts +0 -36
  192. package/dist/upgrade/fresh.d.ts.map +0 -1
  193. package/dist/upgrade/fresh.js +0 -154
  194. package/dist/upgrade/fresh.js.map +0 -1
  195. package/dist/upgrade/index.d.ts +0 -79
  196. package/dist/upgrade/index.d.ts.map +0 -1
  197. package/dist/upgrade/index.js +0 -806
  198. package/dist/upgrade/index.js.map +0 -1
  199. package/dist/upgrade/json-only.d.ts +0 -24
  200. package/dist/upgrade/json-only.d.ts.map +0 -1
  201. package/dist/upgrade/json-only.js +0 -124
  202. package/dist/upgrade/json-only.js.map +0 -1
  203. package/dist/upgrade/names.d.ts +0 -29
  204. package/dist/upgrade/names.d.ts.map +0 -1
  205. package/dist/upgrade/names.js +0 -105
  206. package/dist/upgrade/names.js.map +0 -1
  207. package/dist/upgrade/payload-enums.d.ts +0 -18
  208. package/dist/upgrade/payload-enums.d.ts.map +0 -1
  209. package/dist/upgrade/payload-enums.js +0 -52
  210. package/dist/upgrade/payload-enums.js.map +0 -1
  211. package/dist/upgrade/permissions-check.d.ts +0 -10
  212. package/dist/upgrade/permissions-check.d.ts.map +0 -1
  213. package/dist/upgrade/permissions-check.js +0 -85
  214. package/dist/upgrade/permissions-check.js.map +0 -1
  215. package/dist/upgrade/program.d.ts +0 -18
  216. package/dist/upgrade/program.d.ts.map +0 -1
  217. package/dist/upgrade/program.js +0 -56
  218. package/dist/upgrade/program.js.map +0 -1
  219. package/dist/upgrade/project.d.ts +0 -56
  220. package/dist/upgrade/project.d.ts.map +0 -1
  221. package/dist/upgrade/project.js +0 -254
  222. package/dist/upgrade/project.js.map +0 -1
  223. package/dist/upgrade/rewrite.d.ts +0 -34
  224. package/dist/upgrade/rewrite.d.ts.map +0 -1
  225. package/dist/upgrade/rewrite.js +0 -500
  226. package/dist/upgrade/rewrite.js.map +0 -1
  227. package/dist/upgrade/schema-ts.d.ts +0 -59
  228. package/dist/upgrade/schema-ts.d.ts.map +0 -1
  229. package/dist/upgrade/schema-ts.js +0 -582
  230. package/dist/upgrade/schema-ts.js.map +0 -1
  231. package/dist/upgrade/snapshot.d.ts +0 -11
  232. package/dist/upgrade/snapshot.d.ts.map +0 -1
  233. package/dist/upgrade/snapshot.js +0 -90
  234. package/dist/upgrade/snapshot.js.map +0 -1
  235. package/dist/upgrade/upgrade-test-helpers.d.ts +0 -12
  236. package/dist/upgrade/upgrade-test-helpers.d.ts.map +0 -1
  237. package/dist/upgrade/upgrade-test-helpers.js +0 -72
  238. package/dist/upgrade/upgrade-test-helpers.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/upgrade/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EACL,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,SAAS,EACT,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEtE,OAAO,EAAE,gBAAgB,EAAsC,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,QAAQ,EACR,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACzD,O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C,GAAG,mDAAmD,EAC3I,MAAM,CAAC,UAAU,CAClB,CAAC;IACN,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,eAAe,CAAC,MAAkC;IAChE,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,KAAK,MAAM,EAAE,GAAG,EAAE,IAAI,MAAM;QAAE,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1E,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC7B,MAA+C,EAC/C,KAA+C;IAE/C,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAChC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC;YACjC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAChC,CAAC","sourcesContent":["/**\n * `jazz-tools upgrade`: convert an alpha.65 app (schema.ts with `defineApp`,\n * the callback permissions.ts, migrations/ with its index.ts) to alpha.66,\n * where TS is the source again: `schema.ts` exports `schema`\n * (`s.defineSchema`) and `permissions` (`definePermissions`), and `generate`\n * writes jazz.app.json, jazz.permissions.json and jazz.generated.ts from it.\n *\n * 1. The app's own jazz-tools (alpha.65) must find its JSON files fresh.\n * 2. schema.ts: `defineApp(schema, { migrations })` → `export const schema =\n * s.defineSchema({…})`, keeping the author's comments; the app and row\n * types come from jazz.generated.ts, other exports move to app-extras.ts.\n * 3. The permissions are printed from the fresh jazz.permissions.json into\n * schema.ts (or permissions.ts, when the old one was large); a spread\n * tables module (Better Auth's) exports `tables` and `permissions`.\n * 4. Imports of `./schema` go to `./jazz.generated`, `app.slice(…)` becomes\n * `app`, and scripts calling `validate` call `generate`.\n * 5. migrations/index.ts is deleted; the stubs and snapshots stay.\n * 6. `generate` runs.\n * 7. The schema hashes and the bundle id must be what they were: otherwise\n * every file is put back and upgrade refuses.\n *\n * Every refusal before step 6 comes before the first write.\n */\nimport {\n existsSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n realpathSync,\n rmSync,\n rmdirSync,\n writeFileSync,\n} from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, extname, join, relative, resolve } from \"node:path\";\nimport type * as TS from \"typescript\";\nimport { printPermissions, type AppJson, type PermissionsJson } from \"../printer/index.js\";\nimport { formatTs, layout, loadPrettier } from \"../printer/format.js\";\nimport { expandDefs } from \"../printer/defs.js\";\nimport { isObject, parseAppJson, tsOnlyMarkers } from \"./app-json.js\";\nimport { UpgradeRefusal, notSupportedYet } from \"./errors.js\";\nimport { convertExtras } from \"./extras.js\";\nimport {\n checkLegacyFiles,\n checkLegacyFilesWithDefs,\n dslAlpha,\n findLegacyJazzTools,\n} from \"./fresh.js\";\nimport { readGeneratedNames } from \"./names.js\";\nimport { createProgram, typeErrors } from \"./program.js\";\nimport {\n EXTRAS_FILE,\n GENERATED_FILE,\n locateProject,\n packageVersion,\n runningPackageRoot,\n type Project,\n} from \"./project.js\";\nimport { JsonOnlyApp } from \"./project.js\";\nimport { upgradeJsonOnly } from \"./json-only.js\";\nimport { appOutputs, snapshot } from \"./snapshot.js\";\nimport { environmentReads, refuseDroppedConditions } from \"./permissions-check.js\";\nimport { refusePayloadEnums } from \"./payload-enums.js\";\nimport { resolveImport, rewriteProject } from \"./rewrite.js\";\nimport { codemodSchema, codemodSpreadModule } from \"./schema-ts.js\";\nimport { collectConstants, constantImports } from \"./constants.js\";\nimport { PackageAliases } from \"./aliases.js\";\nimport { specifierLike } from \"./edits.js\";\n\nexport { UpgradeRefusal } from \"./errors.js\";\n\n/** A permissions.ts longer than this keeps its own file. */\nconst SEPARATE_PERMISSIONS_LINES = 150;\n\nexport interface UpgradeOptions {\n /** The app's directory (default: cwd). */\n dir?: string;\n /** Where schema.ts is, when not in `dir`, `dir/src` or `dir/src/lib`. */\n schemaDir?: string;\n /** Plan and report, write nothing. */\n dryRun?: boolean;\n /** Skip the closing typecheck. */\n skipTypecheck?: boolean;\n /** Skip step 1 (tests whose fixtures have no installed alpha.65). */\n skipFreshCheck?: boolean;\n /** Step 6: write the JSON files and bindings from the new TS (default: this jazz-tools' `generate`). */\n generate?: (schemaDir: string) => void | Promise<void>;\n}\n\nexport interface UpgradeReport {\n dir: string;\n /** Files written, relative to `dir`. */\n written: string[];\n /** Files deleted, relative to `dir`. */\n deleted: string[];\n /** Every rewrite, as `file:line: what`. */\n rewrites: string[];\n /** Code upgrade left for the author, as `file:line: what`. */\n manual: string[];\n /** Decisions and guesses worth a look. */\n notes: string[];\n /** Typecheck errors after the conversion, as `file:line:col: message`. */\n typeErrors: string[];\n /** Typecheck errors the project had before the conversion too: reported, not counted. */\n preexistingTypeErrors: string[];\n /** Whether the typecheck ran. */\n typechecked: boolean;\n /** The schema hashes and bundle id, which upgrade keeps. */\n identity?: ArtifactIdentity;\n}\n\n/** What a deployment of the app is: its bundle id and every version's schema hash. */\nexport interface ArtifactIdentity {\n bundle: string;\n current: string;\n schemas: string[];\n}\n\nexport async function upgradeProject(options: UpgradeOptions = {}): Promise<UpgradeReport> {\n const root = resolve(options.dir ?? process.cwd());\n let project: Project;\n try {\n project = locateProject(root, options.schemaDir);\n } catch (error) {\n if (!(error instanceof JsonOnlyApp)) throw error;\n // An app whose JSON is its source: its TS is printed from it.\n const report = await upgradeJsonOnly(error.dir, root, {\n dryRun: options.dryRun,\n generate: options.generate ?? runGenerate,\n identity: artifactIdentity,\n differences: identityDifferences,\n });\n return {\n dir: root,\n written: report.written,\n deleted: [],\n rewrites: [],\n manual: [],\n notes: report.notes,\n typeErrors: [],\n preexistingTypeErrors: [],\n typechecked: false,\n };\n }\n const { ts } = project;\n const rel = (path: string) => relative(project.root, path) || path;\n const notes: string[] = [];\n if (!existsSync(project.schemaFile)) {\n throw new UpgradeRefusal(\n `${rel(project.schemaFile)} is missing: upgrade converts an alpha.65 schema.ts`,\n );\n }\n\n if (/\\.defineSchema\\(/.test(readFileSync(project.schemaFile, \"utf8\"))) {\n throw new UpgradeRefusal(\n `${rel(project.schemaFile)} already calls \\`defineSchema\\`: this app is on alpha.66's layout, run \\`npx jazz-tools generate\\``,\n );\n }\n\n // 1. The JSON files must be fresh: the permissions are printed from them.\n if (!options.skipFreshCheck) {\n const legacy = findLegacyJazzTools(project);\n const committed = (\n existsSync(project.permissionsJsonFile) && existsSync(project.appFile)\n ? JSON.parse(readFileSync(project.permissionsJsonFile, \"utf8\"))\n : {}\n ) as PermissionsJson;\n // Hand-written `defs` aren't what the old validate writes: compare by what deploys instead.\n notes.push(\n ...(committed.defs\n ? await checkLegacyFilesWithDefs(\n project,\n legacy,\n JSON.stringify(expandDefs(committed)),\n artifactIdentity,\n )\n : checkLegacyFiles(project, legacy)),\n );\n }\n const scan = scanImports(project);\n const envReads = environmentReads(project, schemaSources(project, scan));\n refuseDroppedConditions(project);\n // A policy that reads the environment and compiled to a bare `true` may be\n // a condition whose value was unset when `validate` ran: printing it would\n // allow more than its author wrote, for good.\n if (envReads.length > 0) refuseBareTrue(project, envReads);\n const appText = readFileSync(project.appFile, \"utf8\");\n const permissionsText = readFileSync(project.permissionsJsonFile, \"utf8\");\n const appJson = parseAppJson(appText);\n refusePayloadEnums(appJson);\n if (Object.keys(tsOnlyMarkers(appJson)).length > 0 || /\"computed\"\\s*:/.test(appText)) {\n throw notSupportedYet(\"computed columns and transforms\", rel(project.appFile));\n }\n const app = JSON.parse(appText) as AppJson;\n const written = JSON.parse(permissionsText) as PermissionsJson;\n // `defs` (alpha.63–65, refused from alpha.66): expanded where they are called,\n // as the old loader read them. The printer's helpers usually bring them back.\n const permissions = written.defs ? expandDefs(written) : written;\n if (written.defs) {\n notes.push(\n `jazz.permissions.json's \\`defs\\` (${Object.keys(written.defs).join(\", \")}) were expanded where they are called; repeated checks became helpers again.`,\n );\n }\n const before = await artifactIdentity(\n appText,\n written.defs ? JSON.stringify(permissions) : permissionsText,\n );\n\n // 2. schema.ts.\n const generatedText = await napiGenerate(appText);\n const names = readGeneratedNames(generatedText);\n const schemaProgram = createProgram(ts, [project.schemaFile], project.compilerOptions, undefined);\n let extras;\n try {\n extras = convertExtras({\n ts,\n program: schemaProgram.program,\n schemaFile: project.schemaFile,\n tables: names.tables,\n generatedExports: names.exports,\n movedToComputed: [],\n jsExtensions: scan.jsExtensions,\n importedNames: scan.schemaNames,\n notes,\n });\n } finally {\n schemaProgram.dispose();\n }\n const schemaText = readFileSync(project.schemaFile, \"utf8\");\n const extrasFile = join(project.schemaDir, EXTRAS_FILE);\n const codemod = codemodSchema({\n ts,\n file: project.schemaFile,\n text: schemaText,\n exports: extras.exports,\n extrasSpecifier: scan.jsExtensions ? \"./app-extras.js\" : \"./app-extras\",\n resolve: (specifier) => resolveImport(project, specifier, project.schemaFile),\n root: project.root,\n });\n\n // 3. The permissions, printed from jazz.permissions.json.\n const prettier = await loadPrettier(project.root);\n const format = async (text: string, file: string) =>\n prettier ? formatTs(text, { file, prettier }) : layout(text);\n const writes: Array<[string, string]> = [];\n const spreadPermissions: string[] = [];\n const spreadImports: string[] = [];\n const skipTables = new Set<string>();\n for (const spread of codemod.spreads) {\n const text = readFileSync(spread.file, \"utf8\");\n const tables = spreadTables(ts, spread.file, text, spread.exported);\n // Tables whose rules are all `true`/`false` keep living in the module.\n const plain = tables.every((t) => plainRules(permissions.tables[t]));\n const permissionsText = plain\n ? `export const permissions = ${plainPermissions(tables, permissions)};`\n : undefined;\n const edited = codemodSpreadModule({\n ts,\n file: spread.file,\n text,\n exported: spread.exported,\n permissionsText,\n });\n for (const name of edited.dropped) {\n notes.push(\n `Dropped \\`${name}\\` from ${rel(spread.file)}: it used the module's own app, which alpha.66 doesn't have.`,\n );\n }\n if (plain) {\n const local = `${spread.local.replace(/(Schema|Tables)$/, \"\")}Permissions`;\n spreadPermissions.push(local);\n spreadImports.push(\n `import { permissions as ${local} } from ${JSON.stringify(spread.specifier)};`,\n );\n for (const t of tables) skipTables.add(t);\n }\n writes.push([spread.file, await formatSpread(edited.text, spread.file, prettier)]);\n codemod.changes.push(`${rel(spread.file)}: exports \\`tables\\` and \\`permissions\\``);\n }\n const oldPermissions = project.permissionsFile\n ? readFileSync(project.permissionsFile, \"utf8\")\n : \"\";\n const separate =\n project.permissionsFile !== undefined &&\n oldPermissions.split(\"\\n\").length > SEPARATE_PERMISSIONS_LINES &&\n !codemod.inlinePermissions;\n // The old permissions' named values keep their names; what came from the environment gets a TODO.\n const oldSource =\n codemod.inlinePermissions || !project.permissionsFile\n ? project.schemaFile\n : project.permissionsFile;\n const constants = collectConstants(ts, oldSource, (spec, from) =>\n resolveImport(project, spec, from),\n );\n const printed = printPermissions(app, permissions, {\n // A separate permissions.ts imports the namespace as `s`; schema.ts has its own name for it.\n dsl: separate ? \"s\" : codemod.dsl,\n spreads: spreadPermissions,\n skipTables,\n constants: constants.byValue,\n notes: envReads.map(\n (read) =>\n `TODO: ${read.replace(/: reads /, \" read \")}; the value it had when \\`validate\\` ran is printed below.`,\n ),\n });\n if (printed.unsupported.length > 0) {\n throw new UpgradeRefusal(\n `the TS DSL can't express these permissions of ${rel(project.permissionsJsonFile)} yet:\\n` +\n printed.unsupported.map((u) => ` ${u.path}: ${u.text}\\n ${u.reason}`).join(\"\\n\"),\n );\n }\n const deleted = new Set<string>(project.permissionsSources);\n if (separate) deleted.delete(project.permissionsFile!);\n const permissionsOut = separate ? project.permissionsFile! : project.schemaFile;\n const named = constantImports(\n constants,\n printed.constantsUsed,\n permissionsOut,\n scan.jsExtensions,\n );\n const permissionsBody = await format(\n [...named.declarations, ...(named.declarations.length ? [\"\"] : []), printed.code].join(\"\\n\"),\n project.schemaFile,\n );\n let newSchema: string;\n if (separate) {\n newSchema = withImports(ts, project.schemaFile, codemod.text, []);\n const schemaSpecifier = scan.jsExtensions ? \"./schema.js\" : \"./schema\";\n const head = [\n `import { schema as s } from \"jazz-tools\";`,\n `import { schema } from ${JSON.stringify(schemaSpecifier)};`,\n ...spreadImports,\n ...named.imports,\n ].join(\"\\n\");\n writes.push([project.permissionsFile!, `${head}\\n\\n${permissionsBody}`]);\n notes.push(\n `${rel(project.permissionsFile!)} was long: the printed permissions stay in their own file.`,\n );\n } else {\n newSchema = `${withImports(ts, project.schemaFile, codemod.text, [...spreadImports, ...named.imports])}\\n${permissionsBody}`;\n }\n writes.unshift([project.schemaFile, newSchema]);\n notes.push(\n \"The permissions were printed from jazz.permissions.json: repeated checks became helpers named for what they check, and the old permissions.ts's named values kept their names. Its comments didn't survive: bring back what they said.\",\n );\n\n // 5. migrations/index.ts goes; the stubs and snapshots stay.\n if (project.migrationsDir) {\n for (const name of [\"index.ts\", \"index.js\"]) {\n const index = join(project.migrationsDir, name);\n if (existsSync(index)) deleted.add(index);\n }\n // A migration from a version nothing holds (no snapshot, not in jazz.app.json's history)\n // never shipped: alpha.65's validate left it out, and `generate` can't build it.\n const snapshotsDir = join(project.migrationsDir, \"snapshots\");\n const known = new Set([\n ...Object.keys(app.history ?? {}).map((v) => v.slice(0, 12)),\n before.current.slice(0, 12),\n ...(existsSync(snapshotsDir)\n ? readdirSync(snapshotsDir).flatMap((f) => /([0-9a-f]{12})\\.json$/i.exec(f)?.[1] ?? [])\n : []),\n ]);\n for (const name of readdirSync(project.migrationsDir)) {\n const from = /-([0-9a-f]{12})-[0-9a-f]{12}\\.[cm]?[jt]s$/i.exec(name)?.[1];\n if (!from || known.has(from)) continue;\n deleted.add(join(project.migrationsDir, name));\n notes.push(\n `Deleted migrations/${name}: it migrates from ${from}, a version no snapshot and no jazz.app.json history holds, so it never shipped.`,\n );\n }\n }\n\n // 4. Imports of schema.ts and permissions.ts.\n const generatedFile = join(project.schemaDir, GENERATED_FILE);\n if (extras.extrasFile) {\n if (existsSync(extrasFile)) {\n throw new UpgradeRefusal(\n `${rel(extrasFile)} exists already; upgrade writes it: move it away and run upgrade again`,\n );\n }\n writes.push([extrasFile, extras.extrasFile]);\n }\n const aliases = new PackageAliases(project.root);\n const untouched = new Set([\n project.schemaFile,\n ...codemod.spreads.map((s) => s.file),\n ...deleted,\n ...(separate ? [project.permissionsFile!] : []),\n ]);\n const rewrites = rewriteProject({\n aliases,\n project,\n exports: extras.exports,\n tables: names.tables,\n deleted: untouched,\n generatedFile,\n extrasFile,\n computedFile: join(project.schemaDir, \"jazz.computed.ts\"),\n });\n const config = configEdits(\n project,\n rewrites.files.some((f) => f.importsJson),\n deleted,\n );\n const manifest = manifestEdit(project);\n const aliasEdits = aliases.apply(\n manifest ? new Map([[manifest.file, manifest.text]]) : undefined,\n );\n for (const file of rewrites.files) writes.push([file.file, file.text]);\n if (config.file) writes.push([config.file, config.text]);\n if (manifest && !aliasEdits.has(manifest.file)) writes.push([manifest.file, manifest.text]);\n for (const [file, edit] of aliasEdits) writes.push([file, edit.text]);\n\n const report: UpgradeReport = {\n dir: project.root,\n written: writes.map(([path]) => rel(path)),\n deleted: [...deleted].map(rel).sort(),\n rewrites: [\n ...codemod.changes,\n ...rewrites.files.flatMap((f) => f.changes),\n ...config.changes,\n ...(manifest?.changes ?? []),\n ...[...aliasEdits.values()].flatMap((e) => e.changes),\n ],\n manual: [\n ...envReads.map(\n (read) =>\n `${read}: the printed permissions hold the value it had when \\`validate\\` ran; make the env-dependent logic explicit in schema.ts`,\n ),\n ...rewrites.manual,\n ],\n notes,\n typeErrors: [],\n preexistingTypeErrors: [],\n typechecked: false,\n identity: before,\n };\n if (options.dryRun) return report;\n\n // The project's errors before the conversion, so the closing typecheck tells upgrade's apart.\n let beforeErrors: Map<string, number> | undefined;\n if (!options.skipTypecheck)\n beforeErrors = countTypeErrors(projectTypeErrors(project, writes, new Set()));\n\n // Write, keeping what was there to put back byte for byte: the files upgrade\n // writes or deletes, the JSON files, the bindings and migrations/ (removed\n // if upgrade made it). Anything else `generate` adds goes again.\n const undo = snapshot(appOutputs(project.schemaDir, [...writes.map(([p]) => p), ...deleted]));\n const filesBefore = new Set(appFiles(project.schemaDir));\n const restore = () => {\n for (const path of appFiles(project.schemaDir))\n if (!filesBefore.has(path)) rmSync(path, { force: true });\n undo.restore();\n };\n for (const [path, text] of writes) writeFileSync(path, text);\n for (const path of deleted) rmSync(path, { force: true });\n // Versions of jazz.app.json's history without a snapshot get one: `generate` builds the history from them.\n for (const [path, text] of await missingSnapshots(project, app)) {\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, text);\n report.written.push(rel(path));\n }\n removeEmptyDirs([...deleted].map(dirname), project.root);\n\n // 6. generate, and 7. the same deployment.\n try {\n await (options.generate ?? runGenerate)(project.schemaDir);\n const after = await artifactIdentity(\n readFileSync(project.appFile, \"utf8\"),\n readFileSync(project.permissionsJsonFile, \"utf8\"),\n );\n const differences = identityDifferences(before, after);\n if (differences.length > 0) {\n throw new UpgradeRefusal(\n `the converted app would deploy differently, so upgrade put every file back:\\n${differences.map((d) => ` ${d}`).join(\"\\n\")}\\n` +\n \"Please report this with the app's jazz.app.json and jazz.permissions.json.\",\n );\n }\n } catch (error) {\n restore();\n if (error instanceof UpgradeRefusal) throw error;\n throw new UpgradeRefusal(\n `\\`generate\\` failed on the converted app, so upgrade put every file back:\\n ${(error instanceof Error ? error.message : String(error)).replace(/\\n/g, \"\\n \")}`,\n );\n }\n report.notes.push(\n `The schema hashes and the bundle id (${before.bundle.slice(0, 12)}) are unchanged.`,\n );\n // A Rust app (a crate on `jazz-app-support`) gets Rust bindings instead, as `generate` writes them.\n const rustApp = isRustApp(project.schemaDir);\n report.written.push(rel(project.appFile), rel(project.permissionsJsonFile));\n if (rustApp) {\n const rustFile = join(project.schemaDir, RUST_BINDINGS_FILE);\n const rust = await rustBindings(readFileSync(project.appFile, \"utf8\"));\n if (typeof rust === \"string\") {\n mkdirSync(dirname(rustFile), { recursive: true });\n writeFileSync(rustFile, rust);\n report.written.push(rel(rustFile));\n } else {\n report.notes.push(\n `${RUST_BINDINGS_FILE} was not written (${rust.reason}); run \\`npx jazz-tools generate\\` once this jazz-tools generates Rust bindings.`,\n );\n }\n report.notes.push(\n \"This is a Rust app: run `cargo check` to typecheck it against the new bindings.\",\n );\n } else {\n report.written.push(rel(generatedFile));\n }\n\n if (!options.skipTypecheck && !rustApp) {\n const split = splitTypeErrors(beforeErrors, projectTypeErrors(project, writes, deleted));\n report.typeErrors = split.added;\n report.preexistingTypeErrors = split.preexisting;\n report.typechecked = true;\n const views = project.sources.filter((f) => /\\.(svelte|vue)$/.test(f));\n if (views.length > 0) {\n report.notes.push(\n `The typecheck covers .ts/.tsx; run svelte-check or vue-tsc for the ${views.length} .svelte/.vue file${views.length === 1 ? \"\" : \"s\"}.`,\n );\n }\n }\n return report;\n}\n\nfunction projectTypeErrors(\n project: Project,\n writes: Array<[string, string]>,\n deleted: Set<string>,\n) {\n const { ts } = project;\n const roots = new Set(project.configFileNames.filter((f) => !deleted.has(f)));\n for (const [path] of writes)\n if (/\\.(ts|tsx|mts|cts)$/.test(path) && existsSync(path)) roots.add(path);\n if (roots.size === 0) return [];\n const runtime = runningPackageRoot();\n const installed = installedJazzTools(project);\n const override =\n installed &&\n dslAlpha(packageVersion(installed)) !== null &&\n realpathSync(installed) !== realpathSync(runtime)\n ? runtime\n : undefined;\n const handle = createProgram(ts, [...roots], project.compilerOptions, override);\n try {\n return typeErrors(ts, handle.program, project.root);\n } finally {\n handle.dispose();\n }\n}\n\n/** Every file under `dir`, but dependencies and VCS data. */\nfunction appFiles(dir: string): string[] {\n const out: string[] = [];\n const walk = (current: string) => {\n for (const entry of readdirSync(current, { withFileTypes: true })) {\n if (entry.name === \"node_modules\" || entry.name === \".git\") continue;\n const path = join(current, entry.name);\n if (entry.isDirectory()) walk(path);\n else out.push(path);\n }\n };\n walk(dir);\n return out;\n}\n\n/**\n * Snapshots for the versions in jazz.app.json's `history` that\n * migrations/snapshots/ lacks (alpha.65 apps kept some only in the JSON), as\n * `migrations create` writes them.\n */\nasync function missingSnapshots(project: Project, app: AppJson): Promise<Array<[string, string]>> {\n const versions = Object.entries(app.history ?? {});\n if (versions.length === 0) return [];\n const dir = join(project.migrationsDir ?? join(project.schemaDir, \"migrations\"), \"snapshots\");\n const have = new Set(\n existsSync(dir)\n ? readdirSync(dir).flatMap((f) => /([0-9a-f]{12})\\.json$/i.exec(f)?.[1] ?? [])\n : [],\n );\n const { snapshotFromVersion } = await import(\"../dev/migrations.js\");\n const out: Array<[string, string]> = [];\n for (const [name, version] of versions) {\n if (have.has(name.slice(0, 12))) continue;\n const snapshot = await snapshotFromVersion(version.tables as never);\n const hash = snapshot.hash.slice(0, 12);\n if (have.has(hash)) continue;\n out.push([join(dir, `${hash}.json`), `${JSON.stringify(snapshot.schema, null, 2)}\\n`]);\n have.add(hash);\n }\n return out;\n}\n\n/** The bundle id and schema hashes `load` computes for the two files. */\nexport async function artifactIdentity(\n app: string,\n permissions: string,\n): Promise<ArtifactIdentity> {\n const napi = (await import(\"jazz-napi\")) as unknown as {\n loadAppArtifact(\n app: string,\n permissions: string,\n ): {\n bundle: string;\n current: string;\n deployment: { schemas: { hash: string }[] };\n };\n };\n const loaded = napi.loadAppArtifact(app, permissions);\n return {\n bundle: loaded.bundle,\n current: loaded.current,\n schemas: loaded.deployment.schemas.map((s) => s.hash),\n };\n}\n\nexport function identityDifferences(before: ArtifactIdentity, after: ArtifactIdentity): string[] {\n const out: string[] = [];\n if (before.current !== after.current)\n out.push(`current schema hash ${before.current} → ${after.current}`);\n const a = [...before.schemas].sort().join(\", \");\n const b = [...after.schemas].sort().join(\", \");\n if (a !== b) out.push(`schema versions [${a}] → [${b}]`);\n if (before.bundle !== after.bundle) out.push(`bundle id ${before.bundle} → ${after.bundle}`);\n return out;\n}\n\nconst RUST_BINDINGS_FILE = join(\"src\", \"jazz_app.rs\");\n\n/**\n * Whether `dir` is a Rust app, as `jazz-tools generate` tells: a crate (a\n * `Cargo.toml` with `[package]`) that depends on `jazz-app-support`, or one with\n * committed `src/jazz_app.rs`. A workspace root or an unrelated crate isn't.\n */\nexport function isRustApp(dir: string): boolean {\n const manifest = join(dir, \"Cargo.toml\");\n if (!existsSync(manifest)) return false;\n const text = readFileSync(manifest, \"utf8\");\n if (!/^\\s*\\[package\\]/m.test(text)) return false;\n if (existsSync(join(dir, RUST_BINDINGS_FILE))) return true;\n return /^\\s*jazz-app-support\\s*=|^\\s*\\[(?:dev-|build-)?dependencies\\.jazz-app-support\\]/m.test(\n text,\n );\n}\n\n/** The `jazz-app-support` crate's bindings, or why this jazz-napi can't generate them. */\nasync function rustBindings(appJson: string): Promise<string | { reason: string }> {\n try {\n const napi = (await import(\"jazz-napi\")) as unknown as {\n generate?: (lang: string, app: string) => string;\n };\n if (typeof napi.generate !== \"function\") return { reason: \"this jazz-napi has no `generate`\" };\n return napi.generate(\"rust\", appJson);\n } catch (error) {\n return {\n reason: (error instanceof Error ? error.message : String(error)).replace(/[.\\s]*$/, \"\"),\n };\n }\n}\n\n/** Refuse bare `true` policies (anywhere) in an app whose old permissions read the environment. */\nfunction refuseBareTrue(project: Project, envReads: string[]): void {\n const permissions = JSON.parse(\n readFileSync(project.permissionsJsonFile, \"utf8\"),\n ) as PermissionsJson;\n const found: string[] = [];\n const walk = (value: unknown, path: string) => {\n if (typeof value === \"string\") {\n if (value.trim() === \"true\") found.push(path);\n } else if (Array.isArray(value)) value.forEach((v, i) => walk(v, `${path}[${i}]`));\n else if (value && typeof value === \"object\") {\n for (const [key, v] of Object.entries(value))\n if (key !== \"$comment\") walk(v, `${path}.${key}`);\n }\n };\n for (const [table, rules] of Object.entries(permissions.tables ?? {})) walk(rules, table);\n if (found.length === 0) return;\n throw new UpgradeRefusal(\n `jazz.permissions.json allows ${found.map((f) => `\\`${f}\\``).join(\", \")} unconditionally (\\`\"true\"\\`), and the old permissions read the environment:\\n` +\n envReads.map((r) => ` ${r}`).join(\"\\n\") +\n \"\\nalpha.65 compiled a condition on an unset value to `true`, so these may allow more than the author wrote. \" +\n \"Set those environment variables and run `npx jazz-tools validate` with the app's alpha.65, then upgrade again \" +\n \"(or, if they really are unconditional, check jazz.permissions.json and fix the old permissions by hand first).\",\n relative(project.root, project.permissionsJsonFile),\n );\n}\n\n/** This jazz-tools' `generate`, in the app's directory: the JSON files from the TS, then the bindings. */\nasync function runGenerate(schemaDir: string): Promise<void> {\n const { generateApp } = await import(\"../dev/project.js\");\n // alpha.65's JSON files carry no `$generated` marker: replacing them is the point.\n await generateApp({ cwd: schemaDir, force: true });\n}\n\n/** The table names a spread module's `export const schema = {…}` declares. */\nfunction spreadTables(ts: typeof TS, file: string, text: string, exported: string): string[] {\n const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n for (const statement of source.statements) {\n if (!ts.isVariableStatement(statement)) continue;\n for (const declaration of statement.declarationList.declarations) {\n if (!ts.isIdentifier(declaration.name) || declaration.name.text !== exported) continue;\n let init = declaration.initializer;\n while (init && (ts.isAsExpression(init) || ts.isSatisfiesExpression(init)))\n init = init.expression;\n if (init && ts.isObjectLiteralExpression(init)) {\n return init.properties.flatMap((p) =>\n p.name && (ts.isIdentifier(p.name) || ts.isStringLiteral(p.name)) ? [p.name.text] : [],\n );\n }\n }\n }\n return [];\n}\n\nfunction plainRules(rules: PermissionsJson[\"tables\"][string] | undefined): boolean {\n return Object.entries(rules ?? {}).every(\n ([key, value]) => key === \"$comment\" || value === \"true\" || value === \"false\",\n );\n}\n\nfunction plainPermissions(tables: string[], permissions: PermissionsJson): string {\n const body = tables.map((table) => {\n const rules = permissions.tables[table] ?? {};\n const entries = ([\"read\", \"insert\", \"update\", \"delete\"] as const)\n .filter((op) => rules[op] !== undefined)\n .map((op) => `${op}: ${rules[op] as string}`);\n return ` ${/^[A-Za-z_$][\\w$]*$/.test(table) ? table : JSON.stringify(table)}: { ${entries.join(\", \")} },`;\n });\n return `{\\n${body.join(\"\\n\")}\\n}`;\n}\n\nasync function formatSpread(\n text: string,\n file: string,\n prettier: Awaited<ReturnType<typeof loadPrettier>>,\n) {\n return prettier ? formatTs(text, { file, prettier }) : text;\n}\n\n/** `text` with `lines` added after its last import. */\nfunction withImports(ts: typeof TS, file: string, text: string, lines: string[]): string {\n if (lines.length === 0) return text;\n const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const last = source.statements.filter(ts.isImportDeclaration).pop();\n const at = last ? last.getEnd() : 0;\n return `${text.slice(0, at)}\\n${lines.join(\"\\n\")}${text.slice(at)}`;\n}\n\n/** package.json: scripts calling `jazz-tools validate` call `generate`. */\nfunction manifestEdit(\n project: Project,\n): { file: string; text: string; changes: string[] } | undefined {\n const file = join(project.root, \"package.json\");\n if (!existsSync(file)) return undefined;\n const text = readFileSync(file, \"utf8\");\n const changes: string[] = [];\n let next = text;\n let manifest: { scripts?: Record<string, string> };\n try {\n manifest = JSON.parse(text);\n } catch {\n return undefined;\n }\n for (const [name, script] of Object.entries(manifest.scripts ?? {})) {\n const renamed = renameValidate(script);\n if (renamed === script) continue;\n changes.push(\n `package.json: script \"${name}\": \\`jazz-tools validate\\` → \\`jazz-tools generate\\``,\n );\n next = next.replace(JSON.stringify(script), JSON.stringify(renamed));\n }\n return next === text ? undefined : { file, text: next, changes };\n}\n\nexport { notSupportedYet, isObject, specifierLike, extname };\n\nasync function napiGenerate(appJson: string): Promise<string> {\n const napi = (await import(\"jazz-napi\")) as unknown as {\n generate?: (lang: string, app: string) => string;\n };\n if (typeof napi.generate !== \"function\") {\n throw new Error(\n \"this jazz-napi has no `generate`: install the jazz-napi that ships with this jazz-tools\",\n );\n }\n return napi.generate(\"ts\", appJson);\n}\n\n/** The project's resolved jazz-tools package directory, if installed. */\nfunction installedJazzTools(project: Project): string | undefined {\n try {\n return dirname(\n createRequire(join(project.schemaDir, \"package.json\")).resolve(\"jazz-tools/package.json\"),\n );\n } catch {\n return undefined;\n }\n}\n\ninterface ImportScan {\n /** Per file, the project files it imports. */\n imports: Map<string, Set<string>>;\n /** Names imported from schema.ts by files other than permissions.ts. */\n schemaNames: Set<string>;\n /** Whether relative imports of schema.ts carry `.js`. */\n jsExtensions: boolean;\n}\n\nfunction scanImports(project: Project): ImportScan {\n const { ts } = project;\n const imports = new Map<string, Set<string>>();\n const schemaNames = new Set<string>();\n let js = 0;\n let plain = 0;\n for (const file of project.sources) {\n const text = readFileSync(file, \"utf8\");\n const code = /\\.(svelte|vue|html)$/.test(file)\n ? [...text.matchAll(/<script\\b[^>]*>([\\s\\S]*?)<\\/script>/g)].map((m) => m[1]).join(\"\\n\")\n : text;\n const targets = new Set<string>();\n const source = ts.createSourceFile(\n file,\n code,\n ts.ScriptTarget.Latest,\n true,\n /\\.[jt]sx$/.test(file) ? ts.ScriptKind.TSX : ts.ScriptKind.TS,\n );\n const visit = (node: TS.Node): void => {\n let spec: TS.Expression | undefined;\n if ((ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) && node.moduleSpecifier)\n spec = node.moduleSpecifier;\n if (ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.ImportKeyword)\n spec = node.arguments[0];\n if (spec && ts.isStringLiteral(spec)) {\n const target = resolveImport(project, spec.text, file);\n if (target) {\n targets.add(target);\n if (target === project.schemaFile && !project.permissionsSources.includes(file)) {\n if (spec.text.startsWith(\".\")) {\n if (spec.text.endsWith(\".js\")) js++;\n else plain++;\n }\n if (ts.isImportDeclaration(node)) {\n const bindings = node.importClause?.namedBindings;\n if (bindings && ts.isNamedImports(bindings)) {\n for (const element of bindings.elements)\n schemaNames.add((element.propertyName ?? element.name).text);\n }\n }\n }\n }\n }\n ts.forEachChild(node, visit);\n };\n visit(source);\n imports.set(file, targets);\n }\n return { imports, schemaNames, jsExtensions: js > plain };\n}\n\n/** schema.ts, permissions.ts and the project files they import, transitively. */\nfunction schemaSources(project: Project, scan: ImportScan): string[] {\n const out = new Set<string>();\n const queue = [project.schemaFile, ...project.permissionsSources];\n while (queue.length > 0) {\n const file = queue.pop()!;\n if (\n out.has(file) ||\n relative(project.root, file).startsWith(\"..\") ||\n file.includes(\"node_modules\")\n )\n continue;\n out.add(file);\n queue.push(...(scan.imports.get(file) ?? []));\n }\n return [...out];\n}\n\nfunction removeEmptyDirs(dirs: string[], root: string): void {\n for (const start of new Set(dirs)) {\n let dir = start;\n while (\n dir.startsWith(root) &&\n dir !== root &&\n existsSync(dir) &&\n readdirSync(dir).length === 0\n ) {\n rmdirSync(dir);\n dir = dirname(dir);\n }\n }\n}\n\n/** tsconfig: `include` entries naming deleted files, and JSON imports. */\nfunction configEdits(\n project: Project,\n importsJson: boolean,\n deleted: Set<string>,\n): { file?: string; text: string; changes: string[] } {\n const file = project.tsconfig;\n if (!file) return { text: \"\", changes: [] };\n let text = readFileSync(file, \"utf8\");\n const original = text;\n const changes: string[] = [];\n const dir = dirname(file);\n const generated = relative(dir, join(project.schemaDir, GENERATED_FILE)).split(\"\\\\\").join(\"/\");\n for (const path of deleted) {\n if (extname(path) !== \".ts\") continue;\n const name = relative(dir, path).split(\"\\\\\").join(\"/\");\n for (const spelled of [name, `./${name}`]) {\n const quoted = JSON.stringify(spelled);\n if (!text.includes(quoted)) continue;\n if (path === project.schemaFile) {\n text = text.replace(quoted, JSON.stringify(generated));\n changes.push(`${relative(project.root, file)}: include ${quoted} → \"${generated}\"`);\n } else {\n text = text.replace(\n new RegExp(`\\\\s*${escape(quoted)}\\\\s*,|,\\\\s*${escape(quoted)}|${escape(quoted)}`),\n \"\",\n );\n changes.push(`${relative(project.root, file)}: dropped ${quoted} from include`);\n }\n }\n }\n if (importsJson && project.compilerOptions.resolveJsonModule !== true) {\n const next = text.replace(\n /(\"compilerOptions\"\\s*:\\s*\\{)(\\s*)/,\n `$1$2\"resolveJsonModule\": true,$2`,\n );\n if (next !== text) {\n text = next;\n changes.push(\n `${relative(project.root, file)}: \"resolveJsonModule\": true, for the jazz.permissions.json import`,\n );\n }\n }\n return text === original ? { text, changes: [] } : { file, text, changes };\n}\n\nfunction escape(text: string): string {\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\n/** A shell command with every jazz-tools CLI `validate` call renamed to `generate`. */\nexport function renameValidate(script: string): string {\n return script.replace(\n /((?:^|[\\s;&|('\"])(?:(?:npx|pnpm(?: exec)?|yarn|bunx)\\s+)?(?:jazz-tools(?:@\\S+)?|\\S*jazz-tools\\/(?:dist\\/cli\\.js|bin\\/jazz-tools\\.js))\\s+)validate\\b/g,\n \"$1generate\",\n );\n}\n\n/** The report as the CLI prints it. */\nexport function formatReport(report: UpgradeReport, dryRun = false): string {\n const lines: string[] = [];\n const section = (title: string, items: string[]) => {\n if (items.length === 0) return;\n lines.push(`${title}:`);\n for (const item of items) lines.push(` ${item.replace(/\\n/g, \"\\n \")}`);\n };\n section(dryRun ? \"Would write\" : \"Wrote\", report.written);\n section(dryRun ? \"Would delete\" : \"Deleted\", report.deleted);\n section(\"Rewrote\", report.rewrites);\n section(\"Left for you (upgrade can't convert these)\", report.manual);\n section(\"Notes\", report.notes);\n if (report.typechecked) {\n section(\n `Typecheck: ${report.preexistingTypeErrors.length} error${report.preexistingTypeErrors.length === 1 ? \"\" : \"s\"} the project had before the conversion too (not upgrade's, and not counted)`,\n report.preexistingTypeErrors,\n );\n if (report.typeErrors.length === 0) {\n lines.push(\n report.preexistingTypeErrors.length === 0\n ? \"Typecheck passed.\"\n : \"Typecheck passed: no errors besides the ones the project already had.\",\n );\n } else\n section(\n `Typecheck: ${report.typeErrors.length} error${report.typeErrors.length === 1 ? \"\" : \"s\"} (the conversion is left in place for you to fix)`,\n report.typeErrors,\n );\n }\n return lines.join(\"\\n\");\n}\n\n/** How many times each error (file, code, first message line) occurs. */\nexport function countTypeErrors(errors: readonly { key: string }[]): Map<string, number> {\n const counts = new Map<string, number>();\n for (const { key } of errors) counts.set(key, (counts.get(key) ?? 0) + 1);\n return counts;\n}\n\n/**\n * The closing typecheck's errors, split into the ones the conversion added\n * and the ones the project had before (`before`, counted per key). Each error\n * before excuses one identical error after, whatever line it moved to, so a\n * second identical error the conversion adds to the same file still counts.\n */\nexport function splitTypeErrors(\n before: ReadonlyMap<string, number> | undefined,\n after: readonly { key: string; text: string }[],\n): { added: string[]; preexisting: string[] } {\n const excused = new Map(before);\n const added: string[] = [];\n const preexisting: string[] = [];\n for (const error of after) {\n const left = excused.get(error.key) ?? 0;\n if (left > 0) {\n excused.set(error.key, left - 1);\n preexisting.push(error.text);\n } else {\n added.push(error.text);\n }\n }\n return { added, preexisting };\n}\n"]}
@@ -1,24 +0,0 @@
1
- export interface JsonOnlyOptions {
2
- dryRun?: boolean;
3
- generate: (dir: string) => void | Promise<void>;
4
- identity: (app: string, permissions: string) => Promise<{
5
- bundle: string;
6
- current: string;
7
- schemas: string[];
8
- }>;
9
- differences: (before: {
10
- bundle: string;
11
- current: string;
12
- schemas: string[];
13
- }, after: {
14
- bundle: string;
15
- current: string;
16
- schemas: string[];
17
- }) => string[];
18
- }
19
- export interface JsonOnlyReport {
20
- written: string[];
21
- notes: string[];
22
- }
23
- export declare function upgradeJsonOnly(dir: string, root: string, options: JsonOnlyOptions): Promise<JsonOnlyReport>;
24
- //# sourceMappingURL=json-only.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-only.d.ts","sourceRoot":"","sources":["../../src/upgrade/json-only.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,QAAQ,EAAE,CACR,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,KAChB,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACrE,WAAW,EAAE,CACX,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,EAC9D,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,KAC1D,MAAM,EAAE,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,CAAC,CAqGzB"}
@@ -1,124 +0,0 @@
1
- /**
2
- * `jazz-tools upgrade` for an app whose source is its JSON files (an alpha.65
3
- * Rust or Go backend, or any app without schema.ts): the files are the
4
- * source, so there is nothing to check them against.
5
- *
6
- * 1. `defs` in jazz.permissions.json are expanded where they are called.
7
- * 2. schema.ts is printed from the files (tables, then the permissions, their
8
- * repeated checks as helpers), and migrations/ from their `history` and
9
- * `migrations`: a snapshot per version and a migration per step.
10
- * 3. `generate` runs (forced: the old files carry no `$generated` marker).
11
- * 4. The schema hashes and the bundle id must be what the files gave:
12
- * otherwise every file is put back and upgrade refuses.
13
- *
14
- * It needs neither the app's jazz-tools nor TypeScript.
15
- */
16
- import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
17
- import { dirname, join, relative } from "node:path";
18
- import { expandDefs } from "../printer/defs.js";
19
- import { formatTs, layout, loadPrettier } from "../printer/format.js";
20
- import { printSchemaTs } from "../printer/index.js";
21
- import { printMigrations } from "../printer/migrations.js";
22
- import { UpgradeRefusal } from "./errors.js";
23
- import { appOutputs, snapshot } from "./snapshot.js";
24
- import { APP_FILE, PERMISSIONS_FILE } from "./project.js";
25
- export async function upgradeJsonOnly(dir, root, options) {
26
- const rel = (path) => relative(root, path) || path;
27
- const appFile = join(dir, APP_FILE);
28
- const permissionsFile = join(dir, PERMISSIONS_FILE);
29
- const appText = readFileSync(appFile, "utf8");
30
- const app = JSON.parse(appText);
31
- const written = existsSync(permissionsFile)
32
- ? JSON.parse(readFileSync(permissionsFile, "utf8"))
33
- : { format: 1, tables: {} };
34
- const notes = [];
35
- const permissions = written.defs ? expandDefs(written) : written;
36
- if (written.defs) {
37
- notes.push(`jazz.permissions.json's \`defs\` (${Object.keys(written.defs).join(", ")}) were expanded where they are called; repeated checks became helpers again.`);
38
- }
39
- const before = await options.identity(appText, JSON.stringify(permissions));
40
- // The TS sources.
41
- const printed = printSchemaTs(app, permissions);
42
- const unsupported = [...printed.unsupported];
43
- const files = { ...printed.files };
44
- if (app.history || app.migrations?.length) {
45
- const { snapshotFromVersion } = await import("../dev/migrations.js");
46
- const migrations = await printMigrations(app, {
47
- snapshot: (tables) => snapshotFromVersion(tables),
48
- });
49
- unsupported.push(...migrations.unsupported);
50
- Object.assign(files, migrations.files);
51
- }
52
- if (unsupported.length > 0) {
53
- throw new UpgradeRefusal(`the TS DSL can't express these parts of the app's files yet:\n` +
54
- unsupported.map((u) => ` ${u.path}: ${u.text}\n ${u.reason}`).join("\n"));
55
- }
56
- const existing = Object.keys(files).filter((f) => existsSync(join(dir, f)));
57
- if (existing.length > 0) {
58
- throw new UpgradeRefusal(`${existing.map((f) => rel(join(dir, f))).join(", ")} exist${existing.length === 1 ? "s" : ""} already; upgrade writes ${existing.length === 1 ? "it" : "them"} from jazz.app.json: move ${existing.length === 1 ? "it" : "them"} away and run upgrade again`);
59
- }
60
- const prettier = await loadPrettier(root);
61
- const writes = [];
62
- for (const [name, text] of Object.entries(files)) {
63
- const path = join(dir, name);
64
- writes.push([
65
- path,
66
- name.endsWith(".ts")
67
- ? prettier
68
- ? await formatTs(text, { file: path, prettier })
69
- : layout(text)
70
- : text,
71
- ]);
72
- }
73
- notes.push("schema.ts was printed from jazz.app.json and jazz.permissions.json: repeated checks became helpers (rename them), and migrations/ holds the app's history.");
74
- const report = { written: writes.map(([p]) => rel(p)), notes };
75
- if (options.dryRun)
76
- return report;
77
- // Write; `generate`; the same deployment, or everything back.
78
- // Byte-exact undo: the app files, the bindings, migrations/ (removed if upgrade made it);
79
- // anything else `generate` adds goes too.
80
- const undo = snapshot(appOutputs(dir, writes.map(([p]) => p)));
81
- const filesBefore = new Set(listFiles(dir));
82
- for (const [path, text] of writes) {
83
- mkdirSync(dirname(path), { recursive: true });
84
- writeFileSync(path, text);
85
- }
86
- try {
87
- await options.generate(dir);
88
- const after = await options.identity(readFileSync(appFile, "utf8"), readFileSync(permissionsFile, "utf8"));
89
- const differences = options.differences(before, after);
90
- if (differences.length > 0) {
91
- throw new UpgradeRefusal(`the TS printed from the app's files would deploy differently, so upgrade put every file back:\n${differences.map((d) => ` ${d}`).join("\n")}\n` +
92
- "Please report this with the app's jazz.app.json and jazz.permissions.json.");
93
- }
94
- }
95
- catch (error) {
96
- for (const path of listFiles(dir))
97
- if (!filesBefore.has(path))
98
- rmSync(path, { force: true });
99
- undo.restore();
100
- if (error instanceof UpgradeRefusal)
101
- throw error;
102
- throw new UpgradeRefusal(`\`generate\` failed on the printed TS, so upgrade put every file back:\n ${(error instanceof Error ? error.message : String(error)).replace(/\n/g, "\n ")}`);
103
- }
104
- report.written.push(rel(appFile), rel(permissionsFile));
105
- report.notes.push(`The schema hashes and the bundle id (${before.bundle.slice(0, 12)}) are unchanged.`);
106
- return report;
107
- }
108
- function listFiles(dir) {
109
- const out = [];
110
- const walk = (current) => {
111
- for (const entry of readdirSync(current, { withFileTypes: true })) {
112
- if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "target")
113
- continue;
114
- const path = join(current, entry.name);
115
- if (entry.isDirectory())
116
- walk(path);
117
- else
118
- out.push(path);
119
- }
120
- };
121
- walk(dir);
122
- return out;
123
- }
124
- //# sourceMappingURL=json-only.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-only.js","sourceRoot":"","sources":["../../src/upgrade/json-only.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAoB,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAoB1D,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAW,EACX,IAAY,EACZ,OAAwB;IAExB,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC;IAC3D,MAAM,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AAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAC/J,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC;IACxD,MAAM,CAAC,KAAK,CAAC,IAAI,CACf,wCAAwC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CACrF,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,MAAM,IAAI,GAAG,CAAC,OAAe,EAAE,EAAE;QAC/B,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;YAClE,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;gBACnF,SAAS;YACX,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YACvC,IAAI,KAAK,CAAC,WAAW,EAAE;gBAAE,IAAI,CAAC,IAAI,CAAC,CAAC;;gBAC/B,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,CAAC;IACF,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * `jazz-tools upgrade` for an app whose source is its JSON files (an alpha.65\n * Rust or Go backend, or any app without schema.ts): the files are the\n * source, so there is nothing to check them against.\n *\n * 1. `defs` in jazz.permissions.json are expanded where they are called.\n * 2. schema.ts is printed from the files (tables, then the permissions, their\n * repeated checks as helpers), and migrations/ from their `history` and\n * `migrations`: a snapshot per version and a migration per step.\n * 3. `generate` runs (forced: the old files carry no `$generated` marker).\n * 4. The schema hashes and the bundle id must be what the files gave:\n * otherwise every file is put back and upgrade refuses.\n *\n * It needs neither the app's jazz-tools nor TypeScript.\n */\nimport { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport { dirname, join, relative } from \"node:path\";\nimport type { AppJson, PermissionsJson } from \"../printer/app-json.js\";\nimport { expandDefs } from \"../printer/defs.js\";\nimport { formatTs, layout, loadPrettier } from \"../printer/format.js\";\nimport { printSchemaTs, type Unsupported } from \"../printer/index.js\";\nimport { printMigrations } from \"../printer/migrations.js\";\nimport { UpgradeRefusal } from \"./errors.js\";\nimport { appOutputs, snapshot } from \"./snapshot.js\";\nimport { APP_FILE, PERMISSIONS_FILE } from \"./project.js\";\n\nexport interface JsonOnlyOptions {\n dryRun?: boolean;\n generate: (dir: string) => void | Promise<void>;\n identity: (\n app: string,\n permissions: string,\n ) => Promise<{ bundle: string; current: string; schemas: string[] }>;\n differences: (\n before: { bundle: string; current: string; schemas: string[] },\n after: { bundle: string; current: string; schemas: string[] },\n ) => string[];\n}\n\nexport interface JsonOnlyReport {\n written: string[];\n notes: string[];\n}\n\nexport async function upgradeJsonOnly(\n dir: string,\n root: string,\n options: JsonOnlyOptions,\n): Promise<JsonOnlyReport> {\n const rel = (path: string) => relative(root, path) || path;\n const appFile = join(dir, APP_FILE);\n const permissionsFile = join(dir, PERMISSIONS_FILE);\n const appText = readFileSync(appFile, \"utf8\");\n const app = JSON.parse(appText) as AppJson;\n const written = existsSync(permissionsFile)\n ? (JSON.parse(readFileSync(permissionsFile, \"utf8\")) as PermissionsJson)\n : ({ format: 1, tables: {} } as PermissionsJson);\n const notes: string[] = [];\n const permissions = written.defs ? expandDefs(written) : written;\n if (written.defs) {\n notes.push(\n `jazz.permissions.json's \\`defs\\` (${Object.keys(written.defs).join(\", \")}) were expanded where they are called; repeated checks became helpers again.`,\n );\n }\n const before = await options.identity(appText, JSON.stringify(permissions));\n\n // The TS sources.\n const printed = printSchemaTs(app, permissions);\n const unsupported: Unsupported[] = [...printed.unsupported];\n const files: Record<string, string> = { ...printed.files };\n if (app.history || app.migrations?.length) {\n const { snapshotFromVersion } = await import(\"../dev/migrations.js\");\n const migrations = await printMigrations(app, {\n snapshot: (tables) => snapshotFromVersion(tables as never),\n });\n unsupported.push(...migrations.unsupported);\n Object.assign(files, migrations.files);\n }\n if (unsupported.length > 0) {\n throw new UpgradeRefusal(\n `the TS DSL can't express these parts of the app's files yet:\\n` +\n unsupported.map((u) => ` ${u.path}: ${u.text}\\n ${u.reason}`).join(\"\\n\"),\n );\n }\n const existing = Object.keys(files).filter((f) => existsSync(join(dir, f)));\n if (existing.length > 0) {\n throw new UpgradeRefusal(\n `${existing.map((f) => rel(join(dir, f))).join(\", \")} exist${existing.length === 1 ? \"s\" : \"\"} already; upgrade writes ${existing.length === 1 ? \"it\" : \"them\"} from jazz.app.json: move ${existing.length === 1 ? \"it\" : \"them\"} away and run upgrade again`,\n );\n }\n const prettier = await loadPrettier(root);\n const writes: Array<[string, string]> = [];\n for (const [name, text] of Object.entries(files)) {\n const path = join(dir, name);\n writes.push([\n path,\n name.endsWith(\".ts\")\n ? prettier\n ? await formatTs(text, { file: path, prettier })\n : layout(text)\n : text,\n ]);\n }\n notes.push(\n \"schema.ts was printed from jazz.app.json and jazz.permissions.json: repeated checks became helpers (rename them), and migrations/ holds the app's history.\",\n );\n const report: JsonOnlyReport = { written: writes.map(([p]) => rel(p)), notes };\n if (options.dryRun) return report;\n\n // Write; `generate`; the same deployment, or everything back.\n // Byte-exact undo: the app files, the bindings, migrations/ (removed if upgrade made it);\n // anything else `generate` adds goes too.\n const undo = snapshot(\n appOutputs(\n dir,\n writes.map(([p]) => p),\n ),\n );\n const filesBefore = new Set(listFiles(dir));\n for (const [path, text] of writes) {\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, text);\n }\n try {\n await options.generate(dir);\n const after = await options.identity(\n readFileSync(appFile, \"utf8\"),\n readFileSync(permissionsFile, \"utf8\"),\n );\n const differences = options.differences(before, after);\n if (differences.length > 0) {\n throw new UpgradeRefusal(\n `the TS printed from the app's files would deploy differently, so upgrade put every file back:\\n${differences.map((d) => ` ${d}`).join(\"\\n\")}\\n` +\n \"Please report this with the app's jazz.app.json and jazz.permissions.json.\",\n );\n }\n } catch (error) {\n for (const path of listFiles(dir)) if (!filesBefore.has(path)) rmSync(path, { force: true });\n undo.restore();\n if (error instanceof UpgradeRefusal) throw error;\n throw new UpgradeRefusal(\n `\\`generate\\` failed on the printed TS, so upgrade put every file back:\\n ${(error instanceof Error ? error.message : String(error)).replace(/\\n/g, \"\\n \")}`,\n );\n }\n report.written.push(rel(appFile), rel(permissionsFile));\n report.notes.push(\n `The schema hashes and the bundle id (${before.bundle.slice(0, 12)}) are unchanged.`,\n );\n return report;\n}\n\nfunction listFiles(dir: string): string[] {\n const out: string[] = [];\n const walk = (current: string) => {\n for (const entry of readdirSync(current, { withFileTypes: true })) {\n if (entry.name === \"node_modules\" || entry.name === \".git\" || entry.name === \"target\")\n continue;\n const path = join(current, entry.name);\n if (entry.isDirectory()) walk(path);\n else out.push(path);\n }\n };\n walk(dir);\n return out;\n}\n"]}
@@ -1,29 +0,0 @@
1
- /**
2
- * The names `jazz.generated.ts` gives a table's types, as jazz-codegen
3
- * derives them (`crates/jazz-codegen/src/names.rs`): PascalCase singular for
4
- * the row (`chatMembers` → `ChatMember`), `<Row>Insert` for inserts and
5
- * `<Row><Column>` for an enum column's type. upgrade reads the generated
6
- * module when it could be generated and falls back to these rules when the
7
- * app file still has TODOs to resolve.
8
- */
9
- /** PascalCase of an authored name: `chat_members` and `chatMembers` both give `ChatMembers`. */
10
- export declare function pascal(name: string): string;
11
- /** The singular of the last word of a (plural) table name. */
12
- export declare function singular(name: string): string;
13
- /** The generated row interface of a table. */
14
- export declare function rowTypeName(table: string): string;
15
- /** The generated names of a table's types, by role. */
16
- export interface TableTypeNames {
17
- row: string;
18
- insert: string;
19
- }
20
- /**
21
- * The table → type names a generated module declares, read from its
22
- * `interface Types` (`chats: { row: Chat; insert: ChatInsert; … }`), and
23
- * every name it exports.
24
- */
25
- export declare function readGeneratedNames(text: string): {
26
- tables: Record<string, TableTypeNames>;
27
- exports: Set<string>;
28
- };
29
- //# sourceMappingURL=names.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"names.d.ts","sourceRoot":"","sources":["../../src/upgrade/names.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,gGAAgG;AAChG,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM3C;AA8BD,8DAA8D;AAC9D,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAoC7C;AAED,8CAA8C;AAC9C,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,uDAAuD;AACvD,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG;IAChD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACvC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACtB,CAcA"}
@@ -1,105 +0,0 @@
1
- /**
2
- * The names `jazz.generated.ts` gives a table's types, as jazz-codegen
3
- * derives them (`crates/jazz-codegen/src/names.rs`): PascalCase singular for
4
- * the row (`chatMembers` → `ChatMember`), `<Row>Insert` for inserts and
5
- * `<Row><Column>` for an enum column's type. upgrade reads the generated
6
- * module when it could be generated and falls back to these rules when the
7
- * app file still has TODOs to resolve.
8
- */
9
- /** PascalCase of an authored name: `chat_members` and `chatMembers` both give `ChatMembers`. */
10
- export function pascal(name) {
11
- return name
12
- .split("_")
13
- .filter((part) => part.length > 0)
14
- .map((part) => part[0].toUpperCase() + part.slice(1))
15
- .join("");
16
- }
17
- const S_SINGULARS = new Set([
18
- "alias",
19
- "atlas",
20
- "bias",
21
- "bonus",
22
- "bus",
23
- "campus",
24
- "canvas",
25
- "census",
26
- "focus",
27
- "gas",
28
- "lens",
29
- "radius",
30
- "status",
31
- "virus",
32
- ]);
33
- const IRREGULAR = {
34
- people: "person",
35
- children: "child",
36
- men: "man",
37
- women: "woman",
38
- mice: "mouse",
39
- geese: "goose",
40
- feet: "foot",
41
- teeth: "tooth",
42
- };
43
- /** The singular of the last word of a (plural) table name. */
44
- export function singular(name) {
45
- let split = 0;
46
- for (let i = name.length - 1; i > 0; i--) {
47
- const c = name[i];
48
- if (c === "_") {
49
- split = i + 1;
50
- break;
51
- }
52
- if (c >= "A" && c <= "Z") {
53
- split = i;
54
- break;
55
- }
56
- }
57
- const head = name.slice(0, split);
58
- const word = name.slice(split);
59
- const lower = word.toLowerCase();
60
- const keepCase = (one) => {
61
- const first = word[0];
62
- return first && first >= "A" && first <= "Z" ? first + one.slice(1) : one;
63
- };
64
- let one;
65
- if (IRREGULAR[lower] !== undefined)
66
- one = keepCase(IRREGULAR[lower]);
67
- else if (lower.length > 3 && lower.endsWith("ies"))
68
- one = `${word.slice(0, -3)}y`;
69
- else if (lower.endsWith("ses") && S_SINGULARS.has(lower.slice(0, -2)))
70
- one = word.slice(0, -2);
71
- else if (["sses", "ches", "shes", "xes", "zes"].some((end) => lower.endsWith(end)))
72
- one = word.slice(0, -2);
73
- else if (lower.length > 1 &&
74
- lower.endsWith("s") &&
75
- !lower.endsWith("ss") &&
76
- !lower.endsWith("us") &&
77
- !lower.endsWith("is")) {
78
- one = word.slice(0, -1);
79
- }
80
- else
81
- one = word;
82
- return `${head}${one}`;
83
- }
84
- /** The generated row interface of a table. */
85
- export function rowTypeName(table) {
86
- return pascal(singular(table));
87
- }
88
- /**
89
- * The table → type names a generated module declares, read from its
90
- * `interface Types` (`chats: { row: Chat; insert: ChatInsert; … }`), and
91
- * every name it exports.
92
- */
93
- export function readGeneratedNames(text) {
94
- const tables = {};
95
- const re = /^\s{2}(?:"([^"]+)"|([A-Za-z_$][\w$]*)): \{\s*\n?\s*row: ([A-Za-z_$][\w$]*);\s*\n?\s*insert: ([A-Za-z_$][\w$]*);/gm;
96
- for (const match of text.matchAll(re)) {
97
- tables[match[1] ?? match[2]] = { row: match[3], insert: match[4] };
98
- }
99
- const exports = new Set();
100
- for (const match of text.matchAll(/^export (?:declare )?(?:interface|type|const|function|class|enum) ([A-Za-z_$][\w$]*)/gm)) {
101
- exports.add(match[1]);
102
- }
103
- return { tables, exports };
104
- }
105
- //# sourceMappingURL=names.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"names.js","sourceRoot":"","sources":["../../src/upgrade/names.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,gGAAgG;AAChG,MAAM,UAAU,MAAM,CAAC,IAAY;IACjC,OAAO,IAAI;SACR,KAAK,CAAC,GAAG,CAAC;SACV,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;SACjC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACrD,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,KAAK;IACL,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,OAAO;CACR,CAAC,CAAC;AAEH,MAAM,SAAS,GAA2B;IACxC,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,OAAO;IACjB,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,IAAI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MAAM,GAAmC,EAAE,CAAC;IAClD,MAAM,EAAE,GACN,mHAAmH,CAAC;IACtH,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;QACtC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAE,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAE,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAE,EAAE,CAAC;IACxE,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAC/B,wFAAwF,CACzF,EAAE,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC","sourcesContent":["/**\n * The names `jazz.generated.ts` gives a table's types, as jazz-codegen\n * derives them (`crates/jazz-codegen/src/names.rs`): PascalCase singular for\n * the row (`chatMembers` → `ChatMember`), `<Row>Insert` for inserts and\n * `<Row><Column>` for an enum column's type. upgrade reads the generated\n * module when it could be generated and falls back to these rules when the\n * app file still has TODOs to resolve.\n */\n\n/** PascalCase of an authored name: `chat_members` and `chatMembers` both give `ChatMembers`. */\nexport function pascal(name: string): string {\n return name\n .split(\"_\")\n .filter((part) => part.length > 0)\n .map((part) => part[0]!.toUpperCase() + part.slice(1))\n .join(\"\");\n}\n\nconst S_SINGULARS = new Set([\n \"alias\",\n \"atlas\",\n \"bias\",\n \"bonus\",\n \"bus\",\n \"campus\",\n \"canvas\",\n \"census\",\n \"focus\",\n \"gas\",\n \"lens\",\n \"radius\",\n \"status\",\n \"virus\",\n]);\n\nconst IRREGULAR: Record<string, string> = {\n people: \"person\",\n children: \"child\",\n men: \"man\",\n women: \"woman\",\n mice: \"mouse\",\n geese: \"goose\",\n feet: \"foot\",\n teeth: \"tooth\",\n};\n\n/** The singular of the last word of a (plural) table name. */\nexport function singular(name: string): string {\n let split = 0;\n for (let i = name.length - 1; i > 0; i--) {\n const c = name[i]!;\n if (c === \"_\") {\n split = i + 1;\n break;\n }\n if (c >= \"A\" && c <= \"Z\") {\n split = i;\n break;\n }\n }\n const head = name.slice(0, split);\n const word = name.slice(split);\n const lower = word.toLowerCase();\n const keepCase = (one: string): string => {\n const first = word[0];\n return first && first >= \"A\" && first <= \"Z\" ? first + one.slice(1) : one;\n };\n let one: string;\n if (IRREGULAR[lower] !== undefined) one = keepCase(IRREGULAR[lower]!);\n else if (lower.length > 3 && lower.endsWith(\"ies\")) one = `${word.slice(0, -3)}y`;\n else if (lower.endsWith(\"ses\") && S_SINGULARS.has(lower.slice(0, -2))) one = word.slice(0, -2);\n else if ([\"sses\", \"ches\", \"shes\", \"xes\", \"zes\"].some((end) => lower.endsWith(end)))\n one = word.slice(0, -2);\n else if (\n lower.length > 1 &&\n lower.endsWith(\"s\") &&\n !lower.endsWith(\"ss\") &&\n !lower.endsWith(\"us\") &&\n !lower.endsWith(\"is\")\n ) {\n one = word.slice(0, -1);\n } else one = word;\n return `${head}${one}`;\n}\n\n/** The generated row interface of a table. */\nexport function rowTypeName(table: string): string {\n return pascal(singular(table));\n}\n\n/** The generated names of a table's types, by role. */\nexport interface TableTypeNames {\n row: string;\n insert: string;\n}\n\n/**\n * The table → type names a generated module declares, read from its\n * `interface Types` (`chats: { row: Chat; insert: ChatInsert; … }`), and\n * every name it exports.\n */\nexport function readGeneratedNames(text: string): {\n tables: Record<string, TableTypeNames>;\n exports: Set<string>;\n} {\n const tables: Record<string, TableTypeNames> = {};\n const re =\n /^\\s{2}(?:\"([^\"]+)\"|([A-Za-z_$][\\w$]*)): \\{\\s*\\n?\\s*row: ([A-Za-z_$][\\w$]*);\\s*\\n?\\s*insert: ([A-Za-z_$][\\w$]*);/gm;\n for (const match of text.matchAll(re)) {\n tables[match[1] ?? match[2]!] = { row: match[3]!, insert: match[4]! };\n }\n const exports = new Set<string>();\n for (const match of text.matchAll(\n /^export (?:declare )?(?:interface|type|const|function|class|enum) ([A-Za-z_$][\\w$]*)/gm,\n )) {\n exports.add(match[1]!);\n }\n return { tables, exports };\n}\n"]}
@@ -1,18 +0,0 @@
1
- /**
2
- * Enum columns with cases (`s.enum({ bug: { severity: s.int() }, … })`,
3
- * `{ "enum": { "bug": { … }, … } }` in jazz.app.json) are removed in
4
- * alpha.65, and its loaders refuse an app whose current tables declare one.
5
- * No alpha.64 store could hold a value of one either: every write failed
6
- * (jazz#5621). So upgrade refuses such an app, naming each column, rather
7
- * than write files the loader then refuses.
8
- *
9
- * Older versions are another matter: a store keeps every version it admitted,
10
- * and the loader reads an enum with cases in `history` and in migrations'
11
- * `add`/`drop` types as a legacy type that hashes as alpha.64 did. Those pass
12
- * through unchanged, so an app that has since moved off one can upgrade.
13
- */
14
- import { type JsonObject } from "./app-json.js";
15
- /** `table.column` of every enum column with cases in the current tables (not history or migrations). */
16
- export declare function payloadEnumColumns(app: JsonObject): string[];
17
- export declare function refusePayloadEnums(app: JsonObject): void;
18
- //# sourceMappingURL=payload-enums.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"payload-enums.d.ts","sourceRoot":"","sources":["../../src/upgrade/payload-enums.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAkC,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhF,wGAAwG;AACxG,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,EAAE,CAW5D;AASD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAYxD"}
@@ -1,52 +0,0 @@
1
- /**
2
- * Enum columns with cases (`s.enum({ bug: { severity: s.int() }, … })`,
3
- * `{ "enum": { "bug": { … }, … } }` in jazz.app.json) are removed in
4
- * alpha.65, and its loaders refuse an app whose current tables declare one.
5
- * No alpha.64 store could hold a value of one either: every write failed
6
- * (jazz#5621). So upgrade refuses such an app, naming each column, rather
7
- * than write files the loader then refuses.
8
- *
9
- * Older versions are another matter: a store keeps every version it admitted,
10
- * and the loader reads an enum with cases in `history` and in migrations'
11
- * `add`/`drop` types as a legacy type that hashes as alpha.64 did. Those pass
12
- * through unchanged, so an app that has since moved off one can upgrade.
13
- */
14
- import { entriesOf, isObject } from "./app-json.js";
15
- import { UpgradeRefusal } from "./errors.js";
16
- /** `table.column` of every enum column with cases in the current tables (not history or migrations). */
17
- export function payloadEnumColumns(app) {
18
- const found = [];
19
- if (!isObject(app.tables))
20
- return found;
21
- for (const [table, spec] of entriesOf(app.tables)) {
22
- const columns = isObject(spec) ? spec.columns : undefined;
23
- if (!isObject(columns))
24
- continue;
25
- for (const [column, type] of entriesOf(columns)) {
26
- if (hasCases(type))
27
- found.push(`${table}.${column}`);
28
- }
29
- }
30
- return found;
31
- }
32
- /** A column type that is, or holds (as an array's element), an enum with cases. */
33
- function hasCases(type) {
34
- if (!isObject(type))
35
- return false;
36
- if (isObject(type.enum))
37
- return true;
38
- return type.array !== undefined && hasCases(type.array);
39
- }
40
- export function refusePayloadEnums(app) {
41
- const columns = payloadEnumColumns(app);
42
- if (columns.length === 0)
43
- return;
44
- const named = columns.map((c) => `"${c}"`).join(", ");
45
- throw new UpgradeRefusal(`column${columns.length === 1 ? "" : "s"} ${named} declare${columns.length === 1 ? "s" : ""} an enum whose cases carry fields, ` +
46
- "which Jazz no longer supports (see https://github.com/garden-co/jazz/issues/5758; no store could hold " +
47
- "one, as every write failed: jazz#5621). In schema.ts, change it to a string enum plus a nullable column per " +
48
- 'field (`kind: s.enum("bug", "feature"), severity: s.int().optional(), area: s.string().optional()`), or a ' +
49
- "`s.json()` column when the payloads are irregular. Then run `npx jazz-tools validate` with the app's alpha.65 " +
50
- "(`migrations create` first, if a store holds the table) and `jazz-tools upgrade` again.");
51
- }
52
- //# sourceMappingURL=payload-enums.js.map
@@ -1 +0,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AkB,CAAC,GAAe;IAChD,MAAM,OAAO,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IACjC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtD,MAAM,IAAI,cAAc,CACtB,SAAS,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,WAAW,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,qCAAqC;QAC9H,wGAAwG;QACxG,8GAA8G;QAC9G,4GAA4G;QAC5G,gHAAgH;QAChH,yFAAyF,CAC5F,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Enum columns with cases (`s.enum({ bug: { severity: s.int() }, … })`,\n * `{ \"enum\": { \"bug\": { … }, … } }` in jazz.app.json) are removed in\n * alpha.65, and its loaders refuse an app whose current tables declare one.\n * No alpha.64 store could hold a value of one either: every write failed\n * (jazz#5621). So upgrade refuses such an app, naming each column, rather\n * than write files the loader then refuses.\n *\n * Older versions are another matter: a store keeps every version it admitted,\n * and the loader reads an enum with cases in `history` and in migrations'\n * `add`/`drop` types as a legacy type that hashes as alpha.64 did. Those pass\n * through unchanged, so an app that has since moved off one can upgrade.\n */\nimport { entriesOf, isObject, type Json, type JsonObject } from \"./app-json.js\";\nimport { UpgradeRefusal } from \"./errors.js\";\n\n/** `table.column` of every enum column with cases in the current tables (not history or migrations). */\nexport function payloadEnumColumns(app: JsonObject): string[] {\n const found: string[] = [];\n if (!isObject(app.tables)) return found;\n for (const [table, spec] of entriesOf(app.tables)) {\n const columns = isObject(spec) ? spec.columns : undefined;\n if (!isObject(columns)) continue;\n for (const [column, type] of entriesOf(columns)) {\n if (hasCases(type)) found.push(`${table}.${column}`);\n }\n }\n return found;\n}\n\n/** A column type that is, or holds (as an array's element), an enum with cases. */\nfunction hasCases(type: Json): boolean {\n if (!isObject(type)) return false;\n if (isObject(type.enum)) return true;\n return type.array !== undefined && hasCases(type.array);\n}\n\nexport function refusePayloadEnums(app: JsonObject): void {\n const columns = payloadEnumColumns(app);\n if (columns.length === 0) return;\n const named = columns.map((c) => `\"${c}\"`).join(\", \");\n throw new UpgradeRefusal(\n `column${columns.length === 1 ? \"\" : \"s\"} ${named} declare${columns.length === 1 ? \"s\" : \"\"} an enum whose cases carry fields, ` +\n \"which Jazz no longer supports (see https://github.com/garden-co/jazz/issues/5758; no store could hold \" +\n \"one, as every write failed: jazz#5621). In schema.ts, change it to a string enum plus a nullable column per \" +\n 'field (`kind: s.enum(\"bug\", \"feature\"), severity: s.int().optional(), area: s.string().optional()`), or a ' +\n \"`s.json()` column when the payloads are irregular. Then run `npx jazz-tools validate` with the app's alpha.65 \" +\n \"(`migrations create` first, if a store holds the table) and `jazz-tools upgrade` again.\",\n );\n}\n"]}