@datalayer/core 0.0.14 → 0.0.15

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.
@@ -0,0 +1,312 @@
1
+ import { IAnyOrganization, IAnySpace, IAssignment, ICell, IContact, ICourse, IDataset, IDatasource, IDocument, IEnvironment, IExercise, IIAMToken, IInbound, IInvite, IItemType, ILesson, ILinkedInUser, INotebook, IOrganization, IOutbound, IPage, ISchool, ISecret, ISpaceItem, IStudent, ITeam, IUsage, IUser, IUserOnboarding, IUserSettings, LinkedInUser, WaitingListFormData } from '../models';
2
+ import { IPrice } from './../components/checkout';
3
+ import { type IRESTBaseResponse } from '../models';
4
+ type CacheProps = {
5
+ loginRoute?: string;
6
+ };
7
+ type ISearchOpts = {
8
+ q: string;
9
+ types: string[];
10
+ max: number;
11
+ public: boolean;
12
+ };
13
+ /**
14
+ * Callbacks to Datalayer service.
15
+ *
16
+ * It assumes to be used within a {@link Router} component. If not
17
+ * you must set the options `loginRoute` to `null` (raise an error _Unauthorized_
18
+ * instead of redirecting to the login page).
19
+ *
20
+ * @deprecated use useCache instead.
21
+ */
22
+ export declare const useCache0: ({ loginRoute }?: CacheProps) => {
23
+ login: (handle: any, password: any) => Promise<any>;
24
+ logout: () => Promise<any>;
25
+ getMe: (token?: string) => Promise<IUser | null>;
26
+ updateMe: (email: any, firstName: any, lastName: any) => Promise<any>;
27
+ whoami: () => Promise<any>;
28
+ requestJoin: (handle: any, email: any, firstName: any, lastName: any, password: any, passwordConfirm: any) => Promise<any>;
29
+ requestJoinToken: (handle: any, email: any, firstName: any, lastName: any, password: any, passwordConfirm: any) => Promise<any>;
30
+ joinWithInvite: (formValues: any, token: any) => Promise<any>;
31
+ confirmJoinWithToken: (userHandle: any, token: any) => Promise<any>;
32
+ changePassword: (handle: any, password: any, passwordConfirm: any) => Promise<any>;
33
+ createTokenForPasswordChange: (handle: any, password: any, passwordConfirm: any) => Promise<any>;
34
+ confirmPassworkWithToken: (userHandle: any, token: any) => Promise<any>;
35
+ requestEmailUpdate: (email: any) => Promise<any>;
36
+ confirmEmailUpdate: (token: any) => Promise<any>;
37
+ getOAuth2AuthorizationURL: (queryArgs: Record<string, string>) => Promise<{
38
+ success: boolean;
39
+ autorization_url: string;
40
+ }>;
41
+ getOAuth2AuthorizationLinkURL: (queryArgs: Record<string, string>) => Promise<{
42
+ success: boolean;
43
+ autorization_url: string;
44
+ }>;
45
+ getGitHubProfile: (accessToken: string) => Promise<any>;
46
+ getLinkedinProfile: (accessToken: string) => Promise<LinkedInUser>;
47
+ postLinkedinShare: (linkedinUser: ILinkedInUser, postText: string, accessToken: string) => Promise<any>;
48
+ postLinkedinShareWithUpload: (linkedinUser: ILinkedInUser, postText: string, uploadObject: string, accessToken: string) => Promise<any>;
49
+ registerToWaitingList: (formData: WaitingListFormData) => void;
50
+ proxyGET: (url: string, token: string) => Promise<any>;
51
+ proxyPOST: (url: string, body: object, token: string) => Promise<any>;
52
+ proxyPUT: (url: string, body: object, token: string) => Promise<any>;
53
+ getUser: (id: string) => IUser | undefined;
54
+ getUserByHandle: (handle: string) => IUser | undefined;
55
+ searchUsers: (namingPattern: string) => Promise<any>;
56
+ refreshUser: (userId: string) => Promise<any>;
57
+ assignRoleToUser: (userId: any, roleName: any) => Promise<any>;
58
+ unassignRoleFromUser: (userId: any, roleName: any) => Promise<any>;
59
+ updateUserOnboarding: (onboarding: IUserOnboarding) => Promise<any>;
60
+ updateUserSettings: (userId: string, settings: IUserSettings) => Promise<any>;
61
+ getUserCredits: (userId: any) => Promise<any>;
62
+ updateUserCredits: (userId: any, credits: any, brand: any) => Promise<any>;
63
+ updateUserCreditsQuota: (userId: string, quota?: number) => Promise<any>;
64
+ getUserSurveys: (userId: string) => Promise<any>;
65
+ getUsages: () => Promise<{
66
+ success: boolean;
67
+ message: string;
68
+ usages?: IUsage[];
69
+ }>;
70
+ getUsagesForUser: (userId: string) => Promise<{
71
+ success: boolean;
72
+ message: string;
73
+ usages?: IUsage[];
74
+ }>;
75
+ createOrganization: (organization: Partial<IOrganization>) => Promise<any>;
76
+ getOrganizationById: (organizationId: string) => IOrganization | undefined;
77
+ getOrganizationByHandle: (organizationHandle: string) => IOrganization | undefined;
78
+ getUserOrganizations: () => IAnyOrganization[];
79
+ getUserOrganizationById: (organizationId: string) => IAnyOrganization | undefined;
80
+ updateOrganization: (organization: Partial<IAnyOrganization>) => Promise<any>;
81
+ refreshOrganization: (user: IUser, organizationId: string) => Promise<any>;
82
+ refreshUserOrganizations: (user: IUser) => Promise<any>;
83
+ addMemberToOrganization: (organizationId: string, userId: string) => Promise<any>;
84
+ removeMemberFromOrganization: (organizationId: string, userId: string) => Promise<any>;
85
+ addRoleToOrganizationMember: (organizationId: string, userId: string, roleName: string) => Promise<any>;
86
+ removeRoleFromOrganizationMember: (organizationId: string, userId: string, roleName: string) => Promise<any>;
87
+ clearCachedOrganizations: () => void;
88
+ createTeam: (team: Partial<ITeam>, organization: IAnyOrganization) => Promise<any>;
89
+ getTeamById: (teamId: string) => ITeam | undefined;
90
+ getTeamByHandle: (teamHandle: string) => ITeam | undefined;
91
+ getTeamsByOrganizationId: (organizationId: string) => ITeam[] | undefined;
92
+ updateTeam: (team: Partial<ITeam>) => Promise<any>;
93
+ refreshTeam: (teamId: string, organizationId: string) => Promise<any>;
94
+ refreshTeams: (organizationId: string) => Promise<any>;
95
+ addMemberToTeam: (teamId: string, userId: string) => Promise<any>;
96
+ removeMemberFromTeam: (teamId: string, userId: string) => Promise<any>;
97
+ addRoleToTeamMember: (teamId: string, userId: string, roleName: string) => Promise<any>;
98
+ removeRoleFromTeamMember: (teamId: string, userId: string, roleName: string) => Promise<any>;
99
+ clearCachedTeams: () => void;
100
+ getSchools: () => ISchool[];
101
+ refreshSchools: () => Promise<any>;
102
+ createSpace: (space: Partial<IAnySpace>, organization?: IAnyOrganization) => Promise<any>;
103
+ getOrganizationSpace: (organizationId: string, spaceId: string) => IAnySpace | undefined;
104
+ getOrganizationSpaceByHandle: (organizationHandle: string, spaceHandle: string) => IAnySpace | undefined;
105
+ getOrganizationSpaces: (organizationId: string) => IAnySpace[];
106
+ getUserSpace: (userId: string) => IAnySpace | undefined;
107
+ getUserSpaceByHandle: (userHandle: string) => IAnySpace | undefined;
108
+ getUserSpaces: () => IAnySpace[];
109
+ updateSpace: (space: Partial<IAnySpace>) => Promise<any>;
110
+ updateOrganizationSpace: (organization: IAnyOrganization, space: Partial<IAnySpace>) => Promise<any>;
111
+ refreshOrganizationSpace: (organizationId: string, spaceId: string) => Promise<any>;
112
+ refreshOrganizationSpaces: (organizationId: string) => Promise<any>;
113
+ refreshUserSpace: (userId: string, spaceId: string) => Promise<any>;
114
+ refreshUserSpaces: () => Promise<any>;
115
+ refreshLayout: (accountHandle: string, spaceHandle?: string, user?: IUser) => Promise<any>;
116
+ exportSpace: (spaceId: string) => Promise<any>;
117
+ addMemberToOrganizationSpace: (organizationId: string, spaceId: string, accountId: string) => Promise<any>;
118
+ removeMemberFromOrganizationSpace: (organizationId: string, spaceId: string, accountId: string) => Promise<any>;
119
+ makeSpacePublic: (spaceId: string) => Promise<any>;
120
+ makeSpacePrivate: (spaceId: string) => Promise<any>;
121
+ getCourse: (courseId: string) => ICourse | undefined;
122
+ updateCourse: (courseId: any, name: any, description: any) => Promise<any>;
123
+ refreshCourse: (courseId: string) => Promise<any>;
124
+ getPublicCourses: () => ICourse[];
125
+ refreshPublicCourses: () => Promise<any>;
126
+ getInstructorCourses: () => ICourse[];
127
+ refreshInstructorCourses: () => Promise<any>;
128
+ getCoursesEnrollments: () => ICourse[];
129
+ refreshCoursesEnrollments: () => Promise<any>;
130
+ enrollStudentToCourse: (courseId: string, studentId: string) => Promise<any>;
131
+ removeStudentFromCourse: (courseId: string, studentId: string) => Promise<any>;
132
+ getStudent: (courseId: any, studentId: any) => IStudent | undefined;
133
+ refreshStudent: (courseId: any, studentHandle: any) => Promise<any>;
134
+ confirmCourseItemCompletion: (courseId: any, itemType: IItemType, itemId: string, completed: boolean) => Promise<any>;
135
+ setCourseItems: (courseId: any, itemIds: any) => Promise<any>;
136
+ createNotebook: (spaceId: string, name: string, description?: string, notebookType?: string) => Promise<any>;
137
+ getNotebook: (notebookId: any) => INotebook | undefined;
138
+ getSpaceNotebook: (id: any) => INotebook | undefined;
139
+ getSpaceNotebooks: () => INotebook[];
140
+ updateNotebook: (id: any, name: any, description: any) => Promise<any>;
141
+ updateNotebookModel: (notebookId: any, nbformat: any) => Promise<any>;
142
+ cloneNotebook: (notebookId: string) => Promise<any>;
143
+ refreshNotebook: (notebookId: string) => Promise<any>;
144
+ refreshSpaceNotebooks: (space: IAnySpace, organization?: IAnyOrganization) => Promise<any>;
145
+ getDocument: (id: any) => IDocument | undefined;
146
+ getSpaceDocument: (id: any) => IDocument | undefined;
147
+ getSpaceDocuments: () => IDocument[];
148
+ updateDocument: (id: any, name: any, description: any) => Promise<any>;
149
+ updateDocumentModel: (id: any, model: any) => Promise<any>;
150
+ cloneDocument: (documentId: string) => Promise<any>;
151
+ refreshDocument: (id: string) => Promise<any>;
152
+ refreshSpaceDocuments: (space: IAnySpace, organization?: IAnyOrganization) => Promise<any>;
153
+ getCell: (id: string) => ICell | undefined;
154
+ getSpaceCells: () => ICell[];
155
+ updateCell: (cell: {
156
+ id: string;
157
+ name: string;
158
+ description: string;
159
+ source: string;
160
+ outputshotUrl?: string;
161
+ outputshotData?: string;
162
+ spaceId: string;
163
+ }) => Promise<any>;
164
+ cloneCell: (cellId: string) => Promise<any>;
165
+ refreshCell: (id: string) => Promise<any>;
166
+ refreshSpaceCells: (space: IAnySpace, organization?: IAnyOrganization) => Promise<any>;
167
+ getDataset: (id: any) => IDataset | undefined;
168
+ getSpaceDatasets: () => IDataset[];
169
+ updateDataset: (id: any, name: any, description: any) => Promise<any>;
170
+ refreshDataset: (id: string) => Promise<any>;
171
+ refreshSpaceDatasets: (space: IAnySpace, organization?: IAnyOrganization) => Promise<any>;
172
+ getEnvironment: (id: string) => IEnvironment | undefined;
173
+ getSpaceEnvironments: () => IEnvironment[];
174
+ refreshEnvironment: (id: string) => Promise<any>;
175
+ refreshSpaceEnvironments: (space: IAnySpace, organization?: IAnyOrganization) => Promise<any>;
176
+ getLesson: (id: any) => ILesson | undefined;
177
+ getSpaceLesson: (id: any) => ILesson | undefined;
178
+ getSpaceLessons: () => ILesson[];
179
+ cloneLesson: (lessonId: string) => Promise<any>;
180
+ refreshLesson: (id: string) => Promise<any>;
181
+ refreshSpaceLessons: (space: IAnySpace, organization?: IAnyOrganization) => Promise<any>;
182
+ getExercise: (id: string) => IExercise | undefined;
183
+ getSpaceExercises: () => IExercise[];
184
+ updateExercise: ({ id, name, description, help, codePre, codeSolution, codeQuestion, codeTest, }: {
185
+ id: any;
186
+ name: any;
187
+ description: any;
188
+ help: any;
189
+ codePre: any;
190
+ codeSolution: any;
191
+ codeQuestion: any;
192
+ codeTest: any;
193
+ }) => Promise<any>;
194
+ updateExercisePoints: (id: any, codeStudent: any, points: any) => Promise<any>;
195
+ cloneExercise: (exerciseId: string) => Promise<any>;
196
+ refreshExercise: (id: string) => Promise<any>;
197
+ refreshSpaceExercises: (space: IAnySpace, organization?: IAnyOrganization) => Promise<any>;
198
+ getAssignment: (assignmentId: any) => IAssignment | undefined;
199
+ getAssignmentForStudent: (assignmentId: string) => IAssignment | undefined;
200
+ getAssignmentStudentVersion: (assignmentId: any) => Promise<any>;
201
+ getSpaceAssignment: (id: any) => IAssignment | undefined;
202
+ getSpaceAssignments: () => IAssignment[];
203
+ cloneAssignment: (assignmentId: string) => Promise<any>;
204
+ refreshAssignment: (assignmentId: string) => Promise<any>;
205
+ refreshAssignmentForStudent: (courseId: string, user: IUser, assignmentId: string) => Promise<any>;
206
+ refreshSpaceAssignments: (space: IAnySpace, organization?: IAnyOrganization) => Promise<any>;
207
+ gradeAssignmentForStudent: (courseId: string, user: IUser, assignmentId: string, model: any) => Promise<any>;
208
+ resetAssignmentForStudent: (courseId: string, user: IUser, assignmentId: string) => Promise<any>;
209
+ getPublicItems: () => ISpaceItem[];
210
+ getSpaceItems: () => ISpaceItem[];
211
+ searchPublicItems: (opts?: ISearchOpts) => Promise<any>;
212
+ makeItemPublic: (id: string) => Promise<any>;
213
+ makeItemPrivate: (id: string) => Promise<any>;
214
+ deleteItem: (itemId: string) => Promise<any>;
215
+ refreshPublicItems: () => Promise<any>;
216
+ refreshSpaceItems: (spaceId: string) => Promise<any>;
217
+ clearCachedPublicItems: () => void;
218
+ clearCachedItems: () => void;
219
+ createPage: (page: Omit<IPage, "id">) => Promise<any>;
220
+ getPage: (pageId: string) => IPage | undefined;
221
+ getPages: () => IPage[];
222
+ updatePage: (page: Pick<IPage, "id" | "name" | "description" | "tags">) => Promise<any>;
223
+ deletePage: (page: IPage) => Promise<any>;
224
+ refreshPage: (pageId: string) => Promise<any>;
225
+ refreshPages: () => Promise<any>;
226
+ clearCachedPages: () => void;
227
+ createDatasource: (datasource: Omit<IDatasource, "id">) => Promise<any>;
228
+ getDatasource: (datasourceId: string) => IDatasource | undefined;
229
+ getDatasources: () => IDatasource[];
230
+ updateDatasource: (datasource: IDatasource) => Promise<any>;
231
+ refreshDatasource: (datasourceId: string) => Promise<any>;
232
+ refreshDatasources: () => Promise<any>;
233
+ clearCachedDatasources: () => void;
234
+ createSecret: (secret: Omit<ISecret, "id">) => Promise<any>;
235
+ getSecret: (secretId: string) => ISecret | undefined;
236
+ getSecrets: () => ISecret[];
237
+ updateSecret: (secret: ISecret) => Promise<any>;
238
+ deleteSecret: (secret: ISecret) => Promise<any>;
239
+ refreshSecret: (secretId: string) => Promise<any>;
240
+ refreshSecrets: () => Promise<any>;
241
+ clearCachedSecrets: () => void;
242
+ createToken: (token: Omit<IIAMToken, "id" | "value">) => Promise<any>;
243
+ getToken: (tokenId: string) => IIAMToken | undefined;
244
+ getTokens: () => IIAMToken[];
245
+ updateToken: (token: IIAMToken) => Promise<any>;
246
+ refreshToken: (tokenId: string) => Promise<any>;
247
+ refreshTokens: () => Promise<any>;
248
+ clearCachedTokens: () => void;
249
+ requestInvite: (firstName: string, lastName: string, email: string, socialUrl: string) => Promise<any>;
250
+ sendInvite: (invite: IInvite) => Promise<any>;
251
+ getInvite: (token: string) => IInvite | undefined;
252
+ getInvites: () => IInvite[];
253
+ putInvite: (token: string) => Promise<any>;
254
+ refreshInvite: (token: string) => Promise<any>;
255
+ refreshInvites: (accountId: string) => Promise<any>;
256
+ refreshAccount: (accountHandle: string) => Promise<any>;
257
+ clearCachedInvites: () => void;
258
+ createContact: (contact: IContact) => Promise<any>;
259
+ getContactById: (contactId: string) => IContact | undefined;
260
+ getContactByHandle: (contactHandle: string) => IContact | undefined;
261
+ updateContact: (contactId: any, contact: IContact) => Promise<any>;
262
+ deleteContact: (contactId: string) => Promise<any>;
263
+ searchContacts: (query: string) => Promise<any>;
264
+ refreshContact: (contactId: string) => Promise<any>;
265
+ assignTagToContact: (contactId: any, tagName: any) => Promise<any>;
266
+ unassignTagFromContact: (contactId: any, tagName: any) => Promise<any>;
267
+ sendInviteToContact: (contact: IContact, message: string) => Promise<any>;
268
+ enrichContactEmail: (contactId: any, useDomain: any) => Promise<any>;
269
+ enrichContactLinkedin: (contactId: any) => Promise<any>;
270
+ sendLinkedinConnectionRequest: (contact: IContact, message: string) => Promise<any>;
271
+ linkUserWithContact: (userId: any, contactId: any) => Promise<any>;
272
+ unlinkUserFromContact: (userId: any, contactId: any) => Promise<any>;
273
+ getInbound: (id: string) => IInbound | undefined;
274
+ getInboundByHandle: (handle: string) => IInbound | undefined;
275
+ getInbounds: () => Promise<any>;
276
+ refreshInbound: (userId: string) => Promise<any>;
277
+ toInbound: (u: any) => IInbound | undefined;
278
+ getOutbound: (id: string) => IOutbound | undefined;
279
+ getOutbounds: () => Promise<any>;
280
+ refreshOutbound: (outboundId: string) => Promise<any>;
281
+ draftBulkEmailsOutbounds: (params: any) => Promise<any>;
282
+ tryBulkEmailsOutbounds: (outboundId: string) => Promise<any>;
283
+ launchBulkEmailsOutbounds: (outboundId: string) => Promise<any>;
284
+ sendOutboundEmailToUser: (userId: string, recipient: string, subject: string, content: string) => Promise<any>;
285
+ deleteOutbound: (outboundId: string) => Promise<any>;
286
+ subscribeUserToOutbounds: (userId: string) => Promise<any>;
287
+ unsubscribeUserFromOutbounds: (userId: string) => Promise<any>;
288
+ unsubscribeContactFromOutbounds: (contactId: string) => Promise<any>;
289
+ unsubscribeInviteeFromOutbounds: (token: string) => Promise<any>;
290
+ toOutbound: (u: any) => IOutbound | undefined;
291
+ enableUserMFA: () => Promise<any>;
292
+ disableUserMFA: () => Promise<any>;
293
+ validateUserMFACode: (userUid: any, code: string) => Promise<any>;
294
+ createCheckoutSession: (product: any, location: any) => Promise<any>;
295
+ burnCredit: (credits: any) => Promise<any>;
296
+ refreshStripePrices: () => Promise<IRESTBaseResponse & {
297
+ prices: IPrice[];
298
+ }>;
299
+ requestPlatformSupport: (subject: any, message: any, email: any, brand: any) => Promise<any>;
300
+ requestPlatformSupport2: (accountHandle: any, firstName: any, lastName: any, email: any, message: any) => Promise<any>;
301
+ getGrowthKPI: () => Promise<any>;
302
+ getPlatformUsages: () => Promise<{
303
+ success: boolean;
304
+ message: string;
305
+ usages?: IUsage[];
306
+ }>;
307
+ clearAllCaches: () => void;
308
+ notebookUploadLoading: boolean;
309
+ notebookUploadProgress: number;
310
+ resetNotebookUpload: () => void;
311
+ };
312
+ export default useCache0;