@loopwise/admin-sdk 0.1.0-beta.0 → 0.1.0-beta.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @loopwise/admin-sdk
2
2
 
3
+ ## 0.1.0-beta.2
4
+
5
+ Add second typed resource:
6
+
7
+ - `admin.members.list({ perPage, page, role })` returns `AdminMemberPage`
8
+ (mirrors `courses.list` shape).
9
+ - `AdminMember`: `id`, `name`, `email`, `phoneNumber`, `createdAt`,
10
+ `lastSignInAt`.
11
+ - `AdminMemberRole`: `'student' | 'teaching_assistant'` mirrors the
12
+ schema enum.
13
+ - Requires OAuth scope `members:read`.
14
+
15
+ ## 0.1.0-beta.1
16
+
17
+ No functional changes. Validates the tag-triggered OIDC publish path
18
+ now that the npm Trusted Publisher entry is configured (the first
19
+ publish — `0.1.0-beta.0` — had to be done manually because npm OIDC
20
+ can't create new package names).
21
+
3
22
  ## 0.1.0-beta.0
4
23
 
5
24
  First public pre-release.
package/dist/index.d.mts CHANGED
@@ -138,9 +138,57 @@ declare class CoursesResource {
138
138
  list(args?: CoursesListArgs): Promise<AdminCoursePage>;
139
139
  }
140
140
  //#endregion
141
+ //#region src/resources/members.d.ts
142
+ /**
143
+ * "Member" = non-admin school user. Maps to `Query.users(role: ...)`,
144
+ * which returns `AdminUserPage` / `AdminUser` (students by default; TAs
145
+ * when `role: 'teaching_assistant'`). Drop down to `admin.graphql()`
146
+ * for fields outside this minimal projection (attended courses,
147
+ * subscriptions, totalSpent, etc.).
148
+ */
149
+ interface AdminMember {
150
+ id: string;
151
+ name: string | null;
152
+ email: string | null;
153
+ phoneNumber: string | null;
154
+ /** Unix timestamp seconds. */
155
+ createdAt: number;
156
+ /** Unix timestamp seconds, or null when the member has never signed in. */
157
+ lastSignInAt: number | null;
158
+ }
159
+ interface AdminMemberPage {
160
+ nodes: AdminMember[];
161
+ nodesCount: number;
162
+ currentPage: number;
163
+ totalPages: number;
164
+ hasNextPage: boolean;
165
+ hasPreviousPage: boolean;
166
+ }
167
+ type AdminMemberRole = 'student' | 'teaching_assistant';
168
+ interface MembersListArgs {
169
+ /** Items per page. Schema default 20, max 50. */
170
+ perPage?: number;
171
+ page?: number;
172
+ /** Defaults to `'student'` upstream — owner / manager are not selectable. */
173
+ role?: AdminMemberRole;
174
+ }
175
+ declare class MembersResource {
176
+ private readonly client;
177
+ constructor(client: LoopwiseAdminClient);
178
+ /**
179
+ * List non-admin school users (students by default; TAs when
180
+ * `role: 'teaching_assistant'`). Returns the full `AdminUserPage`
181
+ * shape (nodes + pagination meta) under our `AdminMemberPage` alias.
182
+ *
183
+ * Requires OAuth scope `members:read` on the access token.
184
+ */
185
+ list(args?: MembersListArgs): Promise<AdminMemberPage>;
186
+ }
187
+ //#endregion
141
188
  //#region src/index.d.ts
142
189
  interface LoopwiseAdmin {
143
190
  readonly courses: CoursesResource;
191
+ readonly members: MembersResource;
144
192
  /**
145
193
  * Run a typed GraphQL operation against `/admin/graphql`. The SDK does
146
194
  * not parse or validate the document — pass the query string as-is and
@@ -164,4 +212,4 @@ interface LoopwiseAdmin {
164
212
  }
165
213
  declare function createAdminClient(config: LoopwiseAdminConfig): LoopwiseAdmin;
166
214
  //#endregion
167
- export { type AdminCourse, type AdminCoursePage, type CoursesListArgs, type GraphQLError, type GraphQLRequest, LoopwiseAdmin, type LoopwiseAdminConfig, LoopwiseError, type LoopwiseErrorCode, createAdminClient };
215
+ export { type AdminCourse, type AdminCoursePage, type AdminMember, type AdminMemberPage, type AdminMemberRole, type CoursesListArgs, type GraphQLError, type GraphQLRequest, LoopwiseAdmin, type LoopwiseAdminConfig, LoopwiseError, type LoopwiseErrorCode, type MembersListArgs, createAdminClient };
package/dist/index.mjs CHANGED
@@ -144,7 +144,7 @@ function resolveEndpoint(baseUrl) {
144
144
  }
145
145
  //#endregion
146
146
  //#region src/resources/courses.ts
147
- const LIST_QUERY = `
147
+ const LIST_QUERY$1 = `
148
148
  query AdminCoursesList($perPage: Int, $page: Int) {
149
149
  courses(perPage: $perPage, page: $page) {
150
150
  nodes {
@@ -177,18 +177,60 @@ var CoursesResource = class {
177
177
  */
178
178
  async list(args = {}) {
179
179
  return (await this.client.graphql({
180
- query: LIST_QUERY,
180
+ query: LIST_QUERY$1,
181
181
  variables: args,
182
182
  operationName: "AdminCoursesList"
183
183
  })).courses;
184
184
  }
185
185
  };
186
186
  //#endregion
187
+ //#region src/resources/members.ts
188
+ const LIST_QUERY = `
189
+ query AdminMembersList($perPage: Int, $page: Int, $role: AdminUserRole) {
190
+ users(perPage: $perPage, page: $page, role: $role) {
191
+ nodes {
192
+ id
193
+ name
194
+ email
195
+ phoneNumber
196
+ createdAt
197
+ lastSignInAt
198
+ }
199
+ nodesCount
200
+ currentPage
201
+ totalPages
202
+ hasNextPage
203
+ hasPreviousPage
204
+ }
205
+ }
206
+ `;
207
+ var MembersResource = class {
208
+ client;
209
+ constructor(client) {
210
+ this.client = client;
211
+ }
212
+ /**
213
+ * List non-admin school users (students by default; TAs when
214
+ * `role: 'teaching_assistant'`). Returns the full `AdminUserPage`
215
+ * shape (nodes + pagination meta) under our `AdminMemberPage` alias.
216
+ *
217
+ * Requires OAuth scope `members:read` on the access token.
218
+ */
219
+ async list(args = {}) {
220
+ return (await this.client.graphql({
221
+ query: LIST_QUERY,
222
+ variables: args,
223
+ operationName: "AdminMembersList"
224
+ })).users;
225
+ }
226
+ };
227
+ //#endregion
187
228
  //#region src/index.ts
188
229
  function createAdminClient(config) {
189
230
  const client = new LoopwiseAdminClient(config);
190
231
  return {
191
232
  courses: new CoursesResource(client),
233
+ members: new MembersResource(client),
192
234
  graphql: (request) => client.graphql(request),
193
235
  setAccessToken: (token) => client.setAccessToken(token)
194
236
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loopwise/admin-sdk",
3
- "version": "0.1.0-beta.0",
3
+ "version": "0.1.0-beta.2",
4
4
  "description": "Loopwise admin GraphQL SDK — typed access to /admin/graphql for tenant-built applications",
5
5
  "repository": {
6
6
  "type": "git",