@bob-kit/client 0.0.3 → 0.0.4
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/cache.js +1 -5
- package/dist/daemon.js +3 -7
- package/dist/index.js +5 -10
- package/dist/install.js +5 -40
- package/package.json +1 -1
package/dist/cache.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MemoryCache = void 0;
|
|
4
|
-
class MemoryCache {
|
|
1
|
+
export class MemoryCache {
|
|
5
2
|
constructor() {
|
|
6
3
|
this.cache = new Map();
|
|
7
4
|
}
|
|
@@ -15,4 +12,3 @@ class MemoryCache {
|
|
|
15
12
|
return this.cache.set(id, value);
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
|
-
exports.MemoryCache = MemoryCache;
|
package/dist/daemon.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Daemon = void 0;
|
|
4
|
-
const node_child_process_1 = require("node:child_process");
|
|
5
|
-
class Daemon {
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
export class Daemon {
|
|
6
3
|
constructor(driver) {
|
|
7
4
|
this.buffer = "";
|
|
8
5
|
this.queue = [];
|
|
9
6
|
const cwd = process.cwd();
|
|
10
|
-
this.process =
|
|
7
|
+
this.process = spawn(`./motor`, ["-d", driver, "--json", "--daemon"], {
|
|
11
8
|
stdio: ["pipe", "pipe", "pipe"],
|
|
12
9
|
windowsHide: true,
|
|
13
10
|
});
|
|
@@ -48,4 +45,3 @@ class Daemon {
|
|
|
48
45
|
return !!this.process && !this.process.killed;
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
|
-
exports.Daemon = Daemon;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.bobQuery = void 0;
|
|
4
|
-
exports.default = bob;
|
|
5
|
-
const daemon_js_1 = require("./daemon.js");
|
|
1
|
+
import { Daemon } from "./daemon.js";
|
|
6
2
|
let daemon;
|
|
7
|
-
const bobQuery = async ({ id, driver: { cache, driver }, input, }) => {
|
|
8
|
-
daemon = new
|
|
3
|
+
export const bobQuery = async ({ id, driver: { cache, driver }, input, }) => {
|
|
4
|
+
daemon = new Daemon(driver);
|
|
9
5
|
const query = typeof input === "string" ? input : input.join("?");
|
|
10
6
|
const cacheKey = id ?? query;
|
|
11
7
|
if (cache) {
|
|
@@ -26,10 +22,9 @@ const bobQuery = async ({ id, driver: { cache, driver }, input, }) => {
|
|
|
26
22
|
}
|
|
27
23
|
return json;
|
|
28
24
|
};
|
|
29
|
-
|
|
30
|
-
function bob(driver) {
|
|
25
|
+
export default function bob(driver) {
|
|
31
26
|
const execute = async (input, parameters = [], id) => {
|
|
32
|
-
const { error, tables, actions } = await
|
|
27
|
+
const { error, tables, actions } = await bobQuery({ input, driver, id });
|
|
33
28
|
if (error)
|
|
34
29
|
return { error };
|
|
35
30
|
if (tables) {
|
package/dist/install.js
CHANGED
|
@@ -1,43 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const fs = __importStar(require("fs"));
|
|
37
|
-
const path = __importStar(require("path"));
|
|
38
|
-
const stream_1 = require("stream");
|
|
39
|
-
const util_1 = require("util");
|
|
40
|
-
const streamPipeline = (0, util_1.promisify)(stream_1.pipeline);
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import { pipeline } from "stream";
|
|
4
|
+
import { promisify } from "util";
|
|
5
|
+
const streamPipeline = promisify(pipeline);
|
|
41
6
|
function detectBobFile() {
|
|
42
7
|
const platform = process.platform; // 'win32', 'darwin', 'linux'
|
|
43
8
|
const arch = process.arch; // 'x64', 'arm64', etc.
|