@rebasepro/server-postgresql 0.0.1-canary.b0e0642 → 0.0.1-canary.bbcb8b4

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rebasepro/server-postgresql",
3
3
  "type": "module",
4
- "version": "0.0.1-canary.b0e0642",
4
+ "version": "0.0.1-canary.bbcb8b4",
5
5
  "description": "PostgreSQL data source backend implementation for Rebase with Drizzle ORM",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/rebaseco"
@@ -64,10 +64,10 @@
64
64
  "drizzle-orm": "^0.44.4",
65
65
  "execa": "^4.1.0",
66
66
  "pg": "^8.11.3",
67
- "@rebasepro/common": "0.0.1-canary.b0e0642",
68
- "@rebasepro/server-core": "0.0.1-canary.b0e0642",
69
- "@rebasepro/utils": "0.0.1-canary.b0e0642",
70
- "@rebasepro/types": "0.0.1-canary.b0e0642"
67
+ "@rebasepro/types": "0.0.1-canary.bbcb8b4",
68
+ "@rebasepro/common": "0.0.1-canary.bbcb8b4",
69
+ "@rebasepro/server-core": "0.0.1-canary.bbcb8b4",
70
+ "@rebasepro/utils": "0.0.1-canary.bbcb8b4"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@types/jest": "^29.5.14",
@@ -49,7 +49,7 @@ describe("generateCollectionFile", () => {
49
49
  expect(result).toContain('type: "number"');
50
50
  expect(result).toContain('type: "boolean"');
51
51
  expect(result).toContain('type: "date"');
52
- expect(result).toContain('type: "json"');
52
+ expect(result).toContain('type: "map"');
53
53
  });
54
54
 
55
55
  it("skips FK columns from properties (they become relations)", () => {
@@ -190,14 +190,14 @@ describe("mapPgType", () => {
190
190
  expect(mapPgType(t)).toBe("date");
191
191
  }
192
192
  });
193
- it("maps JSON types to json", () => {
194
- expect(mapPgType("json")).toBe("json");
195
- expect(mapPgType("jsonb")).toBe("json");
193
+ it("maps JSON types to map", () => {
194
+ expect(mapPgType("json")).toBe("map");
195
+ expect(mapPgType("jsonb")).toBe("map");
196
196
  });
197
- it("maps ARRAY and underscore-prefixed types to json", () => {
198
- expect(mapPgType("ARRAY")).toBe("json");
199
- expect(mapPgType("_int4")).toBe("json");
200
- expect(mapPgType("_text")).toBe("json");
197
+ it("maps ARRAY and underscore-prefixed types to array", () => {
198
+ expect(mapPgType("ARRAY")).toBe("array");
199
+ expect(mapPgType("_int4")).toBe("array");
200
+ expect(mapPgType("_text")).toBe("array");
201
201
  });
202
202
  it("maps string-like types to string", () => {
203
203
  for (const t of ["text", "varchar", "character varying", "char", "character", "uuid", "bytea", "inet", "cidr", "macaddr", "macaddr8", "interval"]) {
@@ -350,9 +350,12 @@ describe("generateIndexContent", () => {
350
350
  expect(lines[2]).toContain("zebra");
351
351
  });
352
352
 
353
- it("each line is a default re-export", () => {
353
+ it("generates import statements and collections array", () => {
354
354
  const result = generateIndexContent(["users"]);
355
- expect(result).toBe('export { default as users } from "./users";\n');
355
+ expect(result).toContain('import usersCollection from "./users";');
356
+ expect(result).toContain('export const collections = [');
357
+ expect(result).toContain(' usersCollection,');
358
+ expect(result).toContain('];');
356
359
  });
357
360
  });
358
361
 
@@ -361,16 +364,16 @@ describe("generateIndexContent", () => {
361
364
  // ═══════════════════════════════════════════════════════════════════════
362
365
  describe("mergeIndexContent", () => {
363
366
  it("adds new exports without duplicating existing ones", () => {
364
- const existing = 'export { default as users } from "./users";\n';
367
+ const existing = 'import usersCollection from "./users";\n\nexport const collections = [\n usersCollection,\n];\n';
365
368
  const result = mergeIndexContent(existing, ["users", "posts"]);
366
- expect(result.match(/users/g)!.length).toBe(2); // one in existing, one mention in "users" still just 1 export line
367
- expect(result).toContain('export { default as posts } from "./posts";');
368
- // users should appear exactly once as an export statement
369
- expect(result.match(/export.*users.*from/g)!.length).toBe(1);
369
+ expect(result.match(/import usersCollection from ".\/users";/g)!.length).toBe(1);
370
+ expect(result).toContain('import postsCollection from "./posts";');
371
+ expect(result).toContain('usersCollection,');
372
+ expect(result).toContain('postsCollection,');
370
373
  });
371
374
 
372
375
  it("returns existing content trimmed + newline when no new files", () => {
373
- const existing = 'export { default as a } from "./a";\n';
376
+ const existing = 'import aCollection from "./a";\n\nexport const collections = [\n aCollection,\n];\n';
374
377
  const result = mergeIndexContent(existing, ["a"]);
375
378
  expect(result.trim()).toBe(existing.trim());
376
379
  });