Initial
This commit is contained in:
23
resources/app/node_modules/@smithy/protocol-http/dist-es/Field.js
generated
vendored
Normal file
23
resources/app/node_modules/@smithy/protocol-http/dist-es/Field.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import { FieldPosition } from "@smithy/types";
|
||||
export class Field {
|
||||
constructor({ name, kind = FieldPosition.HEADER, values = [] }) {
|
||||
this.name = name;
|
||||
this.kind = kind;
|
||||
this.values = values;
|
||||
}
|
||||
add(value) {
|
||||
this.values.push(value);
|
||||
}
|
||||
set(values) {
|
||||
this.values = values;
|
||||
}
|
||||
remove(value) {
|
||||
this.values = this.values.filter((v) => v !== value);
|
||||
}
|
||||
toString() {
|
||||
return this.values.map((v) => (v.includes(",") || v.includes(" ") ? `"${v}"` : v)).join(", ");
|
||||
}
|
||||
get() {
|
||||
return this.values;
|
||||
}
|
||||
}
|
||||
19
resources/app/node_modules/@smithy/protocol-http/dist-es/Fields.js
generated
vendored
Normal file
19
resources/app/node_modules/@smithy/protocol-http/dist-es/Fields.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
export class Fields {
|
||||
constructor({ fields = [], encoding = "utf-8" }) {
|
||||
this.entries = {};
|
||||
fields.forEach(this.setField.bind(this));
|
||||
this.encoding = encoding;
|
||||
}
|
||||
setField(field) {
|
||||
this.entries[field.name.toLowerCase()] = field;
|
||||
}
|
||||
getField(name) {
|
||||
return this.entries[name.toLowerCase()];
|
||||
}
|
||||
removeField(name) {
|
||||
delete this.entries[name.toLowerCase()];
|
||||
}
|
||||
getByType(kind) {
|
||||
return Object.values(this.entries).filter((field) => field.kind === kind);
|
||||
}
|
||||
}
|
||||
22
resources/app/node_modules/@smithy/protocol-http/dist-es/extensions/httpExtensionConfiguration.js
generated
vendored
Normal file
22
resources/app/node_modules/@smithy/protocol-http/dist-es/extensions/httpExtensionConfiguration.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
export const getHttpHandlerExtensionConfiguration = (runtimeConfig) => {
|
||||
let httpHandler = runtimeConfig.httpHandler;
|
||||
return {
|
||||
setHttpHandler(handler) {
|
||||
httpHandler = handler;
|
||||
},
|
||||
httpHandler() {
|
||||
return httpHandler;
|
||||
},
|
||||
updateHttpClientConfig(key, value) {
|
||||
httpHandler.updateHttpClientConfig(key, value);
|
||||
},
|
||||
httpHandlerConfigs() {
|
||||
return httpHandler.httpHandlerConfigs();
|
||||
},
|
||||
};
|
||||
};
|
||||
export const resolveHttpHandlerRuntimeConfig = (httpHandlerExtensionConfiguration) => {
|
||||
return {
|
||||
httpHandler: httpHandlerExtensionConfiguration.httpHandler(),
|
||||
};
|
||||
};
|
||||
1
resources/app/node_modules/@smithy/protocol-http/dist-es/extensions/index.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/protocol-http/dist-es/extensions/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./httpExtensionConfiguration";
|
||||
1
resources/app/node_modules/@smithy/protocol-http/dist-es/httpHandler.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/protocol-http/dist-es/httpHandler.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
48
resources/app/node_modules/@smithy/protocol-http/dist-es/httpRequest.js
generated
vendored
Normal file
48
resources/app/node_modules/@smithy/protocol-http/dist-es/httpRequest.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
export class HttpRequest {
|
||||
constructor(options) {
|
||||
this.method = options.method || "GET";
|
||||
this.hostname = options.hostname || "localhost";
|
||||
this.port = options.port;
|
||||
this.query = options.query || {};
|
||||
this.headers = options.headers || {};
|
||||
this.body = options.body;
|
||||
this.protocol = options.protocol
|
||||
? options.protocol.slice(-1) !== ":"
|
||||
? `${options.protocol}:`
|
||||
: options.protocol
|
||||
: "https:";
|
||||
this.path = options.path ? (options.path.charAt(0) !== "/" ? `/${options.path}` : options.path) : "/";
|
||||
this.username = options.username;
|
||||
this.password = options.password;
|
||||
this.fragment = options.fragment;
|
||||
}
|
||||
static isInstance(request) {
|
||||
if (!request)
|
||||
return false;
|
||||
const req = request;
|
||||
return ("method" in req &&
|
||||
"protocol" in req &&
|
||||
"hostname" in req &&
|
||||
"path" in req &&
|
||||
typeof req["query"] === "object" &&
|
||||
typeof req["headers"] === "object");
|
||||
}
|
||||
clone() {
|
||||
const cloned = new HttpRequest({
|
||||
...this,
|
||||
headers: { ...this.headers },
|
||||
});
|
||||
if (cloned.query)
|
||||
cloned.query = cloneQuery(cloned.query);
|
||||
return cloned;
|
||||
}
|
||||
}
|
||||
function cloneQuery(query) {
|
||||
return Object.keys(query).reduce((carry, paramName) => {
|
||||
const param = query[paramName];
|
||||
return {
|
||||
...carry,
|
||||
[paramName]: Array.isArray(param) ? [...param] : param,
|
||||
};
|
||||
}, {});
|
||||
}
|
||||
14
resources/app/node_modules/@smithy/protocol-http/dist-es/httpResponse.js
generated
vendored
Normal file
14
resources/app/node_modules/@smithy/protocol-http/dist-es/httpResponse.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
export class HttpResponse {
|
||||
constructor(options) {
|
||||
this.statusCode = options.statusCode;
|
||||
this.reason = options.reason;
|
||||
this.headers = options.headers || {};
|
||||
this.body = options.body;
|
||||
}
|
||||
static isInstance(response) {
|
||||
if (!response)
|
||||
return false;
|
||||
const resp = response;
|
||||
return typeof resp.statusCode === "number" && typeof resp.headers === "object";
|
||||
}
|
||||
}
|
||||
8
resources/app/node_modules/@smithy/protocol-http/dist-es/index.js
generated
vendored
Normal file
8
resources/app/node_modules/@smithy/protocol-http/dist-es/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export * from "./extensions";
|
||||
export * from "./Field";
|
||||
export * from "./Fields";
|
||||
export * from "./httpHandler";
|
||||
export * from "./httpRequest";
|
||||
export * from "./httpResponse";
|
||||
export * from "./isValidHostname";
|
||||
export * from "./types";
|
||||
4
resources/app/node_modules/@smithy/protocol-http/dist-es/isValidHostname.js
generated
vendored
Normal file
4
resources/app/node_modules/@smithy/protocol-http/dist-es/isValidHostname.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export function isValidHostname(hostname) {
|
||||
const hostPattern = /^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/;
|
||||
return hostPattern.test(hostname);
|
||||
}
|
||||
1
resources/app/node_modules/@smithy/protocol-http/dist-es/types.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/protocol-http/dist-es/types.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Reference in New Issue
Block a user