jazz-react-native 0.9.4 → 0.9.6

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > jazz-react-native@0.9.4 build /home/runner/work/jazz/jazz/packages/jazz-react-native
2
+ > jazz-react-native@0.9.6 build /home/runner/work/jazz/jazz/packages/jazz-react-native
3
3
  > rm -rf ./dist && tsc --sourceMap --outDir dist
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # jazz-browser
2
2
 
3
+ ## 0.9.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 8a390d2: Fix the account type registration using the sources for the typescript definitions
8
+
9
+ ## 0.9.5
10
+
11
+ ### Patch Changes
12
+
13
+ - c871912: Add clearUserCredentials API to programmatically delete the current user stored credentials
14
+
3
15
  ## 0.9.4
4
16
 
5
17
  ### Patch Changes
package/dist/auth/auth.js CHANGED
@@ -1,2 +1,11 @@
1
+ import KvStoreContext from "../storage/kv-store-context.js";
1
2
  export * from "./DemoAuthUI.js";
3
+ export function clearUserCredentials() {
4
+ const kvStore = KvStoreContext.getInstance().getStorage();
5
+ // TODO: Migrate the Auth methods to use the same storage key/interface
6
+ return Promise.all([
7
+ kvStore.delete("demo-auth-logged-in-secret"),
8
+ kvStore.delete("jazz-clerk-auth"),
9
+ ]);
10
+ }
2
11
  //# sourceMappingURL=auth.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth/auth.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth/auth.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,gCAAgC,CAAC;AAE5D,cAAc,iBAAiB,CAAC;AAEhC,MAAM,UAAU,oBAAoB;IAClC,MAAM,OAAO,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC,UAAU,EAAE,CAAC;IAE1D,uEAAuE;IACvE,OAAO,OAAO,CAAC,GAAG,CAAC;QACjB,OAAO,CAAC,MAAM,CAAC,4BAA4B,CAAC;QAC5C,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC;KAClC,CAAC,CAAC;AACL,CAAC"}
package/dist/provider.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { JazzContext } from "jazz-react-core";
2
2
  import { Account } from "jazz-tools";
3
- import { useState } from "react";
3
+ import React, { useState } from "react";
4
4
  import { useEffect, useRef } from "react";
5
5
  import { createJazzRNContext, } from "./platform.js";
6
6
  /** @category Context & Hooks */
@@ -1 +1 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAA4B,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAEL,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAgBvB,gCAAgC;AAChC,MAAM,UAAU,YAAY,CAA0C,EACpE,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,aAAa,GAAG,OAAuC,EACvD,cAAc,EACd,OAAO,GACgB;IACvB,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,EAAoC,CAAC;IAEnE,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEpD,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACrC,cAAc,CAAC,OAAO,GAAG,KAAK,CAAC;IAE/B,SAAS,CAAC,GAAG,EAAE;QACb,iFAAiF;QACjF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;YAC3C,IAAI,cA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C,EAAE,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IAE9C,OAAO,CACL,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,QAAQ,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAC3E,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jazz-react-native",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -9,17 +9,17 @@
9
9
  "exports": {
10
10
  ".": {
11
11
  "react-native": "./dist/index.js",
12
- "types": "./dist/index.d.ts",
12
+ "types": "./src/index.ts",
13
13
  "default": "./dist/index.js"
14
14
  },
15
15
  "./crypto": {
16
16
  "react-native": "./dist/crypto/index.js",
17
- "types": "./dist/crypto/index.d.ts",
17
+ "types": "./src/crypto/index.ts",
18
18
  "default": "./dist/crypto/index.js"
19
19
  },
20
20
  "./testing": {
21
21
  "react-native": "./dist/testing.js",
22
- "types": "./dist/testing.d.ts",
22
+ "types": "./src/testing.ts",
23
23
  "default": "./dist/testing.js"
24
24
  }
25
25
  },
@@ -27,11 +27,11 @@
27
27
  "dependencies": {
28
28
  "@scure/base": "1.2.1",
29
29
  "react-native-quick-crypto": "1.0.0-beta.9",
30
+ "jazz-react-core": "0.8.48",
30
31
  "cojson": "0.9.0",
31
32
  "cojson-transport-ws": "0.9.0",
32
- "cojson-storage-rn-sqlite": "0.8.51",
33
33
  "jazz-tools": "0.9.1",
34
- "jazz-react-core": "0.8.48"
34
+ "cojson-storage-rn-sqlite": "0.8.51"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@react-native-community/netinfo": "*",
package/src/auth/auth.ts CHANGED
@@ -1 +1,13 @@
1
+ import KvStoreContext from "../storage/kv-store-context.js";
2
+
1
3
  export * from "./DemoAuthUI.js";
4
+
5
+ export function clearUserCredentials() {
6
+ const kvStore = KvStoreContext.getInstance().getStorage();
7
+
8
+ // TODO: Migrate the Auth methods to use the same storage key/interface
9
+ return Promise.all([
10
+ kvStore.delete("demo-auth-logged-in-secret"),
11
+ kvStore.delete("jazz-clerk-auth"),
12
+ ]);
13
+ }
package/src/provider.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import { JazzContext, JazzContextType } from "jazz-react-core";
2
2
  import { Account, AccountClass, AuthMethod } from "jazz-tools";
3
- import { useState } from "react";
3
+ import React, { useState } from "react";
4
4
  import { useEffect, useRef } from "react";
5
5
  import {
6
6
  BaseReactNativeContextOptions,
package/tsconfig.json CHANGED
@@ -10,8 +10,7 @@
10
10
  "jsx": "react-native",
11
11
  "forceConsistentCasingInFileNames": true,
12
12
  "noUncheckedIndexedAccess": true,
13
- "esModuleInterop": true,
14
- "declaration": true
13
+ "esModuleInterop": true
15
14
  },
16
15
  "include": ["./src/**/*"]
17
16
  }
