monoidentity 0.31.0 → 0.31.2
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/dist/+index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
export { SYNC_REQUEST_EVENT, STORAGE_EVENT } from './storageclient.svelte.js';
|
|
1
2
|
export declare const getLoginRecognized: () => {
|
|
2
3
|
email: string;
|
|
3
4
|
password: string;
|
|
4
5
|
};
|
|
5
6
|
export declare const setLoginRecognized: (login: string) => void;
|
|
6
7
|
export declare const openHub: (path: string) => never;
|
|
8
|
+
export declare const relog: () => never;
|
|
7
9
|
export declare const getStorage: (realm: "config" | "userdata" | "cache" | (string & {})) => Record<string, any>;
|
|
8
10
|
export declare const getScopedFS: (dir: string) => Record<string, any>;
|
package/dist/+index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { parse as useSchema } from 'valibot';
|
|
|
3
3
|
import { decode } from 'base36-esm';
|
|
4
4
|
import { storageClient } from './storageclient.svelte.js';
|
|
5
5
|
import { object, pipe, email, string } from 'valibot';
|
|
6
|
+
export { SYNC_REQUEST_EVENT, STORAGE_EVENT } from './storageclient.svelte.js';
|
|
6
7
|
const loginSchema = object({ email: pipe(string(), email()), password: string() });
|
|
7
8
|
const LOGIN_RECOGNIZED_PATH = '.local/login.encjson';
|
|
8
9
|
export const getLoginRecognized = () => {
|
|
@@ -31,6 +32,7 @@ export const openHub = (path) => {
|
|
|
31
32
|
location.href = target.toString();
|
|
32
33
|
throw new Error('relogging');
|
|
33
34
|
};
|
|
35
|
+
export const relog = () => openHub(MONOIDENTITY_APP_ID);
|
|
34
36
|
export const getStorage = (realm) => {
|
|
35
37
|
const prefix = `.${realm}/${MONOIDENTITY_APP_ID}/`;
|
|
36
38
|
return storageClient((key) => `${prefix}${key}.devalue`, (key) => (key.startsWith(prefix) ? key.slice(prefix.length, -'.devalue'.length) : undefined), stringify, parse);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const SYNC_REQUEST_EVENT = 'monoidentity-sync-request';
|
|
2
|
-
const STORAGE_EVENT = 'monoidentity-storage';
|
|
1
|
+
export const SYNC_REQUEST_EVENT = 'monoidentity-sync-request';
|
|
2
|
+
export const STORAGE_EVENT = 'monoidentity-storage';
|
|
3
3
|
const waitForSync = async (key) => {
|
|
4
4
|
await new Promise((resolve, reject) => window.dispatchEvent(new CustomEvent(SYNC_REQUEST_EVENT, { detail: { key, resolve, reject } })));
|
|
5
5
|
};
|