@oaknational/google-classroom-addon 1.6.3 → 1.8.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.
@@ -1,15 +1,20 @@
1
1
  import { Firestore } from '@google-cloud/firestore';
2
+ import z from 'zod';
2
3
 
3
- type CreateAnnouncementAttachmentArgs = {
4
- courseId: string;
5
- itemId: string;
6
- addOnToken: string;
7
- title: string;
8
- lessonSlug: string;
9
- programeSlug: string;
10
- unitSlug: string;
11
- maxPoints?: number;
12
- };
4
+ declare const codeSchema: z.ZodString;
5
+ type Code = z.infer<typeof codeSchema>;
6
+
7
+ declare const createAnnouncementAttachmentArgsSchema: z.ZodObject<{
8
+ courseId: z.ZodString;
9
+ itemId: z.ZodString;
10
+ addOnToken: z.ZodString;
11
+ title: z.ZodString;
12
+ lessonSlug: z.ZodString;
13
+ programmeSlug: z.ZodString;
14
+ unitSlug: z.ZodString;
15
+ maxPoints: z.ZodOptional<z.ZodNumber>;
16
+ }, z.core.$strip>;
17
+ type CreateAnnouncementAttachmentArgs = z.infer<typeof createAnnouncementAttachmentArgsSchema>;
13
18
 
