@quartal/messages-client 0.0.0-stage → 0.2.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Quartal Accounting Software Oy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,37 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # @quartal/messages-client
2
+
3
+ The browser SDK of the **Quartal Messages API**. `MessagesApi` bundles every resource the UI reads
4
+ and writes — channels and their listed companies, threads, messages, channel agents, the model /
5
+ agent / skill catalog, companies and the signed-in user — plus the live event stream
6
+ (`POST /events`, Server-Sent Events), all over HTTP with the user's bearer token. The API's access
7
+ rules decide what each call sees.
8
+
9
+ A pnpm workspace package of this repo (`workspace:*`); it is not published.
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { MessagesApi } from '@quartal/messages-client';
15
+
16
+ const api = new MessagesApi('http://localhost:8002', () => currentAccessToken());
17
+
18
+ const channels = await api.channels.getOData({ $filter: { advisory } });
19
+ const threads = await api.threads.list('salaxy-payroll');
20
+ await api.messages.create(threads[0].id, [{ id: crypto.randomUUID(), type: 'text', text: 'Hei', state: 'active' }]);
21
+
22
+ const stop = api.events.subscribe((event) => {
23
+ if (event.type === 'message') console.log(event.message.threadId, event.message.parts);
24
+ });
25
+ ```
26
+
27
+ The catalog and channel resources (`channels`, `models`, `agents`, `skills`) keep the
28
+ `ICrudApiBase` shape: `getBlank` and `validate` run locally, the API validates again on write.
29
+ Failed calls reject with an `ApiError` carrying the HTTP status and the API's message.
30
+
31
+ `loadClientConfig()` reads the browser settings (`VITE_MESSAGES_API_URL`, `VITE_OIDC_*`,
32
+ `VITE_IAM_API_URL`); `@quartal/ui-messages` uses it to create the shared client.
33
+
34
+ The CRUD shapes (`ApiCrudItem`, `ODataResult`, `ValidationResult`, …) come from
35
+ [`@quartal/core`](https://www.npmjs.com/package/@quartal/core) — import them from there. Only
36
+ `ODataQuery` is re-defined here, with its `$filter` typed as a domain-shaped object instead of an
37
+ OData filter string.