monoidentity 0.12.0 → 0.12.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.
@@ -2,6 +2,7 @@ import { AwsClient } from "aws4fetch";
2
2
  import { storageClient, STORAGE_EVENT } from "./storageclient.svelte.js";
3
3
  const CLOUD_CACHE_KEY = "monoidentity-x/cloud-cache";
4
4
  const isJunk = (key) => key.includes(".obsidian/") || key.includes(".cache/");
5
+ const keepAnyway = (key) => key.includes(".cache/");
5
6
  const loadFromCloud = async (base, client) => {
6
7
  const listResp = await client.fetch(base);
7
8
  if (!listResp.ok)
@@ -47,9 +48,11 @@ const syncFromCloud = async (bucket, client) => {
47
48
  const remote = await loadFromCloud(bucket.base, client);
48
49
  const local = storageClient();
49
50
  for (const key of Object.keys(local)) {
50
- if (!(key in remote)) {
51
- delete local[key];
52
- }
51
+ if (key in remote)
52
+ continue;
53
+ if (keepAnyway(key))
54
+ continue;
55
+ delete local[key];
53
56
  }
54
57
  for (const [key, value] of Object.entries(remote)) {
55
58
  local[key] = value;
@@ -1,480 +1,5 @@
1
- //#region node_modules/.pnpm/devalue@5.3.2/node_modules/devalue/src/utils.js
2
- var DevalueError = class extends Error {
3
- /**
4
- * @param {string} message
5
- * @param {string[]} keys
6
- */
7
- constructor(message, keys) {
8
- super(message);
9
- this.name = "DevalueError";
10
- this.path = keys.join("");
11
- }
12
- };
13
- /** @param {any} thing */
14
- function is_primitive(thing) {
15
- return Object(thing) !== thing;
16
- }
17
- const object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
18
- /** @param {any} thing */
19
- function is_plain_object(thing) {
20
- const proto = Object.getPrototypeOf(thing);
21
- return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null || Object.getOwnPropertyNames(proto).sort().join("\0") === object_proto_names;
22
- }
23
- /** @param {any} thing */
24
- function get_type(thing) {
25
- return Object.prototype.toString.call(thing).slice(8, -1);
26
- }
27
- /** @param {string} char */
28
- function get_escaped_char(char) {
29
- switch (char) {
30
- case "\"": return "\\\"";
31
- case "<": return "\\u003C";
32
- case "\\": return "\\\\";
33
- case "\n": return "\\n";
34
- case "\r": return "\\r";
35
- case " ": return "\\t";
36
- case "\b": return "\\b";
37
- case "\f": return "\\f";
38
- case "\u2028": return "\\u2028";
39
- case "\u2029": return "\\u2029";
40
- default: return char < " " ? `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}` : "";
41
- }
42
- }
43
- /** @param {string} str */
44
- function stringify_string(str) {
45
- let result = "";
46
- let last_pos = 0;
47
- const len = str.length;
48
- for (let i = 0; i < len; i += 1) {
49
- const char = str[i];
50
- const replacement = get_escaped_char(char);
51
- if (replacement) {
52
- result += str.slice(last_pos, i) + replacement;
53
- last_pos = i + 1;
54
- }
55
- }
56
- return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`;
57
- }
58
- /** @param {Record<string | symbol, any>} object */
59
- function enumerable_symbols(object) {
60
- return Object.getOwnPropertySymbols(object).filter((symbol) => Object.getOwnPropertyDescriptor(object, symbol).enumerable);
61
- }
62
- const is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
63
- /** @param {string} key */
64
- function stringify_key(key) {
65
- return is_identifier.test(key) ? "." + key : "[" + JSON.stringify(key) + "]";
66
- }
67
-
68
- //#endregion
69
- //#region node_modules/.pnpm/devalue@5.3.2/node_modules/devalue/src/base64.js
70
- /**
71
- * Base64 Encodes an arraybuffer
72
- * @param {ArrayBuffer} arraybuffer
73
- * @returns {string}
74
- */
75
- function encode64(arraybuffer) {
76
- const dv = new DataView(arraybuffer);
77
- let binaryString = "";
78
- for (let i = 0; i < arraybuffer.byteLength; i++) binaryString += String.fromCharCode(dv.getUint8(i));
79
- return binaryToAscii(binaryString);
80
- }
81
- /**
82
- * Decodes a base64 string into an arraybuffer
83
- * @param {string} string
84
- * @returns {ArrayBuffer}
85
- */
86
- function decode64(string) {
87
- const binaryString = asciiToBinary(string);
88
- const arraybuffer = new ArrayBuffer(binaryString.length);
89
- const dv = new DataView(arraybuffer);
90
- for (let i = 0; i < arraybuffer.byteLength; i++) dv.setUint8(i, binaryString.charCodeAt(i));
91
- return arraybuffer;
92
- }
93
- const KEY_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
94
- /**
95
- * Substitute for atob since it's deprecated in node.
96
- * Does not do any input validation.
97
- *
98
- * @see https://github.com/jsdom/abab/blob/master/lib/atob.js
99
- *
100
- * @param {string} data
101
- * @returns {string}
102
- */
103
- function asciiToBinary(data) {
104
- if (data.length % 4 === 0) data = data.replace(/==?$/, "");
105
- let output = "";
106
- let buffer = 0;
107
- let accumulatedBits = 0;
108
- for (let i = 0; i < data.length; i++) {
109
- buffer <<= 6;
110
- buffer |= KEY_STRING.indexOf(data[i]);
111
- accumulatedBits += 6;
112
- if (accumulatedBits === 24) {
113
- output += String.fromCharCode((buffer & 16711680) >> 16);
114
- output += String.fromCharCode((buffer & 65280) >> 8);
115
- output += String.fromCharCode(buffer & 255);
116
- buffer = accumulatedBits = 0;
117
- }
118
- }
119
- if (accumulatedBits === 12) {
120
- buffer >>= 4;
121
- output += String.fromCharCode(buffer);
122
- } else if (accumulatedBits === 18) {
123
- buffer >>= 2;
124
- output += String.fromCharCode((buffer & 65280) >> 8);
125
- output += String.fromCharCode(buffer & 255);
126
- }
127
- return output;
128
- }
129
- /**
130
- * Substitute for btoa since it's deprecated in node.
131
- * Does not do any input validation.
132
- *
133
- * @see https://github.com/jsdom/abab/blob/master/lib/btoa.js
134
- *
135
- * @param {string} str
136
- * @returns {string}
137
- */
138
- function binaryToAscii(str) {
139
- let out = "";
140
- for (let i = 0; i < str.length; i += 3) {
141
- /** @type {[number, number, number, number]} */
142
- const groupsOfSix = [
143
- void 0,
144
- void 0,
145
- void 0,
146
- void 0
147
- ];
148
- groupsOfSix[0] = str.charCodeAt(i) >> 2;
149
- groupsOfSix[1] = (str.charCodeAt(i) & 3) << 4;
150
- if (str.length > i + 1) {
151
- groupsOfSix[1] |= str.charCodeAt(i + 1) >> 4;
152
- groupsOfSix[2] = (str.charCodeAt(i + 1) & 15) << 2;
153
- }
154
- if (str.length > i + 2) {
155
- groupsOfSix[2] |= str.charCodeAt(i + 2) >> 6;
156
- groupsOfSix[3] = str.charCodeAt(i + 2) & 63;
157
- }
158
- for (let j = 0; j < groupsOfSix.length; j++) if (typeof groupsOfSix[j] === "undefined") out += "=";
159
- else out += KEY_STRING[groupsOfSix[j]];
160
- }
161
- return out;
162
- }
1
+ import { parse, stringify } from "devalue";
163
2
 
164
- //#endregion
165
- //#region node_modules/.pnpm/devalue@5.3.2/node_modules/devalue/src/constants.js
166
- const UNDEFINED = -1;
167
- const HOLE = -2;
168
- const NAN = -3;
169
- const POSITIVE_INFINITY = -4;
170
- const NEGATIVE_INFINITY = -5;
171
- const NEGATIVE_ZERO = -6;
172
-
173
- //#endregion
174
- //#region node_modules/.pnpm/devalue@5.3.2/node_modules/devalue/src/parse.js
175
- /**
176
- * Revive a value serialized with `devalue.stringify`
177
- * @param {string} serialized
178
- * @param {Record<string, (value: any) => any>} [revivers]
179
- */
180
- function parse(serialized, revivers) {
181
- return unflatten(JSON.parse(serialized), revivers);
182
- }
183
- /**
184
- * Revive a value flattened with `devalue.stringify`
185
- * @param {number | any[]} parsed
186
- * @param {Record<string, (value: any) => any>} [revivers]
187
- */
188
- function unflatten(parsed, revivers) {
189
- if (typeof parsed === "number") return hydrate(parsed, true);
190
- if (!Array.isArray(parsed) || parsed.length === 0) throw new Error("Invalid input");
191
- const values = parsed;
192
- const hydrated = Array(values.length);
193
- /**
194
- * @param {number} index
195
- * @returns {any}
196
- */
197
- function hydrate(index, standalone = false) {
198
- if (index === UNDEFINED) return void 0;
199
- if (index === NAN) return NaN;
200
- if (index === POSITIVE_INFINITY) return Infinity;
201
- if (index === NEGATIVE_INFINITY) return -Infinity;
202
- if (index === NEGATIVE_ZERO) return -0;
203
- if (standalone || typeof index !== "number") throw new Error(`Invalid input`);
204
- if (index in hydrated) return hydrated[index];
205
- const value = values[index];
206
- if (!value || typeof value !== "object") hydrated[index] = value;
207
- else if (Array.isArray(value)) if (typeof value[0] === "string") {
208
- const type = value[0];
209
- const reviver = revivers?.[type];
210
- if (reviver) return hydrated[index] = reviver(hydrate(value[1]));
211
- switch (type) {
212
- case "Date":
213
- hydrated[index] = new Date(value[1]);
214
- break;
215
- case "Set":
216
- const set = /* @__PURE__ */ new Set();
217
- hydrated[index] = set;
218
- for (let i = 1; i < value.length; i += 1) set.add(hydrate(value[i]));
219
- break;
220
- case "Map":
221
- const map = /* @__PURE__ */ new Map();
222
- hydrated[index] = map;
223
- for (let i = 1; i < value.length; i += 2) map.set(hydrate(value[i]), hydrate(value[i + 1]));
224
- break;
225
- case "RegExp":
226
- hydrated[index] = new RegExp(value[1], value[2]);
227
- break;
228
- case "Object":
229
- hydrated[index] = Object(value[1]);
230
- break;
231
- case "BigInt":
232
- hydrated[index] = BigInt(value[1]);
233
- break;
234
- case "null":
235
- const obj = Object.create(null);
236
- hydrated[index] = obj;
237
- for (let i = 1; i < value.length; i += 2) obj[value[i]] = hydrate(value[i + 1]);
238
- break;
239
- case "Int8Array":
240
- case "Uint8Array":
241
- case "Uint8ClampedArray":
242
- case "Int16Array":
243
- case "Uint16Array":
244
- case "Int32Array":
245
- case "Uint32Array":
246
- case "Float32Array":
247
- case "Float64Array":
248
- case "BigInt64Array":
249
- case "BigUint64Array": {
250
- const TypedArrayConstructor = globalThis[type];
251
- const typedArray = new TypedArrayConstructor(hydrate(value[1]));
252
- hydrated[index] = value[2] !== void 0 ? typedArray.subarray(value[2], value[3]) : typedArray;
253
- break;
254
- }
255
- case "ArrayBuffer": {
256
- const base64 = value[1];
257
- hydrated[index] = decode64(base64);
258
- break;
259
- }
260
- case "Temporal.Duration":
261
- case "Temporal.Instant":
262
- case "Temporal.PlainDate":
263
- case "Temporal.PlainTime":
264
- case "Temporal.PlainDateTime":
265
- case "Temporal.PlainMonthDay":
266
- case "Temporal.PlainYearMonth":
267
- case "Temporal.ZonedDateTime": {
268
- const temporalName = type.slice(9);
269
- hydrated[index] = Temporal[temporalName].from(value[1]);
270
- break;
271
- }
272
- case "URL":
273
- hydrated[index] = new URL(value[1]);
274
- break;
275
- case "URLSearchParams":
276
- hydrated[index] = new URLSearchParams(value[1]);
277
- break;
278
- default: throw new Error(`Unknown type ${type}`);
279
- }
280
- } else {
281
- const array = new Array(value.length);
282
- hydrated[index] = array;
283
- for (let i = 0; i < value.length; i += 1) {
284
- const n = value[i];
285
- if (n === HOLE) continue;
286
- array[i] = hydrate(n);
287
- }
288
- }
289
- else {
290
- /** @type {Record<string, any>} */
291
- const object = {};
292
- hydrated[index] = object;
293
- for (const key in value) {
294
- if (key === "__proto__") throw new Error("Cannot parse an object with a `__proto__` property");
295
- const n = value[key];
296
- object[key] = hydrate(n);
297
- }
298
- }
299
- return hydrated[index];
300
- }
301
- return hydrate(0);
302
- }
303
-
304
- //#endregion
305
- //#region node_modules/.pnpm/devalue@5.3.2/node_modules/devalue/src/stringify.js
306
- /**
307
- * Turn a value into a JSON string that can be parsed with `devalue.parse`
308
- * @param {any} value
309
- * @param {Record<string, (value: any) => any>} [reducers]
310
- */
311
- function stringify(value, reducers) {
312
- /** @type {any[]} */
313
- const stringified = [];
314
- /** @type {Map<any, number>} */
315
- const indexes = /* @__PURE__ */ new Map();
316
- /** @type {Array<{ key: string, fn: (value: any) => any }>} */
317
- const custom = [];
318
- if (reducers) for (const key of Object.getOwnPropertyNames(reducers)) custom.push({
319
- key,
320
- fn: reducers[key]
321
- });
322
- /** @type {string[]} */
323
- const keys = [];
324
- let p = 0;
325
- /** @param {any} thing */
326
- function flatten(thing) {
327
- if (typeof thing === "function") throw new DevalueError(`Cannot stringify a function`, keys);
328
- if (thing === void 0) return UNDEFINED;
329
- if (Number.isNaN(thing)) return NAN;
330
- if (thing === Infinity) return POSITIVE_INFINITY;
331
- if (thing === -Infinity) return NEGATIVE_INFINITY;
332
- if (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO;
333
- if (indexes.has(thing)) return indexes.get(thing);
334
- const index$1 = p++;
335
- indexes.set(thing, index$1);
336
- for (const { key, fn } of custom) {
337
- const value$1 = fn(thing);
338
- if (value$1) {
339
- stringified[index$1] = `["${key}",${flatten(value$1)}]`;
340
- return index$1;
341
- }
342
- }
343
- let str = "";
344
- if (is_primitive(thing)) str = stringify_primitive(thing);
345
- else {
346
- const type = get_type(thing);
347
- switch (type) {
348
- case "Number":
349
- case "String":
350
- case "Boolean":
351
- str = `["Object",${stringify_primitive(thing)}]`;
352
- break;
353
- case "BigInt":
354
- str = `["BigInt",${thing}]`;
355
- break;
356
- case "Date":
357
- str = `["Date","${!isNaN(thing.getDate()) ? thing.toISOString() : ""}"]`;
358
- break;
359
- case "URL":
360
- str = `["URL",${stringify_string(thing.toString())}]`;
361
- break;
362
- case "URLSearchParams":
363
- str = `["URLSearchParams",${stringify_string(thing.toString())}]`;
364
- break;
365
- case "RegExp":
366
- const { source, flags } = thing;
367
- str = flags ? `["RegExp",${stringify_string(source)},"${flags}"]` : `["RegExp",${stringify_string(source)}]`;
368
- break;
369
- case "Array":
370
- str = "[";
371
- for (let i = 0; i < thing.length; i += 1) {
372
- if (i > 0) str += ",";
373
- if (i in thing) {
374
- keys.push(`[${i}]`);
375
- str += flatten(thing[i]);
376
- keys.pop();
377
- } else str += HOLE;
378
- }
379
- str += "]";
380
- break;
381
- case "Set":
382
- str = "[\"Set\"";
383
- for (const value$1 of thing) str += `,${flatten(value$1)}`;
384
- str += "]";
385
- break;
386
- case "Map":
387
- str = "[\"Map\"";
388
- for (const [key, value$1] of thing) {
389
- keys.push(`.get(${is_primitive(key) ? stringify_primitive(key) : "..."})`);
390
- str += `,${flatten(key)},${flatten(value$1)}`;
391
- keys.pop();
392
- }
393
- str += "]";
394
- break;
395
- case "Int8Array":
396
- case "Uint8Array":
397
- case "Uint8ClampedArray":
398
- case "Int16Array":
399
- case "Uint16Array":
400
- case "Int32Array":
401
- case "Uint32Array":
402
- case "Float32Array":
403
- case "Float64Array":
404
- case "BigInt64Array":
405
- case "BigUint64Array": {
406
- /** @type {import("./types.js").TypedArray} */
407
- const typedArray = thing;
408
- str = "[\"" + type + "\"," + flatten(typedArray.buffer);
409
- const a = thing.byteOffset;
410
- const b = a + thing.byteLength;
411
- if (a > 0 || b !== typedArray.buffer.byteLength) {
412
- const m = +/(\d+)/.exec(type)[1] / 8;
413
- str += `,${a / m},${b / m}`;
414
- }
415
- str += "]";
416
- break;
417
- }
418
- case "ArrayBuffer":
419
- str = `["ArrayBuffer","${encode64(thing)}"]`;
420
- break;
421
- case "Temporal.Duration":
422
- case "Temporal.Instant":
423
- case "Temporal.PlainDate":
424
- case "Temporal.PlainTime":
425
- case "Temporal.PlainDateTime":
426
- case "Temporal.PlainMonthDay":
427
- case "Temporal.PlainYearMonth":
428
- case "Temporal.ZonedDateTime":
429
- str = `["${type}",${stringify_string(thing.toString())}]`;
430
- break;
431
- default:
432
- if (!is_plain_object(thing)) throw new DevalueError(`Cannot stringify arbitrary non-POJOs`, keys);
433
- if (enumerable_symbols(thing).length > 0) throw new DevalueError(`Cannot stringify POJOs with symbolic keys`, keys);
434
- if (Object.getPrototypeOf(thing) === null) {
435
- str = "[\"null\"";
436
- for (const key in thing) {
437
- keys.push(stringify_key(key));
438
- str += `,${stringify_string(key)},${flatten(thing[key])}`;
439
- keys.pop();
440
- }
441
- str += "]";
442
- } else {
443
- str = "{";
444
- let started = false;
445
- for (const key in thing) {
446
- if (started) str += ",";
447
- started = true;
448
- keys.push(stringify_key(key));
449
- str += `${stringify_string(key)}:${flatten(thing[key])}`;
450
- keys.pop();
451
- }
452
- str += "}";
453
- }
454
- }
455
- }
456
- stringified[index$1] = str;
457
- return index$1;
458
- }
459
- const index = flatten(value);
460
- if (index < 0) return `${index}`;
461
- return `[${stringified.join(",")}]`;
462
- }
463
- /**
464
- * @param {any} thing
465
- * @returns {string}
466
- */
467
- function stringify_primitive(thing) {
468
- const type = typeof thing;
469
- if (type === "string") return stringify_string(thing);
470
- if (thing instanceof String) return stringify_string(thing.toString());
471
- if (thing === void 0) return UNDEFINED.toString();
472
- if (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO.toString();
473
- if (type === "bigint") return `["BigInt","${thing}"]`;
474
- return String(thing);
475
- }
476
-
477
- //#endregion
478
3
  //#region src/lib/verification/attest.remote.ts
479
4
  async function attest_remote_default(arg, init) {
480
5
  const res = await fetch("https://benignmonoserver.fly.dev/b1c8ae45b4", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monoidentity",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "repository": "KTibow/monoidentity",
5
5
  "author": {
6
6
  "name": "KTibow"