@jskit-ai/agent-docs 0.1.398 → 0.1.400

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 (46) hide show
  1. package/guide/agent/app-extras/assistant-conversation.md +4 -1
  2. package/guide/agent/app-setup/users.md +32 -0
  3. package/guide/agent/framework/client-features.md +124 -0
  4. package/package.json +1 -1
  5. package/patterns/feature-package/example/booking-engine/package.json +1 -1
  6. package/patterns/minimal-foundation/example/package.json +4 -4
  7. package/patterns/shell-foundation/example/package.json +5 -5
  8. package/patterns/shell-foundation/example/packages/main/package.json +1 -1
  9. package/patterns/shell-foundation/example/src/pages/home/index.vue +2 -1
  10. package/reference/autogen/PATTERN_INDEX.md +47 -47
  11. package/reference/autogen/packages/assistant-voice.md +1 -1
  12. package/reference/autogen/packages/auth-provider-local-core.md +8 -1
  13. package/reference/autogen/packages/auth-provider-local-db-core.md +1 -0
  14. package/reference/autogen/packages/auth-web.md +4 -2
  15. package/reference/autogen/packages/http-runtime.md +2 -0
  16. package/reference/autogen/packages/http-web.md +3 -3
  17. package/reference/autogen/packages/kernel.md +1 -1
  18. package/reference/autogen/packages/mobile-capacitor.md +7 -4
  19. package/reference/autogen/packages/push-core.md +8 -0
  20. package/reference/autogen/packages/shell-web.md +1 -1
  21. package/reference/autogen/packages/store-purchases-core.md +8 -0
  22. package/reference/autogen/packages/uploads-image-web.md +1 -1
  23. package/reference/autogen/packages/users-core.md +4 -2
  24. package/reference/autogen/packages/users-web.md +7 -0
  25. package/reference/autogen/tooling/config-eslint.md +36 -0
  26. package/reference/autogen/tooling/jskit-catalog.md +12 -0
  27. package/skills/jskit/references/client-features.md +124 -0
  28. package/skills/jskit/references/pattern-index.md +47 -47
  29. package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +4 -4
  30. package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +5 -5
  31. package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
  32. package/skills/jskit/references/patterns/app/shell-foundation/example/src/pages/home/index.vue +2 -1
  33. package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +3 -3
  34. package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
  35. package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
  36. package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +5 -5
  37. package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/package.json +3 -3
  38. package/skills/jskit/references/patterns/database/mysql-application/example/package.json +2 -2
  39. package/skills/jskit/references/patterns/database/postgres-application/example/package.json +2 -2
  40. package/skills/jskit/references/patterns/mobile/ios-application/example/package.json +1 -1
  41. package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
  42. package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
  43. package/skills/jskit/references/patterns/shell/application-shell/PATTERN.md +1 -1
  44. package/skills/jskit/references/patterns/shell/application-shell/example/src/pages/home/index.vue +2 -1
  45. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +3 -3
  46. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +6 -6
@@ -104,10 +104,18 @@ Exports
104
104
 
105
105
  ### migrations
106
106
 
107
+ ### `migrations/store_purchases_intents-collation.cjs`
108
+ Exports
109
+ - None
110
+
107
111
  ### `migrations/store_purchases_intents.cjs`
108
112
  Exports
109
113
  - None
110
114
 
115
+ ### `migrations/store_purchases_ledger-collation.cjs`
116
+ Exports
117
+ - None
118
+
111
119
  ### `migrations/store_purchases_ledger.cjs`
112
120
  Exports
113
121
  - None
@@ -22,7 +22,7 @@ Local functions
22
22
 
23
23
  ### `src/client/composables/createManagedImageAssetRuntime.js`
24
24
  Exports
