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
package/dist/upgrade/fresh.js
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Step 1 of `jazz-tools upgrade`: the jazz-tools the app was written for
|
|
3
|
-
* (alpha.65, with the callback permissions) must confirm that jazz.app.json
|
|
4
|
-
* and jazz.permissions.json are what schema.ts, permissions.ts and
|
|
5
|
-
* migrations/ make. upgrade prints the permissions from that file, so a
|
|
6
|
-
* stale one would lose whatever it doesn't say.
|
|
7
|
-
*/
|
|
8
|
-
import { spawnSync } from "node:child_process";
|
|
9
|
-
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
10
|
-
import { appOutputs, snapshot } from "./snapshot.js";
|
|
11
|
-
import { createRequire } from "node:module";
|
|
12
|
-
import { dirname, join } from "node:path";
|
|
13
|
-
import { UpgradeRefusal } from "./errors.js";
|
|
14
|
-
import { APP_FILE, PERMISSIONS_FILE, packageVersion, SCHEMA_ROOTS, runningPackageRoot, } from "./project.js";
|
|
15
|
-
/** The last release with `defineApp` and the callback permissions. */
|
|
16
|
-
export const LAST_DSL_ALPHA = 65;
|
|
17
|
-
const LAST_DSL_VERSION = `2.0.0-alpha.${LAST_DSL_ALPHA}`;
|
|
18
|
-
/** The DSL-era alpha number of a jazz-tools version, or null when it has no DSL. */
|
|
19
|
-
export function dslAlpha(version) {
|
|
20
|
-
const match = /^2\.0\.0-alpha\.(\d+)/.exec(version);
|
|
21
|
-
if (!match)
|
|
22
|
-
return null;
|
|
23
|
-
const alpha = Number(match[1]);
|
|
24
|
-
return alpha <= LAST_DSL_ALPHA ? alpha : null;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* The project's installed jazz-tools, which must still have the DSL: the old
|
|
28
|
-
* validate bundles schema.ts against it, and the checker reads its types.
|
|
29
|
-
*/
|
|
30
|
-
export function findLegacyJazzTools(project) {
|
|
31
|
-
const require = createRequire(join(project.schemaDir, "package.json"));
|
|
32
|
-
let manifest;
|
|
33
|
-
try {
|
|
34
|
-
manifest = require.resolve("jazz-tools/package.json");
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
throw new UpgradeRefusal(`jazz-tools isn't installed in ${project.root}: install the jazz-tools the app was written for (≤ ${LAST_DSL_VERSION}) and run upgrade again`);
|
|
38
|
-
}
|
|
39
|
-
const dir = dirname(manifest);
|
|
40
|
-
const version = packageVersion(dir);
|
|
41
|
-
const same = realpathSync(dir) === realpathSync(runningPackageRoot());
|
|
42
|
-
if (dslAlpha(version) === null || same) {
|
|
43
|
-
throw new UpgradeRefusal(`upgrade reads schema.ts with the schema DSL of the app's own jazz-tools (≤ ${LAST_DSL_VERSION}), but the app's jazz-tools ` +
|
|
44
|
-
`is ${same ? "this jazz-tools itself" : version}. Install jazz-tools@${LAST_DSL_VERSION} in the app, ` +
|
|
45
|
-
`run \`npx jazz-tools@2.0.0-alpha.${LAST_DSL_ALPHA + 1} upgrade\` there, then update jazz-tools.`);
|
|
46
|
-
}
|
|
47
|
-
return { dir, version };
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* The environment for the app's own jazz-tools: everything but what points
|
|
51
|
-
* Jazz at other native or WASM builds. jazz-napi and jazz-tools honour
|
|
52
|
-
* `JAZZ_CORRECTNESS_*` (the monorepo's sealed test artifacts) and napi-rs
|
|
53
|
-
* `NAPI_RS_*` overrides; inherited, they would run alpha.65's validate on
|
|
54
|
-
* this release's engine, which writes different files (no `slices`).
|
|
55
|
-
*/
|
|
56
|
-
export function legacyEnvironment(env) {
|
|
57
|
-
const out = {};
|
|
58
|
-
for (const [key, value] of Object.entries(env)) {
|
|
59
|
-
if (key.startsWith("JAZZ_CORRECTNESS_") ||
|
|
60
|
-
key === "NAPI_RS_NATIVE_LIBRARY_PATH" ||
|
|
61
|
-
key === "NAPI_RS_FORCE_WASI")
|
|
62
|
-
continue;
|
|
63
|
-
out[key] = value;
|
|
64
|
-
}
|
|
65
|
-
return out;
|
|
66
|
-
}
|
|
67
|
-
/** What the old validate takes as `--schema-dir`: the root it searches (., src, src/lib), or schema.ts's own directory. */
|
|
68
|
-
function validateDir(project) {
|
|
69
|
-
return SCHEMA_ROOTS.some((r) => join(project.root, r) === project.schemaDir)
|
|
70
|
-
? project.root
|
|
71
|
-
: project.schemaDir;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Freshness for a jazz.permissions.json with hand-written `defs`, which the
|
|
75
|
-
* old `validate` never writes (it inlines its helpers), so `--check` would
|
|
76
|
-
* call it stale: run the old `validate` on the project, put every file back,
|
|
77
|
-
* and compare what it wrote with the committed files, `defs` expanded, by
|
|
78
|
-
* what a deployment would get (schema hashes and bundle id).
|
|
79
|
-
*/
|
|
80
|
-
export async function checkLegacyFilesWithDefs(project, legacy, expanded, identity) {
|
|
81
|
-
// Only what `validate` writes: the two files, the bindings, migrations/.
|
|
82
|
-
const undo = snapshot(appOutputs(project.schemaDir).filter((p) => !/[\\/](schema|permissions)\.ts$/.test(p)));
|
|
83
|
-
const committedApp = readFileSync(project.appFile, "utf8");
|
|
84
|
-
const bin = join(legacy.dir, "bin", "jazz-tools.js");
|
|
85
|
-
let result;
|
|
86
|
-
let written;
|
|
87
|
-
try {
|
|
88
|
-
result = spawnSync(process.execPath, [bin, "validate", "--schema-dir", validateDir(project)], {
|
|
89
|
-
cwd: project.root,
|
|
90
|
-
encoding: "utf8",
|
|
91
|
-
env: { ...legacyEnvironment(process.env), NO_COLOR: "1" },
|
|
92
|
-
});
|
|
93
|
-
written = {
|
|
94
|
-
app: readFileSync(project.appFile, "utf8"),
|
|
95
|
-
permissions: readFileSync(project.permissionsJsonFile, "utf8"),
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
finally {
|
|
99
|
-
undo.restore();
|
|
100
|
-
}
|
|
101
|
-
const output = `${result.stdout ?? ""}${result.stderr ?? ""}`.trim();
|
|
102
|
-
if (result.error)
|
|
103
|
-
throw new UpgradeRefusal(`couldn't run ${bin}: ${result.error.message}`);
|
|
104
|
-
if (result.status !== 0) {
|
|
105
|
-
throw new UpgradeRefusal(`jazz-tools ${legacy.version} \`validate\` refused the app:\n${indent(output)}\nFix what it says, then upgrade again.`);
|
|
106
|
-
}
|
|
107
|
-
const committed = await identity(committedApp, expanded);
|
|
108
|
-
if (JSON.stringify(await identity(written.app, written.permissions)) !== JSON.stringify(committed)) {
|
|
109
|
-
throw new UpgradeRefusal(`jazz.app.json or jazz.permissions.json (its \`defs\` expanded) isn't what schema.ts and permissions.ts make with jazz-tools ${legacy.version}, so upgrade would convert stale files. ` +
|
|
110
|
-
`Run \`npx jazz-tools validate\` with jazz-tools ${legacy.version}, commit what it writes, then upgrade again.`);
|
|
111
|
-
}
|
|
112
|
-
if (/changed since the latest snapshot/.test(output)) {
|
|
113
|
-
throw new UpgradeRefusal(`schema.ts changed since its latest snapshot in migrations/, so jazz.app.json's history lacks the version a store may hold. ` +
|
|
114
|
-
`Run \`npx jazz-tools migrations create --name <name>\` with jazz-tools ${legacy.version} first, then upgrade again.`);
|
|
115
|
-
}
|
|
116
|
-
return [];
|
|
117
|
-
}
|
|
118
|
-
/** Run the old `validate --check`, refusing what it refuses. */
|
|
119
|
-
export function checkLegacyFiles(project, legacy) {
|
|
120
|
-
for (const file of [project.appFile, project.permissionsJsonFile]) {
|
|
121
|
-
if (!existsSync(file)) {
|
|
122
|
-
throw new UpgradeRefusal(`${file.slice(project.root.length + 1)} is missing: run \`npx jazz-tools validate\` with jazz-tools ${legacy.version} and commit ${APP_FILE} and ${PERMISSIONS_FILE} first` +
|
|
123
|
-
(project.permissionsFile
|
|
124
|
-
? ""
|
|
125
|
-
: " (that validate needs a permissions.ts, even for an app without a backend; a minimal one will do)"));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
const bin = join(legacy.dir, "bin", "jazz-tools.js");
|
|
129
|
-
const result = spawnSync(process.execPath, [bin, "validate", "--check", "--schema-dir", validateDir(project)], {
|
|
130
|
-
cwd: project.root,
|
|
131
|
-
encoding: "utf8",
|
|
132
|
-
env: { ...legacyEnvironment(process.env), NO_COLOR: "1" },
|
|
133
|
-
});
|
|
134
|
-
const output = `${result.stdout ?? ""}${result.stderr ?? ""}`.trim();
|
|
135
|
-
if (result.error)
|
|
136
|
-
throw new UpgradeRefusal(`couldn't run ${bin}: ${result.error.message}`);
|
|
137
|
-
if (result.status !== 0) {
|
|
138
|
-
throw new UpgradeRefusal(`jazz-tools ${legacy.version} \`validate --check\` refused the app files, so upgrade would convert stale ones:\n${indent(output)}\n` +
|
|
139
|
-
`Run \`npx jazz-tools validate\` with jazz-tools ${legacy.version}, commit what it writes, then upgrade again.`);
|
|
140
|
-
}
|
|
141
|
-
if (/changed since the latest snapshot/.test(output)) {
|
|
142
|
-
throw new UpgradeRefusal(`schema.ts changed since its latest snapshot in migrations/, so jazz.app.json's history lacks the version a store may hold. ` +
|
|
143
|
-
`Run \`npx jazz-tools migrations create --name <name>\` with jazz-tools ${legacy.version} first, then upgrade again.`);
|
|
144
|
-
}
|
|
145
|
-
// Its warnings are about permissions.ts's DSL, which upgrade deletes.
|
|
146
|
-
return [];
|
|
147
|
-
}
|
|
148
|
-
function indent(text) {
|
|
149
|
-
return text
|
|
150
|
-
.split("\n")
|
|
151
|
-
.map((line) => ` ${line}`)
|
|
152
|
-
.join("\n");
|
|
153
|
-
}
|
|
154
|
-
//# sourceMappingURL=fresh.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fresh.js","sourceRoot":"","sources":["../../src/upgrade/fresh.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,kBAAkB,GAEnB,MAAM,cAAc,CAAC;AAEtB,sEAAsE;AACtE,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AACjC,MAAM,gBAAgB,GAAG,eAAe,cAAc,EAAE,CAAC;AAQzD,oFAAoF;AACpF,MAAM,UAAU,QAAQ,CAAC,OAAe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,CAAC;IACF,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;IACrE,IAAI,MAAM,CAAC,KAAK;QAAE,MAAM,IAAI,cAAc,CAAC,gBAAgB,GAAG,KAAK,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC3F,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,cAAc,CACtB,cAAc,MAAM,CAAC,OAAO,sFAAsF,MAAM,CAAC,MAAM,CAAC,IAAI;YAClI,mDAAmD,MAAM,CAAC,OAAO,8CAA8C,CAClH,CAAC;IACJ,CAAC;IACD,IAAI,mCAAmC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,cAAc,CACtB,6HAA6H;YAC3H,0EAA0E,MAAM,CAAC,OAAO,6BAA6B,CACxH,CAAC;IACJ,CAAC;IACD,sEAAsE;IACtE,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,IAAI;SACR,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC;SAC1B,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC","sourcesContent":["/**\n * Step 1 of `jazz-tools upgrade`: the jazz-tools the app was written for\n * (alpha.65, with the callback permissions) must confirm that jazz.app.json\n * and jazz.permissions.json are what schema.ts, permissions.ts and\n * migrations/ make. upgrade prints the permissions from that file, so a\n * stale one would lose whatever it doesn't say.\n */\nimport { spawnSync } from \"node:child_process\";\nimport { existsSync, readFileSync, realpathSync } from \"node:fs\";\nimport { appOutputs, snapshot } from \"./snapshot.js\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\nimport { UpgradeRefusal } from \"./errors.js\";\nimport {\n APP_FILE,\n PERMISSIONS_FILE,\n packageVersion,\n SCHEMA_ROOTS,\n runningPackageRoot,\n type Project,\n} from \"./project.js\";\n\n/** The last release with `defineApp` and the callback permissions. */\nexport const LAST_DSL_ALPHA = 65;\nconst LAST_DSL_VERSION = `2.0.0-alpha.${LAST_DSL_ALPHA}`;\n\nexport interface LegacyJazzTools {\n /** The package directory. */\n dir: string;\n version: string;\n}\n\n/** The DSL-era alpha number of a jazz-tools version, or null when it has no DSL. */\nexport function dslAlpha(version: string): number | null {\n const match = /^2\\.0\\.0-alpha\\.(\\d+)/.exec(version);\n if (!match) return null;\n const alpha = Number(match[1]);\n return alpha <= LAST_DSL_ALPHA ? alpha : null;\n}\n\n/**\n * The project's installed jazz-tools, which must still have the DSL: the old\n * validate bundles schema.ts against it, and the checker reads its types.\n */\nexport function findLegacyJazzTools(project: Project): LegacyJazzTools {\n const require = createRequire(join(project.schemaDir, \"package.json\"));\n let manifest: string;\n try {\n manifest = require.resolve(\"jazz-tools/package.json\");\n } catch {\n throw new UpgradeRefusal(\n `jazz-tools isn't installed in ${project.root}: install the jazz-tools the app was written for (≤ ${LAST_DSL_VERSION}) and run upgrade again`,\n );\n }\n const dir = dirname(manifest);\n const version = packageVersion(dir);\n const same = realpathSync(dir) === realpathSync(runningPackageRoot());\n if (dslAlpha(version) === null || same) {\n throw new UpgradeRefusal(\n `upgrade reads schema.ts with the schema DSL of the app's own jazz-tools (≤ ${LAST_DSL_VERSION}), but the app's jazz-tools ` +\n `is ${same ? \"this jazz-tools itself\" : version}. Install jazz-tools@${LAST_DSL_VERSION} in the app, ` +\n `run \\`npx jazz-tools@2.0.0-alpha.${LAST_DSL_ALPHA + 1} upgrade\\` there, then update jazz-tools.`,\n );\n }\n return { dir, version };\n}\n\n/**\n * The environment for the app's own jazz-tools: everything but what points\n * Jazz at other native or WASM builds. jazz-napi and jazz-tools honour\n * `JAZZ_CORRECTNESS_*` (the monorepo's sealed test artifacts) and napi-rs\n * `NAPI_RS_*` overrides; inherited, they would run alpha.65's validate on\n * this release's engine, which writes different files (no `slices`).\n */\nexport function legacyEnvironment(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {\n const out: Record<string, string | undefined> = {};\n for (const [key, value] of Object.entries(env)) {\n if (\n key.startsWith(\"JAZZ_CORRECTNESS_\") ||\n key === \"NAPI_RS_NATIVE_LIBRARY_PATH\" ||\n key === \"NAPI_RS_FORCE_WASI\"\n )\n continue;\n out[key] = value;\n }\n return out as NodeJS.ProcessEnv;\n}\n\n/** What the old validate takes as `--schema-dir`: the root it searches (., src, src/lib), or schema.ts's own directory. */\nfunction validateDir(project: Project): string {\n return SCHEMA_ROOTS.some((r) => join(project.root, r) === project.schemaDir)\n ? project.root\n : project.schemaDir;\n}\n\n/** The bundle id and schema hashes of an app's two files. */\nexport type Identity = (app: string, permissions: string) => Promise<unknown>;\n\n/**\n * Freshness for a jazz.permissions.json with hand-written `defs`, which the\n * old `validate` never writes (it inlines its helpers), so `--check` would\n * call it stale: run the old `validate` on the project, put every file back,\n * and compare what it wrote with the committed files, `defs` expanded, by\n * what a deployment would get (schema hashes and bundle id).\n */\nexport async function checkLegacyFilesWithDefs(\n project: Project,\n legacy: LegacyJazzTools,\n expanded: string,\n identity: Identity,\n): Promise<string[]> {\n // Only what `validate` writes: the two files, the bindings, migrations/.\n const undo = snapshot(\n appOutputs(project.schemaDir).filter((p) => !/[\\\\/](schema|permissions)\\.ts$/.test(p)),\n );\n const committedApp = readFileSync(project.appFile, \"utf8\");\n const bin = join(legacy.dir, \"bin\", \"jazz-tools.js\");\n let result;\n let written: { app: string; permissions: string };\n try {\n result = spawnSync(process.execPath, [bin, \"validate\", \"--schema-dir\", validateDir(project)], {\n cwd: project.root,\n encoding: \"utf8\",\n env: { ...legacyEnvironment(process.env), NO_COLOR: \"1\" },\n });\n written = {\n app: readFileSync(project.appFile, \"utf8\"),\n permissions: readFileSync(project.permissionsJsonFile, \"utf8\"),\n };\n } finally {\n undo.restore();\n }\n const output = `${result.stdout ?? \"\"}${result.stderr ?? \"\"}`.trim();\n if (result.error) throw new UpgradeRefusal(`couldn't run ${bin}: ${result.error.message}`);\n if (result.status !== 0) {\n throw new UpgradeRefusal(\n `jazz-tools ${legacy.version} \\`validate\\` refused the app:\\n${indent(output)}\\nFix what it says, then upgrade again.`,\n );\n }\n const committed = await identity(committedApp, expanded);\n if (\n JSON.stringify(await identity(written.app, written.permissions)) !== JSON.stringify(committed)\n ) {\n throw new UpgradeRefusal(\n `jazz.app.json or jazz.permissions.json (its \\`defs\\` expanded) isn't what schema.ts and permissions.ts make with jazz-tools ${legacy.version}, so upgrade would convert stale files. ` +\n `Run \\`npx jazz-tools validate\\` with jazz-tools ${legacy.version}, commit what it writes, then upgrade again.`,\n );\n }\n if (/changed since the latest snapshot/.test(output)) {\n throw new UpgradeRefusal(\n `schema.ts changed since its latest snapshot in migrations/, so jazz.app.json's history lacks the version a store may hold. ` +\n `Run \\`npx jazz-tools migrations create --name <name>\\` with jazz-tools ${legacy.version} first, then upgrade again.`,\n );\n }\n return [];\n}\n\n/** Run the old `validate --check`, refusing what it refuses. */\nexport function checkLegacyFiles(project: Project, legacy: LegacyJazzTools): string[] {\n for (const file of [project.appFile, project.permissionsJsonFile]) {\n if (!existsSync(file)) {\n throw new UpgradeRefusal(\n `${file.slice(project.root.length + 1)} is missing: run \\`npx jazz-tools validate\\` with jazz-tools ${legacy.version} and commit ${APP_FILE} and ${PERMISSIONS_FILE} first` +\n (project.permissionsFile\n ? \"\"\n : \" (that validate needs a permissions.ts, even for an app without a backend; a minimal one will do)\"),\n );\n }\n }\n const bin = join(legacy.dir, \"bin\", \"jazz-tools.js\");\n const result = spawnSync(\n process.execPath,\n [bin, \"validate\", \"--check\", \"--schema-dir\", validateDir(project)],\n {\n cwd: project.root,\n encoding: \"utf8\",\n env: { ...legacyEnvironment(process.env), NO_COLOR: \"1\" },\n },\n );\n const output = `${result.stdout ?? \"\"}${result.stderr ?? \"\"}`.trim();\n if (result.error) throw new UpgradeRefusal(`couldn't run ${bin}: ${result.error.message}`);\n if (result.status !== 0) {\n throw new UpgradeRefusal(\n `jazz-tools ${legacy.version} \\`validate --check\\` refused the app files, so upgrade would convert stale ones:\\n${indent(output)}\\n` +\n `Run \\`npx jazz-tools validate\\` with jazz-tools ${legacy.version}, commit what it writes, then upgrade again.`,\n );\n }\n if (/changed since the latest snapshot/.test(output)) {\n throw new UpgradeRefusal(\n `schema.ts changed since its latest snapshot in migrations/, so jazz.app.json's history lacks the version a store may hold. ` +\n `Run \\`npx jazz-tools migrations create --name <name>\\` with jazz-tools ${legacy.version} first, then upgrade again.`,\n );\n }\n // Its warnings are about permissions.ts's DSL, which upgrade deletes.\n return [];\n}\n\nfunction indent(text: string): string {\n return text\n .split(\"\\n\")\n .map((line) => ` ${line}`)\n .join(\"\\n\");\n}\n"]}
|
package/dist/upgrade/index.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { extname } from "node:path";
|
|
2
|
-
import { isObject } from "./app-json.js";
|
|
3
|
-
import { notSupportedYet } from "./errors.js";
|
|
4
|
-
import { specifierLike } from "./edits.js";
|
|
5
|
-
export { UpgradeRefusal } from "./errors.js";
|
|
6
|
-
export interface UpgradeOptions {
|
|
7
|
-
/** The app's directory (default: cwd). */
|
|
8
|
-
dir?: string;
|
|
9
|
-
/** Where schema.ts is, when not in `dir`, `dir/src` or `dir/src/lib`. */
|
|
10
|
-
schemaDir?: string;
|
|
11
|
-
/** Plan and report, write nothing. */
|
|
12
|
-
dryRun?: boolean;
|
|
13
|
-
/** Skip the closing typecheck. */
|
|
14
|
-
skipTypecheck?: boolean;
|
|
15
|
-
/** Skip step 1 (tests whose fixtures have no installed alpha.65). */
|
|
16
|
-
skipFreshCheck?: boolean;
|
|
17
|
-
/** Step 6: write the JSON files and bindings from the new TS (default: this jazz-tools' `generate`). */
|
|
18
|
-
generate?: (schemaDir: string) => void | Promise<void>;
|
|
19
|
-
}
|
|
20
|
-
export interface UpgradeReport {
|
|
21
|
-
dir: string;
|
|
22
|
-
/** Files written, relative to `dir`. */
|
|
23
|
-
written: string[];
|
|
24
|
-
/** Files deleted, relative to `dir`. */
|
|
25
|
-
deleted: string[];
|
|
26
|
-
/** Every rewrite, as `file:line: what`. */
|
|
27
|
-
rewrites: string[];
|
|
28
|
-
/** Code upgrade left for the author, as `file:line: what`. */
|
|
29
|
-
manual: string[];
|
|
30
|
-
/** Decisions and guesses worth a look. */
|
|
31
|
-
notes: string[];
|
|
32
|
-
/** Typecheck errors after the conversion, as `file:line:col: message`. */
|
|
33
|
-
typeErrors: string[];
|
|
34
|
-
/** Typecheck errors the project had before the conversion too: reported, not counted. */
|
|
35
|
-
preexistingTypeErrors: string[];
|
|
36
|
-
/** Whether the typecheck ran. */
|
|
37
|
-
typechecked: boolean;
|
|
38
|
-
/** The schema hashes and bundle id, which upgrade keeps. */
|
|
39
|
-
identity?: ArtifactIdentity;
|
|
40
|
-
}
|
|
41
|
-
/** What a deployment of the app is: its bundle id and every version's schema hash. */
|
|
42
|
-
export interface ArtifactIdentity {
|
|
43
|
-
bundle: string;
|
|
44
|
-
current: string;
|
|
45
|
-
schemas: string[];
|
|
46
|
-
}
|
|
47
|
-
export declare function upgradeProject(options?: UpgradeOptions): Promise<UpgradeReport>;
|
|
48
|
-
/** The bundle id and schema hashes `load` computes for the two files. */
|
|
49
|
-
export declare function artifactIdentity(app: string, permissions: string): Promise<ArtifactIdentity>;
|
|
50
|
-
export declare function identityDifferences(before: ArtifactIdentity, after: ArtifactIdentity): string[];
|
|
51
|
-
/**
|
|
52
|
-
* Whether `dir` is a Rust app, as `jazz-tools generate` tells: a crate (a
|
|
53
|
-
* `Cargo.toml` with `[package]`) that depends on `jazz-app-support`, or one with
|
|
54
|
-
* committed `src/jazz_app.rs`. A workspace root or an unrelated crate isn't.
|
|
55
|
-
*/
|
|
56
|
-
export declare function isRustApp(dir: string): boolean;
|
|
57
|
-
export { notSupportedYet, isObject, specifierLike, extname };
|
|
58
|
-
/** A shell command with every jazz-tools CLI `validate` call renamed to `generate`. */
|
|
59
|
-
export declare function renameValidate(script: string): string;
|
|
60
|
-
/** The report as the CLI prints it. */
|
|
61
|
-
export declare function formatReport(report: UpgradeReport, dryRun?: boolean): string;
|
|
62
|
-
/** How many times each error (file, code, first message line) occurs. */
|
|
63
|
-
export declare function countTypeErrors(errors: readonly {
|
|
64
|
-
key: string;
|
|
65
|
-
}[]): Map<string, number>;
|
|
66
|
-
/**
|
|
67
|
-
* The closing typecheck's errors, split into the ones the conversion added
|
|
68
|
-
* and the ones the project had before (`before`, counted per key). Each error
|
|
69
|
-
* before excuses one identical error after, whatever line it moved to, so a
|
|
70
|
-
* second identical error the conversion adds to the same file still counts.
|
|
71
|
-
*/
|
|
72
|
-
export declare function splitTypeErrors(before: ReadonlyMap<string, number> | undefined, after: readonly {
|
|
73
|
-
key: string;
|
|
74
|
-
text: string;
|
|
75
|
-
}[]): {
|
|
76
|
-
added: string[];
|
|
77
|
-
preexisting: string[];
|
|
78
|
-
};
|
|
79
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/upgrade/index.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAW,OAAO,EAA2B,MAAM,WAAW,CAAC;AAKtE,OAAO,EAAE,QAAQ,EAA+B,MAAM,eAAe,CAAC;AACtE,OAAO,EAAkB,eAAe,EAAE,MAAM,aAAa,CAAC;AA2B9D,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAK7C,MAAM,WAAW,cAAc;IAC7B,0CAA0C;IAC1C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kCAAkC;IAClC,aAA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