@event-driven-io/dumbo 0.13.0-beta.3 → 0.13.0-beta.30
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/chunk-4SM4JJJZ.js +83 -0
- package/dist/chunk-4SM4JJJZ.js.map +1 -0
- package/dist/chunk-EEKBLOCH.cjs +706 -0
- package/dist/chunk-EEKBLOCH.cjs.map +1 -0
- package/dist/{chunk-OJ34O3Q2.cjs → chunk-GVR3PSDL.cjs} +2474 -1636
- package/dist/chunk-GVR3PSDL.cjs.map +1 -0
- package/dist/chunk-HZM7GDOT.cjs +34 -0
- package/dist/chunk-HZM7GDOT.cjs.map +1 -0
- package/dist/{chunk-N7RWT46K.js → chunk-JKE6SULM.js} +2522 -1684
- package/dist/chunk-JKE6SULM.js.map +1 -0
- package/dist/chunk-MOPKHYYU.cjs +83 -0
- package/dist/chunk-MOPKHYYU.cjs.map +1 -0
- package/dist/chunk-RA2L3FQW.js +481 -0
- package/dist/chunk-RA2L3FQW.js.map +1 -0
- package/dist/chunk-UA542GT3.cjs +481 -0
- package/dist/chunk-UA542GT3.cjs.map +1 -0
- package/dist/chunk-WLWELSA2.js +34 -0
- package/dist/chunk-WLWELSA2.js.map +1 -0
- package/dist/chunk-XFEGS3YT.js +706 -0
- package/dist/chunk-XFEGS3YT.js.map +1 -0
- package/dist/cloudflare.cjs +456 -0
- package/dist/cloudflare.cjs.map +1 -0
- package/dist/cloudflare.d.cts +92 -0
- package/dist/cloudflare.d.ts +92 -0
- package/dist/cloudflare.js +456 -0
- package/dist/cloudflare.js.map +1 -0
- package/dist/{columnProcessors-DMPpTPqM.d.ts → columnProcessors-Be2uMYjS.d.cts} +1 -1
- package/dist/{columnProcessors-BX-sH7ah.d.cts → columnProcessors-D0ivj_SU.d.ts} +1 -1
- package/dist/{connectionString-B1wm0TFc.d.cts → connectionString-Dch_MIRU.d.cts} +394 -168
- package/dist/{connectionString-B1wm0TFc.d.ts → connectionString-Dch_MIRU.d.ts} +394 -168
- package/dist/index.cjs +100 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -18
- package/dist/index.d.ts +23 -18
- package/dist/index.js +105 -9
- package/dist/index.js.map +1 -1
- package/dist/pg.cjs +383 -9
- package/dist/pg.cjs.map +1 -1
- package/dist/pg.d.cts +81 -105
- package/dist/pg.d.ts +81 -105
- package/dist/pg.js +435 -61
- package/dist/pg.js.map +1 -1
- package/dist/postgresql.cjs +50 -0
- package/dist/postgresql.cjs.map +1 -0
- package/dist/postgresql.d.cts +61 -0
- package/dist/postgresql.d.ts +61 -0
- package/dist/postgresql.js +50 -0
- package/dist/sqlite.cjs +60 -0
- package/dist/sqlite.cjs.map +1 -0
- package/dist/{index-C2z_XBn6.d.ts → sqlite.d.cts} +69 -20
- package/dist/{index-C0h0c380.d.cts → sqlite.d.ts} +69 -20
- package/dist/sqlite.js +60 -0
- package/dist/sqlite3.cjs +319 -6
- package/dist/sqlite3.cjs.map +1 -1
- package/dist/sqlite3.d.cts +45 -25
- package/dist/sqlite3.d.ts +45 -25
- package/dist/sqlite3.js +335 -22
- package/dist/sqlite3.js.map +1 -1
- package/package.json +55 -33
- package/dist/chunk-A7TC7IOP.cjs +0 -55
- package/dist/chunk-A7TC7IOP.cjs.map +0 -1
- package/dist/chunk-F7JQ7BX7.js +0 -240
- package/dist/chunk-F7JQ7BX7.js.map +0 -1
- package/dist/chunk-I34X53VL.js +0 -688
- package/dist/chunk-I34X53VL.js.map +0 -1
- package/dist/chunk-ISNF6USX.cjs +0 -688
- package/dist/chunk-ISNF6USX.cjs.map +0 -1
- package/dist/chunk-IYEHOE4S.cjs +0 -405
- package/dist/chunk-IYEHOE4S.cjs.map +0 -1
- package/dist/chunk-L2YZQAG3.cjs +0 -240
- package/dist/chunk-L2YZQAG3.cjs.map +0 -1
- package/dist/chunk-N7RWT46K.js.map +0 -1
- package/dist/chunk-OJ34O3Q2.cjs.map +0 -1
- package/dist/chunk-TXSETOGH.js +0 -55
- package/dist/chunk-TXSETOGH.js.map +0 -1
- package/dist/chunk-XVV3OOQX.js +0 -405
- package/dist/chunk-XVV3OOQX.js.map +0 -1
- package/dist/d1.cjs +0 -277
- package/dist/d1.cjs.map +0 -1
- package/dist/d1.d.cts +0 -72
- package/dist/d1.d.ts +0 -72
- package/dist/d1.js +0 -277
- package/dist/d1.js.map +0 -1
- package/dist/pg-3ACXFMU4.cjs +0 -59
- package/dist/pg-3ACXFMU4.cjs.map +0 -1
- package/dist/pg-GHOW3XSG.js +0 -59
- package/dist/sqlite3-EEIKQCJR.js +0 -25
- package/dist/sqlite3-SE4DDYZE.cjs +0 -25
- package/dist/sqlite3-SE4DDYZE.cjs.map +0 -1
- /package/dist/{pg-GHOW3XSG.js.map → postgresql.js.map} +0 -0
- /package/dist/{sqlite3-EEIKQCJR.js.map → sqlite.js.map} +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SQL,
|
|
3
|
+
exists
|
|
4
|
+
} from "./chunk-JKE6SULM.js";
|
|
5
|
+
|
|
6
|
+
// src/storage/postgresql/core/connections/connectionString.ts
|
|
7
|
+
var defaultPostgreSQLConnectionString = "postgresql://postgres@localhost:5432/postgres";
|
|
8
|
+
var PostgreSQLConnectionString = (connectionString) => {
|
|
9
|
+
if (!connectionString.startsWith("postgresql://") && !connectionString.startsWith("postgres://")) {
|
|
10
|
+
throw new Error(
|
|
11
|
+
`Invalid PostgreSQL connection string: ${connectionString}. It should start with "postgresql://".`
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
return connectionString;
|
|
15
|
+
};
|
|
16
|
+
function parseDatabaseName(str) {
|
|
17
|
+
if (str.charAt(0) === "/") {
|
|
18
|
+
const parts = str.split(" ");
|
|
19
|
+
return parts[1] || null;
|
|
20
|
+
}
|
|
21
|
+
if (/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(str)) {
|
|
22
|
+
str = encodeURI(str).replace(/%25(\d\d)/g, "%$1");
|
|
23
|
+
}
|
|
24
|
+
let result;
|
|
25
|
+
try {
|
|
26
|
+
result = new URL(str, "postgres://base");
|
|
27
|
+
} catch {
|
|
28
|
+
try {
|
|
29
|
+
result = new URL(str.replace("@/", "@___DUMMY___/"), "postgres://base");
|
|
30
|
+
} catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (result.protocol === "socket:") {
|
|
35
|
+
return result.searchParams.get("db");
|
|
36
|
+
}
|
|
37
|
+
const pathname = result.pathname.slice(1) || null;
|
|
38
|
+
return pathname ? decodeURI(pathname) : null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/storage/postgresql/core/schema/schema.ts
|
|
42
|
+
var defaultPostgreSqlDatabase = "postgres";
|
|
43
|
+
var tableExistsSQL = (tableName) => SQL`
|
|
44
|
+
SELECT EXISTS (
|
|
45
|
+
SELECT FROM pg_tables
|
|
46
|
+
WHERE tablename = ${tableName}
|
|
47
|
+
) AS exists;`;
|
|
48
|
+
var tableExists = async (execute, tableName) => exists(execute.query(tableExistsSQL(tableName)));
|
|
49
|
+
var functionExistsSQL = (functionName) => SQL`
|
|
50
|
+
SELECT EXISTS (
|
|
51
|
+
SELECT FROM pg_proc
|
|
52
|
+
WHERE
|
|
53
|
+
proname = ${functionName}
|
|
54
|
+
) AS exists;`;
|
|
55
|
+
var functionExists = async (execute, functionName) => exists(execute.query(functionExistsSQL(functionName)));
|
|
56
|
+
|
|
57
|
+
// src/storage/postgresql/core/schema/postgreSQLMetadata.ts
|
|
58
|
+
var postgreSQLMetadata = {
|
|
59
|
+
databaseType: "PostgreSQL",
|
|
60
|
+
defaultDatabaseName: defaultPostgreSqlDatabase,
|
|
61
|
+
capabilities: {
|
|
62
|
+
supportsSchemas: true,
|
|
63
|
+
supportsFunctions: true,
|
|
64
|
+
supportsMultipleDatabases: true
|
|
65
|
+
},
|
|
66
|
+
tableExists,
|
|
67
|
+
functionExists,
|
|
68
|
+
parseDatabaseName: (connectionString) => (connectionString ? parseDatabaseName(connectionString) : null) ?? defaultPostgreSqlDatabase
|
|
69
|
+
};
|
|
70
|
+
dumboDatabaseMetadataRegistry.register("PostgreSQL", postgreSQLMetadata);
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
defaultPostgreSQLConnectionString,
|
|
74
|
+
PostgreSQLConnectionString,
|
|
75
|
+
parseDatabaseName,
|
|
76
|
+
defaultPostgreSqlDatabase,
|
|
77
|
+
tableExistsSQL,
|
|
78
|
+
tableExists,
|
|
79
|
+
functionExistsSQL,
|
|
80
|
+
functionExists,
|
|
81
|
+
postgreSQLMetadata
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=chunk-4SM4JJJZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/storage/postgresql/core/connections/connectionString.ts","../src/storage/postgresql/core/schema/schema.ts","../src/storage/postgresql/core/schema/postgreSQLMetadata.ts"],"sourcesContent":["import type { DatabaseConnectionString } from '../../../all';\n\nexport const defaultPostgreSQLConnectionString: PostgreSQLConnectionString =\n 'postgresql://postgres@localhost:5432/postgres' as PostgreSQLConnectionString;\n\nexport type PostgreSQLConnectionString = DatabaseConnectionString<\n 'PostgreSQL',\n `postgresql://${string}` | `postgres://${string}`\n>;\n\nexport const PostgreSQLConnectionString = (\n connectionString: string,\n): PostgreSQLConnectionString => {\n if (\n !connectionString.startsWith('postgresql://') &&\n !connectionString.startsWith('postgres://')\n ) {\n throw new Error(\n `Invalid PostgreSQL connection string: ${connectionString}. It should start with \"postgresql://\".`,\n );\n }\n return connectionString as PostgreSQLConnectionString;\n};\n\n// Stripped from https://github.com/brianc/node-postgres\n// Copyright (c) 2010-2014 Brian Carlson (brian.m.carlson@gmail.com)\n// MIT License\n/**\n * Parse database name from a PostgreSQL connection string\n */\nexport function parseDatabaseName(str: string): string | null {\n // Unix socket format: /path/to/socket database_name\n if (str.charAt(0) === '/') {\n const parts = str.split(' ');\n return parts[1] || null;\n }\n\n // Encode spaces if present\n if (/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(str)) {\n str = encodeURI(str).replace(/%25(\\d\\d)/g, '%$1');\n }\n\n let result: URL;\n try {\n result = new URL(str, 'postgres://base');\n } catch {\n // Try with dummy host for malformed URLs\n try {\n result = new URL(str.replace('@/', '@___DUMMY___/'), 'postgres://base');\n } catch {\n return null;\n }\n }\n\n // Socket protocol: socket://path?db=dbname\n if (result.protocol === 'socket:') {\n return result.searchParams.get('db');\n }\n\n // Standard URL: postgres://user:pass@host:port/database\n const pathname = result.pathname.slice(1) || null;\n return pathname ? decodeURI(pathname) : null;\n}\n","import { exists, SQL, type SQLExecutor } from '../../../../core';\nexport * from './schema';\n\nexport const defaultPostgreSqlDatabase = 'postgres';\n\nexport const tableExistsSQL = (tableName: string): SQL =>\n SQL`\n SELECT EXISTS (\n SELECT FROM pg_tables\n WHERE tablename = ${tableName}\n ) AS exists;`;\n\nexport const tableExists = async (\n execute: SQLExecutor,\n tableName: string,\n): Promise<boolean> => exists(execute.query(tableExistsSQL(tableName)));\n\nexport const functionExistsSQL = (functionName: string): SQL =>\n SQL`\n SELECT EXISTS (\n SELECT FROM pg_proc\n WHERE\n proname = ${functionName}\n ) AS exists;`;\n\nexport const functionExists = async (\n execute: SQLExecutor,\n functionName: string,\n): Promise<boolean> => exists(execute.query(functionExistsSQL(functionName)));\n","import type { DatabaseMetadata } from '../../../../core';\nimport { parseDatabaseName } from '../connections';\nimport {\n defaultPostgreSqlDatabase,\n functionExists,\n tableExists,\n} from './schema';\n\nexport const postgreSQLMetadata: DatabaseMetadata<true, true, true> = {\n databaseType: 'PostgreSQL',\n defaultDatabaseName: defaultPostgreSqlDatabase,\n capabilities: {\n supportsSchemas: true,\n supportsFunctions: true,\n supportsMultipleDatabases: true,\n },\n tableExists,\n functionExists,\n parseDatabaseName: (connectionString?: string) =>\n (connectionString ? parseDatabaseName(connectionString) : null) ??\n defaultPostgreSqlDatabase,\n};\n\ndumboD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