@learnorama/mozaik-sdk 0.1.0-staging.11.1 → 0.1.0-staging.12.1

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 (83) hide show
  1. package/README.md +69 -2
  2. package/dist/api/account.d.ts +1 -1
  3. package/dist/api/admin-catalogue.d.ts +1 -1
  4. package/dist/api/admin-consumption.d.ts +1 -1
  5. package/dist/api/admin-patrons.d.ts +1 -1
  6. package/dist/api/admin-reviews.d.ts +1 -1
  7. package/dist/api/admin-support.d.ts +1 -1
  8. package/dist/api/admin-tutoring.d.ts +1 -1
  9. package/dist/api/auth.d.ts +1 -1
  10. package/dist/api/biblio-catalogue.d.ts +1 -1
  11. package/dist/api/biblio-home.d.ts +1 -1
  12. package/dist/api/biblio-library.d.ts +1 -1
  13. package/dist/api/biblio-nextory.d.ts +1 -1
  14. package/dist/api/biblio-press.d.ts +1 -1
  15. package/dist/api/consumption.d.ts +1 -1
  16. package/dist/api/cvs-app.d.ts +1 -1
  17. package/dist/api/cvs-documents.d.ts +1 -1
  18. package/dist/api/cvs-favorites.d.ts +1 -1
  19. package/dist/api/cvs-loans.d.ts +1 -1
  20. package/dist/api/cvs-payments.d.ts +49 -0
  21. package/dist/api/cvs-payments.js +84 -0
  22. package/dist/api/cvs-payments.js.map +1 -0
  23. package/dist/api/index.d.ts +2 -1
  24. package/dist/api/index.js +3 -2
  25. package/dist/api/partner-catalogue.d.ts +1 -1
  26. package/dist/api/partner-reader.d.ts +1 -1
  27. package/dist/api/tutoring-catalogue.d.ts +1 -1
  28. package/dist/api/tutoring-chat.d.ts +1 -1
  29. package/dist/api/tutoring-dispatch.d.ts +1 -1
  30. package/dist/api/tutoring-requests.d.ts +1 -1
  31. package/dist/chat.d.ts +3 -0
  32. package/dist/chat.js +3 -0
  33. package/dist/chunks/connection.d.ts +28 -0
  34. package/dist/chunks/connection.js +141 -0
  35. package/dist/chunks/connection.js.map +1 -0
  36. package/dist/chunks/index.d.ts +198 -1
  37. package/dist/index.d.ts +2 -2
  38. package/dist/index.js +2 -2
  39. package/dist/index.js.map +1 -1
  40. package/dist/models.d.ts +2 -2
  41. package/dist/models.js +16 -1
  42. package/dist/models.js.map +1 -1
  43. package/dist/react/account.d.ts +1 -1
  44. package/dist/react/admin-catalogue.d.ts +1 -1
  45. package/dist/react/admin-consumption.d.ts +1 -1
  46. package/dist/react/admin-licenses.d.ts +1 -1
  47. package/dist/react/admin-patrons.d.ts +1 -1
  48. package/dist/react/admin-reviews.d.ts +1 -1
  49. package/dist/react/admin-roles.d.ts +1 -1
  50. package/dist/react/admin-support.d.ts +1 -1
  51. package/dist/react/admin-tenants.d.ts +1 -1
  52. package/dist/react/admin-tutoring.d.ts +1 -1
  53. package/dist/react/auth.d.ts +1 -1
  54. package/dist/react/biblio-catalogue.d.ts +1 -1
  55. package/dist/react/biblio-home.d.ts +1 -1
  56. package/dist/react/biblio-library.d.ts +1 -1
  57. package/dist/react/biblio-nextory.d.ts +1 -1
  58. package/dist/react/biblio-press.d.ts +1 -1
  59. package/dist/react/biblio-search.d.ts +1 -1
  60. package/dist/react/biblio-telemetry.d.ts +1 -1
  61. package/dist/react/chat.d.ts +36 -0
  62. package/dist/react/chat.js +234 -0
  63. package/dist/react/chat.js.map +1 -0
  64. package/dist/react/consumption.d.ts +1 -1
  65. package/dist/react/cvs-app.d.ts +1 -1
  66. package/dist/react/cvs-documents.d.ts +1 -1
  67. package/dist/react/cvs-favorites.d.ts +1 -1
  68. package/dist/react/cvs-loans.d.ts +1 -1
  69. package/dist/react/cvs-payments.d.ts +123 -0
  70. package/dist/react/cvs-payments.js +181 -0
  71. package/dist/react/cvs-payments.js.map +1 -0
  72. package/dist/react/cvs-streaming.d.ts +1 -1
  73. package/dist/react/index.d.ts +2 -1
  74. package/dist/react/index.js +2 -1
  75. package/dist/react/partner-catalogue.d.ts +1 -1
  76. package/dist/react/partner-reader.d.ts +1 -1
  77. package/dist/react/profiles.d.ts +1 -1
  78. package/dist/react/tutoring-catalogue.d.ts +1 -1
  79. package/dist/react/tutoring-chat.d.ts +1 -1
  80. package/dist/react/tutoring-dispatch.d.ts +1 -1
  81. package/dist/react/tutoring-practitioner.d.ts +1 -1
  82. package/dist/react/tutoring-requests.d.ts +1 -1
  83. package/package.json +15 -7
package/README.md CHANGED
@@ -64,6 +64,73 @@ Create a separate client and QueryClient for each server-side request. Clear the
64
64
  query cache on logout, account change, or a change of acting-as/tenant context;
65
65
  generated query keys do not contain credentials or identify the current user.
66
66
 
67
+ ## ProfExpress student/teacher chat
68
+
69
+ The handwritten chat hook is published alongside the generated HTTP hooks:
70
+
71
+ ```tsx
72
+ import type { Client } from '@learnorama/mozaik-sdk';
73
+ import { useTutoringChat } from '@learnorama/mozaik-sdk/react/chat';
74
+
75
+ export function TutoringRoom({ client, requestId }: { client: Client; requestId: number }) {
76
+ const chat = useTutoringChat({ client, requestId });
77
+
78
+ async function send(body: string) {
79
+ try {
80
+ await chat.sendMessage({ body });
81
+ } catch {
82
+ // chat.sendError exposes the error; keep the draft for an explicit retry.
83
+ }
84
+ }
85
+
86
+ return (
87
+ <section>
88
+ <p>Connection: {chat.status}</p>
89
+ {chat.error && <p role="alert">Chat connection interrupted.</p>}
90
+ {chat.hasMore && (
91
+ <button disabled={chat.isLoadingOlder} onClick={() => { void chat.loadOlder().catch(() => {}); }}>
92
+ Older messages
93
+ </button>
94
+ )}
95
+ {chat.messages.map(message => <p key={message.id}>{message.body ?? 'Message removed'}</p>)}
96
+ <button disabled={chat.isSending} onClick={() => { void send('Bonjour !'); }}>Send</button>
97
+ {chat.sendError && <p role="alert">Message not confirmed. Please retry.</p>}
98
+ </section>
99
+ );
100
+ }
101
+ ```
102
+
103
+ Use this inside `QueryClientProvider`. Keep `client` stable; create a new client
104
+ when switching signed-in accounts. Pass `requestId: null` or `enabled: false`
105
+ on logout/when no room is selected. The hook closes its connection, cancels
106
+ requests and clears its private history on cleanup, including React Strict Mode.
107
+ Messages are ordered oldest first and deduplicated by ID.
108
+
109
+ The hook obtains a fresh single-use ticket for every connection; the OAuth access
110
+ token never enters the WebSocket URL. The server acknowledges the Redis
111
+ subscription before accepting the socket. The hook then loads history while
112
+ buffering live messages and retrieves missed pages after reconnecting. Network
113
+ failures reconnect with backoff; HTTP 401/403/404 and socket policy refusal stop
114
+ retries. Refresh authentication/access before enabling the hook again.
115
+
116
+ `sendMessage` uses the HTTP endpoint so success confirms persistence. Each send
117
+ gets a `clientKey`; writes are not automatically retried. For a failed send, pass
118
+ `chat.lastSend` back to `chat.sendMessage` to retain that key and avoid duplication.
119
+ For multiple simultaneous drafts, supply and retain a separate `clientKey` for
120
+ each draft yourself. `loadOlderError`, `sendError` and the connection `error` are
121
+ separate; `isSending`, `isLoading`, and `isLoadingOlder` support the corresponding UI.
122
+
123
+ Without React, import `connectTutoringChat` from `@learnorama/mozaik-sdk/chat`.
124
+ Provide `client`, `requestId`, and `onMessage`; call the returned `close()` on
125
+ cleanup. Its optional async `onConnect(signal)` callback can retrieve history;
126
+ incoming messages are buffered until it resolves. Sending and history are the
127
+ generated functions under `/api/tutoring-chat`.
128
+
129
+ Live chat messages are validated at runtime against the generated message kind
130
+ and the expected room/message shape. The chat module uses native WebSocket,
131
+ AbortSignal and secure-context `crypto.randomUUID()` APIs. It introduces no
132
+ additional production dependencies.
133
+
67
134
  ## Models and errors
