@interncom/diplomatic 0.0.10 → 0.0.11

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.mjs CHANGED
@@ -93,7 +93,7 @@ var Queue = class {
93
93
  return this.map.get(key);
94
94
  }
95
95
  async entries() {
96
- return this.map.entries();
96
+ return Array.from(this.map.entries());
97
97
  }
98
98
  async dequeue(key) {
99
99
  const value = this.map.get(key);
@@ -8565,8 +8565,11 @@ var DiplomaticClient = class {
8565
8565
  return [];
8566
8566
  }
8567
8567
  const { hostURL, hostKeyPair, encKey } = this;
8568
- for (const [path] of await this.store.pullQueue.entries()) {
8569
- const cipher = await api_default.getDelta(this.hostURL, path, hostKeyPair);
8568
+ const entries = await this.store.pullQueue.entries();
8569
+ const paths = entries.map(([path]) => path);
8570
+ paths.sort((p1, p2) => p2.localeCompare(p1));
8571
+ for (const path of paths) {
8572
+ const cipher = await api_default.getDelta(hostURL, path, hostKeyPair);
8570
8573
  const packed = await crypto_default.decryptXSalsa20Poly1305Combined(cipher, encKey);
8571
8574
  const op = decode(packed);
8572
8575
  try {
package/dist/queue.d.ts CHANGED
@@ -4,7 +4,7 @@ export declare class Queue<K, V> implements IQueue<K, V> {
4
4
  constructor();
5
5
  enqueue(key: K, value: V): Promise<void>;
6
6
  peek(key: K): Promise<V | undefined>;
7
- entries(): Promise<Iterable<[K, V]>>;
7
+ entries(): Promise<Array<[K, V]>>;
8
8
  dequeue(key: K): Promise<V | undefined>;
9
9
  size(): Promise<number>;
10
10
  }
package/dist/types.d.ts CHANGED
@@ -13,10 +13,10 @@ export interface IQueue<K, V> {
13
13
  */
14
14
  peek(key: K): Promise<V | undefined>;
15
15
  /**
16
- * Returns an iterator for the queue, allowing iteration over all entries.
17
- * @returns An iterator of entries in the queue.
16
+ * Returns an array of entries in the queue, allowing sorting and iteration over all entries.
17
+ * @returns An array of entries in the queue.
18
18
  */
19
- entries(): Promise<Iterable<[K, V]>>;
19
+ entries(): Promise<Array<[K, V]>>;
20
20
  /**
21
21
  * Removes the entry with the specified key from the queue.
22
22
  * @param key - The key of the entry.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interncom/diplomatic",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "type": "module",
5
5
  "description": "Secure sync layer",
6
6
  "main": "dist/index.mjs",