modality-kit 0.14.0 → 0.14.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.
package/dist/index.js CHANGED
@@ -207,8 +207,14 @@ function withErrorHandling(fn, operation) {
207
207
 
208
208
  // src/util_response.ts
209
209
  function formatSuccessResponse(content, meta) {
210
- const { instructions, ...restContent } = content;
211
- const otherContent = JSON.parse(JSON.stringify(restContent || {}));
210
+ let otherContent;
211
+ const instructions = content.instructions;
212
+ if (instructions != null) {
213
+ const { instructions: instructions2, ...restContent } = content;
214
+ otherContent = JSON.parse(JSON.stringify(restContent || {}));
215
+ } else {
216
+ otherContent = JSON.parse(JSON.stringify(content || {}));
217
+ }
212
218
  return JSON.stringify({
213
219
  success: true,
214
220
  instructions,
@@ -5893,46 +5899,49 @@ class WebSocketClient {
5893
5899
  }
5894
5900
  // src/lruCache.ts
5895
5901
  class LruCache {
5896
- values = new Map;
5902
+ _values = new Map;
5897
5903
  max;
5898
5904
  constructor(max = 100) {
5899
5905
  this.max = max;
5900
5906
  }
5901
5907
  has(key) {
5902
- return this.values.has(key);
5908
+ return this._values.has(key);
5903
5909
  }
5904
5910
  get(key) {
5905
- const value = this.values.get(key);
5911
+ const value = this._values.get(key);
5906
5912
  if (value) {
5907
- this.values.delete(key);
5908
- this.values.set(key, value);
5913
+ this._values.delete(key);
5914
+ this._values.set(key, value);
5909
5915
  }
5910
5916
  return value;
5911
5917
  }
5912
5918
  set(key, value) {
5913
5919
  if (this.size() >= this.max) {
5914
5920
  const itemsToEvictCount = Math.max(1, Math.floor(this.max * 0.25));
5915
- const keys = this.values.keys();
5921
+ const keys = this._values.keys();
5916
5922
  let count = 0;
5917
5923
  while (count < itemsToEvictCount) {
5918
5924
  const next = keys.next();
5919
5925
  if (next.done) {
5920
5926
  break;
5921
5927
  }
5922
- this.values.delete(next.value);
5928
+ this._values.delete(next.value);
5923
5929
  count++;
5924
5930
  }
5925
5931
  }
5926
- this.values.set(key, value);
5932
+ this._values.set(key, value);
5927
5933
  }
5928
5934
  delete(key) {
5929
- return this.values.delete(key);
5935
+ return this._values.delete(key);
5930
5936
  }
5931
5937
  clear() {
5932
- this.values.clear();
5938
+ this._values.clear();
5933
5939
  }
5934
5940
  size() {
5935
- return this.values.size;
5941
+ return this._values.size;
5942
+ }
5943
+ values() {
5944
+ return this._values.values();
5936
5945
  }
5937
5946
  }
5938
5947
  export {
@@ -1,5 +1,5 @@
1
1
  export declare class LruCache<T> {
2
- private values;
2
+ private _values;
3
3
  private max;
4
4
  constructor(max?: number);
5
5
  has(key: string): boolean;
@@ -8,4 +8,5 @@ export declare class LruCache<T> {
8
8
  delete(key: string): boolean;
9
9
  clear(): void;
10
10
  size(): number;
11
+ values(): IterableIterator<T>;
11
12
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.14.0",
2
+ "version": "0.14.2",
3
3
  "name": "modality-kit",
4
4
  "repository": {
5
5
  "type": "git",
@@ -30,8 +30,8 @@
30
30
  "build:src": "bun build src/index.ts --outdir dist",
31
31
  "build": "bun run build:clean && bun run build:types && bun run build:src",
32
32
  "dev": "bunx concurrently 'bun --watch tsc -p ./' 'bun build:src -- --watch --sourcemap=inline'",
33
- "test": "bun test",
34
- "prepublishOnly": "npm run build && npm run test"
33
+ "test": "npm run build && bun test",
34
+ "prepublishOnly": "npm t"
35
35
  },
36
36
  "files": ["package.json", "README.md", "dist"]
37
37
  }