monoidentity 0.5.2 → 0.6.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/dist/storage.d.ts +2 -1
- package/dist/storage.js +3 -2
- package/dist/trackready.js +16 -11
- package/dist/utils-callback.d.ts +8 -9
- package/dist/utils-callback.js +0 -6
- package/dist/utils-scope.d.ts +3 -6
- package/dist/utils-scope.js +3 -6
- package/package.json +4 -2
package/dist/storage.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Login } from "./utils-callback.js";
|
|
2
2
|
export declare const setup: (i: Record<string, string>, a: string) => void;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const LOGIN_RECOGNIZED_PATH = ".core/login.encjson";
|
|
4
|
+
export declare const getLoginRecognized: () => Login;
|
|
4
5
|
export declare const getStorage: (realm: "config" | "cache") => Record<string, any>;
|
package/dist/storage.js
CHANGED
|
@@ -7,10 +7,11 @@ export const setup = (i, a) => {
|
|
|
7
7
|
implementation = i;
|
|
8
8
|
app = a;
|
|
9
9
|
};
|
|
10
|
-
export const
|
|
10
|
+
export const LOGIN_RECOGNIZED_PATH = ".core/login.encjson";
|
|
11
|
+
export const getLoginRecognized = () => {
|
|
11
12
|
if (!implementation)
|
|
12
13
|
throw new Error("No implementation set");
|
|
13
|
-
const login = implementation[
|
|
14
|
+
const login = implementation[LOGIN_RECOGNIZED_PATH];
|
|
14
15
|
if (!login)
|
|
15
16
|
throw new Error("No login found");
|
|
16
17
|
return JSON.parse(decode(login));
|
package/dist/trackready.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {} from "./utils-callback.js";
|
|
2
2
|
import {} from "./utils-scope.js";
|
|
3
3
|
import { init as initLocal, wrapWithBackup } from "./_localstorage.js";
|
|
4
|
-
import { setup } from "./storage.js";
|
|
4
|
+
import { LOGIN_RECOGNIZED_PATH, setup } from "./storage.js";
|
|
5
5
|
export const trackReady = (app, scopes, requestBackup, callback) => {
|
|
6
6
|
const params = new URLSearchParams(location.hash.slice(1));
|
|
7
7
|
let memory = localStorage.monoidentityMemory
|
|
8
8
|
? JSON.parse(localStorage.monoidentityMemory)
|
|
9
9
|
: undefined;
|
|
10
|
-
let fileTasks = undefined;
|
|
11
10
|
const paramCB = params.get("monoidentitycallback");
|
|
11
|
+
let cb = [];
|
|
12
12
|
if (paramCB) {
|
|
13
13
|
history.replaceState(null, "", location.pathname);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
cb = JSON.parse(paramCB);
|
|
15
|
+
}
|
|
16
|
+
for (const task of cb) {
|
|
17
|
+
if ("setup" in task) {
|
|
18
|
+
memory = task.setup;
|
|
19
|
+
localStorage.monoidentityMemory = JSON.stringify(memory);
|
|
20
|
+
}
|
|
19
21
|
}
|
|
20
22
|
if (!memory) {
|
|
21
23
|
const params = new URLSearchParams();
|
|
@@ -38,9 +40,12 @@ export const trackReady = (app, scopes, requestBackup, callback) => {
|
|
|
38
40
|
throw new Error("unreachable");
|
|
39
41
|
}
|
|
40
42
|
setup(storage, app);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
storage[
|
|
43
|
+
for (const task of cb) {
|
|
44
|
+
if ("createLoginRecognized" in task) {
|
|
45
|
+
storage[LOGIN_RECOGNIZED_PATH] = task.createLoginRecognized;
|
|
46
|
+
}
|
|
47
|
+
else if ("createVerification" in task) {
|
|
48
|
+
storage[".core/verification.jwt"] = task.createVerification;
|
|
44
49
|
}
|
|
45
50
|
}
|
|
46
51
|
callback();
|
package/dist/utils-callback.d.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
type Setup = {
|
|
1
|
+
export type Setup = {
|
|
2
2
|
method: "cloud";
|
|
3
3
|
jwt: string;
|
|
4
4
|
} | {
|
|
5
5
|
method: "localStorage";
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
fileTasks: Record<string, string> | undefined;
|
|
7
|
+
type CallbackTask = {
|
|
8
|
+
setup: Setup;
|
|
9
|
+
} | {
|
|
10
|
+
createLoginRecognized: string;
|
|
11
|
+
} | {
|
|
12
|
+
createVerification: string;
|
|
14
13
|
};
|
|
14
|
+
export type Callback = CallbackTask[];
|
|
15
15
|
export type Login = {
|
|
16
16
|
email: string;
|
|
17
17
|
password: string;
|
|
18
18
|
};
|
|
19
19
|
export declare const canBackup: boolean;
|
|
20
|
-
export declare const rememberCallback: (data: Callback, pastMemory?: Memory) => Memory;
|
|
21
20
|
export {};
|
package/dist/utils-callback.js
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
1
|
export const canBackup = navigator.userAgent.includes("CrOS") && Boolean(window.showDirectoryPicker);
|
|
2
|
-
export const rememberCallback = (data, pastMemory) => {
|
|
3
|
-
const { connect } = data;
|
|
4
|
-
return connect.method == "cloud"
|
|
5
|
-
? { method: "cloud", jwt: connect.jwt }
|
|
6
|
-
: { method: connect.method };
|
|
7
|
-
};
|
package/dist/utils-scope.d.ts
CHANGED
package/dist/utils-scope.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monoidentity",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"repository": "KTibow/monoidentity",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "KTibow"
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"@sveltejs/package": "^2.0.0",
|
|
41
41
|
"@sveltejs/vite-plugin-svelte": "^6.0.0",
|
|
42
42
|
"@types/wicg-file-system-access": "^2023.10.6",
|
|
43
|
+
"knip": "^5.64.0",
|
|
43
44
|
"publint": "^0.3.2",
|
|
44
45
|
"svelte": "^5.0.0",
|
|
45
46
|
"svelte-check": "^4.0.0",
|
|
@@ -54,6 +55,7 @@
|
|
|
54
55
|
"build": "vite build && pnpm run prepack",
|
|
55
56
|
"preview": "vite preview",
|
|
56
57
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
57
|
-
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
|
|
58
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
59
|
+
"knip": "knip"
|
|
58
60
|
}
|
|
59
61
|
}
|