@awsless/awsless 0.0.433 → 0.0.435
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 +120 -121
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/package.json +7 -7
package/dist/bin.js
CHANGED
|
@@ -88,17 +88,17 @@ var require_visit = __commonJS({
|
|
|
88
88
|
visit.BREAK = BREAK;
|
|
89
89
|
visit.SKIP = SKIP;
|
|
90
90
|
visit.REMOVE = REMOVE;
|
|
91
|
-
function visit_(key, node, visitor,
|
|
92
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
91
|
+
function visit_(key, node, visitor, path) {
|
|
92
|
+
const ctrl = callVisitor(key, node, visitor, path);
|
|
93
93
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
94
|
-
replaceNode(key,
|
|
95
|
-
return visit_(key, ctrl, visitor,
|
|
94
|
+
replaceNode(key, path, ctrl);
|
|
95
|
+
return visit_(key, ctrl, visitor, path);
|
|
96
96
|
}
|
|
97
97
|
if (typeof ctrl !== "symbol") {
|
|
98
98
|
if (identity.isCollection(node)) {
|
|
99
|
-
|
|
99
|
+
path = Object.freeze(path.concat(node));
|
|
100
100
|
for (let i = 0; i < node.items.length; ++i) {
|
|
101
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
101
|
+
const ci = visit_(i, node.items[i], visitor, path);
|
|
102
102
|
if (typeof ci === "number")
|
|
103
103
|
i = ci - 1;
|
|
104
104
|
else if (ci === BREAK)
|
|
@@ -109,13 +109,13 @@ var require_visit = __commonJS({
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
} else if (identity.isPair(node)) {
|
|
112
|
-
|
|
113
|
-
const ck = visit_("key", node.key, visitor,
|
|
112
|
+
path = Object.freeze(path.concat(node));
|
|
113
|
+
const ck = visit_("key", node.key, visitor, path);
|
|
114
114
|
if (ck === BREAK)
|
|
115
115
|
return BREAK;
|
|
116
116
|
else if (ck === REMOVE)
|
|
117
117
|
node.key = null;
|
|
118
|
-
const cv = visit_("value", node.value, visitor,
|
|
118
|
+
const cv = visit_("value", node.value, visitor, path);
|
|
119
119
|
if (cv === BREAK)
|
|
120
120
|
return BREAK;
|
|
121
121
|
else if (cv === REMOVE)
|
|
@@ -136,17 +136,17 @@ var require_visit = __commonJS({
|
|
|
136
136
|
visitAsync.BREAK = BREAK;
|
|
137
137
|
visitAsync.SKIP = SKIP;
|
|
138
138
|
visitAsync.REMOVE = REMOVE;
|
|
139
|
-
async function visitAsync_(key, node, visitor,
|
|
140
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
139
|
+
async function visitAsync_(key, node, visitor, path) {
|
|
140
|
+
const ctrl = await callVisitor(key, node, visitor, path);
|
|
141
141
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
142
|
-
replaceNode(key,
|
|
143
|
-
return visitAsync_(key, ctrl, visitor,
|
|
142
|
+
replaceNode(key, path, ctrl);
|
|
143
|
+
return visitAsync_(key, ctrl, visitor, path);
|
|
144
144
|
}
|
|
145
145
|
if (typeof ctrl !== "symbol") {
|
|
146
146
|
if (identity.isCollection(node)) {
|
|
147
|
-
|
|
147
|
+
path = Object.freeze(path.concat(node));
|
|
148
148
|
for (let i = 0; i < node.items.length; ++i) {
|
|
149
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
149
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path);
|
|
150
150
|
if (typeof ci === "number")
|
|
151
151
|
i = ci - 1;
|
|
152
152
|
else if (ci === BREAK)
|
|
@@ -157,13 +157,13 @@ var require_visit = __commonJS({
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
} else if (identity.isPair(node)) {
|
|
160
|
-
|
|
161
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
160
|
+
path = Object.freeze(path.concat(node));
|
|
161
|
+
const ck = await visitAsync_("key", node.key, visitor, path);
|
|
162
162
|
if (ck === BREAK)
|
|
163
163
|
return BREAK;
|
|
164
164
|
else if (ck === REMOVE)
|
|
165
165
|
node.key = null;
|
|
166
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
166
|
+
const cv = await visitAsync_("value", node.value, visitor, path);
|
|
167
167
|
if (cv === BREAK)
|
|
168
168
|
return BREAK;
|
|
169
169
|
else if (cv === REMOVE)
|
|
@@ -190,23 +190,23 @@ var require_visit = __commonJS({
|
|
|
190
190
|
}
|
|
191
191
|
return visitor;
|
|
192
192
|
}
|
|
193
|
-
function callVisitor(key, node, visitor,
|
|
193
|
+
function callVisitor(key, node, visitor, path) {
|
|
194
194
|
if (typeof visitor === "function")
|
|
195
|
-
return visitor(key, node,
|
|
195
|
+
return visitor(key, node, path);
|
|
196
196
|
if (identity.isMap(node))
|
|
197
|
-
return visitor.Map?.(key, node,
|
|
197
|
+
return visitor.Map?.(key, node, path);
|
|
198
198
|
if (identity.isSeq(node))
|
|
199
|
-
return visitor.Seq?.(key, node,
|
|
199
|
+
return visitor.Seq?.(key, node, path);
|
|
200
200
|
if (identity.isPair(node))
|
|
201
|
-
return visitor.Pair?.(key, node,
|
|
201
|
+
return visitor.Pair?.(key, node, path);
|
|
202
202
|
if (identity.isScalar(node))
|
|
203
|
-
return visitor.Scalar?.(key, node,
|
|
203
|
+
return visitor.Scalar?.(key, node, path);
|
|
204
204
|
if (identity.isAlias(node))
|
|
205
|
-
return visitor.Alias?.(key, node,
|
|
205
|
+
return visitor.Alias?.(key, node, path);
|
|
206
206
|
return void 0;
|
|
207
207
|
}
|
|
208
|
-
function replaceNode(key,
|
|
209
|
-
const parent =
|
|
208
|
+
function replaceNode(key, path, node) {
|
|
209
|
+
const parent = path[path.length - 1];
|
|
210
210
|
if (identity.isCollection(parent)) {
|
|
211
211
|
parent.items[key] = node;
|
|
212
212
|
} else if (identity.isPair(parent)) {
|
|
@@ -804,10 +804,10 @@ var require_Collection = __commonJS({
|
|
|
804
804
|
var createNode = require_createNode();
|
|
805
805
|
var identity = require_identity();
|
|
806
806
|
var Node27 = require_Node();
|
|
807
|
-
function collectionFromPath(schema,
|
|
807
|
+
function collectionFromPath(schema, path, value) {
|
|
808
808
|
let v = value;
|
|
809
|
-
for (let i =
|
|
810
|
-
const k =
|
|
809
|
+
for (let i = path.length - 1; i >= 0; --i) {
|
|
810
|
+
const k = path[i];
|
|
811
811
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
812
812
|
const a = [];
|
|
813
813
|
a[k] = v;
|
|
@@ -826,7 +826,7 @@ var require_Collection = __commonJS({
|
|
|
826
826
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
827
827
|
});
|
|
828
828
|
}
|
|
829
|
-
var isEmptyPath = (
|
|
829
|
+
var isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
|
|
830
830
|
var Collection = class extends Node27.NodeBase {
|
|
831
831
|
constructor(type, schema) {
|
|
832
832
|
super(type);
|
|
@@ -856,11 +856,11 @@ var require_Collection = __commonJS({
|
|
|
856
856
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
857
857
|
* that already exists in the map.
|
|
858
858
|
*/
|
|
859
|
-
addIn(
|
|
860
|
-
if (isEmptyPath(
|
|
859
|
+
addIn(path, value) {
|
|
860
|
+
if (isEmptyPath(path))
|
|
861
861
|
this.add(value);
|
|
862
862
|
else {
|
|
863
|
-
const [key, ...rest] =
|
|
863
|
+
const [key, ...rest] = path;
|
|
864
864
|
const node = this.get(key, true);
|
|
865
865
|
if (identity.isCollection(node))
|
|
866
866
|
node.addIn(rest, value);
|
|
@@ -874,8 +874,8 @@ var require_Collection = __commonJS({
|
|
|
874
874
|
* Removes a value from the collection.
|
|
875
875
|
* @returns `true` if the item was found and removed.
|
|
876
876
|
*/
|
|
877
|
-
deleteIn(
|
|
878
|
-
const [key, ...rest] =
|
|
877
|
+
deleteIn(path) {
|
|
878
|
+
const [key, ...rest] = path;
|
|
879
879
|
if (rest.length === 0)
|
|
880
880
|
return this.delete(key);
|
|
881
881
|
const node = this.get(key, true);
|
|
@@ -889,8 +889,8 @@ var require_Collection = __commonJS({
|
|
|
889
889
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
890
890
|
* `true` (collections are always returned intact).
|
|
891
891
|
*/
|
|
892
|
-
getIn(
|
|
893
|
-
const [key, ...rest] =
|
|
892
|
+
getIn(path, keepScalar) {
|
|
893
|
+
const [key, ...rest] = path;
|
|
894
894
|
const node = this.get(key, true);
|
|
895
895
|
if (rest.length === 0)
|
|
896
896
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -908,8 +908,8 @@ var require_Collection = __commonJS({
|
|
|
908
908
|
/**
|
|
909
909
|
* Checks if the collection includes a value with the key `key`.
|
|
910
910
|
*/
|
|
911
|
-
hasIn(
|
|
912
|
-
const [key, ...rest] =
|
|
911
|
+
hasIn(path) {
|
|
912
|
+
const [key, ...rest] = path;
|
|
913
913
|
if (rest.length === 0)
|
|
914
914
|
return this.has(key);
|
|
915
915
|
const node = this.get(key, true);
|
|
@@ -919,8 +919,8 @@ var require_Collection = __commonJS({
|
|
|
919
919
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
920
920
|
* boolean to add/remove the item from the set.
|
|
921
921
|
*/
|
|
922
|
-
setIn(
|
|
923
|
-
const [key, ...rest] =
|
|
922
|
+
setIn(path, value) {
|
|
923
|
+
const [key, ...rest] = path;
|
|
924
924
|
if (rest.length === 0) {
|
|
925
925
|
this.set(key, value);
|
|
926
926
|
} else {
|
|
@@ -3369,9 +3369,9 @@ var require_Document = __commonJS({
|
|
|
3369
3369
|
this.contents.add(value);
|
|
3370
3370
|
}
|
|
3371
3371
|
/** Adds a value to the document. */
|
|
3372
|
-
addIn(
|
|
3372
|
+
addIn(path, value) {
|
|
3373
3373
|
if (assertCollection(this.contents))
|
|
3374
|
-
this.contents.addIn(
|
|
3374
|
+
this.contents.addIn(path, value);
|
|
3375
3375
|
}
|
|
3376
3376
|
/**
|
|
3377
3377
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3446,14 +3446,14 @@ var require_Document = __commonJS({
|
|
|
3446
3446
|
* Removes a value from the document.
|
|
3447
3447
|
* @returns `true` if the item was found and removed.
|
|
3448
3448
|
*/
|
|
3449
|
-
deleteIn(
|
|
3450
|
-
if (Collection.isEmptyPath(
|
|
3449
|
+
deleteIn(path) {
|
|
3450
|
+
if (Collection.isEmptyPath(path)) {
|
|
3451
3451
|
if (this.contents == null)
|
|
3452
3452
|
return false;
|
|
3453
3453
|
this.contents = null;
|
|
3454
3454
|
return true;
|
|
3455
3455
|
}
|
|
3456
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3456
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path) : false;
|
|
3457
3457
|
}
|
|
3458
3458
|
/**
|
|
3459
3459
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3468,10 +3468,10 @@ var require_Document = __commonJS({
|
|
|
3468
3468
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3469
3469
|
* `true` (collections are always returned intact).
|
|
3470
3470
|
*/
|
|
3471
|
-
getIn(
|
|
3472
|
-
if (Collection.isEmptyPath(
|
|
3471
|
+
getIn(path, keepScalar) {
|
|
3472
|
+
if (Collection.isEmptyPath(path))
|
|
3473
3473
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3474
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
3474
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path, keepScalar) : void 0;
|
|
3475
3475
|
}
|
|
3476
3476
|
/**
|
|
3477
3477
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3482,10 +3482,10 @@ var require_Document = __commonJS({
|
|
|
3482
3482
|
/**
|
|
3483
3483
|
* Checks if the document includes a value at `path`.
|
|
3484
3484
|
*/
|
|
3485
|
-
hasIn(
|
|
3486
|
-
if (Collection.isEmptyPath(
|
|
3485
|
+
hasIn(path) {
|
|
3486
|
+
if (Collection.isEmptyPath(path))
|
|
3487
3487
|
return this.contents !== void 0;
|
|
3488
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
3488
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path) : false;
|
|
3489
3489
|
}
|
|
3490
3490
|
/**
|
|
3491
3491
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3502,13 +3502,13 @@ var require_Document = __commonJS({
|
|
|
3502
3502
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3503
3503
|
* boolean to add/remove the item from the set.
|
|
3504
3504
|
*/
|
|
3505
|
-
setIn(
|
|
3506
|
-
if (Collection.isEmptyPath(
|
|
3505
|
+
setIn(path, value) {
|
|
3506
|
+
if (Collection.isEmptyPath(path)) {
|
|
3507
3507
|
this.contents = value;
|
|
3508
3508
|
} else if (this.contents == null) {
|
|
3509
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
3509
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path), value);
|
|
3510
3510
|
} else if (assertCollection(this.contents)) {
|
|
3511
|
-
this.contents.setIn(
|
|
3511
|
+
this.contents.setIn(path, value);
|
|
3512
3512
|
}
|
|
3513
3513
|
}
|
|
3514
3514
|
/**
|
|
@@ -5437,9 +5437,9 @@ var require_cst_visit = __commonJS({
|
|
|
5437
5437
|
visit.BREAK = BREAK;
|
|
5438
5438
|
visit.SKIP = SKIP;
|
|
5439
5439
|
visit.REMOVE = REMOVE;
|
|
5440
|
-
visit.itemAtPath = (cst,
|
|
5440
|
+
visit.itemAtPath = (cst, path) => {
|
|
5441
5441
|
let item = cst;
|
|
5442
|
-
for (const [field, index] of
|
|
5442
|
+
for (const [field, index] of path) {
|
|
5443
5443
|
const tok = item?.[field];
|
|
5444
5444
|
if (tok && "items" in tok) {
|
|
5445
5445
|
item = tok.items[index];
|
|
@@ -5448,23 +5448,23 @@ var require_cst_visit = __commonJS({
|
|
|
5448
5448
|
}
|
|
5449
5449
|
return item;
|
|
5450
5450
|
};
|
|
5451
|
-
visit.parentCollection = (cst,
|
|
5452
|
-
const parent = visit.itemAtPath(cst,
|
|
5453
|
-
const field =
|
|
5451
|
+
visit.parentCollection = (cst, path) => {
|
|
5452
|
+
const parent = visit.itemAtPath(cst, path.slice(0, -1));
|
|
5453
|
+
const field = path[path.length - 1][0];
|
|
5454
5454
|
const coll = parent?.[field];
|
|
5455
5455
|
if (coll && "items" in coll)
|
|
5456
5456
|
return coll;
|
|
5457
5457
|
throw new Error("Parent collection not found");
|
|
5458
5458
|
};
|
|
5459
|
-
function _visit(
|
|
5460
|
-
let ctrl = visitor(item,
|
|
5459
|
+
function _visit(path, item, visitor) {
|
|
5460
|
+
let ctrl = visitor(item, path);
|
|
5461
5461
|
if (typeof ctrl === "symbol")
|
|
5462
5462
|
return ctrl;
|
|
5463
5463
|
for (const field of ["key", "value"]) {
|
|
5464
5464
|
const token = item[field];
|
|
5465
5465
|
if (token && "items" in token) {
|
|
5466
5466
|
for (let i = 0; i < token.items.length; ++i) {
|
|
5467
|
-
const ci = _visit(Object.freeze(
|
|
5467
|
+
const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);
|
|
5468
5468
|
if (typeof ci === "number")
|
|
5469
5469
|
i = ci - 1;
|
|
5470
5470
|
else if (ci === BREAK)
|
|
@@ -5475,10 +5475,10 @@ var require_cst_visit = __commonJS({
|
|
|
5475
5475
|
}
|
|
5476
5476
|
}
|
|
5477
5477
|
if (typeof ctrl === "function" && field === "key")
|
|
5478
|
-
ctrl = ctrl(item,
|
|
5478
|
+
ctrl = ctrl(item, path);
|
|
5479
5479
|
}
|
|
5480
5480
|
}
|
|
5481
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5481
|
+
return typeof ctrl === "function" ? ctrl(item, path) : ctrl;
|
|
5482
5482
|
}
|
|
5483
5483
|
exports.visit = visit;
|
|
5484
5484
|
}
|
|
@@ -7262,21 +7262,21 @@ var directories = {
|
|
|
7262
7262
|
return join(this.output, "test");
|
|
7263
7263
|
}
|
|
7264
7264
|
};
|
|
7265
|
-
var setRoot = (
|
|
7266
|
-
directories.root =
|
|
7265
|
+
var setRoot = (path = root) => {
|
|
7266
|
+
directories.root = path;
|
|
7267
7267
|
};
|
|
7268
|
-
var findRootDir = async (
|
|
7268
|
+
var findRootDir = async (path, configFiles, level = 5) => {
|
|
7269
7269
|
if (!level) {
|
|
7270
7270
|
throw new TypeError("No awsless project found");
|
|
7271
7271
|
}
|
|
7272
7272
|
for (const configFile of configFiles) {
|
|
7273
|
-
const file = join(
|
|
7273
|
+
const file = join(path, configFile);
|
|
7274
7274
|
const exists = await fileExist(file);
|
|
7275
7275
|
if (exists) {
|
|
7276
|
-
return [file,
|
|
7276
|
+
return [file, path];
|
|
7277
7277
|
}
|
|
7278
7278
|
}
|
|
7279
|
-
return findRootDir(normalize(join(
|
|
7279
|
+
return findRootDir(normalize(join(path, "..")), configFiles, level - 1);
|
|
7280
7280
|
};
|
|
7281
7281
|
var fileExist = async (file) => {
|
|
7282
7282
|
try {
|
|
@@ -7620,18 +7620,18 @@ import { stat } from "fs/promises";
|
|
|
7620
7620
|
import { join as join3 } from "path";
|
|
7621
7621
|
import { z as z5 } from "zod";
|
|
7622
7622
|
var basePath;
|
|
7623
|
-
var setLocalBasePath = (
|
|
7624
|
-
basePath =
|
|
7623
|
+
var setLocalBasePath = (path) => {
|
|
7624
|
+
basePath = path;
|
|
7625
7625
|
};
|
|
7626
|
-
var resolvePath = (
|
|
7627
|
-
if (
|
|
7628
|
-
return join3(basePath,
|
|
7626
|
+
var resolvePath = (path) => {
|
|
7627
|
+
if (path.startsWith(".") && basePath) {
|
|
7628
|
+
return join3(basePath, path);
|
|
7629
7629
|
}
|
|
7630
|
-
return join3(directories.root,
|
|
7630
|
+
return join3(directories.root, path);
|
|
7631
7631
|
};
|
|
7632
|
-
var LocalFileSchema = z5.string().transform((
|
|
7632
|
+
var LocalFileSchema = z5.string().transform((path) => resolvePath(path)).refine(async (path) => {
|
|
7633
7633
|
try {
|
|
7634
|
-
const s = await stat(
|
|
7634
|
+
const s = await stat(path);
|
|
7635
7635
|
return s.isFile();
|
|
7636
7636
|
} catch (error) {
|
|
7637
7637
|
return false;
|
|
@@ -7950,9 +7950,9 @@ import { z as z13 } from "zod";
|
|
|
7950
7950
|
// src/config/schema/local-directory.ts
|
|
7951
7951
|
import { stat as stat2 } from "fs/promises";
|
|
7952
7952
|
import { z as z12 } from "zod";
|
|
7953
|
-
var LocalDirectorySchema = z12.string().transform((
|
|
7953
|
+
var LocalDirectorySchema = z12.string().transform((path) => resolvePath(path)).refine(async (path) => {
|
|
7954
7954
|
try {
|
|
7955
|
-
const s = await stat2(
|
|
7955
|
+
const s = await stat2(path);
|
|
7956
7956
|
return s.isDirectory();
|
|
7957
7957
|
} catch (error) {
|
|
7958
7958
|
return false;
|
|
@@ -8898,8 +8898,8 @@ var TypeFile = class {
|
|
|
8898
8898
|
codes = /* @__PURE__ */ new Set();
|
|
8899
8899
|
interfaces = /* @__PURE__ */ new Map();
|
|
8900
8900
|
imports = /* @__PURE__ */ new Map();
|
|
8901
|
-
addImport(varName,
|
|
8902
|
-
this.imports.set(varName,
|
|
8901
|
+
addImport(varName, path) {
|
|
8902
|
+
this.imports.set(varName, path);
|
|
8903
8903
|
return this;
|
|
8904
8904
|
}
|
|
8905
8905
|
addCode(code) {
|
|
@@ -8922,11 +8922,11 @@ var TypeFile = class {
|
|
|
8922
8922
|
lines.push(
|
|
8923
8923
|
...[
|
|
8924
8924
|
"// Imports",
|
|
8925
|
-
...Array.from(this.imports.entries()).map(([varName,
|
|
8925
|
+
...Array.from(this.imports.entries()).map(([varName, path]) => {
|
|
8926
8926
|
if (typeof varName === "string") {
|
|
8927
|
-
return `import ${camelCase(varName)} from '${
|
|
8927
|
+
return `import ${camelCase(varName)} from '${path}'`;
|
|
8928
8928
|
}
|
|
8929
|
-
return `import { ${Object.entries(varName).map(([key, alias]) => `${key} as ${camelCase(alias)}`).join(", ")} } from '${
|
|
8929
|
+
return `import { ${Object.entries(varName).map(([key, alias]) => `${key} as ${camelCase(alias)}`).join(", ")} } from '${path}'`;
|
|
8930
8930
|
}),
|
|
8931
8931
|
""
|
|
8932
8932
|
]
|
|
@@ -10465,10 +10465,10 @@ var build = (type, name, builder, props) => {
|
|
|
10465
10465
|
}
|
|
10466
10466
|
const time = createTimer();
|
|
10467
10467
|
const meta = await callback(async (file, data2) => {
|
|
10468
|
-
const
|
|
10469
|
-
const base2 = dirname5(
|
|
10468
|
+
const path = getBuildPath(type, name, file);
|
|
10469
|
+
const base2 = dirname5(path);
|
|
10470
10470
|
await mkdir2(base2, { recursive: true });
|
|
10471
|
-
await writeFile2(
|
|
10471
|
+
await writeFile2(path, data2);
|
|
10472
10472
|
});
|
|
10473
10473
|
const data = { ...meta, buildTime: time() };
|
|
10474
10474
|
await writeCache(cacheFile, version, data);
|
|
@@ -10603,18 +10603,18 @@ import { hashElement } from "folder-hash";
|
|
|
10603
10603
|
import { mkdir as mkdir3, readdir, rm as rm2 } from "fs/promises";
|
|
10604
10604
|
import { join as join8 } from "path";
|
|
10605
10605
|
var createTempFolder = async (name) => {
|
|
10606
|
-
const
|
|
10606
|
+
const path = join8(directories.temp, name);
|
|
10607
10607
|
await mkdir3(join8(directories.temp, name), { recursive: true });
|
|
10608
10608
|
process.on("SIGTERM", async () => {
|
|
10609
|
-
await rm2(
|
|
10609
|
+
await rm2(path, { recursive: true });
|
|
10610
10610
|
});
|
|
10611
10611
|
return {
|
|
10612
|
-
path
|
|
10612
|
+
path,
|
|
10613
10613
|
async files() {
|
|
10614
|
-
return readdir(
|
|
10614
|
+
return readdir(path, { recursive: true });
|
|
10615
10615
|
},
|
|
10616
10616
|
async delete() {
|
|
10617
|
-
await rm2(
|
|
10617
|
+
await rm2(path, { recursive: true });
|
|
10618
10618
|
}
|
|
10619
10619
|
};
|
|
10620
10620
|
};
|
|
@@ -11177,13 +11177,13 @@ var SsmStore = class {
|
|
|
11177
11177
|
}
|
|
11178
11178
|
async list() {
|
|
11179
11179
|
debug("Load remote config values");
|
|
11180
|
-
const
|
|
11180
|
+
const path = configParameterPrefix(this.props.appConfig.name);
|
|
11181
11181
|
const values = {};
|
|
11182
11182
|
let token;
|
|
11183
11183
|
while (true) {
|
|
11184
11184
|
const result = await this.client.send(
|
|
11185
11185
|
new GetParametersByPathCommand({
|
|
11186
|
-
Path:
|
|
11186
|
+
Path: path,
|
|
11187
11187
|
WithDecryption: true,
|
|
11188
11188
|
MaxResults: 10,
|
|
11189
11189
|
Recursive: true,
|
|
@@ -11893,8 +11893,8 @@ import { camelCase as camelCase4, constantCase as constantCase6 } from "change-c
|
|
|
11893
11893
|
import { relative as relative3 } from "path";
|
|
11894
11894
|
var parseRoute = (route) => {
|
|
11895
11895
|
const [method, ...paths] = route.split(" ");
|
|
11896
|
-
const
|
|
11897
|
-
return { method, path
|
|
11896
|
+
const path = paths.join(" ");
|
|
11897
|
+
return { method, path };
|
|
11898
11898
|
};
|
|
11899
11899
|
var strToInt = (str) => {
|
|
11900
11900
|
return parseInt(Buffer.from(str, "utf8").toString("hex"), 16);
|
|
@@ -11915,12 +11915,12 @@ var httpFeature = defineFeature({
|
|
|
11915
11915
|
for (const [id, routes] of Object.entries(stack.http ?? {})) {
|
|
11916
11916
|
if (!(id in api)) api[id] = {};
|
|
11917
11917
|
for (const [route, props] of Object.entries(routes)) {
|
|
11918
|
-
const { path
|
|
11918
|
+
const { path, method } = parseRoute(route);
|
|
11919
11919
|
const file = typeof props === "string" ? props : props.file;
|
|
11920
11920
|
if (!(method in api[id])) {
|
|
11921
11921
|
api[id][method] = {};
|
|
11922
11922
|
}
|
|
11923
|
-
api[id][method][
|
|
11923
|
+
api[id][method][path] = file;
|
|
11924
11924
|
}
|
|
11925
11925
|
}
|
|
11926
11926
|
}
|
|
@@ -11928,15 +11928,15 @@ var httpFeature = defineFeature({
|
|
|
11928
11928
|
const idType = new TypeObject(2);
|
|
11929
11929
|
for (const [method, paths] of Object.entries(routes)) {
|
|
11930
11930
|
const methodType = new TypeObject(3);
|
|
11931
|
-
for (const [
|
|
11931
|
+
for (const [path, file] of Object.entries(paths)) {
|
|
11932
11932
|
const paramType = new TypeObject(4);
|
|
11933
|
-
for (const param of
|
|
11933
|
+
for (const param of path.matchAll(/{([a-z0-9]+)}/g)) {
|
|
11934
11934
|
paramType.addType(param[0], "string | number");
|
|
11935
11935
|
}
|
|
11936
|
-
const varName = camelCase4(`${id}-${
|
|
11936
|
+
const varName = camelCase4(`${id}-${path}-${method}`);
|
|
11937
11937
|
const relFile = relative3(directories.types, file);
|
|
11938
11938
|
types2.addImport(varName, relFile);
|
|
11939
|
-
methodType.add(`'${
|
|
11939
|
+
methodType.add(`'${path}'`, `Route<typeof ${varName}, ${paramType.toString() || "never"}>`);
|
|
11940
11940
|
}
|
|
11941
11941
|
idType.addConst(method, methodType);
|
|
11942
11942
|
}
|
|
@@ -12030,7 +12030,7 @@ var httpFeature = defineFeature({
|
|
|
12030
12030
|
const group = new Node8(ctx.stack, "http", id);
|
|
12031
12031
|
for (const [routeKey, routeProps] of Object.entries(routes)) {
|
|
12032
12032
|
const routeGroup = new Node8(group, "route", routeKey);
|
|
12033
|
-
const { method, path
|
|
12033
|
+
const { method, path } = parseRoute(routeKey);
|
|
12034
12034
|
const routeId = shortId(routeKey);
|
|
12035
12035
|
const { lambda } = createLambdaFunction(routeGroup, ctx, "http", `${id}-${routeId}`, {
|
|
12036
12036
|
...routeProps,
|
|
@@ -12058,7 +12058,7 @@ var httpFeature = defineFeature({
|
|
|
12058
12058
|
priority: generatePriority(ctx.stackConfig.name, routeKey),
|
|
12059
12059
|
conditions: [
|
|
12060
12060
|
aws9.elb.ListenerCondition.httpRequestMethods([method]),
|
|
12061
|
-
aws9.elb.ListenerCondition.pathPatterns([
|
|
12061
|
+
aws9.elb.ListenerCondition.pathPatterns([path])
|
|
12062
12062
|
],
|
|
12063
12063
|
actions: [aws9.elb.ListenerAction.forward([target.arn])]
|
|
12064
12064
|
}).dependsOn(target);
|
|
@@ -13808,7 +13808,6 @@ var alertFeature = defineFeature({
|
|
|
13808
13808
|
|
|
13809
13809
|
// src/feature/layer/index.ts
|
|
13810
13810
|
import { Asset as Asset7, aws as aws26, Node as Node26 } from "@awsless/formation";
|
|
13811
|
-
import path from "path";
|
|
13812
13811
|
var layerFeature = defineFeature({
|
|
13813
13812
|
name: "layer",
|
|
13814
13813
|
onBefore(ctx) {
|
|
@@ -13847,9 +13846,9 @@ var layerFeature = defineFeature({
|
|
|
13847
13846
|
name: formatGlobalResourceName({
|
|
13848
13847
|
appName: ctx.appConfig.name,
|
|
13849
13848
|
resourceType: "layer",
|
|
13850
|
-
resourceName: id
|
|
13849
|
+
resourceName: shortId(id)
|
|
13851
13850
|
}),
|
|
13852
|
-
description:
|
|
13851
|
+
description: id,
|
|
13853
13852
|
architectures: props.architecture ? [props.architecture] : void 0,
|
|
13854
13853
|
runtimes: props.runtimes,
|
|
13855
13854
|
code: {
|
|
@@ -14036,11 +14035,11 @@ var logConfigError = (error) => {
|
|
|
14036
14035
|
const inStack = issue.path[0] === "stacks" && typeof issue.path[1] === "number";
|
|
14037
14036
|
const length = issue.path.length;
|
|
14038
14037
|
const end = ["}"];
|
|
14039
|
-
issue.path.forEach((
|
|
14038
|
+
issue.path.forEach((path, i) => {
|
|
14040
14039
|
const index = i + 1;
|
|
14041
|
-
context = context[
|
|
14042
|
-
if (typeof
|
|
14043
|
-
const key =
|
|
14040
|
+
context = context[path];
|
|
14041
|
+
if (typeof path === "string") {
|
|
14042
|
+
const key = path + `: `;
|
|
14044
14043
|
if (index === length) {
|
|
14045
14044
|
const space = " ".repeat(key.length);
|
|
14046
14045
|
const value = format(context);
|
|
@@ -14988,8 +14987,8 @@ var runTests = async (tests, stackFilters = [], testFilters = []) => {
|
|
|
14988
14987
|
continue;
|
|
14989
14988
|
}
|
|
14990
14989
|
}
|
|
14991
|
-
for (const
|
|
14992
|
-
const result = await runTest(test2.name,
|
|
14990
|
+
for (const path of test2.paths) {
|
|
14991
|
+
const result = await runTest(test2.name, path, testFilters);
|
|
14993
14992
|
if (!result) {
|
|
14994
14993
|
return false;
|
|
14995
14994
|
}
|
|
@@ -15257,13 +15256,13 @@ var generateTypes = async (props) => {
|
|
|
15257
15256
|
...props,
|
|
15258
15257
|
async write(file, data, include = false) {
|
|
15259
15258
|
const code = data?.toString("utf8");
|
|
15260
|
-
const
|
|
15259
|
+
const path = join14(directories.types, file);
|
|
15261
15260
|
if (code) {
|
|
15262
15261
|
if (include) {
|
|
15263
|
-
files.push(relative7(directories.root,
|
|
15262
|
+
files.push(relative7(directories.root, path));
|
|
15264
15263
|
}
|
|
15265
|
-
await mkdir6(dirname13(
|
|
15266
|
-
await writeFile4(
|
|
15264
|
+
await mkdir6(dirname13(path), { recursive: true });
|
|
15265
|
+
await writeFile4(path, code);
|
|
15267
15266
|
}
|
|
15268
15267
|
}
|
|
15269
15268
|
});
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.435",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@awsless/dynamodb": "^0.1.5",
|
|
32
|
-
"@awsless/iot": "^0.0.3",
|
|
33
32
|
"@awsless/json": "^0.0.6",
|
|
33
|
+
"@awsless/iot": "^0.0.3",
|
|
34
34
|
"@awsless/lambda": "^0.0.30",
|
|
35
35
|
"@awsless/open-search": "^0.0.17",
|
|
36
|
-
"@awsless/redis": "^0.0.13",
|
|
37
36
|
"@awsless/s3": "^0.0.20",
|
|
37
|
+
"@awsless/sns": "^0.0.10",
|
|
38
38
|
"@awsless/validate": "^0.0.17",
|
|
39
39
|
"@awsless/sqs": "^0.0.8",
|
|
40
40
|
"@awsless/ssm": "^0.0.7",
|
|
41
41
|
"@awsless/weak-cache": "^0.0.1",
|
|
42
42
|
"@awsless/mqtt": "^0.0.2",
|
|
43
|
-
"@awsless/
|
|
43
|
+
"@awsless/redis": "^0.0.13"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@arcanyx/cidr-slicer": "^0.3.0",
|
|
@@ -117,13 +117,13 @@
|
|
|
117
117
|
"zod": "^3.21.4",
|
|
118
118
|
"zod-to-json-schema": "^3.22.3",
|
|
119
119
|
"@awsless/code": "^0.0.10",
|
|
120
|
-
"@awsless/duration": "^0.0.1",
|
|
121
120
|
"@awsless/formation": "^0.0.59",
|
|
121
|
+
"@awsless/duration": "^0.0.1",
|
|
122
122
|
"@awsless/graphql": "^0.0.9",
|
|
123
123
|
"@awsless/json": "^0.0.6",
|
|
124
124
|
"@awsless/size": "^0.0.1",
|
|
125
|
-
"@awsless/
|
|
126
|
-
"@awsless/
|
|
125
|
+
"@awsless/ts-file-cache": "^0.0.10",
|
|
126
|
+
"@awsless/validate": "^0.0.17"
|
|
127
127
|
},
|
|
128
128
|
"devDependencies": {
|
|
129
129
|
"@node-rs/bcrypt": "^1.10.5"
|