@nestia/fetcher 10.0.2 → 11.0.0-dev.20260305

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.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +93 -93
  3. package/package.json +20 -13
  4. package/src/AesPkcs5.ts +41 -49
  5. package/src/EncryptedFetcher.ts +176 -176
  6. package/src/FormDataInput.ts +80 -80
  7. package/src/HttpError.ts +1 -1
  8. package/src/IConnection.ts +241 -241
  9. package/src/IEncryptionPassword.ts +44 -44
  10. package/src/IFetchEvent.ts +31 -31
  11. package/src/IFetchRoute.ts +60 -60
  12. package/src/IPropagation.ts +99 -99
  13. package/src/NestiaSimulator.ts +82 -82
  14. package/src/PlainFetcher.ts +105 -105
  15. package/src/index.ts +12 -7
  16. package/src/internal/FetcherBase.ts +235 -235
  17. package/lib/AesPkcs5.d.ts +0 -30
  18. package/lib/AesPkcs5.js +0 -49
  19. package/lib/AesPkcs5.js.map +0 -1
  20. package/lib/EncryptedFetcher.d.ts +0 -47
  21. package/lib/EncryptedFetcher.js +0 -139
  22. package/lib/EncryptedFetcher.js.map +0 -1
  23. package/lib/FormDataInput.d.ts +0 -70
  24. package/lib/FormDataInput.js +0 -3
  25. package/lib/FormDataInput.js.map +0 -1
  26. package/lib/HttpError.d.ts +0 -1
  27. package/lib/HttpError.js +0 -6
  28. package/lib/HttpError.js.map +0 -1
  29. package/lib/IConnection.d.ts +0 -165
  30. package/lib/IConnection.js +0 -3
  31. package/lib/IConnection.js.map +0 -1
  32. package/lib/IEncryptionPassword.d.ts +0 -41
  33. package/lib/IEncryptionPassword.js +0 -3
  34. package/lib/IEncryptionPassword.js.map +0 -1
  35. package/lib/IFetchEvent.d.ts +0 -11
  36. package/lib/IFetchEvent.js +0 -21
  37. package/lib/IFetchEvent.js.map +0 -1
  38. package/lib/IFetchRoute.d.ts +0 -46
  39. package/lib/IFetchRoute.js +0 -3
  40. package/lib/IFetchRoute.js.map +0 -1
  41. package/lib/IPropagation.d.ts +0 -69
  42. package/lib/IPropagation.js +0 -3
  43. package/lib/IPropagation.js.map +0 -1
  44. package/lib/MigrateFetcher.d.ts +0 -19
  45. package/lib/MigrateFetcher.js +0 -179
  46. package/lib/MigrateFetcher.js.map +0 -1
  47. package/lib/NestiaSimulator.d.ts +0 -13
  48. package/lib/NestiaSimulator.js +0 -62
  49. package/lib/NestiaSimulator.js.map +0 -1
  50. package/lib/PlainFetcher.d.ts +0 -46
  51. package/lib/PlainFetcher.js +0 -89
  52. package/lib/PlainFetcher.js.map +0 -1
  53. package/lib/index.d.ts +0 -7
  54. package/lib/index.js +0 -24
  55. package/lib/index.js.map +0 -1
  56. package/lib/internal/FetcherBase.d.ts +0 -1
  57. package/lib/internal/FetcherBase.js +0 -348
  58. package/lib/internal/FetcherBase.js.map +0 -1
  59. package/src/MigrateFetcher.ts +0 -118
