@askdb/client 1.0.0-beta.4 → 1.0.0-beta.6

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.
Files changed (2) hide show
  1. package/README.md +21 -0
  2. package/package.json +14 -12
package/README.md CHANGED
@@ -40,6 +40,27 @@ const { sql } = await askdb.ask("count active users", {
40
40
  });
41
41
  ```
42
42
 
43
+ ## Parameterized output
44
+
45
+ `askdb.ask()` returns the same `AskPipelineResult` as `@askdb/core`'s `ask()`, including optional `unboundSql`, `params`, `parameters`, and `preparedQuery` when the model complies (default `parameterize: true`). The facade forwards options and returns the core result verbatim — no client-side binding logic.
46
+
47
+ ```ts
48
+ import { bindPreparedQuery } from "@askdb/core";
49
+
50
+ const result = await askdb.ask("How many cities does Colorado have?", { tenantScope });
51
+
52
+ await pool.query(result.sql);
53
+ await pool.query(result.unboundSql!, result.params);
54
+
55
+ const rebound = bindPreparedQuery(result.preparedQuery!, {
56
+ state_name: "Utah",
57
+ ":tenant_agency_ids": authorizedAgencyIds,
58
+ });
59
+ await pool.query(rebound.sql);
60
+ ```
61
+
62
+ Every `ask()` is still one model call. Set `{ parameterize: false }` to opt out of the extra output tokens. `bindPreparedQuery` does not authorize tenant IDs — that remains the host's job when building `tenantScope`. Prefer `params` over `tenantParams` when using the new fields.
63
+
43
64
  ## Multi-tenant usage
44
65
 
45
66
  The schema and model caches are **per-client-instance**. For multi-tenant servers where each tenant has a different schema, either:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askdb/client",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.6",
4
4
  "description": "Config-aware AskDB facade: resolves schema, model, and dialect from config so callers only pass a question.",
5
5
  "keywords": [
6
6
  "askdb",
@@ -8,7 +8,7 @@
8
8
  "facade",
9
9
  "client"
10
10
  ],
11
- "homepage": "https://github.com/Ygilany/AskDB#readme",
11
+ "homepage": "https://askdb.tools/reference/client-api/",
12
12
  "bugs": {
13
13
  "url": "https://github.com/Ygilany/AskDB/issues"
14
14
  },
@@ -20,12 +20,14 @@
20
20
  "license": "Apache-2.0",
21
21
  "author": "Yahya Gilany",
22
22
  "type": "module",
23
+ "sideEffects": false,
23
24
  "main": "./dist/index.js",
24
25
  "types": "./dist/index.d.ts",
25
26
  "exports": {
26
27
  ".": {
27
28
  "types": "./dist/index.d.ts",
28
- "import": "./dist/index.js"
29
+ "import": "./dist/index.js",
30
+ "default": "./dist/index.js"
29
31
  }
30
32
  },
31
33
  "files": [
@@ -35,22 +37,22 @@
35
37
  "NOTICE"
36
38
  ],
37
39
  "engines": {
38
- "node": ">=22"
40
+ "node": ">=22.12"
39
41
  },
40
42
  "peerDependencies": {
41
- "ai": "^7.0.51",
42
- "@askdb/config": "^1.0.0-beta.10",
43
- "@askdb/core": "^1.0.0-beta.41"
43
+ "ai": "^7.0.113",
44
+ "@askdb/config": "^1.0.0-beta.12",
45
+ "@askdb/core": "^1.0.0-beta.43"
44
46
  },
45
47
  "devDependencies": {
46
- "ai": "^7.0.51",
48
+ "ai": "^7.0.113",
47
49
  "typescript": "^6.0.3",
48
- "vitest": "^4.1.10",
49
- "@askdb/config": "1.0.0-beta.10",
50
- "@askdb/core": "1.0.0-beta.41"
50
+ "vitest": "^5.0.1",
51
+ "@askdb/config": "1.0.0-beta.12",
52
+ "@askdb/core": "1.0.0-beta.43"
51
53
  },
52
54
  "dependencies": {
53
- "@askdb/ai": "^0.1.0-beta.5"
55
+ "@askdb/ai": "^0.1.0-beta.7"
54
56
  },
55
57
  "scripts": {
56
58
  "build": "tsc -p tsconfig.build.json",