@@ -1,30 +0,0 @@
1
- import { AgentSecret } from "cojson";
2
- import { Account, AuthMethod, AuthResult, ID } from "jazz-tools";
3
- import { KvStore } from "../storage/kv-store-context.js";
4
- /** @category Auth Providers */
5
- export declare namespace RNDemoAuth {
6
- interface Driver {
7
- onReady: (next: {
8
- signUp: (username: string) => Promise<void>;
9
- getExistingUsers: () => Promise<string[]>;
10
- logInAs: (existingUser: string) => Promise<void>;
11
- }) => void;
12
- onSignedIn: (next: {
13
- logOut: () => void;
14
- }) => void;
15
- onError: (error: string | Error) => void;
16
- }
17
- }
18
- export declare function encodeUsername(username: string): string;
19
- export declare class RNDemoAuth implements AuthMethod {
20
- private driver;
21
- private kvStore;
22
- private constructor();
23
- static init(driver: RNDemoAuth.Driver, seedAccounts?: {
24
- [name: string]: {
25
- accountID: ID<Account>;
26
- accountSecret: AgentSecret;
27
- };
28
- }, store?: KvStore | undefined): Promise<RNDemoAuth>;
29
- start(): Promise<AuthResult>;
30
- }
@@ -1,35 +0,0 @@
1
- import { AgentSecret } from "cojson";
2
- import { Account, ID } from "jazz-tools";
3
- import React from "react";
4
- import { KvStore } from "../storage/kv-store-context.js";
5
- import { RNDemoAuth } from "./DemoAuthMethod.js";
6
- type DemoAuthState = ({
7
- state: "uninitialized";
8
- } | {
9
- state: "loading";
10
- } | {
11
- state: "ready";
12
- existingUsers: string[];
13
- signUp: (username: string) => void;
14
- logInAs: (existingUser: string) => void;
15
- } | {
16
- state: "signedIn";
17
- logOut: () => void;
18
- }) & {
19
- errors: string[];
20
- };
21
- /** @category Auth Providers */
22
- export declare function useDemoAuth({ seedAccounts, store, }?: {
23
- seedAccounts?: {
24
- [name: string]: {
25
- accountID: ID<Account>;
26
- accountSecret: AgentSecret;
27
- };
28
- };
29
- store?: KvStore;
30
- }): readonly [RNDemoAuth | null, DemoAuthState];
31
- export declare const DemoAuthBasicUI: ({ appName, state, }: {
32
- appName: string;
33
- state: DemoAuthState;
34
- }) => React.JSX.Element;
35
- export {};
@@ -1 +0,0 @@
1
- export * from "./DemoAuthUI.js";
@@ -1,5 +0,0 @@
1
- import { Peer } from "cojson";
2
- export declare function createWebSocketPeerWithReconnection(peer: string, reconnectionTimeout: number | undefined, addPeer: (peer: Peer) => void): {
3
- peer: Peer;
4
- done: () => void;
5
- };
@@ -1,12 +0,0 @@
1
- import { JsonValue, PureJSCrypto } from "cojson/native";
2
- import { CojsonInternalTypes } from "cojson/native";
3
- import { Ed } from "react-native-quick-crypto";
4
- export declare class RNQuickCrypto extends PureJSCrypto {
5
- ed: Ed;
6
- constructor();
7
- static create(): Promise<RNQuickCrypto>;
8
- newEd25519SigningKey(): Uint8Array;
9
- getSignerID(secret: CojsonInternalTypes.SignerSecret): CojsonInternalTypes.SignerID;
10
- sign(secret: CojsonInternalTypes.SignerSecret, message: JsonValue): CojsonInternalTypes.Signature;
11
- verify(signature: CojsonInternalTypes.Signature, message: JsonValue, id: CojsonInternalTypes.SignerID): boolean;
12
- }
@@ -1 +0,0 @@
1
- export { RNQuickCrypto } from "./RNQuickCrypto.js";