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.
- package/README.md +2 -3
- package/bin/jazz-tools.js +0 -3
- package/dist/accounts/account-manager-core.d.ts +54 -1
- package/dist/accounts/account-manager-core.d.ts.map +1 -1
- package/dist/accounts/account-manager-core.js +2 -2
- package/dist/accounts/account-manager-core.js.map +1 -1
- package/dist/accounts/context.js +1 -1
- package/dist/accounts/context.js.map +1 -1
- package/dist/backend/api.d.ts +1 -2
- package/dist/backend/api.d.ts.map +1 -1
- package/dist/backend/api.js +0 -2
- package/dist/backend/api.js.map +1 -1
- package/dist/backend/create-jazz.d.ts +0 -6
- package/dist/backend/create-jazz.d.ts.map +1 -1
- package/dist/backend/create-jazz.js +1 -1
- package/dist/backend/create-jazz.js.map +1 -1
- package/dist/backend/inspector-ui/11.js +2 -2
- package/dist/backend/inspector-ui/12.js +2 -2
- package/dist/backend/inspector-ui/13.js +2 -2
- package/dist/backend/inspector-ui/14.js +2 -2
- package/dist/backend/inspector-ui/20.js +1 -1
- package/dist/backend/inspector-ui-files.js +4 -4
- package/dist/backend/no-account-error.d.ts +1 -1
- package/dist/backend/no-account-error.js +1 -1
- package/dist/backend/no-account-error.js.map +1 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +8 -22
- package/dist/cli.js.map +1 -1
- package/dist/client/index.d.ts +0 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +0 -2
- package/dist/client/index.js.map +1 -1
- package/dist/dev/app-files.js +1 -1
- package/dist/dev/app-files.js.map +1 -1
- package/dist/dev/catalogue-api.d.ts.map +1 -1
- package/dist/dev/catalogue-api.js +3 -6
- package/dist/dev/catalogue-api.js.map +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/{index-D3RK8wNj.js → index-DUKUt96e.js} +3 -3
- package/dist/dev/inspector-overlay/embedded/assets/{jazz-broker-worker-EyaWhBtz.js → jazz-broker-worker-C_mr9Omd.js} +2 -2
- package/dist/dev/inspector-overlay/embedded/assets/{jazz_wasm-O10pptvY.js → jazz_wasm-BOvbCHn3.js} +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/{jazz_wasm_bg-wI43fvvq.wasm → jazz_wasm_bg-BG8gazqt.wasm} +0 -0
- package/dist/dev/inspector-overlay/embedded/embedded.html +1 -1
- package/dist/dev/project.js +1 -1
- package/dist/dev/project.js.map +1 -1
- package/dist/dev/ts-project.d.ts.map +1 -1
- package/dist/dev/ts-project.js +3 -2
- package/dist/dev/ts-project.js.map +1 -1
- package/dist/expo/create-account-manager.d.ts +1 -1
- package/dist/expo/create-account-manager.js.map +1 -1
- package/dist/expo/index.d.ts +1 -2
- package/dist/expo/index.d.ts.map +1 -1
- package/dist/expo/index.js +1 -3
- package/dist/expo/index.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/printer/index.d.ts +2 -2
- package/dist/printer/index.d.ts.map +1 -1
- package/dist/printer/index.js +4 -1
- package/dist/printer/index.js.map +1 -1
- package/dist/react/index.d.ts +1 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -3
- package/dist/react/index.js.map +1 -1
- package/dist/react/provider.d.ts +0 -2
- package/dist/react/provider.d.ts.map +1 -1
- package/dist/react/provider.js +1 -2
- package/dist/react/provider.js.map +1 -1
- package/dist/react-core/index.d.ts +1 -2
- package/dist/react-core/index.d.ts.map +1 -1
- package/dist/react-core/index.js +3 -5
- package/dist/react-core/index.js.map +1 -1
- package/dist/react-core/provider.d.ts +0 -8
- package/dist/react-core/provider.d.ts.map +1 -1
- package/dist/react-core/provider.js +0 -13
- package/dist/react-core/provider.js.map +1 -1
- package/dist/react-native/create-account-manager.d.ts +1 -1
- package/dist/react-native/create-account-manager.js.map +1 -1
- package/dist/react-native/index.d.ts +1 -3
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js +1 -5
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/provider.d.ts +0 -2
- package/dist/react-native/provider.d.ts.map +1 -1
- package/dist/react-native/provider.js +1 -2
- package/dist/react-native/provider.js.map +1 -1
- package/dist/runtime/db.d.ts +0 -5
- package/dist/runtime/db.d.ts.map +1 -1
- package/dist/runtime/db.js +0 -5
- package/dist/runtime/db.js.map +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.d.ts +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.js +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.js.map +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.d.ts +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.js +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.js.map +1 -1
- package/dist/runtime/native-artifact-fingerprints.d.ts +2 -2
- package/dist/schema-builders.d.ts +0 -7
- package/dist/schema-builders.d.ts.map +1 -1
- package/dist/schema-builders.js +0 -7
- package/dist/schema-builders.js.map +1 -1
- package/dist/session/create-jazz-session.d.ts +1 -1
- package/dist/session/create-jazz-session.d.ts.map +1 -1
- package/dist/session/create-jazz-session.js.map +1 -1
- package/dist/solid/index.d.ts +1 -2
- package/dist/solid/index.d.ts.map +1 -1
- package/dist/solid/index.js +7 -8
- package/dist/solid/index.ssr.js +2 -3
- package/dist/solid/provider.d.ts +1 -12
- package/dist/solid/provider.d.ts.map +1 -1
- package/dist/solid/provider.js +12 -18
- package/dist/solid/provider.js.map +1 -1
- package/dist/solid/provider.ssr.js +1 -11
- package/dist/solid/provider.ssr.js.map +1 -1
- package/dist/svelte/context.svelte.d.ts +1 -12
- package/dist/svelte/context.svelte.d.ts.map +1 -1
- package/dist/svelte/context.svelte.js +2 -20
- package/dist/svelte/index.d.ts +1 -2
- package/dist/svelte/index.d.ts.map +1 -1
- package/dist/svelte/index.js +1 -3
- package/dist/thin/index.d.ts +0 -1
- package/dist/thin/index.d.ts.map +1 -1
- package/dist/thin/index.js +0 -2
- package/dist/thin/index.js.map +1 -1
- package/dist/typed-app.d.ts +1 -1
- package/dist/typed-app.js.map +1 -1
- package/dist/vue/index.d.ts +1 -2
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +1 -3
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/provider.d.ts +2 -35
- package/dist/vue/provider.d.ts.map +1 -1
- package/dist/vue/provider.js +1 -135
- package/dist/vue/provider.js.map +1 -1
- package/dist/web/lazy-local-first.d.ts +0 -3
- package/dist/web/lazy-local-first.d.ts.map +1 -1
- package/dist/web/lazy-local-first.js +1 -6
- package/dist/web/lazy-local-first.js.map +1 -1
- package/dist/worker/jazz-broker-worker.js +2 -2
- package/dist/worker/jazz_wasm_bg.wasm +0 -0
- package/package.json +4 -8
- package/dist/accounts/create-account-manager.d.ts +0 -57
- package/dist/accounts/create-account-manager.d.ts.map +0 -1
- package/dist/accounts/create-account-manager.js +0 -17
- package/dist/accounts/create-account-manager.js.map +0 -1
- package/dist/permissions/index.d.ts +0 -5
- package/dist/permissions/index.d.ts.map +0 -1
- package/dist/permissions/index.js +0 -11
- package/dist/permissions/index.js.map +0 -1
- package/dist/removed-api.d.ts +0 -87
- package/dist/removed-api.d.ts.map +0 -1
- package/dist/removed-api.js +0 -95
- package/dist/removed-api.js.map +0 -1
- package/dist/removed-schema-api.d.ts +0 -80
- package/dist/removed-schema-api.d.ts.map +0 -1
- package/dist/removed-schema-api.js +0 -128
- package/dist/removed-schema-api.js.map +0 -1
- package/dist/session/deprecated-session-hook.d.ts +0 -8
- package/dist/session/deprecated-session-hook.d.ts.map +0 -1
- package/dist/session/deprecated-session-hook.js +0 -28
- package/dist/session/deprecated-session-hook.js.map +0 -1
- package/dist/svelte/JazzSvelteProvider.svelte +0 -181
- package/dist/svelte/JazzSvelteProvider.svelte.d.ts +0 -14
- package/dist/svelte/JazzSvelteProvider.svelte.d.ts.map +0 -1
- package/dist/upgrade/aliases.d.ts +0 -25
- package/dist/upgrade/aliases.d.ts.map +0 -1
- package/dist/upgrade/aliases.js +0 -80
- package/dist/upgrade/aliases.js.map +0 -1
- package/dist/upgrade/app-json.d.ts +0 -32
- package/dist/upgrade/app-json.d.ts.map +0 -1
- package/dist/upgrade/app-json.js +0 -145
- package/dist/upgrade/app-json.js.map +0 -1
- package/dist/upgrade/constants.d.ts +0 -25
- package/dist/upgrade/constants.d.ts.map +0 -1
- package/dist/upgrade/constants.js +0 -136
- package/dist/upgrade/constants.js.map +0 -1
- package/dist/upgrade/edits.d.ts +0 -10
- package/dist/upgrade/edits.d.ts.map +0 -1
- package/dist/upgrade/edits.js +0 -21
- package/dist/upgrade/edits.js.map +0 -1
- package/dist/upgrade/errors.d.ts +0 -12
- package/dist/upgrade/errors.d.ts.map +0 -1
- package/dist/upgrade/errors.js +0 -18
- package/dist/upgrade/errors.js.map +0 -1
- package/dist/upgrade/extras.d.ts +0 -42
- package/dist/upgrade/extras.d.ts.map +0 -1
- package/dist/upgrade/extras.js +0 -487
- package/dist/upgrade/extras.js.map +0 -1
- package/dist/upgrade/fresh.d.ts +0 -36
- package/dist/upgrade/fresh.d.ts.map +0 -1
- package/dist/upgrade/fresh.js +0 -154
- package/dist/upgrade/fresh.js.map +0 -1
- package/dist/upgrade/index.d.ts +0 -79
- package/dist/upgrade/index.d.ts.map +0 -1
- package/dist/upgrade/index.js +0 -806
- package/dist/upgrade/index.js.map +0 -1
- package/dist/upgrade/json-only.d.ts +0 -24
- package/dist/upgrade/json-only.d.ts.map +0 -1
- package/dist/upgrade/json-only.js +0 -124
- package/dist/upgrade/json-only.js.map +0 -1
- package/dist/upgrade/names.d.ts +0 -29
- package/dist/upgrade/names.d.ts.map +0 -1
- package/dist/upgrade/names.js +0 -105
- package/dist/upgrade/names.js.map +0 -1
- package/dist/upgrade/payload-enums.d.ts +0 -18
- package/dist/upgrade/payload-enums.d.ts.map +0 -1
- package/dist/upgrade/payload-enums.js +0 -52
- package/dist/upgrade/payload-enums.js.map +0 -1
- package/dist/upgrade/permissions-check.d.ts +0 -10
- package/dist/upgrade/permissions-check.d.ts.map +0 -1
- package/dist/upgrade/permissions-check.js +0 -85
- package/dist/upgrade/permissions-check.js.map +0 -1
- package/dist/upgrade/program.d.ts +0 -18
- package/dist/upgrade/program.d.ts.map +0 -1
- package/dist/upgrade/program.js +0 -56
- package/dist/upgrade/program.js.map +0 -1
- package/dist/upgrade/project.d.ts +0 -56
- package/dist/upgrade/project.d.ts.map +0 -1
- package/dist/upgrade/project.js +0 -254
- package/dist/upgrade/project.js.map +0 -1
- package/dist/upgrade/rewrite.d.ts +0 -34
- package/dist/upgrade/rewrite.d.ts.map +0 -1
- package/dist/upgrade/rewrite.js +0 -500
- package/dist/upgrade/rewrite.js.map +0 -1
- package/dist/upgrade/schema-ts.d.ts +0 -59
- package/dist/upgrade/schema-ts.d.ts.map +0 -1
- package/dist/upgrade/schema-ts.js +0 -582
- package/dist/upgrade/schema-ts.js.map +0 -1
- package/dist/upgrade/snapshot.d.ts +0 -11
- package/dist/upgrade/snapshot.d.ts.map +0 -1
- package/dist/upgrade/snapshot.js +0 -90
- package/dist/upgrade/snapshot.js.map +0 -1
- package/dist/upgrade/upgrade-test-helpers.d.ts +0 -12
- package/dist/upgrade/upgrade-test-helpers.d.ts.map +0 -1
- package/dist/upgrade/upgrade-test-helpers.js +0 -72
- package/dist/upgrade/upgrade-test-helpers.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// embedded.html, as base64. Generated by scripts/stage-inspector-overlay.mjs.
|
|
2
|
-
export default "PCFkb2N0eXBlIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9IlVURi04IiAvPgogICAgPG1ldGEgbmFtZT0idmlld3BvcnQiIGNvbnRlbnQ9IndpZHRoPWRldmljZS13aWR0aCwgaW5pdGlhbC1zY2FsZT0xLjAiIC8+CiAgICA8dGl0bGU+SmF6eiBJbnNwZWN0b3IgKGVtYmVkZGVkKTwvdGl0bGU+
|
|
2
|
+
export default "PCFkb2N0eXBlIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICA8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9IlVURi04IiAvPgogICAgPG1ldGEgbmFtZT0idmlld3BvcnQiIGNvbnRlbnQ9IndpZHRoPWRldmljZS13aWR0aCwgaW5pdGlhbC1zY2FsZT0xLjAiIC8+CiAgICA8dGl0bGU+SmF6eiBJbnNwZWN0b3IgKGVtYmVkZGVkKTwvdGl0bGU+CiAgICA8c2NyaXB0IHR5cGU9Im1vZHVsZSIgY3Jvc3NvcmlnaW4gc3JjPSIuL2Fzc2V0cy9pbmRleC1EVUtVdDk2ZS5qcyI+PC9zY3JpcHQ+CiAgICA8bGluayByZWw9Im1vZHVsZXByZWxvYWQiIGNyb3Nzb3JpZ2luIGhyZWY9Ii4vYXNzZXRzL3JvbGxkb3duLXJ1bnRpbWUtWEt5YUh0bDkuanMiPgogICAgPGxpbmsgcmVsPSJtb2R1bGVwcmVsb2FkIiBjcm9zc29yaWdpbiBocmVmPSIuL2Fzc2V0cy9zcmMtNEp3aHhaYVcuanMiPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBjcm9zc29yaWdpbiBocmVmPSIuL2Fzc2V0cy9zcmMtQ3E4Z1NPTHguY3NzIj4KICA8L2hlYWQ+CiAgPGJvZHk+CiAgICA8ZGl2IGlkPSJyb290Ij48L2Rpdj4KICA8L2JvZHk+CjwvaHRtbD4K";
|
|
@@ -12,10 +12,10 @@ export const INSPECTOR_UI_FILES = {
|
|
|
12
12
|
"assets/esm-CcBEG-yV.js": () => import("./inspector-ui/8.js"),
|
|
13
13
|
"assets/esm-DZrCzNXM.js": () => import("./inspector-ui/9.js"),
|
|
14
14
|
"assets/esm-k373aadI.js": () => import("./inspector-ui/10.js"),
|
|
15
|
-
"assets/index-
|
|
16
|
-
"assets/jazz-broker-worker-
|
|
17
|
-
"assets/jazz_wasm-
|
|
18
|
-
"assets/jazz_wasm_bg-
|
|
15
|
+
"assets/index-DUKUt96e.js": () => import("./inspector-ui/11.js"),
|
|
16
|
+
"assets/jazz-broker-worker-C_mr9Omd.js": () => import("./inspector-ui/12.js"),
|
|
17
|
+
"assets/jazz_wasm-BOvbCHn3.js": () => import("./inspector-ui/13.js"),
|
|
18
|
+
"assets/jazz_wasm_bg-BG8gazqt.wasm": () => import("./inspector-ui/14.js"),
|
|
19
19
|
"assets/node-foreground-node-lease.browser-2mfp13Qb.js": () => import("./inspector-ui/15.js"),
|
|
20
20
|
"assets/rolldown-runtime-XKyaHtl9.js": () => import("./inspector-ui/16.js"),
|
|
21
21
|
"assets/src-4JwhxZaW.js": () => import("./inspector-ui/17.js"),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The request's user has no Jazz account yet, so there is no one to act as.
|
|
3
3
|
* Jazz never creates an account on the backend by itself: the user gets one
|
|
4
4
|
* when they sign in from a client, when a local-first guest links to them
|
|
5
|
-
* (`
|
|
5
|
+
* (the session's `linkDeviceAccount()`), or when your backend calls `jazz.createAccountFor`.
|
|
6
6
|
*
|
|
7
7
|
* `jazz-tools/backend` is often loaded outside an app's bundle, so a caller
|
|
8
8
|
* can see this error from a different copy of the class: match it with
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The request's user has no Jazz account yet, so there is no one to act as.
|
|
3
3
|
* Jazz never creates an account on the backend by itself: the user gets one
|
|
4
4
|
* when they sign in from a client, when a local-first guest links to them
|
|
5
|
-
* (`
|
|
5
|
+
* (the session's `linkDeviceAccount()`), or when your backend calls `jazz.createAccountFor`.
|
|
6
6
|
*
|
|
7
7
|
* `jazz-tools/backend` is often loaded outside an app's bundle, so a caller
|
|
8
8
|
* can see this error from a different copy of the class: match it with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-account-error.js","sourceRoot":"","sources":["../../src/backend/no-account-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAMhC;IALF,IAAI,GAAG,oBAAoB,CAAC;IAC5B,IAAI,GAAG,YAAY,CAAC;IAE7B;IACE,mDAAmD;IAC1C,MAAc,EACvB,MAAc;QAEd,KAAK,CACH,GAAG,MAAM,UAAU,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,mIAAmI,CAC7K,CAAC;QALO,WAAM,GAAN,MAAM,CAAQ;IAMzB,CAAC;CACF;AAED,8EAA8E;AAC9E,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,OAAO,CACL,KAAK,YAAY,kBAAkB;QACnC,CAAC,KAAK,YAAY,KAAK;YACrB,KAAK,CAAC,IAAI,KAAK,oBAAoB;YAClC,KAA4B,CAAC,IAAI,KAAK,YAAY,CAAC,CACvD,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The request's user has no Jazz account yet, so there is no one to act as.\n * Jazz never creates an account on the backend by itself: the user gets one\n * when they sign in from a client, when a local-first guest links to them\n * (`
|
|
1
|
+
{"version":3,"file":"no-account-error.js","sourceRoot":"","sources":["../../src/backend/no-account-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAMhC;IALF,IAAI,GAAG,oBAAoB,CAAC;IAC5B,IAAI,GAAG,YAAY,CAAC;IAE7B;IACE,mDAAmD;IAC1C,MAAc,EACvB,MAAc;QAEd,KAAK,CACH,GAAG,MAAM,UAAU,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,mIAAmI,CAC7K,CAAC;QALO,WAAM,GAAN,MAAM,CAAQ;IAMzB,CAAC;CACF;AAED,8EAA8E;AAC9E,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,OAAO,CACL,KAAK,YAAY,kBAAkB;QACnC,CAAC,KAAK,YAAY,KAAK;YACrB,KAAK,CAAC,IAAI,KAAK,oBAAoB;YAClC,KAA4B,CAAC,IAAI,KAAK,YAAY,CAAC,CACvD,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The request's user has no Jazz account yet, so there is no one to act as.\n * Jazz never creates an account on the backend by itself: the user gets one\n * when they sign in from a client, when a local-first guest links to them\n * (the session's `linkDeviceAccount()`), or when your backend calls `jazz.createAccountFor`.\n *\n * `jazz-tools/backend` is often loaded outside an app's bundle, so a caller\n * can see this error from a different copy of the class: match it with\n * `isNoJazzAccountError`, which also compares the name, or check\n * `code === \"no_account\"`.\n */\nexport class NoJazzAccountError extends Error {\n readonly name = \"NoJazzAccountError\";\n readonly code = \"no_account\";\n\n constructor(\n /** The user, as your `authenticate` names them. */\n readonly userId: string,\n caller: string,\n ) {\n super(\n `${caller}: user ${JSON.stringify(userId)} has no Jazz account yet. They get one when they sign in from a client, or when your backend calls jazz.createAccountFor(userId).`,\n );\n }\n}\n\n/** Whether `error` is a `NoJazzAccountError`, from any copy of jazz-tools. */\nexport function isNoJazzAccountError(error: unknown): error is NoJazzAccountError {\n return (\n error instanceof NoJazzAccountError ||\n (error instanceof Error &&\n error.name === \"NoJazzAccountError\" &&\n (error as { code?: unknown }).code === \"no_account\")\n );\n}\n"]}
|
package/dist/cli.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ export interface BuildOptions {
|
|
|
12
12
|
export interface SchemaCompileOptions {
|
|
13
13
|
schemaDir: string;
|
|
14
14
|
}
|
|
15
|
-
export declare const VALIDATE_RENAMED: string;
|
|
16
15
|
/** `jazz-tools generate [--check] [--force]`: write jazz.app.json, jazz.permissions.json and the bindings from the app's TS. */
|
|
17
16
|
export declare function generate(options: BuildOptions): Promise<void>;
|
|
18
17
|
/** `jazz-tools schema compile`: print what jazz.generated.ts passes to bindApp, as JSON. */
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAkBA,MAAM,WAAW,YAAY;IAC3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S,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,wFAAwF;AACxF,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAe3D;AASD,eAAO,MAAM,mBAAmB,8IAMtB,CAAC;AAEX,eAAO,MAAM,eAAe,0HAMlB,CAAC;AAKX,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,IAAI,CAsBN;AAED,wBAAgB,UAAU,CACxB,GAAG,GAAE,MAAsB,EAC3B,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,IAAI,CAEN;AAuCD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAErD;AACD,wBAAgB,aAAa,CAC3B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,MAAM,GAAG,SAAS,CAMpB;AA0FD,kGAAkG;AAClG,wBAAsB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA4B7F"}
|
package/dist/cli.js
CHANGED
|
@@ -19,8 +19,10 @@ const SERVER_REMOVED = "`jazz-tools server` was removed. Jazz runs inside your b
|
|
|
19
19
|
"`createJazz({ store: vercel() })` runs it on Vercel, and " +
|
|
20
20
|
"`createJazz({ store: sqlite({ path }) })` serves sync from your own server. " +
|
|
21
21
|
"Jazz Cloud is deprecated for new apps.";
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const UPGRADE_GUIDE_URL = "https://jazz.tools/docs/operating/backups-and-upgrades#upgrading-from-alpha70-to-beta0";
|
|
23
|
+
const UPGRADE_REMOVED = "`jazz-tools upgrade` was removed in 2.0.0-beta.0. To convert an alpha.65 (or older) app, " +
|
|
24
|
+
"run `npx jazz-tools@2.0.0-alpha.70 upgrade`, then follow the upgrade guide: " +
|
|
25
|
+
UPGRADE_GUIDE_URL;
|
|
24
26
|
const CREATE_REMOVED = "`jazz-tools create` was removed. Start a project with `npm create jazz`.";
|
|
25
27
|
const MIGRATE_ALPHA59_MOVED = "`jazz-tools migrate-alpha59` was removed. Move alpha.59 data with the exporter and importer from " +
|
|
26
28
|
"https://github.com/garden-co/jazz/releases/tag/v2.0.0-alpha.65 (`jazz-alpha59-alpha60-export-<platform>` " +
|
|
@@ -320,7 +322,6 @@ function printHelp() {
|
|
|
320
322
|
console.log(" --lang <ts|rust|…>: the bindings' languages, by default each the app's files name)");
|
|
321
323
|
console.log(" migrations create Write a migration stub for a schema change to migrations/ (--name <name>)");
|
|
322
324
|
console.log(" migrations graph Visualize the full migration graph");
|
|
323
|
-
console.log(" upgrade Convert an alpha.65 app to alpha.66's schema.ts (or write it from a JSON-only app's files)");
|
|
324
325
|
console.log(" schema compile Print the compiled schema jazz.generated.ts embeds, as JSON");
|
|
325
326
|
console.log(" login | logout | whoami (deprecated)");
|
|
326
327
|
console.log(" Sign in to Jazz Cloud with your dashboard account");
|
|
@@ -349,8 +350,8 @@ if (isMainModule()) {
|
|
|
349
350
|
const command = args[0] ?? "";
|
|
350
351
|
// Cloud commands (login, apps, ...) have their own help.
|
|
351
352
|
const cloudCommand = isCloudCommand(command);
|
|
352
|
-
// Cloud commands and `inspect` have their own help.
|
|
353
|
-
const ownHelp = cloudCommand || command === "inspect";
|
|
353
|
+
// Cloud commands and `inspect` have their own help; `upgrade` only refuses.
|
|
354
|
+
const ownHelp = cloudCommand || command === "inspect" || command === "upgrade";
|
|
354
355
|
if (!ownHelp && args.some((arg) => arg === "--help" || arg === "-h")) {
|
|
355
356
|
printHelp();
|
|
356
357
|
process.exit(0);
|
|
@@ -398,28 +399,13 @@ if (isMainModule()) {
|
|
|
398
399
|
exitOnError(Promise.resolve().then(() => generate(parseArgs(args).options)));
|
|
399
400
|
}
|
|
400
401
|
else if (command === "upgrade") {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
exitOnError(import("./upgrade/index.js").then(async ({ upgradeProject, formatReport }) => {
|
|
404
|
-
const report = await upgradeProject({
|
|
405
|
-
dir: resolve(process.cwd(), getFlagValue(commandArgs, "--dir") ?? "."),
|
|
406
|
-
dryRun,
|
|
407
|
-
skipTypecheck: commandArgs.includes("--skip-typecheck"),
|
|
408
|
-
schemaDir: getFlagValue(commandArgs, "--schema-dir"),
|
|
409
|
-
});
|
|
410
|
-
console.log(formatReport(report, dryRun));
|
|
411
|
-
if (report.typeErrors.length > 0)
|
|
412
|
-
process.exitCode = 1;
|
|
413
|
-
}));
|
|
402
|
+
console.error(UPGRADE_REMOVED);
|
|
403
|
+
process.exit(1);
|
|
414
404
|
}
|
|
415
405
|
else if (command === "print-ts") {
|
|
416
406
|
// Hidden: the examples' TS from their JSON (src/printer/cli.ts).
|
|
417
407
|
exitOnError(import("./printer/cli.js").then(({ runPrintTs }) => runPrintTs(args.slice(1))));
|
|
418
408
|
}
|
|
419
|
-
else if (command === "validate") {
|
|
420
|
-
console.error(VALIDATE_RENAMED);
|
|
421
|
-
process.exit(1);
|
|
422
|
-
}
|
|
423
409
|
else if (command === "store") {
|
|
424
410
|
const [subcommand, path, ...rest] = args.slice(1);
|
|
425
411
|
const usage = "Usage: jazz-tools store detach <path>\n jazz-tools store set-app-id <path> <app id>\n\n" +
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,oCAAoC;AAEpC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,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AAC,CAAC,CAAC,CAAC;IAClB,CAAC;SAAM,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;SAAM,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;SAAM,IAAI,OAAO,KAAK,iBAAiB,EAAE,CAAC;QACzC,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;SAAM,CAAC;QACN,SAAS,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;AACH,CAAC","sourcesContent":["#!/usr/bin/env node\n\n// CLI for jazz-tools schema tooling\n\nimport { existsSync, readFileSync, realpathSync } from \"fs\";\nimport { join, relative, resolve } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { createAppMigration, localMigrationGraph, generateApp } from \"./dev/project.js\";\nimport {\n combineMigrationGraphs,\n fetchMigrationGraph,\n renderMigrationGraph,\n} from \"./dev/migration-graph.js\";\nimport { readAppProject } from \"./dev/app-files.js\";\nimport { compileApp } from \"./dev/codegen-napi.js\";\nimport { isCloudCommand, runCloudCommand } from \"./cloud/commands.js\";\nimport { runInspectCommand } from \"./inspect/cli.js\";\n\nexport interface BuildOptions {\n /** The project directory: jazz.app.json in it, ./src or ./src/lib. */\n schemaDir: string;\n /** Write nothing; fail if jazz.app.json, jazz.permissions.json or the bindings aren't what generate would write. */\n check?: boolean;\n /** Overwrite a jazz.app.json or jazz.permissions.json edited by hand. */\n force?: boolean;\n /** `--lang <lang>` (repeatable): the bindings' languages; by default each the app's files name. */\n lang?: string[];\n}\n\nexport interface SchemaCompileOptions {\n schemaDir: string;\n}\n\n// createJazz publishes the app's bundle when the backend starts, so there is\n// no separate deploy step.\nconst DEPLOY_NOTE =\n \"Deploy your backend to publish them: createJazz publishes the schema, its permissions and its migrations when it starts.\";\n\nconst DEPLOY_REMOVED =\n \"`jazz-tools deploy` was removed. \" +\n \"createJazz publishes your schema, its permissions and its migrations when your backend starts, \" +\n \"so deploying the backend is the deployment.\";\n\nconst SERVER_REMOVED =\n \"`jazz-tools server` was removed. Jazz runs inside your backend: \" +\n \"`createJazz({ store: vercel() })` runs it on Vercel, and \" +\n \"`createJazz({ store: sqlite({ path }) })` serves sync from your own server. \" +\n \"Jazz Cloud is deprecated for new apps.\";\n\nexport const VALIDATE_RENAMED =\n \"`jazz-tools validate` was renamed to `jazz-tools generate` in alpha.65: it writes jazz.app.json, \" +\n \"jazz.permissions.json and jazz.generated.ts from the app's TS. Use `jazz-tools generate --check` in CI.\";\n\nconst CREATE_REMOVED = \"`jazz-tools create` was removed. Start a project with `npm create jazz`.\";\n\nconst MIGRATE_ALPHA59_MOVED =\n \"`jazz-tools migrate-alpha59` was removed. Move alpha.59 data with the exporter and importer from \" +\n \"https://github.com/garden-co/jazz/releases/tag/v2.0.0-alpha.65 (`jazz-alpha59-alpha60-export-<platform>` \" +\n \"and `jazz-alpha59-alpha60-import-<platform>`), then upgrade from alpha.65.\";\n\nfunction parseArgs(args: string[]): { command: string; options: BuildOptions } {\n const command = args[0] || \"\";\n const schemaDir = getFlagValue(args, \"--schema-dir\", \"last\") ?? process.cwd();\n if (args.includes(\"--strict-provenance\")) {\n throw new Error(\n \"--strict-provenance was removed with schema.ts: jazz.app.json's columns are taken as written. Use Jazz's $createdAt, $createdBy, $updatedAt and $updatedBy instead of columns that duplicate them.\",\n );\n }\n return {\n command,\n options: {\n schemaDir: resolve(process.cwd(), schemaDir),\n check: args.includes(\"--check\"),\n force: args.includes(\"--force\"),\n lang: langFlags(args),\n },\n };\n}\n\n/** `jazz-tools generate [--check] [--force]`: write jazz.app.json, jazz.permissions.json and the bindings from the app's TS. */\nexport async function generate(options: BuildOptions): Promise<void> {\n const result = await generateApp({\n cwd: options.schemaDir,\n check: options.check,\n force: options.force,\n ...(options.lang?.length ? { lang: options.lang } : {}),\n });\n for (const warning of result.warnings) {\n console.warn(`\\x1b[33m${warning}\\x1b[0m`);\n }\n const shown = result.bindings\n .map((file) => relative(process.cwd(), join(result.dir, file)) || file)\n .join(\" and \");\n const files = [\n ...(result.wroteFiles ? [\"jazz.app.json\", \"jazz.permissions.json\"] : []),\n ...(result.wrote ? [shown] : []),\n ];\n console.log(\n options.check\n ? `jazz.app.json, jazz.permissions.json and ${shown} are up to date with the app's TS.`\n : files.length > 0\n ? `Wrote ${files.join(\", \")} from the app's TS. Commit them.`\n : `jazz.app.json, jazz.permissions.json and ${shown} are up to date.`,\n );\n console.log(DEPLOY_NOTE);\n}\n\n/** `jazz-tools schema compile`: print what jazz.generated.ts passes to bindApp, as JSON. */\nexport async function compileSchema(options: SchemaCompileOptions): Promise<void> {\n const project = await readAppProject(options.schemaDir);\n process.stdout.write(`${JSON.stringify(await compileApp(project.app), null, 2)}\\n`);\n}\n\nexport function requireServerValue(\n value: string | undefined,\n kind: \"serverUrl\" | \"adminSecret\",\n): string {\n if (value) return value;\n if (kind === \"serverUrl\") {\n throw new Error(\n \"Missing server URL. Pass --server-url <url> or set JAZZ_SERVER_URL (or a framework-prefixed form such as VITE_JAZZ_SERVER_URL).\",\n );\n }\n throw new Error(\"Missing admin secret. Pass --admin-secret <secret> or set JAZZ_ADMIN_SECRET.\");\n}\n\nexport function requireAppId(appId: string | undefined): string {\n if (appId) return appId;\n throw new Error(\n \"Missing app ID. Pass an <appId> positional argument or set JAZZ_APP_ID (or a framework-prefixed form such as VITE_JAZZ_APP_ID).\",\n );\n}\n\nexport interface MigrationCommandOptions {\n appId?: string;\n serverUrl?: string;\n adminSecret?: string;\n schemaDir?: string;\n}\n\nexport interface CreateMigrationOptions {\n schemaDir: string;\n name?: string;\n /** `--lang <lang>` (repeatable), as for `generate`. */\n lang?: string[];\n}\n\n/** Every `--lang <lang>` (or `--lang=<lang>`) given; one without a value is refused. */\nexport function langFlags(args: readonly string[]): string[] {\n const langs: string[] = [];\n args.forEach((arg, i) => {\n if (arg.startsWith(\"--lang=\")) {\n const lang = arg.slice(\"--lang=\".length);\n if (!lang) throw new Error(\"Missing value for --lang (e.g. --lang ts).\");\n langs.push(lang);\n } else if (arg === \"--lang\") {\n const lang = args[i + 1];\n if (!lang || lang.startsWith(\"--\"))\n throw new Error(\"Missing value for --lang (e.g. --lang ts).\");\n langs.push(lang);\n }\n });\n return langs;\n}\n\n// Framework bundlers (Vite, SvelteKit, Next.js, Expo) expose public env vars\n// under their own prefix so the client bundle can read them. The CLI often\n// runs in the same project, so accept those prefixed names as fallbacks for\n// the canonical JAZZ_ form. The unprefixed JAZZ_ name always wins — it's the\n// explicit opt-in when the framework var points somewhere else (e.g. prod).\n// Admin/backend secrets stay unprefixed by design: a PUBLIC_/VITE_/NEXT_PUBLIC_\n// prefix would leak them into the client bundle.\nexport const SERVER_URL_ENV_VARS = [\n \"JAZZ_SERVER_URL\",\n \"PUBLIC_JAZZ_SERVER_URL\",\n \"VITE_JAZZ_SERVER_URL\",\n \"NEXT_PUBLIC_JAZZ_SERVER_URL\",\n \"EXPO_PUBLIC_JAZZ_SERVER_URL\",\n] as const;\n\nexport const APP_ID_ENV_VARS = [\n \"JAZZ_APP_ID\",\n \"PUBLIC_JAZZ_APP_ID\",\n \"VITE_JAZZ_APP_ID\",\n \"NEXT_PUBLIC_JAZZ_APP_ID\",\n \"EXPO_PUBLIC_JAZZ_APP_ID\",\n] as const;\n\n// Real environment variables always win — `.env` is a fallback only.\n// Uses Node's built-in `process.loadEnvFile` when operating on the real\n// process.env; falls back to a small parser for tests and older Node.\nexport function loadEnvFile(\n envPath: string,\n env: Record<string, string | undefined> = process.env,\n): void {\n if (!existsSync(envPath)) return;\n if (env === process.env && typeof process.loadEnvFile === \"function\") {\n process.loadEnvFile(envPath);\n return;\n }\n const content = readFileSync(envPath, \"utf8\");\n for (let line of content.split(\"\\n\")) {\n if (line.endsWith(\"\\r\")) line = line.slice(0, -1);\n if (!line || line.startsWith(\"#\")) continue;\n const eq = line.indexOf(\"=\");\n if (eq === -1) continue;\n const key = line.slice(0, eq).trim();\n let value = line.slice(eq + 1).trim();\n if (\n (value.startsWith('\"') && value.endsWith('\"')) ||\n (value.startsWith(\"'\") && value.endsWith(\"'\"))\n ) {\n value = value.slice(1, -1);\n }\n if (env[key] === undefined) env[key] = value;\n }\n}\n\nexport function loadDotEnv(\n cwd: string = process.cwd(),\n env: Record<string, string | undefined> = process.env,\n): void {\n loadEnvFile(join(cwd, \".env\"), env);\n}\n\n// The value of `flag` at args[i], given as `flag value` or `flag=value`, and\n// how many args it spans.\nfunction readFlagAt(\n args: string[],\n i: number,\n flag: string,\n): { value: string; width: number } | undefined {\n const arg = args[i];\n const width = arg === flag ? 2 : 1;\n if (width === 1 && !arg?.startsWith(`${flag}=`)) return undefined;\n const value = width === 2 ? args[i + 1] : arg!.slice(flag.length + 1);\n if (!value || value.startsWith(\"-\")) {\n throw new Error(`Missing value for ${flag}.`);\n }\n return { value, width };\n}\n\n// Normalize env-file flags in the same pass that records the files to load.\n// This keeps command and operand positions stable for every dispatch path.\nfunction normalizeArgs(args: string[]): { args: string[]; envFiles: string[] } {\n const normalized: string[] = [];\n const envFiles: string[] = [];\n for (let i = 0; i < args.length; i++) {\n const found = readFlagAt(args, i, \"--env-file\");\n if (found) {\n envFiles.push(found.value);\n i += found.width - 1;\n } else {\n normalized.push(args[i]!);\n }\n }\n return { args: normalized, envFiles };\n}\n\n// Collect every `--env-file=PATH` and `--env-file PATH` from argv, in\n// the order they appear. Earlier files take precedence over later ones\n// because loadEnvFile only fills in keys that are still undefined.\nexport function readEnvFiles(args: string[]): string[] {\n return normalizeArgs(args).envFiles;\n}\nexport function resolveEnvVar(\n names: readonly string[],\n env: Record<string, string | undefined> = process.env,\n): string | undefined {\n for (const name of names) {\n const value = env[name];\n if (value) return value;\n }\n return undefined;\n}\n\nfunction getFlagValue(\n args: string[],\n flag: string,\n selection: \"first\" | \"last\" = \"first\",\n): string | undefined {\n const values: string[] = [];\n for (let i = 0; i < args.length; i++) {\n const found = readFlagAt(args, i, flag);\n if (found) {\n values.push(found.value);\n i += found.width - 1;\n }\n }\n return selection === \"first\" ? values[0] : values.at(-1);\n}\n\n// Accept only `--flag value` pairs drawn from `allowed`.\nfunction assertFlagPairs(\n args: string[],\n allowed: readonly string[],\n unknown: (arg: string) => string,\n): void {\n for (let i = 0; i < args.length; i += 2) {\n if (!allowed.includes(args[i]!)) {\n throw new Error(unknown(args[i]!));\n }\n if (!args[i + 1] || args[i + 1]!.startsWith(\"--\")) {\n throw new Error(`Missing value for ${args[i]}.`);\n }\n }\n}\n\nfunction exitOnError(task: Promise<unknown>): void {\n task.catch((err) => {\n console.error(err.message);\n process.exit(1);\n });\n}\n\n/** Run a `store` subcommand, which needs the store stopped. */\nfunction storeCommand(path: string, run: () => void): void {\n try {\n run();\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n if (/already open|jazz\\.lock/i.test(message)) {\n throw new Error(`${path} is in use: stop the backend or server using it first.`);\n }\n throw error;\n }\n}\n\nfunction splitLeadingAppId(args: string[]): { appId?: string; args: string[] } {\n const first = args[0];\n if (!first || first.startsWith(\"-\")) {\n return { args: args, appId: resolveEnvVar(APP_ID_ENV_VARS) };\n }\n\n return {\n appId: first,\n args: args.slice(1),\n };\n}\n\nfunction resolveMigrationOptions(args: string[]): MigrationCommandOptions {\n const serverUrl = getFlagValue(args, \"--server-url\") ?? resolveEnvVar(SERVER_URL_ENV_VARS);\n const adminSecret = getFlagValue(args, \"--admin-secret\") ?? process.env.JAZZ_ADMIN_SECRET;\n const schemaDir = resolve(process.cwd(), getFlagValue(args, \"--schema-dir\") ?? process.cwd());\n\n return {\n serverUrl,\n adminSecret,\n schemaDir,\n };\n}\n\nfunction requireMigrationServerOptions(options: MigrationCommandOptions): {\n appId: string;\n serverUrl: string;\n adminSecret: string;\n} {\n return {\n appId: requireAppId(options.appId),\n serverUrl: requireServerValue(options.serverUrl, \"serverUrl\"),\n adminSecret: requireServerValue(options.adminSecret, \"adminSecret\"),\n };\n}\n\n/** `jazz-tools migrations create --name <name>`: write a migration stub for the schema change. */\nexport async function createMigration(options: CreateMigrationOptions): Promise<string | null> {\n const result = await createAppMigration({\n cwd: options.schemaDir,\n name: options.name ?? \"\",\n });\n if (!result.file) {\n console.log(\n result.snapshot\n ? `Wrote the snapshot ${relative(process.cwd(), result.snapshot) || result.snapshot}: no migration is needed for this change.`\n : \"No schema changes since the latest snapshot in migrations/snapshots: no migration needed.\",\n );\n return null;\n }\n const file = relative(process.cwd(), result.file) || result.file;\n console.log(\n `Wrote the migration ${file}${result.snapshot ? ` and the snapshot ${relative(process.cwd(), result.snapshot) || result.snapshot}` : \"\"}.`,\n );\n if (result.todos.length > 0) {\n console.log(\"\");\n console.log(\n `Resolve ${result.todos.length} TODO${result.todos.length === 1 ? \"\" : \"s\"} in ${file}, then run \\`jazz-tools generate\\`:`,\n );\n for (const todo of result.todos) console.log(` ${todo}`);\n } else {\n console.log(\"Review the migration, then run `jazz-tools generate` and commit the results.\");\n }\n console.log(DEPLOY_NOTE);\n return result.file;\n}\n\nfunction realpathOrSelf(path: string): string {\n try {\n return realpathSync(path);\n } catch {\n return path;\n }\n}\n\nfunction isMainModule(): boolean {\n const entry = process.argv[1];\n if (!entry) {\n return false;\n }\n // pnpm reaches the CLI through a symlinked package path, so argv[1] and\n // import.meta.url differ only by symlink resolution. Compare realpaths.\n return realpathOrSelf(entry) === realpathOrSelf(fileURLToPath(import.meta.url));\n}\n\nfunction printHelp(): void {\n console.log(\"Usage: node <path-to-jazz-tools>/dist/cli.js <command> [options]\");\n console.log(\"\\nCommands:\");\n console.log(\n \" generate Write jazz.app.json, jazz.permissions.json and jazz.generated.ts from schema.ts\",\n );\n console.log(\n \" (--check: write nothing, fail if anything is out of date; for CI;\",\n );\n console.log(\n \" --force: overwrite a jazz.app.json or jazz.permissions.json edited by hand;\",\n );\n console.log(\n \" --lang <ts|rust|…>: the bindings' languages, by default each the app's files name)\",\n );\n console.log(\n \" migrations create Write a migration stub for a schema change to migrations/ (--name <name>)\",\n );\n console.log(\" migrations graph Visualize the full migration graph\");\n console.log(\n \" upgrade Convert an alpha.65 app to alpha.66's schema.ts (or write it from a JSON-only app's files)\",\n );\n console.log(\n \" schema compile Print the compiled schema jazz.generated.ts embeds, as JSON\",\n );\n console.log(\" login | logout | whoami (deprecated)\");\n console.log(\" Sign in to Jazz Cloud with your dashboard account\");\n console.log(\n \" teams, apps (deprecated) Manage Jazz Cloud teams and apps (see `apps --help`)\",\n );\n console.log(\n \" inspect <command> Read and change an app's data through its backend (see `inspect --help`)\",\n );\n console.log(\" store detach <path> Make a stopped copy of a store a store of its own\");\n console.log(\" store set-app-id <path> <id>\");\n console.log(\" Make a stopped store serve another app id\");\n console.log(\"\\nOptions:\");\n console.log(\n \" --schema-dir <path> Project directory holding schema.ts (default: .; also ./src, ./src/lib)\",\n );\n console.log(\" --name <name> migrations create: the migration's name\");\n console.log(\"\\nUpgrade options:\");\n console.log(\" --dir <path> The app's directory (default: .)\");\n console.log(\n \" --schema-dir <path> Where schema.ts is, if not ., ./src, ./src/lib or found below --dir\",\n );\n console.log(\" --dry-run Report what would change, write nothing\");\n console.log(\" --skip-typecheck Don't typecheck the converted project\");\n console.log(\"\\nMigration graph options:\");\n console.log(\n \" <appId> Required (or set JAZZ_APP_ID / {VITE,PUBLIC,NEXT_PUBLIC,EXPO_PUBLIC}_JAZZ_APP_ID)\",\n );\n console.log(\n \" --server-url <url> Jazz server URL (or set JAZZ_SERVER_URL / {VITE,PUBLIC,NEXT_PUBLIC,EXPO_PUBLIC}_JAZZ_SERVER_URL)\",\n );\n console.log(\" --admin-secret <sec> Admin secret (or set JAZZ_ADMIN_SECRET)\");\n console.log(\"\\nGlobal options:\");\n console.log(\n \" --env-file <path> Load env vars from this file (repeatable; first file wins per key). Defaults to .env in cwd.\",\n );\n}\n\nif (isMainModule()) {\n const { args, envFiles } = normalizeArgs(process.argv.slice(2));\n const command = args[0] ?? \"\";\n // Cloud commands (login, apps, ...) have their own help.\n const cloudCommand = isCloudCommand(command);\n // Cloud commands and `inspect` have their own help.\n const ownHelp = cloudCommand || command === \"inspect\";\n if (!ownHelp && args.some((arg) => arg === \"--help\" || arg === \"-h\")) {\n printHelp();\n process.exit(0);\n }\n if (envFiles.length > 0) {\n for (const file of envFiles) {\n loadEnvFile(resolve(process.cwd(), file));\n }\n } else {\n loadDotEnv();\n }\n\n if (command === \"inspect\" && args[1] === \"mcp\") {\n const rest = args.slice(2);\n if (rest.some((arg) => arg === \"--help\" || arg === \"-h\")) {\n console.log(\n \"Usage: jazz-tools inspect mcp [--app <url>]\\n\\nServe the app's Inspector API as an MCP server over stdio.\\nAdd it to an agent with e.g. `claude mcp add jazz -- npx jazz-tools inspect mcp --app <url>`.\",\n );\n process.exit(0);\n }\n const appIndex = rest.findIndex((arg) => arg === \"--app\" || arg.startsWith(\"--app=\"));\n const app =\n appIndex === -1\n ? undefined\n : rest[appIndex]!.startsWith(\"--app=\")\n ? rest[appIndex]!.slice(\"--app=\".length)\n : rest[appIndex + 1];\n void import(\"./inspect/mcp.js\").then(({ runMcpServer }) =>\n runMcpServer(app ? { app } : {}).then(\n () => process.exit(0),\n (error: unknown) => {\n console.error(error);\n process.exit(1);\n },\n ),\n );\n } else if (command === \"inspect\") {\n runInspectCommand(args.slice(1), {\n stdout: (text) => process.stdout.write(text),\n stderr: (text) => process.stderr.write(text),\n env: process.env,\n }).then((code) => process.exit(code));\n } else if (cloudCommand) {\n runCloudCommand(args, {\n stdout: (text) => process.stdout.write(text),\n stderr: (text) => process.stderr.write(text),\n env: process.env,\n }).then((code) => process.exit(code));\n } else if (command === \"generate\") {\n exitOnError(Promise.resolve().then(() => generate(parseArgs(args).options)));\n } else if (command === \"upgrade\") {\n const commandArgs = args.slice(1);\n const dryRun = commandArgs.includes(\"--dry-run\");\n exitOnError(\n import(\"./upgrade/index.js\").then(async ({ upgradeProject, formatReport }) => {\n const report = await upgradeProject({\n dir: resolve(process.cwd(), getFlagValue(commandArgs, \"--dir\") ?? \".\"),\n dryRun,\n skipTypecheck: commandArgs.includes(\"--skip-typecheck\"),\n schemaDir: getFlagValue(commandArgs, \"--schema-dir\"),\n });\n console.log(formatReport(report, dryRun));\n if (report.typeErrors.length > 0) process.exitCode = 1;\n }),\n );\n } else if (command === \"print-ts\") {\n // Hidden: the examples' TS from their JSON (src/printer/cli.ts).\n exitOnError(import(\"./printer/cli.js\").then(({ runPrintTs }) => runPrintTs(args.slice(1))));\n } else if (command === \"validate\") {\n console.error(VALIDATE_RENAMED);\n process.exit(1);\n } else if (command === \"store\") {\n const [subcommand, path, ...rest] = args.slice(1);\n const usage =\n \"Usage: jazz-tools store detach <path>\\n jazz-tools store set-app-id <path> <app id>\\n\\n\" +\n \"detach: make a stopped copy of a store a store of its own, so it claims its own chunk directory or s3() prefix instead of the original's.\\n\" +\n \"set-app-id: make a stopped store serve another app id from its next start.\";\n if (subcommand === \"detach\" && path && rest.length === 0) {\n exitOnError(\n import(\"jazz-napi\").then(({ detachStore }) => {\n storeCommand(path, () => detachStore(resolve(process.cwd(), path)));\n console.log(\n `${path} is now a store of its own; it claims its large values' place on its next start.`,\n );\n }),\n );\n } else if (subcommand === \"set-app-id\" && path && rest.length === 1) {\n const appId = rest[0]!;\n exitOnError(\n import(\"jazz-napi\").then(({ setStoreAppId }) => {\n storeCommand(path, () => setStoreAppId(resolve(process.cwd(), path), appId));\n console.log(`${path} serves app ${appId} from its next start.`);\n }),\n );\n } else {\n console.error(usage);\n process.exit(1);\n }\n } else if (command === \"schema\") {\n const subcommand = args[1] ?? \"\";\n if (subcommand === \"compile\") {\n const commandArgs = args.slice(2);\n try {\n assertFlagPairs(\n commandArgs,\n [\"--schema-dir\"],\n (arg) =>\n `Unknown schema compile argument: ${arg}. Only local schema compilation is supported.`,\n );\n } catch (err) {\n console.error((err as Error).message);\n process.exit(1);\n }\n const schemaDir = resolve(process.cwd(), getFlagValue(commandArgs, \"--schema-dir\") ?? \".\");\n exitOnError(compileSchema({ schemaDir }));\n } else {\n console.error(\"Usage: node dist/cli.js schema compile [--schema-dir <path>] [...]\");\n process.exit(1);\n }\n } else if (command === \"migrations\") {\n const subcommand = args[1] ?? \"\";\n let task: Promise<unknown>;\n\n if (subcommand === \"create\") {\n // `--lang=x` is `--lang x`, so the pairs below check it like any flag.\n const commandArgs = args\n .slice(2)\n .flatMap((arg) =>\n arg.startsWith(\"--lang=\") ? [\"--lang\", arg.slice(\"--lang=\".length)] : [arg],\n );\n task = (async () => {\n assertFlagPairs(commandArgs, [\"--schema-dir\", \"--name\", \"--lang\"], (arg) =>\n [\"--fromHash\", \"--toHash\", \"--migrations-dir\"].includes(arg)\n ? `${arg} was removed: migrations go from the latest snapshot in migrations/snapshots to schema.ts's tables.`\n : `Unknown migrations create argument: ${arg}.`,\n );\n await createMigration({\n schemaDir: resolve(process.cwd(), getFlagValue(commandArgs, \"--schema-dir\") ?? \".\"),\n name: getFlagValue(commandArgs, \"--name\"),\n lang: langFlags(commandArgs),\n });\n })();\n } else if (subcommand === \"graph\") {\n task = (async () => {\n const { appId, args: commandArgs } = splitLeadingAppId(args.slice(2));\n assertFlagPairs(\n commandArgs,\n [\"--server-url\", \"--admin-secret\", \"--schema-dir\"],\n (arg) => `Unknown migrations graph argument: ${arg}.`,\n );\n const localOptions = resolveMigrationOptions(commandArgs);\n const options = requireMigrationServerOptions({ ...localOptions, appId });\n const graph = combineMigrationGraphs(\n await fetchMigrationGraph(options),\n await localMigrationGraph(localOptions.schemaDir ?? process.cwd()),\n );\n const color =\n Boolean(process.stdout.isTTY) &&\n process.env.NO_COLOR === undefined &&\n process.env.TERM !== \"dumb\";\n console.log(renderMigrationGraph(graph, color));\n })();\n } else {\n task = Promise.reject(\n new Error(\n `Use \\`jazz-tools migrations create\\` to prepare migrations and \\`jazz-tools migrations graph <appId>\\` to inspect the migration graph. ${DEPLOY_NOTE}`,\n ),\n );\n }\n\n exitOnError(task);\n } else if (command === \"deploy\") {\n console.error(DEPLOY_REMOVED);\n process.exit(1);\n } else if (command === \"server\") {\n console.error(SERVER_REMOVED);\n process.exit(1);\n } else if (command === \"create\") {\n console.error(CREATE_REMOVED);\n process.exit(1);\n } else if (command === \"migrate-alpha59\") {\n console.error(MIGRATE_ALPHA59_MOVED);\n process.exit(1);\n } else {\n printHelp();\n process.exit(command ? 1 : 0);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,oCAAoC;AAEpC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACxF,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAiBrD,6EAA6E;AAC7E,2BAA2B;AAC3B,MAAM,WAAW,GACf,0HAA0H,CAAC;AAE7H,MAAM,cAAc,GAClB,mCAAmC;IACnC,iGAAiG;IACjG,6CAA6C,CAAC;AAEh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AC,CAAC,CAAC,CAAC;IAClB,CAAC;SAAM,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;SAAM,IAAI,OAAO,KAAK,iBAAiB,EAAE,CAAC;QACzC,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;SAAM,CAAC;QACN,SAAS,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;AACH,CAAC","sourcesContent":["#!/usr/bin/env node\n\n// CLI for jazz-tools schema tooling\n\nimport { existsSync, readFileSync, realpathSync } from \"fs\";\nimport { join, relative, resolve } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { createAppMigration, localMigrationGraph, generateApp } from \"./dev/project.js\";\nimport {\n combineMigrationGraphs,\n fetchMigrationGraph,\n renderMigrationGraph,\n} from \"./dev/migration-graph.js\";\nimport { readAppProject } from \"./dev/app-files.js\";\nimport { compileApp } from \"./dev/codegen-napi.js\";\nimport { isCloudCommand, runCloudCommand } from \"./cloud/commands.js\";\nimport { runInspectCommand } from \"./inspect/cli.js\";\n\nexport interface BuildOptions {\n /** The project directory: jazz.app.json in it, ./src or ./src/lib. */\n schemaDir: string;\n /** Write nothing; fail if jazz.app.json, jazz.permissions.json or the bindings aren't what generate would write. */\n check?: boolean;\n /** Overwrite a jazz.app.json or jazz.permissions.json edited by hand. */\n force?: boolean;\n /** `--lang <lang>` (repeatable): the bindings' languages; by default each the app's files name. */\n lang?: string[];\n}\n\nexport interface SchemaCompileOptions {\n schemaDir: string;\n}\n\n// createJazz publishes the app's bundle when the backend starts, so there is\n// no separate deploy step.\nconst DEPLOY_NOTE =\n \"Deploy your backend to publish them: createJazz publishes the schema, its permissions and its migrations when it starts.\";\n\nconst DEPLOY_REMOVED =\n \"`jazz-tools deploy` was removed. \" +\n \"createJazz publishes your schema, its permissions and its migrations when your backend starts, \" +\n \"so deploying the backend is the deployment.\";\n\nconst SERVER_REMOVED =\n \"`jazz-tools server` was removed. Jazz runs inside your backend: \" +\n \"`createJazz({ store: vercel() })` runs it on Vercel, and \" +\n \"`createJazz({ store: sqlite({ path }) })` serves sync from your own server. \" +\n \"Jazz Cloud is deprecated for new apps.\";\n\nconst UPGRADE_GUIDE_URL =\n \"https://jazz.tools/docs/operating/backups-and-upgrades#upgrading-from-alpha70-to-beta0\";\n\nconst UPGRADE_REMOVED =\n \"`jazz-tools upgrade` was removed in 2.0.0-beta.0. To convert an alpha.65 (or older) app, \" +\n \"run `npx jazz-tools@2.0.0-alpha.70 upgrade`, then follow the upgrade guide: \" +\n UPGRADE_GUIDE_URL;\n\nconst CREATE_REMOVED = \"`jazz-tools create` was removed. Start a project with `npm create jazz`.\";\n\nconst MIGRATE_ALPHA59_MOVED =\n \"`jazz-tools migrate-alpha59` was removed. Move alpha.59 data with the exporter and importer from \" +\n \"https://github.com/garden-co/jazz/releases/tag/v2.0.0-alpha.65 (`jazz-alpha59-alpha60-export-<platform>` \" +\n \"and `jazz-alpha59-alpha60-import-<platform>`), then upgrade from alpha.65.\";\n\nfunction parseArgs(args: string[]): { command: string; options: BuildOptions } {\n const command = args[0] || \"\";\n const schemaDir = getFlagValue(args, \"--schema-dir\", \"last\") ?? process.cwd();\n if (args.includes(\"--strict-provenance\")) {\n throw new Error(\n \"--strict-provenance was removed with schema.ts: jazz.app.json's columns are taken as written. Use Jazz's $createdAt, $createdBy, $updatedAt and $updatedBy instead of columns that duplicate them.\",\n );\n }\n return {\n command,\n options: {\n schemaDir: resolve(process.cwd(), schemaDir),\n check: args.includes(\"--check\"),\n force: args.includes(\"--force\"),\n lang: langFlags(args),\n },\n };\n}\n\n/** `jazz-tools generate [--check] [--force]`: write jazz.app.json, jazz.permissions.json and the bindings from the app's TS. */\nexport async function generate(options: BuildOptions): Promise<void> {\n const result = await generateApp({\n cwd: options.schemaDir,\n check: options.check,\n force: options.force,\n ...(options.lang?.length ? { lang: options.lang } : {}),\n });\n for (const warning of result.warnings) {\n console.warn(`\\x1b[33m${warning}\\x1b[0m`);\n }\n const shown = result.bindings\n .map((file) => relative(process.cwd(), join(result.dir, file)) || file)\n .join(\" and \");\n const files = [\n ...(result.wroteFiles ? [\"jazz.app.json\", \"jazz.permissions.json\"] : []),\n ...(result.wrote ? [shown] : []),\n ];\n console.log(\n options.check\n ? `jazz.app.json, jazz.permissions.json and ${shown} are up to date with the app's TS.`\n : files.length > 0\n ? `Wrote ${files.join(\", \")} from the app's TS. Commit them.`\n : `jazz.app.json, jazz.permissions.json and ${shown} are up to date.`,\n );\n console.log(DEPLOY_NOTE);\n}\n\n/** `jazz-tools schema compile`: print what jazz.generated.ts passes to bindApp, as JSON. */\nexport async function compileSchema(options: SchemaCompileOptions): Promise<void> {\n const project = await readAppProject(options.schemaDir);\n process.stdout.write(`${JSON.stringify(await compileApp(project.app), null, 2)}\\n`);\n}\n\nexport function requireServerValue(\n value: string | undefined,\n kind: \"serverUrl\" | \"adminSecret\",\n): string {\n if (value) return value;\n if (kind === \"serverUrl\") {\n throw new Error(\n \"Missing server URL. Pass --server-url <url> or set JAZZ_SERVER_URL (or a framework-prefixed form such as VITE_JAZZ_SERVER_URL).\",\n );\n }\n throw new Error(\"Missing admin secret. Pass --admin-secret <secret> or set JAZZ_ADMIN_SECRET.\");\n}\n\nexport function requireAppId(appId: string | undefined): string {\n if (appId) return appId;\n throw new Error(\n \"Missing app ID. Pass an <appId> positional argument or set JAZZ_APP_ID (or a framework-prefixed form such as VITE_JAZZ_APP_ID).\",\n );\n}\n\nexport interface MigrationCommandOptions {\n appId?: string;\n serverUrl?: string;\n adminSecret?: string;\n schemaDir?: string;\n}\n\nexport interface CreateMigrationOptions {\n schemaDir: string;\n name?: string;\n /** `--lang <lang>` (repeatable), as for `generate`. */\n lang?: string[];\n}\n\n/** Every `--lang <lang>` (or `--lang=<lang>`) given; one without a value is refused. */\nexport function langFlags(args: readonly string[]): string[] {\n const langs: string[] = [];\n args.forEach((arg, i) => {\n if (arg.startsWith(\"--lang=\")) {\n const lang = arg.slice(\"--lang=\".length);\n if (!lang) throw new Error(\"Missing value for --lang (e.g. --lang ts).\");\n langs.push(lang);\n } else if (arg === \"--lang\") {\n const lang = args[i + 1];\n if (!lang || lang.startsWith(\"--\"))\n throw new Error(\"Missing value for --lang (e.g. --lang ts).\");\n langs.push(lang);\n }\n });\n return langs;\n}\n\n// Framework bundlers (Vite, SvelteKit, Next.js, Expo) expose public env vars\n// under their own prefix so the client bundle can read them. The CLI often\n// runs in the same project, so accept those prefixed names as fallbacks for\n// the canonical JAZZ_ form. The unprefixed JAZZ_ name always wins — it's the\n// explicit opt-in when the framework var points somewhere else (e.g. prod).\n// Admin/backend secrets stay unprefixed by design: a PUBLIC_/VITE_/NEXT_PUBLIC_\n// prefix would leak them into the client bundle.\nexport const SERVER_URL_ENV_VARS = [\n \"JAZZ_SERVER_URL\",\n \"PUBLIC_JAZZ_SERVER_URL\",\n \"VITE_JAZZ_SERVER_URL\",\n \"NEXT_PUBLIC_JAZZ_SERVER_URL\",\n \"EXPO_PUBLIC_JAZZ_SERVER_URL\",\n] as const;\n\nexport const APP_ID_ENV_VARS = [\n \"JAZZ_APP_ID\",\n \"PUBLIC_JAZZ_APP_ID\",\n \"VITE_JAZZ_APP_ID\",\n \"NEXT_PUBLIC_JAZZ_APP_ID\",\n \"EXPO_PUBLIC_JAZZ_APP_ID\",\n] as const;\n\n// Real environment variables always win — `.env` is a fallback only.\n// Uses Node's built-in `process.loadEnvFile` when operating on the real\n// process.env; falls back to a small parser for tests and older Node.\nexport function loadEnvFile(\n envPath: string,\n env: Record<string, string | undefined> = process.env,\n): void {\n if (!existsSync(envPath)) return;\n if (env === process.env && typeof process.loadEnvFile === \"function\") {\n process.loadEnvFile(envPath);\n return;\n }\n const content = readFileSync(envPath, \"utf8\");\n for (let line of content.split(\"\\n\")) {\n if (line.endsWith(\"\\r\")) line = line.slice(0, -1);\n if (!line || line.startsWith(\"#\")) continue;\n const eq = line.indexOf(\"=\");\n if (eq === -1) continue;\n const key = line.slice(0, eq).trim();\n let value = line.slice(eq + 1).trim();\n if (\n (value.startsWith('\"') && value.endsWith('\"')) ||\n (value.startsWith(\"'\") && value.endsWith(\"'\"))\n ) {\n value = value.slice(1, -1);\n }\n if (env[key] === undefined) env[key] = value;\n }\n}\n\nexport function loadDotEnv(\n cwd: string = process.cwd(),\n env: Record<string, string | undefined> = process.env,\n): void {\n loadEnvFile(join(cwd, \".env\"), env);\n}\n\n// The value of `flag` at args[i], given as `flag value` or `flag=value`, and\n// how many args it spans.\nfunction readFlagAt(\n args: string[],\n i: number,\n flag: string,\n): { value: string; width: number } | undefined {\n const arg = args[i];\n const width = arg === flag ? 2 : 1;\n if (width === 1 && !arg?.startsWith(`${flag}=`)) return undefined;\n const value = width === 2 ? args[i + 1] : arg!.slice(flag.length + 1);\n if (!value || value.startsWith(\"-\")) {\n throw new Error(`Missing value for ${flag}.`);\n }\n return { value, width };\n}\n\n// Normalize env-file flags in the same pass that records the files to load.\n// This keeps command and operand positions stable for every dispatch path.\nfunction normalizeArgs(args: string[]): { args: string[]; envFiles: string[] } {\n const normalized: string[] = [];\n const envFiles: string[] = [];\n for (let i = 0; i < args.length; i++) {\n const found = readFlagAt(args, i, \"--env-file\");\n if (found) {\n envFiles.push(found.value);\n i += found.width - 1;\n } else {\n normalized.push(args[i]!);\n }\n }\n return { args: normalized, envFiles };\n}\n\n// Collect every `--env-file=PATH` and `--env-file PATH` from argv, in\n// the order they appear. Earlier files take precedence over later ones\n// because loadEnvFile only fills in keys that are still undefined.\nexport function readEnvFiles(args: string[]): string[] {\n return normalizeArgs(args).envFiles;\n}\nexport function resolveEnvVar(\n names: readonly string[],\n env: Record<string, string | undefined> = process.env,\n): string | undefined {\n for (const name of names) {\n const value = env[name];\n if (value) return value;\n }\n return undefined;\n}\n\nfunction getFlagValue(\n args: string[],\n flag: string,\n selection: \"first\" | \"last\" = \"first\",\n): string | undefined {\n const values: string[] = [];\n for (let i = 0; i < args.length; i++) {\n const found = readFlagAt(args, i, flag);\n if (found) {\n values.push(found.value);\n i += found.width - 1;\n }\n }\n return selection === \"first\" ? values[0] : values.at(-1);\n}\n\n// Accept only `--flag value` pairs drawn from `allowed`.\nfunction assertFlagPairs(\n args: string[],\n allowed: readonly string[],\n unknown: (arg: string) => string,\n): void {\n for (let i = 0; i < args.length; i += 2) {\n if (!allowed.includes(args[i]!)) {\n throw new Error(unknown(args[i]!));\n }\n if (!args[i + 1] || args[i + 1]!.startsWith(\"--\")) {\n throw new Error(`Missing value for ${args[i]}.`);\n }\n }\n}\n\nfunction exitOnError(task: Promise<unknown>): void {\n task.catch((err) => {\n console.error(err.message);\n process.exit(1);\n });\n}\n\n/** Run a `store` subcommand, which needs the store stopped. */\nfunction storeCommand(path: string, run: () => void): void {\n try {\n run();\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n if (/already open|jazz\\.lock/i.test(message)) {\n throw new Error(`${path} is in use: stop the backend or server using it first.`);\n }\n throw error;\n }\n}\n\nfunction splitLeadingAppId(args: string[]): { appId?: string; args: string[] } {\n const first = args[0];\n if (!first || first.startsWith(\"-\")) {\n return { args: args, appId: resolveEnvVar(APP_ID_ENV_VARS) };\n }\n\n return {\n appId: first,\n args: args.slice(1),\n };\n}\n\nfunction resolveMigrationOptions(args: string[]): MigrationCommandOptions {\n const serverUrl = getFlagValue(args, \"--server-url\") ?? resolveEnvVar(SERVER_URL_ENV_VARS);\n const adminSecret = getFlagValue(args, \"--admin-secret\") ?? process.env.JAZZ_ADMIN_SECRET;\n const schemaDir = resolve(process.cwd(), getFlagValue(args, \"--schema-dir\") ?? process.cwd());\n\n return {\n serverUrl,\n adminSecret,\n schemaDir,\n };\n}\n\nfunction requireMigrationServerOptions(options: MigrationCommandOptions): {\n appId: string;\n serverUrl: string;\n adminSecret: string;\n} {\n return {\n appId: requireAppId(options.appId),\n serverUrl: requireServerValue(options.serverUrl, \"serverUrl\"),\n adminSecret: requireServerValue(options.adminSecret, \"adminSecret\"),\n };\n}\n\n/** `jazz-tools migrations create --name <name>`: write a migration stub for the schema change. */\nexport async function createMigration(options: CreateMigrationOptions): Promise<string | null> {\n const result = await createAppMigration({\n cwd: options.schemaDir,\n name: options.name ?? \"\",\n });\n if (!result.file) {\n console.log(\n result.snapshot\n ? `Wrote the snapshot ${relative(process.cwd(), result.snapshot) || result.snapshot}: no migration is needed for this change.`\n : \"No schema changes since the latest snapshot in migrations/snapshots: no migration needed.\",\n );\n return null;\n }\n const file = relative(process.cwd(), result.file) || result.file;\n console.log(\n `Wrote the migration ${file}${result.snapshot ? ` and the snapshot ${relative(process.cwd(), result.snapshot) || result.snapshot}` : \"\"}.`,\n );\n if (result.todos.length > 0) {\n console.log(\"\");\n console.log(\n `Resolve ${result.todos.length} TODO${result.todos.length === 1 ? \"\" : \"s\"} in ${file}, then run \\`jazz-tools generate\\`:`,\n );\n for (const todo of result.todos) console.log(` ${todo}`);\n } else {\n console.log(\"Review the migration, then run `jazz-tools generate` and commit the results.\");\n }\n console.log(DEPLOY_NOTE);\n return result.file;\n}\n\nfunction realpathOrSelf(path: string): string {\n try {\n return realpathSync(path);\n } catch {\n return path;\n }\n}\n\nfunction isMainModule(): boolean {\n const entry = process.argv[1];\n if (!entry) {\n return false;\n }\n // pnpm reaches the CLI through a symlinked package path, so argv[1] and\n // import.meta.url differ only by symlink resolution. Compare realpaths.\n return realpathOrSelf(entry) === realpathOrSelf(fileURLToPath(import.meta.url));\n}\n\nfunction printHelp(): void {\n console.log(\"Usage: node <path-to-jazz-tools>/dist/cli.js <command> [options]\");\n console.log(\"\\nCommands:\");\n console.log(\n \" generate Write jazz.app.json, jazz.permissions.json and jazz.generated.ts from schema.ts\",\n );\n console.log(\n \" (--check: write nothing, fail if anything is out of date; for CI;\",\n );\n console.log(\n \" --force: overwrite a jazz.app.json or jazz.permissions.json edited by hand;\",\n );\n console.log(\n \" --lang <ts|rust|…>: the bindings' languages, by default each the app's files name)\",\n );\n console.log(\n \" migrations create Write a migration stub for a schema change to migrations/ (--name <name>)\",\n );\n console.log(\" migrations graph Visualize the full migration graph\");\n console.log(\n \" schema compile Print the compiled schema jazz.generated.ts embeds, as JSON\",\n );\n console.log(\" login | logout | whoami (deprecated)\");\n console.log(\" Sign in to Jazz Cloud with your dashboard account\");\n console.log(\n \" teams, apps (deprecated) Manage Jazz Cloud teams and apps (see `apps --help`)\",\n );\n console.log(\n \" inspect <command> Read and change an app's data through its backend (see `inspect --help`)\",\n );\n console.log(\" store detach <path> Make a stopped copy of a store a store of its own\");\n console.log(\" store set-app-id <path> <id>\");\n console.log(\" Make a stopped store serve another app id\");\n console.log(\"\\nOptions:\");\n console.log(\n \" --schema-dir <path> Project directory holding schema.ts (default: .; also ./src, ./src/lib)\",\n );\n console.log(\" --name <name> migrations create: the migration's name\");\n console.log(\"\\nUpgrade options:\");\n console.log(\" --dir <path> The app's directory (default: .)\");\n console.log(\n \" --schema-dir <path> Where schema.ts is, if not ., ./src, ./src/lib or found below --dir\",\n );\n console.log(\" --dry-run Report what would change, write nothing\");\n console.log(\" --skip-typecheck Don't typecheck the converted project\");\n console.log(\"\\nMigration graph options:\");\n console.log(\n \" <appId> Required (or set JAZZ_APP_ID / {VITE,PUBLIC,NEXT_PUBLIC,EXPO_PUBLIC}_JAZZ_APP_ID)\",\n );\n console.log(\n \" --server-url <url> Jazz server URL (or set JAZZ_SERVER_URL / {VITE,PUBLIC,NEXT_PUBLIC,EXPO_PUBLIC}_JAZZ_SERVER_URL)\",\n );\n console.log(\" --admin-secret <sec> Admin secret (or set JAZZ_ADMIN_SECRET)\");\n console.log(\"\\nGlobal options:\");\n console.log(\n \" --env-file <path> Load env vars from this file (repeatable; first file wins per key). Defaults to .env in cwd.\",\n );\n}\n\nif (isMainModule()) {\n const { args, envFiles } = normalizeArgs(process.argv.slice(2));\n const command = args[0] ?? \"\";\n // Cloud commands (login, apps, ...) have their own help.\n const cloudCommand = isCloudCommand(command);\n // Cloud commands and `inspect` have their own help; `upgrade` only refuses.\n const ownHelp = cloudCommand || command === \"inspect\" || command === \"upgrade\";\n if (!ownHelp && args.some((arg) => arg === \"--help\" || arg === \"-h\")) {\n printHelp();\n process.exit(0);\n }\n if (envFiles.length > 0) {\n for (const file of envFiles) {\n loadEnvFile(resolve(process.cwd(), file));\n }\n } else {\n loadDotEnv();\n }\n\n if (command === \"inspect\" && args[1] === \"mcp\") {\n const rest = args.slice(2);\n if (rest.some((arg) => arg === \"--help\" || arg === \"-h\")) {\n console.log(\n \"Usage: jazz-tools inspect mcp [--app <url>]\\n\\nServe the app's Inspector API as an MCP server over stdio.\\nAdd it to an agent with e.g. `claude mcp add jazz -- npx jazz-tools inspect mcp --app <url>`.\",\n );\n process.exit(0);\n }\n const appIndex = rest.findIndex((arg) => arg === \"--app\" || arg.startsWith(\"--app=\"));\n const app =\n appIndex === -1\n ? undefined\n : rest[appIndex]!.startsWith(\"--app=\")\n ? rest[appIndex]!.slice(\"--app=\".length)\n : rest[appIndex + 1];\n void import(\"./inspect/mcp.js\").then(({ runMcpServer }) =>\n runMcpServer(app ? { app } : {}).then(\n () => process.exit(0),\n (error: unknown) => {\n console.error(error);\n process.exit(1);\n },\n ),\n );\n } else if (command === \"inspect\") {\n runInspectCommand(args.slice(1), {\n stdout: (text) => process.stdout.write(text),\n stderr: (text) => process.stderr.write(text),\n env: process.env,\n }).then((code) => process.exit(code));\n } else if (cloudCommand) {\n runCloudCommand(args, {\n stdout: (text) => process.stdout.write(text),\n stderr: (text) => process.stderr.write(text),\n env: process.env,\n }).then((code) => process.exit(code));\n } else if (command === \"generate\") {\n exitOnError(Promise.resolve().then(() => generate(parseArgs(args).options)));\n } else if (command === \"upgrade\") {\n console.error(UPGRADE_REMOVED);\n process.exit(1);\n } else if (command === \"print-ts\") {\n // Hidden: the examples' TS from their JSON (src/printer/cli.ts).\n exitOnError(import(\"./printer/cli.js\").then(({ runPrintTs }) => runPrintTs(args.slice(1))));\n } else if (command === \"store\") {\n const [subcommand, path, ...rest] = args.slice(1);\n const usage =\n \"Usage: jazz-tools store detach <path>\\n jazz-tools store set-app-id <path> <app id>\\n\\n\" +\n \"detach: make a stopped copy of a store a store of its own, so it claims its own chunk directory or s3() prefix instead of the original's.\\n\" +\n \"set-app-id: make a stopped store serve another app id from its next start.\";\n if (subcommand === \"detach\" && path && rest.length === 0) {\n exitOnError(\n import(\"jazz-napi\").then(({ detachStore }) => {\n storeCommand(path, () => detachStore(resolve(process.cwd(), path)));\n console.log(\n `${path} is now a store of its own; it claims its large values' place on its next start.`,\n );\n }),\n );\n } else if (subcommand === \"set-app-id\" && path && rest.length === 1) {\n const appId = rest[0]!;\n exitOnError(\n import(\"jazz-napi\").then(({ setStoreAppId }) => {\n storeCommand(path, () => setStoreAppId(resolve(process.cwd(), path), appId));\n console.log(`${path} serves app ${appId} from its next start.`);\n }),\n );\n } else {\n console.error(usage);\n process.exit(1);\n }\n } else if (command === \"schema\") {\n const subcommand = args[1] ?? \"\";\n if (subcommand === \"compile\") {\n const commandArgs = args.slice(2);\n try {\n assertFlagPairs(\n commandArgs,\n [\"--schema-dir\"],\n (arg) =>\n `Unknown schema compile argument: ${arg}. Only local schema compilation is supported.`,\n );\n } catch (err) {\n console.error((err as Error).message);\n process.exit(1);\n }\n const schemaDir = resolve(process.cwd(), getFlagValue(commandArgs, \"--schema-dir\") ?? \".\");\n exitOnError(compileSchema({ schemaDir }));\n } else {\n console.error(\"Usage: node dist/cli.js schema compile [--schema-dir <path>] [...]\");\n process.exit(1);\n }\n } else if (command === \"migrations\") {\n const subcommand = args[1] ?? \"\";\n let task: Promise<unknown>;\n\n if (subcommand === \"create\") {\n // `--lang=x` is `--lang x`, so the pairs below check it like any flag.\n const commandArgs = args\n .slice(2)\n .flatMap((arg) =>\n arg.startsWith(\"--lang=\") ? [\"--lang\", arg.slice(\"--lang=\".length)] : [arg],\n );\n task = (async () => {\n assertFlagPairs(commandArgs, [\"--schema-dir\", \"--name\", \"--lang\"], (arg) =>\n [\"--fromHash\", \"--toHash\", \"--migrations-dir\"].includes(arg)\n ? `${arg} was removed: migrations go from the latest snapshot in migrations/snapshots to schema.ts's tables.`\n : `Unknown migrations create argument: ${arg}.`,\n );\n await createMigration({\n schemaDir: resolve(process.cwd(), getFlagValue(commandArgs, \"--schema-dir\") ?? \".\"),\n name: getFlagValue(commandArgs, \"--name\"),\n lang: langFlags(commandArgs),\n });\n })();\n } else if (subcommand === \"graph\") {\n task = (async () => {\n const { appId, args: commandArgs } = splitLeadingAppId(args.slice(2));\n assertFlagPairs(\n commandArgs,\n [\"--server-url\", \"--admin-secret\", \"--schema-dir\"],\n (arg) => `Unknown migrations graph argument: ${arg}.`,\n );\n const localOptions = resolveMigrationOptions(commandArgs);\n const options = requireMigrationServerOptions({ ...localOptions, appId });\n const graph = combineMigrationGraphs(\n await fetchMigrationGraph(options),\n await localMigrationGraph(localOptions.schemaDir ?? process.cwd()),\n );\n const color =\n Boolean(process.stdout.isTTY) &&\n process.env.NO_COLOR === undefined &&\n process.env.TERM !== \"dumb\";\n console.log(renderMigrationGraph(graph, color));\n })();\n } else {\n task = Promise.reject(\n new Error(\n `Use \\`jazz-tools migrations create\\` to prepare migrations and \\`jazz-tools migrations graph <appId>\\` to inspect the migration graph. ${DEPLOY_NOTE}`,\n ),\n );\n }\n\n exitOnError(task);\n } else if (command === \"deploy\") {\n console.error(DEPLOY_REMOVED);\n process.exit(1);\n } else if (command === \"server\") {\n console.error(SERVER_REMOVED);\n process.exit(1);\n } else if (command === \"create\") {\n console.error(CREATE_REMOVED);\n process.exit(1);\n } else if (command === \"migrate-alpha59\") {\n console.error(MIGRATE_ALPHA59_MOVED);\n process.exit(1);\n } else {\n printHelp();\n process.exit(command ? 1 : 0);\n }\n}\n"]}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -6,5 +6,4 @@ export * from "../accounts/exports.js";
|
|
|
6
6
|
export { accountRegistryUrl } from "../accounts/context.js";
|
|
7
7
|
export { createJazzClient, startJazzClient, type JazzClientConfig, } from "../session/create-jazz-session.js";
|
|
8
8
|
export type { JazzSession, JazzSessionSnapshot, JazzSessionErrorViewProps, JazzSessionOperation, JazzUser, } from "../session/jazz-session.js";
|
|
9
|
-
export { AccountManager, BrowserAuthSecretStore, createAccountManager, createJazzApp, exportLocalFirstSecret, } from "../removed-api.js";
|
|
10
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEvF,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,KAAK,gBAAgB,GACtB,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,EACpB,QAAQ,GACT,MAAM,4BAA4B,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEvF,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,KAAK,gBAAgB,GACtB,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,EACpB,QAAQ,GACT,MAAM,4BAA4B,CAAC"}
|
package/dist/client/index.js
CHANGED
|
@@ -2,6 +2,4 @@ export { getSubscriptionStore } from "../subscription-store-internal.js";
|
|
|
2
2
|
export * from "../accounts/exports.js";
|
|
3
3
|
export { accountRegistryUrl } from "../accounts/context.js";
|
|
4
4
|
export { createJazzClient, startJazzClient, } from "../session/create-jazz-session.js";
|
|
5
|
-
// Removed in alpha.61: stubs that throw, naming the replacement (one release).
|
|
6
|
-
export { AccountManager, BrowserAuthSecretStore, createAccountManager, createJazzApp, exportLocalFirstSecret, } from "../removed-api.js";
|
|
7
5
|
//# sourceMappingURL=index.js.map
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAGzE,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EACL,gBAAgB,EAChB,eAAe,GAEhB,MAAM,mCAAmC,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAGzE,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EACL,gBAAgB,EAChB,eAAe,GAEhB,MAAM,mCAAmC,CAAC","sourcesContent":["export type { JazzClient } from \"../web/create-jazz-client.js\";\nexport type { QueryBuilder, QueryOptions } from \"../runtime/db.js\";\nexport { getSubscriptionStore } from \"../subscription-store-internal.js\";\nexport type { CacheEntryHandle, UseAllState } from \"../subscription-store-internal.js\";\n\nexport * from \"../accounts/exports.js\";\n\nexport { accountRegistryUrl } from \"../accounts/context.js\";\n\nexport {\n createJazzClient,\n startJazzClient,\n type JazzClientConfig,\n} from \"../session/create-jazz-session.js\";\nexport type {\n JazzSession,\n JazzSessionSnapshot,\n JazzSessionErrorViewProps,\n JazzSessionOperation,\n JazzUser,\n} from \"../session/jazz-session.js\";\n"]}
|
package/dist/dev/app-files.js
CHANGED
|
@@ -34,7 +34,7 @@ export async function readAppProject(cwd) {
|
|
|
34
34
|
if (!dir) {
|
|
35
35
|
const legacy = APP_ROOTS.map((root) => join(cwd, root, "schema.ts")).find(existsSync);
|
|
36
36
|
throw new Error(legacy
|
|
37
|
-
? `${relative(cwd, legacy) || legacy} is an alpha.64 schema: jazz.app.json is now the app's schema.
|
|
37
|
+
? `${relative(cwd, legacy) || legacy} is an alpha.64 schema: jazz.app.json is now the app's schema. Convert the app with \`npx jazz-tools@2.0.0-alpha.70 upgrade\`: see https://jazz.tools/docs/operating/backups-and-upgrades#upgrading-from-alpha70-to-beta0.`
|
|
38
38
|
: `No ${APP_FILE} in ${cwd} (looked in ${APP_ROOTS.join(", ")}). See ${APP_FILES_DOCS}.`);
|
|
39
39
|
}
|
|
40
40
|
const optional = (file) => readFile(join(dir, file), "utf8").catch(() => null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-files.js","sourceRoot":"","sources":["../../src/dev/app-files.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,O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AAI,KAAK,CACb,yBAAyB,KAAK,+BAA+B,QAAQ,oDAAoD,cAAc,aAAa,CACrJ,CAAC;AACJ,CAAC","sourcesContent":["/**\n * An app's files (SPEC 10.10): `jazz.app.json` (schema, history, migrations,\n * computed fields and transforms), `jazz.permissions.json` (backends only),\n * and the typed bindings `jazz-tools generate` generates from the first,\n * `jazz.generated.ts`, whose `source` is the hash of the file it was\n * generated from. The files are the app's only source. Node only.\n */\nimport { existsSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { join, relative } from \"node:path\";\nimport { schemaSourceHash } from \"./codegen-napi.js\";\n\nexport const APP_FILE = \"jazz.app.json\";\nexport const PERMISSIONS_FILE = \"jazz.permissions.json\";\nexport const GENERATED_FILE = \"jazz.generated.ts\";\nexport const COMPUTED_FILE = \"jazz.computed.ts\";\n\n/** Where the docs explain the files and their expression grammar. */\nexport const APP_FILES_DOCS = \"https://jazz.tools/docs/reference/app-files\";\n\n/** The code jazz-napi gives a refusal that only says the format can't express something yet. */\nexport const APP_FILES_UNSUPPORTED = \"JAZZ_APP_FILES_UNSUPPORTED\";\n\n/** Where a project keeps its files, as the CLI looks for them: the root, ./src, ./src/lib. */\nexport const APP_ROOTS = [\".\", \"src\", join(\"src\", \"lib\")];\n\n/** The directory holding `jazz.app.json` in the project at `cwd`, if any. */\nexport function findAppDir(cwd: string): string | null {\n const found = APP_ROOTS.map((root) => join(cwd, root)).filter((dir) =>\n existsSync(join(dir, APP_FILE)),\n );\n if (found.length > 1) {\n throw new Error(\n `found ${APP_FILE} in both ${found.map((dir) => relative(cwd, join(dir, APP_FILE)) || APP_FILE).join(\" and \")}: ` +\n \"keep one, or point the command at the app with --schema-dir.\",\n );\n }\n return found[0] ?? null;\n}\n\n/** An app's files as they are on disk; the permissions and bindings may be missing. */\nexport interface AppProject {\n dir: string;\n app: string;\n permissions: string | null;\n bindings: string | null;\n}\n\n/** Read the files of the project at `cwd`, or refuse naming what is missing. */\nexport async function readAppProject(cwd: string): Promise<AppProject> {\n const dir = findAppDir(cwd);\n if (!dir) {\n const legacy = APP_ROOTS.map((root) => join(cwd, root, \"schema.ts\")).find(existsSync);\n throw new Error(\n legacy\n ? `${relative(cwd, legacy) || legacy} is an alpha.64 schema: jazz.app.json is now the app's schema. Convert the app with \\`npx jazz-tools@2.0.0-alpha.70 upgrade\\`: see https://jazz.tools/docs/operating/backups-and-upgrades#upgrading-from-alpha70-to-beta0.`\n : `No ${APP_FILE} in ${cwd} (looked in ${APP_ROOTS.join(\", \")}). See ${APP_FILES_DOCS}.`,\n );\n }\n const optional = (file: string) => readFile(join(dir, file), \"utf8\").catch(() => null);\n return {\n dir,\n app: await readFile(join(dir, APP_FILE), \"utf8\"),\n permissions: await optional(PERMISSIONS_FILE),\n bindings: await optional(GENERATED_FILE),\n };\n}\n\n/**\n * `createJazz`'s check of the bindings it runs with against the project's\n * `jazz.app.json`: refused when the file changed since the bindings were\n * generated. The project is `JAZZ_APP_DIR` if set, else the process's cwd. A\n * process with no `jazz.app.json` in reach (a deployed bundle, which ships\n * only the bindings) has nothing to compare and starts; outside production it\n * says so, since a dev server started elsewhere (a monorepo root) would\n * otherwise skip the check unnoticed.\n */\nexport async function checkRunningBindings(\n source: string,\n cwd: string = process.env.JAZZ_APP_DIR ?? process.cwd(),\n warn: (message: string) => void = console.warn,\n): Promise<void> {\n const dir = findAppDir(cwd);\n if (!dir) {\n if (process.env.NODE_ENV !== \"production\") {\n warn(\n `jazz: no ${APP_FILE} in ${cwd} (looked in ${APP_ROOTS.join(\", \")}), so createJazz can't check that ${GENERATED_FILE} is up to date. ` +\n \"Set JAZZ_APP_DIR to the app's directory to check it.\",\n );\n }\n return;\n }\n const app = await readFile(join(dir, APP_FILE), \"utf8\");\n if ((await schemaSourceHash(app)) === source) return;\n const shown = relative(cwd, join(dir, GENERATED_FILE)) || GENERATED_FILE;\n throw new Error(\n `bindings out of date: ${shown} was generated from another ${APP_FILE}. Run \\`npx jazz-tools generate\\` and commit the ${GENERATED_FILE} it writes.`,\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogue-api.d.ts","sourceRoot":"","sources":["../../src/dev/catalogue-api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,KAAK,IAAI,SAAS,EAClB,UAAU,EACX,MAAM,qBAAqB,CAAC;AAI7B,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAUD,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAc7D;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;
|
|
1
|
+
{"version":3,"file":"catalogue-api.d.ts","sourceRoot":"","sources":["../../src/dev/catalogue-api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,KAAK,IAAI,SAAS,EAClB,UAAU,EACX,MAAM,qBAAqB,CAAC;AAI7B,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAUD,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAc7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;AAED,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,EAC/C,UAAU,EAAE,cAAc,GACzB,OAAO,CAAC,kBAAkB,CAAC,CA6B7B"}
|
|
@@ -19,9 +19,7 @@ function isSchemaHashesResponseBody(value) {
|
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
21
|
const candidate = value;
|
|
22
|
-
|
|
23
|
-
(Array.isArray(candidate.hashes) && candidate.hashes.every((hash) => typeof hash === "string"));
|
|
24
|
-
const hasValidSchemas = candidate.schemas === undefined ||
|
|
22
|
+
return (candidate.schemas === undefined ||
|
|
25
23
|
(Array.isArray(candidate.schemas) &&
|
|
26
24
|
candidate.schemas.every((schema) => {
|
|
27
25
|
if (typeof schema !== "object" || schema === null) {
|
|
@@ -32,8 +30,7 @@ function isSchemaHashesResponseBody(value) {
|
|
|
32
30
|
(entry.publishedAt === undefined ||
|
|
33
31
|
entry.publishedAt === null ||
|
|
34
32
|
(typeof entry.publishedAt === "number" && Number.isFinite(entry.publishedAt))));
|
|
35
|
-
}));
|
|
36
|
-
return hasValidHashes && hasValidSchemas;
|
|
33
|
+
})));
|
|
37
34
|
}
|
|
38
35
|
export async function fetchSchemaHashes(serverUrl, options) {
|
|
39
36
|
const rawSchemaHashesResponse = await fetchAdminJson(appScopedUrl(serverUrl, options.appId, "schemas"), options.adminSecret, "Schema hashes",
|
|
@@ -50,7 +47,7 @@ export async function fetchSchemaHashes(serverUrl, options) {
|
|
|
50
47
|
publishedAt: publishedAtEpochMilliseconds(schema.publishedAt),
|
|
51
48
|
})) ?? [];
|
|
52
49
|
return {
|
|
53
|
-
hashes:
|
|
50
|
+
hashes: schemas.map((schema) => schema.hash),
|
|
54
51
|
schemas,
|
|
55
52
|
};
|
|
56
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogue-api.js","source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AAC;YACP,oCAAoC;QACtC,CAAC;QACD,MAAM,IAAI,eAAe,CACvB,kBAAkB,IAAI,CAAC,KAAK,IAAI,GAAG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EACxG,QAAQ,CAAC,MAAM,EACf,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,OAAO,CACb,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAuB,CAAC;AACvD,CAAC","sourcesContent":["import { fetchFor } from \"../runtime/in-process-transport.js\";\nimport { runtimeSchemaJsonReplacer } from \"../drivers/schema-wire.js\";\nimport type {\n ColumnType,\n TablePolicies,\n Value as WasmValue,\n WasmSchema,\n} from \"../drivers/types.js\";\nimport type { CompiledPermissionsMap } from \"../schema-permissions.js\";\nimport { appScopedUrl, fetchAdminJson } from \"../runtime/url.js\";\n\nexport interface FetchStoredWasmSchemaOptions {\n appId: string;\n adminSecret: string;\n schemaHash: string;\n}\n\nfunction publishedAtEpochMilliseconds(publishedAt: number | null | undefined): number | null {\n if (typeof publishedAt !== \"number\" || !Number.isFinite(publishedAt)) {\n return null;\n }\n\n return publishedAt;\n}\n\nexport async function fetchStoredWasmSchema(\n serverUrl: string,\n options: FetchStoredWasmSchemaOptions,\n): Promise<{ schema: WasmSchema; publishedAt: number | null }> {\n const body = (await fetchAdminJson(\n appScopedUrl(serverUrl, options.appId, `schema/${encodeURIComponent(options.schemaHash)}`),\n options.adminSecret,\n \"Schema\",\n )) as {\n schema: { tables: WasmSchema };\n publishedAt?: number | null;\n };\n\n return {\n schema: body.schema.tables,\n publishedAt: publishedAtEpochMilliseconds(body.publishedAt),\n };\n}\n\nexport interface FetchStoredSchemasOptions {\n appId: string;\n adminSecret: string;\n}\n\nexport interface StoredSchemaHash {\n hash: string;\n publishedAt: number | null;\n}\n\ninterface SchemaHashesResponseBody {\n hashes?: string[];\n schemas?: Array<{\n hash: string;\n publishedAt?: number | null;\n }>;\n}\n\nfunction isSchemaHashesResponseBody(value: unknown): value is SchemaHashesResponseBody {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const candidate = value as {\n hashes?: unknown;\n schemas?: unknown;\n };\n\n const hasValidHashes =\n candidate.hashes === undefined ||\n (Array.isArray(candidate.hashes) && candidate.hashes.every((hash) => typeof hash === \"string\"));\n const hasValidSchemas =\n candidate.schemas === undefined ||\n (Array.isArray(candidate.schemas) &&\n candidate.schemas.every((schema) => {\n if (typeof schema !== \"object\" || schema === null) {\n return false;\n }\n const entry = schema as { hash?: unknown; publishedAt?: unknown };\n return (\n typeof entry.hash === \"string\" &&\n (entry.publishedAt === undefined ||\n entry.publishedAt === null ||\n (typeof entry.publishedAt === \"number\" && Number.isFinite(entry.publishedAt)))\n );\n }));\n\n return hasValidHashes && hasValidSchemas;\n}\n\nexport async function fetchSchemaHashes(\n serverUrl: string,\n options: FetchStoredSchemasOptions,\n): Promise<{ hashes: string[]; schemas: StoredSchemaHash[] }> {\n const rawSchemaHashesResponse = await fetchAdminJson(\n appScopedUrl(serverUrl, options.appId, \"schemas\"),\n options.adminSecret,\n \"Schema hashes\",\n // A 404 also deliberately hides invalid/mismatched app IDs. It is not a\n // transient-readiness signal, so leave the retry decision with the caller.\n (status) =>\n status === 404\n ? \" Check the server URL and app ID. If this Cloud app was just created, wait for its regional status to become healthy and synced, then retry deployment. A 404 alone does not confirm startup is still in progress.\"\n : \"\",\n );\n const schemaHashesResponse = isSchemaHashesResponseBody(rawSchemaHashesResponse)\n ? rawSchemaHashesResponse\n : {};\n const schemas =\n schemaHashesResponse.schemas?.map((schema) => ({\n hash: schema.hash,\n publishedAt: publishedAtEpochMilliseconds(schema.publishedAt),\n })) ?? [];\n\n return {\n hashes: schemaHashesResponse.hashes ?? schemas.map((schema) => schema.hash),\n schemas,\n };\n}\n\nexport interface FetchPublishedBundlesOptions {\n appId: string;\n adminSecret: string;\n}\n\n/** A permissions bundle the core has published: what sessions pin to. */\nexport interface PublishedBundle {\n bundle: string;\n schemaHash: string;\n publishedAt: number;\n permissions: Record<string, TablePolicies>;\n}\n\n/** Every bundle the core has published, oldest first. */\nexport async function fetchPublishedBundles(\n serverUrl: string,\n options: FetchPublishedBundlesOptions,\n): Promise<PublishedBundle[]> {\n const body = (await fetchAdminJson(\n appScopedUrl(serverUrl, options.appId, \"admin/bundles\"),\n options.adminSecret,\n \"Bundles\",\n )) as { bundles?: PublishedBundle[] };\n return body.bundles ?? [];\n}\n\nexport type PublishedMigrationValue =\n | { type: \"Integer\"; value: number }\n | { type: \"BigInt\"; value: bigint | string | number }\n | { type: \"Double\"; value: number }\n | { type: \"Boolean\"; value: boolean }\n | { type: \"Text\"; value: string }\n | { type: \"Timestamp\"; value: number }\n | { type: \"Uuid\"; value: string }\n | { type: \"Bytea\"; value: number[] }\n | { type: \"Array\"; value: PublishedMigrationValue[] }\n | { type: \"Row\"; value: { id?: string; values: PublishedMigrationValue[] } }\n | { type: \"Null\" };\n\nexport type PublishedMigrationOp =\n | {\n type: \"introduce\";\n column: string;\n column_type: ColumnType;\n value: PublishedMigrationValue;\n }\n | {\n type: \"drop\";\n column: string;\n column_type: ColumnType;\n value: PublishedMigrationValue;\n }\n | {\n type: \"rename\";\n column: string;\n value: string;\n };\n\nexport interface PublishedTableLens {\n table: string;\n added?: boolean;\n removed?: boolean;\n renamedFrom?: string;\n operations: PublishedMigrationOp[];\n}\n\nexport function encodePublishedMigrationValue(value: WasmValue): PublishedMigrationValue {\n switch (value.type) {\n case \"BigInt\":\n return {\n type: \"BigInt\",\n value: value.value.toString(),\n };\n case \"Bytea\":\n return {\n type: \"Bytea\",\n value: Array.from(value.value),\n };\n case \"Array\":\n return {\n type: \"Array\",\n value: value.value.map(encodePublishedMigrationValue),\n };\n case \"Row\":\n return {\n type: \"Row\",\n value: {\n id: value.value.id,\n values: value.value.values.map(encodePublishedMigrationValue),\n },\n };\n default:\n return value;\n }\n}\n\nexport interface DeploymentResponse {\n changed: boolean;\n published: {\n schemas: string[];\n migrations: Array<{ fromHash: string; toHash: string }>;\n };\n /** The published bundle's id: what a backend pins its sessions to. */\n bundle: string;\n}\n\nexport class DeploymentError extends Error {\n readonly name = \"DeploymentError\";\n constructor(\n message: string,\n readonly status: number,\n readonly code?: string,\n readonly details?: { target?: string; active?: string; roots?: string[]; tables?: string[] },\n ) {\n super(message);\n }\n}\n\n/**\n * The body of a deployment, as the server's `POST admin/bundles` takes it and\n * as Jazz's Rust loader builds it from an app's files (jazz-napi\n * `loadBackendApp(...).deployment`).\n */\nexport interface DeploymentBody {\n targetSchemaHash: string;\n schemas: Array<{ hash: string; schema: unknown }>;\n migrations: Array<{ fromHash: string; toHash: string; forward: unknown[] }>;\n permissions: unknown;\n allowDroppingHistory?: boolean;\n}\n\nexport async function publishDeployment(\n serverUrl: string,\n options: { appId: string; adminSecret: string },\n deployment: DeploymentBody,\n): Promise<DeploymentResponse> {\n // A core that predates bundles has no `/bundles` route, so it refuses the\n // publish instead of activating it.\n const deployUrl = appScopedUrl(serverUrl, options.appId, \"admin/bundles\");\n const response = await fetchFor(deployUrl)(deployUrl, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-Jazz-Admin-Secret\": options.adminSecret,\n },\n body: JSON.stringify(deployment, runtimeSchemaJsonReplacer),\n });\n if (!response.ok) {\n const text = await response.text();\n let body: { error?: string; code?: string; details?: DeploymentError[\"details\"] } = {};\n try {\n const parsed = JSON.parse(text);\n if (parsed && typeof parsed === \"object\") body = parsed;\n } catch {\n /* Preserve non-JSON HTTP errors. */\n }\n throw new DeploymentError(\n `Deploy failed: ${body.error ?? `${response.status} ${response.statusText}${text ? ` - ${text}` : \"\"}`}`,\n response.status,\n body.code,\n body.details,\n );\n }\n return (await response.json()) as DeploymentResponse;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"catalogue-api.js","sourceRoot":"","sources":["../../src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,CAAC;IACD,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAuB,CAAC;AACvD,CAAC","sourcesContent":["import { fetchFor } from \"../runtime/in-process-transport.js\";\nimport { runtimeSchemaJsonReplacer } from \"../drivers/schema-wire.js\";\nimport type {\n ColumnType,\n TablePolicies,\n Value as WasmValue,\n WasmSchema,\n} from \"../drivers/types.js\";\nimport type { CompiledPermissionsMap } from \"../schema-permissions.js\";\nimport { appScopedUrl, fetchAdminJson } from \"../runtime/url.js\";\n\nexport interface FetchStoredWasmSchemaOptions {\n appId: string;\n adminSecret: string;\n schemaHash: string;\n}\n\nfunction publishedAtEpochMilliseconds(publishedAt: number | null | undefined): number | null {\n if (typeof publishedAt !== \"number\" || !Number.isFinite(publishedAt)) {\n return null;\n }\n\n return publishedAt;\n}\n\nexport async function fetchStoredWasmSchema(\n serverUrl: string,\n options: FetchStoredWasmSchemaOptions,\n): Promise<{ schema: WasmSchema; publishedAt: number | null }> {\n const body = (await fetchAdminJson(\n appScopedUrl(serverUrl, options.appId, `schema/${encodeURIComponent(options.schemaHash)}`),\n options.adminSecret,\n \"Schema\",\n )) as {\n schema: { tables: WasmSchema };\n publishedAt?: number | null;\n };\n\n return {\n schema: body.schema.tables,\n publishedAt: publishedAtEpochMilliseconds(body.publishedAt),\n };\n}\n\nexport interface FetchStoredSchemasOptions {\n appId: string;\n adminSecret: string;\n}\n\nexport interface StoredSchemaHash {\n hash: string;\n publishedAt: number | null;\n}\n\ninterface SchemaHashesResponseBody {\n schemas?: Array<{\n hash: string;\n publishedAt?: number | null;\n }>;\n}\n\nfunction isSchemaHashesResponseBody(value: unknown): value is SchemaHashesResponseBody {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const candidate = value as {\n schemas?: unknown;\n };\n\n return (\n candidate.schemas === undefined ||\n (Array.isArray(candidate.schemas) &&\n candidate.schemas.every((schema) => {\n if (typeof schema !== \"object\" || schema === null) {\n return false;\n }\n const entry = schema as { hash?: unknown; publishedAt?: unknown };\n return (\n typeof entry.hash === \"string\" &&\n (entry.publishedAt === undefined ||\n entry.publishedAt === null ||\n (typeof entry.publishedAt === \"number\" && Number.isFinite(entry.publishedAt)))\n );\n }))\n );\n}\n\nexport async function fetchSchemaHashes(\n serverUrl: string,\n options: FetchStoredSchemasOptions,\n): Promise<{ hashes: string[]; schemas: StoredSchemaHash[] }> {\n const rawSchemaHashesResponse = await fetchAdminJson(\n appScopedUrl(serverUrl, options.appId, \"schemas\"),\n options.adminSecret,\n \"Schema hashes\",\n // A 404 also deliberately hides invalid/mismatched app IDs. It is not a\n // transient-readiness signal, so leave the retry decision with the caller.\n (status) =>\n status === 404\n ? \" Check the server URL and app ID. If this Cloud app was just created, wait for its regional status to become healthy and synced, then retry deployment. A 404 alone does not confirm startup is still in progress.\"\n : \"\",\n );\n const schemaHashesResponse = isSchemaHashesResponseBody(rawSchemaHashesResponse)\n ? rawSchemaHashesResponse\n : {};\n const schemas =\n schemaHashesResponse.schemas?.map((schema) => ({\n hash: schema.hash,\n publishedAt: publishedAtEpochMilliseconds(schema.publishedAt),\n })) ?? [];\n\n return {\n hashes: schemas.map((schema) => schema.hash),\n schemas,\n };\n}\n\nexport interface FetchPublishedBundlesOptions {\n appId: string;\n adminSecret: string;\n}\n\n/** A permissions bundle the core has published: what sessions pin to. */\nexport interface PublishedBundle {\n bundle: string;\n schemaHash: string;\n publishedAt: number;\n permissions: Record<string, TablePolicies>;\n}\n\n/** Every bundle the core has published, oldest first. */\nexport async function fetchPublishedBundles(\n serverUrl: string,\n options: FetchPublishedBundlesOptions,\n): Promise<PublishedBundle[]> {\n const body = (await fetchAdminJson(\n appScopedUrl(serverUrl, options.appId, \"admin/bundles\"),\n options.adminSecret,\n \"Bundles\",\n )) as { bundles?: PublishedBundle[] };\n return body.bundles ?? [];\n}\n\nexport type PublishedMigrationValue =\n | { type: \"Integer\"; value: number }\n | { type: \"BigInt\"; value: bigint | string | number }\n | { type: \"Double\"; value: number }\n | { type: \"Boolean\"; value: boolean }\n | { type: \"Text\"; value: string }\n | { type: \"Timestamp\"; value: number }\n | { type: \"Uuid\"; value: string }\n | { type: \"Bytea\"; value: number[] }\n | { type: \"Array\"; value: PublishedMigrationValue[] }\n | { type: \"Row\"; value: { id?: string; values: PublishedMigrationValue[] } }\n | { type: \"Null\" };\n\nexport type PublishedMigrationOp =\n | {\n type: \"introduce\";\n column: string;\n column_type: ColumnType;\n value: PublishedMigrationValue;\n }\n | {\n type: \"drop\";\n column: string;\n column_type: ColumnType;\n value: PublishedMigrationValue;\n }\n | {\n type: \"rename\";\n column: string;\n value: string;\n };\n\nexport interface PublishedTableLens {\n table: string;\n added?: boolean;\n removed?: boolean;\n renamedFrom?: string;\n operations: PublishedMigrationOp[];\n}\n\nexport function encodePublishedMigrationValue(value: WasmValue): PublishedMigrationValue {\n switch (value.type) {\n case \"BigInt\":\n return {\n type: \"BigInt\",\n value: value.value.toString(),\n };\n case \"Bytea\":\n return {\n type: \"Bytea\",\n value: Array.from(value.value),\n };\n case \"Array\":\n return {\n type: \"Array\",\n value: value.value.map(encodePublishedMigrationValue),\n };\n case \"Row\":\n return {\n type: \"Row\",\n value: {\n id: value.value.id,\n values: value.value.values.map(encodePublishedMigrationValue),\n },\n };\n default:\n return value;\n }\n}\n\nexport interface DeploymentResponse {\n changed: boolean;\n published: {\n schemas: string[];\n migrations: Array<{ fromHash: string; toHash: string }>;\n };\n /** The published bundle's id: what a backend pins its sessions to. */\n bundle: string;\n}\n\nexport class DeploymentError extends Error {\n readonly name = \"DeploymentError\";\n constructor(\n message: string,\n readonly status: number,\n readonly code?: string,\n readonly details?: { target?: string; active?: string; roots?: string[]; tables?: string[] },\n ) {\n super(message);\n }\n}\n\n/**\n * The body of a deployment, as the server's `POST admin/bundles` takes it and\n * as Jazz's Rust loader builds it from an app's files (jazz-napi\n * `loadBackendApp(...).deployment`).\n */\nexport interface DeploymentBody {\n targetSchemaHash: string;\n schemas: Array<{ hash: string; schema: unknown }>;\n migrations: Array<{ fromHash: string; toHash: string; forward: unknown[] }>;\n permissions: unknown;\n allowDroppingHistory?: boolean;\n}\n\nexport async function publishDeployment(\n serverUrl: string,\n options: { appId: string; adminSecret: string },\n deployment: DeploymentBody,\n): Promise<DeploymentResponse> {\n // A core that predates bundles has no `/bundles` route, so it refuses the\n // publish instead of activating it.\n const deployUrl = appScopedUrl(serverUrl, options.appId, \"admin/bundles\");\n const response = await fetchFor(deployUrl)(deployUrl, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-Jazz-Admin-Secret\": options.adminSecret,\n },\n body: JSON.stringify(deployment, runtimeSchemaJsonReplacer),\n });\n if (!response.ok) {\n const text = await response.text();\n let body: { error?: string; code?: string; details?: DeploymentError[\"details\"] } = {};\n try {\n const parsed = JSON.parse(text);\n if (parsed && typeof parsed === \"object\") body = parsed;\n } catch {\n /* Preserve non-JSON HTTP errors. */\n }\n throw new DeploymentError(\n `Deploy failed: ${body.error ?? `${response.status} ${response.statusText}${text ? ` - ${text}` : \"\"}`}`,\n response.status,\n body.code,\n body.details,\n );\n }\n return (await response.json()) as DeploymentResponse;\n}\n"]}
|