skapi-js 0.0.41 → 0.0.43

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skapi-js",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "description": "skapi serverless cloud javascript library",
5
5
  "main": "./dist/skapi.module.js",
6
6
  "scripts": {
package/src/skapi.ts CHANGED
@@ -1031,7 +1031,7 @@ export default class Skapi {
1031
1031
  url: isExternalUrl || url,
1032
1032
  refresh: isForm ? true : refresh // should not use startKey when post is a form
1033
1033
  }); // returns requrestKey | cached data
1034
-
1034
+
1035
1035
  if (requestKey && typeof requestKey === 'object') {
1036
1036
  return requestKey;
1037
1037
  }
@@ -1112,7 +1112,7 @@ export default class Skapi {
1112
1112
  }): string | FetchResponse {
1113
1113
 
1114
1114
  let { params = {}, url, refresh = false } = option || {};
1115
-
1115
+
1116
1116
  if (params.hasOwnProperty('startKey')) {
1117
1117
  if (
1118
1118
  typeof params.startKey !== 'object' && !Object.keys(params.startKey).length ||
@@ -1432,11 +1432,14 @@ export default class Skapi {
1432
1432
  async postRecord(
1433
1433
  /** Any type of data to store. If undefined, does not update the data. */
1434
1434
  form: Form | any,
1435
- option?: PostRecordParams & FormCallbacks
1435
+ option: PostRecordParams & FormCallbacks
1436
1436
  ): Promise<RecordData> {
1437
1437
 
1438
1438
  let is_admin = await this.requireAdmin({ ignoreVerification: true });
1439
-
1439
+ if (!option) {
1440
+ throw new SkapiError(['INVALID_PARAMETER', '"option" argument is required.']);
1441
+ }
1442
+
1440
1443
  let { formData } = option;
1441
1444
  let fetchOptions: Record<string, any> = {};
1442
1445
 
@@ -2737,7 +2740,7 @@ export default class Skapi {
2737
2740
  * @category User
2738
2741
  */
2739
2742
  @formResponse()
2740
- login(
2743
+ async login(
2741
2744
  form: Form | {
2742
2745
  /** E-Mail for signin. 64 character max. */
2743
2746
  email: string;
@@ -2745,6 +2748,7 @@ export default class Skapi {
2745
2748
  password: string;
2746
2749
  },
2747
2750
  option?: FormCallbacks): Promise<User> {
2751
+ await this.__connection;
2748
2752
  this.logout();
2749
2753
  let params = checkParams(form, {
2750
2754
  email: (v: string) => validateEmail(v),