@awsless/cli 0.0.43 → 0.0.44

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 CHANGED
@@ -9286,14 +9286,37 @@ async function findRoute(path, method) {
9286
9286
  const keys = getPossibleRouteKeys(path);
9287
9287
 
9288
9288
  for(const i in keys) {
9289
+ const key = keys[i];
9290
+ let value;
9291
+
9289
9292
  try {
9290
- const value = await store.get(keys[i], { format: 'json' });
9291
- const result = matchRoute(value, path, method);
9293
+ value = await store.get(key, { format: 'json' });
9294
+ } catch (e) {
9295
+ continue;
9296
+ }
9292
9297
 
9293
- if(result) {
9294
- return result;
9298
+ // Route lists that are too big for a single key value pair
9299
+ // are sharded over multiple entries behind a route index.
9300
+ if(value && value.list) {
9301
+ for(let n = 0; n < value.list; n++) {
9302
+ try {
9303
+ const route = await store.get(key + '#' + n, { format: 'json' });
9304
+ const result = matchRoute(route, path, method);
9305
+
9306
+ if(result) {
9307
+ return result;
9308
+ }
9309
+ } catch (e) {}
9295
9310
  }
9296
- } catch (e) {}
9311
+
9312
+ continue;
9313
+ }
9314
+
9315
+ const result = matchRoute(value, path, method);
9316
+
9317
+ if(result) {
9318
+ return result;
9319
+ }
9297
9320
  }
9298
9321
  }
9299
9322
 
@@ -9447,6 +9470,32 @@ async function handler(event) {
9447
9470
 
9448
9471
  // src/feature/router/index.ts
9449
9472
  import { createHash as createHash8 } from "crypto";
9473
+
9474
+ // src/feature/router/route.ts
9475
+ var MAX_VALUE_SIZE = 1e3;
9476
+ var createRouteStoreEntries = (routes) => {
9477
+ const entries = [];
9478
+ for (const [key, value] of Object.entries(routes)) {
9479
+ const json = JSON.stringify(value);
9480
+ if (Array.isArray(value) && Buffer.byteLength(json, "utf8") > MAX_VALUE_SIZE) {
9481
+ entries.push({
9482
+ key,
9483
+ value: JSON.stringify({ list: value.length })
9484
+ });
9485
+ value.forEach((route, index) => {
9486
+ entries.push({
9487
+ key: `${key}#${index}`,
9488
+ value: JSON.stringify(route)
9489
+ });
9490
+ });
9491
+ } else {
9492
+ entries.push({ key, value: json });
9493
+ }
9494
+ }
9495
+ return entries;
9496
+ };
9497
+
9498
+ // src/feature/router/index.ts
9450
9499
  var routerFeature = defineFeature({
9451
9500
  name: "router",
9452
9501
  onApp(ctx) {
@@ -9476,9 +9525,7 @@ var routerFeature = defineFeature({
9476
9525
  {
9477
9526
  kvsArn: routeStore.arn,
9478
9527
  keys: $resolve([routes], (routes2) => {
9479
- return Object.entries(routes2).map(([key, value]) => {
9480
- return { key, value: JSON.stringify(value) };
9481
- });
9528
+ return createRouteStoreEntries(routes2);
9482
9529
  })
9483
9530
  },
9484
9531
  {
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/cli",
3
- "version": "0.0.43",
3
+ "version": "0.0.44",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -89,19 +89,19 @@
89
89
  "zod": "^3.24.2",
90
90
  "zod-to-json-schema": "^3.24.3",
91
91
  "@awsless/big-float": "^0.1.7",
92
- "@awsless/duration": "^0.0.4",
93
92
  "@awsless/dynamodb": "^0.3.22",
94
- "@awsless/cloudwatch": "^0.0.1",
93
+ "@awsless/duration": "^0.0.4",
95
94
  "@awsless/json": "^0.0.11",
96
- "@awsless/size": "^0.0.2",
97
- "@awsless/s3": "^0.0.21",
98
- "@awsless/scheduler": "^0.0.4",
99
95
  "@awsless/lambda": "^0.0.44",
96
+ "@awsless/redis": "^0.1.13",
97
+ "@awsless/s3": "^0.0.21",
98
+ "@awsless/cloudwatch": "^0.0.1",
99
+ "@awsless/size": "^0.0.2",
100
100
  "@awsless/sns": "^0.0.10",
101
101
  "@awsless/clui": "^0.0.8",
102
+ "@awsless/scheduler": "^0.0.4",
102
103
  "@awsless/validate": "^0.1.7",
103
104
  "@awsless/weak-cache": "^0.0.1",
104
- "@awsless/redis": "^0.1.13",
105
105
  "awsless": "^0.0.14",
106
106
  "@awsless/iot": "^0.0.5",
107
107
  "@awsless/ts-file-cache": "^0.0.16",