@awsless/cli 0.0.46-local.11 → 0.0.46-local.13
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/dist/bin.js +128 -140
- package/dist/handlers/bundle.js +1 -1
- package/package.json +15 -15
package/dist/bin.js
CHANGED
|
@@ -150257,16 +150257,6 @@ var bootstrapAwsless = async (props) => {
|
|
|
150257
150257
|
// src/config/load/load.ts
|
|
150258
150258
|
import { basename as basename2, dirname as dirname5, join as join13 } from "path";
|
|
150259
150259
|
|
|
150260
|
-
// src/feature/config/schema.ts
|
|
150261
|
-
var ConfigNameSchema = exports_external.string().regex(/^[a-z0-9-]+$/, "Invalid config name");
|
|
150262
|
-
var ConfigsSchema = exports_external.array(ConfigNameSchema).optional().describe("Define the config values for your app.");
|
|
150263
|
-
var ConfigFileSchema = exports_external.record(ConfigNameSchema, exports_external.union([
|
|
150264
|
-
exports_external.string().describe("A committed default value for the local dev environment."),
|
|
150265
|
-
exports_external.object({
|
|
150266
|
-
secret: exports_external.literal(true).describe("Pulled from ssm into memory on local dev boot, never stored locally.")
|
|
150267
|
-
}).describe("A secret config value.")
|
|
150268
|
-
])).describe("The config values of your app.");
|
|
150269
|
-
|
|
150270
150260
|
// src/config/schema/config-ref.ts
|
|
150271
150261
|
var ConfigRefSchema = exports_external.string().regex(/^config:[a-z0-9-]+$/, "Invalid config reference");
|
|
150272
150262
|
var isConfigRef = (value) => {
|
|
@@ -150335,6 +150325,10 @@ var AuthDefaultSchema = exports_external.record(ResourceIdSchema, exports_extern
|
|
|
150335
150325
|
}).default({}).describe("Specifies the validity duration for every JWT token.")
|
|
150336
150326
|
})).default({}).describe("Define the authenticatable users in your app.");
|
|
150337
150327
|
|
|
150328
|
+
// src/feature/config/schema.ts
|
|
150329
|
+
var ConfigNameSchema = exports_external.string().regex(/^[a-z0-9-]+$/, "Invalid config name");
|
|
150330
|
+
var ConfigsSchema = exports_external.array(ConfigNameSchema).optional().describe("Define the config values for your app.");
|
|
150331
|
+
|
|
150338
150332
|
// src/feature/domain/schema.ts
|
|
150339
150333
|
var DomainNameSchema = exports_external.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe("Enter a fully qualified domain name, for example, www.example.com. You can optionally include a trailing dot. If you omit the trailing dot, Amazon Route 53 assumes that the domain name that you specify is fully qualified. This means that Route 53 treats www.example.com (without a trailing dot) and www.example.com. (with a trailing dot) as identical.");
|
|
150340
150334
|
var DNSTypeSchema = exports_external.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
|
|
@@ -152488,32 +152482,8 @@ var loadAppConfig = async (options) => {
|
|
|
152488
152482
|
debug("Validate app config file");
|
|
152489
152483
|
const app = await validateConfig(AppSchema, appConfig.file, appConfig.data);
|
|
152490
152484
|
app.stage = options.stage;
|
|
152491
|
-
await loadConfigFile(app, root3, options.stage);
|
|
152492
152485
|
return app;
|
|
152493
152486
|
};
|
|
152494
|
-
var loadConfigFile = async (app, root3, stage) => {
|
|
152495
|
-
const ext2 = ["config.json", "config.jsonc", "config.json5"];
|
|
152496
|
-
const files = await glob(ext2, { cwd: root3 });
|
|
152497
|
-
const file2 = ext2.find((name) => files.includes(name));
|
|
152498
|
-
if (!file2) {
|
|
152499
|
-
return;
|
|
152500
|
-
}
|
|
152501
|
-
debug("Load config file:", color2.info(file2));
|
|
152502
|
-
const config = await readConfigWithStage(join13(root3, file2), stage);
|
|
152503
|
-
const entries2 = await validateConfig(ConfigFileSchema, config.file, config.data);
|
|
152504
|
-
const defaults2 = {};
|
|
152505
|
-
const secrets = [];
|
|
152506
|
-
for (const [name, value] of Object.entries(entries2)) {
|
|
152507
|
-
if (typeof value === "string") {
|
|
152508
|
-
defaults2[name] = value;
|
|
152509
|
-
} else {
|
|
152510
|
-
secrets.push(name);
|
|
152511
|
-
}
|
|
152512
|
-
}
|
|
152513
|
-
app.configs = [...new Set([...app.configs ?? [], ...Object.keys(entries2)])].sort();
|
|
152514
|
-
app.configDefaults = defaults2;
|
|
152515
|
-
app.configSecrets = secrets;
|
|
152516
|
-
};
|
|
152517
152487
|
var loadStackConfigs = async (options) => {
|
|
152518
152488
|
debug("Load stacks config files");
|
|
152519
152489
|
const ext2 = "{json,jsonc,json5}";
|
|
@@ -152647,7 +152617,7 @@ class TypeFile {
|
|
|
152647
152617
|
this.module = module;
|
|
152648
152618
|
}
|
|
152649
152619
|
addImport(varName, path2) {
|
|
152650
|
-
this.imports.set(varName, path2);
|
|
152620
|
+
this.imports.set(varName, path2.replace(/\.(ts|tsx|mts)$/, ""));
|
|
152651
152621
|
return this;
|
|
152652
152622
|
}
|
|
152653
152623
|
addCode(code) {
|
|
@@ -154801,9 +154771,7 @@ var createSsmServer = (props) => {
|
|
|
154801
154771
|
let closeServer;
|
|
154802
154772
|
let log;
|
|
154803
154773
|
const warned2 = new Set;
|
|
154804
|
-
let defaults2 = {};
|
|
154805
154774
|
let pulled = {};
|
|
154806
|
-
let secrets = new Set;
|
|
154807
154775
|
const loadValues = async () => {
|
|
154808
154776
|
try {
|
|
154809
154777
|
return JSON.parse(await readFile12(props.file, "utf8"));
|
|
@@ -154816,9 +154784,7 @@ var createSsmServer = (props) => {
|
|
|
154816
154784
|
log = logFn;
|
|
154817
154785
|
},
|
|
154818
154786
|
setValues(next) {
|
|
154819
|
-
defaults2 = next.defaults;
|
|
154820
154787
|
pulled = next.pulled;
|
|
154821
|
-
secrets = next.secrets;
|
|
154822
154788
|
},
|
|
154823
154789
|
async listen(port = 0) {
|
|
154824
154790
|
server = createServer2((req, res) => {
|
|
@@ -154839,12 +154805,12 @@ var createSsmServer = (props) => {
|
|
|
154839
154805
|
const parameters = [];
|
|
154840
154806
|
for (const name of Names ?? []) {
|
|
154841
154807
|
const key = name.split("/").at(-1);
|
|
154842
|
-
const value = values[key] ??
|
|
154808
|
+
const value = values[key] ?? pulled[key];
|
|
154843
154809
|
if (typeof value === "string") {
|
|
154844
154810
|
parameters.push({ Name: name, Type: "SecureString", Value: value });
|
|
154845
154811
|
} else if (!warned2.has(key)) {
|
|
154846
154812
|
warned2.add(key);
|
|
154847
|
-
log?.(
|
|
154813
|
+
log?.(`The "${key}" config has no value - the ssm pull didn't provide one. Set it with "awsless config set ${key}" or on the dashboard.`);
|
|
154848
154814
|
}
|
|
154849
154815
|
}
|
|
154850
154816
|
res.writeHead(200, { "content-type": "application/x-amz-json-1.1" });
|
|
@@ -154974,19 +154940,19 @@ var configFeature = defineFeature({
|
|
|
154974
154940
|
const gen = new TypeFile("awsless");
|
|
154975
154941
|
const resources = new TypeObject(0, false);
|
|
154976
154942
|
for (const name of ctx.appConfig.configs ?? []) {
|
|
154977
|
-
resources.
|
|
154943
|
+
resources.addConst(name, "string");
|
|
154978
154944
|
}
|
|
154979
154945
|
for (const stack of ctx.stackConfigs) {
|
|
154980
154946
|
for (const site of Object.values(stack.sites ?? {})) {
|
|
154981
154947
|
for (const name of site.build?.configs ?? []) {
|
|
154982
|
-
resources.
|
|
154948
|
+
resources.addConst(name, "string");
|
|
154983
154949
|
}
|
|
154984
154950
|
}
|
|
154985
154951
|
}
|
|
154986
154952
|
gen.addInterface("ConfigResources", resources.toString());
|
|
154987
|
-
const testConfigs = new TypeObject(2);
|
|
154953
|
+
const testConfigs = new TypeObject(2, false);
|
|
154988
154954
|
for (const name of ctx.appConfig.configs ?? []) {
|
|
154989
|
-
testConfigs.
|
|
154955
|
+
testConfigs.addConst(name, "string");
|
|
154990
154956
|
}
|
|
154991
154957
|
const testMock = new TypeObject(1);
|
|
154992
154958
|
testMock.addType("config", testConfigs);
|
|
@@ -155030,10 +154996,9 @@ var configFeature = defineFeature({
|
|
|
155030
154996
|
if (names.size === 0) {
|
|
155031
154997
|
return;
|
|
155032
154998
|
}
|
|
155033
|
-
const secrets = new Set(ctx.appConfig.configSecrets ?? []);
|
|
155034
154999
|
for (const name of names) {
|
|
155035
155000
|
ctx.addEnv(`CONFIG_${constantCase(name)}`, name);
|
|
155036
|
-
ctx.registerResource({ kind: "config", id: name
|
|
155001
|
+
ctx.registerResource({ kind: "config", id: name });
|
|
155037
155002
|
}
|
|
155038
155003
|
const file2 = join18(directories.output, "local", "config.json");
|
|
155039
155004
|
const { server, port } = await ctx.keep("shim:ssm", file2, async () => {
|
|
@@ -155042,38 +155007,31 @@ var configFeature = defineFeature({
|
|
|
155042
155007
|
return { value: { server: server2, port: port2 }, stop: () => server2.stop() };
|
|
155043
155008
|
});
|
|
155044
155009
|
ctx.addEnv("AWS_ENDPOINT_URL_SSM", `http://127.0.0.1:${port}`);
|
|
155045
|
-
|
|
155046
|
-
|
|
155047
|
-
|
|
155048
|
-
|
|
155049
|
-
|
|
155050
|
-
|
|
155051
|
-
|
|
155052
|
-
|
|
155053
|
-
|
|
155054
|
-
|
|
155055
|
-
|
|
155056
|
-
|
|
155057
|
-
|
|
155058
|
-
|
|
155059
|
-
|
|
155060
|
-
|
|
155061
|
-
if (typeof all5[name] === "string") {
|
|
155062
|
-
values[name] = all5[name];
|
|
155063
|
-
}
|
|
155010
|
+
const pulled = await ctx.keep("config:pull", [...names].sort().join(","), async () => {
|
|
155011
|
+
const values = {};
|
|
155012
|
+
try {
|
|
155013
|
+
ctx.log(`Pulling ${names.size} config value${names.size === 1 ? "" : "s"} from SSM...`);
|
|
155014
|
+
const credentials2 = await getCredentials(ctx.appConfig.profile);
|
|
155015
|
+
const store = new SsmStore({ credentials: credentials2, appConfig: ctx.appConfig });
|
|
155016
|
+
let timer;
|
|
155017
|
+
const all5 = await Promise.race([
|
|
155018
|
+
store.list(),
|
|
155019
|
+
new Promise((_3, reject) => {
|
|
155020
|
+
timer = setTimeout(() => reject(new Error("the pull timed out after 15s")), 15000);
|
|
155021
|
+
})
|
|
155022
|
+
]).finally(() => clearTimeout(timer));
|
|
155023
|
+
for (const name of names) {
|
|
155024
|
+
if (typeof all5[name] === "string") {
|
|
155025
|
+
values[name] = all5[name];
|
|
155064
155026
|
}
|
|
155065
|
-
} catch (error3) {
|
|
155066
|
-
debug("Config secret pull failed", error3);
|
|
155067
|
-
ctx.log(`Couldn't pull the config secrets from SSM (${error3 instanceof Error ? error3.message : String(error3)}) - secret-backed features will fail when called.`);
|
|
155068
155027
|
}
|
|
155069
|
-
|
|
155070
|
-
|
|
155071
|
-
|
|
155072
|
-
|
|
155073
|
-
|
|
155074
|
-
pulled,
|
|
155075
|
-
secrets
|
|
155028
|
+
} catch (error3) {
|
|
155029
|
+
debug("Config pull failed", error3);
|
|
155030
|
+
ctx.log(`Couldn't pull the config values from SSM (${error3 instanceof Error ? error3.message : String(error3)}) - set them on the dashboard instead.`);
|
|
155031
|
+
}
|
|
155032
|
+
return { value: values, stop: () => {} };
|
|
155076
155033
|
});
|
|
155034
|
+
server.setValues({ pulled });
|
|
155077
155035
|
ctx.restartOnChange(file2);
|
|
155078
155036
|
ctx.registerServer({
|
|
155079
155037
|
name: "config",
|
|
@@ -165859,7 +165817,7 @@ var watchConfig = async (options, resolve5, reject) => {
|
|
|
165859
165817
|
await loadAppConfig(options);
|
|
165860
165818
|
debug("Start watching...");
|
|
165861
165819
|
const ext2 = "{json,jsonc,json5}";
|
|
165862
|
-
const watcher = $watch([`app.${ext2}`,
|
|
165820
|
+
const watcher = $watch([`app.${ext2}`, `**/stack.${ext2}`, `**/*.stack.${ext2}`], {
|
|
165863
165821
|
cwd: directories.root,
|
|
165864
165822
|
ignored: ["**/node_modules/**", "**/dist/**"],
|
|
165865
165823
|
awaitWriteFinish: true
|
|
@@ -165879,7 +165837,7 @@ var watchConfig = async (options, resolve5, reject) => {
|
|
|
165879
165837
|
|
|
165880
165838
|
// src/dev/index.ts
|
|
165881
165839
|
import { loadWorkspace as loadWorkspace3 } from "@awsless/ts-file-cache";
|
|
165882
|
-
import { mkdir as
|
|
165840
|
+
import { mkdir as mkdir11, rm as rm12, writeFile as writeFile14 } from "fs/promises";
|
|
165883
165841
|
import { join as join53 } from "path";
|
|
165884
165842
|
|
|
165885
165843
|
// src/dev/context.ts
|
|
@@ -166188,7 +166146,10 @@ var createDevContext = (props) => {
|
|
|
166188
166146
|
|
|
166189
166147
|
// src/dev/seed.ts
|
|
166190
166148
|
import { spawn as spawn5 } from "child_process";
|
|
166149
|
+
import { mkdir as mkdir9, writeFile as writeFile11 } from "fs/promises";
|
|
166191
166150
|
import { isAbsolute as isAbsolute4, join as join49 } from "path";
|
|
166151
|
+
import { pathToFileURL } from "url";
|
|
166152
|
+
var MARKER = "__awsless_seed__:";
|
|
166192
166153
|
var createSeedRunner = (props) => {
|
|
166193
166154
|
const seeds = props.stackConfigs.filter((stack) => stack.seed).map((stack) => ({
|
|
166194
166155
|
name: stack.name,
|
|
@@ -166198,33 +166159,68 @@ var createSeedRunner = (props) => {
|
|
|
166198
166159
|
const run = () => {
|
|
166199
166160
|
running ??= (async () => {
|
|
166200
166161
|
try {
|
|
166201
|
-
|
|
166202
|
-
|
|
166203
|
-
|
|
166204
|
-
|
|
166205
|
-
|
|
166206
|
-
|
|
166207
|
-
|
|
166208
|
-
|
|
166209
|
-
|
|
166210
|
-
|
|
166211
|
-
|
|
166212
|
-
|
|
166213
|
-
|
|
166214
|
-
|
|
166215
|
-
|
|
166216
|
-
|
|
166217
|
-
|
|
166218
|
-
|
|
166219
|
-
|
|
166220
|
-
|
|
166162
|
+
const runner = seeds.map((entry) => {
|
|
166163
|
+
return `console.log(${JSON.stringify(MARKER + entry.name)})
|
|
166164
|
+
await import(${JSON.stringify(pathToFileURL(entry.file).href)})
|
|
166165
|
+
`;
|
|
166166
|
+
}).join("");
|
|
166167
|
+
const runnerDir = join49(directories.output, "local");
|
|
166168
|
+
const runnerFile = join49(runnerDir, "seed-runner.mjs");
|
|
166169
|
+
await mkdir9(runnerDir, { recursive: true });
|
|
166170
|
+
await writeFile11(runnerFile, runner);
|
|
166171
|
+
const timings = [];
|
|
166172
|
+
await new Promise((resolve5, reject) => {
|
|
166173
|
+
const child = spawn5("bun", [runnerFile], {
|
|
166174
|
+
cwd: directories.root,
|
|
166175
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
166176
|
+
env: { ...process.env, ...props.env }
|
|
166177
|
+
});
|
|
166178
|
+
let current;
|
|
166179
|
+
let started = Date.now();
|
|
166180
|
+
const output = [];
|
|
166181
|
+
let buffered = "";
|
|
166182
|
+
const capture = (chunk3) => {
|
|
166183
|
+
buffered += chunk3.toString();
|
|
166184
|
+
let index;
|
|
166185
|
+
while ((index = buffered.indexOf(`
|
|
166186
|
+
`)) >= 0) {
|
|
166187
|
+
const line = buffered.slice(0, index);
|
|
166188
|
+
buffered = buffered.slice(index + 1);
|
|
166189
|
+
if (line.startsWith(MARKER)) {
|
|
166190
|
+
if (current) {
|
|
166191
|
+
timings.push([current, Date.now() - started]);
|
|
166192
|
+
}
|
|
166193
|
+
current = line.slice(MARKER.length);
|
|
166194
|
+
started = Date.now();
|
|
166195
|
+
debug(`Seeding the ${current} stack`);
|
|
166221
166196
|
} else {
|
|
166222
|
-
|
|
166223
|
-
${logs}`));
|
|
166197
|
+
output.push(line);
|
|
166224
166198
|
}
|
|
166225
|
-
}
|
|
166199
|
+
}
|
|
166200
|
+
};
|
|
166201
|
+
child.stdout?.on("data", capture);
|
|
166202
|
+
child.stderr?.on("data", capture);
|
|
166203
|
+
child.on("error", reject);
|
|
166204
|
+
child.on("exit", (code) => {
|
|
166205
|
+
capture(Buffer.from(`
|
|
166206
|
+
`));
|
|
166207
|
+
const logs = output.join(`
|
|
166208
|
+
`).trim();
|
|
166209
|
+
if (logs) {
|
|
166210
|
+
debug(logs);
|
|
166211
|
+
}
|
|
166212
|
+
if (code === 0) {
|
|
166213
|
+
if (current) {
|
|
166214
|
+
timings.push([current, Date.now() - started]);
|
|
166215
|
+
}
|
|
166216
|
+
resolve5();
|
|
166217
|
+
} else {
|
|
166218
|
+
reject(new Error(`The seed of the "${current ?? seeds[0]?.name}" stack exited with code ${code}:
|
|
166219
|
+
${logs}`));
|
|
166220
|
+
}
|
|
166226
166221
|
});
|
|
166227
|
-
}
|
|
166222
|
+
});
|
|
166223
|
+
return timings;
|
|
166228
166224
|
} finally {
|
|
166229
166225
|
running = undefined;
|
|
166230
166226
|
}
|
|
@@ -166239,13 +166235,13 @@ var import_ioredis5 = __toESM(require_built3(), 1);
|
|
|
166239
166235
|
import { DynamoDBClient as DynamoDBClient4 } from "@aws-sdk/client-dynamodb";
|
|
166240
166236
|
import { DynamoDBDocumentClient, ScanCommand as ScanCommand2 } from "@aws-sdk/lib-dynamodb";
|
|
166241
166237
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
166242
|
-
import { readdir as readdir9, readFile as readFile21, stat as stat9, writeFile as
|
|
166238
|
+
import { readdir as readdir9, readFile as readFile21, stat as stat9, writeFile as writeFile13 } from "fs/promises";
|
|
166243
166239
|
import { createServer as createServer8 } from "http";
|
|
166244
166240
|
import { join as join51, relative as relative10, sep as sep5 } from "path";
|
|
166245
166241
|
|
|
166246
166242
|
// src/dev/worker.ts
|
|
166247
166243
|
import { spawn as spawn6 } from "child_process";
|
|
166248
|
-
import { writeFile as
|
|
166244
|
+
import { writeFile as writeFile12 } from "fs/promises";
|
|
166249
166245
|
import { join as join50 } from "path";
|
|
166250
166246
|
class WorkerError extends Error {
|
|
166251
166247
|
name;
|
|
@@ -166340,7 +166336,7 @@ var createBundleWorker = (props) => {
|
|
|
166340
166336
|
};
|
|
166341
166337
|
const start = async () => {
|
|
166342
166338
|
const entry = join50(props.buildDir, "worker.mjs");
|
|
166343
|
-
await
|
|
166339
|
+
await writeFile12(entry, WORKER_ENTRY);
|
|
166344
166340
|
port = await findFreePort();
|
|
166345
166341
|
child = spawn6("node", ["--enable-source-maps", entry], {
|
|
166346
166342
|
cwd: props.buildDir,
|
|
@@ -167191,24 +167187,18 @@ const configPanel = async (main) => {
|
|
|
167191
167187
|
const names = [...new Set(state.resources.filter(r => r.kind === 'config').map(r => r.id))].sort()
|
|
167192
167188
|
const data = await api('/api/config')
|
|
167193
167189
|
const values = data.values ?? {}
|
|
167194
|
-
const
|
|
167195
|
-
const secrets = new Set(data.secrets ?? [])
|
|
167190
|
+
const pulled = new Set(data.pulled ?? [])
|
|
167196
167191
|
|
|
167197
167192
|
const inputs = new Map()
|
|
167198
167193
|
const form = $('div', { className: 'config-form' })
|
|
167199
167194
|
|
|
167200
167195
|
for (const name of names) {
|
|
167201
|
-
// An empty input falls through to the
|
|
167202
|
-
//
|
|
167203
|
-
const placeholder = secrets.has(name)
|
|
167204
|
-
? 'pulled from ssm'
|
|
167205
|
-
: defaults[name] !== undefined ? 'default: ' + defaults[name] : 'not set'
|
|
167206
|
-
|
|
167196
|
+
// An empty input falls through to the value pulled from ssm on
|
|
167197
|
+
// boot - the placeholder shows whether the pull provided one.
|
|
167207
167198
|
const input = $('input', {
|
|
167208
167199
|
value: values[name] ?? '',
|
|
167209
|
-
placeholder,
|
|
167200
|
+
placeholder: pulled.has(name) ? 'pulled from ssm' : 'not set',
|
|
167210
167201
|
spellcheck: false,
|
|
167211
|
-
...(secrets.has(name) ? { type: 'password' } : {}),
|
|
167212
167202
|
})
|
|
167213
167203
|
inputs.set(name, input)
|
|
167214
167204
|
form.append($('label', { className: 'field' }, [$('span', { className: 'name' }, name), input]))
|
|
@@ -167643,7 +167633,7 @@ var createDashboardServer = (props) => {
|
|
|
167643
167633
|
if (url.pathname === "/api/config") {
|
|
167644
167634
|
if (req.method === "PUT") {
|
|
167645
167635
|
const values2 = JSON.parse((await readBody3(req)).toString() || "{}");
|
|
167646
|
-
await
|
|
167636
|
+
await writeFile13(props.configFile, JSON.stringify(values2, null, "\t") + `
|
|
167647
167637
|
`);
|
|
167648
167638
|
return { status: 200, body: JSON.stringify({ ok: true }) };
|
|
167649
167639
|
}
|
|
@@ -167655,8 +167645,7 @@ var createDashboardServer = (props) => {
|
|
|
167655
167645
|
status: 200,
|
|
167656
167646
|
body: JSON.stringify({
|
|
167657
167647
|
values,
|
|
167658
|
-
|
|
167659
|
-
secrets: props.configMeta?.secrets ?? []
|
|
167648
|
+
pulled: props.configPulled ?? []
|
|
167660
167649
|
})
|
|
167661
167650
|
};
|
|
167662
167651
|
}
|
|
@@ -167880,7 +167869,7 @@ var createLambdaServer = (props) => {
|
|
|
167880
167869
|
};
|
|
167881
167870
|
|
|
167882
167871
|
// src/dev/sdk.ts
|
|
167883
|
-
import { readdir as readdir10, readFile as readFile22, mkdir as
|
|
167872
|
+
import { readdir as readdir10, readFile as readFile22, mkdir as mkdir10, rm as rm11, symlink } from "fs/promises";
|
|
167884
167873
|
import { createRequire } from "module";
|
|
167885
167874
|
import { dirname as dirname22, join as join52 } from "path";
|
|
167886
167875
|
var linkSdkPackages = async (buildDir, onWarn) => {
|
|
@@ -167910,7 +167899,7 @@ var linkSdkPackages = async (buildDir, onWarn) => {
|
|
|
167910
167899
|
continue;
|
|
167911
167900
|
}
|
|
167912
167901
|
const target2 = join52(buildDir, "node_modules", name);
|
|
167913
|
-
await
|
|
167902
|
+
await mkdir10(dirname22(target2), { recursive: true });
|
|
167914
167903
|
await rm11(target2, { recursive: true, force: true });
|
|
167915
167904
|
await symlink(source, target2, "dir");
|
|
167916
167905
|
}
|
|
@@ -167932,7 +167921,7 @@ var startDev = async (props) => {
|
|
|
167932
167921
|
accountId: LOCAL_ACCOUNT_ID,
|
|
167933
167922
|
dev: true
|
|
167934
167923
|
});
|
|
167935
|
-
await
|
|
167924
|
+
await mkdir11(join53(directories.output, "local"), { recursive: true });
|
|
167936
167925
|
const routerPorts = {};
|
|
167937
167926
|
Object.keys(appConfig.router ?? {}).forEach((id, index) => {
|
|
167938
167927
|
routerPorts[id] = props.port + 1 + index;
|
|
@@ -167987,7 +167976,7 @@ var startDev = async (props) => {
|
|
|
167987
167976
|
for (const [id, port] of Object.entries(routerPorts)) {
|
|
167988
167977
|
env5[`ROUTER_${constantCase(id)}_ENDPOINT`] = `localhost:${port}`;
|
|
167989
167978
|
}
|
|
167990
|
-
await
|
|
167979
|
+
await writeFile14(join53(directories.output, "local", "env.json"), JSON.stringify(env5, null, "\t") + `
|
|
167991
167980
|
`);
|
|
167992
167981
|
return { env: env5, lambda: lambda2 };
|
|
167993
167982
|
});
|
|
@@ -168002,7 +167991,7 @@ var startDev = async (props) => {
|
|
|
168002
167991
|
}
|
|
168003
167992
|
debug(`Build ${builder.type}:${builder.name}`, meta?.cached ? "cached" : String(meta?.buildTime));
|
|
168004
167993
|
}
|
|
168005
|
-
await
|
|
167994
|
+
await writeFile14(getBuildPath("bundle", bundleName, "files/awsless-env.mjs"), `export default {}
|
|
168006
167995
|
`);
|
|
168007
167996
|
await linkSdkPackages(buildDir, log);
|
|
168008
167997
|
return changed;
|
|
@@ -168075,7 +168064,9 @@ var startDev = async (props) => {
|
|
|
168075
168064
|
const resetData = createDataReset({ pool: props.pool, appConfig, stackConfigs });
|
|
168076
168065
|
if (firstBoot && seeder.count > 0 && !dirty) {
|
|
168077
168066
|
try {
|
|
168078
|
-
await phase({ start: "Seeding the local data...", done: "Seeded the local data" }, () =>
|
|
168067
|
+
await phase({ start: "Seeding the local data...", done: "Seeded the local data" }, async (detail) => {
|
|
168068
|
+
detail(breakdown(await seeder.run()));
|
|
168069
|
+
});
|
|
168079
168070
|
} catch (error3) {
|
|
168080
168071
|
log(`Seeding failed: ${error3 instanceof Error ? error3.message : String(error3)}`);
|
|
168081
168072
|
}
|
|
@@ -168102,10 +168093,7 @@ var startDev = async (props) => {
|
|
|
168102
168093
|
env: env4,
|
|
168103
168094
|
storeRoot: join53(directories.output, "local", "store"),
|
|
168104
168095
|
configFile: join53(directories.output, "local", "config.json"),
|
|
168105
|
-
|
|
168106
|
-
defaults: appConfig.configDefaults ?? {},
|
|
168107
|
-
secrets: appConfig.configSecrets ?? []
|
|
168108
|
-
},
|
|
168096
|
+
configPulled: Object.keys(props.pool.peek("config:pull") ?? {}),
|
|
168109
168097
|
events: dev.events
|
|
168110
168098
|
});
|
|
168111
168099
|
dashboard.connect(dispatch);
|
|
@@ -168198,7 +168186,7 @@ var createServerPool = () => {
|
|
|
168198
168186
|
};
|
|
168199
168187
|
|
|
168200
168188
|
// src/type-gen/generate.ts
|
|
168201
|
-
import { mkdir as
|
|
168189
|
+
import { mkdir as mkdir12, writeFile as writeFile15 } from "fs/promises";
|
|
168202
168190
|
import { dirname as dirname23, join as join54, relative as relative11 } from "path";
|
|
168203
168191
|
var generateTypes = async (props) => {
|
|
168204
168192
|
const files = [];
|
|
@@ -168212,8 +168200,8 @@ var generateTypes = async (props) => {
|
|
|
168212
168200
|
if (include) {
|
|
168213
168201
|
files.push(relative11(directories.root, path6));
|
|
168214
168202
|
}
|
|
168215
|
-
await
|
|
168216
|
-
await
|
|
168203
|
+
await mkdir12(dirname23(path6), { recursive: true });
|
|
168204
|
+
await writeFile15(path6, code);
|
|
168217
168205
|
}
|
|
168218
168206
|
}
|
|
168219
168207
|
});
|
|
@@ -168221,7 +168209,7 @@ var generateTypes = async (props) => {
|
|
|
168221
168209
|
if (files.length) {
|
|
168222
168210
|
const code = files.map((file2) => `/// <reference path='${file2}' />`).join(`
|
|
168223
168211
|
`);
|
|
168224
|
-
await
|
|
168212
|
+
await writeFile15(join54(directories.root, `awsless.d.ts`), code);
|
|
168225
168213
|
}
|
|
168226
168214
|
};
|
|
168227
168215
|
|
|
@@ -168375,7 +168363,7 @@ import { DynamoDBClient as DynamoDBClient6, dynamoDBClient } from "@awsless/dyna
|
|
|
168375
168363
|
|
|
168376
168364
|
// ../../node_modules/.pnpm/@aws-sdk+client-iot-data-plane@3.1023.0_aws-crt@1.30.0_supports-color@8.1.1_/node_modules/@aws-sdk/client-iot-data-plane/dist-es/IoTDataPlaneClient.js
|
|
168377
168365
|
var import_core50 = __toESM(require_dist_cjs2(), 1);
|
|
168378
|
-
var
|
|
168366
|
+
var import_schema67 = __toESM(require_schema(), 1);
|
|
168379
168367
|
|
|
168380
168368
|
// ../../node_modules/.pnpm/@aws-sdk+client-iot-data-plane@3.1023.0_aws-crt@1.30.0_supports-color@8.1.1_/node_modules/@aws-sdk/client-iot-data-plane/dist-es/auth/httpAuthSchemeProvider.js
|
|
168381
168369
|
var import_httpAuthSchemes4 = __toESM(require_httpAuthSchemes(), 1);
|
|
@@ -168581,7 +168569,7 @@ var defaultEndpointResolver3 = (endpointParams, context = {}) => {
|
|
|
168581
168569
|
customEndpointFunctions.aws = awsEndpointFunctions;
|
|
168582
168570
|
|
|
168583
168571
|
// ../../node_modules/.pnpm/@aws-sdk+client-iot-data-plane@3.1023.0_aws-crt@1.30.0_supports-color@8.1.1_/node_modules/@aws-sdk/client-iot-data-plane/dist-es/schemas/schemas_0.js
|
|
168584
|
-
var
|
|
168572
|
+
var import_schema66 = __toESM(require_schema(), 1);
|
|
168585
168573
|
|
|
168586
168574
|
// ../../node_modules/.pnpm/@aws-sdk+client-iot-data-plane@3.1023.0_aws-crt@1.30.0_supports-color@8.1.1_/node_modules/@aws-sdk/client-iot-data-plane/dist-es/models/IoTDataPlaneServiceException.js
|
|
168587
168575
|
class IoTDataPlaneServiceException extends ServiceException {
|
|
@@ -168811,10 +168799,10 @@ var _xamcd = "x-amz-mqtt5-correlation-data";
|
|
|
168811
168799
|
var _xampfi = "x-amz-mqtt5-payload-format-indicator";
|
|
168812
168800
|
var _xamup = "x-amz-mqtt5-user-properties";
|
|
168813
168801
|
var n03 = "com.amazonaws.iotdataplane";
|
|
168814
|
-
var _s_registry3 =
|
|
168802
|
+
var _s_registry3 = import_schema66.TypeRegistry.for(_s3);
|
|
168815
168803
|
var IoTDataPlaneServiceException$ = [-3, _s3, "IoTDataPlaneServiceException", 0, [], []];
|
|
168816
168804
|
_s_registry3.registerError(IoTDataPlaneServiceException$, IoTDataPlaneServiceException);
|
|
168817
|
-
var n0_registry3 =
|
|
168805
|
+
var n0_registry3 = import_schema66.TypeRegistry.for(n03);
|
|
168818
168806
|
var ConflictException$ = [
|
|
168819
168807
|
-3,
|
|
168820
168808
|
n03,
|
|
@@ -169250,7 +169238,7 @@ class IoTDataPlaneClient extends Client {
|
|
|
169250
169238
|
const _config_7 = resolveHttpAuthSchemeConfig3(_config_6);
|
|
169251
169239
|
const _config_8 = resolveRuntimeExtensions3(_config_7, configuration?.extensions || []);
|
|
169252
169240
|
this.config = _config_8;
|
|
169253
|
-
this.middlewareStack.use(
|
|
169241
|
+
this.middlewareStack.use(import_schema67.getSchemaSerdePlugin(this.config));
|
|
169254
169242
|
this.middlewareStack.use(getUserAgentPlugin(this.config));
|
|
169255
169243
|
this.middlewareStack.use(getRetryPlugin(this.config));
|
|
169256
169244
|
this.middlewareStack.use(getContentLengthPlugin(this.config));
|
|
@@ -183850,7 +183838,7 @@ var state = (program3) => {
|
|
|
183850
183838
|
};
|
|
183851
183839
|
|
|
183852
183840
|
// src/cli/command/test.ts
|
|
183853
|
-
import { mkdir as
|
|
183841
|
+
import { mkdir as mkdir13, writeFile as writeFile16 } from "fs/promises";
|
|
183854
183842
|
import { join as join56 } from "path";
|
|
183855
183843
|
|
|
183856
183844
|
// src/test/manifest.ts
|
|
@@ -183979,8 +183967,8 @@ var test2 = (program3) => {
|
|
|
183979
183967
|
await redis.ping();
|
|
183980
183968
|
manifest.servers.redis = { host: "127.0.0.1", port: await redis.getPort() };
|
|
183981
183969
|
}
|
|
183982
|
-
await
|
|
183983
|
-
await
|
|
183970
|
+
await mkdir13(join56(directories.output, "test"), { recursive: true });
|
|
183971
|
+
await writeFile16(manifestFile, JSON.stringify(manifest));
|
|
183984
183972
|
process.env.AWSLESS_TEST_MANIFEST = manifestFile;
|
|
183985
183973
|
let passed = false;
|
|
183986
183974
|
try {
|
package/dist/handlers/bundle.js
CHANGED
|
@@ -381,7 +381,7 @@ var topicHandler = (event, routes) => {
|
|
|
381
381
|
return type === "topic" && id === topicId;
|
|
382
382
|
});
|
|
383
383
|
if (!subscribers.length) {
|
|
384
|
-
|
|
384
|
+
return [];
|
|
385
385
|
}
|
|
386
386
|
if (subscribers.length === 1) {
|
|
387
387
|
return asyncRoute(subscribers[0], event);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/cli",
|
|
3
|
-
"version": "0.0.46-local.
|
|
3
|
+
"version": "0.0.46-local.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@awsless/big-float": "^0.1.7",
|
|
46
|
-
"@awsless/duration": "^0.0.4",
|
|
47
46
|
"@awsless/dynamodb": "^0.3.22",
|
|
47
|
+
"@awsless/duration": "^0.0.4",
|
|
48
48
|
"@awsless/json": "^0.0.11",
|
|
49
49
|
"@awsless/lambda": "^0.0.47",
|
|
50
|
+
"@awsless/weak-cache": "^0.0.1",
|
|
50
51
|
"@awsless/s3": "^0.0.22",
|
|
51
|
-
"
|
|
52
|
-
"awsless": "^0.
|
|
53
|
-
"@awsless/weak-cache": "^0.0.1"
|
|
52
|
+
"awsless": "^0.0.15-local.6",
|
|
53
|
+
"@awsless/validate": "^0.1.7"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@aws-sdk/client-cloudformation": "^3.369.0",
|
|
@@ -121,24 +121,24 @@
|
|
|
121
121
|
"zod": "^3.24.2",
|
|
122
122
|
"zod-to-json-schema": "^3.24.3",
|
|
123
123
|
"@awsless/clui": "^0.0.9",
|
|
124
|
+
"@awsless/big-float": "^0.1.7",
|
|
124
125
|
"@awsless/cloudwatch": "^0.0.1",
|
|
125
126
|
"@awsless/dynamodb": "^0.3.22",
|
|
126
|
-
"@awsless/iot": "^0.0.5",
|
|
127
127
|
"@awsless/json": "^0.0.11",
|
|
128
|
-
"@awsless/duration": "^0.0.4",
|
|
129
|
-
"@awsless/open-search": "^0.0.24",
|
|
130
128
|
"@awsless/lambda": "^0.0.47",
|
|
129
|
+
"@awsless/open-search": "^0.0.24",
|
|
130
|
+
"@awsless/duration": "^0.0.4",
|
|
131
131
|
"@awsless/redis": "^0.1.13",
|
|
132
|
-
"@awsless/s3": "^0.0.22",
|
|
133
|
-
"@awsless/big-float": "^0.1.7",
|
|
134
132
|
"@awsless/size": "^0.0.2",
|
|
135
|
-
"@awsless/
|
|
133
|
+
"@awsless/sqs": "^0.0.24",
|
|
136
134
|
"@awsless/scheduler": "^0.0.5",
|
|
137
|
-
"@awsless/validate": "^0.1.7",
|
|
138
|
-
"@awsless/weak-cache": "^0.0.1",
|
|
139
135
|
"@awsless/ssm": "^0.0.8",
|
|
140
|
-
"awsless": "^0.0.
|
|
141
|
-
"@awsless/
|
|
136
|
+
"@awsless/weak-cache": "^0.0.1",
|
|
137
|
+
"@awsless/validate": "^0.1.7",
|
|
138
|
+
"@awsless/s3": "^0.0.22",
|
|
139
|
+
"@awsless/sns": "^0.0.11",
|
|
140
|
+
"awsless": "^0.0.15-local.6",
|
|
141
|
+
"@awsless/iot": "^0.0.5"
|
|
142
142
|
},
|
|
143
143
|
"scripts": {
|
|
144
144
|
"test": "bun cli/build-handlers.ts && pnpm vitest",
|