@awsless/awsless 0.0.553 → 0.0.555
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 +36 -9
- 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 +20 -19
package/dist/bin.js
CHANGED
|
@@ -8375,6 +8375,7 @@ var findDependencies = async (file, code) => {
|
|
|
8375
8375
|
|
|
8376
8376
|
// src/test/reporter.ts
|
|
8377
8377
|
import { getSuites, getTests } from "@vitest/runner/utils";
|
|
8378
|
+
import { parseStacktrace } from "@vitest/utils/source-map";
|
|
8378
8379
|
var CustomReporter = class {
|
|
8379
8380
|
interval;
|
|
8380
8381
|
tasks;
|
|
@@ -8407,13 +8408,21 @@ var CustomReporter = class {
|
|
|
8407
8408
|
if (!test2.result?.errors || test2.result.errors.length === 0) {
|
|
8408
8409
|
return [];
|
|
8409
8410
|
}
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
|
|
8411
|
+
const item = test2.type === "suite" ? test2 : test2.file;
|
|
8412
|
+
return test2.result.errors.map((error) => {
|
|
8413
|
+
const traces = error.stackStr ? parseStacktrace(error.stackStr) : [];
|
|
8414
|
+
return {
|
|
8415
|
+
location: {
|
|
8416
|
+
line: traces[0]?.line,
|
|
8417
|
+
column: traces[0]?.column
|
|
8418
|
+
},
|
|
8419
|
+
file: item.name,
|
|
8420
|
+
test: test2.type === "test" ? test2.name : void 0,
|
|
8421
|
+
diff: error.showDiff && error.diff ? error.diff : void 0,
|
|
8422
|
+
type: error.name,
|
|
8423
|
+
message: error.message
|
|
8424
|
+
};
|
|
8425
|
+
});
|
|
8417
8426
|
}).flat();
|
|
8418
8427
|
this.events.finished?.({ errors, passed, failed, logs: this.logs });
|
|
8419
8428
|
}
|
|
@@ -8470,6 +8479,10 @@ var startTest = async (props) => {
|
|
|
8470
8479
|
exclude: ["**/_*", "**/_*/**", ...configDefaults.exclude],
|
|
8471
8480
|
globals: true,
|
|
8472
8481
|
reporters: props.reporter,
|
|
8482
|
+
// typecheck: {
|
|
8483
|
+
// checker: 'tsc',
|
|
8484
|
+
// enabled: true,
|
|
8485
|
+
// },
|
|
8473
8486
|
setupFiles: [
|
|
8474
8487
|
//
|
|
8475
8488
|
join18(__dirname4, "test-global-setup.js")
|
|
@@ -8534,6 +8547,19 @@ var logTestLogs = (event) => {
|
|
|
8534
8547
|
log15.message(event.logs.map((log26) => wrap(log26, { hard: true })).join("\n"));
|
|
8535
8548
|
}
|
|
8536
8549
|
};
|
|
8550
|
+
var formatFileName = (error) => {
|
|
8551
|
+
const name = [error.file];
|
|
8552
|
+
const loc = error.location;
|
|
8553
|
+
if (loc) {
|
|
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
|
+
}
|
|
8561
|
+
return name.join("");
|
|
8562
|
+
};
|
|
8537
8563
|
var logTestErrors = (event) => {
|
|
8538
8564
|
event.errors.forEach((error, i) => {
|
|
8539
8565
|
const [message, ...comment] = error.message.split("//");
|
|
@@ -8548,9 +8574,10 @@ var logTestErrors = (event) => {
|
|
|
8548
8574
|
color.error.inverse.bold(` FAIL `),
|
|
8549
8575
|
color.dim(`(${i + 1}/${event.errors.length})`),
|
|
8550
8576
|
color.dim(icon.arrow.right),
|
|
8551
|
-
error
|
|
8577
|
+
formatFileName(error),
|
|
8552
8578
|
color.dim(icon.arrow.right),
|
|
8553
|
-
|
|
8579
|
+
// `\n${color.label.inverse.bold(` TEST `)}`,
|
|
8580
|
+
color.dim(error.test),
|
|
8554
8581
|
[`
|
|
8555
8582
|
|
|
8556
8583
|
`, 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.555",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -34,22 +34,22 @@
|
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@awsless/big-float": "^0.1.3",
|
|
37
|
-
"@awsless/
|
|
37
|
+
"@awsless/cloudwatch": "^0.0.1",
|
|
38
|
+
"@awsless/clui": "^0.0.7",
|
|
38
39
|
"@awsless/duration": "^0.0.3",
|
|
39
|
-
"@awsless/dynamodb": "^0.2.6",
|
|
40
|
-
"@awsless/lambda": "^0.0.33",
|
|
41
|
-
"@awsless/open-search": "^0.0.21",
|
|
42
40
|
"@awsless/json": "^0.0.10",
|
|
43
|
-
"@awsless/
|
|
44
|
-
"@awsless/
|
|
45
|
-
"@awsless/
|
|
46
|
-
"@awsless/
|
|
41
|
+
"@awsless/dynamodb": "^0.2.7",
|
|
42
|
+
"@awsless/iot": "^0.0.3",
|
|
43
|
+
"@awsless/open-search": "^0.0.21",
|
|
44
|
+
"@awsless/mqtt": "^0.0.2",
|
|
45
|
+
"@awsless/redis": "^0.0.14",
|
|
47
46
|
"@awsless/sns": "^0.0.10",
|
|
47
|
+
"@awsless/s3": "^0.0.21",
|
|
48
|
+
"@awsless/sqs": "^0.0.8",
|
|
48
49
|
"@awsless/ssm": "^0.0.7",
|
|
49
|
-
"@awsless/
|
|
50
|
-
"@awsless/
|
|
51
|
-
"@awsless/
|
|
52
|
-
"@awsless/mqtt": "^0.0.2"
|
|
50
|
+
"@awsless/lambda": "^0.0.33",
|
|
51
|
+
"@awsless/validate": "^0.0.19",
|
|
52
|
+
"@awsless/weak-cache": "^0.0.1"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@arcanyx/cidr-slicer": "^0.3.0",
|
|
@@ -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/duration": "^0.0.3",
|
|
136
136
|
"@awsless/big-float": "^0.1.3",
|
|
137
|
+
"@awsless/cloudwatch": "^0.0.1",
|
|
138
|
+
"@awsless/clui": "^0.0.7",
|
|
137
139
|
"@awsless/formation": "^0.0.79",
|
|
138
|
-
"@awsless/
|
|
140
|
+
"@awsless/duration": "^0.0.3",
|
|
139
141
|
"@awsless/graphql": "^0.0.9",
|
|
140
|
-
"@awsless/json": "^0.0.10",
|
|
141
142
|
"@awsless/size": "^0.0.2",
|
|
142
|
-
"@awsless/ts-file-cache": "^0.0.12",
|
|
143
|
-
"@awsless/cloudwatch": "^0.0.1",
|
|
144
143
|
"@awsless/validate": "^0.0.19",
|
|
145
|
-
"@awsless/
|
|
144
|
+
"@awsless/ts-file-cache": "^0.0.12",
|
|
145
|
+
"@awsless/scheduler": "^0.0.4",
|
|
146
|
+
"@awsless/json": "^0.0.10"
|
|
146
147
|
},
|
|
147
148
|
"devDependencies": {
|
|
148
149
|
"@node-rs/bcrypt": "^1.10.5",
|