Socket
Socket
Sign inDemoInstall

aws-crt

Package Overview
Dependencies
8
Maintainers
4
Versions
121
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.12.5 to 1.13.0

4

dist.browser/browser.d.ts

@@ -1,5 +0,1 @@

/**
* @packageDocumentation
* @module crt
*/
import * as platform from './common/platform';

@@ -6,0 +2,0 @@ import * as resource_safety from './common/resource_safety';

12

dist.browser/browser.js

@@ -8,3 +8,7 @@ "use strict";

if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -22,3 +26,3 @@ if (k2 === undefined) k2 = k;

var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -29,6 +33,2 @@ return result;

exports.CrtError = exports.resource_safety = exports.platform = exports.iot = exports.auth = exports.crypto = exports.http = exports.mqtt = exports.io = void 0;
/**
* @packageDocumentation
* @module crt
*/
// This is the entry point for the browser AWS CRT shim library

@@ -35,0 +35,0 @@ /* common libs */

@@ -6,3 +6,3 @@ /**

* @module auth
* @preferred
* @mergeTarget
*/

@@ -9,0 +9,0 @@ import { AwsSigningConfigBase } from '../common/auth';

@@ -10,6 +10,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -16,0 +18,0 @@ function __() { this.constructor = d; }

@@ -5,4 +5,4 @@ /**

* @packageDocumentation
* @module aws-iot
* @preferred
* @module aws_iot
* @mergeTarget
*/

@@ -9,0 +9,0 @@ import { CredentialsProvider } from "./auth";

@@ -8,3 +8,7 @@ "use strict";

if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -22,3 +26,3 @@ if (k2 === undefined) k2 = k;

var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -33,4 +37,4 @@ return result;

* @packageDocumentation
* @module aws-iot
* @preferred
* @module aws_iot
* @mergeTarget
*/

@@ -37,0 +41,0 @@ var auth_1 = require("./auth");

@@ -8,3 +8,7 @@ "use strict";

if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -22,3 +26,3 @@ if (k2 === undefined) k2 = k;

var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -30,5 +34,7 @@ return result;

/**
* A module containing support for a variety of cryptographic operations.
*
* @packageDocumentation
* @module crypto
* @mergeTarget
*/

@@ -35,0 +41,0 @@ var Crypto = __importStar(require("crypto-js"));

/**
* Library-specific error extension type
*
* @packageDocumentation
* @module crt
* @module error
* @mergeTarget
*/

@@ -5,0 +8,0 @@ /**

@@ -10,6 +10,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -23,4 +25,7 @@ function __() { this.constructor = d; }

/**
* Library-specific error extension type
*
* @packageDocumentation
* @module crt
* @module error
* @mergeTarget
*/

@@ -27,0 +32,0 @@ /**

/**
*
* A module containing support for creating http connections and making requests on them.
*
* @packageDocumentation
* @module http
* @mergeTarget
*/

@@ -128,25 +132,19 @@ import { CommonHttpProxyOptions, HttpHeader, HttpHeaders as CommonHttpHeaders, HttpClientConnectionConnected, HttpClientConnectionError, HttpClientConnectionClosed, HttpStreamComplete, HttpStreamData, HttpStreamError } from '../common/http';

*
* @param event type of event (connect)
* @param listener event listener to use
*
* @event
*/
on(event: 'connect', listener: HttpClientConnectionConnected): this;
static CONNECT: string;
/**
* Emitted when an error occurs on the connection
*
* @param event type of event (error)
* @param listener event listener to use
*
* @event
*/
on(event: 'error', listener: HttpClientConnectionError): this;
static ERROR: string;
/**
* Emitted when the connection has completed
*
* @param event type of event (close)
* @param listener event listener to use
*
* @event
*/
static CLOSE: string;
on(event: 'connect', listener: HttpClientConnectionConnected): this;
on(event: 'error', listener: HttpClientConnectionError): this;
on(event: 'close', listener: HttpClientConnectionClosed): this;

@@ -170,3 +168,2 @@ /**

*
* @asMemberOf HttpClientStream
* @category HTTP

@@ -203,34 +200,26 @@ */

*
* @param event type of event (response)
* @param listener event listener to use
*
* @event
*/
on(event: 'response', listener: HttpStreamResponse): this;
static RESPONSE: string;
/**
* Emitted when http response data is available.
*
* @param event type of event (data)
* @param listener event listener to use
*
* @event
*/
on(event: 'data', listener: HttpStreamData): this;
static DATA: string;
/**
* Emitted when an error occurs in stream processing
*
* @param event type of event (error)
* @param listener event listener to use
*
* @event
*/
on(event: 'error', listener: HttpStreamError): this;
static ERROR: string;
/**
* Emitted when the stream has completed
*
* @param event type of event (end)
* @param listener event listener to use
*
* @event
*/
static END: string;
on(event: 'response', listener: HttpStreamResponse): this;
on(event: 'data', listener: HttpStreamData): this;
on(event: 'error', listener: HttpStreamError): this;
on(event: 'end', listener: HttpStreamComplete): this;

@@ -237,0 +226,0 @@ /** @internal */

@@ -10,6 +10,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -59,6 +61,10 @@ function __() { this.constructor = d; }

Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpClientConnectionManager = exports.HttpClientStream = exports.HttpClientConnection = exports.HttpRequest = exports.HttpProxyOptions = exports.HttpHeaders = void 0;
exports.HttpClientConnectionManager = exports.HttpClientStream = exports.HttpClientConnection = exports.HttpRequest = exports.HttpProxyOptions = exports.HttpHeaders = exports.HttpProxyAuthenticationType = void 0;
/**
*
* A module containing support for creating http connections and making requests on them.
*
* @packageDocumentation
* @module http
* @mergeTarget
*/

@@ -349,3 +355,3 @@ var http_1 = require("../common/http");

_this.axios_options = {
baseURL: scheme + "://" + host_name + ":" + port + "/"
baseURL: "".concat(scheme, "://").concat(host_name, ":").concat(port, "/")
};

@@ -396,2 +402,20 @@ if (_this.proxy_options) {

};
/**
* Emitted when the connection is connected and ready to start streams
*
* @event
*/
HttpClientConnection.CONNECT = 'connect';
/**
* Emitted when an error occurs on the connection
*
* @event
*/
HttpClientConnection.ERROR = 'error';
/**
* Emitted when the connection has completed
*
* @event
*/
HttpClientConnection.CLOSE = 'close';
return HttpClientConnection;

@@ -505,8 +529,8 @@ }(event_1.BufferedEventEmitter));

this.response_status_code = error.response.status;
info += "status_code=" + error.response.status;
info += "status_code=".concat(error.response.status);
if (error.response.headers) {
info += " headers=" + JSON.stringify(error.response.headers);
info += " headers=".concat(JSON.stringify(error.response.headers));
}
if (error.response.data) {
info += " data=" + error.response.data;
info += " data=".concat(error.response.data);
}

@@ -518,4 +542,28 @@ }

