create-qpq-app 0.1.6 → 0.1.8

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 (79) hide show
  1. package/README.md +4 -4
  2. package/lib/commonjs/steps/013_printNextSteps.js +2 -2
  3. package/lib/commonjs/steps/013_printNextSteps.js.map +1 -1
  4. package/lib/esm/steps/013_printNextSteps.js +2 -2
  5. package/lib/esm/steps/013_printNextSteps.js.map +1 -1
  6. package/package.json +2 -2
  7. package/template/README.md +5 -5
  8. package/template/apps/qpqjs/bootstrap.qpq.ts +6 -0
  9. package/template/apps/qpqjs/services/design/views/src/components/LandingPage/components/Footer.tsx +3 -2
  10. package/template/apps/qpqjs/services/design/views/src/components/LandingPage/components/InstallChip.tsx +1 -1
  11. package/template/docusaurus/docs/actions/core/ai/ask-ai-prompt-stream.md +22 -2
  12. package/template/docusaurus/docs/actions/core/ai/ask-ai-prompt.md +10 -3
  13. package/template/docusaurus/docs/actions/core/array/ask-flat-map-parallel-batch.md +1 -1
  14. package/template/docusaurus/docs/actions/core/array/ask-map-parallel-batch.md +2 -2
  15. package/template/docusaurus/docs/actions/core/date/date-time-math.md +2 -2
  16. package/template/docusaurus/docs/actions/core/event/ask-process-event.md +1 -1
  17. package/template/docusaurus/docs/actions/core/file/ask-file-delete.md +3 -0
  18. package/template/docusaurus/docs/actions/core/file/ask-file-exists.md +3 -0
  19. package/template/docusaurus/docs/actions/core/file/ask-file-generate-temporary-secure-url.md +3 -0
  20. package/template/docusaurus/docs/actions/core/file/ask-file-generate-temporary-upload-secure-url.md +3 -0
  21. package/template/docusaurus/docs/actions/core/file/ask-file-is-cold-storage.md +3 -0
  22. package/template/docusaurus/docs/actions/core/file/ask-file-list-directory.md +4 -1
  23. package/template/docusaurus/docs/actions/core/file/ask-file-read-binary-contents.md +3 -0
  24. package/template/docusaurus/docs/actions/core/file/ask-file-read-object-json.md +5 -0
  25. package/template/docusaurus/docs/actions/core/file/ask-file-read-text-contents.md +4 -0
  26. package/template/docusaurus/docs/actions/core/file/ask-file-stream-open.md +3 -0
  27. package/template/docusaurus/docs/actions/core/file/ask-file-write-binary-contents.md +3 -0
  28. package/template/docusaurus/docs/actions/core/file/ask-file-write-object-json.md +3 -0
  29. package/template/docusaurus/docs/actions/core/file/ask-file-write-text-contents.md +3 -0
  30. package/template/docusaurus/docs/actions/core/graph-database/ask-graph-database-internal-field-names.md +1 -1
  31. package/template/docusaurus/docs/actions/core/json/ask-decode-json.md +1 -0
  32. package/template/docusaurus/docs/actions/core/key-value-store/ask-key-value-store-delete.md +9 -1
  33. package/template/docusaurus/docs/actions/core/key-value-store/ask-key-value-store-get-all.md +9 -1
  34. package/template/docusaurus/docs/actions/core/key-value-store/ask-key-value-store-get.md +9 -1
  35. package/template/docusaurus/docs/actions/core/key-value-store/ask-key-value-store-query-single.md +3 -0
  36. package/template/docusaurus/docs/actions/core/key-value-store/ask-key-value-store-query.md +4 -1
  37. package/template/docusaurus/docs/actions/core/key-value-store/ask-key-value-store-scan-all.md +2 -0
  38. package/template/docusaurus/docs/actions/core/key-value-store/ask-key-value-store-scan.md +12 -0
  39. package/template/docusaurus/docs/actions/core/key-value-store/ask-key-value-store-update-partial-properties.md +5 -1
  40. package/template/docusaurus/docs/actions/core/key-value-store/ask-key-value-store-update.md +9 -1
  41. package/template/docusaurus/docs/actions/core/key-value-store/ask-key-value-store-upsert-with-retry.md +1 -1
  42. package/template/docusaurus/docs/actions/core/key-value-store/ask-key-value-store-upsert.md +3 -0
  43. package/template/docusaurus/docs/actions/core/network/ask-network-request.md +1 -1
  44. package/template/docusaurus/docs/actions/core/state/ask-reduce-state.md +1 -1
  45. package/template/docusaurus/docs/actions/core/state/ask-state-dispatch.md +1 -1
  46. package/template/docusaurus/docs/actions/core/stream/ask-stream-map.md +1 -1
  47. package/template/docusaurus/docs/actions/core/stream/ask-stream-process.md +2 -1
  48. package/template/docusaurus/docs/actions/core/system/ask-trace-story.md +66 -0
  49. package/template/docusaurus/docs/actions/core/user-directory/ask-user-directory-authenticate-user.md +3 -3
  50. package/template/docusaurus/docs/actions/core/user-directory/ask-user-directory-set-access-token.md +1 -0
  51. package/template/docusaurus/docs/actions/features/event-doc/ask-apply-event-doc-event.md +47 -0
  52. package/template/docusaurus/docs/actions/features/event-doc/ask-event-doc-event-append.md +1 -0
  53. package/template/docusaurus/docs/actions/features/event-doc-ai/ask-event-doc-ai-process-send.md +11 -8
  54. package/template/docusaurus/docs/actions/features/web-socket-queue/_category_.json +1 -0
  55. package/template/docusaurus/docs/actions/{webserver/service → features/web-socket-queue}/ask-service-request.md +4 -3
  56. package/template/docusaurus/docs/actions/webserver/generic-data-resource/ask-put-generic-data-resource.md +4 -0
  57. package/template/docusaurus/docs/actions/webserver/generic-data-resource/ask-scan-generic-data-resource.md +4 -0
  58. package/template/docusaurus/docs/actions/webserver/websocket/ask-websocket-send-message.md +2 -2
  59. package/template/docusaurus/docs/architecture-overview.md +2 -0
  60. package/template/docusaurus/docs/config/config-aws/bootstrap-waf.md +36 -0
  61. package/template/docusaurus/docs/config/core/action-processors.md +24 -2
  62. package/template/docusaurus/docs/config/core/ai.md +5 -5
  63. package/template/docusaurus/docs/config/core/bundle-options.md +102 -0
  64. package/template/docusaurus/docs/config/core/global.md +1 -1
  65. package/template/docusaurus/docs/config/core/queue.md +1 -1
  66. package/template/docusaurus/docs/config/features/admin-settings.md +4 -7
  67. package/template/docusaurus/docs/config/features/event-doc-routes.md +2 -0
  68. package/template/docusaurus/docs/config/features/event-doc.md +2 -0
  69. package/template/docusaurus/docs/config/{webserver → features}/state-dispatch-over-websockets.md +2 -2
  70. package/template/docusaurus/docs/config/features/tenant-stores.md +80 -0
  71. package/template/docusaurus/docs/config/features/tenant.md +81 -0
  72. package/template/docusaurus/docs/config/features/tenanted-event-doc.md +51 -0
  73. package/template/docusaurus/docs/config/features/tenanted-web-socket-queue.md +52 -0
  74. package/template/docusaurus/docs/config/{webserver → features}/web-socket-queue.md +11 -8
  75. package/template/docusaurus/docs/config/webserver/websocket.md +3 -3
  76. package/template/docusaurus/docs/getting-started.md +93 -754
  77. package/template/docusaurus/docs/index.md +7 -2
  78. package/template/package.json +4 -12
  79. package/template/docusaurus/docs/actions/webserver/service/_category_.json +0 -1
