@nestia/fetcher 1.3.3 → 1.3.5

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/lib/index.js CHANGED
@@ -1,23 +1,23 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./IConnection"), exports);
18
- __exportStar(require("./IEncryptionPassword"), exports);
19
- __exportStar(require("./Primitive"), exports);
20
- __exportStar(require("./AesPkcs5"), exports);
21
- __exportStar(require("./Fetcher"), exports);
22
- __exportStar(require("./HttpError"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./IConnection"), exports);
18
+ __exportStar(require("./IEncryptionPassword"), exports);
19
+ __exportStar(require("./Primitive"), exports);
20
+ __exportStar(require("./AesPkcs5"), exports);
21
+ __exportStar(require("./Fetcher"), exports);
22
+ __exportStar(require("./HttpError"), exports);
23
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,24 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Singleton = void 0;
4
- /**
5
- * @internal
6
- */
7
- var Singleton = /** @class */ (function () {
8
- function Singleton(closure_) {
9
- this.closure_ = closure_;
10
- this.value_ = NOT_MOUNTED_YET;
11
- }
12
- Singleton.prototype.get = function () {
13
- if (this.value_ === NOT_MOUNTED_YET)
14
- this.value_ = this.closure_();
15
- return this.value_;
16
- };
17
- return Singleton;
18
- }());
19
- exports.Singleton = Singleton;
20
- /**
21
- * @internal
22
- */
23
- var NOT_MOUNTED_YET = {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Singleton = void 0;
4
+ /**
5
+ * @internal
6
+ */
7
+ var Singleton = /** @class */ (function () {
8
+ function Singleton(closure_) {
9
+ this.closure_ = closure_;
10
+ this.value_ = NOT_MOUNTED_YET;
11
+ }
12
+ Singleton.prototype.get = function () {
13
+ if (this.value_ === NOT_MOUNTED_YET)
14
+ this.value_ = this.closure_();
15
+ return this.value_;
16
+ };
17
+ return Singleton;
18
+ }());
19
+ exports.Singleton = Singleton;
20
+ /**
21
+ * @internal
22
+ */
23
+ var NOT_MOUNTED_YET = {};
24
24
  //# sourceMappingURL=Singleton.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestia/fetcher",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "Fetcher library of Nestia SDK",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "@typescript-eslint/parser": "^5.46.1",
33
33
  "prettier": "^2.8.1",
34
34
  "rimraf": "^3.0.2",
35
- "typescript": "^4.9.4"
35
+ "typescript": "^5.1.3"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "typescript": ">= 4.7.4"
package/src/Fetcher.ts CHANGED
@@ -78,6 +78,7 @@ export class Fetcher {
78
78
  //----
79
79
  // METHOD & HEADERS
80
80
  const init: RequestInit = {
81
+ ...(connection.options ?? {}),
81
82
  method,
82
83
  headers:
83
84
  encrypted.request === false &&
@@ -14,6 +14,7 @@ import { IRandomGenerator } from "./IRandomGenerator";
14
14
  * or {@link IEncryptionPassword.Closure} variable.
15
15
  *
16
16
  * @author Jenogho Nam - https://github.com/samchon
17
+ * @author Seungjun We - https://github.com/SeungjunWe
17
18
  */
18
19
  export interface IConnection {
19
20
  /**
@@ -49,11 +50,88 @@ export interface IConnection {
49
50
  simulate?: boolean | Partial<IRandomGenerator>;
50
51
 
51
52
  /**
52
- * Use simulation mode.
53
+ * Additional options for the `fetch` function.
54
+ */
55
+ options?: IConnection.IOptions;
56
+ }
57
+ export namespace IConnection {
58
+ /**
59
+ * Addiotional options for the `fetch` function.
53
60
  *
54
- * @default false
55
- * @deprecated Use {@link simulate} property instead.
56
- * This property would be erased after v2.0 update
61
+ * Almost same with {@link RequestInit} type of the {@link fetch} function,
62
+ * but `body`, `headers` and `method` properties are omitted.
63
+ *
64
+ * The reason why defining duplicated definition of {@link RequestInit}
65
+ * is for legacy NodeJS environments, which does not have the {@link fetch}
66
+ * function type.
57
67
  */
58
- random?: boolean | Partial<IRandomGenerator>;
68
+ export interface IOptions {
69
+ /**
70
+ * A string indicating how the request will interact with the browser's
71
+ * cache to set request's cache.
72
+ */
73
+ cache?:
74
+ | "default"
75
+ | "force-cache"
76
+ | "no-cache"
77
+ | "no-store"
78
+ | "only-if-cached"
79
+ | "reload";
80
+
81
+ /**
82
+ * A string indicating whether credentials will be sent with the request
83
+ * always, never, or only when sent to a same-origin URL. Sets request's
84
+ * credentials.
85
+ */
86
+ credentials?: "omit" | "same-origin" | "include";
87
+
88
+ /**
89
+ * A cryptographic hash of the resource to be fetched by request.
90
+ *
91
+ * Sets request's integrity.
92
+ */
93
+ integrity?: string;
94
+
95
+ /**
96
+ * A boolean to set request's keepalive.
97
+ */
98
+ keepalive?: boolean;
99
+
100
+ /**
101
+ * A string to indicate whether the request will use CORS, or will be
102
+ * restricted to same-origin URLs.
103
+ *
104
+ * Sets request's mode.
105
+ */
106
+ mode?: "cors" | "navigate" | "no-cors" | "same-origin";
107
+
108
+ /**
109
+ * A string indicating whether request follows redirects, results in
110
+ * an error upon encountering a redirect, or returns the redirect
111
+ * (in an opaque fashion).
112
+ *
113
+ * Sets request's redirect.
114
+ */
115
+ redirect?: "error" | "follow" | "manual";
116
+
117
+ /**
118
+ * A string whose value is a same-origin URL, "about:client", or the
119
+ * empty string, to set request's referrer.
120
+ */
121
+ referrer?: string;
122
+
123
+ /**
124
+ * A referrer policy to set request's referrerPolicy.
125
+ */
126
+ referrerPolicy?:
127
+ | ""
128
+ | "no-referrer"
129
+ | "no-referrer-when-downgrade"
130
+ | "origin"
131
+ | "origin-when-cross-origin"
132
+ | "same-origin"
133
+ | "strict-origin"
134
+ | "strict-origin-when-cross-origin"
135
+ | "unsafe-url";
136
+ }
59
137
  }