68
135
 
69
136
  ```ts
@@ -89,6 +156,6 @@ are required; the backend commit SHA is metadata, not the package version.
89
156
  import { apiVersion, backendRevision, schemaSha256 } from '@learnorama/mozaik-sdk';
90
157
  ```
91
158
 
92
- TypeScript types describe the API contract; they do not validate response bodies
93
- at runtime. The package contains the client and type declarations, not application
159
+ Generated HTTP TypeScript types describe the API contract; they do not validate
160
+ response bodies at runtime. The package contains the client and type declarations, not application
94
161
  credentials or backend implementation code.
@@ -1,5 +1,5 @@
1
1
 
2
- import { $r as AccountDetailRead, B as ServiceListRead, Zr as AccountUpdateWrite } from "../chunks/index.js";
2
+ import { B as ServiceListRead, ci as AccountDetailRead, oi as AccountUpdateWrite } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/account/account.d.ts
5
5
  export declare const getDeleteAccountUrl: () => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { C as ThemeWrite, E as ThemeRead, T as ThemeListRead, sn as ListThemesParams, w as ThemeOrderWrite } from "../chunks/index.js";
2
+ import { C as ThemeWrite, E as ThemeRead, T as ThemeListRead, mn as ListThemesParams, w as ThemeOrderWrite } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/admin-catalogue/admin-catalogue.d.ts
5
5
  export declare const getListThemesUrl: (params?: ListThemesParams) => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { in as LiveLeaseListRead, zn as LeaseCloseWrite } from "../chunks/index.js";
2
+ import { Kn as LeaseCloseWrite, dn as LiveLeaseListRead } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/admin-consumption/admin-consumption.d.ts
5
5
  export declare const getListLiveLeasesUrl: () => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { Ft as PatronDetailRead, Mt as PatronUpdateWrite, Nt as PatronPage, pn as ListPatronsParams } from "../chunks/index.js";
2
+ import { Bt as PatronPage, Ht as PatronDetailRead, bn as ListPatronsParams, zt as PatronUpdateWrite } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/admin-patrons/admin-patrons.d.ts
5
5
  export declare const getListPatronsUrl: (params?: ListPatronsParams) => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { J as ReviewModerationRead, Jt as ModerationWrite, cn as ListReviewsParams, q as ReviewPage } from "../chunks/index.js";
2
+ import { J as ReviewModerationRead, hn as ListReviewsParams, q as ReviewPage, tn as ModerationWrite } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/admin-reviews/admin-reviews.d.ts
5
5
  export declare const getListReviewsUrl: (params?: ListReviewsParams) => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { Cr as DemoUserWrite, Wn as ImpersonationWrite, j as SupportSessionRead, wr as DemoUserRead } from "../chunks/index.js";
2
+ import { Mr as DemoUserRead, Zn as ImpersonationWrite, j as SupportSessionRead, jr as DemoUserWrite } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/admin-support/admin-support.d.ts
5
5
  export declare const getCreateDemoUserUrl: () => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { Cn as ListExpiringDocumentsParams, Dt as PractitionerDocumentListRead, En as ListAllRequestsParams, Et as PractitionerRead, F as SubjectRead, In as LevelRead, N as SubjectWrite, Pn as LevelWrite, Sn as ListFeedbackParams, Tt as PractitionerPage, Xr as AiDraftRead, Yr as AiDraftReviewWrite, cr as EducationalGoalRead, d as TutoringQueuePage, fn as ListPractitionersParams, g as TutoringFeedbackModerationWrite, l as TutoringRequestAdminWrite, m as TutoringFeedbackPage, o as TutoringRequestStaffRead, or as EducationalGoalWrite, u as TutoringRequestAdminCloseWrite, wt as PractitionerWrite } from "../chunks/index.js";
2
+ import { An as ListExpiringDocumentsParams, Dt as PractitionerDocumentListRead, Et as PractitionerRead, F as SubjectRead, N as SubjectWrite, Nn as ListAllRequestsParams, Tt as PractitionerPage, Un as LevelRead, Vn as LevelWrite, ai as AiDraftRead, d as TutoringQueuePage, g as TutoringFeedbackModerationWrite, gr as EducationalGoalRead, ii as AiDraftReviewWrite, kn as ListFeedbackParams, l as TutoringRequestAdminWrite, m as TutoringFeedbackPage, mr as EducationalGoalWrite, o as TutoringRequestStaffRead, u as TutoringRequestAdminCloseWrite, wt as PractitionerWrite, yn as ListPractitionersParams } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/admin-tutoring/admin-tutoring.d.ts
5
5
  export declare const getListExpiringDocumentsUrl: (params?: ListExpiringDocumentsParams) => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { $t as MeRead, Dr as CredentialsWrite, Kr as AuthorizationRead, Y as RefreshWrite, jr as CodeExchangeWrite, qr as AuthorizationParams, tn as LogoutWrite, z as SessionRead } from "../chunks/index.js";
2
+ import { Fr as CredentialsWrite, Y as RefreshWrite, cn as LogoutWrite, ni as AuthorizationParams, on as MeRead, ti as AuthorizationRead, z as SessionRead, zr as CodeExchangeWrite } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/auth/auth.d.ts
5
5
  export declare const getAuthorizationUrl: (params: AuthorizationParams) => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { An as LikeRead, Or as ContentRead, Rr as CatalogRead, Vn as LearningPathDetailRead, Wt as PackDetailRead, X as RecommendationsRead, Z as ReadRecommendationsParams, dt as ReadCatalogParams, et as ReadPackParams, fr as EditorDetailRead, lr as EditorListRead, lt as ReadEditorParams, ut as ReadCatalogThemeParams, wn as ListEditorsParams } from "../chunks/index.js";
2
+ import { Ir as ContentRead, Jn as LearningPathDetailRead, Kr as CatalogRead, Ln as LikeRead, X as RecommendationsRead, Z as ReadRecommendationsParams, Zt as PackDetailRead, _r as EditorListRead, br as EditorDetailRead, dt as ReadCatalogParams, et as ReadPackParams, jn as ListEditorsParams, lt as ReadEditorParams, ut as ReadCatalogThemeParams } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/biblio-catalogue/biblio-catalogue.d.ts
5
5
  export declare const getReadContentUrl: (contentId: number) => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { Kn as HomeFeedRead, st as ReadHomeFeedParams } from "../chunks/index.js";
2
+ import { $n as HomeFeedRead, st as ReadHomeFeedParams } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/biblio-home/biblio-home.d.ts
5
5
  export declare const getReadHomeFeedUrl: (params?: ReadHomeFeedParams) => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { $n as FavoritePage, Ct as PreferencesRead, Fr as CategoryListRead, Ht as PackListRead, Pr as CategoryPreferencesWrite, Tn as ListBiblioFavoritesParams, Zn as HistoryPage, bn as ListHistoryParams, ir as FavoriteAddWrite } from "../chunks/index.js";
2
+ import { Ct as PreferencesRead, Dn as ListHistoryParams, Hr as CategoryPreferencesWrite, Mn as ListBiblioFavoritesParams, Ur as CategoryListRead, Yt as PackListRead, fr as FavoriteAddWrite, ir as HistoryPage, sr as FavoritePage } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/biblio-library/biblio-library.d.ts
5
5
  export declare const getListBiblioCategoriesUrl: () => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { Mn as LicenseRead } from "../chunks/index.js";
