@starci/eslint-canon-fe 9.4.9 → 9.5.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/CHANGELOG.md +12 -0
- package/dist/fe-stack.d.ts +3 -3
- package/dist/fe-stack.js +3 -9
- package/dist/index.js +0 -2
- package/dist/lib/scope.d.ts +8 -0
- package/dist/lib/scope.js +10 -0
- package/dist/lib/why.js +2 -2
- package/dist/shape-slot.d.ts +2 -2
- package/dist/transport.d.ts +1 -1
- package/dist/transport.js +29 -7
- package/package.json +1 -1
- package/runtime/knowledge/hfs/canon-pins.yaml +44 -24
- package/runtime/knowledge/hfs/fe-stack.yaml +4 -11
- package/runtime/knowledge/hfs/slots.yaml +185 -172
- package/runtime/scripts/hfs/architecture/canon-clones.mjs +1 -1
- package/runtime/scripts/hfs/architecture/entity-registry.mjs +53 -0
- package/runtime/scripts/hfs/architecture/{supabase-be.mjs → identity.mjs} +45 -15
- package/runtime/scripts/hfs/architecture/index.mjs +2 -3
- package/runtime/scripts/hfs/architecture/{supabase-ast.mjs → jwt-ast.mjs} +2 -103
- package/runtime/scripts/hfs/architecture/owners.mjs +11 -0
- package/runtime/scripts/hfs/architecture/register-once.mjs +1 -1
- package/runtime/scripts/hfs/architecture/schema-owner.mjs +29 -4
- package/runtime/scripts/hfs/architecture/server-action.mjs +3 -4
- package/runtime/scripts/hfs/architecture/side-boundary.mjs +1 -1
- package/runtime/scripts/hfs/architecture/{supabase-keys.mjs → sql-keys.mjs} +1 -1
- package/runtime/scripts/hfs/architecture/sql-owner.mjs +25 -27
- package/runtime/scripts/hfs/architecture/tiers.mjs +14 -3
- package/runtime/scripts/hfs/architecture/transport-owner.mjs +7 -3
- package/runtime/scripts/hfs/declaration-shape.mjs +15 -18
- package/runtime/scripts/hfs/manifest-shape.mjs +9 -5
- package/runtime/scripts/hfs/rule-params-shape.mjs +4 -1
- package/runtime/scripts/hfs/rules/database-constants.mjs +8 -10
- package/runtime/scripts/hfs/rules/database-migrations.mjs +3 -3
- package/runtime/scripts/hfs/slot-app-view.mjs +1 -1
- package/runtime/scripts/hfs/slots.mjs +8 -2
- package/runtime/scripts/lib/secret-patterns.mjs +2 -2
- package/dist/callback-shape.d.ts +0 -7
- package/dist/callback-shape.js +0 -396
- package/dist/lib/pure-owner-helper.d.ts +0 -10
- package/dist/lib/pure-owner-helper.js +0 -156
- package/runtime/scripts/hfs/architecture/supabase-tables.mjs +0 -50
- package/runtime/scripts/hfs/architecture/supabase.mjs +0 -226
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 9.5.1 - 2026-10-29
|
|
4
|
+
|
|
5
|
+
- Changed: the bundled slot manifest 3.10.0 adds the lite slot `be.platform.database.entities`, the entity registry (slot fields `role: entity-registry` and `importedBy`, validated by the manifest shape); the bundled architecture machine reads it (`architecture/entity-registry.mjs`): `tier-direction` (R26 `BE_TIER_DIRECTION`) admits the registry's import of a domain or platform capability's `index.ts` that binds only that capability's `<c>Entities`, and `owner-export-bypass` (R30 `ARCH_OWNER_EXPORT_BYPASS`) admits a direct import of the registry from the files `importedBy` names (`apps/*/src/compose/*.ts`, `apps/*/src/app.module.ts`, `src/tests/world/**`); every other import of either shape stays refused, and full has no registry; the bundled canon pins name hfs 4.10.1, eslint-canon-be 3.7.1, eslint-canon-fe 9.5.1 and the Grammar family 0.15.12. No front-end rule changed.
|
|
6
|
+
- Changed: the bundled architecture machine: the owner-cycle check (R27 `ARCH_OWNER_CYCLE`) counts the entity registry as a unit of its own, not part of `platform/database`, so naming every `<c>Entities` closes no cycle among capabilities while any other platform/database file importing a domain still does.
|
|
7
|
+
|
|
8
|
+
## 9.5.0 - 2026-10-29
|
|
9
|
+
|
|
10
|
+
- Changed: `modules/auth` is the session issuer's client. `fetch-only-in-api-client` admits axios in `modules/auth/auth-door.ts` and refuses a door call whose readable path names no `/auth/` door; `no-shared-transport-state` judges `modules/auth` and admits only `modules/auth/token-store.ts`; the machine `transport-owner` admits the auth door. `fe-stack-import` no longer carves Supabase into `modules/auth`: the fe-stack catalog forbids `@supabase/supabase-js`, `@supabase/ssr` and `@supabase/auth-js` everywhere and lists `fe.modules.auth` as a home of axios.
|
|
11
|
+
- Removed: `callback-shape` (R287 `FE_CALLBACK_SHAPE`) with the `fe.route.callback` slot: the OAuth callback is a back-end door.
|
|
12
|
+
- Changed: the bundled slot manifest 3.9.0 replaces the lite `app.supabase*` slots with `app.db` (`db/migrations`, `db/migrations/archive`, `db/seed.sql`, the managed `db/bootstrap.sql`), `be.integrations.supabase` with `be.integrations.passport` and `be.integrations.object-storage`, removes `fe.route.callback`, sets lite `schemaAuthority: sql`, gives lite TypeORM entities in `be.persistence`, adds `ruleParams.be.dbFunctions`, and moves the S3 SDKs to `integrations/object-storage` and the identity libraries to `integrations/passport` in `infraOwners` (`@supabase/*`, `minio` and `bcrypt` nowhere); the bundled rule catalog retires R216, R217, R219, R254 and R287 and adds R328-R334; the bundled canon pins name hfs 4.10.0, eslint-canon-be 3.7.0, eslint-canon-fe 9.5.0 and the Grammar family 0.15.11, pin `@nestjs/passport` 11.0.5 (CommonJS on the Nest 11 line), `passport` 0.7.0, `passport-google-oauth20` 2.0.0, `passport-local` 1.0.0, `bcryptjs` 3.0.3 and their types (tokens are signed and verified with `jose`; `@nestjs/jwt` stays allowed in `integrations/passport` but unpinned), and drop `@supabase/ssr`, `@supabase/supabase-js` and the `supabase` CLI.
|
|
13
|
+
|
|
14
|
+
|
|
3
15
|
## 9.4.9 - 2026-10-29
|
|
4
16
|
|
|
5
17
|
- Changed: the bundled slot manifest gives the model libraries their owners in `ruleParams.be.infraOwners` (`@starci/ai-router` to `integrations/ai-gateway`, `@langchain/*` to `integrations/ai`; `openai`, `langchain`, `@langchain/langgraph`, `@langchain/community` and the provider SDKs nowhere) and lists R326 and R327 on `be.integrations`; the bundled canon pins name hfs 4.9.11, eslint-canon-be 3.6.8, eslint-canon-fe 9.4.9, the Grammar family 0.15.10 (grammar, eslint-grammar-core, eslint-grammar-offset-pop), and pin `@langchain/core` 1.3.1 and `@langchain/openai` 1.8.0. No rule changed.
|
package/dist/fe-stack.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type Rules, type Recommended } from "./lib/rule.js";
|
|
2
|
+
/** The package scope only the identity-provider client may import. */
|
|
2
3
|
/**
|
|
3
|
-
* No import (static, re-export, dynamic or `require`) of a package the fe-stack catalog forbids
|
|
4
|
-
* `modules/auth`. Type-only imports count: a type import still makes the package a dependency of the front end.
|
|
4
|
+
* No import (static, re-export, dynamic or `require`) of a package the fe-stack catalog forbids.
|
|
5
5
|
*/
|
|
6
|
-
export declare const feStackImport: import("./lib/rule.js").Rule<"forbidden"
|
|
6
|
+
export declare const feStackImport: import("./lib/rule.js").Rule<"forbidden", []>;
|
|
7
7
|
/** The rules this law contributes to the plugin. */
|
|
8
8
|
export declare const rules: Rules;
|
|
9
9
|
/** Every rule is an error: a second library for a concern is the defect, not a style. */
|
package/dist/fe-stack.js
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
import { defineRule } from "./lib/rule.js";
|
|
2
2
|
import { forbiddingConcern, packageNameOf } from "./lib/fe-stack.js";
|
|
3
|
-
import { globalReferences,
|
|
3
|
+
import { globalReferences, isProductSource } from "./lib/scope.js";
|
|
4
4
|
/** The package scope only the identity-provider client may import. */
|
|
5
|
-
const SUPABASE_SCOPE = "@supabase/";
|
|
6
5
|
/**
|
|
7
|
-
* No import (static, re-export, dynamic or `require`) of a package the fe-stack catalog forbids
|
|
8
|
-
* `modules/auth`. Type-only imports count: a type import still makes the package a dependency of the front end.
|
|
6
|
+
* No import (static, re-export, dynamic or `require`) of a package the fe-stack catalog forbids.
|
|
9
7
|
*/
|
|
10
8
|
export const feStackImport = defineRule({
|
|
11
9
|
meta: {
|
|
12
10
|
type: "problem",
|
|
13
|
-
docs: { description: "A front end imports no library the fe-stack catalog forbids
|
|
11
|
+
docs: { description: "A front end imports no library the fe-stack catalog forbids." },
|
|
14
12
|
schema: [],
|
|
15
13
|
messages: {
|
|
16
14
|
forbidden: "`{{name}}` is a forbidden alternative for the {{concern}} concern of the front-end stack. The stack has one library per concern, the same in every app and both editions: use {{canonical}} ({{pattern}}). {{why}}",
|
|
17
|
-
supabase: "`{{name}}` is imported outside `modules/auth`. Supabase on the front end is the auth client only, held by `modules/auth` (the session, the access token the Apollo link attaches, sign-in and sign-out); data is read and written through the GraphQL operations of `modules/api`, never through Supabase from the browser.",
|
|
18
15
|
},
|
|
19
16
|
},
|
|
20
17
|
create(context) {
|
|
21
18
|
if (!isProductSource(context))
|
|
22
19
|
return {};
|
|
23
|
-
const authOwner = inSlot(context, "fe.modules.auth");
|
|
24
20
|
const judge = (node, source) => {
|
|
25
21
|
const name = packageNameOf(source);
|
|
26
22
|
if (name === null || name === undefined)
|
|
@@ -32,8 +28,6 @@ export const feStackImport = defineRule({
|
|
|
32
28
|
context.report({ node, messageId: "forbidden", data: { name, concern: concern.id, canonical, pattern: concern.pattern ?? "", why: concern.why ?? "" } });
|
|
33
29
|
return;
|
|
34
30
|
}
|
|
35
|
-
if (name.startsWith(SUPABASE_SCOPE) && !authOwner)
|
|
36
|
-
context.report({ node, messageId: "supabase", data: { name } });
|
|
37
31
|
};
|
|
38
32
|
return {
|
|
39
33
|
ImportDeclaration(node) {
|
package/dist/index.js
CHANGED
|
@@ -274,10 +274,8 @@ Object.assign(recommended, functionBudgetRecommended);
|
|
|
274
274
|
// source-only catalog discovery can find them. The appended registration gives each module
|
|
275
275
|
// ownership of those same rule instances without declaring either rule twice.
|
|
276
276
|
import { recommended as swrFamilyRecommended, rules as swrFamilyRules } from "./swr-family.js";
|
|
277
|
-
import { recommended as callbackShapeRecommended, rules as callbackShapeRules } from "./callback-shape.js";
|
|
278
277
|
const A14_CONTRIBUTIONS = [
|
|
279
278
|
{ law: "swr-family", rules: swrFamilyRules, recommended: swrFamilyRecommended },
|
|
280
|
-
{ law: "callback-shape", rules: callbackShapeRules, recommended: callbackShapeRecommended },
|
|
281
279
|
];
|
|
282
280
|
for (const addition of A14_CONTRIBUTIONS) {
|
|
283
281
|
const names = new Set(Object.keys(addition.rules));
|
package/dist/lib/scope.d.ts
CHANGED
|
@@ -39,6 +39,14 @@ export declare const isProductSource: (context: AnyContext) => boolean;
|
|
|
39
39
|
export declare const isComponentFile: (context: AnyContext) => boolean;
|
|
40
40
|
/** True when the given file (an absolute or repo-relative name, e.g. where an import resolves to) sits in a component layer of slot `fe.components` or `fe.package.ui`. */
|
|
41
41
|
export declare const isComponentPath: (context: AnyContext, file: string) => boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The one auth door of the session issuer's client: `modules/auth/auth-door.ts` (slot `fe.modules.auth`). It alone calls the app's
|
|
44
|
+
* own back-end auth doors (login, signup, refresh, logout, password reset, resend verification) with the REST client, credentials
|
|
45
|
+
* included; every other file of `modules/auth` and every other module stays outside the transport.
|
|
46
|
+
*/
|
|
47
|
+
export declare const isAuthDoor: (context: AnyContext) => boolean;
|
|
48
|
+
/** The in-memory access-token store of `modules/auth` (`modules/auth/token-store.ts`), the one module-level mutable state the auth client keeps. */
|
|
49
|
+
export declare const isAuthTokenStore: (context: AnyContext) => boolean;
|
|
42
50
|
/** The one place that may read the environment: slot `fe.modules.config`. */
|
|
43
51
|
export declare const isConfigModule: (context: AnyContext) => boolean;
|
|
44
52
|
/**
|
package/dist/lib/scope.js
CHANGED
|
@@ -48,6 +48,16 @@ export const isComponentPath = (context, file) => {
|
|
|
48
48
|
const found = hfsOf(context).classify(file);
|
|
49
49
|
return (found.slot === "fe.components" || found.slot === "fe.package.ui") && found.kind !== undefined;
|
|
50
50
|
};
|
|
51
|
+
/** The base name of the linted file. */
|
|
52
|
+
const baseNameOf = (context) => (context.filename || context.getFilename()).split(/[\\/]/).at(-1) ?? "";
|
|
53
|
+
/**
|
|
54
|
+
* The one auth door of the session issuer's client: `modules/auth/auth-door.ts` (slot `fe.modules.auth`). It alone calls the app's
|
|
55
|
+
* own back-end auth doors (login, signup, refresh, logout, password reset, resend verification) with the REST client, credentials
|
|
56
|
+
* included; every other file of `modules/auth` and every other module stays outside the transport.
|
|
57
|
+
*/
|
|
58
|
+
export const isAuthDoor = (context) => inSlot(context, "fe.modules.auth") && baseNameOf(context) === "auth-door.ts";
|
|
59
|
+
/** The in-memory access-token store of `modules/auth` (`modules/auth/token-store.ts`), the one module-level mutable state the auth client keeps. */
|
|
60
|
+
export const isAuthTokenStore = (context) => inSlot(context, "fe.modules.auth") && baseNameOf(context) === "token-store.ts";
|
|
51
61
|
/** The one place that may read the environment: slot `fe.modules.config`. */
|
|
52
62
|
export const isConfigModule = (context) => inSlot(context, "fe.modules.config");
|
|
53
63
|
/**
|
package/dist/lib/why.js
CHANGED
|
@@ -339,8 +339,8 @@ export const why = {
|
|
|
339
339
|
},
|
|
340
340
|
"fe-stack-import": {
|
|
341
341
|
code: "FE_STACK_FORBIDDEN",
|
|
342
|
-
en: "`<file>` imports `<what>`, a package or scoped package family the front-end stack forbids
|
|
343
|
-
fix: "Use the concern's canonical library from `knowledge/hfs/fe-stack.yaml` (the message names it). For @dicebear/*, pass the identity id as seed on Grammar Avatar, AvatarButton or AvatarGroup members.
|
|
342
|
+
en: "`<file>` imports `<what>`, a package or scoped package family the front-end stack forbids.",
|
|
343
|
+
fix: "Use the concern's canonical library from `knowledge/hfs/fe-stack.yaml` (the message names it). For @dicebear/*, pass the identity id as seed on Grammar Avatar, AvatarButton or AvatarGroup members.",
|
|
344
344
|
},
|
|
345
345
|
"file-size-growth": {
|
|
346
346
|
code: "HFS_SIZE_GROWTH",
|
package/dist/shape-slot.d.ts
CHANGED
|
@@ -6,13 +6,13 @@ export declare const noDataStatusProp: import("./lib/rule.js").Rule<"status" | "
|
|
|
6
6
|
/** A region that reads data hands its Base a DataSlot, and the Base renders it through SlotView. */
|
|
7
7
|
export declare const regionReadsThroughSlot: import("./lib/rule.js").Rule<"slot" | "view", []>;
|
|
8
8
|
/** A branch keeps only interaction state; a leaf holds no hook. */
|
|
9
|
-
export declare const branchIntrinsicState: import("./lib/rule.js").Rule<"hooks" | "data" | "
|
|
9
|
+
export declare const branchIntrinsicState: import("./lib/rule.js").Rule<"hooks" | "data" | "leaf" | "fetch", []>;
|
|
10
10
|
/** The rules this law contributes to the plugin. */
|
|
11
11
|
export declare const rules: {
|
|
12
12
|
"exhaustive-shape-switch": import("./lib/rule.js").Rule<"missing" | "hidden", []>;
|
|
13
13
|
"no-data-status-prop": import("./lib/rule.js").Rule<"status" | "leaf", []>;
|
|
14
14
|
"region-reads-through-slot": import("./lib/rule.js").Rule<"slot" | "view", []>;
|
|
15
|
-
"branch-intrinsic-state": import("./lib/rule.js").Rule<"hooks" | "data" | "
|
|
15
|
+
"branch-intrinsic-state": import("./lib/rule.js").Rule<"hooks" | "data" | "leaf" | "fetch", []>;
|
|
16
16
|
};
|
|
17
17
|
/** Every FE canon rule is an error; existing debt is fixed before adoption. */
|
|
18
18
|
export declare const recommended: Recommended;
|
package/dist/transport.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ import { type Recommended, type Rules } from "./lib/rule.js";
|
|
|
28
28
|
* `socket.io-client` only by `hooks/socketio/`. Native `WebSocket` is refused everywhere, including the API layer.
|
|
29
29
|
* Every other file reaches the back end through an SWR hook over an operation.
|
|
30
30
|
*/
|
|
31
|
-
export declare const fetchOnlyInApiClient: import("./lib/rule.js").Rule<"library" | "outside" | "channel" | "websocket" | "xhr" | "placed", []>;
|
|
31
|
+
export declare const fetchOnlyInApiClient: import("./lib/rule.js").Rule<"library" | "outside" | "channel" | "websocket" | "xhr" | "placed" | "authDoor", []>;
|
|
32
32
|
/** Every `fetch` of the API layer (a custom fetch handed to the Apollo http link, a raw call) carries an abort signal, so a hung backend cannot hang a reader. */
|
|
33
33
|
export declare const clientFetchHasSignal: import("./lib/rule.js").Rule<"signal", []>;
|
|
34
34
|
/** No module-level mutable state in the API layer: a token or locale in a `let` leaks across requests. */
|
package/dist/transport.js
CHANGED
|
@@ -19,12 +19,11 @@
|
|
|
19
19
|
* standing in for a status.
|
|
20
20
|
*/
|
|
21
21
|
import ts from "typescript";
|
|
22
|
-
import { rules as callbackShapeRules } from "./callback-shape.js";
|
|
23
22
|
import { isNode } from "./lib/ast.js";
|
|
24
23
|
import { hfsOf } from "./lib/hfs.js";
|
|
25
24
|
import { forbiddingConcern, packageNameOf } from "./lib/fe-stack.js";
|
|
26
25
|
import { defineRule } from "./lib/rule.js";
|
|
27
|
-
import { globalReferences, inSlot, isApiClient, isApiLayer, isApiRest, isOutcomeModule } from "./lib/scope.js";
|
|
26
|
+
import { globalReferences, inSlot, isApiClient, isApiLayer, isApiRest, isAuthDoor, isAuthTokenStore, isOutcomeModule } from "./lib/scope.js";
|
|
28
27
|
import { typed } from "./lib/types.js";
|
|
29
28
|
/**
|
|
30
29
|
* The canonical transport libraries and the one place each may be imported (fe-stack graphql, rest and realtime): Apollo in
|
|
@@ -32,7 +31,7 @@ import { typed } from "./lib/types.js";
|
|
|
32
31
|
*/
|
|
33
32
|
const PLACED_TRANSPORTS = new Map([
|
|
34
33
|
["@apollo/client", { where: "the API layer (`modules/api`)", allowed: (context) => isApiLayer(context) }],
|
|
35
|
-
["axios", { where: "the REST calls of the API layer (`modules/api/rest/`)", allowed: (context) => isApiRest(context) }],
|
|
34
|
+
["axios", { where: "the REST calls of the API layer (`modules/api/rest/`) and the auth door (`modules/auth/auth-door.ts`)", allowed: (context) => isApiRest(context) || isAuthDoor(context) }],
|
|
36
35
|
["socket.io-client", { where: "`hooks/socketio/`", allowed: (context) => inSlot(context, "fe.hooks.socketio") }],
|
|
37
36
|
["graphql-ws", { where: "the Apollo clients of the API layer (`modules/api/graphql/clients/`, or the shared api package's `graphql/clients/`)", allowed: (context) => isApiClient(context) }],
|
|
38
37
|
]);
|
|
@@ -140,6 +139,27 @@ const transportUses = (context) => {
|
|
|
140
139
|
return uses;
|
|
141
140
|
};
|
|
142
141
|
// -- FE-TRANSPORT-1 --------------------------------------------------------------------------------
|
|
142
|
+
/** The HTTP methods of the REST client whose first argument is the request path. */
|
|
143
|
+
const REST_METHODS = new Set(["get", "post", "put", "patch", "delete", "request"]);
|
|
144
|
+
/** The static text of a path argument (a literal, or a template's fixed parts), or null when nothing about it is fixed. */
|
|
145
|
+
const staticPath = (node) => {
|
|
146
|
+
if (node?.type === "Literal" && typeof node.value === "string")
|
|
147
|
+
return node.value;
|
|
148
|
+
if (node?.type === "TemplateLiteral")
|
|
149
|
+
return node.quasis.map((quasi) => quasi.value.cooked ?? "").join("<expression>");
|
|
150
|
+
return null;
|
|
151
|
+
};
|
|
152
|
+
/** A path segment `auth/`: the app's own back-end auth doors. */
|
|
153
|
+
const AUTH_DOOR_PATH = /(?:^|\/)auth\//;
|
|
154
|
+
/** In the auth door, a REST call whose path the rule can read must name an `/auth/` door; a fully dynamic path is left to review. */
|
|
155
|
+
const judgeAuthDoorCall = (context, node) => {
|
|
156
|
+
if (node.callee.type !== "MemberExpression" || node.callee.computed || node.callee.property.type !== "Identifier" || !REST_METHODS.has(node.callee.property.name))
|
|
157
|
+
return;
|
|
158
|
+
const path = staticPath(node.arguments[0]);
|
|
159
|
+
if (path === null || AUTH_DOOR_PATH.test(path))
|
|
160
|
+
return;
|
|
161
|
+
context.report({ node, messageId: "authDoor", data: { call: `.${node.callee.property.name}()`, path } });
|
|
162
|
+
};
|
|
143
163
|
/**
|
|
144
164
|
* `fetch` is reached only in the API layer, each canonical transport library only in its home, and no other HTTP library exists.
|
|
145
165
|
*
|
|
@@ -160,11 +180,13 @@ export const fetchOnlyInApiClient = defineRule({
|
|
|
160
180
|
library: "`{{name}}` is a second HTTP transport. The front end talks to its back end through Apollo (`modules/api/graphql`) and the axios REST calls (`modules/api/rest`); another library is another set of timeout, retry and error rules. Use an operation of `modules/api`.",
|
|
161
181
|
placed: "`{{name}}` is imported outside {{where}}, the one place the front-end stack gives it. A component or hook that holds the transport itself skips the link chain (token, locale, retry, timeout) and the one result vocabulary. Call an operation of `modules/api` through its SWR hook (`hooks/swr/`), or listen through `hooks/socketio/`.",
|
|
162
182
|
xhr: "`XMLHttpRequest` is a second transport. Use an operation of the API layer (`modules/api`).",
|
|
183
|
+
authDoor: "`{{call}}` calls `{{path}}` from the auth door. `modules/auth/auth-door.ts` calls only the app's own back-end auth doors (`/auth/...`: login, signup, refresh, logout, password reset, resend verification); every other REST call is `modules/api/rest/`.",
|
|
163
184
|
websocket: "Native `WebSocket` is a second realtime transport. Use socket.io-client in `hooks/socketio/`, the front end's realtime owner.",
|
|
164
185
|
},
|
|
165
186
|
},
|
|
166
187
|
create(context) {
|
|
167
188
|
const layer = isApiLayer(context);
|
|
189
|
+
const authDoor = isAuthDoor(context);
|
|
168
190
|
const library = (node, source) => {
|
|
169
191
|
const name = packageNameOf(source);
|
|
170
192
|
if (name === null || forbiddingConcern(source))
|
|
@@ -209,6 +231,8 @@ export const fetchOnlyInApiClient = defineRule({
|
|
|
209
231
|
library(node, node.source.value);
|
|
210
232
|
},
|
|
211
233
|
CallExpression(node) {
|
|
234
|
+
if (authDoor)
|
|
235
|
+
judgeAuthDoorCall(context, node);
|
|
212
236
|
// `require("axios")` where `require` is the CommonJS global.
|
|
213
237
|
const [first] = node.arguments;
|
|
214
238
|
if (node.callee.type !== "Identifier" || node.callee.name !== "require" || first?.type !== "Literal")
|
|
@@ -266,14 +290,14 @@ const isTransportFile = (context) => isApiLayer(context) && !hfsOf(context).rela
|
|
|
266
290
|
export const noSharedTransportState = defineRule({
|
|
267
291
|
meta: {
|
|
268
292
|
type: "problem",
|
|
269
|
-
docs: { description: "The API layer (`modules/api/**`)
|
|
293
|
+
docs: { description: "The API layer (`modules/api/**`) and `modules/auth` hold no module-level `let`/`var`, but the in-memory access-token store `modules/auth/token-store.ts`." },
|
|
270
294
|
schema: [],
|
|
271
295
|
messages: {
|
|
272
296
|
shared: "A module-level `{{kind}}` in the API layer. A token or locale kept there is shared by every request on the server and by every reader in one tab, so one reader's credential can answer another's request. Pass the credential as a parameter or read it from context.",
|
|
273
297
|
},
|
|
274
298
|
},
|
|
275
299
|
create(context) {
|
|
276
|
-
if (!isTransportFile(context))
|
|
300
|
+
if (!isTransportFile(context) && !(inSlot(context, "fe.modules.auth") && !isAuthTokenStore(context)))
|
|
277
301
|
return {};
|
|
278
302
|
const check = (node) => {
|
|
279
303
|
const declaration = node.type === "VariableDeclaration" ? node : node.type === "ExportNamedDeclaration" ? node.declaration : undefined;
|
|
@@ -878,8 +902,6 @@ export const rules = {
|
|
|
878
902
|
"no-hand-typed-wire": noHandTypedWire,
|
|
879
903
|
"outcome-kinds-exhaustive": outcomeKindsExhaustive,
|
|
880
904
|
"one-outcome-union": oneOutcomeUnion,
|
|
881
|
-
// Forward the callback enforcer for the catalog's source-only CONTRIBUTIONS discovery.
|
|
882
|
-
...callbackShapeRules,
|
|
883
905
|
};
|
|
884
906
|
/** Every rule is an error: a second transport or a status collapse is the defect, not a style. */
|
|
885
907
|
export const recommended = Object.fromEntries(Object.keys(rules).map((name) => [`starci-fe/${name}`, "error"]));
|
package/package.json
CHANGED
|
@@ -31,35 +31,35 @@ pins:
|
|
|
31
31
|
source: packages/event-stream/package.json
|
|
32
32
|
why: 'the one server-sent-events client of every front end (fe-stack event-stream, owner:event-stream-package): the transport client layer (modules/api/sse/clients) creates one instance for the app with the bearer token source and the stream operations follow on it; it carries Last-Event-ID resume, the capped doubling backoff, the heartbeat timeout, the single 401 renewal and the useSWRSubscription adapter, so no app keeps a hand-written reader.'
|
|
33
33
|
'@starci/grammar':
|
|
34
|
-
version: 0.15.
|
|
34
|
+
version: 0.15.12
|
|
35
35
|
group: starci
|
|
36
36
|
install: registry
|
|
37
37
|
side: fe
|
|
38
38
|
source: packages/grammar/package.json
|
|
39
39
|
why: 'the grammar front ends read: the brand layer sets `--font-sans` and `--font-mono` and the grammar reads them; it carries the Input tel kind, the copyable and read-only Input, the IconButton disclosure props and count badge, ChatBubble, FillViewport, Textarea mentions and Enter-to-send, the leading PrimaryRailLayout rail, the plate-less Image, ListRow, the soft Alert, Progress steps, the floating primary IconButton, FlowGraph, the STATE-8 loading views and the bordered selectable TagGroup chips. The runtime source version wins for a @starci package.'
|
|
40
40
|
'@starci/eslint-canon-be':
|
|
41
|
-
version: 3.
|
|
41
|
+
version: 3.7.1
|
|
42
42
|
group: starci
|
|
43
43
|
install: registry
|
|
44
44
|
side: be
|
|
45
45
|
source: packages/eslint-canon-be/package.json
|
|
46
46
|
why: 'the back-end ESLint canon: `loadHfs(import.meta.url)` of be/eslint.config.mjs finds the app-root hfs.json (kind app) and gives every linted file the view of the be side, and the project graph is built per side; its bundled runtime copies (slots, canon-pins, failure codes, the architecture machine) put .starcistacks and .sops.yaml at the app root; `starciBeConfig({ hfs: loadHfs(import.meta.url) })` is the typed factory and the BE-CONVENTION laws are its rules.'
|
|
47
47
|
'@starci/eslint-canon-fe':
|
|
48
|
-
version: 9.
|
|
48
|
+
version: 9.5.1
|
|
49
49
|
group: starci
|
|
50
50
|
install: registry
|
|
51
51
|
side: fe
|
|
52
52
|
source: packages/eslint-canon-fe/package.json
|
|
53
53
|
why: 'the front-end ESLint canon: `loadHfs(import.meta.url)` of fe/eslint.config.mjs finds the app-root hfs.json (kind app) and gives every linted file the view of the fe side, and the project graph is built per side; its bundled runtime copies (slots, canon-pins, failure codes, the architecture machine) put .starcistacks and .sops.yaml at the app root; the front end has no tests (FE_NO_TESTS R97 in hfs) and no-vietnamese-in-source (R91) applies.'
|
|
54
54
|
'@starci/eslint-grammar-core':
|
|
55
|
-
version: 0.15.
|
|
55
|
+
version: 0.15.12
|
|
56
56
|
group: starci
|
|
57
57
|
install: registry
|
|
58
58
|
side: fe
|
|
59
59
|
source: packages/eslint-grammar-core/package.json
|
|
60
60
|
why: 'the StarCi Grammar component API lint, versioned with @starci/grammar; front ends compose this family package with the universal FE canon.'
|
|
61
61
|
'@starci/eslint-grammar-offset-pop':
|
|
62
|
-
version: 0.15.
|
|
62
|
+
version: 0.15.12
|
|
63
63
|
group: starci
|
|
64
64
|
install: registry
|
|
65
65
|
side: fe
|
|
@@ -85,12 +85,12 @@ pins:
|
|
|
85
85
|
side: both
|
|
86
86
|
source: packages/prettier-config/package.json
|
|
87
87
|
'@starci/jest-preset':
|
|
88
|
-
version: 2.
|
|
88
|
+
version: 2.5.0
|
|
89
89
|
group: starci
|
|
90
90
|
install: registry
|
|
91
91
|
side: be
|
|
92
92
|
source: packages/jest-preset/package.json
|
|
93
|
-
why: 'the Jest preset of a back end: the world runner runs up to min(--maxWorkers, slots) world files at once, each in its own process bound to one data slot of the test world (STARCI_TEST_WORLD_SLOT), and reads test-world state protocol 2 only: it pairs exactly with @starci/test-world, and any other state file is JEST_PRESET_WORLD_PAIR_MISMATCH. The unit run writes the lcov Sonar and Codecov import (services only); the integration, e2e and contract projects run every spec file in a worker process of its own (world-runner.cjs), so a process-global framework registry (@nestjs/graphql type metadata) never leaks between e2e files; it ships the unit kit (mockEntityManager, fakeTransaction, fakeIds, FakeClock, Outcome matchers) and the recordingOutbox claim side.'
|
|
93
|
+
why: 'the Jest preset of a back end: the world runner runs up to min(--maxWorkers, slots) world files at once, each in its own process bound to one data slot of the test world (STARCI_TEST_WORLD_SLOT), and reads test-world state protocol 2 only: it pairs exactly with @starci/test-world, and any other state file is JEST_PRESET_WORLD_PAIR_MISMATCH. The unit run writes the lcov Sonar and Codecov import (services only); the integration, e2e and contract projects run every spec file in a worker process of its own (world-runner.cjs), so a process-global framework registry (@nestjs/graphql type metadata) never leaks between e2e files; it ships the unit kit (mockEntityManager, fakeTransaction, fakeQueryBuilder, queueQueryBuilders, fakeIds, FakeClock, Outcome matchers) and the recordingOutbox claim side.'
|
|
94
94
|
'@starci/test-world':
|
|
95
95
|
version: 1.2.3
|
|
96
96
|
group: starci
|
|
@@ -106,7 +106,7 @@ pins:
|
|
|
106
106
|
source: packages/ai-router/package.json
|
|
107
107
|
why: 'the AI pool router of a back end: a NestJS module that routes OpenAI-compatible chat, stream and embeddings calls across keys, models and providers, with @starci/ai-router/testing for its specs; @starci/jest-preset compiles it as an ESM-only dependency.'
|
|
108
108
|
'@starci/hfs':
|
|
109
|
-
version: 4.
|
|
109
|
+
version: 4.10.1
|
|
110
110
|
group: starci
|
|
111
111
|
install: registry
|
|
112
112
|
side: both
|
|
@@ -543,7 +543,7 @@ pins:
|
|
|
543
543
|
version: 3.1150.0
|
|
544
544
|
group: framework
|
|
545
545
|
side: be
|
|
546
|
-
why: 'the S3 transport of integrations/object-storage, the one ObjectStorage adapter of both editions (MinIO, S3, Spaces
|
|
546
|
+
why: 'the S3 transport of integrations/object-storage, the one ObjectStorage adapter of both editions (MinIO, S3, Spaces); 3.1150.0 is the release of 2026-10-12, chosen over newer ones that had not aged two weeks.'
|
|
547
547
|
'@aws-sdk/s3-request-presigner':
|
|
548
548
|
version: 3.1150.0
|
|
549
549
|
group: framework
|
|
@@ -594,27 +594,47 @@ pins:
|
|
|
594
594
|
group: framework
|
|
595
595
|
side: be
|
|
596
596
|
why: 'the Express 5 integration @nestjs/apollo loads at boot (R111 nestjs-apollo-express5, knowledge/hfs/peer-integrations.yaml); every api app that serves GraphQL installs it; the latest registry version on 2026-10-13.'
|
|
597
|
-
# ---
|
|
598
|
-
'@
|
|
599
|
-
version: 0.
|
|
597
|
+
# --- lite identity (integrations/passport, ruling lite-self-hosted-postgres-passport-minio)
|
|
598
|
+
'@nestjs/passport':
|
|
599
|
+
version: 11.0.5
|
|
600
600
|
group: framework
|
|
601
|
-
side:
|
|
602
|
-
why:
|
|
603
|
-
|
|
604
|
-
version:
|
|
601
|
+
side: be
|
|
602
|
+
why: 'PassportStrategy of integrations/passport; 11.0.5 is CommonJS on the Nest 11 line (12.0.0 is ESM-only and breaks Nest 11 jest under the CommonJS transform of @starci/jest-preset), as nivo-lite runs it.'
|
|
603
|
+
passport:
|
|
604
|
+
version: 0.7.0
|
|
605
605
|
group: framework
|
|
606
|
-
side:
|
|
607
|
-
why: the
|
|
606
|
+
side: be
|
|
607
|
+
why: the strategy runtime under @nestjs/passport (its peer range ^0.5 || ^0.6 || ^0.7).
|
|
608
|
+
passport-google-oauth20:
|
|
609
|
+
version: 2.0.0
|
|
610
|
+
group: framework
|
|
611
|
+
side: be
|
|
612
|
+
why: Google OAuth 2.0 (authorization code with state and PKCE) of integrations/passport.
|
|
613
|
+
passport-local:
|
|
614
|
+
version: 1.0.0
|
|
615
|
+
group: framework
|
|
616
|
+
side: be
|
|
617
|
+
why: the email and password strategy of integrations/passport.
|
|
618
|
+
bcryptjs:
|
|
619
|
+
version: 3.0.3
|
|
620
|
+
group: framework
|
|
621
|
+
side: be
|
|
622
|
+
why: 'bcrypt in pure JavaScript (no native build on the alpine image); verifies the $2a$/$2b$ hashes auth.users carries over.'
|
|
623
|
+
'@types/passport-google-oauth20':
|
|
624
|
+
version: 2.0.17
|
|
625
|
+
group: framework
|
|
626
|
+
side: be
|
|
627
|
+
why: types of passport-google-oauth20.
|
|
628
|
+
'@types/passport-local':
|
|
629
|
+
version: 1.0.38
|
|
630
|
+
group: framework
|
|
631
|
+
side: be
|
|
632
|
+
why: types of passport-local.
|
|
608
633
|
jose:
|
|
609
634
|
version: 6.2.12
|
|
610
635
|
group: framework
|
|
611
636
|
side: be
|
|
612
|
-
why:
|
|
613
|
-
supabase:
|
|
614
|
-
version: 2.119.0
|
|
615
|
-
group: tooling
|
|
616
|
-
side: both
|
|
617
|
-
why: the root CLI wrapper owns local schema lifecycle and generates the committed database types.
|
|
637
|
+
why: signs the app's own ES256 access tokens and verifies them against its own key set (createLocalJWKSet) in integrations/passport.
|
|
618
638
|
class-transformer:
|
|
619
639
|
version: 0.5.1
|
|
620
640
|
group: framework
|
|
@@ -37,10 +37,10 @@ concerns:
|
|
|
37
37
|
- id: rest
|
|
38
38
|
tier: core
|
|
39
39
|
packages: [axios]
|
|
40
|
-
home: [fe.modules.api]
|
|
40
|
+
home: [fe.modules.api, fe.modules.auth]
|
|
41
41
|
pattern: FE-API-REST
|
|
42
42
|
forbids: [ky, superagent, node-fetch, cross-fetch, isomorphic-fetch]
|
|
43
|
-
why: modules/api/rest/<area>/*.ts for uploads
|
|
43
|
+
why: modules/api/rest/<area>/*.ts for uploads and presigned URLs, and modules/auth/auth-door.ts for the app's own auth doors only; GraphQL carries every other call.
|
|
44
44
|
- id: data
|
|
45
45
|
tier: core
|
|
46
46
|
packages: [swr]
|
|
@@ -99,8 +99,8 @@ concerns:
|
|
|
99
99
|
packages: []
|
|
100
100
|
home: [fe.modules.auth]
|
|
101
101
|
pattern: FE-AUTH
|
|
102
|
-
forbids: []
|
|
103
|
-
why: modules/auth is the
|
|
102
|
+
forbids: ['@supabase/supabase-js', '@supabase/ssr', '@supabase/auth-js']
|
|
103
|
+
why: modules/auth is the session issuer's client (lite - auth-door.ts over the app's own back-end auth doors with the in-memory token store; full - the app's IdP client); it yields the session and the access token for the Apollo link and never reads data.
|
|
104
104
|
- id: i18n
|
|
105
105
|
tier: core
|
|
106
106
|
packages: [next-intl]
|
|
@@ -256,13 +256,6 @@ concerns:
|
|
|
256
256
|
pattern: FE-RULE-OWNERSHIP
|
|
257
257
|
forbids: []
|
|
258
258
|
why: The selected Grammar family's lint package runs beside the universal front-end canon; the family catalog declares the package and factory.
|
|
259
|
-
- id: auth-supabase
|
|
260
|
-
tier: opt
|
|
261
|
-
packages: ['@supabase/supabase-js', '@supabase/ssr']
|
|
262
|
-
home: [fe.modules.auth]
|
|
263
|
-
pattern: FE-AUTH
|
|
264
|
-
forbids: []
|
|
265
|
-
why: the lite auth provider client and PKCE server cookie adapter, confined to modules/auth; data still goes through the back end.
|
|
266
259
|
- id: framework-support
|
|
267
260
|
tier: opt
|
|
268
261
|
packages: [server-only, rxjs]
|