monoidentity 0.21.0 → 0.21.1

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/readyup.js CHANGED
@@ -5,7 +5,7 @@ import {} from "./utils-transport.js";
5
5
  import { conf, setLoginRecognized } from "./storage.js";
6
6
  import { pullFromLocalBackup } from "./storage/backuplocally-pull.js";
7
7
  import { mountLocalBackupPush } from "./storage/backuplocally-push.js";
8
- import { createCloudClient } from "./storage/backupcloud-shared.js";
8
+ import { createCloudClient } from "./storage/backupcloud-connection.js";
9
9
  import { mountCloudPull, pullFromCloud } from "./storage/backupcloud-pull.js";
10
10
  import { mountCloudPush } from "./storage/backupcloud-push.js";
11
11
  import { switchToHub } from "./utils-hub.js";
@@ -0,0 +1,3 @@
1
+ export declare const isPlainTextCloudObject: (key: string) => boolean;
2
+ export declare const encodeCloudContent: (key: string, value: string) => string | Uint8Array<ArrayBuffer>;
3
+ export declare const decodeCloudContent: (key: string, response: Response) => Promise<string>;
@@ -0,0 +1,23 @@
1
+ export const isPlainTextCloudObject = (key) => key.endsWith(".md") || key.endsWith(".devalue");
2
+ export const encodeCloudContent = (key, value) => {
3
+ if (isPlainTextCloudObject(key)) {
4
+ return value;
5
+ }
6
+ const bytes = new Uint8Array(value.length);
7
+ for (let i = 0; i < value.length; i++) {
8
+ bytes[i] = value.charCodeAt(i);
9
+ }
10
+ return bytes;
11
+ };
12
+ export const decodeCloudContent = async (key, response) => {
13
+ if (isPlainTextCloudObject(key)) {
14
+ return response.text();
15
+ }
16
+ const buf = new Uint8Array(await response.arrayBuffer());
17
+ let content = "";
18
+ const chunk = 8192;
19
+ for (let i = 0; i < buf.length; i += chunk) {
20
+ content += String.fromCharCode.apply(null, buf.subarray(i, i + chunk));
21
+ }
22
+ return content;
23
+ };
@@ -3,6 +3,7 @@ import { addSync } from "./utils-sync.js";
3
3
  import { shouldPersist } from "./utils-storage.js";
4
4
  import { get, set } from "idb-keyval";
5
5
  import { store } from "./utils-idb.js";
6
+ import { decodeCloudContent } from "./_backupcloud.js";
6
7
  const CLOUD_CACHE_KEY = "cloud-cache";
7
8
  let cache;
8
9
  const initCache = async () => {
@@ -46,18 +47,7 @@ const loadFromCloud = async (getSyncStrategy, base, client) => {
46
47
  const r = await client(`${base}/${key}`);
47
48
  if (!r.ok)
48
49
  throw new Error(`Fetch ${key} failed: ${r.status}`);
49
- let content;
50
- if (key.endsWith(".md") || key.endsWith(".devalue")) {
51
- content = await r.text();
52
- }
53
- else {
54
- const buf = new Uint8Array(await r.arrayBuffer());
55
- content = "";
56
- const chunk = 8192;
57
- for (let i = 0; i < buf.length; i += chunk) {
58
- content += String.fromCharCode.apply(null, buf.subarray(i, i + chunk));
59
- }
60
- }
50
+ const content = await decodeCloudContent(key, r);
61
51
  model[key] = content;
62
52
  nextCache[key] = { etag, content };
63
53
  }));
@@ -2,6 +2,7 @@ import { STORAGE_EVENT } from "./storageclient.svelte.js";
2
2
  import { addSync, scheduleSync } from "./utils-sync.js";
3
3
  import { shouldPersist } from "./utils-storage.js";
4
4
  import { setCloudCacheEntry } from "./backupcloud-pull.js";
5
+ import { encodeCloudContent } from "./_backupcloud.js";
5
6
  const write = async (key, value, bucket, client) => {
6
7
  console.debug("[monoidentity cloud] saving", key);
7
8
  const url = `${bucket.base}/${key}`;
@@ -9,7 +10,7 @@ const write = async (key, value, bucket, client) => {
9
10
  const r = await client(url, {
10
11
  method: "PUT",
11
12
  headers: { "content-type": "application/octet-stream" },
12
- body: value,
13
+ body: encodeCloudContent(key, value),
13
14
  });
14
15
  if (!r.ok)
15
16
  throw new Error(`PUT ${key} failed: ${r.status}`);
@@ -1,3 +1,5 @@
1
+ import "devalue";
2
+
1
3
  //#region src/lib/verification/use-studentvue.remote.ts
2
4
  async function use_studentvue_remote_default(arg, init) {
3
5
  const res = await fetch("https://monoserve-by45xe47vq-uc.a.run.app/use-studentvue:d6da", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monoidentity",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "license": "ISC",
5
5
  "repository": "KTibow/monoidentity",
6
6
  "author": {
@@ -31,29 +31,29 @@
31
31
  "svelte": "^5.0.0"
32
32
  },
33
33
  "dependencies": {
34
- "@tsndr/cloudflare-worker-jwt": "^3.2.0",
34
+ "@tsndr/cloudflare-worker-jwt": "^3.2.1",
35
35
  "aws4fetch": "^1.0.20",
36
- "devalue": "^5.5.0",
36
+ "devalue": "^5.6.2",
37
37
  "fast-studentvue": "^2.1.1",
38
38
  "idb-keyval": "^6.2.2",
39
- "valibot": "^1.1.0"
39
+ "valibot": "^1.2.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@sveltejs/adapter-static": "^3.0.10",
43
- "@sveltejs/kit": "^2.48.5",
44
- "@sveltejs/package": "^2.5.4",
45
- "@sveltejs/vite-plugin-svelte": "^6.2.1",
43
+ "@sveltejs/kit": "^2.51.0",
44
+ "@sveltejs/package": "^2.5.7",
45
+ "@sveltejs/vite-plugin-svelte": "^6.2.4",
46
46
  "@types/wicg-file-system-access": "^2023.10.7",
47
- "knip": "^5.69.1",
48
- "monoserve": "^3.2.2",
49
- "publint": "^0.3.15",
50
- "rolldown": "^1.0.0-beta.47",
47
+ "knip": "^5.83.1",
48
+ "monoserve": "^3.2.3",
49
+ "publint": "^0.3.17",
50
+ "rolldown": "1.0.0-rc.4",
51
51
  "school-districts": "^5.0.1",
52
- "svelte": "^5.43.6",
53
- "svelte-check": "^4.3.4",
52
+ "svelte": "^5.51.0",
53
+ "svelte-check": "^4.4.0",
54
54
  "tinyglobby": "^0.2.15",
55
55
  "typescript": "^5.9.3",
56
- "vite": "^7.2.2"
56
+ "vite": "^7.3.1"
57
57
  },
58
58
  "keywords": [
59
59
  "svelte"