25
- - `createManagedImageAssetRuntime({ uploadEndpoint = "", deleteEndpoint = "", fieldName = "file", hasAsset = false, assetVersion = "", selectedFileName = ref(""), resolveAssetUrl = assetUrlFromUploadEndpoint, resolveRequestHeaders, onUploadSuccess, onDeleteSuccess = ignoreDeleteSuccess, resolveUploadErrorMessage = keepDefaultMessage, resolveDeleteErrorMessage = keepDefaultMessage, deleteRequest = requestDeleteWithFetch, reportFeedback, messages = {}, uploadOptions = {}, deleteMethod = "DELETE", source = "uploads-image-web.managed-image-asset", dependencies: { createImageUploadRuntimeFactory = createImageUploadRuntime, fetchImpl = globalThis.fetch.bind(globalThis) } = {} })`
25
+ - `createManagedImageAssetRuntime({ uploadEndpoint = "", deleteEndpoint = "", fieldName = "file", hasAsset = false, assetVersion = "", selectedFileName = ref(""), resolveAssetUrl = assetUrlFromUploadEndpoint, resolveRequestHeaders, onUploadSuccess, onDeleteSuccess = ignoreDeleteSuccess, resolveUploadErrorMessage = keepDefaultMessage, resolveDeleteErrorMessage = keepDefaultMessage, deleteRequest = requestDeleteWithFetch, reportFeedback, messages = {}, uploadOptions = {}, deleteMethod = "DELETE", source = "uploads-image-web.managed-image-asset", dependencies: { createImageUploadRuntimeFactory = createImageUploadRuntime, fetchImpl = appFetch } = {} })`
26
26
  - `DEFAULT_MANAGED_IMAGE_ASSET_MESSAGES`
27
27
  Local functions
28
28
  - `readJsonResponse(response)`
@@ -63,7 +63,9 @@ Local functions
63
63
 
64
64
  ### `src/server/accountSecurity/accountSecurityActions.js`
65
65
  Exports
66
+ - `ACTION_DELETE_ACCOUNT`
66
67
  - `createAccountSecurityActions({ accountSecurityService })`
68
+ - `deleteAccountInputValidator`
67
69
 
68
70
  ### `src/server/accountSecurity/accountSecurityRoutes.js`
69
71
  Exports
@@ -71,7 +73,7 @@ Exports
71
73
 
72
74
  ### `src/server/accountSecurity/accountSecurityService.js`
73
75
  Exports
74
- - `createService({ userSettingsRepository, userProfilesRepository, authService })`
76
+ - `createService({ userSettingsRepository, userProfilesRepository, authService, events })`
75
77
 
76
78
  ### `src/server/common/formatters/accountAvatarFormatter.js`
77
79
  Exports
@@ -204,7 +206,7 @@ Exports
204
206
 
205
207
  ### `src/server/usersRuntime.js`
206
208
  Exports
207
- - `createUsersRuntime({ authService, profileProjector, profiles: userProfilesRepository, settings: userSettingsRepository, storage })`
209
+ - `createUsersRuntime({ authService, profileProjector, profiles: userProfilesRepository, settings: userSettingsRepository, storage, events })`
208
210
 
209
211
  ### `src/shared/index.js`
210
212
  Exports
@@ -14,6 +14,13 @@ Use this on demand; do not load the full index at startup.
14
14
 
15
15
  ### src
16
16
 
17
+ ### `src/client/account-settings/DeleteAccountSection.vue`
18
+ Exports
19
+ - None
20
+ Local functions
21
+ - `request(body)`
22
+ - `deleteAccount()`
23
+
17
24
  ### `src/client/account-settings/sections.js`
18
25
  Exports
19
26
  - `ACCOUNT_SETTINGS_SECTION_TARGET`
@@ -124,7 +124,9 @@ Exports
124
124
  - `clientSourceFiles(directory, files = [])`
125
125
  - `createSourceMemo(read, unreadable)`
126
126
  - `isGeneratedMirror(file)`
127
+ - `isJskitPackageFile(file)`
127
128
  - `isServerOrSharedFile(file, packageDirectory)`
129
+ - `packageNameOf(file)`
128
130
  - `packageRootOf(file)`
129
131
  - `packageSourceFiles(directory, files = [])`
130
132
  - `toPosixPath(file)`
@@ -319,6 +321,10 @@ Exports
319
321
  Local functions
320
322
  - `moduleDeclarations(program)`
321
323
 
324
+ ### `plugin/rules/noNativePluginImport.js`
325
+ Exports
326
+ - `noNativePluginImport`
327
+
322
328
  ### `plugin/rules/noOptionalAfterDefault.js`
323
329
  Exports
324
330
  - `noOptionalAfterDefault`
@@ -333,6 +339,22 @@ Local functions
333
339
  - `calleeName(node)`
