@openora/core 0.4.1-canary.140 → 0.4.1-canary.142
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/.tsbuildinfo +1 -1
- package/dist/cms/__tests__/cms.router.int.test.js +8 -6
- package/dist/cms/__tests__/cms.router.int.test.js.map +1 -1
- package/dist/cms/__tests__/cms.service.int.test.js +4 -3
- package/dist/cms/__tests__/cms.service.int.test.js.map +1 -1
- package/dist/compliance/__tests__/rg-monitoring.service.int.test.js +1 -1
- package/dist/compliance/__tests__/rg-monitoring.service.int.test.js.map +1 -1
- package/dist/contracts/schemas/events.d.ts +3 -1
- package/dist/contracts/schemas/events.d.ts.map +1 -1
- package/dist/contracts/schemas/events.js +3 -0
- package/dist/contracts/schemas/events.js.map +1 -1
- package/dist/contracts/schemas/identity.d.ts +31 -1
- package/dist/contracts/schemas/identity.d.ts.map +1 -1
- package/dist/contracts/schemas/identity.js +36 -7
- package/dist/contracts/schemas/identity.js.map +1 -1
- package/dist/contracts/schemas/mail.d.ts +9 -1
- package/dist/contracts/schemas/mail.d.ts.map +1 -1
- package/dist/contracts/schemas/mail.js +3 -0
- package/dist/contracts/schemas/mail.js.map +1 -1
- package/dist/mail/adapters/default-email-template-renderer.d.ts.map +1 -1
- package/dist/mail/adapters/default-email-template-renderer.js +6 -0
- package/dist/mail/adapters/default-email-template-renderer.js.map +1 -1
- package/dist/mail/contract/index.d.ts +5 -0
- package/dist/mail/contract/index.d.ts.map +1 -1
- package/dist/pam/identity/__tests__/admin-security.int.test.js +2 -2
- package/dist/pam/identity/__tests__/admin-security.int.test.js.map +1 -1
- package/dist/pam/identity/__tests__/identity.rate-limit.int.test.js +7 -1
- package/dist/pam/identity/__tests__/identity.rate-limit.int.test.js.map +1 -1
- package/dist/pam/identity/__tests__/identity.registration-gates.int.test.js +5 -0
- package/dist/pam/identity/__tests__/identity.registration-gates.int.test.js.map +1 -1
- package/dist/pam/identity/__tests__/identity.service.int.test.js +40 -6
- package/dist/pam/identity/__tests__/identity.service.int.test.js.map +1 -1
- package/dist/pam/identity/__tests__/two-factor-delivery.test.d.ts +2 -0
- package/dist/pam/identity/__tests__/two-factor-delivery.test.d.ts.map +1 -0
- package/dist/pam/identity/__tests__/two-factor-delivery.test.js +23 -0
- package/dist/pam/identity/__tests__/two-factor-delivery.test.js.map +1 -0
- package/dist/pam/identity/__tests__/user-commands.int.test.js +0 -6
- package/dist/pam/identity/__tests__/user-commands.int.test.js.map +1 -1
- package/dist/pam/identity/contract/index.d.ts +26 -1
- package/dist/pam/identity/contract/index.d.ts.map +1 -1
- package/dist/pam/identity/contract/index.js +14 -1
- package/dist/pam/identity/contract/index.js.map +1 -1
- package/dist/pam/identity/drizzle/migrations/0012_worried_nuke.sql +2 -0
- package/dist/pam/identity/drizzle/migrations/0013_backfill_two_factor_method.sql +6 -0
- package/dist/pam/identity/drizzle/migrations/meta/0012_snapshot.json +1090 -0
- package/dist/pam/identity/drizzle/migrations/meta/0013_snapshot.json +1090 -0
- package/dist/pam/identity/drizzle/migrations/meta/_journal.json +14 -0
- package/dist/pam/identity/plugin.d.ts.map +1 -1
- package/dist/pam/identity/plugin.js +6 -0
- package/dist/pam/identity/plugin.js.map +1 -1
- package/dist/pam/identity/react/account.d.ts +10 -4
- package/dist/pam/identity/react/account.d.ts.map +1 -1
- package/dist/pam/identity/react/account.js +14 -0
- package/dist/pam/identity/react/account.js.map +1 -1
- package/dist/pam/identity/react/auth.d.ts +1 -0
- package/dist/pam/identity/react/auth.d.ts.map +1 -1
- package/dist/pam/identity/router/index.d.ts +26 -1
- package/dist/pam/identity/router/index.d.ts.map +1 -1
- package/dist/pam/identity/router/index.js +2 -0
- package/dist/pam/identity/router/index.js.map +1 -1
- package/dist/pam/identity/schema/index.d.ts +18 -0
- package/dist/pam/identity/schema/index.d.ts.map +1 -1
- package/dist/pam/identity/schema/index.js +6 -1
- package/dist/pam/identity/schema/index.js.map +1 -1
- package/dist/pam/identity/service/admin-security.service.d.ts.map +1 -1
- package/dist/pam/identity/service/admin-security.service.js +3 -0
- package/dist/pam/identity/service/admin-security.service.js.map +1 -1
- package/dist/pam/identity/service/fresh-reauthentication.service.d.ts.map +1 -1
- package/dist/pam/identity/service/fresh-reauthentication.service.js +4 -9
- package/dist/pam/identity/service/fresh-reauthentication.service.js.map +1 -1
- package/dist/pam/identity/service/identity.service.d.ts +46 -6
- package/dist/pam/identity/service/identity.service.d.ts.map +1 -1
- package/dist/pam/identity/service/identity.service.js +219 -22
- package/dist/pam/identity/service/identity.service.js.map +1 -1
- package/dist/pam/identity/service/two-factor-challenge.service.d.ts +36 -0
- package/dist/pam/identity/service/two-factor-challenge.service.d.ts.map +1 -0
- package/dist/pam/identity/service/two-factor-challenge.service.js +30 -0
- package/dist/pam/identity/service/two-factor-challenge.service.js.map +1 -0
- package/dist/pam/identity/service/two-factor-delivery.service.d.ts +67 -0
- package/dist/pam/identity/service/two-factor-delivery.service.d.ts.map +1 -0
- package/dist/pam/identity/service/two-factor-delivery.service.js +135 -0
- package/dist/pam/identity/service/two-factor-delivery.service.js.map +1 -0
- package/dist/pam/player-management/__tests__/kyc-status-writer.int.test.js +7 -2
- package/dist/pam/player-management/__tests__/kyc-status-writer.int.test.js.map +1 -1
- package/dist/pam/player-management/__tests__/player.router.int.test.js +1 -1
- package/dist/pam/player-management/__tests__/player.router.int.test.js.map +1 -1
- package/dist/pam/player-note/__tests__/player-note.router.int.test.js +1 -1
- package/dist/pam/player-note/__tests__/player-note.router.int.test.js.map +1 -1
- package/dist/pam/react.d.ts +1 -1
- package/dist/pam/react.d.ts.map +1 -1
- package/dist/pam/react.js +1 -1
- package/dist/pam/react.js.map +1 -1
- package/dist/server/auth/__tests__/admin-guard.int.test.js +46 -2
- package/dist/server/auth/__tests__/admin-guard.int.test.js.map +1 -1
- package/dist/server/auth/auth.d.ts.map +1 -1
- package/dist/server/auth/auth.js +3 -0
- package/dist/server/auth/auth.js.map +1 -1
- package/dist/server/db/__tests__/migrate.test.js +11 -1
- package/dist/server/db/__tests__/migrate.test.js.map +1 -1
- package/dist/server/db/__tests__/query-helpers.test.js +21 -1
- package/dist/server/db/__tests__/query-helpers.test.js.map +1 -1
- package/dist/server/db/__tests__/zod-jsonb.test.js +14 -1
- package/dist/server/db/__tests__/zod-jsonb.test.js.map +1 -1
- package/dist/server/db/outbox/__tests__/relay.int.test.js +66 -0
- package/dist/server/db/outbox/__tests__/relay.int.test.js.map +1 -1
- package/dist/server/kernel/__tests__/rate-limiter.int.test.js +3 -0
- package/dist/server/kernel/__tests__/rate-limiter.int.test.js.map +1 -1
- package/dist/server/kernel/logger.d.ts +0 -7
- package/dist/server/kernel/logger.d.ts.map +1 -1
- package/dist/server/kernel/logger.js +16 -1
- package/dist/server/kernel/logger.js.map +1 -1
- package/dist/testing/global-setup.d.ts +15 -0
- package/dist/testing/global-setup.d.ts.map +1 -0
- package/dist/testing/global-setup.js +33 -0
- package/dist/testing/global-setup.js.map +1 -0
- package/dist/testing/real-infra.d.ts +24 -3
- package/dist/testing/real-infra.d.ts.map +1 -1
- package/dist/testing/real-infra.js +28 -28
- package/dist/testing/real-infra.js.map +1 -1
- package/dist/testing/seed-player.d.ts +2 -0
- package/dist/testing/seed-player.d.ts.map +1 -1
- package/dist/wallet/__tests__/wallet.service.int.test.js +16 -2
- package/dist/wallet/__tests__/wallet.service.int.test.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,9 +8,24 @@ import { getCurrentRequestContext } from './request-context.js';
|
|
|
8
8
|
* child loggers are covered too. `report: false` opts a noisy/expected error out of
|
|
9
9
|
* forwarding (still logged); a log without `err` is never reported.
|
|
10
10
|
*/
|
|
11
|
+
/**
|
|
12
|
+
* pino reads no environment of its own; this is where LOG_LEVEL is honoured.
|
|
13
|
+
*
|
|
14
|
+
* `silent` is served by discarding the output rather than by pino's own silent level:
|
|
15
|
+
* a disabled level never reaches `logMethod`, and the error-reporter hook below lives
|
|
16
|
+
* there - so asking for quiet logs would silently also stop reporting errors to the
|
|
17
|
+
* bound tracker. The test suites run at this setting.
|
|
18
|
+
*/
|
|
19
|
+
const DISCARD = { write() { } };
|
|
20
|
+
function levelAndDestination() {
|
|
21
|
+
const level = process.env['LOG_LEVEL'] ?? 'info';
|
|
22
|
+
return level === 'silent' ? ['info', DISCARD] : [level, undefined];
|
|
23
|
+
}
|
|
11
24
|
export function createLogger(name) {
|
|
25
|
+
const [level, destination] = levelAndDestination();
|
|
12
26
|
return pino({
|
|
13
27
|
name,
|
|
28
|
+
level,
|
|
14
29
|
hooks: {
|
|
15
30
|
logMethod(inputArgs, method, level) {
|
|
16
31
|
method.apply(this, inputArgs);
|
|
@@ -34,6 +49,6 @@ export function createLogger(name) {
|
|
|
34
49
|
});
|
|
35
50
|
},
|
|
36
51
|
},
|
|
37
|
-
});
|
|
52
|
+
}, destination);
|
|
38
53
|
}
|
|
39
54
|
//# sourceMappingURL=logger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/server/kernel/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAe,MAAM,MAAM,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/server/kernel/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAe,MAAM,MAAM,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE;;;;;;GAMG;AACH;;;;;;;GAOG;AACH,MAAM,OAAO,GAAG,EAAE,KAAK,KAAI,CAAC,EA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AE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC9C,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBACjD,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI;iBAC7C,CAAC,CAAC;YACL,CAAC;SACF;KACF,EACD,WAAW,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remove the databases `createTestDb` created for this run, once the run is over.
|
|
3
|
+
*
|
|
4
|
+
* `DROP DATABASE` forces a cluster-wide immediate checkpoint, so dropping one per test
|
|
5
|
+
* file makes 80-odd of them queue behind each other while the workers are still running
|
|
6
|
+
* - long enough, measured on a local cluster with `fsync` on, to stall an unrelated
|
|
7
|
+
* file's teardown past its hook timeout. Sweeping here moves all of it after the last
|
|
8
|
+
* test.
|
|
9
|
+
*
|
|
10
|
+
* The sweep is confined to the run id set below, so a second run sharing this Postgres
|
|
11
|
+
* server keeps its own databases. The cost is that a run killed outright leaves its
|
|
12
|
+
* databases behind, which `pnpm db:clean:test` clears.
|
|
13
|
+
*/
|
|
14
|
+
export default function setup(): Promise<() => Promise<void>>;
|
|
15
|
+
//# sourceMappingURL=global-setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-setup.d.ts","sourceRoot":"","sources":["../../src/testing/global-setup.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AACH,wBAA8B,KAAK,IAAI,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAkBlE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { Pool } from 'pg';
|
|
3
|
+
import { adminDatabaseUrl, testDatabasePrefix } from './real-infra.js';
|
|
4
|
+
/**
|
|
5
|
+
* Remove the databases `createTestDb` created for this run, once the run is over.
|
|
6
|
+
*
|
|
7
|
+
* `DROP DATABASE` forces a cluster-wide immediate checkpoint, so dropping one per test
|
|
8
|
+
* file makes 80-odd of them queue behind each other while the workers are still running
|
|
9
|
+
* - long enough, measured on a local cluster with `fsync` on, to stall an unrelated
|
|
10
|
+
* file's teardown past its hook timeout. Sweeping here moves all of it after the last
|
|
11
|
+
* test.
|
|
12
|
+
*
|
|
13
|
+
* The sweep is confined to the run id set below, so a second run sharing this Postgres
|
|
14
|
+
* server keeps its own databases. The cost is that a run killed outright leaves its
|
|
15
|
+
* databases behind, which `pnpm db:clean:test` clears.
|
|
16
|
+
*/
|
|
17
|
+
export default async function setup() {
|
|
18
|
+
process.env['OPENORA_TEST_RUN_ID'] = randomUUID().replaceAll('-', '').slice(0, 8);
|
|
19
|
+
const prefix = testDatabasePrefix();
|
|
20
|
+
const admin = new Pool({ connectionString: adminDatabaseUrl(), connectionTimeoutMillis: 5000 });
|
|
21
|
+
return async () => {
|
|
22
|
+
try {
|
|
23
|
+
const { rows } = await admin.query(`SELECT datname FROM pg_database WHERE datname LIKE $1`, [`${prefix.replaceAll('_', '\\_')}%`]);
|
|
24
|
+
for (const { datname } of rows) {
|
|
25
|
+
await admin.query(`DROP DATABASE IF EXISTS "${datname}" WITH (FORCE)`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
await admin.end();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=global-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-setup.js","sourceRoot":"","sources":["../../src/testing/global-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEvE;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,KAAK;IACjC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,GAAG,UAAU,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClF,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAC;IACpC,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,EAAE,uBAAuB,EAAE,IAAI,EAAE,CAAC,CAAC;IAEhG,OAAO,KAAK,IAAI,EAAE;QAChB,IAAI,CAAC;YACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,KAAK,CAAC,KAAK,CAChC,uDAAuD,EACvD,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CACtC,CAAC;YACF,KAAK,MAAM,EAAE,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC;gBAC/B,MAAM,KAAK,CAAC,KAAK,CAAC,4BAA4B,OAAO,gBAAgB,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,MAAM,KAAK,CAAC,GAAG,EAAE,CAAC;QACpB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -16,17 +16,38 @@ export declare function waitForConsumerGroup(client: ReturnType<typeof createCli
|
|
|
16
16
|
group: string;
|
|
17
17
|
timeoutMs?: number;
|
|
18
18
|
}): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* The prefix every database `createTestDb` creates carries, carrying this run's own id so
|
|
21
|
+
* that a second run against the same Postgres server (a second worktree, a stray `vitest`
|
|
22
|
+
* alongside `pnpm verify`) is never swept by this one's teardown.
|
|
23
|
+
*
|
|
24
|
+
* `global-setup.ts` sets the id before vitest forks its workers, which inherit it. A
|
|
25
|
+
* worker that somehow did not would otherwise create databases under a name the teardown
|
|
26
|
+
* never looks for, so an absent id is an error rather than a default.
|
|
27
|
+
*/
|
|
28
|
+
export declare function testDatabasePrefix(): string;
|
|
29
|
+
/** The admin connection string a sweep needs, resolved the same way `createTestDb` does. */
|
|
30
|
+
export declare const adminDatabaseUrl: () => string;
|
|
19
31
|
/** A per-module migration entrypoint (`packages/core/src/<module>/migrate.ts`). */
|
|
20
32
|
export type Migration = (databaseUrl: string) => Promise<unknown>;
|
|
21
33
|
export type TestDb = {
|
|
22
34
|
url: string;
|
|
23
35
|
drizzle: DrizzleService;
|
|
36
|
+
/** Close the pool. The database itself is dropped by the global teardown. */
|
|
24
37
|
drop: () => Promise<void>;
|
|
25
38
|
};
|
|
26
39
|
/**
|
|
27
|
-
* Create a throwaway `
|
|
28
|
-
* against it, and return a `DrizzleService` bound to it. `drop()` disposes the
|
|
29
|
-
*
|
|
40
|
+
* Create a throwaway `testDatabasePrefix()`-prefixed database, apply the given per-module
|
|
41
|
+
* migrations against it, and return a `DrizzleService` bound to it. `drop()` disposes the
|
|
42
|
+
* pool; the database itself is removed in bulk by `global-setup.ts`.
|
|
43
|
+
*
|
|
44
|
+
* Deferring the removal is not tidiness, it is throughput. `DROP DATABASE` forces a
|
|
45
|
+
* cluster-wide immediate checkpoint (measured: `CREATE DATABASE` requests none, `DROP`
|
|
46
|
+
* requests exactly one), and every other backend on the cluster waits it out. With one
|
|
47
|
+
* drop per test file and workers running in parallel, those checkpoints queue up: a
|
|
48
|
+
* single one was measured at 25s on a local cluster with `fsync` on, long enough to
|
|
49
|
+
* blow the 30s hook timeout in unrelated files in both integration tiers at once.
|
|
50
|
+
* Sweeping once per run instead cut the tier from 116s to 87s under parallel load.
|
|
30
51
|
*
|
|
31
52
|
* `DrizzleService` reads `DATABASE_URL` in its constructor, so this points the env at
|
|
32
53
|
* the ephemeral url just before constructing it - safe because a test file owns one db.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"real-infra.d.ts","sourceRoot":"","sources":["../../src/testing/real-infra.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAqBtD;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,EACvC,EAAE,MAAM,EAAE,KAAK,EAAE,SAAgB,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACzF,OAAO,CAAC,IAAI,CAAC,CAgBf;AAeD,mFAAmF;AACnF,MAAM,MAAM,SAAS,GAAG,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAElE,MAAM,MAAM,MAAM,GAAG;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,cAAc,CAAC;IACxB,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B,CAAC;
|
|
1
|
+
{"version":3,"file":"real-infra.d.ts","sourceRoot":"","sources":["../../src/testing/real-infra.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAqBtD;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,EACvC,EAAE,MAAM,EAAE,KAAK,EAAE,SAAgB,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACzF,OAAO,CAAC,IAAI,CAAC,CAgBf;AAeD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAM3C;AAED,4FAA4F;AAC5F,eAAO,MAAM,gBAAgB,QAAO,MAA4B,CAAC;AAEjE,mFAAmF;AACnF,MAAM,MAAM,SAAS,GAAG,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAElE,MAAM,MAAM,MAAM,GAAG;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,cAAc,CAAC;IACxB,6EAA6E;IAC7E,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,YAAY,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA6B3E;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IACxC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,SAAS,CAAC,CAqB1D"}
|
|
@@ -57,51 +57,54 @@ function withDatabase(adminUrl, database) {
|
|
|
57
57
|
return url.toString();
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
60
|
+
* The prefix every database `createTestDb` creates carries, carrying this run's own id so
|
|
61
|
+
* that a second run against the same Postgres server (a second worktree, a stray `vitest`
|
|
62
|
+
* alongside `pnpm verify`) is never swept by this one's teardown.
|
|
62
63
|
*
|
|
63
|
-
* `
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* error with no listener left to catch it - an uncaught exception that fails the whole
|
|
67
|
-
* vitest run even though every test passed. Only reproducible under parallel load, which
|
|
68
|
-
* is exactly when a lingering socket is slowest to close.
|
|
69
|
-
*
|
|
70
|
-
* Best-effort: a backend that outlives the timeout is left to FORCE, since a stuck
|
|
71
|
-
* teardown must never be worse than the race it is avoiding.
|
|
64
|
+
* `global-setup.ts` sets the id before vitest forks its workers, which inherit it. A
|
|
65
|
+
* worker that somehow did not would otherwise create databases under a name the teardown
|
|
66
|
+
* never looks for, so an absent id is an error rather than a default.
|
|
72
67
|
*/
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
WHERE datname = $1 AND pid <> pg_backend_pid()`, [database]);
|
|
78
|
-
if (rows[0]?.count === '0') {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
await new Promise((resolve) => setTimeout(resolve, 25));
|
|
68
|
+
export function testDatabasePrefix() {
|
|
69
|
+
const runId = process.env['OPENORA_TEST_RUN_ID'];
|
|
70
|
+
if (!runId) {
|
|
71
|
+
throw new Error('OPENORA_TEST_RUN_ID is not set - this tier requires its global setup');
|
|
82
72
|
}
|
|
73
|
+
return `test_${runId}_`;
|
|
83
74
|
}
|
|
75
|
+
/** The admin connection string a sweep needs, resolved the same way `createTestDb` does. */
|
|
76
|
+
export const adminDatabaseUrl = () => ADMIN_DATABASE_URL;
|
|
84
77
|
/**
|
|
85
|
-
* Create a throwaway `
|
|
86
|
-
* against it, and return a `DrizzleService` bound to it. `drop()` disposes the
|
|
87
|
-
*
|
|
78
|
+
* Create a throwaway `testDatabasePrefix()`-prefixed database, apply the given per-module
|
|
79
|
+
* migrations against it, and return a `DrizzleService` bound to it. `drop()` disposes the
|
|
80
|
+
* pool; the database itself is removed in bulk by `global-setup.ts`.
|
|
81
|
+
*
|
|
82
|
+
* Deferring the removal is not tidiness, it is throughput. `DROP DATABASE` forces a
|
|
83
|
+
* cluster-wide immediate checkpoint (measured: `CREATE DATABASE` requests none, `DROP`
|
|
84
|
+
* requests exactly one), and every other backend on the cluster waits it out. With one
|
|
85
|
+
* drop per test file and workers running in parallel, those checkpoints queue up: a
|
|
86
|
+
* single one was measured at 25s on a local cluster with `fsync` on, long enough to
|
|
87
|
+
* blow the 30s hook timeout in unrelated files in both integration tiers at once.
|
|
88
|
+
* Sweeping once per run instead cut the tier from 116s to 87s under parallel load.
|
|
88
89
|
*
|
|
89
90
|
* `DrizzleService` reads `DATABASE_URL` in its constructor, so this points the env at
|
|
90
91
|
* the ephemeral url just before constructing it - safe because a test file owns one db.
|
|
91
92
|
*/
|
|
92
93
|
export async function createTestDb(migrations) {
|
|
93
|
-
const database =
|
|
94
|
+
const database = `${testDatabasePrefix()}${randomUUID().replaceAll('-', '')}`;
|
|
94
95
|
const admin = new Pool({ connectionString: ADMIN_DATABASE_URL, connectionTimeoutMillis: 5000 });
|
|
95
96
|
try {
|
|
96
97
|
await admin.query(`CREATE DATABASE "${database}"`);
|
|
97
98
|
}
|
|
98
99
|
catch (err) {
|
|
99
|
-
await admin.end();
|
|
100
100
|
if (isConnectionError(err)) {
|
|
101
101
|
throw new Error(INFRA_HINT, { cause: err });
|
|
102
102
|
}
|
|
103
103
|
throw err;
|
|
104
104
|
}
|
|
105
|
+
finally {
|
|
106
|
+
await admin.end();
|
|
107
|
+
}
|
|
105
108
|
const url = withDatabase(ADMIN_DATABASE_URL, database);
|
|
106
109
|
for (const migrate of migrations) {
|
|
107
110
|
await migrate(url);
|
|
@@ -113,9 +116,6 @@ export async function createTestDb(migrations) {
|
|
|
113
116
|
drizzle,
|
|
114
117
|
async drop() {
|
|
115
118
|
await drizzle.dispose();
|
|
116
|
-
await waitForIdleBackends(admin, database);
|
|
117
|
-
await admin.query(`DROP DATABASE IF EXISTS "${database}" WITH (FORCE)`);
|
|
118
|
-
await admin.end();
|
|
119
119
|
},
|
|
120
120
|
};
|
|
121
121
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|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,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO;QACL,MAAM;QACN,KAAK,CAAC,KAAK;YACT,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC;QACD,KAAK,CAAC,IAAI;YACR,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -28,6 +28,7 @@ export declare function seedUser(db: TestDb, overrides?: Partial<typeof user.$in
|
|
|
28
28
|
banReason: string | null;
|
|
29
29
|
banned: boolean | null;
|
|
30
30
|
banExpires: Date | null;
|
|
31
|
+
twoFactorMethod: "email" | "app" | "sms" | null;
|
|
31
32
|
phoneVerifiedAt: Date | null;
|
|
32
33
|
withdrawalPinHash: string | null;
|
|
33
34
|
withdrawalPinSetAt: Date | null;
|
|
@@ -69,6 +70,7 @@ export declare function seedPlayerWithUser(db: TestDb, overrides?: SeedPlayerOve
|
|
|
69
70
|
banReason: string | null;
|
|
70
71
|
banned: boolean | null;
|
|
71
72
|
banExpires: Date | null;
|
|
73
|
+
twoFactorMethod: "email" | "app" | "sms" | null;
|
|
72
74
|
phoneVerifiedAt: Date | null;
|
|
73
75
|
withdrawalPinHash: string | null;
|
|
74
76
|
withdrawalPinSetAt: Date | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed-player.d.ts","sourceRoot":"","sources":["../../src/testing/seed-player.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,MAAM,SAAW,GAAG,MAAM,CAExD;AAED,2EAA2E;AAC3E,wBAAsB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,GAAE,OAAO,CAAC,OAAO,IAAI,CAAC,YAAY,CAAM
|
|
1
|
+
{"version":3,"file":"seed-player.d.ts","sourceRoot":"","sources":["../../src/testing/seed-player.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,MAAM,SAAW,GAAG,MAAM,CAExD;AAED,2EAA2E;AAC3E,wBAAsB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,GAAE,OAAO,CAAC,OAAO,IAAI,CAAC,YAAY,CAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAe3F;AAED,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,OAAO,MAAM,CAAC,YAAY,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9F,uDAAuD;AACvD,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,GAAE,mBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgBvF"}
|
|
@@ -709,7 +709,14 @@ describe('WalletService.withdraw destination whitelisting (real PG)', () => {
|
|
|
709
709
|
destinationAddress: 'bc1qsaved',
|
|
710
710
|
...NO_CLIENT_META,
|
|
711
711
|
});
|
|
712
|
-
expect(result.
|
|
712
|
+
expect(result.status).toBe('pending');
|
|
713
|
+
expect(await txById(result.transactionId)).toMatchObject({
|
|
714
|
+
type: 'withdrawal',
|
|
715
|
+
status: 'pending',
|
|
716
|
+
amount: '1.000000000000000000',
|
|
717
|
+
currency: 'BTC',
|
|
718
|
+
});
|
|
719
|
+
expect(await balanceOf(w.userId)).toBe(4);
|
|
713
720
|
});
|
|
714
721
|
it('refuses a tag the player never whitelisted on an address they did', async () => {
|
|
715
722
|
const psp = whitelistingPsp();
|
|
@@ -797,7 +804,14 @@ describe('WalletService.withdraw destination whitelisting (real PG)', () => {
|
|
|
797
804
|
destinationAddress: 'bc1qnever-saved',
|
|
798
805
|
...NO_CLIENT_META,
|
|
799
806
|
});
|
|
800
|
-
expect(result.
|
|
807
|
+
expect(result.status).toBe('pending');
|
|
808
|
+
expect(await txById(result.transactionId)).toMatchObject({
|
|
809
|
+
type: 'withdrawal',
|
|
810
|
+
status: 'pending',
|
|
811
|
+
amount: '1.000000000000000000',
|
|
812
|
+
currency: 'BTC',
|
|
813
|
+
});
|
|
814
|
+
expect(await balanceOf(w.userId)).toBe(4);
|
|
801
815
|
});
|
|
802
816
|
});
|
|
803
817
|
describe('WalletService.approveWithdrawal (real PG)', () => {
|