@awsless/awsless 0.0.543 → 0.0.545
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 +154 -138
- package/dist/build-json-schema.js +43 -53
- package/dist/chunk-W4ED7XCC.js +9 -0
- package/dist/prebuild/icon/bundle.zip +0 -0
- package/dist/prebuild/image/bundle.zip +0 -0
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/server.d.ts +5 -1
- package/dist/server.js +16 -0
- package/dist/stack.json +1 -1
- package/package.json +13 -13
|
@@ -542,55 +542,52 @@ var RpcSchema = z19.record(ResourceIdSchema, z19.record(z19.string(), FunctionSc
|
|
|
542
542
|
|
|
543
543
|
// src/feature/instance/schema.ts
|
|
544
544
|
import { days as days3, toDays as toDays2 } from "@awsless/duration";
|
|
545
|
+
import { toMebibytes } from "@awsless/size";
|
|
545
546
|
import { z as z20 } from "zod";
|
|
546
|
-
var
|
|
547
|
-
|
|
548
|
-
z20.literal("0.5 vCPU"),
|
|
549
|
-
z20.literal("1 vCPU"),
|
|
550
|
-
z20.literal("2 vCPU"),
|
|
551
|
-
z20.literal("4 vCPU"),
|
|
552
|
-
z20.literal("8 vCPU"),
|
|
553
|
-
z20.literal("16 vCPU")
|
|
554
|
-
]).describe(
|
|
555
|
-
"The number of vCPU units used by the task. For tasks using the Fargate launch type, this field is required. Valid values: 0.25, 0.5, 1, 2, 4, 8, 16 vCPU."
|
|
547
|
+
var CpuSchema = z20.union([z20.literal(0.25), z20.literal(0.5), z20.literal(1), z20.literal(2), z20.literal(4), z20.literal(8), z20.literal(16)]).transform((v) => `${v} vCPU`).describe(
|
|
548
|
+
"The number of virtual CPU units (vCPU) used by the task. For tasks using the Fargate launch type, this field is required. Valid values: 0.25, 0.5, 1, 2, 4, 8, 16 vCPU."
|
|
556
549
|
);
|
|
557
|
-
var
|
|
550
|
+
var validMemorySize = [
|
|
558
551
|
// 0.25 vCPU
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
552
|
+
512,
|
|
553
|
+
1024,
|
|
554
|
+
2048,
|
|
562
555
|
// 0.5 vCPU
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
556
|
+
1024,
|
|
557
|
+
2048,
|
|
558
|
+
3072,
|
|
559
|
+
4096,
|
|
567
560
|
// 1 vCPU
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
561
|
+
2048,
|
|
562
|
+
3072,
|
|
563
|
+
4096,
|
|
564
|
+
5120,
|
|
565
|
+
6144,
|
|
566
|
+
7168,
|
|
567
|
+
8192,
|
|
575
568
|
// 2 vCPU
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
]
|
|
569
|
+
4096,
|
|
570
|
+
5120,
|
|
571
|
+
6144,
|
|
572
|
+
7168,
|
|
573
|
+
8192,
|
|
574
|
+
9216,
|
|
575
|
+
10240,
|
|
576
|
+
11264,
|
|
577
|
+
12288,
|
|
578
|
+
13312,
|
|
579
|
+
14336,
|
|
580
|
+
15360,
|
|
581
|
+
16384
|
|
582
|
+
];
|
|
583
|
+
var MemorySizeSchema2 = SizeSchema.refine(
|
|
584
|
+
(s) => validMemorySize.includes(toMebibytes(s)),
|
|
585
|
+
`Invalid memory size. Allowed sizes: ${validMemorySize.join(", ")} MiB`
|
|
586
|
+
).describe(
|
|
590
587
|
"The amount of memory (in MiB) used by the task. For tasks using the Fargate launch type, this field is required and must be compatible with the CPU value. Valid memory values depend on the CPU configuration."
|
|
591
588
|
);
|
|
592
589
|
var HealthCheckSchema = z20.object({
|
|
593
|
-
|
|
590
|
+
path: z20.string().describe("The path that the container runs to determine if it is healthy."),
|
|
594
591
|
interval: DurationSchema.describe("The time period in seconds between each health check execution."),
|
|
595
592
|
retries: z20.number().int().min(1).max(10).describe(
|
|
596
593
|
"The number of times to retry a failed health check before the container is considered unhealthy."
|
|
@@ -602,13 +599,6 @@ var HealthCheckSchema = z20.object({
|
|
|
602
599
|
"The time period in seconds to wait for a health check to succeed before it is considered a failure."
|
|
603
600
|
)
|
|
604
601
|
}).describe("The health check command and associated configuration parameters for the container.");
|
|
605
|
-
var RestartPolicySchema = z20.object({
|
|
606
|
-
enabled: z20.boolean().describe("Whether to enable the restart policy for the container."),
|
|
607
|
-
ignoredExitCodes: z20.number().int().array().optional().describe("A list of exit codes that Amazon ECS will ignore and not attempt a restart against."),
|
|
608
|
-
restartAttemptPeriod: z20.number().int().min(0).max(1800).optional().describe(
|
|
609
|
-
"A period of time (in seconds) that the container must run for before a restart can be attempted. A container can be restarted only once every restartAttemptPeriod seconds. If a container isn't able to run for this time period and exits early, it will not be restarted. You can set a minimum restartAttemptPeriod of 60 seconds and a maximum restartAttemptPeriod of 1800 seconds."
|
|
610
|
-
)
|
|
611
|
-
}).describe("The restart policy for the container. This parameter maps to the --restart option to docker run.");
|
|
612
602
|
var EnvironmentSchema2 = z20.record(z20.string(), z20.string()).optional().describe("Environment variable key-value pairs.");
|
|
613
603
|
var ArchitectureSchema3 = z20.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
|
|
614
604
|
var ActionSchema2 = z20.string();
|
|
@@ -662,13 +652,13 @@ var ISchema = z20.object({
|
|
|
662
652
|
description: DescriptionSchema2.optional(),
|
|
663
653
|
image: ImageSchema.optional(),
|
|
664
654
|
log: LogSchema2.optional(),
|
|
655
|
+
cpu: CpuSchema.optional(),
|
|
665
656
|
memorySize: MemorySizeSchema2.optional(),
|
|
666
|
-
cpuSize: CpuSizeSchema.optional(),
|
|
667
657
|
architecture: ArchitectureSchema3.optional(),
|
|
668
658
|
environment: EnvironmentSchema2.optional(),
|
|
669
659
|
permissions: PermissionsSchema2.optional(),
|
|
670
|
-
healthCheck: HealthCheckSchema.optional()
|
|
671
|
-
restartPolicy: RestartPolicySchema.optional()
|
|
660
|
+
healthCheck: HealthCheckSchema.optional()
|
|
661
|
+
// restartPolicy: RestartPolicySchema.optional(),
|
|
672
662
|
});
|
|
673
663
|
var InstanceSchema = z20.union([
|
|
674
664
|
LocalFileSchema.transform((code) => ({
|
|
@@ -679,13 +669,13 @@ var InstanceSchema = z20.union([
|
|
|
679
669
|
var InstancesSchema = z20.record(ResourceIdSchema, InstanceSchema).optional().describe("Define the instances in your stack.");
|
|
680
670
|
var InstanceDefaultSchema = z20.object({
|
|
681
671
|
image: ImageSchema.default("public.ecr.aws/aws-cli/aws-cli:amd64"),
|
|
682
|
-
|
|
683
|
-
|
|
672
|
+
cpu: CpuSchema.default(0.25),
|
|
673
|
+
memorySize: MemorySizeSchema2.default("512 MB"),
|
|
684
674
|
architecture: ArchitectureSchema3.default("arm64"),
|
|
685
675
|
environment: EnvironmentSchema2.optional(),
|
|
686
676
|
permissions: PermissionsSchema2.optional(),
|
|
687
677
|
healthCheck: HealthCheckSchema.optional(),
|
|
688
|
-
restartPolicy: RestartPolicySchema.default({ enabled: true }),
|
|
678
|
+
// restartPolicy: RestartPolicySchema.default({ enabled: true }),
|
|
689
679
|
log: LogSchema2.default(true).transform((log) => ({
|
|
690
680
|
retention: log.retention ?? days3(7)
|
|
691
681
|
}))
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/server.d.ts
CHANGED
|
@@ -85,6 +85,10 @@ interface FunctionResources {
|
|
|
85
85
|
declare const Function: FunctionResources;
|
|
86
86
|
declare const Fn: FunctionResources;
|
|
87
87
|
|
|
88
|
+
interface InstanceResources {
|
|
89
|
+
}
|
|
90
|
+
declare const Instance: InstanceResources;
|
|
91
|
+
|
|
88
92
|
declare const getPubSubTopic: <N extends string>(name: N) => `app/pubsub/${N}`;
|
|
89
93
|
|
|
90
94
|
type PublishOptions = {
|
|
@@ -159,4 +163,4 @@ declare const Topic: TopicResources;
|
|
|
159
163
|
declare const APP: "app";
|
|
160
164
|
declare const STACK: "stack";
|
|
161
165
|
|
|
162
|
-
export { APP, Alert, type AlertMock, type AlertMockResponse, type AlertResources, Auth, type AuthResources, Cache, type CacheResources, type CommandContext, type CommandHandler, Config, type ConfigResources, Fn, Function, type FunctionMock, type FunctionMockResponse, type FunctionResources, PubSub, type PublishOptions, Queue, type QueueMock, type QueueMockResponse, type QueueResources, type RpcAuthorizerResponse, STACK, Search, type SearchResources, Store, type StoreResources, Table, type TableResources, Task, type TaskMock, type TaskMockResponse, type TaskResources, Topic, type TopicMock, type TopicMockResponse, type TopicResources, getAlertName, getAuthProps, getCacheProps, getConfigName, getConfigValue, getFunctionName, getPubSubTopic, getQueueName, getQueueUrl, getSearchName, getSearchProps, getSiteBucketName, getStoreName, getTableName, getTaskName, getTopicName, mockAlert, mockCache, mockFunction, mockPubSub, mockQueue, mockTask, mockTopic, pubsubAuthorizerHandle, pubsubAuthorizerResponse, setConfigValue };
|
|
166
|
+
export { APP, Alert, type AlertMock, type AlertMockResponse, type AlertResources, Auth, type AuthResources, Cache, type CacheResources, type CommandContext, type CommandHandler, Config, type ConfigResources, Fn, Function, type FunctionMock, type FunctionMockResponse, type FunctionResources, Instance, type InstanceResources, PubSub, type PublishOptions, Queue, type QueueMock, type QueueMockResponse, type QueueResources, type RpcAuthorizerResponse, STACK, Search, type SearchResources, Store, type StoreResources, Table, type TableResources, Task, type TaskMock, type TaskMockResponse, type TaskResources, Topic, type TopicMock, type TopicMockResponse, type TopicResources, getAlertName, getAuthProps, getCacheProps, getConfigName, getConfigValue, getFunctionName, getPubSubTopic, getQueueName, getQueueUrl, getSearchName, getSearchProps, getSiteBucketName, getStoreName, getTableName, getTaskName, getTopicName, mockAlert, mockCache, mockFunction, mockPubSub, mockQueue, mockTask, mockTopic, pubsubAuthorizerHandle, pubsubAuthorizerResponse, setConfigValue };
|
package/dist/server.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
shortId
|
|
3
|
+
} from "./chunk-W4ED7XCC.js";
|
|
1
4
|
import {
|
|
2
5
|
createProxy
|
|
3
6
|
} from "./chunk-2LRBH7VV.js";
|
|
@@ -263,6 +266,11 @@ var mockTask = (cb) => {
|
|
|
263
266
|
cb(mock);
|
|
264
267
|
mockLambda2(list);
|
|
265
268
|
mockScheduler(list);
|
|
269
|
+
beforeEach && beforeEach(() => {
|
|
270
|
+
for (const item of Object.values(list)) {
|
|
271
|
+
item.mockClear();
|
|
272
|
+
}
|
|
273
|
+
});
|
|
266
274
|
return createProxy((stack) => {
|
|
267
275
|
return createProxy((name) => {
|
|
268
276
|
return list[getTaskName(name, stack)];
|
|
@@ -425,6 +433,13 @@ var Config = /* @__PURE__ */ new Proxy(
|
|
|
425
433
|
}
|
|
426
434
|
);
|
|
427
435
|
|
|
436
|
+
// src/lib/server/instance.ts
|
|
437
|
+
var Instance = /* @__PURE__ */ createProxy((stack) => {
|
|
438
|
+
return createProxy((name) => {
|
|
439
|
+
return `http://${shortId(`${stack}:${name}`)}.${APP}`;
|
|
440
|
+
});
|
|
441
|
+
});
|
|
442
|
+
|
|
428
443
|
// src/lib/server/pubsub.ts
|
|
429
444
|
import { hours, toSeconds } from "@awsless/duration";
|
|
430
445
|
import { publish as publish3, QoS } from "@awsless/iot";
|
|
@@ -590,6 +605,7 @@ export {
|
|
|
590
605
|
Config,
|
|
591
606
|
Fn,
|
|
592
607
|
Function,
|
|
608
|
+
Instance,
|
|
593
609
|
PubSub,
|
|
594
610
|
QoS,
|
|
595
611
|
Queue,
|