2
+ import { zn as LicenseRead } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/biblio-nextory/biblio-nextory.d.ts
5
5
  export declare const getDeleteLicenseUrl: () => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { Q as ReadPressReviewParams, bt as PressArticleRead, dn as ListPressArticlesParams, qn as PressReviewRead, xt as PressArticleListRead } from "../chunks/index.js";
2
+ import { Q as ReadPressReviewParams, bt as PressArticleRead, er as PressReviewRead, vn as ListPressArticlesParams, xt as PressArticleListRead } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/biblio-press/biblio-press.d.ts
5
5
  export declare const getListPressArticlesUrl: (params?: ListPressArticlesParams) => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { Rn as LeaseRead } from "../chunks/index.js";
2
+ import { Gn as LeaseRead } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/consumption/consumption.d.ts
5
5
  export declare const getCloseLeaseUrl: (eventId: number) => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { At as PlaybackReportWrite, Kt as NotificationListRead, jt as PlaybackReportRead, mn as ListNotificationsParams } from "../chunks/index.js";
2
+ import { $t as NotificationListRead, At as PlaybackReportWrite, jt as PlaybackReportRead, xn as ListNotificationsParams } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/cvs-app/cvs-app.d.ts
5
5
  export declare const getListNotificationsUrl: (params?: ListNotificationsParams) => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { G as ReviewUpdateWrite, K as ReviewRead, M as SupplierGrantRead, Un as LastPositionWrite, ft as RatingUpdateWrite, hr as DocumentRead, mr as DocumentSearchWrite, vr as DocumentPage } from "../chunks/index.js";
2
+ import { Cr as DocumentRead, Er as DocumentPage, G as ReviewUpdateWrite, K as ReviewRead, M as SupplierGrantRead, Sr as DocumentSearchWrite, Xn as LastPositionWrite, ft as RatingUpdateWrite } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/cvs-documents/cvs-documents.d.ts
5
5
  export declare const getSearchDocumentsUrl: () => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { rr as SelectionRead, tr as FavoriteListRead } from "../chunks/index.js";
2
+ import { dr as SelectionRead, lr as FavoriteListRead } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/cvs-favorites/cvs-favorites.d.ts
5
5
  export declare const getListCvsFavoritesUrl: () => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { Ur as BorrowWrite, nn as LoanPage, rn as LoanRead, yn as ListLoansParams } from "../chunks/index.js";
2
+ import { En as ListLoansParams, Zr as BorrowWrite, ln as LoanPage, un as LoanRead } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/cvs-loans/cvs-loans.d.ts
5
5
  export declare const getListLoansUrl: (params?: ListLoansParams) => string;
