@aaqu/fromcubes-db 0.0.0-stage → 0.1.0
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/LICENSE +201 -0
- package/NOTICE +24 -0
- package/README.md +442 -2
- package/SECURITY.md +75 -0
- package/THIRD-PARTY-NOTICES.md +151 -0
- package/examples/Quick Start/All Databases.json +1719 -0
- package/examples/Quick Start/ClickHouse.json +278 -0
- package/examples/Quick Start/CockroachDB.json +280 -0
- package/examples/Quick Start/Firebird.json +278 -0
- package/examples/Quick Start/MariaDB.json +281 -0
- package/examples/Quick Start/MySQL.json +281 -0
- package/examples/Quick Start/Oracle.json +280 -0
- package/examples/Quick Start/PostgreSQL.json +280 -0
- package/examples/Quick Start/SQL Server.json +282 -0
- package/examples/Quick Start/SQLite.json +278 -0
- package/examples/Quick Start/TiDB.json +281 -0
- package/examples/Quick Start/YugabyteDB.json +280 -0
- package/examples/SQLite Sensor Log With Portal.json +391 -0
- package/examples/Select With Parameters.json +130 -0
- package/index.js +32 -0
- package/lib/adapters/clickhouse.js +254 -0
- package/lib/adapters/firebird.js +416 -0
- package/lib/adapters/index.js +37 -0
- package/lib/adapters/mssql.js +178 -0
- package/lib/adapters/mysql.js +171 -0
- package/lib/adapters/oracle.js +272 -0
- package/lib/adapters/postgres.js +161 -0
- package/lib/adapters/read.js +57 -0
- package/lib/adapters/sqlite.js +193 -0
- package/lib/adapters/time.js +89 -0
- package/lib/bound.js +29 -0
- package/lib/editor-api.js +134 -0
- package/lib/editor-preview.js +191 -0
- package/lib/errors.js +66 -0
- package/lib/params.js +966 -0
- package/lib/pool.js +391 -0
- package/lib/settings.js +302 -0
- package/lib/sql/compile.js +160 -0
- package/lib/sql/dialect.js +194 -0
- package/lib/sql/parse.js +202 -0
- package/lib/sql/types.js +1071 -0
- package/lib/sqlite-files.js +137 -0
- package/nodes/connection.html +728 -0
- package/nodes/connection.js +179 -0
- package/nodes/editor/ark-pixel.LICENSE.txt +96 -0
- package/nodes/editor/ark-pixel.woff2 +0 -0
- package/nodes/editor/mark.svg +5 -0
- package/nodes/editor/sql-editor.css +604 -0
- package/nodes/editor/sql-editor.js +1490 -0
- package/nodes/editor/sql-model.js +203 -0
- package/nodes/icons/fromcubes-db.svg +24 -0
- package/nodes/query.html +662 -0
- package/nodes/query.js +195 -0
- package/package.json +81 -4
package/lib/errors.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One error hierarchy for every driver, so a flow can react to "duplicate key"
|
|
5
|
+
* the same way whether it talks to Postgres or Oracle.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
class DbError extends Error {
|
|
9
|
+
/**
|
|
10
|
+
* @param {string} message
|
|
11
|
+
* @param {{ dialect?: string, driverCode?: string|number, cause?: unknown }} [options]
|
|
12
|
+
*/
|
|
13
|
+
constructor(message, options = {}) {
|
|
14
|
+
super(message, options.cause === undefined ? undefined : { cause: options.cause });
|
|
15
|
+
this.name = new.target.name;
|
|
16
|
+
this.dialect = options.dialect;
|
|
17
|
+
/** Native driver code, verbatim (SQLSTATE, ORA-number, mssql number...). */
|
|
18
|
+
this.driverCode = options.driverCode;
|
|
19
|
+
if (Error.captureStackTrace) Error.captureStackTrace(this, new.target);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** SQL text could not be parsed (unterminated string, unterminated comment, ...). */
|
|
24
|
+
class SqlSyntaxError extends DbError {}
|
|
25
|
+
|
|
26
|
+
/** A placeholder has no value, a value has the wrong shape, or config is invalid. */
|
|
27
|
+
class ParameterError extends DbError {}
|
|
28
|
+
|
|
29
|
+
/** Could not reach the server, credentials rejected, pool unavailable. */
|
|
30
|
+
class ConnectionError extends DbError {}
|
|
31
|
+
|
|
32
|
+
/** The pool is shutting down or was closed by a redeploy. */
|
|
33
|
+
class PoolClosedError extends ConnectionError {}
|
|
34
|
+
|
|
35
|
+
/** Ran out of time acquiring a connection or waiting for a statement. */
|
|
36
|
+
class TimeoutError extends DbError {}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* More queries are waiting for a free connection than the queue limit allows.
|
|
40
|
+
* Failing here is the point: the alternative is holding every message in memory
|
|
41
|
+
* until the process dies.
|
|
42
|
+
*/
|
|
43
|
+
class QueueOverflowError extends DbError {}
|
|
44
|
+
|
|
45
|
+
/** The server rejected the statement. */
|
|
46
|
+
class QueryError extends DbError {}
|
|
47
|
+
|
|
48
|
+
class UniqueViolationError extends QueryError {}
|
|
49
|
+
class ForeignKeyViolationError extends QueryError {}
|
|
50
|
+
class NotNullViolationError extends QueryError {}
|
|
51
|
+
class CheckViolationError extends QueryError {}
|
|
52
|
+
|
|
53
|
+
module.exports = {
|
|
54
|
+
DbError,
|
|
55
|
+
SqlSyntaxError,
|
|
56
|
+
ParameterError,
|
|
57
|
+
ConnectionError,
|
|
58
|
+
PoolClosedError,
|
|
59
|
+
QueueOverflowError,
|
|
60
|
+
TimeoutError,
|
|
61
|
+
QueryError,
|
|
62
|
+
UniqueViolationError,
|
|
63
|
+
ForeignKeyViolationError,
|
|
64
|
+
NotNullViolationError,
|
|
65
|
+
CheckViolationError,
|
|
66
|
+
};
|