sst 2.24.13 → 2.24.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/constructs/App.js CHANGED
@@ -2,19 +2,20 @@ import path from "path";
2
2
  import fs from "fs";
3
3
  import { Stack } from "./Stack.js";
4
4
  import { isSSTConstruct, isStackConstruct, } from "./Construct.js";
5
+ import { useFunctions } from "./Function.js";
5
6
  import { bindParameters, bindType } from "./util/functionBinding.js";
6
7
  import { stack } from "./FunctionalStack.js";
7
- import { createRequire } from "module";
8
8
  import { Auth } from "./Auth.js";
9
9
  import { useDeferredTasks } from "./deferred_task.js";
10
10
  import { AppContext } from "./context.js";
11
11
  import { useProject } from "../project.js";
12
12
  import { Logger } from "../logger.js";
13
- import { App as CDKApp, Tags, CfnResource, RemovalPolicy, Aspects, } from "aws-cdk-lib/core";
13
+ import { App as CDKApp, Tags, CfnResource, RemovalPolicy, CustomResource, Aspects, } from "aws-cdk-lib/core";
14
14
  import { CfnFunction } from "aws-cdk-lib/aws-lambda";
15
15
  import { Bucket } from "aws-cdk-lib/aws-s3";
16
+ import { Effect, Policy, PolicyStatement } from "aws-cdk-lib/aws-iam";
16
17
  import { CfnLogGroup } from "aws-cdk-lib/aws-logs";
