@jskit-ai/agent-docs 0.1.264 → 0.1.266
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-conversation.md +11 -2
- package/guide/agent/app-setup/multi-homing.md +5 -3
- package/guide/agent/framework/translation.md +56 -10
- package/package.json +1 -1
- package/patterns/feature-package/example/booking-engine/package.json +1 -1
- package/patterns/minimal-foundation/example/package.json +3 -3
- package/patterns/shell-foundation/example/package.json +4 -4
- package/patterns/shell-foundation/example/packages/main/package.json +1 -1
- package/reference/autogen/PATTERN_INDEX.md +37 -37
- package/reference/autogen/packages/assistant-core.md +5 -3
- package/reference/autogen/packages/auth-core.md +4 -1
- package/reference/autogen/packages/http-web.md +1 -1
- package/reference/autogen/packages/oidc-issuer-core.md +23 -4
- package/reference/autogen/packages/resource-crud-core.md +2 -1
- package/reference/autogen/packages/users-web.md +26 -0
- package/reference/autogen/packages/workspaces-core.md +2 -1
- package/skills/jskit/references/multi-homing.md +5 -3
- package/skills/jskit/references/pattern-index.md +37 -37
- package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +3 -3
- package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +4 -4
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
- package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +2 -2
- 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/json-api-resource-package/example/packages/books/package.json +2 -2
- package/skills/jskit/references/patterns/database/mysql-application/example/package.json +1 -1
- package/skills/jskit/references/patterns/database/postgres-application/example/package.json +1 -1
- package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +2 -2
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +3 -3
- package/skills/jskit/references/translation.md +56 -10
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"./shared": "./src/shared/index.js"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@jskit-ai/crud-core": "0.2.
|
|
14
|
-
"@jskit-ai/resource-crud-core": "0.1.
|
|
13
|
+
"@jskit-ai/crud-core": "0.2.6",
|
|
14
|
+
"@jskit-ai/resource-crud-core": "0.1.197"
|
|
15
15
|
},
|
|
16
16
|
"jskit": {
|
|
17
17
|
"kind": "runtime",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"./shared": "./src/shared/index.js"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@jskit-ai/crud-core": "0.2.
|
|
14
|
-
"@jskit-ai/resource-crud-core": "0.1.
|
|
15
|
-
"@jskit-ai/workspaces-core": "0.2.
|
|
13
|
+
"@jskit-ai/crud-core": "0.2.6",
|
|
14
|
+
"@jskit-ai/resource-crud-core": "0.1.197",
|
|
15
|
+
"@jskit-ai/workspaces-core": "0.2.7"
|
|
16
16
|
},
|
|
17
17
|
"jskit": {
|
|
18
18
|
"kind": "runtime",
|
|
@@ -135,6 +135,9 @@ the English `message`:
|
|
|
135
135
|
values and render from `jskit.errors.<code>`.
|
|
136
136
|
- Validation errors keep `details.fieldErrors` (English) and add
|
|
137
137
|
`details.fieldErrorCodes: { field: { code, params } }`.
|
|
138
|
+
- A schema's field `messages` may give a message as a string or as
|
|
139
|
+
`{ code, message, params }` (see below); the coded form travels as that
|
|
140
|
+
field's code.
|
|
138
141
|
- Where one code covers several different sentences (for example
|
|
139
142
|
`connector_input_invalid`), the response also has `messageCode` and
|
|
140
143
|
`messageParams` for the exact sentence.
|
|
@@ -164,6 +167,33 @@ throw new AppError(409, "That slug is taken.", { code: "app.project.slugTaken" }
|
|
|
164
167
|
// en: { jskit: { app: { project: { slugTaken: "That slug is taken." } } } }
|
|
165
168
|
```
|
|
166
169
|
|
|
170
|
+
### Field messages in schemas
|
|
171
|
+
|
|
172
|
+
A field's `messages` in a resource or command schema map a validation keyword
|
|
173
|
+
(or `default`) to the message shown when that check fails. A plain string is
|
|
174
|
+
sent as written and is never translated. To make it translatable, give the
|
|
175
|
+
coded form instead: the code, the English (exactly the catalog's English with
|
|
176
|
+
the params filled in) and any params.
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
const NAME_MESSAGES = Object.freeze({
|
|
180
|
+
required: { code: "app.project.nameRequired", message: "Name is required." },
|
|
181
|
+
maxLength: { code: "app.project.nameTooLong", message: "Use at most 80 characters.", params: { max: 80 } }
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
const schema = {
|
|
185
|
+
name: { type: "string", required: true, maxLength: 80, messages: NAME_MESSAGES }
|
|
186
|
+
};
|
|
187
|
+
// en: { jskit: { app: { project: {
|
|
188
|
+
// nameRequired: "Name is required.", nameTooLong: "Use at most {max} characters." } } } }
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
The server still sends the English in `details.fieldErrors` and adds the code
|
|
192
|
+
and params to `details.fieldErrorCodes`, so an untranslated app shows exactly
|
|
193
|
+
the English it showed before. The failed check's own params (for example
|
|
194
|
+
`limit`) are sent too, and the coded entry's `params` win over them. JSKIT's
|
|
195
|
+
own schemas use this form, which is why their field messages translate.
|
|
196
|
+
|
|
167
197
|
## Placement labels
|
|
168
198
|
|
|
169
199
|
A placement `label` or `title` may be a message key, `{ key, fallback, params }`
|
|
@@ -186,12 +216,21 @@ App code can use the same helpers from `useJskitText()`: `formatDate`,
|
|
|
186
216
|
|
|
187
217
|
## Emails
|
|
188
218
|
|
|
189
|
-
The
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
219
|
+
The server reads the same `src/locales/<code>/jskit.json` files the client
|
|
220
|
+
uses, so translating a JSKIT email's keys there translates the email too. It
|
|
221
|
+
looks for the exact locale (`it-IT`), then the language (`it`), then English.
|
|
222
|
+
|
|
223
|
+
- The workspace invitation email (`jskit.workspaces.inviteEmail.*`) is rendered
|
|
224
|
+
in the recipient's saved `user_settings.locale` when the recipient already
|
|
225
|
+
has an account, and in English otherwise. Its expiry date is written with
|
|
226
|
+
`Intl` in that locale and the recipient's saved time zone (UTC otherwise).
|
|
227
|
+
The app's invite mailer also receives the chosen `locale`.
|
|
228
|
+
- JSKIT's accounts hub (`@jskit-ai/oidc-issuer-core`) sends the account
|
|
229
|
+
confirmation, password recovery, Google link and test emails itself, from
|
|
230
|
+
`jskit.accounts.*`. Hub accounts keep no saved language, so each email
|
|
231
|
+
follows the request that sent it: the app's `ui_locales`, then the browser's
|
|
232
|
+
`Accept-Language`, then English. The hub reads the hub project's
|
|
233
|
+
`src/locales/<code>/jskit.json`; its README has the details.
|
|
195
234
|
|
|
196
235
|
Server code that renders JSKIT-style messages itself uses the same lookup:
|
|
197
236
|
|
|
@@ -202,9 +241,10 @@ const i18n = createServerI18n({ appRoot, catalogs: [english] });
|
|
|
202
241
|
i18n.t("it-IT", "jskit.workspaces.inviteEmail.subject", { workspace: "Acme" });
|
|
203
242
|
```
|
|
204
243
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
244
|
+
An app that signs in through JSKIT's accounts hub gets its password-reset
|
|
245
|
+
email from the hub, translated as above. With another identity provider
|
|
246
|
+
(Supabase, a third-party OIDC issuer) the provider sends it, so its language is
|
|
247
|
+
the provider's choice.
|
|
208
248
|
|
|
209
249
|
## What the app translates itself
|
|
210
250
|
|
|
@@ -223,6 +263,12 @@ JSKIT's catalogs cover JSKIT's own code. These texts belong to the app:
|
|
|
223
263
|
|
|
224
264
|
Each JSKIT package with a catalog has a test that compiles every message with
|
|
225
265
|
vue-i18n, requires every key and dotted code its source uses to exist, rejects
|
|
226
|
-
unused keys and refuses a key another package already defines.
|
|
266
|
+
unused keys and refuses a key another package already defines. It also requires
|
|
267
|
+
an undotted code sent with fixed English to have its `jskit.errors.<code>`
|
|
268
|
+
entry (or a `messageCode`), and a literal `{ code, message }` to send its
|
|
269
|
+
catalog's English. A browser test exports a pseudo-locale with
|
|
270
|
+
`jskit i18n export`, switches a fixture app to it, and fails on any English left
|
|
271
|
+
on the sign-in, registration, password reset, sign-out, profile menu, account
|
|
272
|
+
settings and error screens. ESLint's
|
|
227
273
|
`@intlify/vue-i18n/no-raw-text` rule rejects untranslated template text in JSKIT
|
|
228
274
|
client code.
|