@starci/hfs 4.7.24 → 4.7.26
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 +8 -0
- package/package.json +1 -1
- package/runtime/knowledge/hfs/canon-pins.yaml +4 -4
- package/sync/index.mjs +2 -1
- package/templates/be/platform/errors-graphql/graphql-error.mapper.spec.ts +15 -0
- package/templates/be/platform/graphql/localize-errors.mapper.spec.ts +14 -11
- package/templates/be/skeleton/src/modules/platform/http-security/edge-security.service.spec.ts +35 -1
- package/templates/be/skeleton/src/modules/platform/http-security/edge-security.service.ts +2 -1
- package/templates/be/skeleton/src/modules/platform/primitives/outcome.mapper.spec.ts +5 -1
- package/templates/be/skeleton-lite/src/modules/platform/database/database.module.ts +2 -1
- package/templates/fe/auth/supabase-client.ts.tpl +5 -1
- package/templates/fe/skeleton/apps/landing/src/modules/i18n/index.ts +1 -4
- package/templates/fe/skeleton-lite/apps/__app__/src/modules/auth/client.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.7.26 - 2026-10-23
|
|
4
|
+
- Changed: the bundled canon pins select @starci/cli 1.7.26, @starci/eslint-canon-be 3.4.33 and @starci/eslint-canon-fe 8.4.32.
|
|
5
|
+
|
|
6
|
+
## 4.7.25 - 2026-10-23
|
|
7
|
+
- Fixed: with fe packages, the managed `lint` and `lint:fix` scripts build them first (`turbo run build --filter=./fe/packages/*`, turbo.json already declares lint dependsOn ^build): the typed front-end canon of @starci/eslint-canon-fe 8.4.30 read a fresh full scaffold's i18n package as unresolved types (`no-unsafe-*`), so `starci app lint` was red on a new app.
|
|
8
|
+
- Fixed: the skeleton specs cover the express-adapter guard of the edge security and the GraphQL error mapper without locations or path, so a fresh scaffold's unit run holds per-file 100; the skeleton templates and the Supabase auth partial are prettier-formatted (`HFS_FORMAT` was red on a fresh lite scaffold).
|
|
9
|
+
- Changed: the bundled canon pins select @starci/cli 1.7.25, @starci/eslint-canon-be 3.4.32 and @starci/eslint-canon-fe 8.4.31.
|
|
10
|
+
|
|
3
11
|
## 4.7.24 - 2026-10-23
|
|
4
12
|
- Fixed: `starci app release push` counts no skipped conclusion as passing (owner ruling 2026-10-22: a skip is a loosening): a green candidate run with a skipped job is red, and the failing-jobs report lists skipped jobs and steps. The candidate grace is 45 minutes and the bounded wait 150 minutes from the push; a queued run is listed, so GitHub's queue never counts against the grace. Specs: `src/candidate-ci.spec.mjs`.
|
|
5
13
|
- Fixed: the local release gate always runs `db-stop` once `db-start` ran (`teardownOf`): a red database row no longer leaves the lite app's local Supabase running. Specs: `src/no-loosening-ci.spec.mjs`.
|
package/package.json
CHANGED
|
@@ -29,14 +29,14 @@ pins:
|
|
|
29
29
|
source: packages/grammar/package.json
|
|
30
30
|
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.'
|
|
31
31
|
'@starci/eslint-canon-be':
|
|
32
|
-
version: 3.4.
|
|
32
|
+
version: 3.4.33
|
|
33
33
|
group: starci
|
|
34
34
|
install: registry
|
|
35
35
|
side: be
|
|
36
36
|
source: packages/eslint/be/package.json
|
|
37
37
|
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.'
|
|
38
38
|
'@starci/eslint-canon-fe':
|
|
39
|
-
version: 8.4.
|
|
39
|
+
version: 8.4.32
|
|
40
40
|
group: starci
|
|
41
41
|
install: registry
|
|
42
42
|
side: fe
|
|
@@ -76,14 +76,14 @@ pins:
|
|
|
76
76
|
source: packages/test-world/package.json
|
|
77
77
|
why: 'the shared e2e library of every back end (R47, R48), a devDependency of every back end: the warm stack behind toxiproxy, the network-edge fakes, the Nest boot, the typed useTestWorld handle, useSandbox for contract specs and the outage lock. Kafka is real own infra (the one digest-pinned apache/kafka KRaft image, a broker listener and proxy per slot, slot-prefixed topics, consumer groups and client ids) and Postgres is schema-per-context (a schema and a login role per context in a shared database). Each worker has its own data slot (<ns>_w<k>) with its own databases, Keycloak realm, leased Redis DB, bucket/collection/topic prefixes, fakes host, toxiproxy proxies and outage lock; a run provisions min(jest workers, workers cap, default 2) slots, and state file protocol 2 pairs exactly with @starci/jest-preset (TEST_WORLD_PAIR_MISMATCH otherwise). A modules world boots real peer apps beside its modules, world.apps.<name>.during(fn) is the outage of a peer app, w.keycloak.clientSecret(client) answers the run-generated secret of a confidential realm client, world.keycloak.events/sessions read the realm user events and live sessions, world.infra.postgresql.connection(name) takes one database connection down while the others serve, and world.resolve and scope.resolve take any Nest token. Every path a declaration names (`stack`, seeds, the realm, Dockerfiles) resolves from the app root (the directory of hfs.json); the globalSetup registers the path aliases as TypeScript resolves them. Its CLI main is exported at ./cli for starci app stack.'
|
|
78
78
|
'@starci/cli':
|
|
79
|
-
version: 1.7.
|
|
79
|
+
version: 1.7.26
|
|
80
80
|
group: starci
|
|
81
81
|
install: registry
|
|
82
82
|
side: both
|
|
83
83
|
source: packages/cli/package.json
|
|
84
84
|
why: 'the only StarCi command package; product repositories install it for starci app, while @starci/hfs remains its pinned transitive implementation.'
|
|
85
85
|
'@starci/hfs':
|
|
86
|
-
version: 4.7.
|
|
86
|
+
version: 4.7.26
|
|
87
87
|
group: starci
|
|
88
88
|
install: registry
|
|
89
89
|
side: both
|
package/sync/index.mjs
CHANGED
|
@@ -345,7 +345,8 @@ export function variables(app, scope, presets, sonarKey, manifest = loadSlotMani
|
|
|
345
345
|
buildFe: 'npm run codegen --silent && turbo run build --filter=./fe/apps/*',
|
|
346
346
|
// The be side with its tsc; every fe workspace with its own typecheck script through turbo (the packages are built first: ^build).
|
|
347
347
|
typecheck: 'npm run codegen --silent && tsc -p be/tsconfig.json && turbo run typecheck',
|
|
348
|
-
|
|
348
|
+
// The typed lint reads the types the fe packages declare (their dist, turbo.json: lint dependsOn ^build), so the packages are built first.
|
|
349
|
+
lintPrefix: packages ? 'npm run codegen --silent && turbo run build --filter=./fe/packages/* && ' : 'npm run codegen --silent && ',
|
|
349
350
|
nodeMajor: String(NODE_MAJOR),
|
|
350
351
|
sonarKey: sonarKey ?? app.project,
|
|
351
352
|
sonarHostLine: sonarHostLine(quality.sonar),
|
|
@@ -49,4 +49,19 @@ describe("formatGraphqlError", () => {
|
|
|
49
49
|
})
|
|
50
50
|
expect(errors.describe).toHaveBeenCalledWith(cause)
|
|
51
51
|
})
|
|
52
|
+
|
|
53
|
+
it("leaves out the locations and path a formatted error does not carry", () => {
|
|
54
|
+
const subject = formatGraphqlError
|
|
55
|
+
const errors = mock<ErrorsService>()
|
|
56
|
+
errors.describe.mockReturnValue({ code: "ERRORS_INTERNAL", kind: "internal", status: 500, params: {} })
|
|
57
|
+
|
|
58
|
+
expect(subject(errors, { message: "raw" }, new GraphQLError("GRAPHQL_PARSE_FAILED"))).toEqual({
|
|
59
|
+
message: "raw",
|
|
60
|
+
extensions: { kind: "invalid" },
|
|
61
|
+
})
|
|
62
|
+
expect(subject(errors, { message: "raw" }, new Error("boom"))).toEqual({
|
|
63
|
+
message: "ERRORS_INTERNAL",
|
|
64
|
+
extensions: { code: "ERRORS_INTERNAL", kind: "internal", params: {} },
|
|
65
|
+
})
|
|
66
|
+
})
|
|
52
67
|
})
|
|
@@ -65,17 +65,20 @@ describe("localizeError", () => {
|
|
|
65
65
|
expect(errors.text).toHaveBeenCalledWith("ITEM_NOT_FOUND", { id: "i-1", retries: 2 }, "en")
|
|
66
66
|
})
|
|
67
67
|
|
|
68
|
-
it.each([undefined, null, ["i-1"], "i-1", 42, false])(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
68
|
+
it.each([undefined, null, ["i-1"], "i-1", 42, false])(
|
|
69
|
+
"interpolates no params when extensions.params is %p",
|
|
70
|
+
(params) => {
|
|
71
|
+
const errors = mock<ErrorsService>()
|
|
72
|
+
errors.text.mockReturnValue("The item was not found")
|
|
73
|
+
const error: GraphQLFormattedError = {
|
|
74
|
+
message: "ITEM_NOT_FOUND",
|
|
75
|
+
extensions: { code: "ITEM_NOT_FOUND", params },
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
expect(localizeError(errors, "en", error).message).toBe("The item was not found")
|
|
79
|
+
expect(errors.text).toHaveBeenCalledWith("ITEM_NOT_FOUND", {}, "en")
|
|
80
|
+
},
|
|
81
|
+
)
|
|
79
82
|
})
|
|
80
83
|
|
|
81
84
|
describe("localizeErrorsPlugin", () => {
|
package/templates/be/skeleton/src/modules/platform/http-security/edge-security.service.spec.ts
CHANGED
|
@@ -58,7 +58,9 @@ describe("HTTP edge origin validation", () => {
|
|
|
58
58
|
it("rejects an empty allowlist and HTTP origins without development permission", async () => {
|
|
59
59
|
const edge = await buildEdge()
|
|
60
60
|
expect(() => edge.validateAllowedOrigins([], false)).toThrow("HTTP_SECURITY_REQUEST_INVALID")
|
|
61
|
-
expect(() => edge.validateAllowedOrigins(["http://web.example"], false)).toThrow(
|
|
61
|
+
expect(() => edge.validateAllowedOrigins(["http://web.example"], false)).toThrow(
|
|
62
|
+
"HTTP_SECURITY_REQUEST_INVALID",
|
|
63
|
+
)
|
|
62
64
|
})
|
|
63
65
|
})
|
|
64
66
|
|
|
@@ -120,3 +122,35 @@ describe("HTTP edge installation", () => {
|
|
|
120
122
|
},
|
|
121
123
|
)
|
|
122
124
|
})
|
|
125
|
+
|
|
126
|
+
describe("HTTP edge adapter", () => {
|
|
127
|
+
it.each([null, 1, {}, { disable: jest.fn() }])(
|
|
128
|
+
"refuses an HTTP adapter whose instance %p is no express application",
|
|
129
|
+
async (instance) => {
|
|
130
|
+
const edge = await buildEdge()
|
|
131
|
+
const { app } = appWithServer()
|
|
132
|
+
const adapter = mock<ReturnType<INestApplication["getHttpAdapter"]>>()
|
|
133
|
+
adapter.getInstance.mockReturnValue(instance)
|
|
134
|
+
app.getHttpAdapter.mockReturnValue(adapter)
|
|
135
|
+
expect(() => edge.applyHttpSecurity(app, options, { trustProxy: 1 })).toThrow(
|
|
136
|
+
"HTTP_SECURITY_REQUEST_INVALID",
|
|
137
|
+
)
|
|
138
|
+
expect(app.enableCors).not.toHaveBeenCalled()
|
|
139
|
+
},
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
it("accepts an express application that is a function or a plain object", async () => {
|
|
143
|
+
const edge = await buildEdge()
|
|
144
|
+
const callable = Object.assign(() => undefined, { disable: jest.fn(), set: jest.fn() })
|
|
145
|
+
const plain = { disable: jest.fn(), set: jest.fn() }
|
|
146
|
+
for (const server of [callable, plain]) {
|
|
147
|
+
const { app } = appWithServer()
|
|
148
|
+
const adapter = mock<ReturnType<INestApplication["getHttpAdapter"]>>()
|
|
149
|
+
adapter.getInstance.mockReturnValue(server)
|
|
150
|
+
app.getHttpAdapter.mockReturnValue(adapter)
|
|
151
|
+
edge.applyHttpSecurity(app, options, { trustProxy: 1 })
|
|
152
|
+
expect(server.disable).toHaveBeenCalledWith("x-powered-by")
|
|
153
|
+
expect(server.set).toHaveBeenCalledWith("trust proxy", 1)
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
})
|
|
@@ -11,7 +11,8 @@ const isExpressApplication = (value: unknown): value is Express =>
|
|
|
11
11
|
|
|
12
12
|
const expressOf = (app: INestApplication): Express => {
|
|
13
13
|
const instance: unknown = app.getHttpAdapter().getInstance()
|
|
14
|
-
if (!isExpressApplication(instance))
|
|
14
|
+
if (!isExpressApplication(instance))
|
|
15
|
+
throw new HttpSecurityError({ code: HttpSecurityErrorCode.RequestInvalid, params: { fields: "HTTP_ADAPTER" } })
|
|
15
16
|
return instance
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -64,7 +64,11 @@ describe("outcome mappers", () => {
|
|
|
64
64
|
it("turns a refusal into the capability error with its parameters", () => {
|
|
65
65
|
const outcome = subject.refused<CapabilityErrorCode>("CAPABILITY_REFUSED", { resource: "value-1" })
|
|
66
66
|
|
|
67
|
-
expect(thrownBy(() => subject.unwrapOutcome(outcome, CapabilityError))).toMatchObject({
|
|
67
|
+
expect(thrownBy(() => subject.unwrapOutcome(outcome, CapabilityError))).toMatchObject({
|
|
68
|
+
name: "CapabilityError",
|
|
69
|
+
code: "CAPABILITY_REFUSED",
|
|
70
|
+
params: { resource: "value-1" },
|
|
71
|
+
})
|
|
68
72
|
})
|
|
69
73
|
})
|
|
70
74
|
})
|
|
@@ -10,7 +10,8 @@ import { PRIMARY_CONNECTION } from "./primary.connection"
|
|
|
10
10
|
import { DATABASE_PROBE, PRIMARY_ENTITY_MANAGER } from "./primary.decorators"
|
|
11
11
|
|
|
12
12
|
/** The `schema` option of a connection, left out when the connection names none. */
|
|
13
|
-
const schemaOption = (schema: string | undefined): Partial<Record<"schema", string>> =>
|
|
13
|
+
const schemaOption = (schema: string | undefined): Partial<Record<"schema", string>> =>
|
|
14
|
+
schema === undefined ? {} : { schema }
|
|
14
15
|
|
|
15
16
|
/** The token each declared connection provides its shared EntityManager under. */
|
|
16
17
|
type EntityManagerToken = typeof PRIMARY_ENTITY_MANAGER
|
|
@@ -4,7 +4,11 @@ const sessionOf = (session: Session | null): AuthSession | undefined =>
|
|
|
4
4
|
: { userId: session.user.id, ...(session.user.email === undefined ? {} : { email: session.user.email }) }
|
|
5
5
|
|
|
6
6
|
/** A Supabase Auth error as the provider reports it: its HTTP status, its code and its message. */
|
|
7
|
-
type ProviderError = {
|
|
7
|
+
type ProviderError = {
|
|
8
|
+
readonly status: number | undefined
|
|
9
|
+
readonly code: string | undefined
|
|
10
|
+
readonly message: string
|
|
11
|
+
}
|
|
8
12
|
|
|
9
13
|
/** The failure kind of a Supabase Auth error: refused credentials, rejected input, or the provider unavailable. */
|
|
10
14
|
const kindOf = (status: number | undefined): string => {
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { createAppI18n } from "@{{project}}/i18n"
|
|
2
2
|
|
|
3
3
|
/** The landing's i18n: the product's one next-intl stack (the i18n package), with this app's own catalogs under `messages/`. */
|
|
4
|
-
export const landingI18n = createAppI18n(
|
|
5
|
-
"landing",
|
|
6
|
-
(locale) => import(`./messages/${locale}.json`),
|
|
7
|
-
)
|
|
4
|
+
export const landingI18n = createAppI18n("landing", (locale) => import(`./messages/${locale}.json`))
|
|
@@ -10,7 +10,8 @@ let authentication: SupabaseClient["auth"] | undefined
|
|
|
10
10
|
* redirect's code is exchanged by `detectSessionInUrl`, no route handler). It never calls `.from()`, `.rpc()` or storage:
|
|
11
11
|
* data goes through modules/api to the back end, which verifies the access token.
|
|
12
12
|
*/
|
|
13
|
-
const authOf = (): SupabaseClient["auth"] =>
|
|
13
|
+
const authOf = (): SupabaseClient["auth"] =>
|
|
14
|
+
(authentication ??= createClient(supabaseUrl(), supabaseAnonKey(), {
|
|
14
15
|
auth: { flowType: "pkce", detectSessionInUrl: true, persistSession: true, autoRefreshToken: true },
|
|
15
16
|
}).auth)
|
|
16
17
|
|