@corsair-dev/memberspot 0.0.0-stage → 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/LICENSE +191 -0
- package/README.md +61 -2
- package/dist/api.test.d.ts +2 -0
- package/dist/api.test.d.ts.map +1 -0
- package/dist/client.d.ts +48 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.test.d.ts +2 -0
- package/dist/client.test.d.ts.map +1 -0
- package/dist/endpoints/call.d.ts +43 -0
- package/dist/endpoints/call.d.ts.map +1 -0
- package/dist/endpoints/index.d.ts +4 -0
- package/dist/endpoints/index.d.ts.map +1 -0
- package/dist/endpoints/reads.d.ts +35 -0
- package/dist/endpoints/reads.d.ts.map +1 -0
- package/dist/endpoints/types.d.ts +964 -0
- package/dist/endpoints/types.d.ts.map +1 -0
- package/dist/endpoints.test.d.ts +2 -0
- package/dist/endpoints.test.d.ts.map +1 -0
- package/dist/error-handlers.d.ts +54 -0
- package/dist/error-handlers.d.ts.map +1 -0
- package/dist/error-handlers.test.d.ts +2 -0
- package/dist/error-handlers.test.d.ts.map +1 -0
- package/dist/index.d.ts +651 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/integration.test.d.ts +2 -0
- package/dist/integration.test.d.ts.map +1 -0
- package/dist/plugin.test.d.ts +2 -0
- package/dist/plugin.test.d.ts.map +1 -0
- package/dist/requests.test.d.ts +2 -0
- package/dist/requests.test.d.ts.map +1 -0
- package/dist/retry.test.d.ts +2 -0
- package/dist/retry.test.d.ts.map +1 -0
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema.test.d.ts +2 -0
- package/dist/schema.test.d.ts.map +1 -0
- package/dist/test-fixtures.d.ts +184 -0
- package/dist/test-fixtures.d.ts.map +1 -0
- package/dist/tsup.config.d.ts +3 -0
- package/dist/tsup.config.d.ts.map +1 -0
- package/package.json +51 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(which shall not include Communications that are clearly marked or
|
|
39
|
+
otherwise designated in writing by the copyright owner as "Not a Work").
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution".
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright (c) 2026 Corsair
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,62 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @corsair-dev/memberspot
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
MemberSpot plugin for Corsair.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @corsair-dev/memberspot
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Endpoints
|
|
12
|
+
|
|
13
|
+
| Operation | Operation ID | Risk | Description |
|
|
14
|
+
|-----------|--------------|------|-------------|
|
|
15
|
+
| `auth.check` | `memberspot.api.auth.check` | `read` | Returns the school the API key belongs to, which is the cheapest way to confirm a key works |
|
|
16
|
+
| `chapters.enableAccess` | `memberspot.api.chapters.enableAccess` | `write` | Grants a user access to one chapter by email |
|
|
17
|
+
| `chapters.enableAccessByUid` | `memberspot.api.chapters.enableAccessByUid` | `write` | Grants a user access to one chapter by uid |
|
|
18
|
+
| `courses.list` | `memberspot.api.courses.list` | `read` | Lists all courses of the school with their ids and types |
|
|
19
|
+
| `customProperties.list` | `memberspot.api.customProperties.list` | `read` | Lists the custom user properties defined for the school |
|
|
20
|
+
| `exams.list` | `memberspot.api.exams.list` | `read` | Lists all exams of the school, including the examId used for results |
|
|
21
|
+
| `exams.results` | `memberspot.api.exams.results` | `read` | Lists the exam results of every user who took an exam, with each run and whether it passed |
|
|
22
|
+
| `offers.list` | `memberspot.api.offers.list` | `read` | Lists the offers available in the school |
|
|
23
|
+
| `users.courseProgress` | `memberspot.api.users.courseProgress` | `read` | Lists every course progress record for a user by email, paginated |
|
|
24
|
+
| `users.courseProgressByUid` | `memberspot.api.users.courseProgressByUid` | `read` | Lists every course progress record for a user by uid, paginated |
|
|
25
|
+
| `users.courseProgressDetail` | `memberspot.api.users.courseProgressDetail` | `read` | Returns one user’s progress in one course, by email |
|
|
26
|
+
| `users.courseProgressDetailByUid` | `memberspot.api.users.courseProgressDetailByUid` | `read` | Returns one user’s progress in one course, by uid |
|
|
27
|
+
| `users.delete` | `memberspot.api.users.delete` | `destructive` | Permanently deletes up to 10 users by email; deleted accounts and their progress cannot be restored |
|
|
28
|
+
| `users.deleteByUid` | `memberspot.api.users.deleteByUid` | `destructive` | Permanently deletes up to 10 users by uid; deleted accounts and their progress cannot be restored |
|
|
29
|
+
| `users.findByEmail` | `memberspot.api.users.findByEmail` | `read` | Returns one user by email; a member that does not exist answers 400 USER_NOT_FOUND rather than an empty result |
|
|
30
|
+
| `users.findByUid` | `memberspot.api.users.findByUid` | `read` | Returns one user by uid; a uid that does not exist answers an empty body, which fails the output schema rather than returning null |
|
|
31
|
+
| `users.grantOffer` | `memberspot.api.users.grantOffer` | `write` | Creates or updates a user by email and optionally grants an offer in the same call; reports whether the user is new |
|
|
32
|
+
| `users.grantOfferByUid` | `memberspot.api.users.grantOfferByUid` | `write` | Grants an offer to an existing user by uid |
|
|
33
|
+
| `users.list` | `memberspot.api.users.list` | `read` | Returns a page of users, optionally filtered by offer or course, with a cursor for the next page |
|
|
34
|
+
| `users.loginToken` | `memberspot.api.users.loginToken` | `write` | Mints a token and login URL that signs a user in automatically, which is a credential; the token expires after one hour |
|
|
35
|
+
| `users.offers` | `memberspot.api.users.offers` | `read` | Returns the offers granted to a user with their active state and expiry |
|
|
36
|
+
| `users.setCourseStartDate` | `memberspot.api.users.setCourseStartDate` | `write` | Sets when a user’s access to a course starts |
|
|
37
|
+
| `users.setCustomProperties` | `memberspot.api.users.setCustomProperties` | `write` | Sets several custom user properties at once by email; properties omitted from the map are left unchanged |
|
|
38
|
+
| `users.setCustomPropertiesByUid` | `memberspot.api.users.setCustomPropertiesByUid` | `write` | Sets several custom user properties at once by uid |
|
|
39
|
+
| `users.setCustomProperty` | `memberspot.api.users.setCustomProperty` | `write` | Sets one custom user property by email; a null value blanks it |
|
|
40
|
+
| `users.setCustomPropertyByUid` | `memberspot.api.users.setCustomPropertyByUid` | `write` | Sets one custom user property by uid |
|
|
41
|
+
| `users.setOfferExpires` | `memberspot.api.users.setOfferExpires` | `write` | Sets or clears the expiry date of an offer for a user by uid |
|
|
42
|
+
| `users.setOfferState` | `memberspot.api.users.setOfferState` | `write` | Activates or deactivates an offer for a user by email, which is how access is revoked |
|
|
43
|
+
| `users.setOfferStateByUid` | `memberspot.api.users.setOfferStateByUid` | `write` | Activates or deactivates an offer for a user by uid |
|
|
44
|
+
| `users.setOrderState` | `memberspot.api.users.setOrderState` | `write` | Sets the state of an offer tied to an order for a user by email |
|
|
45
|
+
| `users.setOrderStateByOrderId` | `memberspot.api.users.setOrderStateByOrderId` | `write` | Sets the state of every offer carrying a given orderId, across all users |
|
|
46
|
+
| `users.setOrderStateByUid` | `memberspot.api.users.setOrderStateByUid` | `write` | Sets the state of an offer tied to an order for a user by uid |
|
|
47
|
+
|
|
48
|
+
## Auth
|
|
49
|
+
|
|
50
|
+
Auth: API key. Corsair prompts your tenant for credentials on first use.
|
|
51
|
+
|
|
52
|
+
## Webhooks
|
|
53
|
+
|
|
54
|
+
No webhooks.
|
|
55
|
+
|
|
56
|
+
## Reference
|
|
57
|
+
|
|
58
|
+
Full docs, types, and examples: https://docs.corsair.dev/plugins/memberspot
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
Apache-2.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.test.d.ts","sourceRoot":"","sources":["../api.test.ts"],"names":[],"mappings":""}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MemberSpot's REST API, documented as an OpenAPI 3.0 spec served at
|
|
3
|
+
* https://api.memberspot.de/api, with the machine-readable copy at
|
|
4
|
+
* https://api.memberspot.de/api-json.
|
|
5
|
+
*
|
|
6
|
+
* Auth is an `X-API-KEY` header. The key is created in the school settings at
|
|
7
|
+
* `/settings/apikeys`, so it is per school, not per user.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MEMBERSPOT_API_BASE = "https://api.memberspot.de";
|
|
10
|
+
/**
|
|
11
|
+
* MemberSpot answers `{ message, statusCode }` on every failure, which is the
|
|
12
|
+
* NestJS default. A missing key is 400 and an invalid one is 401, so the status
|
|
13
|
+
* alone does not tell a caller whether to fix their key.
|
|
14
|
+
*/
|
|
15
|
+
export declare class MemberSpotAPIError extends Error {
|
|
16
|
+
/** The HTTP status. */
|
|
17
|
+
readonly status?: number;
|
|
18
|
+
/** Milliseconds from a Retry-After header, when one was sent. */
|
|
19
|
+
readonly retryAfter?: number;
|
|
20
|
+
/** True for a 429. */
|
|
21
|
+
readonly isRateLimit: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* True when repeating the request cannot apply the operation twice. The API
|
|
24
|
+
* mixes reads with writes on the same host, so each call declares this.
|
|
25
|
+
*/
|
|
26
|
+
readonly replaySafe: boolean;
|
|
27
|
+
/** True when the request never reached MemberSpot. */
|
|
28
|
+
readonly transport: boolean;
|
|
29
|
+
constructor(message: string, options?: {
|
|
30
|
+
status?: number;
|
|
31
|
+
retryAfter?: number;
|
|
32
|
+
replaySafe?: boolean;
|
|
33
|
+
transport?: boolean;
|
|
34
|
+
cause?: Error;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export type MemberSpotQuery = Record<string, string | number | boolean | undefined>;
|
|
38
|
+
/**
|
|
39
|
+
* Sends one request and returns the parsed JSON body, which every endpoint then
|
|
40
|
+
* parses with its own schema. The return type stays unknown for that reason.
|
|
41
|
+
*/
|
|
42
|
+
export declare function makeMemberSpotRequest(apiKey: string, action: string, options?: {
|
|
43
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
44
|
+
query?: MemberSpotQuery;
|
|
45
|
+
body?: unknown;
|
|
46
|
+
replaySafe?: boolean;
|
|
47
|
+
}): Promise<unknown>;
|
|
48
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources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0 +1,43 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { MemberSpotContext } from '..';
|
|
3
|
+
import type { MemberSpotQuery } from '../client';
|
|
4
|
+
type LogFields = Record<string, string | number | boolean | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Validates the input, sends the request, validates the response, then logs the
|
|
7
|
+
* event. Inputs are not logged: they carry member emails and names, so `log`
|
|
8
|
+
* picks the safe fields, which are ids and counts.
|
|
9
|
+
*/
|
|
10
|
+
export declare function call<Input extends z.ZodType, Output extends z.ZodType>(ctx: MemberSpotContext, operation: {
|
|
11
|
+
event: string;
|
|
12
|
+
input: Input;
|
|
13
|
+
output: Output;
|
|
14
|
+
}, rawInput: unknown, toRequest: (parsed: z.output<Input>) => {
|
|
15
|
+
action: string;
|
|
16
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
17
|
+
query?: MemberSpotQuery;
|
|
18
|
+
body?: Record<string, unknown>;
|
|
19
|
+
/**
|
|
20
|
+
* True for reads and for writes the docs describe as idempotent. A 5xx
|
|
21
|
+
* never replays anything else, because the write may already have landed.
|
|
22
|
+
*/
|
|
23
|
+
replaySafe?: boolean;
|
|
24
|
+
}, options?: {
|
|
25
|
+
log?: (parsed: z.output<Input>, result: z.output<Output>) => LogFields;
|
|
26
|
+
/**
|
|
27
|
+
* Reshapes a reply the output schema cannot take as sent, for routes whose
|
|
28
|
+
* live answer differs from the spec. Kept out of the schema so the
|
|
29
|
+
* generated reference still shows the output fields.
|
|
30
|
+
*/
|
|
31
|
+
normalize?: (raw: unknown) => unknown;
|
|
32
|
+
}): Promise<z.output<Output>>;
|
|
33
|
+
/**
|
|
34
|
+
* Drops undefined entries so a body matches the DTO the API documents.
|
|
35
|
+
*
|
|
36
|
+
* Both types are unknown because the fields differ per operation: this runs on a
|
|
37
|
+
* freshly built literal with a handful of optional keys, and the endpoint's input
|
|
38
|
+
* schema is what validates them before they arrive. Naming a DTO type per call
|
|
39
|
+
* site would restate every schema for no check the schema does not already make.
|
|
40
|
+
*/
|
|
41
|
+
export declare function bodyOf(fields: Record<string, unknown>): Record<string, unknown>;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=call.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../../endpoints/call.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGjD,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;AAEvE;;;;GAIG;AACH,wBAAsB,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC,OAAO,EAAE,MAAM,SAAS,CAAC,CAAC,OAAO,EAC3E,GAAG,EAAE,iBAAiB,EACtB,SAAS,EAAE;IACV,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf,EAED,QAAQ,EAAE,OAAO,EACjB,SAAS,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACrD,KAAK,CAAC,EAAE,eAAe,CAAC;IAIxB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB,EACD,OAAO,GAAE;IACR,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC;IACvE;;;;OAIG;IAEH,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC;CACjC,GACJ,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CA0B3B;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../endpoints/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,GAAG,EAAE,CAAC;AACf,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { MemberSpotEndpoints } from '..';
|
|
2
|
+
/** Returns the school the key belongs to, which is the cheapest key check. */
|
|
3
|
+
export declare const authCheck: MemberSpotEndpoints['authCheck'];
|
|
4
|
+
export declare const offersList: MemberSpotEndpoints['offersList'];
|
|
5
|
+
export declare const coursesList: MemberSpotEndpoints['coursesList'];
|
|
6
|
+
export declare const examsList: MemberSpotEndpoints['examsList'];
|
|
7
|
+
export declare const customPropertiesList: MemberSpotEndpoints['customPropertiesList'];
|
|
8
|
+
export declare const usersList: MemberSpotEndpoints['usersList'];
|
|
9
|
+
export declare const usersFindByEmail: MemberSpotEndpoints['usersFindByEmail'];
|
|
10
|
+
export declare const usersFindByUid: MemberSpotEndpoints['usersFindByUid'];
|
|
11
|
+
export declare const usersOffers: MemberSpotEndpoints['usersOffers'];
|
|
12
|
+
export declare const usersLoginToken: MemberSpotEndpoints['usersLoginToken'];
|
|
13
|
+
export declare const usersCourseProgress: MemberSpotEndpoints['usersCourseProgress'];
|
|
14
|
+
export declare const usersCourseProgressByUid: MemberSpotEndpoints['usersCourseProgressByUid'];
|
|
15
|
+
export declare const usersCourseProgressDetail: MemberSpotEndpoints['usersCourseProgressDetail'];
|
|
16
|
+
export declare const usersCourseProgressDetailByUid: MemberSpotEndpoints['usersCourseProgressDetailByUid'];
|
|
17
|
+
export declare const usersGrantOffer: MemberSpotEndpoints['usersGrantOffer'];
|
|
18
|
+
export declare const usersGrantOfferByUid: MemberSpotEndpoints['usersGrantOfferByUid'];
|
|
19
|
+
export declare const usersSetOfferState: MemberSpotEndpoints['usersSetOfferState'];
|
|
20
|
+
export declare const usersSetOfferStateByUid: MemberSpotEndpoints['usersSetOfferStateByUid'];
|
|
21
|
+
export declare const usersSetOrderState: MemberSpotEndpoints['usersSetOrderState'];
|
|
22
|
+
export declare const usersSetOrderStateByUid: MemberSpotEndpoints['usersSetOrderStateByUid'];
|
|
23
|
+
export declare const usersSetOrderStateByOrderId: MemberSpotEndpoints['usersSetOrderStateByOrderId'];
|
|
24
|
+
export declare const usersSetOfferExpires: MemberSpotEndpoints['usersSetOfferExpires'];
|
|
25
|
+
export declare const usersSetCourseStartDate: MemberSpotEndpoints['usersSetCourseStartDate'];
|
|
26
|
+
export declare const usersSetCustomProperties: MemberSpotEndpoints['usersSetCustomProperties'];
|
|
27
|
+
export declare const usersSetCustomPropertiesByUid: MemberSpotEndpoints['usersSetCustomPropertiesByUid'];
|
|
28
|
+
export declare const usersSetCustomProperty: MemberSpotEndpoints['usersSetCustomProperty'];
|
|
29
|
+
export declare const usersSetCustomPropertyByUid: MemberSpotEndpoints['usersSetCustomPropertyByUid'];
|
|
30
|
+
export declare const usersDelete: MemberSpotEndpoints['usersDelete'];
|
|
31
|
+
export declare const usersDeleteByUid: MemberSpotEndpoints['usersDeleteByUid'];
|
|
32
|
+
export declare const examResults: MemberSpotEndpoints['examResults'];
|
|
33
|
+
export declare const chaptersEnableAccess: MemberSpotEndpoints['chaptersEnableAccess'];
|
|
34
|
+
export declare const chaptersE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