@learnorama/mozaik-sdk 0.1.0-staging.11.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.
- package/README.md +94 -0
- package/dist/api/account.d.ts +75 -0
- package/dist/api/account.js +117 -0
- package/dist/api/account.js.map +1 -0
- package/dist/api/admin-catalogue.d.ts +68 -0
- package/dist/api/admin-catalogue.js +155 -0
- package/dist/api/admin-catalogue.js.map +1 -0
- package/dist/api/admin-consumption.d.ts +27 -0
- package/dist/api/admin-consumption.js +55 -0
- package/dist/api/admin-consumption.js.map +1 -0
- package/dist/api/admin-licenses.d.ts +21 -0
- package/dist/api/admin-licenses.js +34 -0
- package/dist/api/admin-licenses.js.map +1 -0
- package/dist/api/admin-patrons.d.ts +36 -0
- package/dist/api/admin-patrons.js +76 -0
- package/dist/api/admin-patrons.js.map +1 -0
- package/dist/api/admin-reviews.d.ts +30 -0
- package/dist/api/admin-reviews.js +63 -0
- package/dist/api/admin-reviews.js.map +1 -0
- package/dist/api/admin-roles.d.ts +34 -0
- package/dist/api/admin-roles.js +62 -0
- package/dist/api/admin-roles.js.map +1 -0
- package/dist/api/admin-support.d.ts +68 -0
- package/dist/api/admin-support.js +116 -0
- package/dist/api/admin-support.js.map +1 -0
- package/dist/api/admin-tenants.d.ts +33 -0
- package/dist/api/admin-tenants.js +68 -0
- package/dist/api/admin-tenants.js.map +1 -0
- package/dist/api/admin-tutoring.d.ts +159 -0
- package/dist/api/admin-tutoring.js +455 -0
- package/dist/api/admin-tutoring.js.map +1 -0
- package/dist/api/auth.d.ts +92 -0
- package/dist/api/auth.js +192 -0
- package/dist/api/auth.js.map +1 -0
- package/dist/api/biblio-catalogue.d.ts +122 -0
- package/dist/api/biblio-catalogue.js +223 -0
- package/dist/api/biblio-catalogue.js.map +1 -0
- package/dist/api/biblio-home.d.ts +18 -0
- package/dist/api/biblio-home.js +31 -0
- package/dist/api/biblio-home.js.map +1 -0
- package/dist/api/biblio-library.d.ts +94 -0
- package/dist/api/biblio-library.js +187 -0
- package/dist/api/biblio-library.js.map +1 -0
- package/dist/api/biblio-nextory.d.ts +43 -0
- package/dist/api/biblio-nextory.js +65 -0
- package/dist/api/biblio-nextory.js.map +1 -0
- package/dist/api/biblio-press.d.ts +38 -0
- package/dist/api/biblio-press.js +70 -0
- package/dist/api/biblio-press.js.map +1 -0
- package/dist/api/biblio-search.d.ts +17 -0
- package/dist/api/biblio-search.js +30 -0
- package/dist/api/biblio-search.js.map +1 -0
- package/dist/api/biblio-telemetry.d.ts +28 -0
- package/dist/api/biblio-telemetry.js +49 -0
- package/dist/api/biblio-telemetry.js.map +1 -0
- package/dist/api/consumption.d.ts +30 -0
- package/dist/api/consumption.js +45 -0
- package/dist/api/consumption.js.map +1 -0
- package/dist/api/cvs-app.d.ts +39 -0
- package/dist/api/cvs-app.js +72 -0
- package/dist/api/cvs-app.js.map +1 -0
- package/dist/api/cvs-documents.d.ts +106 -0
- package/dist/api/cvs-documents.js +208 -0
- package/dist/api/cvs-documents.js.map +1 -0
- package/dist/api/cvs-favorites.d.ts +53 -0
- package/dist/api/cvs-favorites.js +82 -0
- package/dist/api/cvs-favorites.js.map +1 -0
- package/dist/api/cvs-loans.d.ts +59 -0
- package/dist/api/cvs-loans.js +106 -0
- package/dist/api/cvs-loans.js.map +1 -0
- package/dist/api/cvs-streaming.d.ts +40 -0
- package/dist/api/cvs-streaming.js +68 -0
- package/dist/api/cvs-streaming.js.map +1 -0
- package/dist/api/index.d.ts +34 -0
- package/dist/api/index.js +34 -0
- package/dist/api/partner-catalogue.d.ts +77 -0
- package/dist/api/partner-catalogue.js +125 -0
- package/dist/api/partner-catalogue.js.map +1 -0
- package/dist/api/partner-reader.d.ts +56 -0
- package/dist/api/partner-reader.js +103 -0
- package/dist/api/partner-reader.js.map +1 -0
- package/dist/api/profiles.d.ts +64 -0
- package/dist/api/profiles.js +126 -0
- package/dist/api/profiles.js.map +1 -0
- package/dist/api/tutoring-catalogue.d.ts +32 -0
- package/dist/api/tutoring-catalogue.js +59 -0
- package/dist/api/tutoring-catalogue.js.map +1 -0
- package/dist/api/tutoring-chat.d.ts +31 -0
- package/dist/api/tutoring-chat.js +71 -0
- package/dist/api/tutoring-chat.js.map +1 -0
- package/dist/api/tutoring-dispatch.d.ts +37 -0
- package/dist/api/tutoring-dispatch.js +83 -0
- package/dist/api/tutoring-dispatch.js.map +1 -0
- package/dist/api/tutoring-practitioner.d.ts +55 -0
- package/dist/api/tutoring-practitioner.js +110 -0
- package/dist/api/tutoring-practitioner.js.map +1 -0
- package/dist/api/tutoring-requests.d.ts +86 -0
- package/dist/api/tutoring-requests.js +176 -0
- package/dist/api/tutoring-requests.js.map +1 -0
- package/dist/chunks/client.d.ts +28 -0
- package/dist/chunks/client.js +61 -0
- package/dist/chunks/client.js.map +1 -0
- package/dist/chunks/index.d.ts +4566 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/models.d.ts +3 -0
- package/dist/models.js +175 -0
- package/dist/models.js.map +1 -0
- package/dist/react/account.d.ts +163 -0
- package/dist/react/account.js +240 -0
- package/dist/react/account.js.map +1 -0
- package/dist/react/admin-catalogue.d.ts +196 -0
- package/dist/react/admin-catalogue.js +336 -0
- package/dist/react/admin-catalogue.js.map +1 -0
- package/dist/react/admin-consumption.d.ts +75 -0
- package/dist/react/admin-consumption.js +127 -0
- package/dist/react/admin-consumption.js.map +1 -0
- package/dist/react/admin-licenses.d.ts +50 -0
- package/dist/react/admin-licenses.js +78 -0
- package/dist/react/admin-licenses.js.map +1 -0
- package/dist/react/admin-patrons.d.ts +111 -0
- package/dist/react/admin-patrons.js +173 -0
- package/dist/react/admin-patrons.js.map +1 -0
- package/dist/react/admin-reviews.d.ts +78 -0
- package/dist/react/admin-reviews.js +135 -0
- package/dist/react/admin-reviews.js.map +1 -0
- package/dist/react/admin-roles.d.ts +82 -0
- package/dist/react/admin-roles.js +135 -0
- package/dist/react/admin-roles.js.map +1 -0
- package/dist/react/admin-support.d.ts +123 -0
- package/dist/react/admin-support.js +208 -0
- package/dist/react/admin-support.js.map +1 -0
- package/dist/react/admin-tenants.d.ts +108 -0
- package/dist/react/admin-tenants.js +165 -0
- package/dist/react/admin-tenants.js.map +1 -0
- package/dist/react/admin-tutoring.d.ts +556 -0
- package/dist/react/admin-tutoring.js +954 -0
- package/dist/react/admin-tutoring.js.map +1 -0
- package/dist/react/auth.d.ts +220 -0
- package/dist/react/auth.js +372 -0
- package/dist/react/auth.js.map +1 -0
- package/dist/react/biblio-catalogue.d.ts +374 -0
- package/dist/react/biblio-catalogue.js +498 -0
- package/dist/react/biblio-catalogue.js.map +1 -0
- package/dist/react/biblio-home.d.ts +47 -0
- package/dist/react/biblio-home.js +75 -0
- package/dist/react/biblio-home.js.map +1 -0
- package/dist/react/biblio-library.d.ts +285 -0
- package/dist/react/biblio-library.js +411 -0
- package/dist/react/biblio-library.js.map +1 -0
- package/dist/react/biblio-nextory.d.ts +100 -0
- package/dist/react/biblio-nextory.js +163 -0
- package/dist/react/biblio-nextory.js.map +1 -0
- package/dist/react/biblio-press.d.ts +121 -0
- package/dist/react/biblio-press.js +163 -0
- package/dist/react/biblio-press.js.map +1 -0
- package/dist/react/biblio-search.d.ts +46 -0
- package/dist/react/biblio-search.js +74 -0
- package/dist/react/biblio-search.js.map +1 -0
- package/dist/react/biblio-telemetry.d.ts +49 -0
- package/dist/react/biblio-telemetry.js +85 -0
- package/dist/react/biblio-telemetry.js.map +1 -0
- package/dist/react/consumption.d.ts +66 -0
- package/dist/react/consumption.js +109 -0
- package/dist/react/consumption.js.map +1 -0
- package/dist/react/cvs-app.d.ts +86 -0
- package/dist/react/cvs-app.js +144 -0
- package/dist/react/cvs-app.js.map +1 -0
- package/dist/react/cvs-documents.d.ts +254 -0
- package/dist/react/cvs-documents.js +418 -0
- package/dist/react/cvs-documents.js.map +1 -0
- package/dist/react/cvs-favorites.d.ts +143 -0
- package/dist/react/cvs-favorites.js +206 -0
- package/dist/react/cvs-favorites.js.map +1 -0
- package/dist/react/cvs-loans.d.ts +140 -0
- package/dist/react/cvs-loans.js +234 -0
- package/dist/react/cvs-loans.js.map +1 -0
- package/dist/react/cvs-streaming.d.ts +87 -0
- package/dist/react/cvs-streaming.js +141 -0
- package/dist/react/cvs-streaming.js.map +1 -0
- package/dist/react/index.d.ts +34 -0
- package/dist/react/index.js +34 -0
- package/dist/react/partner-catalogue.d.ts +223 -0
- package/dist/react/partner-catalogue.js +301 -0
- package/dist/react/partner-catalogue.js.map +1 -0
- package/dist/react/partner-reader.d.ts +159 -0
- package/dist/react/partner-reader.js +226 -0
- package/dist/react/partner-reader.js.map +1 -0
- package/dist/react/profiles.d.ts +174 -0
- package/dist/react/profiles.js +279 -0
- package/dist/react/profiles.js.map +1 -0
- package/dist/react/tutoring-catalogue.d.ts +115 -0
- package/dist/react/tutoring-catalogue.js +151 -0
- package/dist/react/tutoring-catalogue.js.map +1 -0
- package/dist/react/tutoring-chat.d.ts +96 -0
- package/dist/react/tutoring-chat.js +172 -0
- package/dist/react/tutoring-chat.js.map +1 -0
- package/dist/react/tutoring-dispatch.d.ts +102 -0
- package/dist/react/tutoring-dispatch.js +183 -0
- package/dist/react/tutoring-dispatch.js.map +1 -0
- package/dist/react/tutoring-practitioner.d.ts +129 -0
- package/dist/react/tutoring-practitioner.js +230 -0
- package/dist/react/tutoring-practitioner.js.map +1 -0
- package/dist/react/tutoring-requests.d.ts +233 -0
- package/dist/react/tutoring-requests.js +385 -0
- package/dist/react/tutoring-requests.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"biblio-search.js","names":[],"sources":["../../src/react/biblio-search/biblio-search.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 {\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n SearchParams,\n SearchResultsRead,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nconst withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {\n const result = { queryKey } as T & { queryKey: K };\n for (const key of Object.keys(query)) {\n // The explicit queryKey always wins, matching the previous\n // `{ ...query, queryKey }` spread where it was set last.\n if (key === 'queryKey') continue;\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get: () => (query as Record<string, unknown>)[key],\n });\n }\n return result;\n};\n\nexport const getSearchUrl = (params?: SearchParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n\n if (value !== undefined) {\n normalizedParams.append(key, value === null ? 'null' : String(value))\n }\n });\n\n const stringifiedParams = normalizedParams.toString();\n\n return stringifiedParams.length > 0 ? `/biblio/search?${stringifiedParams}` : `/biblio/search`\n}\n\n/**\n * Search the catalogue (E46).\n *\n * An empty ``q`` returns an empty ``data`` with ``200``. It is not an error: a\n * client clearing its search box should get an empty result, not a failure.\n *\n * An unrecognised ``type`` is ``422``, naming the families that exist.\n * @summary Search\n */\nexport const search = async (params?: SearchParams, options?: Parameters<typeof request>[1]): Promise<SearchResultsRead> => {\n\n return request<SearchResultsRead>(getSearchUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getSearchQueryKey = (params?: SearchParams,) => {\n return [\n `/biblio/search`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getSearchQueryOptions = <TData = Awaited<ReturnType<typeof search>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: SearchParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof search>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getSearchQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof search>>> = ({ signal }) => search(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof search>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type SearchQueryResult = NonNullable<Awaited<ReturnType<typeof search>>>\nexport type SearchQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useSearch<TData = Awaited<ReturnType<typeof search>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | SearchParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof search>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof search>>,\n TError,\n Awaited<ReturnType<typeof search>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useSearch<TData = Awaited<ReturnType<typeof search>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: SearchParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof search>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof search>>,\n TError,\n Awaited<ReturnType<typeof search>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useSearch<TData = Awaited<ReturnType<typeof search>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: SearchParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof search>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Search\n */\n\nexport function useSearch<TData = Awaited<ReturnType<typeof search>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: SearchParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof search>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getSearchQueryOptions(params,options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\n"],"mappings":";;;;;;;;;;;AAqCA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EAGpC,IAAI,QAAQ,YAAY;EACxB,OAAO,eAAe,QAAQ,KAAK;GACjC,YAAY;GACZ,cAAc;GACd,WAAY,MAAkC;EAChD,CAAC;CACH;CACA,OAAO;AACT;AAEA,MAAa,gBAAgB,WAA2B;CACtD,MAAM,mBAAmB,IAAI,gBAAgB;CAE7C,OAAO,QAAQ,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;EAErD,IAAI,UAAU,KAAA,GACZ,iBAAiB,OAAO,KAAK,UAAU,OAAO,SAAS,OAAO,KAAK,CAAC;CAExE,CAAC;CAED,MAAM,oBAAoB,iBAAiB,SAAS;CAEpD,OAAO,kBAAkB,SAAS,IAAI,kBAAkB,sBAAsB;AAChF;;;;;;;;;;AAWA,MAAa,SAAS,OAAO,QAAuB,YAAwE;CAE1H,OAAO,QAA2B,aAAa,MAAM,GACrD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,qBAAqB,WAA2B;CACzD,OAAO,CACP,kBAAkB,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CAC3C;AACA;AAGJ,MAAa,yBAA0I,QAAuB,YACzK;CAEL,MAAM,EAAC,OAAO,cAAc,SAAS,mBAAkB,WAAW,CAAC;CAEjE,MAAM,WAAY,cAAc,YAAY,kBAAkB,MAAM;CAIlE,MAAM,WAA8D,EAAE,aAAa,OAAO,QAAQ;EAAE;EAAQ,GAAG;CAAe,CAAC;CAMhI,OAAQ;EAAE;EAAU;EAAS,GAAG;CAAY;AAC/C;;;;AAkCA,SAAgB,UACf,QAAuB,SACrB,aACiF;CAElF,MAAM,eAAe,sBAAsB,QAAO,OAAO;CAEzD,MAAM,QAAQ,SAAS,cAAc,WAAW;CAEhD,OAAO,aAAa,OAAO,aAAa,QAAQ;AAClD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
import { Gn as HTTPExceptionResponse, nt as ReadingSessionWrite, rt as ReadingSessionRead, t as ValidationErrorResponse } from "../chunks/index.js";
|
|
3
|
+
import { a as ErrorType, c as request, n as BodyType } from "../chunks/client.js";
|
|
4
|
+
import { QueryClient, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
|
|
5
|
+
//#region src/react/biblio-telemetry/biblio-telemetry.d.ts
|
|
6
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
7
|
+
export declare const getRecordReadingSessionUrl: (sessionTag: string) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Record one content-consumption session (E54). Idempotent on ``session_tag``.
|
|
10
|
+
*
|
|
11
|
+
* **There is no ``user_id`` and no ``client_id`` in the body, and there must
|
|
12
|
+
* never be.** The legacy endpoint was unauthenticated and took both from the
|
|
13
|
+
* request without checking either against a credential, so consumption records
|
|
14
|
+
* — which is to say the billing record — were forgeable for any account
|
|
15
|
+
* (defect D3). Both come from the token here.
|
|
16
|
+
*
|
|
17
|
+
* ``PUT`` because the legacy handler already checked whether the tag existed and
|
|
18
|
+
* returned success rather than duplicating: that is an upsert keyed by a
|
|
19
|
+
* client-supplied identifier, and the verb now says so. The tag becomes
|
|
20
|
+
* ``ConsumptionEvent.request_key``, so a retried request after a timeout costs
|
|
21
|
+
* one unit rather than two — enforced by a partial unique index, not by
|
|
22
|
+
* checking first and hoping.
|
|
23
|
+
*
|
|
24
|
+
* ``201`` on the first write for a tag, ``200`` when it already existed. Never
|
|
25
|
+
* an error for a repeat: that is what idempotent means (§2.6).
|
|
26
|
+
* @summary Record Reading Session
|
|
27
|
+
*/
|
|
28
|
+
export declare const recordReadingSession: (sessionTag: string, readingSessionWrite: ReadingSessionWrite, options?: Parameters<typeof request>[1]) => Promise<ReadingSessionRead>;
|
|
29
|
+
export declare const getRecordReadingSessionMutationKey: () => readonly ['recordReadingSession'];
|
|
30
|
+
export declare const getRecordReadingSessionMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
31
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof recordReadingSession>>, TError, RecordReadingSessionMutationVariables, TContext>;
|
|
32
|
+
request?: SecondParameter<typeof request>;
|
|
33
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof recordReadingSession>>, TError, RecordReadingSessionMutationVariables, TContext>;
|
|
34
|
+
export type RecordReadingSessionMutationResult = NonNullable<Awaited<ReturnType<typeof recordReadingSession>>>;
|
|
35
|
+
export type RecordReadingSessionMutationBody = BodyType<ReadingSessionWrite>;
|
|
36
|
+
export type RecordReadingSessionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
37
|
+
export type RecordReadingSessionMutationVariables = {
|
|
38
|
+
sessionTag: string;
|
|
39
|
+
data: BodyType<ReadingSessionWrite>;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* @summary Record Reading Session
|
|
43
|
+
*/
|
|
44
|
+
export declare const useRecordReadingSession: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
45
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof recordReadingSession>>, TError, RecordReadingSessionMutationVariables, TContext>;
|
|
46
|
+
request?: SecondParameter<typeof request>;
|
|
47
|
+
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof recordReadingSession>>, TError, RecordReadingSessionMutationVariables, TContext>;
|
|
48
|
+
//#endregion
|
|
49
|
+
//# sourceMappingURL=biblio-telemetry.d.ts.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as request } from "../chunks/client.js";
|
|
3
|
+
import { useMutation } from "@tanstack/react-query";
|
|
4
|
+
//#region src/react/biblio-telemetry/biblio-telemetry.ts
|
|
5
|
+
/**
|
|
6
|
+
* Generated by orval 🍺
|
|
7
|
+
* Do not edit manually.
|
|
8
|
+
* Mozaik backend
|
|
9
|
+
* 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.
|
|
10
|
+
* OpenAPI spec version: 0.1.0
|
|
11
|
+
*/
|
|
12
|
+
const getRecordReadingSessionUrl = (sessionTag) => {
|
|
13
|
+
return `/biblio/reading-sessions/${sessionTag}`;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Record one content-consumption session (E54). Idempotent on ``session_tag``.
|
|
17
|
+
*
|
|
18
|
+
* **There is no ``user_id`` and no ``client_id`` in the body, and there must
|
|
19
|
+
* never be.** The legacy endpoint was unauthenticated and took both from the
|
|
20
|
+
* request without checking either against a credential, so consumption records
|
|
21
|
+
* — which is to say the billing record — were forgeable for any account
|
|
22
|
+
* (defect D3). Both come from the token here.
|
|
23
|
+
*
|
|
24
|
+
* ``PUT`` because the legacy handler already checked whether the tag existed and
|
|
25
|
+
* returned success rather than duplicating: that is an upsert keyed by a
|
|
26
|
+
* client-supplied identifier, and the verb now says so. The tag becomes
|
|
27
|
+
* ``ConsumptionEvent.request_key``, so a retried request after a timeout costs
|
|
28
|
+
* one unit rather than two — enforced by a partial unique index, not by
|
|
29
|
+
* checking first and hoping.
|
|
30
|
+
*
|
|
31
|
+
* ``201`` on the first write for a tag, ``200`` when it already existed. Never
|
|
32
|
+
* an error for a repeat: that is what idempotent means (§2.6).
|
|
33
|
+
* @summary Record Reading Session
|
|
34
|
+
*/
|
|
35
|
+
const recordReadingSession = async (sessionTag, readingSessionWrite, options) => {
|
|
36
|
+
const getHeaders = (h) => {
|
|
37
|
+
if (!h) return {};
|
|
38
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
39
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
40
|
+
const headers = {};
|
|
41
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
42
|
+
return headers;
|
|
43
|
+
};
|
|
44
|
+
return request(getRecordReadingSessionUrl(sessionTag), {
|
|
45
|
+
...options,
|
|
46
|
+
method: "PUT",
|
|
47
|
+
headers: {
|
|
48
|
+
"Content-Type": "application/json",
|
|
49
|
+
...getHeaders(options?.headers)
|
|
50
|
+
},
|
|
51
|
+
body: JSON.stringify(readingSessionWrite)
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
const getRecordReadingSessionMutationKey = () => ["recordReadingSession"];
|
|
55
|
+
const getRecordReadingSessionMutationOptions = (options) => {
|
|
56
|
+
const mutationKey = getRecordReadingSessionMutationKey();
|
|
57
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
58
|
+
...options,
|
|
59
|
+
mutation: {
|
|
60
|
+
...options.mutation,
|
|
61
|
+
mutationKey
|
|
62
|
+
}
|
|
63
|
+
} : {
|
|
64
|
+
mutation: { mutationKey },
|
|
65
|
+
request: void 0
|
|
66
|
+
};
|
|
67
|
+
const mutationFn = (props) => {
|
|
68
|
+
const { sessionTag, data } = props ?? {};
|
|
69
|
+
return recordReadingSession(sessionTag, data, requestOptions);
|
|
70
|
+
};
|
|
71
|
+
return {
|
|
72
|
+
mutationFn,
|
|
73
|
+
...mutationOptions
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* @summary Record Reading Session
|
|
78
|
+
*/
|
|
79
|
+
const useRecordReadingSession = (options, queryClient) => {
|
|
80
|
+
return useMutation(getRecordReadingSessionMutationOptions(options), queryClient);
|
|
81
|
+
};
|
|
82
|
+
//#endregion
|
|
83
|
+
export { getRecordReadingSessionMutationKey, getRecordReadingSessionMutationOptions, getRecordReadingSessionUrl, recordReadingSession, useRecordReadingSession };
|
|
84
|
+
|
|
85
|
+
//# sourceMappingURL=biblio-telemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"biblio-telemetry.js","names":[],"sources":["../../src/react/biblio-telemetry/biblio-telemetry.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 {\n useMutation\n} from '@tanstack/react-query';\nimport type {\n MutationFunction,\n QueryClient,\n UseMutationOptions,\n UseMutationResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n ReadingSessionRead,\n ReadingSessionWrite,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType , BodyType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nexport const getRecordReadingSessionUrl = (sessionTag: string,) => {\n\n\n\n\n return `/biblio/reading-sessions/${sessionTag}`\n}\n\n/**\n * Record one content-consumption session (E54). Idempotent on ``session_tag``.\n *\n * **There is no ``user_id`` and no ``client_id`` in the body, and there must\n * never be.** The legacy endpoint was unauthenticated and took both from the\n * request without checking either against a credential, so consumption records\n * — which is to say the billing record — were forgeable for any account\n * (defect D3). Both come from the token here.\n *\n * ``PUT`` because the legacy handler already checked whether the tag existed and\n * returned success rather than duplicating: that is an upsert keyed by a\n * client-supplied identifier, and the verb now says so. The tag becomes\n * ``ConsumptionEvent.request_key``, so a retried request after a timeout costs\n * one unit rather than two — enforced by a partial unique index, not by\n * checking first and hoping.\n *\n * ``201`` on the first write for a tag, ``200`` when it already existed. Never\n * an error for a repeat: that is what idempotent means (§2.6).\n * @summary Record Reading Session\n */\nexport const recordReadingSession = async (sessionTag: string,\n readingSessionWrite: ReadingSessionWrite, options?: Parameters<typeof request>[1]): Promise<ReadingSessionRead> => {\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<ReadingSessionRead>(getRecordReadingSessionUrl(sessionTag),\n {\n ...options,\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(readingSessionWrite)\n }\n);}\n\n\n\n\n\nexport const getRecordReadingSessionMutationKey = () => ['recordReadingSession'] as const;\n\nexport const getRecordReadingSessionMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof recordReadingSession>>, TError,RecordReadingSessionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof recordReadingSession>>, TError,RecordReadingSessionMutationVariables, TContext> => {\n\nconst mutationKey = getRecordReadingSessionMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof recordReadingSession>>, RecordReadingSessionMutationVariables> = (props) => {\n const {sessionTag,data} = props ?? {};\n\n return recordReadingSession(sessionTag,data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type RecordReadingSessionMutationResult = NonNullable<Awaited<ReturnType<typeof recordReadingSession>>>\n export type RecordReadingSessionMutationBody = BodyType<ReadingSessionWrite>\n export type RecordReadingSessionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type RecordReadingSessionMutationVariables = {sessionTag: string;data: BodyType<ReadingSessionWrite>}\n\n /**\n * @summary Record Reading Session\n */\nexport const useRecordReadingSession = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof recordReadingSession>>, TError,RecordReadingSessionMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof recordReadingSession>>,\n TError,\n RecordReadingSessionMutationVariables,\n TContext\n > => {\n return useMutation(getRecordReadingSessionMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AAgCA,MAAa,8BAA8B,eAAwB;CAKjE,OAAO,4BAA4B;AACrC;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,uBAAuB,OAAO,YACvC,qBAA0C,YAAyE;CAEnH,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,QAA4B,2BAA2B,UAAU,GACtE;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,mBAAmB;CAC1C,CACF;AAAE;AAMF,MAAa,2CAA2C,CAAC,sBAAsB;AAE/E,MAAa,0CACW,YAC2G;CAEnI,MAAM,cAAc,mCAAmC;CACvD,MAAM,EAAC,UAAU,iBAAiB,SAAS,mBAAkB,UACvD,QAAQ,YAAY,iBAAiB,QAAQ,YAAY,QAAQ,SAAS,cAC1E,UACE;EAAC,GAAG;EAAS,UAAU;GAAC,GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;EAAG,SAAS,KAAA;CAAS;CAKjD,MAAM,cAAyH,UAAU;EACrI,MAAM,EAAC,YAAW,SAAQ,SAAS,CAAC;EAEpC,OAAQ,qBAAqB,YAAW,MAAK,cAAc;CAC7D;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,2BACW,SACrB,gBAKQ;CACL,OAAO,YAAY,uCAAuC,OAAO,GAAG,WAAW;AACjF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
|
|
2
|
+
import { Gn as HTTPExceptionResponse, Rn as LeaseRead, t as ValidationErrorResponse } from "../chunks/index.js";
|
|
3
|
+
import { a as ErrorType, c as request } from "../chunks/client.js";
|
|
4
|
+
import { QueryClient, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
|
|
5
|
+
//#region src/react/consumption/consumption.d.ts
|
|
6
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
7
|
+
export declare const getCloseLeaseUrl: (eventId: number) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Finish reading. Returns the seat immediately rather than at lapse.
|
|
10
|
+
*
|
|
11
|
+
* ``204`` whether or not the lease was still open: the desired end state is
|
|
12
|
+
* "closed", and a client that lost its connection and retried should not get an
|
|
13
|
+
* error for succeeding twice.
|
|
14
|
+
* @summary Close Lease
|
|
15
|
+
*/
|
|
16
|
+
export declare const closeLease: (eventId: number, options?: Parameters<typeof request>[1]) => Promise<void>;
|
|
17
|
+
export declare const getCloseLeaseMutationKey: () => readonly ['closeLease'];
|
|
18
|
+
export declare const getCloseLeaseMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
19
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof closeLease>>, TError, CloseLeaseMutationVariables, TContext>;
|
|
20
|
+
request?: SecondParameter<typeof request>;
|
|
21
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof closeLease>>, TError, CloseLeaseMutationVariables, TContext>;
|
|
22
|
+
export type CloseLeaseMutationResult = NonNullable<Awaited<ReturnType<typeof closeLease>>>;
|
|
23
|
+
export type CloseLeaseMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
24
|
+
export type CloseLeaseMutationVariables = {
|
|
25
|
+
eventId: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* @summary Close Lease
|
|
29
|
+
*/
|
|
30
|
+
export declare const useCloseLease: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
31
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof closeLease>>, TError, CloseLeaseMutationVariables, TContext>;
|
|
32
|
+
request?: SecondParameter<typeof request>;
|
|
33
|
+
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof closeLease>>, TError, CloseLeaseMutationVariables, TContext>;
|
|
34
|
+
export declare const getRenewLeaseUrl: (eventId: number) => string;
|
|
35
|
+
/**
|
|
36
|
+
* Heartbeat. Push the lease out; the client repeats before it lapses.
|
|
37
|
+
*
|
|
38
|
+
* ``404`` when the lease is closed, reaped, or somebody else's — the three are
|
|
39
|
+
* deliberately indistinguishable, because a lease id is a bare integer and
|
|
40
|
+
* guessing one must not reveal whether it exists.
|
|
41
|
+
*
|
|
42
|
+
* This does not write the ledger. A reader refreshing every thirty seconds for
|
|
43
|
+
* an hour would be 120 UPDATEs on the table we bill from, for a value that only
|
|
44
|
+
* matters while it is current; the durable extent is settled once, at close.
|
|
45
|
+
* @summary Renew Lease
|
|
46
|
+
*/
|
|
47
|
+
export declare const renewLease: (eventId: number, options?: Parameters<typeof request>[1]) => Promise<LeaseRead>;
|
|
48
|
+
export declare const getRenewLeaseMutationKey: () => readonly ['renewLease'];
|
|
49
|
+
export declare const getRenewLeaseMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
50
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof renewLease>>, TError, RenewLeaseMutationVariables, TContext>;
|
|
51
|
+
request?: SecondParameter<typeof request>;
|
|
52
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof renewLease>>, TError, RenewLeaseMutationVariables, TContext>;
|
|
53
|
+
export type RenewLeaseMutationResult = NonNullable<Awaited<ReturnType<typeof renewLease>>>;
|
|
54
|
+
export type RenewLeaseMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
55
|
+
export type RenewLeaseMutationVariables = {
|
|
56
|
+
eventId: number;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* @summary Renew Lease
|
|
60
|
+
*/
|
|
61
|
+
export declare const useRenewLease: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
62
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof renewLease>>, TError, RenewLeaseMutationVariables, TContext>;
|
|
63
|
+
request?: SecondParameter<typeof request>;
|
|
64
|
+
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof renewLease>>, TError, RenewLeaseMutationVariables, TContext>;
|
|
65
|
+
//#endregion
|
|
66
|
+
//# sourceMappingURL=consumption.d.ts.map
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as request } from "../chunks/client.js";
|
|
3
|
+
import { useMutation } from "@tanstack/react-query";
|
|
4
|
+
//#region src/react/consumption/consumption.ts
|
|
5
|
+
/**
|
|
6
|
+
* Generated by orval 🍺
|
|
7
|
+
* Do not edit manually.
|
|
8
|
+
* Mozaik backend
|
|
9
|
+
* 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.
|
|
10
|
+
* OpenAPI spec version: 0.1.0
|
|
11
|
+
*/
|
|
12
|
+
const getCloseLeaseUrl = (eventId) => {
|
|
13
|
+
return `/consumption/${eventId}`;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Finish reading. Returns the seat immediately rather than at lapse.
|
|
17
|
+
*
|
|
18
|
+
* ``204`` whether or not the lease was still open: the desired end state is
|
|
19
|
+
* "closed", and a client that lost its connection and retried should not get an
|
|
20
|
+
* error for succeeding twice.
|
|
21
|
+
* @summary Close Lease
|
|
22
|
+
*/
|
|
23
|
+
const closeLease = async (eventId, options) => {
|
|
24
|
+
return request(getCloseLeaseUrl(eventId), {
|
|
25
|
+
...options,
|
|
26
|
+
method: "DELETE"
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
const getCloseLeaseMutationKey = () => ["closeLease"];
|
|
30
|
+
const getCloseLeaseMutationOptions = (options) => {
|
|
31
|
+
const mutationKey = getCloseLeaseMutationKey();
|
|
32
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
33
|
+
...options,
|
|
34
|
+
mutation: {
|
|
35
|
+
...options.mutation,
|
|
36
|
+
mutationKey
|
|
37
|
+
}
|
|
38
|
+
} : {
|
|
39
|
+
mutation: { mutationKey },
|
|
40
|
+
request: void 0
|
|
41
|
+
};
|
|
42
|
+
const mutationFn = (props) => {
|
|
43
|
+
const { eventId } = props ?? {};
|
|
44
|
+
return closeLease(eventId, requestOptions);
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
mutationFn,
|
|
48
|
+
...mutationOptions
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* @summary Close Lease
|
|
53
|
+
*/
|
|
54
|
+
const useCloseLease = (options, queryClient) => {
|
|
55
|
+
return useMutation(getCloseLeaseMutationOptions(options), queryClient);
|
|
56
|
+
};
|
|
57
|
+
const getRenewLeaseUrl = (eventId) => {
|
|
58
|
+
return `/consumption/${eventId}`;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Heartbeat. Push the lease out; the client repeats before it lapses.
|
|
62
|
+
*
|
|
63
|
+
* ``404`` when the lease is closed, reaped, or somebody else's — the three are
|
|
64
|
+
* deliberately indistinguishable, because a lease id is a bare integer and
|
|
65
|
+
* guessing one must not reveal whether it exists.
|
|
66
|
+
*
|
|
67
|
+
* This does not write the ledger. A reader refreshing every thirty seconds for
|
|
68
|
+
* an hour would be 120 UPDATEs on the table we bill from, for a value that only
|
|
69
|
+
* matters while it is current; the durable extent is settled once, at close.
|
|
70
|
+
* @summary Renew Lease
|
|
71
|
+
*/
|
|
72
|
+
const renewLease = async (eventId, options) => {
|
|
73
|
+
return request(getRenewLeaseUrl(eventId), {
|
|
74
|
+
...options,
|
|
75
|
+
method: "PUT"
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
const getRenewLeaseMutationKey = () => ["renewLease"];
|
|
79
|
+
const getRenewLeaseMutationOptions = (options) => {
|
|
80
|
+
const mutationKey = getRenewLeaseMutationKey();
|
|
81
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
82
|
+
...options,
|
|
83
|
+
mutation: {
|
|
84
|
+
...options.mutation,
|
|
85
|
+
mutationKey
|
|
86
|
+
}
|
|
87
|
+
} : {
|
|
88
|
+
mutation: { mutationKey },
|
|
89
|
+
request: void 0
|
|
90
|
+
};
|
|
91
|
+
const mutationFn = (props) => {
|
|
92
|
+
const { eventId } = props ?? {};
|
|
93
|
+
return renewLease(eventId, requestOptions);
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
mutationFn,
|
|
97
|
+
...mutationOptions
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* @summary Renew Lease
|
|
102
|
+
*/
|
|
103
|
+
const useRenewLease = (options, queryClient) => {
|
|
104
|
+
return useMutation(getRenewLeaseMutationOptions(options), queryClient);
|
|
105
|
+
};
|
|
106
|
+
//#endregion
|
|
107
|
+
export { closeLease, getCloseLeaseMutationKey, getCloseLeaseMutationOptions, getCloseLeaseUrl, getRenewLeaseMutationKey, getRenewLeaseMutationOptions, getRenewLeaseUrl, renewLease, useCloseLease, useRenewLease };
|
|
108
|
+
|
|
109
|
+
//# sourceMappingURL=consumption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consumption.js","names":[],"sources":["../../src/react/consumption/consumption.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 {\n useMutation\n} from '@tanstack/react-query';\nimport type {\n MutationFunction,\n QueryClient,\n UseMutationOptions,\n UseMutationResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n LeaseRead,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nexport const getCloseLeaseUrl = (eventId: number,) => {\n\n\n\n\n return `/consumption/${eventId}`\n}\n\n/**\n * Finish reading. Returns the seat immediately rather than at lapse.\n *\n * ``204`` whether or not the lease was still open: the desired end state is\n * \"closed\", and a client that lost its connection and retried should not get an\n * error for succeeding twice.\n * @summary Close Lease\n */\nexport const closeLease = async (eventId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getCloseLeaseUrl(eventId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\n\n\n\nexport const getCloseLeaseMutationKey = () => ['closeLease'] as const;\n\nexport const getCloseLeaseMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof closeLease>>, TError,CloseLeaseMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof closeLease>>, TError,CloseLeaseMutationVariables, TContext> => {\n\nconst mutationKey = getCloseLeaseMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof closeLease>>, CloseLeaseMutationVariables> = (props) => {\n const {eventId} = props ?? {};\n\n return closeLease(eventId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CloseLeaseMutationResult = NonNullable<Awaited<ReturnType<typeof closeLease>>>\n\n export type CloseLeaseMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type CloseLeaseMutationVariables = {eventId: number}\n\n /**\n * @summary Close Lease\n */\nexport const useCloseLease = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof closeLease>>, TError,CloseLeaseMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof closeLease>>,\n TError,\n CloseLeaseMutationVariables,\n TContext\n > => {\n return useMutation(getCloseLeaseMutationOptions(options), queryClient);\n }\n export const getRenewLeaseUrl = (eventId: number,) => {\n\n\n\n\n return `/consumption/${eventId}`\n}\n\n/**\n * Heartbeat. Push the lease out; the client repeats before it lapses.\n *\n * ``404`` when the lease is closed, reaped, or somebody else's — the three are\n * deliberately indistinguishable, because a lease id is a bare integer and\n * guessing one must not reveal whether it exists.\n *\n * This does not write the ledger. A reader refreshing every thirty seconds for\n * an hour would be 120 UPDATEs on the table we bill from, for a value that only\n * matters while it is current; the durable extent is settled once, at close.\n * @summary Renew Lease\n */\nexport const renewLease = async (eventId: number, options?: Parameters<typeof request>[1]): Promise<LeaseRead> => {\n\n return request<LeaseRead>(getRenewLeaseUrl(eventId),\n {\n ...options,\n method: 'PUT'\n\n\n }\n);}\n\n\n\n\n\nexport const getRenewLeaseMutationKey = () => ['renewLease'] as const;\n\nexport const getRenewLeaseMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof renewLease>>, TError,RenewLeaseMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof renewLease>>, TError,RenewLeaseMutationVariables, TContext> => {\n\nconst mutationKey = getRenewLeaseMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof renewLease>>, RenewLeaseMutationVariables> = (props) => {\n const {eventId} = props ?? {};\n\n return renewLease(eventId,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type RenewLeaseMutationResult = NonNullable<Awaited<ReturnType<typeof renewLease>>>\n\n export type RenewLeaseMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type RenewLeaseMutationVariables = {eventId: number}\n\n /**\n * @summary Renew Lease\n */\nexport const useRenewLease = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof renewLease>>, TError,RenewLeaseMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof renewLease>>,\n TError,\n RenewLeaseMutationVariables,\n TContext\n > => {\n return useMutation(getRenewLeaseMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA+BA,MAAa,oBAAoB,YAAqB;CAKpD,OAAO,gBAAgB;AACzB;;;;;;;;;AAUA,MAAa,aAAa,OAAO,SAAiB,YAA2D;CAE3G,OAAO,QAAc,iBAAiB,OAAO,GAC7C;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,iCAAiC,CAAC,YAAY;AAE3D,MAAa,gCACW,YACuF;CAE/G,MAAM,cAAc,yBAAyB;CAC7C,MAAM,EAAC,UAAU,iBAAiB,SAAS,mBAAkB,UACvD,QAAQ,YAAY,iBAAiB,QAAQ,YAAY,QAAQ,SAAS,cAC1E,UACE;EAAC,GAAG;EAAS,UAAU;GAAC,GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;EAAG,SAAS,KAAA;CAAS;CAKjD,MAAM,cAAqG,UAAU;EACjH,MAAM,EAAC,YAAW,SAAS,CAAC;EAE5B,OAAQ,WAAW,SAAQ,cAAc;CAC3C;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,iBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,6BAA6B,OAAO,GAAG,WAAW;AACvE;AACA,MAAa,oBAAoB,YAAqB;CAKxD,OAAO,gBAAgB;AACzB;;;;;;;;;;;;;AAcA,MAAa,aAAa,OAAO,SAAiB,YAAgE;CAEhH,OAAO,QAAmB,iBAAiB,OAAO,GAClD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,iCAAiC,CAAC,YAAY;AAE3D,MAAa,gCACW,YACuF;CAE/G,MAAM,cAAc,yBAAyB;CAC7C,MAAM,EAAC,UAAU,iBAAiB,SAAS,mBAAkB,UACvD,QAAQ,YAAY,iBAAiB,QAAQ,YAAY,QAAQ,SAAS,cAC1E,UACE;EAAC,GAAG;EAAS,UAAU;GAAC,GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;EAAG,SAAS,KAAA;CAAS;CAKjD,MAAM,cAAqG,UAAU;EACjH,MAAM,EAAC,YAAW,SAAS,CAAC;EAE5B,OAAQ,WAAW,SAAQ,cAAc;CAC3C;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,iBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,6BAA6B,OAAO,GAAG,WAAW;AACvE"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
|
|
2
|
+
import { At as PlaybackReportWrite, Gn as HTTPExceptionResponse, Kt as NotificationListRead, jt as PlaybackReportRead, mn as ListNotificationsParams, t as ValidationErrorResponse } from "../chunks/index.js";
|
|
3
|
+
import { a as ErrorType, c as request, n as BodyType } from "../chunks/client.js";
|
|
4
|
+
import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
5
|
+
//#region src/react/cvs-app/cvs-app.d.ts
|
|
6
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
7
|
+
export declare const getListNotificationsUrl: (params?: ListNotificationsParams) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Notifications published to this caller's library.
|
|
10
|
+
*
|
|
11
|
+
* **These are tenant broadcasts, not a per-user inbox.** ``app_notification``
|
|
12
|
+
* has no user column and no read state — ``app_notification_bm`` links a
|
|
13
|
+
* notification to a library and that is the whole model. So ``unread_count`` is
|
|
14
|
+
* always ``0`` here and every notification is returned every time.
|
|
15
|
+
*
|
|
16
|
+
* Giving each member their own read state is a schema change (a
|
|
17
|
+
* ``notification_read`` row per user and notification), not a query change. It
|
|
18
|
+
* is worth doing — a broadcast list that never shrinks is one people stop
|
|
19
|
+
* opening — but it is a decision rather than a port, so it is not made here.
|
|
20
|
+
* @summary List Notifications
|
|
21
|
+
*/
|
|
22
|
+
export declare const listNotifications: (params?: ListNotificationsParams, options?: Parameters<typeof request>[1]) => Promise<NotificationListRead>;
|
|
23
|
+
export declare const getListNotificationsQueryKey: (params?: ListNotificationsParams) => readonly ["/cvs/notifications", ...ListNotificationsParams[]];
|
|
24
|
+
export declare const getListNotificationsQueryOptions: <TData = Awaited<ReturnType<typeof listNotifications>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListNotificationsParams, options?: {
|
|
25
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listNotifications>>, TError, TData>>;
|
|
26
|
+
request?: SecondParameter<typeof request>;
|
|
27
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof listNotifications>>, TError, TData> & {
|
|
28
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
29
|
+
};
|
|
30
|
+
export type ListNotificationsQueryResult = NonNullable<Awaited<ReturnType<typeof listNotifications>>>;
|
|
31
|
+
export type ListNotificationsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
32
|
+
export declare function useListNotifications<TData = Awaited<ReturnType<typeof listNotifications>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params: undefined | ListNotificationsParams, options: {
|
|
33
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof listNotifications>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof listNotifications>>, TError, Awaited<ReturnType<typeof listNotifications>>>, 'initialData'>;
|
|
34
|
+
request?: SecondParameter<typeof request>;
|
|
35
|
+
}, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
|
|
36
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
37
|
+
};
|
|
38
|
+
export declare function useListNotifications<TData = Awaited<ReturnType<typeof listNotifications>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListNotificationsParams, options?: {
|
|
39
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listNotifications>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof listNotifications>>, TError, Awaited<ReturnType<typeof listNotifications>>>, 'initialData'>;
|
|
40
|
+
request?: SecondParameter<typeof request>;
|
|
41
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
42
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
43
|
+
};
|
|
44
|
+
export declare function useListNotifications<TData = Awaited<ReturnType<typeof listNotifications>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListNotificationsParams, options?: {
|
|
45
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listNotifications>>, TError, TData>>;
|
|
46
|
+
request?: SecondParameter<typeof request>;
|
|
47
|
+
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
48
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
49
|
+
};
|
|
50
|
+
export declare const getCreateReportUrl: () => string;
|
|
51
|
+
/**
|
|
52
|
+
* Report a playback problem.
|
|
53
|
+
*
|
|
54
|
+
* The identifying fields are taken from the credential, not the body. The
|
|
55
|
+
* legacy took ``adhId``, ``bmId`` and ``bmBibLocaleId`` from the query string
|
|
56
|
+
* and declared no ``Authorization`` at all, so anyone holding the shared
|
|
57
|
+
* ``api_key`` — which every deployed app binary contains — could file a report
|
|
58
|
+
* in any patron's name, at any library. The DTO still carries those three
|
|
59
|
+
* fields, marked transition-only, and this handler ignores every one of them.
|
|
60
|
+
*
|
|
61
|
+
* ``email`` is free text that ends up in a message. Authenticated and
|
|
62
|
+
* rate-limited it is a support channel; unauthenticated it is a spam relay with
|
|
63
|
+
* the library's return address on it.
|
|
64
|
+
* @summary Create Report
|
|
65
|
+
*/
|
|
66
|
+
export declare const createReport: (playbackReportWrite: PlaybackReportWrite, options?: Parameters<typeof request>[1]) => Promise<PlaybackReportRead>;
|
|
67
|
+
export declare const getCreateReportMutationKey: () => readonly ['createReport'];
|
|
68
|
+
export declare const getCreateReportMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
69
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof createReport>>, TError, CreateReportMutationVariables, TContext>;
|
|
70
|
+
request?: SecondParameter<typeof request>;
|
|
71
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof createReport>>, TError, CreateReportMutationVariables, TContext>;
|
|
72
|
+
export type CreateReportMutationResult = NonNullable<Awaited<ReturnType<typeof createReport>>>;
|
|
73
|
+
export type CreateReportMutationBody = BodyType<PlaybackReportWrite>;
|
|
74
|
+
export type CreateReportMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
75
|
+
export type CreateReportMutationVariables = {
|
|
76
|
+
data: BodyType<PlaybackReportWrite>;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* @summary Create Report
|
|
80
|
+
*/
|
|
81
|
+
export declare const useCreateReport: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
82
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof createReport>>, TError, CreateReportMutationVariables, TContext>;
|
|
83
|
+
request?: SecondParameter<typeof request>;
|
|
84
|
+
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof createReport>>, TError, CreateReportMutationVariables, TContext>;
|
|
85
|
+
//#endregion
|
|
86
|
+
//# sourceMappingURL=cvs-app.d.ts.map
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as request } from "../chunks/client.js";
|
|
3
|
+
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
4
|
+
//#region src/react/cvs-app/cvs-app.ts
|
|
5
|
+
/**
|
|
6
|
+
* Generated by orval 🍺
|
|
7
|
+
* Do not edit manually.
|
|
8
|
+
* Mozaik backend
|
|
9
|
+
* 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.
|
|
10
|
+
* OpenAPI spec version: 0.1.0
|
|
11
|
+
*/
|
|
12
|
+
const withQueryKey = (query, queryKey) => {
|
|
13
|
+
const result = { queryKey };
|
|
14
|
+
for (const key of Object.keys(query)) {
|
|
15
|
+
if (key === "queryKey") continue;
|
|
16
|
+
Object.defineProperty(result, key, {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
get: () => query[key]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
const getListNotificationsUrl = (params) => {
|
|
25
|
+
const normalizedParams = new URLSearchParams();
|
|
26
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
27
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
28
|
+
});
|
|
29
|
+
const stringifiedParams = normalizedParams.toString();
|
|
30
|
+
return stringifiedParams.length > 0 ? `/cvs/notifications?${stringifiedParams}` : `/cvs/notifications`;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Notifications published to this caller's library.
|
|
34
|
+
*
|
|
35
|
+
* **These are tenant broadcasts, not a per-user inbox.** ``app_notification``
|
|
36
|
+
* has no user column and no read state — ``app_notification_bm`` links a
|
|
37
|
+
* notification to a library and that is the whole model. So ``unread_count`` is
|
|
38
|
+
* always ``0`` here and every notification is returned every time.
|
|
39
|
+
*
|
|
40
|
+
* Giving each member their own read state is a schema change (a
|
|
41
|
+
* ``notification_read`` row per user and notification), not a query change. It
|
|
42
|
+
* is worth doing — a broadcast list that never shrinks is one people stop
|
|
43
|
+
* opening — but it is a decision rather than a port, so it is not made here.
|
|
44
|
+
* @summary List Notifications
|
|
45
|
+
*/
|
|
46
|
+
const listNotifications = async (params, options) => {
|
|
47
|
+
return request(getListNotificationsUrl(params), {
|
|
48
|
+
...options,
|
|
49
|
+
method: "GET"
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
const getListNotificationsQueryKey = (params) => {
|
|
53
|
+
return [`/cvs/notifications`, ...params ? [params] : []];
|
|
54
|
+
};
|
|
55
|
+
const getListNotificationsQueryOptions = (params, options) => {
|
|
56
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
57
|
+
const queryKey = queryOptions?.queryKey ?? getListNotificationsQueryKey(params);
|
|
58
|
+
const queryFn = ({ signal }) => listNotifications(params, {
|
|
59
|
+
signal,
|
|
60
|
+
...requestOptions
|
|
61
|
+
});
|
|
62
|
+
return {
|
|
63
|
+
queryKey,
|
|
64
|
+
queryFn,
|
|
65
|
+
...queryOptions
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* @summary List Notifications
|
|
70
|
+
*/
|
|
71
|
+
function useListNotifications(params, options, queryClient) {
|
|
72
|
+
const queryOptions = getListNotificationsQueryOptions(params, options);
|
|
73
|
+
const query = useQuery(queryOptions, queryClient);
|
|
74
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
75
|
+
}
|
|
76
|
+
const getCreateReportUrl = () => {
|
|
77
|
+
return `/cvs/reports`;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Report a playback problem.
|
|
81
|
+
*
|
|
82
|
+
* The identifying fields are taken from the credential, not the body. The
|
|
83
|
+
* legacy took ``adhId``, ``bmId`` and ``bmBibLocaleId`` from the query string
|
|
84
|
+
* and declared no ``Authorization`` at all, so anyone holding the shared
|
|
85
|
+
* ``api_key`` — which every deployed app binary contains — could file a report
|
|
86
|
+
* in any patron's name, at any library. The DTO still carries those three
|
|
87
|
+
* fields, marked transition-only, and this handler ignores every one of them.
|
|
88
|
+
*
|
|
89
|
+
* ``email`` is free text that ends up in a message. Authenticated and
|
|
90
|
+
* rate-limited it is a support channel; unauthenticated it is a spam relay with
|
|
91
|
+
* the library's return address on it.
|
|
92
|
+
* @summary Create Report
|
|
93
|
+
*/
|
|
94
|
+
const createReport = async (playbackReportWrite, options) => {
|
|
95
|
+
const getHeaders = (h) => {
|
|
96
|
+
if (!h) return {};
|
|
97
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
98
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
99
|
+
const headers = {};
|
|
100
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
101
|
+
return headers;
|
|
102
|
+
};
|
|
103
|
+
return request(getCreateReportUrl(), {
|
|
104
|
+
...options,
|
|
105
|
+
method: "POST",
|
|
106
|
+
headers: {
|
|
107
|
+
"Content-Type": "application/json",
|
|
108
|
+
...getHeaders(options?.headers)
|
|
109
|
+
},
|
|
110
|
+
body: JSON.stringify(playbackReportWrite)
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
const getCreateReportMutationKey = () => ["createReport"];
|
|
114
|
+
const getCreateReportMutationOptions = (options) => {
|
|
115
|
+
const mutationKey = getCreateReportMutationKey();
|
|
116
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
117
|
+
...options,
|
|
118
|
+
mutation: {
|
|
119
|
+
...options.mutation,
|
|
120
|
+
mutationKey
|
|
121
|
+
}
|
|
122
|
+
} : {
|
|
123
|
+
mutation: { mutationKey },
|
|
124
|
+
request: void 0
|
|
125
|
+
};
|
|
126
|
+
const mutationFn = (props) => {
|
|
127
|
+
const { data } = props ?? {};
|
|
128
|
+
return createReport(data, requestOptions);
|
|
129
|
+
};
|
|
130
|
+
return {
|
|
131
|
+
mutationFn,
|
|
132
|
+
...mutationOptions
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* @summary Create Report
|
|
137
|
+
*/
|
|
138
|
+
const useCreateReport = (options, queryClient) => {
|
|
139
|
+
return useMutation(getCreateReportMutationOptions(options), queryClient);
|
|
140
|
+
};
|
|
141
|
+
//#endregion
|
|
142
|
+
export { createReport, getCreateReportMutationKey, getCreateReportMutationOptions, getCreateReportUrl, getListNotificationsQueryKey, getListNotificationsQueryOptions, getListNotificationsUrl, listNotifications, useCreateReport, useListNotifications };
|
|
143
|
+
|
|
144
|
+
//# sourceMappingURL=cvs-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cvs-app.js","names":[],"sources":["../../src/react/cvs-app/cvs-app.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 {\n useMutation,\n useQuery\n} from '@tanstack/react-query';\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n MutationFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query';\n\nimport type {\n HTTPExceptionResponse,\n ListNotificationsParams,\n NotificationListRead,\n PlaybackReportRead,\n PlaybackReportWrite,\n ValidationErrorResponse\n} from '../../models';\n\nimport { request } from '../../client';\nimport type { ErrorType , BodyType } from '../../client';\n\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n\n\nconst withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {\n const result = { queryKey } as T & { queryKey: K };\n for (const key of Object.keys(query)) {\n // The explicit queryKey always wins, matching the previous\n // `{ ...query, queryKey }` spread where it was set last.\n if (key === 'queryKey') continue;\n Object.defineProperty(result, key, {\n enumerable: true,\n configurable: true,\n get: () => (query as Record<string, unknown>)[key],\n });\n }\n return result;\n};\n\nexport const getListNotificationsUrl = (params?: ListNotificationsParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n\n if (value !== undefined) {\n normalizedParams.append(key, value === null ? 'null' : String(value))\n }\n });\n\n const stringifiedParams = normalizedParams.toString();\n\n return stringifiedParams.length > 0 ? `/cvs/notifications?${stringifiedParams}` : `/cvs/notifications`\n}\n\n/**\n * Notifications published to this caller's library.\n *\n * **These are tenant broadcasts, not a per-user inbox.** ``app_notification``\n * has no user column and no read state — ``app_notification_bm`` links a\n * notification to a library and that is the whole model. So ``unread_count`` is\n * always ``0`` here and every notification is returned every time.\n *\n * Giving each member their own read state is a schema change (a\n * ``notification_read`` row per user and notification), not a query change. It\n * is worth doing — a broadcast list that never shrinks is one people stop\n * opening — but it is a decision rather than a port, so it is not made here.\n * @summary List Notifications\n */\nexport const listNotifications = async (params?: ListNotificationsParams, options?: Parameters<typeof request>[1]): Promise<NotificationListRead> => {\n\n return request<NotificationListRead>(getListNotificationsUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n\n\n\nexport const getListNotificationsQueryKey = (params?: ListNotificationsParams,) => {\n return [\n `/cvs/notifications`, ...(params ? [params] : [])\n ] as const;\n }\n\n\nexport const getListNotificationsQueryOptions = <TData = Awaited<ReturnType<typeof listNotifications>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(params?: ListNotificationsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listNotifications>>, TError, TData>>, request?: SecondParameter<typeof request>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getListNotificationsQueryKey(params);\n\n\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof listNotifications>>> = ({ signal }) => listNotifications(params, { signal, ...requestOptions });\n\n\n\n\n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listNotifications>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type ListNotificationsQueryResult = NonNullable<Awaited<ReturnType<typeof listNotifications>>>\nexport type ListNotificationsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n\n\nexport function useListNotifications<TData = Awaited<ReturnType<typeof listNotifications>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params: undefined | ListNotificationsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listNotifications>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof listNotifications>>,\n TError,\n Awaited<ReturnType<typeof listNotifications>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListNotifications<TData = Awaited<ReturnType<typeof listNotifications>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListNotificationsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listNotifications>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof listNotifications>>,\n TError,\n Awaited<ReturnType<typeof listNotifications>>\n > , 'initialData'\n >, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useListNotifications<TData = Awaited<ReturnType<typeof listNotifications>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListNotificationsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listNotifications>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary List Notifications\n */\n\nexport function useListNotifications<TData = Awaited<ReturnType<typeof listNotifications>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(\n params?: ListNotificationsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listNotifications>>, TError, TData>>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getListNotificationsQueryOptions(params,options)\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n return withQueryKey(query, queryOptions.queryKey);\n}\n\n\n\n\n\n\nexport const getCreateReportUrl = () => {\n\n\n\n\n return `/cvs/reports`\n}\n\n/**\n * Report a playback problem.\n *\n * The identifying fields are taken from the credential, not the body. The\n * legacy took ``adhId``, ``bmId`` and ``bmBibLocaleId`` from the query string\n * and declared no ``Authorization`` at all, so anyone holding the shared\n * ``api_key`` — which every deployed app binary contains — could file a report\n * in any patron's name, at any library. The DTO still carries those three\n * fields, marked transition-only, and this handler ignores every one of them.\n *\n * ``email`` is free text that ends up in a message. Authenticated and\n * rate-limited it is a support channel; unauthenticated it is a spam relay with\n * the library's return address on it.\n * @summary Create Report\n */\nexport const createReport = async (playbackReportWrite: PlaybackReportWrite, options?: Parameters<typeof request>[1]): Promise<PlaybackReportRead> => {\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<PlaybackReportRead>(getCreateReportUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(playbackReportWrite)\n }\n);}\n\n\n\n\n\nexport const getCreateReportMutationKey = () => ['createReport'] as const;\n\nexport const getCreateReportMutationOptions = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createReport>>, TError,CreateReportMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n): UseMutationOptions<Awaited<ReturnType<typeof createReport>>, TError,CreateReportMutationVariables, TContext> => {\n\nconst mutationKey = getCreateReportMutationKey();\nconst {mutation: mutationOptions, request: requestOptions} = options ?\n options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?\n options\n : {...options, mutation: {...options.mutation, mutationKey}}\n : {mutation: { mutationKey, }, request: undefined};\n\n\n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof createReport>>, CreateReportMutationVariables> = (props) => {\n const {data} = props ?? {};\n\n return createReport(data,requestOptions)\n }\n\n\n\n\n\n\n return { mutationFn, ...mutationOptions }}\n\n export type CreateReportMutationResult = NonNullable<Awaited<ReturnType<typeof createReport>>>\n export type CreateReportMutationBody = BodyType<PlaybackReportWrite>\n export type CreateReportMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>\n export type CreateReportMutationVariables = {data: BodyType<PlaybackReportWrite>}\n\n /**\n * @summary Create Report\n */\nexport const useCreateReport = <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>,\n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createReport>>, TError,CreateReportMutationVariables, TContext>, request?: SecondParameter<typeof request>}\n , queryClient?: QueryClient): UseMutationResult<\n Awaited<ReturnType<typeof createReport>>,\n TError,\n CreateReportMutationVariables,\n TContext\n > => {\n return useMutation(getCreateReportMutationOptions(options), queryClient);\n }\n"],"mappings":";;;;;;;;;;;AA2CA,MAAM,gBAAqC,OAAU,aAAqC;CACxF,MAAM,SAAS,EAAE,SAAS;CAC1B,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EAGpC,IAAI,QAAQ,YAAY;EACxB,OAAO,eAAe,QAAQ,KAAK;GACjC,YAAY;GACZ,cAAc;GACd,WAAY,MAAkC;EAChD,CAAC;CACH;CACA,OAAO;AACT;AAEA,MAAa,2BAA2B,WAAsC;CAC5E,MAAM,mBAAmB,IAAI,gBAAgB;CAE7C,OAAO,QAAQ,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;EAErD,IAAI,UAAU,KAAA,GACZ,iBAAiB,OAAO,KAAK,UAAU,OAAO,SAAS,OAAO,KAAK,CAAC;CAExE,CAAC;CAED,MAAM,oBAAoB,iBAAiB,SAAS;CAEpD,OAAO,kBAAkB,SAAS,IAAI,sBAAsB,sBAAsB;AACpF;;;;;;;;;;;;;;;AAgBA,MAAa,oBAAoB,OAAO,QAAkC,YAA2E;CAEnJ,OAAO,QAA8B,wBAAwB,MAAM,GACnE;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAMF,MAAa,gCAAgC,WAAsC;CAC/E,OAAO,CACP,sBAAsB,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CAC/C;AACA;AAGJ,MAAa,oCAAgK,QAAkC,YAC1M;CAEL,MAAM,EAAC,OAAO,cAAc,SAAS,mBAAkB,WAAW,CAAC;CAEjE,MAAM,WAAY,cAAc,YAAY,6BAA6B,MAAM;CAI7E,MAAM,WAAyE,EAAE,aAAa,kBAAkB,QAAQ;EAAE;EAAQ,GAAG;CAAe,CAAC;CAMtJ,OAAQ;EAAE;EAAU;EAAS,GAAG;CAAY;AAC/C;;;;AAkCA,SAAgB,qBACf,QAAkC,SAChC,aACiF;CAElF,MAAM,eAAe,iCAAiC,QAAO,OAAO;CAEpE,MAAM,QAAQ,SAAS,cAAc,WAAW;CAEhD,OAAO,aAAa,OAAO,aAAa,QAAQ;AAClD;AAOA,MAAa,2BAA2B;CAKtC,OAAO;AACT;;;;;;;;;;;;;;;;AAiBA,MAAa,eAAe,OAAO,qBAA0C,YAAyE;CAElJ,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,QAA4B,mBAAmB,GACpD;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,mBAAmB;CAC1C,CACF;AAAE;AAMF,MAAa,mCAAmC,CAAC,cAAc;AAE/D,MAAa,kCACW,YAC2F;CAEnH,MAAM,cAAc,2BAA2B;CAC/C,MAAM,EAAC,UAAU,iBAAiB,SAAS,mBAAkB,UACvD,QAAQ,YAAY,iBAAiB,QAAQ,YAAY,QAAQ,SAAS,cAC1E,UACE;EAAC,GAAG;EAAS,UAAU;GAAC,GAAG,QAAQ;GAAU;EAAW;CAAC,IACzD;EAAC,UAAU,EAAE,YAAa;EAAG,SAAS,KAAA;CAAS;CAKjD,MAAM,cAAyG,UAAU;EACrH,MAAM,EAAC,SAAQ,SAAS,CAAC;EAEzB,OAAQ,aAAa,MAAK,cAAc;CAC1C;CAON,OAAQ;EAAE;EAAY,GAAG;CAAgB;AAAC;;;;AAU5C,MAAa,mBACW,SACrB,gBAKQ;CACL,OAAO,YAAY,+BAA+B,OAAO,GAAG,WAAW;AACzE"}
|