skapi-js 1.0.6 → 1.0.8

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/main/skapi.js CHANGED
@@ -22,7 +22,7 @@ export default class Skapi {
22
22
  set user(value) {
23
23
  }
24
24
  constructor(service, owner, options) {
25
- this.version = '1.0.6';
25
+ this.version = '1.0.8';
26
26
  this.session = null;
27
27
  this.connection = null;
28
28
  this.host = 'skapi';
@@ -747,6 +747,12 @@ export async function postRecord(form, config) {
747
747
  }
748
748
  }
749
749
  if (config_chkd.table?.subscription) {
750
+ if (!config_chkd?.record_id && !config_chkd.table?.access_group) {
751
+ throw new SkapiError('Public records cannot require subscription.', { code: 'INVALID_REQUEST' });
752
+ }
753
+ if (config_chkd.table.access_group === 0) {
754
+ throw new SkapiError('Public records cannot require subscription.', { code: 'INVALID_REQUEST' });
755
+ }
750
756
  config_chkd.table.subscription_group = 1;
751
757
  delete config_chkd.table.subscription;
752
758
  }
@@ -1005,6 +1011,12 @@ export async function deleteRecords(params) {
1005
1011
  delete table_p.subscription;
1006
1012
  }
1007
1013
  else {
1014
+ if (!table_p.hasOwnProperty('access_group')) {
1015
+ throw new SkapiError('"table.access_group" is required for subscription records.', { code: 'INVALID_PARAMETER' });
1016
+ }
1017
+ else if (table_p.access_group === 0) {
1018
+ throw new SkapiError('Public tables does not hold subscription records.', { code: 'INVALID_REQUEST' });
1019
+ }
1008
1020
  table_p.subscription_group = 1;
1009
1021
  }
1010
1022
  params.table = table_p;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skapi-js",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Javascript library for Skapi: Complete JAM Stack, front-end driven serverless backend API service.",
5
5
  "main": "./dist/skapi.module.js",
6
6
  "types": "./js/Main.d.ts",