@speakableio/core 0.1.0 → 0.1.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/dist/index.d.mts CHANGED
@@ -2,17 +2,13 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
3
  import * as _tanstack_react_query from '@tanstack/react-query';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
- import * as firebase_firestore from 'firebase/firestore';
6
5
  import { Firestore } from 'firebase/firestore';
7
6
  import { FirebaseFirestoreTypes } from '@react-native-firebase/firestore';
8
7
 
9
- interface AssignmentWithId extends Assignment {
10
- ltiLineItemId: null;
11
- id: string;
12
- }
13
8
  interface Assignment {
14
- name: string;
15
- scheduledTime: string | null;
9
+ title: string;
10
+ description: string;
11
+ scheduledTime?: string | null;
16
12
  dueTime?: {
17
13
  hours: number;
18
14
  minutes: number;
@@ -48,15 +44,122 @@ interface Assignment {
48
44
  isAssessment: boolean;
49
45
  isAvailable: boolean;
50
46
  }
51
- type AssignmentAnalyticsType = 'macro' | 'gradebook' | 'cards' | 'student' | 'student_summary';
47
+ interface AssignmentWithId extends Assignment {
48
+ id: string;
49
+ isAvailable: boolean;
50
+ scores?: unknown;
51
+ }
52
52
 
53
- type FirebaseInstance = FirebaseFirestoreTypes.Module | Firestore;
54
- type FirestoreDB = Firestore;
55
- type FirestoreHelpers = typeof firebase_firestore;
53
+ declare const enum AssignmentAnalyticsType {
54
+ Macro = "macro",
55
+ Gradebook = "gradebook",
56
+ Cards = "cards",
57
+ Student = "student",
58
+ StudentSummary = "student_summary",
59
+ All = "all"
60
+ }
61
+
62
+ interface GetAttachScoresParams {
63
+ assignments: AssignmentWithId[];
64
+ analyticType: AssignmentAnalyticsType;
65
+ studentId?: string;
66
+ currentUserId: string;
67
+ }
68
+ interface GetAssignmentScoresParams {
69
+ assignmentId: string;
70
+ currentUserId: string;
71
+ analyticType?: AssignmentAnalyticsType;
72
+ studentId?: string;
73
+ }
56
74
 
57
- declare const createAssignmentRepo: (db: FirestoreDB, h: FirestoreHelpers) => {
58
- get(id: string): Promise<AssignmentWithId | null>;
59
- list(): Promise<AssignmentWithId[]>;
75
+ declare const createAssignmentRepo: () => {
76
+ getAssignment: (params: GetAssignmentScoresParams) => Promise<AssignmentWithId | {
77
+ scores: any;
78
+ id: string;
79
+ isAvailable: boolean;
80
+ title: string;
81
+ description: string;
82
+ scheduledTime?: string | null;
83
+ dueTime?: {
84
+ hours: number;
85
+ minutes: number;
86
+ nanos: number;
87
+ };
88
+ speakableio: boolean;
89
+ owners: string[];
90
+ image: {
91
+ path: string | null;
92
+ url: string;
93
+ };
94
+ dueDate: {
95
+ day: number;
96
+ month: number;
97
+ year: number;
98
+ };
99
+ teacherName: string;
100
+ courseWorkId: string | null;
101
+ dueDateTimestamp: {
102
+ seconds: number;
103
+ nanoseconds: number;
104
+ };
105
+ scheduledTimeTimestamp: number;
106
+ active: boolean;
107
+ voice: string | null;
108
+ setId: string;
109
+ dateMade: {
110
+ seconds: number;
111
+ nanoseconds: number;
112
+ };
113
+ maxPoints: number;
114
+ courseId: string;
115
+ isAssessment: boolean;
116
+ } | null>;
117
+ attachScoresAssignment: (args_0: GetAttachScoresParams) => Promise<{
118
+ scores: any;
119
+ id: string;
120
+ isAvailable: boolean;
121
+ title: string;
122
+ description: string;
123
+ scheduledTime?: string | null;
124
+ dueTime?: {
125
+ hours: number;
126
+ minutes: number;
127
+ nanos: number;
128
+ };
129
+ speakableio: boolean;
130
+ owners: string[];
131
+ image: {
132
+ path: string | null;
133
+ url: string;
134
+ };
135
+ dueDate: {
136
+ day: number;
137
+ month: number;
138
+ year: number;
139
+ };
140
+ teacherName: string;
141
+ courseWorkId: string | null;
142
+ dueDateTimestamp: {
143
+ seconds: number;
144
+ nanoseconds: number;
145
+ };
146
+ scheduledTimeTimestamp: number;
147
+ active: boolean;
148
+ voice: string | null;
149
+ setId: string;
150
+ dateMade: {
151
+ seconds: number;
152
+ nanoseconds: number;
153
+ };
154
+ maxPoints: number;
155
+ courseId: string;
156
+ isAssessment: boolean;
157
+ }[]>;
158
+ getAssignmentScores: (args_0: GetAssignmentScoresParams) => Promise<{
159
+ scores: unknown;
160
+ id: string;
161
+ } | undefined>;
162
+ getAllAssignments: () => Promise<AssignmentWithId[]>;
60
163
  };
61
164
 
62
165
  declare const assignmentQueryKeys: {
@@ -64,18 +167,150 @@ declare const assignmentQueryKeys: {
64
167
  byId: (id: string) => readonly ["assignments", string];
65
168
  list: () => readonly ["assignments", "list"];
66
169
  };
67
- declare function useAssignment(id: string): _tanstack_react_query.UseQueryResult<AssignmentWithId | null, Error>;
170
+ declare function useAssignment({ assignmentId, enabled, analyticType, userId, }: {
171
+ assignmentId: string;
172
+ enabled?: boolean;
173
+ analyticType?: AssignmentAnalyticsType;
174
+ userId: string;
175
+ }): _tanstack_react_query.UseQueryResult<AssignmentWithId | {
176
+ scores: any;
177
+ id: string;
178
+ isAvailable: boolean;
179
+ title: string;
180
+ description: string;
181
+ scheduledTime?: string | null;
182
+ dueTime?: {
183
+ hours: number;
184
+ minutes: number;
185
+ nanos: number;
186
+ };
187
+ speakableio: boolean;
188
+ owners: string[];
189
+ image: {
190
+ path: string | null;
191
+ url: string;
192
+ };
193
+ dueDate: {
194
+ day: number;
195
+ month: number;
196
+ year: number;
197
+ };
198
+ teacherName: string;
199
+ courseWorkId: string | null;
200
+ dueDateTimestamp: {
201
+ seconds: number;
202
+ nanoseconds: number;
203
+ };
204
+ scheduledTimeTimestamp: number;
205
+ active: boolean;
206
+ voice: string | null;
207
+ setId: string;
208
+ dateMade: {
209
+ seconds: number;
210
+ nanoseconds: number;
211
+ };
212
+ maxPoints: number;
213
+ courseId: string;
214
+ isAssessment: boolean;
215
+ } | null, Error>;
216
+
217
+ type FirebaseInstance = FirebaseFirestoreTypes.Module | Firestore;
68
218
 
69
219
  type FsClient = ReturnType<typeof createFsClient>;
70
220
  declare function createFsClient(db: FirebaseInstance, platform: 'web' | 'native'): Promise<{
71
221
  assignmentRepo: {
72
- get(id: string): Promise<AssignmentWithId | null>;
73
- list(): Promise<AssignmentWithId[]>;
222
+ getAssignment: (params: GetAssignmentScoresParams) => Promise<AssignmentWithId | {
223
+ scores: any;
224
+ id: string;
225
+ isAvailable: boolean;
226
+ title: string;
227
+ description: string;
228
+ scheduledTime?: string | null;
229
+ dueTime?: {
230
+ hours: number;
231
+ minutes: number;
232
+ nanos: number;
233
+ };
234
+ speakableio: boolean;
235
+ owners: string[];
236
+ image: {
237
+ path: string | null;
238
+ url: string;
239
+ };
240
+ dueDate: {
241
+ day: number;
242
+ month: number;
243
+ year: number;
244
+ };
245
+ teacherName: string;
246
+ courseWorkId: string | null;
247
+ dueDateTimestamp: {
248
+ seconds: number;
249
+ nanoseconds: number;
250
+ };
251
+ scheduledTimeTimestamp: number;
252
+ active: boolean;
253
+ voice: string | null;
254
+ setId: string;
255
+ dateMade: {
256
+ seconds: number;
257
+ nanoseconds: number;
258
+ };
259
+ maxPoints: number;
260
+ courseId: string;
261
+ isAssessment: boolean;
262
+ } | null>;
263
+ attachScoresAssignment: (args_0: GetAttachScoresParams) => Promise<{
264
+ scores: any;
265
+ id: string;
266
+ isAvailable: boolean;
267
+ title: string;
268
+ description: string;
269
+ scheduledTime?: string | null;
270
+ dueTime?: {
271
+ hours: number;
272
+ minutes: number;
273
+ nanos: number;
274
+ };
275
+ speakableio: boolean;
276
+ owners: string[];
277
+ image: {
278
+ path: string | null;
279
+ url: string;
280
+ };
281
+ dueDate: {
282
+ day: number;
283
+ month: number;
284
+ year: number;
285
+ };
286
+ teacherName: string;
287
+ courseWorkId: string | null;
288
+ dueDateTimestamp: {
289
+ seconds: number;
290
+ nanoseconds: number;
291
+ };
292
+ scheduledTimeTimestamp: number;
293
+ active: boolean;
294
+ voice: string | null;
295
+ setId: string;
296
+ dateMade: {
297
+ seconds: number;
298
+ nanoseconds: number;
299
+ };
300
+ maxPoints: number;
301
+ courseId: string;
302
+ isAssessment: boolean;
303
+ }[]>;
304
+ getAssignmentScores: (args_0: GetAssignmentScoresParams) => Promise<{
305
+ scores: unknown;
306
+ id: string;
307
+ } | undefined>;
308
+ getAllAssignments: () => Promise<AssignmentWithId[]>;
74
309
  };
75
310
  }>;
76
311
 
77
312
  interface FsContext {
78
- fs: Awaited<FsClient>;
313
+ speakableApi: Awaited<FsClient>;
79
314
  queryClient: QueryClient;
80
315
  }
81
316
  declare const FsCtx: React.Context<FsContext | null>;
@@ -85,6 +320,6 @@ declare function SpeakableProvider({ db, platform, children, queryClient, }: {
85
320
  children: React.ReactNode;
86
321
  queryClient: QueryClient;
87
322
  }): react_jsx_runtime.JSX.Element | null;
88
- declare function useFs(): FsContext;
323
+ declare function useSpeakableApi(): FsContext;
89
324
 
90
- export { type Assignment, type AssignmentAnalyticsType, type AssignmentWithId, type FsClient, FsCtx, SpeakableProvider, assignmentQueryKeys, createAssignmentRepo, createFsClient, useAssignment, useFs };
325
+ export { type Assignment, type AssignmentWithId, type FsClient, FsCtx, SpeakableProvider, assignmentQueryKeys, createAssignmentRepo, createFsClient, useAssignment, useSpeakableApi };
package/dist/index.d.ts CHANGED
@@ -2,17 +2,13 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
3
  import * as _tanstack_react_query from '@tanstack/react-query';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
- import * as firebase_firestore from 'firebase/firestore';
6
5
  import { Firestore } from 'firebase/firestore';
7
6
  import { FirebaseFirestoreTypes } from '@react-native-firebase/firestore';
8
7
 
9
- interface AssignmentWithId extends Assignment {
10
- ltiLineItemId: null;
11
- id: string;
12
- }
13
8
  interface Assignment {
14
- name: string;
15
- scheduledTime: string | null;
9
+ title: string;
10
+ description: string;
11
+ scheduledTime?: string | null;
16
12
  dueTime?: {
17
13
  hours: number;
18
14
  minutes: number;
@@ -48,15 +44,122 @@ interface Assignment {
48
44
  isAssessment: boolean;
49
45
  isAvailable: boolean;
50
46
  }
51
- type AssignmentAnalyticsType = 'macro' | 'gradebook' | 'cards' | 'student' | 'student_summary';
47
+ interface AssignmentWithId extends Assignment {
48
+ id: string;
49
+ isAvailable: boolean;
50
+ scores?: unknown;
51
+ }
52
52
 
53
- type FirebaseInstance = FirebaseFirestoreTypes.Module | Firestore;
54
- type FirestoreDB = Firestore;
55
- type FirestoreHelpers = typeof firebase_firestore;
53
+ declare const enum AssignmentAnalyticsType {
54
+ Macro = "macro",
55
+ Gradebook = "gradebook",
56
+ Cards = "cards",
57
+ Student = "student",
58
+ StudentSummary = "student_summary",
59
+ All = "all"
60
+ }
61
+
62
+ interface GetAttachScoresParams {
63
+ assignments: AssignmentWithId[];
64
+ analyticType: AssignmentAnalyticsType;
65
+ studentId?: string;
66
+ currentUserId: string;
67
+ }
68
+ interface GetAssignmentScoresParams {
69
+ assignmentId: string;
70
+ currentUserId: string;
71
+ analyticType?: AssignmentAnalyticsType;
72
+ studentId?: string;
73
+ }
56
74
 
57
- declare const createAssignmentRepo: (db: FirestoreDB, h: FirestoreHelpers) => {
58
- get(id: string): Promise<AssignmentWithId | null>;
59
- list(): Promise<AssignmentWithId[]>;
75
+ declare const createAssignmentRepo: () => {
76
+ getAssignment: (params: GetAssignmentScoresParams) => Promise<AssignmentWithId | {
77
+ scores: any;
78
+ id: string;
79
+ isAvailable: boolean;
80
+ title: string;
81
+ description: string;
82
+ scheduledTime?: string | null;
83
+ dueTime?: {
84
+ hours: number;
85
+ minutes: number;
86
+ nanos: number;
87
+ };
88
+ speakableio: boolean;
89
+ owners: string[];
90
+ image: {
91
+ path: string | null;
92
+ url: string;
93
+ };
94
+ dueDate: {
95
+ day: number;
96
+ month: number;
97
+ year: number;
98
+ };
99
+ teacherName: string;
100
+ courseWorkId: string | null;
101
+ dueDateTimestamp: {
102
+ seconds: number;
103
+ nanoseconds: number;
104
+ };
105
+ scheduledTimeTimestamp: number;
106
+ active: boolean;
107
+ voice: string | null;
108
+ setId: string;
109
+ dateMade: {
110
+ seconds: number;
111
+ nanoseconds: number;
112
+ };
113
+ maxPoints: number;
114
+ courseId: string;
115
+ isAssessment: boolean;
116
+ } | null>;
117
+ attachScoresAssignment: (args_0: GetAttachScoresParams) => Promise<{
118
+ scores: any;
119
+ id: string;
120
+ isAvailable: boolean;
121
+ title: string;
122
+ description: string;
123
+ scheduledTime?: string | null;
124
+ dueTime?: {
125
+ hours: number;
126
+ minutes: number;
127
+ nanos: number;
128
+ };
129
+ speakableio: boolean;
130
+ owners: string[];
131
+ image: {
132
+ path: string | null;
133
+ url: string;
134
+ };
135
+ dueDate: {
136
+ day: number;
137
+ month: number;
138
+ year: number;
139
+ };
140
+ teacherName: string;
141
+ courseWorkId: string | null;
142
+ dueDateTimestamp: {
143
+ seconds: number;
144
+ nanoseconds: number;
145
+ };
146
+ scheduledTimeTimestamp: number;
147
+ active: boolean;
148
+ voice: string | null;
149
+ setId: string;
150
+ dateMade: {
151
+ seconds: number;
152
+ nanoseconds: number;
153
+ };
154
+ maxPoints: number;
155
+ courseId: string;
156
+ isAssessment: boolean;
157
+ }[]>;
158
+ getAssignmentScores: (args_0: GetAssignmentScoresParams) => Promise<{
159
+ scores: unknown;
160
+ id: string;
161
+ } | undefined>;
162
+ getAllAssignments: () => Promise<AssignmentWithId[]>;
60
163
  };
61
164
 
62
165
  declare const assignmentQueryKeys: {
@@ -64,18 +167,150 @@ declare const assignmentQueryKeys: {
64
167
  byId: (id: string) => readonly ["assignments", string];
65
168
  list: () => readonly ["assignments", "list"];
66
169
  };
67
- declare function useAssignment(id: string): _tanstack_react_query.UseQueryResult<AssignmentWithId | null, Error>;
170
+ declare function useAssignment({ assignmentId, enabled, analyticType, userId, }: {
171
+ assignmentId: string;
172
+ enabled?: boolean;
173
+ analyticType?: AssignmentAnalyticsType;
174
+ userId: string;
175
+ }): _tanstack_react_query.UseQueryResult<AssignmentWithId | {
176
+ scores: any;
177
+ id: string;
178
+ isAvailable: boolean;
179
+ title: string;
180
+ description: string;
181
+ scheduledTime?: string | null;
182
+ dueTime?: {
183
+ hours: number;
184
+ minutes: number;
185
+ nanos: number;
186
+ };
187
+ speakableio: boolean;
188
+ owners: string[];
189
+ image: {
190
+ path: string | null;
191
+ url: string;
192
+ };
193
+ dueDate: {
194
+ day: number;
195
+ month: number;
196
+ year: number;
197
+ };
198
+ teacherName: string;
199
+ courseWorkId: string | null;
200
+ dueDateTimestamp: {
201
+ seconds: number;
202
+ nanoseconds: number;
203
+ };
204
+ scheduledTimeTimestamp: number;
205
+ active: boolean;
206
+ voice: string | null;
207
+ setId: string;
208
+ dateMade: {
209
+ seconds: number;
210
+ nanoseconds: number;
211
+ };
212
+ maxPoints: number;
213
+ courseId: string;
214
+ isAssessment: boolean;
215
+ } | null, Error>;
216
+
217
+ type FirebaseInstance = FirebaseFirestoreTypes.Module | Firestore;
68
218
 
69
219
  type FsClient = ReturnType<typeof createFsClient>;
70
220
  declare function createFsClient(db: FirebaseInstance, platform: 'web' | 'native'): Promise<{
71
221
  assignmentRepo: {
72
- get(id: string): Promise<AssignmentWithId | null>;
73
- list(): Promise<AssignmentWithId[]>;
222
+ getAssignment: (params: GetAssignmentScoresParams) => Promise<AssignmentWithId | {
223
+ scores: any;
224
+ id: string;
225
+ isAvailable: boolean;
226
+ title: string;
227
+ description: string;
228
+ scheduledTime?: string | null;
229
+ dueTime?: {
230
+ hours: number;
231
+ minutes: number;
232
+ nanos: number;
233
+ };
234
+ speakableio: boolean;
235
+ owners: string[];
236
+ image: {
237
+ path: string | null;
238
+ url: string;
239
+ };
240
+ dueDate: {
241
+ day: number;
242
+ month: number;
243
+ year: number;
244
+ };
245
+ teacherName: string;
246
+ courseWorkId: string | null;
247
+ dueDateTimestamp: {
248
+ seconds: number;
249
+ nanoseconds: number;
250
+ };
251
+ scheduledTimeTimestamp: number;
252
+ active: boolean;
253
+ voice: string | null;
254
+ setId: string;
255
+ dateMade: {
256
+ seconds: number;
257
+ nanoseconds: number;
258
+ };
259
+ maxPoints: number;
260
+ courseId: string;
261
+ isAssessment: boolean;
262
+ } | null>;
263
+ attachScoresAssignment: (args_0: GetAttachScoresParams) => Promise<{
264
+ scores: any;
265
+ id: string;
266
+ isAvailable: boolean;
267
+ title: string;
268
+ description: string;
269
+ scheduledTime?: string | null;
270
+ dueTime?: {
271
+ hours: number;
272
+ minutes: number;
273
+ nanos: number;
274
+ };
275
+ speakableio: boolean;
276
+ owners: string[];
277
+ image: {
278
+ path: string | null;
279
+ url: string;
280
+ };
281
+ dueDate: {
282
+ day: number;
283
+ month: number;
284
+ year: number;
285
+ };
286
+ teacherName: string;
287
+ courseWorkId: string | null;
288
+ dueDateTimestamp: {
289
+ seconds: number;
290
+ nanoseconds: number;
291
+ };
292
+ scheduledTimeTimestamp: number;
293
+ active: boolean;
294
+ voice: string | null;
295
+ setId: string;
296
+ dateMade: {
297
+ seconds: number;
298
+ nanoseconds: number;
299
+ };
300
+ maxPoints: number;
301
+ courseId: string;
302
+ isAssessment: boolean;
303
+ }[]>;
304
+ getAssignmentScores: (args_0: GetAssignmentScoresParams) => Promise<{
305
+ scores: unknown;
306
+ id: string;
307
+ } | undefined>;
308
+ getAllAssignments: () => Promise<AssignmentWithId[]>;
74
309
  };
75
310
  }>;
76
311
 
77
312
  interface FsContext {
78
- fs: Awaited<FsClient>;
313
+ speakableApi: Awaited<FsClient>;
79
314
  queryClient: QueryClient;
80
315
  }
81
316
  declare const FsCtx: React.Context<FsContext | null>;
@@ -85,6 +320,6 @@ declare function SpeakableProvider({ db, platform, children, queryClient, }: {
85
320
  children: React.ReactNode;
86
321
  queryClient: QueryClient;
87
322
  }): react_jsx_runtime.JSX.Element | null;
88
- declare function useFs(): FsContext;
323
+ declare function useSpeakableApi(): FsContext;
89
324
 
90
- export { type Assignment, type AssignmentAnalyticsType, type AssignmentWithId, type FsClient, FsCtx, SpeakableProvider, assignmentQueryKeys, createAssignmentRepo, createFsClient, useAssignment, useFs };
325
+ export { type Assignment, type AssignmentWithId, type FsClient, FsCtx, SpeakableProvider, assignmentQueryKeys, createAssignmentRepo, createFsClient, useAssignment, useSpeakableApi };