this.connection.close();
this.emit('error', new Error("msg=" + error.message + ", connection=" + JSON.stringify(this.connection) + ", info=" + info));
this.emit('error', new Error("msg=".concat(error.message, ", connection=").concat(JSON.stringify(this.connection), ", info=").concat(info)));
};
/**
* Emitted when the http response headers have arrived.
*
* @event
*/
HttpClientStream.RESPONSE = 'response';
/**
* Emitted when http response data is available.
*
* @event
*/
HttpClientStream.DATA = 'data';
/**
* Emitted when an error occurs in stream processing
*
* @event
*/
HttpClientStream.ERROR = 'error';
/**
* Emitted when the stream has completed
*
* @event
*/
HttpClientStream.END = 'end';
return HttpClientStream;

@@ -522,0 +570,0 @@ }(event_1.BufferedEventEmitter));

/**
*
* A module containing a grab bag of support for core network I/O functionality, including sockets, TLS, DNS, logging,
* error handling, streams, and connection -> thread mapping.
*
* Categories include:
* - Network: socket configuration
* - TLS: tls configuration
* - Logging: logging controls and configuration
* - IO: everything else
*
* @packageDocumentation
* @module IO
* @module io
* @mergeTarget
*/

@@ -14,3 +24,3 @@ export { TlsVersion, SocketType, SocketDomain } from "../common/io";

export declare function is_alpn_available(): boolean;
declare type BodyData = string | object | ArrayBuffer | ArrayBufferView | Blob | File;
export declare type BodyData = string | object | ArrayBuffer | ArrayBufferView | Blob | File;
/**

@@ -17,0 +27,0 @@ * Wrapper for any sort of body data in requests. As the browser does not implement streaming,

@@ -10,6 +10,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -21,7 +23,17 @@ function __() { this.constructor = d; }

Object.defineProperty(exports, "__esModule", { value: true });
exports.SocketOptions = exports.ClientTlsContext = exports.TlsContext = exports.TlsConnectionOptions = exports.ClientBootstrap = exports.InputStream = exports.is_alpn_available = void 0;
exports.SocketOptions = exports.ClientTlsContext = exports.TlsContext = exports.TlsConnectionOptions = exports.ClientBootstrap = exports.InputStream = exports.is_alpn_available = exports.SocketDomain = exports.SocketType = exports.TlsVersion = void 0;
/**
*
* A module containing a grab bag of support for core network I/O functionality, including sockets, TLS, DNS, logging,
* error handling, streams, and connection -> thread mapping.
*
* Categories include:
* - Network: socket configuration
* - TLS: tls configuration
* - Logging: logging controls and configuration
* - IO: everything else
*
* @packageDocumentation
* @module IO
* @module io
* @mergeTarget
*/

@@ -28,0 +40,0 @@ var io_1 = require("../common/io");

import * as WebsocketUtils from "./ws";
import * as auth from "./auth";
import { BufferedEventEmitter } from "../common/event";
import { CrtError } from "../browser";
import { ClientBootstrap, SocketOptions } from "./io";
import { QoS, Payload, MqttRequest, MqttSubscribeRequest, MqttWill, OnMessageCallback, MqttConnectionConnected, MqttConnectionDisconnected, MqttConnectionError, MqttConnectionInterrupted, MqttConnectionResumed } from "../common/mqtt";
import { QoS, Payload, MqttRequest, MqttSubscribeRequest, MqttWill, OnMessageCallback, MqttConnectionConnected, MqttConnectionDisconnected, MqttConnectionResumed } from "../common/mqtt";
export { QoS, Payload, MqttRequest, MqttSubscribeRequest, MqttWill } from "../common/mqtt";
/**
* Listener signature for event emitted from an {@link MqttClientConnection} when an error occurs
*
* @param error the error that occurred
*
* @category MQTT
*/
export declare type MqttConnectionError = (error: CrtError) => void;
/**
* Listener signature for event emitted from an {@link MqttClientConnection} when the connection has been
* interrupted unexpectedly.
*
* @param error description of the error that occurred
*
* @category MQTT
*/
export declare type MqttConnectionInterrupted = (error: CrtError) => void;
/**
* @category MQTT
*/
export declare type WebsocketOptions = WebsocketUtils.WebsocketOptions;

@@ -130,17 +148,11 @@ /**

*
* @param event the type of event (connect)
* @param listener the event listener to use
*
* @event
*/
on(event: 'connect', listener: MqttConnectionConnected): this;
static CONNECT: string;
/**
* Emitted when connection has disconnected sucessfully.
*
* @param event the type of event (disconnect)
* @param listener the event listener to use
*
* @event
*/
on(event: 'disconnect', listener: MqttConnectionDisconnected): this;
static DISCONNECT: string;
/**

@@ -150,8 +162,5 @@ * Emitted when an error occurs. The error will contain the error

*
* @param event the type of event (error)
* @param listener the event listener to use
*
* @event
*/
on(event: 'error', listener: MqttConnectionError): this;
static ERROR: string;
/**

@@ -161,33 +170,23 @@ * Emitted when the connection is dropped unexpectedly. The error will contain the error

*
* @param event the type of event (interrupt)
* @param listener the event listener to use
*
* @event
*/
on(event: 'interrupt', listener: MqttConnectionInterrupted): this;
static INTERRUPT: string;
/**
* Emitted when the connection reconnects (after an interrupt). Only triggers on connections after the initial one.
*
* @param event the type of event (resume)
* @param listener the event listener to use
*
* @event
*/
on(event: 'resume', listener: MqttConnectionResumed): this;
static RESUME: string;
/**
* Emitted when any MQTT publish message arrives.
*
* @param event the type of event (message)
* @param listener the event listener to use
*
* @event
*/
static MESSAGE: string;
on(event: 'connect', listener: MqttConnectionConnected): this;
on(event: 'disconnect', listener: MqttConnectionDisconnected): this;
on(event: 'error', listener: MqttConnectionError): this;
on(event: 'interrupt', listener: MqttConnectionInterrupted): this;
on(event: 'resume', listener: MqttConnectionResumed): this;
on(event: 'message', listener: OnMessageCallback): this;
private on_connect;
private on_online;
private on_offline;
private on_disconnected;
private on_error;
private on_message;
private reset_reconnect_times;
/**

@@ -202,6 +201,2 @@ * Open the actual connection to the server (async).

/**
* Returns seconds until next reconnect attempt.
*/
private get_reconnect_time_sec;
/**
* The connection will automatically reconnect. To cease reconnection attempts, call {@link disconnect}.

@@ -263,2 +258,13 @@ * To resume the connection, call {@link connect}.

disconnect(): Promise<unknown>;
private on_connect;
private on_online;
private on_offline;
private on_disconnected;
private on_error;
private on_message;
private reset_reconnect_times;
/**
* Returns seconds until next reconnect attempt.
*/
private get_reconnect_time_sec;
}

@@ -10,6 +10,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -22,3 +24,7 @@ function __() { this.constructor = d; }

if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -36,3 +42,3 @@ if (k2 === undefined) k2 = k;

var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -89,6 +95,10 @@ return result;

Object.defineProperty(exports, "__esModule", { value: true });
exports.MqttClientConnection = exports.MqttClient = void 0;
exports.MqttClientConnection = exports.MqttClient = exports.MqttWill = exports.QoS = void 0;
/**
*
* A module containing support for mqtt connection establishment and operations.
*
* @packageDocumentation
* @module mqtt
* @mergeTarget
*/

