@getstrata/core 0.5.47 → 0.5.49
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 +23 -0
- package/dist/entries/auth/scimAuthMiddleware.js +0 -3
- package/dist/entries/auth/sessionGuard.js +142 -2751
- package/dist/entries/database/transaction.js +1 -129
- package/dist/entries/http/formRequest.js +0 -3
- package/dist/entries/http/pagination.js +0 -3
- package/dist/entries/http/routeModelBinding.js +0 -3
- package/dist/entries/http/securedRouteModelBinding.js +0 -3
- package/dist/entries/http/throttleMiddleware.js +0 -3
- package/dist/entries/http/webErrorResponse.js +170 -2633
- package/dist/entries/http/webFormRequest.js +0 -3
- package/dist/entries/queue/createAppQueue.js +9 -29
- package/dist/entries/queue/failedJobRepository.js +0 -21
- package/dist/entries/queue/jobRunner.js +9 -8
- package/dist/entries/queue/publicQueue.js +9 -29
- package/dist/entries/queue/queueMetrics.js +9 -29
- package/dist/entries/queue/redisQueue.js +9 -8
- package/dist/entries/tenant/tenantDatabaseScope.js +0 -3
- package/dist/entries/view.js +164 -2750
- package/package.json +2 -2
|
@@ -137,9 +137,6 @@ function runWithTenant(tenant, callback) {
|
|
|
137
137
|
function currentTenant() {
|
|
138
138
|
return tenantContext.getStore() ?? null;
|
|
139
139
|
}
|
|
140
|
-
function currentTenantId() {
|
|
141
|
-
return currentTenant()?.id ?? 1;
|
|
142
|
-
}
|
|
143
140
|
function rateLimitMultiplierForPlan(plan) {
|
|
144
141
|
switch (plan) {
|
|
145
142
|
case "enterprise":
|
|
@@ -1383,14 +1383,6 @@ class BaseRepository {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
}
|
|
1385
1385
|
var baseRepository_default = BaseRepository;
|
|
1386
|
-
// ../../src/core/database/connection.ts
|
|
1387
|
-
function createDatabaseConnection(source) {
|
|
1388
|
-
return {
|
|
1389
|
-
async unsafe(query, params = []) {
|
|
1390
|
-
return await source.unsafe(query, params);
|
|
1391
|
-
}
|
|
1392
|
-
};
|
|
1393
|
-
}
|
|
1394
1386
|
// ../../src/core/database/model.ts
|
|
1395
1387
|
var modelRepositories = new WeakMap;
|
|
1396
1388
|
var modelGlobalScopes = new WeakMap;
|
|
@@ -2331,19 +2323,6 @@ function createSchemaBuilder(db, driver) {
|
|
|
2331
2323
|
function defineTable(definition) {
|
|
2332
2324
|
return definition;
|
|
2333
2325
|
}
|
|
2334
|
-
// ../../src/core/database/transaction.ts
|
|
2335
|
-
function supportsTransactions(connection) {
|
|
2336
|
-
return typeof connection.begin === "function";
|
|
2337
|
-
}
|
|
2338
|
-
async function runInTransaction(operation) {
|
|
2339
|
-
const pool = resolveRepositoryConnection();
|
|
2340
|
-
if (!supportsTransactions(pool)) {
|
|
2341
|
-
throw new Error("Active database connection does not support transactions. Bind a client with begin() via bindDatabaseConnection.");
|
|
2342
|
-
}
|
|
2343
|
-
return await pool.begin(async (transaction) => {
|
|
2344
|
-
return await operation(createDatabaseConnection(transaction));
|
|
2345
|
-
});
|
|
2346
|
-
}
|
|
2347
2326
|
// ../../src/core/queue/failedJobTable.ts
|
|
2348
2327
|
var failedJobTable = defineTable({
|
|
2349
2328
|
name: "failed_job",
|
|
@@ -2441,15 +2420,16 @@ function readSharedJobRegistry() {
|
|
|
2441
2420
|
}
|
|
2442
2421
|
var jobRegistry = readSharedJobRegistry();
|
|
2443
2422
|
|
|
2444
|
-
// ../../src/core/contracts/serviceTokens.ts
|
|
2445
|
-
var CORE_CONFIG_TOKEN = "core.config";
|
|
2446
|
-
var CORE_CACHE_TOKEN = "core.cache";
|
|
2447
|
-
var CORE_QUEUE_TOKEN = "core.queue";
|
|
2448
|
-
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
2449
|
-
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
2450
|
-
var CORE_AUTH_TOKEN = "core.auth";
|
|
2451
|
-
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
2452
2423
|
// ../../src/bootstrap/config.ts
|
|
2424
|
+
import {
|
|
2425
|
+
CORE_AUTH_TOKEN,
|
|
2426
|
+
CORE_CACHE_TOKEN,
|
|
2427
|
+
CORE_CONFIG_TOKEN,
|
|
2428
|
+
CORE_EVENT_BUS_TOKEN,
|
|
2429
|
+
CORE_POLICY_GATE_TOKEN,
|
|
2430
|
+
CORE_QUEUE_TOKEN,
|
|
2431
|
+
CORE_TOKEN_SERVICE_TOKEN
|
|
2432
|
+
} from "@getstrata/core/contracts/serviceTokens";
|
|
2453
2433
|
var DEFAULT_QUEUE_DRIVER = "sync";
|
|
2454
2434
|
|
|
2455
2435
|
// ../../src/config/queue.ts
|
|
@@ -1383,14 +1383,6 @@ class BaseRepository {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
}
|
|
1385
1385
|
var baseRepository_default = BaseRepository;
|
|
1386
|
-
// ../../src/core/database/connection.ts
|
|
1387
|
-
function createDatabaseConnection(source) {
|
|
1388
|
-
return {
|
|
1389
|
-
async unsafe(query, params = []) {
|
|
1390
|
-
return await source.unsafe(query, params);
|
|
1391
|
-
}
|
|
1392
|
-
};
|
|
1393
|
-
}
|
|
1394
1386
|
// ../../src/core/database/model.ts
|
|
1395
1387
|
var modelRepositories = new WeakMap;
|
|
1396
1388
|
var modelGlobalScopes = new WeakMap;
|
|
@@ -2331,19 +2323,6 @@ function createSchemaBuilder(db, driver) {
|
|
|
2331
2323
|
function defineTable(definition) {
|
|
2332
2324
|
return definition;
|
|
2333
2325
|
}
|
|
2334
|
-
// ../../src/core/database/transaction.ts
|
|
2335
|
-
function supportsTransactions(connection) {
|
|
2336
|
-
return typeof connection.begin === "function";
|
|
2337
|
-
}
|
|
2338
|
-
async function runInTransaction(operation) {
|
|
2339
|
-
const pool = resolveRepositoryConnection();
|
|
2340
|
-
if (!supportsTransactions(pool)) {
|
|
2341
|
-
throw new Error("Active database connection does not support transactions. Bind a client with begin() via bindDatabaseConnection.");
|
|
2342
|
-
}
|
|
2343
|
-
return await pool.begin(async (transaction) => {
|
|
2344
|
-
return await operation(createDatabaseConnection(transaction));
|
|
2345
|
-
});
|
|
2346
|
-
}
|
|
2347
2326
|
// ../../src/core/queue/failedJobTable.ts
|
|
2348
2327
|
var failedJobTable = defineTable({
|
|
2349
2328
|
name: "failed_job",
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// ../../src/core/contracts/serviceTokens.ts
|
|
3
|
-
var CORE_CONFIG_TOKEN = "core.config";
|
|
4
|
-
var CORE_CACHE_TOKEN = "core.cache";
|
|
5
|
-
var CORE_QUEUE_TOKEN = "core.queue";
|
|
6
|
-
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
7
|
-
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
8
|
-
var CORE_AUTH_TOKEN = "core.auth";
|
|
9
|
-
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
10
2
|
// ../../src/bootstrap/config.ts
|
|
3
|
+
import {
|
|
4
|
+
CORE_AUTH_TOKEN,
|
|
5
|
+
CORE_CACHE_TOKEN,
|
|
6
|
+
CORE_CONFIG_TOKEN,
|
|
7
|
+
CORE_EVENT_BUS_TOKEN,
|
|
8
|
+
CORE_POLICY_GATE_TOKEN,
|
|
9
|
+
CORE_QUEUE_TOKEN,
|
|
10
|
+
CORE_TOKEN_SERVICE_TOKEN
|
|
11
|
+
} from "@getstrata/core/contracts/serviceTokens";
|
|
11
12
|
var DEFAULT_QUEUE_DRIVER = "sync";
|
|
12
13
|
|
|
13
14
|
// ../../src/config/queue.ts
|
|
@@ -1383,14 +1383,6 @@ class BaseRepository {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
}
|
|
1385
1385
|
var baseRepository_default = BaseRepository;
|
|
1386
|
-
// ../../src/core/database/connection.ts
|
|
1387
|
-
function createDatabaseConnection(source) {
|
|
1388
|
-
return {
|
|
1389
|
-
async unsafe(query, params = []) {
|
|
1390
|
-
return await source.unsafe(query, params);
|
|
1391
|
-
}
|
|
1392
|
-
};
|
|
1393
|
-
}
|
|
1394
1386
|
// ../../src/core/database/model.ts
|
|
1395
1387
|
var modelRepositories = new WeakMap;
|
|
1396
1388
|
var modelGlobalScopes = new WeakMap;
|
|
@@ -2331,19 +2323,6 @@ function createSchemaBuilder(db, driver) {
|
|
|
2331
2323
|
function defineTable(definition) {
|
|
2332
2324
|
return definition;
|
|
2333
2325
|
}
|
|
2334
|
-
// ../../src/core/database/transaction.ts
|
|
2335
|
-
function supportsTransactions(connection) {
|
|
2336
|
-
return typeof connection.begin === "function";
|
|
2337
|
-
}
|
|
2338
|
-
async function runInTransaction(operation) {
|
|
2339
|
-
const pool = resolveRepositoryConnection();
|
|
2340
|
-
if (!supportsTransactions(pool)) {
|
|
2341
|
-
throw new Error("Active database connection does not support transactions. Bind a client with begin() via bindDatabaseConnection.");
|
|
2342
|
-
}
|
|
2343
|
-
return await pool.begin(async (transaction) => {
|
|
2344
|
-
return await operation(createDatabaseConnection(transaction));
|
|
2345
|
-
});
|
|
2346
|
-
}
|
|
2347
2326
|
// ../../src/core/queue/failedJobTable.ts
|
|
2348
2327
|
var failedJobTable = defineTable({
|
|
2349
2328
|
name: "failed_job",
|
|
@@ -2441,15 +2420,16 @@ function readSharedJobRegistry() {
|
|
|
2441
2420
|
}
|
|
2442
2421
|
var jobRegistry = readSharedJobRegistry();
|
|
2443
2422
|
|
|
2444
|
-
// ../../src/core/contracts/serviceTokens.ts
|
|
2445
|
-
var CORE_CONFIG_TOKEN = "core.config";
|
|
2446
|
-
var CORE_CACHE_TOKEN = "core.cache";
|
|
2447
|
-
var CORE_QUEUE_TOKEN = "core.queue";
|
|
2448
|
-
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
2449
|
-
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
2450
|
-
var CORE_AUTH_TOKEN = "core.auth";
|
|
2451
|
-
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
2452
2423
|
// ../../src/bootstrap/config.ts
|
|
2424
|
+
import {
|
|
2425
|
+
CORE_AUTH_TOKEN,
|
|
2426
|
+
CORE_CACHE_TOKEN,
|
|
2427
|
+
CORE_CONFIG_TOKEN,
|
|
2428
|
+
CORE_EVENT_BUS_TOKEN,
|
|
2429
|
+
CORE_POLICY_GATE_TOKEN,
|
|
2430
|
+
CORE_QUEUE_TOKEN,
|
|
2431
|
+
CORE_TOKEN_SERVICE_TOKEN
|
|
2432
|
+
} from "@getstrata/core/contracts/serviceTokens";
|
|
2453
2433
|
var DEFAULT_QUEUE_DRIVER = "sync";
|
|
2454
2434
|
|
|
2455
2435
|
// ../../src/config/queue.ts
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
// ../../src/core/queue/queueMetrics.ts
|
|
3
3
|
var {RedisClient: RedisClient2 } = globalThis.Bun;
|
|
4
4
|
|
|
5
|
-
// ../../src/core/contracts/serviceTokens.ts
|
|
6
|
-
var CORE_CONFIG_TOKEN = "core.config";
|
|
7
|
-
var CORE_CACHE_TOKEN = "core.cache";
|
|
8
|
-
var CORE_QUEUE_TOKEN = "core.queue";
|
|
9
|
-
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
10
|
-
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
11
|
-
var CORE_AUTH_TOKEN = "core.auth";
|
|
12
|
-
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
13
5
|
// ../../src/bootstrap/config.ts
|
|
6
|
+
import {
|
|
7
|
+
CORE_AUTH_TOKEN,
|
|
8
|
+
CORE_CACHE_TOKEN,
|
|
9
|
+
CORE_CONFIG_TOKEN,
|
|
10
|
+
CORE_EVENT_BUS_TOKEN,
|
|
11
|
+
CORE_POLICY_GATE_TOKEN,
|
|
12
|
+
CORE_QUEUE_TOKEN,
|
|
13
|
+
CORE_TOKEN_SERVICE_TOKEN
|
|
14
|
+
} from "@getstrata/core/contracts/serviceTokens";
|
|
14
15
|
var DEFAULT_QUEUE_DRIVER = "sync";
|
|
15
16
|
|
|
16
17
|
// ../../src/config/queue.ts
|
|
@@ -1404,14 +1405,6 @@ class BaseRepository {
|
|
|
1404
1405
|
}
|
|
1405
1406
|
}
|
|
1406
1407
|
var baseRepository_default = BaseRepository;
|
|
1407
|
-
// ../../src/core/database/connection.ts
|
|
1408
|
-
function createDatabaseConnection(source) {
|
|
1409
|
-
return {
|
|
1410
|
-
async unsafe(query, params = []) {
|
|
1411
|
-
return await source.unsafe(query, params);
|
|
1412
|
-
}
|
|
1413
|
-
};
|
|
1414
|
-
}
|
|
1415
1408
|
// ../../src/core/database/model.ts
|
|
1416
1409
|
var modelRepositories = new WeakMap;
|
|
1417
1410
|
var modelGlobalScopes = new WeakMap;
|
|
@@ -2352,19 +2345,6 @@ function createSchemaBuilder(db, driver) {
|
|
|
2352
2345
|
function defineTable(definition) {
|
|
2353
2346
|
return definition;
|
|
2354
2347
|
}
|
|
2355
|
-
// ../../src/core/database/transaction.ts
|
|
2356
|
-
function supportsTransactions(connection) {
|
|
2357
|
-
return typeof connection.begin === "function";
|
|
2358
|
-
}
|
|
2359
|
-
async function runInTransaction(operation) {
|
|
2360
|
-
const pool = resolveRepositoryConnection();
|
|
2361
|
-
if (!supportsTransactions(pool)) {
|
|
2362
|
-
throw new Error("Active database connection does not support transactions. Bind a client with begin() via bindDatabaseConnection.");
|
|
2363
|
-
}
|
|
2364
|
-
return await pool.begin(async (transaction) => {
|
|
2365
|
-
return await operation(createDatabaseConnection(transaction));
|
|
2366
|
-
});
|
|
2367
|
-
}
|
|
2368
2348
|
// ../../src/core/queue/failedJobTable.ts
|
|
2369
2349
|
var failedJobTable = defineTable({
|
|
2370
2350
|
name: "failed_job",
|
|
@@ -39,15 +39,16 @@ function readSharedJobRegistry() {
|
|
|
39
39
|
}
|
|
40
40
|
var jobRegistry = readSharedJobRegistry();
|
|
41
41
|
|
|
42
|
-
// ../../src/core/contracts/serviceTokens.ts
|
|
43
|
-
var CORE_CONFIG_TOKEN = "core.config";
|
|
44
|
-
var CORE_CACHE_TOKEN = "core.cache";
|
|
45
|
-
var CORE_QUEUE_TOKEN = "core.queue";
|
|
46
|
-
var CORE_EVENT_BUS_TOKEN = "core.eventBus";
|
|
47
|
-
var CORE_POLICY_GATE_TOKEN = "core.policyGate";
|
|
48
|
-
var CORE_AUTH_TOKEN = "core.auth";
|
|
49
|
-
var CORE_TOKEN_SERVICE_TOKEN = "core.tokenService";
|
|
50
42
|
// ../../src/bootstrap/config.ts
|
|
43
|
+
import {
|
|
44
|
+
CORE_AUTH_TOKEN,
|
|
45
|
+
CORE_CACHE_TOKEN,
|
|
46
|
+
CORE_CONFIG_TOKEN,
|
|
47
|
+
CORE_EVENT_BUS_TOKEN,
|
|
48
|
+
CORE_POLICY_GATE_TOKEN,
|
|
49
|
+
CORE_QUEUE_TOKEN,
|
|
50
|
+
CORE_TOKEN_SERVICE_TOKEN
|
|
51
|
+
} from "@getstrata/core/contracts/serviceTokens";
|
|
51
52
|
var DEFAULT_QUEUE_DRIVER = "sync";
|
|
52
53
|
|
|
53
54
|
// ../../src/config/queue.ts
|
|
@@ -81,9 +81,6 @@ function runWithTenant(tenant, callback) {
|
|
|
81
81
|
function currentTenant() {
|
|
82
82
|
return tenantContext.getStore() ?? null;
|
|
83
83
|
}
|
|
84
|
-
function currentTenantId() {
|
|
85
|
-
return currentTenant()?.id ?? 1;
|
|
86
|
-
}
|
|
87
84
|
function rateLimitMultiplierForPlan(plan) {
|
|
88
85
|
switch (plan) {
|
|
89
86
|
case "enterprise":
|