@rebasepro/server-postgresql 0.0.1-canary.5584634 → 0.0.1-canary.94dff14
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.
|
|
4
|
+
"version": "0.0.1-canary.94dff14",
|
|
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/
|
|
68
|
-
"@rebasepro/
|
|
69
|
-
"@rebasepro/
|
|
70
|
-
"@rebasepro/
|
|
67
|
+
"@rebasepro/common": "0.0.1-canary.94dff14",
|
|
68
|
+
"@rebasepro/utils": "0.0.1-canary.94dff14",
|
|
69
|
+
"@rebasepro/server-core": "0.0.1-canary.94dff14",
|
|
70
|
+
"@rebasepro/types": "0.0.1-canary.94dff14"
|
|
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: "
|
|
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
|
|
194
|
-
expect(mapPgType("json")).toBe("
|
|
195
|
-
expect(mapPgType("jsonb")).toBe("
|
|
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
|
|
198
|
-
expect(mapPgType("ARRAY")).toBe("
|
|
199
|
-
expect(mapPgType("_int4")).toBe("
|
|
200
|
-
expect(mapPgType("_text")).toBe("
|
|
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("
|
|
353
|
+
it("generates import statements and collections array", () => {
|
|
354
354
|
const result = generateIndexContent(["users"]);
|
|
355
|
-
expect(result).
|
|
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 = '
|
|
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
|
|
367
|
-
expect(result).toContain('
|
|
368
|
-
|
|
369
|
-
expect(result
|
|
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 = '
|
|
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
|
});
|