@@ -311,5 +321,2 @@ var mqtt = __importStar(require("mqtt"));

};
MqttClientConnection.prototype.reset_reconnect_times = function () {
this.reconnect_count = 0;
};
/**

@@ -341,20 +348,2 @@ * Open the actual connection to the server (async).

/**
* Returns seconds until next reconnect attempt.
*/
MqttClientConnection.prototype.get_reconnect_time_sec = function () {
if (this.reconnect_min_sec == 0 && this.reconnect_max_sec == 0) {
return 0;
}
// Uses "FullJitter" backoff algorithm, described here:
// https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
// We slightly vary the algorithm described on the page,
// which takes (base,cap) and may result in 0.
// But we take (min,max) as parameters, and don't don't allow results less than min.
var cap = this.reconnect_max_sec - this.reconnect_min_sec;
var base = Math.max(this.reconnect_min_sec, 1);
/** Use Math.pow() since IE does not support ** operator */
var sleep = Math.random() * Math.min(cap, base * Math.pow(2, this.reconnect_count));
return this.reconnect_min_sec + sleep;
};
/**
* The connection will automatically reconnect. To cease reconnection attempts, call {@link disconnect}.

@@ -400,3 +389,7 @@ * To resume the connection, call {@link connect}.

}
resolve({ packet_id: packet.messageId });
var id = undefined;
if (qos != mqtt_1.QoS.AtMostOnce) {
id = packet.messageId;
}
resolve({ packet_id: id });
});

@@ -487,2 +480,61 @@ })];

};
MqttClientConnection.prototype.reset_reconnect_times = function () {
this.reconnect_count = 0;
};
/**
* Returns seconds until next reconnect attempt.
*/
MqttClientConnection.prototype.get_reconnect_time_sec = function () {
if (this.reconnect_min_sec == 0 && this.reconnect_max_sec == 0) {
return 0;
}
// Uses "FullJitter" backoff algorithm, described here:
// https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
// We slightly vary the algorithm described on the page,
// which takes (base,cap) and may result in 0.
// But we take (min,max) as parameters, and don't don't allow results less than min.
var cap = this.reconnect_max_sec - this.reconnect_min_sec;
var base = Math.max(this.reconnect_min_sec, 1);
/** Use Math.pow() since IE does not support ** operator */
var sleep = Math.random() * Math.min(cap, base * Math.pow(2, this.reconnect_count));
return this.reconnect_min_sec + sleep;
};
/**
* Emitted when the connection successfully establishes itself for the first time
*
* @event
*/
MqttClientConnection.CONNECT = 'connect';
/**
* Emitted when connection has disconnected sucessfully.
*
* @event
*/
MqttClientConnection.DISCONNECT = 'disconnect';
/**
* Emitted when an error occurs. The error will contain the error
* code and message.
*
* @event
*/
MqttClientConnection.ERROR = 'error';
/**
* Emitted when the connection is dropped unexpectedly. The error will contain the error
* code and message. The underlying mqtt implementation will attempt to reconnect.
*
* @event
*/
MqttClientConnection.INTERRUPT = 'interrupt';
/**
* Emitted when the connection reconnects (after an interrupt). Only triggers on connections after the initial one.
*
* @event
*/
MqttClientConnection.RESUME = 'resume';
/**
* Emitted when any MQTT publish message arrives.
*
* @event
*/
MqttClientConnection.MESSAGE = 'message';
return MqttClientConnection;

@@ -489,0 +541,0 @@ }(event_1.BufferedEventEmitter));

/**
* Module for utilities related to websocket connection establishment
*
* @packageDocumentation
* @module mqtt
* @module ws
* @mergeTarget
*/

@@ -5,0 +8,0 @@ import { MqttConnectionConfig } from "./mqtt";

@@ -8,3 +8,7 @@ "use strict";

if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -22,3 +26,3 @@ if (k2 === undefined) k2 = k;

var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -31,10 +35,13 @@ return result;

var Crypto = __importStar(require("crypto-js"));
/** @internal */
function zero_pad(n) {
return (n > 9) ? n : '0' + n.toString();
}
/** @internal */
function canonical_time(time) {
var now = time !== null && time !== void 0 ? time : new Date();
return "" + now.getUTCFullYear() + zero_pad(now.getUTCMonth() + 1) + zero_pad(now.getUTCDate()) + "T" +
("" + zero_pad(now.getUTCHours()) + zero_pad(now.getUTCMinutes()) + zero_pad(now.getUTCSeconds()) + "Z");
return "".concat(now.getUTCFullYear()).concat(zero_pad(now.getUTCMonth() + 1)).concat(zero_pad(now.getUTCDate()), "T") +
"".concat(zero_pad(now.getUTCHours())).concat(zero_pad(now.getUTCMinutes())).concat(zero_pad(now.getUTCSeconds()), "Z");
}
/** @internal */
function canonical_day(time) {

@@ -44,2 +51,3 @@ if (time === void 0) { time = canonical_time(); }

}
/** @internal */
function make_signing_key(credentials, day, service_name) {

@@ -53,2 +61,3 @@ var hash_opts = { asBytes: true };

}
/** @internal */
function sign_url(method, url, signing_config, time, day, payload) {

@@ -60,15 +69,15 @@ if (time === void 0) { time = canonical_time(); }

var service = signing_config.service;
var canonical_headers = "host:" + url.hostname.toLowerCase() + "\n";
var canonical_headers = "host:".concat(url.hostname.toLowerCase(), "\n");
var payload_hash = Crypto.SHA256(payload, { asBytes: true });
var canonical_params = url.search.replace(new RegExp('^\\?'), '');
var canonical_request = method + "\n" + url.pathname + "\n" + canonical_params + "\n" + canonical_headers + "\n" + signed_headers + "\n" + payload_hash;
var canonical_request = "".concat(method, "\n").concat(url.pathname, "\n").concat(canonical_params, "\n").concat(canonical_headers, "\n").concat(signed_headers, "\n").concat(payload_hash);
var canonical_request_hash = Crypto.SHA256(canonical_request, { asBytes: true });
var signature_raw = "AWS4-HMAC-SHA256\n" + time + "\n" + day + "/" + signing_config.credentials.aws_region + "/" + service + "/aws4_request\n" + canonical_request_hash;
var signature_raw = "AWS4-HMAC-SHA256\n".concat(time, "\n").concat(day, "/").concat(signing_config.credentials.aws_region, "/").concat(service, "/aws4_request\n").concat(canonical_request_hash);
var signing_key = make_signing_key(signing_config.credentials, day, service);
var signature = Crypto.HmacSHA256(signature_raw, signing_key, { asBytes: true });
var query_params = url.search + "&X-Amz-Signature=" + signature;
var query_params = "".concat(url.search, "&X-Amz-Signature=").concat(signature);
if (signing_config.credentials.aws_sts_token) {
query_params += "&X-Amz-Security-Token=" + encodeURIComponent(signing_config.credentials.aws_sts_token);
query_params += "&X-Amz-Security-Token=".concat(encodeURIComponent(signing_config.credentials.aws_sts_token));
}
var signed_url = url.protocol + "//" + url.hostname + url.pathname + query_params;
var signed_url = "".concat(url.protocol, "//").concat(url.hostname).concat(url.pathname).concat(query_params);
return signed_url;

@@ -92,11 +101,11 @@ }

