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":"removed-schema-api.js","sourceRoot":"","sources":["../src/removed-schema-api.ts"],"names":[],"mappings":"AAWA,uFAAuF;AACvF,MAAM,CAAC,MAAM,yBAAyB,GACpC,+EAA+E,CAAC;AAElF,MAAM,cAAc,GAClB,uHAAuH;IACvH,sHAAsH;IACtH,qEAAqE,CAAC;AAExE;;;;GAIG;AACH,MAAM,sBAAsB,GAAqC;IAC/D,SAAS,EACP,qIAAqI;IACvI,kBAAkB,EAChB,qIAAqI;IACvI,kBAAkB,EAChB,qIAAqI;IACvI,2BAA2B,EACzB,qIAAqI;IACvI,YAAY,EAAE,0EAA0E;IACxF,iBAAiB,EACf,kKAAkK;IACpK,0BAA0B,EACxB,kKAAkK;IACpK,eAAe,EACb,wFAAwF;IAC1F,eAAe,EACb,oFAAoF;IACtF,KAAK,EAAE,kEAAkE;IACzE,KAAK,EAAE,2DAA2D;IAClE,KAAK,EAAE,2DAA2D;IAClE,oBAAoB,EAAE,+DAA+D;CACtF,CAAC;AAEF,2EAA2E;AAC3E,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,MAAM,WAAW,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,WAAW;QACzB,CAAC,CAAC,sBAAsB,IAAI,iBAAiB,WAAW,gFAAgF,yBAAyB,EAAE;QACnK,CAAC,CAAC,sBAAsB,IAAI,iBAAiB,cAAc,SAAS,yBAAyB,EAAE,CAAC;IAClG,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK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I;AAC7I,MAAM,CAAC,MAAM,YAAY,GAAe,aAAa,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;AACvF,iJAAiJ;AACjJ,MAAM,CAAC,MAAM,KAAK,GAAe,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;AACzE,0IAA0I;AAC1I,MAAM,CAAC,MAAM,KAAK,GAAe,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;AACzE,0IAA0I;AAC1I,MAAM,CAAC,MAAM,KAAK,GAAe,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC","sourcesContent":["/**\n * Root-level exports of the alpha.64/65 schema, permissions and migrations\n * DSL that alpha.66's TS authoring replaced (`schema.ts` with\n * `s.defineSchema` and the schema's own `definePermissions`, compiled by\n * `npx jazz-tools generate` to `jazz.app.json`, `jazz.permissions.json` and\n * `jazz.generated.ts`). The names stay as stubs that throw when used, naming\n * the replacement and pointing at `jazz-tools upgrade`. Without them a\n * bundler's \"not exported\" error would guess a similarly named export.\n */\nimport { type RemovedApi } from \"./removed-api.js\";\n\n/** Where the upgrade from alpha.64 is written up (the alpha.65 section follows it). */\nexport const UPGRADE_FROM_ALPHA_64_URL =\n \"https://jazz.tools/docs/operating/backups-and-upgrades#upgrading-from-alpha64\";\n\nconst NO_REPLACEMENT =\n \"it has no replacement: jazz.app.json and jazz.permissions.json are now the app's schema, migrations and permissions, \" +\n \"generated from schema.ts (`s.defineSchema`) by `npx jazz-tools generate`, with typed bindings in jazz.generated.ts. \" +\n \"Run `npx jazz-tools upgrade` to convert an alpha.64 or alpha.65 app\";\n\n/**\n * What replaces each alpha.64 name in alpha.66's TS authoring (`schema.ts`\n * with `s.defineSchema` and `schema.definePermissions`). Names not here\n * have no replacement.\n */\nconst AUTHORING_REPLACEMENTS: Readonly<Record<string, string>> = {\n defineApp:\n \"define the schema with `export const schema = s.defineSchema({ … })` in schema.ts; runtime code imports `app` from ./jazz.generated\",\n \"schema.defineApp\":\n \"define the schema with `export const schema = s.defineSchema({ … })` in schema.ts; runtime code imports `app` from ./jazz.generated\",\n defineSliceableApp:\n \"schema slicing is gone: define the schema with `export const schema = s.defineSchema({ … })` and import `app` from ./jazz.generated\",\n \"schema.defineSliceableApp\":\n \"schema slicing is gone: define the schema with `export const schema = s.defineSchema({ … })` and import `app` from ./jazz.generated\",\n defineSchema: 'use `s.defineSchema({ … })` (`import { schema as s } from \"jazz-tools\"`)',\n definePermissions:\n \"permissions use the new DSL: `const { definePermissions } = schema; export const permissions = definePermissions({ <table>: { read, insert, update, delete } })`\",\n \"schema.definePermissions\":\n \"permissions use the new DSL: `const { definePermissions } = schema; export const permissions = definePermissions({ <table>: { read, insert, update, delete } })`\",\n defineMigration:\n 'use `migration.defineMigration({ … })` (`import { migration as m } from \"jazz-tools\"`)',\n renameTableFrom:\n 'use `migration.renameTableFrom(…)` (`import { migration as m } from \"jazz-tools\"`)',\n table: \"use `s.table(columns, relations)` inside `s.defineSchema({ … })`\",\n anyOf: \"use the schema's own `anyOf` (`const { anyOf } = schema`)\",\n allOf: \"use the schema's own `allOf` (`const { allOf } = schema`)\",\n createSessionContext: \"use the schema's own `session` (`const { session } = schema`)\",\n};\n\n/** The error a removed DSL export throws. `code` is `JAZZ_API_REMOVED`. */\nexport function removedSchemaApiError(name: string): Error {\n const replacement = AUTHORING_REPLACEMENTS[name];\n const message = replacement\n ? `[JAZZ_API_REMOVED] ${name} was removed: ${replacement}. Run \\`npx jazz-tools upgrade\\` to convert an alpha.64 or alpha.65 app. See ${UPGRADE_FROM_ALPHA_64_URL}`\n : `[JAZZ_API_REMOVED] ${name} was removed: ${NO_REPLACEMENT}. See ${UPGRADE_FROM_ALPHA_64_URL}`;\n return Object.assign(new Error(message), { code: \"JAZZ_API_REMOVED\" });\n}\n\n/** @internal A stub for a removed DSL export: throws when called or constructed. */\nexport function removedSchemaApi(name: string): RemovedApi {\n // A plain function (not a Proxy): React and Fast Refresh inspect exports,\n // which must stay inert. Calling or constructing it throws.\n const stub = function removedJazzSchemaApi(): never {\n throw removedSchemaApiError(name);\n };\n Object.defineProperty(stub, \"name\", { value: name });\n return stub as unknown as RemovedApi;\n}\n\n/**\n * What `s.enum({ ...cases })` throws: enum cases with fields are gone for\n * good, not just moved to jazz.app.json (jazz#5758).\n */\nexport const ENUM_CASES_NOT_SUPPORTED =\n 'enum cases with fields are not supported; use s.enum(\"a\", \"b\") plus a nullable column per field, or s.json() (see https://github.com/garden-co/jazz/issues/5758)';\n\n/** `schema.enum`: like every removed member, except that the object form names its own refusal. */\nfunction removedEnum(): RemovedApi {\n const stub = function removedJazzSchemaApi(...args: unknown[]): never {\n if (args.length === 1 && typeof args[0] === \"object\" && args[0] !== null) {\n throw new Error(ENUM_CASES_NOT_SUPPORTED);\n }\n throw removedSchemaApiError(\"schema.enum\");\n };\n Object.defineProperty(stub, \"name\", { value: \"schema.enum\" });\n return stub as unknown as RemovedApi;\n}\n\n/** A removed namespace: each member it had is a stub that throws, naming itself. */\nfunction removedNamespace<const TMembers extends readonly string[]>(\n namespace: string,\n members: TMembers,\n): { readonly [K in TMembers[number]]: RemovedApi } {\n const stubs: Record<string, RemovedApi> = {};\n for (const member of members)\n stubs[member] =\n namespace === \"schema\" && member === \"enum\"\n ? removedEnum()\n : removedSchemaApi(`${namespace}.${member}`);\n return Object.freeze(stubs) as { readonly [K in TMembers[number]]: RemovedApi };\n}\n\n/**\n * @deprecated Not available here, and throws when used: the schema DSL is for\n * authoring only. Define the app in schema.ts (`s.defineSchema`), run\n * `npx jazz-tools generate`, and import `app` from ./jazz.generated at runtime.\n */\nexport const schema = /*#__PURE__*/ removedNamespace(\"schema\", [\n \"table\",\n \"computed\",\n \"string\",\n \"uuid\",\n \"boolean\",\n \"int\",\n \"bigint\",\n \"timestamp\",\n \"float\",\n \"bytes\",\n \"json\",\n \"enum\",\n \"array\",\n \"rel\",\n \"reverse\",\n \"defineApp\",\n \"defineSchema\",\n \"defineSliceableApp\",\n \"definePermissions\",\n \"allowExternalProvenanceName\",\n] as const);\n\n/**\n * @deprecated Not available here, and throws when used: migrations are\n * authored in migrations/*.ts, written by `npx jazz-tools migrations create`.\n */\nexport const migration = /*#__PURE__*/ removedNamespace(\"migration\", [\n \"add\",\n \"drop\",\n \"renameFrom\",\n \"defineMigration\",\n \"renameTableFrom\",\n] as const);\n\n/** @deprecated Removed, and throws when used: define the schema in schema.ts with `export const schema = s.defineSchema({ … })`; import `app` from ./jazz.generated. Run `npx jazz-tools upgrade`. */\nexport const defineApp: RemovedApi = /*#__PURE__*/ removedSchemaApi(\"defineApp\");\n/** @deprecated Removed, and throws when used: use `s.defineSchema({ … })` (`import { schema as s } from \"jazz-tools\"`). Run `npx jazz-tools upgrade`. */\nexport const defineSchema: RemovedApi = /*#__PURE__*/ removedSchemaApi(\"defineSchema\");\n/** @deprecated Removed, and throws when used: schema slicing is gone; use `s.defineSchema({ … })` and the generated `app`. Run `npx jazz-tools upgrade`. */\nexport const defineSliceableApp: RemovedApi = /*#__PURE__*/ removedSchemaApi(\"defineSliceableApp\");\n/** @deprecated Removed, and throws when used: use the schema's own `definePermissions` (`const { definePermissions } = schema`). Run `npx jazz-tools upgrade`. */\nexport const definePermissions: RemovedApi = /*#__PURE__*/ removedSchemaApi(\"definePermissions\");\n/** @deprecated Removed, and throws when used: use `m.defineMigration` (`import { migration as m } from \"jazz-tools\"`). Run `npx jazz-tools upgrade`. */\nexport const defineMigration: RemovedApi = /*#__PURE__*/ removedSchemaApi(\"defineMigration\");\n/** @deprecated Removed, and throws when used: use `m.renameTableFrom` (`import { migration as m } from \"jazz-tools\"`). Run `npx jazz-tools upgrade`. */\nexport const renameTableFrom: RemovedApi = /*#__PURE__*/ removedSchemaApi(\"renameTableFrom\");\n/** @deprecated Removed, and throws when used: no replacement: jazz.generated.ts embeds the compiled schema. Run `npx jazz-tools upgrade`. */\nexport const schemaToWasm: RemovedApi = /*#__PURE__*/ removedSchemaApi(\"schemaToWasm\");\n/** @deprecated Removed, and throws when used: use `s.table(columns, relations)` inside `s.defineSchema({ … })`. Run `npx jazz-tools upgrade`. */\nexport const table: RemovedApi = /*#__PURE__*/ removedSchemaApi(\"table\");\n/** @deprecated Removed, and throws when used: use the schema's own `anyOf` (`const { anyOf } = schema`). Run `npx jazz-tools upgrade`. */\nexport const anyOf: RemovedApi = /*#__PURE__*/ removedSchemaApi(\"anyOf\");\n/** @deprecated Removed, and throws when used: use the schema's own `allOf` (`const { allOf } = schema`). Run `npx jazz-tools upgrade`. */\nexport const allOf: RemovedApi = /*#__PURE__*/ removedSchemaApi(\"allOf\");\n"]}
@@ -1,8 +0,0 @@
1
- /**
2
- * @internal Warn once, outside production builds, that a framework's
3
- * permission-session hook (`useSession()`, Svelte `getSession()`) is
4
- * deprecated. It still works in alpha.66; it throws, naming its replacement,
5
- * from a later release.
6
- */
7
- export declare function warnSessionHookDeprecated(name: string, replacement: string): void;
8
- //# sourceMappingURL=deprecated-session-hook.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deprecated-session-hook.d.ts","sourceRoot":"","sources":["../../src/session/deprecated-session-hook.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAOjF"}
@@ -1,28 +0,0 @@
1
- const warned = new Set();
2
- /**
3
- * @internal Warn once, outside production builds, that a framework's
4
- * permission-session hook (`useSession()`, Svelte `getSession()`) is
5
- * deprecated. It still works in alpha.66; it throws, naming its replacement,
6
- * from a later release.
7
- */
8
- export function warnSessionHookDeprecated(name, replacement) {
9
- if (warned.has(name) || isProductionBuild())
10
- return;
11
- warned.add(name);
12
- console.warn(`[jazz] ${name} is deprecated and will be removed in a later alpha: use ${replacement} ` +
13
- "(its `user` is what your permissions see as `session`; `user` is now `accountId`).");
14
- }
15
- /**
16
- * Spelled `process.env.NODE_ENV` so bundlers replace it with the build's mode.
17
- * Where nothing replaced it and there is no `process` (an unbundled browser
18
- * module), it throws, and that counts as development.
19
- */
20
- function isProductionBuild() {
21
- try {
22
- return process.env.NODE_ENV === "production";
23
- }
24
- catch {
25
- return false;
26
- }
27
- }
28
- //# sourceMappingURL=deprecated-session-hook.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deprecated-session-hook.js","sourceRoot":"","sources":["../../src/session/deprecated-session-hook.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAAY,EAAE,WAAmB;IACzE,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,iBAAiB,EAAE;QAAE,OAAO;IACpD,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjB,OAAO,CAAC,IAAI,CACV,UAAU,IAAI,4DAA4D,WAAW,GAAG;QACtF,oFAAoF,CACvF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB;IACxB,IAAI,CAAC;QACH,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["const warned = new Set<string>();\n\n/**\n * @internal Warn once, outside production builds, that a framework's\n * permission-session hook (`useSession()`, Svelte `getSession()`) is\n * deprecated. It still works in alpha.66; it throws, naming its replacement,\n * from a later release.\n */\nexport function warnSessionHookDeprecated(name: string, replacement: string): void {\n if (warned.has(name) || isProductionBuild()) return;\n warned.add(name);\n console.warn(\n `[jazz] ${name} is deprecated and will be removed in a later alpha: use ${replacement} ` +\n \"(its `user` is what your permissions see as `session`; `user` is now `accountId`).\",\n );\n}\n\n/**\n * Spelled `process.env.NODE_ENV` so bundlers replace it with the build's mode.\n * Where nothing replaced it and there is no `process` (an unbundled browser\n * module), it throws, and that counts as development.\n */\nfunction isProductionBuild(): boolean {\n try {\n return process.env.NODE_ENV === \"production\";\n } catch {\n return false;\n }\n}\n"]}
@@ -1,181 +0,0 @@
1
- <!--
2
- Makes a Jazz client available to descendant Svelte components through context.
3
- Pass a reactive database configuration. The provider creates the client and
4
- serialises shutdown before starting a replacement.
5
- -->
6
- <script lang="ts">
7
- import type { Db } from '../runtime/db.js';
8
- import type { AccountDbConfig as DbConfig } from '../accounts/context.js';
9
- import { serializeClientConfig } from '../runtime/client-config-key.js';
10
- import JazzSvelteClientProvider from './JazzSvelteClientProvider.svelte';
11
- import { openJazzClient, type JazzClient } from './create-jazz-client.js';
12
- import { assertNoClassicProviderProps } from '../classic-api.js';
13
- import { refuseAutoAttachDevTools, type NoAutoAttachDevTools } from '../runtime/removed-provider-props.js';
14
- import { toError } from '../runtime/util.js';
15
-
16
- interface Props extends NoAutoAttachDevTools {
17
- config: DbConfig;
18
- children: import('svelte').Snippet<[{ db: Db }]>;
19
- fallback?: import('svelte').Snippet;
20
- }
21
-
22
- type ConfigSnapshot =
23
- | { config: DbConfig; key: string }
24
- | { error: unknown };
25
-
26
- function isPlainRecord(value: object): value is Record<string, unknown> {
27
- const prototype = Object.getPrototypeOf(value);
28
- return prototype === Object.prototype || prototype === null;
29
- }
30
-
31
- function cloneConfigValue(value: unknown, seen: WeakMap<object, unknown>): unknown {
32
- if (value === null || typeof value !== 'object') {
33
- return value;
34
- }
35
-
36
- const previous = seen.get(value);
37
- if (previous !== undefined) {
38
- return previous;
39
- }
40
-
41
- if (value instanceof Date) {
42
- return new Date(value.getTime());
43
- }
44
-
45
- if (Array.isArray(value)) {
46
- const clone: unknown[] = [];
47
- seen.set(value, clone);
48
- for (let index = 0; index < value.length; index++) {
49
- clone[index] = cloneConfigValue(value[index], seen);
50
- }
51
- return clone;
52
- }
53
-
54
- if (!isPlainRecord(value)) {
55
- return value;
56
- }
57
-
58
- const clone = Object.create(Object.getPrototypeOf(value)) as Record<string, unknown>;
59
- seen.set(value, clone);
60
- for (const key of Object.keys(value)) {
61
- clone[key] = cloneConfigValue(value[key], seen);
62
- }
63
- return clone;
64
- }
65
-
66
- function captureConfig(config: DbConfig): DbConfig {
67
- // Config is a known in-process DbConfig; cloning only plain values gives
68
- // the async handover an immutable snapshot while retaining opaque refs.
69
- const captured = cloneConfigValue(config, new WeakMap()) as DbConfig;
70
- return captured;
71
- }
72
-
73
- let { config, children, fallback, ...otherProps }: Props = $props();
74
-
75
- function validateClassicProps() {
76
- refuseAutoAttachDevTools('JazzSvelteProvider', otherProps);
77
- assertNoClassicProviderProps('JazzSvelteProvider', otherProps);
78
- }
79
-
80
- validateClassicProps();
81
-
82
- let error = $state<Error | null>(null);
83
- let client = $state<JazzClient | null>(null);
84
- let activeClient: JazzClient | null = null;
85
- let handover = Promise.resolve();
86
- let previousSnapshot: ConfigSnapshot | undefined;
87
-
88
- let configSnapshot = $derived.by((): ConfigSnapshot => {
89
- try {
90
- const captured = captureConfig(config);
91
- const nextSnapshot = { config: captured, key: serializeClientConfig(captured) };
92
- if (
93
- previousSnapshot &&
94
- 'config' in previousSnapshot &&
95
- previousSnapshot.key === nextSnapshot.key
96
- ) {
97
- return previousSnapshot;
98
- }
99
- previousSnapshot = nextSnapshot;
100
- return nextSnapshot;
101
- } catch (reason) {
102
- return { error: reason };
103
- }
104
- });
105
-
106
- $effect(() => {
107
- validateClassicProps();
108
- let cancelled = false;
109
- const snapshot = configSnapshot;
110
-
111
- error = null;
112
- client = null;
113
-
114
- const clientToShutdown = () => {
115
- const current = activeClient;
116
- activeClient = null;
117
- const shuttingDown = handover.then(() => current?.shutdown());
118
- shuttingDown.catch(() => {});
119
- handover = shuttingDown;
120
- };
121
-
122
- if ('error' in snapshot) {
123
- clientToShutdown();
124
- error = toError(snapshot.error);
125
- return () => {
126
- cancelled = true;
127
- client = null;
128
- };
129
- }
130
-
131
- const nextConfig = snapshot.config;
132
- handover = handover
133
- .then(async () => {
134
- if (cancelled) {
135
- return;
136
- }
137
-
138
- validateClassicProps();
139
- const createdClient = await openJazzClient(nextConfig);
140
- if (cancelled) {
141
- await createdClient.shutdown();
142
- return;
143
- }
144
- try {
145
- validateClassicProps();
146
- } catch (reason) {
147
- await createdClient.shutdown();
148
- throw reason;
149
- }
150
-
151
- activeClient = createdClient;
152
- client = createdClient;
153
- })
154
- .catch((reason) => {
155
- if (cancelled) {
156
- return;
157
- }
158
-
159
- error = toError(reason);
160
- });
161
-
162
- return () => {
163
- cancelled = true;
164
- client = null;
165
- clientToShutdown();
166
- };
167
- });
168
- </script>
169
-
170
- {#if error}
171
- <!-- Re-throw so an error boundary can catch it -->
172
- {(() => { throw error; })()}
173
- {:else if client}
174
- <JazzSvelteClientProvider {client} {fallback}>
175
- {#snippet children({ db })}
176
- {@render children({ db })}
177
- {/snippet}
178
- </JazzSvelteClientProvider>
179
- {:else if fallback}
180
- {@render fallback()}
181
- {/if}
@@ -1,14 +0,0 @@
1
- import type { Db } from '../runtime/db.js';
2
- import type { AccountDbConfig as DbConfig } from '../accounts/context.js';
3
- import { type NoAutoAttachDevTools } from '../runtime/removed-provider-props.js';
4
- interface Props extends NoAutoAttachDevTools {
5
- config: DbConfig;
6
- children: import('svelte').Snippet<[{
7
- db: Db;
8
- }]>;
9
- fallback?: import('svelte').Snippet;
10
- }
11
- declare const JazzSvelteProvider: import("svelte").Component<Props, {}, "">;
12
- type JazzSvelteProvider = ReturnType<typeof JazzSvelteProvider>;
13
- export default JazzSvelteProvider;
14
- //# sourceMappingURL=JazzSvelteProvider.svelte.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"JazzSvelteProvider.svelte.d.ts","sourceRoot":"","sources":["../../src/svelte/JazzSvelteProvider.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,IAAI,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAK1E,OAAO,EAA4B,KAAK,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAI1G,UAAU,KAAM,SAAQ,oBAAoB;IAC3C,MAAM,EAAE,QAAQ,CAAC;IACjB,QAAQ,EAAE,OAAO,QAAQ,EAAE,OAAO,CAAC,CAAC;QAAE,EAAE,EAAE,EAAE,CAAA;KAAE,CAAC,CAAC,CAAC;IACjD,QAAQ,CAAC,EAAE,OAAO,QAAQ,EAAE,OAAO,CAAC;CACpC;AAiLF,QAAA,MAAM,kBAAkB,2CAAwC,CAAC;AACjE,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAChE,eAAe,kBAAkB,CAAC"}
@@ -1,25 +0,0 @@
1
- export interface AliasEdit {
2
- /** The package.json. */
3
- file: string;
4
- alias: string;
5
- from: string;
6
- to: string;
7
- }
8
- export declare class PackageAliases {
9
- private readonly root;
10
- private readonly edits;
11
- constructor(root: string);
12
- /**
13
- * Point `alias` (as written in `importer`) from `from` at `to`, when the
14
- * importer's package maps it straight to `from`. Returns whether the alias
15
- * now names `to` and can stay as written.
16
- */
17
- retarget(alias: string, importer: string, from: string, to: string): boolean;
18
- /** The package.json files to rewrite, as their new text (from `base` when given). */
19
- apply(base?: Map<string, string>): Map<string, {
20
- text: string;
21
- changes: string[];
22
- }>;
23
- private manifestFor;
24
- }
25
- //# sourceMappingURL=aliases.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aliases.d.ts","sourceRoot":"","sources":["../../src/upgrade/aliases.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,SAAS;IACxB,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,qBAAa,cAAc;IAGb,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;gBAEzB,IAAI,EAAE,MAAM;IAEzC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO;IAqB5E,qFAAqF;IACrF,KAAK,CAAC,IAAI,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,GAAG,GAAG,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAmB9F,OAAO,CAAC,WAAW;CAWpB"}
@@ -1,80 +0,0 @@
1
- /**
2
- * `package.json` `imports` aliases (`"#app": "./schema.ts"`). Code that
3
- * imports the schema or permissions through one keeps the alias, and the
4
- * alias is pointed at the new file, so every importer, including ones
5
- * upgrade can't see (scripts, tools), follows.
6
- */
7
- import { existsSync, readFileSync } from "node:fs";
8
- import { dirname, join, relative, resolve, sep } from "node:path";
9
- export class PackageAliases {
10
- root;
11
- edits = new Map();
12
- constructor(root) {
13
- this.root = root;
14
- }
15
- /**
16
- * Point `alias` (as written in `importer`) from `from` at `to`, when the
17
- * importer's package maps it straight to `from`. Returns whether the alias
18
- * now names `to` and can stay as written.
19
- */
20
- retarget(alias, importer, from, to) {
21
- if (!alias.startsWith("#"))
22
- return false;
23
- const manifest = this.manifestFor(importer);
24
- if (!manifest)
25
- return false;
26
- const imports = JSON.parse(readFileSync(manifest, "utf8")).imports;
27
- const target = imports?.[alias];
28
- // Only a plain string mapping; conditions and patterns stay as they are.
29
- if (typeof target !== "string")
30
- return false;
31
- const dir = dirname(manifest);
32
- const key = `${manifest}\0${alias}`;
33
- const existing = this.edits.get(key);
34
- if (existing)
35
- return sameFile(resolve(dir, existing.to), to);
36
- if (!sameFile(resolve(dir, target), from))
37
- return false;
38
- let next = relative(dir, to).split(sep).join("/");
39
- if (!next.startsWith("."))
40
- next = `./${next}`;
41
- this.edits.set(key, { file: manifest, alias, from: target, to: next });
42
- return true;
43
- }
44
- /** The package.json files to rewrite, as their new text (from `base` when given). */
45
- apply(base = new Map()) {
46
- const out = new Map();
47
- for (const edit of this.edits.values()) {
48
- const current = out.get(edit.file) ?? {
49
- text: base.get(edit.file) ?? readFileSync(edit.file, "utf8"),
50
- changes: [],
51
- };
52
- const pattern = new RegExp(`(${escape(JSON.stringify(edit.alias))}\\s*:\\s*)${escape(JSON.stringify(edit.from))}`);
53
- current.text = current.text.replace(pattern, `$1${JSON.stringify(edit.to)}`);
54
- current.changes.push(`${relative(this.root, edit.file) || "package.json"}: imports ${edit.alias}: ${edit.from} → ${edit.to}`);
55
- out.set(edit.file, current);
56
- }
57
- return out;
58
- }
59
- manifestFor(file) {
60
- for (let dir = dirname(file);; dir = dirname(dir)) {
61
- const manifest = join(dir, "package.json");
62
- if (existsSync(manifest)) {
63
- const parsed = JSON.parse(readFileSync(manifest, "utf8"));
64
- // The nearest package.json scopes `#` imports, whether or not it has a map.
65
- return parsed.imports ? manifest : undefined;
66
- }
67
- if (dir === this.root || dirname(dir) === dir)
68
- return undefined;
69
- }
70
- }
71
- }
72
- /** Whether two paths name the same module (`./schema.ts`, `./schema.js` and `./schema` do). */
73
- function sameFile(a, b) {
74
- const stem = (p) => p.replace(/\.(ts|tsx|mts|js|jsx|mjs|json)$/, "");
75
- return a === b || stem(a) === stem(b);
76
- }
77
- function escape(text) {
78
- return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
79
- }
80
- //# sourceMappingURL=aliases.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aliases.js","sourceRoot":"","sources":["../../src/upgrade/aliases.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAUlE,MAAM,OAAO,cAAc;IAGI;IAFZ,KAAK,GAAG,IAAI,GAAG,EAAqB,CAAC;IAEtD,YAA6B,IAAY;QAAZ,SAAI,GAAJ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;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAEO,WAAW,CAAC,IAAY;QAC9B,KAAK,IAAI,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,GAAI,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;YAC3C,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACzB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAA0B,CAAC;gBACnF,4EAA4E;gBAC5E,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;YAC/C,CAAC;YACD,IAAI,GAAG,KAAK,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG;gBAAE,OAAO,SAAS,CAAC;QAClE,CAAC;IACH,CAAC;CACF;AAED,+FAA+F;AAC/F,SAAS,QAAQ,CAAC,CAAS,EAAE,CAAS;IACpC,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,iCAAiC,EAAE,EAAE,CAAC,CAAC;IAC7E,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/**\n * `package.json` `imports` aliases (`\"#app\": \"./schema.ts\"`). Code that\n * imports the schema or permissions through one keeps the alias, and the\n * alias is pointed at the new file, so every importer, including ones\n * upgrade can't see (scripts, tools), follows.\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, join, relative, resolve, sep } from \"node:path\";\n\nexport interface AliasEdit {\n /** The package.json. */\n file: string;\n alias: string;\n from: string;\n to: string;\n}\n\nexport class PackageAliases {\n private readonly edits = new Map<string, AliasEdit>();\n\n constructor(private readonly root: string) {}\n\n /**\n * Point `alias` (as written in `importer`) from `from` at `to`, when the\n * importer's package maps it straight to `from`. Returns whether the alias\n * now names `to` and can stay as written.\n */\n retarget(alias: string, importer: string, from: string, to: string): boolean {\n if (!alias.startsWith(\"#\")) return false;\n const manifest = this.manifestFor(importer);\n if (!manifest) return false;\n const imports = (\n JSON.parse(readFileSync(manifest, \"utf8\")) as { imports?: Record<string, unknown> }\n ).imports;\n const target = imports?.[alias];\n // Only a plain string mapping; conditions and patterns stay as they are.\n if (typeof target !== \"string\") return false;\n const dir = dirname(manifest);\n const key = `${manifest}\\0${alias}`;\n const existing = this.edits.get(key);\n if (existing) return sameFile(resolve(dir, existing.to), to);\n if (!sameFile(resolve(dir, target), from)) return false;\n let next = relative(dir, to).split(sep).join(\"/\");\n if (!next.startsWith(\".\")) next = `./${next}`;\n this.edits.set(key, { file: manifest, alias, from: target, to: next });\n return true;\n }\n\n /** The package.json files to rewrite, as their new text (from `base` when given). */\n apply(base: Map<string, string> = new Map()): Map<string, { text: string; changes: string[] }> {\n const out = new Map<string, { text: string; changes: string[] }>();\n for (const edit of this.edits.values()) {\n const current = out.get(edit.file) ?? {\n text: base.get(edit.file) ?? readFileSync(edit.file, \"utf8\"),\n changes: [],\n };\n const pattern = new RegExp(\n `(${escape(JSON.stringify(edit.alias))}\\\\s*:\\\\s*)${escape(JSON.stringify(edit.from))}`,\n );\n current.text = current.text.replace(pattern, `$1${JSON.stringify(edit.to)}`);\n current.changes.push(\n `${relative(this.root, edit.file) || \"package.json\"}: imports ${edit.alias}: ${edit.from} → ${edit.to}`,\n );\n out.set(edit.file, current);\n }\n return out;\n }\n\n private manifestFor(file: string): string | undefined {\n for (let dir = dirname(file); ; dir = dirname(dir)) {\n const manifest = join(dir, \"package.json\");\n if (existsSync(manifest)) {\n const parsed = JSON.parse(readFileSync(manifest, \"utf8\")) as { imports?: unknown };\n // The nearest package.json scopes `#` imports, whether or not it has a map.\n return parsed.imports ? manifest : undefined;\n }\n if (dir === this.root || dirname(dir) === dir) return undefined;\n }\n }\n}\n\n/** Whether two paths name the same module (`./schema.ts`, `./schema.js` and `./schema` do). */\nfunction sameFile(a: string, b: string): boolean {\n const stem = (p: string) => p.replace(/\\.(ts|tsx|mts|js|jsx|mjs|json)$/, \"\");\n return a === b || stem(a) === stem(b);\n}\n\nfunction escape(text: string): string {\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n"]}
@@ -1,32 +0,0 @@
1
- /**
2
- * Reading `jazz.app.json` for `jazz-tools upgrade`, keeping key order (a
3
- * `history` version named by an all-digit hash must stay where it is).
4
- */
5
- export type Json = null | boolean | number | string | Json[] | {
6
- [key: string]: Json;
7
- };
8
- export type JsonObject = {
9
- [key: string]: Json;
10
- };
11
- /** The `tsOnly` markers of a .64 file: per table, field → kind. */
12
- export type TsOnlyMarkers = Record<string, Record<string, "computed" | "transform">>;
13
- /**
14
- * Objects with an integer-like key (a `history` version named by an
15
- * all-digit short hash, a JSON Schema's `"0"` property) keep their keys
16
- * here, in file order: a plain JS object would move integer-like keys
17
- * first, silently reordering history that must stay oldest-first.
18
- */
19
- export declare const ORDERED: unique symbol;
20
- /** An object's entries in file order. */
21
- export declare function entriesOf(value: JsonObject): Array<[string, Json]>;
22
- /** Parse JSON keeping every object's key order. */
23
- export declare function parseJsonOrdered(text: string): Json;
24
- export declare function parseAppJson(text: string): JsonObject;
25
- export declare function isObject(value: Json | undefined): value is JsonObject;
26
- /** The current tables of the file. */
27
- export declare function appTables(app: JsonObject): Record<string, JsonObject>;
28
- /** The stored columns of a table, with their specs. */
29
- export declare function tableColumns(table: JsonObject): Record<string, Json>;
30
- /** The `tsOnly` markers in the current tables. */
31
- export declare function tsOnlyMarkers(app: JsonObject): TsOnlyMarkers;
32
- //# sourceMapping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/**
2
- * Reading `jazz.app.json` for `jazz-tools upgrade`, keeping key order (a
3
- * `history` version named by an all-digit hash must stay where it is).
4
- */
5
- /**
6
- * Objects with an integer-like key (a `history` version named by an
7
- * all-digit short hash, a JSON Schema's `"0"` property) keep their keys
8
- * here, in file order: a plain JS object would move integer-like keys
9
- * first, silently reordering history that must stay oldest-first.
10
- */
11
- export const ORDERED = Symbol("jazz.upgrade.orderedEntries");
12
- /** An object's entries in file order. */
13
- export function entriesOf(value) {
14
- return value[ORDERED] ?? Object.entries(value);
15
- }
16
- /** Parse JSON keeping every object's key order. */
17
- export function parseJsonOrdered(text) {
18
- let i = 0;
19
- const fail = (what) => {
20
- throw new SyntaxError(`invalid JSON at offset ${i}: ${what}`);
21
- };
22
- const ws = () => {
23
- while (i < text.length && /\s/.test(text[i]))
24
- i++;
25
- };
26
- const value = () => {
27
- ws();
28
- const c = text[i];
29
- if (c === "{") {
30
- i++;
31
- const entries = [];
32
- ws();
33
- if (text[i] === "}") {
34
- i++;
35
- }
36
- else {
37
- for (;;) {
38
- ws();
39
- if (text[i] !== '"')
40
- fail("expected a key");
41
- const key = string();
42
- ws();
43
- if (text[i++] !== ":")
44
- fail("expected `:`");
45
- entries.push([key, value()]);
46
- ws();
47
- const next = text[i++];
48
- if (next === "}")
49
- break;
50
- if (next !== ",")
51
- fail("expected `,` or `}`");
52
- }
53
- }
54
- const object = {};
55
- for (const [k, v] of entries)
56
- object[k] = v;
57
- if (entries.some(([k]) => /^(0|[1-9]\d*)$/.test(k))) {
58
- Object.defineProperty(object, ORDERED, { value: entries, enumerable: false });
59
- }
60
- return object;
61
- }
62
- if (c === "[") {
63
- i++;
64
- const items = [];
65
- ws();
66
- if (text[i] === "]") {
67
- i++;
68
- return items;
69
- }
70
- for (;;) {
71
- items.push(value());
72
- ws();
73
- const next = text[i++];
74
- if (next === "]")
75
- return items;
76
- if (next !== ",")
77
- fail("expected `,` or `]`");
78
- }
79
- }
80
- if (c === '"')
81
- return string();
82
- const match = /^(?:-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)/.exec(text.slice(i, i + 400));
83
- if (!match)
84
- return fail("unexpected character");
85
- i += match[0].length;
86
- return JSON.parse(match[0]);
87
- };
88
- const string = () => {
89
- const start = i;
90
- i++;
91
- while (i < text.length && text[i] !== '"')
92
- i += text[i] === "\\" ? 2 : 1;
93
- i++;
94
- return JSON.parse(text.slice(start, i));
95
- };
96
- const result = value();
97
- ws();
98
- if (i !== text.length)
99
- fail("trailing content");
100
- return result;
101
- }
102
- export function parseAppJson(text) {
103
- const value = parseJsonOrdered(text);
104
- if (!isObject(value))
105
- throw new Error("jazz.app.json is not a JSON object");
106
- return value;
107
- }
108
- export function isObject(value) {
109
- return typeof value === "object" && value !== null && !Array.isArray(value);
110
- }
111
- /** The current tables of the file. */
112
- export function appTables(app) {
113
- const tables = app.tables;
114
- if (!isObject(tables))
115
- throw new Error("jazz.app.json has no `tables` object");
116
- const out = {};
117
- for (const [name, table] of Object.entries(tables)) {
118
- if (!isObject(table))
119
- throw new Error(`jazz.app.json: tables.${name} is not an object`);
120
- out[name] = table;
121
- }
122
- return out;
123
- }
124
- /** The stored columns of a table, with their specs. */
125
- export function tableColumns(table) {
126
- return isObject(table.columns) ? table.columns : {};
127
- }
128
- /** The `tsOnly` markers in the current tables. */
129
- export function tsOnlyMarkers(app) {
130
- const out = {};
131
- for (const [name, table] of Object.entries(appTables(app))) {
132
- const markers = table.tsOnly;
133
- if (!isObject(markers))
134
- continue;
135
- out[name] = {};
136
- for (const [field, kind] of Object.entries(markers)) {
137
- if (kind !== "computed" && kind !== "transform") {
138
- throw new Error(`jazz.app.json: tables.${name}.tsOnly.${field} is neither "computed" nor "transform"`);
139
- }
140
- out[name][field] = kind;
141
- }
142
- }
143
- return out;
144
- }
145
- //# sourceMappingURL=app-json.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-json.js","sourceRoot":"","sources":["../../src/upgrade/app-json.ts"],"names":[],"m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CAAC;QAC3D,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,SAAS;QACjC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QACf,KAAK,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACpD,IAAI,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;gBAChD,MAAM,IAAI,KAAK,CACb,yBAAyB,IAAI,WAAW,KAAK,wCAAwC,CACtF,CAAC;YACJ,CAAC;YACD,GAAG,CAAC,IAAI,CAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * Reading `jazz.app.json` for `jazz-tools upgrade`, keeping key order (a\n * `history` version named by an all-digit hash must stay where it is).\n */\n\nexport type Json = null | boolean | number | string | Json[] | { [key: string]: Json };\nexport type JsonObject = { [key: string]: Json };\n\n/** The `tsOnly` markers of a .64 file: per table, field → kind. */\nexport type TsOnlyMarkers = Record<string, Record<string, \"computed\" | \"transform\">>;\n\n/**\n * Objects with an integer-like key (a `history` version named by an\n * all-digit short hash, a JSON Schema's `\"0\"` property) keep their keys\n * here, in file order: a plain JS object would move integer-like keys\n * first, silently reordering history that must stay oldest-first.\n */\nexport const ORDERED: unique symbol = Symbol(\"jazz.upgrade.orderedEntries\");\ntype Ordered = { [ORDERED]?: Array<[string, Json]> };\n\n/** An object's entries in file order. */\nexport function entriesOf(value: JsonObject): Array<[string, Json]> {\n return (value as Ordered)[ORDERED] ?? Object.entries(value);\n}\n\n/** Parse JSON keeping every object's key order. */\nexport function parseJsonOrdered(text: string): Json {\n let i = 0;\n const fail = (what: string): never => {\n throw new SyntaxError(`invalid JSON at offset ${i}: ${what}`);\n };\n const ws = () => {\n while (i < text.length && /\\s/.test(text[i]!)) i++;\n };\n const value = (): Json => {\n ws();\n const c = text[i];\n if (c === \"{\") {\n i++;\n const entries: Array<[string, Json]> = [];\n ws();\n if (text[i] === \"}\") {\n i++;\n } else {\n for (;;) {\n ws();\n if (text[i] !== '\"') fail(\"expected a key\");\n const key = string();\n ws();\n if (text[i++] !== \":\") fail(\"expected `:`\");\n entries.push([key, value()]);\n ws();\n const next = text[i++];\n if (next === \"}\") break;\n if (next !== \",\") fail(\"expected `,` or `}`\");\n }\n }\n const object: JsonObject = {};\n for (const [k, v] of entries) object[k] = v;\n if (entries.some(([k]) => /^(0|[1-9]\\d*)$/.test(k))) {\n Object.defineProperty(object, ORDERED, { value: entries, enumerable: false });\n }\n return object;\n }\n if (c === \"[\") {\n i++;\n const items: Json[] = [];\n ws();\n if (text[i] === \"]\") {\n i++;\n return items;\n }\n for (;;) {\n items.push(value());\n ws();\n const next = text[i++];\n if (next === \"]\") return items;\n if (next !== \",\") fail(\"expected `,` or `]`\");\n }\n }\n if (c === '\"') return string();\n const match = /^(?:-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?|true|false|null)/.exec(\n text.slice(i, i + 400),\n );\n if (!match) return fail(\"unexpected character\");\n i += match[0].length;\n return JSON.parse(match[0]) as Json;\n };\n const string = (): string => {\n const start = i;\n i++;\n while (i < text.length && text[i] !== '\"') i += text[i] === \"\\\\\" ? 2 : 1;\n i++;\n return JSON.parse(text.slice(start, i)) as string;\n };\n const result = value();\n ws();\n if (i !== text.length) fail(\"trailing content\");\n return result;\n}\n\nexport function parseAppJson(text: string): JsonObject {\n const value = parseJsonOrdered(text);\n if (!isObject(value)) throw new Error(\"jazz.app.json is not a JSON object\");\n return value;\n}\n\nexport function isObject(value: Json | undefined): value is JsonObject {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** The current tables of the file. */\nexport function appTables(app: JsonObject): Record<string, JsonObject> {\n const tables = app.tables;\n if (!isObject(tables)) throw new Error(\"jazz.app.json has no `tables` object\");\n const out: Record<string, JsonObject> = {};\n for (const [name, table] of Object.entries(tables)) {\n if (!isObject(table)) throw new Error(`jazz.app.json: tables.${name} is not an object`);\n out[name] = table;\n }\n return out;\n}\n\n/** The stored columns of a table, with their specs. */\nexport function tableColumns(table: JsonObject): Record<string, Json> {\n return isObject(table.columns) ? table.columns : {};\n}\n\n/** The `tsOnly` markers in the current tables. */\nexport function tsOnlyMarkers(app: JsonObject): TsOnlyMarkers {\n const out: TsOnlyMarkers = {};\n for (const [name, table] of Object.entries(appTables(app))) {\n const markers = table.tsOnly;\n if (!isObject(markers)) continue;\n out[name] = {};\n for (const [field, kind] of Object.entries(markers)) {\n if (kind !== \"computed\" && kind !== \"transform\") {\n throw new Error(\n `jazz.app.json: tables.${name}.tsOnly.${field} is neither \"computed\" nor \"transform\"`,\n );\n }\n out[name]![field] = kind;\n }\n }\n return out;\n}\n"]}
@@ -1,25 +0,0 @@
1
- import type * as TS from "typescript";
2
- type Ts = typeof TS;
3
- export interface NamedConstant {
4
- /** The identifier the old permissions used. */
5
- name: string;
6
- /** The module that exports it, when imported; undefined when declared in the old file itself. */
7
- file?: string;
8
- /** The exported name, when imported (`import { roles as r }`). */
9
- exported?: string;
10
- /** Its declaration, when declared in the old file (which upgrade deletes). */
11
- declaration?: string;
12
- }
13
- export interface Constants {
14
- /** A value's TS literal → its identifier. */
15
- byValue: Map<string, string>;
16
- byName: Map<string, NamedConstant>;
17
- }
18
- export declare function collectConstants(ts: Ts, file: string, resolve: (specifier: string, from: string) => string | undefined): Constants;
19
- /** The import lines (or local declarations) for the constants `names`, as seen from `file`. */
20
- export declare function constantImports(constants: Constants, names: Iterable<string>, file: string, jsExtensions: boolean): {
21
- imports: string[];
22
- declarations: string[];
23
- };
24
- export {};
25
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/upgrade/constants.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAGtC,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC;AAEpB,MAAM,WAAW,aAAa;IAC5B,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,iGAAiG;IACjG,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,6CAA6C;IAC7C,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CACpC;AAED,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAC/D,SAAS,CAyCX;AAuDD,+FAA+F;AAC/F,wBAAgB,eAAe,CAC7B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,EACvB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,OAAO,GACpB;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAqB/C"}