jazz-vue 0.10.15 → 0.11.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.
@@ -1 +1 @@
1
- {"version":3,"file":"provider-CkA-a4Og.js","sources":["../src/provider.ts"],"sourcesContent":["import { JazzBrowserContextManager } from \"jazz-browser\";\nimport { Account, AccountClass, JazzContextType, SyncConfig } from \"jazz-tools\";\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n PropType,\n computed,\n defineComponent,\n onMounted,\n onUnmounted,\n provide,\n ref,\n watch,\n} from \"vue\";\n\nexport const logoutHandler = ref<() => void>();\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface Register {}\n\nexport type RegisteredAccount = Register extends { Account: infer Acc }\n ? Acc\n : Account;\n\nexport const JazzContextSymbol = Symbol(\"JazzContext\");\nexport const JazzAuthContextSymbol = Symbol(\"JazzAuthContext\");\nexport const JazzProvider = defineComponent({\n name: \"JazzProvider\",\n props: {\n guestMode: {\n type: Boolean,\n default: false,\n },\n sync: {\n type: Object as PropType<SyncConfig>,\n required: true,\n },\n AccountSchema: {\n type: Function as unknown as PropType<AccountClass<RegisteredAccount>>,\n required: false,\n },\n storage: {\n type: String as PropType<\"indexedDB\" | \"singleTabOPFS\">,\n default: undefined,\n },\n defaultProfileName: {\n type: String,\n required: false,\n },\n onAnonymousAccountDiscarded: {\n type: Function as PropType<\n (anonymousAccount: RegisteredAccount) => Promise<void>\n >,\n required: false,\n },\n onLogOut: {\n type: Function as PropType<() => void>,\n required: false,\n },\n },\n setup(props, { slots }) {\n const contextManager = new JazzBrowserContextManager<RegisteredAccount>();\n const ctx = ref<JazzContextType<RegisteredAccount>>();\n\n provide(JazzContextSymbol, ctx);\n provide(JazzAuthContextSymbol, contextManager.getAuthSecretStorage());\n\n watch(\n () => ({\n peer: props.sync.peer,\n syncWhen: props.sync.when,\n storage: props.storage,\n guestMode: props.guestMode,\n }),\n async () => {\n contextManager\n .createContext({\n sync: props.sync,\n storage: props.storage,\n guestMode: props.guestMode,\n AccountSchema: props.AccountSchema,\n defaultProfileName: props.defaultProfileName,\n onAnonymousAccountDiscarded: props.onAnonymousAccountDiscarded,\n onLogOut: props.onLogOut,\n })\n .catch((error) => {\n console.error(\"Error creating Jazz browser context:\", error);\n });\n },\n { immediate: true },\n );\n\n onMounted(() => {\n const cleanup = contextManager.subscribe(() => {\n ctx.value = contextManager.getCurrentValue();\n });\n onUnmounted(cleanup);\n });\n\n onUnmounted(() => {\n if (ctx.value) ctx.value.done?.();\n });\n\n return () => (ctx.value ? slots.default?.() : null);\n },\n});\n"],"names":[],"mappings":";;AAc6B,IAAgB;AAShC,MAAA,oBAAoB,OAAO,aAAa;AACxC,MAAA,wBAAwB,OAAO,iBAAiB;AACtD,MAAM,eAAe,gBAAgB;AAAA,EAC1C,MAAM;AAAA,EACN,OAAO;AAAA,IACL,WAAW;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,UAAU;AAAA,IACZ;AAAA,IACA,eAAe;AAAA,MACb,MAAM;AAAA,MACN,UAAU;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA,oBAAoB;AAAA,MAClB,MAAM;AAAA,MACN,UAAU;AAAA,IACZ;AAAA,IACA,6BAA6B;AAAA,MAC3B,MAAM;AAAA,MAGN,UAAU;AAAA,IACZ;AAAA,IACA,UAAU;AAAA,MACR,MAAM;AAAA,MACN,UAAU;AAAA,IAAA;AAAA,EAEd;AAAA,EACA,MAAM,OAAO,EAAE,SAAS;AAChB,UAAA,iBAAiB,IAAI,0BAA6C;AACxE,UAAM,MAAM,IAAwC;AAEpD,YAAQ,mBAAmB,GAAG;AACtB,YAAA,uBAAuB,eAAe,sBAAsB;AAEpE;AAAA,MACE,OAAO;AAAA,QACL,MAAM,MAAM,KAAK;AAAA,QACjB,UAAU,MAAM,KAAK;AAAA,QACrB,SAAS,MAAM;AAAA,QACf,WAAW,MAAM;AAAA,MAAA;AAAA,MAEnB,YAAY;AACV,uBACG,cAAc;AAAA,UACb,MAAM,MAAM;AAAA,UACZ,SAAS,MAAM;AAAA,UACf,WAAW,MAAM;AAAA,UACjB,eAAe,MAAM;AAAA,UACrB,oBAAoB,MAAM;AAAA,UAC1B,6BAA6B,MAAM;AAAA,UACnC,UAAU,MAAM;AAAA,QAAA,CACjB,EACA,MAAM,CAAC,UAAU;AACR,kBAAA,MAAM,wCAAwC,KAAK;AAAA,QAAA,CAC5D;AAAA,MACL;AAAA,MACA,EAAE,WAAW,KAAK;AAAA,IACpB;AAEA,cAAU,MAAM;AACR,YAAA,UAAU,eAAe,UAAU,MAAM;AACzC,YAAA,QAAQ,eAAe,gBAAgB;AAAA,MAAA,CAC5C;AACD,kBAAY,OAAO;AAAA,IAAA,CACpB;AAED,gBAAY,MAAM;;AAChB,UAAI,IAAI,MAAW,iBAAA,OAAM,SAAN;AAAA,IAAa,CACjC;AAED,WAAO,MAAO;;AAAA,iBAAI,SAAQ,WAAM,YAAN,iCAAoB;AAAA;AAAA,EAAA;AAElD,CAAC;"}
1
+ {"version":3,"file":"provider-CkA-a4Og.js","sources":["../src/provider.ts"],"sourcesContent":["import { JazzBrowserContextManager } from \"jazz-browser\";\nimport { Account, AccountClass, JazzContextType, SyncConfig } from \"jazz-tools\";\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n PropType,\n computed,\n defineComponent,\n onMounted,\n onUnmounted,\n provide,\n ref,\n watch,\n} from \"vue\";\n\nexport const logoutHandler = ref<() => void>();\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface Register {}\n\nexport type RegisteredAccount = Register extends { Account: infer Acc }\n ? Acc\n : Account;\n\ndeclare module \"jazz-tools\" {\n export interface Register {\n Account: RegisteredAccount;\n }\n}\n\nexport const JazzContextSymbol = Symbol(\"JazzContext\");\nexport const JazzAuthContextSymbol = Symbol(\"JazzAuthContext\");\nexport const JazzProvider = defineComponent({\n name: \"JazzProvider\",\n props: {\n guestMode: {\n type: Boolean,\n default: false,\n },\n sync: {\n type: Object as PropType<SyncConfig>,\n required: true,\n },\n AccountSchema: {\n type: Function as unknown as PropType<AccountClass<RegisteredAccount>>,\n required: false,\n },\n storage: {\n type: String as PropType<\"indexedDB\" | \"singleTabOPFS\">,\n default: undefined,\n },\n defaultProfileName: {\n type: String,\n required: false,\n },\n onAnonymousAccountDiscarded: {\n type: Function as PropType<\n (anonymousAccount: RegisteredAccount) => Promise<void>\n >,\n required: false,\n },\n onLogOut: {\n type: Function as PropType<() => void>,\n required: false,\n },\n },\n setup(props, { slots }) {\n const contextManager = new JazzBrowserContextManager<RegisteredAccount>();\n const ctx = ref<JazzContextType<RegisteredAccount>>();\n\n provide(JazzContextSymbol, ctx);\n provide(JazzAuthContextSymbol, contextManager.getAuthSecretStorage());\n\n watch(\n () => ({\n peer: props.sync.peer,\n syncWhen: props.sync.when,\n storage: props.storage,\n guestMode: props.guestMode,\n }),\n async () => {\n contextManager\n .createContext({\n sync: props.sync,\n storage: props.storage,\n guestMode: props.guestMode,\n AccountSchema: props.AccountSchema,\n defaultProfileName: props.defaultProfileName,\n onAnonymousAccountDiscarded: props.onAnonymousAccountDiscarded,\n onLogOut: props.onLogOut,\n })\n .catch((error) => {\n console.error(\"Error creating Jazz browser context:\", error);\n });\n },\n { immediate: true },\n );\n\n onMounted(() => {\n const cleanup = contextManager.subscribe(() => {\n ctx.value = contextManager.getCurrentValue();\n });\n onUnmounted(cleanup);\n });\n\n onUnmounted(() => {\n if (ctx.value) ctx.value.done?.();\n });\n\n return () => (ctx.value ? slots.default?.() : null);\n },\n});\n"],"names":[],"mappings":";;AAc6B,IAAgB;AAehC,MAAA,oBAAoB,OAAO,aAAa;AACxC,MAAA,wBAAwB,OAAO,iBAAiB;AACtD,MAAM,eAAe,gBAAgB;AAAA,EAC1C,MAAM;AAAA,EACN,OAAO;A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O;AAAA,IAAA,CACpB;AAED,gBAAY,MAAM;;AAChB,UAAI,IAAI,MAAW,iBAAA,OAAM,SAAN;AAAA,IAAa,CACjC;AAED,WAAO,MAAO;;AAAA,iBAAI,SAAQ,WAAM,YAAN,iCAAoB;AAAA;AAAA,EAAA;AAElD,CAAC;"}
@@ -6,6 +6,11 @@ export interface Register {
6
6
  export type RegisteredAccount = Register extends {
7
7
  Account: infer Acc;
8
8
  } ? Acc : Account;
9
+ declare module "jazz-tools" {
10
+ interface Register {
11
+ Account: RegisteredAccount;
12
+ }
13
+ }
9
14
  export declare const JazzContextSymbol: unique symbol;
10
15
  export declare const JazzAuthContextSymbol: unique symbol;
11
16
  export declare const JazzProvider: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
@@ -69,6 +74,6 @@ export declare const JazzProvider: import('vue').DefineComponent<import('vue').E
69
74
  required: false;
70
75
  };