var day = canonical_day(time);
var query_params = "X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=" + signing_config.credentials.aws_access_id +
("%2F" + day + "%2F" + signing_config.credentials.aws_region + "%2F" + signing_config.service + "%2Faws4_request&X-Amz-Date=" + time + "&X-Amz-SignedHeaders=host");
var url = new URL("wss://" + config.host_name + path + "?" + query_params);
var query_params = "X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=".concat(signing_config.credentials.aws_access_id) +
"%2F".concat(day, "%2F").concat(signing_config.credentials.aws_region, "%2F").concat(signing_config.service, "%2Faws4_request&X-Amz-Date=").concat(time, "&X-Amz-SignedHeaders=host");
var url = new URL("wss://".concat(config.host_name).concat(path, "?").concat(query_params));
return sign_url('GET', url, signing_config, time, day);
}
else if (protocol === 'wss-custom-auth') {
return "wss://" + config.host_name + "/" + path;
return "wss://".concat(config.host_name, "/").concat(path);
}
throw new URIError("Invalid protocol requested: " + protocol);
throw new URIError("Invalid protocol requested: ".concat(protocol));
}

@@ -103,0 +112,0 @@ exports.create_websocket_url = create_websocket_url;

/**
* @packageDocumentation
* @module auth
*/
/**
* Configuration for use in AWS-related signing.

@@ -6,3 +10,2 @@ * AwsSigningConfig is immutable.

*
* @internal
*/