14
19
  type OakGoogleSignInCallback = {
15
20
  encryptedSession: string;
@@ -33,7 +38,7 @@ declare class OakGoogleClassroomAddOn {
33
38
  constructor(encryptionSecret: string, firestore: Firestore, googleOAuthClientId: string, googleOAuthClientSecret: string, googleOAuthCallbackApiRoute: string, sessionSecret: string, baseUrl: string);
34
39
  private getOAuthClient;
35
40
  getGoogleSignInUrl(loginHint?: string, subscribeToNewsletter?: boolean): Promise<string>;
36
- handleGoogleSignInCallback(code: string, subscribeToNewsletterFn?: (email: string) => Promise<void>): Promise<OakGoogleSignInCallback>;
41
+ handleGoogleSignInCallback(code: Code, subscribeToNewsletterFn?: (email: string) => Promise<void>): Promise<OakGoogleSignInCallback>;
37
42
  private decryptSession;
38
43
  /**
39
44
  * Validates an encrypted session and fetches the associated user credentials.
@@ -53,7 +58,25 @@ declare class OakGoogleClassroomAddOn {
53
58
  session: string;
54
59
  token: string;
55
60
  } | null>;
56
- createAttachment(args: CreateAnnouncementAttachmentArgs, accessToken: string, session: string): Promise<FirebaseFirestore.DocumentData | null | undefined>;
61
+ createAttachment(args: CreateAnnouncementAttachmentArgs, accessToken: string, session: string): Promise<{
62
+ courseId: string;
63
+ postId: string;
64
+ id: string;
65
+ title: string;
66
+ teacherViewUri: {
67
+ uri: string;
68
+ };
69
+ studentViewUri: {
70
+ uri: string;
71
+ };
72
+ itemId: string;
73
+ attachmentId: string;
74
+ createdAt: string;
75
+ studentWorkReviewUri?: {
76
+ uri: string;
77
+ } | undefined;
78
+ maxPoints?: number | undefined;
79
+ } | null>;
57
80
  }
58
81
 
59
82
  export { OakGoogleClassroomAddOn };
@@ -0,0 +1,87 @@
1
+ import z from 'zod';
2
+
3
+ declare const codeSchema: z.ZodString;
4
+ type Code = z.infer<typeof codeSchema>;
5
+ declare const googleOAuthUserSchema: z.ZodObject<{
6
+ accessToken: z.ZodString;
7
+ loginHint: z.ZodString;
8
+ refreshToken: z.ZodOptional<z.ZodString>;
9
+ profilePictureUrl: z.ZodOptional<z.ZodString>;
10
+ email: z.ZodOptional<z.ZodString>;
11
+ }, z.core.$strip>;
12
+ type GoogleOAuthUser = z.infer<typeof googleOAuthUserSchema>;
13
+ declare const tokenPayloadSchema: z.ZodObject<{
14
+ token: z.ZodString;
15
+ }, z.core.$strip>;
16
+ type TokenPayload = z.infer<typeof tokenPayloadSchema>;
17
+ declare const CreateAttachmentCallSchema: z.ZodTuple<[z.ZodObject<{
18
+ courseId: z.ZodString;
19
+ itemId: z.ZodString;
20
+ addOnToken: z.ZodString;
21
+ title: z.ZodString;
22
+ lessonSlug: z.ZodString;
23
+ programmeSlug: z.ZodString;
24
+ unitSlug: z.ZodString;
25
+ maxPoints: z.ZodOptional<z.ZodNumber>;
26
+ }, z.core.$strip>, z.ZodString, z.ZodString], null>;
27
+ type CreateAttachmentCall = z.infer<typeof CreateAttachmentCallSchema>;
28
+
29
+ declare const classroomAttachmentEntitySchema: z.ZodObject<{
30
+ courseId: z.ZodString;
31
+ postId: z.ZodString;
32
+ id: z.ZodString;
33
+ title: z.ZodString;
34
+ teacherViewUri: z.ZodObject<{
35
+ uri: z.ZodString;
36
+ }, z.core.$strip>;
37
+ studentViewUri: z.ZodObject<{
38
+ uri: z.ZodString;
39
+ }, z.core.$strip>;
40
+ studentWorkReviewUri: z.ZodOptional<z.ZodObject<{
41
+ uri: z.ZodString;
42
+ }, z.core.$strip>>;
43
+ itemId: z.ZodString;
44
+ maxPoints: z.ZodOptional<z.ZodNumber>;
45
+ attachmentId: z.ZodString;
46
+ createdAt: z.ZodString;
47
+ }, z.core.$strip>;
48
+ type ClassroomAttachmentEntity = z.infer<typeof classroomAttachmentEntitySchema>;
49
+ declare const userCredentialsEntitySchema: z.ZodObject<{
50
+ loginHint: z.ZodString;
51
+ refreshToken: z.ZodOptional<z.ZodString>;
52
+ profilePictureUrl: z.ZodOptional<z.ZodString>;
53
+ }, z.core.$strip>;
54
+ type UserCredentialsEntity = z.infer<typeof userCredentialsEntitySchema>;
55
+
56
+ declare const createAnnouncementAttachmentArgsSchema: z.ZodObject<{
57
+ courseId: z.ZodString;
58
+ itemId: z.ZodString;
59
+ addOnToken: z.ZodString;
60
+ title: z.ZodString;
61
+ lessonSlug: z.ZodString;
62
+ programmeSlug: z.ZodString;
63
+ unitSlug: z.ZodString;
64
+ maxPoints: z.ZodOptional<z.ZodNumber>;
65
+ }, z.core.$strip>;
66
+ type CreateAnnouncementAttachmentArgs = z.infer<typeof createAnnouncementAttachmentArgsSchema>;
67
+ declare const classroomAttachmentSchema: z.ZodObject<{
68
+ courseId: z.ZodString;
69
+ postId: z.ZodString;
70
+ id: z.ZodString;
71
+ title: z.ZodString;
72
+ teacherViewUri: z.ZodObject<{
73
+ uri: z.ZodString;
74
+ }, z.core.$strip>;
75
+ studentViewUri: z.ZodObject<{
76
+ uri: z.ZodString;
77
+ }, z.core.$strip>;
78
+ studentWorkReviewUri: z.ZodOptional<z.ZodObject<{
79
+ uri: z.ZodString;
80
+ }, z.core.$strip>>;
81
+ itemId: z.ZodString;
82
+ maxPoints: z.ZodOptional<z.ZodNumber>;
83
+ }, z.core.$strip>;
84
+ type ClassroomAttachment = z.infer<typeof classroomAttachmentSchema>;
85
+
86
+ export { CreateAttachmentCallSchema, classroomAttachmentEntitySchema, classroomAttachmentSchema, codeSchema, createAnnouncementAttachmentArgsSchema, googleOAuthUserSchema, tokenPayloadSchema, userCredentialsEntitySchema };
87
+ export type { ClassroomAttachment, ClassroomAttachmentEntity, Code, CreateAnnouncementAttachmentArgs, CreateAttachmentCall, GoogleOAuthUser, TokenPayload, UserCredentialsEntity };
package/dist/views.d.ts CHANGED
@@ -77,7 +77,7 @@ type NewAttachment = {
77
77
  addOnToken: string;
78
78
  title: string;
79
79
  lessonSlug: string;
80
- programeSlug: string;
80
+ programmeSlug: string;
81
81
  unitSlug: string;
82
82
  maxPoints?: number;
83
83
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oaknational/google-classroom-addon",
3
- "version": "1.6.3",
3
+ "version": "1.8.0",
4
4
  "description": "Components and helpers for the Oak Google Classroom Add-on",
5
5
  "exports": {
6
6
  "./ui": {
@@ -12,12 +12,18 @@
12
12
  "import": "./dist/esm/services/index.js",
13
13
  "require": "./dist/cjs/services/index.js",
14
14
  "types": "./dist/services.d.ts"
15
+ },
16
+ "./types": {
17
+ "import": "./dist/esm/types/index.js",
18
+ "require": "./dist/cjs/types/index.js",
19
+ "types": "./dist/types.d.ts"
15
20
  }
16
21
  },
17
22
  "files": [
18
23
  "dist",
19
24
  "ui",
20
- "server"
25
+ "server",
26
+ "types"
21
27
  ],
22
28
  "scripts": {
23
29
  "build": "rollup -c --bundleConfigAsCjs",
@@ -54,7 +60,8 @@
54
60
  "next": ">=15.4.3",
55
61
  "react": ">=18.3.1",
56
62
  "react-dom": ">=18.3.1",
57
- "zustand": ">=5.0.9"
63
+ "zustand": ">=5.0.9",
64
+ "zod": ">=3.25.76"
58
65
  },
59
66
  "dependencies": {
60
67
  "iron-session": "^8.0.4",
@@ -0,0 +1,5 @@
1
+ {
2
+ "main": "../dist/cjs/types/index.js",
3
+ "module": "../dist/esm/types/index.js",
4
+ "types": "../dist/types.d.ts"
5
+ }