334
340
  - `isConstructedError(node)`
335
341
 
342
+ ### `plugin/rules/noRawNetwork.js`
343
+ Exports
344
+ - `noRawNetwork`
345
+ Local functions
346
+ - `globalReferences(globalScope, names)`
347
+
348
+ ### `plugin/rules/noServerPathString.js`
349
+ Exports
350
+ - `noServerPathString`
351
+ Local functions
352
+ - `browserUse(node)`
353
+
354
+ ### `plugin/rules/noServiceWorker.js`
355
+ Exports
356
+ - `noServiceWorker`
357
+
336
358
  ### `plugin/rules/noSlotSetter.js`
337
359
  Exports
338
360
  - `noSlotSetter`
@@ -430,6 +452,12 @@ Local functions
430
452
  - `rootIdentifier(expression)`
431
453
  - `hasFixedItems(attribute, bindings)`
432
454
 
455
+ ### `plugin/rules/serverPathBinding.js`
456
+ Exports
457
+ - `serverPathBinding`
458
+ Local functions
459
+ - `addressName(attribute)`
460
+
433
461
  ### `plugin/rules/sqlLiteral.js`
434
462
  Exports
435
463
  - `sqlLiteral`
@@ -450,6 +478,14 @@ Local functions
450
478
  - `isTypedInjection(sourceCode, call)`
451
479
  - `requiredOption(sourceCode, call)`
452
480
 
481
+ ### `plugin/serverPaths.js`
482
+ Exports
483
+ - `SERVER_ADDRESS_HELPERS`
484
+ - `SERVER_PATH`
485
+ - `calleeName(call)`
486
+ - `isServerPathLiteral(node)`
487
+ - `joinsServerPath(node)`
488
+
453
489
  ### `plugin/support.js`
454
490
  Exports
455
491
  - `ABSENT_DEFAULT`
@@ -479,6 +479,18 @@ Local functions
479
479
  - `findImports(root, packageIds)`
480
480
  - `approveInstallScripts(manifest, declared)`
481
481
 
482
+ ### `scripts/server-paths.mjs`
483
+ Exports
484
+ - `checkServerPaths({ projectRoot })`
485
+ - `formatServerPathsReport(result)`
486
+ Local functions
487
+ - `pageFiles(root, directory = root, files = [])`
488
+ - `sourceFiles(root)`
489
+ - `scriptRanges(text)`
490
+ - `fencedRanges(text)`
491
+ - `inside(ranges, offset)`
492
+ - `pageFindings(file, text)`
493
+
482
494
  ### `scripts/server-setup.mjs`
483
495
  Exports
484
496
  - `checkServerSetup({ projectRoot })`
@@ -623,13 +623,80 @@ another site's address.
623
623
  Why: a bundled app's page is not on the server's site, so a bare `"/api/..."`
624
624
  reaches nothing there, and only one resolver knows where the server is.
625
625
 