@@ -25,3 +28,2 @@ export interface AwsSigningConfigBase {

*
* @Internal
*/

@@ -28,0 +30,0 @@ export interface WebsocketOptionsBase {

@@ -7,6 +7,7 @@ /**

* @module aws_iot
* @preferred
*/
/**
* A helper function to add parameters to the username in with_custom_authorizer function
*
* @internal
*/

@@ -16,2 +17,4 @@ export declare function add_to_username_parameter(current_username: string, parameter_value: string, parameter_pre_text: string): string;

* A helper function to see if a string is not null, is defined, and is not an empty string
*
* @internal
*/

@@ -27,3 +30,5 @@ export declare function is_string_and_not_empty(item: any): boolean;

* @returns The finished username with the additions added to it
*
* @internal
*/
export declare function populate_username_string_with_custom_authorizer(current_username?: string, input_username?: string, input_authorizer?: string, input_signature?: string, input_builder_username?: string): string;

@@ -14,6 +14,7 @@ "use strict";

* @module aws_iot
* @preferred
*/
/**
* A helper function to add parameters to the username in with_custom_authorizer function
*
* @internal
*/

@@ -38,2 +39,4 @@ function add_to_username_parameter(current_username, parameter_value, parameter_pre_text) {

* A helper function to see if a string is not null, is defined, and is not an empty string
*
* @internal
*/

@@ -52,2 +55,4 @@ function is_string_and_not_empty(item) {

* @returns The finished username with the additions added to it
*
* @internal
*/

@@ -54,0 +59,0 @@ function populate_username_string_with_custom_authorizer(current_username, input_username, input_authorizer, input_signature, input_builder_username) {

@@ -8,3 +8,2 @@ /// <reference types="node" />

* @module crypto
* @preferred
*/

@@ -11,0 +10,0 @@ /**

/// <reference types="node" />
/**
* Module for base types related to event emission
*
* @packageDocumentation
* @module crt
* @module event
*/

@@ -12,8 +14,8 @@ import { EventEmitter } from 'events';

*/
declare type EventKey = string | symbol;
export declare type EventKey = string | symbol;
/**
* Provides buffered event emitting semantics, similar to many Node-style streams.
* Subclasses will override {@link BufferedEventEmitter.on} and trigger uncorking.
* Subclasses will override EventEmitter.on() and trigger uncorking.
* NOTE: It is HIGHLY recommended that uncorking should always be done via
* ```process.nextTick()```, not during the {@link BufferedEventEmitter.on} call.
* ```process.nextTick()```, not during the EventEmitter.on() call.
*

@@ -50,2 +52,1 @@ * See also: [Node writable streams](https://nodejs.org/api/stream.html#stream_writable_cork)

}
export {};

@@ -10,6 +10,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -36,5 +38,10 @@ function __() { this.constructor = d; }

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -44,4 +51,6 @@ Object.defineProperty(exports, "__esModule", { value: true });

/**
* Module for base types related to event emission
*
* @packageDocumentation
* @module crt
* @module event
*/

@@ -61,5 +70,5 @@ var events_1 = require("events");

* Provides buffered event emitting semantics, similar to many Node-style streams.
* Subclasses will override {@link BufferedEventEmitter.on} and trigger uncorking.
* Subclasses will override EventEmitter.on() and trigger uncorking.
* NOTE: It is HIGHLY recommended that uncorking should always be done via
* ```process.nextTick()```, not during the {@link BufferedEventEmitter.on} call.
* ```process.nextTick()```, not during the EventEmitter.on() call.
*

@@ -94,3 +103,3 @@ * See also: [Node writable streams](https://nodejs.org/api/stream.html#stream_writable_cork)

var event_1 = this.eventQueue;
_super.prototype.emit.apply(this, __spread([event_1.event], event_1.args));
_super.prototype.emit.apply(this, __spreadArray([event_1.event], __read(event_1.args), false));
this.eventQueue = this.eventQueue.next;

@@ -123,3 +132,3 @@ }

}
return _super.prototype.emit.apply(this, __spread([event], args));
return _super.prototype.emit.apply(this, __spreadArray([event], __read(args), false));
};

@@ -126,0 +135,0 @@ return BufferedEventEmitter;

@@ -7,3 +7,2 @@ /**

* @module http
* @preferred
*/

@@ -30,3 +29,7 @@ /**

export declare type HttpHeader = [string, string];
/** @internal */
/**
* Common interface for a set of HTTP headers.
*
* @category HTTP
*/
export interface HttpHeaders {

@@ -122,3 +125,2 @@ readonly length: number;

*
* @asMemberOf HttpClientConnection
* @category HTTP

@@ -132,3 +134,2 @@ */

*
* @asMemberOf HttpClientConnection
* @category HTTP

@@ -140,3 +141,2 @@ */

*
* @asMemberOf HttpClientConnection
* @category HTTP

@@ -150,3 +150,2 @@ */

*
* @asMemberOf HttpClientStream
* @category HTTP

@@ -160,3 +159,2 @@ */

*
* @asMemberOf HttpClientStream
* @category HTTP

@@ -168,5 +166,4 @@ */

*
* @asMemberOf HttpClientStream
* @category HTTP
*/
export declare type HttpStreamComplete = () => void;

@@ -15,3 +15,2 @@ "use strict";

* @module http
* @preferred
*/

@@ -18,0 +17,0 @@ /**

@@ -13,4 +13,3 @@ /**

* @packageDocumentation
* @module IO
* @preferred
* @module io
*/

@@ -17,0 +16,0 @@ /**

@@ -20,4 +20,3 @@ "use strict";

* @packageDocumentation
* @module IO
* @preferred
* @module io
*/

@@ -24,0 +23,0 @@ /**

@@ -7,12 +7,4 @@ /**

* @module mqtt
* @preferred
*/
/**
* MQTT Quality of Service
* [MQTT-4.3]
*
* @category MQTT
*/
import { CrtError } from "../browser/error";
/**
* Quality of service control for mqtt publish operations

@@ -130,3 +122,2 @@ *

*
* @asMemberOf MqttClientConnection
* @category MQTT

@@ -139,3 +130,2 @@ */

*
* @asMemberOf MqttClientConnection
* @category MQTT

@@ -145,21 +135,2 @@ */

/**
* Listener signature for event emitted from an {@link MqttClientConnection} when an error occurs
*
* @param error the error that occurred
*
* @asMemberOf MqttClientConnection
* @category MQTT
*/
export declare type MqttConnectionError = (error: CrtError) => void;
/**
* Listener signature for event emitted from an {@link MqttClientConnection} when the connection has been
* interrupted unexpectedly.
*
* @param error description of the error that occurred
*
* @asMemberOf MqttClientConnection
* @category MQTT
*/
export declare type MqttConnectionInterrupted = (error: CrtError) => void;
/**
* Listener signature for event emitted from an {@link MqttClientConnection} when the connection successfully

@@ -171,3 +142,2 @@ * reestablishes itself after an interruption

*
* @asMemberOf MqttClientConnection
* @category MQTT

@@ -174,0 +144,0 @@ */

@@ -9,2 +9,9 @@ "use strict";

/**
*
* A module containing support for mqtt connection establishment and operations.
*
* @packageDocumentation
* @module mqtt
*/
/**
* Quality of service control for mqtt publish operations

@@ -11,0 +18,0 @@ *

/**
*
* A module containing miscellaneous functionality for error reporting, platform functionality, and package-wide logic.
* A module containing miscellaneous platform-related queries
*
* @packageDocumentation
* @module crt
* @preferred
* @module platform
* @mergeTarget
*/

@@ -9,0 +9,0 @@ /**

@@ -10,7 +10,7 @@ "use strict";

*
* A module containing miscellaneous functionality for error reporting, platform functionality, and package-wide logic.
* A module containing miscellaneous platform-related queries
*
* @packageDocumentation
* @module crt
* @preferred
* @module platform
* @mergeTarget
*/

@@ -17,0 +17,0 @@ /**

/**
*
* A module containing miscellaneous types for resource management
*
* @packageDocumentation
* @module crt
* @module resource_safety
* @mergeTarget
*/

@@ -5,0 +9,0 @@ /**

/**
* @packageDocumentation
* @module auth
*/
/**
* Configuration for use in AWS-related signing.

@@ -6,3 +10,2 @@ * AwsSigningConfig is immutable.

*
* @internal
*/

@@ -25,3 +28,2 @@ export interface AwsSigningConfigBase {

*
* @Internal
*/

@@ -28,0 +30,0 @@ export interface WebsocketOptionsBase {

@@ -7,6 +7,7 @@ /**

* @module aws_iot
* @preferred
*/
/**
* A helper function to add parameters to the username in with_custom_authorizer function
*
* @internal
*/

@@ -16,2 +17,4 @@ export declare function add_to_username_parameter(current_username: string, parameter_value: string, parameter_pre_text: string): string;

* A helper function to see if a string is not null, is defined, and is not an empty string
*
* @internal
*/

@@ -27,3 +30,5 @@ export declare function is_string_and_not_empty(item: any): boolean;

* @returns The finished username with the additions added to it
*
* @internal
*/
export declare function populate_username_string_with_custom_authorizer(current_username?: string, input_username?: string, input_authorizer?: string, input_signature?: string, input_builder_username?: string): string;

@@ -14,6 +14,7 @@ "use strict";

* @module aws_iot
* @preferred
*/
/**
* A helper function to add parameters to the username in with_custom_authorizer function
*
* @internal
*/

@@ -38,2 +39,4 @@ function add_to_username_parameter(current_username, parameter_value, parameter_pre_text) {

* A helper function to see if a string is not null, is defined, and is not an empty string
*
* @internal
*/

@@ -52,2 +55,4 @@ function is_string_and_not_empty(item) {

* @returns The finished username with the additions added to it
*
* @internal
*/

@@ -54,0 +59,0 @@ function populate_username_string_with_custom_authorizer(current_username, input_username, input_authorizer, input_signature, input_builder_username) {

@@ -8,3 +8,2 @@ /// <reference types="node" />

* @module crypto
* @preferred
*/

@@ -11,0 +10,0 @@ /**

/// <reference types="node" />
/**
* Module for base types related to event emission
*
* @packageDocumentation
* @module crt
* @module event
*/

@@ -12,8 +14,8 @@ import { EventEmitter } from 'events';

*/
declare type EventKey = string | symbol;
export declare type EventKey = string | symbol;
/**
* Provides buffered event emitting semantics, similar to many Node-style streams.
* Subclasses will override {@link BufferedEventEmitter.on} and trigger uncorking.
* Subclasses will override EventEmitter.on() and trigger uncorking.
* NOTE: It is HIGHLY recommended that uncorking should always be done via
* ```process.nextTick()```, not during the {@link BufferedEventEmitter.on} call.
* ```process.nextTick()```, not during the EventEmitter.on() call.
*

@@ -50,2 +52,1 @@ * See also: [Node writable streams](https://nodejs.org/api/stream.html#stream_writable_cork)

}
export {};

@@ -9,4 +9,6 @@ "use strict";

/**
* Module for base types related to event emission
*
* @packageDocumentation
* @module crt
* @module event
*/

@@ -25,5 +27,5 @@ const events_1 = require("events");

* Provides buffered event emitting semantics, similar to many Node-style streams.
* Subclasses will override {@link BufferedEventEmitter.on} and trigger uncorking.
* Subclasses will override EventEmitter.on() and trigger uncorking.
* NOTE: It is HIGHLY recommended that uncorking should always be done via
* ```process.nextTick()```, not during the {@link BufferedEventEmitter.on} call.
* ```process.nextTick()```, not during the EventEmitter.on() call.
*

@@ -30,0 +32,0 @@ * See also: [Node writable streams](https://nodejs.org/api/stream.html#stream_writable_cork)

@@ -7,3 +7,2 @@ /**

* @module http
* @preferred
*/

@@ -30,3 +29,7 @@ /**

export declare type HttpHeader = [string, string];
/** @internal */
/**
* Common interface for a set of HTTP headers.
*
* @category HTTP
*/
export interface HttpHeaders {

@@ -122,3 +125,2 @@ readonly length: number;

*
* @asMemberOf HttpClientConnection
* @category HTTP

@@ -132,3 +134,2 @@ */

*
* @asMemberOf HttpClientConnection
* @category HTTP

@@ -140,3 +141,2 @@ */

*
* @asMemberOf HttpClientConnection
* @category HTTP

@@ -150,3 +150,2 @@ */

*
* @asMemberOf HttpClientStream
* @category HTTP

@@ -160,3 +159,2 @@ */

*
* @asMemberOf HttpClientStream
* @category HTTP

@@ -168,5 +166,4 @@ */

*
* @asMemberOf HttpClientStream
* @category HTTP
*/
export declare type HttpStreamComplete = () => void;

@@ -15,3 +15,2 @@ "use strict";

* @module http
* @preferred
*/

@@ -18,0 +17,0 @@ /**

@@ -13,4 +13,3 @@ /**

* @packageDocumentation
* @module IO
* @preferred
* @module io
*/

@@ -17,0 +16,0 @@ /**

@@ -20,4 +20,3 @@ "use strict";

* @packageDocumentation
* @module IO
* @preferred
* @module io
*/

@@ -24,0 +23,0 @@ /**

@@ -7,12 +7,4 @@ /**

* @module mqtt
* @preferred
*/
/**
* MQTT Quality of Service
* [MQTT-4.3]
*
* @category MQTT
*/
import { CrtError } from "../browser/error";
/**
* Quality of service control for mqtt publish operations

@@ -130,3 +122,2 @@ *

*
* @asMemberOf MqttClientConnection
* @category MQTT

@@ -139,3 +130,2 @@ */

*
* @asMemberOf MqttClientConnection
* @category MQTT

@@ -145,21 +135,2 @@ */

/**
* Listener signature for event emitted from an {@link MqttClientConnection} when an error occurs
*
* @param error the error that occurred
*
* @asMemberOf MqttClientConnection
* @category MQTT
*/
export declare type MqttConnectionError = (error: CrtError) => void;
/**
* Listener signature for event emitted from an {@link MqttClientConnection} when the connection has been
* interrupted unexpectedly.
*
* @param error description of the error that occurred
*
* @asMemberOf MqttClientConnection
* @category MQTT
*/
export declare type MqttConnectionInterrupted = (error: CrtError) => void;
/**
* Listener signature for event emitted from an {@link MqttClientConnection} when the connection successfully

@@ -171,3 +142,2 @@ * reestablishes itself after an interruption

*
* @asMemberOf MqttClientConnection
* @category MQTT

@@ -174,0 +144,0 @@ */

@@ -9,2 +9,9 @@ "use strict";

/**
*
* A module containing support for mqtt connection establishment and operations.
*
* @packageDocumentation
* @module mqtt
*/
/**
* Quality of service control for mqtt publish operations

@@ -11,0 +18,0 @@ *

/**
*
* A module containing miscellaneous functionality for error reporting, platform functionality, and package-wide logic.
* A module containing miscellaneous platform-related queries
*
* @packageDocumentation
* @module crt
* @preferred
* @module platform
* @mergeTarget
*/

@@ -9,0 +9,0 @@ /**

@@ -10,7 +10,7 @@ "use strict";

*
* A module containing miscellaneous functionality for error reporting, platform functionality, and package-wide logic.
* A module containing miscellaneous platform-related queries
*
* @packageDocumentation
* @module crt
* @preferred
* @module platform
* @mergeTarget
*/

@@ -17,0 +17,0 @@ /**

/**
*
* A module containing miscellaneous types for resource management
*
* @packageDocumentation
* @module crt
* @module resource_safety
* @mergeTarget
*/

@@ -5,0 +9,0 @@ /**

@@ -1,5 +0,1 @@

/**
* @packageDocumentation
* @module crt
*/
import * as platform from './common/platform';

@@ -14,3 +10,4 @@ import * as resource_safety from './common/resource_safety';

import * as iot from './native/aws_iot';
import * as checksums from './native/checksums';
import { CrtError } from './native/error';
export { crt, io, mqtt, http, crypto, auth, iot, platform, resource_safety, CrtError };
export { crt, io, mqtt, http, crypto, auth, iot, platform, resource_safety, checksums, CrtError };

@@ -8,3 +8,7 @@ "use strict";

if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -22,3 +26,3 @@ if (k2 === undefined) k2 = k;

var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -28,7 +32,3 @@ return result;

Object.defineProperty(exports, "__esModule", { value: true });
exports.CrtError = exports.resource_safety = exports.platform = exports.iot = exports.auth = exports.crypto = exports.http = exports.mqtt = exports.io = exports.crt = void 0;
/**
* @packageDocumentation
* @module crt
*/
exports.CrtError = exports.checksums = exports.resource_safety = exports.platform = exports.iot = exports.auth = exports.crypto = exports.http = exports.mqtt = exports.io = exports.crt = void 0;
// This is the entry point for the AWS CRT nodejs native libraries

@@ -55,4 +55,6 @@ /* common libs */

exports.iot = iot;
const checksums = __importStar(require("./native/checksums"));
exports.checksums = checksums;
const error_1 = require("./native/error");
Object.defineProperty(exports, "CrtError", { enumerable: true, get: function () { return error_1.CrtError; } });
//# sourceMappingURL=index.js.map

@@ -6,3 +6,3 @@ /**

* @module auth
* @preferred
* @mergeTarget
*/

@@ -9,0 +9,0 @@ import * as auth from '../common/auth';

@@ -5,4 +5,4 @@ /**

* @packageDocumentation
* @module aws-iot
* @preferred
* @module aws_iot
* @mergeTarget
*/

@@ -9,0 +9,0 @@ import { MqttConnectionConfig, MqttWill } from "./mqtt";

@@ -8,3 +8,7 @@ "use strict";

if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -22,3 +26,3 @@ if (k2 === undefined) k2 = k;

var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -42,2 +46,3 @@ return result;

const platform = __importStar(require("../common/platform"));
const error_1 = require("./error");
const auth_1 = require("./auth");

@@ -152,7 +157,12 @@ const iot_shared = __importStar(require("../common/aws_iot_shared"));

try {
yield auth_1.aws_sign_request(request, signing_config);
yield (0, auth_1.aws_sign_request)(request, signing_config);
done();
}
catch (error) {
done(error);
if (error instanceof error_1.CrtError) {
done(error.error_code);
}
else {
done(3); /* TODO: AWS_ERROR_UNKNOWN */
}
}

@@ -159,0 +169,0 @@ });

@@ -25,3 +25,2 @@ /*

/** @internal */
type StringLike = string | ArrayBuffer | ArrayBufferView;

@@ -379,3 +378,2 @@

/** @internal */
export class AwsCredentialsProvider {

@@ -382,0 +380,0 @@ protected constructor();

@@ -8,3 +8,7 @@ "use strict";

if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -22,3 +26,3 @@ if (k2 === undefined) k2 = k;

var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -34,2 +38,3 @@ return result;

if ('napi' in process_1.versions) {
// @ts-ignore
const napi_version = parseInt(process_1.versions['napi']);

@@ -47,3 +52,3 @@ if (napi_version < 4) {

const dist = path.join(source_root, 'dist');
if (fs_1.existsSync(dist)) {
if ((0, fs_1.existsSync)(dist)) {
source_root = dist;

@@ -57,3 +62,3 @@ }

for (const path of search_paths) {
if (fs_1.existsSync(path + '.node')) {
if ((0, fs_1.existsSync)(path + '.node')) {
binding = require(path);

@@ -60,0 +65,0 @@ break;

@@ -12,4 +12,8 @@ "use strict";

/**
*
* A module containing various checksum implementations intended for streaming payloads
*
* @packageDocumentation
* @module crypto
* @module checksums
* @mergeTarget
*/

@@ -16,0 +20,0 @@ const binding_1 = __importDefault(require("./binding"));

@@ -12,4 +12,8 @@ "use strict";

/**
*
* A module containing some miscellaneous crt native memory queries
*
* @packageDocumentation
* @module crt
* @mergeTarget
*/

@@ -16,0 +20,0 @@ /**

@@ -12,4 +12,7 @@ "use strict";

/**
* A module containing support for a variety of cryptographic operations.
*
* @packageDocumentation
* @module crypto
* @mergeTarget
*/

@@ -16,0 +19,0 @@ const binding_1 = __importDefault(require("./binding"));

@@ -12,7 +12,9 @@ "use strict";

/**
* Library-specific error extension type
*
* @packageDocumentation
* @module crt
* @module error
* @mergeTarget
*/
const binding_1 = __importDefault(require("./binding"));
const util_1 = require("util");
/**

@@ -35,3 +37,3 @@ * Represents an error encountered in native code. Can also be used to convert a numeric error code into

function extract_message(error) {
if (util_1.isNumber(error)) {
if (typeof error === 'number') {
return binding_1.default.error_code_to_string(error);

@@ -45,3 +47,3 @@ }

function extract_code(error) {
if (util_1.isNumber(error)) {
if (typeof error === 'number') {
return error;

@@ -55,3 +57,3 @@ }

function extract_name(error) {
if (util_1.isNumber(error)) {
if (typeof error === 'number') {
return binding_1.default.error_code_to_name(error);

@@ -58,0 +60,0 @@ }

/**
*
* A module containing support for creating http connections and making requests on them.
*
* @packageDocumentation
* @module http
* @mergeTarget
*/

@@ -56,25 +60,19 @@ import crt_native from './binding';

*
* @param event type of event (connect)
* @param listener event listener to use
*
* @event
*/
on(event: 'connect', listener: HttpClientConnectionConnected): this;
static CONNECT: string;
/**
* Emitted when an error occurs on the connection
*
* @param event type of event (error)
* @param listener event listener to use
*
* @event
*/
on(event: 'error', listener: HttpClientConnectionError): this;
static ERROR: string;
/**
* Emitted when the connection has completed
*
* @param event type of event (close)
* @param listener event listener to use
*
* @event
*/
static CLOSE: string;
on(event: 'connect', listener: HttpClientConnectionConnected): this;
on(event: 'error', listener: HttpClientConnectionError): this;
on(event: 'close', listener: HttpClientConnectionClosed): this;

@@ -205,3 +203,2 @@ }

*
* @asMemberOf HttpClientStream
* @category HTTP

@@ -216,3 +213,2 @@ */

*
* @asMemberOf HttpClientStream
* @category HTTP

@@ -243,43 +239,33 @@ */

*
* @param event type of event (response)
* @param listener event listener to use
*
* @event
*/
on(event: 'response', listener: HttpStreamResponse): this;
static RESPONSE: string;
/**
* Emitted when http response data is available.
*
* @param event type of event (data)
* @param listener event listener to use
*
* @event
*/
on(event: 'data', listener: HttpStreamData): this;
static DATA: string;
/**
* Emitted when an error occurs in stream processing
*
* @param event type of event (error)
* @param listener event listener to use
*
* @event
*/
on(event: 'error', listener: HttpStreamError): this;
static ERROR: string;
/**
* Emitted when the stream has completed
*
* @param event type of event (end)
* @param listener event listener to use
*
* @event
*/
on(event: 'end', listener: HttpStreamComplete): this;
static END: string;
/**
* Emitted when inline headers are delivered while communicating over H2
*
* @param event type of event (headers)
* @param listener event listener to use
*
* @event
*/
*/
static HEADERS: string;
on(event: 'response', listener: HttpStreamResponse): this;
on(event: 'data', listener: HttpStreamData): this;
on(event: 'error', listener: HttpStreamError): this;
on(event: 'end', listener: HttpStreamComplete): this;
on(event: 'headers', listener: HttpStreamHeaders): this;

@@ -286,0 +272,0 @@ /** @internal */

@@ -10,6 +10,10 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpClientConnectionManager = exports.HttpClientStream = exports.HttpStream = exports.HttpClientConnection = exports.HttpProxyOptions = exports.HttpProxyConnectionType = exports.HttpConnection = exports.HttpRequest = exports.HttpHeaders = void 0;
exports.HttpClientConnectionManager = exports.HttpClientStream = exports.HttpStream = exports.HttpClientConnection = exports.HttpProxyOptions = exports.HttpProxyConnectionType = exports.HttpConnection = exports.HttpRequest = exports.HttpHeaders = exports.HttpProxyAuthenticationType = void 0;
/**
*
* A module containing support for creating http connections and making requests on them.
*
* @packageDocumentation
* @module http
* @mergeTarget
*/

@@ -44,3 +48,3 @@ const binding_1 = __importDefault(require("./binding"));

*/
class HttpConnection extends native_resource_1.NativeResourceMixin(event_1.BufferedEventEmitter) {
class HttpConnection extends (0, native_resource_1.NativeResourceMixin)(event_1.BufferedEventEmitter) {
constructor(native_handle) {

@@ -71,2 +75,20 @@ super();

/**
* Emitted when the connection is connected and ready to start streams
*
* @event
*/
HttpConnection.CONNECT = 'connect';
/**
* Emitted when an error occurs on the connection
*
* @event
*/
HttpConnection.ERROR = 'error';
/**
* Emitted when the connection has completed
*
* @event
*/
HttpConnection.CLOSE = 'close';
/**
* Proxy connection types.

@@ -202,3 +224,3 @@ *

*/
class HttpStream extends native_resource_1.NativeResourceMixin(event_1.BufferedEventEmitter) {
class HttpStream extends (0, native_resource_1.NativeResourceMixin)(event_1.BufferedEventEmitter) {
constructor(native_handle, connection) {

@@ -287,2 +309,32 @@ super();

/**
* Emitted when the http response headers have arrived.
*
* @event
*/
HttpClientStream.RESPONSE = 'response';
/**
* Emitted when http response data is available.
*
* @event
*/
HttpClientStream.DATA = 'data';
/**
* Emitted when an error occurs in stream processing
*
* @event
*/
HttpClientStream.ERROR = 'error';
/**
* Emitted when the stream has completed
*
* @event
*/
HttpClientStream.END = 'end';
/**
* Emitted when inline headers are delivered while communicating over H2
*
* @event
*/
HttpClientStream.HEADERS = 'headers';
/**
* Creates, manages, and vends connections to a given host/port endpoint

@@ -289,0 +341,0 @@ *

@@ -10,7 +10,17 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Pkcs11Lib = exports.TlsConnectionOptions = exports.ServerTlsContext = exports.ClientTlsContext = exports.TlsContext = exports.TlsContextOptions = exports.SocketOptions = exports.ClientBootstrap = exports.InputStream = exports.is_alpn_available = exports.enable_logging = exports.LogLevel = exports.error_code_to_name = exports.error_code_to_string = void 0;
exports.Pkcs11Lib = exports.TlsConnectionOptions = exports.ServerTlsContext = exports.ClientTlsContext = exports.TlsContext = exports.TlsContextOptions = exports.SocketOptions = exports.ClientBootstrap = exports.InputStream = exports.is_alpn_available = exports.enable_logging = exports.LogLevel = exports.error_code_to_name = exports.error_code_to_string = exports.SocketDomain = exports.SocketType = exports.TlsVersion = void 0;
/**
*
* A module containing a grab bag of support for core network I/O functionality, including sockets, TLS, DNS, logging,
* error handling, streams, and connection -> thread mapping.
*
* Categories include:
* - Network: socket configuration
* - TLS: tls configuration
* - Logging: logging controls and configuration
* - IO: everything else
*
* @packageDocumentation
* @module IO
* @module io
* @mergeTarget
*/

@@ -17,0 +27,0 @@ const binding_1 = __importDefault(require("./binding"));

import { NativeResource } from "./native_resource";
import { BufferedEventEmitter } from '../common/event';
import { CrtError } from './error';
import * as io from "./io";
import { HttpProxyOptions, HttpRequest } from './http';
export { HttpProxyOptions } from './http';
import { QoS, Payload, MqttRequest, MqttSubscribeRequest, MqttWill, OnMessageCallback, MqttConnectionConnected, MqttConnectionDisconnected, MqttConnectionError, MqttConnectionInterrupted, MqttConnectionResumed } from "../common/mqtt";
import { QoS, Payload, MqttRequest, MqttSubscribeRequest, MqttWill, OnMessageCallback, MqttConnectionConnected, MqttConnectionDisconnected, MqttConnectionResumed } from "../common/mqtt";
export { QoS, Payload, MqttRequest, MqttSubscribeRequest, MqttWill, OnMessageCallback } from "../common/mqtt";
/**
* Listener signature for event emitted from an {@link MqttClientConnection} when an error occurs
*
* @param error the error that occurred
*
* @category MQTT
*/
export declare type MqttConnectionError = (error: CrtError) => void;
/**
* Listener signature for event emitted from an {@link MqttClientConnection} when the connection has been
* interrupted unexpectedly.
*
* @param error description of the error that occurred
*
* @category MQTT
*/
export declare type MqttConnectionInterrupted = (error: CrtError) => void;
/**
* MQTT client

@@ -140,17 +158,11 @@ *

*
* @param event the type of event (connect)
* @param listener the event listener to use
*
* @event
*/
on(event: 'connect', listener: MqttConnectionConnected): this;
static CONNECT: string;
/**
* Emitted when connection has disconnected sucessfully.
*
* @param event the type of event (disconnect)
* @param listener the event listener to use
*
* @event
*/
on(event: 'disconnect', listener: MqttConnectionDisconnected): this;
static DISCONNECT: string;
/**

@@ -160,8 +172,5 @@ * Emitted when an error occurs. The error will contain the error

*
* @param event the type of event (error)
* @param listener the event listener to use
*
* @event
*/
on(event: 'error', listener: MqttConnectionError): this;
static ERROR: string;
/**

@@ -171,25 +180,22 @@ * Emitted when the connection is dropped unexpectedly. The error will contain the error

*
* @param event the type of event (interrupt)
* @param listener the event listener to use
*
* @event
*/
on(event: 'interrupt', listener: MqttConnectionInterrupted): this;
static INTERRUPT: string;
/**
* Emitted when the connection reconnects (after an interrupt). Only triggers on connections after the initial one.
*
* @param event the type of event (resume)
* @param listener the event listener to use
*
* @event
*/
on(event: 'resume', listener: MqttConnectionResumed): this;
static RESUME: string;
/**
* Emitted when any MQTT publish message arrives.
*
* @param event the type of event (message)
* @param listener the event listener to use
*
* @event
*/
static MESSAGE: string;
on(event: 'connect', listener: MqttConnectionConnected): this;
on(event: 'disconnect', listener: MqttConnectionDisconnected): this;
on(event: 'error', listener: MqttConnectionError): this;
on(event: 'interrupt', listener: MqttConnectionInterrupted): this;
on(event: 'resume', listener: MqttConnectionResumed): this;
on(event: 'message', listener: OnMessageCallback): this;

@@ -196,0 +202,0 @@ /**

@@ -8,3 +8,7 @@ "use strict";

if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -22,3 +26,3 @@ if (k2 === undefined) k2 = k;

var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -40,6 +44,10 @@ return result;

Object.defineProperty(exports, "__esModule", { value: true });
exports.MqttClientConnection = exports.MqttClient = void 0;
exports.MqttClientConnection = exports.MqttClient = exports.MqttWill = exports.QoS = exports.HttpProxyOptions = void 0;
/**
*
* A module containing support for mqtt connection establishment and operations.
*
* @packageDocumentation
* @module mqtt
* @mergeTarget
*/

@@ -106,3 +114,3 @@ const binding_1 = __importDefault(require("./binding"));

*/
class MqttClientConnection extends native_resource_1.NativeResourceMixin(event_1.BufferedEventEmitter) {
class MqttClientConnection extends (0, native_resource_1.NativeResourceMixin)(event_1.BufferedEventEmitter) {
/**

@@ -360,2 +368,40 @@ * @param client The client that owns this connection

exports.MqttClientConnection = MqttClientConnection;
/**
* Emitted when the connection successfully establishes itself for the first time
*
* @event
*/
MqttClientConnection.CONNECT = 'connect';
/**
* Emitted when connection has disconnected sucessfully.
*
* @event
*/
MqttClientConnection.DISCONNECT = 'disconnect';
/**
* Emitted when an error occurs. The error will contain the error
* code and message.
*
* @event
*/
MqttClientConnection.ERROR = 'error';
/**
* Emitted when the connection is dropped unexpectedly. The error will contain the error
* code and message. The underlying mqtt implementation will attempt to reconnect.
*
* @event
*/
MqttClientConnection.INTERRUPT = 'interrupt';
/**
* Emitted when the connection reconnects (after an interrupt). Only triggers on connections after the initial one.
*
* @event
*/
MqttClientConnection.RESUME = 'resume';
/**
* Emitted when any MQTT publish message arrives.
*
* @event
*/
MqttClientConnection.MESSAGE = 'message';
//# sourceMappingURL=mqtt.js.map
{
"name": "aws-crt",
"version": "1.12.5",
"version": "1.13.0",
"description": "NodeJS/browser bindings to the aws-c-* libraries",

@@ -39,7 +39,5 @@ "homepage": "https://github.com/awslabs/aws-crt-nodejs",

"ts-jest": "^27.0.5",
"typedoc": "^0.17.8",
"typedoc-plugin-as-member-of": "^1.0.2",
"typedoc-plugin-external-module-name": "^4.0.6",
"typedoc-plugin-remove-references": "^0.0.5",
"typescript": "^3.9.9",
"typedoc": "^0.22.18",
"typedoc-plugin-merge-modules": "^3.1.0",
"typescript": "^4.7.4",
"uuid": "^8.3.2",

@@ -46,0 +44,0 @@ "yargs": "^17.2.1"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc