@portqueue/core 1.0.0 → 1.0.2
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/README.md +5 -5
- package/dist/conformance/index.cjs +1 -1
- package/dist/conformance/index.mjs +1 -1
- package/dist/constants/storage.constants.d.ts +2 -2
- package/dist/drivers/driver-context.d.ts +1 -1
- package/dist/drivers/driver.interface.d.ts +1 -1
- package/dist/drivers/mysql/index.cjs +3 -3
- package/dist/drivers/mysql/index.cjs.map +1 -1
- package/dist/drivers/mysql/index.mjs +3 -3
- package/dist/drivers/mysql/index.mjs.map +1 -1
- package/dist/drivers/mysql/mysql-driver.d.ts +1 -1
- package/dist/drivers/oracle/index.cjs +3 -3
- package/dist/drivers/oracle/index.cjs.map +1 -1
- package/dist/drivers/oracle/index.mjs +3 -3
- package/dist/drivers/oracle/index.mjs.map +1 -1
- package/dist/drivers/oracle/oracle-driver.d.ts +1 -1
- package/dist/drivers/pglite/index.cjs +7 -7
- package/dist/drivers/pglite/index.cjs.map +1 -1
- package/dist/drivers/pglite/index.mjs +6 -6
- package/dist/drivers/pglite/index.mjs.map +1 -1
- package/dist/drivers/pglite/migrations.d.ts +2 -2
- package/dist/drivers/pglite/pglite-driver.d.ts +7 -7
- package/dist/drivers/postgresql/index.cjs +5 -0
- package/dist/drivers/postgresql/index.d.ts +2 -0
- package/dist/drivers/postgresql/index.mjs +5 -0
- package/dist/drivers/{postgres → postgresql}/migrations.d.ts +5 -5
- package/dist/drivers/{postgres/postgres-driver.d.ts → postgresql/postgresql-driver.d.ts} +7 -7
- package/dist/drivers/shared/base-driver.d.ts +4 -4
- package/dist/drivers/shared/migration-runner.service.d.ts +1 -1
- package/dist/drivers/sqlite/index.cjs +2 -2
- package/dist/drivers/sqlite/index.cjs.map +1 -1
- package/dist/drivers/sqlite/index.mjs +2 -2
- package/dist/drivers/sqlite/index.mjs.map +1 -1
- package/dist/drivers/table-names.d.ts +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/dist/{migration-CWBCpwFH.cjs → migration-CoTjpgBl.cjs} +7 -7
- package/dist/migration-CoTjpgBl.cjs.map +1 -0
- package/dist/{migration-CQsAizIw.js → migration-D73ANkYV.js} +7 -7
- package/dist/migration-D73ANkYV.js.map +1 -0
- package/dist/options/enums.d.ts +1 -1
- package/dist/{postgres-driver-eWlY7pVg.js → postgresql-driver-BUHuyRYj.js} +14 -14
- package/dist/postgresql-driver-BUHuyRYj.js.map +1 -0
- package/dist/{postgres-driver-F9-TIi38.cjs → postgresql-driver-CIk94XCq.cjs} +14 -14
- package/dist/postgresql-driver-CIk94XCq.cjs.map +1 -0
- package/dist/{storage.constants-CIkf7BAJ.cjs → storage.constants-B5oQjxp5.cjs} +2 -2
- package/dist/storage.constants-B5oQjxp5.cjs.map +1 -0
- package/dist/{storage.constants-BDS_q-_N.js → storage.constants-DwSzjjMZ.js} +2 -2
- package/dist/storage.constants-DwSzjjMZ.js.map +1 -0
- package/dist/tx/index.cjs +8 -8
- package/dist/tx/index.cjs.map +1 -1
- package/dist/tx/index.mjs +8 -8
- package/dist/tx/index.mjs.map +1 -1
- package/package.json +6 -5
- package/dist/drivers/postgres/index.cjs +0 -5
- package/dist/drivers/postgres/index.d.ts +0 -2
- package/dist/drivers/postgres/index.mjs +0 -5
- package/dist/migration-CQsAizIw.js.map +0 -1
- package/dist/migration-CWBCpwFH.cjs.map +0 -1
- package/dist/postgres-driver-F9-TIi38.cjs.map +0 -1
- package/dist/postgres-driver-eWlY7pVg.js.map +0 -1
- package/dist/storage.constants-BDS_q-_N.js.map +0 -1
- package/dist/storage.constants-CIkf7BAJ.cjs.map +0 -1
- /package/dist/drivers/{postgres → postgresql}/index.cjs.map +0 -0
- /package/dist/drivers/{postgres → postgresql}/index.mjs.map +0 -0
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @portqueue/core
|
|
2
2
|
|
|
3
|
-
The engine and first-party drivers for **PortQueue** — a horizontally scalable, fault-tolerant, database-agnostic, performance-focused queue implementation, running on your own database (
|
|
3
|
+
The engine and first-party drivers for **PortQueue** — a horizontally scalable, fault-tolerant, database-agnostic, performance-focused queue implementation, running on your own database (PostgreSQL, MySQL, Oracle, PGLite, SQLite) through one API.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
npm install @portqueue/core
|
|
7
7
|
# + the client for your DB, e.g. one of:
|
|
8
|
-
npm install pg #
|
|
8
|
+
npm install pg # PostgreSQL
|
|
9
9
|
npm install mysql2 # MySQL
|
|
10
10
|
npm install oracledb # Oracle
|
|
11
11
|
npm install @electric-sql/pglite # PGLite (embedded/edge/tests)
|
|
@@ -14,9 +14,9 @@ npm install better-sqlite3 # SQLite
|
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { PortQueue } from '@portqueue/core';
|
|
17
|
-
import {
|
|
17
|
+
import { PostgresqlDriver } from '@portqueue/core/drivers/postgresql';
|
|
18
18
|
|
|
19
|
-
const pq = new PortQueue({ driver: new
|
|
19
|
+
const pq = new PortQueue({ driver: new PostgresqlDriver({ connectionString: process.env.DATABASE_URL }) });
|
|
20
20
|
await pq.init();
|
|
21
21
|
|
|
22
22
|
// Create the queue and provide a jobs handler.
|
|
@@ -32,7 +32,7 @@ await pq.addJob({ queue: 'emails', data: { to: 'a@b.com' } });
|
|
|
32
32
|
|
|
33
33
|
**Free and open source. Commercial use permitted. No license fee, no obligations.** (MIT)
|
|
34
34
|
|
|
35
|
-
- Subpath driver imports: `@portqueue/core/drivers/{
|
|
35
|
+
- Subpath driver imports: `@portqueue/core/drivers/{postgresql,mysql,oracle,pglite,sqlite}`
|
|
36
36
|
- Transaction adapters: `@portqueue/core/tx` (`fromKnex`, `fromPg`, …)
|
|
37
37
|
- Custom-driver conformance kit: `@portqueue/core/conformance`
|
|
38
38
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const storage_constants = require("../storage.constants-
|
|
3
|
+
const storage_constants = require("../storage.constants-B5oQjxp5.cjs");
|
|
4
4
|
const QUEUE = "conformance";
|
|
5
5
|
async function bootstrap(driver) {
|
|
6
6
|
await driver.connect();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as JobStatus, D as DriverCapability, M as MAX_BATCH_IDS, B as BackoffStrategy } from "../storage.constants-
|
|
1
|
+
import { J as JobStatus, D as DriverCapability, M as MAX_BATCH_IDS, B as BackoffStrategy } from "../storage.constants-DwSzjjMZ.js";
|
|
2
2
|
const QUEUE = "conformance";
|
|
3
3
|
async function bootstrap(driver) {
|
|
4
4
|
await driver.connect();
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
export declare const DEFAULT_TABLE_PREFIX = "pq_";
|
|
4
4
|
/** Logical prefix for pub/sub channels when several PortQueues share one database. */
|
|
5
5
|
export declare const DEFAULT_NAMESPACE = "portqueue";
|
|
6
|
-
/** Identifier length ceiling a driver assumes when it declares none (
|
|
6
|
+
/** Identifier length ceiling a driver assumes when it declares none (PostgreSQL' limit). */
|
|
7
7
|
export declare const DEFAULT_MAX_IDENTIFIER_LEN = 63;
|
|
8
8
|
/**
|
|
9
9
|
* The most ids one batch call may carry — `addJobs`, `requeueJobs`, `cancelJobs`, `removeJobs`,
|
|
10
10
|
* `deleteSchedules`, and the dashboard's bulk actions.
|
|
11
11
|
*
|
|
12
12
|
* Oracle caps the expressions in an `IN` list at 1000 and is the lowest of the engines here, so its
|
|
13
|
-
* limit is everyone's: a 1001-id batch that works on
|
|
13
|
+
* limit is everyone's: a 1001-id batch that works on PostgreSQL and raises ORA-01795 on Oracle is a
|
|
14
14
|
* portability bug the tool refuses up front rather than one a caller discovers in production. It is
|
|
15
15
|
* a cap on what a single *call* may ask for — a set that still needs several statements (an insert
|
|
16
16
|
* binds ~25 values per job) is chunked by `BaseDriver.chunkForBind` underneath.
|
|
@@ -6,7 +6,7 @@ import { TableNames } from './table-names';
|
|
|
6
6
|
* `schema` by qualifying every object name with it; SQLite has none and does not accept the option.
|
|
7
7
|
*/
|
|
8
8
|
export interface StorageOptions {
|
|
9
|
-
/** DB schema/namespace (
|
|
9
|
+
/** DB schema/namespace (PostgreSQL/PGLite/MySQL/Oracle). */
|
|
10
10
|
schema?: string;
|
|
11
11
|
/** Prefix for all created tables (default 'pq_'). */
|
|
12
12
|
tablePrefix?: string;
|
|
@@ -135,7 +135,7 @@ export interface Driver {
|
|
|
135
135
|
/**
|
|
136
136
|
* Apply one step's DDL and record its version.
|
|
137
137
|
*
|
|
138
|
-
* **In one transaction wherever the engine allows it** —
|
|
138
|
+
* **In one transaction wherever the engine allows it** — PostgreSQL, PGLite and SQLite all run DDL
|
|
139
139
|
* transactionally, so a crash there cannot leave an applied-but-unrecorded migration. MySQL and
|
|
140
140
|
* Oracle commit each DDL statement implicitly and no transaction can span them: those drivers run
|
|
141
141
|
* the statements and then record the version, in that order, so an interruption leaves the schema
|
|
@@ -22,8 +22,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
mod
|
|
23
23
|
));
|
|
24
24
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
25
|
-
const storage_constants = require("../../storage.constants-
|
|
26
|
-
const migration = require("../../migration-
|
|
25
|
+
const storage_constants = require("../../storage.constants-B5oQjxp5.cjs");
|
|
26
|
+
const migration = require("../../migration-CoTjpgBl.cjs");
|
|
27
27
|
function v1(names) {
|
|
28
28
|
const t = names.name;
|
|
29
29
|
const idx = names.derived;
|
|
@@ -134,7 +134,7 @@ class MysqlDriver extends migration.BaseDriver {
|
|
|
134
134
|
[storage_constants.DriverCapability.SKIP_LOCKED]: true,
|
|
135
135
|
[storage_constants.DriverCapability.TRANSACTIONS]: true,
|
|
136
136
|
// `GET_LOCK` is a genuine named lock, so the migration runner can serialize a concurrent first
|
|
137
|
-
// boot here exactly as it does on
|
|
137
|
+
// boot here exactly as it does on PostgreSQL. No RETURNING and no LISTEN/NOTIFY.
|
|
138
138
|
[storage_constants.DriverCapability.ADVISORY_LOCK]: true
|
|
139
139
|
});
|
|
140
140
|
migrations = migration.toMigrationSteps(MYSQL_MIGRATIONS);
|