sst 2.0.18 → 2.0.20
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/Function.d.ts +1 -0
- package/constructs/Function.js +1 -0
- package/constructs/WebSocketApi.d.ts +1 -0
- package/constructs/WebSocketApi.js +38 -0
- package/package.json +3 -1
- package/runtime/handlers/rust.d.ts +1 -0
- package/runtime/handlers/rust.js +96 -0
- package/runtime/server.js +9 -2
- package/sst.mjs +206 -83
- package/stacks/deploy.js +4 -0
- package/stacks/synth.js +2 -0
- package/support/custom-resources/index.mjs +50301 -0
package/sst.mjs
CHANGED
|
@@ -2291,9 +2291,11 @@ var init_server2 = __esm({
|
|
|
2291
2291
|
"Lambda-Runtime-Client-Context": JSON.stringify(
|
|
2292
2292
|
payload.context.clientContext || {}
|
|
2293
2293
|
),
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2294
|
+
...payload.context.identity ? {
|
|
2295
|
+
"Lambda-Runtime-Cognito-Identity": JSON.stringify(
|
|
2296
|
+
payload.context.identity
|
|
2297
|
+
)
|
|
2298
|
+
} : {}
|
|
2297
2299
|
});
|
|
2298
2300
|
res.json(payload.event);
|
|
2299
2301
|
}
|
|
@@ -2302,10 +2304,13 @@ var init_server2 = __esm({
|
|
|
2302
2304
|
`/:workerID/${cfg.API_VERSION}/runtime/invocation/:awsRequestId/response`,
|
|
2303
2305
|
express2.json({
|
|
2304
2306
|
strict: false,
|
|
2305
|
-
type
|
|
2307
|
+
type() {
|
|
2308
|
+
return true;
|
|
2309
|
+
},
|
|
2306
2310
|
limit: "10mb"
|
|
2307
2311
|
}),
|
|
2308
2312
|
(req, res) => {
|
|
2313
|
+
console.log(JSON.stringify(req.body, null, 4));
|
|
2309
2314
|
Logger.debug("Worker", req.params.workerID, "got response", req.body);
|
|
2310
2315
|
const worker = workers.fromID(req.params.workerID);
|
|
2311
2316
|
bus.publish("function.success", {
|
|
@@ -4180,6 +4185,9 @@ async function publishAssets4(stacks) {
|
|
|
4180
4185
|
return results;
|
|
4181
4186
|
}
|
|
4182
4187
|
async function deployMany(stacks) {
|
|
4188
|
+
if (stacks.length === 0) {
|
|
4189
|
+
throw new VisibleError("No stacks to deploy");
|
|
4190
|
+
}
|
|
4183
4191
|
Logger.debug(
|
|
4184
4192
|
"Deploying stacks",
|
|
4185
4193
|
stacks.map((s) => s.stackName)
|
|
@@ -4355,13 +4363,13 @@ async function listImports(exportName) {
|
|
|
4355
4363
|
}
|
|
4356
4364
|
}
|
|
4357
4365
|
async function getLocalTemplate(stack) {
|
|
4358
|
-
const
|
|
4359
|
-
const fileContent = await
|
|
4366
|
+
const fs19 = await import("fs/promises");
|
|
4367
|
+
const fileContent = await fs19.readFile(stack.templateFullPath);
|
|
4360
4368
|
return fileContent.toString();
|
|
4361
4369
|
}
|
|
4362
4370
|
async function saveLocalTemplate(stack, content) {
|
|
4363
|
-
const
|
|
4364
|
-
await
|
|
4371
|
+
const fs19 = await import("fs/promises");
|
|
4372
|
+
await fs19.writeFile(stack.templateFullPath, content);
|
|
4365
4373
|
}
|
|
4366
4374
|
var init_deploy = __esm({
|
|
4367
4375
|
"src/stacks/deploy.ts"() {
|
|
@@ -4370,6 +4378,7 @@ var init_deploy = __esm({
|
|
|
4370
4378
|
init_credentials();
|
|
4371
4379
|
init_logger();
|
|
4372
4380
|
init_monitor();
|
|
4381
|
+
init_error();
|
|
4373
4382
|
}
|
|
4374
4383
|
});
|
|
4375
4384
|
|
|
@@ -5048,19 +5057,131 @@ var init_go = __esm({
|
|
|
5048
5057
|
}
|
|
5049
5058
|
});
|
|
5050
5059
|
|
|
5060
|
+
// src/runtime/handlers/rust.ts
|
|
5061
|
+
var rust_exports = {};
|
|
5062
|
+
__export(rust_exports, {
|
|
5063
|
+
useRustHandler: () => useRustHandler
|
|
5064
|
+
});
|
|
5065
|
+
import path12 from "path";
|
|
5066
|
+
import fs12 from "fs/promises";
|
|
5067
|
+
import { exec as exec4, spawn as spawn4 } from "child_process";
|
|
5068
|
+
import { promisify as promisify3 } from "util";
|
|
5069
|
+
var execAsync3, useRustHandler;
|
|
5070
|
+
var init_rust = __esm({
|
|
5071
|
+
"src/runtime/handlers/rust.ts"() {
|
|
5072
|
+
"use strict";
|
|
5073
|
+
init_handlers();
|
|
5074
|
+
init_workers();
|
|
5075
|
+
init_context();
|
|
5076
|
+
init_error();
|
|
5077
|
+
init_server2();
|
|
5078
|
+
init_fs();
|
|
5079
|
+
execAsync3 = promisify3(exec4);
|
|
5080
|
+
useRustHandler = Context.memo(async () => {
|
|
5081
|
+
const workers = await useRuntimeWorkers();
|
|
5082
|
+
const server = await useRuntimeServerConfig();
|
|
5083
|
+
const handlers = useRuntimeHandlers();
|
|
5084
|
+
const processes = /* @__PURE__ */ new Map();
|
|
5085
|
+
const sources = /* @__PURE__ */ new Map();
|
|
5086
|
+
const handlerName = process.platform === "win32" ? `handler.exe` : `handler`;
|
|
5087
|
+
handlers.register({
|
|
5088
|
+
shouldBuild: (input) => {
|
|
5089
|
+
if (!input.file.endsWith(".rs"))
|
|
5090
|
+
return false;
|
|
5091
|
+
const parent = sources.get(input.functionID);
|
|
5092
|
+
if (!parent)
|
|
5093
|
+
return false;
|
|
5094
|
+
const result = isChild(parent, input.file);
|
|
5095
|
+
return result;
|
|
5096
|
+
},
|
|
5097
|
+
canHandle: (input) => input.startsWith("rust"),
|
|
5098
|
+
startWorker: async (input) => {
|
|
5099
|
+
const proc = spawn4(path12.join(input.out, handlerName), {
|
|
5100
|
+
env: {
|
|
5101
|
+
...process.env,
|
|
5102
|
+
...input.environment,
|
|
5103
|
+
IS_LOCAL: "true",
|
|
5104
|
+
RUST_BACKTRACE: "1",
|
|
5105
|
+
AWS_LAMBDA_RUNTIME_API: `http://localhost:${server.port}/${input.workerID}`,
|
|
5106
|
+
AWS_LAMBDA_FUNCTION_MEMORY_SIZE: "1024"
|
|
5107
|
+
},
|
|
5108
|
+
cwd: input.out
|
|
5109
|
+
});
|
|
5110
|
+
proc.on("exit", () => workers.exited(input.workerID));
|
|
5111
|
+
proc.stdout.on("data", (data2) => {
|
|
5112
|
+
workers.stdout(input.workerID, data2.toString());
|
|
5113
|
+
});
|
|
5114
|
+
proc.stderr.on("data", (data2) => {
|
|
5115
|
+
workers.stdout(input.workerID, data2.toString());
|
|
5116
|
+
});
|
|
5117
|
+
processes.set(input.workerID, proc);
|
|
5118
|
+
},
|
|
5119
|
+
stopWorker: async (workerID) => {
|
|
5120
|
+
const proc = processes.get(workerID);
|
|
5121
|
+
if (proc) {
|
|
5122
|
+
proc.kill();
|
|
5123
|
+
processes.delete(workerID);
|
|
5124
|
+
}
|
|
5125
|
+
},
|
|
5126
|
+
build: async (input) => {
|
|
5127
|
+
const parsed = path12.parse(input.props.handler);
|
|
5128
|
+
const project = await findAbove(parsed.dir, "Cargo.toml");
|
|
5129
|
+
sources.set(input.functionID, project);
|
|
5130
|
+
if (input.mode === "start") {
|
|
5131
|
+
try {
|
|
5132
|
+
await execAsync3(`cargo build --bin ${parsed.name}`, {
|
|
5133
|
+
cwd: project,
|
|
5134
|
+
env: {
|
|
5135
|
+
...process.env
|
|
5136
|
+
}
|
|
5137
|
+
});
|
|
5138
|
+
await fs12.cp(
|
|
5139
|
+
path12.join(project, `target/debug`, parsed.name),
|
|
5140
|
+
path12.join(input.out, "handler")
|
|
5141
|
+
);
|
|
5142
|
+
} catch (ex) {
|
|
5143
|
+
throw new VisibleError("Failed to build");
|
|
5144
|
+
}
|
|
5145
|
+
}
|
|
5146
|
+
if (input.mode === "deploy") {
|
|
5147
|
+
try {
|
|
5148
|
+
await execAsync3(`cargo lambda build --release --bin ${parsed.name}`, {
|
|
5149
|
+
cwd: project,
|
|
5150
|
+
env: {
|
|
5151
|
+
...process.env
|
|
5152
|
+
}
|
|
5153
|
+
});
|
|
5154
|
+
await fs12.cp(
|
|
5155
|
+
path12.join(project, `target/lambda/`, parsed.name, "bootstrap"),
|
|
5156
|
+
path12.join(input.out, "bootstrap")
|
|
5157
|
+
);
|
|
5158
|
+
} catch (ex) {
|
|
5159
|
+
throw new VisibleError("Failed to build");
|
|
5160
|
+
}
|
|
5161
|
+
}
|
|
5162
|
+
return {
|
|
5163
|
+
type: "success",
|
|
5164
|
+
handler: "handler"
|
|
5165
|
+
};
|
|
5166
|
+
}
|
|
5167
|
+
});
|
|
5168
|
+
});
|
|
5169
|
+
}
|
|
5170
|
+
});
|
|
5171
|
+
|
|
5051
5172
|
// src/runtime/handlers/python.ts
|
|
5052
5173
|
var python_exports = {};
|
|
5053
5174
|
__export(python_exports, {
|
|
5054
5175
|
usePythonHandler: () => usePythonHandler
|
|
5055
5176
|
});
|
|
5056
|
-
import
|
|
5057
|
-
import { exec as
|
|
5058
|
-
import { promisify as
|
|
5177
|
+
import path13 from "path";
|
|
5178
|
+
import { exec as exec5, spawn as spawn5 } from "child_process";
|
|
5179
|
+
import { promisify as promisify4 } from "util";
|
|
5059
5180
|
import { Runtime as Runtime2 } from "aws-cdk-lib/aws-lambda";
|
|
5060
|
-
import
|
|
5181
|
+
import fs13 from "fs/promises";
|
|
5061
5182
|
import os3 from "os";
|
|
5062
5183
|
import url6 from "url";
|
|
5063
|
-
var
|
|
5184
|
+
var execAsync4, RUNTIME_MAP, usePythonHandler;
|
|
5064
5185
|
var init_python = __esm({
|
|
5065
5186
|
"src/runtime/handlers/python.ts"() {
|
|
5066
5187
|
"use strict";
|
|
@@ -5069,7 +5190,7 @@ var init_python = __esm({
|
|
|
5069
5190
|
init_context();
|
|
5070
5191
|
init_server2();
|
|
5071
5192
|
init_fs();
|
|
5072
|
-
|
|
5193
|
+
execAsync4 = promisify4(exec5);
|
|
5073
5194
|
RUNTIME_MAP = {
|
|
5074
5195
|
"python2.7": Runtime2.PYTHON_2_7,
|
|
5075
5196
|
"python3.6": Runtime2.PYTHON_3_6,
|
|
@@ -5093,9 +5214,9 @@ var init_python = __esm({
|
|
|
5093
5214
|
canHandle: (input) => input.startsWith("python"),
|
|
5094
5215
|
startWorker: async (input) => {
|
|
5095
5216
|
const src = await findAbove(input.handler, "requirements.txt");
|
|
5096
|
-
const parsed =
|
|
5097
|
-
const target = [...parsed.dir.split(
|
|
5098
|
-
const proc =
|
|
5217
|
+
const parsed = path13.parse(path13.relative(src, input.handler));
|
|
5218
|
+
const target = [...parsed.dir.split(path13.sep), parsed.name].join(".");
|
|
5219
|
+
const proc = spawn5(
|
|
5099
5220
|
os3.platform() === "win32" ? "python.exe" : "python3",
|
|
5100
5221
|
[
|
|
5101
5222
|
"-u",
|
|
@@ -5141,18 +5262,18 @@ var init_python = __esm({
|
|
|
5141
5262
|
handler: input.props.handler
|
|
5142
5263
|
};
|
|
5143
5264
|
const src = await findAbove(input.props.handler, "requirements.txt");
|
|
5144
|
-
await
|
|
5265
|
+
await fs13.cp(src, input.out, {
|
|
5145
5266
|
recursive: true,
|
|
5146
5267
|
filter: (src2) => !src2.includes(".sst")
|
|
5147
5268
|
});
|
|
5148
5269
|
if (input.props.python?.installCommands) {
|
|
5149
5270
|
for (const cmd of input.props.python.installCommands) {
|
|
5150
|
-
await
|
|
5271
|
+
await execAsync4(cmd);
|
|
5151
5272
|
}
|
|
5152
5273
|
}
|
|
5153
5274
|
const result = {
|
|
5154
5275
|
type: "success",
|
|
5155
|
-
handler:
|
|
5276
|
+
handler: path13.relative(src, path13.resolve(input.props.handler))
|
|
5156
5277
|
};
|
|
5157
5278
|
return result;
|
|
5158
5279
|
}
|
|
@@ -5166,14 +5287,14 @@ var java_exports = {};
|
|
|
5166
5287
|
__export(java_exports, {
|
|
5167
5288
|
useJavaHandler: () => useJavaHandler
|
|
5168
5289
|
});
|
|
5169
|
-
import
|
|
5170
|
-
import
|
|
5290
|
+
import path14 from "path";
|
|
5291
|
+
import fs14 from "fs/promises";
|
|
5171
5292
|
import os4 from "os";
|
|
5172
5293
|
import zipLocal from "zip-local";
|
|
5173
|
-
import { spawn as
|
|
5294
|
+
import { spawn as spawn6 } from "child_process";
|
|
5174
5295
|
import url7 from "url";
|
|
5175
5296
|
async function getGradleBinary(srcPath) {
|
|
5176
|
-
const gradleWrapperPath =
|
|
5297
|
+
const gradleWrapperPath = path14.resolve(path14.join(srcPath, "gradlew"));
|
|
5177
5298
|
return await existsAsync(gradleWrapperPath) ? gradleWrapperPath : "gradle";
|
|
5178
5299
|
}
|
|
5179
5300
|
var useJavaHandler;
|
|
@@ -5205,7 +5326,7 @@ var init_java = __esm({
|
|
|
5205
5326
|
},
|
|
5206
5327
|
canHandle: (input) => input.startsWith("java"),
|
|
5207
5328
|
startWorker: async (input) => {
|
|
5208
|
-
const proc =
|
|
5329
|
+
const proc = spawn6(
|
|
5209
5330
|
`java`,
|
|
5210
5331
|
[
|
|
5211
5332
|
`-cp`,
|
|
@@ -5257,11 +5378,11 @@ var init_java = __esm({
|
|
|
5257
5378
|
cwd: srcPath
|
|
5258
5379
|
}
|
|
5259
5380
|
);
|
|
5260
|
-
const buildOutput =
|
|
5261
|
-
const zip = (await
|
|
5381
|
+
const buildOutput = path14.join(srcPath, "build", outputDir);
|
|
5382
|
+
const zip = (await fs14.readdir(buildOutput)).find(
|
|
5262
5383
|
(f) => f.endsWith(".zip")
|
|
5263
5384
|
);
|
|
5264
|
-
zipLocal.sync.unzip(
|
|
5385
|
+
zipLocal.sync.unzip(path14.join(buildOutput, zip)).save(input.out);
|
|
5265
5386
|
return {
|
|
5266
5387
|
type: "success",
|
|
5267
5388
|
handler: input.props.handler
|
|
@@ -5280,12 +5401,13 @@ var init_java = __esm({
|
|
|
5280
5401
|
|
|
5281
5402
|
// src/stacks/synth.ts
|
|
5282
5403
|
import * as contextproviders from "aws-cdk/lib/context-providers/index.js";
|
|
5283
|
-
import
|
|
5404
|
+
import path15 from "path";
|
|
5284
5405
|
async function synth(opts) {
|
|
5285
5406
|
Logger.debug("Synthesizing stacks...");
|
|
5286
5407
|
const { App: App2 } = await import("../src/constructs/App.js");
|
|
5287
5408
|
const { useNodeHandler: useNodeHandler2 } = await Promise.resolve().then(() => (init_node(), node_exports));
|
|
5288
5409
|
const { useGoHandler: useGoHandler2 } = await Promise.resolve().then(() => (init_go(), go_exports));
|
|
5410
|
+
const { useRustHandler: useRustHandler2 } = await Promise.resolve().then(() => (init_rust(), rust_exports));
|
|
5289
5411
|
const { usePythonHandler: usePythonHandler2 } = await Promise.resolve().then(() => (init_python(), python_exports));
|
|
5290
5412
|
const { useJavaHandler: useJavaHandler2 } = await Promise.resolve().then(() => (init_java(), java_exports));
|
|
5291
5413
|
useNodeHandler2();
|
|
@@ -5293,12 +5415,13 @@ async function synth(opts) {
|
|
|
5293
5415
|
usePythonHandler2();
|
|
5294
5416
|
useJavaHandler2();
|
|
5295
5417
|
useDotnetHandler();
|
|
5418
|
+
useRustHandler2();
|
|
5296
5419
|
const { Configuration } = await import("aws-cdk/lib/settings.js");
|
|
5297
5420
|
const project = useProject();
|
|
5298
5421
|
const identity = await useSTSIdentity();
|
|
5299
5422
|
opts = {
|
|
5300
5423
|
...opts,
|
|
5301
|
-
buildDir: opts.buildDir ||
|
|
5424
|
+
buildDir: opts.buildDir || path15.join(project.paths.out, "dist")
|
|
5302
5425
|
};
|
|
5303
5426
|
const cfg = new Configuration();
|
|
5304
5427
|
await cfg.load();
|
|
@@ -5672,16 +5795,16 @@ __export(pothos_exports, {
|
|
|
5672
5795
|
import babel from "@babel/core";
|
|
5673
5796
|
import generator from "@babel/generator";
|
|
5674
5797
|
import esbuild3 from "esbuild";
|
|
5675
|
-
import
|
|
5676
|
-
import
|
|
5798
|
+
import fs15 from "fs/promises";
|
|
5799
|
+
import path16 from "path";
|
|
5677
5800
|
import url8 from "url";
|
|
5678
5801
|
async function generate(opts) {
|
|
5679
5802
|
const { printSchema, lexicographicSortSchema } = await import("graphql");
|
|
5680
5803
|
const contents = await extractSchema(opts);
|
|
5681
|
-
const out =
|
|
5682
|
-
await
|
|
5804
|
+
const out = path16.join(path16.dirname(opts.schema), "out.mjs");
|
|
5805
|
+
await fs15.writeFile(out, contents, "utf8");
|
|
5683
5806
|
const { schema } = await import(url8.pathToFileURL(out).href + "?bust=" + Date.now());
|
|
5684
|
-
await
|
|
5807
|
+
await fs15.rm(out);
|
|
5685
5808
|
const schemaAsString = printSchema(lexicographicSortSchema(schema));
|
|
5686
5809
|
return schemaAsString;
|
|
5687
5810
|
}
|
|
@@ -5716,15 +5839,15 @@ async function extractSchema(opts) {
|
|
|
5716
5839
|
{
|
|
5717
5840
|
name: "pothos-extractor",
|
|
5718
5841
|
visitor: {
|
|
5719
|
-
Program(
|
|
5720
|
-
const dummyResolverId =
|
|
5842
|
+
Program(path19) {
|
|
5843
|
+
const dummyResolverId = path19.scope.generateUidIdentifier("DUMMY_RESOLVER");
|
|
5721
5844
|
const resolverNode = dummyResolver({
|
|
5722
5845
|
dummy_resolver: dummyResolverId
|
|
5723
5846
|
});
|
|
5724
|
-
|
|
5725
|
-
|
|
5847
|
+
path19.unshiftContainer("body", resolverNode);
|
|
5848
|
+
path19.scope.crawl();
|
|
5726
5849
|
let schemaBuilder = null;
|
|
5727
|
-
|
|
5850
|
+
path19.traverse({
|
|
5728
5851
|
ImportDeclaration(declarator) {
|
|
5729
5852
|
if (!declarator)
|
|
5730
5853
|
return;
|
|
@@ -5782,17 +5905,17 @@ async function extractSchema(opts) {
|
|
|
5782
5905
|
);
|
|
5783
5906
|
return contents.code;
|
|
5784
5907
|
}
|
|
5785
|
-
function getBindings(
|
|
5908
|
+
function getBindings(path19, globalPaths) {
|
|
5786
5909
|
const bindings = [];
|
|
5787
|
-
|
|
5910
|
+
path19.traverse({
|
|
5788
5911
|
Expression(expressionPath) {
|
|
5789
5912
|
if (!expressionPath.isIdentifier())
|
|
5790
5913
|
return;
|
|
5791
|
-
const binding =
|
|
5914
|
+
const binding = path19.scope.getBinding(expressionPath);
|
|
5792
5915
|
if (!binding || globalPaths.has(binding.path) || bindings.includes(binding.path))
|
|
5793
5916
|
return;
|
|
5794
5917
|
const rootBinding = findRootBinding(binding.path);
|
|
5795
|
-
if (
|
|
5918
|
+
if (path19 === rootBinding) {
|
|
5796
5919
|
bindings.push(binding.path);
|
|
5797
5920
|
return;
|
|
5798
5921
|
}
|
|
@@ -5805,8 +5928,8 @@ function getBindings(path18, globalPaths) {
|
|
|
5805
5928
|
}
|
|
5806
5929
|
return bindings;
|
|
5807
5930
|
}
|
|
5808
|
-
function findRootBinding(
|
|
5809
|
-
let rootPath =
|
|
5931
|
+
function findRootBinding(path19) {
|
|
5932
|
+
let rootPath = path19;
|
|
5810
5933
|
while (rootPath.parentPath?.node !== void 0 && !rootPath.parentPath?.isProgram()) {
|
|
5811
5934
|
rootPath = rootPath.parentPath;
|
|
5812
5935
|
}
|
|
@@ -5829,11 +5952,11 @@ var pothos_exports2 = {};
|
|
|
5829
5952
|
__export(pothos_exports2, {
|
|
5830
5953
|
usePothosBuilder: () => usePothosBuilder
|
|
5831
5954
|
});
|
|
5832
|
-
import
|
|
5833
|
-
import { exec as
|
|
5834
|
-
import { promisify as
|
|
5835
|
-
import
|
|
5836
|
-
var
|
|
5955
|
+
import fs16 from "fs/promises";
|
|
5956
|
+
import { exec as exec6 } from "child_process";
|
|
5957
|
+
import { promisify as promisify5 } from "util";
|
|
5958
|
+
import path17 from "path";
|
|
5959
|
+
var execAsync5, usePothosBuilder;
|
|
5837
5960
|
var init_pothos2 = __esm({
|
|
5838
5961
|
"src/cli/commands/plugins/pothos.ts"() {
|
|
5839
5962
|
"use strict";
|
|
@@ -5841,7 +5964,7 @@ var init_pothos2 = __esm({
|
|
|
5841
5964
|
init_context();
|
|
5842
5965
|
init_pothos();
|
|
5843
5966
|
init_colors();
|
|
5844
|
-
|
|
5967
|
+
execAsync5 = promisify5(exec6);
|
|
5845
5968
|
usePothosBuilder = Context.memo(() => {
|
|
5846
5969
|
let routes = [];
|
|
5847
5970
|
const bus = useBus();
|
|
@@ -5850,9 +5973,9 @@ var init_pothos2 = __esm({
|
|
|
5850
5973
|
const schema = await pothos_exports.generate({
|
|
5851
5974
|
schema: route.schema
|
|
5852
5975
|
});
|
|
5853
|
-
await
|
|
5976
|
+
await fs16.writeFile(route.output, schema);
|
|
5854
5977
|
if (Array.isArray(route.commands) && route.commands.length > 0) {
|
|
5855
|
-
await Promise.all(route.commands.map((cmd) =>
|
|
5978
|
+
await Promise.all(route.commands.map((cmd) => execAsync5(cmd)));
|
|
5856
5979
|
}
|
|
5857
5980
|
Colors.line(Colors.success(`\u2714`), " Pothos: Extracted pothos schema");
|
|
5858
5981
|
} catch (ex) {
|
|
@@ -5866,9 +5989,9 @@ var init_pothos2 = __esm({
|
|
|
5866
5989
|
if (evt.properties.file.endsWith("out.mjs"))
|
|
5867
5990
|
return;
|
|
5868
5991
|
for (const route of routes) {
|
|
5869
|
-
const dir =
|
|
5870
|
-
const relative =
|
|
5871
|
-
if (relative && !relative.startsWith("..") && !
|
|
5992
|
+
const dir = path17.dirname(route.schema);
|
|
5993
|
+
const relative = path17.relative(dir, evt.properties.file);
|
|
5994
|
+
if (relative && !relative.startsWith("..") && !path17.isAbsolute(relative))
|
|
5872
5995
|
build2(route);
|
|
5873
5996
|
}
|
|
5874
5997
|
});
|
|
@@ -5894,7 +6017,7 @@ __export(kysely_exports, {
|
|
|
5894
6017
|
import { Kysely } from "kysely";
|
|
5895
6018
|
import { DataApiDialect } from "kysely-data-api";
|
|
5896
6019
|
import RDSDataService from "aws-sdk/clients/rdsdataservice.js";
|
|
5897
|
-
import * as
|
|
6020
|
+
import * as fs17 from "fs/promises";
|
|
5898
6021
|
import {
|
|
5899
6022
|
DatabaseMetadata,
|
|
5900
6023
|
EnumCollection,
|
|
@@ -5970,7 +6093,7 @@ var init_kysely = __esm({
|
|
|
5970
6093
|
};
|
|
5971
6094
|
const serializer = new Serializer();
|
|
5972
6095
|
const data2 = serializer.serialize(nodes);
|
|
5973
|
-
await
|
|
6096
|
+
await fs17.writeFile(db.types.path, data2);
|
|
5974
6097
|
}
|
|
5975
6098
|
bus.subscribe("stacks.metadata", (evt) => {
|
|
5976
6099
|
const constructs = Object.values(evt.properties).flat();
|
|
@@ -6329,14 +6452,14 @@ var env = (program2) => program2.command(
|
|
|
6329
6452
|
),
|
|
6330
6453
|
async (args) => {
|
|
6331
6454
|
const { createSpinner: createSpinner2 } = await Promise.resolve().then(() => (init_spinner(), spinner_exports));
|
|
6332
|
-
const
|
|
6455
|
+
const fs19 = await import("fs/promises");
|
|
6333
6456
|
const { SiteEnv } = await Promise.resolve().then(() => (init_site_env(), site_env_exports));
|
|
6334
6457
|
const { spawnSync } = await import("child_process");
|
|
6335
6458
|
const { useAWSCredentials: useAWSCredentials2 } = await Promise.resolve().then(() => (init_credentials(), credentials_exports));
|
|
6336
6459
|
const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
|
|
6337
6460
|
let spinner;
|
|
6338
6461
|
while (true) {
|
|
6339
|
-
const exists = await
|
|
6462
|
+
const exists = await fs19.access(SiteEnv.valuesFile()).then(() => true).catch(() => false);
|
|
6340
6463
|
if (!exists) {
|
|
6341
6464
|
spinner = createSpinner2(
|
|
6342
6465
|
"Cannot find SST environment variables. Waiting for SST to start..."
|
|
@@ -6398,8 +6521,8 @@ var dev = (program2) => program2.command(
|
|
|
6398
6521
|
const { Context: Context2 } = await Promise.resolve().then(() => (init_context(), context_exports));
|
|
6399
6522
|
const { printDeploymentResults: printDeploymentResults2, DeploymentUI: DeploymentUI2 } = await Promise.resolve().then(() => (init_deploy2(), deploy_exports));
|
|
6400
6523
|
const { useLocalServer: useLocalServer2 } = await Promise.resolve().then(() => (init_server(), server_exports));
|
|
6401
|
-
const
|
|
6402
|
-
const
|
|
6524
|
+
const path19 = await import("path");
|
|
6525
|
+
const fs19 = await import("fs/promises");
|
|
6403
6526
|
const crypto2 = await import("crypto");
|
|
6404
6527
|
const { useFunctions: useFunctions3 } = await import("../src/constructs/Function.js");
|
|
6405
6528
|
const { SiteEnv } = await Promise.resolve().then(() => (init_site_env(), site_env_exports));
|
|
@@ -6588,8 +6711,8 @@ var dev = (program2) => program2.command(
|
|
|
6588
6711
|
}
|
|
6589
6712
|
await SiteEnv.writeValues(result);
|
|
6590
6713
|
}
|
|
6591
|
-
|
|
6592
|
-
|
|
6714
|
+
fs19.writeFile(
|
|
6715
|
+
path19.join(project.paths.out, "outputs.json"),
|
|
6593
6716
|
JSON.stringify(
|
|
6594
6717
|
pipe2(
|
|
6595
6718
|
results,
|
|
@@ -6605,17 +6728,17 @@ var dev = (program2) => program2.command(
|
|
|
6605
6728
|
build2();
|
|
6606
6729
|
}
|
|
6607
6730
|
async function checksum(cdkOutPath) {
|
|
6608
|
-
const manifestPath =
|
|
6731
|
+
const manifestPath = path19.join(cdkOutPath, "manifest.json");
|
|
6609
6732
|
const cdkManifest = JSON.parse(
|
|
6610
|
-
await
|
|
6733
|
+
await fs19.readFile(manifestPath).then((x) => x.toString())
|
|
6611
6734
|
);
|
|
6612
6735
|
const checksumData = await Promise.all(
|
|
6613
6736
|
Object.keys(cdkManifest.artifacts).filter(
|
|
6614
6737
|
(key) => cdkManifest.artifacts[key].type === "aws:cloudformation:stack"
|
|
6615
6738
|
).map(async (key) => {
|
|
6616
6739
|
const { templateFile } = cdkManifest.artifacts[key].properties;
|
|
6617
|
-
const templatePath =
|
|
6618
|
-
const templateContent = await
|
|
6740
|
+
const templatePath = path19.join(cdkOutPath, templateFile);
|
|
6741
|
+
const templateContent = await fs19.readFile(templatePath);
|
|
6619
6742
|
return templateContent;
|
|
6620
6743
|
})
|
|
6621
6744
|
).then((x) => x.join("\n"));
|
|
@@ -6725,7 +6848,7 @@ var build = (program2) => program2.command(
|
|
|
6725
6848
|
const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
|
|
6726
6849
|
const { Stacks } = await Promise.resolve().then(() => (init_stacks(), stacks_exports));
|
|
6727
6850
|
const { Colors: Colors2 } = await Promise.resolve().then(() => (init_colors(), colors_exports));
|
|
6728
|
-
const
|
|
6851
|
+
const path19 = await import("path");
|
|
6729
6852
|
const result = await Stacks.synth({
|
|
6730
6853
|
fn: useProject2().stacks,
|
|
6731
6854
|
buildDir: args.to,
|
|
@@ -6735,7 +6858,7 @@ var build = (program2) => program2.command(
|
|
|
6735
6858
|
Colors2.line(
|
|
6736
6859
|
Colors2.success(`\u2714`),
|
|
6737
6860
|
Colors2.bold(" Built:"),
|
|
6738
|
-
`${result.stacks.length} stack${result.stacks.length > 1 ? "s" : ""} to ${
|
|
6861
|
+
`${result.stacks.length} stack${result.stacks.length > 1 ? "s" : ""} to ${path19.relative(process.cwd(), result.directory)}`
|
|
6739
6862
|
);
|
|
6740
6863
|
process.exit(0);
|
|
6741
6864
|
}
|
|
@@ -6744,8 +6867,8 @@ var build = (program2) => program2.command(
|
|
|
6744
6867
|
// src/cli/commands/deploy.tsx
|
|
6745
6868
|
init_credentials();
|
|
6746
6869
|
init_colors();
|
|
6747
|
-
import
|
|
6748
|
-
import
|
|
6870
|
+
import fs18 from "fs/promises";
|
|
6871
|
+
import path18 from "path";
|
|
6749
6872
|
var deploy2 = (program2) => program2.command(
|
|
6750
6873
|
"deploy [filter]",
|
|
6751
6874
|
"Deploy your app to AWS",
|
|
@@ -6814,8 +6937,8 @@ var deploy2 = (program2) => program2.command(
|
|
|
6814
6937
|
printDeploymentResults2(assembly, results);
|
|
6815
6938
|
if (Object.values(results).some((stack) => Stacks.isFailed(stack.status)))
|
|
6816
6939
|
process.exit(1);
|
|
6817
|
-
|
|
6818
|
-
|
|
6940
|
+
fs18.writeFile(
|
|
6941
|
+
path18.join(project.paths.out, "outputs.json"),
|
|
6819
6942
|
JSON.stringify(
|
|
6820
6943
|
mapValues2(results, (val) => val.outputs),
|
|
6821
6944
|
null,
|
|
@@ -7099,22 +7222,22 @@ var update = (program2) => program2.command(
|
|
|
7099
7222
|
}),
|
|
7100
7223
|
async (args) => {
|
|
7101
7224
|
const { green, yellow } = await import("colorette");
|
|
7102
|
-
const
|
|
7103
|
-
const
|
|
7225
|
+
const fs19 = await import("fs/promises");
|
|
7226
|
+
const path19 = await import("path");
|
|
7104
7227
|
const { fetch } = await import("undici");
|
|
7105
7228
|
const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
|
|
7106
7229
|
const { Colors: Colors2 } = await Promise.resolve().then(() => (init_colors(), colors_exports));
|
|
7107
7230
|
async function find2(dir) {
|
|
7108
|
-
const children = await
|
|
7231
|
+
const children = await fs19.readdir(dir);
|
|
7109
7232
|
const tasks2 = children.map(async (item) => {
|
|
7110
7233
|
if (item === "node_modules")
|
|
7111
7234
|
return [];
|
|
7112
7235
|
if (/(^|\/)\.[^\/\.]/g.test(item))
|
|
7113
7236
|
return [];
|
|
7114
|
-
const full =
|
|
7237
|
+
const full = path19.join(dir, item);
|
|
7115
7238
|
if (item === "package.json")
|
|
7116
7239
|
return [full];
|
|
7117
|
-
const stat = await
|
|
7240
|
+
const stat = await fs19.stat(full);
|
|
7118
7241
|
if (stat.isDirectory())
|
|
7119
7242
|
return find2(full);
|
|
7120
7243
|
return [];
|
|
@@ -7128,7 +7251,7 @@ var update = (program2) => program2.command(
|
|
|
7128
7251
|
).then((resp) => resp.json());
|
|
7129
7252
|
const results = /* @__PURE__ */ new Map();
|
|
7130
7253
|
const tasks = files.map(async (file) => {
|
|
7131
|
-
const data2 = await
|
|
7254
|
+
const data2 = await fs19.readFile(file).then((x) => x.toString()).then(JSON.parse);
|
|
7132
7255
|
for (const field of FIELDS) {
|
|
7133
7256
|
const deps = data2[field];
|
|
7134
7257
|
if (!deps)
|
|
@@ -7156,7 +7279,7 @@ var update = (program2) => program2.command(
|
|
|
7156
7279
|
deps[pkg] = desired;
|
|
7157
7280
|
}
|
|
7158
7281
|
}
|
|
7159
|
-
await
|
|
7282
|
+
await fs19.writeFile(file, JSON.stringify(data2, null, 2));
|
|
7160
7283
|
});
|
|
7161
7284
|
await Promise.all(tasks);
|
|
7162
7285
|
if (results.size === 0) {
|
|
@@ -7166,7 +7289,7 @@ var update = (program2) => program2.command(
|
|
|
7166
7289
|
for (const [file, pkgs] of results.entries()) {
|
|
7167
7290
|
Colors2.line(
|
|
7168
7291
|
Colors2.success(`\u2714 `),
|
|
7169
|
-
Colors2.bold.dim(
|
|
7292
|
+
Colors2.bold.dim(path19.relative(project.paths.root, file))
|
|
7170
7293
|
);
|
|
7171
7294
|
for (const [pkg, version2] of pkgs) {
|
|
7172
7295
|
Colors2.line(Colors2.dim(` ${pkg}@${version2}`));
|
package/stacks/deploy.js
CHANGED
|
@@ -2,6 +2,7 @@ import { useBus } from "../bus.js";
|
|
|
2
2
|
import { useAWSClient, useAWSProvider } from "../credentials.js";
|
|
3
3
|
import { Logger } from "../logger.js";
|
|
4
4
|
import { filterOutputs, isFailed, monitor, } from "./monitor.js";
|
|
5
|
+
import { VisibleError } from "../error.js";
|
|
5
6
|
export async function publishAssets(stacks) {
|
|
6
7
|
Logger.debug("Publishing assets");
|
|
7
8
|
const provider = await useAWSProvider();
|
|
@@ -20,6 +21,9 @@ export async function publishAssets(stacks) {
|
|
|
20
21
|
return results;
|
|
21
22
|
}
|
|
22
23
|
export async function deployMany(stacks) {
|
|
24
|
+
if (stacks.length === 0) {
|
|
25
|
+
throw new VisibleError("No stacks to deploy");
|
|
26
|
+
}
|
|
23
27
|
Logger.debug("Deploying stacks", stacks.map((s) => s.stackName));
|
|
24
28
|
const { CloudFormationStackArtifact } = await import("aws-cdk-lib/cx-api");
|
|
25
29
|
await useAWSProvider();
|
package/stacks/synth.js
CHANGED
|
@@ -10,6 +10,7 @@ export async function synth(opts) {
|
|
|
10
10
|
const { App } = await import("../constructs/App.js");
|
|
11
11
|
const { useNodeHandler } = await import("../runtime/handlers/node.js");
|
|
12
12
|
const { useGoHandler } = await import("../runtime/handlers/go.js");
|
|
13
|
+
const { useRustHandler } = await import("../runtime/handlers/rust.js");
|
|
13
14
|
const { usePythonHandler } = await import("../runtime/handlers/python.js");
|
|
14
15
|
const { useJavaHandler } = await import("../runtime/handlers/java.js");
|
|
15
16
|
useNodeHandler();
|
|
@@ -17,6 +18,7 @@ export async function synth(opts) {
|
|
|
17
18
|
usePythonHandler();
|
|
18
19
|
useJavaHandler();
|
|
19
20
|
useDotnetHandler();
|
|
21
|
+
useRustHandler();
|
|
20
22
|
const { Configuration } = await import("aws-cdk/lib/settings.js");
|
|
21
23
|
const project = useProject();
|
|
22
24
|
const identity = await useSTSIdentity();
|