@fraym/crud 0.16.1 → 0.16.2

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.
@@ -8,6 +8,9 @@ const getAllCrudTypes = async (config) => {
8
8
  Authorization: `Bearer ${config.apiToken}`,
9
9
  },
10
10
  });
11
+ if (!response.ok) {
12
+ throw new Error(await response.text());
13
+ }
11
14
  const data = await response.json();
12
15
  return data.typeNames;
13
16
  };
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.removeCrudTypes = void 0;
4
4
  const removeCrudTypes = async (typeNames, config) => {
5
- await fetch(`${config.serverAddress}/management/types`, {
5
+ const response = await fetch(`${config.serverAddress}/management/types`, {
6
6
  method: "DELETE",
7
7
  headers: {
8
8
  Authorization: `Bearer ${config.apiToken}`,
@@ -12,5 +12,8 @@ const removeCrudTypes = async (typeNames, config) => {
12
12
  typeNames,
13
13
  }),
14
14
  });
15
+ if (!response.ok) {
16
+ throw new Error(await response.text());
17
+ }
15
18
  };
16
19
  exports.removeCrudTypes = removeCrudTypes;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.upsertCrudTypes = void 0;
4
4
  const upsertCrudTypes = async (schema, config) => {
5
- await fetch(`${config.serverAddress}/management/types`, {
5
+ const response = await fetch(`${config.serverAddress}/management/types`, {
6
6
  method: "POST",
7
7
  headers: {
8
8
  Authorization: `Bearer ${config.apiToken}`,
@@ -12,5 +12,8 @@ const upsertCrudTypes = async (schema, config) => {
12
12
  schema,
13
13
  }),
14
14
  });
15
+ if (!response.ok) {
16
+ throw new Error(await response.text());
17
+ }
15
18
  };
16
19
  exports.upsertCrudTypes = upsertCrudTypes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fraym/crud",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "license": "UNLICENSED",
5
5
  "homepage": "https://github.com/fraym/crud-nodejs",
6
6
  "repository": {