@fraym/crud 0.16.0 → 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.
@@ -5,11 +5,11 @@ const dotenv_1 = require("dotenv");
5
5
  const getEnvDeliveryConfig = () => {
6
6
  var _a;
7
7
  (0, dotenv_1.config)();
8
- const serverAddress = (_a = process.env.PROJECTIONS_SERVER_ADDRESS) !== null && _a !== void 0 ? _a : "";
8
+ const serverAddress = (_a = process.env.CRUD_SERVER_ADDRESS) !== null && _a !== void 0 ? _a : "";
9
9
  let keepaliveInterval;
10
10
  let keepaliveTimeout;
11
- const keepaliveIntervalString = process.env.PROJECTIONS_CONNECTION_KEEPALIVE_INTERVAL;
12
- const keepaliveTimeoutString = process.env.PROJECTIONS_CONNECTION_KEEPALIVE_INTERVAL;
11
+ const keepaliveIntervalString = process.env.CRUD_CONNECTION_KEEPALIVE_INTERVAL;
12
+ const keepaliveTimeoutString = process.env.CRUD_CONNECTION_KEEPALIVE_INTERVAL;
13
13
  if (keepaliveIntervalString) {
14
14
  keepaliveInterval = parseInt(keepaliveIntervalString, 10);
15
15
  }
@@ -27,8 +27,8 @@ const getEnvManagementConfig = () => {
27
27
  var _a, _b;
28
28
  (0, dotenv_1.config)();
29
29
  return {
30
- serverAddress: (_a = process.env.PROJECTIONS_MANAGEMENT_SERVER_ADDRESS) !== null && _a !== void 0 ? _a : "",
31
- apiToken: (_b = process.env.PROJECTIONS_MANAGEMENT_API_TOKEN) !== null && _b !== void 0 ? _b : "",
30
+ serverAddress: (_a = process.env.CRUD_MANAGEMENT_SERVER_ADDRESS) !== null && _a !== void 0 ? _a : "",
31
+ apiToken: (_b = process.env.CRUD_MANAGEMENT_API_TOKEN) !== null && _b !== void 0 ? _b : "",
32
32
  };
33
33
  };
34
34
  exports.getEnvManagementConfig = getEnvManagementConfig;
@@ -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.0",
3
+ "version": "0.16.2",
4
4
  "license": "UNLICENSED",
5
5
  "homepage": "https://github.com/fraym/crud-nodejs",
6
6
  "repository": {