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/printer/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The JSON → TS printer: `jazz.app.json` + `jazz.permissions.json` → the
|
|
3
3
|
* alpha.66 sources (`schema.ts` with `s.defineSchema` and `definePermissions`,
|
|
4
|
-
* and `migrations/` when the app has history). Used by `jazz-tools
|
|
5
|
-
*
|
|
4
|
+
* and `migrations/` when the app has history). Used by `jazz-tools print-ts`
|
|
5
|
+
* and the parity test.
|
|
6
6
|
*/
|
|
7
7
|
import type { AppJson, PermissionsJson } from "./app-json.js";
|
|
8
8
|
import { type Unsupported } from "./permissions.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/printer/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGtE,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC9D,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE7D,MAAM,WAAW,YAAY;IAC3B,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,UAAU;IACzB,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,+EAA+E;IAC/E,WAAW,EAAE,WAAW,EAAE,CAAC;CAC5B;AAED,qBAAa,YAAa,SAAQ,KAAK;IACzB,QAAQ,CAAC,WAAW,EAAE,WAAW,EAAE;gBAA1B,WAAW,EAAE,WAAW,EAAE;CAMhD;AAED,wBAAgB,aAAa,CAC3B,GAAG,EAAE,OAAO,EACZ,WAAW,EAAE,eAAe,EAC5B,OAAO,GAAE,YAAiB,GACzB,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/printer/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGtE,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC9D,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE7D,MAAM,WAAW,YAAY;IAC3B,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,UAAU;IACzB,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,+EAA+E;IAC/E,WAAW,EAAE,WAAW,EAAE,CAAC;CAC5B;AAED,qBAAa,YAAa,SAAQ,KAAK;IACzB,QAAQ,CAAC,WAAW,EAAE,WAAW,EAAE;gBAA1B,WAAW,EAAE,WAAW,EAAE;CAMhD;AAED,wBAAgB,aAAa,CAC3B,GAAG,EAAE,OAAO,EACZ,WAAW,EAAE,eAAe,EAC5B,OAAO,GAAE,YAAiB,GACzB,UAAU,CAuCZ"}
|
package/dist/printer/index.js
CHANGED
|
@@ -31,7 +31,10 @@ export function printSchemaTs(app, permissions, options = {}) {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
const printed = printPermissions(app, permissions);
|
|
34
|
-
unsupported.push(...printed.unsupported.map((u) => ({
|
|
34
|
+
unsupported.push(...printed.unsupported.map((u) => ({
|
|
35
|
+
...u,
|
|
36
|
+
path: `jazz.permissions.json: ${u.path}`,
|
|
37
|
+
})));
|
|
35
38
|
const header = options.header ? `${options.header.trimEnd()}\n` : "";
|
|
36
39
|
const schemaTs = `${header}import { schema as s } from "jazz-tools";\n\nexport const schema = s.defineSchema(${tables});\n`;
|
|
37
40
|
const files = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/printer/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAoB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgB7D,MAAM,OAAO,YAAa,SAAQ,KAAK;IAChB;IAArB,YAAqB,WAA0B;QAC7C,KAAK,CACH,4BAA4B,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,SAAS;YAC9E,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAC/E,CAAC;QAJiB,gBAAW,GAAX,WAAW,CAAe;IAK/C,CAAC;CACF;AAED,MAAM,UAAU,aAAa,CAC3B,GAAY,EACZ,WAA4B,EAC5B,UAAwB,EAAE;IAE1B,MAAM,WAAW,GAAkB,EAAE,CAAC;IACtC,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE;QACrC,IAAI,EAAE,QAAQ;QACd,WAAW;QACX,UAAU,EAAE,GAAG,CAAC,UAAU;KAC3B,CAAC,CAAC;IACH,uFAAuF;IACvF,MAAM,IAAI,GAAG,IAAI,GAAG,CAClB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AAG,CAAC;QACJ,IAAI,EAAE,0BAA0B,CAAC,CAAC,IAAI,EAAE;KACzC,CAAC,CAAC,CACJ,CAAC;IACF,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACrE,MAAM,QAAQ,GAAG,GAAG,MAAM,qFAAqF,MAAM,MAAM,CAAC;IAC5H,MAAM,KAAK,GAA2B,EAAE,CAAC;IACzC,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;QAChC,KAAK,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC;QAC9B,KAAK,CAAC,gBAAgB,CAAC;YACrB,yFAAyF,OAAO,CAAC,IAAI,EAAE,CAAC;IAC5G,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,WAAW,CAAC,GAAG,GAAG,QAAQ,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC;IACtD,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAChC,CAAC","sourcesContent":["/**\n * The JSON → TS printer: `jazz.app.json` + `jazz.permissions.json` → the\n * alpha.66 sources (`schema.ts` with `s.defineSchema` and `definePermissions`,\n * and `migrations/` when the app has history). Used by `jazz-tools print-ts`\n * and the parity test.\n */\nimport type { AppJson, PermissionsJson } from \"./app-json.js\";\nimport { printPermissions, type Unsupported } from \"./permissions.js\";\nimport { printTables } from \"./schema.js\";\n\nexport type { AppJson, PermissionsJson } from \"./app-json.js\";\nexport type { Unsupported } from \"./permissions.js\";\nexport { printPermissions } from \"./permissions.js\";\nexport { printTables } from \"./schema.js\";\nexport { formatTs, layout, loadPrettier } from \"./format.js\";\n\nexport interface PrintOptions {\n /** Comment lines at the top of `schema.ts`. */\n header?: string;\n /** Print the permissions into a separate `permissions.ts`. */\n separatePermissions?: boolean;\n}\n\nexport interface PrintedApp {\n /** Relative path → contents (unformatted: run `formatTs`). */\n files: Record<string, string>;\n /** What the DSL can't express, by JSON path: callers refuse when non-empty. */\n unsupported: Unsupported[];\n}\n\nexport class PrintRefusal extends Error {\n constructor(readonly unsupported: Unsupported[]) {\n super(\n `the TS DSL can't express ${unsupported.length === 1 ? \"this\" : \"these\"} yet:\\n` +\n unsupported.map((u) => ` ${u.path}: ${u.text}\\n ${u.reason}`).join(\"\\n\"),\n );\n }\n}\n\nexport function printSchemaTs(\n app: AppJson,\n permissions: PermissionsJson,\n options: PrintOptions = {},\n): PrintedApp {\n const unsupported: Unsupported[] = [];\n const tables = printTables(app.tables, {\n path: \"tables\",\n unsupported,\n transforms: app.transforms,\n });\n // Transforms are spelt on the columns that use them: one no column uses would be lost.\n const used = new Set(\n JSON.stringify(app.tables)\n .match(/\"transform\":\"[^\"]*\"/g)\n ?.map((m) => m.slice(13, -1)),\n );\n for (const name of Object.keys(app.transforms ?? {})) {\n if (!used.has(name))\n unsupported.push({\n path: `transforms.${name}`,\n text: name,\n reason: \"a transform no column uses\",\n });\n }\n const printed = printPermissions(app, permissions);\n unsupported.push(\n ...printed.unsupported.map((u) => ({\n ...u,\n path: `jazz.permissions.json: ${u.path}`,\n })),\n );\n const header = options.header ? `${options.header.trimEnd()}\\n` : \"\";\n const schemaTs = `${header}import { schema as s } from \"jazz-tools\";\\n\\nexport const schema = s.defineSchema(${tables});\\n`;\n const files: Record<string, string> = {};\n if (options.separatePermissions) {\n files[\"schema.ts\"] = schemaTs;\n files[\"permissions.ts\"] =\n `import type { schema as s } from \"jazz-tools\";\\nimport { schema } from \"./schema\";\\n\\n${printed.code}`;\n } else {\n files[\"schema.ts\"] = `${schemaTs}\\n${printed.code}`;\n }\n return { files, unsupported };\n}\n"]}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { useCoState, useAccount, useSuspenseCoState, useSuspenseAccount, JazzReactProvider, } from "../classic-api.js";
|
|
2
2
|
export type { JazzClient } from "./create-jazz-client.js";
|
|
3
|
-
export { JazzProvider, type JazzProviderProps, JazzClientProvider, type JazzClientProviderProps, useDb, useJazzClient,
|
|
3
|
+
export { JazzProvider, type JazzProviderProps, JazzClientProvider, type JazzClientProviderProps, useDb, useJazzClient, } from "./provider.js";
|
|
4
4
|
export { useAll, useAllSuspense, type UseAllResult, type UseAllSuspenseResult } from "./use-all.js";
|
|
5
5
|
export { useOne, useOneSuspense, type UseOneResult, type UseOneSuspenseResult } from "./use-one.js";
|
|
6
6
|
export { useAuthState, type AuthStateInfo } from "../react-core/use-auth-state.js";
|
|
@@ -12,5 +12,4 @@ export * from "../accounts/exports.js";
|
|
|
12
12
|
export { createJazzClient, startJazzClient, type JazzClientConfig, } from "../session/create-jazz-session.js";
|
|
13
13
|
export type { JazzSession, JazzSessionSnapshot, JazzSessionErrorViewProps, JazzSessionOperation, JazzUser, LocalFirstUnavailable, } from "../session/jazz-session.js";
|
|
14
14
|
export { useJazzSession, type UseJazzSessionResult, type JazzSessionViewProps, } from "../react-core/session.js";
|
|
15
|
-
export { AccountManager, JazzSessionProvider, createAccountManager, exportLocalFirstSecret, useAccountState, useJazzAuth, useJazzSessionOwner, useLocalFirstAuth, } from "../removed-api.js";
|
|
16
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,KAAK,EACL,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,KAAK,EACL,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACxE,YAAY,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE5F,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,KAAK,gBAAgB,GACtB,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,EACpB,QAAQ,EACR,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,0BAA0B,CAAC"}
|
package/dist/react/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { useCoState, useAccount, useSuspenseCoState, useSuspenseAccount, JazzReactProvider, } from "../classic-api.js";
|
|
2
|
-
export { JazzProvider, JazzClientProvider, useDb, useJazzClient,
|
|
2
|
+
export { JazzProvider, JazzClientProvider, useDb, useJazzClient, } from "./provider.js";
|
|
3
3
|
export { useAll, useAllSuspense } from "./use-all.js";
|
|
4
4
|
export { useOne, useOneSuspense } from "./use-one.js";
|
|
5
5
|
export { useAuthState } from "../react-core/use-auth-state.js";
|
|
@@ -7,6 +7,4 @@ export { useSyncStatus } from "../react-core/use-sync-status.js";
|
|
|
7
7
|
export * from "../accounts/exports.js";
|
|
8
8
|
export { createJazzClient, startJazzClient, } from "../session/create-jazz-session.js";
|
|
9
9
|
export { useJazzSession, } from "../react-core/session.js";
|
|
10
|
-
// Removed in alpha.61: stubs that throw, naming the replacement (one release).
|
|
11
|
-
export { AccountManager, JazzSessionProvider, createAccountManager, exportLocalFirstSecret, useAccountState, useJazzAuth, useJazzSessionOwner, useLocalFirstAuth, } from "../removed-api.js";
|
|
12
10
|
//# sourceMappingURL=index.js.map
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,YAAY,EAEZ,kBAAkB,EAElB,KAAK,EACL,aAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,YAAY,EAEZ,kBAAkB,EAElB,KAAK,EACL,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAgD,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,MAAM,EAAE,cAAc,EAAgD,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,YAAY,EAAsB,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAKjE,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EACL,gBAAgB,EAChB,eAAe,GAEhB,MAAM,mCAAmC,CAAC;AAS3C,OAAO,EACL,cAAc,GAGf,MAAM,0BAA0B,CAAC","sourcesContent":["export {\n useCoState,\n useAccount,\n useSuspenseCoState,\n useSuspenseAccount,\n JazzReactProvider,\n} from \"../classic-api.js\";\nexport type { JazzClient } from \"./create-jazz-client.js\";\nexport {\n JazzProvider,\n type JazzProviderProps,\n JazzClientProvider,\n type JazzClientProviderProps,\n useDb,\n useJazzClient,\n} from \"./provider.js\";\nexport { useAll, useAllSuspense, type UseAllResult, type UseAllSuspenseResult } from \"./use-all.js\";\nexport { useOne, useOneSuspense, type UseOneResult, type UseOneSuspenseResult } from \"./use-one.js\";\nexport { useAuthState, type AuthStateInfo } from \"../react-core/use-auth-state.js\";\nexport { useSyncStatus } from \"../react-core/use-sync-status.js\";\nexport type { LinkStatus, SyncStatus } from \"../runtime/sync-status.js\";\nexport type { QueryOptions, RuntimeSourcesConfig } from \"../runtime/index.js\";\nexport type { LocalFirstLoader, LocalFirstModule } from \"../runtime/local-first-upgrade.js\";\n\nexport * from \"../accounts/exports.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 LocalFirstUnavailable,\n} from \"../session/jazz-session.js\";\nexport {\n useJazzSession,\n type UseJazzSessionResult,\n type JazzSessionViewProps,\n} from \"../react-core/session.js\";\n"]}
|
package/dist/react/provider.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { PublicSession } from "../runtime/context.js";
|
|
2
|
-
import { useSession } from "../react-core/provider.js";
|
|
3
2
|
import { type JazzSessionSourceProps, type JazzSessionViewProps } from "../react-core/session.js";
|
|
4
3
|
import { type JazzClientConfig } from "../session/create-jazz-session.js";
|
|
5
4
|
import type { JazzClient as CreatedJazzClient } from "./create-jazz-client.js";
|
|
@@ -23,6 +22,5 @@ export declare function useJazzClient(): JazzClientContextValue;
|
|
|
23
22
|
* Get a Jazz {@link Db} instance that can be used to read and write data.
|
|
24
23
|
*/
|
|
25
24
|
export declare function useDb(): CreatedJazzClient["db"];
|
|
26
|
-
export { useSession };
|
|
27
25
|
export type { JazzClientContextValue };
|
|
28
26
|
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/react/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/react/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAClG,OAAO,KAAK,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,sCAAsC,CAAC;AAI9C,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAE7F,UAAU,sBAAsB;IAC9B,EAAE,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC5B,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9B,QAAQ,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;CACzC;AAED,MAAM,MAAM,iBAAiB,GAAG,sBAAsB,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,GACzF,oBAAoB,CAAC,iBAAiB,CAAC,GACvC,oBAAoB,CAAC;AAEvB;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAwBpD;AAED,wBAAgB,aAAa,IAAI,sBAAsB,CAEtD;AAED;;GAEG;AACH,wBAAgB,KAAK,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAE/C;AAED,YAAY,EAAE,sBAAsB,EAAE,CAAC"}
|
package/dist/react/provider.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useDb as useCoreDb, useJazzClient as useCoreJazzClient
|
|
2
|
+
import { useDb as useCoreDb, useJazzClient as useCoreJazzClient } from "../react-core/provider.js";
|
|
3
3
|
import { JazzSessionProvider, } from "../react-core/session.js";
|
|
4
4
|
import { openBrowserSessionCore } from "../session/create-jazz-session.js";
|
|
5
5
|
import { refuseAutoAttachDevTools, } from "../runtime/removed-provider-props.js";
|
|
@@ -30,5 +30,4 @@ export function useJazzClient() {
|
|
|
30
30
|
export function useDb() {
|
|
31
31
|
return useCoreDb();
|
|
32
32
|
}
|
|
33
|
-
export { useSession };
|
|
34
33
|
//# sourceMappingURL=provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/react/provider.tsx"],"names":[],"mappings":";AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/react/provider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnG,OAAO,EACL,mBAAmB,GAGpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAyB,MAAM,mCAAmC,CAAC;AAElG,OAAO,EACL,wBAAwB,GAEzB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EAAE,kBAAkB,EAAgC,MAAM,2BAA2B,CAAC;AAY7F;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,wBAAwB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IAChD,4BAA4B,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACpD,0BAA0B,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACxE,OAAO,CACL,KAAC,mBAAmB,OACd,IAAI,EACR,QAAQ,EAAE,sBAAsB,EAChC,OAAO,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,YAAG,IAAI,EAAC,QAAQ,8BAAa,CAAC,CAAC,CAAC,OAAO,EACxE,KAAK,EACH,KAAK,KAAK,SAAS;YACjB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CACb,mBAAS,IAAI,EAAC,OAAO,aACnB,sEAA6C,EAC7C,iBAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,KAAK,EAAE,0BAExC,IACD,CACX;YACH,CAAC,CAAC,KAAK,GAEX,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,iBAAiB,EAA4B,CAAC;AACvD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,KAAK;IACnB,OAAO,SAAS,EAA2B,CAAC;AAC9C,CAAC","sourcesContent":["import type { PublicSession } from \"../runtime/context.js\";\nimport { useDb as useCoreDb, useJazzClient as useCoreJazzClient } from \"../react-core/provider.js\";\nimport {\n JazzSessionProvider,\n type JazzSessionSourceProps,\n type JazzSessionViewProps,\n} from \"../react-core/session.js\";\nimport { openBrowserSessionCore, type JazzClientConfig } from \"../session/create-jazz-session.js\";\nimport type { JazzClient as CreatedJazzClient } from \"./create-jazz-client.js\";\nimport {\n refuseAutoAttachDevTools,\n type NoAutoAttachDevTools,\n} from \"../runtime/removed-provider-props.js\";\nimport { refuseRemovedProviderProps } from \"./provider-props.js\";\nimport { assertNoClassicProviderProps } from \"../classic-api.js\";\n\nexport { JazzClientProvider, type JazzClientProviderProps } from \"../react-core/provider.js\";\n\ninterface JazzClientContextValue {\n db: CreatedJazzClient[\"db\"];\n session: PublicSession | null;\n shutdown: CreatedJazzClient[\"shutdown\"];\n}\n\nexport type JazzProviderProps = JazzSessionSourceProps<JazzClientConfig, CreatedJazzClient> &\n JazzSessionViewProps<CreatedJazzClient> &\n NoAutoAttachDevTools;\n\n/**\n * Jazz for a React app: owns a session (`config`) or shows yours (`session`),\n * renders `children` with its client once someone is signed in, and\n * `signedOut`, `loading` or `error` otherwise. Read the session anywhere\n * below with `useJazzSession()`.\n */\nexport function JazzProvider(props: JazzProviderProps) {\n refuseAutoAttachDevTools(\"JazzProvider\", props);\n assertNoClassicProviderProps(\"JazzProvider\", props);\n refuseRemovedProviderProps(props);\n const { loading, error, autoAttachDevTools: _removed, ...rest } = props;\n return (\n <JazzSessionProvider\n {...rest}\n openCore={openBrowserSessionCore}\n loading={loading === undefined ? <p role=\"status\">Loading…</p> : loading}\n error={\n error === undefined\n ? ({ retry }) => (\n <section role=\"alert\">\n <p>Jazz couldn’t start. Please try again.</p>\n <button type=\"button\" onClick={() => void retry()}>\n Try again\n </button>\n </section>\n )\n : error\n }\n />\n );\n}\n\nexport function useJazzClient(): JazzClientContextValue {\n return useCoreJazzClient() as JazzClientContextValue;\n}\n\n/**\n * Get a Jazz {@link Db} instance that can be used to read and write data.\n */\nexport function useDb(): CreatedJazzClient[\"db\"] {\n return useCoreDb<CreatedJazzClient[\"db\"]>();\n}\n\nexport type { JazzClientContextValue };\n"]}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
export { useCoState, useAccount, useSuspenseCoState, useSuspenseAccount } from "../classic-api.js";
|
|
2
2
|
export type { JazzClient } from "../react/create-jazz-client.js";
|
|
3
|
-
export { JazzClientProvider, useDb, useJazzClient,
|
|
3
|
+
export { JazzClientProvider, useDb, useJazzClient, type JazzClientProviderProps, } from "./provider.js";
|
|
4
4
|
export { useAll, useAllSuspense, type UseAllResult, type UseAllSuspenseResult } from "./use-all.js";
|
|
5
5
|
export { useOne, useOneSuspense, type UseOneResult, type UseOneSuspenseResult } from "./use-one.js";
|
|
6
6
|
export { useAuthState, type AuthStateInfo } from "./use-auth-state.js";
|
|
7
7
|
export { useSyncStatus } from "./use-sync-status.js";
|
|
8
8
|
export type { DurabilityTier, QueryBuilder, QueryOptions, TableProxy } from "../runtime/index.js";
|
|
9
9
|
export { JazzSessionProvider as JazzHostSessionProvider, useJazzSession, reportJazzStartupFailure, type JazzSessionSourceProps, type JazzSessionViewProps, type UseJazzSessionResult, } from "./session.js";
|
|
10
|
-
export { createUseLocalFirstAuth, useJazzSessionOwner } from "../removed-api.js";
|
|
11
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react-core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACnG,YAAY,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EACL,kBAAkB,EAClB,KAAK,EACL,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react-core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACnG,YAAY,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EACL,kBAAkB,EAClB,KAAK,EACL,aAAa,EACb,KAAK,uBAAuB,GAC7B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAElG,OAAO,EAIL,mBAAmB,IAAI,uBAAuB,EAC9C,cAAc,EACd,wBAAwB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,cAAc,CAAC"}
|
package/dist/react-core/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
export { useCoState, useAccount, useSuspenseCoState, useSuspenseAccount } from "../classic-api.js";
|
|
2
|
-
export { JazzClientProvider, useDb, useJazzClient,
|
|
2
|
+
export { JazzClientProvider, useDb, useJazzClient, } from "./provider.js";
|
|
3
3
|
export { useAll, useAllSuspense } from "./use-all.js";
|
|
4
4
|
export { useOne, useOneSuspense } from "./use-one.js";
|
|
5
5
|
export { useAuthState } from "./use-auth-state.js";
|
|
6
6
|
export { useSyncStatus } from "./use-sync-status.js";
|
|
7
7
|
export {
|
|
8
8
|
// The provider a host binding builds its `<JazzProvider>` on (it takes the
|
|
9
|
-
// host's `openCore`).
|
|
10
|
-
//
|
|
9
|
+
// host's `openCore`). Exported under another name so it isn't mistaken for
|
|
10
|
+
// alpha.60's `JazzSessionProvider`.
|
|
11
11
|
JazzSessionProvider as JazzHostSessionProvider, useJazzSession, reportJazzStartupFailure, } from "./session.js";
|
|
12
|
-
// Removed in alpha.61: stubs that throw, naming the replacement (one release).
|
|
13
|
-
export { createUseLocalFirstAuth, useJazzSessionOwner } from "../removed-api.js";
|
|
14
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react-core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEnG,OAAO,EACL,kBAAkB,EAClB,KAAK,EACL,aAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react-core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEnG,OAAO,EACL,kBAAkB,EAClB,KAAK,EACL,aAAa,GAEd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAgD,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,MAAM,EAAE,cAAc,EAAgD,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD,OAAO;AACL,2EAA2E;AAC3E,2EAA2E;AAC3E,oCAAoC;AACpC,mBAAmB,IAAI,uBAAuB,EAC9C,cAAc,EACd,wBAAwB,GAIzB,MAAM,cAAc,CAAC","sourcesContent":["export { useCoState, useAccount, useSuspenseCoState, useSuspenseAccount } from \"../classic-api.js\";\nexport type { JazzClient } from \"../react/create-jazz-client.js\";\nexport {\n JazzClientProvider,\n useDb,\n useJazzClient,\n type JazzClientProviderProps,\n} from \"./provider.js\";\nexport { useAll, useAllSuspense, type UseAllResult, type UseAllSuspenseResult } from \"./use-all.js\";\nexport { useOne, useOneSuspense, type UseOneResult, type UseOneSuspenseResult } from \"./use-one.js\";\nexport { useAuthState, type AuthStateInfo } from \"./use-auth-state.js\";\nexport { useSyncStatus } from \"./use-sync-status.js\";\n\nexport type { DurabilityTier, QueryBuilder, QueryOptions, TableProxy } from \"../runtime/index.js\";\n\nexport {\n // The provider a host binding builds its `<JazzProvider>` on (it takes the\n // host's `openCore`). Exported under another name so it isn't mistaken for\n // alpha.60's `JazzSessionProvider`.\n JazzSessionProvider as JazzHostSessionProvider,\n useJazzSession,\n reportJazzStartupFailure,\n type JazzSessionSourceProps,\n type JazzSessionViewProps,\n type UseJazzSessionResult,\n} from \"./session.js\";\n"]}
|
|
@@ -52,13 +52,5 @@ export declare function useJazzClient(): CoreJazzClient;
|
|
|
52
52
|
* Get a Jazz {@link Db} instance that can be used to read and write data.
|
|
53
53
|
*/
|
|
54
54
|
export declare function useDb<TDb = unknown>(): TDb;
|
|
55
|
-
/**
|
|
56
|
-
* Get the current Jazz {@link PublicSession}, including the canonical user,
|
|
57
|
-
* immutable provider claims, and auth mode.
|
|
58
|
-
*
|
|
59
|
-
* @deprecated Use `useJazzSession().user`: the same user, with `user` as
|
|
60
|
-
* `accountId`. Warns once in development; removed in a later alpha.
|
|
61
|
-
*/
|
|
62
|
-
export declare function useSession(): PublicSession | null;
|
|
63
55
|
export {};
|
|
64
56
|
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/react-core/provider.tsx"],"names":[],"mappings":"AAAA,OAAc,EAMZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAM5D,OAA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QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,gBAAgB;AAChB,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,QAAQ,CAAC;IACjB,uFAAuF;IACvF,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;IACpB,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAyDF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CAOhE;AAED,8FAA8F;AAC9F,wBAAgB,yBAAyB,CAAC,EACxC,MAAM,EAAE,aAAa,EACrB,QAAQ,GACT,EAAE,uBAAuB,2CAQzB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,cAAc,GACf,EAAE,mBAAmB,2CA4DrB;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,IAAI;IAAE,MAAM,EAAE,cAAc,CAAA;CAAE,GAAG,IAAI,CAEhF;AAED,wBAAgB,aAAa,IAAI,cAAc,CAI9C;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,GAAG,GAAG,OAAO,KAAK,GAAG,CAE1C"}
|
|
@@ -4,7 +4,6 @@ import { createClientConfigKey } from "../runtime/client-config-key.js";
|
|
|
4
4
|
import { acquireClient as registryAcquireClient, releaseClient as registryReleaseClient, } from "../runtime/client-registry.js";
|
|
5
5
|
import { trackPromise } from "../subscriptions-orchestrator.js";
|
|
6
6
|
import { SessionContext } from "./session-context.js";
|
|
7
|
-
import { warnSessionHookDeprecated } from "../session/deprecated-session-hook.js";
|
|
8
7
|
const JazzContext = createContext(null);
|
|
9
8
|
// Client lifecycle is delegated to the framework-agnostic, refcounted client
|
|
10
9
|
// registry (keyed by configKey, with deferred release to survive Strict Mode's
|
|
@@ -126,16 +125,4 @@ export function useJazzClient() {
|
|
|
126
125
|
export function useDb() {
|
|
127
126
|
return useJazzClient().db;
|
|
128
127
|
}
|
|
129
|
-
/**
|
|
130
|
-
* Get the current Jazz {@link PublicSession}, including the canonical user,
|
|
131
|
-
* immutable provider claims, and auth mode.
|
|
132
|
-
*
|
|
133
|
-
* @deprecated Use `useJazzSession().user`: the same user, with `user` as
|
|
134
|
-
* `accountId`. Warns once in development; removed in a later alpha.
|
|
135
|
-
*/
|
|
136
|
-
export function useSession() {
|
|
137
|
-
warnSessionHookDeprecated("useSession()", "useJazzSession().user");
|
|
138
|
-
const session = useJazzClient().session;
|
|
139
|
-
return session ?? null;
|
|
140
|
-
}
|
|
141
128
|
//# sourceMappingURL=provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/react-core/provider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EACZ,aAAa,EACb,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,GAET,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EACL,aAAa,IAAI,qBAAqB,EACtC,aAAa,IAAI,qBAAqB,GACvC,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAqClF,MAAM,WAAW,GAAG,aAAa,CAA0B,IAAI,CAAC,CAAC;AAEjE,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,gFAAgF;AAChF,mDAAmD;AACnD,SAAS,aAAa,CACpB,SAAiB,EACjB,MAAgB,EAChB,cAAuC,EACvC,MAAc;IAEd,OAAO,qBAAqB,CAAU,SAAS,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;AACzF,CAAC;AAED,SAAS,aAAa,CAAC,SAAiB,EAAE,MA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AAU,CAAC,WAAW,CAAC,CAAC;IACpC,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;IAC9F,OAAO,GAAG,CAAC,MAAM,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,KAAK;IACnB,OAAO,aAAa,EAAE,CAAC,EAAS,CAAC;AACnC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU;IACxB,yBAAyB,CAAC,cAAc,EAAE,uBAAuB,CAAC,CAAC;IACnE,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC,OAAO,CAAC;IACxC,OAAO,OAAO,IAAI,IAAI,CAAC;AACzB,CAAC","sourcesContent":["import React, {\n createContext,\n useContext,\n useEffect,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\nimport type { AuthState } from \"../runtime/auth-state.js\";\nimport type { SyncStatus } from \"../runtime/sync-status.js\";\nimport { createClientConfigKey } from \"../runtime/client-config-key.js\";\nimport {\n acquireClient as registryAcquireClient,\n releaseClient as registryReleaseClient,\n} from \"../runtime/client-registry.js\";\nimport type { PublicSession } from \"../runtime/context.js\";\nimport type { AccountDbConfig as DbConfig } from \"../accounts/context.js\";\nimport { trackPromise } from \"../subscriptions-orchestrator.js\";\nimport { SessionContext } from \"./session-context.js\";\nimport { warnSessionHookDeprecated } from \"../session/deprecated-session-hook.js\";\n\ntype CoreJazzDb = {\n getAuthState(): AuthState;\n onAuthChanged(listener: (state: AuthState) => void): () => void;\n getSyncStatus(): SyncStatus;\n onSyncStatusChange(listener: (status: SyncStatus) => void): () => void;\n};\n\nexport type CoreJazzClient = {\n db: CoreJazzDb;\n session?: PublicSession | null;\n shutdown(options?: import(\"../runtime/db.js\").ShutdownOptions): Promise<void>;\n};\n\nexport type OpenJazzClient<TClient extends CoreJazzClient = CoreJazzClient> = (\n config: DbConfig,\n) => Promise<TClient>;\n\nexport type JazzClientProviderProps = {\n client: Promise<CoreJazzClient> | CoreJazzClient;\n children: ReactNode;\n};\n\n/** @internal */\nexport type JazzDbProviderProps = {\n config: DbConfig;\n /** Rendered during SSR and until client acquisition completes after browser commit. */\n fallback?: ReactNode;\n children: ReactNode;\n openJazzClient: OpenJazzClient;\n};\n\ntype JazzContextValue = {\n client: CoreJazzClient;\n};\n\nconst JazzContext = createContext<JazzContextValue | null>(null);\n\n// Client lifecycle is delegated to the framework-agnostic, refcounted client\n// registry (keyed by configKey, with deferred release to survive Strict Mode's\n// mount→unmount→remount cycle). Using the shared Map-backed registry — rather\n// than a single cached slot — lets distinct configs (e.g. two principals on one\n// screen) coexist instead of evicting one another.\nfunction acquireClient<TClient extends CoreJazzClient>(\n configKey: string,\n config: DbConfig,\n openJazzClient: OpenJazzClient<TClient>,\n holder: object,\n): Promise<TClient> {\n return registryAcquireClient<TClient>(configKey, () => openJazzClient(config), holder);\n}\n\nfunction releaseClient(configKey: string, holder: object): Promise<void> {\n return registryReleaseClient(configKey, holder);\n}\n\n// Credential refresh belongs to the shared account context, so every framework\n// observes the same outcome. Providers only invalidate their rendered session.\nfunction useAuthSubscription(client: CoreJazzClient): number {\n const [authRev, setAuthRev] = useState(0);\n useEffect(() => client.db.onAuthChanged(() => setAuthRev((n) => n + 1)), [client]);\n return authRev;\n}\n\n// Wrap React.use to make it compatible with React 18 and 19\nfunction usePromise<T extends object>(promise: Promise<T> | T): T {\n if (!(\"then\" in promise)) {\n return promise;\n }\n\n if (React.use !== undefined) {\n return React.use(promise);\n }\n\n const tracked = trackPromise(promise);\n\n if (tracked.status === \"pending\") {\n throw tracked;\n }\n\n if (tracked.status === \"rejected\") {\n throw tracked.reason;\n }\n\n return tracked.value as T;\n}\n\n/**\n * Makes a Jazz client available to children components through a React context.\n * Useful if you need to create a Jazz client outside of the React component lifecycle.\n */\nexport function JazzClientProvider(props: JazzClientProviderProps) {\n // Its children read this client, not an enclosing <JazzProvider>'s session.\n return (\n <SessionContext.Provider value={null}>\n <JazzClientContextProvider {...props} />\n </SessionContext.Provider>\n );\n}\n\n/** @internal `<JazzClientProvider>` for a session's own client: the session stays visible. */\nexport function JazzClientContextProvider({\n client: clientPromise,\n children,\n}: JazzClientProviderProps) {\n const client = usePromise(clientPromise);\n\n const authRev = useAuthSubscription(client);\n\n const value = React.useMemo(() => ({ client }), [client, authRev]);\n\n return <JazzContext.Provider value={value}>{children}</JazzContext.Provider>;\n}\n\n/**\n * @internal Opens a client straight from a Db config (a local or test Db, no\n * session) and makes it available to children. Apps use `<JazzProvider>`,\n * which owns a session, or `<JazzClientProvider>` for a client they opened.\n */\nexport function JazzDbProvider({\n config,\n fallback,\n children,\n openJazzClient,\n}: JazzDbProviderProps) {\n // Stable per-provider identity, used as the registry holder across effect\n // cleanup and re-acquisition (including React Strict Mode's effect replay).\n const holder = useRef({}).current;\n\n // Keep the framework-level lease distinct from openJazzClient's own shared\n // client lease. Both use the generic registry; sharing an unqualified key\n // makes provider teardown recursively release itself instead of the runtime.\n const configKey = createClientConfigKey(\"react\", config, [openJazzClient]);\n\n const [clientLease, setClientLease] = useState<{\n configKey: string;\n promise: Promise<CoreJazzClient>;\n } | null>(null);\n const lifecycle = useRef<{\n configKey: string | null;\n release: Promise<void>;\n }>({ configKey: null, release: Promise.resolve() });\n\n useEffect(() => {\n let cancelled = false;\n let acquired = false;\n const previous = lifecycle.current;\n // A same-key re-acquire must run immediately so the registry can cancel its\n // deferred release during Strict Mode replay. A different key waits for the\n // complete prior lifecycle, including any replacement that was cancelled\n // before it acquired a lease.\n const ready = previous.configKey === configKey ? Promise.resolve() : previous.release;\n const acquisition = ready.then(() => {\n if (cancelled) return;\n const promise = acquireClient<CoreJazzClient>(configKey, config, openJazzClient, holder);\n acquired = true;\n setClientLease({ configKey, promise });\n });\n\n return () => {\n cancelled = true;\n lifecycle.current = {\n configKey,\n release: acquisition.then(() => {\n if (acquired) {\n return releaseClient(configKey, holder);\n }\n }),\n };\n };\n }, [configKey, openJazzClient, holder]);\n\n // Effects do not run during SSR. Rendering the same fallback before the first\n // browser commit keeps hydration stable while deferring all registry work to\n // the committed lifecycle.\n if (clientLease?.configKey !== configKey) {\n return <>{fallback}</>;\n }\n\n return (\n <React.Suspense fallback={fallback}>\n <JazzClientProvider client={clientLease.promise}>{children}</JazzClientProvider>\n </React.Suspense>\n );\n}\n\n/**\n * @internal The nearest client's context, or null outside a provider. A new\n * value each time the client's auth changes.\n */\nexport function useOptionalJazzClientContext(): { client: CoreJazzClient } | null {\n return useContext(JazzContext);\n}\n\nexport function useJazzClient(): CoreJazzClient {\n const ctx = useContext(JazzContext);\n if (!ctx) throw new Error(\"useDb must be used within <JazzProvider> or <JazzClientProvider>\");\n return ctx.client;\n}\n\n/**\n * Get a Jazz {@link Db} instance that can be used to read and write data.\n */\nexport function useDb<TDb = unknown>(): TDb {\n return useJazzClient().db as TDb;\n}\n\n/**\n * Get the current Jazz {@link PublicSession}, including the canonical user,\n * immutable provider claims, and auth mode.\n *\n * @deprecated Use `useJazzSession().user`: the same user, with `user` as\n * `accountId`. Warns once in development; removed in a later alpha.\n */\nexport function useSession(): PublicSession | null {\n warnSessionHookDeprecated(\"useSession()\", \"useJazzSession().user\");\n const session = useJazzClient().session;\n return session ?? null;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/react-core/provider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EACZ,aAAa,EACb,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,GAET,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EACL,aAAa,IAAI,qBAAqB,EACtC,aAAa,IAAI,qBAAqB,GACvC,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAqCtD,MAAM,WAAW,GAAG,aAAa,CAA0B,IAAI,CAAC,CAAC;AAEjE,6EAA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CAAC,QAAQ,IAAC,QAAQ,EAAE,QAAQ,YAChC,KAAC,kBAAkB,IAAC,MAAM,EAAE,WAAW,CAAC,OAAO,YAAG,QAAQ,GAAsB,GACjE,CAClB,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,4BAA4B;IAC1C,OAAO,UAAU,CAAC,WAAW,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,MAAM,GAAG,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACpC,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;IAC9F,OAAO,GAAG,CAAC,MAAM,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,KAAK;IACnB,OAAO,aAAa,EAAE,CAAC,EAAS,CAAC;AACnC,CAAC","sourcesContent":["import React, {\n createContext,\n useContext,\n useEffect,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\nimport type { AuthState } from \"../runtime/auth-state.js\";\nimport type { SyncStatus } from \"../runtime/sync-status.js\";\nimport { createClientConfigKey } from \"../runtime/client-config-key.js\";\nimport {\n acquireClient as registryAcquireClient,\n releaseClient as registryReleaseClient,\n} from \"../runtime/client-registry.js\";\nimport type { PublicSession } from \"../runtime/context.js\";\nimport type { AccountDbConfig as DbConfig } from \"../accounts/context.js\";\nimport { trackPromise } from \"../subscriptions-orchestrator.js\";\nimport { SessionContext } from \"./session-context.js\";\n\ntype CoreJazzDb = {\n getAuthState(): AuthState;\n onAuthChanged(listener: (state: AuthState) => void): () => void;\n getSyncStatus(): SyncStatus;\n onSyncStatusChange(listener: (status: SyncStatus) => void): () => void;\n};\n\nexport type CoreJazzClient = {\n db: CoreJazzDb;\n session?: PublicSession | null;\n shutdown(options?: import(\"../runtime/db.js\").ShutdownOptions): Promise<void>;\n};\n\nexport type OpenJazzClient<TClient extends CoreJazzClient = CoreJazzClient> = (\n config: DbConfig,\n) => Promise<TClient>;\n\nexport type JazzClientProviderProps = {\n client: Promise<CoreJazzClient> | CoreJazzClient;\n children: ReactNode;\n};\n\n/** @internal */\nexport type JazzDbProviderProps = {\n config: DbConfig;\n /** Rendered during SSR and until client acquisition completes after browser commit. */\n fallback?: ReactNode;\n children: ReactNode;\n openJazzClient: OpenJazzClient;\n};\n\ntype JazzContextValue = {\n client: CoreJazzClient;\n};\n\nconst JazzContext = createContext<JazzContextValue | null>(null);\n\n// Client lifecycle is delegated to the framework-agnostic, refcounted client\n// registry (keyed by configKey, with deferred release to survive Strict Mode's\n// mount→unmount→remount cycle). Using the shared Map-backed registry — rather\n// than a single cached slot — lets distinct configs (e.g. two principals on one\n// screen) coexist instead of evicting one another.\nfunction acquireClient<TClient extends CoreJazzClient>(\n configKey: string,\n config: DbConfig,\n openJazzClient: OpenJazzClient<TClient>,\n holder: object,\n): Promise<TClient> {\n return registryAcquireClient<TClient>(configKey, () => openJazzClient(config), holder);\n}\n\nfunction releaseClient(configKey: string, holder: object): Promise<void> {\n return registryReleaseClient(configKey, holder);\n}\n\n// Credential refresh belongs to the shared account context, so every framework\n// observes the same outcome. Providers only invalidate their rendered session.\nfunction useAuthSubscription(client: CoreJazzClient): number {\n const [authRev, setAuthRev] = useState(0);\n useEffect(() => client.db.onAuthChanged(() => setAuthRev((n) => n + 1)), [client]);\n return authRev;\n}\n\n// Wrap React.use to make it compatible with React 18 and 19\nfunction usePromise<T extends object>(promise: Promise<T> | T): T {\n if (!(\"then\" in promise)) {\n return promise;\n }\n\n if (React.use !== undefined) {\n return React.use(promise);\n }\n\n const tracked = trackPromise(promise);\n\n if (tracked.status === \"pending\") {\n throw tracked;\n }\n\n if (tracked.status === \"rejected\") {\n throw tracked.reason;\n }\n\n return tracked.value as T;\n}\n\n/**\n * Makes a Jazz client available to children components through a React context.\n * Useful if you need to create a Jazz client outside of the React component lifecycle.\n */\nexport function JazzClientProvider(props: JazzClientProviderProps) {\n // Its children read this client, not an enclosing <JazzProvider>'s session.\n return (\n <SessionContext.Provider value={null}>\n <JazzClientContextProvider {...props} />\n </SessionContext.Provider>\n );\n}\n\n/** @internal `<JazzClientProvider>` for a session's own client: the session stays visible. */\nexport function JazzClientContextProvider({\n client: clientPromise,\n children,\n}: JazzClientProviderProps) {\n const client = usePromise(clientPromise);\n\n const authRev = useAuthSubscription(client);\n\n const value = React.useMemo(() => ({ client }), [client, authRev]);\n\n return <JazzContext.Provider value={value}>{children}</JazzContext.Provider>;\n}\n\n/**\n * @internal Opens a client straight from a Db config (a local or test Db, no\n * session) and makes it available to children. Apps use `<JazzProvider>`,\n * which owns a session, or `<JazzClientProvider>` for a client they opened.\n */\nexport function JazzDbProvider({\n config,\n fallback,\n children,\n openJazzClient,\n}: JazzDbProviderProps) {\n // Stable per-provider identity, used as the registry holder across effect\n // cleanup and re-acquisition (including React Strict Mode's effect replay).\n const holder = useRef({}).current;\n\n // Keep the framework-level lease distinct from openJazzClient's own shared\n // client lease. Both use the generic registry; sharing an unqualified key\n // makes provider teardown recursively release itself instead of the runtime.\n const configKey = createClientConfigKey(\"react\", config, [openJazzClient]);\n\n const [clientLease, setClientLease] = useState<{\n configKey: string;\n promise: Promise<CoreJazzClient>;\n } | null>(null);\n const lifecycle = useRef<{\n configKey: string | null;\n release: Promise<void>;\n }>({ configKey: null, release: Promise.resolve() });\n\n useEffect(() => {\n let cancelled = false;\n let acquired = false;\n const previous = lifecycle.current;\n // A same-key re-acquire must run immediately so the registry can cancel its\n // deferred release during Strict Mode replay. A different key waits for the\n // complete prior lifecycle, including any replacement that was cancelled\n // before it acquired a lease.\n const ready = previous.configKey === configKey ? Promise.resolve() : previous.release;\n const acquisition = ready.then(() => {\n if (cancelled) return;\n const promise = acquireClient<CoreJazzClient>(configKey, config, openJazzClient, holder);\n acquired = true;\n setClientLease({ configKey, promise });\n });\n\n return () => {\n cancelled = true;\n lifecycle.current = {\n configKey,\n release: acquisition.then(() => {\n if (acquired) {\n return releaseClient(configKey, holder);\n }\n }),\n };\n };\n }, [configKey, openJazzClient, holder]);\n\n // Effects do not run during SSR. Rendering the same fallback before the first\n // browser commit keeps hydration stable while deferring all registry work to\n // the committed lifecycle.\n if (clientLease?.configKey !== configKey) {\n return <>{fallback}</>;\n }\n\n return (\n <React.Suspense fallback={fallback}>\n <JazzClientProvider client={clientLease.promise}>{children}</JazzClientProvider>\n </React.Suspense>\n );\n}\n\n/**\n * @internal The nearest client's context, or null outside a provider. A new\n * value each time the client's auth changes.\n */\nexport function useOptionalJazzClientContext(): { client: CoreJazzClient } | null {\n return useContext(JazzContext);\n}\n\nexport function useJazzClient(): CoreJazzClient {\n const ctx = useContext(JazzContext);\n if (!ctx) throw new Error(\"useDb must be used within <JazzProvider> or <JazzClientProvider>\");\n return ctx.client;\n}\n\n/**\n * Get a Jazz {@link Db} instance that can be used to read and write data.\n */\nexport function useDb<TDb = unknown>(): TDb {\n return useJazzClient().db as TDb;\n}\n"]}
|
|
@@ -18,7 +18,7 @@ export interface AccountManagerConfig {
|
|
|
18
18
|
/**
|
|
19
19
|
* The app's own token for its backend (an app has no cookie to send), read
|
|
20
20
|
* whenever it is needed: sent as `Authorization: Bearer` when signing in
|
|
21
|
-
* through the backend (`
|
|
21
|
+
* through the backend (the session's `refresh()` and `linkDeviceAccount()`) and on the device's sync
|
|
22
22
|
* connection, where the backend's `authenticate` reads who the user is.
|
|
23
23
|
*/
|
|
24
24
|
bearer?: AppBearer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-account-manager.js","sourceRoot":"","sources":["../../src/react-native/create-account-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAqB,MAAM,4BAA4B,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAAE,eAAe,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ACpF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { installNativeRuntimeEntropy } from \"../runtime/runtime-entropy.js\";\nimport { clientRegistryUrl, deviceOnlyFetch } from \"../accounts/account-manager-core.js\";\nimport { clientScope } from \"../runtime/client-scope.js\";\nimport { prepareAccountManager, type AccountStore } from \"../accounts/persistence.js\";\nimport type { AppBearer } from \"../accounts/enrollment.js\";\nimport { formatAuthSecret, parseAuthSecret } from \"../runtime/auth-secret-codec.js\";\nimport { importNativeRelay } from \"./native-relay.js\";\n\nexport interface AccountManagerConfig {\n /**\n * Backend and test code only; a browser client leaves it out and is scoped\n * by `serverUrl` (see `clientScope`).\n */\n appId?: string;\n /** The app id an existing local-first app's users were created under. */\n scope?: string;\n /**\n * The app's Jazz endpoint, its backend's `createJazz` mount. `null` keeps\n * Jazz on this device only: no server, no sign-in, one local-first account.\n */\n serverUrl: string | null;\n /** Atomic OS-protected storage scoped to this application, registry, and profile. */\n store: AccountStore;\n /**\n * The app's own token for its backend (an app has no cookie to send), read\n * whenever it is needed: sent as `Authorization: Bearer` when signing in\n * through the backend (`
|
|
1
|
+
{"version":3,"file":"create-account-manager.js","sourceRoot":"","sources":["../../src/react-native/create-account-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAqB,MAAM,4BAA4B,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AA0BtD,mFAAmF;AACnF,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,MAA4B;IACrE,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,MAAM,iBAAiB,EAAE,CAAC;IACzC,MAAM,MAAM,GAAG,MAAM,CAAC,8BAA8B,EAAE,CAAC;IACvD,MAAM,cAAc,GAAG,MAAM,CAAC,aAAa,CAAC;IAC5C,MAAM,SAAS,GAAG,MAAM,CAAC,mBAAmB,CAAC;IAC7C,IAAI,OAAO,cAAc,KAAK,UAAU,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;QAC5E,MAAM,IAAI,KAAK,CACb,mFAAmF,CACpF,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,KAAK;QACf,MAAM,IAAI,KAAK,CACb,+LAA+L,CAChM,CAAC;IACJ,2BAA2B,CAAC,cAAc,CAAC,CAAC;IAC5C,OAAO,qBAAqB,CAAC;QAC3B,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC;QAC1B,QAAQ;QACR,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,GAAG,CAAC,MAAM,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChE,cAAc,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC;QACxD,SAAS,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,CAC9B,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;KACpF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { installNativeRuntimeEntropy } from \"../runtime/runtime-entropy.js\";\nimport { clientRegistryUrl, deviceOnlyFetch } from \"../accounts/account-manager-core.js\";\nimport { clientScope } from \"../runtime/client-scope.js\";\nimport { prepareAccountManager, type AccountStore } from \"../accounts/persistence.js\";\nimport type { AppBearer } from \"../accounts/enrollment.js\";\nimport { formatAuthSecret, parseAuthSecret } from \"../runtime/auth-secret-codec.js\";\nimport { importNativeRelay } from \"./native-relay.js\";\n\nexport interface AccountManagerConfig {\n /**\n * Backend and test code only; a browser client leaves it out and is scoped\n * by `serverUrl` (see `clientScope`).\n */\n appId?: string;\n /** The app id an existing local-first app's users were created under. */\n scope?: string;\n /**\n * The app's Jazz endpoint, its backend's `createJazz` mount. `null` keeps\n * Jazz on this device only: no server, no sign-in, one local-first account.\n */\n serverUrl: string | null;\n /** Atomic OS-protected storage scoped to this application, registry, and profile. */\n store: AccountStore;\n /**\n * The app's own token for its backend (an app has no cookie to send), read\n * whenever it is needed: sent as `Authorization: Bearer` when signing in\n * through the backend (the session's `refresh()` and `linkDeviceAccount()`) and on the device's sync\n * connection, where the backend's `authenticate` reads who the user is.\n */\n bearer?: AppBearer;\n}\n\n/** Prepare native crypto and retained selection without opening a Jazz context. */\nexport async function createAccountManager(config: AccountManagerConfig) {\n const registry = clientRegistryUrl(config);\n const native = await importNativeRelay();\n const crypto = native.installNativeForegroundRuntime();\n const generateSecret = crypto.accountSecret;\n const mintToken = crypto.mintLocalFirstToken;\n if (typeof generateSecret !== \"function\" || typeof mintToken !== \"function\") {\n throw new Error(\n \"React Native accounts require a matching native build with account crypto support\",\n );\n }\n if (!config.store)\n throw new Error(\n \"createJazzClient from jazz-tools/react-native needs a `store`: an atomic AccountStore ({ read, update }) backed by OS-protected storage. jazz-tools/expo supplies one from expo-secure-store.\",\n );\n installNativeRuntimeEntropy(generateSecret);\n return prepareAccountManager({\n appId: clientScope(config),\n registry,\n store: config.store,\n bearer: config.bearer,\n ...(config.serverUrl === null ? { fetch: deviceOnlyFetch } : {}),\n generateSecret: () => formatAuthSecret(generateSecret()),\n mintToken: (secret, audience) =>\n mintToken(parseAuthSecret(secret), audience, 3600, Math.floor(Date.now() / 1000)),\n });\n}\n"]}
|
|
@@ -2,13 +2,12 @@ export { useCoState, useAccount, useSuspenseCoState, useSuspenseAccount, JazzRea
|
|
|
2
2
|
export { Db } from "./create-db.js";
|
|
3
3
|
export { type SnapshotRef, parseSnapshotRef, serializeSnapshotRef, SnapshotRefFormatError, UnsupportedSnapshotError, } from "../runtime/snapshot-ref.js";
|
|
4
4
|
export type { JazzClient } from "./create-jazz-client.js";
|
|
5
|
-
export { JazzProvider, type JazzProviderProps, JazzClientProvider, type JazzClientProviderProps, useDb, useJazzClient,
|
|
5
|
+
export { JazzProvider, type JazzProviderProps, JazzClientProvider, type JazzClientProviderProps, useDb, useJazzClient, } from "./provider.js";
|
|
6
6
|
export { useAll, useAllSuspense, type UseAllResult, type UseAllSuspenseResult } from "./use-all.js";
|
|
7
7
|
export { useOne, useOneSuspense, type UseOneResult, type UseOneSuspenseResult } from "./use-one.js";
|
|
8
8
|
export type { QueryOptions, RuntimeSourcesConfig } from "../runtime/index.js";
|
|
9
9
|
export { bindApp } from "../typed-app.js";
|
|
10
10
|
export type { AppTypes, ComputedImpl, TransformImpl, RowOf, InsertOf, WhereOf, App, } from "../typed-app.js";
|
|
11
|
-
export { schema, migration } from "../removed-schema-api.js";
|
|
12
11
|
export { REACT_NATIVE_MEMORY_RUNTIME_UNSUPPORTED_ERROR, REACT_NATIVE_NATIVE_RELAY_MEMORY_ONLY_ERROR, REACT_NATIVE_NATIVE_RELAY_REQUIRED_ERROR, REACT_NATIVE_UNSUPPORTED_ERROR, REACT_NATIVE_WEB_UNSUPPORTED_ERROR, } from "./errors.js";
|
|
13
12
|
export { UnsupportedStorageCodecsError, isUnsupportedStorageCodecsError, } from "../runtime/unsupported-storage-codecs-error.js";
|
|
14
13
|
export { useSyncStatus } from "../react-core/use-sync-status.js";
|
|
@@ -18,5 +17,4 @@ export { createJazzClient, startJazzClient, type JazzClientConfig } from "./crea
|
|
|
18
17
|
export type { JazzSession, JazzSessionSnapshot, JazzSessionErrorViewProps, JazzSessionOperation, JazzUser, } from "../session/jazz-session.js";
|
|
19
18
|
export { useJazzSession, type UseJazzSessionResult, type JazzSessionViewProps, } from "../react-core/session.js";
|
|
20
19
|
export type { ForwardRelationship, ReverseRelationship, Relationship, Relationships, } from "../relationships.js";
|
|
21
|
-
export { AccountManager, JazzSessionProvider, createAccountManager, createDb, exportLocalFirstSecret, useAccountState, useJazzAuth, useJazzSessionOwner, useLocalFirstAuth, } from "../removed-api.js";
|
|
22
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react-native/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EACL,KAAK,WAAW,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,KAAK,EACL,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react-native/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EACL,KAAK,WAAW,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,kBA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
export { useCoState, useAccount, useSuspenseCoState, useSuspenseAccount, JazzReactNativeProvider, } from "../classic-api.js";
|
|
2
2
|
export { Db } from "./create-db.js";
|
|
3
3
|
export { parseSnapshotRef, serializeSnapshotRef, SnapshotRefFormatError, UnsupportedSnapshotError, } from "../runtime/snapshot-ref.js";
|
|
4
|
-
export { JazzProvider, JazzClientProvider, useDb, useJazzClient,
|
|
4
|
+
export { JazzProvider, JazzClientProvider, useDb, useJazzClient, } from "./provider.js";
|
|
5
5
|
export { useAll, useAllSuspense } from "./use-all.js";
|
|
6
6
|
export { useOne, useOneSuspense } from "./use-one.js";
|
|
7
7
|
// jazz.generated.ts imports bindApp from "jazz-tools", which resolves here on React Native.
|
|
8
8
|
export { bindApp } from "../typed-app.js";
|
|
9
|
-
// Removed in alpha.65 (files as source): stubs that throw, pointing at `jazz-tools upgrade`.
|
|
10
|
-
export { schema, migration } from "../removed-schema-api.js";
|
|
11
9
|
export { REACT_NATIVE_MEMORY_RUNTIME_UNSUPPORTED_ERROR, REACT_NATIVE_NATIVE_RELAY_MEMORY_ONLY_ERROR, REACT_NATIVE_NATIVE_RELAY_REQUIRED_ERROR, REACT_NATIVE_UNSUPPORTED_ERROR, REACT_NATIVE_WEB_UNSUPPORTED_ERROR, } from "./errors.js";
|
|
12
10
|
export { UnsupportedStorageCodecsError, isUnsupportedStorageCodecsError, } from "../runtime/unsupported-storage-codecs-error.js";
|
|
13
11
|
export { useSyncStatus } from "../react-core/use-sync-status.js";
|
|
14
12
|
export * from "../accounts/exports.js";
|
|
15
13
|
export { createJazzClient, startJazzClient } from "./create-jazz-session.js";
|
|
16
14
|
export { useJazzSession, } from "../react-core/session.js";
|
|
17
|
-
// Removed in alpha.61: stubs that throw, naming the replacement (one release).
|
|
18
|
-
export { AccountManager, JazzSessionProvider, createAccountManager, createDb, exportLocalFirstSecret, useAccountState, useJazzAuth, useJazzSessionOwner, useLocalFirstAuth, } from "../removed-api.js";
|
|
19
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react-native/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAEL,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,YAAY,EAEZ,kBAAkB,EAElB,KAAK,EACL,aAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react-native/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAEL,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,YAAY,EAEZ,kBAAkB,EAElB,KAAK,EACL,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAgD,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,MAAM,EAAE,cAAc,EAAgD,MAAM,cAAc,CAAC;AAEpG,4FAA4F;AAC5F,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAU1C,OAAO,EACL,6CAA6C,EAC7C,2CAA2C,EAC3C,wCAAwC,EACxC,8BAA8B,EAC9B,kCAAkC,GACnC,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,6BAA6B,EAC7B,+BAA+B,GAChC,MAAM,gDAAgD,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAGjE,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAyB,MAAM,0BAA0B,CAAC;AAQpG,OAAO,EACL,cAAc,GAGf,MAAM,0BAA0B,CAAC","sourcesContent":["export {\n useCoState,\n useAccount,\n useSuspenseCoState,\n useSuspenseAccount,\n JazzReactNativeProvider,\n} from \"../classic-api.js\";\nexport { Db } from \"./create-db.js\";\nexport {\n type SnapshotRef,\n parseSnapshotRef,\n serializeSnapshotRef,\n SnapshotRefFormatError,\n UnsupportedSnapshotError,\n} from \"../runtime/snapshot-ref.js\";\nexport type { JazzClient } from \"./create-jazz-client.js\";\nexport {\n JazzProvider,\n type JazzProviderProps,\n JazzClientProvider,\n type JazzClientProviderProps,\n useDb,\n useJazzClient,\n} from \"./provider.js\";\nexport { useAll, useAllSuspense, type UseAllResult, type UseAllSuspenseResult } from \"./use-all.js\";\nexport { useOne, useOneSuspense, type UseOneResult, type UseOneSuspenseResult } from \"./use-one.js\";\nexport type { QueryOptions, RuntimeSourcesConfig } from \"../runtime/index.js\";\n// jazz.generated.ts imports bindApp from \"jazz-tools\", which resolves here on React Native.\nexport { bindApp } from \"../typed-app.js\";\nexport type {\n AppTypes,\n ComputedImpl,\n TransformImpl,\n RowOf,\n InsertOf,\n WhereOf,\n App,\n} from \"../typed-app.js\";\nexport {\n REACT_NATIVE_MEMORY_RUNTIME_UNSUPPORTED_ERROR,\n REACT_NATIVE_NATIVE_RELAY_MEMORY_ONLY_ERROR,\n REACT_NATIVE_NATIVE_RELAY_REQUIRED_ERROR,\n REACT_NATIVE_UNSUPPORTED_ERROR,\n REACT_NATIVE_WEB_UNSUPPORTED_ERROR,\n} from \"./errors.js\";\nexport {\n UnsupportedStorageCodecsError,\n isUnsupportedStorageCodecsError,\n} from \"../runtime/unsupported-storage-codecs-error.js\";\n\nexport { useSyncStatus } from \"../react-core/use-sync-status.js\";\nexport type { LinkStatus, SyncStatus } from \"../runtime/sync-status.js\";\n\nexport * from \"../accounts/exports.js\";\n\nexport { createJazzClient, startJazzClient, type JazzClientConfig } from \"./create-jazz-session.js\";\nexport type {\n JazzSession,\n JazzSessionSnapshot,\n JazzSessionErrorViewProps,\n JazzSessionOperation,\n JazzUser,\n} from \"../session/jazz-session.js\";\nexport {\n useJazzSession,\n type UseJazzSessionResult,\n type JazzSessionViewProps,\n} from \"../react-core/session.js\";\n\nexport type {\n ForwardRelationship,\n ReverseRelationship,\n Relationship,\n Relationships,\n} from \"../relationships.js\";\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { PublicSession } from "../runtime/context.js";
|
|
2
2
|
import type { Db } from "../runtime/db.js";
|
|
3
|
-
import { useSession } from "../react-core/provider.js";
|
|
4
3
|
import { type JazzSessionSourceProps, type JazzSessionViewProps } from "../react-core/session.js";
|
|
5
4
|
import type { SessionCore } from "../session/state.js";
|
|
6
5
|
import { type JazzClientConfig } from "./create-jazz-session.js";
|
|
@@ -21,7 +20,6 @@ export type JazzProviderProps = JazzSessionSourceProps<JazzClientConfig, Created
|
|
|
21
20
|
export declare function JazzProvider(props: JazzProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
22
21
|
export declare function useJazzClient(): JazzClientContextValue;
|
|
23
22
|
export declare function useDb(): Db;
|
|
24
|
-
export { useSession };
|
|
25
23
|
export type { JazzClientContextValue };
|
|
26
24
|
/** @internal The provider shared by React Native and Expo, with native default views. */
|
|
27
25
|
export declare function NativeJazzProvider<Config>(props: JazzSessionSourceProps<Config, CreatedJazzClient> & JazzSessionViewProps<CreatedJazzClient> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/react-native/provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { View, Text, Pressable } from "react-native";
|
|
3
|
-
import { useDb as useCoreDb, useJazzClient as useCoreJazzClient
|
|
3
|
+
import { useDb as useCoreDb, useJazzClient as useCoreJazzClient } from "../react-core/provider.js";
|
|
4
4
|
import { JazzSessionProvider, } from "../react-core/session.js";
|
|
5
5
|
import { refuseRemovedProviderProps } from "../react/provider-props.js";
|
|
6
6
|
import { assertNoClassicProviderProps } from "../classic-api.js";
|
|
@@ -21,7 +21,6 @@ export function useJazzClient() {
|
|
|
21
21
|
export function useDb() {
|
|
22
22
|
return useCoreDb();
|
|
23
23
|
}
|
|
24
|
-
export { useSession };
|
|
25
24
|
/** @internal The provider shared by React Native and Expo, with native default views. */
|
|
26
25
|
export function NativeJazzProvider(props) {
|
|
27
26
|
assertNoClassicProviderProps("JazzProvider", props);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/react-native/provider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGrD,OAAO,
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/react-native/provider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGrD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnG,OAAO,EACL,mBAAmB,GAGpB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAyB,MAAM,0BAA0B,CAAC;AAGxF,OAAO,EAAE,kBAAkB,EAAgC,MAAM,2BAA2B,CAAC;AAW7F;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,OAAO,KAAC,kBAAkB,OAAK,KAAK,EAAE,QAAQ,EAAE,qBAAqB,GAAI,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,iBAAiB,EAA4B,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,KAAK;IACnB,OAAO,SAAS,EAAM,CAAC;AACzB,CAAC;AAID,yFAAyF;AACzF,MAAM,UAAU,kBAAkB,CAChC,KAGG;IAEH,4BAA4B,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACpD,0BAA0B,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC1C,OAAO,CACL,KAAC,mBAAmB,OACd,IAAI,EACR,OAAO,EACL,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CACtB,KAAC,IAAI,cACH,KAAC,IAAI,gCAAgB,GAChB,CACR,CAAC,CAAC,CAAC,CACF,OAAO,CACR,EAEH,KAAK,EACH,KAAK,KAAK,SAAS;YACjB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CACb,MAAC,IAAI,IAAC,iBAAiB,EAAC,OAAO,aAC7B,KAAC,IAAI,8DAA8C,EACnD,KAAC,SAAS,IAAC,iBAAiB,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,KAAK,EAAE,YAC/D,KAAC,IAAI,4BAAiB,GACZ,IACP,CACR;YACH,CAAC,CAAC,KAAK,GAEX,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { View, Text, Pressable } from \"react-native\";\nimport type { PublicSession } from \"../runtime/context.js\";\nimport type { Db } from \"../runtime/db.js\";\nimport { useDb as useCoreDb, useJazzClient as useCoreJazzClient } from \"../react-core/provider.js\";\nimport {\n JazzSessionProvider,\n type JazzSessionSourceProps,\n type JazzSessionViewProps,\n} from \"../react-core/session.js\";\nimport type { SessionCore } from \"../session/state.js\";\nimport { refuseRemovedProviderProps } from \"../react/provider-props.js\";\nimport { assertNoClassicProviderProps } from \"../classic-api.js\";\nimport { openNativeSessionCore, type JazzClientConfig } from \"./create-jazz-session.js\";\nimport type { JazzClient as CreatedJazzClient } from \"./create-jazz-client.js\";\n\nexport { JazzClientProvider, type JazzClientProviderProps } from \"../react-core/provider.js\";\n\ninterface JazzClientContextValue {\n db: Db;\n session: PublicSession | null;\n shutdown: CreatedJazzClient[\"shutdown\"];\n}\n\nexport type JazzProviderProps = JazzSessionSourceProps<JazzClientConfig, CreatedJazzClient> &\n JazzSessionViewProps<CreatedJazzClient>;\n\n/**\n * Jazz for a React Native app: owns a session (`config`) or shows yours\n * (`session`), renders `children` with its client once someone is signed in,\n * and `signedOut`, `loading` or `error` otherwise. Read the session anywhere\n * below with `useJazzSession()`.\n */\nexport function JazzProvider(props: JazzProviderProps) {\n return <NativeJazzProvider {...props} openCore={openNativeSessionCore} />;\n}\n\nexport function useJazzClient(): JazzClientContextValue {\n return useCoreJazzClient() as JazzClientContextValue;\n}\n\nexport function useDb(): Db {\n return useCoreDb<Db>();\n}\n\nexport type { JazzClientContextValue };\n\n/** @internal The provider shared by React Native and Expo, with native default views. */\nexport function NativeJazzProvider<Config>(\n props: JazzSessionSourceProps<Config, CreatedJazzClient> &\n JazzSessionViewProps<CreatedJazzClient> & {\n openCore: (config: Config) => Promise<SessionCore<CreatedJazzClient>>;\n },\n) {\n assertNoClassicProviderProps(\"JazzProvider\", props);\n refuseRemovedProviderProps(props);\n const { loading, error, ...rest } = props;\n return (\n <JazzSessionProvider\n {...rest}\n loading={\n loading === undefined ? (\n <View>\n <Text>Loading…</Text>\n </View>\n ) : (\n loading\n )\n }\n error={\n error === undefined\n ? ({ retry }) => (\n <View accessibilityRole=\"alert\">\n <Text>Jazz couldn’t start. Please try again.</Text>\n <Pressable accessibilityRole=\"button\" onPress={() => void retry()}>\n <Text>Try again</Text>\n </Pressable>\n </View>\n )\n : error\n }\n />\n );\n}\n"]}
|
package/dist/runtime/db.d.ts
CHANGED
|
@@ -580,11 +580,6 @@ export declare class Db {
|
|
|
580
580
|
ttlSeconds?: number;
|
|
581
581
|
audience?: string;
|
|
582
582
|
}): string | null;
|
|
583
|
-
/** @deprecated Renamed to {@link getDeviceAccountProof}; this alias goes in a later release. */
|
|
584
|
-
getLocalFirstIdentityProof(options?: {
|
|
585
|
-
ttlSeconds?: number;
|
|
586
|
-
audience?: string;
|
|
587
|
-
}): string | null;
|
|
588
583
|
/** @internal This Db's own runtime's auth state changes, which never move to a successor. */
|
|
589
584
|
onOwnAuthChanged(listener: (state: AuthState) => void): () => void;
|
|
590
585
|
onAuthChanged(listener: (state: AuthState) => void): () => void;
|