@bob-kit/client 0.0.12 → 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 +0 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -7
- package/dist/install.js +1 -1
- package/dist/wasm.d.ts +5 -4
- package/dist/wasm.js +1 -7
- package/package.json +2 -2
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
|
|
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
|
|
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
|
|
12
|
-
if (error)
|
|
13
|
-
throw new Error(error);
|
|
11
|
+
const result = bobInstance.query(query);
|
|
14
12
|
if (cache) {
|
|
15
|
-
cache.set(cacheKey,
|
|
13
|
+
cache.set(cacheKey, result);
|
|
16
14
|
}
|
|
17
|
-
return
|
|
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/install.js
CHANGED
|
@@ -15,7 +15,7 @@ async function downloadFile(url, folder, filename) {
|
|
|
15
15
|
}
|
|
16
16
|
(async () => {
|
|
17
17
|
try {
|
|
18
|
-
const version = "v0.0.
|
|
18
|
+
const version = "v0.0.4"; // or dynamic
|
|
19
19
|
const fileName = "bob.wasm";
|
|
20
20
|
const url = `https://github.com/bob-object-builder/bob/releases/download/${version}/${fileName}`;
|
|
21
21
|
const downloadFolder = "dist";
|
package/dist/wasm.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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):
|
|
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
|
-
|
|
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.
|
|
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.
|
|
31
|
+
"@bob-kit/types": "^0.0.3"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "tsc && tsc-alias",
|