skapi-js 1.2.14-beta.3 → 1.2.14-beta.6

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.
Files changed (92) hide show
  1. package/dist/bundle-report-commonjs.html +2 -2
  2. package/dist/bundle-report-esm.html +2 -2
  3. package/dist/bundle-report-node-esm.html +2 -2
  4. package/dist/bundle-report.html +2 -2
  5. package/dist/skapi.cjs +1 -1
  6. package/dist/skapi.cjs.map +1 -1
  7. package/dist/skapi.js +1 -1
  8. package/dist/skapi.js.map +1 -1
  9. package/dist/skapi.mjs +1 -1
  10. package/dist/skapi.mjs.map +1 -1
  11. package/dist/skapi.node.mjs +1 -1
  12. package/dist/skapi.node.mjs.map +1 -1
  13. package/js/package.json +6 -5
  14. package/js/src/Types.d.ts +40 -2
  15. package/js/src/main/skapi.d.ts +41 -29
  16. package/js/src/main/skapi.js +48 -60
  17. package/js/src/main/skapi.js.map +1 -1
  18. package/js/src/methods/admin.d.ts +2 -4
  19. package/js/src/methods/database.d.ts +8 -0
  20. package/js/src/methods/database.js +285 -8
  21. package/js/src/methods/database.js.map +1 -1
  22. package/js/src/methods/param_restrictions.d.ts +8 -4
  23. package/js/src/methods/param_restrictions.js +72 -6
  24. package/js/src/methods/param_restrictions.js.map +1 -1
  25. package/js/src/methods/request.js +1 -1
  26. package/js/src/methods/request.js.map +1 -1
  27. package/js/src/methods/subscription.d.ts +0 -6
  28. package/js/src/methods/subscription.js +0 -28
  29. package/js/src/methods/subscription.js.map +1 -1
  30. package/js/src/methods/vivian.d.ts +18 -3
  31. package/js/src/methods/vivian.js +20 -10
  32. package/js/src/methods/vivian.js.map +1 -1
  33. package/js/src/utils/network.js +16 -11
  34. package/js/src/utils/network.js.map +1 -1
  35. package/js/src/utils/utils.d.ts +3 -1
  36. package/js/src/utils/utils.js +15 -3
  37. package/js/src/utils/utils.js.map +1 -1
  38. package/package.json +6 -5
  39. package/js/Main.d.ts +0 -6
  40. package/js/Main.js +0 -6
  41. package/js/Main.js.map +0 -1
  42. package/js/Types.d.ts +0 -305
  43. package/js/Types.js +0 -2
  44. package/js/Types.js.map +0 -1
  45. package/js/main/error.d.ts +0 -9
  46. package/js/main/error.js +0 -46
  47. package/js/main/error.js.map +0 -1
  48. package/js/main/skapi.d.ts +0 -443
  49. package/js/main/skapi.js +0 -853
  50. package/js/main/skapi.js.map +0 -1
  51. package/js/methods/admin.d.ts +0 -61
  52. package/js/methods/admin.js +0 -325
  53. package/js/methods/admin.js.map +0 -1
  54. package/js/methods/database.d.ts +0 -65
  55. package/js/methods/database.js +0 -947
  56. package/js/methods/database.js.map +0 -1
  57. package/js/methods/notification.d.ts +0 -21
  58. package/js/methods/notification.js +0 -81
  59. package/js/methods/notification.js.map +0 -1
  60. package/js/methods/param_restrictions.d.ts +0 -21
  61. package/js/methods/param_restrictions.js +0 -144
  62. package/js/methods/param_restrictions.js.map +0 -1
  63. package/js/methods/realtime.d.ts +0 -35
  64. package/js/methods/realtime.js +0 -408
  65. package/js/methods/realtime.js.map +0 -1
  66. package/js/methods/request.d.ts +0 -43
  67. package/js/methods/request.js +0 -132
  68. package/js/methods/request.js.map +0 -1
  69. package/js/methods/subscription.d.ts +0 -53
  70. package/js/methods/subscription.js +0 -337
  71. package/js/methods/subscription.js.map +0 -1
  72. package/js/methods/user.d.ts +0 -176
  73. package/js/methods/user.js +0 -1120
  74. package/js/methods/user.js.map +0 -1
  75. package/js/methods/vivian.d.ts +0 -3
  76. package/js/methods/vivian.js +0 -36
  77. package/js/methods/vivian.js.map +0 -1
  78. package/js/methods/webrtc.d.ts +0 -26
  79. package/js/methods/webrtc.js +0 -608
  80. package/js/methods/webrtc.js.map +0 -1
  81. package/js/polyfills/global.d.ts +0 -3
  82. package/js/polyfills/global.js +0 -235
  83. package/js/polyfills/global.js.map +0 -1
  84. package/js/utils/network.d.ts +0 -24
  85. package/js/utils/network.js +0 -707
  86. package/js/utils/network.js.map +0 -1
  87. package/js/utils/utils.d.ts +0 -40
  88. package/js/utils/utils.js +0 -651
  89. package/js/utils/utils.js.map +0 -1
  90. package/js/utils/validator.d.ts +0 -24
  91. package/js/utils/validator.js +0 -293
  92. package/js/utils/validator.js.map +0 -1