@@ -0,0 +1,52 @@
1
+ ---
2
+ title: defineTenantedWebSocketQueue
3
+ description: A defineWebSocketQueue with the tenant scope resolution pre-wired as the connection scope resolver.
4
+ ---
5
+
6
+ # defineTenantedWebSocketQueue
7
+
8
+ A [defineWebSocketQueue](./web-socket-queue.md) with tenant scope resolution pre-wired as its `connectionScopeResolver`: a tenant id claimed in the WebSocket Authenticate handshake is membership-checked before it is stored, and a handshake with no claim stores the user's own personal scope instead of leaving the connection unscoped. It takes the same arguments as `defineWebSocketQueue` minus `connectionScopeResolver`, which it fills in for you.
9
+
10
+ The deploying service must still register the resolver implementation by calling [defineTenant](./tenant.md) (with the same `owner` used everywhere else).
11
+
12
+ ```typescript
13
+ import { defineTenantedWebSocketQueue, defineTenant } from 'quidproquo-features';
14
+
15
+ export default [
16
+ ...defineTenant({
17
+ owner: { module: 'ca' },
18
+ basePath: '/tenants',
19
+ routeAuthSettings: { userDirectoryName: 'users' },
20
+ }),
21
+
22
+ defineTenantedWebSocketQueue('my-event-bus', 'api', 'example.com', {
23
+ userDirectoryName: 'users',
24
+ }),
25
+ ];
26
+ ```
27
+
28
+ ## Signature
29
+
30
+ ```typescript
31
+ function defineTenantedWebSocketQueue(
32
+ eventBusName: string,
33
+ apiName: string,
34
+ rootDomain: string,
35
+ advancedSettings?: QPQConfigAdvancedTenantedWebsocketQueueSettings,
36
+ ): QPQConfig;
37
+ ```
38
+
39
+ `QPQConfigAdvancedTenantedWebsocketQueueSettings` is `QPQConfigAdvancedWebsocketQueueSettings` with `connectionScopeResolver` omitted — see [defineWebSocketQueue](./web-socket-queue.md#advancedsettings--qpqconfigadvancedwebsocketqueuesettings-optional) for the remaining options.
40
+
41
+ ## Parameters
42
+
43
+ Same as [defineWebSocketQueue](./web-socket-queue.md#parameters): `eventBusName`, `apiName`, `rootDomain`, and `advancedSettings` (without `connectionScopeResolver`, which this always sets to `TENANT_CONNECTION_SCOPE_RESOLVER_FN`).
44
+
45
+ ## Returns
46
+
47
+ Same as [defineWebSocketQueue](./web-socket-queue.md#returns) — a `QPQConfig` array with the connection-scope resolver already pointed at the tenant scope resolution.
48
+
49
+ ## Related
50
+
51
+ - [defineWebSocketQueue](./web-socket-queue.md) — the underlying define this pre-configures.
52
+ - [defineTenant](./tenant.md) — registers `TENANT_CONNECTION_SCOPE_RESOLVER_FN` (the inline function this wires in by name) plus the rest of the tenant setup.
@@ -5,15 +5,15 @@ description: Define a managed WebSocket messaging layer — connection tracking,
5
5
 
6
6
  # defineWebSocketQueue
7
7
 
8
- Defines a **WebSocket queue**: a batteries-included messaging layer on top of a raw [WebSocket API](./websocket.md). Where [defineWebsocket](./websocket.md) hands you the bare `$connect`/`$disconnect`/`$default` hooks, `defineWebSocketQueue` supplies those handlers for you and wires in a built-in service that tracks live connections, authenticates clients, and exchanges typed client/server messages (ping/pong, authenticate, service request/response, state dispatch). Inbound frames are routed by message type, and outbound messages fan out to the connections registered for a user.
8
+ Defines a **WebSocket queue**: a batteries-included messaging layer on top of a raw [WebSocket API](../webserver/websocket.md). Where [defineWebsocket](../webserver/websocket.md) hands you the bare `$connect`/`$disconnect`/`$default` hooks, `defineWebSocketQueue` supplies those handlers for you and wires in a built-in service that tracks live connections, authenticates clients, and exchanges typed client/server messages (ping/pong, authenticate, service request/response, state dispatch). Inbound frames are routed by message type, and outbound messages fan out to the connections registered for a user.
9
9
 
10
10
  - **On AWS:** this define expands into several config settings, each deploying its own infrastructure:
11
- - a [WebSocket API](./websocket.md) (API Gateway v2 WebSocket API + Lambda) whose connect/disconnect/message handlers are the queue's built-in service entry points;
11
+ - a [WebSocket API](../webserver/websocket.md) (API Gateway v2 WebSocket API + Lambda) whose connect/disconnect/message handlers are the queue's built-in service entry points;
12
12
  - a [key-value store](../core/key-value-store.md) (DynamoDB table) named `qpq-wsq-<apiName>`, keyed by `id` with a `userId` index, that records each live connection so messages can be addressed to a user's connections;
13
- - two [globals](../core/global.md) recording the associated event-bus name and user-directory name.
13
+ - three [globals](../core/global.md) recording the associated event-bus name, user-directory name, and connection-scope-resolver name.
14
14
 
15
15
  ```typescript
16
- import { defineWebSocketQueue } from 'quidproquo-webserver';
16
+ import { defineWebSocketQueue } from 'quidproquo-features';
17
17
 
18
18
  export default [
19
19
  defineWebSocketQueue('my-event-bus', 'api', 'example.com', {
@@ -24,7 +24,7 @@ export default [
24
24
 
25
25
  ## How it relates to defineWebsocket
26
26
 
27
- `defineWebSocketQueue` **calls** [defineWebsocket](./websocket.md) internally — you do not need to declare one yourself. It passes its own service handlers as the `eventProcessors`:
27
+ `defineWebSocketQueue` **calls** [defineWebsocket](../webserver/websocket.md) internally — you do not need to declare one yourself. It passes its own service handlers as the `eventProcessors`:
28
28
 
29
29
  | Route | Handler wired by the queue |
30
30
  | --- | --- |
@@ -59,7 +59,7 @@ Logical name of the WebSocket API. Drives the resource names of the deployed API
59
59
 
60
60
  ### `rootDomain` — `string` (required)
61
61
 
62
- The registered domain the WebSocket API is served under (passed straight through to the underlying [defineWebsocket](./websocket.md)).
62
+ The registered domain the WebSocket API is served under (passed straight through to the underlying [defineWebsocket](../webserver/websocket.md)).
63
63
 
64
64
  ### `advancedSettings` — `QPQConfigAdvancedWebsocketQueueSettings` (optional)
65
65
 
@@ -67,22 +67,25 @@ The registered domain the WebSocket API is served under (passed straight through
67
67
  export interface QPQConfigAdvancedWebsocketQueueSettings extends QPQConfigAdvancedSettings {
68
68
  owner?: CrossModuleOwnerWithNoResourceOverride;
69
69
  userDirectoryName?: string;
70
+ connectionScopeResolver?: string;
70
71
  }
71
72
  ```
72
73
 
73
74
  | Property | Type | Default | Description |
74
75
  | --- | --- | --- | --- |
75
76
  | `userDirectoryName` | `string` | `''` | Name of the [user directory](../core/user-directory.md) used to authenticate clients (stored in the `qpq-wsq-kvs-name-<apiName>` global). Enables the authenticate client/server message flow. |
77
+ | `connectionScopeResolver` | `string` | `''` | Name of a registered [inline function](../core/inline-function.md) invoked with `{ userId, requestedScope }` on **every** Authenticate message, whether or not it claims a storage scope (stored in the `qpq-wsq-scope-resolver-<apiName>` global). It returns the effective scope to store on the connection (e.g. a membership-checked tenant scope for a claim, or the user's own scope for no claim), or throws to reject the authenticate. A scope claim with no resolver configured is rejected outright, leaving the connection unauthenticated. |
76
78
  | `owner` | `CrossModuleOwnerWithNoResourceOverride` | – | Declares the queue's resources as owned by another module/service, so this service references them instead of deploying its own. Applied to both the WebSocket API and the connection store. |
77
79
  | `deprecated` | `boolean` | `false` | Inherited from `QPQConfigAdvancedSettings`; when set, the underlying WebSocket API is not deployed. |
78
80
 
79
81
  ## Returns
80
82
 
81
- A `QPQConfig` array containing: two globals, the connection [key-value store](../core/key-value-store.md), and the [WebSocket API](./websocket.md) with the queue's built-in handlers.
83
+ A `QPQConfig` array containing: three globals, the connection [key-value store](../core/key-value-store.md), and the [WebSocket API](./websocket.md) with the queue's built-in handlers.
82
84
 
83
85
  ## Related
84
86
 
85
- - [defineWebsocket](./websocket.md) — the raw WebSocket API this define builds on and configures for you.
87
+ - [defineWebsocket](../webserver/websocket.md) — the raw WebSocket API this define builds on and configures for you.
86
88
  - [defineStateDispatchOverWebsockets](./state-dispatch-over-websockets.md) — routes core State-domain dispatches to clients through this queue.
89
+ - [defineTenantedWebSocketQueue](./tenanted-web-socket-queue.md) — this define with the tenant connection-scope resolver pre-wired.
87
90
  - [askWebsocketSendMessage](../../actions/webserver/websocket/ask-websocket-send-message.md) — send a raw message to a connection on the queue's API.
88
91
  - [defineEventBus](../core/event-bus.md), [defineKeyValueStore](../core/key-value-store.md), [defineUserDirectory](../core/user-directory.md) — the underlying resources it depends on.
@@ -101,10 +101,10 @@ A `WebSocketQPQWebServerConfigSetting` config setting (`configSettingType: WebSo
101
101
 
102
102
  ## Notes
103
103
 
104
- - `defineWebsocket` gives you the raw connect/disconnect/message hooks. If you want a batteries-included messaging layer — connection tracking, authentication, ping/pong, and typed client/server messages — use [defineWebSocketQueue](./web-socket-queue.md), which wires those three handlers to a built-in service for you.
104
+ - `defineWebsocket` gives you the raw connect/disconnect/message hooks. If you want a batteries-included messaging layer — connection tracking, authentication, ping/pong, and typed client/server messages — use [defineWebSocketQueue](../features/web-socket-queue.md), which wires those three handlers to a built-in service for you.
105
105
 
106
106
  ## Related
107
107
 
108
- - [defineWebSocketQueue](./web-socket-queue.md) — a higher-level WebSocket setup that provides `eventProcessors` for you and manages connections and messaging.
109
- - [defineStateDispatchOverWebsockets](./state-dispatch-over-websockets.md) — pushes core State-domain dispatches to clients over the WebSocket queue.
108
+ - [defineWebSocketQueue](../features/web-socket-queue.md) — a higher-level WebSocket setup that provides `eventProcessors` for you and manages connections and messaging.
109
+ - [defineStateDispatchOverWebsockets](../features/state-dispatch-over-websockets.md) — pushes core State-domain dispatches to clients over the WebSocket queue.
110
110
  - [askWebsocketSendMessage](../../actions/webserver/websocket/ask-websocket-send-message.md) — send a message to a connected client by `connectionId`.