sst 2.0.37 → 2.0.39
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/cli/commands/plugins/kysely.js +1 -1
- package/credentials.d.ts +2 -2
- package/package.json +21 -21
- package/runtime/handlers/python.js +33 -20
- package/{constructs/util/python/bundling.d.ts → runtime/handlers/pythonBundling.d.ts} +7 -5
- package/{constructs/util/python/bundling.js → runtime/handlers/pythonBundling.js} +20 -15
- package/sst.mjs +301 -138
- package/support/base-site-archiver.mjs +16 -16
- package/support/bootstrap-metadata-function/index.mjs +7490 -16374
- package/support/bridge/bridge.mjs +35 -35
- package/support/custom-resources/index.mjs +66101 -60805
- package/support/job-invoker/index.mjs +2903 -1929
- package/support/python-runtime/Dockerfile +9 -0
- package/support/python-runtime/Dockerfile.custom +21 -0
- package/support/python-runtime/Dockerfile.dependencies +26 -0
- package/support/rds-migrator/index.mjs +19 -17
- package/support/script-function/index.mjs +6990 -4697
- package/support/ssr-site-function-archiver.mjs +15 -15
|
@@ -85,7 +85,7 @@ export const useKyselyTypeGenerator = Context.memo(async () => {
|
|
|
85
85
|
defaultDatabaseName: c.data.defaultDatabaseName,
|
|
86
86
|
secretArn: c.data.secretArn,
|
|
87
87
|
}));
|
|
88
|
-
databases.map((db) => generate(db));
|
|
88
|
+
databases.map((db) => generate(db).catch());
|
|
89
89
|
});
|
|
90
90
|
bus.subscribe("function.success", async (evt) => {
|
|
91
91
|
if (!evt.properties.body?.results)
|
package/credentials.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import { RetryInputConfig } from "@aws-sdk/middleware-retry";
|
|
|
5
5
|
import { AwsAuthInputConfig } from "@aws-sdk/middleware-signing";
|
|
6
6
|
import { SdkProvider } from "aws-cdk/lib/api/aws-auth/sdk-provider.js";
|
|
7
7
|
type Config = RegionInputConfig & RetryInputConfig & AwsAuthInputConfig & HostHeaderConditionConfig;
|
|
8
|
-
export declare const useAWSCredentialsProvider: () => import("@aws-sdk/types").
|
|
9
|
-
export declare const useAWSCredentials: () => Promise<import("@aws-sdk/types").
|
|
8
|
+
export declare const useAWSCredentialsProvider: () => import("@aws-sdk/types").AwsCredentialIdentityProvider;
|
|
9
|
+
export declare const useAWSCredentials: () => Promise<import("@aws-sdk/types").AwsCredentialIdentity>;
|
|
10
10
|
export declare const useSTSIdentity: () => Promise<import("@aws-sdk/client-sts").GetCallerIdentityCommandOutput>;
|
|
11
11
|
export declare function useAWSClient<C extends Client<any, any, any, any>>(client: new (config: Config) => C, force?: boolean): C;
|
|
12
12
|
import { HostHeaderConditionConfig } from "aws-sdk/clients/elbv2.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sst",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.39",
|
|
4
4
|
"bin": {
|
|
5
5
|
"sst": "cli/sst.js"
|
|
6
6
|
},
|
|
@@ -29,23 +29,23 @@
|
|
|
29
29
|
"@aws-cdk/cloudformation-diff": "2.62.2",
|
|
30
30
|
"@aws-cdk/cx-api": "2.62.2",
|
|
31
31
|
"@aws-cdk/region-info": "2.62.2",
|
|
32
|
-
"@aws-sdk/client-api-gateway": "3.208.0",
|
|
33
|
-
"@aws-sdk/client-cloudformation": "3.
|
|
34
|
-
"@aws-sdk/client-cloudfront": "3.
|
|
35
|
-
"@aws-sdk/client-iam": "3.
|
|
36
|
-
"@aws-sdk/client-iot": "3.
|
|
37
|
-
"@aws-sdk/client-iot-data-plane": "3.
|
|
38
|
-
"@aws-sdk/client-lambda": "3.
|
|
39
|
-
"@aws-sdk/client-rds-data": "3.
|
|
40
|
-
"@aws-sdk/client-s3": "3.
|
|
41
|
-
"@aws-sdk/client-ssm": "3.
|
|
42
|
-
"@aws-sdk/client-sts": "3.
|
|
43
|
-
"@aws-sdk/config-resolver": "3.
|
|
44
|
-
"@aws-sdk/credential-providers": "3.
|
|
45
|
-
"@aws-sdk/middleware-retry": "3.
|
|
46
|
-
"@aws-sdk/middleware-signing": "3.
|
|
47
|
-
"@aws-sdk/signature-v4-crt": "^3.
|
|
48
|
-
"@aws-sdk/smithy-client": "3.
|
|
32
|
+
"@aws-sdk/client-api-gateway": "^3.208.0",
|
|
33
|
+
"@aws-sdk/client-cloudformation": "^3.279.0",
|
|
34
|
+
"@aws-sdk/client-cloudfront": "^3.279.0",
|
|
35
|
+
"@aws-sdk/client-iam": "^3.279.0",
|
|
36
|
+
"@aws-sdk/client-iot": "^3.279.0",
|
|
37
|
+
"@aws-sdk/client-iot-data-plane": "^3.279.0",
|
|
38
|
+
"@aws-sdk/client-lambda": "^3.279.0",
|
|
39
|
+
"@aws-sdk/client-rds-data": "^3.279.0",
|
|
40
|
+
"@aws-sdk/client-s3": "^3.279.0",
|
|
41
|
+
"@aws-sdk/client-ssm": "^3.279.0",
|
|
42
|
+
"@aws-sdk/client-sts": "^3.279.0",
|
|
43
|
+
"@aws-sdk/config-resolver": "^3.272.0",
|
|
44
|
+
"@aws-sdk/credential-providers": "^3.279.0",
|
|
45
|
+
"@aws-sdk/middleware-retry": "^3.272.0",
|
|
46
|
+
"@aws-sdk/middleware-signing": "^3.272.0",
|
|
47
|
+
"@aws-sdk/signature-v4-crt": "^3.272.0",
|
|
48
|
+
"@aws-sdk/smithy-client": "^3.279.0",
|
|
49
49
|
"@babel/core": "^7.0.0-0",
|
|
50
50
|
"@babel/generator": "^7.20.5",
|
|
51
51
|
"@trpc/server": "9.16.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"aws-cdk": "2.62.2",
|
|
55
55
|
"aws-cdk-lib": "2.62.2",
|
|
56
56
|
"aws-iot-device-sdk": "^2.2.12",
|
|
57
|
-
"aws-sdk": "2.
|
|
57
|
+
"aws-sdk": "^2.1323.0",
|
|
58
58
|
"builtin-modules": "3.2.0",
|
|
59
59
|
"cdk-assets": "2.62.2",
|
|
60
60
|
"chalk": "^4.1.2",
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
"zip-local": "^0.3.5"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
|
-
"@aws-sdk/client-codebuild": "^3.
|
|
97
|
-
"@aws-sdk/types": "^3.
|
|
96
|
+
"@aws-sdk/client-codebuild": "^3.279.0",
|
|
97
|
+
"@aws-sdk/types": "^3.272.0",
|
|
98
98
|
"@graphql-tools/merge": "^8.3.16",
|
|
99
99
|
"@sls-next/lambda-at-edge": "^3.7.0",
|
|
100
100
|
"@tsconfig/node16": "^1.0.3",
|
|
@@ -5,9 +5,9 @@ import { Context } from "../../context/context.js";
|
|
|
5
5
|
import { exec, spawn } from "child_process";
|
|
6
6
|
import { promisify } from "util";
|
|
7
7
|
import { useRuntimeServerConfig } from "../server.js";
|
|
8
|
-
import {
|
|
8
|
+
import { findAbove, isChild } from "../../util/fs.js";
|
|
9
9
|
import { Runtime } from "aws-cdk-lib/aws-lambda";
|
|
10
|
-
import
|
|
10
|
+
import { bundle } from "./pythonBundling.js";
|
|
11
11
|
const execAsync = promisify(exec);
|
|
12
12
|
import os from "os";
|
|
13
13
|
import url from "url";
|
|
@@ -91,37 +91,50 @@ export const usePythonHandler = Context.memo(async () => {
|
|
|
91
91
|
type: "error",
|
|
92
92
|
errors: [`Could not find src for ${input.props.handler}`],
|
|
93
93
|
};
|
|
94
|
+
bundle({
|
|
95
|
+
installCommands: input.props.python?.installCommands,
|
|
96
|
+
entry: src,
|
|
97
|
+
runtime: RUNTIME_MAP[input.props.runtime],
|
|
98
|
+
outputPathSuffix: ".",
|
|
99
|
+
out: input.out,
|
|
100
|
+
});
|
|
101
|
+
/*
|
|
94
102
|
await fs.cp(src, input.out, {
|
|
95
|
-
|
|
96
|
-
|
|
103
|
+
recursive: true,
|
|
104
|
+
filter: (src) => !src.includes(".sst"),
|
|
97
105
|
});
|
|
106
|
+
|
|
98
107
|
if (await existsAsync(path.join(src, "Pipfile"))) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
108
|
+
await execAsync("pipenv requirements > requirements.txt", {
|
|
109
|
+
cwd: input.out,
|
|
110
|
+
});
|
|
102
111
|
}
|
|
103
112
|
if (await existsAsync(path.join(src, "poetry.lock"))) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
113
|
+
await execAsync(
|
|
114
|
+
"poetry export --with-credentials --format requirements.txt --output requirements.txt",
|
|
115
|
+
{
|
|
116
|
+
cwd: input.out,
|
|
117
|
+
}
|
|
118
|
+
);
|
|
107
119
|
}
|
|
108
120
|
if (await existsAsync(path.join(src, "requirements.txt"))) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
121
|
+
await execAsync("pip install -r requirements.txt", {
|
|
122
|
+
cwd: input.out,
|
|
123
|
+
});
|
|
112
124
|
}
|
|
125
|
+
|
|
113
126
|
if (input.props.python?.installCommands) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
127
|
+
for (const cmd of input.props.python.installCommands) {
|
|
128
|
+
await execAsync(cmd, {
|
|
129
|
+
cwd: input.out,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
119
132
|
}
|
|
120
|
-
|
|
133
|
+
*/
|
|
134
|
+
return {
|
|
121
135
|
type: "success",
|
|
122
136
|
handler: path.relative(src, path.resolve(input.props.handler)),
|
|
123
137
|
};
|
|
124
|
-
return result;
|
|
125
138
|
},
|
|
126
139
|
});
|
|
127
140
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Runtime } from "aws-cdk-lib/aws-lambda";
|
|
2
|
+
import { AssetHashType } from "aws-cdk-lib";
|
|
3
3
|
/**
|
|
4
4
|
* Dependency files to exclude from the asset hash.
|
|
5
5
|
*/
|
|
@@ -19,7 +19,7 @@ export interface BundlingOptions {
|
|
|
19
19
|
/**
|
|
20
20
|
* The runtime of the lambda function
|
|
21
21
|
*/
|
|
22
|
-
readonly runtime:
|
|
22
|
+
readonly runtime: Runtime;
|
|
23
23
|
/**
|
|
24
24
|
* Output path suffix ('python' for a layer, '.' otherwise)
|
|
25
25
|
*/
|
|
@@ -46,7 +46,7 @@ export interface BundlingOptions {
|
|
|
46
46
|
* default is `CUSTOM`. This means that only updates to the source will cause
|
|
47
47
|
* the asset to rebuild.
|
|
48
48
|
*/
|
|
49
|
-
readonly assetHashType?:
|
|
49
|
+
readonly assetHashType?: AssetHashType;
|
|
50
50
|
/**
|
|
51
51
|
* Specify a custom hash for this asset. If `assetHashType` is set it must
|
|
52
52
|
* be set to `AssetHashType.CUSTOM`. For consistency, this custom hash will
|
|
@@ -67,7 +67,9 @@ export interface BundlingOptions {
|
|
|
67
67
|
/**
|
|
68
68
|
* Produce bundled Lambda asset code
|
|
69
69
|
*/
|
|
70
|
-
export declare function bundle(options: BundlingOptions
|
|
70
|
+
export declare function bundle(options: BundlingOptions & {
|
|
71
|
+
out: string;
|
|
72
|
+
}): void;
|
|
71
73
|
/**
|
|
72
74
|
* Checks to see if the `entry` directory contains a type of dependency that
|
|
73
75
|
* we know how to install.
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import url from "url";
|
|
6
6
|
import path from "path";
|
|
7
|
-
import
|
|
8
|
-
import * as lambda from "aws-cdk-lib/aws-lambda";
|
|
7
|
+
import { AssetStaging, DockerImage, FileSystem, } from "aws-cdk-lib";
|
|
9
8
|
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
10
9
|
/**
|
|
11
10
|
* Dependency files to exclude from the asset hash.
|
|
@@ -20,15 +19,16 @@ export const BUNDLER_DEPENDENCIES_CACHE = "/var/dependencies";
|
|
|
20
19
|
*/
|
|
21
20
|
export function bundle(options) {
|
|
22
21
|
const { entry, runtime, outputPathSuffix, installCommands } = options;
|
|
23
|
-
const stagedir =
|
|
22
|
+
const stagedir = FileSystem.mkdtemp("python-bundling-");
|
|
24
23
|
const hasDeps = stageDependencies(entry, stagedir);
|
|
25
24
|
const hasInstallCommands = stageInstallCommands(installCommands || [], stagedir);
|
|
26
25
|
const depsCommand = chain([
|
|
27
26
|
hasDeps || hasInstallCommands
|
|
28
|
-
? `rsync -r ${BUNDLER_DEPENDENCIES_CACHE}/. ${
|
|
27
|
+
? `rsync -r ${BUNDLER_DEPENDENCIES_CACHE}/. ${AssetStaging.BUNDLING_OUTPUT_DIR}/${outputPathSuffix}`
|
|
29
28
|
: "",
|
|
30
|
-
`rsync -r . ${
|
|
29
|
+
`rsync -r . ${AssetStaging.BUNDLING_OUTPUT_DIR}/${outputPathSuffix}`,
|
|
31
30
|
]);
|
|
31
|
+
console.log("Commands", depsCommand);
|
|
32
32
|
// Determine which dockerfile to use. When dependencies are present, we use a
|
|
33
33
|
// Dockerfile that can create a cacheable layer. We can't use this Dockerfile
|
|
34
34
|
// if there aren't dependencies or the Dockerfile will complain about missing
|
|
@@ -39,21 +39,26 @@ export function bundle(options) {
|
|
|
39
39
|
? "Dockerfile.dependencies"
|
|
40
40
|
: "Dockerfile";
|
|
41
41
|
// copy Dockerfile to workdir
|
|
42
|
-
fs.copyFileSync(path.join(__dirname, "
|
|
43
|
-
const image =
|
|
42
|
+
fs.copyFileSync(path.join(__dirname, "../../support/python-runtime", dockerfile), path.join(stagedir, dockerfile));
|
|
43
|
+
const image = DockerImage.fromBuild(stagedir, {
|
|
44
44
|
buildArgs: {
|
|
45
45
|
IMAGE: runtime.bundlingImage.image,
|
|
46
46
|
},
|
|
47
47
|
file: dockerfile,
|
|
48
48
|
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
image.run({
|
|
50
|
+
command: ["bash", "-c", depsCommand],
|
|
51
|
+
workingDirectory: AssetStaging.BUNDLING_INPUT_DIR,
|
|
52
|
+
volumes: [
|
|
53
|
+
{
|
|
54
|
+
hostPath: entry,
|
|
55
|
+
containerPath: AssetStaging.BUNDLING_INPUT_DIR,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
hostPath: options.out,
|
|
59
|
+
containerPath: AssetStaging.BUNDLING_OUTPUT_DIR,
|
|
60
|
+
},
|
|
61
|
+
],
|
|
57
62
|
});
|
|
58
63
|
}
|
|
59
64
|
/**
|