626
+ `jskit/no-server-path-string` reports a server path written in the code (a
627
+ string or template starting with `/api`) that goes to the browser as it is:
628
+ given to `location.assign`, `location.replace` or `window.open`, assigned to
629
+ `location`, `href`, `src` or `action`, resolved with `new URL`, set with
630
+ `setAttribute` as an address, or joined to an address by hand
631
+ (`${origin}/api/...`). A path given to the HTTP client, to `serverUrl()`, or
632
+ kept in a constant is fine: http-web resolves it.
633
+
626
634
  ```js
627
635
  // good
628
636
  import { serverUrl } from "@jskit-ai/http-web/client";
629
637
  const href = serverUrl(`/api/invoices/${id}/pdf`);
638
+ window.location.assign(serverUrl(`/api/exports/${id}`));
630
639
 
631
640
  // bad: works on the web, reaches nothing inside the app
632
641
  const href = `/api/invoices/${id}/pdf`;
642
+ window.location.assign(`/api/exports/${id}`);
643
+ ```
644
+
645
+ ### Network calls
646
+
647
+ **Client code reaches the server through http-web, never through the
648
+ browser's own network objects: `fetch`, `EventSource`, `WebSocket`,
649
+ `XMLHttpRequest` and `navigator.sendBeacon`.** Requests go through the HTTP
650
+ client (`getHttpWebClient().request`), streams through
651
+ `openEventStream` and `openWebSocket`.
652
+
653
+ Why: the browser's objects send the page's cookies on the web only. Inside a
654
+ Capacitor app the page is on another site: it sends no cookie and the
655
+ browser's objects carry no app token, so the call works in the browser and
656
+ fails on the phone. The HTTP client adds the app's token and refreshes it.
657
+
658
+ `jskit/no-raw-network` reports those globals wherever client code reaches
659
+ them, also read from `globalThis`, `window` or `self`, and also as a default
660
+ value (`fetchImpl = globalThis.fetch`). JSKIT's own helpers, which wrap them,
661
+ carry an exception with the reason. Code that must read a response itself
662
+ (its status, its headers) takes `appFetch` from
663
+ `@jskit-ai/http-runtime/client`: `fetch` on the web, and inside an app the
664
+ same request with the app's headers and token, no cookie, and one retry after
665
+ refreshing the tokens on a 401.
666
+
667
+ ```js
668
+ // good
669
+ import { getHttpWebClient, openEventStream } from "@jskit-ai/http-web/client";
670
+ const invoice = await getHttpWebClient().request(`/api/invoices/${id}`);
671
+ const progress = openEventStream(`/api/imports/${id}/events`);
672
+
673
+ // bad: signed in on the web, signed out inside the app
674
+ const invoice = await (await fetch(`/api/invoices/${id}`)).json();
675
+ const progress = new EventSource(`/api/imports/${id}/events`);
676
+ ```
677
+
678
+ ### Server addresses in templates
679
+
680
+ **A template's `src`, `href`, `action`, `poster`, `data`, `formaction` or
681
+ `srcset` that names a server path goes through `serverUrl()`, or `signedUrl()`
682
+ / `frameUrl()` when the server checks who asks.**
683
+
684
+ Why: the browser loads those addresses by itself, against the page's site,
685
+ which inside an app is the app.
686
+
687
+ `jskit/server-path-binding` reports such an attribute written with a server
688
+ path (`src="/api/..."`), or bound to an expression holding a server path that
689
+ none of the three helpers wraps. An address the script already resolved
690
+ (`:src="photoAddress"`) is the script's to get right.
691
+
692
+ ```vue
693
+ <!-- good -->
694
+ <img :src="serverUrl(`/api/photos/${photo.id}`)" />
695
+ <iframe :src="reportFrame" /> <!-- reportFrame = await frameUrl("/api/reports/embed") -->
696
+
697
+ <!-- bad: loads from the app inside the app -->
698
+ <img :src="`/api/photos/${photo.id}`" />
699
+ <a href="/api/report">Report</a>
633
700
  ```
634
701
 
635
702
  ### Streams, sockets and signed links
@@ -653,6 +720,10 @@ no `Authorization` header, and inside a Capacitor app no cookie either.
653
720
  stream goes without a ticket, as a public one does. Tickets live in the
654
721
  server's process, so a deployment of several servers routes a stream to the
655
722
  server that issued its ticket (sticky routing).
723
+ - `openWebSocket(path, { reconnect: false })` is one socket for a protocol that
724
+ recovers itself (assistant voice, with its own handshake): it signs in with a
725
+ ticket the same way, its `close` listeners hear it drop, nothing opens it
726
+ again, and `close(code, reason)` ends it.
656
727
  - `signedUrl(path, { ttl })` asks `POST /api/session/link` for a link to that
657
728
  server path, signed (HMAC) for this session and user: 5 minutes, at most an
658
729
  hour (`ttl` in seconds). It opens that path alone, by GET, and only while the
@@ -676,6 +747,54 @@ const src = await signedUrl(`/api/photos/${id}`);
676
747
  const source = new EventSource(`/api/imports/${id}/events`);
