@linabase/js 0.5.0 → 0.5.1

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.cjs CHANGED
@@ -52,7 +52,12 @@ var DatabaseClient = class {
52
52
  // ─── Query Methods ──────────────────────────────────────
53
53
  /** Select columns. Supports nested joins: "*, comments(*)" and aliases: "full_name:name" */
54
54
  select(columns, options) {
55
- this.method = options?.head ? "HEAD" : "GET";
55
+ const isMutation = this.method === "POST" || this.method === "PATCH" || this.method === "DELETE";
56
+ if (!isMutation) {
57
+ this.method = options?.head ? "HEAD" : "GET";
58
+ } else if (!this.preferHeaders.some((h) => h.startsWith("return="))) {
59
+ this.preferHeaders.push("return=representation");
60
+ }
56
61
  if (columns && columns !== "*") this.params.set("select", columns);
57
62
  if (options?.count) this.preferHeaders.push(`count=${options.count}`);
58
63
  return this;
package/dist/index.js CHANGED
@@ -20,7 +20,12 @@ var DatabaseClient = class {
20
20
  // ─── Query Methods ──────────────────────────────────────
21
21
  /** Select columns. Supports nested joins: "*, comments(*)" and aliases: "full_name:name" */
22
22
  select(columns, options) {
23
- this.method = options?.head ? "HEAD" : "GET";
23
+ const isMutation = this.method === "POST" || this.method === "PATCH" || this.method === "DELETE";
24
+ if (!isMutation) {
25
+ this.method = options?.head ? "HEAD" : "GET";
26
+ } else if (!this.preferHeaders.some((h) => h.startsWith("return="))) {
27
+ this.preferHeaders.push("return=representation");
28
+ }
24
29
  if (columns && columns !== "*") this.params.set("select", columns);
25
30
  if (options?.count) this.preferHeaders.push(`count=${options.count}`);
26
31
  return this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linabase/js",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "JavaScript/TypeScript client SDK for Linabase (database, storage, auth)",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,23 +35,24 @@
35
35
  "directory": "packages/sdk-js"
36
36
  },
37
37
  "homepage": "https://linabase.com",
38
- "devDependencies": {
39
- "@types/pg": "^8.11.0",
40
- "@vitest/coverage-v8": "^3.2.4",
41
- "pg": "^8.13.0",
42
- "tsup": "^8.3.0",
43
- "typescript": "^5.7.0",
44
- "vitest": "^3.2.1",
45
- "@linabase/rest-api": "0.0.1",
46
- "@linabase/db": "0.0.1"
47
- },
48
38
  "scripts": {
49
39
  "build": "tsup",
50
40
  "dev": "tsup --watch",
41
+ "prepublishOnly": "tsup",
51
42
  "test": "vitest run",
52
43
  "test:watch": "vitest",
53
44
  "test:coverage": "vitest run --coverage",
54
45
  "typecheck": "tsc --noEmit",
55
46
  "lint": "eslint src/"
47
+ },
48
+ "devDependencies": {
49
+ "@linabase/db": "workspace:*",
50
+ "@linabase/rest-api": "workspace:*",
51
+ "@types/pg": "^8.11.0",
52
+ "@vitest/coverage-v8": "^3.2.4",
53
+ "pg": "^8.13.0",
54
+ "tsup": "^8.3.0",
55
+ "typescript": "^5.7.0",
56
+ "vitest": "^3.2.1"
56
57
  }
57
- }
58
+ }