@awsless/awsless 0.0.434 → 0.0.436
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/bin.js +390 -282
- package/dist/build-json-schema.js +151 -137
- package/dist/prebuild/rpc/HASH +1 -1
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/stack.json +1 -1
- package/package.json +12 -12
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 {
|
|
@@ -7588,7 +7588,7 @@ var AlertsDefaultSchema = z2.record(
|
|
|
7588
7588
|
).optional().describe("Define the alerts in your app. Alerts are a way to send messages to one or more email addresses.");
|
|
7589
7589
|
|
|
7590
7590
|
// src/feature/auth/schema.ts
|
|
7591
|
-
import { z as
|
|
7591
|
+
import { z as z9 } from "zod";
|
|
7592
7592
|
|
|
7593
7593
|
// src/config/schema/resource-id.ts
|
|
7594
7594
|
import { paramCase as paramCase2 } from "change-case";
|
|
@@ -7598,7 +7598,7 @@ var ResourceIdSchema = z3.string().min(3).max(24).regex(/^[a-z0-9\-]+$/i, "Inval
|
|
|
7598
7598
|
// src/feature/function/schema.ts
|
|
7599
7599
|
import { days, minutes as minutes2, seconds, toDays } from "@awsless/duration";
|
|
7600
7600
|
import { gibibytes, mebibytes } from "@awsless/size";
|
|
7601
|
-
import { z as
|
|
7601
|
+
import { z as z8 } from "zod";
|
|
7602
7602
|
|
|
7603
7603
|
// src/config/schema/duration.ts
|
|
7604
7604
|
import { z as z4 } from "zod";
|
|
@@ -7615,33 +7615,47 @@ var durationMax = (max) => {
|
|
|
7615
7615
|
};
|
|
7616
7616
|
};
|
|
7617
7617
|
|
|
7618
|
+
// src/config/schema/local-directory.ts
|
|
7619
|
+
import { stat as stat2 } from "fs/promises";
|
|
7620
|
+
import { z as z6 } from "zod";
|
|
7621
|
+
|
|
7618
7622
|
// src/config/schema/local-file.ts
|
|
7619
7623
|
import { stat } from "fs/promises";
|
|
7620
7624
|
import { join as join3 } from "path";
|
|
7621
7625
|
import { z as z5 } from "zod";
|
|
7622
7626
|
var basePath;
|
|
7623
|
-
var setLocalBasePath = (
|
|
7624
|
-
basePath =
|
|
7627
|
+
var setLocalBasePath = (path) => {
|
|
7628
|
+
basePath = path;
|
|
7625
7629
|
};
|
|
7626
|
-
var resolvePath = (
|
|
7627
|
-
if (
|
|
7628
|
-
return join3(basePath,
|
|
7630
|
+
var resolvePath = (path) => {
|
|
7631
|
+
if (path.startsWith(".") && basePath) {
|
|
7632
|
+
return join3(basePath, path);
|
|
7629
7633
|
}
|
|
7630
|
-
return join3(directories.root,
|
|
7634
|
+
return join3(directories.root, path);
|
|
7631
7635
|
};
|
|
7632
|
-
var LocalFileSchema = z5.string().transform((
|
|
7636
|
+
var LocalFileSchema = z5.string().transform((path) => resolvePath(path)).refine(async (path) => {
|
|
7633
7637
|
try {
|
|
7634
|
-
const s = await stat(
|
|
7638
|
+
const s = await stat(path);
|
|
7635
7639
|
return s.isFile();
|
|
7636
7640
|
} catch (error) {
|
|
7637
7641
|
return false;
|
|
7638
7642
|
}
|
|
7639
7643
|
}, `File doesn't exist`);
|
|
7640
7644
|
|
|
7645
|
+
// src/config/schema/local-directory.ts
|
|
7646
|
+
var LocalDirectorySchema = z6.string().transform((path) => resolvePath(path)).refine(async (path) => {
|
|
7647
|
+
try {
|
|
7648
|
+
const s = await stat2(path);
|
|
7649
|
+
return s.isDirectory();
|
|
7650
|
+
} catch (error) {
|
|
7651
|
+
return false;
|
|
7652
|
+
}
|
|
7653
|
+
}, `Directory doesn't exist`);
|
|
7654
|
+
|
|
7641
7655
|
// src/config/schema/size.ts
|
|
7642
|
-
import { z as
|
|
7656
|
+
import { z as z7 } from "zod";
|
|
7643
7657
|
import { parse as parse2 } from "@awsless/size";
|
|
7644
|
-
var SizeSchema =
|
|
7658
|
+
var SizeSchema = z7.string().regex(/^[0-9]+ (B|KB|MB|GB|TB|PB)$/, "Invalid size").transform((v) => parse2(v));
|
|
7645
7659
|
var sizeMin = (min) => {
|
|
7646
7660
|
return (size) => {
|
|
7647
7661
|
return size.value >= min.value;
|
|
@@ -7664,33 +7678,32 @@ var EphemeralStorageSizeSchema = SizeSchema.refine(
|
|
|
7664
7678
|
sizeMin(mebibytes(512)),
|
|
7665
7679
|
"Minimum ephemeral storage size is 512 MB"
|
|
7666
7680
|
).refine(sizeMax(gibibytes(10)), "Minimum ephemeral storage size is 10 GB").describe("The size of the function's /tmp directory. You can specify a size value from 512 MB to 10 GB.");
|
|
7667
|
-
var ReservedConcurrentExecutionsSchema =
|
|
7668
|
-
var EnvironmentSchema =
|
|
7669
|
-
var ArchitectureSchema =
|
|
7670
|
-
var RetryAttemptsSchema =
|
|
7681
|
+
var ReservedConcurrentExecutionsSchema = z8.number().int().min(0).describe("The number of simultaneous executions to reserve for the function. You can specify a number from 0.");
|
|
7682
|
+
var EnvironmentSchema = z8.record(z8.string(), z8.string()).optional().describe("Environment variable key-value pairs.");
|
|
7683
|
+
var ArchitectureSchema = z8.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
|
|
7684
|
+
var RetryAttemptsSchema = z8.number().int().min(0).max(2).describe(
|
|
7671
7685
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
7672
7686
|
);
|
|
7673
|
-
var NodeRuntimeSchema =
|
|
7674
|
-
var ContainerRuntimeSchema =
|
|
7675
|
-
var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema);
|
|
7676
|
-
var ActionSchema =
|
|
7677
|
-
var ActionsSchema =
|
|
7678
|
-
var ArnSchema =
|
|
7679
|
-
var WildcardSchema =
|
|
7680
|
-
var ResourceSchema =
|
|
7681
|
-
var ResourcesSchema =
|
|
7682
|
-
var PermissionSchema =
|
|
7683
|
-
effect:
|
|
7687
|
+
var NodeRuntimeSchema = z8.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]);
|
|
7688
|
+
var ContainerRuntimeSchema = z8.literal("container");
|
|
7689
|
+
var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema).describe("The identifier of the function's runtime.");
|
|
7690
|
+
var ActionSchema = z8.string();
|
|
7691
|
+
var ActionsSchema = z8.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
|
|
7692
|
+
var ArnSchema = z8.string().startsWith("arn:").transform((v) => v);
|
|
7693
|
+
var WildcardSchema = z8.literal("*");
|
|
7694
|
+
var ResourceSchema = z8.union([ArnSchema, WildcardSchema]);
|
|
7695
|
+
var ResourcesSchema = z8.union([ResourceSchema.transform((v) => [v]), ResourceSchema.array()]);
|
|
7696
|
+
var PermissionSchema = z8.object({
|
|
7697
|
+
effect: z8.enum(["allow", "deny"]).default("allow"),
|
|
7684
7698
|
actions: ActionsSchema,
|
|
7685
7699
|
resources: ResourcesSchema
|
|
7686
7700
|
});
|
|
7687
|
-
var PermissionsSchema =
|
|
7688
|
-
var WarmSchema =
|
|
7689
|
-
var VPCSchema =
|
|
7690
|
-
var MinifySchema =
|
|
7691
|
-
var HandlerSchema =
|
|
7692
|
-
var
|
|
7693
|
-
var DescriptionSchema = z7.string().describe("A description of the function.");
|
|
7701
|
+
var PermissionsSchema = z8.union([PermissionSchema.transform((v) => [v]), PermissionSchema.array()]).describe("Add IAM permissions to your function.");
|
|
7702
|
+
var WarmSchema = z8.number().int().min(0).max(10).describe("Specify how many functions you want to warm up each 5 minutes. You can specify a number from 0 to 10.");
|
|
7703
|
+
var VPCSchema = z8.boolean().describe("Put the function inside your global VPC.");
|
|
7704
|
+
var MinifySchema = z8.boolean().describe("Minify the function code.");
|
|
7705
|
+
var HandlerSchema = z8.string().describe("The name of the exported method within your code that Lambda calls to run your function.");
|
|
7706
|
+
var DescriptionSchema = z8.string().describe("A description of the function.");
|
|
7694
7707
|
var validLogRetentionDays = [
|
|
7695
7708
|
...[1n, 3n, 5n, 7n, 14n, 30n, 60n, 90n, 120n, 150n],
|
|
7696
7709
|
...[180n, 365n, 400n, 545n, 731n, 1096n, 1827n, 2192n],
|
|
@@ -7705,47 +7718,59 @@ var LogRetentionSchema = DurationSchema.refine(
|
|
|
7705
7718
|
},
|
|
7706
7719
|
`Invalid log retention. Valid days are: ${validLogRetentionDays.map((days7) => `${days7}`).join(", ")}`
|
|
7707
7720
|
).describe("The log retention duration.");
|
|
7708
|
-
var LogSubscriptionSchema =
|
|
7721
|
+
var LogSubscriptionSchema = z8.union([
|
|
7709
7722
|
LocalFileSchema.transform((file) => ({
|
|
7710
7723
|
file
|
|
7711
7724
|
})),
|
|
7712
|
-
|
|
7725
|
+
z8.object({
|
|
7713
7726
|
subscriber: LocalFileSchema,
|
|
7714
|
-
filter:
|
|
7727
|
+
filter: z8.string().optional()
|
|
7715
7728
|
})
|
|
7716
7729
|
]).describe(
|
|
7717
7730
|
"Log Subscription allow you to subscribe to a real-time stream of log events and have them delivered to a specific destination"
|
|
7718
7731
|
);
|
|
7719
|
-
var LogSchema =
|
|
7720
|
-
|
|
7732
|
+
var LogSchema = z8.union([
|
|
7733
|
+
z8.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
|
|
7721
7734
|
LogRetentionSchema.transform((retention) => ({ retention })),
|
|
7722
|
-
|
|
7735
|
+
z8.object({
|
|
7723
7736
|
subscription: LogSubscriptionSchema.optional(),
|
|
7724
7737
|
retention: LogRetentionSchema.optional(),
|
|
7725
|
-
format:
|
|
7738
|
+
format: z8.enum(["text", "json"]).describe(
|
|
7726
7739
|
`The format in which Lambda sends your function's application and system logs to CloudWatch. Select between plain text and structured JSON.`
|
|
7727
7740
|
).optional(),
|
|
7728
|
-
system:
|
|
7741
|
+
system: z8.enum(["debug", "info", "warn"]).describe(
|
|
7729
7742
|
"Set this property to filter the system logs for your function that Lambda sends to CloudWatch. Lambda only sends system logs at the selected level of detail and lower, where DEBUG is the highest level and WARN is the lowest."
|
|
7730
7743
|
).optional(),
|
|
7731
|
-
level:
|
|
7744
|
+
level: z8.enum(["trace", "debug", "info", "warn", "error", "fatal"]).describe(
|
|
7732
7745
|
"Set this property to filter the application logs for your function that Lambda sends to CloudWatch. Lambda only sends application logs at the selected level of detail and lower, where TRACE is the highest level and FATAL is the lowest."
|
|
7733
7746
|
).optional()
|
|
7734
7747
|
})
|
|
7735
7748
|
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
7736
|
-
var LayersSchema =
|
|
7749
|
+
var LayersSchema = z8.string().array().describe(
|
|
7737
7750
|
// `A list of function layers to add to the function's execution environment..`
|
|
7738
7751
|
`A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.`
|
|
7739
7752
|
);
|
|
7740
|
-
var
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7753
|
+
var FileCodeSchema = z8.object({
|
|
7754
|
+
file: LocalFileSchema.describe("The file path of the function code."),
|
|
7755
|
+
minify: MinifySchema.optional().default(true),
|
|
7756
|
+
external: z8.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
|
|
7757
|
+
});
|
|
7758
|
+
var BundleCodeSchema = z8.object({
|
|
7759
|
+
bundle: LocalDirectorySchema.describe("The directory that needs to be bundled.")
|
|
7760
|
+
});
|
|
7761
|
+
var CodeSchema = z8.union([
|
|
7762
|
+
LocalFileSchema.transform((file) => ({
|
|
7763
|
+
file
|
|
7764
|
+
})),
|
|
7765
|
+
FileCodeSchema,
|
|
7766
|
+
BundleCodeSchema
|
|
7767
|
+
]).describe("Specify the code of your function.");
|
|
7768
|
+
var FnSchema = z8.object({
|
|
7769
|
+
code: CodeSchema,
|
|
7746
7770
|
// node
|
|
7747
7771
|
handler: HandlerSchema.optional(),
|
|
7748
|
-
build: BuildSchema.optional(),
|
|
7772
|
+
// build: BuildSchema.optional(),
|
|
7773
|
+
// bundle: BundleSchema.optional(),
|
|
7749
7774
|
// container
|
|
7750
7775
|
// ...
|
|
7751
7776
|
runtime: RuntimeSchema.optional(),
|
|
@@ -7763,20 +7788,23 @@ var FnSchema = z7.object({
|
|
|
7763
7788
|
environment: EnvironmentSchema.optional(),
|
|
7764
7789
|
permissions: PermissionsSchema.optional()
|
|
7765
7790
|
});
|
|
7766
|
-
var FunctionSchema =
|
|
7791
|
+
var FunctionSchema = z8.union([
|
|
7767
7792
|
LocalFileSchema.transform((file) => ({
|
|
7768
|
-
|
|
7793
|
+
code: {
|
|
7794
|
+
file
|
|
7795
|
+
}
|
|
7769
7796
|
})),
|
|
7770
7797
|
FnSchema
|
|
7771
7798
|
]);
|
|
7772
|
-
var FunctionsSchema =
|
|
7773
|
-
var FunctionDefaultSchema =
|
|
7799
|
+
var FunctionsSchema = z8.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
|
|
7800
|
+
var FunctionDefaultSchema = z8.object({
|
|
7774
7801
|
runtime: RuntimeSchema.default("nodejs20.x"),
|
|
7775
7802
|
// node
|
|
7776
7803
|
handler: HandlerSchema.default("index.default"),
|
|
7777
|
-
build: BuildSchema.default({
|
|
7778
|
-
|
|
7779
|
-
|
|
7804
|
+
// build: BuildSchema.default({
|
|
7805
|
+
// type: 'simple',
|
|
7806
|
+
// minify: true,
|
|
7807
|
+
// }),
|
|
7780
7808
|
// container
|
|
7781
7809
|
warm: WarmSchema.default(0),
|
|
7782
7810
|
vpc: VPCSchema.default(false),
|
|
@@ -7798,7 +7826,7 @@ var FunctionDefaultSchema = z7.object({
|
|
|
7798
7826
|
}).default({});
|
|
7799
7827
|
|
|
7800
7828
|
// src/feature/auth/schema.ts
|
|
7801
|
-
var TriggersSchema =
|
|
7829
|
+
var TriggersSchema = z9.object({
|
|
7802
7830
|
beforeToken: FunctionSchema.optional().describe("A pre jwt token generation AWS Lambda trigger."),
|
|
7803
7831
|
beforeLogin: FunctionSchema.optional().describe("A pre user login AWS Lambda trigger."),
|
|
7804
7832
|
afterLogin: FunctionSchema.optional().describe("A post user login AWS Lambda trigger."),
|
|
@@ -7811,42 +7839,42 @@ var TriggersSchema = z8.object({
|
|
|
7811
7839
|
createChallenge: FunctionSchema.optional().describe("Creates an authentication challenge."),
|
|
7812
7840
|
verifyChallenge: FunctionSchema.optional().describe("Verifies the authentication challenge response.")
|
|
7813
7841
|
}).describe("Specifies the configuration for AWS Lambda triggers.");
|
|
7814
|
-
var AuthSchema =
|
|
7842
|
+
var AuthSchema = z9.record(
|
|
7815
7843
|
ResourceIdSchema,
|
|
7816
|
-
|
|
7817
|
-
access:
|
|
7844
|
+
z9.object({
|
|
7845
|
+
access: z9.boolean().default(false).describe("Give access to every function in this stack to your cognito instance."),
|
|
7818
7846
|
triggers: TriggersSchema.optional()
|
|
7819
7847
|
})
|
|
7820
7848
|
).optional().describe("Define the auth triggers in your stack.");
|
|
7821
|
-
var AuthDefaultSchema =
|
|
7849
|
+
var AuthDefaultSchema = z9.record(
|
|
7822
7850
|
ResourceIdSchema,
|
|
7823
|
-
|
|
7824
|
-
allowUserRegistration:
|
|
7825
|
-
messaging:
|
|
7851
|
+
z9.object({
|
|
7852
|
+
allowUserRegistration: z9.boolean().default(true).describe("Specifies whether users can create an user account or if only the administrator can."),
|
|
7853
|
+
messaging: z9.object({
|
|
7826
7854
|
fromEmail: EmailSchema.describe("Specifies the sender's email address."),
|
|
7827
|
-
fromName:
|
|
7855
|
+
fromName: z9.string().optional().describe("Specifies the sender's name."),
|
|
7828
7856
|
replyTo: EmailSchema.optional().describe(
|
|
7829
7857
|
"The destination to which the receiver of the email should reply."
|
|
7830
7858
|
)
|
|
7831
7859
|
}).optional().describe("The email configuration for sending messages."),
|
|
7832
7860
|
// secret: z.boolean().default(false).describe('Specifies whether you want to generate a client secret.'),
|
|
7833
|
-
username:
|
|
7834
|
-
emailAlias:
|
|
7835
|
-
caseSensitive:
|
|
7861
|
+
username: z9.object({
|
|
7862
|
+
emailAlias: z9.boolean().default(true).describe("Allow the user email to be used as username."),
|
|
7863
|
+
caseSensitive: z9.boolean().default(false).describe(
|
|
7836
7864
|
"Specifies whether username case sensitivity will be enabled. When usernames and email addresses are case insensitive, users can sign in as the same user when they enter a different capitalization of their user name."
|
|
7837
7865
|
)
|
|
7838
7866
|
}).default({}).describe("The username policy."),
|
|
7839
|
-
password:
|
|
7840
|
-
minLength:
|
|
7841
|
-
uppercase:
|
|
7842
|
-
lowercase:
|
|
7843
|
-
numbers:
|
|
7844
|
-
symbols:
|
|
7867
|
+
password: z9.object({
|
|
7868
|
+
minLength: z9.number().int().min(6).max(99).default(12).describe("Required users to have at least the minimum password length."),
|
|
7869
|
+
uppercase: z9.boolean().default(true).describe("Required users to use at least one uppercase letter in their password."),
|
|
7870
|
+
lowercase: z9.boolean().default(true).describe("Required users to use at least one lowercase letter in their password."),
|
|
7871
|
+
numbers: z9.boolean().default(true).describe("Required users to use at least one number in their password."),
|
|
7872
|
+
symbols: z9.boolean().default(true).describe("Required users to use at least one symbol in their password."),
|
|
7845
7873
|
temporaryPasswordValidity: DurationSchema.default("7 days").describe(
|
|
7846
7874
|
"The duration a temporary password is valid. If the user doesn't sign in during this time, an administrator must reset their password."
|
|
7847
7875
|
)
|
|
7848
7876
|
}).default({}).describe("The password policy."),
|
|
7849
|
-
validity:
|
|
7877
|
+
validity: z9.object({
|
|
7850
7878
|
idToken: DurationSchema.default("1 hour").describe(
|
|
7851
7879
|
"The ID token time limit. After this limit expires, your user can't use their ID token."
|
|
7852
7880
|
),
|
|
@@ -7862,18 +7890,18 @@ var AuthDefaultSchema = z8.record(
|
|
|
7862
7890
|
).default({}).describe("Define the authenticatable users in your app.");
|
|
7863
7891
|
|
|
7864
7892
|
// src/feature/domain/schema.ts
|
|
7865
|
-
import { z as
|
|
7866
|
-
var DomainNameSchema =
|
|
7893
|
+
import { z as z10 } from "zod";
|
|
7894
|
+
var DomainNameSchema = z10.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
|
|
7867
7895
|
"Enter a fully qualified domain name, for example, www.example.com. You can optionally include a trailing dot. If you omit the trailing dot, Amazon Route 53 assumes that the domain name that you specify is fully qualified. This means that Route 53 treats www.example.com (without a trailing dot) and www.example.com. (with a trailing dot) as identical."
|
|
7868
7896
|
);
|
|
7869
|
-
var DNSTypeSchema =
|
|
7897
|
+
var DNSTypeSchema = z10.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
|
|
7870
7898
|
var TTLSchema = DurationSchema.describe("The resource record cache time to live (TTL).");
|
|
7871
|
-
var RecordsSchema =
|
|
7872
|
-
var DomainsDefaultSchema =
|
|
7899
|
+
var RecordsSchema = z10.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
|
|
7900
|
+
var DomainsDefaultSchema = z10.record(
|
|
7873
7901
|
ResourceIdSchema,
|
|
7874
|
-
|
|
7902
|
+
z10.object({
|
|
7875
7903
|
domain: DomainNameSchema.describe("Define the domain name"),
|
|
7876
|
-
dns:
|
|
7904
|
+
dns: z10.object({
|
|
7877
7905
|
name: DomainNameSchema.optional(),
|
|
7878
7906
|
type: DNSTypeSchema,
|
|
7879
7907
|
ttl: TTLSchema,
|
|
@@ -7883,18 +7911,18 @@ var DomainsDefaultSchema = z9.record(
|
|
|
7883
7911
|
).optional().describe("Define the domains for your application.");
|
|
7884
7912
|
|
|
7885
7913
|
// src/feature/graphql/schema.ts
|
|
7886
|
-
import { z as
|
|
7914
|
+
import { z as z11 } from "zod";
|
|
7887
7915
|
var AuthorizerTtl = DurationSchema.describe(
|
|
7888
7916
|
`The number of seconds a response should be cached for. The maximum value is one hour (3600 seconds). The Lambda function can override this by returning a ttlOverride key in its response.`
|
|
7889
7917
|
);
|
|
7890
|
-
var GraphQLDefaultSchema =
|
|
7918
|
+
var GraphQLDefaultSchema = z11.record(
|
|
7891
7919
|
ResourceIdSchema,
|
|
7892
|
-
|
|
7920
|
+
z11.object({
|
|
7893
7921
|
domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
|
|
7894
|
-
subDomain:
|
|
7895
|
-
auth:
|
|
7922
|
+
subDomain: z11.string().optional(),
|
|
7923
|
+
auth: z11.union([
|
|
7896
7924
|
ResourceIdSchema,
|
|
7897
|
-
|
|
7925
|
+
z11.object({
|
|
7898
7926
|
authorizer: FunctionSchema,
|
|
7899
7927
|
ttl: AuthorizerTtl.default("1 hour")
|
|
7900
7928
|
})
|
|
@@ -7906,22 +7934,22 @@ var GraphQLDefaultSchema = z10.record(
|
|
|
7906
7934
|
resolver: LocalFileSchema.optional()
|
|
7907
7935
|
})
|
|
7908
7936
|
).describe(`Define the global GraphQL API's.`).optional();
|
|
7909
|
-
var GraphQLSchema =
|
|
7937
|
+
var GraphQLSchema = z11.record(
|
|
7910
7938
|
ResourceIdSchema,
|
|
7911
|
-
|
|
7939
|
+
z11.object({
|
|
7912
7940
|
// schema: z.union([LocalFileSchema.transform(v => [v]), z.array(LocalFileSchema).min(1)]).optional(),
|
|
7913
7941
|
schema: LocalFileSchema.describe("The graphql schema file."),
|
|
7914
|
-
resolvers:
|
|
7942
|
+
resolvers: z11.record(
|
|
7915
7943
|
// TypeName
|
|
7916
|
-
|
|
7917
|
-
|
|
7944
|
+
z11.string(),
|
|
7945
|
+
z11.record(
|
|
7918
7946
|
// FieldName
|
|
7919
|
-
|
|
7920
|
-
|
|
7947
|
+
z11.string(),
|
|
7948
|
+
z11.union([
|
|
7921
7949
|
FunctionSchema.transform((consumer) => ({
|
|
7922
7950
|
consumer
|
|
7923
7951
|
})),
|
|
7924
|
-
|
|
7952
|
+
z11.object({
|
|
7925
7953
|
consumer: FunctionSchema,
|
|
7926
7954
|
resolver: LocalFileSchema.optional()
|
|
7927
7955
|
})
|
|
@@ -7932,34 +7960,20 @@ var GraphQLSchema = z10.record(
|
|
|
7932
7960
|
).describe("Define the schema & resolvers in your stack for your global GraphQL API.").optional();
|
|
7933
7961
|
|
|
7934
7962
|
// src/feature/http/schema.ts
|
|
7935
|
-
import { z as
|
|
7936
|
-
var RouteSchema =
|
|
7937
|
-
var HttpDefaultSchema =
|
|
7963
|
+
import { z as z12 } from "zod";
|
|
7964
|
+
var RouteSchema = z12.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route").transform((v) => v);
|
|
7965
|
+
var HttpDefaultSchema = z12.record(
|
|
7938
7966
|
ResourceIdSchema,
|
|
7939
|
-
|
|
7967
|
+
z12.object({
|
|
7940
7968
|
domain: ResourceIdSchema.describe("The domain id to link your API with."),
|
|
7941
|
-
subDomain:
|
|
7969
|
+
subDomain: z12.string().optional()
|
|
7942
7970
|
// auth: ResourceIdSchema.optional(),
|
|
7943
7971
|
})
|
|
7944
7972
|
).optional().describe("Define your global HTTP API's.");
|
|
7945
|
-
var HttpSchema =
|
|
7973
|
+
var HttpSchema = z12.record(ResourceIdSchema, z12.record(RouteSchema, FunctionSchema)).optional().describe("Define routes in your stack for your global HTTP API.");
|
|
7946
7974
|
|
|
7947
7975
|
// src/feature/instance/schema.ts
|
|
7948
7976
|
import { z as z13 } from "zod";
|
|
7949
|
-
|
|
7950
|
-
// src/config/schema/local-directory.ts
|
|
7951
|
-
import { stat as stat2 } from "fs/promises";
|
|
7952
|
-
import { z as z12 } from "zod";
|
|
7953
|
-
var LocalDirectorySchema = z12.string().transform((path2) => resolvePath(path2)).refine(async (path2) => {
|
|
7954
|
-
try {
|
|
7955
|
-
const s = await stat2(path2);
|
|
7956
|
-
return s.isDirectory();
|
|
7957
|
-
} catch (error) {
|
|
7958
|
-
return false;
|
|
7959
|
-
}
|
|
7960
|
-
}, `Directory doesn't exist`);
|
|
7961
|
-
|
|
7962
|
-
// src/feature/instance/schema.ts
|
|
7963
7977
|
var ImageSchema = z13.string().regex(/^ami\-[0-9a-f]+/).describe("The ID of the AMI.");
|
|
7964
7978
|
var TypeSchema = z13.enum([
|
|
7965
7979
|
"t3.nano",
|
|
@@ -7980,7 +7994,7 @@ var TypeSchema = z13.enum([
|
|
|
7980
7994
|
"g4dn.xlarge"
|
|
7981
7995
|
]).describe(`The instance type.`);
|
|
7982
7996
|
var CommandSchema = z13.string().describe(`The script you want to execute when the instance starts up.`);
|
|
7983
|
-
var
|
|
7997
|
+
var CodeSchema2 = LocalDirectorySchema.describe(`The code directory that will be deployed to your instance.`);
|
|
7984
7998
|
var ConnectSchema = z13.boolean().describe("Allows you to connect to all instances with an Instance Connect Endpoint.");
|
|
7985
7999
|
var EnvironmentSchema2 = z13.record(z13.string(), z13.string()).optional().describe("Environment variable key-value pairs.");
|
|
7986
8000
|
var ActionSchema2 = z13.string();
|
|
@@ -8003,7 +8017,7 @@ var InstancesSchema = z13.record(
|
|
|
8003
8017
|
z13.object({
|
|
8004
8018
|
image: ImageSchema,
|
|
8005
8019
|
type: TypeSchema,
|
|
8006
|
-
code:
|
|
8020
|
+
code: CodeSchema2,
|
|
8007
8021
|
user: z13.string().default("ec2-user"),
|
|
8008
8022
|
command: CommandSchema.optional(),
|
|
8009
8023
|
environment: EnvironmentSchema2.optional(),
|
|
@@ -8898,8 +8912,8 @@ var TypeFile = class {
|
|
|
8898
8912
|
codes = /* @__PURE__ */ new Set();
|
|
8899
8913
|
interfaces = /* @__PURE__ */ new Map();
|
|
8900
8914
|
imports = /* @__PURE__ */ new Map();
|
|
8901
|
-
addImport(varName,
|
|
8902
|
-
this.imports.set(varName,
|
|
8915
|
+
addImport(varName, path) {
|
|
8916
|
+
this.imports.set(varName, path);
|
|
8903
8917
|
return this;
|
|
8904
8918
|
}
|
|
8905
8919
|
addCode(code) {
|
|
@@ -8922,11 +8936,11 @@ var TypeFile = class {
|
|
|
8922
8936
|
lines.push(
|
|
8923
8937
|
...[
|
|
8924
8938
|
"// Imports",
|
|
8925
|
-
...Array.from(this.imports.entries()).map(([varName,
|
|
8939
|
+
...Array.from(this.imports.entries()).map(([varName, path]) => {
|
|
8926
8940
|
if (typeof varName === "string") {
|
|
8927
|
-
return `import ${camelCase(varName)} from '${
|
|
8941
|
+
return `import ${camelCase(varName)} from '${path}'`;
|
|
8928
8942
|
}
|
|
8929
|
-
return `import { ${Object.entries(varName).map(([key, alias]) => `${key} as ${camelCase(alias)}`).join(", ")} } from '${
|
|
8943
|
+
return `import { ${Object.entries(varName).map(([key, alias]) => `${key} as ${camelCase(alias)}`).join(", ")} } from '${path}'`;
|
|
8930
8944
|
}),
|
|
8931
8945
|
""
|
|
8932
8946
|
]
|
|
@@ -10465,10 +10479,10 @@ var build = (type, name, builder, props) => {
|
|
|
10465
10479
|
}
|
|
10466
10480
|
const time = createTimer();
|
|
10467
10481
|
const meta = await callback(async (file, data2) => {
|
|
10468
|
-
const
|
|
10469
|
-
const base2 = dirname5(
|
|
10482
|
+
const path = getBuildPath(type, name, file);
|
|
10483
|
+
const base2 = dirname5(path);
|
|
10470
10484
|
await mkdir2(base2, { recursive: true });
|
|
10471
|
-
await writeFile2(
|
|
10485
|
+
await writeFile2(path, data2);
|
|
10472
10486
|
});
|
|
10473
10487
|
const data = { ...meta, buildTime: time() };
|
|
10474
10488
|
await writeCache(cacheFile, version, data);
|
|
@@ -10603,18 +10617,18 @@ import { hashElement } from "folder-hash";
|
|
|
10603
10617
|
import { mkdir as mkdir3, readdir, rm as rm2 } from "fs/promises";
|
|
10604
10618
|
import { join as join8 } from "path";
|
|
10605
10619
|
var createTempFolder = async (name) => {
|
|
10606
|
-
const
|
|
10620
|
+
const path = join8(directories.temp, name);
|
|
10607
10621
|
await mkdir3(join8(directories.temp, name), { recursive: true });
|
|
10608
10622
|
process.on("SIGTERM", async () => {
|
|
10609
|
-
await rm2(
|
|
10623
|
+
await rm2(path, { recursive: true });
|
|
10610
10624
|
});
|
|
10611
10625
|
return {
|
|
10612
|
-
path
|
|
10626
|
+
path,
|
|
10613
10627
|
async files() {
|
|
10614
|
-
return readdir(
|
|
10628
|
+
return readdir(path, { recursive: true });
|
|
10615
10629
|
},
|
|
10616
10630
|
async delete() {
|
|
10617
|
-
await rm2(
|
|
10631
|
+
await rm2(path, { recursive: true });
|
|
10618
10632
|
}
|
|
10619
10633
|
};
|
|
10620
10634
|
};
|
|
@@ -10627,6 +10641,71 @@ var formatFilterPattern = (filters) => {
|
|
|
10627
10641
|
return `{${filters.map((filter) => `$.level = "${filter.toUpperCase()}"`).join(" || ")}}`;
|
|
10628
10642
|
};
|
|
10629
10643
|
|
|
10644
|
+
// src/feature/function/build/bundle/bundle.ts
|
|
10645
|
+
import JSZip2 from "jszip";
|
|
10646
|
+
import { createReadStream as createReadStream2 } from "node:fs";
|
|
10647
|
+
import { readdir as readdir2 } from "node:fs/promises";
|
|
10648
|
+
import { join as join9, relative as relative2 } from "node:path";
|
|
10649
|
+
var zipBundle = async ({ directory }) => {
|
|
10650
|
+
const zip2 = new JSZip2();
|
|
10651
|
+
const list4 = await readdir2(directory, {
|
|
10652
|
+
recursive: true,
|
|
10653
|
+
withFileTypes: true
|
|
10654
|
+
});
|
|
10655
|
+
for (const file of list4) {
|
|
10656
|
+
if (file.isFile()) {
|
|
10657
|
+
const path = join9(file.path, file.name);
|
|
10658
|
+
const rel = relative2(directory, path);
|
|
10659
|
+
zip2.file(rel, createReadStream2(path));
|
|
10660
|
+
}
|
|
10661
|
+
}
|
|
10662
|
+
return zip2.generateAsync({
|
|
10663
|
+
type: "nodebuffer",
|
|
10664
|
+
compression: "DEFLATE",
|
|
10665
|
+
compressionOptions: {
|
|
10666
|
+
level: 9
|
|
10667
|
+
}
|
|
10668
|
+
});
|
|
10669
|
+
};
|
|
10670
|
+
|
|
10671
|
+
// src/feature/function/build/bundle/cache.ts
|
|
10672
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
10673
|
+
import { createReadStream as createReadStream3 } from "node:fs";
|
|
10674
|
+
import { lstat as lstat2, readdir as readdir3 } from "node:fs/promises";
|
|
10675
|
+
import { join as join10 } from "node:path";
|
|
10676
|
+
var bundleCacheKey = async (props) => {
|
|
10677
|
+
const files = await listAllFiles([props.directory]);
|
|
10678
|
+
const hashes = {};
|
|
10679
|
+
for (const file of files) {
|
|
10680
|
+
hashes[file] = await createHashFromFile(file);
|
|
10681
|
+
}
|
|
10682
|
+
return createHash3("md5").update(JSON.stringify(hashes)).digest("hex");
|
|
10683
|
+
};
|
|
10684
|
+
var createHashFromFile = (file) => {
|
|
10685
|
+
return new Promise((resolve2) => {
|
|
10686
|
+
const hash = createHash3("md5");
|
|
10687
|
+
const stream = createReadStream3(file);
|
|
10688
|
+
stream.on("data", (data) => hash.update(data));
|
|
10689
|
+
stream.on("end", () => resolve2(hash.digest("hex")));
|
|
10690
|
+
});
|
|
10691
|
+
};
|
|
10692
|
+
var listAllFiles = async (list4) => {
|
|
10693
|
+
const files = [];
|
|
10694
|
+
for (const entry of list4) {
|
|
10695
|
+
const stat5 = await lstat2(entry);
|
|
10696
|
+
if (stat5.isDirectory()) {
|
|
10697
|
+
const dirents = await readdir3(entry, {
|
|
10698
|
+
recursive: true,
|
|
10699
|
+
withFileTypes: true
|
|
10700
|
+
});
|
|
10701
|
+
files.push(...dirents.filter((d) => d.isFile()).map((file) => join10(file.path, file.name)));
|
|
10702
|
+
} else if (stat5.isFile()) {
|
|
10703
|
+
files.push(entry);
|
|
10704
|
+
}
|
|
10705
|
+
}
|
|
10706
|
+
return files;
|
|
10707
|
+
};
|
|
10708
|
+
|
|
10630
10709
|
// src/feature/function/build/container/build.ts
|
|
10631
10710
|
import { exec } from "promisify-child-process";
|
|
10632
10711
|
var buildDockerImage = async (opts) => {
|
|
@@ -10671,7 +10750,10 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
|
|
|
10671
10750
|
let code;
|
|
10672
10751
|
if (props.runtime === "container") {
|
|
10673
10752
|
ctx.registerBuild("function", name, async (build3) => {
|
|
10674
|
-
|
|
10753
|
+
if (!("file" in local2.code)) {
|
|
10754
|
+
throw new Error('code.file needs to be set for functions with the "container" runtime');
|
|
10755
|
+
}
|
|
10756
|
+
const cwd = dirname7(local2.code.file);
|
|
10675
10757
|
const version = await hashElement(cwd, {
|
|
10676
10758
|
files: {
|
|
10677
10759
|
exclude: ["stack.json"]
|
|
@@ -10698,18 +10780,19 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
|
|
|
10698
10780
|
code = {
|
|
10699
10781
|
imageUri: image.uri
|
|
10700
10782
|
};
|
|
10701
|
-
} else {
|
|
10783
|
+
} else if ("file" in local2.code) {
|
|
10784
|
+
const fileCode = local2.code;
|
|
10702
10785
|
ctx.registerBuild("function", name, async (build3, { workspace }) => {
|
|
10703
|
-
const version = await generateFileHash(workspace,
|
|
10786
|
+
const version = await generateFileHash(workspace, fileCode.file);
|
|
10704
10787
|
return build3(version, async (write) => {
|
|
10705
10788
|
const temp = await createTempFolder(`function--${name}`);
|
|
10706
10789
|
const bundle = await bundleTypeScript({
|
|
10707
|
-
file:
|
|
10790
|
+
file: fileCode.file,
|
|
10708
10791
|
external: [
|
|
10709
|
-
...
|
|
10792
|
+
...fileCode.external ?? [],
|
|
10710
10793
|
...(props.layers ?? []).flatMap((id2) => ctx.shared.get(`layer-${id2}-packages`))
|
|
10711
10794
|
],
|
|
10712
|
-
minify:
|
|
10795
|
+
minify: fileCode.minify,
|
|
10713
10796
|
nativeDir: temp.path
|
|
10714
10797
|
});
|
|
10715
10798
|
const nativeFiles = await temp.files();
|
|
@@ -10737,6 +10820,28 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
|
|
|
10737
10820
|
key: `/lambda/${name}.zip`,
|
|
10738
10821
|
body: Asset.fromFile(getBuildPath("function", name, "bundle.zip"))
|
|
10739
10822
|
});
|
|
10823
|
+
} else {
|
|
10824
|
+
const bundleCode = local2.code;
|
|
10825
|
+
ctx.registerBuild("function", name, async (build3) => {
|
|
10826
|
+
const version = await bundleCacheKey({
|
|
10827
|
+
directory: bundleCode.bundle
|
|
10828
|
+
});
|
|
10829
|
+
return build3(version, async (write) => {
|
|
10830
|
+
const bundle = await zipBundle({
|
|
10831
|
+
directory: bundleCode.bundle
|
|
10832
|
+
});
|
|
10833
|
+
await write("HASH", version);
|
|
10834
|
+
await write("bundle.zip", bundle);
|
|
10835
|
+
return {
|
|
10836
|
+
size: formatByteSize(bundle.byteLength)
|
|
10837
|
+
};
|
|
10838
|
+
});
|
|
10839
|
+
});
|
|
10840
|
+
code = new aws2.s3.BucketObject(group, "code", {
|
|
10841
|
+
bucket: ctx.shared.get("function-bucket-name"),
|
|
10842
|
+
key: `/lambda/${name}.zip`,
|
|
10843
|
+
body: Asset.fromFile(getBuildPath("function", name, "bundle.zip"))
|
|
10844
|
+
});
|
|
10740
10845
|
}
|
|
10741
10846
|
const role = new aws2.iam.Role(group, "role", {
|
|
10742
10847
|
name,
|
|
@@ -11177,13 +11282,13 @@ var SsmStore = class {
|
|
|
11177
11282
|
}
|
|
11178
11283
|
async list() {
|
|
11179
11284
|
debug("Load remote config values");
|
|
11180
|
-
const
|
|
11285
|
+
const path = configParameterPrefix(this.props.appConfig.name);
|
|
11181
11286
|
const values = {};
|
|
11182
11287
|
let token;
|
|
11183
11288
|
while (true) {
|
|
11184
11289
|
const result = await this.client.send(
|
|
11185
11290
|
new GetParametersByPathCommand({
|
|
11186
|
-
Path:
|
|
11291
|
+
Path: path,
|
|
11187
11292
|
WithDecryption: true,
|
|
11188
11293
|
MaxResults: 10,
|
|
11189
11294
|
Recursive: true,
|
|
@@ -11408,7 +11513,7 @@ var domainFeature = defineFeature({
|
|
|
11408
11513
|
// src/feature/function/index.ts
|
|
11409
11514
|
import { aws as aws7, Node as Node6 } from "@awsless/formation";
|
|
11410
11515
|
import { camelCase as camelCase3 } from "change-case";
|
|
11411
|
-
import { relative as
|
|
11516
|
+
import { relative as relative3 } from "path";
|
|
11412
11517
|
import deepmerge2 from "deepmerge";
|
|
11413
11518
|
import { days as days3 } from "@awsless/duration";
|
|
11414
11519
|
var typeGenCode2 = `
|
|
@@ -11458,16 +11563,18 @@ var functionFeature = defineFeature({
|
|
|
11458
11563
|
resourceType: "function",
|
|
11459
11564
|
resourceName: name
|
|
11460
11565
|
});
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
11464
|
-
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
|
|
11470
|
-
|
|
11566
|
+
if ("file" in local2.code) {
|
|
11567
|
+
const relFile = relative3(directories.types, local2.code.file);
|
|
11568
|
+
if (props.runtime === "container") {
|
|
11569
|
+
resource2.addType(name, `Invoke<'${funcName}', Func>`);
|
|
11570
|
+
mock.addType(name, `MockBuilder<Func>`);
|
|
11571
|
+
mockResponse.addType(name, `MockObject<Func>`);
|
|
11572
|
+
} else {
|
|
11573
|
+
types2.addImport(varName, relFile);
|
|
11574
|
+
resource2.addType(name, `Invoke<'${funcName}', typeof ${varName}>`);
|
|
11575
|
+
mock.addType(name, `MockBuilder<typeof ${varName}>`);
|
|
11576
|
+
mockResponse.addType(name, `MockObject<typeof ${varName}>`);
|
|
11577
|
+
}
|
|
11471
11578
|
}
|
|
11472
11579
|
}
|
|
11473
11580
|
mocks.addType(stack.name, mock);
|
|
@@ -11536,12 +11643,12 @@ import { mergeTypeDefs } from "@graphql-tools/merge";
|
|
|
11536
11643
|
import { readFile as readFile5 } from "fs/promises";
|
|
11537
11644
|
import { buildSchema, print } from "graphql";
|
|
11538
11645
|
import { Asset as Asset2, aws as aws8, Node as Node7 } from "@awsless/formation";
|
|
11539
|
-
import { createHash as
|
|
11646
|
+
import { createHash as createHash5 } from "crypto";
|
|
11540
11647
|
|
|
11541
11648
|
// src/util/id.ts
|
|
11542
|
-
import { createHash as
|
|
11649
|
+
import { createHash as createHash4 } from "crypto";
|
|
11543
11650
|
var shortId = (ns) => {
|
|
11544
|
-
return
|
|
11651
|
+
return createHash4("md5").update(ns).digest("hex").substring(0, 10);
|
|
11545
11652
|
};
|
|
11546
11653
|
|
|
11547
11654
|
// src/feature/domain/util.ts
|
|
@@ -11749,12 +11856,12 @@ var graphqlFeature = defineFeature({
|
|
|
11749
11856
|
const file = stack.graphql?.[id]?.schema;
|
|
11750
11857
|
if (file) {
|
|
11751
11858
|
const source = await readFile5(file, "utf8");
|
|
11752
|
-
const finger2 =
|
|
11859
|
+
const finger2 = createHash5("sha1").update(source).digest("hex");
|
|
11753
11860
|
sources.push(source);
|
|
11754
11861
|
fingers.push(finger2);
|
|
11755
11862
|
}
|
|
11756
11863
|
}
|
|
11757
|
-
const finger =
|
|
11864
|
+
const finger = createHash5("sha1").update(sources.sort().join(" ")).digest("hex");
|
|
11758
11865
|
return build3(finger, async (write) => {
|
|
11759
11866
|
const defs = mergeTypeDefs([scalarSchema, baseSchema, ...sources]);
|
|
11760
11867
|
const output = print(defs);
|
|
@@ -11890,11 +11997,11 @@ var graphqlFeature = defineFeature({
|
|
|
11890
11997
|
// src/feature/http/index.ts
|
|
11891
11998
|
import { aws as aws9, Node as Node8 } from "@awsless/formation";
|
|
11892
11999
|
import { camelCase as camelCase4, constantCase as constantCase6 } from "change-case";
|
|
11893
|
-
import { relative as
|
|
12000
|
+
import { relative as relative4 } from "path";
|
|
11894
12001
|
var parseRoute = (route) => {
|
|
11895
12002
|
const [method, ...paths] = route.split(" ");
|
|
11896
|
-
const
|
|
11897
|
-
return { method, path
|
|
12003
|
+
const path = paths.join(" ");
|
|
12004
|
+
return { method, path };
|
|
11898
12005
|
};
|
|
11899
12006
|
var strToInt = (str) => {
|
|
11900
12007
|
return parseInt(Buffer.from(str, "utf8").toString("hex"), 16);
|
|
@@ -11915,12 +12022,12 @@ var httpFeature = defineFeature({
|
|
|
11915
12022
|
for (const [id, routes] of Object.entries(stack.http ?? {})) {
|
|
11916
12023
|
if (!(id in api)) api[id] = {};
|
|
11917
12024
|
for (const [route, props] of Object.entries(routes)) {
|
|
11918
|
-
const { path
|
|
12025
|
+
const { path, method } = parseRoute(route);
|
|
11919
12026
|
const file = typeof props === "string" ? props : props.file;
|
|
11920
12027
|
if (!(method in api[id])) {
|
|
11921
12028
|
api[id][method] = {};
|
|
11922
12029
|
}
|
|
11923
|
-
api[id][method][
|
|
12030
|
+
api[id][method][path] = file;
|
|
11924
12031
|
}
|
|
11925
12032
|
}
|
|
11926
12033
|
}
|
|
@@ -11928,15 +12035,15 @@ var httpFeature = defineFeature({
|
|
|
11928
12035
|
const idType = new TypeObject(2);
|
|
11929
12036
|
for (const [method, paths] of Object.entries(routes)) {
|
|
11930
12037
|
const methodType = new TypeObject(3);
|
|
11931
|
-
for (const [
|
|
12038
|
+
for (const [path, file] of Object.entries(paths)) {
|
|
11932
12039
|
const paramType = new TypeObject(4);
|
|
11933
|
-
for (const param of
|
|
12040
|
+
for (const param of path.matchAll(/{([a-z0-9]+)}/g)) {
|
|
11934
12041
|
paramType.addType(param[0], "string | number");
|
|
11935
12042
|
}
|
|
11936
|
-
const varName = camelCase4(`${id}-${
|
|
11937
|
-
const relFile =
|
|
12043
|
+
const varName = camelCase4(`${id}-${path}-${method}`);
|
|
12044
|
+
const relFile = relative4(directories.types, file);
|
|
11938
12045
|
types2.addImport(varName, relFile);
|
|
11939
|
-
methodType.add(`'${
|
|
12046
|
+
methodType.add(`'${path}'`, `Route<typeof ${varName}, ${paramType.toString() || "never"}>`);
|
|
11940
12047
|
}
|
|
11941
12048
|
idType.addConst(method, methodType);
|
|
11942
12049
|
}
|
|
@@ -12030,7 +12137,7 @@ var httpFeature = defineFeature({
|
|
|
12030
12137
|
const group = new Node8(ctx.stack, "http", id);
|
|
12031
12138
|
for (const [routeKey, routeProps] of Object.entries(routes)) {
|
|
12032
12139
|
const routeGroup = new Node8(group, "route", routeKey);
|
|
12033
|
-
const { method, path
|
|
12140
|
+
const { method, path } = parseRoute(routeKey);
|
|
12034
12141
|
const routeId = shortId(routeKey);
|
|
12035
12142
|
const { lambda } = createLambdaFunction(routeGroup, ctx, "http", `${id}-${routeId}`, {
|
|
12036
12143
|
...routeProps,
|
|
@@ -12058,7 +12165,7 @@ var httpFeature = defineFeature({
|
|
|
12058
12165
|
priority: generatePriority(ctx.stackConfig.name, routeKey),
|
|
12059
12166
|
conditions: [
|
|
12060
12167
|
aws9.elb.ListenerCondition.httpRequestMethods([method]),
|
|
12061
|
-
aws9.elb.ListenerCondition.pathPatterns([
|
|
12168
|
+
aws9.elb.ListenerCondition.pathPatterns([path])
|
|
12062
12169
|
],
|
|
12063
12170
|
actions: [aws9.elb.ListenerAction.forward([target.arn])]
|
|
12064
12171
|
}).dependsOn(target);
|
|
@@ -12416,7 +12523,7 @@ var pubsubFeature = defineFeature({
|
|
|
12416
12523
|
import { aws as aws14, Node as Node13 } from "@awsless/formation";
|
|
12417
12524
|
import { camelCase as camelCase5, constantCase as constantCase8 } from "change-case";
|
|
12418
12525
|
import deepmerge3 from "deepmerge";
|
|
12419
|
-
import { relative as
|
|
12526
|
+
import { relative as relative5 } from "path";
|
|
12420
12527
|
var typeGenCode3 = `
|
|
12421
12528
|
import { SendMessageOptions, SendMessageBatchOptions, BatchItem } from '@awsless/sqs'
|
|
12422
12529
|
import type { Mock } from 'vitest'
|
|
@@ -12454,7 +12561,7 @@ var queueFeature = defineFeature({
|
|
|
12454
12561
|
resourceName: name
|
|
12455
12562
|
});
|
|
12456
12563
|
const file = typeof fileOrProps === "string" ? fileOrProps : typeof fileOrProps.consumer === "string" ? fileOrProps.consumer : fileOrProps.consumer.file;
|
|
12457
|
-
const relFile =
|
|
12564
|
+
const relFile = relative5(directories.types, file);
|
|
12458
12565
|
gen.addImport(varName, relFile);
|
|
12459
12566
|
mock.addType(name, `MockBuilder<typeof ${varName}>`);
|
|
12460
12567
|
resource2.addType(name, `Send<'${queueName}', typeof ${varName}>`);
|
|
@@ -12602,7 +12709,7 @@ var restFeature = defineFeature({
|
|
|
12602
12709
|
import { camelCase as camelCase6, constantCase as constantCase10, paramCase as paramCase7 } from "change-case";
|
|
12603
12710
|
import { Asset as Asset5, aws as aws17, Node as Node16 } from "@awsless/formation";
|
|
12604
12711
|
import { mebibytes as mebibytes2 } from "@awsless/size";
|
|
12605
|
-
import { dirname as dirname10, join as
|
|
12712
|
+
import { dirname as dirname10, join as join11, relative as relative6 } from "path";
|
|
12606
12713
|
import { fileURLToPath } from "node:url";
|
|
12607
12714
|
|
|
12608
12715
|
// src/feature/function/prebuild.ts
|
|
@@ -12648,6 +12755,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, local2) => {
|
|
|
12648
12755
|
role: role.arn,
|
|
12649
12756
|
code,
|
|
12650
12757
|
runtime: props.runtime === "container" ? void 0 : props.runtime,
|
|
12758
|
+
layers: (props.layers ?? []).map((id2) => ctx.shared.get(`layer-${id2}-arn`)),
|
|
12651
12759
|
// Remove conflicting props.
|
|
12652
12760
|
vpc: void 0,
|
|
12653
12761
|
log: props.log
|
|
@@ -12760,7 +12868,7 @@ var rpcFeature = defineFeature({
|
|
|
12760
12868
|
const schema = new TypeObject(2);
|
|
12761
12869
|
for (const stack of ctx.stackConfigs) {
|
|
12762
12870
|
for (const [name, props] of Object.entries(stack.rpc?.[id] ?? {})) {
|
|
12763
|
-
const relFile =
|
|
12871
|
+
const relFile = relative6(directories.types, props.file);
|
|
12764
12872
|
const varName = camelCase6(`${stack.name}-${name}`);
|
|
12765
12873
|
types2.addImport(varName, relFile);
|
|
12766
12874
|
schema.addType(name, `Handle<typeof ${varName}>`);
|
|
@@ -12798,8 +12906,8 @@ var rpcFeature = defineFeature({
|
|
|
12798
12906
|
resourceName: id
|
|
12799
12907
|
});
|
|
12800
12908
|
const { lambda, policy, code } = createPrebuildLambdaFunction(group, ctx, "rpc", id, {
|
|
12801
|
-
bundleFile:
|
|
12802
|
-
bundleHash:
|
|
12909
|
+
bundleFile: join11(__dirname, "/prebuild/rpc/bundle.zip"),
|
|
12910
|
+
bundleHash: join11(__dirname, "/prebuild/rpc/HASH"),
|
|
12803
12911
|
memorySize: mebibytes2(256),
|
|
12804
12912
|
warm: 3,
|
|
12805
12913
|
log: props.log
|
|
@@ -12987,7 +13095,7 @@ var searchFeature = defineFeature({
|
|
|
12987
13095
|
import { days as days6, seconds as seconds4 } from "@awsless/duration";
|
|
12988
13096
|
import { Asset as Asset6, aws as aws19, Node as Node18 } from "@awsless/formation";
|
|
12989
13097
|
import { glob as glob2 } from "glob";
|
|
12990
|
-
import { join as
|
|
13098
|
+
import { join as join12 } from "path";
|
|
12991
13099
|
|
|
12992
13100
|
// src/feature/site/util.ts
|
|
12993
13101
|
import { lookup, contentType } from "mime-types";
|
|
@@ -13097,7 +13205,7 @@ var siteFeature = defineFeature({
|
|
|
13097
13205
|
const object = new aws19.s3.BucketObject(group, file, {
|
|
13098
13206
|
bucket: bucket.name,
|
|
13099
13207
|
key: file,
|
|
13100
|
-
body: Asset6.fromFile(
|
|
13208
|
+
body: Asset6.fromFile(join12(props.static, file)),
|
|
13101
13209
|
cacheControl: getCacheControl(file),
|
|
13102
13210
|
contentType: getContentType(file)
|
|
13103
13211
|
});
|
|
@@ -13478,7 +13586,7 @@ var tableFeature = defineFeature({
|
|
|
13478
13586
|
// src/feature/task/index.ts
|
|
13479
13587
|
import { Node as Node22 } from "@awsless/formation";
|
|
13480
13588
|
import { camelCase as camelCase7 } from "change-case";
|
|
13481
|
-
import { relative as
|
|
13589
|
+
import { relative as relative7 } from "path";
|
|
13482
13590
|
var typeGenCode6 = `
|
|
13483
13591
|
import { InvokeOptions } from '@awsless/lambda'
|
|
13484
13592
|
import type { Mock } from 'vitest'
|
|
@@ -13520,7 +13628,7 @@ var taskFeature = defineFeature({
|
|
|
13520
13628
|
resourceType: "task",
|
|
13521
13629
|
resourceName: name
|
|
13522
13630
|
});
|
|
13523
|
-
const relFile =
|
|
13631
|
+
const relFile = relative7(directories.types, props.consumer.file);
|
|
13524
13632
|
types2.addImport(varName, relFile);
|
|
13525
13633
|
resource2.addType(name, `Invoke<'${funcName}', typeof ${varName}>`);
|
|
13526
13634
|
mock.addType(name, `MockBuilder<typeof ${varName}>`);
|
|
@@ -13808,7 +13916,6 @@ var alertFeature = defineFeature({
|
|
|
13808
13916
|
|
|
13809
13917
|
// src/feature/layer/index.ts
|
|
13810
13918
|
import { Asset as Asset7, aws as aws26, Node as Node26 } from "@awsless/formation";
|
|
13811
|
-
import path from "path";
|
|
13812
13919
|
var layerFeature = defineFeature({
|
|
13813
13920
|
name: "layer",
|
|
13814
13921
|
onBefore(ctx) {
|
|
@@ -13849,7 +13956,7 @@ var layerFeature = defineFeature({
|
|
|
13849
13956
|
resourceType: "layer",
|
|
13850
13957
|
resourceName: shortId(id)
|
|
13851
13958
|
}),
|
|
13852
|
-
description:
|
|
13959
|
+
description: id,
|
|
13853
13960
|
architectures: props.architecture ? [props.architecture] : void 0,
|
|
13854
13961
|
runtimes: props.runtimes,
|
|
13855
13962
|
code: {
|
|
@@ -14036,11 +14143,11 @@ var logConfigError = (error) => {
|
|
|
14036
14143
|
const inStack = issue.path[0] === "stacks" && typeof issue.path[1] === "number";
|
|
14037
14144
|
const length = issue.path.length;
|
|
14038
14145
|
const end = ["}"];
|
|
14039
|
-
issue.path.forEach((
|
|
14146
|
+
issue.path.forEach((path, i) => {
|
|
14040
14147
|
const index = i + 1;
|
|
14041
|
-
context = context[
|
|
14042
|
-
if (typeof
|
|
14043
|
-
const key =
|
|
14148
|
+
context = context[path];
|
|
14149
|
+
if (typeof path === "string") {
|
|
14150
|
+
const key = path + `: `;
|
|
14044
14151
|
if (index === length) {
|
|
14045
14152
|
const space = " ".repeat(key.length);
|
|
14046
14153
|
const value = format(context);
|
|
@@ -14670,13 +14777,13 @@ import wildstring4 from "wildstring";
|
|
|
14670
14777
|
import { log as log8 } from "@clack/prompts";
|
|
14671
14778
|
import chalk6 from "chalk";
|
|
14672
14779
|
import { mkdir as mkdir5, readFile as readFile7, writeFile as writeFile3 } from "fs/promises";
|
|
14673
|
-
import { join as
|
|
14780
|
+
import { join as join15 } from "path";
|
|
14674
14781
|
import wildstring3 from "wildstring";
|
|
14675
14782
|
|
|
14676
14783
|
// src/build/__fingerprint.ts
|
|
14677
|
-
import { createHash as
|
|
14678
|
-
import { readdir as
|
|
14679
|
-
import { basename as basename5, dirname as dirname11, extname as extname3, join as
|
|
14784
|
+
import { createHash as createHash6 } from "crypto";
|
|
14785
|
+
import { readdir as readdir4, readFile as readFile6, stat as stat4 } from "fs/promises";
|
|
14786
|
+
import { basename as basename5, dirname as dirname11, extname as extname3, join as join13 } from "path";
|
|
14680
14787
|
import parseStaticImports from "parse-static-imports";
|
|
14681
14788
|
var extensions = ["js", "mjs", "jsx", "ts", "mts", "tsx"];
|
|
14682
14789
|
var generateFileHashes = async (file, hashes) => {
|
|
@@ -14685,7 +14792,7 @@ var generateFileHashes = async (file, hashes) => {
|
|
|
14685
14792
|
}
|
|
14686
14793
|
const code = await readModuleFile(file);
|
|
14687
14794
|
const deps = await findDependencies(file, code);
|
|
14688
|
-
const hash =
|
|
14795
|
+
const hash = createHash6("sha1").update(code).digest();
|
|
14689
14796
|
hashes.set(file, hash);
|
|
14690
14797
|
for (const dep of deps) {
|
|
14691
14798
|
if (dep.startsWith("/")) {
|
|
@@ -14695,14 +14802,14 @@ var generateFileHashes = async (file, hashes) => {
|
|
|
14695
14802
|
};
|
|
14696
14803
|
var fingerprintFromDirectory = async (dir) => {
|
|
14697
14804
|
const hashes = /* @__PURE__ */ new Map();
|
|
14698
|
-
const files = await
|
|
14805
|
+
const files = await readdir4(dir, { recursive: true });
|
|
14699
14806
|
for (const file of files) {
|
|
14700
14807
|
if (extensions.includes(extname3(file).substring(1)) && file.at(0) !== "_") {
|
|
14701
|
-
await generateFileHashes(
|
|
14808
|
+
await generateFileHashes(join13(dir, file), hashes);
|
|
14702
14809
|
}
|
|
14703
14810
|
}
|
|
14704
14811
|
const merge2 = Buffer.concat(Array.from(hashes.values()).sort());
|
|
14705
|
-
return
|
|
14812
|
+
return createHash6("sha1").update(merge2).digest("hex");
|
|
14706
14813
|
};
|
|
14707
14814
|
var readModuleFile = (file) => {
|
|
14708
14815
|
if (file.endsWith(".js")) {
|
|
@@ -14712,7 +14819,7 @@ var readModuleFile = (file) => {
|
|
|
14712
14819
|
return readFiles([
|
|
14713
14820
|
file,
|
|
14714
14821
|
...extensions.map((exp) => `${file}.${exp}`),
|
|
14715
|
-
...extensions.map((exp) =>
|
|
14822
|
+
...extensions.map((exp) => join13(file, `/index.${exp}`))
|
|
14716
14823
|
]);
|
|
14717
14824
|
}
|
|
14718
14825
|
return readFile6(file, "utf8");
|
|
@@ -14732,7 +14839,7 @@ var readFiles = async (files) => {
|
|
|
14732
14839
|
};
|
|
14733
14840
|
var findDependencies = async (file, code) => {
|
|
14734
14841
|
const imports = await parseStaticImports(code);
|
|
14735
|
-
return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ?
|
|
14842
|
+
return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ? join13(dirname11(file), value) : value);
|
|
14736
14843
|
};
|
|
14737
14844
|
|
|
14738
14845
|
// src/test/reporter.ts
|
|
@@ -14815,7 +14922,7 @@ import { startVitest } from "vitest/node";
|
|
|
14815
14922
|
import commonjs3 from "@rollup/plugin-commonjs";
|
|
14816
14923
|
import nodeResolve3 from "@rollup/plugin-node-resolve";
|
|
14817
14924
|
import json3 from "@rollup/plugin-json";
|
|
14818
|
-
import { dirname as dirname12, join as
|
|
14925
|
+
import { dirname as dirname12, join as join14 } from "path";
|
|
14819
14926
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
14820
14927
|
var startTest = async (props) => {
|
|
14821
14928
|
const __dirname2 = dirname12(fileURLToPath2(import.meta.url));
|
|
@@ -14832,7 +14939,7 @@ var startTest = async (props) => {
|
|
|
14832
14939
|
exclude: ["**/_*", "**/_*/**", ...configDefaults.exclude],
|
|
14833
14940
|
globals: true,
|
|
14834
14941
|
reporters: props.reporter,
|
|
14835
|
-
globalSetup:
|
|
14942
|
+
globalSetup: join14(__dirname2, "test-global-setup.js")
|
|
14836
14943
|
// env: {
|
|
14837
14944
|
// TZ: 'UTC',
|
|
14838
14945
|
// },
|
|
@@ -14926,7 +15033,7 @@ var logTestErrors = (event) => {
|
|
|
14926
15033
|
var runTest = async (stack, dir, filters) => {
|
|
14927
15034
|
await mkdir5(directories.test, { recursive: true });
|
|
14928
15035
|
const fingerprint = await fingerprintFromDirectory(dir);
|
|
14929
|
-
const file =
|
|
15036
|
+
const file = join15(directories.test, `${stack}.json`);
|
|
14930
15037
|
const exists = await fileExist(file);
|
|
14931
15038
|
if (exists && !process.env.NO_CACHE) {
|
|
14932
15039
|
const raw = await readFile7(file, { encoding: "utf8" });
|
|
@@ -14988,8 +15095,8 @@ var runTests = async (tests, stackFilters = [], testFilters = []) => {
|
|
|
14988
15095
|
continue;
|
|
14989
15096
|
}
|
|
14990
15097
|
}
|
|
14991
|
-
for (const
|
|
14992
|
-
const result = await runTest(test2.name,
|
|
15098
|
+
for (const path of test2.paths) {
|
|
15099
|
+
const result = await runTest(test2.name, path, testFilters);
|
|
14993
15100
|
if (!result) {
|
|
14994
15101
|
return false;
|
|
14995
15102
|
}
|
|
@@ -15180,12 +15287,13 @@ var bind = (program2) => {
|
|
|
15180
15287
|
} else {
|
|
15181
15288
|
log9.warning("No bindings available.");
|
|
15182
15289
|
}
|
|
15290
|
+
const configList = opts.config ?? [];
|
|
15183
15291
|
const configs = {};
|
|
15184
|
-
for (const name of
|
|
15292
|
+
for (const name of configList) {
|
|
15185
15293
|
configs[`CONFIG_${constantCase14(name)}`] = name;
|
|
15186
15294
|
}
|
|
15187
|
-
if (
|
|
15188
|
-
note3(wrap(
|
|
15295
|
+
if (configList.length ?? 0 > 0) {
|
|
15296
|
+
note3(wrap(configList.map((v) => color.label(constantCase14(v)))), "Bind Config");
|
|
15189
15297
|
}
|
|
15190
15298
|
if (commands7.length === 0) {
|
|
15191
15299
|
return "No command to execute.";
|
|
@@ -15248,7 +15356,7 @@ import { log as log10 } from "@clack/prompts";
|
|
|
15248
15356
|
|
|
15249
15357
|
// src/type-gen/generate.ts
|
|
15250
15358
|
import { mkdir as mkdir6, writeFile as writeFile4 } from "fs/promises";
|
|
15251
|
-
import { dirname as dirname13, join as
|
|
15359
|
+
import { dirname as dirname13, join as join16, relative as relative8 } from "path";
|
|
15252
15360
|
var generateTypes = async (props) => {
|
|
15253
15361
|
const files = [];
|
|
15254
15362
|
await Promise.all(
|
|
@@ -15257,13 +15365,13 @@ var generateTypes = async (props) => {
|
|
|
15257
15365
|
...props,
|
|
15258
15366
|
async write(file, data, include = false) {
|
|
15259
15367
|
const code = data?.toString("utf8");
|
|
15260
|
-
const
|
|
15368
|
+
const path = join16(directories.types, file);
|
|
15261
15369
|
if (code) {
|
|
15262
15370
|
if (include) {
|
|
15263
|
-
files.push(
|
|
15371
|
+
files.push(relative8(directories.root, path));
|
|
15264
15372
|
}
|
|
15265
|
-
await mkdir6(dirname13(
|
|
15266
|
-
await writeFile4(
|
|
15373
|
+
await mkdir6(dirname13(path), { recursive: true });
|
|
15374
|
+
await writeFile4(path, code);
|
|
15267
15375
|
}
|
|
15268
15376
|
}
|
|
15269
15377
|
});
|
|
@@ -15271,7 +15379,7 @@ var generateTypes = async (props) => {
|
|
|
15271
15379
|
);
|
|
15272
15380
|
if (files.length) {
|
|
15273
15381
|
const code = files.map((file) => `/// <reference path='${file}' />`).join("\n");
|
|
15274
|
-
await writeFile4(
|
|
15382
|
+
await writeFile4(join16(directories.root, `awsless.d.ts`), code);
|
|
15275
15383
|
}
|
|
15276
15384
|
};
|
|
15277
15385
|
|