@awsless/cli 0.0.46-next.2 → 0.0.46-next.21
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/app.json +1 -1
- package/dist/app.stage.json +1 -1
- package/dist/bin.js +134740 -12057
- package/dist/handlers/{bundle.mjs → bundle.js} +50 -43
- package/dist/handlers/icon.js +33391 -0
- package/dist/handlers/{image.mjs → image.js} +2 -2
- package/dist/handlers/{on-error-log.mjs → on-error-log.js} +2 -2
- package/dist/handlers/pubsub-publisher.js +9987 -0
- package/dist/handlers/{pubsub-server.mjs → pubsub-server.js} +31772 -37941
- package/dist/handlers/{rpc.mjs → rpc.js} +50 -14
- package/dist/prebuild/on-failure/HASH +1 -0
- package/dist/prebuild/on-failure/bundle.zip +0 -0
- package/dist/prebuild/sandbox-proxy/HASH +1 -0
- package/dist/prebuild/sandbox-proxy/bundle.zip +0 -0
- package/dist/stack.json +1 -1
- package/dist/stack.stage.json +1 -1
- package/dist/test-global-setup.js +1 -1
- package/package.json +38 -32
- package/README.MD +0 -487
- package/dist/bin.d.ts +0 -1
- package/dist/build-json-schema.js +0 -1963
- package/dist/handlers/icon.mjs +0 -104
- package/dist/handlers/on-failure.mjs +0 -216
- package/dist/handlers/pubsub-publisher.mjs +0 -43
|
@@ -1,13 +1,57 @@
|
|
|
1
1
|
// src/feature/rpc/server/handle.ts
|
|
2
2
|
import { ExpectedError, ViewableError } from "@awsless/lambda";
|
|
3
|
-
import {
|
|
3
|
+
import { internalInvoke as internalInvoke2 } from "awsless";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
|
|
6
6
|
// src/feature/rpc/server/auth.ts
|
|
7
7
|
import { toSeconds } from "@awsless/duration";
|
|
8
8
|
import { WeakCache } from "@awsless/weak-cache";
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
// ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constants.js
|
|
11
|
+
var daysInYear = 365.2425;
|
|
12
|
+
var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;
|
|
13
|
+
var minTime = -maxTime;
|
|
14
|
+
var secondsInHour = 3600;
|
|
15
|
+
var secondsInDay = secondsInHour * 24;
|
|
16
|
+
var secondsInWeek = secondsInDay * 7;
|
|
17
|
+
var secondsInYear = secondsInDay * daysInYear;
|
|
18
|
+
var secondsInMonth = secondsInYear / 12;
|
|
19
|
+
var secondsInQuarter = secondsInMonth * 3;
|
|
20
|
+
var constructFromSymbol = Symbol.for("constructDateFrom");
|
|
21
|
+
|
|
22
|
+
// ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constructFrom.js
|
|
23
|
+
function constructFrom(date, value) {
|
|
24
|
+
if (typeof date === "function")
|
|
25
|
+
return date(value);
|
|
26
|
+
if (date && typeof date === "object" && constructFromSymbol in date)
|
|
27
|
+
return date[constructFromSymbol](value);
|
|
28
|
+
if (date instanceof Date)
|
|
29
|
+
return new date.constructor(value);
|
|
30
|
+
return new Date(value);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/toDate.js
|
|
34
|
+
function toDate(argument, context) {
|
|
35
|
+
return constructFrom(context || argument, argument);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addMilliseconds.js
|
|
39
|
+
function addMilliseconds(date, amount, options) {
|
|
40
|
+
return constructFrom(options?.in || date, +toDate(date) + amount);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addSeconds.js
|
|
44
|
+
function addSeconds(date, amount, options) {
|
|
45
|
+
return addMilliseconds(date, amount * 1000, options);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isFuture.js
|
|
49
|
+
function isFuture(date) {
|
|
50
|
+
return +toDate(date) > Date.now();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// src/feature/rpc/server/auth.ts
|
|
54
|
+
import { getRouteEnv, internalInvoke } from "awsless";
|
|
11
55
|
|
|
12
56
|
// src/feature/rpc/server/validate.ts
|
|
13
57
|
import {
|
|
@@ -91,7 +135,7 @@ var authenticate = async (token) => {
|
|
|
91
135
|
}
|
|
92
136
|
let response;
|
|
93
137
|
try {
|
|
94
|
-
response = await
|
|
138
|
+
response = await internalInvoke(authRoute, { token });
|
|
95
139
|
} catch (error) {
|
|
96
140
|
console.error(error);
|
|
97
141
|
return {
|
|
@@ -229,7 +273,6 @@ var invokeInternalFunction = (name, payload, auth) => {
|
|
|
229
273
|
|
|
230
274
|
// src/feature/rpc/server/lock.ts
|
|
231
275
|
import { ConditionalCheckFailedException, deleteItem, updateItem } from "@awsless/dynamodb";
|
|
232
|
-
import { addSeconds as addSeconds2 } from "date-fns";
|
|
233
276
|
import { getRouteEnv as getRouteEnv4 } from "awsless";
|
|
234
277
|
|
|
235
278
|
// src/feature/rpc/server/table.ts
|
|
@@ -250,7 +293,7 @@ var getLockTable = () => {
|
|
|
250
293
|
var lockRequest = async (requestId, key) => {
|
|
251
294
|
const timeout = parseInt(getRouteEnv4("TIMEOUT") ?? "60", 10);
|
|
252
295
|
const now = new Date;
|
|
253
|
-
const ttl2 =
|
|
296
|
+
const ttl2 = addSeconds(now, timeout * 2);
|
|
254
297
|
try {
|
|
255
298
|
await updateItem(getLockTable(), { key }, {
|
|
256
299
|
update: (e) => [
|
|
@@ -389,13 +432,6 @@ var handle_default = async (event) => {
|
|
|
389
432
|
if (!auth.authorized) {
|
|
390
433
|
return response(405, UNAUTHORIZED(auth.reason));
|
|
391
434
|
}
|
|
392
|
-
console.log({
|
|
393
|
-
requestId,
|
|
394
|
-
lockKey: auth.lockKey,
|
|
395
|
-
authContext: auth.context,
|
|
396
|
-
request: request.output.body,
|
|
397
|
-
ip: request.output.requestContext.http.sourceIp
|
|
398
|
-
});
|
|
399
435
|
const calls = request.output.body.map((fn) => {
|
|
400
436
|
return {
|
|
401
437
|
...fn,
|
|
@@ -427,7 +463,7 @@ var handle_default = async (event) => {
|
|
|
427
463
|
}
|
|
428
464
|
let data;
|
|
429
465
|
try {
|
|
430
|
-
data = await
|
|
466
|
+
data = await internalInvoke2(fn.details.name, {
|
|
431
467
|
...fn.payload ?? {},
|
|
432
468
|
...auth.context ?? {},
|
|
433
469
|
viewer: buildViewerPayload(request.output)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d0394e205fdedf5d8ab1359a0a44f90b7462a3ca
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
e0969c65ac76ce3dc636979c07087813b7e73820
|
|
Binary file
|