Socket
Socket
Sign inDemoInstall

aws-crt

Package Overview
Dependencies
67
Maintainers
4
Versions
121
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.18.3 to 1.19.0

25

dist.browser/browser/http.js

@@ -21,2 +21,25 @@ "use strict";

})();
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = 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) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __generator = (this && this.__generator) || function (thisArg, body) {

@@ -75,3 +98,3 @@ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;

var error_1 = require("./error");
var axios = require("axios");
var axios = __importStar(require("axios"));
var io_1 = require("./io");

@@ -78,0 +101,0 @@ var util_utf8_browser_1 = require("@aws-sdk/util-utf8-browser");

2

lib/browser/http.ts

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

import { CrtError } from './error';
import axios = require('axios');
import * as axios from "axios";
import { ClientBootstrap, InputStream, SocketOptions, TlsConnectionOptions } from './io';

@@ -33,0 +33,0 @@ import { fromUtf8 } from '@aws-sdk/util-utf8-browser';

@@ -17,3 +17,3 @@ /*

async function makeConnection(will?: MqttWill) : Promise<MqttClientConnection> {
async function makeConnection(will?: MqttWill, client_id: string = `node-mqtt-unit-test-${uuid()}`) : Promise<MqttClientConnection> {
return new Promise<MqttClientConnection>(async (resolve, reject) => {

@@ -23,3 +23,3 @@ try {

.with_clean_session(true)
.with_client_id(`node-mqtt-unit-test-${uuid()}`)
.with_client_id(client_id)
.with_endpoint(test_env.AWS_IOT_ENV.MQTT311_HOST)

@@ -103,23 +103,63 @@ .with_credentials(

test_env.conditional_test(test_env.AWS_IOT_ENV.mqtt311_is_valid_iot_cred())('MQTT Will', async () => {
/* TODO: this doesn't really test anything. Unfortunately, there's no easy way to break the
* MQTT311 connection without it sending a client-side DISCONNECT packet which removes the will. It's not
* impossible but would require changes to the C API as well as the bindings to add a path that skips the
* DISCONNECT packet, which is far beyond the scope of refactoring these tests to be more procedural and reliable.
*/
const connection = await makeConnection(new MqttWill(
'test/last/will/and/testament',
// To check that Will message was successfully set for a connection, the connection should be closed without
// sending a client-side DISCONNECT packet. This test forces server to close connection by opening another
// connection with the same client ID.
const willTopic = 'test/last/will/and/testament'
const willPayload = 'AVENGE ME'
const client_id = `node-mqtt-unit-test-will-${uuid()}`
// Connection with Will set.
const connectionWithWill = await makeConnection(new MqttWill(
willTopic,
QoS.AtLeastOnce,
'AVENGE ME'
));
willPayload
), client_id);
const onConnectWithWill = once(connectionWithWill, 'connect');
const onDisconnectWithWill = once(connectionWithWill, 'disconnect');
await connectionWithWill.connect();
const connectWithWillResult = (await onConnectWithWill)[0];
expect(connectWithWillResult).toBeFalsy(); /* session present */
let onConnect = once(connection, 'connect');
let onDisconnect = once(connection, 'disconnect');
// The second connection that subscribes to first connection's Will topic.
const connectionWaitingForWill = await makeConnection();
const onConnectWaitingForWill = once(connectionWaitingForWill, 'connect');
const onDisconnectWaitingForWill = once(connectionWaitingForWill, 'disconnect');
await connectionWaitingForWill.connect()
const connectWaitingForWill = (await onConnectWaitingForWill)[0];
expect(connectWaitingForWill).toBeFalsy(); /* session present */
await connection.connect();
const onMessage = once(connectionWaitingForWill, 'message');
await connectionWaitingForWill.subscribe(willTopic, QoS.AtLeastOnce);
let connectResult = (await onConnect)[0];
expect(connectResult).toBeFalsy(); /* session present */
// The third connection that will cause the first one to be disconnected because it has the same client ID.
const connectionDuplicate = await makeConnection(undefined, client_id);
const onConnectDuplicate = once(connectionDuplicate, 'connect');
const onDisconnectDuplicate = once(connectionDuplicate, 'disconnect');
await connectionDuplicate.connect()
const connectDuplicateResult = (await onConnectDuplicate)[0];
expect(connectDuplicateResult).toBeFalsy(); /* session present */
await connection.disconnect();
await onDisconnect;
// The second connection should receive Will message after the first connection was kicked out.
const messageReceivedArgs = (await onMessage);
const messageReceivedTopic = messageReceivedArgs[0];
const messageReceivedPayload = messageReceivedArgs[1];
const messageReceivedQos = messageReceivedArgs[3];
const messageReceivedRetain = messageReceivedArgs[4];
expect(messageReceivedTopic).toEqual(willTopic);
expect(messageReceivedPayload).toBeDefined();
const payload_str = (new TextDecoder()).decode(new Uint8Array(messageReceivedPayload));
expect(payload_str).toEqual(willPayload);
expect(messageReceivedQos).toEqual(QoS.AtLeastOnce);
expect(messageReceivedRetain).toBeFalsy();
await connectionWaitingForWill.disconnect();
await onDisconnectWaitingForWill;
await connectionDuplicate.disconnect();
await onDisconnectDuplicate;
await connectionWithWill.disconnect();
await onDisconnectWithWill;
});

@@ -126,0 +166,0 @@

@@ -9,3 +9,3 @@ /*

import {once} from "events";
import crt_native, {cRuntime, CRuntimeType} from "./binding";
import crt_native from "./binding";
import * as os from "os";

@@ -318,7 +318,4 @@

/*
* Skip this test on Musl as it is very flaky
* TODO: Figure out why it is flaky on Musl and fix it.
*/
conditional_test(cRuntime !== CRuntimeType.MUSL && hasEchoServerEnvironment())('Eventstream protocol connection failure Echo Server - bad version', async () => {
conditional_test(hasEchoServerEnvironment())('Eventstream protocol connection failure Echo Server - bad version', async () => {
let connection : eventstream.ClientConnection = new eventstream.ClientConnection(makeGoodConfig());

@@ -325,0 +322,0 @@ await connection.connect({});

{
"name": "aws-crt",
"version": "1.18.3",
"version": "1.19.0",
"description": "NodeJS/browser bindings to the aws-c-* libraries",

@@ -48,3 +48,3 @@ "homepage": "https://github.com/awslabs/aws-crt-nodejs",

"yargs": "^17.2.1",
"cmake-js": "^6.3.2",
"cmake-js": "^7.2.1",
"tar": "^6.1.11"

@@ -54,6 +54,6 @@ },

"@aws-sdk/util-utf8-browser": "^3.109.0",
"@httptoolkit/websocket-stream": "^6.0.0",
"axios": "^0.24.0",
"@httptoolkit/websocket-stream": "^6.0.1",
"axios": "^1.6.0",
"buffer": "^6.0.3",
"crypto-js": "^4.0.0",
"crypto-js": "^4.2.0",
"mqtt": "^4.3.7",

@@ -60,0 +60,0 @@ "process": "^0.11.10"

@@ -7,8 +7,2 @@ ## AWS CRT JS

## Impending Node Version Update
In the coming months, the AWS Common Runtime will be updating its Node baseline from 10.16 to 14. A
[discussion thread](https://github.com/awslabs/aws-crt-nodejs/discussions/468)
has been created for any questions or feedback you may have. We do not yet have a concrete timeline for when the
update will happen.
## License

@@ -21,3 +15,3 @@

### Prereqs:
* Node 10.16+
* Node 14+
* npm

@@ -24,0 +18,0 @@ * CMake 3.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

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