nextemos 4.1.0 → 4.1.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.
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const nextemos_config_1 = require("../nextemos-config");
4
3
  const html_entities_1 = require("html-entities");
5
- const { cdnUrl, cdnProvider, videoCdnUrl, thumborSource } = (0, nextemos_config_1.getConfig)();
6
- const CDN_URL = process.env.CDN_URL || cdnUrl;
7
- const VIDEO_CDN_URL = process.env.VIDEO_CDN_URL || videoCdnUrl || CDN_URL;
8
- const CDN_PROVIDER = process.env.CDN_PROVIDER || cdnProvider;
9
- const THUMBOR_SOURCE = process.env.THUMBOR_SOURCE || thumborSource;
4
+ const CDN_URL = process.env.CDN_URL || "https://images.proj-e.com";
5
+ const VIDEO_CDN_URL = process.env.VIDEO_CDN_URL || CDN_URL;
6
+ const CDN_PROVIDER = process.env.CDN_PROVIDER;
7
+ const THUMBOR_SOURCE = process.env.THUMBOR_SOURCE;
10
8
  // CDN işlemleri için kullanılan nesne
11
9
  const cdn = {
12
10
  // CDN URL'sini döndüren özellik
@@ -20,7 +20,6 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  return t;
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- const nextemos_config_1 = require("../nextemos-config");
24
23
  const __1 = require("../");
25
24
  /**
26
25
  * İstek yapmak için bir HTTP istemcisi oluşturur.
@@ -35,13 +34,12 @@ const fetchRequest = () => {
35
34
  */
36
35
  const request = (_a) => __awaiter(void 0, void 0, void 0, function* () {
37
36
  var { url, method, params } = _a, options = __rest(_a, ["url", "method", "params"]);
38
- const { cacheStrategy } = (0, nextemos_config_1.getConfig)();
39
37
  const apiURL = new URL(url);
40
38
  if (params)
41
39
  Object.keys(params).forEach(key => apiURL.searchParams.append(key, params[key]));
42
40
  if (method === __1.HTTPMethod.POST)
43
41
  options.headers = Object.assign({ ['Content-Type']: 'application/json' }, options.headers);
44
- const requestOptions = Object.assign(Object.assign({ cache: cacheStrategy }, options), { method });
42
+ const requestOptions = Object.assign(Object.assign({ cache: process.env.CACHE_STRATEGY || "no-store" }, options), { method });
45
43
  console.log(`Fetch Request: ${method} - ${apiURL} - ${JSON.stringify(requestOptions)}`);
46
44
  try {
47
45
  const response = yield fetch(apiURL.toString(), requestOptions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "description": "For helpers and hooks used in NextJS projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -38,7 +38,6 @@
38
38
  "nextemos"
39
39
  ],
40
40
  "dependencies": {
41
- "html-entities": "^2.5.2",
42
- "rc-config-loader": "^4.1.3"
41
+ "html-entities": "^2.5.2"
43
42
  }
44
43
  }
@@ -1,16 +0,0 @@
1
- export interface IConfig {
2
- cacheStrategy: "default" | "no-store" | "no-cache" | "force-cache" | "reload" | "only-if-cached";
3
- apiUrl: string | null;
4
- cdnUrl: string;
5
- videoCdnUrl: string | null;
6
- cdnProvider: string | null;
7
- thumborSource: string | null;
8
- }
9
- export declare const getConfig: () => {
10
- cacheStrategy: "default" | "no-store" | "no-cache" | "force-cache" | "reload" | "only-if-cached";
11
- apiUrl: string | null;
12
- cdnUrl: string;
13
- videoCdnUrl: string | null;
14
- cdnProvider: string | null;
15
- thumborSource: string | null;
16
- };
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getConfig = void 0;
4
- const path_1 = require("path");
5
- const rc_config_loader_1 = require("rc-config-loader");
6
- const defaultConfigs = {
7
- "cacheStrategy": "no-store",
8
- "apiUrl": null,
9
- "cdnUrl": "https://images.proj-e.com",
10
- "videoCdnUrl": null,
11
- "cdnProvider": "medianova",
12
- "thumborSource": null
13
- };
14
- function loadRcFile() {
15
- try {
16
- const results = (0, rc_config_loader_1.rcFile)("nextemos", {
17
- configFileName: (0, path_1.join)(process.cwd(), '.nextemosrc')
18
- });
19
- // Not Found
20
- if (!results) {
21
- return {};
22
- }
23
- return results.config;
24
- }
25
- catch (error) {
26
- console.log("ERRRR!!!!❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌", error);
27
- // Found it, but it is parsing error
28
- return {}; // default value
29
- }
30
- }
31
- // Config'i döndür
32
- const getConfig = () => {
33
- // load config
34
- const config = loadRcFile();
35
- return Object.assign(Object.assign({}, defaultConfigs), config);
36
- };
37
- exports.getConfig = getConfig;