lambda-live-debugger
Version:
Debug Lambda functions locally like it is running in the cloud
951 lines (899 loc) • 37.3 kB
JavaScript
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var index_exports = {};
__export(index_exports, {
ConflictException: () => ConflictException,
DeleteThingShadowCommand: () => DeleteThingShadowCommand,
GetRetainedMessageCommand: () => GetRetainedMessageCommand,
GetThingShadowCommand: () => GetThingShadowCommand,
InternalFailureException: () => InternalFailureException,
InvalidRequestException: () => InvalidRequestException,
IoTDataPlane: () => IoTDataPlane,
IoTDataPlaneClient: () => IoTDataPlaneClient,
IoTDataPlaneServiceException: () => IoTDataPlaneServiceException,
ListNamedShadowsForThingCommand: () => ListNamedShadowsForThingCommand,
ListRetainedMessagesCommand: () => ListRetainedMessagesCommand,
MethodNotAllowedException: () => MethodNotAllowedException,
PayloadFormatIndicator: () => PayloadFormatIndicator,
PublishCommand: () => PublishCommand,
RequestEntityTooLargeException: () => RequestEntityTooLargeException,
ResourceNotFoundException: () => ResourceNotFoundException,
ServiceUnavailableException: () => ServiceUnavailableException,
ThrottlingException: () => ThrottlingException,
UnauthorizedException: () => UnauthorizedException,
UnsupportedDocumentEncodingException: () => UnsupportedDocumentEncodingException,
UpdateThingShadowCommand: () => UpdateThingShadowCommand,
__Client: () => import_smithy_client.Client,
paginateListRetainedMessages: () => paginateListRetainedMessages
});
module.exports = __toCommonJS(index_exports);
// src/IoTDataPlaneClient.ts
var import_middleware_host_header = require("@aws-sdk/middleware-host-header");
var import_middleware_logger = require("@aws-sdk/middleware-logger");
var import_middleware_recursion_detection = require("@aws-sdk/middleware-recursion-detection");
var import_middleware_user_agent = require("@aws-sdk/middleware-user-agent");
var import_config_resolver = require("@smithy/config-resolver");
var import_core = require("@smithy/core");
var import_middleware_content_length = require("@smithy/middleware-content-length");
var import_middleware_endpoint = require("@smithy/middleware-endpoint");
var import_middleware_retry = require("@smithy/middleware-retry");
var import_httpAuthSchemeProvider = require("./auth/httpAuthSchemeProvider");
// src/endpoint/EndpointParameters.ts
var resolveClientEndpointParameters = /* @__PURE__ */ __name((options) => {
return Object.assign(options, {
useDualstackEndpoint: options.useDualstackEndpoint ?? false,
useFipsEndpoint: options.useFipsEndpoint ?? false,
defaultSigningName: "iotdata"
});
}, "resolveClientEndpointParameters");
var commonParams = {
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
Endpoint: { type: "builtInParams", name: "endpoint" },
Region: { type: "builtInParams", name: "region" },
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
};
// src/IoTDataPlaneClient.ts
var import_runtimeConfig = require("././runtimeConfig");
// src/runtimeExtensions.ts
var import_region_config_resolver = require("@aws-sdk/region-config-resolver");
var import_protocol_http = require("@smithy/protocol-http");
var import_smithy_client = require("@smithy/smithy-client");
// src/auth/httpAuthExtensionConfiguration.ts
var getHttpAuthExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => {
const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
let _credentials = runtimeConfig.credentials;
return {
setHttpAuthScheme(httpAuthScheme) {
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
if (index === -1) {
_httpAuthSchemes.push(httpAuthScheme);
} else {
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
}
},
httpAuthSchemes() {
return _httpAuthSchemes;
},
setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
_httpAuthSchemeProvider = httpAuthSchemeProvider;
},
httpAuthSchemeProvider() {
return _httpAuthSchemeProvider;
},
setCredentials(credentials) {
_credentials = credentials;
},
credentials() {
return _credentials;
}
};
}, "getHttpAuthExtensionConfiguration");
var resolveHttpAuthRuntimeConfig = /* @__PURE__ */ __name((config) => {
return {
httpAuthSchemes: config.httpAuthSchemes(),
httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
credentials: config.credentials()
};
}, "resolveHttpAuthRuntimeConfig");
// src/runtimeExtensions.ts
var resolveRuntimeExtensions = /* @__PURE__ */ __name((runtimeConfig, extensions) => {
const extensionConfiguration = Object.assign(
(0, import_region_config_resolver.getAwsRegionExtensionConfiguration)(runtimeConfig),
(0, import_smithy_client.getDefaultExtensionConfiguration)(runtimeConfig),
(0, import_protocol_http.getHttpHandlerExtensionConfiguration)(runtimeConfig),
getHttpAuthExtensionConfiguration(runtimeConfig)
);
extensions.forEach((extension) => extension.configure(extensionConfiguration));
return Object.assign(
runtimeConfig,
(0, import_region_config_resolver.resolveAwsRegionExtensionConfiguration)(extensionConfiguration),
(0, import_smithy_client.resolveDefaultRuntimeConfig)(extensionConfiguration),
(0, import_protocol_http.resolveHttpHandlerRuntimeConfig)(extensionConfiguration),
resolveHttpAuthRuntimeConfig(extensionConfiguration)
);
}, "resolveRuntimeExtensions");
// src/IoTDataPlaneClient.ts
var IoTDataPlaneClient = class extends import_smithy_client.Client {
static {
__name(this, "IoTDataPlaneClient");
}
/**
* The resolved configuration of IoTDataPlaneClient class. This is resolved and normalized from the {@link IoTDataPlaneClientConfig | constructor configuration interface}.
*/
config;
constructor(...[configuration]) {
const _config_0 = (0, import_runtimeConfig.getRuntimeConfig)(configuration || {});
super(_config_0);
this.initConfig = _config_0;
const _config_1 = resolveClientEndpointParameters(_config_0);
const _config_2 = (0, import_middleware_user_agent.resolveUserAgentConfig)(_config_1);
const _config_3 = (0, import_middleware_retry.resolveRetryConfig)(_config_2);
const _config_4 = (0, import_config_resolver.resolveRegionConfig)(_config_3);
const _config_5 = (0, import_middleware_host_header.resolveHostHeaderConfig)(_config_4);
const _config_6 = (0, import_middleware_endpoint.resolveEndpointConfig)(_config_5);
const _config_7 = (0, import_httpAuthSchemeProvider.resolveHttpAuthSchemeConfig)(_config_6);
const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);
this.config = _config_8;
this.middlewareStack.use((0, import_middleware_user_agent.getUserAgentPlugin)(this.config));
this.middlewareStack.use((0, import_middleware_retry.getRetryPlugin)(this.config));
this.middlewareStack.use((0, import_middleware_content_length.getContentLengthPlugin)(this.config));
this.middlewareStack.use((0, import_middleware_host_header.getHostHeaderPlugin)(this.config));
this.middlewareStack.use((0, import_middleware_logger.getLoggerPlugin)(this.config));
this.middlewareStack.use((0, import_middleware_recursion_detection.getRecursionDetectionPlugin)(this.config));
this.middlewareStack.use(
(0, import_core.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, {
httpAuthSchemeParametersProvider: import_httpAuthSchemeProvider.defaultIoTDataPlaneHttpAuthSchemeParametersProvider,
identityProviderConfigProvider: /* @__PURE__ */ __name(async (config) => new import_core.DefaultIdentityProviderConfig({
"aws.auth#sigv4": config.credentials
}), "identityProviderConfigProvider")
})
);
this.middlewareStack.use((0, import_core.getHttpSigningPlugin)(this.config));
}
/**
* Destroy underlying resources, like sockets. It's usually not necessary to do this.
* However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed.
* Otherwise, sockets might stay open for quite a long time before the server terminates them.
*/
destroy() {
super.destroy();
}
};
// src/IoTDataPlane.ts
// src/commands/DeleteThingShadowCommand.ts
var import_middleware_serde = require("@smithy/middleware-serde");
// src/protocols/Aws_restJson1.ts
var import_core2 = require("@aws-sdk/core");
// src/models/IoTDataPlaneServiceException.ts
var IoTDataPlaneServiceException = class _IoTDataPlaneServiceException extends import_smithy_client.ServiceException {
static {
__name(this, "IoTDataPlaneServiceException");
}
/**
* @internal
*/
constructor(options) {
super(options);
Object.setPrototypeOf(this, _IoTDataPlaneServiceException.prototype);
}
};
// src/models/models_0.ts
var ConflictException = class _ConflictException extends IoTDataPlaneServiceException {
static {
__name(this, "ConflictException");
}
name = "ConflictException";
$fault = "client";
/**
* @internal
*/
constructor(opts) {
super({
name: "ConflictException",
$fault: "client",
...opts
});
Object.setPrototypeOf(this, _ConflictException.prototype);
}
};
var InternalFailureException = class _InternalFailureException extends IoTDataPlaneServiceException {
static {
__name(this, "InternalFailureException");
}
name = "InternalFailureException";
$fault = "server";
/**
* @internal
*/
constructor(opts) {
super({
name: "InternalFailureException",
$fault: "server",
...opts
});
Object.setPrototypeOf(this, _InternalFailureException.prototype);
}
};
var InvalidRequestException = class _InvalidRequestException extends IoTDataPlaneServiceException {
static {
__name(this, "InvalidRequestException");
}
name = "InvalidRequestException";
$fault = "client";
/**
* @internal
*/
constructor(opts) {
super({
name: "InvalidRequestException",
$fault: "client",
...opts
});
Object.setPrototypeOf(this, _InvalidRequestException.prototype);
}
};
var MethodNotAllowedException = class _MethodNotAllowedException extends IoTDataPlaneServiceException {
static {
__name(this, "MethodNotAllowedException");
}
name = "MethodNotAllowedException";
$fault = "client";
/**
* @internal
*/
constructor(opts) {
super({
name: "MethodNotAllowedException",
$fault: "client",
...opts
});
Object.setPrototypeOf(this, _MethodNotAllowedException.prototype);
}
};
var ResourceNotFoundException = class _ResourceNotFoundException extends IoTDataPlaneServiceException {
static {
__name(this, "ResourceNotFoundException");
}
name = "ResourceNotFoundException";
$fault = "client";
/**
* @internal
*/
constructor(opts) {
super({
name: "ResourceNotFoundException",
$fault: "client",
...opts
});
Object.setPrototypeOf(this, _ResourceNotFoundException.prototype);
}
};
var ServiceUnavailableException = class _ServiceUnavailableException extends IoTDataPlaneServiceException {
static {
__name(this, "ServiceUnavailableException");
}
name = "ServiceUnavailableException";
$fault = "server";
/**
* @internal
*/
constructor(opts) {
super({
name: "ServiceUnavailableException",
$fault: "server",
...opts
});
Object.setPrototypeOf(this, _ServiceUnavailableException.prototype);
}
};
var ThrottlingException = class _ThrottlingException extends IoTDataPlaneServiceException {
static {
__name(this, "ThrottlingException");
}
name = "ThrottlingException";
$fault = "client";
/**
* @internal
*/
constructor(opts) {
super({
name: "ThrottlingException",
$fault: "client",
...opts
});
Object.setPrototypeOf(this, _ThrottlingException.prototype);
}
};
var UnauthorizedException = class _UnauthorizedException extends IoTDataPlaneServiceException {
static {
__name(this, "UnauthorizedException");
}
name = "UnauthorizedException";
$fault = "client";
/**
* @internal
*/
constructor(opts) {
super({
name: "UnauthorizedException",
$fault: "client",
...opts
});
Object.setPrototypeOf(this, _UnauthorizedException.prototype);
}
};
var UnsupportedDocumentEncodingException = class _UnsupportedDocumentEncodingException extends IoTDataPlaneServiceException {
static {
__name(this, "UnsupportedDocumentEncodingException");
}
name = "UnsupportedDocumentEncodingException";
$fault = "client";
/**
* @internal
*/
constructor(opts) {
super({
name: "UnsupportedDocumentEncodingException",
$fault: "client",
...opts
});
Object.setPrototypeOf(this, _UnsupportedDocumentEncodingException.prototype);
}
};
var PayloadFormatIndicator = {
UNSPECIFIED_BYTES: "UNSPECIFIED_BYTES",
UTF8_DATA: "UTF8_DATA"
};
var RequestEntityTooLargeException = class _RequestEntityTooLargeException extends IoTDataPlaneServiceException {
static {
__name(this, "RequestEntityTooLargeException");
}
name = "RequestEntityTooLargeException";
$fault = "client";
/**
* @internal
*/
constructor(opts) {
super({
name: "RequestEntityTooLargeException",
$fault: "client",
...opts
});
Object.setPrototypeOf(this, _RequestEntityTooLargeException.prototype);
}
};
// src/protocols/Aws_restJson1.ts
var se_DeleteThingShadowCommand = /* @__PURE__ */ __name(async (input, context) => {
const b = (0, import_core.requestBuilder)(input, context);
const headers = {};
b.bp("/things/{thingName}/shadow");
b.p("thingName", () => input.thingName, "{thingName}", false);
const query = (0, import_smithy_client.map)({
[_n]: [, input[_sN]]
});
let body;
b.m("DELETE").h(headers).q(query).b(body);
return b.build();
}, "se_DeleteThingShadowCommand");
var se_GetRetainedMessageCommand = /* @__PURE__ */ __name(async (input, context) => {
const b = (0, import_core.requestBuilder)(input, context);
const headers = {};
b.bp("/retainedMessage/{topic}");
b.p("topic", () => input.topic, "{topic}", false);
let body;
b.m("GET").h(headers).b(body);
return b.build();
}, "se_GetRetainedMessageCommand");
var se_GetThingShadowCommand = /* @__PURE__ */ __name(async (input, context) => {
const b = (0, import_core.requestBuilder)(input, context);
const headers = {};
b.bp("/things/{thingName}/shadow");
b.p("thingName", () => input.thingName, "{thingName}", false);
const query = (0, import_smithy_client.map)({
[_n]: [, input[_sN]]
});
let body;
b.m("GET").h(headers).q(query).b(body);
return b.build();
}, "se_GetThingShadowCommand");
var se_ListNamedShadowsForThingCommand = /* @__PURE__ */ __name(async (input, context) => {
const b = (0, import_core.requestBuilder)(input, context);
const headers = {};
b.bp("/api/things/shadow/ListNamedShadowsForThing/{thingName}");
b.p("thingName", () => input.thingName, "{thingName}", false);
const query = (0, import_smithy_client.map)({
[_nT]: [, input[_nT]],
[_pS]: [() => input.pageSize !== void 0, () => input[_pS].toString()]
});
let body;
b.m("GET").h(headers).q(query).b(body);
return b.build();
}, "se_ListNamedShadowsForThingCommand");
var se_ListRetainedMessagesCommand = /* @__PURE__ */ __name(async (input, context) => {
const b = (0, import_core.requestBuilder)(input, context);
const headers = {};
b.bp("/retainedMessage");
const query = (0, import_smithy_client.map)({
[_nT]: [, input[_nT]],
[_mR]: [() => input.maxResults !== void 0, () => input[_mR].toString()]
});
let body;
b.m("GET").h(headers).q(query).b(body);
return b.build();
}, "se_ListRetainedMessagesCommand");
var se_PublishCommand = /* @__PURE__ */ __name(async (input, context) => {
const b = (0, import_core.requestBuilder)(input, context);
const headers = (0, import_smithy_client.map)({}, import_smithy_client.isSerializableHeaderValue, {
"content-type": "application/octet-stream",
[_xamup]: [
() => (0, import_smithy_client.isSerializableHeaderValue)(input[_uP]),
() => context.base64Encoder(Buffer.from(import_smithy_client.LazyJsonString.from(input[_uP])))
],
[_xampfi]: input[_pFI],
[_xamcd]: input[_cD]
});
b.bp("/topics/{topic}");
b.p("topic", () => input.topic, "{topic}", false);
const query = (0, import_smithy_client.map)({
[_q]: [() => input.qos !== void 0, () => input[_q].toString()],
[_r]: [() => input.retain !== void 0, () => input[_r].toString()],
[_cT]: [, input[_cT]],
[_rT]: [, input[_rT]],
[_mE]: [() => input.messageExpiry !== void 0, () => input[_mE].toString()]
});
let body;
if (input.payload !== void 0) {
body = input.payload;
}
b.m("POST").h(headers).q(query).b(body);
return b.build();
}, "se_PublishCommand");
var se_UpdateThingShadowCommand = /* @__PURE__ */ __name(async (input, context) => {
const b = (0, import_core.requestBuilder)(input, context);
const headers = {
"content-type": "application/octet-stream"
};
b.bp("/things/{thingName}/shadow");
b.p("thingName", () => input.thingName, "{thingName}", false);
const query = (0, import_smithy_client.map)({
[_n]: [, input[_sN]]
});
let body;
if (input.payload !== void 0) {
body = input.payload;
}
b.m("POST").h(headers).q(query).b(body);
return b.build();
}, "se_UpdateThingShadowCommand");
var de_DeleteThingShadowCommand = /* @__PURE__ */ __name(async (output, context) => {
if (output.statusCode !== 200 && output.statusCode >= 300) {
return de_CommandError(output, context);
}
const contents = (0, import_smithy_client.map)({
$metadata: deserializeMetadata(output)
});
const data = await (0, import_smithy_client.collectBody)(output.body, context);
contents.payload = data;
return contents;
}, "de_DeleteThingShadowCommand");
var de_GetRetainedMessageCommand = /* @__PURE__ */ __name(async (output, context) => {
if (output.statusCode !== 200 && output.statusCode >= 300) {
return de_CommandError(output, context);
}
const contents = (0, import_smithy_client.map)({
$metadata: deserializeMetadata(output)
});
const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
const doc = (0, import_smithy_client.take)(data, {
lastModifiedTime: import_smithy_client.expectLong,
payload: context.base64Decoder,
qos: import_smithy_client.expectInt32,
topic: import_smithy_client.expectString,
userProperties: context.base64Decoder
});
Object.assign(contents, doc);
return contents;
}, "de_GetRetainedMessageCommand");
var de_GetThingShadowCommand = /* @__PURE__ */ __name(async (output, context) => {
if (output.statusCode !== 200 && output.statusCode >= 300) {
return de_CommandError(output, context);
}
const contents = (0, import_smithy_client.map)({
$metadata: deserializeMetadata(output)
});
const data = await (0, import_smithy_client.collectBody)(output.body, context);
contents.payload = data;
return contents;
}, "de_GetThingShadowCommand");
var de_ListNamedShadowsForThingCommand = /* @__PURE__ */ __name(async (output, context) => {
if (output.statusCode !== 200 && output.statusCode >= 300) {
return de_CommandError(output, context);
}
const contents = (0, import_smithy_client.map)({
$metadata: deserializeMetadata(output)
});
const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
const doc = (0, import_smithy_client.take)(data, {
nextToken: import_smithy_client.expectString,
results: import_smithy_client._json,
timestamp: import_smithy_client.expectLong
});
Object.assign(contents, doc);
return contents;
}, "de_ListNamedShadowsForThingCommand");
var de_ListRetainedMessagesCommand = /* @__PURE__ */ __name(async (output, context) => {
if (output.statusCode !== 200 && output.statusCode >= 300) {
return de_CommandError(output, context);
}
const contents = (0, import_smithy_client.map)({
$metadata: deserializeMetadata(output)
});
const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
const doc = (0, import_smithy_client.take)(data, {
nextToken: import_smithy_client.expectString,
retainedTopics: import_smithy_client._json
});
Object.assign(contents, doc);
return contents;
}, "de_ListRetainedMessagesCommand");
var de_PublishCommand = /* @__PURE__ */ __name(async (output, context) => {
if (output.statusCode !== 200 && output.statusCode >= 300) {
return de_CommandError(output, context);
}
const contents = (0, import_smithy_client.map)({
$metadata: deserializeMetadata(output)
});
await (0, import_smithy_client.collectBody)(output.body, context);
return contents;
}, "de_PublishCommand");
var de_UpdateThingShadowCommand = /* @__PURE__ */ __name(async (output, context) => {
if (output.statusCode !== 200 && output.statusCode >= 300) {
return de_CommandError(output, context);
}
const contents = (0, import_smithy_client.map)({
$metadata: deserializeMetadata(output)
});
const data = await (0, import_smithy_client.collectBody)(output.body, context);
contents.payload = data;
return contents;
}, "de_UpdateThingShadowCommand");
var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
const parsedOutput = {
...output,
body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
};
const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
switch (errorCode) {
case "InternalFailureException":
case "com.amazonaws.iotdataplane#InternalFailureException":
throw await de_InternalFailureExceptionRes(parsedOutput, context);
case "InvalidRequestException":
case "com.amazonaws.iotdataplane#InvalidRequestException":
throw await de_InvalidRequestExceptionRes(parsedOutput, context);
case "MethodNotAllowedException":
case "com.amazonaws.iotdataplane#MethodNotAllowedException":
throw await de_MethodNotAllowedExceptionRes(parsedOutput, context);
case "ResourceNotFoundException":
case "com.amazonaws.iotdataplane#ResourceNotFoundException":
throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
case "ServiceUnavailableException":
case "com.amazonaws.iotdataplane#ServiceUnavailableException":
throw await de_ServiceUnavailableExceptionRes(parsedOutput, context);
case "ThrottlingException":
case "com.amazonaws.iotdataplane#ThrottlingException":
throw await de_ThrottlingExceptionRes(parsedOutput, context);
case "UnauthorizedException":
case "com.amazonaws.iotdataplane#UnauthorizedException":
throw await de_UnauthorizedExceptionRes(parsedOutput, context);
case "UnsupportedDocumentEncodingException":
case "com.amazonaws.iotdataplane#UnsupportedDocumentEncodingException":
throw await de_UnsupportedDocumentEncodingExceptionRes(parsedOutput, context);
case "ConflictException":
case "com.amazonaws.iotdataplane#ConflictException":
throw await de_ConflictExceptionRes(parsedOutput, context);
case "RequestEntityTooLargeException":
case "com.amazonaws.iotdataplane#RequestEntityTooLargeException":
throw await de_RequestEntityTooLargeExceptionRes(parsedOutput, context);
default:
const parsedBody = parsedOutput.body;
return throwDefaultError({
output,
parsedBody,
errorCode
});
}
}, "de_CommandError");
var throwDefaultError = (0, import_smithy_client.withBaseException)(IoTDataPlaneServiceException);
var de_ConflictExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
const contents = (0, import_smithy_client.map)({});
const data = parsedOutput.body;
const doc = (0, import_smithy_client.take)(data, {
message: import_smithy_client.expectString
});
Object.assign(contents, doc);
const exception = new ConflictException({
$metadata: deserializeMetadata(parsedOutput),
...contents
});
return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
}, "de_ConflictExceptionRes");
var de_InternalFailureExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
const contents = (0, import_smithy_client.map)({});
const data = parsedOutput.body;
const doc = (0, import_smithy_client.take)(data, {
message: import_smithy_client.expectString
});
Object.assign(contents, doc);
const exception = new InternalFailureException({
$metadata: deserializeMetadata(parsedOutput),
...contents
});
return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
}, "de_InternalFailureExceptionRes");
var de_InvalidRequestExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
const contents = (0, import_smithy_client.map)({});
const data = parsedOutput.body;
const doc = (0, import_smithy_client.take)(data, {
message: import_smithy_client.expectString
});
Object.assign(contents, doc);
const exception = new InvalidRequestException({
$metadata: deserializeMetadata(parsedOutput),
...contents
});
return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
}, "de_InvalidRequestExceptionRes");
var de_MethodNotAllowedExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
const contents = (0, import_smithy_client.map)({});
const data = parsedOutput.body;
const doc = (0, import_smithy_client.take)(data, {
message: import_smithy_client.expectString
});
Object.assign(contents, doc);
const exception = new MethodNotAllowedException({
$metadata: deserializeMetadata(parsedOutput),
...contents
});
return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
}, "de_MethodNotAllowedExceptionRes");
var de_RequestEntityTooLargeExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
const contents = (0, import_smithy_client.map)({});
const data = parsedOutput.body;
const doc = (0, import_smithy_client.take)(data, {
message: import_smithy_client.expectString
});
Object.assign(contents, doc);
const exception = new RequestEntityTooLargeException({
$metadata: deserializeMetadata(parsedOutput),
...contents
});
return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
}, "de_RequestEntityTooLargeExceptionRes");
var de_ResourceNotFoundExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
const contents = (0, import_smithy_client.map)({});
const data = parsedOutput.body;
const doc = (0, import_smithy_client.take)(data, {
message: import_smithy_client.expectString
});
Object.assign(contents, doc);
const exception = new ResourceNotFoundException({
$metadata: deserializeMetadata(parsedOutput),
...contents
});
return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
}, "de_ResourceNotFoundExceptionRes");
var de_ServiceUnavailableExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
const contents = (0, import_smithy_client.map)({});
const data = parsedOutput.body;
const doc = (0, import_smithy_client.take)(data, {
message: import_smithy_client.expectString
});
Object.assign(contents, doc);
const exception = new ServiceUnavailableException({
$metadata: deserializeMetadata(parsedOutput),
...contents
});
return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
}, "de_ServiceUnavailableExceptionRes");
var de_ThrottlingExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
const contents = (0, import_smithy_client.map)({});
const data = parsedOutput.body;
const doc = (0, import_smithy_client.take)(data, {
message: import_smithy_client.expectString
});
Object.assign(contents, doc);
const exception = new ThrottlingException({
$metadata: deserializeMetadata(parsedOutput),
...contents
});
return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
}, "de_ThrottlingExceptionRes");
var de_UnauthorizedExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
const contents = (0, import_smithy_client.map)({});
const data = parsedOutput.body;
const doc = (0, import_smithy_client.take)(data, {
message: import_smithy_client.expectString
});
Object.assign(contents, doc);
const exception = new UnauthorizedException({
$metadata: deserializeMetadata(parsedOutput),
...contents
});
return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
}, "de_UnauthorizedExceptionRes");
var de_UnsupportedDocumentEncodingExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
const contents = (0, import_smithy_client.map)({});
const data = parsedOutput.body;
const doc = (0, import_smithy_client.take)(data, {
message: import_smithy_client.expectString
});
Object.assign(contents, doc);
const exception = new UnsupportedDocumentEncodingException({
$metadata: deserializeMetadata(parsedOutput),
...contents
});
return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
}, "de_UnsupportedDocumentEncodingExceptionRes");
var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
httpStatusCode: output.statusCode,
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
extendedRequestId: output.headers["x-amz-id-2"],
cfId: output.headers["x-amz-cf-id"]
}), "deserializeMetadata");
var _cD = "correlationData";
var _cT = "contentType";
var _mE = "messageExpiry";
var _mR = "maxResults";
var _n = "name";
var _nT = "nextToken";
var _pFI = "payloadFormatIndicator";
var _pS = "pageSize";
var _q = "qos";
var _r = "retain";
var _rT = "responseTopic";
var _sN = "shadowName";
var _uP = "userProperties";
var _xamcd = "x-amz-mqtt5-correlation-data";
var _xampfi = "x-amz-mqtt5-payload-format-indicator";
var _xamup = "x-amz-mqtt5-user-properties";
// src/commands/DeleteThingShadowCommand.ts
var DeleteThingShadowCommand = class extends import_smithy_client.Command.classBuilder().ep(commonParams).m(function(Command, cs, config, o) {
return [
(0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
(0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
];
}).s("IotMoonrakerService", "DeleteThingShadow", {}).n("IoTDataPlaneClient", "DeleteThingShadowCommand").f(void 0, void 0).ser(se_DeleteThingShadowCommand).de(de_DeleteThingShadowCommand).build() {
static {
__name(this, "DeleteThingShadowCommand");
}
};
// src/commands/GetRetainedMessageCommand.ts
var GetRetainedMessageCommand = class extends import_smithy_client.Command.classBuilder().ep(commonParams).m(function(Command, cs, config, o) {
return [
(0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
(0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
];
}).s("IotMoonrakerService", "GetRetainedMessage", {}).n("IoTDataPlaneClient", "GetRetainedMessageCommand").f(void 0, void 0).ser(se_GetRetainedMessageCommand).de(de_GetRetainedMessageCommand).build() {
static {
__name(this, "GetRetainedMessageCommand");
}
};
// src/commands/GetThingShadowCommand.ts
var GetThingShadowCommand = class extends import_smithy_client.Command.classBuilder().ep(commonParams).m(function(Command, cs, config, o) {
return [
(0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
(0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
];
}).s("IotMoonrakerService", "GetThingShadow", {}).n("IoTDataPlaneClient", "GetThingShadowCommand").f(void 0, void 0).ser(se_GetThingShadowCommand).de(de_GetThingShadowCommand).build() {
static {
__name(this, "GetThingShadowCommand");
}
};
// src/commands/ListNamedShadowsForThingCommand.ts
var ListNamedShadowsForThingCommand = class extends import_smithy_client.Command.classBuilder().ep(commonParams).m(function(Command, cs, config, o) {
return [
(0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
(0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
];
}).s("IotMoonrakerService", "ListNamedShadowsForThing", {}).n("IoTDataPlaneClient", "ListNamedShadowsForThingCommand").f(void 0, void 0).ser(se_ListNamedShadowsForThingCommand).de(de_ListNamedShadowsForThingCommand).build() {
static {
__name(this, "ListNamedShadowsForThingCommand");
}
};
// src/commands/ListRetainedMessagesCommand.ts
var ListRetainedMessagesCommand = class extends import_smithy_client.Command.classBuilder().ep(commonParams).m(function(Command, cs, config, o) {
return [
(0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
(0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
];
}).s("IotMoonrakerService", "ListRetainedMessages", {}).n("IoTDataPlaneClient", "ListRetainedMessagesCommand").f(void 0, void 0).ser(se_ListRetainedMessagesCommand).de(de_ListRetainedMessagesCommand).build() {
static {
__name(this, "ListRetainedMessagesCommand");
}
};
// src/commands/PublishCommand.ts
var PublishCommand = class extends import_smithy_client.Command.classBuilder().ep(commonParams).m(function(Command, cs, config, o) {
return [
(0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
(0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
];
}).s("IotMoonrakerService", "Publish", {}).n("IoTDataPlaneClient", "PublishCommand").f(void 0, void 0).ser(se_PublishCommand).de(de_PublishCommand).build() {
static {
__name(this, "PublishCommand");
}
};
// src/commands/UpdateThingShadowCommand.ts
var UpdateThingShadowCommand = class extends import_smithy_client.Command.classBuilder().ep(commonParams).m(function(Command, cs, config, o) {
return [
(0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
(0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
];
}).s("IotMoonrakerService", "UpdateThingShadow", {}).n("IoTDataPlaneClient", "UpdateThingShadowCommand").f(void 0, void 0).ser(se_UpdateThingShadowCommand).de(de_UpdateThingShadowCommand).build() {
static {
__name(this, "UpdateThingShadowCommand");
}
};
// src/IoTDataPlane.ts
var commands = {
DeleteThingShadowCommand,
GetRetainedMessageCommand,
GetThingShadowCommand,
ListNamedShadowsForThingCommand,
ListRetainedMessagesCommand,
PublishCommand,
UpdateThingShadowCommand
};
var IoTDataPlane = class extends IoTDataPlaneClient {
static {
__name(this, "IoTDataPlane");
}
};
(0, import_smithy_client.createAggregatedClient)(commands, IoTDataPlane);
// src/pagination/ListRetainedMessagesPaginator.ts
var paginateListRetainedMessages = (0, import_core.createPaginator)(IoTDataPlaneClient, ListRetainedMessagesCommand, "nextToken", "nextToken", "maxResults");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
IoTDataPlaneServiceException,
__Client,
IoTDataPlaneClient,
IoTDataPlane,
$Command,
DeleteThingShadowCommand,
GetRetainedMessageCommand,
GetThingShadowCommand,
ListNamedShadowsForThingCommand,
ListRetainedMessagesCommand,
PublishCommand,
UpdateThingShadowCommand,
paginateListRetainedMessages,
ConflictException,
InternalFailureException,
InvalidRequestException,
MethodNotAllowedException,
ResourceNotFoundException,
ServiceUnavailableException,
ThrottlingException,
UnauthorizedException,
UnsupportedDocumentEncodingException,
PayloadFormatIndicator,
RequestEntityTooLargeException
});