skapi-js 1.0.0-alpha.9 → 1.0.1

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/js/Types.d.ts CHANGED
@@ -3,42 +3,50 @@ export type SubscriptionGroup<T> = {
3
3
  user_id: string;
4
4
  group?: T;
5
5
  };
6
- export type Database<Tbl, Ref, Idx> = {
7
- service?: string;
6
+ export type GetRecordQuery = {
8
7
  record_id?: string;
9
- table?: Tbl;
10
- reference?: Ref;
11
- index?: Idx;
12
- private_access_key?: string;
13
- };
14
- export type GetRecordQuery = Database<{
15
- name: string;
16
- access_group?: number | 'private' | 'public' | 'authorized';
17
- subscription?: {
18
- user_id: string;
19
- group: number;
8
+ table?: {
9
+ name: string;
10
+ access_group?: number | 'private' | 'public' | 'authorized';
11
+ subscription?: string;
12
+ } | string;
13
+ reference?: string;
14
+ index?: {
15
+ name: string | '$updated' | '$uploaded' | '$referenced_count' | '$user_id';
16
+ value: string | number | boolean;
17
+ condition?: 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | 'ne' | '>' | '>=' | '<' | '<=' | '=' | '!=';
18
+ range?: string | number | boolean;
20
19
  };
21
- }, string, {
22
- name: string | '$updated' | '$uploaded' | '$referenced_count' | '$user_id';
23
- value: string | number | boolean;
24
- condition?: Condition;
25
- range?: string | number | boolean;
26
- }> & {
27
20
  tag?: string;
28
21
  };
29
- export type PostRecordConfig = Database<{
30
- name?: string;
31
- access_group?: number | 'private' | 'public' | 'authorized';
32
- subscription_group?: number;
33
- }, {
34
- record_id: string;
35
- reference_limit: number | null;
36
- allow_multiple_reference: boolean;
37
- }, {
38
- name: string;
39
- value: string | number | boolean;
40
- } | null> & {
22
+ export type PostRecordConfig = {
23
+ record_id?: string;
24
+ readonly?: boolean;
25
+ table?: {
26
+ name?: string;
27
+ access_group?: number | 'private' | 'public' | 'authorized';
28
+ subscription?: boolean;
29
+ } | string;
30
+ reference?: {
31
+ record_id?: string;
32
+ reference_limit?: number | null;
33
+ allow_multiple_reference?: boolean;
34
+ } | string;
35
+ index?: {
36
+ name: string;
37
+ value: string | number | boolean;
38
+ } | null;
41
39
  tags?: string[];
40
+ remove_bin?: BinaryFile[] | string[];
41
+ };
42
+ export type BinaryFile = {
43
+ access_group: number | 'private' | 'public' | 'authorized';
44
+ filename: string;
45
+ url: string;
46
+ path: string;
47
+ size: number;
48
+ uploaded: number;
49
+ getFile: (dataType?: 'base64' | 'endpoint' | 'blob', progress?: ProgressCallback) => Promise<Blob | string | void>;
42
50
  };
43
51
  export type RecordData = {
44
52
  service: string;
@@ -48,11 +56,8 @@ export type RecordData = {
48
56
  uploaded: number;
49
57
  table: {
50
58
  name: string;
51
- access_group?: number | 'private' | 'public' | 'authorized';
52
- subscription?: {
53
- user_id: string;
54
- group: number;
55
- };
59
+ access_group: 'private' | 'public' | 'authorized' | number;
60
+ subscription: boolean;
56
61
  };
57
62
  reference: {
58
63
  record_id?: string;
@@ -66,7 +71,11 @@ export type RecordData = {
66
71
  };
67
72
  data?: Record<string, any>;
68
73
  tags?: string[];
74
+ bin?: {
75
+ [key: string]: BinaryFile | BinaryFile[];
76
+ };
69
77
  ip: string;
78
+ readonly: boolean;
70
79
  };
71
80
  export type Connection = {
72
81
  locale: string;
@@ -115,8 +124,8 @@ export type UserAttributes = {
115
124
  };
116
125
  export type UserProfile = {
117
126
  service: string;
118
- owner?: string;
119
- access_group?: number;
127
+ owner: string;
128
+ access_group: number;
120
129
  user_id: string;
121
130
  locale: string;
122
131
  email_verified?: boolean;
@@ -137,24 +146,14 @@ export type PublicUser = {
137
146
  gender?: string;
138
147
  birthdate?: string;
139
148
  misc?: string;
140
- subscribers: number;
149
+ subscribers?: number;
141
150
  timestamp: number;
142
151
  service: string;
143
152
  owner: string;
144
- access_group?: number;
153
+ access_group: number;
145
154
  user_id: string;
146
155
  locale: string;
147
156
  };
148
- export interface User extends UserProfile {
149
- subscribers: number;
150
- timestamp: number;
151
- }
152
- export type QueryParams = {
153
- searchFor: string;
154
- value: string | number | boolean;
155
- condition?: '>' | '>=' | '=' | '<' | '<=' | '!=' | 'gt' | 'gte' | 'eq' | 'lt' | 'lte' | 'ne';
156
- range?: string | number | boolean;
157
- };
158
157
  export type ProgressCallback = (e: {
159
158
  status: 'upload' | 'download';
160
159
  progress: number;
@@ -192,17 +191,18 @@ export type Service = {
192
191
  newsletter_subscribers: number;
193
192
  service: string;
194
193
  template_activation: {
195
- html: string;
194
+ url: string;
196
195
  subject: string;
197
196
  };
198
197
  template_verification: {
199
- html: string;
198
+ url: string;
200
199
  sms: string;
201
200
  subject: string;
202
201
  };
203
202
  template_welcome: {
204
- html: string;
203
+ url: string;
205
204
  subject: string;
205
+ subscri: any;
206
206
  };
207
207
  timestamp: number;
208
208
  triggers: {
@@ -2,6 +2,7 @@ export default class SkapiError extends Error {
2
2
  code: string | number;
3
3
  cause: Error;
4
4
  constructor(error: any, options?: {
5
+ name?: string;
5
6
  code?: string;
6
7
  cause?: Error;
7
8
  });
package/js/main/error.js CHANGED
@@ -2,7 +2,7 @@ export default class SkapiError extends Error {
2
2
  constructor(error, options) {
3
3
  if (Array.isArray(error) && error.length <= 2) {
4
4
  super(error[1] || 'Something went wrong.');
5
- this.name = "SKAPI";
5
+ this.name = options && options.name || "SKAPI";
6
6
  this.code = error[0] || "ERROR";
7
7
  if (options) {
8
8
  if (options.code) {
@@ -1,4 +1,4 @@
1
- import { User, DatabaseResponse, Connection, ProgressCallback, GetRecordQuery, FetchOptions, RecordData, Condition, QueryParams, UserAttributes, UserProfile, Newsletters, FormSubmitCallback, Form, PostRecordConfig, PublicUser, SubscriptionGroup } from '../Types';
1
+ import { DatabaseResponse, Connection, ProgressCallback, GetRecordQuery, FetchOptions, RecordData, Condition, UserAttributes, UserProfile, Newsletters, FormSubmitCallback, Form, PostRecordConfig, PublicUser } from '../Types';
2
2
  export default class Skapi {
3
3
  version: string;
4
4
  service: string;
@@ -12,10 +12,11 @@ export default class Skapi {
12
12
  private __cached_requests;
13
13
  private __startKeyHistory;
14
14
  private __request_signup_confirmation;
15
+ private __private_access_key;
15
16
  private __class_properties_has_been_cached;
16
17
  private __user;
17
- get user(): User | null;
18
- set user(value: User | null);
18
+ get user(): UserProfile | null;
19
+ set user(value: UserProfile | null);
19
20
  private admin_endpoint;
20
21
  private record_endpoint;
21
22
  validate: {
@@ -26,6 +27,7 @@ export default class Skapi {
26
27
  email(val: string): boolean;
27
28
  };
28
29
  private __connection;
30
+ private __authConnection;
29
31
  constructor(service: string, owner: string, options?: {
30
32
  autoLogin: boolean;
31
33
  });
@@ -34,16 +36,16 @@ export default class Skapi {
34
36
  private request;
35
37
  private getSubscribedTo;
36
38
  private getSubscribers;
39
+ normalizeRecord: any;
37
40
  getConnection(): Promise<Connection>;
38
41
  getProfile(options?: {
39
42
  refreshToken: boolean;
40
- }): Promise<User | null>;
43
+ }): Promise<UserProfile | null>;
41
44
  getFile(url: string, config?: {
42
- noCdn?: boolean;
43
45
  dataType?: 'base64' | 'download' | 'endpoint' | 'blob';
44
- expiration?: number;
46
+ expires?: number;
45
47
  progress?: ProgressCallback;
46
- }): Promise<Blob | string>;
48
+ }): Promise<Blob | string | void>;
47
49
  secureRequest<Params = {
48
50
  url: string;
49
51
  data?: any;
@@ -93,28 +95,21 @@ export default class Skapi {
93
95
  table?: {
94
96
  name: string;
95
97
  access_group?: number | 'private' | 'public' | 'authorized';
96
- subscription_group?: number;
98
+ subscription: boolean;
97
99
  };
98
100
  }): Promise<string>;
99
101
  resendSignupConfirmation(redirect: string): Promise<'SUCCESS: Signup confirmation E-Mail has been sent.'>;
100
102
  recoverAccount(redirect?: boolean | string): Promise<"SUCCESS: Recovery e-mail has been sent.">;
101
- getUsers(params?: QueryParams | null, fetchOptions?: FetchOptions): Promise<DatabaseResponse<PublicUser>>;
103
+ getUsers(params?: {
104
+ searchFor: 'user_id' | 'email' | 'phone_number' | 'locale' | 'name' | 'address' | 'gender' | 'birthdate';
105
+ value: string | number | boolean;
106
+ condition?: '>' | '>=' | '=' | '<' | '<=' | '!=' | 'gt' | 'gte' | 'eq' | 'lt' | 'lte' | 'ne';
107
+ range?: string | number | boolean;
108
+ }, fetchOptions?: FetchOptions): Promise<DatabaseResponse<PublicUser>>;
102
109
  disableAccount(): Promise<'SUCCESS: account has been disabled.'>;
103
110
  lastVerifiedEmail(params?: {
104
111
  revert: boolean;
105
112
  }): Promise<string | UserProfile>;
106
- getSubscriptions(params: {
107
- subscriber?: string;
108
- subscription?: string;
109
- group?: number;
110
- blocked?: boolean;
111
- }, fetchOptions?: FetchOptions, _mapper?: (data: Record<string, any>) => any): Promise<DatabaseResponse<{
112
- subscriber: string;
113
- subscription: string;
114
- group: number;
115
- timestamp: number;
116
- blocked: boolean;
117
- }>>;
118
113
  unsubscribeNewsletter(params: {
119
114
  group: number | 'public' | 'authorized' | null;
120
115
  }): Promise<string>;
@@ -172,10 +167,10 @@ export default class Skapi {
172
167
  mockResponse: Record<string, any>;
173
168
  }>;
174
169
  login(form: Form<{
175
- username: string;
170
+ username?: string;
176
171
  email: string;
177
172
  password: string;
178
- }>): Promise<User>;
173
+ }>): Promise<UserProfile>;
179
174
  logout(): Promise<'SUCCESS: The user has been logged out.'>;
180
175
  signup(form: Form<UserAttributes & {
181
176
  email: String;
@@ -184,7 +179,7 @@ export default class Skapi {
184
179
  signup_confirmation?: boolean | string;
185
180
  email_subscription?: boolean;
186
181
  login?: boolean;
187
- } & FormSubmitCallback): Promise<User | "SUCCESS: The account has been created. User's signup confirmation is required." | 'SUCCESS: The account has been created.'>;
182
+ } & FormSubmitCallback): Promise<UserProfile | "SUCCESS: The account has been created. User's signup confirmation is required." | 'SUCCESS: The account has been created.'>;
188
183
  resetPassword(form: Form<{
189
184
  email: string;
190
185
  code?: string | number;
@@ -203,12 +198,31 @@ export default class Skapi {
203
198
  new_password: string;
204
199
  current_password: string;
205
200
  }): Promise<'SUCCESS: Password has been changed.'>;
206
- updateProfile(form: Form<UserAttributes>): Promise<User>;
201
+ updateProfile(form: Form<UserAttributes>): Promise<UserProfile>;
207
202
  postRecord(form: Form<Record<string, any>> | null | undefined, config: PostRecordConfig & FormSubmitCallback): Promise<RecordData>;
208
- subscribe(option: SubscriptionGroup<number>): Promise<'SUCCESS: the user has subscribed.'>;
209
- unsubscribe(option: SubscriptionGroup<number | '*'>): Promise<'SUCCESS: the user has unsubscribed.'>;
210
- blockSubscriber(option: SubscriptionGroup<number | '*'>): Promise<'SUCCESS: blocked user id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".'>;
211
- unblockSubscriber(option: SubscriptionGroup<number | '*'>): Promise<'SUCCESS: unblocked user id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".'>;
203
+ getSubscriptions(params: {
204
+ subscriber?: string;
205
+ subscription?: string;
206
+ blocked?: boolean;
207
+ }, fetchOptions?: FetchOptions): Promise<DatabaseResponse<{
208
+ subscriber: string;
209
+ subscription: string;
210
+ group: number;
211
+ timestamp: number;
212
+ blocked: boolean;
213
+ }>>;
214
+ subscribe(params: {
215
+ user_id: string;
216
+ }): Promise<'SUCCESS: the user has subscribed.'>;
217
+ unsubscribe(params: {
218
+ user_id: string;
219
+ }): Promise<'SUCCESS: the user has unsubscribed.'>;
220
+ blockSubscriber(params: {
221
+ user_id: string;
222
+ }): Promise<'SUCCESS: blocked user id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".'>;
223
+ unblockSubscriber(params: {
224
+ user_id: string;
225
+ }): Promise<'SUCCESS: unblocked user id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".'>;
212
226
  subscribeNewsletter(form: Form<{
213
227
  email?: string;
214
228
  group: number | 'public' | 'authorized';
package/js/main/skapi.js CHANGED
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import SkapiError from './error';
8
8
  import validator from '../utils/validator';
9
- import { getRecords, postRecord, deleteRecords, getTables, getIndexes, getTags, uploadFiles, getFile, grantPrivateRecordAccess, removePrivateRecordAccess, listPrivateRecordAccess, requestPrivateRecordAccessKey, deleteFiles } from '../methods/database';
9
+ import { getRecords, postRecord, deleteRecords, getTables, getIndexes, getTags, uploadFiles, getFile, grantPrivateRecordAccess, removePrivateRecordAccess, listPrivateRecordAccess, requestPrivateRecordAccessKey, deleteFiles, normalizeRecord } from '../methods/database';
10
10
  import { request, secureRequest, mock, getFormResponse, formHandler, getConnection } from '../methods/request';
11
11
  import { subscribe, unsubscribe, blockSubscriber, unblockSubscriber, getSubscribers, getSubscribedTo, getSubscriptions, subscribeNewsletter, getNewsletters, unsubscribeNewsletter, getNewsletterSubscription } from '../methods/subscription';
12
12
  import { checkAdmin, getProfile, logout, recoverAccount, resendSignupConfirmation, authentication, login, signup, disableAccount, resetPassword, verifyEmail, verifyPhoneNumber, forgotPassword, changePassword, updateProfile, getUsers, setUserPool, userPool, lastVerifiedEmail, requestUsernameChange } from '../methods/user';
@@ -22,16 +22,17 @@ export default class Skapi {
22
22
  set user(value) {
23
23
  }
24
24
  constructor(service, owner, options) {
25
- this.version = '1.0.0-alpha.9';
25
+ this.version = '1.0.1';
26
26
  this.session = null;
27
27
  this.connection = null;
28
28
  this.host = 'skapi';
29
- this.hostDomain = 'skapi.app';
30
- this.target_cdn = 'd1wrj5ymxrt2ir';
29
+ this.hostDomain = 'skapi.com';
30
+ this.target_cdn = 'd1h765tqb4s5ov';
31
31
  this.__disabledAccount = null;
32
32
  this.__cached_requests = {};
33
33
  this.__startKeyHistory = {};
34
34
  this.__request_signup_confirmation = null;
35
+ this.__private_access_key = {};
35
36
  this.__class_properties_has_been_cached = false;
36
37
  this.__user = null;
37
38
  this.validate = {
@@ -85,6 +86,7 @@ export default class Skapi {
85
86
  this.request = request.bind(this);
86
87
  this.getSubscribedTo = getSubscribedTo.bind(this);
87
88
  this.getSubscribers = getSubscribers.bind(this);
89
+ this.normalizeRecord = normalizeRecord.bind(this);
88
90
  if (typeof service !== 'string' || typeof owner !== 'string') {
89
91
  throw new SkapiError('"service" and "owner" should be type <string>.', { code: 'INVALID_PARAMETER' });
90
92
  }
@@ -117,39 +119,40 @@ export default class Skapi {
117
119
  reader.readAsDataURL(blob);
118
120
  }))
119
121
  .then(data => typeof data === 'string' ? JSON.parse(window.atob(data.split(',')[1])) : null);
120
- this.__connection = (async () => {
121
- if (!window.sessionStorage) {
122
- throw new Error(`This browser does not support skapi.`);
123
- }
124
- const restore = JSON.parse(window.sessionStorage.getItem(`${service}#${owner}`) || 'null');
125
- if (restore?.connection) {
126
- for (let k in restore) {
127
- this[k] = restore[k];
128
- }
122
+ if (!window.sessionStorage) {
123
+ throw new Error(`This browser does not support skapi.`);
124
+ }
125
+ const restore = JSON.parse(window.sessionStorage.getItem(`${service}#${owner}`) || 'null');
126
+ if (restore?.connection) {
127
+ for (let k in restore) {
128
+ this[k] = restore[k];
129
129
  }
130
+ }
131
+ this.__authConnection = (async () => {
130
132
  const admin_endpoint = await this.admin_endpoint;
131
133
  setUserPool({
132
134
  UserPoolId: admin_endpoint.userpool_id,
133
135
  ClientId: admin_endpoint.userpool_client
134
136
  });
135
- const process = [];
136
- if (!restore?.connection) {
137
- process.push(this.updateConnection());
138
- }
139
137
  if (!restore?.connection && !autoLogin) {
140
138
  let currentUser = userPool.getCurrentUser();
141
139
  if (currentUser) {
142
140
  currentUser.signOut();
143
141
  }
144
142
  }
145
- if (restore?.connection || autoLogin) {
146
- process.push(authentication.bind(this)().getSession({ refreshToken: !restore?.connection }).catch(err => {
143
+ if (autoLogin) {
144
+ try {
145
+ await authentication.bind(this)().getSession({ refreshToken: !restore?.connection });
146
+ }
147
+ catch (err) {
147
148
  this.__user = null;
148
- }));
149
+ }
149
150
  }
150
- let awaitProcess;
151
- if (process.length) {
152
- awaitProcess = await Promise.all(process);
151
+ })();
152
+ this.__connection = (async () => {
153
+ let process = null;
154
+ if (!restore?.connection) {
155
+ process = this.updateConnection();
153
156
  }
154
157
  const storeClassProperties = () => {
155
158
  if (this.__class_properties_has_been_cached) {
@@ -171,20 +174,22 @@ export default class Skapi {
171
174
  this.__class_properties_has_been_cached = true;
172
175
  }
173
176
  };
174
- return (awaitProcess instanceof Promise) ? awaitProcess.then(() => exec()) : exec();
177
+ return (process instanceof Promise) ? process.then(() => exec()) : exec();
175
178
  };
176
179
  window.addEventListener('beforeunload', storeClassProperties);
177
180
  window.addEventListener("visibilitychange", storeClassProperties);
181
+ await process;
182
+ await this.__authConnection;
183
+ let skapi = `%c\r\n $$\\ $$\\ \r\n $$ | \\__|\r\n $$$$$$$\\ $$ | $$\\ $$$$$$\\ $$$$$$\\ $$\\ \r\n$$ _____|$$ | $$ |\\____$$\\ $$ __$$\\ $$ |\r\n\\$$$$$$\\ $$$$$$ \/ $$$$$$$ |$$ \/ $$ |$$ |\r\n \\____$$\\ $$ _$$< $$ __$$ |$$ | $$ |$$ |\r\n$$$$$$$ |$$ | \\$$\\\\$$$$$$$ |$$$$$$$ |$$ |\r\n\\_______\/ \\__| \\__|\\_______|$$ ____\/ \\__|\r\n $$ | \r\n $$ | \r\n \\__| \r\n`;
184
+ console.log(`Built with:\n${skapi}Version: ${this.version}\n\nDocumentation: https://docs.skapi.com`, `font-family: monospace; color:blue;`);
178
185
  return this.connection;
179
186
  })();
180
187
  }
181
188
  async updateConnection() {
182
- let skapi = `%c\r\n $$\\ $$\\ \r\n $$ | \\__|\r\n $$$$$$$\\ $$ | $$\\ $$$$$$\\ $$$$$$\\ $$\\ \r\n$$ _____|$$ | $$ |\\____$$\\ $$ __$$\\ $$ |\r\n\\$$$$$$\\ $$$$$$ \/ $$$$$$$ |$$ \/ $$ |$$ |\r\n \\____$$\\ $$ _$$< $$ __$$ |$$ | $$ |$$ |\r\n$$$$$$$ |$$ | \\$$\\\\$$$$$$$ |$$$$$$$ |$$ |\r\n\\_______\/ \\__| \\__|\\_______|$$ ____\/ \\__|\r\n $$ | \r\n $$ | \r\n \\__| \r\n`;
183
189
  this.connection = await request.bind(this)('service', {
184
190
  service: this.service,
185
191
  owner: this.owner
186
192
  }, { bypassAwaitConnection: true, method: 'get' });
187
- console.log(`Built with:\n${skapi}Version: ${this.version}\n\nDocumentation: https://docs.skapi.com`, `font-family: monospace; color:blue;`);
188
193
  return this.connection;
189
194
  }
190
195
  getConnection() {
@@ -226,9 +231,6 @@ export default class Skapi {
226
231
  lastVerifiedEmail(params) {
227
232
  return lastVerifiedEmail.bind(this)(params);
228
233
  }
229
- getSubscriptions(params, fetchOptions, _mapper) {
230
- return getSubscriptions.bind(this)(params, fetchOptions, _mapper);
231
- }
232
234
  unsubscribeNewsletter(params) {
233
235
  return unsubscribeNewsletter.bind(this)(params);
234
236
  }
@@ -270,22 +272,97 @@ export default class Skapi {
270
272
  changePassword(params) { return changePassword.bind(this)(params); }
271
273
  updateProfile(form) { return updateProfile.bind(this)(form); }
272
274
  postRecord(form, config) { return postRecord.bind(this)(form, config); }
273
- subscribe(option) {
274
- return subscribe.bind(this)(option);
275
+ getSubscriptions(params, fetchOptions) {
276
+ return getSubscriptions.bind(this)(params, fetchOptions);
275
277
  }
276
- unsubscribe(option) {
277
- return unsubscribe.bind(this)(option);
278
+ subscribe(params) {
279
+ return subscribe.bind(this)(params);
278
280
  }
279
- blockSubscriber(option) {
280
- return blockSubscriber.bind(this)(option);
281
+ unsubscribe(params) {
282
+ return unsubscribe.bind(this)(params);
281
283
  }
282
- unblockSubscriber(option) {
283
- return unblockSubscriber.bind(this)(option);
284
+ blockSubscriber(params) {
285
+ return blockSubscriber.bind(this)(params);
286
+ }
287
+ unblockSubscriber(params) {
288
+ return unblockSubscriber.bind(this)(params);
284
289
  }
285
290
  subscribeNewsletter(form) {
286
291
  return subscribeNewsletter.bind(this)(form);
287
292
  }
288
293
  }
294
+ __decorate([
295
+ formHandler()
296
+ ], Skapi.prototype, "getConnection", null);
297
+ __decorate([
298
+ formHandler()
299
+ ], Skapi.prototype, "getProfile", null);
300
+ __decorate([
301
+ formHandler()
302
+ ], Skapi.prototype, "getFile", null);
303
+ __decorate([
304
+ formHandler()
305
+ ], Skapi.prototype, "secureRequest", null);
306
+ __decorate([
307
+ formHandler()
308
+ ], Skapi.prototype, "getFormResponse", null);
309
+ __decorate([
310
+ formHandler()
311
+ ], Skapi.prototype, "getRecords", null);
312
+ __decorate([
313
+ formHandler()
314
+ ], Skapi.prototype, "getTables", null);
315
+ __decorate([
316
+ formHandler()
317
+ ], Skapi.prototype, "getIndexes", null);
318
+ __decorate([
319
+ formHandler()
320
+ ], Skapi.prototype, "getTags", null);
321
+ __decorate([
322
+ formHandler()
323
+ ], Skapi.prototype, "deleteRecords", null);
324
+ __decorate([
325
+ formHandler()
326
+ ], Skapi.prototype, "resendSignupConfirmation", null);
327
+ __decorate([
328
+ formHandler()
329
+ ], Skapi.prototype, "recoverAccount", null);
330
+ __decorate([
331
+ formHandler()
332
+ ], Skapi.prototype, "getUsers", null);
333
+ __decorate([
334
+ formHandler()
335
+ ], Skapi.prototype, "disableAccount", null);
336
+ __decorate([
337
+ formHandler()
338
+ ], Skapi.prototype, "lastVerifiedEmail", null);
339
+ __decorate([
340
+ formHandler()
341
+ ], Skapi.prototype, "unsubscribeNewsletter", null);
342
+ __decorate([
343
+ formHandler()
344
+ ], Skapi.prototype, "getNewsletters", null);
345
+ __decorate([
346
+ formHandler()
347
+ ], Skapi.prototype, "getNewsletterSubscription", null);
348
+ __decorate([
349
+ formHandler()
350
+ ], Skapi.prototype, "requestUsernameChange", null);
351
+ __decorate([
352
+ formHandler()
353
+ ], Skapi.prototype, "grantPrivateRecordAccess", null);
354
+ __decorate([
355
+ formHandler()
356
+ ], Skapi.prototype, "removePrivateRecordAccess", null);
357
+ __decorate([
358
+ formHandler()
359
+ ], Skapi.prototype, "listPrivateRecordAccess", null);
360
+ __decorate([
361
+ formHandler()
362
+ ], Skapi.prototype, "requestPrivateRecordAccessKey", null);
363
+ __decorate([
364
+ formHandler()
365
+ ], Skapi.prototype, "deleteFiles", null);
289
366
  __decorate([
290
367
  formHandler()
291
368
  ], Skapi.prototype, "uploadFiles", null);
@@ -322,6 +399,9 @@ __decorate([
322
399
  __decorate([
323
400
  formHandler()
324
401
  ], Skapi.prototype, "postRecord", null);
402
+ __decorate([
403
+ formHandler()
404
+ ], Skapi.prototype, "getSubscriptions", null);
325
405
  __decorate([
326
406
  formHandler()
327
407
  ], Skapi.prototype, "subscribe", null);
@@ -1,4 +1,5 @@
1
1
  import { RecordData, Form, FormSubmitCallback, FetchOptions, DatabaseResponse, GetRecordQuery, Condition, PostRecordConfig, ProgressCallback } from '../Types';
2
+ export declare function normalizeRecord(record: Record<string, any>): RecordData;
2
3
  export declare function deleteFiles(params: {
3
4
  endpoints: string | string[];
4
5
  }): Promise<RecordData[]>;
@@ -7,15 +8,19 @@ export declare function uploadFiles(fileList: Form<FileList | File[]>, params: {
7
8
  } & FormSubmitCallback): Promise<{
8
9
  completed: File[];
9
10
  failed: File[];
11
+ bin_endpoints: string[];
10
12
  }>;
11
13
  export declare function getFile(url: string, config?: {
12
- noCdn?: boolean;
13
14
  dataType?: 'base64' | 'download' | 'endpoint' | 'blob';
14
- expiration?: number;
15
+ expires?: number;
15
16
  progress?: ProgressCallback;
16
- }): Promise<Blob | string>;
17
- export declare function getRecords(query: GetRecordQuery, fetchOptions?: FetchOptions): Promise<DatabaseResponse<RecordData>>;
18
- export declare function postRecord(form: Form<Record<string, any>> | null | undefined, config: PostRecordConfig & FormSubmitCallback): Promise<RecordData>;
17
+ }): Promise<Blob | string | void>;
18
+ export declare function getRecords(query: GetRecordQuery & {
19
+ private_key?: string;
20
+ }, fetchOptions?: FetchOptions): Promise<DatabaseResponse<RecordData>>;
21
+ export declare function postRecord(form: Form<Record<string, any>> | null | undefined, config: PostRecordConfig & FormSubmitCallback & {
22
+ reference_private_key?: string;
23
+ }): Promise<RecordData>;
19
24
  export declare function getTables(query: {
20
25
  table: string;
21
26
  condition?: Condition;
@@ -44,7 +49,7 @@ export declare function getIndexes(query: {
44
49
  average_number?: number;
45
50
  average_bool?: number;
46
51
  }>>;
47
- export declare function getTags(query: {
52
+ export declare function getTags(query?: {
48
53
  table: string;
49
54
  tag?: string;
50
55
  condition?: Condition;
@@ -59,8 +64,7 @@ export declare function deleteRecords(params: {
59
64
  table?: {
60
65
  name: string;
61
66
  access_group?: number | 'private' | 'public' | 'authorized';
62
- subscription?: string;
63
- subscription_group?: number;
67
+ subscription?: boolean;
64
68
  };
65
69
  }): Promise<string>;
66
70
  export declare function grantPrivateRecordAccess(params: {
@@ -74,5 +78,5 @@ export declare function removePrivateRecordAccess(params: {
74
78
  export declare function listPrivateRecordAccess(params: {
75
79
  record_id: string;
76
80
  user_id: string | string[];
77
- }): any;
81
+ }): void;
78
82
  export declare function requestPrivateRecordAccessKey(record_id: string): any;