71
76
  }>> & Readonly<{}>, {
72
- storage: "indexedDB" | "singleTabOPFS";
73
77
  guestMode: boolean;
78
+ storage: "indexedDB" | "singleTabOPFS";
74
79
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jazz-vue",
3
- "version": "0.10.15",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "src/index.ts",
@@ -16,9 +16,9 @@
16
16
  }
17
17
  },
18
18
  "dependencies": {
19
- "cojson": "0.10.15",
20
- "jazz-browser": "0.10.15",
21
- "jazz-tools": "0.10.15"
19
+ "jazz-tools": "0.11.0",
20
+ "cojson": "0.11.0",
21
+ "jazz-browser": "0.11.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@scure/bip39": "^1.3.0",
package/src/provider.ts CHANGED
@@ -21,6 +21,12 @@ export type RegisteredAccount = Register extends { Account: infer Acc }
21
21
  ? Acc
22
22
  : Account;
23
23
 
24
+ declare module "jazz-tools" {
25
+ export interface Register {
26
+ Account: RegisteredAccount;
27
+ }
28
+ }
29
+
24
30
  export const JazzContextSymbol = Symbol("JazzContext");
25
31
  export const JazzAuthContextSymbol = Symbol("JazzAuthContext");
26
32
  export const JazzProvider = defineComponent({