skapi-js 1.0.16 → 1.0.17
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/dist/skapi.js +1 -1
- package/dist/skapi.js.map +1 -1
- package/dist/skapi.module.js +1 -1
- package/dist/skapi.module.js.map +1 -1
- package/js/main/skapi.js +1 -1
- package/js/methods/database.js +6 -3
- package/package.json +1 -1
package/js/main/skapi.js
CHANGED
package/js/methods/database.js
CHANGED
|
@@ -555,6 +555,9 @@ export async function getRecords(query, fetchOptions) {
|
|
|
555
555
|
throw new SkapiError("User has no access", { code: 'INVALID_REQUEST' });
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
|
+
if (!query.table.hasOwnProperty('access_group')) {
|
|
559
|
+
query.table.access_group = query.table?.subscription ? 1 : 0;
|
|
560
|
+
}
|
|
558
561
|
}
|
|
559
562
|
if (query?.index && !query.index?.name) {
|
|
560
563
|
throw new SkapiError('"index.name" is required when using "index" parameter.', { code: 'INVALID_REQUEST' });
|
|
@@ -725,7 +728,7 @@ export async function postRecord(form, config) {
|
|
|
725
728
|
if (!config_chkd?.table && !config_chkd?.record_id) {
|
|
726
729
|
throw new SkapiError('Either "record_id" or "table" should have a value.', { code: 'INVALID_PARAMETER' });
|
|
727
730
|
}
|
|
728
|
-
if (
|
|
731
|
+
if (config_chkd.table) {
|
|
729
732
|
if (config_chkd.table.access_group === 'public') {
|
|
730
733
|
config_chkd.table.access_group = 0;
|
|
731
734
|
}
|
|
@@ -747,8 +750,8 @@ export async function postRecord(form, config) {
|
|
|
747
750
|
}
|
|
748
751
|
}
|
|
749
752
|
if (config_chkd.table?.subscription) {
|
|
750
|
-
if (!config_chkd?.record_id && !config_chkd.table
|
|
751
|
-
|
|
753
|
+
if (!config_chkd?.record_id && !config_chkd.table.hasOwnProperty('access_group')) {
|
|
754
|
+
config_chkd.table.access_group = 1;
|
|
752
755
|
}
|
|
753
756
|
if (config_chkd.table.access_group === 0) {
|
|
754
757
|
throw new SkapiError('Public records cannot require subscription.', { code: 'INVALID_REQUEST' });
|
package/package.json
CHANGED