diff --git a/package-lock.json b/package-lock.json index 425910e..6ead234 100644 --- a/package-lock.json +++ b/package-lock.json @@ -177,6 +177,19 @@ "resolved": "packages/idempotency", "link": true }, + "node_modules/@inkanjs/inkan": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/@inkanjs/inkan/-/inkan-0.9.2.tgz", + "integrity": "sha512-ftKg1xXFAQ9B7x1R2jN6q6TDc8AZ81yo60J8LXuQbZwQngXzAo9kQgICObc0GBHQkPFRjZEkf6ZzRCFCMW7lWQ==", + "dev": true, + "license": "MIT", + "bin": { + "inkan": "dist/cli.js" + }, + "engines": { + "node": ">=22" + } + }, "node_modules/@inkanjs/mongo": { "resolved": "packages/mongo", "link": true @@ -731,19 +744,6 @@ "node": ">=16.20.0" } }, - "node_modules/@vxnsin/inkan": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@vxnsin/inkan/-/inkan-0.8.0.tgz", - "integrity": "sha512-hwCyNL0VQcvTvWxjIVCT8QFaQ92fR0dXB7aca0AGXqdBzd7HpeirLg/o2QI16MIkHroxSGuPaerM/f3lO78zBA==", - "dev": true, - "license": "MIT", - "bin": { - "inkan": "dist/cli.js" - }, - "engines": { - "node": ">=22" - } - }, "node_modules/agent-base": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", @@ -2647,66 +2647,66 @@ }, "packages/auth": { "name": "@inkanjs/auth", - "version": "0.2.1", + "version": "0.2.2", "license": "MIT", "devDependencies": { - "@vxnsin/inkan": "^0.8.0" + "@inkanjs/inkan": "^0.9.2" }, "engines": { "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" } }, "packages/circuit-breaker": { "name": "@inkanjs/circuit-breaker", - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "devDependencies": { - "@vxnsin/inkan": "^0.8.0" + "@inkanjs/inkan": "^0.9.2" }, "engines": { "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" } }, "packages/etag": { "name": "@inkanjs/etag", - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "devDependencies": { - "@vxnsin/inkan": "^0.8.0" + "@inkanjs/inkan": "^0.9.2" }, "engines": { "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" } }, "packages/idempotency": { "name": "@inkanjs/idempotency", - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "devDependencies": { - "@vxnsin/inkan": "^0.8.0" + "@inkanjs/inkan": "^0.9.2" }, "engines": { "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" } }, "packages/mongo": { "name": "@inkanjs/mongo", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "devDependencies": { - "@vxnsin/inkan": "^0.8.0", + "@inkanjs/inkan": "^0.9.2", "mongodb": "^7.7.0", "mongodb-memory-server-core": "^11.3.0" }, @@ -2714,15 +2714,15 @@ "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" } }, "packages/mysql": { "name": "@inkanjs/mysql", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "devDependencies": { - "@vxnsin/inkan": "^0.8.0", + "@inkanjs/inkan": "^0.9.2", "mysql-memory-server": "^1.17.0", "mysql2": "^3.24.6" }, @@ -2730,32 +2730,32 @@ "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" } }, "packages/otel": { "name": "@inkanjs/otel", - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "devDependencies": { - "@opentelemetry/api": "^1.9.1", - "@vxnsin/inkan": "^0.8.0" + "@inkanjs/inkan": "^0.9.2", + "@opentelemetry/api": "^1.9.1" }, "engines": { "node": ">=22.18" }, "peerDependencies": { - "@opentelemetry/api": "^1.4.0", - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0", + "@opentelemetry/api": "^1.4.0" } }, "packages/postgres": { "name": "@inkanjs/postgres", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "devDependencies": { + "@inkanjs/inkan": "^0.9.2", "@types/pg": "^8.23.1", - "@vxnsin/inkan": "^0.8.0", "embedded-postgres": "^18.4.0-beta.17", "pg": "^8.23.1", "postgres": "^3.4.9" @@ -2764,29 +2764,29 @@ "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" } }, "packages/proxy": { "name": "@inkanjs/proxy", - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "devDependencies": { - "@vxnsin/inkan": "^0.8.0" + "@inkanjs/inkan": "^0.9.2" }, "engines": { "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" } }, "packages/redis": { "name": "@inkanjs/redis", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "devDependencies": { - "@vxnsin/inkan": "^0.8.0", + "@inkanjs/inkan": "^0.9.2", "ioredis": "^6.0.0", "redis": "^6.3.0", "redis-memory-server": "^0.17.1" @@ -2795,35 +2795,35 @@ "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" } }, "packages/secure-headers": { "name": "@inkanjs/secure-headers", - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "devDependencies": { - "@vxnsin/inkan": "^0.8.0" + "@inkanjs/inkan": "^0.9.2" }, "engines": { "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" } }, "packages/session": { "name": "@inkanjs/session", - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "devDependencies": { - "@vxnsin/inkan": "^0.8.0" + "@inkanjs/inkan": "^0.9.2" }, "engines": { "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" } } } diff --git a/packages/auth/CHANGELOG.md b/packages/auth/CHANGELOG.md index b5060ec..eaf17f1 100644 --- a/packages/auth/CHANGELOG.md +++ b/packages/auth/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.2.2 + +- Works with `@inkanjs/inkan`, the new name of the core (it was `@vxnsin/inkan`). Install + `@inkanjs/inkan` 0.9.2 or later next to it. + ## 0.2.1 - The generated routes mark the statuses no example can show as `untested`, with the reason diff --git a/packages/auth/README.md b/packages/auth/README.md index 4736c83..861e1a8 100644 --- a/packages/auth/README.md +++ b/packages/auth/README.md @@ -14,7 +14,7 @@ Node 22.18 or newer, inkan 0.8 (`register()` refuses other versions). MIT licens ## Quick start ```js -import { inkan, t } from "@vxnsin/inkan"; +import { inkan, t } from "@inkanjs/inkan"; import { auth } from "@inkanjs/auth"; const login = auth({ @@ -296,8 +296,8 @@ typed their address. Without `emailVerified`, make a new account or refuse. Sessions, refresh tokens and TOTP steps live in `store`; the brute-force counters in `bruteForce.store`, a second one. Both are inkan `Store`s, by default `memoryStore()` from -@vxnsin/inkan: in memory, per process. Any `Store` works, such as @inkanjs/redis, @inkanjs/mongo, @inkanjs/mysql and @inkanjs/postgres (coming with inkan 0.8), or one you -write against the interface (`storeConformance` from `@vxnsin/inkan/testing` checks it): +@inkanjs/inkan: in memory, per process. Any `Store` works, such as @inkanjs/redis, @inkanjs/mongo, @inkanjs/mysql and @inkanjs/postgres (coming with inkan 0.8), or one you +write against the interface (`storeConformance` from `@inkanjs/inkan/testing` checks it): ```js import { redisStore } from "@inkanjs/redis"; diff --git a/packages/auth/index.d.ts b/packages/auth/index.d.ts index 8b93418..3234b0c 100644 --- a/packages/auth/index.d.ts +++ b/packages/auth/index.d.ts @@ -1,4 +1,4 @@ -import type { Context, memoryStore as coreMemoryStore, Plugin, ProblemBody, Schema, Security, Store as CoreStore } from "@vxnsin/inkan"; +import type { Context, memoryStore as coreMemoryStore, Plugin, ProblemBody, Schema, Security, Store as CoreStore } from "@inkanjs/inkan"; import type { AsymmetricKey, Duration, JwksOptions, JwtAlgorithm, JwtPayload, Secret } from "./lib/jwt.js"; import type { OAuthTokens, OAuthUser, Provider } from "./lib/oauth.js"; import type { ScryptParams } from "./lib/password.js"; @@ -12,7 +12,7 @@ export { randomToken, hashToken, safeEqual } from "./lib/tokens.js"; export { github, google, oidcProvider } from "./lib/oauth.js"; export type { OAuth2Provider, OAuthTokens, OAuthUser, OidcProvider, Provider } from "./lib/oauth.js"; -declare module "@vxnsin/inkan" { +declare module "@inkanjs/inkan" { interface RouteMeta { /** * What @inkanjs/auth asks of the caller. `roles`: at least one of them (403 otherwise). @@ -54,11 +54,11 @@ export interface UserSource { updatePasswordHash?(id: any, hash: string): Awaitable; } -/** @deprecated Use `Store` from "@vxnsin/inkan"; TTLs are in milliseconds since 0.2. */ +/** @deprecated Use `Store` from "@inkanjs/inkan"; TTLs are in milliseconds since 0.2. */ export type Store = CoreStore; -/** @deprecated Use `Store` from "@vxnsin/inkan"; TTLs are in milliseconds since 0.2. */ +/** @deprecated Use `Store` from "@inkanjs/inkan"; TTLs are in milliseconds since 0.2. */ export type AuthStore = CoreStore; -/** @deprecated Use `memoryStore` from "@vxnsin/inkan": this is the same function, re-exported. */ +/** @deprecated Use `memoryStore` from "@inkanjs/inkan": this is the same function, re-exported. */ export declare const memoryStore: typeof coreMemoryStore; export interface SessionOptions { diff --git a/packages/auth/index.js b/packages/auth/index.js index c37569d..7af761b 100644 --- a/packages/auth/index.js +++ b/packages/auth/index.js @@ -1,8 +1,8 @@ // @inkanjs/auth: the inkan plugin, and the building blocks it is made of for apps that need // them on their own (password reset tokens, tokens for other services, account linking). export { auth } from "./lib/plugin.js"; -/** @deprecated the core's `memoryStore` from @vxnsin/inkan, re-exported for 0.1 code. */ -export { memoryStore } from "@vxnsin/inkan"; +/** @deprecated the core's `memoryStore` from @inkanjs/inkan, re-exported for 0.1 code. */ +export { memoryStore } from "@inkanjs/inkan"; export { AuthError } from "./lib/errors.js"; export { signJwt, verifyJwt, jwksSource } from "./lib/jwt.js"; export { hashPassword, verifyPassword, needsRehash } from "./lib/password.js"; diff --git a/packages/auth/lib/plugin.js b/packages/auth/lib/plugin.js index 8289138..b116e6f 100644 --- a/packages/auth/lib/plugin.js +++ b/packages/auth/lib/plugin.js @@ -7,7 +7,7 @@ // for a scheme this plugin cannot verify is refused, never waved through. import { Buffer } from "node:buffer"; import { randomBytes } from "node:crypto"; -import { HttpProblem, memoryStore, plugin, problem, reply, t } from "@vxnsin/inkan"; +import { HttpProblem, memoryStore, plugin, problem, reply, t } from "@inkanjs/inkan"; import { AuthError } from "./errors.js"; import { isObject, secureUrl } from "./http.js"; import { jwksSource, signJwt, verifyJwt } from "./jwt.js"; diff --git a/packages/auth/lib/store.js b/packages/auth/lib/store.js index ad26aab..0b37db5 100644 --- a/packages/auth/lib/store.js +++ b/packages/auth/lib/store.js @@ -1,5 +1,5 @@ // What the plugin keeps between requests (sessions, refresh tokens, login counters, the last -// TOTP step) lives in an inkan `Store`: `memoryStore()` from @vxnsin/inkan by default, or any +// TOTP step) lives in an inkan `Store`: `memoryStore()` from @inkanjs/inkan by default, or any // adapter (Redis, a database) whose add, take and increment are atomic across processes. // What is left here is the lock for the few steps that read and then write within one process. diff --git a/packages/auth/package.json b/packages/auth/package.json index b6c5fe3..e7c6b95 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@inkanjs/auth", - "version": "0.2.1", + "version": "0.2.2", "description": "Authentication for inkan without dependencies: sessions, JWTs, API keys, passwords, TOTP and OAuth on node:crypto alone.", "type": "module", "license": "MIT", @@ -41,10 +41,10 @@ "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" }, "devDependencies": { - "@vxnsin/inkan": "^0.8.0" + "@inkanjs/inkan": "^0.9.2" }, "scripts": { "test": "node --import ../../scripts/no-deprecations.js --test \"test/*.test.ts\"" diff --git a/packages/auth/test/app.ts b/packages/auth/test/app.ts index c526867..a188451 100644 --- a/packages/auth/test/app.ts +++ b/packages/auth/test/app.ts @@ -1,5 +1,5 @@ // What the plugin tests share: a few users, a clock to move, and a cookie jar for inject. -import { inkan, type InjectResponse } from "@vxnsin/inkan"; +import { inkan, type InjectResponse } from "@inkanjs/inkan"; import { auth, hashPassword, type AuthOptions } from "../index.js"; export const SECRET = "test-secret-that-is-long-enough-0123456789"; diff --git a/packages/auth/test/plugin-credentials.test.ts b/packages/auth/test/plugin-credentials.test.ts index 72c1aca..930365d 100644 --- a/packages/auth/test/plugin-credentials.test.ts +++ b/packages/auth/test/plugin-credentials.test.ts @@ -1,7 +1,7 @@ import { test, after } from "node:test"; import assert from "node:assert/strict"; import { createHash, createHmac, generateKeyPairSync } from "node:crypto"; -import { inkan } from "@vxnsin/inkan"; +import { inkan } from "@inkanjs/inkan"; import { auth, signJwt } from "../index.js"; import { SECRET, clock, makeUsers, type User } from "./app.ts"; import { json, serve } from "./server.ts"; diff --git a/packages/auth/test/plugin-docs.test.ts b/packages/auth/test/plugin-docs.test.ts index 6fb5981..4891245 100644 --- a/packages/auth/test/plugin-docs.test.ts +++ b/packages/auth/test/plugin-docs.test.ts @@ -1,6 +1,6 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { inkan, t } from "@vxnsin/inkan"; +import { inkan, t } from "@inkanjs/inkan"; import { auth, github } from "../index.js"; import { FAST, SECRET, makeUsers, type User } from "./app.ts"; diff --git a/packages/auth/test/plugin-oauth.test.ts b/packages/auth/test/plugin-oauth.test.ts index c3075c3..72280cd 100644 --- a/packages/auth/test/plugin-oauth.test.ts +++ b/packages/auth/test/plugin-oauth.test.ts @@ -1,7 +1,7 @@ import { test, after } from "node:test"; import assert from "node:assert/strict"; import { createHash } from "node:crypto"; -import { inkan } from "@vxnsin/inkan"; +import { inkan } from "@inkanjs/inkan"; import { auth, github, type OAuthUser } from "../index.js"; import { SECRET, clock, cookieOf, makeUsers, setCookieOf, type User } from "./app.ts"; import { json, serve } from "./server.ts"; diff --git a/packages/auth/test/plugin-session.test.ts b/packages/auth/test/plugin-session.test.ts index 5b38b88..fe1f280 100644 --- a/packages/auth/test/plugin-session.test.ts +++ b/packages/auth/test/plugin-session.test.ts @@ -1,6 +1,6 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { memoryStore } from "@vxnsin/inkan"; +import { memoryStore } from "@inkanjs/inkan"; import { auth } from "../index.js"; import { OTHER_SECRET, SECRET, clock, cookieOf, login, makeApp, makeUsers, setCookieOf } from "./app.ts"; import { countingStore } from "./store.ts"; @@ -88,7 +88,7 @@ test("meta.auth.optional on a route without security still sees the user of a se }); test("a public route still refuses a cross-site POST that carries our session cookie", async () => { - const { inkan } = await import("@vxnsin/inkan"); + const { inkan } = await import("@inkanjs/inkan"); const users = makeUsers(); const plugin = auth({ secret: SECRET, users: users.source, password: { ln: 14 } }); const app = inkan({ log: false }) @@ -196,7 +196,7 @@ test("secret rotation: a cookie signed with the old secret still works, one with test("ctx.auth.login and logout for flows of your own", async () => { const users = makeUsers(); const plugin = auth({ secret: SECRET, users: users.source, routes: false }); - const { inkan } = await import("@vxnsin/inkan"); + const { inkan } = await import("@inkanjs/inkan"); const app = inkan({ log: false }) .register(plugin) .post("/signup", async (ctx) => { @@ -258,7 +258,7 @@ test("CSRF: configured origins are let through", async () => { }); test("CSRF: a bearer POST is not cookie-based and never checked", async () => { - const { inkan } = await import("@vxnsin/inkan"); + const { inkan } = await import("@inkanjs/inkan"); const users = makeUsers(); const plugin = auth({ secret: SECRET, users: users.source, jwt: { issue: true }, password: { ln: 14 } }); const app = inkan({ log: false }) @@ -493,7 +493,7 @@ test("options are checked when the plugin is made", () => { }); test("a preHandler hook sees the user itself, not a promise, on a route that needs one", async () => { - const { inkan } = await import("@vxnsin/inkan"); + const { inkan } = await import("@inkanjs/inkan"); const users = makeUsers(); const plugin = auth({ secret: SECRET, users: users.source, password: { ln: 14 } }); const seen: unknown[] = []; diff --git a/packages/auth/test/plugin-tokens.test.ts b/packages/auth/test/plugin-tokens.test.ts index cf1eb53..8e5ba65 100644 --- a/packages/auth/test/plugin-tokens.test.ts +++ b/packages/auth/test/plugin-tokens.test.ts @@ -1,6 +1,6 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { inkan, memoryStore, type Store } from "@vxnsin/inkan"; +import { inkan, memoryStore, type Store } from "@inkanjs/inkan"; import { auth, verifyJwt, type AuthOptions } from "../index.js"; import { totp } from "../lib/totp.js"; import { FAST, SECRET, clock, cookieOf, login, makeApp, makeUsers, type User } from "./app.ts"; diff --git a/packages/auth/test/plugin-types.test.ts b/packages/auth/test/plugin-types.test.ts index a5c636b..1d2fe3d 100644 --- a/packages/auth/test/plugin-types.test.ts +++ b/packages/auth/test/plugin-types.test.ts @@ -1,7 +1,7 @@ // Types: `npx tsc` checks this file; node runs it as an ordinary test. import { test } from "node:test"; import assert from "node:assert/strict"; -import { inkan } from "@vxnsin/inkan"; +import { inkan } from "@inkanjs/inkan"; import { auth, type AuthContext } from "../index.js"; import { SECRET } from "./app.ts"; @@ -53,7 +53,7 @@ test("an explicit generic, and meta.auth is typed", () => { }); test("the plugin's routes reach the typed client: POST /auth/login, under a prefix too", async () => { - const { client } = await import("@vxnsin/inkan/client"); + const { client } = await import("@inkanjs/inkan/client"); const plugin = auth({ secret: SECRET, users: { find: async (login: string) => db.get(login), byId: async (id: string) => db.get(id) } }); const app = inkan({ log: false }).register(plugin); const api = client("http://localhost:1"); diff --git a/packages/auth/test/store.test.ts b/packages/auth/test/store.test.ts index 39824dc..5aaeae7 100644 --- a/packages/auth/test/store.test.ts +++ b/packages/auth/test/store.test.ts @@ -1,6 +1,6 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { inkan, memoryStore, type Store } from "@vxnsin/inkan"; +import { inkan, memoryStore, type Store } from "@inkanjs/inkan"; import { auth, memoryStore as deprecatedMemoryStore, type AuthOptions } from "../index.js"; import { totp } from "../lib/totp.js"; import { FAST, SECRET, clock, cookieOf, makeUsers, type User } from "./app.ts"; diff --git a/packages/auth/test/store.ts b/packages/auth/test/store.ts index 42fe945..f525787 100644 --- a/packages/auth/test/store.ts +++ b/packages/auth/test/store.ts @@ -1,6 +1,6 @@ // A Store that counts what is asked of it: only the six methods of the interface are there, // and every property the plugin reads is noted, so a test can show it uses nothing else. -import { memoryStore, type Store } from "@vxnsin/inkan"; +import { memoryStore, type Store } from "@inkanjs/inkan"; export const METHODS = ["get", "set", "delete", "add", "take", "increment"] as const; diff --git a/packages/circuit-breaker/CHANGELOG.md b/packages/circuit-breaker/CHANGELOG.md index 95ba2d5..20459d1 100644 --- a/packages/circuit-breaker/CHANGELOG.md +++ b/packages/circuit-breaker/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.2.1 + +- Works with `@inkanjs/inkan`, the new name of the core (it was `@vxnsin/inkan`). Install + `@inkanjs/inkan` 0.9.2 or later next to it. + ## 0.2.0 - Works with inkan 0.8 (`inkan: ">=0.8.0 <1.0.0"`). diff --git a/packages/circuit-breaker/README.md b/packages/circuit-breaker/README.md index 4c39088..94062f9 100644 --- a/packages/circuit-breaker/README.md +++ b/packages/circuit-breaker/README.md @@ -6,7 +6,7 @@ queue of retries, and your callers get an answer at once instead of waiting for timeout. ```sh -npm install @vxnsin/inkan @inkanjs/circuit-breaker +npm install @inkanjs/inkan @inkanjs/circuit-breaker ``` ``` @@ -21,7 +21,7 @@ The common case: a service you call that sometimes falls over. Wrap the call onc use the wrapped function as before. ```ts -import { inkan, problem } from "@vxnsin/inkan"; +import { inkan, problem } from "@inkanjs/inkan"; import { circuit, CircuitOpenError } from "@inkanjs/circuit-breaker"; const rates = circuit((currency: string) => fetch(`https://rates.example/${currency}`, { signal: AbortSignal.timeout(2000) }), { diff --git a/packages/circuit-breaker/index.d.ts b/packages/circuit-breaker/index.d.ts index 26b077b..92bd4ac 100644 --- a/packages/circuit-breaker/index.d.ts +++ b/packages/circuit-breaker/index.d.ts @@ -1,4 +1,4 @@ -import type { Context, Plugin } from "@vxnsin/inkan"; +import type { Context, Plugin } from "@inkanjs/inkan"; export type CircuitState = "closed" | "open" | "half-open"; diff --git a/packages/circuit-breaker/index.js b/packages/circuit-breaker/index.js index dd349c0..2c27f79 100644 --- a/packages/circuit-breaker/index.js +++ b/packages/circuit-breaker/index.js @@ -8,7 +8,7 @@ // open calls fail at once (CircuitOpenError, or a 503 problem) for `cooldown` ms // half-open one call goes through as a probe: success closes it, failure opens it again -import { plugin, problem } from "@vxnsin/inkan"; +import { plugin, problem } from "@inkanjs/inkan"; /** 5xx answers and thrown errors. */ const defaultIsFailure = (status, err) => err !== undefined || (typeof status === "number" && status >= 500); diff --git a/packages/circuit-breaker/package.json b/packages/circuit-breaker/package.json index c4f2d08..8623865 100644 --- a/packages/circuit-breaker/package.json +++ b/packages/circuit-breaker/package.json @@ -1,6 +1,6 @@ { "name": "@inkanjs/circuit-breaker", - "version": "0.2.0", + "version": "0.2.1", "description": "Circuit breakers for inkan: stop calling what keeps failing, for incoming routes and outgoing calls.", "type": "module", "license": "MIT", @@ -34,10 +34,10 @@ "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" }, "devDependencies": { - "@vxnsin/inkan": "^0.8.0" + "@inkanjs/inkan": "^0.9.2" }, "scripts": { "test": "node --import ../../scripts/no-deprecations.js --test test.ts" diff --git a/packages/circuit-breaker/test.ts b/packages/circuit-breaker/test.ts index c178819..10269dd 100644 --- a/packages/circuit-breaker/test.ts +++ b/packages/circuit-breaker/test.ts @@ -1,6 +1,6 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { HttpProblem, inkan, reply } from "@vxnsin/inkan"; +import { HttpProblem, inkan, reply } from "@inkanjs/inkan"; import { breaker, circuit, Circuit, CircuitOpenError, type CircuitState } from "./index.js"; const quiet = { log: false as const, onError: () => {} }; diff --git a/packages/etag/CHANGELOG.md b/packages/etag/CHANGELOG.md index 9bd849e..31c456c 100644 --- a/packages/etag/CHANGELOG.md +++ b/packages/etag/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.2.1 + +- Works with `@inkanjs/inkan`, the new name of the core (it was `@vxnsin/inkan`). Install + `@inkanjs/inkan` 0.9.2 or later next to it. + ## 0.2.0 - Works with inkan 0.8 (`inkan: ">=0.8.0 <1.0.0"`). diff --git a/packages/etag/README.md b/packages/etag/README.md index fa2dac4..6e5ef85 100644 --- a/packages/etag/README.md +++ b/packages/etag/README.md @@ -5,11 +5,11 @@ already has an answer gets an empty 304 instead of the same body again. The tag of exactly the bytes that are sent, worked out before compression. ```sh -npm install @vxnsin/inkan @inkanjs/etag +npm install @inkanjs/inkan @inkanjs/etag ``` ```ts -import { compress, inkan } from "@vxnsin/inkan"; +import { compress, inkan } from "@inkanjs/inkan"; import { etag } from "@inkanjs/etag"; const app = inkan() diff --git a/packages/etag/index.d.ts b/packages/etag/index.d.ts index 9c94398..2321297 100644 --- a/packages/etag/index.d.ts +++ b/packages/etag/index.d.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "@vxnsin/inkan"; +import type { Plugin } from "@inkanjs/inkan"; export type EtagOptions = { /** `W/"…"` instead of a strong tag. Default false. */ diff --git a/packages/etag/index.js b/packages/etag/index.js index 2d4ec0d..c9e8074 100644 --- a/packages/etag/index.js +++ b/packages/etag/index.js @@ -9,7 +9,7 @@ // whatever encoding the client takes. import { createHash } from "node:crypto"; -import { plugin } from "@vxnsin/inkan"; +import { plugin } from "@inkanjs/inkan"; const TAG = /(W\/)?"([^"]*)"/g; diff --git a/packages/etag/package.json b/packages/etag/package.json index a2de487..a8e9001 100644 --- a/packages/etag/package.json +++ b/packages/etag/package.json @@ -1,6 +1,6 @@ { "name": "@inkanjs/etag", - "version": "0.2.0", + "version": "0.2.1", "description": "ETags and 304 answers for inkan: hashed from exactly the bytes that go out, before compression.", "type": "module", "license": "MIT", @@ -34,10 +34,10 @@ "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" }, "devDependencies": { - "@vxnsin/inkan": "^0.8.0" + "@inkanjs/inkan": "^0.9.2" }, "scripts": { "test": "node --import ../../scripts/no-deprecations.js --test test.ts" diff --git a/packages/etag/test.ts b/packages/etag/test.ts index 62a384a..68e2b7c 100644 --- a/packages/etag/test.ts +++ b/packages/etag/test.ts @@ -1,7 +1,7 @@ import { test } from "node:test"; import assert from "node:assert/strict"; import { createHash } from "node:crypto"; -import { compress, inkan, reply, t } from "@vxnsin/inkan"; +import { compress, inkan, reply, t } from "@inkanjs/inkan"; import { etag, etagOf, noneMatch } from "./index.js"; const quiet = { log: false as const }; diff --git a/packages/idempotency/CHANGELOG.md b/packages/idempotency/CHANGELOG.md index edc64e4..8051801 100644 --- a/packages/idempotency/CHANGELOG.md +++ b/packages/idempotency/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.2.1 + +- Works with `@inkanjs/inkan`, the new name of the core (it was `@vxnsin/inkan`). Install + `@inkanjs/inkan` 0.9.2 or later next to it. + ## 0.2.0 - **Any inkan `Store`** (inkan 0.8) for `store`: `memoryStore()` from @vxnsin/inkan, or an diff --git a/packages/idempotency/README.md b/packages/idempotency/README.md index 6d1322d..bff2186 100644 --- a/packages/idempotency/README.md +++ b/packages/idempotency/README.md @@ -5,11 +5,11 @@ again, because the answer got lost on the way, gets the first answer again inste second order or a second payment. As Stripe and the IETF draft do it. ```sh -npm install @vxnsin/inkan @inkanjs/idempotency +npm install @inkanjs/inkan @inkanjs/idempotency ``` ```ts -import { inkan, t } from "@vxnsin/inkan"; +import { inkan, t } from "@inkanjs/inkan"; import { idempotency } from "@inkanjs/idempotency"; const app = inkan() @@ -71,7 +71,7 @@ POST /payments idempotency-key: 5f0c… {"amount":99} → 422 idempotency-ke ## Store -Answers are kept in an inkan `Store`, by default `memoryStore()` from @vxnsin/inkan: one +Answers are kept in an inkan `Store`, by default `memoryStore()` from @inkanjs/inkan: one process, at most `max` keys (default 10000), the least recently used dropped first. For several processes any `Store` works, such as @inkanjs/redis, @inkanjs/mongo, @inkanjs/mysql and @inkanjs/postgres (coming with inkan 0.8): diff --git a/packages/idempotency/index.d.ts b/packages/idempotency/index.d.ts index 2467c2a..89b4316 100644 --- a/packages/idempotency/index.d.ts +++ b/packages/idempotency/index.d.ts @@ -1,4 +1,4 @@ -import type { Context, memoryStore as coreMemoryStore, Plugin, Store } from "@vxnsin/inkan"; +import type { Context, memoryStore as coreMemoryStore, Plugin, Store } from "@inkanjs/inkan"; /** What is kept under a key: a marker while the first request runs, then its answer. Plain JSON. */ export type IdempotencyRecord = @@ -14,14 +14,14 @@ export type IdempotencyRecord = binary: boolean; }; -/** @deprecated Use `Store` from "@vxnsin/inkan". */ +/** @deprecated Use `Store` from "@inkanjs/inkan". */ export type IdempotencyStore = Store; export type IdempotencyOptions = { /** * Where answers are kept, an `IdempotencyRecord` per key: any inkan `Store` (Redis, a * database, …); its atomic `add` keeps two processes from both running a key. Default - * `memoryStore()` from @vxnsin/inkan: one process only. + * `memoryStore()` from @inkanjs/inkan: one process only. */ store?: Store; /** Default `["POST", "PATCH"]`. */ @@ -56,5 +56,5 @@ export type IdempotencyOptions = { export declare function idempotency(options?: IdempotencyOptions): Plugin<{}, {}, {}>; export default idempotency; -/** @deprecated Use `memoryStore` from "@vxnsin/inkan": this is the same function, re-exported. */ +/** @deprecated Use `memoryStore` from "@inkanjs/inkan": this is the same function, re-exported. */ export declare const memoryStore: typeof coreMemoryStore; diff --git a/packages/idempotency/index.js b/packages/idempotency/index.js index 5fa6c71..a86d28a 100644 --- a/packages/idempotency/index.js +++ b/packages/idempotency/index.js @@ -9,10 +9,10 @@ // the same key for another request (another method, path, query or body) a 422. import { createHash } from "node:crypto"; -import { HttpProblem, memoryStore, plugin, problem, reply, stateKey, t } from "@vxnsin/inkan"; +import { HttpProblem, memoryStore, plugin, problem, reply, stateKey, t } from "@inkanjs/inkan"; -/** @deprecated the core's `memoryStore` from @vxnsin/inkan, re-exported for 0.1 code. */ -export { memoryStore } from "@vxnsin/inkan"; +/** @deprecated the core's `memoryStore` from @inkanjs/inkan, re-exported for 0.1 code. */ +export { memoryStore } from "@inkanjs/inkan"; const STORE_METHODS = ["get", "set", "delete", "add"]; diff --git a/packages/idempotency/package.json b/packages/idempotency/package.json index 8b2fb87..ceed725 100644 --- a/packages/idempotency/package.json +++ b/packages/idempotency/package.json @@ -1,6 +1,6 @@ { "name": "@inkanjs/idempotency", - "version": "0.2.0", + "version": "0.2.1", "description": "Idempotency-Key for inkan: a retried POST gets the first answer again instead of running twice.", "type": "module", "license": "MIT", @@ -34,10 +34,10 @@ "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" }, "devDependencies": { - "@vxnsin/inkan": "^0.8.0" + "@inkanjs/inkan": "^0.9.2" }, "scripts": { "test": "node --import ../../scripts/no-deprecations.js --test test.ts" diff --git a/packages/idempotency/test.ts b/packages/idempotency/test.ts index d076bf5..e2be2e3 100644 --- a/packages/idempotency/test.ts +++ b/packages/idempotency/test.ts @@ -1,6 +1,6 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { inkan, memoryStore, plugin, problem, reply, t, type Store } from "@vxnsin/inkan"; +import { inkan, memoryStore, plugin, problem, reply, t, type Store } from "@inkanjs/inkan"; import { idempotency, memoryStore as deprecatedMemoryStore, type IdempotencyOptions } from "./index.js"; const quiet = { log: false as const }; diff --git a/packages/mongo/CHANGELOG.md b/packages/mongo/CHANGELOG.md index 06ae4db..de8a33c 100644 --- a/packages/mongo/CHANGELOG.md +++ b/packages/mongo/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.1.1 + +- Works with `@inkanjs/inkan`, the new name of the core (it was `@vxnsin/inkan`). Install + `@inkanjs/inkan` 0.9.2 or later next to it. + ## 0.1.0 - `mongoStore(dbOrCollection, { collection, events, prefix, create, changeStreams, poll })`: diff --git a/packages/mongo/README.md b/packages/mongo/README.md index 4a7ad75..a6284e4 100644 --- a/packages/mongo/README.md +++ b/packages/mongo/README.md @@ -5,12 +5,12 @@ limits, sessions, logins and idempotency keys kept where every process of your a them. You pass your own `mongodb` client; the package has no dependencies. ```sh -npm install @vxnsin/inkan @inkanjs/mongo mongodb +npm install @inkanjs/inkan @inkanjs/mongo mongodb ``` ```ts import { MongoClient } from "mongodb"; -import { inkan, rateLimit } from "@vxnsin/inkan"; +import { inkan, rateLimit } from "@inkanjs/inkan"; import { mongoStore } from "@inkanjs/mongo"; const client = await new MongoClient(process.env.MONGO_URL!).connect(); diff --git a/packages/mongo/index.d.ts b/packages/mongo/index.d.ts index c068658..c8042ee 100644 --- a/packages/mongo/index.d.ts +++ b/packages/mongo/index.d.ts @@ -1,4 +1,4 @@ -import type { Store } from "@vxnsin/inkan"; +import type { Store } from "@inkanjs/inkan"; /** The parts of a `Db` of the official `mongodb` driver this store uses. */ export type MongoDbLike = { diff --git a/packages/mongo/package.json b/packages/mongo/package.json index dd878fe..35fb0f2 100644 --- a/packages/mongo/package.json +++ b/packages/mongo/package.json @@ -1,6 +1,6 @@ { "name": "@inkanjs/mongo", - "version": "0.1.0", + "version": "0.1.1", "description": "A MongoDB Store for inkan: jobs, rate limits, sessions and idempotency keys shared by every process, on your own mongodb client.", "type": "module", "license": "MIT", @@ -35,10 +35,10 @@ "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" }, "devDependencies": { - "@vxnsin/inkan": "^0.8.0", + "@inkanjs/inkan": "^0.9.2", "mongodb": "^7.7.0", "mongodb-memory-server-core": "^11.3.0" }, diff --git a/packages/mongo/test.ts b/packages/mongo/test.ts index 7b53905..be30731 100644 --- a/packages/mongo/test.ts +++ b/packages/mongo/test.ts @@ -7,7 +7,7 @@ import assert from "node:assert/strict"; import { randomBytes } from "node:crypto"; import { inspect } from "node:util"; import { MongoClient } from "mongodb"; -import { storeConformance } from "@vxnsin/inkan/testing"; +import { storeConformance } from "@inkanjs/inkan/testing"; import { mongoStore, type MongoStore, type MongoStoreOptions } from "./index.js"; const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms)); diff --git a/packages/mysql/CHANGELOG.md b/packages/mysql/CHANGELOG.md index c2ab013..5510d15 100644 --- a/packages/mysql/CHANGELOG.md +++ b/packages/mysql/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.1.1 + +- Works with `@inkanjs/inkan`, the new name of the core (it was `@vxnsin/inkan`). Install + `@inkanjs/inkan` 0.9.2 or later next to it. + ## 0.1.0 - `mysqlStore(pool, { table, events, prefix, create, sweep, poll })`: an inkan `Store` on diff --git a/packages/mysql/README.md b/packages/mysql/README.md index d40fc09..5352fb4 100644 --- a/packages/mysql/README.md +++ b/packages/mysql/README.md @@ -5,12 +5,12 @@ limits, sessions, logins and idempotency keys kept where every process of your a them. You pass your own `mysql2/promise` pool; the package has no dependencies. ```sh -npm install @vxnsin/inkan @inkanjs/mysql mysql2 +npm install @inkanjs/inkan @inkanjs/mysql mysql2 ``` ```ts import mysql from "mysql2/promise"; -import { inkan, rateLimit } from "@vxnsin/inkan"; +import { inkan, rateLimit } from "@inkanjs/inkan"; import { mysqlStore } from "@inkanjs/mysql"; const pool = mysql.createPool(process.env.MYSQL_URL!); diff --git a/packages/mysql/index.d.ts b/packages/mysql/index.d.ts index 0be4dcb..a374414 100644 --- a/packages/mysql/index.d.ts +++ b/packages/mysql/index.d.ts @@ -1,4 +1,4 @@ -import type { Store } from "@vxnsin/inkan"; +import type { Store } from "@inkanjs/inkan"; /** A connection from the pool, as `mysql2/promise` gives it. */ export type MysqlConnectionLike = { diff --git a/packages/mysql/package.json b/packages/mysql/package.json index 0746354..bbcd30a 100644 --- a/packages/mysql/package.json +++ b/packages/mysql/package.json @@ -1,6 +1,6 @@ { "name": "@inkanjs/mysql", - "version": "0.1.0", + "version": "0.1.1", "description": "A MySQL Store for inkan: jobs, rate limits, sessions and idempotency keys shared by every process, on your own mysql2 pool.", "type": "module", "license": "MIT", @@ -35,10 +35,10 @@ "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" }, "devDependencies": { - "@vxnsin/inkan": "^0.8.0", + "@inkanjs/inkan": "^0.9.2", "mysql-memory-server": "^1.17.0", "mysql2": "^3.24.6" }, diff --git a/packages/mysql/test.ts b/packages/mysql/test.ts index 12e0f23..05b0b6a 100644 --- a/packages/mysql/test.ts +++ b/packages/mysql/test.ts @@ -7,7 +7,7 @@ import assert from "node:assert/strict"; import { randomBytes } from "node:crypto"; import { inspect } from "node:util"; import mysql from "mysql2/promise"; -import { storeConformance } from "@vxnsin/inkan/testing"; +import { storeConformance } from "@inkanjs/inkan/testing"; import { mysqlStore, storedKey, type MysqlStore } from "./index.js"; const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms)); diff --git a/packages/otel/CHANGELOG.md b/packages/otel/CHANGELOG.md index 8dbfa12..940539b 100644 --- a/packages/otel/CHANGELOG.md +++ b/packages/otel/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.2.1 + +- Works with `@inkanjs/inkan`, the new name of the core (it was `@vxnsin/inkan`). Install + `@inkanjs/inkan` 0.9.2 or later next to it. + ## 0.2.0 - Works with inkan 0.8 (`inkan: ">=0.8.0 <1.0.0"`). diff --git a/packages/otel/README.md b/packages/otel/README.md index 3fd85a0..815a851 100644 --- a/packages/otel/README.md +++ b/packages/otel/README.md @@ -10,11 +10,11 @@ else: no SDK, no exporter. Which SDK turns the spans into traces is up to your a one, every call is a no-op. ```sh -npm install @vxnsin/inkan @inkanjs/otel @opentelemetry/api +npm install @inkanjs/inkan @inkanjs/otel @opentelemetry/api ``` ```ts -import { inkan } from "@vxnsin/inkan"; +import { inkan } from "@inkanjs/inkan"; import { otel } from "@inkanjs/otel"; const app = inkan() diff --git a/packages/otel/index.d.ts b/packages/otel/index.d.ts index 4e1d84b..ea0c091 100644 --- a/packages/otel/index.d.ts +++ b/packages/otel/index.d.ts @@ -1,5 +1,5 @@ import type { Attributes, Context as OtelContext, Span, Tracer } from "@opentelemetry/api"; -import type { Context, Plugin } from "@vxnsin/inkan"; +import type { Context, Plugin } from "@inkanjs/inkan"; type Ctx = Context; diff --git a/packages/otel/index.js b/packages/otel/index.js index 7fb6b7d..437b1d5 100644 --- a/packages/otel/index.js +++ b/packages/otel/index.js @@ -8,7 +8,7 @@ // is up to the SDK the app sets up. Without one every call here is a no-op. import { context, propagation, ROOT_CONTEXT, SpanKind, SpanStatusCode, trace, INVALID_SPAN_CONTEXT } from "@opentelemetry/api"; -import { plugin, stateKey } from "@vxnsin/inkan"; +import { plugin, stateKey } from "@inkanjs/inkan"; const NAME = "@inkanjs/otel"; const VERSION = "0.1.0"; diff --git a/packages/otel/package.json b/packages/otel/package.json index 33d19ad..011277b 100644 --- a/packages/otel/package.json +++ b/packages/otel/package.json @@ -1,6 +1,6 @@ { "name": "@inkanjs/otel", - "version": "0.2.0", + "version": "0.2.1", "description": "OpenTelemetry tracing for inkan: a server span per request, with the semantic conventions for HTTP.", "type": "module", "license": "MIT", @@ -35,11 +35,11 @@ }, "peerDependencies": { "@opentelemetry/api": "^1.4.0", - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" }, "devDependencies": { "@opentelemetry/api": "^1.9.1", - "@vxnsin/inkan": "^0.8.0" + "@inkanjs/inkan": "^0.9.2" }, "scripts": { "test": "node --import ../../scripts/no-deprecations.js --test test.ts" diff --git a/packages/otel/test.ts b/packages/otel/test.ts index f2ace76..8760fd1 100644 --- a/packages/otel/test.ts +++ b/packages/otel/test.ts @@ -26,7 +26,7 @@ import { type Tracer, type TracerProvider, } from "@opentelemetry/api"; -import { HttpProblem, inkan, t as s } from "@vxnsin/inkan"; +import { HttpProblem, inkan, t as s } from "@inkanjs/inkan"; import { otel, spanOf } from "./index.js"; // ---------- a tracer that keeps its spans in memory: no SDK needed ---------- diff --git a/packages/postgres/CHANGELOG.md b/packages/postgres/CHANGELOG.md index a1033b3..17ec321 100644 --- a/packages/postgres/CHANGELOG.md +++ b/packages/postgres/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.1.1 + +- Works with `@inkanjs/inkan`, the new name of the core (it was `@vxnsin/inkan`). Install + `@inkanjs/inkan` 0.9.2 or later next to it. + ## 0.1.0 - `postgresStore(db, { table, schema, prefix, create, sweep, listener })`: an inkan `Store` diff --git a/packages/postgres/README.md b/packages/postgres/README.md index 56d2e24..9342611 100644 --- a/packages/postgres/README.md +++ b/packages/postgres/README.md @@ -7,11 +7,11 @@ have, `pg` (a Pool or a Client) or `postgres` (postgres.js), and has no dependen own. ```sh -npm install @vxnsin/inkan @inkanjs/postgres pg # or postgres +npm install @inkanjs/inkan @inkanjs/postgres pg # or postgres ``` ```ts -import { inkan, rateLimit } from "@vxnsin/inkan"; +import { inkan, rateLimit } from "@inkanjs/inkan"; import pg from "pg"; import { postgresStore } from "@inkanjs/postgres"; @@ -102,7 +102,7 @@ The driver is told apart by its methods: postgres.js has `unsafe` and `listen`, - `increment` counts in `numeric`: `0.1 + 0.2` is `0.3`. On a live key whose value is not a JSON number (a string, even `"5"`, a boolean, `null`, an object) it rejects with a `TypeError` and leaves the value as it was, as the other stores do. -- The suite from `@vxnsin/inkan/testing` (`storeConformance`) passes on a pg Pool, a pg +- The suite from `@inkanjs/inkan/testing` (`storeConformance`) passes on a pg Pool, a pg Client and postgres.js. ## Security diff --git a/packages/postgres/index.d.ts b/packages/postgres/index.d.ts index 4bfff9a..fe02d18 100644 --- a/packages/postgres/index.d.ts +++ b/packages/postgres/index.d.ts @@ -1,4 +1,4 @@ -import type { Store } from "@vxnsin/inkan"; +import type { Store } from "@inkanjs/inkan"; /** A `pg` Pool or Client (or anything with the same `query`). A Pool is told apart by `totalCount`. */ export interface PgQueryable { diff --git a/packages/postgres/index.js b/packages/postgres/index.js index 1787907..dcf0a94 100644 --- a/packages/postgres/index.js +++ b/packages/postgres/index.js @@ -1,4 +1,4 @@ -// A `Store` (from @vxnsin/inkan) in one PostgreSQL table, on a pool the app already has: +// A `Store` (from @inkanjs/inkan) in one PostgreSQL table, on a pool the app already has: // `pg` (a Pool or a Client) or `postgres` (porsager's postgres.js). No dependencies. // // create table "inkan_store" (key text primary key, value text not null, expires_at timestamptz) diff --git a/packages/postgres/package.json b/packages/postgres/package.json index 8ca9d74..ece1d8b 100644 --- a/packages/postgres/package.json +++ b/packages/postgres/package.json @@ -1,6 +1,6 @@ { "name": "@inkanjs/postgres", - "version": "0.1.0", + "version": "0.1.1", "description": "A PostgreSQL store for inkan: jobs, sessions, auth, idempotency keys and rate limits in one table, on the pool you already have.", "type": "module", "license": "MIT", @@ -36,11 +36,11 @@ "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" }, "devDependencies": { "@types/pg": "^8.23.1", - "@vxnsin/inkan": "^0.8.0", + "@inkanjs/inkan": "^0.9.2", "embedded-postgres": "^18.4.0-beta.17", "pg": "^8.23.1", "postgres": "^3.4.9" diff --git a/packages/postgres/test.ts b/packages/postgres/test.ts index 4eead4b..4e14796 100644 --- a/packages/postgres/test.ts +++ b/packages/postgres/test.ts @@ -9,7 +9,7 @@ import { join } from "node:path"; import { inspect } from "node:util"; import pg from "pg"; import postgres from "postgres"; -import { storeConformance } from "@vxnsin/inkan/testing"; +import { storeConformance } from "@inkanjs/inkan/testing"; import { postgresStore, storedKey, type PostgresStore } from "./index.js"; // The server: DATABASE_URL when set (CI runs a postgres:17 service), else embedded-postgres, diff --git a/packages/proxy/CHANGELOG.md b/packages/proxy/CHANGELOG.md index 76fddec..ec7dc98 100644 --- a/packages/proxy/CHANGELOG.md +++ b/packages/proxy/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.2.1 + +- Works with `@inkanjs/inkan`, the new name of the core (it was `@vxnsin/inkan`). Install + `@inkanjs/inkan` 0.9.2 or later next to it. + ## 0.2.0 - Works with inkan 0.8 (`inkan: ">=0.8.0 <1.0.0"`). diff --git a/packages/proxy/README.md b/packages/proxy/README.md index db97cb5..d09a6ce 100644 --- a/packages/proxy/README.md +++ b/packages/proxy/README.md @@ -5,11 +5,11 @@ of the app, or one route, handed on to a server behind it. Request and response stream through as they come, so a 2 GB upload or download never sits in memory. ```sh -npm install @vxnsin/inkan @inkanjs/proxy +npm install @inkanjs/inkan @inkanjs/proxy ``` ```ts -import { inkan, t } from "@vxnsin/inkan"; +import { inkan, t } from "@inkanjs/inkan"; import { proxy, proxyTo } from "@inkanjs/proxy"; const app = inkan() diff --git a/packages/proxy/index.d.ts b/packages/proxy/index.d.ts index 968d97f..b21c5d9 100644 --- a/packages/proxy/index.d.ts +++ b/packages/proxy/index.d.ts @@ -1,5 +1,5 @@ import type { Agent } from "node:http"; -import type { Context, Plugin, Reply, RouteMeta } from "@vxnsin/inkan"; +import type { Context, Plugin, Reply, RouteMeta } from "@inkanjs/inkan"; type Ctx = Context; diff --git a/packages/proxy/index.js b/packages/proxy/index.js index 082a7ed..c8998a4 100644 --- a/packages/proxy/index.js +++ b/packages/proxy/index.js @@ -11,7 +11,7 @@ import http from "node:http"; import https from "node:https"; import { Readable, pipeline } from "node:stream"; -import { HttpProblem, joinPath, plugin, reply, t } from "@vxnsin/inkan"; +import { HttpProblem, joinPath, plugin, reply, t } from "@inkanjs/inkan"; // hop-by-hop: they describe one connection, not the message (RFC 9110 7.6.1) const HOP = new Set(["connection", "keep-alive", "transfer-encoding", "upgrade", "te", "trailer", "trailers", "proxy-connection", "proxy-authenticate", "proxy-authorization"]); diff --git a/packages/proxy/package.json b/packages/proxy/package.json index d7a280a..74a9234 100644 --- a/packages/proxy/package.json +++ b/packages/proxy/package.json @@ -1,6 +1,6 @@ { "name": "@inkanjs/proxy", - "version": "0.2.0", + "version": "0.2.1", "description": "A streaming reverse proxy for inkan: a prefix or one route handed on to a server behind it, on node:http alone.", "type": "module", "license": "MIT", @@ -34,10 +34,10 @@ "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" }, "devDependencies": { - "@vxnsin/inkan": "^0.8.0" + "@inkanjs/inkan": "^0.9.2" }, "scripts": { "test": "node --import ../../scripts/no-deprecations.js --test test.ts" diff --git a/packages/proxy/test.ts b/packages/proxy/test.ts index 1eb784c..a1dbd5f 100644 --- a/packages/proxy/test.ts +++ b/packages/proxy/test.ts @@ -3,7 +3,7 @@ import assert from "node:assert/strict"; import http, { type IncomingMessage, type ServerResponse } from "node:http"; import net, { type AddressInfo } from "node:net"; import { once } from "node:events"; -import { inkan, t as s } from "@vxnsin/inkan"; +import { inkan, t as s } from "@inkanjs/inkan"; import { proxy, proxyTo } from "./index.js"; const quiet = { log: false as const, onError: () => {} }; diff --git a/packages/redis/CHANGELOG.md b/packages/redis/CHANGELOG.md index 2d30c00..e798212 100644 --- a/packages/redis/CHANGELOG.md +++ b/packages/redis/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.1.1 + +- Works with `@inkanjs/inkan`, the new name of the core (it was `@vxnsin/inkan`). Install + `@inkanjs/inkan` 0.9.2 or later next to it. + ## 0.1.0 - `redisStore(client, { prefix, subscriber })`: an inkan `Store` (0.8) in Redis, on the diff --git a/packages/redis/README.md b/packages/redis/README.md index 631ad5e..d7b375f 100644 --- a/packages/redis/README.md +++ b/packages/redis/README.md @@ -6,11 +6,11 @@ of an app sees the same state. It runs on the Redis client you already have, `re (node-redis v4 or later) or `ioredis`, and has no dependencies of its own. ```sh -npm install @vxnsin/inkan @inkanjs/redis redis # or ioredis +npm install @inkanjs/inkan @inkanjs/redis redis # or ioredis ``` ```ts -import { inkan, rateLimit } from "@vxnsin/inkan"; +import { inkan, rateLimit } from "@inkanjs/inkan"; import { createClient } from "redis"; import { redisStore } from "@inkanjs/redis"; @@ -78,7 +78,7 @@ other object is refused. the TTL of one that was: a rate-limit window stays fixed. - Values are JSON: `get` returns what `JSON.stringify` made of the value, `undefined` for a missing key, `null` only for a stored `null`. -- The suite from `@vxnsin/inkan/testing` (`storeConformance`) passes on both clients. +- The suite from `@inkanjs/inkan/testing` (`storeConformance`) passes on both clients. ## Security diff --git a/packages/redis/index.d.ts b/packages/redis/index.d.ts index 3a8adc2..e021551 100644 --- a/packages/redis/index.d.ts +++ b/packages/redis/index.d.ts @@ -1,4 +1,4 @@ -import type { Store } from "@vxnsin/inkan"; +import type { Store } from "@inkanjs/inkan"; /** A connected client from `redis` (node-redis v4 or later): `createClient(...)` after `connect()`. */ export interface NodeRedisClient { diff --git a/packages/redis/index.js b/packages/redis/index.js index 2f215fc..9392fc5 100644 --- a/packages/redis/index.js +++ b/packages/redis/index.js @@ -1,4 +1,4 @@ -// A `Store` (from @vxnsin/inkan) in Redis, on a client the app already has: node-redis (v4 and +// A `Store` (from @inkanjs/inkan) in Redis, on a client the app already has: node-redis (v4 and // later) or ioredis. Nothing to install besides the client the user picked. // // set SET key json [PX ttl] (without PX the TTL is cleared) diff --git a/packages/redis/package.json b/packages/redis/package.json index 74cdefd..8684d9d 100644 --- a/packages/redis/package.json +++ b/packages/redis/package.json @@ -1,6 +1,6 @@ { "name": "@inkanjs/redis", - "version": "0.1.0", + "version": "0.1.1", "description": "A Redis store for inkan: jobs, sessions, auth, idempotency keys and rate limits shared by every process, on the client you already have.", "type": "module", "license": "MIT", @@ -35,10 +35,10 @@ "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" }, "devDependencies": { - "@vxnsin/inkan": "^0.8.0", + "@inkanjs/inkan": "^0.9.2", "ioredis": "^6.0.0", "redis": "^6.3.0", "redis-memory-server": "^0.17.1" diff --git a/packages/redis/test.ts b/packages/redis/test.ts index 0dd1ee6..7be714a 100644 --- a/packages/redis/test.ts +++ b/packages/redis/test.ts @@ -5,7 +5,7 @@ import { spawn } from "node:child_process"; import { inspect } from "node:util"; import { createClient } from "redis"; import { Redis } from "ioredis"; -import { storeConformance } from "@vxnsin/inkan/testing"; +import { storeConformance } from "@inkanjs/inkan/testing"; import { redisStore, type RedisClient, type RedisStore } from "./index.js"; // The server: REDIS_URL when set (CI runs a redis:7 service), else one redis-memory-server diff --git a/packages/secure-headers/CHANGELOG.md b/packages/secure-headers/CHANGELOG.md index c66be87..e03f187 100644 --- a/packages/secure-headers/CHANGELOG.md +++ b/packages/secure-headers/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.2.1 + +- Works with `@inkanjs/inkan`, the new name of the core (it was `@vxnsin/inkan`). Install + `@inkanjs/inkan` 0.9.2 or later next to it. + ## 0.2.0 - Works with inkan 0.8 (`inkan: ">=0.8.0 <1.0.0"`). diff --git a/packages/secure-headers/README.md b/packages/secure-headers/README.md index 5302fb6..46fc6a5 100644 --- a/packages/secure-headers/README.md +++ b/packages/secure-headers/README.md @@ -6,11 +6,11 @@ HSTS over HTTPS, and the rest. Every header can be changed or left out, and a he handler set itself is never overwritten. ```sh -npm install @vxnsin/inkan @inkanjs/secure-headers +npm install @inkanjs/inkan @inkanjs/secure-headers ``` ```ts -import { html, inkan } from "@vxnsin/inkan"; +import { html, inkan } from "@inkanjs/inkan"; import { secureHeaders } from "@inkanjs/secure-headers"; const app = inkan() diff --git a/packages/secure-headers/index.d.ts b/packages/secure-headers/index.d.ts index 98c6a29..ec185ea 100644 --- a/packages/secure-headers/index.d.ts +++ b/packages/secure-headers/index.d.ts @@ -1,4 +1,4 @@ -import type { Context, Plugin } from "@vxnsin/inkan"; +import type { Context, Plugin } from "@inkanjs/inkan"; /** A CSP directive's sources: `["'self'", "https://cdn.example.com"]`, one string, `true` for one without sources, or `false` to drop it. */ export type CspValue = string | string[] | boolean | null; diff --git a/packages/secure-headers/index.js b/packages/secure-headers/index.js index 2d0dfc7..8ba0226 100644 --- a/packages/secure-headers/index.js +++ b/packages/secure-headers/index.js @@ -11,7 +11,7 @@ // runs, so they are never touched: their inline script and style keep working. import { randomBytes } from "node:crypto"; -import { plugin } from "@vxnsin/inkan"; +import { plugin } from "@inkanjs/inkan"; /** The policy every answer gets unless told otherwise: only this origin, no plugins, no framing. */ export const DEFAULT_CSP = Object.freeze({ diff --git a/packages/secure-headers/package.json b/packages/secure-headers/package.json index b5186e0..2bf270d 100644 --- a/packages/secure-headers/package.json +++ b/packages/secure-headers/package.json @@ -1,6 +1,6 @@ { "name": "@inkanjs/secure-headers", - "version": "0.2.0", + "version": "0.2.1", "description": "Security headers for inkan: a strict Content-Security-Policy with per-request nonces, HSTS and the rest, each one yours to change.", "type": "module", "license": "MIT", @@ -35,10 +35,10 @@ "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" }, "devDependencies": { - "@vxnsin/inkan": "^0.8.0" + "@inkanjs/inkan": "^0.9.2" }, "scripts": { "test": "node --import ../../scripts/no-deprecations.js --test test.ts" diff --git a/packages/secure-headers/test.ts b/packages/secure-headers/test.ts index 9168ede..95f0204 100644 --- a/packages/secure-headers/test.ts +++ b/packages/secure-headers/test.ts @@ -1,6 +1,6 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { html, inkan, problem, reply } from "@vxnsin/inkan"; +import { html, inkan, problem, reply } from "@inkanjs/inkan"; import { DEFAULT_CSP, secureHeaders } from "./index.js"; const quiet = { log: false as const }; diff --git a/packages/session/CHANGELOG.md b/packages/session/CHANGELOG.md index e665daa..5a79c5a 100644 --- a/packages/session/CHANGELOG.md +++ b/packages/session/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.2.1 + +- Works with `@inkanjs/inkan`, the new name of the core (it was `@vxnsin/inkan`). Install + `@inkanjs/inkan` 0.9.2 or later next to it. + ## 0.2.0 - **Any inkan `Store`** (inkan 0.8) for `store`: `memoryStore()` from @vxnsin/inkan, or an diff --git a/packages/session/README.md b/packages/session/README.md index 6aa46e1..7130f7c 100644 --- a/packages/session/README.md +++ b/packages/session/README.md @@ -6,11 +6,11 @@ while the cookie holds only a random id. `ctx.session` is typed, made only for a that reads it, and written back only when it changed. ```sh -npm install @vxnsin/inkan @inkanjs/session +npm install @inkanjs/inkan @inkanjs/session ``` ```ts -import { inkan, t } from "@vxnsin/inkan"; +import { inkan, t } from "@inkanjs/inkan"; import { session } from "@inkanjs/session"; type Data = { userId: number; cart: string[] }; @@ -44,13 +44,13 @@ in it. A cookie session lasts until it expires even after `destroy()` if someone copy; when you need logout to end a session for certain, use a store. ```ts -import { memoryStore } from "@vxnsin/inkan"; +import { memoryStore } from "@inkanjs/inkan"; import { session } from "@inkanjs/session"; app.register(session({ secret, store: memoryStore({ max: 50_000 }) })); ``` -The store is an inkan `Store`. `memoryStore` from @vxnsin/inkan lives in the process: right +The store is an inkan `Store`. `memoryStore` from @inkanjs/inkan lives in the process: right for development and one process. For more, any `Store` works, such as @inkanjs/redis, @inkanjs/mongo, @inkanjs/mysql and @inkanjs/postgres (coming with inkan 0.8): ```ts diff --git a/packages/session/index.d.ts b/packages/session/index.d.ts index 66e029b..c444104 100644 --- a/packages/session/index.d.ts +++ b/packages/session/index.d.ts @@ -1,9 +1,9 @@ -import type { memoryStore as coreMemoryStore, Plugin, Store } from "@vxnsin/inkan"; +import type { memoryStore as coreMemoryStore, Plugin, Store } from "@inkanjs/inkan"; /** What a store keeps per session: the data, when the session began (ms), and flash messages not read yet. Plain JSON. */ export type SessionRecord = { d: Record; c: number; f?: Record }; -/** @deprecated Use `Store` from "@vxnsin/inkan"; TTLs are in milliseconds since 0.2. */ +/** @deprecated Use `Store` from "@inkanjs/inkan"; TTLs are in milliseconds since 0.2. */ export type SessionStore = Store; export type SessionCookie = { @@ -32,7 +32,7 @@ export type SessionOptions = { /** AES-256-GCM instead of a signature: the client cannot read the data either. Default false. Ignored with a store. */ encrypt?: boolean; /** - * Keep the data in this inkan `Store` (`memoryStore()` from @vxnsin/inkan, Redis, a + * Keep the data in this inkan `Store` (`memoryStore()` from @inkanjs/inkan, Redis, a * database, …) and only a random id in the cookie. A `SessionRecord` per session, for * `maxAge` (in ms, as every Store takes it). */ @@ -88,5 +88,5 @@ export declare function session = Record }>; export default session; -/** @deprecated Use `memoryStore` from "@vxnsin/inkan": this is the same function, re-exported. */ +/** @deprecated Use `memoryStore` from "@inkanjs/inkan": this is the same function, re-exported. */ export declare const memoryStore: typeof coreMemoryStore; diff --git a/packages/session/index.js b/packages/session/index.js index 49eba5b..f74d875 100644 --- a/packages/session/index.js +++ b/packages/session/index.js @@ -11,7 +11,7 @@ // nothing, and an answer whose session did not change sets no cookie. import { createCipheriv, createDecipheriv, createHmac, hkdfSync, randomBytes, timingSafeEqual } from "node:crypto"; -import { plugin, serializeCookie } from "@vxnsin/inkan"; +import { plugin, serializeCookie } from "@inkanjs/inkan"; const MIN_SECRET = 32; const MAX_COOKIE = 4096; // what every browser keeps of name=value, at the least @@ -91,8 +91,8 @@ function codec(keys, name, encrypt) { }; } -/** @deprecated the core's `memoryStore` from @vxnsin/inkan, re-exported for 0.1 code. */ -export { memoryStore } from "@vxnsin/inkan"; +/** @deprecated the core's `memoryStore` from @inkanjs/inkan, re-exported for 0.1 code. */ +export { memoryStore } from "@inkanjs/inkan"; /** One request's session. */ export class Session { @@ -250,7 +250,7 @@ export function session(options) { const { secret, encrypt = false, store, rolling = false, maxLifetime } = options ?? {}; const keys = keysOf(secret); if (store !== undefined && (store === null || typeof store !== "object" || ["get", "set", "delete"].some((m) => typeof store[m] !== "function"))) { - throw new TypeError("session: store must be an inkan Store, such as memoryStore() from @vxnsin/inkan (TTLs in ms)"); + throw new TypeError("session: store must be an inkan Store, such as memoryStore() from @inkanjs/inkan (TTLs in ms)"); } const c = options.cookie ?? {}; const name = c.name ?? "sid"; diff --git a/packages/session/package.json b/packages/session/package.json index de22c9b..7a40698 100644 --- a/packages/session/package.json +++ b/packages/session/package.json @@ -1,6 +1,6 @@ { "name": "@inkanjs/session", - "version": "0.2.0", + "version": "0.2.1", "description": "Cookie sessions for inkan without dependencies: signed or encrypted cookies, or a store behind a random id.", "type": "module", "license": "MIT", @@ -34,10 +34,10 @@ "node": ">=22.18" }, "peerDependencies": { - "@vxnsin/inkan": ">=0.8.0 <1.0.0" + "@inkanjs/inkan": ">=0.8.0 <1.0.0" }, "devDependencies": { - "@vxnsin/inkan": "^0.8.0" + "@inkanjs/inkan": "^0.9.2" }, "scripts": { "test": "node --import ../../scripts/no-deprecations.js --test test.ts" diff --git a/packages/session/test.ts b/packages/session/test.ts index 97c66e3..dffed19 100644 --- a/packages/session/test.ts +++ b/packages/session/test.ts @@ -1,6 +1,6 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { inkan, memoryStore, type Store } from "@vxnsin/inkan"; +import { inkan, memoryStore, type Store } from "@inkanjs/inkan"; import { memoryStore as deprecatedMemoryStore, session } from "./index.js"; const quiet = { log: false as const };