17
- const require = createRequire(import.meta.url);
18
+ import { useBootstrap } from "../bootstrap.js";
18
19
  function exitWithMessage(message) {
19
20
  console.error(message);
20
21
  process.exit(1);
@@ -177,6 +178,7 @@ export class App extends CDKApp {
177
178
  if (this.isFinished)
178
179
  return;
179
180
  this.isFinished = true;
181
+ const { config, paths } = useProject();
180
182
  Auth.injectConfig();
181
183
  this.buildConstructsMetadata();
182
184
  this.ensureUniqueConstructIds();
@@ -189,12 +191,43 @@ export class App extends CDKApp {
189
191
  await useDeferredTasks().run();
190
192
  this.createBindingSsmParameters();
191
193
  this.removeGovCloudUnsupportedResourceProperties();
192
- const { config } = useProject();
194
+ const bootstrap = await useBootstrap();
193
195
  for (const child of this.node.children) {
194
196
  if (isStackConstruct(child)) {
195
197
  // Tag stacks
196
198
  Tags.of(child).add("sst:app", this.name);
197
199
  Tags.of(child).add("sst:stage", this.stage);
200
+ if (child instanceof Stack) {
201
+ const functions = useFunctions();
202
+ const sourcemaps = functions.sourcemaps.forStack(child.stackName);
203
+ if (sourcemaps.length) {
204
+ const policy = new Policy(child, "FunctionSourcemapUploaderPolicy", {
205
+ statements: [
206
+ new PolicyStatement({
207
+ effect: Effect.ALLOW,
208
+ actions: ["s3:GetObject", "s3:PutObject"],
209
+ resources: [
210
+ sourcemaps[0].bucket.bucketArn + "/*",
211
+ `arn:${child.partition}:s3:::${bootstrap.bucket}/*`,
212
+ ],
213
+ }),
214
+ ],
215
+ });
216
+ child.customResourceHandler.role?.attachInlinePolicy(policy);
217
+ const resource = new CustomResource(child, "FunctionSourcemapUploader", {
218
+ serviceToken: child.customResourceHandler.functionArn,
219
+ resourceType: "Custom::FunctionSourcemapUploader",
220
+ properties: {
221
+ app: this.name,
222
+ stage: this.stage,
223
+ bootstrap: bootstrap.bucket,
224
+ bucket: sourcemaps[0].bucket.bucketName,
225
+ functions: sourcemaps.map((s) => [s.arn, s.key]),
226
+ },
227
+ });
228
+ resource.node.addDependency(policy);
229
+ }
230
+ }
198
231
  // Set removal policy
199
232
  this.applyRemovalPolicy(child);
200
233
  // Stack names need to be parameterized with the stage name
@@ -10,6 +10,7 @@ import * as functionUrlCors from "./util/functionUrlCors.js";
10
10
  import { Architecture, Function as CDKFunction, FunctionOptions, ILayerVersion, Runtime as CDKRuntime, Tracing } from "aws-cdk-lib/aws-lambda";
11
11
  import { RetentionDays } from "aws-cdk-lib/aws-logs";
12
12
  import { Size as CDKSize, Duration as CDKDuration } from "aws-cdk-lib/core";
13
+ import { IBucket } from "aws-cdk-lib/aws-s3";
13
14
  declare const supportedRuntimes: {
14
15
  container: CDKRuntime;
15
16
  rust: CDKRuntime;
@@ -657,6 +658,18 @@ export declare class Function extends CDKFunction implements SSTConstruct {
657
658
  static mergeProps(baseProps?: FunctionProps, props?: FunctionProps): FunctionProps;
658
659
  }
659
660
  export declare const useFunctions: () => {
661
+ sourcemaps: {
662
+ add(stack: string, source: {
663
+ arn: string;
664
+ bucket: IBucket;
665
+ key: string;
666
+ }): void;
667
+ forStack(stack: string): {
668
+ arn: string;
669
+ bucket: IBucket;
670
+ key: string;
671
+ }[];
672
+ };
660
673
  fromID(id: string): FunctionProps | undefined;
661
674
  add(name: string, props: FunctionProps): void;
662
675
  readonly all: Record<string, FunctionProps>;
@@ -1,6 +1,8 @@
1
1
  /* eslint-disable @typescript-eslint/ban-types */
2
2
  // Note: disabling ban-type rule so we don't get an error referencing the class Function
3
3
  import path from "path";
4
+ import fs from "fs/promises";
5
+ import zlib from "zlib";
4
6
  import { Stack } from "./Stack.js";
5
7
  import { Job } from "./Job.js";
6
8
  import { Secret } from "./Config.js";
@@ -24,8 +26,7 @@ import { StringParameter } from "aws-cdk-lib/aws-ssm";
24
26
  import { Platform } from "aws-cdk-lib/aws-ecr-assets";
25
27
  import { useBootstrap } from "../bootstrap.js";
26
28
  import { Colors } from "../cli/colors.js";
27
- import { BucketDeployment, Source } from "aws-cdk-lib/aws-s3-deployment";
28
- import { Bucket } from "aws-cdk-lib/aws-s3";
29
+ import { Asset } from "aws-cdk-lib/aws-s3-assets";
29
30
  const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
30
31
  const supportedRuntimes = {
31
32
  container: CDKRuntime.FROM_IMAGE,
@@ -231,6 +232,7 @@ export class Function extends CDKFunction {
231
232
  useDeferredTasks().add(async () => {
232
233
  if (props.runtime === "container")
233
234
  Colors.line(`➜ Building the container image for the "${this.node.id}" function...`);
235
+ const project = useProject();
234
236
  // Build function
235
237
  const result = await useRuntimeHandlers().build(this.node.addr, "deploy");
236
238
  if (result.type === "error") {
@@ -242,19 +244,23 @@ export class Function extends CDKFunction {
242
244
  // No need to update code if runtime is container
243
245
  if (props.runtime === "container")
244
246
  return;
247
+ if (result.sourcemap) {
248
+ const data = await fs.readFile(result.sourcemap);
249
+ await fs.writeFile(result.sourcemap, zlib.gzipSync(data));
250
+ const asset = new Asset(stack, this.id + "-Sourcemap", {
251
+ path: result.sourcemap,
252
+ });
253
+ await fs.rm(result.sourcemap);
254
+ useFunctions().sourcemaps.add(stack.stackName, {
255
+ bucket: asset.bucket,
256
+ key: asset.s3ObjectKey,
257
+ arn: this.functionArn,
258
+ });
259
+ }
245
260
  // Update code
246
261
  const cfnFunction = this.node.defaultChild;
247
262
  const code = AssetCode.fromAsset(result.out);
248
263
  const codeConfig = code.bind(this);
249
- const bootstrap = await useBootstrap();
250
- if (result.sourcemap)
251
- new BucketDeployment(this, "Sourcemap", {
252
- sources: [Source.asset(result.sourcemap)],
253
- contentEncoding: "gzip",
254
- contentType: "application/json",
255
- destinationBucket: Bucket.fromBucketName(this, "BootstrapBucket", bootstrap.bucket),
256
- destinationKeyPrefix: `sourcemap/${app.name}/${app.stage}/${this.functionArn}/`,
257
- });
258
264
  cfnFunction.code = {
259
265
  s3Bucket: codeConfig.s3Location?.bucketName,
260
266
  s3Key: codeConfig.s3Location?.objectKey,
@@ -548,7 +554,19 @@ export class Function extends CDKFunction {
548
554
  }
549
555
  export const useFunctions = createAppContext(() => {
550
556
  const functions = {};
557
+ const sourcemaps = {};
551
558
  return {
559
+ sourcemaps: {
560
+ add(stack, source) {
561
+ let arr = sourcemaps[stack];
562
+ if (!arr)
563
+ sourcemaps[stack] = arr = [];
564
+ arr.push(source);
565
+ },
566
+ forStack(stack) {
567
+ return sourcemaps[stack] || [];
568
+ },
569
+ },
552
570
  fromID(id) {
553
571
  const result = functions[id];
554
572
  if (!result)
@@ -1,27 +1,18 @@
1
1
  import { APIGatewayProxyEventV2, APIGatewayProxyStructuredResultV2 } from "aws-lambda";
2
2
  import { Adapter } from "./adapter/adapter.js";
3
3
  import { SignerOptions } from "fast-jwt";
4
- import { SessionValue } from "./session.js";
5
- declare const onSuccessResponse: {
6
- session(input: SessionCreateInput): {
4
+ import { SessionBuilder, SessionValue } from "./session.js";
5
+ interface OnSuccessResponder<T> {
6
+ session(input: T & Partial<SignerOptions>): {
7
7
  type: "session";
8
- properties: SessionCreateInput;
8
+ properties: T;
9
9
  };
10
10
  http(input: APIGatewayProxyStructuredResultV2): {
11
11
  type: "http";
12
- properties: APIGatewayProxyStructuredResultV2;
12
+ properties: typeof input;
13
13
  };
14
- provider(provider: string): {
15
- type: "http";
16
- properties: {
17
- statusCode: number;
18
- headers: {
19
- Location: string;
20
- };
21
- };
22
- };
23
- };
24
- export declare function AuthHandler<Providers extends Record<string, Adapter<any>>, Result = {
14
+ }
15
+ export declare function AuthHandler<Providers extends Record<string, Adapter<any>>, Sessions extends SessionBuilder, Result = {
25
16
  [key in keyof Providers]: {
26
17
  provider: key;
27
18
  } & Extract<Awaited<ReturnType<Providers[key]>>, {
@@ -29,11 +20,11 @@ export declare function AuthHandler<Providers extends Record<string, Adapter<any
29
20
  }>["properties"];
30
21
  }[keyof Providers]>(input: {
31
22
  providers: Providers;
23
+ sessions?: Sessions;
32
24
  clients: () => Promise<Record<string, string>>;
33
25
  onAuthorize?: (event: APIGatewayProxyEventV2) => Promise<void | keyof Providers>;
34
- onSuccess: (input: Result, response: typeof onSuccessResponse) => Promise<ReturnType<(typeof onSuccessResponse)[keyof typeof onSuccessResponse]>>;
26
+ onSuccess: (input: Result, response: OnSuccessResponder<SessionValue | Sessions["$type"]>) => Promise<ReturnType<OnSuccessResponder<SessionValue | Sessions["$type"]>[keyof OnSuccessResponder<any>]>>;
35
27
  onIndex?: (event: APIGatewayProxyEventV2) => Promise<APIGatewayProxyStructuredResultV2>;
36
28
  onError?: () => Promise<APIGatewayProxyStructuredResultV2>;
37
29
  }): (event: APIGatewayProxyEventV2, context: import("aws-lambda").Context) => Promise<APIGatewayProxyStructuredResultV2>;
38
- export type SessionCreateInput = SessionValue & Partial<SignerOptions>;
39
30
  export {};
@@ -1,34 +1,6 @@
1
1
  import { createSigner, createVerifier } from "fast-jwt";
2
2
  import { ApiHandler, useCookie, useCookies, useFormValue, usePathParam, useQueryParam, useQueryParams, useResponse, } from "../../api/index.js";
3
3
  import { Config } from "../../config/index.js";
4
- const onSuccessResponse = {
5
- session(input) {
6
- return {
7
- type: "session",
8
- properties: input,
9
- };
10
- },
11
- http(input) {
12
- return {
13
- type: "http",
14
- properties: input,
15
- };
16
- },
17
- provider(provider) {
18
- return {
19
- type: "http",
20
- properties: {
21
- statusCode: 302,
22
- headers: {
23
- Location: "/authorize?" +
24
- new URLSearchParams({
25
- provider,
26
- }).toString(),
27
- },
28
- },
29
- };
30
- },
31
- };
32
4
  export function AuthHandler(input) {
33
5
  return ApiHandler(async (evt) => {
34
6
  const step = usePathParam("step");
@@ -184,7 +156,20 @@ export function AuthHandler(input) {
184
156
  const onSuccess = await input.onSuccess({
185
157
  provider,
186
158
  ...result.properties,
187
- }, onSuccessResponse);
159
+ }, {
160
+ http(input) {
161
+ return {
162
+ type: "http",
163
+ properties: input,
164
+ };
165
+ },
166
+ session(input) {
167
+ return {
168
+ type: "session",
169
+ properties: input,
170
+ };
171
+ },
172
+ });
188
173
  console.log("onSuccess", onSuccess);
189
174
  if (onSuccess.type === "session") {
190
175
  const { type, properties, ...rest } = onSuccess.properties;
@@ -43,4 +43,35 @@ export declare const Session: {
43
43
  create: typeof create;
44
44
  verify: typeof verify;
45
45
  };
46
+ export type SessionBuilder = ReturnType<typeof createSessionBuilder>;
47
+ export declare function createSessionBuilder<SessionTypes extends Record<string, any> = {}>(): {
48
+ create<T extends ({ [type in keyof SessionTypes]: {
49
+ type: type;
50
+ properties: SessionTypes[type];
51
+ }; }[keyof SessionTypes] | {
52
+ type: "public";
53
+ properties: {};
54
+ })["type"]>(type: T, properties: SessionTypes[T], options?: Partial<SignerOptions>): string;
55
+ verify(token: string): { [type in keyof SessionTypes]: {
56
+ type: type;
57
+ properties: SessionTypes[type];
58
+ }; }[keyof SessionTypes] | {
59
+ type: "public";
60
+ properties: {};
61
+ };
62
+ use(): { [type in keyof SessionTypes]: {
63
+ type: type;
64
+ properties: SessionTypes[type];
65
+ }; }[keyof SessionTypes] | {
66
+ type: "public";
67
+ properties: {};
68
+ };
69
+ $type: { [type in keyof SessionTypes]: {
70
+ type: type;
71
+ properties: SessionTypes[type];
72
+ }; }[keyof SessionTypes] | {
73
+ type: "public";
74
+ properties: {};
75
+ };
76
+ };
46
77
  export {};
@@ -106,3 +106,42 @@ export const Session = {
106
106
  create,
107
107
  verify,
108
108
  };
109
+ export function createSessionBuilder() {
110
+ return {
111
+ create(type, properties, options) {
112
+ // @ts-expect-error
113
+ const key = Config[process.env.AUTH_ID + "PrivateKey"];
114
+ const signer = createSigner({
115
+ ...options,
116
+ key,
117
+ algorithm: "RS512",
118
+ });
119
+ const token = signer({
120
+ type: type,
121
+ properties: properties,
122
+ });
123
+ return token;
124
+ },
125
+ verify(token) {
126
+ if (token) {
127
+ try {
128
+ const jwt = createVerifier({
129
+ algorithms: ["RS512"],
130
+ key: getPublicKey(),
131
+ })(token);
132
+ return jwt;
133
+ }
134
+ catch (e) { }
135
+ }
136
+ return {
137
+ type: "public",
138
+ properties: {},
139
+ };
140
+ },
141
+ use() {
142
+ const ctx = SessionMemo();
143
+ return ctx;
144
+ },
145
+ $type: {},
146
+ };
147
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.24.13",
4
+ "version": "2.24.15",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
@@ -71,7 +71,7 @@
71
71
  "dotenv": "^16.0.3",
72
72
  "esbuild": "0.18.13",
73
73
  "express": "^4.18.2",
74
- "fast-jwt": "^1.6.1",
74
+ "fast-jwt": "^3.1.1",
75
75
  "get-port": "^6.1.2",
76
76
  "glob": "^8.0.3",
77
77
  "graphql": "*",
@@ -1,11 +1,9 @@
1
1
  import { Context } from "../context/context.js";
2
2
  import { Logger } from "../logger.js";
3
3
  import path from "path";
4
- import zlib from "zlib";
5
4
  import fs from "fs/promises";
6
5
  import { useWatcher } from "../watcher.js";
7
6
  import { useBus } from "../bus.js";
8
- import crypto from "crypto";
9
7
  import { useProject } from "../project.js";
10
8
  import { useFunctions } from "../constructs/Function.js";
11
9
  export const useRuntimeHandlers = Context.memo(() => {
@@ -77,22 +75,11 @@ export const useRuntimeHandlers = Context.memo(() => {
77
75
  }
78
76
  if (func.hooks?.afterBuild)
79
77
  await func.hooks.afterBuild(func, out);
80
- let sourcemap;
81
- if (built.sourcemap && mode === "deploy") {
82
- const data = await fs.readFile(built.sourcemap);
83
- await fs.rm(built.sourcemap);
84
- const hash = crypto.createHash("md5").update(data).digest("hex");
85
- const dir = path.join(project.paths.artifacts, "sourcemaps", functionID);
86
- await fs.rm(dir, { recursive: true, force: true });
87
- await fs.mkdir(dir, { recursive: true });
88
- sourcemap = dir;
89
- await fs.writeFile(path.join(dir, `${hash}.map`), zlib.gzipSync(data));
90
- }
91
78
  bus.publish("function.build.success", { functionID });
92
79
  return {
93
80
  ...built,
94
81
  out,
95
- sourcemap,
82
+ sourcemap: built.sourcemap,
96
83
  };
97
84
  }
98
85
  if (pendingBuilds.has(functionID)) {
@@ -132,8 +119,8 @@ export const useFunctionBuilder = Context.memo(() => {
132
119
  watcher.subscribe("file.changed", async (evt) => {
133
120
  try {
134
121
  const functions = useFunctions();
135
- for (const [functionID, props] of Object.entries(functions.all)) {
136
- const handler = handlers.for(props.runtime);
122
+ for (const [functionID, info] of Object.entries(functions.all)) {
123
+ const handler = handlers.for(info.runtime);
137
124
  if (!handler?.shouldBuild({
138
125
  functionID,
139
126
  file: evt.properties.file,
@@ -664,8 +664,8 @@ var require_createConfigValueProvider = __commonJS({
664
664
  return endpoint.url.href;
665
665
  }
666
666
  if ("hostname" in endpoint) {
667
- const { protocol, hostname, port, path: path3 } = endpoint;
668
- return `${protocol}//${hostname}${port ? ":" + port : ""}${path3}`;
667
+ const { protocol, hostname, port, path: path4 } = endpoint;
668
+ return `${protocol}//${hostname}${port ? ":" + port : ""}${path4}`;
669
669
  }
670
670
  }
671
671
  return endpoint;
@@ -21709,14 +21709,14 @@ var require_Aws_json1_1 = __commonJS({
21709
21709
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
21710
21710
  };
21711
21711
  var collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
21712
- var buildHttpRpcRequest = async (context, headers, path3, resolvedHostname, body) => {
21712
+ var buildHttpRpcRequest = async (context, headers, path4, resolvedHostname, body) => {
21713
21713
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
21714
21714
  const contents = {
21715
21715
  protocol,
21716
21716
  hostname,
21717
21717
  port,
21718
21718
  method: "POST",
21719
- path: basePath.endsWith("/") ? basePath.slice(0, -1) + path3 : basePath + path3,
21719
+ path: basePath.endsWith("/") ? basePath.slice(0, -1) + path4 : basePath + path4,
21720
21720
  headers
21721
21721
  };
21722
21722
  if (resolvedHostname !== void 0) {
@@ -31139,10 +31139,10 @@ ${longDate}
31139
31139
  ${credentialScope}
31140
31140
  ${(0, util_hex_encoding_1.toHex)(hashedRequest)}`;
31141
31141
  }
31142
- getCanonicalPath({ path: path3 }) {
31142
+ getCanonicalPath({ path: path4 }) {
31143
31143
  if (this.uriEscapePath) {
31144
31144
  const normalizedPathSegments = [];
31145
- for (const pathSegment of path3.split("/")) {
31145
+ for (const pathSegment of path4.split("/")) {
31146
31146
  if ((pathSegment === null || pathSegment === void 0 ? void 0 : pathSegment.length) === 0)
31147
31147
  continue;
31148
31148
  if (pathSegment === ".")
@@ -31153,11 +31153,11 @@ ${(0, util_hex_encoding_1.toHex)(hashedRequest)}`;
31153
31153
  normalizedPathSegments.push(pathSegment);
31154
31154
  }
31155
31155
  }
31156
- const normalizedPath = `${(path3 === null || path3 === void 0 ? void 0 : path3.startsWith("/")) ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && (path3 === null || path3 === void 0 ? void 0 : path3.endsWith("/")) ? "/" : ""}`;
31156
+ const normalizedPath = `${(path4 === null || path4 === void 0 ? void 0 : path4.startsWith("/")) ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && (path4 === null || path4 === void 0 ? void 0 : path4.endsWith("/")) ? "/" : ""}`;
31157
31157
  const doubleEncoded = encodeURIComponent(normalizedPath);
31158
31158
  return doubleEncoded.replace(/%2F/g, "/");
31159
31159
  }
31160
- return path3;
31160
+ return path4;
31161
31161
  }
31162
31162
  async getSignature(longDate, credentialScope, keyPromise, canonicalRequest) {
31163
31163
  const stringToSign = await this.createStringToSign(longDate, credentialScope, canonicalRequest);
@@ -34506,14 +34506,14 @@ var require_Aws_query = __commonJS({
34506
34506
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
34507
34507
  };
34508
34508
  var collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
34509
- var buildHttpRpcRequest = async (context, headers, path3, resolvedHostname, body) => {
34509
+ var buildHttpRpcRequest = async (context, headers, path4, resolvedHostname, body) => {
34510
34510
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
34511
34511
  const contents = {
34512
34512
  protocol,
34513
34513
  hostname,
34514
34514
  port,
34515
34515
  method: "POST",
34516
- path: basePath.endsWith("/") ? basePath.slice(0, -1) + path3 : basePath + path3,
34516
+ path: basePath.endsWith("/") ? basePath.slice(0, -1) + path4 : basePath + path4,
34517
34517
  headers
34518
34518
  };
34519
34519
  if (resolvedHostname !== void 0) {
@@ -35431,11 +35431,11 @@ var require_slurpFile = __commonJS({
35431
35431
  var fs_1 = __require("fs");
35432
35432
  var { readFile } = fs_1.promises;
35433
35433
  var filePromisesHash = {};
35434
- var slurpFile = (path3) => {
35435
- if (!filePromisesHash[path3]) {
35436
- filePromisesHash[path3] = readFile(path3, "utf8");
35434
+ var slurpFile = (path4) => {
35435
+ if (!filePromisesHash[path4]) {
35436
+ filePromisesHash[path4] = readFile(path4, "utf8");
35437
35437
  }
35438
- return filePromisesHash[path3];
35438
+ return filePromisesHash[path4];
35439
35439
  };
35440
35440
  exports.slurpFile = slurpFile;
35441
35441
  }
@@ -37463,7 +37463,7 @@ var require_node_http2_handler = __commonJS({
37463
37463
  rejectOriginal(abortError);
37464
37464
  return;
37465
37465
  }
37466
- const { hostname, method, port, protocol, path: path3, query } = request;
37466
+ const { hostname, method, port, protocol, path: path4, query } = request;
37467
37467
  const authority = `${protocol}//${hostname}${port ? `:${port}` : ""}`;
37468
37468
  const session = this.getSession(authority, disableConcurrentStreams || false);
37469
37469
  const reject = (err) => {
@@ -37476,7 +37476,7 @@ var require_node_http2_handler = __commonJS({
37476
37476
  const queryString = (0, querystring_builder_1.buildQueryString)(query || {});
37477
37477
  const req = session.request({
37478
37478
  ...request.headers,
37479
- [http2_1.constants.HTTP2_HEADER_PATH]: queryString ? `${path3}?${queryString}` : path3,
37479
+ [http2_1.constants.HTTP2_HEADER_PATH]: queryString ? `${path4}?${queryString}` : path4,
37480
37480
  [http2_1.constants.HTTP2_HEADER_METHOD]: method
37481
37481
  });
37482
37482
  session.ref();
@@ -38012,7 +38012,7 @@ var require_binding = __commonJS({
38012
38012
  };
38013
38013
  Object.defineProperty(exports, "__esModule", { value: true });
38014
38014
  exports.cRuntime = exports.CRuntimeType = void 0;
38015
- var path3 = __importStar3(__require("path"));
38015
+ var path4 = __importStar3(__require("path"));
38016
38016
  var os_1 = __require("os");
38017
38017
  var fs_1 = __require("fs");
38018
38018
  var process_1 = __require("process");
@@ -38052,19 +38052,19 @@ var require_binding = __commonJS({
38052
38052
  exports.cRuntime = cRuntime;
38053
38053
  var binary_name = "aws-crt-nodejs";
38054
38054
  var platformDir = `${os_1.platform}-${os_1.arch}-${cRuntime}`;
38055
- var source_root = path3.resolve(__dirname, "..", "..");
38056
- var dist = path3.join(source_root, "dist");
38055
+ var source_root = path4.resolve(__dirname, "..", "..");
38056
+ var dist = path4.join(source_root, "dist");
38057
38057
  if ((0, fs_1.existsSync)(dist)) {
38058
38058
  source_root = dist;
38059
38059
  }
38060
- var bin_path = path3.resolve(source_root, "bin");
38060
+ var bin_path = path4.resolve(source_root, "bin");
38061
38061
  var search_paths = [
38062
- path3.join(bin_path, platformDir, binary_name)
38062
+ path4.join(bin_path, platformDir, binary_name)
38063
38063
  ];
38064
38064
  var binding;
38065
- for (const path4 of search_paths) {
38066
- if ((0, fs_1.existsSync)(path4 + ".node")) {
38067
- binding = __require(path4);
38065
+ for (const path5 of search_paths) {
38066
+ if ((0, fs_1.existsSync)(path5 + ".node")) {
38067
+ binding = __require(path5);
38068
38068
  break;
38069
38069
  }
38070
38070
  }
@@ -38448,8 +38448,8 @@ var require_io2 = __commonJS({
38448
38448
  * @param behavior - Specifies how `C_Initialize()` and `C_Finalize()`
38449
38449
  * will be called on the PKCS#11 library.
38450
38450
  */
38451
- constructor(path3, behavior = _Pkcs11Lib.InitializeFinalizeBehavior.DEFAULT) {
38452
- super(binding_1.default.io_pkcs11_lib_new(path3, behavior));
38451
+ constructor(path4, behavior = _Pkcs11Lib.InitializeFinalizeBehavior.DEFAULT) {
38452
+ super(binding_1.default.io_pkcs11_lib_new(path4, behavior));
38453
38453
  }
38454
38454
  /**
38455
38455
  * Release the PKCS#11 library immediately, without waiting for the GC.
@@ -39650,8 +39650,8 @@ var require_http2 = __commonJS({
39650
39650
  exports.HttpHeaders = binding_1.default.HttpHeaders;
39651
39651
  var nativeHttpRequest = binding_1.default.HttpRequest;
39652
39652
  var HttpRequest = class extends nativeHttpRequest {
39653
- constructor(method, path3, headers, body) {
39654
- super(method, path3, headers, body === null || body === void 0 ? void 0 : body.native_handle());
39653
+ constructor(method, path4, headers, body) {
39654
+ super(method, path4, headers, body === null || body === void 0 ? void 0 : body.native_handle());
39655
39655
  }
39656
39656
  };
39657
39657
  exports.HttpRequest = HttpRequest;
@@ -40054,7 +40054,7 @@ var require_aws_iot_shared = __commonJS({
40054
40054
  }
40055
40055
  }
40056
40056
  function buildMqtt5FinalUsername(customAuthConfig) {
40057
- let path3 = "";
40057
+ let path4 = "";
40058
40058
  let paramList = [];
40059
40059
  if (customAuthConfig) {
40060
40060
  let usingSigning = false;
@@ -40067,7 +40067,7 @@ var require_aws_iot_shared = __commonJS({
40067
40067
  let username = customAuthConfig.username;
40068
40068
  let pathSplit = (username !== null && username !== void 0 ? username : "").split("?");
40069
40069
  let params = pathSplit.slice(1);
40070
- path3 = pathSplit[0];
40070
+ path4 = pathSplit[0];
40071
40071
  if (params.length > 1) {
40072
40072
  throw new Error("Custom auth username property value is invalid");
40073
40073
  } else if (params.length == 1) {
@@ -40085,7 +40085,7 @@ var require_aws_iot_shared = __commonJS({
40085
40085
  }
40086
40086
  paramList.push(["SDK", "NodeJSv2"]);
40087
40087
  paramList.push(["Version", platform2.crt_version()]);
40088
- return (path3 !== null && path3 !== void 0 ? path3 : "") + "?" + paramList.map((value) => `${value[0]}=${value[1]}`).join("&");
40088
+ return (path4 !== null && path4 !== void 0 ? path4 : "") + "?" + paramList.map((value) => `${value[0]}=${value[1]}`).join("&");
40089
40089
  }
40090
40090
  exports.buildMqtt5FinalUsername = buildMqtt5FinalUsername;
40091
40091
  function extractRegionFromEndpoint(endpoint) {
@@ -42627,18 +42627,18 @@ var require_getAttrPathList = __commonJS({
42627
42627
  Object.defineProperty(exports, "__esModule", { value: true });
42628
42628
  exports.getAttrPathList = void 0;
42629
42629
  var types_1 = require_types5();
42630
- var getAttrPathList = (path3) => {
42631
- const parts = path3.split(".");
42630
+ var getAttrPathList = (path4) => {
42631
+ const parts = path4.split(".");
42632
42632
  const pathList = [];
42633
42633
  for (const part of parts) {
42634
42634
  const squareBracketIndex = part.indexOf("[");
42635
42635
  if (squareBracketIndex !== -1) {
42636
42636
  if (part.indexOf("]") !== part.length - 1) {
42637
- throw new types_1.EndpointError(`Path: '${path3}' does not end with ']'`);
42637
+ throw new types_1.EndpointError(`Path: '${path4}' does not end with ']'`);
42638
42638
  }
42639
42639
  const arrayIndex = part.slice(squareBracketIndex + 1, -1);
42640
42640
  if (Number.isNaN(parseInt(arrayIndex))) {
42641
- throw new types_1.EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path3}'`);
42641
+ throw new types_1.EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path4}'`);
42642
42642
  }
42643
42643
  if (squareBracketIndex !== 0) {
42644
42644
  pathList.push(part.slice(0, squareBracketIndex));
@@ -42662,9 +42662,9 @@ var require_getAttr = __commonJS({
42662
42662
  exports.getAttr = void 0;
42663
42663
  var types_1 = require_types5();
42664
42664
  var getAttrPathList_1 = require_getAttrPathList();
42665
- var getAttr = (value, path3) => (0, getAttrPathList_1.getAttrPathList)(path3).reduce((acc, index) => {
42665
+ var getAttr = (value, path4) => (0, getAttrPathList_1.getAttrPathList)(path4).reduce((acc, index) => {
42666
42666
  if (typeof acc !== "object") {
42667
- throw new types_1.EndpointError(`Index '${index}' in '${path3}' not found in '${JSON.stringify(value)}'`);
42667
+ throw new types_1.EndpointError(`Index '${index}' in '${path4}' not found in '${JSON.stringify(value)}'`);
42668
42668
  } else if (Array.isArray(acc)) {
42669
42669
  return acc[parseInt(index)];
42670
42670
  }
@@ -43031,8 +43031,8 @@ var require_parseURL = __commonJS({
43031
43031
  return value;
43032
43032
  }
43033
43033
  if (typeof value === "object" && "hostname" in value) {
43034
- const { hostname: hostname2, port, protocol: protocol2 = "", path: path3 = "", query = {} } = value;
43035
- const url2 = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path3}`);
43034
+ const { hostname: hostname2, port, protocol: protocol2 = "", path: path4 = "", query = {} } = value;
43035
+ const url2 = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path4}`);
43036
43036
  url2.search = Object.entries(query).map(([k, v]) => `${k}=${v}`).join("&");
43037
43037
  return url2;
43038
43038
  }
@@ -51306,26 +51306,26 @@ var require_utils3 = __commonJS({
51306
51306
  }
51307
51307
  mkdirSync(folder);
51308
51308
  };
51309
- Utils.prototype.writeFileTo = function(path3, content, overwrite, attr) {
51309
+ Utils.prototype.writeFileTo = function(path4, content, overwrite, attr) {
51310
51310
  const self = this;
51311
- if (self.fs.existsSync(path3)) {
51311
+ if (self.fs.existsSync(path4)) {
51312
51312
  if (!overwrite)
51313
51313
  return false;
51314
- var stat = self.fs.statSync(path3);
51314
+ var stat = self.fs.statSync(path4);
51315
51315
  if (stat.isDirectory()) {
51316
51316
  return false;
51317
51317
  }
51318
51318
  }
51319
- var folder = pth.dirname(path3);
51319
+ var folder = pth.dirname(path4);
51320
51320
  if (!self.fs.existsSync(folder)) {
51321
51321
  self.makeDir(folder);
51322
51322
  }
51323
51323
  var fd;
51324
51324
  try {
51325
- fd = self.fs.openSync(path3, "w", 438);
51325
+ fd = self.fs.openSync(path4, "w", 438);
51326
51326
  } catch (e) {
51327
- self.fs.chmodSync(path3, 438);
51328
- fd = self.fs.openSync(path3, "w", 438);
51327
+ self.fs.chmodSync(path4, 438);
51328
+ fd = self.fs.openSync(path4, "w", 438);
51329
51329
  }
51330
51330
  if (fd) {
51331
51331
  try {
@@ -51334,33 +51334,33 @@ var require_utils3 = __commonJS({
51334
51334
  self.fs.closeSync(fd);
51335
51335
  }
51336
51336
  }
51337
- self.fs.chmodSync(path3, attr || 438);
51337
+ self.fs.chmodSync(path4, attr || 438);
51338
51338
  return true;
51339
51339
  };
51340
- Utils.prototype.writeFileToAsync = function(path3, content, overwrite, attr, callback) {
51340
+ Utils.prototype.writeFileToAsync = function(path4, content, overwrite, attr, callback) {
51341
51341
  if (typeof attr === "function") {
51342
51342
  callback = attr;
51343
51343
  attr = void 0;
51344
51344
  }
51345
51345
  const self = this;
51346
- self.fs.exists(path3, function(exist) {
51346
+ self.fs.exists(path4, function(exist) {
51347
51347
  if (exist && !overwrite)
51348
51348
  return callback(false);
51349
- self.fs.stat(path3, function(err, stat) {
51349
+ self.fs.stat(path4, function(err, stat) {
51350
51350
  if (exist && stat.isDirectory()) {
51351
51351
  return callback(false);
51352
51352
  }
51353
- var folder = pth.dirname(path3);
51353
+ var folder = pth.dirname(path4);
51354
51354
  self.fs.exists(folder, function(exists) {
51355
51355
  if (!exists)
51356
51356
  self.makeDir(folder);
51357
- self.fs.open(path3, "w", 438, function(err2, fd) {
51357
+ self.fs.open(path4, "w", 438, function(err2, fd) {
51358
51358
  if (err2) {
51359
- self.fs.chmod(path3, 438, function() {
51360
- self.fs.open(path3, "w", 438, function(err3, fd2) {
51359
+ self.fs.chmod(path4, 438, function() {
51360
+ self.fs.open(path4, "w", 438, function(err3, fd2) {
51361
51361
  self.fs.write(fd2, content, 0, content.length, 0, function() {
51362
51362
  self.fs.close(fd2, function() {
51363
- self.fs.chmod(path3, attr || 438, function() {
51363
+ self.fs.chmod(path4, attr || 438, function() {
51364
51364
  callback(true);
51365
51365
  });
51366
51366
  });
@@ -51370,13 +51370,13 @@ var require_utils3 = __commonJS({
51370
51370
  } else if (fd) {
51371
51371
  self.fs.write(fd, content, 0, content.length, 0, function() {
51372
51372
  self.fs.close(fd, function() {
51373
- self.fs.chmod(path3, attr || 438, function() {
51373
+ self.fs.chmod(path4, attr || 438, function() {
51374
51374
  callback(true);
51375
51375
  });
51376
51376
  });
51377
51377
  });
51378
51378
  } else {
51379
- self.fs.chmod(path3, attr || 438, function() {
51379
+ self.fs.chmod(path4, attr || 438, function() {
51380
51380
  callback(true);
51381
51381
  });
51382
51382
  }
@@ -51385,7 +51385,7 @@ var require_utils3 = __commonJS({
51385
51385
  });
51386
51386
  });
51387
51387
  };
51388
- Utils.prototype.findFiles = function(path3) {
51388
+ Utils.prototype.findFiles = function(path4) {
51389
51389
  const self = this;
51390
51390
  function findSync(dir, pattern, recursive) {
51391
51391
  if (typeof pattern === "boolean") {
@@ -51394,16 +51394,16 @@ var require_utils3 = __commonJS({
51394
51394
  }
51395
51395
  let files = [];
51396
51396
  self.fs.readdirSync(dir).forEach(function(file) {
51397
- var path4 = pth.join(dir, file);
51398
- if (self.fs.statSync(path4).isDirectory() && recursive)
51399
- files = files.concat(findSync(path4, pattern, recursive));
51400
- if (!pattern || pattern.test(path4)) {
51401
- files.push(pth.normalize(path4) + (self.fs.statSync(path4).isDirectory() ? self.sep : ""));
51397
+ var path5 = pth.join(dir, file);
51398
+ if (self.fs.statSync(path5).isDirectory() && recursive)
51399
+ files = files.concat(findSync(path5, pattern, recursive));
51400
+ if (!pattern || pattern.test(path5)) {
51401
+ files.push(pth.normalize(path5) + (self.fs.statSync(path5).isDirectory() ? self.sep : ""));
51402
51402
  }
51403
51403
  });
51404
51404
  return files;
51405
51405
  }
51406
- return findSync(path3, void 0, true);
51406
+ return findSync(path4, void 0, true);
51407
51407
  };
51408
51408
  Utils.prototype.getAttributes = function() {
51409
51409
  };
@@ -51434,19 +51434,19 @@ var require_utils3 = __commonJS({
51434
51434
  return "UNSUPPORTED (" + method + ")";
51435
51435
  }
51436
51436
  };
51437
- Utils.canonical = function(path3) {
51438
- if (!path3)
51437
+ Utils.canonical = function(path4) {
51438
+ if (!path4)
51439
51439
  return "";
51440
- var safeSuffix = pth.posix.normalize("/" + path3.split("\\").join("/"));
51440
+ var safeSuffix = pth.posix.normalize("/" + path4.split("\\").join("/"));
51441
51441
  return pth.join(".", safeSuffix);
51442
51442
  };
51443
51443
  Utils.sanitize = function(prefix, name) {
51444
51444
  prefix = pth.resolve(pth.normalize(prefix));
51445
51445
  var parts = name.split("/");
51446
51446
  for (var i = 0, l = parts.length; i < l; i++) {
51447
- var path3 = pth.normalize(pth.join(prefix, parts.slice(i, l).join(pth.sep)));
51448
- if (path3.indexOf(prefix) === 0) {
51449
- return path3;
51447
+ var path4 = pth.normalize(pth.join(prefix, parts.slice(i, l).join(pth.sep)));
51448
+ if (path4.indexOf(prefix) === 0) {
51449
+ return path4;
51450
51450
  }
51451
51451
  }
51452
51452
  return pth.normalize(pth.join(prefix, pth.basename(name)));
@@ -51476,8 +51476,8 @@ var require_fattr = __commonJS({
51476
51476
  var fs2 = require_fileSystem().require();
51477
51477
  var pth = __require("path");
51478
51478
  fs2.existsSync = fs2.existsSync || pth.existsSync;
51479
- module.exports = function(path3) {
51480
- var _path = path3 || "", _obj = newAttr(), _stat = null;
51479
+ module.exports = function(path4) {
51480
+ var _path = path4 || "", _obj = newAttr(), _stat = null;
51481
51481
  function newAttr() {
51482
51482
  return {
51483
51483
  directory: false,
@@ -65593,7 +65593,7 @@ var require_CopyObjectCommand = __commonJS({
65593
65593
  var smithy_client_1 = require_dist_cjs7();
65594
65594
  var models_0_1 = require_models_05();
65595
65595
  var Aws_restXml_1 = require_Aws_restXml();
65596
- var CopyObjectCommand = class _CopyObjectCommand extends smithy_client_1.Command {
65596
+ var CopyObjectCommand2 = class _CopyObjectCommand extends smithy_client_1.Command {
65597
65597
  constructor(input) {
65598
65598
  super();
65599
65599
  this.input = input;
@@ -65638,7 +65638,7 @@ var require_CopyObjectCommand = __commonJS({
65638
65638
  return (0, Aws_restXml_1.deserializeAws_restXmlCopyObjectCommand)(output, context);
65639
65639
  }
65640
65640
  };
65641
- exports.CopyObjectCommand = CopyObjectCommand;
65641
+ exports.CopyObjectCommand = CopyObjectCommand2;
65642
65642
  }
65643
65643
  });
65644
65644
 
@@ -74796,10 +74796,10 @@ ${longDate}
74796
74796
  ${credentialScope}
74797
74797
  ${(0, util_hex_encoding_1.toHex)(hashedRequest)}`;
74798
74798
  }
74799
- getCanonicalPath({ path: path3 }) {
74799
+ getCanonicalPath({ path: path4 }) {
74800
74800
  if (this.uriEscapePath) {
74801
74801
  const normalizedPathSegments = [];
74802
- for (const pathSegment of path3.split("/")) {
74802
+ for (const pathSegment of path4.split("/")) {
74803
74803
  if ((pathSegment === null || pathSegment === void 0 ? void 0 : pathSegment.length) === 0)
74804
74804
  continue;
74805
74805
  if (pathSegment === ".")
@@ -74810,11 +74810,11 @@ ${(0, util_hex_encoding_1.toHex)(hashedRequest)}`;
74810
74810
  normalizedPathSegments.push(pathSegment);
74811
74811
  }
74812
74812
  }
74813
- const normalizedPath = `${(path3 === null || path3 === void 0 ? void 0 : path3.startsWith("/")) ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && (path3 === null || path3 === void 0 ? void 0 : path3.endsWith("/")) ? "/" : ""}`;
74813
+ const normalizedPath = `${(path4 === null || path4 === void 0 ? void 0 : path4.startsWith("/")) ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && (path4 === null || path4 === void 0 ? void 0 : path4.endsWith("/")) ? "/" : ""}`;
74814
74814
  const doubleEncoded = encodeURIComponent(normalizedPath);
74815
74815
  return doubleEncoded.replace(/%2F/g, "/");
74816
74816
  }
74817
- return path3;
74817
+ return path4;
74818
74818
  }
74819
74819
  async getSignature(longDate, credentialScope, keyPromise, canonicalRequest) {
74820
74820
  const stringToSign = await this.createStringToSign(longDate, credentialScope, canonicalRequest);
@@ -75473,7 +75473,7 @@ var require_S3Client = __commonJS({
75473
75473
  var smithy_client_1 = require_dist_cjs7();
75474
75474
  var EndpointParameters_1 = require_EndpointParameters5();
75475
75475
  var runtimeConfig_1 = require_runtimeConfig5();
75476
- var S3Client2 = class extends smithy_client_1.Client {
75476
+ var S3Client3 = class extends smithy_client_1.Client {
75477
75477
  constructor(configuration) {
75478
75478
  const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration);
75479
75479
  const _config_1 = (0, EndpointParameters_1.resolveClientEndpointParameters)(_config_0);
@@ -75501,7 +75501,7 @@ var require_S3Client = __commonJS({
75501
75501
  super.destroy();
75502
75502
  }
75503
75503
  };
75504
- exports.S3Client = S3Client2;
75504
+ exports.S3Client = S3Client3;
75505
75505
  }
75506
75506
  });
75507
75507
 
@@ -104208,8 +104208,8 @@ var require_createConfigValueProvider2 = __commonJS({
104208
104208
  return endpoint.url.href;
104209
104209
  }
104210
104210
  if ("hostname" in endpoint) {
104211
- const { protocol, hostname, port, path: path3 } = endpoint;
104212
- return `${protocol}//${hostname}${port ? ":" + port : ""}${path3}`;
104211
+ const { protocol, hostname, port, path: path4 } = endpoint;
104212
+ return `${protocol}//${hostname}${port ? ":" + port : ""}${path4}`;
104213
104213
  }
104214
104214
  }
104215
104215
  return endpoint;
@@ -105894,10 +105894,10 @@ ${longDate}
105894
105894
  ${credentialScope}
105895
105895
  ${(0, util_hex_encoding_1.toHex)(hashedRequest)}`;
105896
105896
  }
105897
- getCanonicalPath({ path: path3 }) {
105897
+ getCanonicalPath({ path: path4 }) {
105898
105898
  if (this.uriEscapePath) {
105899
105899
  const normalizedPathSegments = [];
105900
- for (const pathSegment of path3.split("/")) {
105900
+ for (const pathSegment of path4.split("/")) {
105901
105901
  if ((pathSegment === null || pathSegment === void 0 ? void 0 : pathSegment.length) === 0)
105902
105902
  continue;
105903
105903
  if (pathSegment === ".")
@@ -105908,11 +105908,11 @@ ${(0, util_hex_encoding_1.toHex)(hashedRequest)}`;
105908
105908
  normalizedPathSegments.push(pathSegment);
105909
105909
  }
105910
105910
  }
105911
- const normalizedPath = `${(path3 === null || path3 === void 0 ? void 0 : path3.startsWith("/")) ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && (path3 === null || path3 === void 0 ? void 0 : path3.endsWith("/")) ? "/" : ""}`;
105911
+ const normalizedPath = `${(path4 === null || path4 === void 0 ? void 0 : path4.startsWith("/")) ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && (path4 === null || path4 === void 0 ? void 0 : path4.endsWith("/")) ? "/" : ""}`;
105912
105912
  const doubleEncoded = encodeURIComponent(normalizedPath);
105913
105913
  return doubleEncoded.replace(/%2F/g, "/");
105914
105914
  }
105915
- return path3;
105915
+ return path4;
105916
105916
  }
105917
105917
  async getSignature(longDate, credentialScope, keyPromise, canonicalRequest) {
105918
105918
  const stringToSign = await this.createStringToSign(longDate, credentialScope, canonicalRequest);
@@ -110233,14 +110233,14 @@ var require_Aws_query2 = __commonJS({
110233
110233
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
110234
110234
  };
110235
110235
  var collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
110236
- var buildHttpRpcRequest = async (context, headers, path3, resolvedHostname, body) => {
110236
+ var buildHttpRpcRequest = async (context, headers, path4, resolvedHostname, body) => {
110237
110237
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
110238
110238
  const contents = {
110239
110239
  protocol,
110240
110240
  hostname,
110241
110241
  port,
110242
110242
  method: "POST",
110243
- path: basePath.endsWith("/") ? basePath.slice(0, -1) + path3 : basePath + path3,
110243
+ path: basePath.endsWith("/") ? basePath.slice(0, -1) + path4 : basePath + path4,
110244
110244
  headers
110245
110245
  };
110246
110246
  if (resolvedHostname !== void 0) {
@@ -111159,11 +111159,11 @@ var require_slurpFile2 = __commonJS({
111159
111159
  var fs_1 = __require("fs");
111160
111160
  var { readFile } = fs_1.promises;
111161
111161
  var filePromisesHash = {};
111162
- var slurpFile = (path3) => {
111163
- if (!filePromisesHash[path3]) {
111164
- filePromisesHash[path3] = readFile(path3, "utf8");
111162
+ var slurpFile = (path4) => {
111163
+ if (!filePromisesHash[path4]) {
111164
+ filePromisesHash[path4] = readFile(path4, "utf8");
111165
111165
  }
111166
- return filePromisesHash[path3];
111166
+ return filePromisesHash[path4];
111167
111167
  };
111168
111168
  exports.slurpFile = slurpFile;
111169
111169
  }
@@ -113073,7 +113073,7 @@ var require_node_http2_handler2 = __commonJS({
113073
113073
  rejectOriginal(abortError);
113074
113074
  return;
113075
113075
  }
113076
- const { hostname, method, port, protocol, path: path3, query } = request;
113076
+ const { hostname, method, port, protocol, path: path4, query } = request;
113077
113077
  const authority = `${protocol}//${hostname}${port ? `:${port}` : ""}`;
113078
113078
  const session = this.getSession(authority, disableConcurrentStreams || false);
113079
113079
  const reject = (err) => {
@@ -113086,7 +113086,7 @@ var require_node_http2_handler2 = __commonJS({
113086
113086
  const queryString = (0, querystring_builder_1.buildQueryString)(query || {});
113087
113087
  const req = session.request({
113088
113088
  ...request.headers,
113089
- [http2_1.constants.HTTP2_HEADER_PATH]: queryString ? `${path3}?${queryString}` : path3,
113089
+ [http2_1.constants.HTTP2_HEADER_PATH]: queryString ? `${path4}?${queryString}` : path4,
113090
113090
  [http2_1.constants.HTTP2_HEADER_METHOD]: method
113091
113091
  });
113092
113092
  session.ref();
@@ -113706,18 +113706,18 @@ var require_getAttrPathList2 = __commonJS({
113706
113706
  Object.defineProperty(exports, "__esModule", { value: true });
113707
113707
  exports.getAttrPathList = void 0;
113708
113708
  var types_1 = require_types12();
113709
- var getAttrPathList = (path3) => {
113710
- const parts = path3.split(".");
113709
+ var getAttrPathList = (path4) => {
113710
+ const parts = path4.split(".");
113711
113711
  const pathList = [];
113712
113712
  for (const part of parts) {
113713
113713
  const squareBracketIndex = part.indexOf("[");
113714
113714
  if (squareBracketIndex !== -1) {
113715
113715
  if (part.indexOf("]") !== part.length - 1) {
113716
- throw new types_1.EndpointError(`Path: '${path3}' does not end with ']'`);
113716
+ throw new types_1.EndpointError(`Path: '${path4}' does not end with ']'`);
113717
113717
  }
113718
113718
  const arrayIndex = part.slice(squareBracketIndex + 1, -1);
113719
113719
  if (Number.isNaN(parseInt(arrayIndex))) {
113720
- throw new types_1.EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path3}'`);
113720
+ throw new types_1.EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path4}'`);
113721
113721
  }
113722
113722
  if (squareBracketIndex !== 0) {
113723
113723
  pathList.push(part.slice(0, squareBracketIndex));
@@ -113741,9 +113741,9 @@ var require_getAttr2 = __commonJS({
113741
113741
  exports.getAttr = void 0;
113742
113742
  var types_1 = require_types12();
113743
113743
  var getAttrPathList_1 = require_getAttrPathList2();
113744
- var getAttr = (value, path3) => (0, getAttrPathList_1.getAttrPathList)(path3).reduce((acc, index) => {
113744
+ var getAttr = (value, path4) => (0, getAttrPathList_1.getAttrPathList)(path4).reduce((acc, index) => {
113745
113745
  if (typeof acc !== "object") {
113746
- throw new types_1.EndpointError(`Index '${index}' in '${path3}' not found in '${JSON.stringify(value)}'`);
113746
+ throw new types_1.EndpointError(`Index '${index}' in '${path4}' not found in '${JSON.stringify(value)}'`);
113747
113747
  } else if (Array.isArray(acc)) {
113748
113748
  return acc[parseInt(index)];
113749
113749
  }
@@ -114007,8 +114007,8 @@ var require_parseURL2 = __commonJS({
114007
114007
  return value;
114008
114008
  }
114009
114009
  if (typeof value === "object" && "hostname" in value) {
114010
- const { hostname: hostname2, port, protocol: protocol2 = "", path: path3 = "", query = {} } = value;
114011
- const url2 = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path3}`);
114010
+ const { hostname: hostname2, port, protocol: protocol2 = "", path: path4 = "", query = {} } = value;
114011
+ const url2 = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path4}`);
114012
114012
  url2.search = Object.entries(query).map(([k, v]) => `${k}=${v}`).join("&");
114013
114013
  return url2;
114014
114014
  }
@@ -153093,14 +153093,14 @@ var require_Aws_query3 = __commonJS({
153093
153093
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
153094
153094
  };
153095
153095
  var collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
153096
- var buildHttpRpcRequest = async (context, headers, path3, resolvedHostname, body) => {
153096
+ var buildHttpRpcRequest = async (context, headers, path4, resolvedHostname, body) => {
153097
153097
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
153098
153098
  const contents = {
153099
153099
  protocol,
153100
153100
  hostname,
153101
153101
  port,
153102
153102
  method: "POST",
153103
- path: basePath.endsWith("/") ? basePath.slice(0, -1) + path3 : basePath + path3,
153103
+ path: basePath.endsWith("/") ? basePath.slice(0, -1) + path4 : basePath + path4,
153104
153104
  headers
153105
153105
  };
153106
153106
  if (resolvedHostname !== void 0) {
@@ -180411,6 +180411,37 @@ async function invoke(functionName) {
180411
180411
  }
180412
180412
  }
180413
180413
 
180414
+ // support/custom-resources/function-sourcemap-uploader.ts
180415
+ var import_client_s32 = __toESM(require_dist_cjs77(), 1);
180416
+ import path3 from "path";
180417
+ var s32 = new import_client_s32.S3Client({});
180418
+ async function FunctionSourcemapUploader(cfnRequest) {
180419
+ switch (cfnRequest.RequestType) {
180420
+ case "Create":
180421
+ case "Update":
180422
+ const old = cfnRequest.RequestType === "Update" ? Object.fromEntries(cfnRequest.OldResourceProperties.functions) : {};
180423
+ const next = cfnRequest.ResourceProperties;
180424
+ for (const [arn, key] of cfnRequest.ResourceProperties.functions) {
180425
+ if (old[arn] === key)
180426
+ continue;
180427
+ await s32.send(
180428
+ new import_client_s32.CopyObjectCommand({
180429
+ Bucket: cfnRequest.ResourceProperties.bootstrap,
180430
+ ContentType: "application/json",
180431
+ CopySource: `/${next.bucket}/${key}`,
180432
+ ContentEncoding: "gzip",
180433
+ Key: `sourcemap/${next.app}/${next.stage}/${arn}/${path3.parse(key).base}`
180434
+ })
180435
+ );
180436
+ }
180437
+ break;
180438
+ case "Delete":
180439
+ break;
180440
+ default:
180441
+ throw new Error("Unsupported request type");
180442
+ }
180443
+ }
180444
+
180414
180445
  // support/custom-resources/index.ts
180415
180446
  var handler = wrapper(async (cfnRequest) => {
180416
180447
  log("onEventHandler", cfnRequest);
@@ -180430,6 +180461,9 @@ var handler = wrapper(async (cfnRequest) => {
180430
180461
  case "Custom::FunctionInvoker":
180431
180462
  await FunctionInvoker(cfnRequest);
180432
180463
  break;
180464
+ case "Custom::FunctionSourcemapUploader":
180465
+ await FunctionSourcemapUploader(cfnRequest);
180466
+ break;
180433
180467
  }
180434
180468
  });
180435
180469
  export {
@@ -40,7 +40,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
40
40
  ));
41
41
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
42
42
 
43
- // ../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs
43
+ // ../../node_modules/.pnpm/tslib@2.6.1/node_modules/tslib/tslib.es6.mjs
44
44
  var tslib_es6_exports = {};
45
45
  __export(tslib_es6_exports, {
46
46
  __addDisposableResource: () => __addDisposableResource,
@@ -460,7 +460,7 @@ function __classPrivateFieldIn(state, receiver) {
460
460
  }
461
461
  function __addDisposableResource(env, value, async) {
462
462
  if (value !== null && value !== void 0) {
463
- if (typeof value !== "object")
463
+ if (typeof value !== "object" && typeof value !== "function")
464
464
  throw new TypeError("Object expected.");
465
465
  var dispose;
466
466
  if (async) {
@@ -507,7 +507,7 @@ function __disposeResources(env) {
507
507
  }
508
508
  var extendStatics, __assign, __createBinding, __setModuleDefault, _SuppressedError, tslib_es6_default;
509
509
  var init_tslib_es6 = __esm({
510
- "../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs"() {
510
+ "../../node_modules/.pnpm/tslib@2.6.1/node_modules/tslib/tslib.es6.mjs"() {
511
511
  extendStatics = function(d, b) {
512
512
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
513
513
  d2.__proto__ = b2;