@mountainpass/waychaser 5.0.47 → 5.0.48
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/README.md +1 -1
- package/dist/augment-options.js +20 -57
- package/dist/augment-options.js.map +1 -1
- package/dist/expand-operation.js +18 -53
- package/dist/expand-operation.js.map +1 -1
- package/dist/handlers/hal/de-curie.js +6 -25
- package/dist/handlers/hal/de-curie.js.map +1 -1
- package/dist/handlers/hal/hal-handler.js +16 -65
- package/dist/handlers/hal/hal-handler.js.map +1 -1
- package/dist/handlers/hal/map-hal-link-to-operation.js +5 -30
- package/dist/handlers/hal/map-hal-link-to-operation.js.map +1 -1
- package/dist/handlers/link-header/link-header-handler.js +20 -63
- package/dist/handlers/link-header/link-header-handler.js.map +1 -1
- package/dist/handlers/location-header/location-header-handler.js +4 -7
- package/dist/handlers/location-header/location-header-handler.js.map +1 -1
- package/dist/handlers/siren/map-siren-action-to-operation.js +12 -53
- package/dist/handlers/siren/map-siren-action-to-operation.js.map +1 -1
- package/dist/handlers/siren/map-siren-link-to-operation.js +4 -29
- package/dist/handlers/siren/map-siren-link-to-operation.js.map +1 -1
- package/dist/handlers/siren/siren-action-handler.js +7 -32
- package/dist/handlers/siren/siren-action-handler.js.map +1 -1
- package/dist/handlers/siren/siren-handler.js +10 -39
- package/dist/handlers/siren/siren-handler.js.map +1 -1
- package/dist/handlers/siren/siren-link-handler.js +8 -43
- package/dist/handlers/siren/siren-link-handler.js.map +1 -1
- package/dist/operation-array.d.ts +1 -0
- package/dist/operation-array.js +27 -70
- package/dist/operation-array.js.map +1 -1
- package/dist/operation.js +128 -272
- package/dist/operation.js.map +1 -1
- package/dist/src/augment-options.d.ts +30 -0
- package/dist/src/expand-operation.d.ts +5 -0
- package/dist/src/handlers/hal/de-curie.d.ts +9 -0
- package/dist/src/handlers/hal/hal-handler.d.ts +6 -0
- package/dist/src/handlers/hal/map-hal-link-to-operation.d.ts +7 -0
- package/dist/src/handlers/link-header/link-header-handler.d.ts +7 -0
- package/dist/src/handlers/location-header/location-header-handler.d.ts +5 -0
- package/dist/src/handlers/siren/map-siren-action-to-operation.d.ts +6 -0
- package/dist/src/handlers/siren/map-siren-link-to-operation.d.ts +13 -0
- package/dist/src/handlers/siren/siren-action-handler.d.ts +5 -0
- package/dist/src/handlers/siren/siren-handler.d.ts +6 -0
- package/dist/src/handlers/siren/siren-link-handler.d.ts +6 -0
- package/dist/src/operation-array.d.ts +13 -0
- package/dist/src/operation.d.ts +24 -0
- package/dist/src/util/media-types.d.ts +5 -0
- package/dist/src/util/method-can-have-body.d.ts +4 -0
- package/dist/src/util/parse-accept.d.ts +6 -0
- package/dist/src/util/parse-operations.d.ts +14 -0
- package/dist/src/util/preferred-content-type.d.ts +6 -0
- package/dist/src/util/uri-template-lite.d.ts +5 -0
- package/dist/src/waychaser.d.ts +131 -0
- package/dist/util/media-types.js +2 -4
- package/dist/util/media-types.js.map +1 -1
- package/dist/util/method-can-have-body.js +1 -4
- package/dist/util/method-can-have-body.js.map +1 -1
- package/dist/util/parse-accept.js +17 -42
- package/dist/util/parse-accept.js.map +1 -1
- package/dist/util/parse-operations.js +22 -78
- package/dist/util/parse-operations.js.map +1 -1
- package/dist/util/preferred-content-type.js +4 -7
- package/dist/util/preferred-content-type.js.map +1 -1
- package/dist/util/uri-template-lite.js +6 -42
- package/dist/util/uri-template-lite.js.map +1 -1
- package/dist/waychaser.es.js +475 -922
- package/dist/waychaser.es.min.js +1 -1
- package/dist/waychaser.js +212 -480
- package/dist/waychaser.js.map +1 -1
- package/package.json +2 -2
package/dist/operation.js
CHANGED
|
@@ -1,119 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
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);
|
|
28
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
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;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
54
|
-
var t = {};
|
|
55
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
56
|
-
t[p] = s[p];
|
|
57
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
58
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
59
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
60
|
-
t[p[i]] = s[p[i]];
|
|
61
|
-
}
|
|
62
|
-
return t;
|
|
63
|
-
};
|
|
64
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
65
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
66
|
-
if (!m) return o;
|
|
67
|
-
var i = m.call(o), r, ar = [], e;
|
|
68
|
-
try {
|
|
69
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
70
|
-
}
|
|
71
|
-
catch (error) { e = { error: error }; }
|
|
72
|
-
finally {
|
|
73
|
-
try {
|
|
74
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
75
|
-
}
|
|
76
|
-
finally { if (e) throw e.error; }
|
|
77
|
-
}
|
|
78
|
-
return ar;
|
|
79
|
-
};
|
|
80
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
81
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
82
|
-
if (ar || !(i in from)) {
|
|
83
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
84
|
-
ar[i] = from[i];
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
88
|
-
};
|
|
89
|
-
var __values = (this && this.__values) || function(o) {
|
|
90
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
91
|
-
if (m) return m.call(o);
|
|
92
|
-
if (o && typeof o.length === "number") return {
|
|
93
|
-
next: function () {
|
|
94
|
-
if (o && i >= o.length) o = void 0;
|
|
95
|
-
return { value: o && o[i++], done: !o };
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
99
|
-
};
|
|
100
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
101
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
102
|
-
};
|
|
103
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
104
|
-
exports.InvocableOperation = exports.Operation = void 0;
|
|
105
|
-
var uri_template_lite_1 = require("./util/uri-template-lite");
|
|
106
|
-
var qs_stringify_1 = __importDefault(require("qs-stringify"));
|
|
107
|
-
var form_data_1 = __importDefault(require("form-data"));
|
|
108
|
-
var preferred_content_type_1 = require("./util/preferred-content-type");
|
|
109
|
-
var flat_1 = require("flat");
|
|
110
|
-
var waychaser_1 = require("./waychaser");
|
|
111
|
-
var jsonpointer_1 = __importDefault(require("jsonpointer"));
|
|
112
|
-
var method_can_have_body_1 = require("./util/method-can-have-body");
|
|
113
|
-
var problem_document_1 = require("@mountainpass/problem-document");
|
|
114
|
-
var Operation = /** @class */ (function () {
|
|
115
|
-
function Operation(_a) {
|
|
116
|
-
var rel = _a.rel, uri = _a.uri, method = _a.method, parameters = _a.parameters, accept = _a.accept, anchor = _a.anchor, otherProperties = __rest(_a, ["rel", "uri", "method", "parameters", "accept", "anchor"]);
|
|
1
|
+
import { URI } from './util/uri-template-lite';
|
|
2
|
+
import qsStringify from 'qs-stringify';
|
|
3
|
+
import FormData from 'form-data';
|
|
4
|
+
import { preferredContentType } from './util/preferred-content-type';
|
|
5
|
+
import { flatten } from 'flat';
|
|
6
|
+
import { _waychaser, WayChaserResponse, WayChaserProblem, isValidationSuccess } from './waychaser';
|
|
7
|
+
import pointer from 'jsonpointer';
|
|
8
|
+
import { methodCanHaveBody } from './util/method-can-have-body';
|
|
9
|
+
import { ProblemDocument } from '@mountainpass/problem-document';
|
|
10
|
+
export class Operation {
|
|
11
|
+
constructor({ rel, uri, method, parameters, accept, anchor, ...otherProperties }) {
|
|
117
12
|
this.rel = rel;
|
|
118
13
|
this.uri = uri;
|
|
119
14
|
this.method = method;
|
|
@@ -122,205 +17,166 @@ var Operation = /** @class */ (function () {
|
|
|
122
17
|
this.anchor = anchor;
|
|
123
18
|
Object.assign(this, otherProperties);
|
|
124
19
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
_this.defaultOptions = defaultOptions;
|
|
134
|
-
if (_this.uri.includes('{this.')) {
|
|
135
|
-
_this.uri = uri_template_lite_1.URI.expand(_this.uri, thisContext);
|
|
20
|
+
}
|
|
21
|
+
export class InvocableOperation extends Operation {
|
|
22
|
+
constructor(operation, response, defaultOptions, thisContext) {
|
|
23
|
+
super(operation);
|
|
24
|
+
this.response = response;
|
|
25
|
+
this.defaultOptions = defaultOptions;
|
|
26
|
+
if (this.uri.includes('{this.')) {
|
|
27
|
+
this.uri = URI.expand(this.uri, thisContext);
|
|
136
28
|
}
|
|
137
|
-
return _this;
|
|
138
29
|
// const pathParameters = URI.parameters(operation.uri)
|
|
139
30
|
// for (const key in pathParameters) {
|
|
140
31
|
// this.parameters[key] = {}
|
|
141
32
|
// }
|
|
142
33
|
}
|
|
143
|
-
|
|
34
|
+
invokeAsFragment(parameters, validator) {
|
|
144
35
|
if (this.uri.startsWith('#/')) {
|
|
145
|
-
|
|
146
|
-
|
|
36
|
+
const anchor = this.expandUrl(parameters).toString();
|
|
37
|
+
const fragmentContent = this.response.fullContent && pointer.get(this.response.fullContent, anchor.slice(1));
|
|
147
38
|
if (fragmentContent === undefined) {
|
|
148
39
|
return undefined;
|
|
149
40
|
}
|
|
150
41
|
if (validator) {
|
|
151
|
-
|
|
152
|
-
if (
|
|
153
|
-
return new
|
|
42
|
+
const validationResult = validator(fragmentContent);
|
|
43
|
+
if (isValidationSuccess(validationResult)) {
|
|
44
|
+
return new WayChaserResponse({ defaultOptions: this.defaultOptions, baseResponse: this.response.response, content: validationResult.content, fullContent: this.response.fullContent, anchor, parentOperations: this.response.allOperations, parameters });
|
|
154
45
|
}
|
|
155
46
|
else {
|
|
156
|
-
throw new
|
|
47
|
+
throw new WayChaserProblem({
|
|
157
48
|
problem: validationResult.problem,
|
|
158
|
-
response: new
|
|
49
|
+
response: new WayChaserResponse({ defaultOptions: this.defaultOptions, baseResponse: this.response.response, content: fragmentContent, fullContent: this.response.fullContent, parameters })
|
|
159
50
|
});
|
|
160
51
|
}
|
|
161
52
|
}
|
|
162
53
|
else {
|
|
163
|
-
return new
|
|
54
|
+
return new WayChaserResponse({ defaultOptions: this.defaultOptions, baseResponse: this.response.response, content: fragmentContent, fullContent: this.response.fullContent, anchor, parentOperations: this.response.allOperations, parameters });
|
|
164
55
|
}
|
|
165
56
|
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
return
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
return [2 /*return*/];
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
};
|
|
182
|
-
InvocableOperation.prototype.doInvokeAll = function (parameters, validator) {
|
|
183
|
-
var _this = this;
|
|
184
|
-
var response = this.response;
|
|
57
|
+
}
|
|
58
|
+
async invokeAll(options) {
|
|
59
|
+
if (this.uri.startsWith('#/') && this.response instanceof WayChaserResponse) {
|
|
60
|
+
const result = this.doInvokeAll(options?.parameters || {});
|
|
61
|
+
return Promise.all(result);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
return this.invoke(options).then(result => [result]);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
doInvokeAll(parameters, validator) {
|
|
68
|
+
const response = this.response;
|
|
185
69
|
// expand the URI with whatever parameters have been passed in
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
70
|
+
const template = new URI.Template(this.uri);
|
|
71
|
+
const uriParameters = Object.assign(URI.parameters(this.uri), parameters);
|
|
72
|
+
const currentUri = template.expand(uriParameters).replaceAll('%7B', "{").replaceAll('%7D', "}");
|
|
189
73
|
// get unfilled parameters
|
|
190
|
-
|
|
191
|
-
|
|
74
|
+
const currentUriParameters = URI.parameters(currentUri);
|
|
75
|
+
const keys = Object.keys(currentUriParameters);
|
|
192
76
|
if (keys.length === 0) {
|
|
193
77
|
return [this.invokeAsFragment(parameters, validator)];
|
|
194
78
|
}
|
|
195
79
|
else {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (
|
|
200
|
-
|
|
201
|
-
return indices.flatMap(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return _this.doInvokeAll(extendedParameters, validator);
|
|
80
|
+
const field = currentUriParameters[keys[0]];
|
|
81
|
+
const parentUri = currentUri.slice(1, currentUri.indexOf(field) - 1);
|
|
82
|
+
const parent = parentUri === '' ? response.content : pointer.get(response.content, parentUri);
|
|
83
|
+
if (parent) {
|
|
84
|
+
const indices = Array.isArray(parent) ? [...Array.from({ length: parent.length }).keys()] : Object.keys(parent);
|
|
85
|
+
return indices.flatMap(index => {
|
|
86
|
+
const extendedParameters = Object.assign({}, parameters, { [keys[0]]: index });
|
|
87
|
+
return this.doInvokeAll(extendedParameters, validator);
|
|
205
88
|
});
|
|
206
89
|
}
|
|
207
90
|
else {
|
|
208
|
-
throw new
|
|
91
|
+
throw new WayChaserProblem({
|
|
209
92
|
response: this.response,
|
|
210
|
-
problem: new
|
|
93
|
+
problem: new ProblemDocument({
|
|
211
94
|
type: "https://waychaser.io/fragment-uri-error",
|
|
212
95
|
title: "The fragment URI does not match the content structure",
|
|
213
96
|
uri: parentUri, content: response.content,
|
|
214
|
-
parameters
|
|
97
|
+
parameters
|
|
215
98
|
}),
|
|
216
99
|
});
|
|
217
100
|
}
|
|
218
101
|
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
102
|
+
}
|
|
103
|
+
async invoke(options) {
|
|
104
|
+
if (this.uri.startsWith('#/')) {
|
|
105
|
+
return this.invokeAsFragment(options?.parameters);
|
|
106
|
+
}
|
|
107
|
+
else if (this.uri.includes('#/')) {
|
|
108
|
+
// URI has both a path and a fragment (e.g., /addresses?q=...#/0)
|
|
109
|
+
// Resolve the fragment against the current response's content
|
|
110
|
+
const fragment = this.uri.slice(this.uri.indexOf('#/') + 1);
|
|
111
|
+
const fragmentContent = this.response.fullContent && pointer.get(this.response.fullContent, fragment);
|
|
112
|
+
if (fragmentContent !== undefined) {
|
|
113
|
+
return new WayChaserResponse({ defaultOptions: this.defaultOptions, baseResponse: this.response.response, content: fragmentContent, fullContent: this.response.fullContent, anchor: '#' + fragment, parentOperations: this.response.allOperations, parameters: options?.parameters });
|
|
114
|
+
}
|
|
115
|
+
// Fall through to HTTP request if fragment resolution fails
|
|
116
|
+
}
|
|
117
|
+
{
|
|
118
|
+
const parameterSpecs = this.parameters || {};
|
|
119
|
+
const parameters = Object.assign({}, this.defaultOptions.parameters, options?.parameters);
|
|
120
|
+
const invokeUrl = this.url(parameters);
|
|
121
|
+
const body = {};
|
|
122
|
+
/* istanbul ignore if reason: TODO */
|
|
123
|
+
if (Array.isArray(parameterSpecs)) {
|
|
124
|
+
for (const key of parameterSpecs) {
|
|
125
|
+
body[key] = parameters?.[key];
|
|
227
126
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
return [2 /*return*/, new waychaser_1.WayChaserResponse({ defaultOptions: this.defaultOptions, baseResponse: this.response.response, content: fragmentContent, fullContent: this.response.fullContent, anchor: '#' + fragment, parentOperations: this.response.allOperations, parameters: options === null || options === void 0 ? void 0 : options.parameters })];
|
|
233
|
-
}
|
|
234
|
-
// Fall through to HTTP request if fragment resolution fails
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
for (const key of Object.keys(parameterSpecs)) {
|
|
130
|
+
body[key] = parameters?.[key];
|
|
235
131
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
try {
|
|
252
|
-
if (parameterSpecs_1_1 && !parameterSpecs_1_1.done && (_c = parameterSpecs_1.return)) _c.call(parameterSpecs_1);
|
|
253
|
-
}
|
|
254
|
-
finally { if (e_1) throw e_1.error; }
|
|
255
|
-
}
|
|
132
|
+
}
|
|
133
|
+
let encodedContent;
|
|
134
|
+
let headers = {};
|
|
135
|
+
const requestOptions = Object.assign({}, options);
|
|
136
|
+
requestOptions.method = this.method;
|
|
137
|
+
if (Object.keys(this.parameters).length !== 0 && methodCanHaveBody(this.method || 'GET')) {
|
|
138
|
+
const contentType = preferredContentType(this.accept, [
|
|
139
|
+
'application/x-www-form-urlencoded',
|
|
140
|
+
'application/json',
|
|
141
|
+
'multipart/form-data'
|
|
142
|
+
], 'application/x-www-form-urlencoded');
|
|
143
|
+
switch (contentType) {
|
|
144
|
+
case 'application/x-www-form-urlencoded': {
|
|
145
|
+
encodedContent = qsStringify(body);
|
|
146
|
+
break;
|
|
256
147
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
key = _b.value;
|
|
261
|
-
body[key] = parameters === null || parameters === void 0 ? void 0 : parameters[key];
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
265
|
-
finally {
|
|
266
|
-
try {
|
|
267
|
-
if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
|
|
268
|
-
}
|
|
269
|
-
finally { if (e_2) throw e_2.error; }
|
|
270
|
-
}
|
|
148
|
+
case 'application/json': {
|
|
149
|
+
encodedContent = JSON.stringify(body);
|
|
150
|
+
break;
|
|
271
151
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
if (Object.keys(this.parameters).length !== 0 && (0, method_can_have_body_1.methodCanHaveBody)(this.method || 'GET')) {
|
|
277
|
-
contentType = (0, preferred_content_type_1.preferredContentType)(this.accept, [
|
|
278
|
-
'application/x-www-form-urlencoded',
|
|
279
|
-
'application/json',
|
|
280
|
-
'multipart/form-data'
|
|
281
|
-
], 'application/x-www-form-urlencoded');
|
|
282
|
-
switch (contentType) {
|
|
283
|
-
case 'application/x-www-form-urlencoded': {
|
|
284
|
-
encodedContent = (0, qs_stringify_1.default)(body);
|
|
285
|
-
break;
|
|
286
|
-
}
|
|
287
|
-
case 'application/json': {
|
|
288
|
-
encodedContent = JSON.stringify(body);
|
|
289
|
-
break;
|
|
290
|
-
}
|
|
291
|
-
case 'multipart/form-data': {
|
|
292
|
-
encodedContent = new form_data_1.default();
|
|
293
|
-
for (name_1 in body) {
|
|
294
|
-
encodedContent.append(name_1, body[name_1]);
|
|
295
|
-
}
|
|
296
|
-
break;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
if (contentType !== 'multipart/form-data') {
|
|
300
|
-
headers = {
|
|
301
|
-
'content-type': contentType
|
|
302
|
-
};
|
|
152
|
+
case 'multipart/form-data': {
|
|
153
|
+
encodedContent = new FormData();
|
|
154
|
+
for (const name in body) {
|
|
155
|
+
encodedContent.append(name, body[name]);
|
|
303
156
|
}
|
|
304
|
-
|
|
305
|
-
// with the boundaries
|
|
306
|
-
requestOptions.body = encodedContent;
|
|
307
|
-
requestOptions.headers = Object.assign(headers, options === null || options === void 0 ? void 0 : options.headers);
|
|
157
|
+
break;
|
|
308
158
|
}
|
|
309
|
-
return [2 /*return*/, (0, waychaser_1._waychaser)(invokeUrl.toString(), this.defaultOptions, requestOptions)];
|
|
310
159
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
160
|
+
if (contentType !== 'multipart/form-data') {
|
|
161
|
+
headers = {
|
|
162
|
+
'content-type': contentType
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
// else fetch adds the right content-type header for us
|
|
166
|
+
// with the boundaries
|
|
167
|
+
requestOptions.body = encodedContent;
|
|
168
|
+
requestOptions.headers = Object.assign(headers, options?.headers);
|
|
169
|
+
}
|
|
170
|
+
return _waychaser(invokeUrl.toString(), this.defaultOptions, requestOptions);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
url(parameters) {
|
|
174
|
+
const expandedUri = this.expandUrl(parameters);
|
|
175
|
+
const invokeUrl = new URL(expandedUri, this.response.url);
|
|
318
176
|
return invokeUrl;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
return
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
}(Operation));
|
|
325
|
-
exports.InvocableOperation = InvocableOperation;
|
|
177
|
+
}
|
|
178
|
+
expandUrl(parameters) {
|
|
179
|
+
return URI.expand(this.uri, flatten(parameters || {}));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
326
182
|
//# sourceMappingURL=operation.js.map
|
package/dist/operation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../src/operation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../src/operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAC9C,OAAO,WAAW,MAAM,cAAc,CAAA;AACtC,OAAO,QAAQ,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAoB,iBAAiB,EAAa,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAC/H,OAAO,OAAO,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAEhE,MAAM,OAAO,SAAS;IAQpB,YAAY,EACV,GAAG,EACH,GAAG,EACH,MAAM,EACN,UAAU,EACV,MAAM,EACN,MAAM,EACN,GAAG,eAAe,EACkC;QACpD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,UAAU,GAAG,UAAU,IAAI,EAAE,CAAA;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,MAAM,CAAC,MAAM,CAAC,IAAI,EA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AC;oBAC1C,OAAO,GAAG;wBACR,cAAc,EAAE,WAAW;qBAC5B,CAAA;gBACH,CAAC;gBACD,uDAAuD;gBACvD,sBAAsB;gBAEtB,cAAc,CAAC,IAAI,GAAG,cAAc,CAAA;gBACpC,cAAc,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;YACnE,CAAC;YACD,OAAO,UAAU,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,CAAA;QAC9E,CAAC;IACH,CAAC;IAEO,GAAG,CAAC,UAAoC;QAC9C,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;QAC9C,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;QACzD,OAAO,SAAS,CAAA;IAClB,CAAC;IAEO,SAAS,CAAC,UAA+C;QAC/D,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,CAAA;IACxD,CAAC;CACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { WayChaserOptions } from './waychaser';
|
|
2
|
+
/**
|
|
3
|
+
* @param baseOptions
|
|
4
|
+
* @param additionalOptions
|
|
5
|
+
*/
|
|
6
|
+
export declare function augmentOptions<BaseContent, AdditionalContent>(baseOptions: WayChaserOptions<BaseContent>, additionalOptions?: Partial<WayChaserOptions<AdditionalContent>>): {
|
|
7
|
+
defaultHandlers: import("./waychaser").HandlerSpec[];
|
|
8
|
+
handlers: never[];
|
|
9
|
+
headers: {};
|
|
10
|
+
contentParser: import("./waychaser").ContentParser;
|
|
11
|
+
body?: BodyInit | null;
|
|
12
|
+
cache?: RequestCache;
|
|
13
|
+
credentials?: RequestCredentials;
|
|
14
|
+
integrity?: string;
|
|
15
|
+
keepalive?: boolean;
|
|
16
|
+
method?: string;
|
|
17
|
+
mode?: RequestMode;
|
|
18
|
+
priority?: RequestPriority;
|
|
19
|
+
redirect?: RequestRedirect;
|
|
20
|
+
referrer?: string;
|
|
21
|
+
referrerPolicy?: ReferrerPolicy;
|
|
22
|
+
signal?: AbortSignal | null;
|
|
23
|
+
window?: null;
|
|
24
|
+
fetch: typeof fetch;
|
|
25
|
+
preInterceptors: Array<(uriOrRequest: any, updateOptions: any, stopper: any) => void>;
|
|
26
|
+
postInterceptors: Array<(<InterceptorContent>(response: (import("./waychaser").WayChaserResponse<InterceptorContent>), stop: import("./waychaser").Stopper) => void)>;
|
|
27
|
+
postErrorInterceptors: Array<(error: import("./waychaser").WayChaserProblem | Error, stopper: import("./waychaser").Stopper) => void>;
|
|
28
|
+
parameters?: Record<string, unknown>;
|
|
29
|
+
validator?: import("./waychaser").Validator<AdditionalContent> | import("./waychaser").Validator<BaseContent> | undefined;
|
|
30
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param relationship
|
|
3
|
+
* @param link
|
|
4
|
+
*/
|
|
5
|
+
import { Operation } from "../../operation";
|
|
6
|
+
/**
|
|
7
|
+
* @param relationship
|
|
8
|
+
* @param link
|
|
9
|
+
*/
|
|
10
|
+
export declare function mapSirenLinkToOperation(relationship: string, link: {
|
|
11
|
+
href: string;
|
|
12
|
+
rel: string;
|
|
13
|
+
} & Record<string, unknown>): Operation;
|