@learnorama/mozaik-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/client-BDwBZYB0.d.ts +28 -0
- package/dist/client-D3kMOcIr.js +61 -0
- package/dist/client-D3kMOcIr.js.map +1 -0
- package/dist/index-wL_20vR8.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 +58 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partner-reader.js","names":[],"sources":["../../src/api/partner-reader/partner-reader.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 CurrentReadingListRead,\n PartnerProvider,\n ReadPackageParams,\n ReaderPackageRead,\n ReadingPositionRead,\n ReadingPositionWrite\n} from '../../models';\n\nimport { request } from '../../client';\n\nexport const getReadPackageUrl = (provider: PartnerProvider,\n mediaId: number,\n params?: ReadPackageParams,) => {\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 ? `/partners/${provider}/media/${mediaId}/package?${stringifiedParams}` : `/partners/${provider}/media/${mediaId}/package`\n}\n\n/**\n * Where to fetch the content itself.\n *\n * The returned URL is a short-lived DRM-wrapped credential. It is not cached\n * here and should not be stored by the client.\n *\n * Opens a consumption lease, so the read appears in the ledger and counts\n * against the establishment's live seats like any other. Its id comes back in\n * ``lease``: keep it alive with ``PUT /consumption/{eventId}`` and drop it with\n * ``DELETE`` when the reader closes. A client that does neither is not broken\n * — the reaper closes the lease about a minute after the last heartbeat — but\n * every such read is a seat held past the end of it.\n *\n * Re-opening the same title returns the lease already held rather than a\n * second one, so a page reload does not leak a seat.\n * @summary Read Package\n */\nexport const readPackage = async (provider: PartnerProvider,\n mediaId: number,\n params?: ReadPackageParams, options?: Parameters<typeof request>[1]): Promise<ReaderPackageRead> => {\n\n return request<ReaderPackageRead>(getReadPackageUrl(provider,mediaId,params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\nexport const getReadPositionUrl = (provider: PartnerProvider,\n mediaId: number,) => {\n\n\n\n\n return `/partners/${provider}/media/${mediaId}/position`\n}\n\n/**\n * Where this reader last was, according to the partner.\n *\n * ``404`` when the partner holds no position — a book never opened has no\n * place to return to, and reporting zero would make a client jump a reader who\n * *is* mid-book back to the start if the call ever failed soft.\n * @summary Read Position\n */\nexport const readPosition = async (provider: PartnerProvider,\n mediaId: number, options?: Parameters<typeof request>[1]): Promise<ReadingPositionRead> => {\n\n return request<ReadingPositionRead>(getReadPositionUrl(provider,mediaId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\nexport const getWritePositionUrl = (provider: PartnerProvider,\n mediaId: number,) => {\n\n\n\n\n return `/partners/${provider}/media/${mediaId}/position`\n}\n\n/**\n * Record progress, and report the partner's own metering alongside it.\n *\n * ``usage_blocks`` is forwarded first when present, because the legacy did and\n * the partner treats the two as one act: metering after a position update\n * records consumption against a page the reader has already left.\n * @summary Write Position\n */\nexport const writePosition = async (provider: PartnerProvider,\n mediaId: number,\n readingPositionWrite: ReadingPositionWrite, options?: Parameters<typeof request>[1]): Promise<ReadingPositionRead> => {\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<ReadingPositionRead>(getWritePositionUrl(provider,mediaId),\n {\n ...options,\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(readingPositionWrite)\n }\n);}\n\n\nexport const getListCurrentReadingsUrl = (provider: PartnerProvider,) => {\n\n\n\n\n return `/partners/${provider}/readings`\n}\n\n/**\n * The partner's own \"continue reading\" list, joined back to our catalogue.\n *\n * Entries the partner knows and our catalogue does not are dropped rather than\n * surfaced with a null id: the import runs nightly and the partner's list is\n * live, so a title added today is genuinely not browsable here yet, and a card\n * that cannot be opened is worse than one that is absent.\n * @summary List Current Readings\n */\nexport const listCurrentReadings = async (provider: PartnerProvider, options?: Parameters<typeof request>[1]): Promise<CurrentReadingListRead> => {\n\n return request<CurrentReadingListRead>(getListCurrentReadingsUrl(provider),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n"],"mappings":";;;AAkBA,MAAa,qBAAqB,UAC9B,SACA,WAAgC;CAClC,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,aAAa,SAAS,SAAS,QAAQ,WAAW,sBAAsB,aAAa,SAAS,SAAS,QAAQ;AACvJ;;;;;;;;;;;;;;;;;;AAmBA,MAAa,cAAc,OAAO,UAC9B,SACA,QAA4B,YAAwE;CAEtG,OAAO,QAA2B,kBAAkB,UAAS,SAAQ,MAAM,GAC3E;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,sBAAsB,UAC/B,YAAqB;CAKvB,OAAO,aAAa,SAAS,SAAS,QAAQ;AAChD;;;;;;;;;AAUA,MAAa,eAAe,OAAO,UAC/B,SAAiB,YAA0E;CAE7F,OAAO,QAA6B,mBAAmB,UAAS,OAAO,GACvE;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,uBAAuB,UAChC,YAAqB;CAKvB,OAAO,aAAa,SAAS,SAAS,QAAQ;AAChD;;;;;;;;;AAUA,MAAa,gBAAgB,OAAO,UAChC,SACA,sBAA4C,YAA0E;CAEtH,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,QAA6B,oBAAoB,UAAS,OAAO,GACtE;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,oBAAoB;CAC3C,CACF;AAAE;AAGF,MAAa,6BAA6B,aAA+B;CAKvE,OAAO,aAAa,SAAS;AAC/B;;;;;;;;;;AAWA,MAAa,sBAAsB,OAAO,UAA2B,YAA6E;CAEhJ,OAAO,QAAgC,0BAA0B,QAAQ,GACzE;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
|
|
2
|
+
import { gt as ProfileCreateWrite, ht as ProfileRead, mt as ProfileListRead, pt as ProfileUpdateWrite } from "../index-wL_20vR8.js";
|
|
3
|
+
import { c as request } from "../client-BDwBZYB0.js";
|
|
4
|
+
//#region src/api/profiles/profiles.d.ts
|
|
5
|
+
export declare const getListProfilesUrl: () => string;
|
|
6
|
+
/**
|
|
7
|
+
* Every profile on this account, the holder included (E20).
|
|
8
|
+
*
|
|
9
|
+
* Unpaginated: the cap is :data:`PROFILE_LIMIT`, so there is no page to turn.
|
|
10
|
+
* One endpoint replaces two legacy routes that rendered the same collection
|
|
11
|
+
* differently — the difference was presentation, which is the client's problem.
|
|
12
|
+
* @summary List Profiles
|
|
13
|
+
*/
|
|
14
|
+
export declare const listProfiles: (options?: Parameters<typeof request>[1]) => Promise<ProfileListRead>;
|
|
15
|
+
export declare const getCreateProfileUrl: () => string;
|
|
16
|
+
/**
|
|
17
|
+
* Add a profile to this account (E21).
|
|
18
|
+
*
|
|
19
|
+
* The new row inherits ``tenant_id`` from the holder rather than accepting one:
|
|
20
|
+
* a profile belongs to the same company as the account it hangs off, and
|
|
21
|
+
* letting that be supplied would be a way into another tenant.
|
|
22
|
+
*
|
|
23
|
+
* A profile has no credential of its own. It has no ``login``, no ``email`` and
|
|
24
|
+
* no password — it is reached by switching within an authenticated session, so
|
|
25
|
+
* there is nothing for it to authenticate *with*.
|
|
26
|
+
* @summary Create Profile
|
|
27
|
+
*/
|
|
28
|
+
export declare const createProfile: (profileCreateWrite: ProfileCreateWrite, options?: Parameters<typeof request>[1]) => Promise<ProfileRead>;
|
|
29
|
+
export declare const getDeleteProfileUrl: (profileId: number) => string;
|
|
30
|
+
/**
|
|
31
|
+
* Remove a profile (E24). Idempotent.
|
|
32
|
+
*
|
|
33
|
+
* Deleting a profile that is already gone is ``204``, not ``404``: the caller
|
|
34
|
+
* asked for it to be absent and it is absent. A retried delete after a timeout
|
|
35
|
+
* must not read as a failure.
|
|
36
|
+
*
|
|
37
|
+
* The account holder cannot be deleted this way — that is E17, which anonymises
|
|
38
|
+
* the whole account and is a different decision with different consequences.
|
|
39
|
+
* @summary Delete Profile
|
|
40
|
+
*/
|
|
41
|
+
export declare const deleteProfile: (profileId: number, options?: Parameters<typeof request>[1]) => Promise<void>;
|
|
42
|
+
export declare const getReadProfileUrl: (profileId: number) => string;
|
|
43
|
+
/**
|
|
44
|
+
* One profile (E22). Returns the resource; the legacy rendered an edit form.
|
|
45
|
+
* @summary Read Profile
|
|
46
|
+
*/
|
|
47
|
+
export declare const readProfile: (profileId: number, options?: Parameters<typeof request>[1]) => Promise<ProfileRead>;
|
|
48
|
+
export declare const getUpdateProfileUrl: (profileId: number) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Partially update a profile (E23).
|
|
51
|
+
*
|
|
52
|
+
* The target comes from the path and the row is re-read from the database
|
|
53
|
+
* before anything is written, so nothing in the body can retarget the write.
|
|
54
|
+
* That is the one habit worth keeping from the legacy handler, which overwrote
|
|
55
|
+
* the identity fields from the trusted record for exactly this reason.
|
|
56
|
+
*
|
|
57
|
+
* ``exclude_unset`` is what makes this a PATCH rather than a PUT wearing the
|
|
58
|
+
* wrong verb: a field the client did not send is untouched, which is not the
|
|
59
|
+
* same as a field it sent as null.
|
|
60
|
+
* @summary Update Profile
|
|
61
|
+
*/
|
|
62
|
+
export declare const updateProfile: (profileId: number, profileUpdateWrite: ProfileUpdateWrite, options?: Parameters<typeof request>[1]) => Promise<ProfileRead>;
|
|
63
|
+
//#endregion
|
|
64
|
+
//# sourceMappingURL=profiles.d.ts.map
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
|
|
2
|
+
import { r as request } from "../client-D3kMOcIr.js";
|
|
3
|
+
//#region src/api/profiles/profiles.ts
|
|
4
|
+
const getListProfilesUrl = () => {
|
|
5
|
+
return `/me/profiles`;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Every profile on this account, the holder included (E20).
|
|
9
|
+
*
|
|
10
|
+
* Unpaginated: the cap is :data:`PROFILE_LIMIT`, so there is no page to turn.
|
|
11
|
+
* One endpoint replaces two legacy routes that rendered the same collection
|
|
12
|
+
* differently — the difference was presentation, which is the client's problem.
|
|
13
|
+
* @summary List Profiles
|
|
14
|
+
*/
|
|
15
|
+
const listProfiles = async (options) => {
|
|
16
|
+
return request(getListProfilesUrl(), {
|
|
17
|
+
...options,
|
|
18
|
+
method: "GET"
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const getCreateProfileUrl = () => {
|
|
22
|
+
return `/me/profiles`;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Add a profile to this account (E21).
|
|
26
|
+
*
|
|
27
|
+
* The new row inherits ``tenant_id`` from the holder rather than accepting one:
|
|
28
|
+
* a profile belongs to the same company as the account it hangs off, and
|
|
29
|
+
* letting that be supplied would be a way into another tenant.
|
|
30
|
+
*
|
|
31
|
+
* A profile has no credential of its own. It has no ``login``, no ``email`` and
|
|
32
|
+
* no password — it is reached by switching within an authenticated session, so
|
|
33
|
+
* there is nothing for it to authenticate *with*.
|
|
34
|
+
* @summary Create Profile
|
|
35
|
+
*/
|
|
36
|
+
const createProfile = async (profileCreateWrite, options) => {
|
|
37
|
+
const getHeaders = (h) => {
|
|
38
|
+
if (!h) return {};
|
|
39
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
40
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
41
|
+
const headers = {};
|
|
42
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
43
|
+
return headers;
|
|
44
|
+
};
|
|
45
|
+
return request(getCreateProfileUrl(), {
|
|
46
|
+
...options,
|
|
47
|
+
method: "POST",
|
|
48
|
+
headers: {
|
|
49
|
+
"Content-Type": "application/json",
|
|
50
|
+
...getHeaders(options?.headers)
|
|
51
|
+
},
|
|
52
|
+
body: JSON.stringify(profileCreateWrite)
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
const getDeleteProfileUrl = (profileId) => {
|
|
56
|
+
return `/me/profiles/${profileId}`;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Remove a profile (E24). Idempotent.
|
|
60
|
+
*
|
|
61
|
+
* Deleting a profile that is already gone is ``204``, not ``404``: the caller
|
|
62
|
+
* asked for it to be absent and it is absent. A retried delete after a timeout
|
|
63
|
+
* must not read as a failure.
|
|
64
|
+
*
|
|
65
|
+
* The account holder cannot be deleted this way — that is E17, which anonymises
|
|
66
|
+
* the whole account and is a different decision with different consequences.
|
|
67
|
+
* @summary Delete Profile
|
|
68
|
+
*/
|
|
69
|
+
const deleteProfile = async (profileId, options) => {
|
|
70
|
+
return request(getDeleteProfileUrl(profileId), {
|
|
71
|
+
...options,
|
|
72
|
+
method: "DELETE"
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
const getReadProfileUrl = (profileId) => {
|
|
76
|
+
return `/me/profiles/${profileId}`;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* One profile (E22). Returns the resource; the legacy rendered an edit form.
|
|
80
|
+
* @summary Read Profile
|
|
81
|
+
*/
|
|
82
|
+
const readProfile = async (profileId, options) => {
|
|
83
|
+
return request(getReadProfileUrl(profileId), {
|
|
84
|
+
...options,
|
|
85
|
+
method: "GET"
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
const getUpdateProfileUrl = (profileId) => {
|
|
89
|
+
return `/me/profiles/${profileId}`;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Partially update a profile (E23).
|
|
93
|
+
*
|
|
94
|
+
* The target comes from the path and the row is re-read from the database
|
|
95
|
+
* before anything is written, so nothing in the body can retarget the write.
|
|
96
|
+
* That is the one habit worth keeping from the legacy handler, which overwrote
|
|
97
|
+
* the identity fields from the trusted record for exactly this reason.
|
|
98
|
+
*
|
|
99
|
+
* ``exclude_unset`` is what makes this a PATCH rather than a PUT wearing the
|
|
100
|
+
* wrong verb: a field the client did not send is untouched, which is not the
|
|
101
|
+
* same as a field it sent as null.
|
|
102
|
+
* @summary Update Profile
|
|
103
|
+
*/
|
|
104
|
+
const updateProfile = async (profileId, profileUpdateWrite, options) => {
|
|
105
|
+
const getHeaders = (h) => {
|
|
106
|
+
if (!h) return {};
|
|
107
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
108
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
109
|
+
const headers = {};
|
|
110
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
111
|
+
return headers;
|
|
112
|
+
};
|
|
113
|
+
return request(getUpdateProfileUrl(profileId), {
|
|
114
|
+
...options,
|
|
115
|
+
method: "PATCH",
|
|
116
|
+
headers: {
|
|
117
|
+
"Content-Type": "application/json",
|
|
118
|
+
...getHeaders(options?.headers)
|
|
119
|
+
},
|
|
120
|
+
body: JSON.stringify(profileUpdateWrite)
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
//#endregion
|
|
124
|
+
export { createProfile, deleteProfile, getCreateProfileUrl, getDeleteProfileUrl, getListProfilesUrl, getReadProfileUrl, getUpdateProfileUrl, listProfiles, readProfile, updateProfile };
|
|
125
|
+
|
|
126
|
+
//# sourceMappingURL=profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.js","names":[],"sources":["../../src/api/profiles/profiles.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 ProfileCreateWrite,\n ProfileListRead,\n ProfileRead,\n ProfileUpdateWrite\n} from '../../models';\n\nimport { request } from '../../client';\n\nexport const getListProfilesUrl = () => {\n\n\n\n\n return `/me/profiles`\n}\n\n/**\n * Every profile on this account, the holder included (E20).\n *\n * Unpaginated: the cap is :data:`PROFILE_LIMIT`, so there is no page to turn.\n * One endpoint replaces two legacy routes that rendered the same collection\n * differently — the difference was presentation, which is the client's problem.\n * @summary List Profiles\n */\nexport const listProfiles = async ( options?: Parameters<typeof request>[1]): Promise<ProfileListRead> => {\n\n return request<ProfileListRead>(getListProfilesUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\nexport const getCreateProfileUrl = () => {\n\n\n\n\n return `/me/profiles`\n}\n\n/**\n * Add a profile to this account (E21).\n *\n * The new row inherits ``tenant_id`` from the holder rather than accepting one:\n * a profile belongs to the same company as the account it hangs off, and\n * letting that be supplied would be a way into another tenant.\n *\n * A profile has no credential of its own. It has no ``login``, no ``email`` and\n * no password — it is reached by switching within an authenticated session, so\n * there is nothing for it to authenticate *with*.\n * @summary Create Profile\n */\nexport const createProfile = async (profileCreateWrite: ProfileCreateWrite, options?: Parameters<typeof request>[1]): Promise<ProfileRead> => {\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<ProfileRead>(getCreateProfileUrl(),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(profileCreateWrite)\n }\n);}\n\n\nexport const getDeleteProfileUrl = (profileId: number,) => {\n\n\n\n\n return `/me/profiles/${profileId}`\n}\n\n/**\n * Remove a profile (E24). Idempotent.\n *\n * Deleting a profile that is already gone is ``204``, not ``404``: the caller\n * asked for it to be absent and it is absent. A retried delete after a timeout\n * must not read as a failure.\n *\n * The account holder cannot be deleted this way — that is E17, which anonymises\n * the whole account and is a different decision with different consequences.\n * @summary Delete Profile\n */\nexport const deleteProfile = async (profileId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getDeleteProfileUrl(profileId),\n {\n ...options,\n method: 'DELETE'\n\n\n }\n);}\n\n\nexport const getReadProfileUrl = (profileId: number,) => {\n\n\n\n\n return `/me/profiles/${profileId}`\n}\n\n/**\n * One profile (E22). Returns the resource; the legacy rendered an edit form.\n * @summary Read Profile\n */\nexport const readProfile = async (profileId: number, options?: Parameters<typeof request>[1]): Promise<ProfileRead> => {\n\n return request<ProfileRead>(getReadProfileUrl(profileId),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\nexport const getUpdateProfileUrl = (profileId: number,) => {\n\n\n\n\n return `/me/profiles/${profileId}`\n}\n\n/**\n * Partially update a profile (E23).\n *\n * The target comes from the path and the row is re-read from the database\n * before anything is written, so nothing in the body can retarget the write.\n * That is the one habit worth keeping from the legacy handler, which overwrote\n * the identity fields from the trusted record for exactly this reason.\n *\n * ``exclude_unset`` is what makes this a PATCH rather than a PUT wearing the\n * wrong verb: a field the client did not send is untouched, which is not the\n * same as a field it sent as null.\n * @summary Update Profile\n */\nexport const updateProfile = async (profileId: number,\n profileUpdateWrite: ProfileUpdateWrite, options?: Parameters<typeof request>[1]): Promise<ProfileRead> => {\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<ProfileRead>(getUpdateProfileUrl(profileId),\n {\n ...options,\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(profileUpdateWrite)\n }\n);}\n\n\n"],"mappings":";;;AAgBA,MAAa,2BAA2B;CAKtC,OAAO;AACT;;;;;;;;;AAUA,MAAa,eAAe,OAAQ,YAAsE;CAExG,OAAO,QAAyB,mBAAmB,GACnD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,4BAA4B;CAKvC,OAAO;AACT;;;;;;;;;;;;;AAcA,MAAa,gBAAgB,OAAO,oBAAwC,YAAkE;CAE1I,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,QAAqB,oBAAoB,GAC9C;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,kBAAkB;CACzC,CACF;AAAE;AAGF,MAAa,uBAAuB,cAAuB;CAKzD,OAAO,gBAAgB;AACzB;;;;;;;;;;;;AAaA,MAAa,gBAAgB,OAAO,WAAmB,YAA2D;CAEhH,OAAO,QAAc,oBAAoB,SAAS,GAClD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,qBAAqB,cAAuB;CAKvD,OAAO,gBAAgB;AACzB;;;;;AAMA,MAAa,cAAc,OAAO,WAAmB,YAAkE;CAErH,OAAO,QAAqB,kBAAkB,SAAS,GACvD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,uBAAuB,cAAuB;CAKzD,OAAO,gBAAgB;AACzB;;;;;;;;;;;;;;AAeA,MAAa,gBAAgB,OAAO,WAChC,oBAAwC,YAAkE;CAE1G,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,QAAqB,oBAAoB,SAAS,GACvD;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,kBAAkB;CACzC,CACF;AAAE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
import { Fn as LevelListRead, P as SubjectListRead, sr as EducationalGoalListRead, xn as ListGoalsParams } from "../index-wL_20vR8.js";
|
|
3
|
+
import { c as request } from "../client-BDwBZYB0.js";
|
|
4
|
+
//#region src/api/tutoring-catalogue/tutoring-catalogue.d.ts
|
|
5
|
+
export declare const getListGoalsUrl: (params?: ListGoalsParams) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Goals on offer, optionally narrowed to one request kind.
|
|
8
|
+
*
|
|
9
|
+
* The filter is a containment test against ``applies_to``, which is what the
|
|
10
|
+
* GIN index on that column is for. The legacy asks the same question with four
|
|
11
|
+
* boolean columns and a different ``WHERE`` per surface.
|
|
12
|
+
* @summary List Goals
|
|
13
|
+
*/
|
|
14
|
+
export declare const listGoals: (params?: ListGoalsParams, options?: Parameters<typeof request>[1]) => Promise<EducationalGoalListRead>;
|
|
15
|
+
export declare const getListLevelsUrl: () => string;
|
|
16
|
+
/**
|
|
17
|
+
* Every school level, in teaching order rather than alphabetical.
|
|
18
|
+
* @summary List Levels
|
|
19
|
+
*/
|
|
20
|
+
export declare const listLevels: (options?: Parameters<typeof request>[1]) => Promise<LevelListRead>;
|
|
21
|
+
export declare const getListSubjectsUrl: () => string;
|
|
22
|
+
/**
|
|
23
|
+
* Every subject a pupil may ask about, in display order.
|
|
24
|
+
*
|
|
25
|
+
* Authenticated, though the data is not secret: the list differs by nothing
|
|
26
|
+
* today, and leaving it open would make it the one tutoring endpoint that does
|
|
27
|
+
* not establish a tenant. Cheap to relax later, expensive to tighten.
|
|
28
|
+
* @summary List Subjects
|
|
29
|
+
*/
|
|
30
|
+
export declare const listSubjects: (options?: Parameters<typeof request>[1]) => Promise<SubjectListRead>;
|
|
31
|
+
//#endregion
|
|
32
|
+
//# sourceMappingURL=tutoring-catalogue.d.ts.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
import { r as request } from "../client-D3kMOcIr.js";
|
|
3
|
+
//#region src/api/tutoring-catalogue/tutoring-catalogue.ts
|
|
4
|
+
const getListGoalsUrl = (params) => {
|
|
5
|
+
const normalizedParams = new URLSearchParams();
|
|
6
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
7
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
8
|
+
});
|
|
9
|
+
const stringifiedParams = normalizedParams.toString();
|
|
10
|
+
return stringifiedParams.length > 0 ? `/tutoring/goals?${stringifiedParams}` : `/tutoring/goals`;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Goals on offer, optionally narrowed to one request kind.
|
|
14
|
+
*
|
|
15
|
+
* The filter is a containment test against ``applies_to``, which is what the
|
|
16
|
+
* GIN index on that column is for. The legacy asks the same question with four
|
|
17
|
+
* boolean columns and a different ``WHERE`` per surface.
|
|
18
|
+
* @summary List Goals
|
|
19
|
+
*/
|
|
20
|
+
const listGoals = async (params, options) => {
|
|
21
|
+
return request(getListGoalsUrl(params), {
|
|
22
|
+
...options,
|
|
23
|
+
method: "GET"
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const getListLevelsUrl = () => {
|
|
27
|
+
return `/tutoring/levels`;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Every school level, in teaching order rather than alphabetical.
|
|
31
|
+
* @summary List Levels
|
|
32
|
+
*/
|
|
33
|
+
const listLevels = async (options) => {
|
|
34
|
+
return request(getListLevelsUrl(), {
|
|
35
|
+
...options,
|
|
36
|
+
method: "GET"
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const getListSubjectsUrl = () => {
|
|
40
|
+
return `/tutoring/subjects`;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Every subject a pupil may ask about, in display order.
|
|
44
|
+
*
|
|
45
|
+
* Authenticated, though the data is not secret: the list differs by nothing
|
|
46
|
+
* today, and leaving it open would make it the one tutoring endpoint that does
|
|
47
|
+
* not establish a tenant. Cheap to relax later, expensive to tighten.
|
|
48
|
+
* @summary List Subjects
|
|
49
|
+
*/
|
|
50
|
+
const listSubjects = async (options) => {
|
|
51
|
+
return request(getListSubjectsUrl(), {
|
|
52
|
+
...options,
|
|
53
|
+
method: "GET"
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
//#endregion
|
|
57
|
+
export { getListGoalsUrl, getListLevelsUrl, getListSubjectsUrl, listGoals, listLevels, listSubjects };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=tutoring-catalogue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tutoring-catalogue.js","names":[],"sources":["../../src/api/tutoring-catalogue/tutoring-catalogue.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 EducationalGoalListRead,\n LevelListRead,\n ListGoalsParams,\n SubjectListRead\n} from '../../models';\n\nimport { request } from '../../client';\n\nexport const getListGoalsUrl = (params?: ListGoalsParams,) => {\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 ? `/tutoring/goals?${stringifiedParams}` : `/tutoring/goals`\n}\n\n/**\n * Goals on offer, optionally narrowed to one request kind.\n *\n * The filter is a containment test against ``applies_to``, which is what the\n * GIN index on that column is for. The legacy asks the same question with four\n * boolean columns and a different ``WHERE`` per surface.\n * @summary List Goals\n */\nexport const listGoals = async (params?: ListGoalsParams, options?: Parameters<typeof request>[1]): Promise<EducationalGoalListRead> => {\n\n return request<EducationalGoalListRead>(getListGoalsUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\nexport const getListLevelsUrl = () => {\n\n\n\n\n return `/tutoring/levels`\n}\n\n/**\n * Every school level, in teaching order rather than alphabetical.\n * @summary List Levels\n */\nexport const listLevels = async ( options?: Parameters<typeof request>[1]): Promise<LevelListRead> => {\n\n return request<LevelListRead>(getListLevelsUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\nexport const getListSubjectsUrl = () => {\n\n\n\n\n return `/tutoring/subjects`\n}\n\n/**\n * Every subject a pupil may ask about, in display order.\n *\n * Authenticated, though the data is not secret: the list differs by nothing\n * today, and leaving it open would make it the one tutoring endpoint that does\n * not establish a tenant. Cheap to relax later, expensive to tighten.\n * @summary List Subjects\n */\nexport const listSubjects = async ( options?: Parameters<typeof request>[1]): Promise<SubjectListRead> => {\n\n return request<SubjectListRead>(getListSubjectsUrl(),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\n"],"mappings":";;;AAgBA,MAAa,mBAAmB,WAA8B;CAC5D,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,mBAAmB,sBAAsB;AACjF;;;;;;;;;AAUA,MAAa,YAAY,OAAO,QAA0B,YAA8E;CAEtI,OAAO,QAAiC,gBAAgB,MAAM,GAC9D;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,yBAAyB;CAKpC,OAAO;AACT;;;;;AAMA,MAAa,aAAa,OAAQ,YAAoE;CAEpG,OAAO,QAAuB,iBAAiB,GAC/C;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,2BAA2B;CAKtC,OAAO;AACT;;;;;;;;;AAUA,MAAa,eAAe,OAAQ,YAAsE;CAExG,OAAO,QAAyB,mBAAmB,GACnD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
import { Nr as ChatTicketRead, Xt as MessagePage, Yt as MessageWrite, Zt as MessageRead, gn as ListMessagesParams } from "../index-wL_20vR8.js";
|
|
3
|
+
import { c as request } from "../client-BDwBZYB0.js";
|
|
4
|
+
//#region src/api/tutoring-chat/tutoring-chat.d.ts
|
|
5
|
+
export declare const getMintChatTicketUrl: (requestId: number) => string;
|
|
6
|
+
/**
|
|
7
|
+
* A single-use credential for opening the socket from a browser.
|
|
8
|
+
*
|
|
9
|
+
* Authenticated the ordinary way, with the ordinary bearer token, because this
|
|
10
|
+
* is an ordinary HTTP request. What it returns is what goes in the socket URL.
|
|
11
|
+
* @summary Mint Chat Ticket
|
|
12
|
+
*/
|
|
13
|
+
export declare const mintChatTicket: (requestId: number, options?: Parameters<typeof request>[1]) => Promise<ChatTicketRead>;
|
|
14
|
+
export declare const getListMessagesUrl: (requestId: number, params?: ListMessagesParams) => string;
|
|
15
|
+
/**
|
|
16
|
+
* The conversation so far, newest first.
|
|
17
|
+
*
|
|
18
|
+
* One extra row is fetched to answer ``hasMore`` without a second count. A
|
|
19
|
+
* ``COUNT(*)`` over a thread on every scroll is a table scan for a number no
|
|
20
|
+
* interface displays.
|
|
21
|
+
* @summary List Messages
|
|
22
|
+
*/
|
|
23
|
+
export declare const listMessages: (requestId: number, params?: ListMessagesParams, options?: Parameters<typeof request>[1]) => Promise<MessagePage>;
|
|
24
|
+
export declare const getSendMessageUrl: (requestId: number) => string;
|
|
25
|
+
/**
|
|
26
|
+
* Say something, without holding a socket open.
|
|
27
|
+
* @summary Send Message
|
|
28
|
+
*/
|
|
29
|
+
export declare const sendMessage: (requestId: number, messageWrite: MessageWrite, options?: Parameters<typeof request>[1]) => Promise<MessageRead>;
|
|
30
|
+
//#endregion
|
|
31
|
+
//# sourceMappingURL=tutoring-chat.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
|
|
2
|
+
import { r as request } from "../client-D3kMOcIr.js";
|
|
3
|
+
//#region src/api/tutoring-chat/tutoring-chat.ts
|
|
4
|
+
const getMintChatTicketUrl = (requestId) => {
|
|
5
|
+
return `/tutoring/requests/${requestId}/chat/ticket`;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A single-use credential for opening the socket from a browser.
|
|
9
|
+
*
|
|
10
|
+
* Authenticated the ordinary way, with the ordinary bearer token, because this
|
|
11
|
+
* is an ordinary HTTP request. What it returns is what goes in the socket URL.
|
|
12
|
+
* @summary Mint Chat Ticket
|
|
13
|
+
*/
|
|
14
|
+
const mintChatTicket = async (requestId, options) => {
|
|
15
|
+
return request(getMintChatTicketUrl(requestId), {
|
|
16
|
+
...options,
|
|
17
|
+
method: "POST"
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
const getListMessagesUrl = (requestId, params) => {
|
|
21
|
+
const normalizedParams = new URLSearchParams();
|
|
22
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
23
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
24
|
+
});
|
|
25
|
+
const stringifiedParams = normalizedParams.toString();
|
|
26
|
+
return stringifiedParams.length > 0 ? `/tutoring/requests/${requestId}/messages?${stringifiedParams}` : `/tutoring/requests/${requestId}/messages`;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The conversation so far, newest first.
|
|
30
|
+
*
|
|
31
|
+
* One extra row is fetched to answer ``hasMore`` without a second count. A
|
|
32
|
+
* ``COUNT(*)`` over a thread on every scroll is a table scan for a number no
|
|
33
|
+
* interface displays.
|
|
34
|
+
* @summary List Messages
|
|
35
|
+
*/
|
|
36
|
+
const listMessages = async (requestId, params, options) => {
|
|
37
|
+
return request(getListMessagesUrl(requestId, params), {
|
|
38
|
+
...options,
|
|
39
|
+
method: "GET"
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
const getSendMessageUrl = (requestId) => {
|
|
43
|
+
return `/tutoring/requests/${requestId}/messages`;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Say something, without holding a socket open.
|
|
47
|
+
* @summary Send Message
|
|
48
|
+
*/
|
|
49
|
+
const sendMessage = async (requestId, messageWrite, options) => {
|
|
50
|
+
const getHeaders = (h) => {
|
|
51
|
+
if (!h) return {};
|
|
52
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
53
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
54
|
+
const headers = {};
|
|
55
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
56
|
+
return headers;
|
|
57
|
+
};
|
|
58
|
+
return request(getSendMessageUrl(requestId), {
|
|
59
|
+
...options,
|
|
60
|
+
method: "POST",
|
|
61
|
+
headers: {
|
|
62
|
+
"Content-Type": "application/json",
|
|
63
|
+
...getHeaders(options?.headers)
|
|
64
|
+
},
|
|
65
|
+
body: JSON.stringify(messageWrite)
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { getListMessagesUrl, getMintChatTicketUrl, getSendMessageUrl, listMessages, mintChatTicket, sendMessage };
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=tutoring-chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tutoring-chat.js","names":[],"sources":["../../src/api/tutoring-chat/tutoring-chat.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 ChatTicketRead,\n ListMessagesParams,\n MessagePage,\n MessageRead,\n MessageWrite\n} from '../../models';\n\nimport { request } from '../../client';\n\nexport const getMintChatTicketUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/chat/ticket`\n}\n\n/**\n * A single-use credential for opening the socket from a browser.\n *\n * Authenticated the ordinary way, with the ordinary bearer token, because this\n * is an ordinary HTTP request. What it returns is what goes in the socket URL.\n * @summary Mint Chat Ticket\n */\nexport const mintChatTicket = async (requestId: number, options?: Parameters<typeof request>[1]): Promise<ChatTicketRead> => {\n\n return request<ChatTicketRead>(getMintChatTicketUrl(requestId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\nexport const getListMessagesUrl = (requestId: number,\n params?: ListMessagesParams,) => {\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 ? `/tutoring/requests/${requestId}/messages?${stringifiedParams}` : `/tutoring/requests/${requestId}/messages`\n}\n\n/**\n * The conversation so far, newest first.\n *\n * One extra row is fetched to answer ``hasMore`` without a second count. A\n * ``COUNT(*)`` over a thread on every scroll is a table scan for a number no\n * interface displays.\n * @summary List Messages\n */\nexport const listMessages = async (requestId: number,\n params?: ListMessagesParams, options?: Parameters<typeof request>[1]): Promise<MessagePage> => {\n\n return request<MessagePage>(getListMessagesUrl(requestId,params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\nexport const getSendMessageUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/messages`\n}\n\n/**\n * Say something, without holding a socket open.\n * @summary Send Message\n */\nexport const sendMessage = async (requestId: number,\n messageWrite: MessageWrite, options?: Parameters<typeof request>[1]): Promise<MessageRead> => {\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<MessageRead>(getSendMessageUrl(requestId),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(messageWrite)\n }\n);}\n\n\n"],"mappings":";;;AAiBA,MAAa,wBAAwB,cAAuB;CAK1D,OAAO,sBAAsB,UAAU;AACzC;;;;;;;;AASA,MAAa,iBAAiB,OAAO,WAAmB,YAAqE;CAE3H,OAAO,QAAwB,qBAAqB,SAAS,GAC7D;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,sBAAsB,WAC/B,WAAiC;CACnC,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,UAAU,YAAY,sBAAsB,sBAAsB,UAAU;AAC1I;;;;;;;;;AAUA,MAAa,eAAe,OAAO,WAC/B,QAA6B,YAAkE;CAEjG,OAAO,QAAqB,mBAAmB,WAAU,MAAM,GAC/D;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,qBAAqB,cAAuB;CAKvD,OAAO,sBAAsB,UAAU;AACzC;;;;;AAMA,MAAa,cAAc,OAAO,WAC9B,cAA4B,YAAkE;CAE9F,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,QAAqB,kBAAkB,SAAS,GACrD;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,YAAY;CACnC,CACF;AAAE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
import { _ as TutoringDispatchWrite, d as TutoringQueuePage, un as ListQueueParams } from "../index-wL_20vR8.js";
|
|
3
|
+
import { c as request } from "../client-BDwBZYB0.js";
|
|
4
|
+
//#region src/api/tutoring-dispatch/tutoring-dispatch.d.ts
|
|
5
|
+
export declare const getListQueueUrl: (params?: ListQueueParams) => string;
|
|
6
|
+
/**
|
|
7
|
+
* What is waiting, oldest first.
|
|
8
|
+
*
|
|
9
|
+
* Scoped to the dispatcher's tenant. Defaults to the four open statuses, which
|
|
10
|
+
* is what the partial index on the table is built for — pass ``?status=`` to
|
|
11
|
+
* look at something else and the query stops using it, which is the honest
|
|
12
|
+
* trade rather than a hidden one.
|
|
13
|
+
* @summary List Queue
|
|
14
|
+
*/
|
|
15
|
+
export declare const listQueue: (params?: ListQueueParams, options?: Parameters<typeof request>[1]) => Promise<TutoringQueuePage>;
|
|
16
|
+
export declare const getDispatchRequestUrl: (requestId: number) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Route it — to somebody named, or to the open pool.
|
|
19
|
+
*
|
|
20
|
+
* Changing the channel here is deliberate and common: pupils pick a classroom
|
|
21
|
+
* and turn out to have no microphone, and the dispatcher is the person who
|
|
22
|
+
* finds that out.
|
|
23
|
+
* @summary Dispatch Request
|
|
24
|
+
*/
|
|
25
|
+
export declare const dispatchRequest: (requestId: number, tutoringDispatchWrite: TutoringDispatchWrite, options?: Parameters<typeof request>[1]) => Promise<void>;
|
|
26
|
+
export declare const getTriageRequestUrl: (requestId: number) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Take a request off the queue to look at it.
|
|
29
|
+
*
|
|
30
|
+
* Separate from dispatching because the legacy's own timestamps separate them —
|
|
31
|
+
* ``picked_by_switchman_at`` then ``validated_at`` — and the gap between the
|
|
32
|
+
* two is the figure that tells you whether the queue is staffed.
|
|
33
|
+
* @summary Triage Request
|
|
34
|
+
*/
|
|
35
|
+
export declare const triageRequest: (requestId: number, options?: Parameters<typeof request>[1]) => Promise<void>;
|
|
36
|
+
//#endregion
|
|
37
|
+
//# sourceMappingURL=tutoring-dispatch.d.ts.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
|
|
2
|
+
import { r as request } from "../client-D3kMOcIr.js";
|
|
3
|
+
//#region src/api/tutoring-dispatch/tutoring-dispatch.ts
|
|
4
|
+
const getListQueueUrl = (params) => {
|
|
5
|
+
const normalizedParams = new URLSearchParams();
|
|
6
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
7
|
+
if (Array.isArray(value) && ["status"].includes(key)) {
|
|
8
|
+
value.forEach((v) => {
|
|
9
|
+
normalizedParams.append(key, v === null ? "null" : String(v));
|
|
10
|
+
});
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
14
|
+
});
|
|
15
|
+
const stringifiedParams = normalizedParams.toString();
|
|
16
|
+
return stringifiedParams.length > 0 ? `/tutoring/queue?${stringifiedParams}` : `/tutoring/queue`;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* What is waiting, oldest first.
|
|
20
|
+
*
|
|
21
|
+
* Scoped to the dispatcher's tenant. Defaults to the four open statuses, which
|
|
22
|
+
* is what the partial index on the table is built for — pass ``?status=`` to
|
|
23
|
+
* look at something else and the query stops using it, which is the honest
|
|
24
|
+
* trade rather than a hidden one.
|
|
25
|
+
* @summary List Queue
|
|
26
|
+
*/
|
|
27
|
+
const listQueue = async (params, options) => {
|
|
28
|
+
return request(getListQueueUrl(params), {
|
|
29
|
+
...options,
|
|
30
|
+
method: "GET"
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const getDispatchRequestUrl = (requestId) => {
|
|
34
|
+
return `/tutoring/requests/${requestId}/dispatch`;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Route it — to somebody named, or to the open pool.
|
|
38
|
+
*
|
|
39
|
+
* Changing the channel here is deliberate and common: pupils pick a classroom
|
|
40
|
+
* and turn out to have no microphone, and the dispatcher is the person who
|
|
41
|
+
* finds that out.
|
|
42
|
+
* @summary Dispatch Request
|
|
43
|
+
*/
|
|
44
|
+
const dispatchRequest = async (requestId, tutoringDispatchWrite, options) => {
|
|
45
|
+
const getHeaders = (h) => {
|
|
46
|
+
if (!h) return {};
|
|
47
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
48
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
49
|
+
const headers = {};
|
|
50
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
51
|
+
return headers;
|
|
52
|
+
};
|
|
53
|
+
return request(getDispatchRequestUrl(requestId), {
|
|
54
|
+
...options,
|
|
55
|
+
method: "POST",
|
|
56
|
+
headers: {
|
|
57
|
+
"Content-Type": "application/json",
|
|
58
|
+
...getHeaders(options?.headers)
|
|
59
|
+
},
|
|
60
|
+
body: JSON.stringify(tutoringDispatchWrite)
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const getTriageRequestUrl = (requestId) => {
|
|
64
|
+
return `/tutoring/requests/${requestId}/triage`;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Take a request off the queue to look at it.
|
|
68
|
+
*
|
|
69
|
+
* Separate from dispatching because the legacy's own timestamps separate them —
|
|
70
|
+
* ``picked_by_switchman_at`` then ``validated_at`` — and the gap between the
|
|
71
|
+
* two is the figure that tells you whether the queue is staffed.
|
|
72
|
+
* @summary Triage Request
|
|
73
|
+
*/
|
|
74
|
+
const triageRequest = async (requestId, options) => {
|
|
75
|
+
return request(getTriageRequestUrl(requestId), {
|
|
76
|
+
...options,
|
|
77
|
+
method: "POST"
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
//#endregion
|
|
81
|
+
export { dispatchRequest, getDispatchRequestUrl, getListQueueUrl, getTriageRequestUrl, listQueue, triageRequest };
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=tutoring-dispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tutoring-dispatch.js","names":[],"sources":["../../src/api/tutoring-dispatch/tutoring-dispatch.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 ListQueueParams,\n TutoringDispatchWrite,\n TutoringQueuePage\n} from '../../models';\n\nimport { request } from '../../client';\n\nexport const getListQueueUrl = (params?: ListQueueParams,) => {\n const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n const explodeParameters = [\"status\"];\n\n if (Array.isArray(value) && explodeParameters.includes(key)) {\n value.forEach((v) => {\n normalizedParams.append(key, v === null ? 'null' : String(v));\n });\n return;\n }\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 ? `/tutoring/queue?${stringifiedParams}` : `/tutoring/queue`\n}\n\n/**\n * What is waiting, oldest first.\n *\n * Scoped to the dispatcher's tenant. Defaults to the four open statuses, which\n * is what the partial index on the table is built for — pass ``?status=`` to\n * look at something else and the query stops using it, which is the honest\n * trade rather than a hidden one.\n * @summary List Queue\n */\nexport const listQueue = async (params?: ListQueueParams, options?: Parameters<typeof request>[1]): Promise<TutoringQueuePage> => {\n\n return request<TutoringQueuePage>(getListQueueUrl(params),\n {\n ...options,\n method: 'GET'\n\n\n }\n);}\n\n\nexport const getDispatchRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/dispatch`\n}\n\n/**\n * Route it — to somebody named, or to the open pool.\n *\n * Changing the channel here is deliberate and common: pupils pick a classroom\n * and turn out to have no microphone, and the dispatcher is the person who\n * finds that out.\n * @summary Dispatch Request\n */\nexport const dispatchRequest = async (requestId: number,\n tutoringDispatchWrite: TutoringDispatchWrite, options?: Parameters<typeof request>[1]): Promise<void> => {\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<void>(getDispatchRequestUrl(requestId),\n {\n ...options,\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },\n body: JSON.stringify(tutoringDispatchWrite)\n }\n);}\n\n\nexport const getTriageRequestUrl = (requestId: number,) => {\n\n\n\n\n return `/tutoring/requests/${requestId}/triage`\n}\n\n/**\n * Take a request off the queue to look at it.\n *\n * Separate from dispatching because the legacy's own timestamps separate them —\n * ``picked_by_switchman_at`` then ``validated_at`` — and the gap between the\n * two is the figure that tells you whether the queue is staffed.\n * @summary Triage Request\n */\nexport const triageRequest = async (requestId: number, options?: Parameters<typeof request>[1]): Promise<void> => {\n\n return request<void>(getTriageRequestUrl(requestId),\n {\n ...options,\n method: 'POST'\n\n\n }\n);}\n\n\n"],"mappings":";;;AAeA,MAAa,mBAAmB,WAA8B;CAC5D,MAAM,mBAAmB,IAAI,gBAAgB;CAE7C,OAAO,QAAQ,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;EAGrD,IAAI,MAAM,QAAQ,KAAK,KAAK,CAFD,QAEiB,CAAC,CAAC,SAAS,GAAG,GAAG;GAC3D,MAAM,SAAS,MAAM;IACnB,iBAAiB,OAAO,KAAK,MAAM,OAAO,SAAS,OAAO,CAAC,CAAC;GAC9D,CAAC;GACD;EACF;EAEA,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,mBAAmB,sBAAsB;AACjF;;;;;;;;;;AAWA,MAAa,YAAY,OAAO,QAA0B,YAAwE;CAEhI,OAAO,QAA2B,gBAAgB,MAAM,GACxD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE;AAGF,MAAa,yBAAyB,cAAuB;CAK3D,OAAO,sBAAsB,UAAU;AACzC;;;;;;;;;AAUA,MAAa,kBAAkB,OAAO,WAClC,uBAA8C,YAA2D;CAEzG,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,QAAc,sBAAsB,SAAS,GAClD;EACE,GAAG;EACH,QAAQ;EACR,SAAS;GAAE,gBAAgB;GAAoB,GAAG,WAAW,SAAS,OAAO;EAAE;EAC/E,MAAM,KAAK,UAAU,qBAAqB;CAC5C,CACF;AAAE;AAGF,MAAa,uBAAuB,cAAuB;CAKzD,OAAO,sBAAsB,UAAU;AACzC;;;;;;;;;AAUA,MAAa,gBAAgB,OAAO,WAAmB,YAA2D;CAEhH,OAAO,QAAc,oBAAoB,SAAS,GAClD;EACE,GAAG;EACH,QAAQ;CAGV,CACF;AAAE"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
import { S as TutoringAnswerWrite, i as TutoringRoomRead, y as TutoringCloseWrite } from "../index-wL_20vR8.js";
|
|
3
|
+
import { c as request } from "../client-BDwBZYB0.js";
|
|
4
|
+
//#region src/api/tutoring-practitioner/tutoring-practitioner.d.ts
|
|
5
|
+
export declare const getAnswerRequestUrl: (requestId: number) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Deliver the answer.
|
|
8
|
+
*
|
|
9
|
+
* The body is stored as the answer and any named attachments are re-roled to
|
|
10
|
+
* ``answer`` — they were uploaded against this request, so no id from another
|
|
11
|
+
* request can be attached here.
|
|
12
|
+
* @summary Answer Request
|
|
13
|
+
*/
|
|
14
|
+
export declare const answerRequest: (requestId: number, tutoringAnswerWrite: TutoringAnswerWrite, options?: Parameters<typeof request>[1]) => Promise<void>;
|
|
15
|
+
export declare const getClaimRequestUrl: (requestId: number) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Take a dispatched request.
|
|
18
|
+
*
|
|
19
|
+
* ``409`` if somebody else already holds it. The check and the write are one
|
|
20
|
+
* statement so that two practitioners hitting claim in the same instant cannot
|
|
21
|
+
* both win — the legacy reads then writes, so both do.
|
|
22
|
+
* @summary Claim Request
|
|
23
|
+
*/
|
|
24
|
+
export declare const claimRequest: (requestId: number, options?: Parameters<typeof request>[1]) => Promise<void>;
|
|
25
|
+
export declare const getCloseRequestUrl: (requestId: number) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Close a request that will not be answered, with a reason.
|
|
28
|
+
*
|
|
29
|
+
* A dispatcher's job rather than a practitioner's: giving up on a request is a
|
|
30
|
+
* decision about the queue, and the person who could not answer it is not the
|
|
31
|
+
* person who should decide nobody will.
|
|
32
|
+
* @summary Close Request
|
|
33
|
+
*/
|
|
34
|
+
export declare const closeRequest: (requestId: number, tutoringCloseWrite: TutoringCloseWrite, options?: Parameters<typeof request>[1]) => Promise<void>;
|
|
35
|
+
export declare const getOpenRoomUrl: (requestId: number) => string;
|
|
36
|
+
/**
|
|
37
|
+
* Open the room for a live request. The practitioner decides when.
|
|
38
|
+
*
|
|
39
|
+
* Deliberately an explicit action rather than a side effect of claiming, which
|
|
40
|
+
* is what Prof Express does: the teacher presses a button in their own queue,
|
|
41
|
+
* and ``createTeacherVedamoClasssroom`` refuses unless a teacher is assigned.
|
|
42
|
+
* A room provisioned at dispatch is a room the pupil joins alone.
|
|
43
|
+
*
|
|
44
|
+
* Only the assigned practitioner may open it, and only once — a second call
|
|
45
|
+
* returns the room that is already open rather than provisioning another. The
|
|
46
|
+
* legacy has no such check, so pressing its button twice orphans a room the
|
|
47
|
+
* pupil may already hold a link to.
|
|
48
|
+
*
|
|
49
|
+
* ``409`` for a channel with nothing to join, and for a request nobody has
|
|
50
|
+
* claimed.
|
|
51
|
+
* @summary Open Room
|
|
52
|
+
*/
|
|
53
|
+
export declare const openRoom: (requestId: number, options?: Parameters<typeof request>[1]) => Promise<TutoringRoomRead>;
|
|
54
|
+
//#endregion
|
|
55
|
+
//# sourceMappingURL=tutoring-practitioner.d.ts.map
|