nextemos 3.3.2 → 3.3.4

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.
@@ -19,11 +19,7 @@ var __rest = (this && this.__rest) || function (s, e) {
19
19
  }
20
20
  return t;
21
21
  };
22
- var __importDefault = (this && this.__importDefault) || function (mod) {
23
- return (mod && mod.__esModule) ? mod : { "default": mod };
24
- };
25
22
  Object.defineProperty(exports, "__esModule", { value: true });
26
- const logger_1 = __importDefault(require("./logger"));
27
23
  const __1 = require("../");
28
24
  /**
29
25
  * İstek yapmak için bir HTTP istemcisi oluşturur.
@@ -43,7 +39,7 @@ const fetchRequest = () => {
43
39
  Object.keys(params).forEach(key => apiURL.searchParams.append(key, params[key]));
44
40
  if (method === __1.HTTPMethod.POST)
45
41
  options.headers = Object.assign(Object.assign({}, options.headers), { ['Content-Type']: 'application/json' });
46
- logger_1.default.info(`Fetch Request: ${method} - ${apiURL} - ${JSON.stringify(Object.assign({ cache: 'no-cache' }, options))}`);
42
+ console.log(`Fetch Request: ${method} - ${apiURL} - ${JSON.stringify(Object.assign({ cache: 'no-cache' }, options))}`);
47
43
  try {
48
44
  const response = yield fetch(apiURL.toString(), Object.assign(Object.assign({ cache: 'no-cache' }, options), { method }));
49
45
  if (!response.ok) {
@@ -67,14 +63,14 @@ const fetchRequest = () => {
67
63
  }
68
64
  catch (error) {
69
65
  if (error instanceof Error) {
70
- logger_1.default.fatal(`Fetch Request Exception Error! -> ${apiURL} -> ${error.name} : ${error.message}`);
66
+ console.log(`Fetch Request Exception Error! -> ${apiURL} -> ${error.name} : ${error.message}`);
71
67
  return {
72
68
  status: 500,
73
69
  error: error.name,
74
70
  errorMessage: error.message
75
71
  };
76
72
  }
77
- logger_1.default.fatal(`Fetch Request Exception Unknown Error! ->`, error);
73
+ console.log(`Fetch Request Exception Unknown Error! ->`, error);
78
74
  return {
79
75
  status: 500,
80
76
  error: `${error}`,
@@ -1,3 +1,2 @@
1
1
  export { default as fetchRequest } from './fetchRequest';
2
2
  export { default as toIntArray } from './toIntArray';
3
- export { default as logger } from './logger';
@@ -3,11 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.logger = exports.toIntArray = exports.fetchRequest = void 0;
6
+ exports.toIntArray = exports.fetchRequest = void 0;
7
7
  /// helpers
8
8
  var fetchRequest_1 = require("./fetchRequest");
9
9
  Object.defineProperty(exports, "fetchRequest", { enumerable: true, get: function () { return __importDefault(fetchRequest_1).default; } });
10
10
  var toIntArray_1 = require("./toIntArray");
11
11
  Object.defineProperty(exports, "toIntArray", { enumerable: true, get: function () { return __importDefault(toIntArray_1).default; } });
12
- var logger_1 = require("./logger");
13
- Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return __importDefault(logger_1).default; } });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Converts a given object into a query string format.
3
+ *
4
+ * @param obj - The object to be converted into a query string.
5
+ * @returns {string} - The query string representation of the object.
6
+ */
7
+ export declare const toQueryString: (obj: Record<string, any>) => string;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toQueryString = void 0;
4
+ /**
5
+ * Converts a given object into a query string format.
6
+ *
7
+ * @param obj - The object to be converted into a query string.
8
+ * @returns {string} - The query string representation of the object.
9
+ */
10
+ const toQueryString = (obj) => {
11
+ const queryString = [];
12
+ for (const key in obj) {
13
+ if (obj.hasOwnProperty(key)) {
14
+ const value = encodeURIComponent(obj[key]);
15
+ queryString.push(`${encodeURIComponent(key)}=${value}`);
16
+ }
17
+ }
18
+ return queryString.join('&');
19
+ };
20
+ exports.toQueryString = toQueryString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "3.3.2",
3
+ "version": "3.3.4",
4
4
  "description": "For helpers and hooks used in NextJS projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -45,8 +45,5 @@
45
45
  "typescript",
46
46
  "nextemos"
47
47
  ],
48
- "dependencies": {
49
- "pino": "^9.3.2",
50
- "pino-pretty": "^11.2.2"
51
- }
48
+ "dependencies": {}
52
49
  }
@@ -1,3 +0,0 @@
1
- import { Logger } from "pino";
2
- declare let logger: Logger;
3
- export default logger;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const pino_1 = __importDefault(require("pino"));
7
- let logger;
8
- if (typeof window === 'undefined' && process.env.NODE_ENV === "development") {
9
- const pretty = require("pino-pretty");
10
- logger = (0, pino_1.default)({
11
- level: "debug",
12
- }, pretty({
13
- levelFirst: true,
14
- colorize: true,
15
- ignore: "time,hostname,pid",
16
- }));
17
- }
18
- else {
19
- logger = (0, pino_1.default)({
20
- level: process.env.NODE_ENV === "development" ? "debug" : "info",
21
- });
22
- }
23
- exports.default = logger;