@awsless/awsless 0.0.552 → 0.0.554
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 +37 -10
- package/dist/prebuild/icon/bundle.zip +0 -0
- package/dist/prebuild/image/bundle.zip +0 -0
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/server.js +22 -9
- package/package.json +16 -15
package/dist/bin.js
CHANGED
|
@@ -2221,7 +2221,8 @@ var loadStackConfigs = async (options) => {
|
|
|
2221
2221
|
});
|
|
2222
2222
|
const stacks = [];
|
|
2223
2223
|
for (const file of stackFiles.sort()) {
|
|
2224
|
-
|
|
2224
|
+
const shouldIngore = file.split("/").filter((v) => v.startsWith("_")).length > 0;
|
|
2225
|
+
if (shouldIngore) {
|
|
2225
2226
|
debug("Skip stack file:", color.info(file));
|
|
2226
2227
|
continue;
|
|
2227
2228
|
}
|
|
@@ -8374,6 +8375,7 @@ var findDependencies = async (file, code) => {
|
|
|
8374
8375
|
|
|
8375
8376
|
// src/test/reporter.ts
|
|
8376
8377
|
import { getSuites, getTests } from "@vitest/runner/utils";
|
|
8378
|
+
import { parseStacktrace } from "@vitest/utils/source-map";
|
|
8377
8379
|
var CustomReporter = class {
|
|
8378
8380
|
interval;
|
|
8379
8381
|
tasks;
|
|
@@ -8406,13 +8408,22 @@ var CustomReporter = class {
|
|
|
8406
8408
|
if (!test2.result?.errors || test2.result.errors.length === 0) {
|
|
8407
8409
|
return [];
|
|
8408
8410
|
}
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8411
|
+
const item = test2.type === "suite" ? test2 : test2.file;
|
|
8412
|
+
console.log(test2.result.errors);
|
|
8413
|
+
return test2.result.errors.map((error) => {
|
|
8414
|
+
const traces = error.stackStr ? parseStacktrace(error.stackStr) : [];
|
|
8415
|
+
return {
|
|
8416
|
+
location: {
|
|
8417
|
+
line: traces[0]?.line,
|
|
8418
|
+
column: traces[0]?.column
|
|
8419
|
+
},
|
|
8420
|
+
file: item.name,
|
|
8421
|
+
test: test2.type === "test" ? test2.name : void 0,
|
|
8422
|
+
diff: error.showDiff && error.diff ? error.diff : void 0,
|
|
8423
|
+
type: error.name,
|
|
8424
|
+
message: error.message
|
|
8425
|
+
};
|
|
8426
|
+
});
|
|
8416
8427
|
}).flat();
|
|
8417
8428
|
this.events.finished?.({ errors, passed, failed, logs: this.logs });
|
|
8418
8429
|
}
|
|
@@ -8469,6 +8480,10 @@ var startTest = async (props) => {
|
|
|
8469
8480
|
exclude: ["**/_*", "**/_*/**", ...configDefaults.exclude],
|
|
8470
8481
|
globals: true,
|
|
8471
8482
|
reporters: props.reporter,
|
|
8483
|
+
// typecheck: {
|
|
8484
|
+
// checker: 'tsc',
|
|
8485
|
+
// enabled: true,
|
|
8486
|
+
// },
|
|
8472
8487
|
setupFiles: [
|
|
8473
8488
|
//
|
|
8474
8489
|
join18(__dirname4, "test-global-setup.js")
|
|
@@ -8533,6 +8548,17 @@ var logTestLogs = (event) => {
|
|
|
8533
8548
|
log15.message(event.logs.map((log26) => wrap(log26, { hard: true })).join("\n"));
|
|
8534
8549
|
}
|
|
8535
8550
|
};
|
|
8551
|
+
var formatFileName = (error) => {
|
|
8552
|
+
const name = [error.file];
|
|
8553
|
+
const loc = error.location;
|
|
8554
|
+
if (typeof loc.line === "number") {
|
|
8555
|
+
name.push(`:${loc.line}`);
|
|
8556
|
+
if (typeof loc.column === "number") {
|
|
8557
|
+
name.push(`:${loc.column}`);
|
|
8558
|
+
}
|
|
8559
|
+
}
|
|
8560
|
+
return name.join("");
|
|
8561
|
+
};
|
|
8536
8562
|
var logTestErrors = (event) => {
|
|
8537
8563
|
event.errors.forEach((error, i) => {
|
|
8538
8564
|
const [message, ...comment] = error.message.split("//");
|
|
@@ -8547,9 +8573,10 @@ var logTestErrors = (event) => {
|
|
|
8547
8573
|
color.error.inverse.bold(` FAIL `),
|
|
8548
8574
|
color.dim(`(${i + 1}/${event.errors.length})`),
|
|
8549
8575
|
color.dim(icon.arrow.right),
|
|
8550
|
-
error
|
|
8576
|
+
formatFileName(error),
|
|
8551
8577
|
color.dim(icon.arrow.right),
|
|
8552
|
-
|
|
8578
|
+
// `\n${color.label.inverse.bold(` TEST `)}`,
|
|
8579
|
+
color.dim(error.test),
|
|
8553
8580
|
[`
|
|
8554
8581
|
|
|
8555
8582
|
`, errorMessage, ...error.diff ? ["\n\n", error.diff] : []].join("")
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/server.js
CHANGED
|
@@ -100,6 +100,7 @@ var mockCache = () => {
|
|
|
100
100
|
import { mockLambda } from "@awsless/lambda";
|
|
101
101
|
|
|
102
102
|
// src/lib/server/function.ts
|
|
103
|
+
import { stringify as stringify2 } from "@awsless/json";
|
|
103
104
|
import { invoke } from "@awsless/lambda";
|
|
104
105
|
import { WeakCache } from "@awsless/weak-cache";
|
|
105
106
|
var cache = new WeakCache();
|
|
@@ -109,11 +110,23 @@ var Function = /* @__PURE__ */ createProxy((stackName) => {
|
|
|
109
110
|
const name = getFunctionName(funcName, stackName);
|
|
110
111
|
const ctx = {
|
|
111
112
|
[name]: (payload, options = {}) => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
if (!options.cache) {
|
|
114
|
+
return invoke({
|
|
115
|
+
...options,
|
|
116
|
+
name,
|
|
117
|
+
payload
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
const cacheKey = stringify2([name, payload, options.qualifier]);
|
|
121
|
+
if (!cache.has(cacheKey)) {
|
|
122
|
+
const promise = invoke({
|
|
123
|
+
...options,
|
|
124
|
+
name,
|
|
125
|
+
payload
|
|
126
|
+
});
|
|
127
|
+
cache.set(cacheKey, promise);
|
|
128
|
+
}
|
|
129
|
+
return cache.get(cacheKey);
|
|
117
130
|
}
|
|
118
131
|
};
|
|
119
132
|
const call = ctx[name];
|
|
@@ -293,7 +306,7 @@ var mockTask = (cb) => {
|
|
|
293
306
|
import { mockSNS as mockSNS2 } from "@awsless/sns";
|
|
294
307
|
|
|
295
308
|
// src/lib/server/topic.ts
|
|
296
|
-
import { stringify as
|
|
309
|
+
import { stringify as stringify3 } from "@awsless/json";
|
|
297
310
|
import { publish as publish2 } from "@awsless/sns";
|
|
298
311
|
var getTopicName = bindGlobalResourceName("topic");
|
|
299
312
|
var Topic = /* @__PURE__ */ createProxy((name) => {
|
|
@@ -303,7 +316,7 @@ var Topic = /* @__PURE__ */ createProxy((name) => {
|
|
|
303
316
|
await publish2({
|
|
304
317
|
...options,
|
|
305
318
|
topic,
|
|
306
|
-
payload:
|
|
319
|
+
payload: stringify3(payload)
|
|
307
320
|
});
|
|
308
321
|
}
|
|
309
322
|
};
|
|
@@ -503,7 +516,7 @@ var Metric = /* @__PURE__ */ createProxy((stack) => {
|
|
|
503
516
|
// src/lib/server/pubsub.ts
|
|
504
517
|
import { hours, toSeconds } from "@awsless/duration";
|
|
505
518
|
import { publish as publish3, QoS } from "@awsless/iot";
|
|
506
|
-
import { stringify as
|
|
519
|
+
import { stringify as stringify4 } from "@awsless/json";
|
|
507
520
|
var getPubSubTopic = (name) => {
|
|
508
521
|
return `${APP}/pubsub/${name}`;
|
|
509
522
|
};
|
|
@@ -511,7 +524,7 @@ var PubSub = {
|
|
|
511
524
|
async publish(topic, event, payload, opts = {}) {
|
|
512
525
|
await publish3({
|
|
513
526
|
topic: getPubSubTopic(topic),
|
|
514
|
-
payload: Buffer.from(
|
|
527
|
+
payload: Buffer.from(stringify4([event, payload])),
|
|
515
528
|
...opts
|
|
516
529
|
});
|
|
517
530
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.554",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -34,21 +34,21 @@
|
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@awsless/big-float": "^0.1.3",
|
|
37
|
-
"@awsless/
|
|
37
|
+
"@awsless/cloudwatch": "^0.0.1",
|
|
38
38
|
"@awsless/duration": "^0.0.3",
|
|
39
|
+
"@awsless/clui": "^0.0.7",
|
|
39
40
|
"@awsless/json": "^0.0.10",
|
|
40
41
|
"@awsless/iot": "^0.0.3",
|
|
41
|
-
"@awsless/dynamodb": "^0.2.6",
|
|
42
|
-
"@awsless/lambda": "^0.0.33",
|
|
43
|
-
"@awsless/open-search": "^0.0.21",
|
|
44
42
|
"@awsless/mqtt": "^0.0.2",
|
|
45
|
-
"@awsless/redis": "^0.0.14",
|
|
46
43
|
"@awsless/sns": "^0.0.10",
|
|
47
|
-
"@awsless/
|
|
44
|
+
"@awsless/lambda": "^0.0.33",
|
|
48
45
|
"@awsless/s3": "^0.0.21",
|
|
49
|
-
"@awsless/
|
|
50
|
-
"@awsless/
|
|
46
|
+
"@awsless/redis": "^0.0.14",
|
|
47
|
+
"@awsless/dynamodb": "^0.2.7",
|
|
51
48
|
"@awsless/ssm": "^0.0.7",
|
|
49
|
+
"@awsless/open-search": "^0.0.21",
|
|
50
|
+
"@awsless/sqs": "^0.0.8",
|
|
51
|
+
"@awsless/validate": "^0.0.19",
|
|
52
52
|
"@awsless/weak-cache": "^0.0.1"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
"@types/uuid": "^9.0.0",
|
|
88
88
|
"@types/wildstring": "^1.0.3",
|
|
89
89
|
"@vitest/runner": "^3.1.4",
|
|
90
|
+
"@vitest/utils": "3.2.4",
|
|
90
91
|
"aws-cron-expression-validator": "^1.0.5",
|
|
91
92
|
"aws-lambda": "^1.0.7",
|
|
92
93
|
"chalk": "^5.3.0",
|
|
@@ -132,17 +133,17 @@
|
|
|
132
133
|
"zip-a-folder": "^3.1.6",
|
|
133
134
|
"zod": "^3.24.2",
|
|
134
135
|
"zod-to-json-schema": "^3.24.3",
|
|
135
|
-
"@awsless/
|
|
136
|
+
"@awsless/big-float": "^0.1.3",
|
|
137
|
+
"@awsless/cloudwatch": "^0.0.1",
|
|
136
138
|
"@awsless/duration": "^0.0.3",
|
|
137
|
-
"@awsless/
|
|
139
|
+
"@awsless/clui": "^0.0.7",
|
|
138
140
|
"@awsless/formation": "^0.0.79",
|
|
139
141
|
"@awsless/json": "^0.0.10",
|
|
142
|
+
"@awsless/graphql": "^0.0.9",
|
|
140
143
|
"@awsless/scheduler": "^0.0.4",
|
|
141
|
-
"@awsless/big-float": "^0.1.3",
|
|
142
|
-
"@awsless/size": "^0.0.2",
|
|
143
144
|
"@awsless/ts-file-cache": "^0.0.12",
|
|
144
|
-
"@awsless/
|
|
145
|
-
"@awsless/
|
|
145
|
+
"@awsless/size": "^0.0.2",
|
|
146
|
+
"@awsless/validate": "^0.0.19"
|
|
146
147
|
},
|
|
147
148
|
"devDependencies": {
|
|
148
149
|
"@node-rs/bcrypt": "^1.10.5",
|