@jskit-ai/agent-docs 0.1.283 → 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.
Files changed (151) hide show
  1. package/guide/agent/app-extras/assistant.md +14 -2
  2. package/guide/agent/app-extras/realtime.md +38 -1
  3. package/guide/agent/app-setup/authentication.md +64 -14
  4. package/guide/agent/app-setup/console.md +8 -0
  5. package/guide/agent/app-setup/database-layer.md +23 -103
  6. package/guide/agent/app-setup/existing-application-migration.md +105 -72
  7. package/guide/agent/app-setup/multi-homing.md +94 -32
  8. package/guide/agent/app-setup/quickstart.md +1 -1
  9. package/guide/agent/app-setup/run-an-accounts-hub.md +1 -1
  10. package/guide/agent/app-setup/upgrading-jskit.md +8 -3
  11. package/guide/agent/app-setup/users.md +8 -5
  12. package/guide/agent/framework/application-operations.md +1 -1
  13. package/guide/agent/framework/crud-operations.md +63 -45
  14. package/guide/agent/framework/data-access.md +1031 -0
  15. package/guide/agent/framework/sanity-checks.md +26 -27
  16. package/guide/agent/framework/typed-features.md +114 -247
  17. package/guide/agent/index.md +2 -0
  18. package/package.json +6 -3
  19. package/patterns/feature-package/PATTERN.md +25 -17
  20. package/patterns/feature-package/example/booking-engine/package.json +1 -1
  21. package/patterns/feature-package/example/variations/InvoiceRollupFeature.js +6 -7
  22. package/patterns/feature-package/example/variations/invoiceResource.js +15 -0
  23. package/patterns/feature-package/example/variations/invoiceRollupActions.js +4 -4
  24. package/patterns/feature-package/example/variations/ownedTableRepository.js +27 -0
  25. package/patterns/feature-package/example/variations/types.js +1 -1
  26. package/patterns/minimal-foundation/example/AGENTS.md +4 -0
  27. package/patterns/minimal-foundation/example/package.json +4 -4
  28. package/patterns/minimal-foundation/example/server.js +4 -1
  29. package/patterns/shell-foundation/example/AGENTS.md +4 -0
  30. package/patterns/shell-foundation/example/package.json +5 -5
  31. package/patterns/shell-foundation/example/packages/main/package.json +1 -1
  32. package/patterns/shell-foundation/example/server.js +4 -1
  33. package/reference/autogen/KERNEL_MAP.md +2 -1
  34. package/reference/autogen/PATTERN_INDEX.md +70 -59
  35. package/reference/autogen/README.md +1 -1
  36. package/reference/autogen/packages/agent-docs.md +7 -3
  37. package/reference/autogen/packages/agent-runtime.md +48 -11
  38. package/reference/autogen/packages/architecture-inspector.md +6 -2
  39. package/reference/autogen/packages/assistant-core.md +4 -4
  40. package/reference/autogen/packages/assistant-runtime.md +33 -13
  41. package/reference/autogen/packages/auth-provider-local-core.md +3 -1
  42. package/reference/autogen/packages/auth-provider-local-db-core.md +65 -14
  43. package/reference/autogen/packages/auth-provider-oidc-core.md +5 -1
  44. package/reference/autogen/packages/auth-provider-supabase-core.md +1 -1
  45. package/reference/autogen/packages/connectors-core.md +22 -2
  46. package/reference/autogen/packages/console-core.md +9 -5
  47. package/reference/autogen/packages/crud-core.md +38 -173
  48. package/reference/autogen/packages/database-runtime.md +8 -32
  49. package/reference/autogen/packages/http-runtime.md +3 -3
  50. package/reference/autogen/packages/http-web.md +12 -0
  51. package/reference/autogen/packages/kernel.md +25 -2
  52. package/reference/autogen/packages/oidc-issuer-core.md +4 -0
  53. package/reference/autogen/packages/payments-core.md +29 -6
  54. package/reference/autogen/packages/realtime.md +15 -6
  55. package/reference/autogen/packages/resource-core.md +30 -5
  56. package/reference/autogen/packages/resource-crud-core.md +30 -34
  57. package/reference/autogen/packages/resource-runtime.md +198 -0
  58. package/reference/autogen/packages/rewarded-core.md +16 -10
  59. package/reference/autogen/packages/shell-web.md +1 -0
  60. package/reference/autogen/packages/users-core.md +26 -14
  61. package/reference/autogen/packages/workspaces-core.md +17 -10
  62. package/reference/autogen/tooling/config-eslint.md +69 -0
  63. package/reference/autogen/tooling/jskit-catalog.md +36 -1
  64. package/reference/autogen/tooling/jskit-release.md +3 -0
  65. package/skills/jskit/SKILL.md +4 -1
  66. package/skills/jskit/references/app-operations.md +1 -1
  67. package/skills/jskit/references/crud-operations.md +62 -44
  68. package/skills/jskit/references/data-access.md +1026 -0
  69. package/skills/jskit/references/database-layer.md +411 -0
  70. package/skills/jskit/references/existing-application-migration.md +105 -72
  71. package/skills/jskit/references/heuristics/INDEX.md +6 -4
  72. package/skills/jskit/references/heuristics/crud-authoring.md +22 -14
  73. package/skills/jskit/references/heuristics/data-access.md +19 -0
  74. package/skills/jskit/references/heuristics/filters.md +6 -6
  75. package/skills/jskit/references/heuristics/row-policies.md +40 -16
  76. package/skills/jskit/references/heuristics/server-search.md +30 -42
  77. package/skills/jskit/references/heuristics/table-resource-fields.md +78 -0
  78. package/skills/jskit/references/heuristics/typed-features.md +3 -3
  79. package/skills/jskit/references/multi-homing.md +94 -32
  80. package/skills/jskit/references/pattern-index.md +70 -59
  81. package/skills/jskit/references/patterns/app/minimal-foundation/example/AGENTS.md +4 -0
  82. package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +4 -4
  83. package/skills/jskit/references/patterns/app/minimal-foundation/example/server.js +4 -1
  84. package/skills/jskit/references/patterns/app/shell-foundation/example/AGENTS.md +4 -0
  85. package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +5 -5
  86. package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
  87. package/skills/jskit/references/patterns/app/shell-foundation/example/server.js +4 -1
  88. package/skills/jskit/references/patterns/assistant/assistant-surface/PATTERN.md +5 -2
  89. package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +3 -2
  90. package/skills/jskit/references/patterns/auth/auth-surface/PATTERN.md +15 -0
  91. package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
  92. package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
  93. package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +4 -4
  94. package/skills/jskit/references/patterns/crud/crud-contract/PATTERN.md +133 -0
  95. package/skills/jskit/references/patterns/crud/crud-contract/example/bookResource.js +74 -0
  96. package/skills/jskit/references/patterns/crud/{json-api-resource-package → crud-feature-package}/PATTERN.md +69 -37
  97. package/skills/jskit/references/patterns/crud/{json-api-resource-package → crud-feature-package}/example/packages/books/package.json +5 -4
  98. package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/src/server/BooksFeature.js +13 -0
  99. package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/src/shared/bookResource.js +74 -0
  100. package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/src/shared/index.js +1 -0
  101. package/skills/jskit/references/patterns/crud/crud-screen-set/PATTERN.md +26 -8
  102. package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookEditPage.vue +2 -2
  103. package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookListPage.vue +2 -2
  104. package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookNewPage.vue +2 -2
  105. package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookViewPage.vue +3 -3
  106. package/skills/jskit/references/patterns/database/mysql-application/PATTERN.md +9 -4
  107. package/skills/jskit/references/patterns/database/mysql-application/example/package.json +2 -1
  108. package/skills/jskit/references/patterns/database/mysql-application/example/scripts/prepare-database.js +8 -0
  109. package/skills/jskit/references/patterns/database/postgres-application/PATTERN.md +8 -4
  110. package/skills/jskit/references/patterns/database/postgres-application/example/package.json +2 -1
  111. package/skills/jskit/references/patterns/database/postgres-application/example/scripts/prepare-database.js +8 -0
  112. package/skills/jskit/references/patterns/database/table-resource/PATTERN.md +117 -0
  113. package/skills/jskit/references/patterns/database/table-resource/example/orderResource.js +25 -0
  114. package/skills/jskit/references/patterns/realtime/realtime-application/PATTERN.md +7 -0
  115. package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
  116. package/skills/jskit/references/patterns/rewards/google-rewarded/PATTERN.md +1 -1
  117. package/skills/jskit/references/patterns/server/feature-package/PATTERN.md +25 -17
  118. package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
  119. package/skills/jskit/references/patterns/server/feature-package/example/variations/InvoiceRollupFeature.js +6 -7
  120. package/skills/jskit/references/patterns/server/feature-package/example/variations/invoiceResource.js +15 -0
  121. package/skills/jskit/references/patterns/server/feature-package/example/variations/invoiceRollupActions.js +4 -4
  122. package/skills/jskit/references/patterns/server/feature-package/example/variations/ownedTableRepository.js +27 -0
  123. package/skills/jskit/references/patterns/server/feature-package/example/variations/types.js +1 -1
  124. package/skills/jskit/references/patterns/users/user-administration-server/PATTERN.md +59 -10
  125. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +5 -4
  126. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/server/UsersFeature.js +7 -5
  127. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/shared/index.js +1 -1
  128. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/shared/userCrud.js +21 -0
  129. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +11 -5
  130. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/server/UsersWorkspaceFeature.js +14 -5
  131. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/server/workspaceMembersOnly.js +52 -0
  132. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/shared/index.js +1 -1
  133. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/shared/userCrud.js +21 -0
  134. package/skills/jskit/references/patterns/workspaces/workspace-server/PATTERN.md +9 -9
  135. package/skills/jskit/references/patterns/workspaces/workspace-surfaces/PATTERN.md +16 -0
  136. package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/pages/home/workspaces/index.vue +2 -0
  137. package/skills/jskit/references/sanity-checks.md +27 -28
  138. package/skills/jskit/references/typed-features.md +114 -247
  139. package/patterns/feature-package/example/variations/customKnexRepository.js +0 -40
  140. package/reference/autogen/packages/json-rest-api-core.md +0 -66
  141. package/skills/jskit/references/heuristics/crud-repository-mapping.md +0 -140
  142. package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/src/server/BooksFeature.js +0 -13
  143. package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/src/shared/bookResource.js +0 -83
  144. package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/src/shared/index.js +0 -1
  145. package/skills/jskit/references/patterns/crud/resource-contract/PATTERN.md +0 -155
  146. package/skills/jskit/references/patterns/crud/resource-contract/example/bookResource.js +0 -87
  147. package/skills/jskit/references/patterns/server/feature-package/example/variations/customKnexRepository.js +0 -40
  148. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/shared/userResource.js +0 -69
  149. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/shared/userResource.js +0 -56
  150. /package/skills/jskit/references/patterns/crud/{json-api-resource-package → crud-feature-package}/example/migrations/20260815000000_books.cjs +0 -0
  151. /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, feature, json-rest, knex, orchestration, package, provider, repository, routes, server
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 an explicit custom Knex repository for a domain that
21
- cannot fit the normal resource APIs.
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 resource patterns when ordinary resource
27
- operations fit. Do not select custom Knex merely because SQL is familiar; it
28
- is an explicit exception for persistence behavior the higher-level APIs cannot
29
- express.
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 Knex client is database-runtime's `RuntimeKnex`.
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 repository owns persistence and accepts transaction/context options.
84
- - The normal persistence lane uses a public or documented high-level resource
85
- API; custom Knex is an explicit, reviewed exception.
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 custom persistence variation uses `createWithTransaction()` from
101
- `@jskit-ai/database-runtime/shared`.
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` and
151
- `example/variations/customKnexRepository.js` show the explicit custom
152
- persistence lane. `example/variations/types.js` declares the
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 transaction and context forwarding.
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
 
@@ -5,7 +5,7 @@
5
5
  "private": true,
6
6
  "type": "module",
7
7
  "dependencies": {
8
- "@jskit-ai/kernel": "0.2.13",
8
+ "@jskit-ai/kernel": "0.2.14",
9
9
  "json-rest-schema": "^1.0.17"
10
10
  },
11
11
  "exports": {
@@ -1,19 +1,18 @@
1
1
  import { defineFeature } from "@jskit-ai/kernel/server/features";
2
- import { createInvoiceRollup } from "./customKnexRepository.js";
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
- requires: {
9
- database: "runtime.database"
10
- },
9
+ owns: [invoiceResource],
11
10
  provides: {
12
11
  invoiceRollup: "feature.invoice-rollup"
13
12
  },
14
- /** @param {{ database: import("@jskit-ai/database-runtime/server/types").RuntimeDatabase }} capabilities */
15
- setup({ database }) {
16
- return { invoiceRollup: createInvoiceRollup({ knex: database.knex }) };
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 ACTION_GET_ROLLUP_STATUS = "invoices.rollup.status.read";
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: ACTION_GET_ROLLUP_STATUS,
18
+ id: ACTION_READ_MONTHLY_TOTALS,
19
19
  input: emptyInputValidator,
20
20
  output: null,
21
- execute: (input, context) => invoiceRollup.getStatus(input, { context })
21
+ execute: (input, context) => invoiceRollup.totalsByMonth(input, { context })
22
22
  })
23
23
  ]);
24
24
  }
25
25
 
26
- export { ACTION_GET_ROLLUP_STATUS, createInvoiceRollupActions };
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("./customKnexRepository.js").createInvoiceRollup>} InvoiceRollup */
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.13",
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.13",
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.246",
53
- "@jskit-ai/jskit-catalog": "0.2.35",
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.13",
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.13",
48
- "@jskit-ai/shell-web": "0.2.16",
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.246",
54
- "@jskit-ai/jskit-catalog": "0.2.35",
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",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "description": "App-local runtime composition and lightweight glue.",
11
11
  "dependencies": {
12
- "@jskit-ai/kernel": "0.2.13"
12
+ "@jskit-ai/kernel": "0.2.14"
13
13
  },
14
14
  "jskit": {
15
15
  "kind": "runtime",
@@ -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