@awsless/awsless 0.0.366 → 0.0.367
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 +521 -229
- package/dist/build-json-schema.js +122 -107
- package/dist/prebuild/rpc/HASH +1 -0
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/prebuild.js +153 -0
- package/dist/server.d.ts +10 -1
- package/dist/stack.json +1 -1
- package/package.json +15 -13
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
3
3
|
|
|
4
4
|
// src/config/stack.ts
|
|
5
|
-
import { z as
|
|
5
|
+
import { z as z30 } from "zod";
|
|
6
6
|
|
|
7
7
|
// src/feature/auth/schema.ts
|
|
8
8
|
import { z as z7 } from "zod";
|
|
@@ -172,32 +172,33 @@ var BuildSchema = z5.object({
|
|
|
172
172
|
minify: MinifySchema.default(true),
|
|
173
173
|
external: z5.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
|
|
174
174
|
}).describe(`Options for the function bundler`);
|
|
175
|
+
var FnSchema = z5.object({
|
|
176
|
+
file: FileSchema,
|
|
177
|
+
// node
|
|
178
|
+
handler: HandlerSchema.optional(),
|
|
179
|
+
build: BuildSchema.optional(),
|
|
180
|
+
// container
|
|
181
|
+
// ...
|
|
182
|
+
runtime: RuntimeSchema.optional(),
|
|
183
|
+
description: DescriptionSchema.optional(),
|
|
184
|
+
warm: WarmSchema.optional(),
|
|
185
|
+
vpc: VPCSchema.optional(),
|
|
186
|
+
log: LogSchema.optional(),
|
|
187
|
+
timeout: TimeoutSchema.optional(),
|
|
188
|
+
memorySize: MemorySizeSchema.optional(),
|
|
189
|
+
architecture: ArchitectureSchema.optional(),
|
|
190
|
+
ephemeralStorageSize: EphemeralStorageSizeSchema.optional(),
|
|
191
|
+
retryAttempts: RetryAttemptsSchema.optional(),
|
|
192
|
+
reserved: ReservedConcurrentExecutionsSchema.optional(),
|
|
193
|
+
layers: LayersSchema.optional(),
|
|
194
|
+
environment: EnvironmentSchema.optional(),
|
|
195
|
+
permissions: PermissionsSchema.optional()
|
|
196
|
+
});
|
|
175
197
|
var FunctionSchema = z5.union([
|
|
176
198
|
LocalFileSchema.transform((file) => ({
|
|
177
199
|
file
|
|
178
200
|
})),
|
|
179
|
-
|
|
180
|
-
file: FileSchema,
|
|
181
|
-
// node
|
|
182
|
-
handler: HandlerSchema.optional(),
|
|
183
|
-
build: BuildSchema.optional(),
|
|
184
|
-
// container
|
|
185
|
-
// ...
|
|
186
|
-
runtime: RuntimeSchema.optional(),
|
|
187
|
-
description: DescriptionSchema.optional(),
|
|
188
|
-
warm: WarmSchema.optional(),
|
|
189
|
-
vpc: VPCSchema.optional(),
|
|
190
|
-
log: LogSchema.optional(),
|
|
191
|
-
timeout: TimeoutSchema.optional(),
|
|
192
|
-
memorySize: MemorySizeSchema.optional(),
|
|
193
|
-
architecture: ArchitectureSchema.optional(),
|
|
194
|
-
ephemeralStorageSize: EphemeralStorageSizeSchema.optional(),
|
|
195
|
-
retryAttempts: RetryAttemptsSchema.optional(),
|
|
196
|
-
reserved: ReservedConcurrentExecutionsSchema.optional(),
|
|
197
|
-
layers: LayersSchema.optional(),
|
|
198
|
-
environment: EnvironmentSchema.optional(),
|
|
199
|
-
permissions: PermissionsSchema.optional()
|
|
200
|
-
})
|
|
201
|
+
FnSchema
|
|
201
202
|
]);
|
|
202
203
|
var FunctionsSchema = z5.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
|
|
203
204
|
var FunctionDefaultSchema = z5.object({
|
|
@@ -674,11 +675,23 @@ var RestDefaultSchema = z20.record(
|
|
|
674
675
|
).optional().describe("Define your global REST API's.");
|
|
675
676
|
var RestSchema = z20.record(ResourceIdSchema, z20.record(RouteSchema2, FunctionSchema)).optional().describe("Define routes in your stack for your global REST API.");
|
|
676
677
|
|
|
678
|
+
// src/feature/rpc/schema.ts
|
|
679
|
+
import { z as z21 } from "zod";
|
|
680
|
+
var RpcDefaultSchema = z21.record(
|
|
681
|
+
ResourceIdSchema,
|
|
682
|
+
z21.object({
|
|
683
|
+
domain: ResourceIdSchema.describe("The domain id to link your RPC API with.").optional(),
|
|
684
|
+
subDomain: z21.string().optional(),
|
|
685
|
+
auth: FunctionSchema.optional()
|
|
686
|
+
})
|
|
687
|
+
).describe(`Define the global RPC API's.`).optional();
|
|
688
|
+
var RpcSchema = z21.record(ResourceIdSchema, z21.record(z21.string(), FunctionSchema).describe("The queries for your global RPC API.")).describe("Define the schema in your stack for your global RPC API.").optional();
|
|
689
|
+
|
|
677
690
|
// src/feature/search/schema.ts
|
|
678
691
|
import { gibibytes as gibibytes2 } from "@awsless/size";
|
|
679
|
-
import { z as
|
|
680
|
-
var VersionSchema =
|
|
681
|
-
var TypeSchema3 =
|
|
692
|
+
import { z as z22 } from "zod";
|
|
693
|
+
var VersionSchema = z22.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
|
|
694
|
+
var TypeSchema3 = z22.enum([
|
|
682
695
|
"t3.small",
|
|
683
696
|
"t3.medium",
|
|
684
697
|
"m3.medium",
|
|
@@ -753,41 +766,41 @@ var TypeSchema3 = z21.enum([
|
|
|
753
766
|
"r6gd.16xlarge"
|
|
754
767
|
]);
|
|
755
768
|
var StorageSizeSchema = SizeSchema.refine(sizeMin(gibibytes2(10)), "Minimum storage size is 10 GB").refine(sizeMax(gibibytes2(100)), "Maximum storage size is 100 GB").describe("The size of the function's /tmp directory. You can specify a size value from 512 MB to 10 GiB.");
|
|
756
|
-
var SearchsSchema =
|
|
769
|
+
var SearchsSchema = z22.record(
|
|
757
770
|
ResourceIdSchema,
|
|
758
|
-
|
|
771
|
+
z22.object({
|
|
759
772
|
type: TypeSchema3.default("t3.small"),
|
|
760
|
-
count:
|
|
773
|
+
count: z22.number().int().min(1).default(1),
|
|
761
774
|
version: VersionSchema.default("2.13"),
|
|
762
775
|
storage: StorageSizeSchema.default("10 GB"),
|
|
763
|
-
vpc:
|
|
776
|
+
vpc: z22.boolean().default(false)
|
|
764
777
|
})
|
|
765
778
|
).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
|
|
766
779
|
|
|
767
780
|
// src/feature/site/schema.ts
|
|
768
|
-
import { z as
|
|
769
|
-
var ErrorResponsePathSchema =
|
|
781
|
+
import { z as z23 } from "zod";
|
|
782
|
+
var ErrorResponsePathSchema = z23.string().describe(
|
|
770
783
|
"The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.\n - We recommend that you store custom error pages in an Amazon S3 bucket. If you store custom error pages on an HTTP server and the server starts to return 5xx errors, CloudFront can't get the files that you want to return to viewers because the origin server is unavailable."
|
|
771
784
|
);
|
|
772
|
-
var StatusCodeSchema =
|
|
785
|
+
var StatusCodeSchema = z23.number().int().positive().optional().describe(
|
|
773
786
|
"The HTTP status code that you want CloudFront to return to the viewer along with the custom error page. There are a variety of reasons that you might want CloudFront to return a status code different from the status code that your origin returned to CloudFront, for example:\n- Some Internet devices (some firewalls and corporate proxies, for example) intercept HTTP 4xx and 5xx and prevent the response from being returned to the viewer. If you substitute 200, the response typically won't be intercepted.\n- If you don't care about distinguishing among different client errors or server errors, you can specify 400 or 500 as the ResponseCode for all 4xx or 5xx errors.\n- You might want to return a 200 status code (OK) and static website so your customers don't know that your website is down."
|
|
774
787
|
);
|
|
775
788
|
var MinTTLSchema = DurationSchema.describe(
|
|
776
789
|
"The minimum amount of time, that you want to cache the error response. When this time period has elapsed, CloudFront queries your origin to see whether the problem that caused the error has been resolved and the requested object is now available."
|
|
777
790
|
);
|
|
778
|
-
var ErrorResponseSchema =
|
|
791
|
+
var ErrorResponseSchema = z23.union([
|
|
779
792
|
ErrorResponsePathSchema,
|
|
780
|
-
|
|
793
|
+
z23.object({
|
|
781
794
|
path: ErrorResponsePathSchema,
|
|
782
795
|
statusCode: StatusCodeSchema.optional(),
|
|
783
796
|
minTTL: MinTTLSchema.optional()
|
|
784
797
|
})
|
|
785
798
|
]).optional();
|
|
786
|
-
var SitesSchema =
|
|
799
|
+
var SitesSchema = z23.record(
|
|
787
800
|
ResourceIdSchema,
|
|
788
|
-
|
|
801
|
+
z23.object({
|
|
789
802
|
domain: ResourceIdSchema.describe("The domain id to link your site with.").optional(),
|
|
790
|
-
subDomain:
|
|
803
|
+
subDomain: z23.string().optional(),
|
|
791
804
|
// bind: z
|
|
792
805
|
// .object({
|
|
793
806
|
// auth: z.array(ResourceIdSchema),
|
|
@@ -810,7 +823,7 @@ var SitesSchema = z22.record(
|
|
|
810
823
|
// build: z.string().optional(),
|
|
811
824
|
// }),
|
|
812
825
|
// ]),
|
|
813
|
-
errors:
|
|
826
|
+
errors: z23.object({
|
|
814
827
|
400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
|
|
815
828
|
403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
|
|
816
829
|
404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
|
|
@@ -823,16 +836,16 @@ var SitesSchema = z22.record(
|
|
|
823
836
|
503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
|
|
824
837
|
504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
|
|
825
838
|
}).optional().describe("Customize the error responses for specific HTTP status codes."),
|
|
826
|
-
cors:
|
|
827
|
-
override:
|
|
839
|
+
cors: z23.object({
|
|
840
|
+
override: z23.boolean().default(false),
|
|
828
841
|
maxAge: DurationSchema.default("365 days"),
|
|
829
|
-
exposeHeaders:
|
|
830
|
-
credentials:
|
|
831
|
-
headers:
|
|
832
|
-
origins:
|
|
833
|
-
methods:
|
|
842
|
+
exposeHeaders: z23.string().array().optional(),
|
|
843
|
+
credentials: z23.boolean().default(false),
|
|
844
|
+
headers: z23.string().array().default(["*"]),
|
|
845
|
+
origins: z23.string().array().default(["*"]),
|
|
846
|
+
methods: z23.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
|
|
834
847
|
}).optional().describe("Define the cors headers."),
|
|
835
|
-
security:
|
|
848
|
+
security: z23.object({
|
|
836
849
|
// contentSecurityPolicy: z.object({
|
|
837
850
|
// override: z.boolean().default(false),
|
|
838
851
|
// policy: z.string(),
|
|
@@ -874,10 +887,10 @@ var SitesSchema = z22.record(
|
|
|
874
887
|
// reportUri?: string
|
|
875
888
|
// }
|
|
876
889
|
}).optional().describe("Define the security policy."),
|
|
877
|
-
cache:
|
|
878
|
-
cookies:
|
|
879
|
-
headers:
|
|
880
|
-
queries:
|
|
890
|
+
cache: z23.object({
|
|
891
|
+
cookies: z23.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
|
|
892
|
+
headers: z23.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
|
|
893
|
+
queries: z23.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
|
|
881
894
|
}).optional().describe(
|
|
882
895
|
"Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
|
|
883
896
|
)
|
|
@@ -885,26 +898,26 @@ var SitesSchema = z22.record(
|
|
|
885
898
|
).optional().describe("Define the sites in your stack.");
|
|
886
899
|
|
|
887
900
|
// src/feature/store/schema.ts
|
|
888
|
-
import { z as
|
|
889
|
-
var DeletionProtectionSchema =
|
|
890
|
-
var StoreDefaultSchema =
|
|
901
|
+
import { z as z24 } from "zod";
|
|
902
|
+
var DeletionProtectionSchema = z24.boolean().describe("Specifies if you want to protect the store from being deleted by awsless.");
|
|
903
|
+
var StoreDefaultSchema = z24.object({
|
|
891
904
|
deletionProtection: DeletionProtectionSchema.optional()
|
|
892
905
|
}).optional();
|
|
893
|
-
var StoresSchema =
|
|
894
|
-
|
|
906
|
+
var StoresSchema = z24.union([
|
|
907
|
+
z24.array(ResourceIdSchema).transform((list) => {
|
|
895
908
|
const stores = {};
|
|
896
909
|
for (const key of list) {
|
|
897
910
|
stores[key] = {};
|
|
898
911
|
}
|
|
899
912
|
return stores;
|
|
900
913
|
}),
|
|
901
|
-
|
|
914
|
+
z24.record(
|
|
902
915
|
ResourceIdSchema,
|
|
903
|
-
|
|
916
|
+
z24.object({
|
|
904
917
|
// cors: CorsSchema,
|
|
905
918
|
deletionProtection: DeletionProtectionSchema.optional(),
|
|
906
|
-
versioning:
|
|
907
|
-
events:
|
|
919
|
+
versioning: z24.boolean().default(false).describe("Enable versioning of your store."),
|
|
920
|
+
events: z24.object({
|
|
908
921
|
// create
|
|
909
922
|
"created:*": FunctionSchema.optional().describe(
|
|
910
923
|
"Subscribe to notifications regardless of the API that was used to create an object."
|
|
@@ -937,22 +950,22 @@ var StoresSchema = z23.union([
|
|
|
937
950
|
]).optional().describe("Define the stores in your stack.");
|
|
938
951
|
|
|
939
952
|
// src/feature/stream/schema.ts
|
|
940
|
-
import { z as
|
|
941
|
-
var LatencyModeSchema =
|
|
953
|
+
import { z as z25 } from "zod";
|
|
954
|
+
var LatencyModeSchema = z25.enum(["low", "normal"]).describe(
|
|
942
955
|
`Channel latency mode. Valid values:
|
|
943
956
|
- normal: Use "normal" to broadcast and deliver live video up to Full HD.
|
|
944
957
|
- low: Use "low" for near real-time interactions with viewers.`
|
|
945
958
|
);
|
|
946
|
-
var TypeSchema4 =
|
|
959
|
+
var TypeSchema4 = z25.enum(["standard", "basic", "advanced-sd", "advanced-hd"]).describe(`The channel type, which determines the allowable resolution and bitrate.
|
|
947
960
|
If you exceed the allowable resolution or bitrate, the stream probably will disconnect immediately. Valid values:
|
|
948
961
|
- standard: Video is transcoded: multiple qualities are generated from the original input to automatically give viewers the best experience for their devices and network conditions. Transcoding allows higher playback quality across a range of download speeds. Resolution can be up to 1080p and bitrate can be up to 8.5 Mbps. Audio is transcoded only for renditions 360p and below; above that, audio is passed through.
|
|
949
962
|
- basic: Video is transmuxed: Amazon IVS delivers the original input to viewers. The viewer's video-quality choice is limited to the original input. Resolution can be up to 1080p and bitrate can be up to 1.5 Mbps for 480p and up to 3.5 Mbps for resolutions between 480p and 1080p.
|
|
950
963
|
- advanced-sd: Video is transcoded; multiple qualities are generated from the original input, to automatically give viewers the best experience for their devices and network conditions. Input resolution can be up to 1080p and bitrate can be up to 8.5 Mbps; output is capped at SD quality (480p). You can select an optional transcode preset (see below). Audio for all renditions is transcoded, and an audio-only rendition is available.
|
|
951
964
|
- advanced-hd: Video is transcoded; multiple qualities are generated from the original input, to automatically give viewers the best experience for their devices and network conditions. Input resolution can be up to 1080p and bitrate can be up to 8.5 Mbps; output is capped at HD quality (720p). You can select an optional transcode preset (see below). Audio for all renditions is transcoded, and an audio-only rendition is available.
|
|
952
965
|
`);
|
|
953
|
-
var StreamsSchema =
|
|
966
|
+
var StreamsSchema = z25.record(
|
|
954
967
|
ResourceIdSchema,
|
|
955
|
-
|
|
968
|
+
z25.object({
|
|
956
969
|
type: TypeSchema4.default("standard"),
|
|
957
970
|
// preset: PresetSchema.optional(),
|
|
958
971
|
latencyMode: LatencyModeSchema.default("low")
|
|
@@ -960,41 +973,41 @@ var StreamsSchema = z24.record(
|
|
|
960
973
|
).optional().describe("Define the streams in your stack.");
|
|
961
974
|
|
|
962
975
|
// src/feature/table/schema.ts
|
|
963
|
-
import { z as
|
|
964
|
-
var KeySchema =
|
|
965
|
-
var DeletionProtectionSchema2 =
|
|
966
|
-
var TableDefaultSchema =
|
|
976
|
+
import { z as z26 } from "zod";
|
|
977
|
+
var KeySchema = z26.string().min(1).max(255);
|
|
978
|
+
var DeletionProtectionSchema2 = z26.boolean().describe("Specifies if you want to protect the table from being deleted by awsless.");
|
|
979
|
+
var TableDefaultSchema = z26.object({
|
|
967
980
|
deletionProtection: DeletionProtectionSchema2.optional()
|
|
968
981
|
}).optional();
|
|
969
|
-
var TablesSchema =
|
|
982
|
+
var TablesSchema = z26.record(
|
|
970
983
|
ResourceIdSchema,
|
|
971
|
-
|
|
984
|
+
z26.object({
|
|
972
985
|
hash: KeySchema.describe(
|
|
973
986
|
"Specifies the name of the partition / hash key that makes up the primary key for the table."
|
|
974
987
|
),
|
|
975
988
|
sort: KeySchema.optional().describe(
|
|
976
989
|
"Specifies the name of the range / sort key that makes up the primary key for the table."
|
|
977
990
|
),
|
|
978
|
-
fields:
|
|
991
|
+
fields: z26.record(z26.string(), z26.enum(["string", "number", "binary"])).optional().describe(
|
|
979
992
|
'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
|
|
980
993
|
),
|
|
981
|
-
class:
|
|
982
|
-
pointInTimeRecovery:
|
|
994
|
+
class: z26.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
|
|
995
|
+
pointInTimeRecovery: z26.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
|
|
983
996
|
timeToLiveAttribute: KeySchema.optional().describe(
|
|
984
997
|
"The name of the TTL attribute used to store the expiration time for items in the table. To update this property, you must first disable TTL and then enable TTL with the new attribute name."
|
|
985
998
|
),
|
|
986
999
|
deletionProtection: DeletionProtectionSchema2.optional(),
|
|
987
|
-
stream:
|
|
988
|
-
type:
|
|
1000
|
+
stream: z26.object({
|
|
1001
|
+
type: z26.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
|
|
989
1002
|
"When an item in the table is modified, stream.type determines what information is written to the stream for this table. Valid values are:\n- keys-only - Only the key attributes of the modified item are written to the stream.\n- new-image - The entire item, as it appears after it was modified, is written to the stream.\n- old-image - The entire item, as it appeared before it was modified, is written to the stream.\n- new-and-old-images - Both the new and the old item images of the item are written to the stream."
|
|
990
1003
|
),
|
|
991
1004
|
consumer: FunctionSchema.describe("The consuming lambda function for the stream")
|
|
992
1005
|
}).optional().describe(
|
|
993
1006
|
"The settings for the DynamoDB table stream, which capture changes to items stored in the table."
|
|
994
1007
|
),
|
|
995
|
-
indexes:
|
|
996
|
-
|
|
997
|
-
|
|
1008
|
+
indexes: z26.record(
|
|
1009
|
+
z26.string(),
|
|
1010
|
+
z26.object({
|
|
998
1011
|
/** Specifies the name of the partition / hash key that makes up the primary key for the global secondary index. */
|
|
999
1012
|
hash: KeySchema,
|
|
1000
1013
|
/** Specifies the name of the range / sort key that makes up the primary key for the global secondary index. */
|
|
@@ -1004,49 +1017,49 @@ var TablesSchema = z25.record(
|
|
|
1004
1017
|
* - keys-only - Only the index and primary keys are projected into the index.
|
|
1005
1018
|
* @default 'all'
|
|
1006
1019
|
*/
|
|
1007
|
-
projection:
|
|
1020
|
+
projection: z26.enum(["all", "keys-only"]).default("all")
|
|
1008
1021
|
})
|
|
1009
1022
|
).optional().describe("Specifies the global secondary indexes to be created on the table.")
|
|
1010
1023
|
})
|
|
1011
1024
|
).optional().describe("Define the tables in your stack.");
|
|
1012
1025
|
|
|
1013
1026
|
// src/feature/task/schema.ts
|
|
1014
|
-
import { z as
|
|
1015
|
-
var RetryAttemptsSchema2 =
|
|
1027
|
+
import { z as z27 } from "zod";
|
|
1028
|
+
var RetryAttemptsSchema2 = z27.number().int().min(0).max(2).describe(
|
|
1016
1029
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
1017
1030
|
);
|
|
1018
|
-
var TaskSchema =
|
|
1031
|
+
var TaskSchema = z27.union([
|
|
1019
1032
|
LocalFileSchema.transform((file) => ({
|
|
1020
1033
|
consumer: { file },
|
|
1021
1034
|
retryAttempts: void 0
|
|
1022
1035
|
})),
|
|
1023
|
-
|
|
1036
|
+
z27.object({
|
|
1024
1037
|
consumer: FunctionSchema,
|
|
1025
1038
|
retryAttempts: RetryAttemptsSchema2.optional()
|
|
1026
1039
|
})
|
|
1027
1040
|
]);
|
|
1028
|
-
var TasksSchema =
|
|
1041
|
+
var TasksSchema = z27.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
|
|
1029
1042
|
|
|
1030
1043
|
// src/feature/test/schema.ts
|
|
1031
|
-
import { z as
|
|
1032
|
-
var TestsSchema =
|
|
1044
|
+
import { z as z28 } from "zod";
|
|
1045
|
+
var TestsSchema = z28.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
|
|
1033
1046
|
|
|
1034
1047
|
// src/feature/topic/schema.ts
|
|
1035
1048
|
import { paramCase as paramCase2 } from "change-case";
|
|
1036
|
-
import { z as
|
|
1037
|
-
var TopicNameSchema =
|
|
1038
|
-
var TopicsSchema =
|
|
1049
|
+
import { z as z29 } from "zod";
|
|
1050
|
+
var TopicNameSchema = z29.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => paramCase2(value)).describe("Define event topic name.");
|
|
1051
|
+
var TopicsSchema = z29.array(TopicNameSchema).refine((topics) => {
|
|
1039
1052
|
return topics.length === new Set(topics).size;
|
|
1040
1053
|
}, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
|
|
1041
|
-
var SubscribersSchema =
|
|
1054
|
+
var SubscribersSchema = z29.record(TopicNameSchema, z29.union([EmailSchema, FunctionSchema])).optional().describe("Define the event topics to subscribe too in your stack.");
|
|
1042
1055
|
|
|
1043
1056
|
// src/config/stack.ts
|
|
1044
1057
|
var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
|
|
1045
1058
|
var NameSchema = ResourceIdSchema.refine((name) => !["base"].includes(name), {
|
|
1046
1059
|
message: `Stack name can't be a reserved name.`
|
|
1047
1060
|
}).describe("Stack name.");
|
|
1048
|
-
var StackSchema =
|
|
1049
|
-
$schema:
|
|
1061
|
+
var StackSchema = z30.object({
|
|
1062
|
+
$schema: z30.string().optional(),
|
|
1050
1063
|
name: NameSchema,
|
|
1051
1064
|
depends: DependsSchema,
|
|
1052
1065
|
commands: CommandsSchema,
|
|
@@ -1055,6 +1068,7 @@ var StackSchema = z29.object({
|
|
|
1055
1068
|
graphql: GraphQLSchema,
|
|
1056
1069
|
http: HttpSchema,
|
|
1057
1070
|
rest: RestSchema,
|
|
1071
|
+
rpc: RpcSchema,
|
|
1058
1072
|
configs: ConfigsSchema,
|
|
1059
1073
|
crons: CronsSchema,
|
|
1060
1074
|
caches: CachesSchema,
|
|
@@ -1074,21 +1088,21 @@ var StackSchema = z29.object({
|
|
|
1074
1088
|
});
|
|
1075
1089
|
|
|
1076
1090
|
// src/config/app.ts
|
|
1077
|
-
import { z as
|
|
1091
|
+
import { z as z33 } from "zod";
|
|
1078
1092
|
|
|
1079
1093
|
// src/feature/domain/schema.ts
|
|
1080
|
-
import { z as
|
|
1081
|
-
var DomainNameSchema =
|
|
1094
|
+
import { z as z31 } from "zod";
|
|
1095
|
+
var DomainNameSchema = z31.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
|
|
1082
1096
|
"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."
|
|
1083
1097
|
);
|
|
1084
|
-
var DNSTypeSchema =
|
|
1098
|
+
var DNSTypeSchema = z31.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
|
|
1085
1099
|
var TTLSchema = DurationSchema.describe("The resource record cache time to live (TTL).");
|
|
1086
|
-
var RecordsSchema =
|
|
1087
|
-
var DomainsDefaultSchema =
|
|
1100
|
+
var RecordsSchema = z31.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
|
|
1101
|
+
var DomainsDefaultSchema = z31.record(
|
|
1088
1102
|
ResourceIdSchema,
|
|
1089
|
-
|
|
1103
|
+
z31.object({
|
|
1090
1104
|
domain: DomainNameSchema.describe("Define the domain name"),
|
|
1091
|
-
dns:
|
|
1105
|
+
dns: z31.object({
|
|
1092
1106
|
name: DomainNameSchema.optional(),
|
|
1093
1107
|
type: DNSTypeSchema,
|
|
1094
1108
|
ttl: TTLSchema,
|
|
@@ -1098,7 +1112,7 @@ var DomainsDefaultSchema = z30.record(
|
|
|
1098
1112
|
).optional().describe("Define the domains for your application.");
|
|
1099
1113
|
|
|
1100
1114
|
// src/config/schema/region.ts
|
|
1101
|
-
import { z as
|
|
1115
|
+
import { z as z32 } from "zod";
|
|
1102
1116
|
var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
|
|
1103
1117
|
var AF = ["af-south-1"];
|
|
1104
1118
|
var AP = [
|
|
@@ -1127,20 +1141,20 @@ var EU = [
|
|
|
1127
1141
|
var ME = ["me-south-1", "me-central-1"];
|
|
1128
1142
|
var SA = ["sa-east-1"];
|
|
1129
1143
|
var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
|
|
1130
|
-
var RegionSchema =
|
|
1144
|
+
var RegionSchema = z32.enum(regions);
|
|
1131
1145
|
|
|
1132
1146
|
// src/config/app.ts
|
|
1133
|
-
var AppSchema =
|
|
1134
|
-
$schema:
|
|
1147
|
+
var AppSchema = z33.object({
|
|
1148
|
+
$schema: z33.string().optional(),
|
|
1135
1149
|
name: ResourceIdSchema.describe("App name."),
|
|
1136
1150
|
region: RegionSchema.describe("The AWS region to deploy to."),
|
|
1137
|
-
profile:
|
|
1151
|
+
profile: z33.string().describe("The AWS profile to deploy to."),
|
|
1138
1152
|
// stage: z
|
|
1139
1153
|
// .string()
|
|
1140
1154
|
// .regex(/^[a-z]+$/)
|
|
1141
1155
|
// .default('prod')
|
|
1142
1156
|
// .describe('The deployment stage.'),
|
|
1143
|
-
defaults:
|
|
1157
|
+
defaults: z33.object({
|
|
1144
1158
|
auth: AuthDefaultSchema,
|
|
1145
1159
|
domains: DomainsDefaultSchema,
|
|
1146
1160
|
function: FunctionDefaultSchema,
|
|
@@ -1149,6 +1163,7 @@ var AppSchema = z32.object({
|
|
|
1149
1163
|
graphql: GraphQLDefaultSchema,
|
|
1150
1164
|
http: HttpDefaultSchema,
|
|
1151
1165
|
rest: RestDefaultSchema,
|
|
1166
|
+
rpc: RpcDefaultSchema,
|
|
1152
1167
|
pubsub: PubSubDefaultSchema,
|
|
1153
1168
|
table: TableDefaultSchema,
|
|
1154
1169
|
store: StoreDefaultSchema
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d019526310c2c85bfb85027114e4b31c2cbf9d5c
|
|
Binary file
|
package/dist/prebuild.js
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// src/prebuild.ts
|
|
2
|
+
import { mkdir } from "fs/promises";
|
|
3
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
|
|
6
|
+
// src/feature/function/prebuild.ts
|
|
7
|
+
import { Asset, aws } from "@awsless/formation";
|
|
8
|
+
import { writeFile } from "fs/promises";
|
|
9
|
+
import { join } from "path";
|
|
10
|
+
|
|
11
|
+
// src/feature/function/build/typescript/bundle.ts
|
|
12
|
+
import commonjs from "@rollup/plugin-commonjs";
|
|
13
|
+
import json from "@rollup/plugin-json";
|
|
14
|
+
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
15
|
+
import { createHash } from "crypto";
|
|
16
|
+
import { dirname } from "path";
|
|
17
|
+
import { rollup } from "rollup";
|
|
18
|
+
import { swc, minify as swcMinify } from "rollup-plugin-swc3";
|
|
19
|
+
|
|
20
|
+
// src/cli/ui/style.ts
|
|
21
|
+
import chalk from "chalk";
|
|
22
|
+
var color = {
|
|
23
|
+
primary: chalk.bold.hex("#FF9000"),
|
|
24
|
+
// primary: chalk.bold.magentaBright,
|
|
25
|
+
// title: chalk.white,
|
|
26
|
+
// normal: chalk.white,
|
|
27
|
+
label: chalk.reset.white.bold,
|
|
28
|
+
dim: chalk.dim,
|
|
29
|
+
line: chalk.black,
|
|
30
|
+
// link: chalk.cyan,
|
|
31
|
+
info: chalk.blue,
|
|
32
|
+
success: chalk.green,
|
|
33
|
+
warning: chalk.yellow,
|
|
34
|
+
error: chalk.red,
|
|
35
|
+
attr: chalk.yellow
|
|
36
|
+
// cursor: chalk.bgWhite.blackBright,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// src/cli/debug.ts
|
|
40
|
+
var queue = [];
|
|
41
|
+
var debugError = (error) => {
|
|
42
|
+
queue.push({
|
|
43
|
+
date: /* @__PURE__ */ new Date(),
|
|
44
|
+
type: color.error.dim("error"),
|
|
45
|
+
message: typeof error === "string" ? error : error instanceof Error ? color.error(error.message || "") : JSON.stringify(error)
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// src/feature/function/build/typescript/bundle.ts
|
|
50
|
+
var bundleTypeScript = async ({ format = "esm", minify = true, file, external }) => {
|
|
51
|
+
const bundle = await rollup({
|
|
52
|
+
input: file,
|
|
53
|
+
external: (importee) => {
|
|
54
|
+
return importee.startsWith("@aws-sdk") || importee.startsWith("aws-sdk") || external?.includes(importee);
|
|
55
|
+
},
|
|
56
|
+
onwarn: (error) => {
|
|
57
|
+
debugError(error.message);
|
|
58
|
+
},
|
|
59
|
+
treeshake: {
|
|
60
|
+
preset: "smallest",
|
|
61
|
+
moduleSideEffects: (id) => file === id
|
|
62
|
+
},
|
|
63
|
+
plugins: [
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
commonjs({ sourceMap: true }),
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
nodeResolve({ preferBuiltins: true }),
|
|
68
|
+
swc({
|
|
69
|
+
// minify,
|
|
70
|
+
// module: true,
|
|
71
|
+
jsc: {
|
|
72
|
+
baseUrl: dirname(file),
|
|
73
|
+
minify: { sourceMap: true }
|
|
74
|
+
},
|
|
75
|
+
sourceMaps: true
|
|
76
|
+
}),
|
|
77
|
+
minify ? swcMinify({
|
|
78
|
+
module: format === "esm",
|
|
79
|
+
sourceMap: true,
|
|
80
|
+
compress: true
|
|
81
|
+
}) : void 0,
|
|
82
|
+
// @ts-ignore
|
|
83
|
+
json()
|
|
84
|
+
]
|
|
85
|
+
});
|
|
86
|
+
const ext = format === "esm" ? "mjs" : "js";
|
|
87
|
+
const result = await bundle.generate({
|
|
88
|
+
format,
|
|
89
|
+
sourcemap: "hidden",
|
|
90
|
+
exports: "auto",
|
|
91
|
+
manualChunks: {},
|
|
92
|
+
entryFileNames: `index.${ext}`,
|
|
93
|
+
chunkFileNames: `[name].${ext}`
|
|
94
|
+
});
|
|
95
|
+
const hash = createHash("sha1");
|
|
96
|
+
const files = [];
|
|
97
|
+
for (const item of result.output) {
|
|
98
|
+
if (item.type !== "chunk") {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
const code = Buffer.from(item.code, "utf8");
|
|
102
|
+
const map = item.map ? Buffer.from(item.map.toString(), "utf8") : void 0;
|
|
103
|
+
hash.update(code);
|
|
104
|
+
files.push({
|
|
105
|
+
name: item.fileName,
|
|
106
|
+
code,
|
|
107
|
+
map
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
hash: hash.digest("hex"),
|
|
112
|
+
files
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// src/feature/function/build/zip.ts
|
|
117
|
+
import JSZip from "jszip";
|
|
118
|
+
var zipFiles = (files) => {
|
|
119
|
+
const zip = new JSZip();
|
|
120
|
+
for (const file of files) {
|
|
121
|
+
zip.file(file.name, file.code);
|
|
122
|
+
}
|
|
123
|
+
return zip.generateAsync({
|
|
124
|
+
type: "nodebuffer",
|
|
125
|
+
compression: "DEFLATE",
|
|
126
|
+
compressionOptions: {
|
|
127
|
+
level: 9
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// src/feature/function/prebuild.ts
|
|
133
|
+
var prebuild = async (file, output) => {
|
|
134
|
+
const bundle = await bundleTypeScript({
|
|
135
|
+
file,
|
|
136
|
+
minify: true,
|
|
137
|
+
external: []
|
|
138
|
+
});
|
|
139
|
+
const archive = await zipFiles(bundle.files);
|
|
140
|
+
await writeFile(join(output, "HASH"), bundle.hash);
|
|
141
|
+
await writeFile(join(output, "bundle.zip"), archive);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// src/prebuild.ts
|
|
145
|
+
var __dirname = dirname2(fileURLToPath(import.meta.url));
|
|
146
|
+
var builds = {
|
|
147
|
+
rpc: "../src/feature/rpc/server/handle.ts"
|
|
148
|
+
};
|
|
149
|
+
for (const [name, file] of Object.entries(builds)) {
|
|
150
|
+
const output = join2(__dirname, "prebuild", name);
|
|
151
|
+
await mkdir(output, { recursive: true });
|
|
152
|
+
await prebuild(join2(__dirname, file), output);
|
|
153
|
+
}
|
package/dist/server.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { AwsCredentialIdentityProvider } from '@aws-sdk/types';
|
|
|
2
2
|
import { Mock } from 'vitest';
|
|
3
3
|
import { QoS } from '@awsless/iot';
|
|
4
4
|
export { QoS } from '@awsless/iot';
|
|
5
|
+
import { DurationFormat } from '@awsless/duration';
|
|
5
6
|
|
|
6
7
|
declare const regions: readonly ["us-east-2", "us-east-1", "us-west-1", "us-west-2", "af-south-1", "ap-east-1", "ap-south-2", "ap-southeast-3", "ap-southeast-4", "ap-south-1", "ap-northeast-3", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-south-1", "eu-west-3", "eu-south-2", "eu-north-1", "eu-central-2", "me-south-1", "me-central-1", "sa-east-1"];
|
|
7
8
|
type Region = (typeof regions)[number];
|
|
@@ -95,6 +96,14 @@ interface QueueResources {
|
|
|
95
96
|
}
|
|
96
97
|
declare const Queue: QueueResources;
|
|
97
98
|
|
|
99
|
+
type RpcAuthorizerResponse = {
|
|
100
|
+
authorized: false;
|
|
101
|
+
} | {
|
|
102
|
+
authorized: true;
|
|
103
|
+
context?: unknown;
|
|
104
|
+
ttl: DurationFormat;
|
|
105
|
+
};
|
|
106
|
+
|
|
98
107
|
declare const getSearchName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--search--${N}`;
|
|
99
108
|
declare const getSearchProps: (name: string, stack?: string) => {
|
|
100
109
|
readonly domain: string | undefined;
|
|
@@ -128,4 +137,4 @@ declare const Topic: TopicResources;
|
|
|
128
137
|
declare const APP: "app";
|
|
129
138
|
declare const STACK: "stack";
|
|
130
139
|
|
|
131
|
-
export { APP, Auth, type AuthResources, Cache, type CacheResources, type CommandContext, type CommandHandler, CommandOptions, Config, type ConfigResources, Fn, Function, type FunctionMock, type FunctionMockResponse, type FunctionResources, PubSub, type PublishOptions, Queue, type QueueMock, type QueueMockResponse, type QueueResources, STACK, Search, type SearchResources, Store, type StoreResources, Table, type TableResources, Task, type TaskMock, type TaskMockResponse, type TaskResources, Topic, type TopicMock, type TopicMockResponse, type TopicResources, getAuthProps, getCacheProps, getConfigName, getConfigValue, getFunctionName, getPubSubTopic, getQueueName, getQueueUrl, getSearchName, getSearchProps, getSiteBucketName, getStoreName, getTableName, getTaskName, getTopicName, mockFunction, mockPubSub, mockQueue, mockTask, mockTopic, setConfigValue };
|
|
140
|
+
export { APP, Auth, type AuthResources, Cache, type CacheResources, type CommandContext, type CommandHandler, CommandOptions, 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, getAuthProps, getCacheProps, getConfigName, getConfigValue, getFunctionName, getPubSubTopic, getQueueName, getQueueUrl, getSearchName, getSearchProps, getSiteBucketName, getStoreName, getTableName, getTaskName, getTopicName, mockFunction, mockPubSub, mockQueue, mockTask, mockTopic, setConfigValue };
|