@ingram-tech/nk-auth 0.17.0 → 0.17.1
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/chain.d.ts +7 -2
- package/dist/chain.d.ts.map +1 -1
- package/dist/chain.js +10 -4
- package/dist/chain.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/src/chain.ts +17 -6
- package/src/index.ts +1 -1
package/dist/chain.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { type MigrationStatus } from "@ingram-tech/nk-db/migrate";
|
|
2
2
|
import type { Pool } from "pg";
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The migration chain this package ships: `migrations/` in the installed
|
|
5
|
+
* package. Resolved through the package manifest, at call time, so a bundler
|
|
6
|
+
* that rewrites `import.meta.url` (Next's server build) still lands on the
|
|
7
|
+
* folder under `node_modules`, and never sees a URL it would try to inline.
|
|
8
|
+
*/
|
|
9
|
+
export declare const authMigrationsFolder: () => string;
|
|
5
10
|
/** The journal table the README tells a site to record the chain in. */
|
|
6
11
|
export declare const AUTH_MIGRATIONS_TABLE = "__nkauth_migrations";
|
|
7
12
|
/**
|
package/dist/chain.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../src/chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../src/chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGrF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE/B;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,QAAO,MAOtC,CAAC;AAEH,wEAAwE;AACxE,eAAO,MAAM,qBAAqB,wBAAwB,CAAC;AAS3D;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IAClD,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,YAAY,OAAO,EAAE,SAAS,MAAM,EAAE,EAMrC;CACD;AAED,MAAM,WAAW,qBAAqB;IACrC,sFAAsF;IACtF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qDAAqD;IACrD,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,SAC5B,IAAI,YACD,qBAAqB,KAC5B,OAAO,CAAC,eAAe,GAAG,IAAI,CAkBhC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,aAChB,OAAO,YACR,qBAAqB,KAC5B,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAOtB,CAAC"}
|
package/dist/chain.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { inspectMigrations } from "@ingram-tech/nk-db/migrate";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { dirname } from "node:path";
|
|
4
|
+
/**
|
|
5
|
+
* The migration chain this package ships: `migrations/` in the installed
|
|
6
|
+
* package. Resolved through the package manifest, at call time, so a bundler
|
|
7
|
+
* that rewrites `import.meta.url` (Next's server build) still lands on the
|
|
8
|
+
* folder under `node_modules`, and never sees a URL it would try to inline.
|
|
9
|
+
*/
|
|
10
|
+
export const authMigrationsFolder = () => dirname(dirname(createRequire(import.meta.url).resolve("@ingram-tech/nk-auth/migrations/meta/_journal.json")));
|
|
5
11
|
/** The journal table the README tells a site to record the chain in. */
|
|
6
12
|
export const AUTH_MIGRATIONS_TABLE = "__nkauth_migrations";
|
|
7
13
|
/** The shape of a `pg` Pool as far as the chain check needs it. */
|
|
@@ -45,7 +51,7 @@ export const assertAuthChainApplied = async (pool, options = {}) => {
|
|
|
45
51
|
return null;
|
|
46
52
|
const status = await inspectMigrations({
|
|
47
53
|
pool,
|
|
48
|
-
migrationsFolder:
|
|
54
|
+
migrationsFolder: authMigrationsFolder(),
|
|
49
55
|
migrationsSchema: schema,
|
|
50
56
|
migrationsTable: table,
|
|
51
57
|
});
|
package/dist/chain.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain.js","sourceRoot":"","sources":["../src/chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAwB,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"chain.js","sourceRoot":"","sources":["../src/chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAwB,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAW,EAAE,CAChD,OAAO,CACN,OAAO,CACN,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CACrC,oDAAoD,CACpD,CACD,CACD,CAAC;AAEH,wEAAwE;AACxE,MAAM,CAAC,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAE3D,mEAAmE;AACnE,MAAM,MAAM,GAAG,CAAC,KAAc,EAAiB,EAAE,CAChD,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,OAAQ,KAA6B,CAAC,KAAK,KAAK,UAAU;IAC1D,OAAQ,KAA+B,CAAC,OAAO,KAAK,UAAU,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACzC,OAAO,C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AAG,CAC7B,QAAiB,EACjB,OAAO,GAA0B,EAAE,EACX,EAAE;IAC1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,IAAI,EAAE,GAAE,CAAC,CAAC;IAC7C,IAAI,OAAkC,CAAC;IACvC,OAAO,GAAG,EAAE;QACX,OAAO,KAAK,sBAAsB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC5E,OAAO,OAAO,CAAC;IAChB,CAAC,CAAC;AACH,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { assertAuthChainApplied,
|
|
1
|
+
export { assertAuthChainApplied, authMigrationsFolder, AUTH_MIGRATIONS_TABLE, type AuthChainCheckOptions, AuthChainNotAppliedError, } from "./chain.js";
|
|
2
2
|
export { type BackendJwtConfig, backendJwtOptions, verifyBackendJwt } from "./jwt.js";
|
|
3
3
|
export { base58Id, fromPrefixedId, toPrefixedId, uuidGenerateId } from "./id.js";
|
|
4
4
|
export { type AuthEnv, authEnv, authSecret, isConfigured } from "./keys.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACN,sBAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACN,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,KAAK,qBAAqB,EAC1B,wBAAwB,GACxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACjF,OAAO,EAAE,KAAK,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC5E,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,aAAa,EAClB,wBAAwB,EACxB,KAAK,SAAS,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EACN,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,KAAK,cAAc,EACnB,cAAc,EACd,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,mBAAmB,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// "@ingram-tech/nk-auth/client" so importing the server presets never pulls in
|
|
3
3
|
// React. Focused subpaths (./jwt, ./organization, ./pool) let a site import
|
|
4
4
|
// only what it needs (e.g. avoid bcrypt when it doesn't use passwords).
|
|
5
|
-
export { assertAuthChainApplied,
|
|
5
|
+
export { assertAuthChainApplied, authMigrationsFolder, AUTH_MIGRATIONS_TABLE, AuthChainNotAppliedError, } from "./chain.js";
|
|
6
6
|
export { backendJwtOptions, verifyBackendJwt } from "./jwt.js";
|
|
7
7
|
export { base58Id, fromPrefixedId, toPrefixedId, uuidGenerateId } from "./id.js";
|
|
8
8
|
export { authEnv, authSecret, isConfigured } from "./keys.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AAExE,OAAO,EACN,sBAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AAExE,OAAO,EACN,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EAErB,wBAAwB,GACxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAyB,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACjF,OAAO,EAAgB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC5E,OAAO,EAIN,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAElB,wBAAwB,GAExB,MAAM,cAAc,CAAC;AACtB,OAAO,EACN,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAE3B,cAAc,EAGd,mBAAmB,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ingram-tech/nk-auth",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "The Ingram Better Auth foundation: composable presets (org, dual-shape JWT, active-org hooks, pg pool) for Next.js sites.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -60,7 +60,8 @@
|
|
|
60
60
|
"types": "./dist/client.d.ts",
|
|
61
61
|
"import": "./dist/client.js"
|
|
62
62
|
},
|
|
63
|
-
"./migrations/*": "./migrations/*"
|
|
63
|
+
"./migrations/*": "./migrations/*",
|
|
64
|
+
"./package.json": "./package.json"
|
|
64
65
|
},
|
|
65
66
|
"scripts": {
|
|
66
67
|
"build": "rm -rf dist *.tsbuildinfo && tsc -p tsconfig.build.json",
|
|
@@ -96,7 +97,7 @@
|
|
|
96
97
|
},
|
|
97
98
|
"devDependencies": {
|
|
98
99
|
"@better-auth/passkey": "1.7.4",
|
|
99
|
-
"@ingram-tech/nk-dev": "0.17.
|
|
100
|
+
"@ingram-tech/nk-dev": "0.17.1",
|
|
100
101
|
"@types/bcrypt": "^6.0.0",
|
|
101
102
|
"@types/node": "^26.5.1",
|
|
102
103
|
"@types/pg": "^8.23.1",
|
package/src/chain.ts
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { inspectMigrations, type MigrationStatus } from "@ingram-tech/nk-db/migrate";
|
|
2
|
-
import {
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { dirname } from "node:path";
|
|
3
4
|
import type { Pool } from "pg";
|
|
4
5
|
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
)
|
|
6
|
+
/**
|
|
7
|
+
* The migration chain this package ships: `migrations/` in the installed
|
|
8
|
+
* package. Resolved through the package manifest, at call time, so a bundler
|
|
9
|
+
* that rewrites `import.meta.url` (Next's server build) still lands on the
|
|
10
|
+
* folder under `node_modules`, and never sees a URL it would try to inline.
|
|
11
|
+
*/
|
|
12
|
+
export const authMigrationsFolder = (): string =>
|
|
13
|
+
dirname(
|
|
14
|
+
dirname(
|
|
15
|
+
createRequire(import.meta.url).resolve(
|
|
16
|
+
"@ingram-tech/nk-auth/migrations/meta/_journal.json",
|
|
17
|
+
),
|
|
18
|
+
),
|
|
19
|
+
);
|
|
9
20
|
|
|
10
21
|
/** The journal table the README tells a site to record the chain in. */
|
|
11
22
|
export const AUTH_MIGRATIONS_TABLE = "__nkauth_migrations";
|
|
@@ -68,7 +79,7 @@ export const assertAuthChainApplied = async (
|
|
|
68
79
|
if (rows[0]?.present === null || rows[0]?.present === undefined) return null;
|
|
69
80
|
const status = await inspectMigrations({
|
|
70
81
|
pool,
|
|
71
|
-
migrationsFolder:
|
|
82
|
+
migrationsFolder: authMigrationsFolder(),
|
|
72
83
|
migrationsSchema: schema,
|
|
73
84
|
migrationsTable: table,
|
|
74
85
|
});
|