Skip to content

Request response workspace #545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 81 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
e7a1a74
WIP
May 10, 2024
ee1d07b
implementation sketch
bretambrose May 10, 2024
412ac6d
Checkpoint
bretambrose May 13, 2024
c529ef5
Full named shadow client initial impl
bretambrose May 15, 2024
0c72ed6
Named shadow success tests + sample cleanup
bretambrose May 16, 2024
a602169
Check sub status
bretambrose May 16, 2024
1d27cb0
Shadow client generated checkpoint
bretambrose Jun 19, 2024
b676e13
Checkpoint
Jun 25, 2024
915e595
Create/destroy tests
bretambrose Jun 25, 2024
6de1fe9
Test checkpoint
Jun 27, 2024
0f2807e
New shadow sample
bretambrose Jun 27, 2024
73aa7c9
Job processing test and deprecated v1 samples
Jun 28, 2024
573dcc5
Identity checkpoint
Jun 28, 2024
b0596f1
Maps are modeled in a messed up way unfortunately
Jun 29, 2024
1fa060c
More sample work
bretambrose Jun 30, 2024
fa996fd
Shadow sample README
Jul 1, 2024
9172363
Sample README updates
Jul 2, 2024
aa3be96
Provisioning sample READMEs
bretambrose Jul 10, 2024
7bbffe9
Codegen updates
Oct 16, 2024
d705679
Updates
Jan 28, 2025
8e1c66c
Updates
Feb 7, 2025
fff86d8
Checkpoint
bretambrose Feb 8, 2025
b24ab92
setup macos 13 and macos latest (#505)
xiazhvera May 30, 2024
21c04d7
Run Greengrass samples in CI (#506)
sfod Jun 11, 2024
079ba1b
Add copyright header (#509)
sfod Jun 12, 2024
617d347
Dependency update (#511)
sbSteveK Jun 14, 2024
063b261
Bump ws from 7.5.9 to 7.5.10 (#512)
dependabot[bot] Jun 24, 2024
22cefac
[v1.19.6] Pin CRT until TLS13 issue resolved (#514)
bretambrose Jul 5, 2024
7ee5e01
Update Greengrass IPC (#515)
sfod Jul 12, 2024
8084dde
[v1.20.0] Update Greengrass IPC model (#516)
bretambrose Jul 12, 2024
6b64f61
Use node-16 for Mac OS arm64 job (#519)
sfod Aug 12, 2024
833d4cc
update pubsub links (#518)
jmklix Aug 13, 2024
f3a6317
Update NodeJS to v1.21.8 (#520)
xiazhvera Aug 22, 2024
8248b31
[v1.20.1] Improve Linux s2n support (#521)
bretambrose Aug 22, 2024
1f92e29
Update CRT (#522)
bretambrose Aug 29, 2024
945123e
Re-Export ICrtError (#500)
bretambrose Aug 29, 2024
e55702a
[v1.21.0] MQTT-js major version upgrade (#523)
bretambrose Aug 29, 2024
a13e2a1
Use the actual aws-crt dependency version to make docs (#527)
sfod Sep 5, 2024
2278b97
Revert "Update CRT (#522)" (#526)
sfod Sep 5, 2024
8bdc409
[v1.21.1] MQTT-js revert (#528)
bretambrose Sep 5, 2024
a2a04ac
move mac-only tls info to main README (#534)
sbSteveK Oct 14, 2024
4cfba6c
Bump axios and jest-puppeteer (#471)
dependabot[bot] Dec 4, 2024
3b374b4
Set client ID in samples (#541)
sfod Dec 30, 2024
5461dd9
Codegen updates
Feb 27, 2025
6910f9e
Merge branch 'main' into RequestResponseWorkspace
Feb 27, 2025
815d5cc
Codegen updates + node type update
Feb 28, 2025
b6e32cd
Testing
Feb 28, 2025
f89376e
Revert package lock and attempt fix of payload transform
Feb 28, 2025
8da492b
Test updates
Feb 28, 2025
2bf2f9c
What version of node is barfing on the http sdk?
Feb 28, 2025
5cf68bb
What happens if we try to use node 16?
Feb 28, 2025
f2b8cd1
Pin iot client to one that still supports node 14 hopefully
Feb 28, 2025
dd0b74e
Use a builder version that has the v2 service test env variables set
Feb 28, 2025
308c93f
Remove unnecessary/broken CI jobs
Mar 4, 2025
aa6495d
What's not defined?
Mar 4, 2025
f871c78
softhsm package
Mar 4, 2025
82f31e5
Let's split testing into unit (via builder) and IoT-account-integrati…
Mar 7, 2025
4362978
Remove temporary env check
Mar 7, 2025
31cc773
Unused
Mar 7, 2025
fdcadbe
Experimenting
Mar 7, 2025
2315bd0
Move to different env variables
Mar 7, 2025
7728172
Update cleanup
Mar 7, 2025
1017e99
Manually update module export file to verify fix prior to codegen update
Mar 7, 2025
709af3e
Fix v1 service client error type export
Mar 7, 2025
d0f0ecb
Pin smoke test ubuntu version
Mar 7, 2025
a0ab298
add identity and jobs testing
Mar 10, 2025
ce389a4
Proper test file name
Mar 10, 2025
b3e78f4
Update jobs test env variables used
Mar 10, 2025
7893da6
Pull region from env variable too
Mar 10, 2025
cd85a51
Run service tests on windows and macs too
Mar 10, 2025
409f293
Use deprecated sample, not interactive sandbox
Mar 10, 2025
3c050b7
Final action name
Mar 10, 2025
d81157f
Update package lock from node-14
Mar 10, 2025
b3cb2de
Minor updates from self-review
Mar 10, 2025
028ff4c
Update documentation entry points
Mar 10, 2025
c27b8a1
request response docs
Mar 10, 2025
481581e
more request response doc roots
Mar 10, 2025
85c55d1
Updates
Mar 10, 2025
215cb5b
Merge branch 'main' into RequestResponseWorkspace
Jun 25, 2025
d9f1272
Update cred fetch
Jun 25, 2025
35ba0ae
Update package lock with node 14
Jun 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 60 additions & 64 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- 'docs'

env:
BUILDER_VERSION: v0.9.62
BUILDER_VERSION: v0.9.75
BUILDER_SOURCE: releases
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
PACKAGE_NAME: aws-iot-device-sdk-js-v2
Expand All @@ -32,46 +32,6 @@ env:
CI_JOBS_SERVICE_CLIENT_ROLE: arn:aws:iam::180635532705:role/CI_JobsServiceClient_Role

jobs:

al2:
runs-on: ubuntu-latest
permissions:
id-token: write # This is required for requesting the JWT
steps:
- name: configure AWS credentials (containers)
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ env.CI_IOT_CONTAINERS }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
# We can't use the `uses: docker://image` version yet, GitHub lacks authentication for actions -> packages
- name: Build ${{ env.PACKAGE_NAME }}
run: |
aws s3 cp s3://aws-crt-test-stuff/ci/${{ env.BUILDER_VERSION }}/linux-container-ci.sh ./linux-container-ci.sh && chmod a+x ./linux-container-ci.sh
./linux-container-ci.sh ${{ env.BUILDER_VERSION }} aws-crt-al2-x64 build -p ${{ env.PACKAGE_NAME }}

raspberry:
runs-on: ubuntu-latest # latest
permissions:
id-token: write # This is required for requesting the JWT
strategy:
fail-fast: false
matrix:
image:
- raspbian-bullseye
steps:
- name: configure AWS credentials (containers)
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ env.CI_IOT_CONTAINERS }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
# set arm arch
- name: Install qemu/docker
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Build ${{ env.PACKAGE_NAME }}
run: |
aws s3 cp s3://aws-crt-test-stuff/ci/${{ env.BUILDER_VERSION }}/linux-container-ci.sh ./linux-container-ci.sh && chmod a+x ./linux-container-ci.sh
./linux-container-ci.sh ${{ env.BUILDER_VERSION }} aws-crt-${{ matrix.image }} build -p ${{ env.PACKAGE_NAME }}

windows:
runs-on: windows-latest
permissions:
Expand All @@ -85,7 +45,7 @@ jobs:
run: |
python -m pip install boto3
- name: configure AWS credentials (PubSub)
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_PUBSUB_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
Expand All @@ -101,7 +61,7 @@ jobs:
run: |
python ./aws-iot-device-sdk-js-v2/utils/run_in_ci.py --file ./aws-iot-device-sdk-js-v2/.github/workflows/ci_run_windows_cert_connect_cfg.json
- name: configure AWS credentials (Device Advisor)
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_DEVICE_ADVISOR }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
Expand Down Expand Up @@ -131,7 +91,7 @@ jobs:
source .venv/bin/activate
python3 -m pip install boto3
- name: configure AWS credentials (PubSub)
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_PUBSUB_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
Expand All @@ -155,7 +115,7 @@ jobs:
source .venv/bin/activate
python3 ./aws-iot-device-sdk-js-v2/utils/run_in_ci.py --file ./aws-iot-device-sdk-js-v2/.github/workflows/ci_run_pkcs12_connect_cfg.json
- name: configure AWS credentials (Device Advisor)
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_DEVICE_ADVISOR }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
Expand All @@ -179,7 +139,7 @@ jobs:
run: |
python3 -m pip install boto3
- name: configure AWS credentials (PubSub)
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_PUBSUB_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
Expand All @@ -194,7 +154,7 @@ jobs:
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
python ./aws-iot-device-sdk-js-v2/utils/run_in_ci.py --file ./aws-iot-device-sdk-js-v2/.github/workflows/ci_run_pubsub_electron_cfg.json
- name: configure AWS credentials (Device Advisor)
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_DEVICE_ADVISOR }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
Expand All @@ -203,6 +163,42 @@ jobs:
cd ./aws-iot-device-sdk-js-v2
python3 ./deviceadvisor/script/DATestRun.py

v2-service-client-tests:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner:
- macos-13
- ubuntu-22.04
- windows-2022
permissions:
id-token: write # This is required for requesting the JWT
steps:
- name: Checkout Sources
uses: actions/checkout@v2
- uses: actions/setup-node@v4
with:
node-version: 16
- name: Build ${{ env.PACKAGE_NAME }}
run: |
npm install
- name: Install boto3
run: |
python3 -m pip install boto3
- name: configure AWS credentials (MQTT5)
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Service tests
shell: bash
run: |
source utils/test_setup.sh s3://iot-sdk-ci-bucket-us-east1/IotUsProdMqtt5EnvironmentVariables.txt us-east-1
npm run test -- iotshadowclientv2
npm run test -- iotidentityclientv2
npm run test -- iotjobsclientv2
source utils/test_cleanup.sh

# Runs the samples and ensures that everything is working
linux-smoke-tests:
runs-on: ubuntu-22.04
Expand All @@ -221,7 +217,7 @@ jobs:
sudo apt-get install softhsm2 -y
softhsm2-util --version
- name: configure AWS credentials (Shadow)
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_SHADOW_SERVICE_CLIENT_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
Expand All @@ -246,7 +242,7 @@ jobs:
export PYTHONPATH=${{ github.workspace }}/aws-iot-device-sdk-js-v2/utils
python3 ./test_cases/test_shadow_update.py --config-file test_cases/mqtt5_named_shadow_cfg.json
- name: configure AWS credentials (Fleet provisioning)
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_FLEET_PROVISIONING_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
Expand All @@ -271,7 +267,7 @@ jobs:
export PYTHONPATH=${{ github.workspace }}/aws-iot-device-sdk-js-v2/utils
python3 ./test_cases/test_fleet_provisioning.py --config-file test_cases/mqtt5_fleet_provisioning_with_csr_cfg.json --thing-name-prefix Fleet_Thing_
- name: configure AWS credentials (Jobs)
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_JOBS_SERVICE_CLIENT_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
Expand All @@ -286,7 +282,7 @@ jobs:
export PYTHONPATH=${{ github.workspace }}/aws-iot-device-sdk-js-v2/utils
python3 ./test_cases/test_jobs_execution.py --config-file test_cases/mqtt5_jobs_cfg.json
- name: configure AWS credentials (Connect and PubSub)
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_PUBSUB_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
Expand Down Expand Up @@ -316,64 +312,64 @@ jobs:
echo "directories.tokendir = /tmp/tokens" > /tmp/softhsm2.conf
python3 ./aws-iot-device-sdk-js-v2/utils/run_in_ci.py --file ./aws-iot-device-sdk-js-v2/.github/workflows/ci_run_pkcs11_connect_cfg.json
- name: configure AWS credentials (Cognito)
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_COGNITO_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run Cognito Connect sample
run: |
python3 ./aws-iot-device-sdk-js-v2/utils/run_in_ci.py --file ./aws-iot-device-sdk-js-v2/.github/workflows/ci_run_cognito_connect_cfg.json
- name: configure AWS credentials (X509)
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_X509_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run X509 sample
run: |
python3 ./aws-iot-device-sdk-js-v2/utils/run_in_ci.py --file ./aws-iot-device-sdk-js-v2/.github/workflows/ci_run_x509_connect_cfg.json
- name: configure AWS credentials (Custom Authorizer)
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_CUSTOM_AUTHORIZER_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run CustomAuthorizerConnect sample
run: |
python3 ./aws-iot-device-sdk-js-v2/utils/run_in_ci.py --file ./aws-iot-device-sdk-js-v2/.github/workflows/ci_run_custom_authorizer_connect_cfg.json
- name: configure AWS credentials (Shadow)
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_SHADOW_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run Shadow sample
- name: run v1 Shadow sample
run: |
python3 ./aws-iot-device-sdk-js-v2/utils/run_in_ci.py --file ./aws-iot-device-sdk-js-v2/.github/workflows/ci_run_shadow_cfg.json
- name: run Mqtt5 Shadow sample
- name: run v1 Mqtt5 Shadow sample
run: |
python3 ./aws-iot-device-sdk-js-v2/utils/run_in_ci.py --file ./aws-iot-device-sdk-js-v2/.github/workflows/ci_run_shadow_mqtt5_cfg.json
- name: configure AWS credentials (Jobs)
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_JOBS_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run Jobs sample
- name: run v1 Jobs sample
run: |
python3 ./aws-iot-device-sdk-js-v2/utils/run_in_ci.py --file ./aws-iot-device-sdk-js-v2/.github/workflows/ci_run_jobs_cfg.json
- name: run Mqtt5 Jobs sample
- name: run v1 Mqtt5 Jobs sample
run: |
python3 ./aws-iot-device-sdk-js-v2/utils/run_in_ci.py --file ./aws-iot-device-sdk-js-v2/.github/workflows/ci_run_jobs_mqtt5_cfg.json
- name: configure AWS credentials (Fleet provisioning)
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_FLEET_PROVISIONING_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run Fleet Provisioning sample
- name: run v1 Fleet Provisioning sample
run: |
python3 ./aws-iot-device-sdk-js-v2/utils/run_fleet_provisioning_sample.py --file ./aws-iot-device-sdk-js-v2/.github/workflows/ci_run_fleet_provisioning_cfg.json --thing-name-prefix "Fleet_Thing_"
- name: run Mqtt5 Fleet Provisioning sample
- name: run v1 Mqtt5 Fleet Provisioning sample
run: |
python3 ./aws-iot-device-sdk-js-v2/utils/run_fleet_provisioning_sample.py --file ./aws-iot-device-sdk-js-v2/.github/workflows/ci_run_fleet_provisioning_mqtt5_cfg.json --thing-name-prefix "Fleet_Thing_"
- name: configure AWS credentials (MQTT5 PubSub)
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_run_fleet_provisioning_cfg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"language": "Javascript",
"runnable_file": "./aws-iot-device-sdk-js-v2/samples/node/fleet_provisioning",
"runnable_file": "./aws-iot-device-sdk-js-v2/samples/node/deprecated/fleet_provisioning",
"runnable_region": "us-east-1",
"runnable_main_class": "",
"arguments": [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_run_fleet_provisioning_mqtt5_cfg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"language": "Javascript",
"runnable_file": "./aws-iot-device-sdk-js-v2/samples/node/fleet_provisioning",
"runnable_file": "./aws-iot-device-sdk-js-v2/samples/node/deprecated/fleet_provisioning",
"runnable_region": "us-east-1",
"runnable_main_class": "",
"arguments": [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_run_jobs_cfg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"language": "Javascript",
"runnable_file": "./aws-iot-device-sdk-js-v2/samples/node/jobs",
"runnable_file": "./aws-iot-device-sdk-js-v2/samples/node/deprecated/jobs",
"runnable_region": "us-east-1",
"runnable_main_class": "",
"arguments": [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_run_jobs_mqtt5_cfg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"language": "Javascript",
"runnable_file": "./aws-iot-device-sdk-js-v2/samples/node/jobs",
"runnable_file": "./aws-iot-device-sdk-js-v2/samples/node/deprecated/jobs",
"runnable_region": "us-east-1",
"runnable_main_class": "",
"arguments": [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_run_shadow_cfg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"language": "Javascript",
"runnable_file": "./aws-iot-device-sdk-js-v2/samples/node/shadow",
"runnable_file": "./aws-iot-device-sdk-js-v2/samples/node/deprecated/shadow",
"runnable_region": "us-east-1",
"runnable_main_class": "",
"arguments": [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_run_shadow_mqtt5_cfg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"language": "Javascript",
"runnable_file": "./aws-iot-device-sdk-js-v2/samples/node/shadow",
"runnable_file": "./aws-iot-device-sdk-js-v2/samples/node/deprecated/shadow",
"runnable_region": "us-east-1",
"runnable_main_class": "",
"arguments": [
Expand Down
2 changes: 1 addition & 1 deletion codebuild/samples/shadow-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -o pipefail

env

pushd $CODEBUILD_SRC_DIR/samples/node/shadow
pushd $CODEBUILD_SRC_DIR/samples/node/deprecated/shadow

ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "ci/endpoint" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g')

Expand Down
8 changes: 5 additions & 3 deletions docsrc/typedoc-browser.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"entryPoints": [
"../lib/greengrass/discoveryclient.ts",
"../lib/iotidentity/iotidentityclient.ts",
"../lib/iotjobs/iotjobsclient.ts",
"../lib/iotshadow/iotshadowclient.ts",
"../lib/iotidentity/iotidentity.ts",
"../lib/iotjobs/iotjobs.ts",
"../lib/iotshadow/iotshadow.ts",
"../lib/mqtt_request_response.ts",
"../lib/mqtt_request_response_utils.ts",
"../build/docs/aws-crt-nodejs/lib/browser/auth.ts",
"../build/docs/aws-crt-nodejs/lib/browser/error.ts",
"../build/docs/aws-crt-nodejs/lib/browser/http.ts",
Expand Down
8 changes: 5 additions & 3 deletions docsrc/typedoc-node.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
"../lib/greengrass/discoveryclient.ts",
"../lib/greengrasscoreipc.ts",
"../lib/greengrasscoreipc/client.ts",
"../lib/iotidentity/iotidentityclient.ts",
"../lib/iotjobs/iotjobsclient.ts",
"../lib/iotshadow/iotshadowclient.ts",
"../lib/iotidentity/iotidentity.ts",
"../lib/iotjobs/iotjobs.ts",
"../lib/iotshadow/iotshadow.ts",
"../lib/mqtt_request_response.ts",
"../lib/mqtt_request_response_utils.ts",
"../build/docs/aws-crt-nodejs/lib/native/auth.ts",
"../build/docs/aws-crt-nodejs/lib/native/binding.d.ts",
"../build/docs/aws-crt-nodejs/lib/native/error.ts",
Expand Down
8 changes: 5 additions & 3 deletions lib/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
* @mergeTarget
*/

import * as iotidentity from './iotidentity/iotidentityclient';
import * as greengrass from './greengrass/discoveryclient';
import * as iotjobs from './iotjobs/iotjobsclient';
import * as iotshadow from './iotshadow/iotshadowclient';
import * as iotidentity from './iotidentity/iotidentity';
import * as iotjobs from './iotjobs/iotjobs';
import * as iotshadow from './iotshadow/iotshadow';
import * as mqtt_request_response from './mqtt_request_response';

import {
auth,
Expand All @@ -37,6 +38,7 @@ export {
iotshadow,
mqtt,
mqtt5,
mqtt_request_response,
CrtError,
ICrtError
}
16 changes: 15 additions & 1 deletion lib/eventstream_rpc_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,21 @@ import {CrtError, eventstream} from "aws-crt";
* @return a base64-encoded string
*/
export function encodePayloadAsString(payload : eventstream.Payload) : string {
return Buffer.from(payload).toString("base64");
if (typeof payload === "string") {
return Buffer.from(payload).toString("base64");
}

if (ArrayBuffer.isView(payload)) {
const view = payload as ArrayBufferView;
return Buffer.from(view.buffer, view.byteOffset, view.byteLength).toString("base64");
}

if (payload instanceof ArrayBuffer) {
let buffer = payload as ArrayBuffer;
return Buffer.from(buffer).toString("base64");
}

throw new TypeError("payload parameter must be a string, ArrayBuffer, or DataView.");
}

/**
Expand Down
Loading
Loading