@fabrika/platform-node 0.9.0-dev.2 → 0.9.0-dev.21

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.
@@ -1,37 +0,0 @@
1
- import type { SqlDatabase } from '@fabrika/platform';
2
- /** A provisioning credential that exists for one test run only, and what it created. */
3
- export interface TestProvisioner {
4
- /**
5
- * Connects as `fabrika_tests_<hex>`: CREATEROLE and CREATE on the database, nothing of any application, and a login
6
- * for `TEST_PROVISIONER_LIFETIME_MINUTES` only.
7
- */
8
- readonly url: string;
9
- /** The provisioners of earlier runs that creating this one dropped. Role names, never a credential. */
10
- readonly swept: readonly string[];
11
- /** Drops every role the provisioner created, with everything those roles own, then the provisioner itself. */
12
- drop(): Promise<void>;
13
- }
14
- /**
15
- * Every grant or revoke on a database changes its one `pg_database` row, and two concurrent changes of that row fail with
16
- * `tuple concurrently updated`, so each change waits for this transaction-level lock first.
17
- */
18
- export declare const DATABASE_GRANT_LOCK_KEY: number;
19
- /**
20
- * Grants (or revokes) CREATE on `database` to `role`, serialized with every other run that does so on the same server.
21
- * Verified afterwards: a grantor that neither owns the database, is a superuser nor holds CREATE WITH GRANT OPTION only
22
- * gets a WARNING, and the statement changes nothing.
23
- */
24
- export declare function changeCreateOnDatabase(admin: SqlDatabase, change: 'grant' | 'revoke', role: string, database: string): Promise<void>;
25
- /**
26
- * How long a provisioner can log in (`VALID UNTIL`). A run that a kill stopped before `drop()` leaves its provisioner
27
- * behind, and nobody knows its password; after this time it also cannot log in, and the next run's sweep drops it. A
28
- * run makes new connections until it ends, so this is far beyond the longest run.
29
- */
30
- export declare const TEST_PROVISIONER_LIFETIME_MINUTES = 15;
31
- /**
32
- * Creates a throwaway provisioning credential for code the platform runs but did not write, such as an application's
33
- * generated tests: it can create the test kit's role families and schemas, and reaches no application's data, because
34
- * a CREATEROLE role administers only the roles it created. The provisioning credential itself never leaves this process.
35
- * First it drops the provisioners earlier runs left behind (`sweepTestProvisioners`).
36
- */
37
- export declare function createTestProvisioner(provisioningUrl: string): Promise<TestProvisioner>;