@jskit-ai/agent-docs 0.1.282 → 0.1.284
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/guide/agent/app-extras/assistant.md +14 -2
- package/guide/agent/app-extras/realtime.md +38 -1
- package/guide/agent/app-setup/authentication.md +64 -14
- package/guide/agent/app-setup/console.md +8 -0
- package/guide/agent/app-setup/database-layer.md +23 -103
- package/guide/agent/app-setup/existing-application-migration.md +105 -72
- package/guide/agent/app-setup/multi-homing.md +94 -32
- package/guide/agent/app-setup/quickstart.md +1 -1
- package/guide/agent/app-setup/run-an-accounts-hub.md +1 -1
- package/guide/agent/app-setup/upgrading-jskit.md +8 -3
- package/guide/agent/app-setup/users.md +8 -5
- package/guide/agent/framework/application-operations.md +1 -1
- package/guide/agent/framework/crud-operations.md +63 -45
- package/guide/agent/framework/data-access.md +1031 -0
- package/guide/agent/framework/sanity-checks.md +26 -27
- package/guide/agent/framework/typed-features.md +114 -247
- package/guide/agent/index.md +2 -0
- package/package.json +6 -3
- package/patterns/feature-package/PATTERN.md +25 -17
- package/patterns/feature-package/example/booking-engine/package.json +1 -1
- package/patterns/feature-package/example/variations/InvoiceRollupFeature.js +6 -7
- package/patterns/feature-package/example/variations/invoiceResource.js +15 -0
- package/patterns/feature-package/example/variations/invoiceRollupActions.js +4 -4
- package/patterns/feature-package/example/variations/ownedTableRepository.js +27 -0
- package/patterns/feature-package/example/variations/types.js +1 -1
- package/patterns/minimal-foundation/example/AGENTS.md +4 -0
- package/patterns/minimal-foundation/example/package.json +4 -4
- package/patterns/minimal-foundation/example/server.js +4 -1
- package/patterns/shell-foundation/example/AGENTS.md +4 -0
- package/patterns/shell-foundation/example/package.json +5 -5
- package/patterns/shell-foundation/example/packages/main/package.json +1 -1
- package/patterns/shell-foundation/example/server.js +4 -1
- package/reference/autogen/KERNEL_MAP.md +2 -1
- package/reference/autogen/PATTERN_INDEX.md +70 -59
- package/reference/autogen/README.md +1 -1
- package/reference/autogen/packages/agent-docs.md +7 -3
- package/reference/autogen/packages/agent-runtime.md +48 -11
- package/reference/autogen/packages/architecture-inspector.md +6 -2
- package/reference/autogen/packages/assistant-core.md +4 -4
- package/reference/autogen/packages/assistant-runtime.md +33 -13
- package/reference/autogen/packages/auth-provider-local-core.md +3 -1
- package/reference/autogen/packages/auth-provider-local-db-core.md +65 -14
- package/reference/autogen/packages/auth-provider-oidc-core.md +5 -1
- package/reference/autogen/packages/auth-provider-supabase-core.md +1 -1
- package/reference/autogen/packages/connectors-core.md +22 -2
- package/reference/autogen/packages/console-core.md +9 -5
- package/reference/autogen/packages/crud-core.md +38 -173
- package/reference/autogen/packages/database-runtime.md +8 -32
- package/reference/autogen/packages/http-runtime.md +3 -3
- package/reference/autogen/packages/http-web.md +12 -0
- package/reference/autogen/packages/kernel.md +25 -2
- package/reference/autogen/packages/oidc-issuer-core.md +4 -0
- package/reference/autogen/packages/payments-core.md +29 -6
- package/reference/autogen/packages/realtime.md +15 -6
- package/reference/autogen/packages/resource-core.md +30 -5
- package/reference/autogen/packages/resource-crud-core.md +30 -34
- package/reference/autogen/packages/resource-runtime.md +198 -0
- package/reference/autogen/packages/rewarded-core.md +16 -10
- package/reference/autogen/packages/shell-web.md +1 -0
- package/reference/autogen/packages/users-core.md +26 -14
- package/reference/autogen/packages/workspaces-core.md +17 -10
- package/reference/autogen/tooling/config-eslint.md +69 -0
- package/reference/autogen/tooling/jskit-catalog.md +40 -1
- package/reference/autogen/tooling/jskit-release.md +3 -0
- package/skills/jskit/SKILL.md +4 -1
- package/skills/jskit/references/app-operations.md +1 -1
- package/skills/jskit/references/crud-operations.md +62 -44
- package/skills/jskit/references/data-access.md +1026 -0
- package/skills/jskit/references/database-layer.md +411 -0
- package/skills/jskit/references/existing-application-migration.md +105 -72
- package/skills/jskit/references/heuristics/INDEX.md +6 -4
- package/skills/jskit/references/heuristics/crud-authoring.md +22 -14
- package/skills/jskit/references/heuristics/data-access.md +19 -0
- package/skills/jskit/references/heuristics/filters.md +6 -6
- package/skills/jskit/references/heuristics/row-policies.md +40 -16
- package/skills/jskit/references/heuristics/server-search.md +30 -42
- package/skills/jskit/references/heuristics/table-resource-fields.md +78 -0
- package/skills/jskit/references/heuristics/typed-features.md +3 -3
- package/skills/jskit/references/multi-homing.md +94 -32
- package/skills/jskit/references/pattern-index.md +70 -59
- package/skills/jskit/references/patterns/app/minimal-foundation/example/AGENTS.md +4 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +4 -4
- package/skills/jskit/references/patterns/app/minimal-foundation/example/server.js +4 -1
- package/skills/jskit/references/patterns/app/shell-foundation/example/AGENTS.md +4 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +5 -5
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
- package/skills/jskit/references/patterns/app/shell-foundation/example/server.js +4 -1
- package/skills/jskit/references/patterns/assistant/assistant-surface/PATTERN.md +5 -2
- package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +3 -2
- package/skills/jskit/references/patterns/auth/auth-surface/PATTERN.md +15 -0
- package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
- package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +4 -4
- package/skills/jskit/references/patterns/crud/crud-contract/PATTERN.md +133 -0
- package/skills/jskit/references/patterns/crud/crud-contract/example/bookResource.js +74 -0
- package/skills/jskit/references/patterns/crud/{json-api-resource-package → crud-feature-package}/PATTERN.md +69 -37
- package/skills/jskit/references/patterns/crud/{json-api-resource-package → crud-feature-package}/example/packages/books/package.json +5 -4
- package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/src/server/BooksFeature.js +13 -0
- package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/src/shared/bookResource.js +74 -0
- package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/src/shared/index.js +1 -0
- package/skills/jskit/references/patterns/crud/crud-screen-set/PATTERN.md +26 -8
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookEditPage.vue +2 -2
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookListPage.vue +2 -2
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookNewPage.vue +2 -2
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookViewPage.vue +3 -3
- package/skills/jskit/references/patterns/database/mysql-application/PATTERN.md +9 -4
- package/skills/jskit/references/patterns/database/mysql-application/example/package.json +2 -1
- package/skills/jskit/references/patterns/database/mysql-application/example/scripts/prepare-database.js +8 -0
- package/skills/jskit/references/patterns/database/postgres-application/PATTERN.md +8 -4
- package/skills/jskit/references/patterns/database/postgres-application/example/package.json +2 -1
- package/skills/jskit/references/patterns/database/postgres-application/example/scripts/prepare-database.js +8 -0
- package/skills/jskit/references/patterns/database/table-resource/PATTERN.md +117 -0
- package/skills/jskit/references/patterns/database/table-resource/example/orderResource.js +25 -0
- package/skills/jskit/references/patterns/realtime/realtime-application/PATTERN.md +7 -0
- package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
- package/skills/jskit/references/patterns/rewards/google-rewarded/PATTERN.md +1 -1
- package/skills/jskit/references/patterns/server/feature-package/PATTERN.md +25 -17
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
- package/skills/jskit/references/patterns/server/feature-package/example/variations/InvoiceRollupFeature.js +6 -7
- package/skills/jskit/references/patterns/server/feature-package/example/variations/invoiceResource.js +15 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/invoiceRollupActions.js +4 -4
- package/skills/jskit/references/patterns/server/feature-package/example/variations/ownedTableRepository.js +27 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/types.js +1 -1
- package/skills/jskit/references/patterns/users/user-administration-server/PATTERN.md +59 -10
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +5 -4
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/server/UsersFeature.js +7 -5
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/shared/index.js +1 -1
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/shared/userCrud.js +21 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +11 -5
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/server/UsersWorkspaceFeature.js +14 -5
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/server/workspaceMembersOnly.js +52 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/shared/index.js +1 -1
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/shared/userCrud.js +21 -0
- package/skills/jskit/references/patterns/workspaces/workspace-server/PATTERN.md +9 -9
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/PATTERN.md +16 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/pages/home/workspaces/index.vue +2 -0
- package/skills/jskit/references/sanity-checks.md +27 -28
- package/skills/jskit/references/typed-features.md +114 -247
- package/patterns/feature-package/example/variations/customKnexRepository.js +0 -40
- package/reference/autogen/packages/json-rest-api-core.md +0 -66
- package/skills/jskit/references/heuristics/crud-repository-mapping.md +0 -140
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/src/server/BooksFeature.js +0 -13
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/src/shared/bookResource.js +0 -83
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/src/shared/index.js +0 -1
- package/skills/jskit/references/patterns/crud/resource-contract/PATTERN.md +0 -155
- package/skills/jskit/references/patterns/crud/resource-contract/example/bookResource.js +0 -87
- package/skills/jskit/references/patterns/server/feature-package/example/variations/customKnexRepository.js +0 -40
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/shared/userResource.js +0 -69
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/shared/userResource.js +0 -56
- /package/skills/jskit/references/patterns/crud/{json-api-resource-package → crud-feature-package}/example/migrations/20260815000000_books.cjs +0 -0
- /package/skills/jskit/references/patterns/crud/{json-api-resource-package → crud-feature-package}/example/packages/books/src/server/types.js +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
id: server/feature-package
|
|
3
3
|
title: App-local server feature package
|
|
4
4
|
summary: Define a server feature through explicit capabilities and first-class actions, adding services or repositories only when its domain earns them.
|
|
5
|
-
keywords: actions,
|
|
5
|
+
keywords: actions, aggregate, feature, handle, orchestration, owns, package, provider, repository, routes, server, table resource
|
|
6
6
|
requires: @jskit-ai/kernel
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -17,16 +17,18 @@ actions whose implementations capture those exact dependencies.
|
|
|
17
17
|
|
|
18
18
|
The concrete `booking-engine` example is intentionally repository-free. The
|
|
19
19
|
`variations/` directory preserves the two important escalations: a meaningful
|
|
20
|
-
orchestration service and
|
|
21
|
-
|
|
20
|
+
orchestration service and a repository over a table the feature owns, for a
|
|
21
|
+
domain whose operations are not CRUD screens.
|
|
22
22
|
|
|
23
23
|
## Do not use when
|
|
24
24
|
|
|
25
25
|
Do not create a package for a tiny composition callback or one route with no
|
|
26
|
-
domain behavior. Use the CRUD
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
domain behavior. Use the CRUD feature pattern when the table's operations are
|
|
27
|
+
screens over HTTP. Do not reach for Knex because SQL is familiar: a table's
|
|
28
|
+
reads and writes go through its handle, and a report the handle cannot express
|
|
29
|
+
is one `scopedQuery()` method, as the
|
|
30
|
+
[data access guide](https://mobily-enterprises.github.io/jskit-ai/guide/framework/data-access)
|
|
31
|
+
says.
|
|
30
32
|
|
|
31
33
|
## Product decisions
|
|
32
34
|
|
|
@@ -50,7 +52,7 @@ questionnaire.
|
|
|
50
52
|
- Every factory, action creator and hook that receives a collaborator names its
|
|
51
53
|
type in a JSDoc `@param`: `import("./types.js").<Name>` or
|
|
52
54
|
`ReturnType<typeof createX>` inside the package, the owner's `./server/types`
|
|
53
|
-
across packages; a
|
|
55
|
+
across packages; a table's handle is resource-runtime's `ResourceHandle`.
|
|
54
56
|
- Collaborators are required. There is no `= null`, `= {}` or no-op default,
|
|
55
57
|
no `typeof` probe, no optional call and no "requires x" guard: the capability
|
|
56
58
|
runtime refuses to start without a required token.
|
|
@@ -80,9 +82,11 @@ questionnaire.
|
|
|
80
82
|
- One copy of each pure helper per package, imported directly. Files stay under
|
|
81
83
|
750 lines and functions under 600, one concern per factory.
|
|
82
84
|
- The service orchestrates the feature and does not issue SQL directly.
|
|
83
|
-
- A
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
- A feature that owns a table lists its table resource in `owns`; setup
|
|
86
|
+
receives the table's handle, and only its repository uses it. One table has
|
|
87
|
+
one owner.
|
|
88
|
+
- A repository holds the owner's queries on its handles and passes each call's
|
|
89
|
+
options (context and transaction) on.
|
|
86
90
|
- Ordinary HTTP and assistant exposure is projected from actions. Explicit
|
|
87
91
|
route code exists only for a genuinely custom transport.
|
|
88
92
|
- Register routes, actions, contributors, and other catalogue entries during
|
|
@@ -97,8 +101,8 @@ questionnaire.
|
|
|
97
101
|
The provider uses `defineFeature()` from
|
|
98
102
|
`@jskit-ai/kernel/server/features`. The runtime supplies named capabilities
|
|
99
103
|
and the feature publishes its actions through the dedicated action catalogue.
|
|
100
|
-
The
|
|
101
|
-
|
|
104
|
+
The persistence variation owns its table with `defineFeature({ owns })` and
|
|
105
|
+
reads totals with the handle's `aggregate()`.
|
|
102
106
|
|
|
103
107
|
## Example files
|
|
104
108
|
|
|
@@ -147,9 +151,11 @@ const SeasonalAvailabilityFeature = defineFeature({
|
|
|
147
151
|
`example/variations/availabilityEngineActions.js` and
|
|
148
152
|
`example/variations/orchestratorService.js` show the repository-free lane.
|
|
149
153
|
`example/variations/InvoiceRollupFeature.js`,
|
|
150
|
-
`example/variations/invoiceRollupActions.js
|
|
151
|
-
`example/variations/
|
|
152
|
-
|
|
154
|
+
`example/variations/invoiceRollupActions.js`,
|
|
155
|
+
`example/variations/invoiceResource.js` and
|
|
156
|
+
`example/variations/ownedTableRepository.js` show the persistence lane: the
|
|
157
|
+
feature owns the invoices table, and its repository reads monthly totals with
|
|
158
|
+
`aggregate()`, scoped to the caller's workspace by the handle. `example/variations/types.js` declares the
|
|
153
159
|
`AvailabilityEngine` and `InvoiceRollup` types.
|
|
154
160
|
|
|
155
161
|
The [typed features guide](https://mobily-enterprises.github.io/jskit-ai/guide/framework/typed-features)
|
|
@@ -172,7 +178,9 @@ illustrative status query with narrow product language before shipping.
|
|
|
172
178
|
denied access.
|
|
173
179
|
- Exercise HTTP routes only when the package owns them.
|
|
174
180
|
- Test service orchestration independently from persistence.
|
|
175
|
-
- Test repository
|
|
181
|
+
- Test each repository path against a second workspace's rows
|
|
182
|
+
(`expectScoped`) and at two sizes (`expectFlatQueries`), from
|
|
183
|
+
`@jskit-ai/resource-runtime/test`.
|
|
176
184
|
- Rebuild any schema from immutable migrations in a disposable database.
|
|
177
185
|
- Run the app's package, server, and integration verification.
|
|
178
186
|
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { defineFeature } from "@jskit-ai/kernel/server/features";
|
|
2
|
-
import {
|
|
2
|
+
import { invoiceResource } from "./invoiceResource.js";
|
|
3
|
+
import { createInvoiceRollup } from "./ownedTableRepository.js";
|
|
3
4
|
import { createInvoiceRollupActions } from "./invoiceRollupActions.js";
|
|
4
5
|
|
|
5
6
|
const InvoiceRollupFeature = defineFeature({
|
|
6
7
|
id: "feature.invoice-rollup",
|
|
7
8
|
domain: "invoices",
|
|
8
|
-
|
|
9
|
-
database: "runtime.database"
|
|
10
|
-
},
|
|
9
|
+
owns: [invoiceResource],
|
|
11
10
|
provides: {
|
|
12
11
|
invoiceRollup: "feature.invoice-rollup"
|
|
13
12
|
},
|
|
14
|
-
/** @param {{
|
|
15
|
-
setup({
|
|
16
|
-
return { invoiceRollup: createInvoiceRollup({
|
|
13
|
+
/** @param {{ resources: { invoices: import("@jskit-ai/resource-runtime/server/types").ResourceHandle } }} capabilities */
|
|
14
|
+
setup({ resources }) {
|
|
15
|
+
return { invoiceRollup: createInvoiceRollup({ invoices: resources.invoices }) };
|
|
17
16
|
},
|
|
18
17
|
actions({ invoiceRollup }) {
|
|
19
18
|
return createInvoiceRollupActions({ invoiceRollup });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineTableResource } from "@jskit-ai/resource-core/shared/tableResource";
|
|
2
|
+
|
|
3
|
+
/** The invoices table: its fields, and the workspace that owns each row. Shared with the client. */
|
|
4
|
+
const invoiceResource = defineTableResource({
|
|
5
|
+
name: "invoices",
|
|
6
|
+
tableName: "invoices",
|
|
7
|
+
ownership: "workspace",
|
|
8
|
+
schema: {
|
|
9
|
+
status: { type: "string", required: true, search: true },
|
|
10
|
+
amount: { type: "number", required: true },
|
|
11
|
+
issuedAt: { type: "dateTime", required: true }
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export { invoiceResource };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { emptyInputValidator } from "@jskit-ai/kernel/server/actions/actionContributorHelpers";
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const ACTION_READ_MONTHLY_TOTALS = "invoices.rollup.monthly-totals.read";
|
|
4
4
|
|
|
5
5
|
/** The fields every invoice rollup query shares, spread first into each definition: they run on the admin surface. */
|
|
6
6
|
const ROLLUP_QUERY = Object.freeze({
|
|
@@ -15,12 +15,12 @@ function createInvoiceRollupActions({ invoiceRollup }) {
|
|
|
15
15
|
return Object.freeze([
|
|
16
16
|
Object.freeze({
|
|
17
17
|
...ROLLUP_QUERY,
|
|
18
|
-
id:
|
|
18
|
+
id: ACTION_READ_MONTHLY_TOTALS,
|
|
19
19
|
input: emptyInputValidator,
|
|
20
20
|
output: null,
|
|
21
|
-
execute: (input, context) => invoiceRollup.
|
|
21
|
+
execute: (input, context) => invoiceRollup.totalsByMonth(input, { context })
|
|
22
22
|
})
|
|
23
23
|
]);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export {
|
|
26
|
+
export { ACTION_READ_MONTHLY_TOTALS, createInvoiceRollupActions };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The invoice rollup's persistence: the queries of the invoices table its
|
|
3
|
+
* feature owns, on that table's handle. The handle adds the workspace to every
|
|
4
|
+
* statement, so no query names it.
|
|
5
|
+
* @param {{ invoices: import("@jskit-ai/resource-runtime/server/types").ResourceHandle }} dependencies
|
|
6
|
+
*/
|
|
7
|
+
function createInvoiceRollup({ invoices }) {
|
|
8
|
+
/**
|
|
9
|
+
* How many invoices of each status the workspace issued each month, and their total.
|
|
10
|
+
* @param {Record<string, never>} input
|
|
11
|
+
* @param {import("@jskit-ai/resource-runtime/server/types").ResourceCallOptions} options
|
|
12
|
+
*/
|
|
13
|
+
function totalsByMonth(input, options) {
|
|
14
|
+
return invoices.aggregate({
|
|
15
|
+
groupBy: ["status", { field: "issuedAt", bucket: "month", as: "month" }],
|
|
16
|
+
measures: { invoices: { count: "*" }, amount: { sum: "amount" } },
|
|
17
|
+
sort: ["month"]
|
|
18
|
+
}, options);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return Object.freeze({
|
|
22
|
+
withTransaction: invoices.withTransaction,
|
|
23
|
+
totalsByMonth
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { createInvoiceRollup };
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
// capabilities, for features that require them.
|
|
3
3
|
|
|
4
4
|
/** @typedef {ReturnType<typeof import("./orchestratorService.js").createAvailabilityEngine>} AvailabilityEngine */
|
|
5
|
-
/** @typedef {ReturnType<typeof import("./
|
|
5
|
+
/** @typedef {ReturnType<typeof import("./ownedTableRepository.js").createInvoiceRollup>} InvoiceRollup */
|
|
6
6
|
|
|
7
7
|
export {};
|
|
@@ -8,6 +8,10 @@ Framework references:
|
|
|
8
8
|
- `https://mobily-enterprises.github.io/jskit-ai/guide/`
|
|
9
9
|
- `https://mobily-enterprises.github.io/jskit-ai/patterns/`
|
|
10
10
|
|
|
11
|
+
Before writing or reviewing code that reads or writes a database table, read
|
|
12
|
+
the data access guide at
|
|
13
|
+
`https://mobily-enterprises.github.io/jskit-ai/guide/framework/data-access`.
|
|
14
|
+
|
|
11
15
|
Before writing or reviewing server code (a feature, provider, action, service,
|
|
12
16
|
repository, route, error or test), read the typed features guide at
|
|
13
17
|
`https://mobily-enterprises.github.io/jskit-ai/guide/framework/typed-features`.
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@local/main": "0.1.0",
|
|
36
36
|
"@fastify/static": "^10.1.3",
|
|
37
|
-
"@jskit-ai/kernel": "0.2.
|
|
37
|
+
"@jskit-ai/kernel": "0.2.14",
|
|
38
38
|
"@jskit-ai/material-web": "0.1.3",
|
|
39
39
|
"@tanstack/vue-query": "^5.101.0",
|
|
40
40
|
"fastify": "^5.12.7",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"vue": "^3.5.44",
|
|
45
45
|
"vue-router": "^5.3.1",
|
|
46
46
|
"vuetify": "^4.3.0",
|
|
47
|
-
"@jskit-ai/http-runtime": "0.2.
|
|
47
|
+
"@jskit-ai/http-runtime": "0.2.14",
|
|
48
48
|
"@fastify/fast-json-stringify-compiler": "^5.1.0",
|
|
49
49
|
"@vue/devtools-api": "^8.2.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@jskit-ai/config-eslint": "0.1.
|
|
53
|
-
"@jskit-ai/jskit-catalog": "0.2.
|
|
52
|
+
"@jskit-ai/config-eslint": "0.1.247",
|
|
53
|
+
"@jskit-ai/jskit-catalog": "0.2.36",
|
|
54
54
|
"@playwright/test": "1.61.1",
|
|
55
55
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
56
56
|
"eslint": "^10.8.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Fastify from "fastify";
|
|
2
2
|
import SerializerSelector from "@fastify/fast-json-stringify-compiler";
|
|
3
|
-
import { createCachedResponseSerializerFactory } from "@jskit-ai/kernel/server/http";
|
|
3
|
+
import { createCachedResponseSerializerFactory, resolveTrustedProxies } from "@jskit-ai/kernel/server/http";
|
|
4
4
|
import fastifyStatic from "@fastify/static";
|
|
5
5
|
import { buildLoggerOptions } from "./server/lib/loggerOptions.js";
|
|
6
6
|
import { resolveRuntimeEnv } from "./server/lib/runtimeEnv.js";
|
|
@@ -94,6 +94,9 @@ function canServeStaticFile(distRoot, relativePath) {
|
|
|
94
94
|
async function createServer({ runtimeEnv }) {
|
|
95
95
|
const app = Fastify({
|
|
96
96
|
logger: buildLoggerOptions(),
|
|
97
|
+
// The proxies in front of the server (TRUSTED_PROXIES; loopback without it), so request.ip and the rate limits
|
|
98
|
+
// counted by it are each client's address behind them.
|
|
99
|
+
trustProxy: resolveTrustedProxies(runtimeEnv),
|
|
97
100
|
schemaController: {
|
|
98
101
|
compilersFactory: {
|
|
99
102
|
buildSerializer: createCachedResponseSerializerFactory(SerializerSelector())
|
|
@@ -8,6 +8,10 @@ Framework references:
|
|
|
8
8
|
- `https://mobily-enterprises.github.io/jskit-ai/guide/`
|
|
9
9
|
- `https://mobily-enterprises.github.io/jskit-ai/patterns/`
|
|
10
10
|
|
|
11
|
+
Before writing or reviewing code that reads or writes a database table, read
|
|
12
|
+
the data access guide at
|
|
13
|
+
`https://mobily-enterprises.github.io/jskit-ai/guide/framework/data-access`.
|
|
14
|
+
|
|
11
15
|
Before writing or reviewing server code (a feature, provider, action, service,
|
|
12
16
|
repository, route, error or test), read the typed features guide at
|
|
13
17
|
`https://mobily-enterprises.github.io/jskit-ai/guide/framework/typed-features`.
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@local/main": "0.1.0",
|
|
36
36
|
"@fastify/static": "^10.1.3",
|
|
37
|
-
"@jskit-ai/kernel": "0.2.
|
|
37
|
+
"@jskit-ai/kernel": "0.2.14",
|
|
38
38
|
"@jskit-ai/material-web": "0.1.3",
|
|
39
39
|
"@tanstack/vue-query": "^5.101.0",
|
|
40
40
|
"fastify": "^5.12.7",
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"vue": "^3.5.44",
|
|
45
45
|
"vue-router": "^5.3.1",
|
|
46
46
|
"vuetify": "^4.3.0",
|
|
47
|
-
"@jskit-ai/http-runtime": "0.2.
|
|
48
|
-
"@jskit-ai/shell-web": "0.2.
|
|
47
|
+
"@jskit-ai/http-runtime": "0.2.14",
|
|
48
|
+
"@jskit-ai/shell-web": "0.2.17",
|
|
49
49
|
"@fastify/fast-json-stringify-compiler": "^5.1.0",
|
|
50
50
|
"@vue/devtools-api": "^8.2.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@jskit-ai/config-eslint": "0.1.
|
|
54
|
-
"@jskit-ai/jskit-catalog": "0.2.
|
|
53
|
+
"@jskit-ai/config-eslint": "0.1.247",
|
|
54
|
+
"@jskit-ai/jskit-catalog": "0.2.36",
|
|
55
55
|
"@playwright/test": "1.61.1",
|
|
56
56
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
57
57
|
"eslint": "^10.8.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Fastify from "fastify";
|
|
2
2
|
import SerializerSelector from "@fastify/fast-json-stringify-compiler";
|
|
3
|
-
import { createCachedResponseSerializerFactory } from "@jskit-ai/kernel/server/http";
|
|
3
|
+
import { createCachedResponseSerializerFactory, resolveTrustedProxies } from "@jskit-ai/kernel/server/http";
|
|
4
4
|
import fastifyStatic from "@fastify/static";
|
|
5
5
|
import { buildLoggerOptions } from "./server/lib/loggerOptions.js";
|
|
6
6
|
import { resolveRuntimeEnv } from "./server/lib/runtimeEnv.js";
|
|
@@ -94,6 +94,9 @@ function canServeStaticFile(distRoot, relativePath) {
|
|
|
94
94
|
async function createServer({ runtimeEnv }) {
|
|
95
95
|
const app = Fastify({
|
|
96
96
|
logger: buildLoggerOptions(),
|
|
97
|
+
// The proxies in front of the server (TRUSTED_PROXIES; loopback without it), so request.ip and the rate limits
|
|
98
|
+
// counted by it are each client's address behind them.
|
|
99
|
+
trustProxy: resolveTrustedProxies(runtimeEnv),
|
|
97
100
|
schemaController: {
|
|
98
101
|
compilersFactory: {
|
|
99
102
|
buildSerializer: createCachedResponseSerializerFactory(SerializerSelector())
|
|
@@ -373,11 +373,12 @@ Exports
|
|
|
373
373
|
### `capabilities/defineProvider.js`
|
|
374
374
|
Exports
|
|
375
375
|
- `ARCHITECTURE_ID_PATTERN`
|
|
376
|
-
- `defineProvider({ id, requires = {}, optional = {}, provides = {}, setup, boot = null, shutdown = null } = {})`
|
|
376
|
+
- `defineProvider({ id, requires = {}, optional = {}, provides = {}, hints = {}, setup, boot = null, shutdown = null } = {})`
|
|
377
377
|
- `normalizeArchitectureId(value, label)`
|
|
378
378
|
- `type ProviderDefinition`
|
|
379
379
|
Local functions
|
|
380
380
|
- `normalizeCapabilityMap(value, label)`
|
|
381
|
+
- `normalizeHints(value, requires, providerId)`
|
|
381
382
|
- `assertDistinctLocalNames(maps)`
|
|
382
383
|
- `normalizeLifecycleMethod(value, label)`
|
|
383
384
|
|