@@ -1,443 +0,0 @@
1
- import { DatabaseResponse, Connection, ProgressCallback, GetRecordQuery, FetchOptions, RecordData, Condition, UserAttributes, UserProfile, Newsletter, Form, PostRecordConfig, UserPublic, UserProfilePublicSettings, FileInfo, RTCEvent, RealtimeCallback, RTCConnectorParams, RTCConnector, DelRecordQuery, ConnectionInfo, Table, Index, Tag, UniqueId, Subscription } from '../Types';
2
- import { terminatePendingRequests } from '../utils/network';
3
- import { extractFormData, fromBase62, generateRandom, toBase62, MD5, decodeServiceId, formatServiceId } from '../utils/utils';
4
- type Options = {
5
- autoLogin: boolean;
6
- requestBatchSize?: number;
7
- eventListener?: {
8
- onLogin?: (user: UserProfile | null) => void;
9
- onUserUpdate?: (user: UserProfile | null) => void;
10
- onBatchProcess?: (process: {
11
- batchToProcess: number;
12
- itemsToProcess: number;
13
- completed: any[];
14
- }) => void;
15
- };
16
- };
17
- export default class Skapi {
18
- private __version;
19
- service: string;
20
- owner: string;
21
- session: Record<string, any> | null;
22
- connection: Connection | null;
23
- private __my_unique_ids;
24
- private userPool;
25
- private __socket;
26
- private __mediaStream;
27
- private host;
28
- private hostDomain;
29
- private target_cdn;
30
- private customApiDomain;
31
- private requestBatchSize;
32
- private __disabledAccount;
33
- private __cached_requests;
34
- private __startKeyHistory;
35
- private __request_signup_confirmation;
36
- private __private_access_key;
37
- private __class_properties_has_been_cached;
38
- private __user;
39
- get user(): UserProfile | null;
40
- set user(value: UserProfile | null);
41
- private _userProfileListeners;
42
- private _onLoginListeners;
43
- get onLogin(): Function[];
44
- set onLogin(listener: (user: UserProfile | null) => void);
45
- get onUserUpdate(): Function[];
46
- set onUserUpdate(listener: (user: UserProfile | null) => void);
47
- private _runOnUserUpdateListeners;
48
- private _runOnLoginListeners;
49
- private admin_endpoint;
50
- private record_endpoint;
51
- private _onBatchProcessListeners;
52
- get onBatchProcess(): ((process: {
53
- batchToProcess: number;
54
- itemsToProcess: number;
55
- completed: any[];
56
- }) => void)[];
57
- set onBatchProcess(listener: (process: {
58
- batchToProcess: number;
59
- itemsToProcess: number;
60
- completed: any[];
61
- }) => void);
62
- validate: {
63
- userId(val: string): boolean;
64
- url(val: string | string[]): boolean;
65
- phoneNumber(val: string): boolean;
66
- birthdate(val: string): boolean;
67
- email(val: string): boolean;
68
- params(val: any, schema: Record<string, any>, required?: string[]): any;
69
- };
70
- util: {
71
- MD5: typeof MD5;
72
- generateRandom: typeof generateRandom;
73
- toBase62: typeof toBase62;
74
- fromBase62: typeof fromBase62;
75
- decodeServiceId: typeof decodeServiceId;
76
- formatServiceId: typeof formatServiceId;
77
- extractFormData: typeof extractFormData;
78
- terminatePendingRequests: typeof terminatePendingRequests;
79
- request: (url: string, data?: Form<any>, options?: {
80
- fetchOptions?: FetchOptions;
81
- auth?: boolean;
82
- method?: string;
83
- bypassAwaitConnection?: boolean;
84
- responseType?: "json" | "blob" | "text" | "arrayBuffer" | "formData" | "document";
85
- contentType?: string;
86
- }) => Promise<any>;
87
- };
88
- private __connection;
89
- private __authConnection;
90
- private __network_logs;
91
- private __endpoint_version;
92
- private __public_identifier;
93
- private bearerToken;
94
- private _alert;
95
- constructor(service: string, owner?: string | Options, options?: Options | any, __etc?: any);
96
- getConnectionInfo(): Promise<ConnectionInfo>;
97
- private _updateConnection;
98
- private registerTicket;
99
- private unregisterTicket;
100
- version(): Promise<string>;
101
- private log;
102
- getFeed(params?: {
103
- access_group?: number;
104
- }, fetchOptions?: FetchOptions): Promise<DatabaseResponse<RecordData>>;
105
- closeRTC(params: {
106
- cid?: string;
107
- close_all?: boolean;
108
- }): Promise<void>;
109
- connectRTC(params: RTCConnectorParams, callback?: RTCEvent): Promise<RTCConnector>;
110
- connectRealtime(callback: RealtimeCallback): Promise<WebSocket>;
111
- spellcast(params: any): Promise<any>;
112
- getspell(params: any): Promise<any>;
113
- dopamine(params: any): Promise<void>;
114
- getUniqueId(params: Form<{
115
- unique_id?: string;
116
- condition?: Condition;
117
- }>, fetchOptions?: FetchOptions): Promise<DatabaseResponse<UniqueId>>;
118
- resendInvitation(params: Form<{
119
- email: string;
120
- confirmation_url?: string;
121
- }>): Promise<"SUCCESS: Invitation has been re-sent. (User ID: xxx...)">;
122
- cancelInvitation(params: Form<{
123
- email: string;
124
- }>): Promise<"SUCCESS: Invitation has been canceled.">;
125
- getInvitations(params: Form<{
126
- email?: string;
127
- }>, fetchOptions: FetchOptions): Promise<DatabaseResponse<UserProfile>>;
128
- openIdLogin(params: {
129
- token: string;
130
- id: string;
131
- merge?: boolean | string[];
132
- }): Promise<{
133
- userProfile: UserProfile;
134
- openid: {
135
- [attribute: string]: string;
136
- };
137
- }>;
138
- loginWithToken(params: {
139
- idToken: string;
140
- accessToken?: string;
141
- refreshToken?: string;
142
- }): Promise<UserProfile>;
143
- registerNewsletterGroup(params: Form<{
144
- group: string;
145
- restriction: number;
146
- }>): Promise<"SUCCESS: Your newsletter group has been registered.">;
147
- clientSecretRequest(params: {
148
- url: string;
149
- clientSecretName: string;
150
- method: 'GET' | 'POST' | 'DELETE' | 'PUT';
151
- headers?: {
152
- [key: string]: string;
153
- };
154
- data?: {
155
- [key: string]: any;
156
- };
157
- params?: {
158
- [key: string]: string;
159
- };
160
- }): Promise<any>;
161
- consumeTicket(params: {
162
- ticket_id: string;
163
- method: string;
164
- auth?: boolean;
165
- data?: {
166
- [key: string]: any;
167
- };
168
- }): Promise<any>;
169
- getConsumedTickets(params: {
170
- ticket_id?: string;
171
- }, fetchOptions: FetchOptions): Promise<DatabaseResponse<any[]>>;
172
- getTickets(params: {
173
- ticket_id?: string;
174
- }, fetchOptions: FetchOptions): Promise<DatabaseResponse<any[]>>;
175
- closeRealtime(): Promise<void>;
176
- getRealtimeUsers(params: {
177
- group: string;
178
- user_id?: string;
179
- }, fetchOptions?: FetchOptions): Promise<DatabaseResponse<{
180
- user_id: string;
181
- cid: string;
182
- }[]>>;
183
- sendInquiry(data: Form<{
184
- name: string;
185
- email: string;
186
- subject: string;
187
- message: string;
188
- }>): Promise<"SUCCESS: Inquiry has been sent.">;
189
- blockAccount(form: {
190
- user_id: string;
191
- }): Promise<"SUCCESS: The user has been blocked.">;
192
- unblockAccount(form: {
193
- user_id: string;
194
- }): Promise<"SUCCESS: The user has been unblocked.">;
195
- deleteAccount(form: {
196
- user_id: string;
197
- }): Promise<"SUCCESS: Account has been deleted.">;
198
- inviteUser(form: {
199
- email: string;
200
- } & UserAttributes & UserProfilePublicSettings, options?: {
201
- confirmation_url?: string;
202
- email_subscription?: boolean;
203
- template?: {
204
- url: string;
205
- subject: string;
206
- };
207
- }): Promise<'SUCCESS: Invitation has been sent.'>;
208
- createAccount(form: {
209
- email: string;
210
- password: string;
211
- } & UserAttributes & UserProfilePublicSettings): Promise<UserProfile & UserPublic & {
212
- email_admin: string;
213
- approved: string;
214
- log: number;
215
- username: string;
216
- }>;
217
- grantAccess(params: {
218
- user_id: string;
219
- access_group: number;
220
- }): Promise<'SUCCESS: Access has been granted to the user.'>;
221
- getRealtimeGroups(params?: {
222
- searchFor: 'group' | 'number_of_users';
223
- value: string | number;
224
- condition?: '>' | '>=' | '=' | '<' | '<=' | '!=' | 'gt' | 'gte' | 'eq' | 'lt' | 'lte' | 'ne';
225
- range?: string | number;
226
- } | null, fetchOptions?: FetchOptions): Promise<DatabaseResponse<{
227
- group: string;
228
- number_of_users: number;
229
- }>>;
230
- newsletterGroupEndpoint(params: any): Promise<any>;
231
- postRealtime(message: any, recipient: string, notification?: {
232
- config?: {
233
- always: boolean;
234
- };
235
- title: string;
236
- body: string;
237
- }): Promise<{
238
- type: 'success';
239
- message: 'Message sent.';
240
- }>;
241
- joinRealtime(params: {
242
- group: string | null;
243
- }): Promise<{
244
- type: 'success';
245
- message: string;
246
- }>;
247
- getConnection(): Promise<Connection>;
248
- getProfile(options?: {
249
- refreshToken: boolean;
250
- }): Promise<UserProfile | null>;
251
- getFile(url: string, config?: {
252
- dataType?: 'base64' | 'download' | 'endpoint' | 'blob' | 'text' | 'info';
253
- expires?: number;
254
- progress?: ProgressCallback;
255
- }): Promise<Blob | string | void | FileInfo>;
256
- secureRequest<Params = {
257
- url: string;
258
- data?: any;
259
- sync?: boolean;
260
- }, Response = {
261
- response: any;
262
- statusCode: number;
263
- url: string;
264
- }>(params: Params[] | Form<Params>, url?: string): Promise<Response | Response[]>;
265
- getFormResponse(): Promise<any>;
266
- getRecords(query: GetRecordQuery, fetchOptions?: FetchOptions): Promise<DatabaseResponse<RecordData>>;
267
- getTables(query: {
268
- table: string;
269
- condition?: Condition;
270
- }, fetchOptions?: FetchOptions): Promise<DatabaseResponse<Table>>;
271
- getIndexes(query: {
272
- table: string;
273
- index?: string;
274
- order?: {
275
- by: 'average_number' | 'total_number' | 'number_count' | 'average_bool' | 'total_bool' | 'bool_count' | 'string_count' | 'index_name';
276
- value?: number | boolean | string;
277
- condition?: Condition;
278
- };
279
- }, fetchOptions?: FetchOptions): Promise<DatabaseResponse<Index>>;
280
- getTags(query: {
281
- table: string;
282
- tag?: string;
283
- condition?: Condition;
284
- }, fetchOptions?: FetchOptions): Promise<DatabaseResponse<Tag>>;
285
- deleteRecords(params: DelRecordQuery, fetchOptions?: FetchOptions): Promise<string | DatabaseResponse<RecordData>>;
286
- resendSignupConfirmation(): Promise<'SUCCESS: Signup confirmation e-mail has been sent.'>;
287
- recoverAccount(redirect?: boolean | string): Promise<"SUCCESS: Recovery e-mail has been sent.">;
288
- getUsers(params?: {
289
- searchFor: 'user_id' | 'email' | 'phone_number' | 'locale' | 'name' | 'address' | 'gender' | 'birthdate' | 'subscribers' | 'timestamp' | 'approved';
290
- value: string | number | boolean | string[];
291
- condition?: '>' | '>=' | '=' | '<' | '<=' | 'gt' | 'gte' | 'eq' | 'lt' | 'lte';
292
- range?: string | number | boolean;
293
- }, fetchOptions?: FetchOptions): Promise<DatabaseResponse<UserPublic>>;
294
- disableAccount(): Promise<'SUCCESS: account has been disabled.'>;
295
- lastVerifiedEmail(params?: {
296
- revert: boolean;
297
- }): Promise<string | UserProfile>;
298
- unsubscribeNewsletter(params: {
299
- group: number | 'public' | 'authorized' | null;
300
- }): Promise<string>;
301
- adminNewsletterRequest(params: any): Promise<any>;
302
- subscribeNotification(endpoint: string, keys: {
303
- p256dh: string;
304
- auth: string;
305
- }): Promise<'SUCCESS: Subscribed to receive notifications.'>;
306
- unsubscribeNotification(endpoint: string, keys: {
307
- p256dh: string;
308
- auth: string;
309
- }): Promise<'SUCCESS: Unsubscribed from notifications.'>;
310
- vapidPublicKey(): Promise<{
311
- VAPIDPublicKey: string;
312
- }>;
313
- pushNotification(form: {
314
- title: string;
315
- body: string;
316
- }, user_ids?: string | string[]): Promise<"SUCCESS: Notification sent.">;
317
- getNewsletters(params?: {
318
- searchFor: 'message_id' | 'timestamp' | 'read' | 'complaint' | 'subject';
319
- value: string | number;
320
- range: string | number;
321
- condition?: '>' | '>=' | '=' | '<' | '<=' | 'gt' | 'gte' | 'eq' | 'lt' | 'lte';
322
- group: 'public' | 'authorized' | number;
323
- }, fetchOptions?: FetchOptions): Promise<DatabaseResponse<Newsletter>>;
324
- getNewsletterSubscription(params: {
325
- group?: number | 'public' | 'authorized';
326
- }, fetchOptions?: FetchOptions): Promise<{
327
- active: boolean;
328
- timestamp: number;
329
- group: number;
330
- subscribed_email: string;
331
- }[]>;
332
- requestUsernameChange(params: {
333
- redirect?: string;
334
- username: string;
335
- }): Promise<'SUCCESS: confirmation e-mail has been sent.'>;
336
- grantPrivateRecordAccess(params: {
337
- record_id: string;
338
- user_id: string | string[];
339
- }): Promise<string>;
340
- removePrivateRecordAccess(params: {
341
- record_id: string;
342
- user_id: string | string[];
343
- }): Promise<string>;
344
- listPrivateRecordAccess(params: {
345
- record_id?: string;
346
- user_id?: string | string[];
347
- }): Promise<DatabaseResponse<{
348
- record_id: string;
349
- user_id: string;
350
- }>>;
351
- requestPrivateRecordAccessKey(params: {
352
- record_id: string;
353
- reference_id?: string;
354
- }): Promise<string>;
355
- deleteFiles(params: {
356
- endpoints: string | string[];
357
- }): Promise<RecordData[]>;
358
- uploadFiles(fileList: FormData | HTMLFormElement | SubmitEvent, params: {
359
- record_id: string;
360
- progress?: ProgressCallback;
361
- }): Promise<{
362
- completed: File[];
363
- failed: File[];
364
- bin_endpoints: string[];
365
- }>;
366
- mock(data: Form<any | {
367
- raise: 'ERR_INVALID_REQUEST' | 'ERR_INVALID_PARAMETER' | 'SOMETHING_WENT_WRONG' | 'ERR_EXISTS' | 'ERR_NOT_EXISTS';
368
- }>, options?: {
369
- auth?: boolean;
370
- method?: string;
371
- responseType?: 'blob' | 'json' | 'text' | 'arrayBuffer' | 'formData' | 'document';
372
- contentType?: string;
373
- progress?: ProgressCallback;
374
- }): Promise<{
375
- [key: string]: any;
376
- }>;
377
- login(form: Form<{
378
- username?: string;
379
- email: string;
380
- password: string;
381
- }>): Promise<UserProfile>;
382
- logout(form?: Form<{
383
- global: boolean;
384
- }>): Promise<'SUCCESS: The user has been logged out.'>;
385
- signup(form: Form<{
386
- email: String;
387
- password: String;
388
- username?: string;
389
- } & UserAttributes>, option?: {
390
- signup_confirmation?: boolean | string;
391
- email_subscription?: boolean;
392
- login?: boolean;
393
- }): Promise<UserProfile | "SUCCESS: The account has been created. User's signup confirmation is required." | 'SUCCESS: The account has been created.'>;
394
- resetPassword(form: Form<{
395
- email: string;
396
- code: string | number;
397
- new_password: string;
398
- }>): Promise<"SUCCESS: New password has been set.">;
399
- verifyEmail(form?: Form<{
400
- code: string;
401
- }>): Promise<string>;
402
- verifyPhoneNumber(form?: Form<{
403
- code: string;
404
- }>): Promise<string>;
405
- forgotPassword(form: Form<{
406
- email: string;
407
- }>): Promise<"SUCCESS: Verification code has been sent.">;
408
- changePassword(params: {
409
- new_password: string;
410
- current_password: string;
411
- }): Promise<'SUCCESS: Password has been changed.'>;
412
- updateProfile(form: Form<UserAttributes>): Promise<UserProfile>;
413
- postRecord(form: Form<Record<string, any>> | null | undefined, config: PostRecordConfig, files?: {
414
- name: string;
415
- file: File;
416
- }[]): Promise<RecordData>;
417
- getSubscriptions(params: {
418
- subscriber?: string;
419
- subscription?: string;
420
- blocked?: boolean;
421
- }, fetchOptions?: FetchOptions): Promise<DatabaseResponse<Subscription>>;
422
- subscribe(params: {
423
- user_id: string;
424
- get_feed?: boolean;
425
- get_notified?: boolean;
426
- get_email?: boolean;
427
- }): Promise<Subscription>;
428
- unsubscribe(params: {
429
- user_id: string;
430
- }): Promise<'SUCCESS: The user has unsubscribed.'>;
431
- blockSubscriber(params: {
432
- user_id: string;
433
- }): Promise<'SUCCESS: Blocked user ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".'>;
434
- unblockSubscriber(params: {
435
- user_id: string;
436
- }): Promise<'SUCCESS: Unblocked user ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".'>;
437
- subscribeNewsletter(params: Form<{
438
- email?: string;
439
- group: number | 'public' | 'authorized' | 'admin';
440
- redirect?: string;
441
- }>): Promise<string>;
442
- }
443
- export {};