@@ -0,0 +1,49 @@
1
+
2
+ import { Ft as PaymentListRead, It as PaymentRead, Mt as PaymentStartWrite, Nt as PaymentStartRead } from "../chunks/index.js";
3
+ import { c as request } from "../chunks/client.js";
4
+ //#region src/api/cvs-payments/cvs-payments.d.ts
5
+ export declare const getListPaymentsUrl: () => string;
6
+ /**
7
+ * This patron's top-ups, newest first. The legacy's ``historyPayments()``.
8
+ * @summary List Payments
9
+ */
10
+ export declare const listPayments: (options?: Parameters<typeof request>[1]) => Promise<PaymentListRead>;
11
+ export declare const getStartPaymentUrl: () => string;
12
+ /**
13
+ * Begin a top-up and get the hand-off to send the patron to.
14
+ *
15
+ * **Which provider answers is the library's setting**, not the client's
16
+ * choice. PayPal returns ``approvalUrl``; Paybox returns ``form``, because
17
+ * its hand-off is a signed POST and not a redirect. Read ``provider`` rather
18
+ * than testing which field is null.
19
+ *
20
+ * ``409`` for an amount this library does not sell — the tariff is the
21
+ * server's, because a client that may name its own price may name zero, and
22
+ * it differs per provider (Paybox sells séances at 3 €, PayPal credits at
23
+ * 5.90 €). ``503`` when the library sells nothing or its merchant account is
24
+ * unconfigured, with nothing written.
25
+ *
26
+ * Nothing is charged here and nothing is credited. This opens a pending row
27
+ * and the provider hand-off, and that is all.
28
+ *
29
+ * ``requestKey`` makes it idempotent: a retried start returns the hand-off the
30
+ * first attempt opened rather than opening a second, because a patron who
31
+ * then pays both has been charged twice for one intent.
32
+ * @summary Start Payment
33
+ */
34
+ export declare const startPayment: (paymentStartWrite: PaymentStartWrite, options?: Parameters<typeof request>[1]) => Promise<PaymentStartRead>;
35
+ export declare const getReadPaymentUrl: (paymentId: number) => string;
36
+ /**
37
+ * One top-up, and what became of it.
38
+ *
39
+ * This is what a client reads after the provider sends the browser back. The
40
+ * landing URL says what the patron *did*; this says what the *provider* told
41
+ * us, which is the only version that credits anything.
42
+ *
43
+ * ``404`` for somebody else's payment, indistinguishable from one that does
44
+ * not exist: a payment id is a bare integer.
45
+ * @summary Read Payment
46
+ */
47
+ export declare const readPayment: (paymentId: number, options?: Parameters<typeof request>[1]) => Promise<PaymentRead>;
48
+ //#endregion
49
+ //# sourceMappingURL=cvs-payments.d.ts.map
@@ -0,0 +1,84 @@
1
+
2
+ import { r as request } from "../chunks/client.js";
3
+ //#region src/api/cvs-payments/cvs-payments.ts
4
+ const getListPaymentsUrl = () => {
5
+ return `/cvs/payments`;
6
+ };
7
+ /**
8
+ * This patron's top-ups, newest first. The legacy's ``historyPayments()``.
9
+ * @summary List Payments
10
+ */
11
+ const listPayments = async (options) => {
12
+ return request(getListPaymentsUrl(), {
13
+ ...options,
14
+ method: "GET"
15
+ });
16
+ };
17
+ const getStartPaymentUrl = () => {
18
+ return `/cvs/payments`;
19
+ };
20
+ /**
21
+ * Begin a top-up and get the hand-off to send the patron to.
22
+ *
23
+ * **Which provider answers is the library's setting**, not the client's
24
+ * choice. PayPal returns ``approvalUrl``; Paybox returns ``form``, because
25
+ * its hand-off is a signed POST and not a redirect. Read ``provider`` rather
26
+ * than testing which field is null.
27
+ *
28
+ * ``409`` for an amount this library does not sell — the tariff is the
29
+ * server's, because a client that may name its own price may name zero, and
30
+ * it differs per provider (Paybox sells séances at 3 €, PayPal credits at
31
+ * 5.90 €). ``503`` when the library sells nothing or its merchant account is
32
+ * unconfigured, with nothing written.
33
+ *
34
+ * Nothing is charged here and nothing is credited. This opens a pending row
35
+ * and the provider hand-off, and that is all.
36
+ *
37
+ * ``requestKey`` makes it idempotent: a retried start returns the hand-off the
38
+ * first attempt opened rather than opening a second, because a patron who
39
+ * then pays both has been charged twice for one intent.
40
+ * @summary Start Payment
41
+ */
42
+ const startPayment = async (paymentStartWrite, options) => {
43
+ const getHeaders = (h) => {
44
+ if (!h) return {};
45
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
46
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
47
+ const headers = {};
48
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
49
+ return headers;
50
+ };
51
+ return request(getStartPaymentUrl(), {
52
+ ...options,
53
+ method: "POST",
54
+ headers: {
55
+ "Content-Type": "application/json",
56
+ ...getHeaders(options?.headers)
57
+ },
58
+ body: JSON.stringify(paymentStartWrite)
59
+ });
60
+ };
61
+ const getReadPaymentUrl = (paymentId) => {
62
+ return `/cvs/payments/${paymentId}`;
63
+ };
64
+ /**
65
+ * One top-up, and what became of it.
66
+ *
67
+ * This is what a client reads after the provider sends the browser back. The
68
+ * landing URL says what the patron *did*; this says what the *provider* told
69
+ * us, which is the only version that credits anything.
70
+ *
71
+ * ``404`` for somebody else's payment, indistinguishable from one that does
72
+ * not exist: a payment id is a bare integer.
73
+ * @summary Read Payment
74
+ */
75
+ const readPayment = async (paymentId, options) => {
76
+ return request(getReadPaymentUrl(paymentId), {
77
+ ...options,
78
+ method: "GET"
79
+ });
80
+ };
81
+ //#endregion
82
+ export { getListPaymentsUrl, getReadPaymentUrl, getStartPaymentUrl, listPayments, readPayment, startPayment };
83
+
84
+ //# sourceMappingURL=cvs-payments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cvs-payments.js","names":[],"sources":["../../src/api/cvs-payments/cvs-payments.ts"],"sourcesContent":["/**\n * Generated by orval 🍺\n * Do not edit manually.\n * Mozaik backend\n * Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.\n * OpenAPI spec version: 0.1.0\n */\nimport type {\n PaymentListRead,\n PaymentRead,\n PaymentStartRead,\n PaymentStartWrite\n} from '../../models';\n\nimport { request } from '../../client';\n\nexport const getListPaymentsUrl = () => {\n\n\n\n\n return `/cvs/payments`\n}\n\n/**\n * This patron's top-ups, newest first. The legacy's ``historyPayments()``.\n * @summary List Payments\n */\nexport const listPayments = async ( options?: Parameters<typeof request>[1]): Promise<PaymentListRead> => {\n\n return request<PaymentListRead>(getListPaymentsUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\nexport const getStartPaymentUrl = () => {\n\n\n\n\n return `/cvs/payments`\n}\n\n/**\n * Begin a top-up and get the hand-off to send the patron to.\n *\n * **Which provider answers is the library's setting**, not the client's\n * choice. PayPal returns ``approvalUrl``; Paybox returns ``form``, because\n * its hand-off is a signed POST and not a redirect. Read ``provider`` rather\n * than testing which field is null.\n *\n * ``409`` for an amount this library does not sell — the tariff is the\n * server's, because a client that may name its own price may name zero, and\n * it differs per provider (Paybox sells séances at 3 €, PayPal credits at\n * 5.90 €). ``503`` when the library sells nothing or its merchant account is\n * unconfigured, with nothing written.\n *\n * Nothing is charged here and nothing is credited. This opens a pending row\n * and the provider hand-off, and that is all.\n *\n * ``requestKey`` makes it idempotent: a retried start returns the hand-off the\n * first attempt opened rather than opening a second, because a patron who\n * then pays both has been charged twice for one intent.\n * @summary Start Payment\n */\nexport const startPayment = async (paymentStartWrite: PaymentStartWrite, options?: Parameters<typeof request>[1]): Promise<PaymentStartRead> => {\n\n const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {\n if (!h) return {};\n if (h instanceof Headers) return Object.fromEntries(h.entries());\n if (Symbol.iterator in h) {\n return Object.fromEntries(\n Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),\n );\n }\n const headers: Record<string, string | readonly string[]> = {};\n for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {\n if (value !== undefined) headers[name] = value;\n }\n return headers;\n };\nreturn request<PaymentStartRead>(getStartPaymentUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(paymentStartWrite)\n }\n);}\n\n\nexport const getReadPaymentUrl = (paymentId: number,) => {\n\n\n\n\n return `/cvs/payments/${paymentId}`\n}\n\n/**\n * One top-up, and what became of it.\n *\n * This is what a client reads after the provider sends the browser back. The\n * landing URL says what the patron *did*; this says what the *provider* told\n * us, which is the only version that credits anything.\n *\n * ``404`` for somebody else's payment, indistinguishable from one that does\n * not exist: a payment id is a bare integer.\n * @summary Read Payment\n */\nexport const readPayment = async (paymentId: number, options?: Parameters<typeof request>[1]): Promise<PaymentRead> => {\n\n return request<PaymentRead>(getReadPaymentUrl(paymentId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n"],"mappings":";;;AAgBA,MAAa,2BAA2B;CAKtC,OAAO;AACT;;;;;AAMA,MAAa,eAAe,OAAQ,YAAsE;CAExG,OAAO,QAAyB,mBAAmB,GACnD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,2BAA2B;CAKtC,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,eAAe,OAAO,mBAAsC,YAAuE;CAE5I,MAAM,cAAc,MAAwF;EAC5G,IAAI,CAAC,GAAG,OAAO,CAAC;EAChB,IAAI,aAAa,SAAS,OAAO,OAAO,YAAY,EAAE,QAAQ,CAAC;EAC/D,IAAI,OAAO,YAAY,GACrB,OAAO,OAAO,YACZ,MAAM,KAAK,IAAkC,UAAU,MAAM,KAAK,KAAK,CAAqB,CAC9F;EAEF,MAAM,UAAsD,CAAC;EAC7D,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAgD,CAAC,GAClF,IAAI,UAAU,KAAA,GAAW,QAAQ,QAAQ;EAE3C,OAAO;CACT;CACF,OAAO,QAA0B,mBAAmB,GAClD;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,iBAAiB;CACxC,CACF;AAAE;AAGF,MAAa,qBAAqB,cAAuB;CAKvD,OAAO,iBAAiB;AAC1B;;;;;;;;;;;;AAaA,MAAa,cAAc,OAAO,WAAmB,YAAkE;CAErH,OAAO,QAAqB,kBAAkB,SAAS,GACvD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE"}
@@ -22,6 +22,7 @@ import { createReport, getCreateReportUrl, getListNotificationsUrl, listNotifica
22
22
  import { getOpenAtSupplierUrl, getRateDocumentUrl, getReadDocumentUrl, getReadLastPositionUrl, getSearchDocumentsUrl, getSetLastPositionUrl, getWriteReviewUrl, openAtSupplier, rateDocument, readDocument, readLastPosition, searchDocuments, setLastPosition, writeReview } from "./cvs-documents.js";
23
23
  import { addCvsFavorite, getAddCvsFavoriteUrl, getListCvsFavoritesUrl, getListSelectionsUrl, getRemoveCvsFavoriteUrl, listCvsFavorites, listSelections, removeCvsFavorite } from "./cvs-favorites.js";
24
24
  import { borrow, extendLoan, getBorrowUrl, getExtendLoanUrl, getListLoansUrl, getReturnLoanUrl, listLoans, returnLoan } from "./cvs-loans.js";
25
+ import { getListPaymentsUrl, getReadPaymentUrl, getStartPaymentUrl, listPayments, readPayment, startPayment } from "./cvs-payments.js";
25
26
  import { getStartSessionUrl, getStreamingDetailsUrl, startSession, streamingDetails } from "./cvs-streaming.js";
26
27
  import { addPartnerFavorite, getAddPartnerFavoriteUrl, getListMediaUrl, getListPartnerCategoriesUrl, getListPartnerFavoritesUrl, getReadMediaUrl, getRemovePartnerFavoriteUrl, listMedia, listPartnerCategories, listPartnerFavorites, readMedia, removePartnerFavorite } from "./partner-catalogue.js";
27
28
  import { getListCurrentReadingsUrl, getReadPackageUrl, getReadPositionUrl, getWritePositionUrl, listCurrentReadings, readPackage, readPosition, writePosition } from "./partner-reader.js";
@@ -31,4 +32,4 @@ import { getListMessagesUrl, getMintChatTicketUrl, getSendMessageUrl, listMessag
31
32
  import { dispatchRequest, getDispatchRequestUrl, getListQueueUrl, getTriageRequestUrl, listQueue, triageRequest } from "./tutoring-dispatch.js";
32
33
  import { answerRequest, claimRequest, closeRequest, getAnswerRequestUrl, getClaimRequestUrl, getCloseRequestUrl, getOpenRoomUrl, openRoom } from "./tutoring-practitioner.js";
33
34
  import { cancelRequest, deleteAttachment, getCancelRequestUrl, getDeleteAttachmentUrl, getGetRequestUrl, getListMyRequestsUrl, getRateRequestUrl, getRequest, getSubmitRequestUrl, getUploadAttachmentUrl, listMyRequests, rateRequest, submitRequest, uploadAttachment } from "./tutoring-requests.js";
34
- export { addBiblioFavorite, addCvsFavorite, addPartnerFavorite, adminCloseRequest, amendGoal, amendLevel, amendPractitioner, amendRequest, amendSubject, amendTheme, answerRequest, authorization, borrow, cancelRequest, claimRequest, closeLease, closeRequest, closeSupportSession, createDemoUser, createGoal, createLevel, createLicense, createProfile, createReport, createSessionFromCode, createSessionFromCredentials, createSubject, createTheme, deleteAccount, deleteAttachment, deleteLicense, deleteProfile, deleteSession, deleteTheme, dispatchRequest, extendLoan, forceCloseLease, getAddBiblioFavoriteUrl, getAddCvsFavoriteUrl, getAddPartnerFavoriteUrl, getAdminCloseRequestUrl, getAmendGoalUrl, getAmendLevelUrl, getAmendPractitionerUrl, getAmendRequestUrl, getAmendSubjectUrl, getAmendThemeUrl, getAnswerRequestUrl, getAuthorizationUrl, getBorrowUrl, getCancelRequestUrl, getClaimRequestUrl, getCloseLeaseUrl, getCloseRequestUrl, getCloseSupportSessionUrl, getCreateDemoUserUrl, getCreateGoalUrl, getCreateLevelUrl, getCreateLicenseUrl, getCreateProfileUrl, getCreateReportUrl, getCreateSessionFromCodeUrl, getCreateSessionFromCredentialsUrl, getCreateSubjectUrl, getCreateThemeUrl, getDeleteAccountUrl, getDeleteAttachmentUrl, getDeleteLicenseUrl, getDeleteProfileUrl, getDeleteSessionUrl, getDeleteThemeUrl, getDispatchRequestUrl, getExtendLoanUrl, getForceCloseLeaseUrl, getGetRequestUrl, getLikeContentUrl, getListAllRequestsUrl, getListBiblioCategoriesUrl, getListBiblioFavoritesUrl, getListCurrentReadingsUrl, getListCvsFavoritesUrl, getListEditorsUrl, getListExpiringDocumentsUrl, getListFeedbackUrl, getListGoalsUrl, getListGrantsUrl, getListHistoryUrl, getListLevelsUrl, getListLiveLeasesUrl, getListLoansUrl, getListMediaUrl, getListMessagesUrl, getListMyRequestsUrl, getListNotificationsUrl, getListPacksUrl, getListPartnerCategoriesUrl, getListPartnerFavoritesUrl, getListPatronsUrl, getListPractitionerDocumentsUrl, getListPractitionersUrl, getListPressArticlesUrl, getListProfilesUrl, getListQueueUrl, getListReviewsUrl, getListSelectionsUrl, getListServicesUrl, getListSubjectsUrl, getListTenantsUrl, getListThemesUrl, getMintChatTicketUrl, getModerateFeedbackUrl, getModerateReviewUrl, getOpenAtSupplierUrl, getOpenRoomUrl, getOpenSupportSessionUrl, getRateDocumentUrl, getRateRequestUrl, getReadAccountUrl, getReadCatalogThemeUrl, getReadCatalogUrl, getReadContentUrl, getReadDocumentUrl, getReadDraftUrl, getReadEditorUrl, getReadHomeFeedUrl, getReadLastPositionUrl, getReadLearningPathUrl, getReadLicenseUrl, getReadMeUrl, getReadMediaUrl, getReadPackUrl, getReadPackageUrl, getReadPatronLicenseUrl, getReadPatronUrl, getReadPositionUrl, getReadPreferencesUrl, getReadPressArticleUrl, getReadPressReviewUrl, getReadProfileUrl, getReadRecommendationsUrl, getReadRequestUrl, getReadTenantUrl, getReadThemeUrl, getRecordReadingSessionUrl, getRefreshSessionUrl, getRemoveBiblioFavoriteUrl, getRemoveCvsFavoriteUrl, getRemovePartnerFavoriteUrl, getRenewLeaseUrl, getReorderThemesUrl, getReplaceCategoryPreferencesUrl, getReplaceGrantsUrl, getRequest, getReturnLoanUrl, getReviewDraftUrl, getSearchDocumentsUrl, getSearchUrl, getSendMessageUrl, getSetLastPositionUrl, getStartSessionUrl, getStreamingDetailsUrl, getSubmitRequestUrl, getTriageRequestUrl, getUnlikeContentUrl, getUpdateAccountUrl, getUpdatePatronUrl, getUpdateProfileUrl, getUpdateTenantUrl, getUploadAttachmentUrl, getWritePositionUrl, getWriteReviewUrl, likeContent, listAllRequests, listBiblioCategories, listBiblioFavorites, listCurrentReadings, listCvsFavorites, listEditors, listExpiringDocuments, listFeedback, listGoals, listGrants, listHistory, listLevels, listLiveLeases, listLoans, listMedia, listMessages, listMyRequests, listNotifications, listPacks, listPartnerCategories, listPartnerFavorites, listPatrons, listPractitionerDocuments, listPractitioners, listPressArticles, listProfiles, listQueue, listReviews, listSelections, listServices, listSubjects, listTenants, listThemes, mintChatTicket, moderateFeedback, moderateReview, openAtSupplier, openRoom, openSupportSession, rateDocument, rateRequest, readAccount, readCatalog, readCatalogTheme, readContent, readDocument, readDraft, readEditor, readHomeFeed, readLastPosition, readLearningPath, readLicense, readMe, readMedia, readPack, readPackage, readPatron, readPatronLicense, readPosition, readPreferences, readPressArticle, readPressReview, readProfile, readRecommendations, readRequest, readTenant, readTheme, recordReadingSession, refreshSession, removeBiblioFavorite, removeCvsFavorite, removePartnerFavorite, renewLease, reorderThemes, replaceCategoryPreferences, replaceGrants, returnLoan, reviewDraft, search, searchDocuments, sendMessage, setLastPosition, startSession, streamingDetails, submitRequest, triageRequest, unlikeContent, updateAccount, updatePatron, updateProfile, updateTenant, uploadAttachment, writePosition, writeReview };
35
+ export { addBiblioFavorite, addCvsFavorite, addPartnerFavorite, adminCloseRequest, amendGoal, amendLevel, amendPractitioner, amendRequest, amendSubject, amendTheme, answerRequest, authorization, borrow, cancelRequest, claimRequest, closeLease, closeRequest, closeSupportSession, createDemoUser, createGoal, createLevel, createLicense, createProfile, createReport, createSessionFromCode, createSessionFromCredentials, createSubject, createTheme, deleteAccount, deleteAttachment, deleteLicense, deleteProfile, deleteSession, deleteTheme, dispatchRequest, extendLoan, forceCloseLease, getAddBiblioFavoriteUrl, getAddCvsFavoriteUrl, getAddPartnerFavoriteUrl, getAdminCloseRequestUrl, getAmendGoalUrl, getAmendLevelUrl, getAmendPractitionerUrl, getAmendRequestUrl, getAmendSubjectUrl, getAmendThemeUrl, getAnswerRequestUrl, getAuthorizationUrl, getBorrowUrl, getCancelRequestUrl, getClaimRequestUrl, getCloseLeaseUrl, getCloseRequestUrl, getCloseSupportSessionUrl, getCreateDemoUserUrl, getCreateGoalUrl, getCreateLevelUrl, getCreateLicenseUrl, getCreateProfileUrl, getCreateReportUrl, getCreateSessionFromCodeUrl, getCreateSessionFromCredentialsUrl, getCreateSubjectUrl, getCreateThemeUrl, getDeleteAccountUrl, getDeleteAttachmentUrl, getDeleteLicenseUrl, getDeleteProfileUrl, getDeleteSessionUrl, getDeleteThemeUrl, getDispatchRequestUrl, getExtendLoanUrl, getForceCloseLeaseUrl, getGetRequestUrl, getLikeContentUrl, getListAllRequestsUrl, getListBiblioCategoriesUrl, getListBiblioFavoritesUrl, getListCurrentReadingsUrl, getListCvsFavoritesUrl, getListEditorsUrl, getListExpiringDocumentsUrl, getListFeedbackUrl, getListGoalsUrl, getListGrantsUrl, getListHistoryUrl, getListLevelsUrl, getListLiveLeasesUrl, getListLoansUrl, getListMediaUrl, getListMessagesUrl, getListMyRequestsUrl, getListNotificationsUrl, getListPacksUrl, getListPartnerCategoriesUrl, getListPartnerFavoritesUrl, getListPatronsUrl, getListPaymentsUrl, getListPractitionerDocumentsUrl, getListPractitionersUrl, getListPressArticlesUrl, getListProfilesUrl, getListQueueUrl, getListReviewsUrl, getListSelectionsUrl, getListServicesUrl, getListSubjectsUrl, getListTenantsUrl, getListThemesUrl, getMintChatTicketUrl, getModerateFeedbackUrl, getModerateReviewUrl, getOpenAtSupplierUrl, getOpenRoomUrl, getOpenSupportSessionUrl, getRateDocumentUrl, getRateRequestUrl, getReadAccountUrl, getReadCatalogThemeUrl, getReadCatalogUrl, getReadContentUrl, getReadDocumentUrl, getReadDraftUrl, getReadEditorUrl, getReadHomeFeedUrl, getReadLastPositionUrl, getReadLearningPathUrl, getReadLicenseUrl, getReadMeUrl, getReadMediaUrl, getReadPackUrl, getReadPackageUrl, getReadPatronLicenseUrl, getReadPatronUrl, getReadPaymentUrl, getReadPositionUrl, getReadPreferencesUrl, getReadPressArticleUrl, getReadPressReviewUrl, getReadProfileUrl, getReadRecommendationsUrl, getReadRequestUrl, getReadTenantUrl, getReadThemeUrl, getRecordReadingSessionUrl, getRefreshSessionUrl, getRemoveBiblioFavoriteUrl, getRemoveCvsFavoriteUrl, getRemovePartnerFavoriteUrl, getRenewLeaseUrl, getReorderThemesUrl, getReplaceCategoryPreferencesUrl, getReplaceGrantsUrl, getRequest, getReturnLoanUrl, getReviewDraftUrl, getSearchDocumentsUrl, getSearchUrl, getSendMessageUrl, getSetLastPositionUrl, getStartPaymentUrl, getStartSessionUrl, getStreamingDetailsUrl, getSubmitRequestUrl, getTriageRequestUrl, getUnlikeContentUrl, getUpdateAccountUrl, getUpdatePatronUrl, getUpdateProfileUrl, getUpdateTenantUrl, getUploadAttachmentUrl, getWritePositionUrl, getWriteReviewUrl, likeContent, listAllRequests, listBiblioCategories, listBiblioFavorites, listCurrentReadings, listCvsFavorites, listEditors, listExpiringDocuments, listFeedback, listGoals, listGrants, listHistory, listLevels, listLiveLeases, listLoans, listMedia, listMessages, listMyRequests, listNotifications, listPacks, listPartnerCategories, listPartnerFavorites, listPatrons, listPayments, listPractitionerDocuments, listPractitioners, listPressArticles, listProfiles, listQueue, listReviews, listSelections, listServices, listSubjects, listTenants, listThemes, mintChatTicket, moderateFeedback, moderateReview, openAtSupplier, openRoom, openSupportSession, rateDocument, rateRequest, readAccount, readCatalog, readCatalogTheme, readContent, readDocument, readDraft, readEditor, readHomeFeed, readLastPosition, readLearningPath, readLicense, readMe, readMedia, readPack, readPackage, readPatron, readPatronLicense, readPayment, readPosition, readPreferences, readPressArticle, readPressReview, readProfile, readRecommendations, readRequest, readTenant, readTheme, recordReadingSession, refreshSession, removeBiblioFavorite, removeCvsFavorite, removePartnerFavorite, renewLease, reorderThemes, replaceCategoryPreferences, replaceGrants, returnLoan, reviewDraft, search, searchDocuments, sendMessage, setLastPosition, startPayment, startSession, streamingDetails, submitRequest, triageRequest, unlikeContent, updateAccount, updatePatron, updateProfile, updateTenant, uploadAttachment, writePosition, writeReview };
package/dist/api/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
 
2
+ import { getListMessagesUrl, getMintChatTicketUrl, getSendMessageUrl, listMessages, mintChatTicket, sendMessage } from "./tutoring-chat.js";
2
3
  import { deleteAccount, getDeleteAccountUrl, getListServicesUrl, getReadAccountUrl, getUpdateAccountUrl, listServices, readAccount, updateAccount } from "./account.js";
3
4
  import { amendTheme, createTheme, deleteTheme, getAmendThemeUrl, getCreateThemeUrl, getDeleteThemeUrl, getListThemesUrl, getReadThemeUrl, getReorderThemesUrl, listThemes, readTheme, reorderThemes } from "./admin-catalogue.js";
4
5
  import { forceCloseLease, getForceCloseLeaseUrl, getListLiveLeasesUrl, listLiveLeases } from "./admin-consumption.js";
@@ -22,13 +23,13 @@ import { createReport, getCreateReportUrl, getListNotificationsUrl, listNotifica
22
23
  import { getOpenAtSupplierUrl, getRateDocumentUrl, getReadDocumentUrl, getReadLastPositionUrl, getSearchDocumentsUrl, getSetLastPositionUrl, getWriteReviewUrl, openAtSupplier, rateDocument, readDocument, readLastPosition, searchDocuments, setLastPosition, writeReview } from "./cvs-documents.js";
23
24
  import { addCvsFavorite, getAddCvsFavoriteUrl, getListCvsFavoritesUrl, getListSelectionsUrl, getRemoveCvsFavoriteUrl, listCvsFavorites, listSelections, removeCvsFavorite } from "./cvs-favorites.js";
24
25
  import { borrow, extendLoan, getBorrowUrl, getExtendLoanUrl, getListLoansUrl, getReturnLoanUrl, listLoans, returnLoan } from "./cvs-loans.js";
26
+ import { getListPaymentsUrl, getReadPaymentUrl, getStartPaymentUrl, listPayments, readPayment, startPayment } from "./cvs-payments.js";
25
27
  import { getStartSessionUrl, getStreamingDetailsUrl, startSession, streamingDetails } from "./cvs-streaming.js";
26
28
  import { addPartnerFavorite, getAddPartnerFavoriteUrl, getListMediaUrl, getListPartnerCategoriesUrl, getListPartnerFavoritesUrl, getReadMediaUrl, getRemovePartnerFavoriteUrl, listMedia, listPartnerCategories, listPartnerFavorites, readMedia, removePartnerFavorite } from "./partner-catalogue.js";
27
29
  import { getListCurrentReadingsUrl, getReadPackageUrl, getReadPositionUrl, getWritePositionUrl, listCurrentReadings, readPackage, readPosition, writePosition } from "./partner-reader.js";
28
30
  import { createProfile, deleteProfile, getCreateProfileUrl, getDeleteProfileUrl, getListProfilesUrl, getReadProfileUrl, getUpdateProfileUrl, listProfiles, readProfile, updateProfile } from "./profiles.js";
29
31
  import { getListGoalsUrl, getListLevelsUrl, getListSubjectsUrl, listGoals, listLevels, listSubjects } from "./tutoring-catalogue.js";
30
- import { getListMessagesUrl, getMintChatTicketUrl, getSendMessageUrl, listMessages, mintChatTicket, sendMessage } from "./tutoring-chat.js";
31
32
  import { dispatchRequest, getDispatchRequestUrl, getListQueueUrl, getTriageRequestUrl, listQueue, triageRequest } from "./tutoring-dispatch.js";
32
33
  import { answerRequest, claimRequest, closeRequest, getAnswerRequestUrl, getClaimRequestUrl, getCloseRequestUrl, getOpenRoomUrl, openRoom } from "./tutoring-practitioner.js";
33
34
  import { cancelRequest, deleteAttachment, getCancelRequestUrl, getDeleteAttachmentUrl, getGetRequestUrl, getListMyRequestsUrl, getRateRequestUrl, getRequest, getSubmitRequestUrl, getUploadAttachmentUrl, listMyRequests, rateRequest, submitRequest, uploadAttachment } from "./tutoring-requests.js";
34
- export { addBiblioFavorite, addCvsFavorite, addPartnerFavorite, adminCloseRequest, amendGoal, amendLevel, amendPractitioner, amendRequest, amendSubject, amendTheme, answerRequest, authorization, borrow, cancelRequest, claimRequest, closeLease, closeRequest, closeSupportSession, createDemoUser, createGoal, createLevel, createLicense, createProfile, createReport, createSessionFromCode, createSessionFromCredentials, createSubject, createTheme, deleteAccount, deleteAttachment, deleteLicense, deleteProfile, deleteSession, deleteTheme, dispatchRequest, extendLoan, forceCloseLease, getAddBiblioFavoriteUrl, getAddCvsFavoriteUrl, getAddPartnerFavoriteUrl, getAdminCloseRequestUrl, getAmendGoalUrl, getAmendLevelUrl, getAmendPractitionerUrl, getAmendRequestUrl, getAmendSubjectUrl, getAmendThemeUrl, getAnswerRequestUrl, getAuthorizationUrl, getBorrowUrl, getCancelRequestUrl, getClaimRequestUrl, getCloseLeaseUrl, getCloseRequestUrl, getCloseSupportSessionUrl, getCreateDemoUserUrl, getCreateGoalUrl, getCreateLevelUrl, getCreateLicenseUrl, getCreateProfileUrl, getCreateReportUrl, getCreateSessionFromCodeUrl, getCreateSessionFromCredentialsUrl, getCreateSubjectUrl, getCreateThemeUrl, getDeleteAccountUrl, getDeleteAttachmentUrl, getDeleteLicenseUrl, getDeleteProfileUrl, getDeleteSessionUrl, getDeleteThemeUrl, getDispatchRequestUrl, getExtendLoanUrl, getForceCloseLeaseUrl, getGetRequestUrl, getLikeContentUrl, getListAllRequestsUrl, getListBiblioCategoriesUrl, getListBiblioFavoritesUrl, getListCurrentReadingsUrl, getListCvsFavoritesUrl, getListEditorsUrl, getListExpiringDocumentsUrl, getListFeedbackUrl, getListGoalsUrl, getListGrantsUrl, getListHistoryUrl, getListLevelsUrl, getListLiveLeasesUrl, getListLoansUrl, getListMediaUrl, getListMessagesUrl, getListMyRequestsUrl, getListNotificationsUrl, getListPacksUrl, getListPartnerCategoriesUrl, getListPartnerFavoritesUrl, getListPatronsUrl, getListPractitionerDocumentsUrl, getListPractitionersUrl, getListPressArticlesUrl, getListProfilesUrl, getListQueueUrl, getListReviewsUrl, getListSelectionsUrl, getListServicesUrl, getListSubjectsUrl, getListTenantsUrl, getListThemesUrl, getMintChatTicketUrl, getModerateFeedbackUrl, getModerateReviewUrl, getOpenAtSupplierUrl, getOpenRoomUrl, getOpenSupportSessionUrl, getRateDocumentUrl, getRateRequestUrl, getReadAccountUrl, getReadCatalogThemeUrl, getReadCatalogUrl, getReadContentUrl, getReadDocumentUrl, getReadDraftUrl, getReadEditorUrl, getReadHomeFeedUrl, getReadLastPositionUrl, getReadLearningPathUrl, getReadLicenseUrl, getReadMeUrl, getReadMediaUrl, getReadPackUrl, getReadPackageUrl, getReadPatronLicenseUrl, getReadPatronUrl, getReadPositionUrl, getReadPreferencesUrl, getReadPressArticleUrl, getReadPressReviewUrl, getReadProfileUrl, getReadRecommendationsUrl, getReadRequestUrl, getReadTenantUrl, getReadThemeUrl, getRecordReadingSessionUrl, getRefreshSessionUrl, getRemoveBiblioFavoriteUrl, getRemoveCvsFavoriteUrl, getRemovePartnerFavoriteUrl, getRenewLeaseUrl, getReorderThemesUrl, getReplaceCategoryPreferencesUrl, getReplaceGrantsUrl, getRequest, getReturnLoanUrl, getReviewDraftUrl, getSearchDocumentsUrl, getSearchUrl, getSendMessageUrl, getSetLastPositionUrl, getStartSessionUrl, getStreamingDetailsUrl, getSubmitRequestUrl, getTriageRequestUrl, getUnlikeContentUrl, getUpdateAccountUrl, getUpdatePatronUrl, getUpdateProfileUrl, getUpdateTenantUrl, getUploadAttachmentUrl, getWritePositionUrl, getWriteReviewUrl, likeContent, listAllRequests, listBiblioCategories, listBiblioFavorites, listCurrentReadings, listCvsFavorites, listEditors, listExpiringDocuments, listFeedback, listGoals, listGrants, listHistory, listLevels, listLiveLeases, listLoans, listMedia, listMessages, listMyRequests, listNotifications, listPacks, listPartnerCategories, listPartnerFavorites, listPatrons, listPractitionerDocuments, listPractitioners, listPressArticles, listProfiles, listQueue, listReviews, listSelections, listServices, listSubjects, listTenants, listThemes, mintChatTicket, moderateFeedback, moderateReview, openAtSupplier, openRoom, openSupportSession, rateDocument, rateRequest, readAccount, readCatalog, readCatalogTheme, readContent, readDocument, readDraft, readEditor, readHomeFeed, readLastPosition, readLearningPath, readLicense, readMe, readMedia, readPack, readPackage, readPatron, readPatronLicense, readPosition, readPreferences, readPressArticle, readPressReview, readProfile, readRecommendations, readRequest, readTenant, readTheme, recordReadingSession, refreshSession, removeBiblioFavorite, removeCvsFavorite, removePartnerFavorite, renewLease, reorderThemes, replaceCategoryPreferences, replaceGrants, returnLoan, reviewDraft, search, searchDocuments, sendMessage, setLastPosition, startSession, streamingDetails, submitRequest, triageRequest, unlikeContent, updateAccount, updatePatron, updateProfile, updateTenant, uploadAttachment, writePosition, writeReview };
35
+ export { addBiblioFavorite, addCvsFavorite, addPartnerFavorite, adminCloseRequest, amendGoal, amendLevel, amendPractitioner, amendRequest, amendSubject, amendTheme, answerRequest, authorization, borrow, cancelRequest, claimRequest, closeLease, closeRequest, closeSupportSession, createDemoUser, createGoal, createLevel, createLicense, createProfile, createReport, createSessionFromCode, createSessionFromCredentials, createSubject, createTheme, deleteAccount, deleteAttachment, deleteLicense, deleteProfile, deleteSession, deleteTheme, dispatchRequest, extendLoan, forceCloseLease, getAddBiblioFavoriteUrl, getAddCvsFavoriteUrl, getAddPartnerFavoriteUrl, getAdminCloseRequestUrl, getAmendGoalUrl, getAmendLevelUrl, getAmendPractitionerUrl, getAmendRequestUrl, getAmendSubjectUrl, getAmendThemeUrl, getAnswerRequestUrl, getAuthorizationUrl, getBorrowUrl, getCancelRequestUrl, getClaimRequestUrl, getCloseLeaseUrl, getCloseRequestUrl, getCloseSupportSessionUrl, getCreateDemoUserUrl, getCreateGoalUrl, getCreateLevelUrl, getCreateLicenseUrl, getCreateProfileUrl, getCreateReportUrl, getCreateSessionFromCodeUrl, getCreateSessionFromCredentialsUrl, getCreateSubjectUrl, getCreateThemeUrl, getDeleteAccountUrl, getDeleteAttachmentUrl, getDeleteLicenseUrl, getDeleteProfileUrl, getDeleteSessionUrl, getDeleteThemeUrl, getDispatchRequestUrl, getExtendLoanUrl, getForceCloseLeaseUrl, getGetRequestUrl, getLikeContentUrl, getListAllRequestsUrl, getListBiblioCategoriesUrl, getListBiblioFavoritesUrl, getListCurrentReadingsUrl, getListCvsFavoritesUrl, getListEditorsUrl, getListExpiringDocumentsUrl, getListFeedbackUrl, getListGoalsUrl, getListGrantsUrl, getListHistoryUrl, getListLevelsUrl, getListLiveLeasesUrl, getListLoansUrl, getListMediaUrl, getListMessagesUrl, getListMyRequestsUrl, getListNotificationsUrl, getListPacksUrl, getListPartnerCategoriesUrl, getListPartnerFavoritesUrl, getListPatronsUrl, getListPaymentsUrl, getListPractitionerDocumentsUrl, getListPractitionersUrl, getListPressArticlesUrl, getListProfilesUrl, getListQueueUrl, getListReviewsUrl, getListSelectionsUrl, getListServicesUrl, getListSubjectsUrl, getListTenantsUrl, getListThemesUrl, getMintChatTicketUrl, getModerateFeedbackUrl, getModerateReviewUrl, getOpenAtSupplierUrl, getOpenRoomUrl, getOpenSupportSessionUrl, getRateDocumentUrl, getRateRequestUrl, getReadAccountUrl, getReadCatalogThemeUrl, getReadCatalogUrl, getReadContentUrl, getReadDocumentUrl, getReadDraftUrl, getReadEditorUrl, getReadHomeFeedUrl, getReadLastPositionUrl, getReadLearningPathUrl, getReadLicenseUrl, getReadMeUrl, getReadMediaUrl, getReadPackUrl, getReadPackageUrl, getReadPatronLicenseUrl, getReadPatronUrl, getReadPaymentUrl, getReadPositionUrl, getReadPreferencesUrl, getReadPressArticleUrl, getReadPressReviewUrl, getReadProfileUrl, getReadRecommendationsUrl, getReadRequestUrl, getReadTenantUrl, getReadThemeUrl, getRecordReadingSessionUrl, getRefreshSessionUrl, getRemoveBiblioFavoriteUrl, getRemoveCvsFavoriteUrl, getRemovePartnerFavoriteUrl, getRenewLeaseUrl, getReorderThemesUrl, getReplaceCategoryPreferencesUrl, getReplaceGrantsUrl, getRequest, getReturnLoanUrl, getReviewDraftUrl, getSearchDocumentsUrl, getSearchUrl, getSendMessageUrl, getSetLastPositionUrl, getStartPaymentUrl, getStartSessionUrl, getStreamingDetailsUrl, getSubmitRequestUrl, getTriageRequestUrl, getUnlikeContentUrl, getUpdateAccountUrl, getUpdatePatronUrl, getUpdateProfileUrl, getUpdateTenantUrl, getUploadAttachmentUrl, getWritePositionUrl, getWriteReviewUrl, likeContent, listAllRequests, listBiblioCategories, listBiblioFavorites, listCurrentReadings, listCvsFavorites, listEditors, listExpiringDocuments, listFeedback, listGoals, listGrants, listHistory, listLevels, listLiveLeases, listLoans, listMedia, listMessages, listMyRequests, listNotifications, listPacks, listPartnerCategories, listPartnerFavorites, listPatrons, listPayments, listPractitionerDocuments, listPractitioners, listPressArticles, listProfiles, listQueue, listReviews, listSelections, listServices, listSubjects, listTenants, listThemes, mintChatTicket, moderateFeedback, moderateReview, openAtSupplier, openRoom, openSupportSession, rateDocument, rateRequest, readAccount, readCatalog, readCatalogTheme, readContent, readDocument, readDraft, readEditor, readHomeFeed, readLastPosition, readLearningPath, readLicense, readMe, readMedia, readPack, readPackage, readPatron, readPatronLicense, readPayment, readPosition, readPreferences, readPressArticle, readPressReview, readProfile, readRecommendations, readRequest, readTenant, readTheme, recordReadingSession, refreshSession, removeBiblioFavorite, removeCvsFavorite, removePartnerFavorite, renewLease, reorderThemes, replaceCategoryPreferences, replaceGrants, returnLoan, reviewDraft, search, searchDocuments, sendMessage, setLastPosition, startPayment, startSession, streamingDetails, submitRequest, triageRequest, unlikeContent, updateAccount, updatePatron, updateProfile, updateTenant, uploadAttachment, writePosition, writeReview };
@@ -1,5 +1,5 @@
1
1
 
2
- import { Bt as PartnerCategoryListRead, It as PartnerMediaRead, Lt as PartnerMediaPage, Nn as PartnerProvider, Rt as PartnerFavoriteListRead, _n as ListMediaParams } from "../chunks/index.js";
2
+ import { Bn as PartnerProvider, Gt as PartnerFavoriteListRead, Ut as PartnerMediaRead, Wt as PartnerMediaPage, qt as PartnerCategoryListRead, wn as ListMediaParams } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/partner-catalogue/partner-catalogue.d.ts
5
5
  export declare const getListPartnerCategoriesUrl: (provider: PartnerProvider) => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { Nn as PartnerProvider, Tr as CurrentReadingListRead, ct as ReaderPackageRead, it as ReadingPositionWrite, ot as ReadingPositionRead, tt as ReadPackageParams } from "../chunks/index.js";
2
+ import { Bn as PartnerProvider, Nr as CurrentReadingListRead, ct as ReaderPackageRead, it as ReadingPositionWrite, ot as ReadingPositionRead, tt as ReadPackageParams } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/partner-reader/partner-reader.d.ts
5
5
  export declare const getReadPackageUrl: (provider: PartnerProvider, mediaId: number, params?: ReadPackageParams) => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { Fn as LevelListRead, P as SubjectListRead, sr as EducationalGoalListRead, xn as ListGoalsParams } from "../chunks/index.js";
2
+ import { Hn as LevelListRead, On as ListGoalsParams, P as SubjectListRead, hr as EducationalGoalListRead } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/tutoring-catalogue/tutoring-catalogue.d.ts
5
5
  export declare const getListGoalsUrl: (params?: ListGoalsParams) => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { Nr as ChatTicketRead, Xt as MessagePage, Yt as MessageWrite, Zt as MessageRead, gn as ListMessagesParams } from "../chunks/index.js";
2
+ import { Cn as ListMessagesParams, Vr as ChatTicketRead, in as MessageRead, nn as MessageWrite, rn as MessagePage } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/tutoring-chat/tutoring-chat.d.ts
5
5
  export declare const getMintChatTicketUrl: (requestId: number) => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { _ as TutoringDispatchWrite, d as TutoringQueuePage, un as ListQueueParams } from "../chunks/index.js";
2
+ import { _ as TutoringDispatchWrite, _n as ListQueueParams, d as TutoringQueuePage } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/tutoring-dispatch/tutoring-dispatch.d.ts
5
5
  export declare const getListQueueUrl: (params?: ListQueueParams) => string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { Gr as BodyUploadAttachment, a as TutoringRequestWrite, c as TutoringRequestRead, hn as ListMyRequestsParams, p as TutoringFeedbackWrite, s as TutoringRequestPage, x as TutoringAttachmentRead } from "../chunks/index.js";
2
+ import { $r as BodyUploadAttachment, Sn as ListMyRequestsParams, a as TutoringRequestWrite, c as TutoringRequestRead, p as TutoringFeedbackWrite, s as TutoringRequestPage, x as TutoringAttachmentRead } from "../chunks/index.js";
3
3
  import { c as request } from "../chunks/client.js";
4
4
  //#region src/api/tutoring-requests/tutoring-requests.d.ts
5
5
  export declare const getListMyRequestsUrl: (params?: ListMyRequestsParams) => string;
package/dist/chat.d.ts ADDED
@@ -0,0 +1,3 @@
1
+
2
+ import { i as connectTutoringChat, n as ChatConnectionOptions, r as ChatStatus, t as ChatConnection } from "./chunks/connection.js";
3
+ export { type ChatConnection, type ChatConnectionOptions, type ChatStatus, connectTutoringChat };
package/dist/chat.js ADDED
@@ -0,0 +1,3 @@
1
+
2
+ import { t as connectTutoringChat } from "./chunks/connection.js";
3
+ export { connectTutoringChat };
@@ -0,0 +1,28 @@
1
+
2
+ import { in as MessageRead } from "./index.js";
3
+ import { r as Client } from "./client.js";
4
+ //#region src/chat/connection.d.ts
5
+ type ChatStatus = 'connecting' | 'syncing' | 'connected' | 'reconnecting' | 'error' | 'closed';
6
+ interface ChatConnectionOptions {
7
+ client: Client;
8
+ requestId: number;
9
+ onMessage: (message: MessageRead) => void;
10
+ /** Runs after subscription readiness, with live messages buffered until it resolves. */
11
+ onConnect?: (signal: AbortSignal) => Promise<void>;
12
+ onStatusChange?: (status: ChatStatus) => void;
13
+ onError?: (error: Error) => void;
14
+ /** Defaults to the browser's native WebSocket. Also useful for native clients/tests. */
15
+ webSocketFactory?: (url: string) => WebSocket;
16
+ /** Attempt starts at zero; the default is exponential backoff with jitter, capped at 30s. */
17
+ retryDelay?: (attempt: number) => number;
18
+ connectTimeoutMs?: number;
19
+ }
20
+ interface ChatConnection {
21
+ /** Cancels ticket/history requests, reconnect timers and the socket. Safe to call twice. */
22
+ close(): void;
23
+ }
24
+ /** Open an authenticated live feed. Use generated REST methods to send and read history. */
25
+ declare function connectTutoringChat(options: ChatConnectionOptions): ChatConnection;
26
+ //#endregion
27
+ export { connectTutoringChat as i, ChatConnectionOptions as n, ChatStatus as r, ChatConnection as t };
28
+ //# sourceMappingURL=connection.d.ts.map