@bob-kit/client 0.0.13 → 0.0.14

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/bob.wasm CHANGED
Binary file
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ type BobQueryParams = {
4
4
  driver: Driver;
5
5
  input: TemplateStringsArray | string;
6
6
  };
7
- export declare const bobQuery: ({ id, driver: { cache, driver }, input, }: BobQueryParams) => Promise<BobQueryResult>;
7
+ export declare const bobQuery: ({ id, driver: { cache }, input, }: BobQueryParams) => Promise<BobQueryResult>;
8
8
  export default function bob(driver: Driver): {
9
9
  query: <A, B = any>(input: TemplateStringsArray | string, ...parameters: B[]) => Promise<BobResult<A>>;
10
10
  cache: (id: string) => <A, B = any>(input: TemplateStringsArray | string, ...parameters: B[]) => Promise<BobResult<A>>;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { WASM } from "./wasm.js";
2
2
  let bobInstance;
3
- export const bobQuery = async ({ id, driver: { cache, driver }, input, }) => {
3
+ export const bobQuery = async ({ id, driver: { cache }, input, }) => {
4
4
  const query = typeof input === "string" ? input : input.join("?");
5
5
  const cacheKey = id ?? query;
6
6
  if (cache) {
@@ -8,18 +8,16 @@ export const bobQuery = async ({ id, driver: { cache, driver }, input, }) => {
8
8
  if (cached)
9
9
  return cache.get(cacheKey);
10
10
  }
11
- const { value, error } = bobInstance.query(query);
12
- if (error)
13
- throw new Error(error);
11
+ const result = bobInstance.query(query);
14
12
  if (cache) {
15
- cache.set(cacheKey, value);
13
+ cache.set(cacheKey, result);
16
14
  }
17
- return value;
15
+ return result;
18
16
  };
19
17
  export default function bob(driver) {
20
18
  bobInstance = new WASM(driver.driver);
21
19
  const execute = async (input, parameters = [], id) => {
22
- const { error, tables, actions } = await bobQuery({ input, driver, id });
20
+ const { error, value: { tables, actions }, } = await bobQuery({ input, driver, id });
23
21
  if (error)
24
22
  return { error };
25
23
  if (tables) {
package/dist/wasm.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- interface BobResult {
2
- error: string | null;
3
- value: {
1
+ import { BobError } from "@bob-kit/types/errors";
2
+ interface WasmBobResult {
3
+ error?: BobError;
4
+ value?: {
4
5
  tables: string[];
5
6
  actions: string[];
6
7
  };
@@ -8,6 +9,6 @@ interface BobResult {
8
9
  export declare class WASM {
9
10
  private driver;
10
11
  constructor(driver: string);
11
- query(query: string): BobResult;
12
+ query(query: string): WasmBobResult;
12
13
  }
13
14
  export {};
package/dist/wasm.js CHANGED
@@ -23,12 +23,6 @@ export class WASM {
23
23
  throw new Error("WASM 'bob' is not available or did not return a function.");
24
24
  }
25
25
  const result = fn(query.trim());
26
- if (result.error)
27
- throw new Error(result.error);
28
- const value = JSON.parse(JSON.stringify(result.value));
29
- return {
30
- error: null,
31
- value,
32
- };
26
+ return result;
33
27
  }
34
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bob-kit/client",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "",
@@ -28,7 +28,7 @@
28
28
  "typescript": "5.9.3"
29
29
  },
30
30
  "dependencies": {
31
- "@bob-kit/types": "^0.0.2"
31
+ "@bob-kit/types": "^0.0.3"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "tsc && tsc-alias",