677
748
  ```
678
749
 
750
+ ### Service workers
751
+
752
+ **An application registers no service worker of its own: push-web registers
753
+ the page's one worker, which shows web push notifications.** What a worker
754
+ must do goes into push-web's worker.
755
+
756
+ Why: a page has one worker per scope, so a second registration replaces
757
+ push-web's and notifications stop; inside a Capacitor app no worker runs at
758
+ all.
759
+
760
+ `jskit/no-service-worker` reports `serviceWorker.register(...)` anywhere but in
761
+ `@jskit-ai/push-web`.
762
+
763
+ ```js
764
+ // good: push-web registers its worker when the person turns notifications on,
765
+ // from its settings section or usePushClient()
766
+ import { usePushClient } from "@jskit-ai/push-web/client";
767
+
768
+ // bad: replaces the worker that shows notifications
769
+ navigator.serviceWorker.register("/offline-worker.js");
770
+ ```
771
+
772
+ ### Device plugins
773
+
774
+ **An application reaches the phone through JSKIT's interfaces, registered as
775
+ client services (`mobile.secureStore`, `uploads.nativeSource`, `push.device`,
776
+ `storePurchases.device`, `mobile.sharedStore` and the rest), never by
777
+ importing a Capacitor plugin.** Each interface loads its plugin lazily, maps
778
+ its answers to JSKIT's shapes and errors, and answers "unavailable" on the
779
+ web.
780
+
781
+ Why: an imported plugin breaks the page on the web, answers differently from
782
+ one plugin version to the next, and stays linked into the app when the
783
+ feature that used it goes.
784
+
785
+ `jskit/no-native-plugin-import` reports an import of `@capacitor/*`,
786
+ `@capgo/*`, `@capawesome/*`, `@capacitor-mlkit/*` or `capacitor-widget-bridge`
787
+ (static, dynamic or re-exported) outside JSKIT's own packages. A plugin no
788
+ JSKIT interface wraps is imported with an exception naming what it is for.
789
+
790
+ ```js
791
+ // good: an upload field offers the camera through the uploads.nativeSource service
792
+ const [photo] = await nativeSource.pick("camera");
793
+
794
+ // bad
795
+ import { Camera } from "@capacitor/camera";
796
+ ```
797
+
679
798
  ### One helper per package
680
799
 
681
800
  **A pure helper exists once in a package and is imported; one the kernel owns
@@ -744,6 +863,11 @@ client-only rules below. The server's action and error rules do not apply.
744
863
  | `jskit/selection-field` | a `v-select`, `v-autocomplete` or `v-combobox` whose items are not fixed, and a `SelectField` whose items are not fixed that binds no `loading` | [Selection fields](#selection-fields) |
745
864
  | `jskit/search-on-server` | a `computed()` that filters a list composable's items by a search ref; an autocomplete over a list's items or a lookup's options without `no-filter` or an `update:search` handler | [Search on the server](#search-on-the-server) |
746
865
  | `jskit/request-recovery-label` | `requestRecoveryLabel` given to a screen read (`useList`, `useView`, `useAddEdit`, the CRUD composables) without `requestRecovery: true` | [Screen read failures](#screen-read-failures) |
866
+ | `jskit/no-raw-network` | `fetch`, `EventSource`, `WebSocket`, `XMLHttpRequest` or `navigator.sendBeacon` reached from client code | [Network calls](#network-calls) |
867
+ | `jskit/no-server-path-string` | a server path (`/api...`) given to the browser as it is: navigated to, assigned as an address, resolved with `new URL`, or joined to an address by hand | [Server paths](#server-paths) |
868
+ | `jskit/server-path-binding` | a template `src`, `href`, `action`, `poster`, `data`, `formaction` or `srcset` naming a server path outside `serverUrl()`, `signedUrl()` or `frameUrl()` | [Server addresses in templates](#server-addresses-in-templates) |
869
+ | `jskit/no-service-worker` | `serviceWorker.register(...)` outside `@jskit-ai/push-web` | [Service workers](#service-workers) |
870
+ | `jskit/no-native-plugin-import` | an import of a device plugin (`@capacitor/*`, `@capgo/*`, `@capawesome/*`, `@capacitor-mlkit/*`, `capacitor-widget-bridge`) outside JSKIT's packages | [Device plugins](#device-plugins) |
747
871
  | `vue/require-prop-types`, `vue/require-default-prop`, `vue/require-valid-default-prop`, `vue/no-required-prop-with-default` | a prop without a type, optional without a default, or both | [Collaborator props](#collaborator-props) |
748
872
  | `vue/require-explicit-emits` | an emitted event the component does not declare | [Declared emits](#declared-emits) |
749
873