@@ -1,19 +0,0 @@
1
- import { IHttpMigrateRoute } from "@samchon/openapi";
2
- import { IConnection } from "./IConnection";
3
- import { IPropagation } from "./IPropagation";
4
- /**
5
- * Use `HttpMigration.execute()` function of `@samchon/openapi` instead.
6
- *
7
- * This module would be removed in the next major update.
8
- *
9
- * @deprecated
10
- */
11
- export declare namespace MigrateFetcher {
12
- interface IProps {
13
- route: IHttpMigrateRoute;
14
- connection: IConnection;
15
- arguments: any[];
16
- }
17
- function request(props: IProps): Promise<any>;
18
- function propagate(props: IProps): Promise<IPropagation.IBranch<boolean, number, any>>;
19
- }
@@ -1,179 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __values = (this && this.__values) || function(o) {
39
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
40
- if (m) return m.call(o);
41
- if (o && typeof o.length === "number") return {
42
- next: function () {
43
- if (o && i >= o.length) o = void 0;
44
- return { value: o && o[i++], done: !o };
45
- }
46
- };
47
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
48
- };
49
- var __read = (this && this.__read) || function (o, n) {
50
- var m = typeof Symbol === "function" && o[Symbol.iterator];
51
- if (!m) return o;
52
- var i = m.call(o), r, ar = [], e;
53
- try {
54
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
55
- }
56
- catch (error) { e = { error: error }; }
57
- finally {
58
- try {
59
- if (r && !r.done && (m = i["return"])) m.call(i);
60
- }
61
- finally { if (e) throw e.error; }
62
- }
63
- return ar;
64
- };
65
- Object.defineProperty(exports, "__esModule", { value: true });
66
- exports.MigrateFetcher = void 0;
67
- var PlainFetcher_1 = require("./PlainFetcher");
68
- /**
69
- * Use `HttpMigration.execute()` function of `@samchon/openapi` instead.
70
- *
71
- * This module would be removed in the next major update.
72
- *
73
- * @deprecated
74
- */
75
- var MigrateFetcher;
76
- (function (MigrateFetcher) {
77
- function request(props) {
78
- return __awaiter(this, void 0, void 0, function () {
79
- var length;
80
- var _a, _b, _c, _d;
81
- return __generator(this, function (_e) {
82
- length = props.route.parameters.length +
83
- (props.route.query ? 1 : 0) +
84
- (props.route.body ? 1 : 0);
85
- if (props.arguments.length !== length)
86
- throw new Error("Error on MigrateFetcher.request(): arguments length is not matched with the route (expected: ".concat(length, ", actual: ").concat(props.arguments.length, ")."));
87
- else if (((_a = props.route.body) === null || _a === void 0 ? void 0 : _a["x-nestia-encrypted"]) === true ||
88
- ((_b = props.route.success) === null || _b === void 0 ? void 0 : _b["x-nestia-encrypted"]) === true)
89
- throw new Error("Error on MigrateFetcher.request(): encrypted API is not supported yet.");
90
- return [2 /*return*/, PlainFetcher_1.PlainFetcher.fetch(props.connection, {
91
- method: props.route.method.toUpperCase(),
92
- path: getPath(props),
93
- template: props.route.path,
94
- status: null,
95
- request: props.route.body
96
- ? {
97
- encrypted: false,
98
- type: props.route.body.type,
99
- }
100
- : null,
101
- response: {
102
- encrypted: false,
103
- type: (_d = (_c = props.route.success) === null || _c === void 0 ? void 0 : _c.type) !== null && _d !== void 0 ? _d : "application/json",
104
- },
105
- }, props.route.body ? props.arguments.at(-1) : undefined)];
106
- });
107
- });
108
- }
109
- MigrateFetcher.request = request;
110
- function propagate(props) {
111
- return __awaiter(this, void 0, void 0, function () {
112
- var length;
113
- var _a, _b, _c, _d;
114
- return __generator(this, function (_e) {
115
- length = props.route.parameters.length +
116
- (props.route.query ? 1 : 0) +
117
- (props.route.body ? 1 : 0);
118
- if (props.arguments.length !== length)
119
- throw new Error("Error on MigrateFetcher.propagate(): arguments length is not matched with the route (expected: ".concat(length, ", actual: ").concat(props.arguments.length, ")."));
120
- else if (((_a = props.route.body) === null || _a === void 0 ? void 0 : _a["x-nestia-encrypted"]) === true ||
121
- ((_b = props.route.success) === null || _b === void 0 ? void 0 : _b["x-nestia-encrypted"]) === true)
122
- throw new Error("Error on MigrateFetcher.propagate(): encrypted API is not supported yet.");
123
- return [2 /*return*/, PlainFetcher_1.PlainFetcher.propagate(props.connection, {
124
- method: props.route.method.toUpperCase(),
125
- path: getPath(props),
126
- template: props.route.path,
127
- status: null,
128
- request: props.route.body
129
- ? {
130
- encrypted: false,
131
- type: props.route.body.type,
132
- }
133
- : null,
134
- response: {
135
- encrypted: false,
136
- type: (_d = (_c = props.route.success) === null || _c === void 0 ? void 0 : _c.type) !== null && _d !== void 0 ? _d : "application/json",
137
- },
138
- }, props.route.body ? props.arguments.at(-1) : undefined)];
139
- });
140
- });
141
- }
142
- MigrateFetcher.propagate = propagate;
143
- function getPath(props) {
144
- var path = props.route.emendedPath;
145
- props.route.parameters.forEach(function (p, i) {
146
- path = path.replace(":".concat(p.key), props.arguments[i]);
147
- });
148
- if (props.route.query)
149
- path += getQueryPath(props.arguments[props.route.parameters.length]);
150
- return path;
151
- }
152
- function getQueryPath(query) {
153
- var e_1, _a;
154
- var variables = new URLSearchParams();
155
- var _loop_1 = function (key, value) {
156
- if (undefined === value)
157
- return "continue";
158
- else if (Array.isArray(value))
159
- value.forEach(function (elem) { return variables.append(key, String(elem)); });
160
- else
161
- variables.set(key, String(value));
162
- };
163
- try {
164
- for (var _b = __values(Object.entries(query)), _c = _b.next(); !_c.done; _c = _b.next()) {
165
- var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
166
- _loop_1(key, value);
167
- }
168
- }
169
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
170
- finally {
171
- try {
172
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
173
- }
174
- finally { if (e_1) throw e_1.error; }
175
- }
176
- return 0 === variables.size ? "" : "?".concat(variables.toString());
177
- }
178
- })(MigrateFetcher || (exports.MigrateFetcher = MigrateFetcher = {}));
179
- //# sourceMappingURL=MigrateFetcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MigrateFetcher.js","sourceRoot":"","sources":["../src/MigrateFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,+CAA8C;AAE9C;;;;;;GAMG;AACH,IAAiB,cAAc,CAwG9B;AAxGD,WAAiB,cAAc;IAO7B,SAAsB,OAAO,CAAC,KAAa;;;;;gBACnC,MAAM,GACV,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM;oBAC7B,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC3B,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC7B,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,KAAK,MAAM;oBACnC,MAAM,IAAI,KAAK,CACb,uGAAgG,MAAM,uBAAa,KAAK,CAAC,SAAS,CAAC,MAAM,OAAI,CAC9I,CAAC;qBACC,IACH,C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Ac,8BAAd,cAAc,QAwG9B"}
@@ -1,13 +0,0 @@
1
- export declare namespace NestiaSimulator {
2
- interface IProps {
3
- host: string;
4
- path: string;
5
- method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
6
- contentType: string;
7
- }
8
- const assert: (props: IProps) => {
9
- param: (name: string) => <T>(task: () => T) => void;
10
- query: <T>(task: () => T) => void;
11
- body: <T>(task: () => T) => void;
12
- };
13
- }
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NestiaSimulator = void 0;
4
- var HttpError_1 = require("./HttpError");
5
- var NestiaSimulator;
6
- (function (NestiaSimulator) {
7
- NestiaSimulator.assert = function (props) {
8
- return {
9
- param: param(props),
10
- query: query(props),
11
- body: body(props),
12
- };
13
- };
14
- var param = function (props) {
15
- return function (name) {
16
- return function (task) {
17
- validate(function (exp) { return "URL parameter \"".concat(name, "\" is not ").concat(exp.expected, " type."); })(props)(task);
18
- };
19
- };
20
- };
21
- var query = function (props) {
22
- return function (task) {
23
- return validate(function () { return "Request query parameters are not following the promised type."; })(props)(task);
24
- };
25
- };
26
- var body = function (props) {
27
- return function (task) {
28
- return validate(function () { return "Request body is not following the promised type."; })(props)(task);
29
- };
30
- };
31
- var validate = function (message, path) {
32
- return function (props) {
33
- return function (task) {
34
- try {
35
- task();
36
- }
37
- catch (exp) {
38
- if (isTypeGuardError(exp))
39
- throw new HttpError_1.HttpError(props.method, props.host + props.path, 400, {
40
- "Content-Type": props.contentType,
41
- }, JSON.stringify({
42
- method: exp.method,
43
- path: path !== null && path !== void 0 ? path : exp.path,
44
- expected: exp.expected,
45
- value: exp.value,
46
- message: message(exp),
47
- }));
48
- throw exp;
49
- }
50
- };
51
- };
52
- };
53
- })(NestiaSimulator || (exports.NestiaSimulator = NestiaSimulator = {}));
54
- var isTypeGuardError = function (input) {
55
- return "string" === typeof input.method &&
56
- (undefined === input.path || "string" === typeof input.path) &&
57
- "string" === typeof input.expected &&
58
- "string" === typeof input.name &&
59
- "string" === typeof input.message &&
60
- (undefined === input.stack || "string" === typeof input.stack);
61
- };
62
- //# sourceMappingURL=NestiaSimulator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NestiaSimulator.js","sourceRoot":"","sources":["../src/NestiaSimulator.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AAExC,IAAiB,eAAe,CAgE/B;AAhED,WAAiB,eAAe;IAQjB,sBAAM,GAAG,UAAC,KAAa;QAClC,OAAO;YACL,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;YACnB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;YACnB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC;SAClB,CAAC;IACJ,CAAC,CAAC;IACF,IAAM,KAAK,GACT,UAAC,KAAa;QACd,OAAA,UAAC,IAAY;YACb,OAAA,UAAI,IAAa;gBACf,QAAQ,CAAC,UAAC,GAAG,IAAK,OAAA,0BAAkB,IAAI,uBAAY,GAAG,CAAC,QAAQ,WAAQ,EAAtD,CAAsD,CAAC,CACvE,KAAK,CACN,CAAC,IAAI,CAAC,CAAC;YACV,CAAC;QAJD,CAIC;IALD,CAKC,CAAC;IAEJ,IAAM,KAAK,GACT,UAAC,KAAa;QACd,OAAA,UAAI,IAAa;YACf,OAAA,QAAQ,CACN,cAAM,OAAA,+DAA+D,EAA/D,CAA+D,CACtE,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;QAFd,CAEc;IAHhB,CAGgB,CAAC;IAEnB,IAAM,IAAI,GACR,UAAC,KAAa;QACd,OAAA,UAAI,IAAa;YACf,OAAA,QAAQ,CAAC,cAAM,OAAA,kDAAkD,EAAlD,CAAkD,CAAC,CAAC,KAAK,CAAC,CACvE,IAAI,CACL;QAFD,CAEC;IAHH,CAGG,CAAC;IAEN,IAAM,QAAQ,GACZ,UAAC,OAAwC,EAAE,IAAa;QACxD,OAAA,UAAC,KAAa;YACd,OAAA,UAAI,IAAa;gBACf,IAAI,CAAC;oBACH,IAAI,EAAE,CAAC;gBACT,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,IAAI,gBAAgB,CAAC,GAAG,CAAC;wBACvB,MAAM,IAAI,qBAAS,CACjB,KAAK,CAAC,MAAM,EACZ,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,EACvB,GAAG,EACH;4BACE,cAAc,EAAE,KAAK,CAAC,WAAW;yBAClC,EACD,IAAI,CAAC,SAAS,CAAC;4BACb,MAAM,EAAE,GAAG,CAAC,MAAM;4BAClB,IAAI,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,GAAG,CAAC,IAAI;4BACtB,QAAQ,EAAE,GAAG,CAAC,QAAQ;4BACtB,KAAK,EAAE,GAAG,CAAC,KAAK;4BAChB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC;yBACtB,CAAC,CACH,CAAC;oBACJ,MAAM,GAAG,CAAC;gBACZ,CAAC;YACH,CAAC;QAtBD,CAsBC;IAvBD,CAuBC,CAAC;AACN,CAAC,EAhEgB,eAAe,+BAAf,eAAe,QAgE/B;AAED,IAAM,gBAAgB,GAAG,UAAC,KAAU;IAClC,OAAA,QAAQ,KAAK,OAAO,KAAK,CAAC,MAAM;QAChC,CAAC,SAAS,KAAK,KAAK,CAAC,IAAI,IAAI,QAAQ,KAAK,OAAO,KAAK,CAAC,IAAI,CAAC;QAC5D,QAAQ,KAAK,OAAO,KAAK,CAAC,QAAQ;QAClC,QAAQ,KAAK,OAAO,KAAK,CAAC,IAAI;QAC9B,QAAQ,KAAK,OAAO,KAAK,CAAC,OAAO;QACjC,CAAC,SAAS,KAAK,KAAK,CAAC,KAAK,IAAI,QAAQ,KAAK,OAAO,KAAK,CAAC,KAAK,CAAC;AAL9D,CAK8D,CAAC"}
@@ -1,46 +0,0 @@
1
- import { IConnection } from "./IConnection";
2
- import { IFetchRoute } from "./IFetchRoute";
3
- import { IPropagation } from "./IPropagation";
4
- /**
5
- * Utility class for `fetch` functions used in `@nestia/sdk`.
6
- *
7
- * `PlainFetcher` is a utility class designed for SDK functions generated by
8
- * [`@nestia/sdk`](https://nestia.io/docs/sdk/sdk), interacting with the remote
9
- * HTTP sever API. In other words, this is a collection of dedicated `fetch()`
10
- * functions for `@nestia/sdk`.
11
- *
12
- * For reference, `PlainFetcher` class does not encrypt or decrypt the body data
13
- * at all. It just delivers plain data without any post processing. If you've
14
- * defined a controller method through `@EncryptedRoute` or `@EncryptedBody`
15
- * decorator, then {@liink EncryptedFetcher} class would be used instead.
16
- *
17
- * @author Jeongho Nam - https://github.com/samchon
18
- */
19
- export declare namespace PlainFetcher {
20
- /**
21
- * Fetch function only for `HEAD` method.
22
- *
23
- * @param connection Connection information for the remote HTTP server
24
- * @param route Route information about the target API
25
- * @returns Nothing because of `HEAD` method
26
- */
27
- function fetch(connection: IConnection, route: IFetchRoute<"HEAD">): Promise<void>;
28
- /**
29
- * Fetch function only for `GET` method.
30
- *
31
- * @param connection Connection information for the remote HTTP server
32
- * @param route Route information about the target API
33
- * @returns Response body data from the remote API
34
- */
35
- function fetch<Output>(connection: IConnection, route: IFetchRoute<"GET">): Promise<Output>;
36
- /**
37
- * Fetch function for the `POST`, `PUT`, `PATCH` and `DELETE` methods.
38
- *
39
- * @param connection Connection information for the remote HTTP server
40
- * @param route Route information about the target API
41
- * @returns Response body data from the remote API
42
- */
43
- function fetch<Input, Output>(connection: IConnection, route: IFetchRoute<"POST" | "PUT" | "PATCH" | "DELETE">, input?: Input, stringify?: (input: Input) => string): Promise<Output>;
44
- function propagate<Output extends IPropagation<any, any>>(connection: IConnection, route: IFetchRoute<"GET" | "HEAD">): Promise<Output>;
45
- function propagate<Input, Output extends IPropagation<any, any>>(connection: IConnection, route: IFetchRoute<"DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT">, input?: Input, stringify?: (input: Input) => string): Promise<Output>;
46
- }
@@ -1,89 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.PlainFetcher = void 0;
40
- var FetcherBase_1 = require("./internal/FetcherBase");
41
- /**
42
- * Utility class for `fetch` functions used in `@nestia/sdk`.
43
- *
44
- * `PlainFetcher` is a utility class designed for SDK functions generated by
45
- * [`@nestia/sdk`](https://nestia.io/docs/sdk/sdk), interacting with the remote
46
- * HTTP sever API. In other words, this is a collection of dedicated `fetch()`
47
- * functions for `@nestia/sdk`.
48
- *
49
- * For reference, `PlainFetcher` class does not encrypt or decrypt the body data
50
- * at all. It just delivers plain data without any post processing. If you've
51
- * defined a controller method through `@EncryptedRoute` or `@EncryptedBody`
52
- * decorator, then {@liink EncryptedFetcher} class would be used instead.
53
- *
54
- * @author Jeongho Nam - https://github.com/samchon
55
- */
56
- var PlainFetcher;
57
- (function (PlainFetcher) {
58
- function fetch(connection, route, input, stringify) {
59
- return __awaiter(this, void 0, void 0, function () {
60
- var _a, _b;
61
- return __generator(this, function (_c) {
62
- if (((_a = route.request) === null || _a === void 0 ? void 0 : _a.encrypted) === true || ((_b = route.response) === null || _b === void 0 ? void 0 : _b.encrypted) === true)
63
- throw new Error("Error on PlainFetcher.fetch(): PlainFetcher doesn't have encryption ability. Use EncryptedFetcher instead.");
64
- return [2 /*return*/, FetcherBase_1.FetcherBase.request({
65
- className: "PlainFetcher",
66
- encode: function (input) { return input; },
67
- decode: function (input) { return input; },
68
- })(connection, route, input, stringify)];
69
- });
70
- });
71
- }
72
- PlainFetcher.fetch = fetch;
73
- function propagate(connection, route, input, stringify) {
74
- return __awaiter(this, void 0, void 0, function () {
75
- var _a, _b;
76
- return __generator(this, function (_c) {
77
- if (((_a = route.request) === null || _a === void 0 ? void 0 : _a.encrypted) === true || ((_b = route.response) === null || _b === void 0 ? void 0 : _b.encrypted) === true)
78
- throw new Error("Error on PlainFetcher.propagate(): PlainFetcher doesn't have encryption ability. Use EncryptedFetcher instead.");
79
- return [2 /*return*/, FetcherBase_1.FetcherBase.propagate({
80
- className: "PlainFetcher",
81
- encode: function (input) { return input; },
82
- decode: function (input) { return input; },
83
- })(connection, route, input, stringify)];
84
- });
85
- });
86
- }
87
- PlainFetcher.propagate = propagate;
88
- })(PlainFetcher || (exports.PlainFetcher = PlainFetcher = {}));
89
- //# sourceMappingURL=PlainFetcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlainFetcher.js","sourceRoot":"","sources":["../src/PlainFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,sDAAqD;AAErD;;;;;;;;;;;;;;GAcG;AACH,IAAiB,YAAY,CAoF5B;AApFD,WAAiB,YAAY;IAuC3B,SAAsB,KAAK,CACzB,UAAuB,EACvB,KAAwE,EACxE,KAAa,EACb,SAAoC;;;;gBAEpC,IAAI,CAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,SAAS,MAAK,IAAI,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,SAAS,MAAK,IAAI;oBACzE,MAAM,IAAI,KAAK,CACb,4GAA4G,CAC7G,CAAC;gBACJ,sBAAO,yBAAW,CAAC,OAAO,CAAC;wBACzB,SAAS,EAAE,cAAc;wBACzB,MAAM,EAAE,UAAC,KAAK,IAAK,OAAA,KAAK,EAAL,CAAK;wBACxB,MAAM,EAAE,UAAC,KAAK,IAAK,OAAA,KAAK,EAAL,CAAK;qBACzB,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,EAAC;;;KACzC;IAfqB,kBAAK,QAe1B,CAAA;IAcD,SAAsB,SAAS,CAC7B,UAAuB,EACvB,KAAwE,EACxE,KAAa,EACb,SAAoC;;;;gBAEpC,IAAI,CAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,SAAS,MAAK,IAAI,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,SAAS,MAAK,IAAI;oBACzE,MAAM,IAAI,KAAK,CACb,gHAAgH,CACjH,CAAC;gBACJ,sBAAO,yBAAW,CAAC,SAAS,CAAC;wBAC3B,SAAS,EAAE,cAAc;wBACzB,MAAM,EAAE,UAAC,KAAK,IAAK,OAAA,KAAK,EAAL,CAAK;wBACxB,MAAM,EAAE,UAAC,KAAK,IAAK,OAAA,KAAK,EAAL,CAAK;qBACzB,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAoB,EAAC;;;KAC5D;IAfqB,sBAAS,YAe9B,CAAA;AACH,CAAC,EApFgB,YAAY,4BAAZ,YAAY,QAoF5B"}
package/lib/index.d.ts DELETED
@@ -1,7 +0,0 @@
1
- export * from "./FormDataInput";
2
- export * from "./HttpError";
3
- export * from "./IConnection";
4
- export * from "./IEncryptionPassword";
5
- export * from "./IFetchEvent";
6
- export * from "./IFetchRoute";
7
- export * from "./IPropagation";
package/lib/index.js DELETED
@@ -1,24 +0,0 @@
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("./FormDataInput"), exports);
18
- __exportStar(require("./HttpError"), exports);
19
- __exportStar(require("./IConnection"), exports);
20
- __exportStar(require("./IEncryptionPassword"), exports);
21
- __exportStar(require("./IFetchEvent"), exports);
22
- __exportStar(require("./IFetchRoute"), exports);
23
- __exportStar(require("./IPropagation"), exports);
24
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,8CAA4B;AAC5B,gDAA8B;AAC9B,wDAAsC;AACtC,gDAA8B;AAC9B,gDAA8B;AAC9B,iDAA+B"}
@@ -1 +0,0 @@
1
- export {};