@mtkruto/node 0.1.706 → 0.1.708

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.
@@ -20,7 +20,7 @@
20
20
  export * from "./storage/0_storage.js";
21
21
  export * from "./storage/1_utilities.js";
22
22
  export * from "./storage/2_storage_indexed_db.js";
23
- export * from "./storage/2_storage_local_storage.js";
23
+ export * from "./storage/2_storage_local_storage.node.js";
24
24
  export * from "./storage/2_storage_memory.js";
25
25
  export * from "./storage/2_storage_session_storage.js";
26
26
  //# sourceMappingURL=2_storage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"2_storage.d.ts","sourceRoot":"","sources":["../src/2_storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wCAAwC,CAAC"}
1
+ {"version":3,"file":"2_storage.d.ts","sourceRoot":"","sources":["../src/2_storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wCAAwC,CAAC"}
package/esm/2_storage.js CHANGED
@@ -20,6 +20,6 @@
20
20
  export * from "./storage/0_storage.js";
21
21
  export * from "./storage/1_utilities.js";
22
22
  export * from "./storage/2_storage_indexed_db.js";
23
- export * from "./storage/2_storage_local_storage.js";
23
+ export * from "./storage/2_storage_local_storage.node.js";
24
24
  export * from "./storage/2_storage_memory.js";
25
25
  export * from "./storage/2_storage_session_storage.js";
@@ -1195,7 +1195,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
1195
1195
  const topMsgId = params?.messageThreadId;
1196
1196
  const replyToMsgId = params?.replyToMessageId;
1197
1197
  return replyToMsgId !== undefined ? new types.InputReplyToMessage({ reply_to_msg_id: replyToMsgId, top_msg_id: topMsgId, quote_text: params?.replyQuote?.text, quote_entities: await Promise.all(params?.replyQuote?.entities.map((v) => messageEntityToTlObject(v, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity)) ?? []), quote_offset: params?.replyQuote?.offset }) : undefined;
1198
- }, _MessageManager_sendDocumentInner = async function _MessageManager_sendDocumentInner(chatId, document, params, fileType, otherAttribs, urlSupported = false, expectedMimeTypes) {
1198
+ }, _MessageManager_sendDocumentInner = async function _MessageManager_sendDocumentInner(chatId, document, params, fileType, otherAttribs, urlSupported = true, expectedMimeTypes) {
1199
1199
  let media = null;
1200
1200
  const spoiler = params?.hasSpoiler ? true : undefined;
1201
1201
  const ttl_seconds = params && "selfDestruct" in params && typeof params.selfDestruct !== undefined ? selfDestructOptionToInt(params.selfDestruct) : undefined;
@@ -20,7 +20,7 @@
20
20
  import { GetManyFilter, Storage, StorageKeyPart } from "./0_storage.js";
21
21
  export declare class StorageLocalStorage implements Storage {
22
22
  #private;
23
- constructor(prefix: string);
23
+ constructor(path: string);
24
24
  get prefix(): string;
25
25
  branch(id: string): Storage;
26
26
  initialize(): void;
@@ -34,4 +34,4 @@ export declare class StorageLocalStorage implements Storage {
34
34
  set(key_: readonly StorageKeyPart[], value: unknown): void;
35
35
  incr(key: readonly StorageKeyPart[], by: number): void;
36
36
  }
37
- //# sourceMappingURL=2_storage_local_storage.d.ts.map
37
+ //# sourceMappingURL=2_storage_local_storage.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"2_storage_local_storage.node.d.ts","sourceRoot":"","sources":["../../src/storage/2_storage_local_storage.node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGxE,qBAAa,mBAAoB,YAAW,OAAO;;gBAKrC,IAAI,EAAE,MAAM;IAKxB,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAM3B,UAAU;IAGV,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,cAAc,EAAE,GAAG,CAAC,GAAG,IAAI;IAUhD,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAC,CAAC,SAAS,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC;IA+B7H,GAAG,CAAC,IAAI,EAAE,SAAS,cAAc,EAAE,EAAE,KAAK,EAAE,OAAO;IASnD,IAAI,CAAC,GAAG,EAAE,SAAS,cAAc,EAAE,EAAE,EAAE,EAAE,MAAM;CAGhD"}
@@ -28,24 +28,24 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
28
28
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
29
29
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
30
30
  };
31
- var _StorageLocalStorage_prefix;
31
+ var _StorageLocalStorage_prefix, _StorageLocalStorage_path, _StorageLocalStorage_storage;
32
+ import { LocalStorage } from "node-localstorage";
32
33
  import { fromString, isInRange, toString } from "./1_utilities.js";
33
34
  export class StorageLocalStorage {
34
- constructor(prefix) {
35
+ constructor(path) {
35
36
  _StorageLocalStorage_prefix.set(this, void 0);
36
- if (typeof localStorage === "undefined") {
37
- throw new Error("Unavailable in current environment");
38
- }
39
- if (prefix.length <= 0) {
40
- throw new Error("Empty prefix");
41
- }
42
- __classPrivateFieldSet(this, _StorageLocalStorage_prefix, prefix, "f");
37
+ _StorageLocalStorage_path.set(this, void 0);
38
+ _StorageLocalStorage_storage.set(this, void 0);
39
+ __classPrivateFieldSet(this, _StorageLocalStorage_prefix, "main", "f");
40
+ __classPrivateFieldSet(this, _StorageLocalStorage_storage, new LocalStorage(__classPrivateFieldSet(this, _StorageLocalStorage_path, path, "f")), "f");
43
41
  }
44
42
  get prefix() {
45
43
  return __classPrivateFieldGet(this, _StorageLocalStorage_prefix, "f");
46
44
  }
47
45
  branch(id) {
48
- return new StorageLocalStorage(this.prefix + "S__" + id);
46
+ const storage = new StorageLocalStorage(__classPrivateFieldGet(this, _StorageLocalStorage_path, "f"));
47
+ __classPrivateFieldSet(storage, _StorageLocalStorage_prefix, this.prefix + "S__" + id, "f");
48
+ return storage;
49
49
  }
50
50
  initialize() {
51
51
  }
@@ -57,7 +57,7 @@ export class StorageLocalStorage {
57
57
  }
58
58
  get(key_) {
59
59
  const key = this.prefix + toString(key_);
60
- const value = localStorage.getItem(key);
60
+ const value = __classPrivateFieldGet(this, _StorageLocalStorage_storage, "f").getItem(key);
61
61
  if (value != null) {
62
62
  return fromString(value);
63
63
  }
@@ -66,7 +66,7 @@ export class StorageLocalStorage {
66
66
  }
67
67
  }
68
68
  *getMany(filter, params) {
69
- let entries = Object.entries(localStorage).sort(([a], [b]) => a.localeCompare(b));
69
+ let entries = Object.entries(__classPrivateFieldGet(this, _StorageLocalStorage_storage, "f")).sort(([a], [b]) => a.localeCompare(b));
70
70
  if (params?.reverse) {
71
71
  entries.reverse();
72
72
  }
@@ -98,14 +98,14 @@ export class StorageLocalStorage {
98
98
  set(key_, value) {
99
99
  const key = this.prefix + toString(key_);
100
100
  if (value != null) {
101
- localStorage.setItem(key, toString(value));
101
+ __classPrivateFieldGet(this, _StorageLocalStorage_storage, "f").setItem(key, toString(value));
102
102
  }
103
103
  else {
104
- localStorage.removeItem(key);
104
+ __classPrivateFieldGet(this, _StorageLocalStorage_storage, "f").removeItem(key);
105
105
  }
106
106
  }
107
107
  incr(key, by) {
108
108
  this.set(key, (this.get(key) || 0) + by);
109
109
  }
110
110
  }
111
- _StorageLocalStorage_prefix = new WeakMap();
111
+ _StorageLocalStorage_prefix = new WeakMap(), _StorageLocalStorage_path = new WeakMap(), _StorageLocalStorage_storage = new WeakMap();