@absolutejs/auth 0.57.6 → 0.57.7
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 +4 -0
- package/dist/agents/index.js.map +6 -6
- package/dist/cli/migrate.js +21 -11
- package/dist/cli/migrate.js.map +11 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.js +21 -11
- package/dist/index.js.map +17 -17
- package/dist/migrations/index.d.ts +1 -0
- package/dist/migrations/runner.d.ts +11 -2
- package/dist/oidc/index.js.map +2 -2
- package/dist/server.js +21 -11
- package/dist/server.js.map +18 -18
- package/dist/vault/index.js.map +2 -2
- package/package.json +58 -20
package/dist/index.d.ts
CHANGED
|
@@ -3588,7 +3588,7 @@ export { createInMemoryWarrantStore, warrantKey } from './fga/inMemoryStores';
|
|
|
3588
3588
|
export { createRedisFgaCache, type RedisFgaCacheClient } from './fga/redisCheckCache';
|
|
3589
3589
|
export { initTracing, withSpan, type TracingConfig } from './telemetry/tracing';
|
|
3590
3590
|
export { blockMigrations, runMigrations, type BlockMigrations, type BlockName, type Migration } from './migrations';
|
|
3591
|
-
export type { MigrationRunResult, RunMigrationsOptions } from './migrations/runner';
|
|
3591
|
+
export type { MigrationClient, MigrationQueryResult, MigrationRunResult, RunMigrationsOptions } from './migrations/runner';
|
|
3592
3592
|
export { createNeonWarrantStore, createPostgresWarrantStore, warrantsTable } from './fga/postgresStores';
|
|
3593
3593
|
export { ssoDiscoveryRoute } from './sso/discoveryRoute';
|
|
3594
3594
|
export { oidcSsoRoutes } from './sso/oidcRoutes';
|
package/dist/index.js
CHANGED
|
@@ -35952,30 +35952,40 @@ var JOURNAL_DDL = `CREATE TABLE IF NOT EXISTS "auth_migrations" (
|
|
|
35952
35952
|
var isJournalRow = (value) => typeof value === "object" && value !== null && typeof Reflect.get(value, "id") === "string";
|
|
35953
35953
|
var isBlockName = (value) => Object.hasOwn(blockMigrations, value);
|
|
35954
35954
|
var allBlockNames = () => Object.keys(blockMigrations).filter(isBlockName);
|
|
35955
|
-
var applyOne = async (
|
|
35956
|
-
await
|
|
35957
|
-
await
|
|
35955
|
+
var applyOne = async (client, id, sql2, log) => {
|
|
35956
|
+
await client.query(sql2);
|
|
35957
|
+
await client.query(`INSERT INTO "auth_migrations" ("id", "applied_at_ms") VALUES ($1, $2)`, [id, Date.now()]);
|
|
35958
35958
|
log(`apply ${id}`);
|
|
35959
35959
|
};
|
|
35960
|
-
var runOne = async (
|
|
35960
|
+
var runOne = async (client, id, sql2, applied, result, log) => {
|
|
35961
35961
|
if (applied.has(id)) {
|
|
35962
35962
|
result.skipped.push(id);
|
|
35963
35963
|
log(`skip ${id}`);
|
|
35964
35964
|
return;
|
|
35965
35965
|
}
|
|
35966
|
-
await applyOne(
|
|
35966
|
+
await applyOne(client, id, sql2, log);
|
|
35967
35967
|
result.applied.push(id);
|
|
35968
35968
|
};
|
|
35969
35969
|
var runMigrations = async ({
|
|
35970
35970
|
blocks,
|
|
35971
|
+
client,
|
|
35971
35972
|
databaseUrl,
|
|
35972
35973
|
log = console.log
|
|
35973
35974
|
}) => {
|
|
35974
|
-
|
|
35975
|
+
let ownedPool;
|
|
35976
|
+
let migrationClient;
|
|
35977
|
+
if (client !== undefined) {
|
|
35978
|
+
migrationClient = client;
|
|
35979
|
+
} else {
|
|
35980
|
+
if (databaseUrl === undefined)
|
|
35981
|
+
throw new Error("runMigrations requires databaseUrl or client");
|
|
35982
|
+
ownedPool = new Ln({ connectionString: databaseUrl });
|
|
35983
|
+
migrationClient = ownedPool;
|
|
35984
|
+
}
|
|
35975
35985
|
const result = { applied: [], skipped: [] };
|
|
35976
35986
|
try {
|
|
35977
|
-
await
|
|
35978
|
-
const journal = await
|
|
35987
|
+
await migrationClient.query(JOURNAL_DDL);
|
|
35988
|
+
const journal = await migrationClient.query(`SELECT "id" FROM "auth_migrations"`);
|
|
35979
35989
|
const applied = new Set(journal.rows.filter(isJournalRow).map((row) => row.id));
|
|
35980
35990
|
const selected = blocks ?? allBlockNames();
|
|
35981
35991
|
const flat = selected.flatMap((block) => blockMigrations[block].migrations.map((migration) => ({
|
|
@@ -35984,10 +35994,10 @@ var runMigrations = async ({
|
|
|
35984
35994
|
})));
|
|
35985
35995
|
await flat.reduce(async (prior, item) => {
|
|
35986
35996
|
await prior;
|
|
35987
|
-
return runOne(
|
|
35997
|
+
return runOne(migrationClient, item.id, item.sql, applied, result, log);
|
|
35988
35998
|
}, Promise.resolve());
|
|
35989
35999
|
} finally {
|
|
35990
|
-
await
|
|
36000
|
+
await ownedPool?.end();
|
|
35991
36001
|
}
|
|
35992
36002
|
return result;
|
|
35993
36003
|
};
|
|
@@ -37366,5 +37376,5 @@ export {
|
|
|
37366
37376
|
AGENT_CLAIM_GRANT_TYPE
|
|
37367
37377
|
};
|
|
37368
37378
|
|
|
37369
|
-
//# debugId=
|
|
37379
|
+
//# debugId=F857B4607106B28664756E2164756E21
|
|
37370
37380
|
//# sourceMappingURL=index.js.map
|