@awsless/awsless 0.0.366 → 0.0.368

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.
@@ -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 z29 } from "zod";
5
+ import { z as z30 } from "zod";
6
6
 
7
7
  // src/feature/auth/schema.ts
8
8
  import { z as z7 } from "zod";
@@ -149,10 +149,22 @@ var LogRetentionSchema = DurationSchema.refine(
149
149
  },
150
150
  `Invalid log retention. Valid days are: ${validLogRetentionDays.map((days3) => `${days3}`).join(", ")}`
151
151
  ).describe("The log retention duration.");
152
+ var LogSubscriptionSchema = z5.union([
153
+ LocalFileSchema.transform((file) => ({
154
+ file
155
+ })),
156
+ z5.object({
157
+ subscriber: LocalFileSchema,
158
+ filter: z5.string().optional()
159
+ })
160
+ ]).describe(
161
+ "Log Subscription allow you to subscribe to a real-time stream of log events and have them delivered to a specific destination"
162
+ );
152
163
  var LogSchema = z5.union([
153
164
  z5.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
154
165
  LogRetentionSchema.transform((retention) => ({ retention })),
155
166
  z5.object({
167
+ subscription: LogSubscriptionSchema.optional(),
156
168
  retention: LogRetentionSchema.optional(),
157
169
  format: z5.enum(["text", "json"]).describe(
158
170
  `The format in which Lambda sends your function's application and system logs to CloudWatch. Select between plain text and structured JSON.`
@@ -172,32 +184,33 @@ var BuildSchema = z5.object({
172
184
  minify: MinifySchema.default(true),
173
185
  external: z5.string().array().optional().describe(`A list of external packages that won't be included in the bundle.`)
174
186
  }).describe(`Options for the function bundler`);
187
+ var FnSchema = z5.object({
188
+ file: FileSchema,
189
+ // node
190
+ handler: HandlerSchema.optional(),
191
+ build: BuildSchema.optional(),
192
+ // container
193
+ // ...
194
+ runtime: RuntimeSchema.optional(),
195
+ description: DescriptionSchema.optional(),
196
+ warm: WarmSchema.optional(),
197
+ vpc: VPCSchema.optional(),
198
+ log: LogSchema.optional(),
199
+ timeout: TimeoutSchema.optional(),
200
+ memorySize: MemorySizeSchema.optional(),
201
+ architecture: ArchitectureSchema.optional(),
202
+ ephemeralStorageSize: EphemeralStorageSizeSchema.optional(),
203
+ retryAttempts: RetryAttemptsSchema.optional(),
204
+ reserved: ReservedConcurrentExecutionsSchema.optional(),
205
+ layers: LayersSchema.optional(),
206
+ environment: EnvironmentSchema.optional(),
207
+ permissions: PermissionsSchema.optional()
208
+ });
175
209
  var FunctionSchema = z5.union([
176
210
  LocalFileSchema.transform((file) => ({
177
211
  file
178
212
  })),
179
- z5.object({
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
- })
213
+ FnSchema
201
214
  ]);
202
215
  var FunctionsSchema = z5.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
203
216
  var FunctionDefaultSchema = z5.object({
@@ -580,9 +593,9 @@ var PubSubSchema = z17.record(
580
593
  ).optional().describe("Define the pubsub subscriber in your stack.");
581
594
 
582
595
  // src/feature/queue/schema.ts
583
- import { z as z18 } from "zod";
584
596
  import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
585
597
  import { kibibytes } from "@awsless/size";
598
+ import { z as z18 } from "zod";
586
599
  var RetentionPeriodSchema = DurationSchema.refine(
587
600
  durationMin(minutes2(1)),
588
601
  "Minimum retention period is 1 minute"
@@ -641,7 +654,7 @@ var QueuesSchema = z18.record(
641
654
  }
642
655
  })),
643
656
  z18.object({
644
- consumer: FunctionSchema.describe("he consuming lambda function properties."),
657
+ consumer: FunctionSchema.describe("The consuming lambda function properties."),
645
658
  retentionPeriod: RetentionPeriodSchema.optional(),
646
659
  visibilityTimeout: VisibilityTimeoutSchema.optional(),
647
660
  deliveryDelay: DeliveryDelaySchema.optional(),
@@ -674,11 +687,23 @@ var RestDefaultSchema = z20.record(
674
687
  ).optional().describe("Define your global REST API's.");
675
688
  var RestSchema = z20.record(ResourceIdSchema, z20.record(RouteSchema2, FunctionSchema)).optional().describe("Define routes in your stack for your global REST API.");
676
689
 
690
+ // src/feature/rpc/schema.ts
691
+ import { z as z21 } from "zod";
692
+ var RpcDefaultSchema = z21.record(
693
+ ResourceIdSchema,
694
+ z21.object({
695
+ domain: ResourceIdSchema.describe("The domain id to link your RPC API with.").optional(),
696
+ subDomain: z21.string().optional(),
697
+ auth: FunctionSchema.optional()
698
+ })
699
+ ).describe(`Define the global RPC API's.`).optional();
700
+ 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();
701
+
677
702
  // src/feature/search/schema.ts
678
703
  import { gibibytes as gibibytes2 } from "@awsless/size";
679
- import { z as z21 } from "zod";
680
- var VersionSchema = z21.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
681
- var TypeSchema3 = z21.enum([
704
+ import { z as z22 } from "zod";
705
+ var VersionSchema = z22.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
706
+ var TypeSchema3 = z22.enum([
682
707
  "t3.small",
683
708
  "t3.medium",
684
709
  "m3.medium",
@@ -753,41 +778,41 @@ var TypeSchema3 = z21.enum([
753
778
  "r6gd.16xlarge"
754
779
  ]);
755
780
  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 = z21.record(
781
+ var SearchsSchema = z22.record(
757
782
  ResourceIdSchema,
758
- z21.object({
783
+ z22.object({
759
784
  type: TypeSchema3.default("t3.small"),
760
- count: z21.number().int().min(1).default(1),
785
+ count: z22.number().int().min(1).default(1),
761
786
  version: VersionSchema.default("2.13"),
762
787
  storage: StorageSizeSchema.default("10 GB"),
763
- vpc: z21.boolean().default(false)
788
+ vpc: z22.boolean().default(false)
764
789
  })
765
790
  ).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
766
791
 
767
792
  // src/feature/site/schema.ts
768
- import { z as z22 } from "zod";
769
- var ErrorResponsePathSchema = z22.string().describe(
793
+ import { z as z23 } from "zod";
794
+ var ErrorResponsePathSchema = z23.string().describe(
770
795
  "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
796
  );
772
- var StatusCodeSchema = z22.number().int().positive().optional().describe(
797
+ var StatusCodeSchema = z23.number().int().positive().optional().describe(
773
798
  "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
799
  );
775
800
  var MinTTLSchema = DurationSchema.describe(
776
801
  "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
802
  );
778
- var ErrorResponseSchema = z22.union([
803
+ var ErrorResponseSchema = z23.union([
779
804
  ErrorResponsePathSchema,
780
- z22.object({
805
+ z23.object({
781
806
  path: ErrorResponsePathSchema,
782
807
  statusCode: StatusCodeSchema.optional(),
783
808
  minTTL: MinTTLSchema.optional()
784
809
  })
785
810
  ]).optional();
786
- var SitesSchema = z22.record(
811
+ var SitesSchema = z23.record(
787
812
  ResourceIdSchema,
788
- z22.object({
813
+ z23.object({
789
814
  domain: ResourceIdSchema.describe("The domain id to link your site with.").optional(),
790
- subDomain: z22.string().optional(),
815
+ subDomain: z23.string().optional(),
791
816
  // bind: z
792
817
  // .object({
793
818
  // auth: z.array(ResourceIdSchema),
@@ -810,7 +835,7 @@ var SitesSchema = z22.record(
810
835
  // build: z.string().optional(),
811
836
  // }),
812
837
  // ]),
813
- errors: z22.object({
838
+ errors: z23.object({
814
839
  400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
815
840
  403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
816
841
  404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
@@ -823,16 +848,16 @@ var SitesSchema = z22.record(
823
848
  503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
824
849
  504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
825
850
  }).optional().describe("Customize the error responses for specific HTTP status codes."),
826
- cors: z22.object({
827
- override: z22.boolean().default(false),
851
+ cors: z23.object({
852
+ override: z23.boolean().default(false),
828
853
  maxAge: DurationSchema.default("365 days"),
829
- exposeHeaders: z22.string().array().optional(),
830
- credentials: z22.boolean().default(false),
831
- headers: z22.string().array().default(["*"]),
832
- origins: z22.string().array().default(["*"]),
833
- methods: z22.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
854
+ exposeHeaders: z23.string().array().optional(),
855
+ credentials: z23.boolean().default(false),
856
+ headers: z23.string().array().default(["*"]),
857
+ origins: z23.string().array().default(["*"]),
858
+ methods: z23.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
834
859
  }).optional().describe("Define the cors headers."),
835
- security: z22.object({
860
+ security: z23.object({
836
861
  // contentSecurityPolicy: z.object({
837
862
  // override: z.boolean().default(false),
838
863
  // policy: z.string(),
@@ -874,10 +899,10 @@ var SitesSchema = z22.record(
874
899
  // reportUri?: string
875
900
  // }
876
901
  }).optional().describe("Define the security policy."),
877
- cache: z22.object({
878
- cookies: z22.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
879
- headers: z22.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
880
- queries: z22.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
902
+ cache: z23.object({
903
+ cookies: z23.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
904
+ headers: z23.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
905
+ queries: z23.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
881
906
  }).optional().describe(
882
907
  "Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
883
908
  )
@@ -885,26 +910,26 @@ var SitesSchema = z22.record(
885
910
  ).optional().describe("Define the sites in your stack.");
886
911
 
887
912
  // src/feature/store/schema.ts
888
- import { z as z23 } from "zod";
889
- var DeletionProtectionSchema = z23.boolean().describe("Specifies if you want to protect the store from being deleted by awsless.");
890
- var StoreDefaultSchema = z23.object({
913
+ import { z as z24 } from "zod";
914
+ var DeletionProtectionSchema = z24.boolean().describe("Specifies if you want to protect the store from being deleted by awsless.");
915
+ var StoreDefaultSchema = z24.object({
891
916
  deletionProtection: DeletionProtectionSchema.optional()
892
917
  }).optional();
893
- var StoresSchema = z23.union([
894
- z23.array(ResourceIdSchema).transform((list) => {
918
+ var StoresSchema = z24.union([
919
+ z24.array(ResourceIdSchema).transform((list) => {
895
920
  const stores = {};
896
921
  for (const key of list) {
897
922
  stores[key] = {};
898
923
  }
899
924
  return stores;
900
925
  }),
901
- z23.record(
926
+ z24.record(
902
927
  ResourceIdSchema,
903
- z23.object({
928
+ z24.object({
904
929
  // cors: CorsSchema,
905
930
  deletionProtection: DeletionProtectionSchema.optional(),
906
- versioning: z23.boolean().default(false).describe("Enable versioning of your store."),
907
- events: z23.object({
931
+ versioning: z24.boolean().default(false).describe("Enable versioning of your store."),
932
+ events: z24.object({
908
933
  // create
909
934
  "created:*": FunctionSchema.optional().describe(
910
935
  "Subscribe to notifications regardless of the API that was used to create an object."
@@ -937,22 +962,22 @@ var StoresSchema = z23.union([
937
962
  ]).optional().describe("Define the stores in your stack.");
938
963
 
939
964
  // src/feature/stream/schema.ts
940
- import { z as z24 } from "zod";
941
- var LatencyModeSchema = z24.enum(["low", "normal"]).describe(
965
+ import { z as z25 } from "zod";
966
+ var LatencyModeSchema = z25.enum(["low", "normal"]).describe(
942
967
  `Channel latency mode. Valid values:
943
968
  - normal: Use "normal" to broadcast and deliver live video up to Full HD.
944
969
  - low: Use "low" for near real-time interactions with viewers.`
945
970
  );
946
- var TypeSchema4 = z24.enum(["standard", "basic", "advanced-sd", "advanced-hd"]).describe(`The channel type, which determines the allowable resolution and bitrate.
971
+ var TypeSchema4 = z25.enum(["standard", "basic", "advanced-sd", "advanced-hd"]).describe(`The channel type, which determines the allowable resolution and bitrate.
947
972
  If you exceed the allowable resolution or bitrate, the stream probably will disconnect immediately. Valid values:
948
973
  - 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
974
  - 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
975
  - 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
976
  - 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
977
  `);
953
- var StreamsSchema = z24.record(
978
+ var StreamsSchema = z25.record(
954
979
  ResourceIdSchema,
955
- z24.object({
980
+ z25.object({
956
981
  type: TypeSchema4.default("standard"),
957
982
  // preset: PresetSchema.optional(),
958
983
  latencyMode: LatencyModeSchema.default("low")
@@ -960,41 +985,41 @@ var StreamsSchema = z24.record(
960
985
  ).optional().describe("Define the streams in your stack.");
961
986
 
962
987
  // src/feature/table/schema.ts
963
- import { z as z25 } from "zod";
964
- var KeySchema = z25.string().min(1).max(255);
965
- var DeletionProtectionSchema2 = z25.boolean().describe("Specifies if you want to protect the table from being deleted by awsless.");
966
- var TableDefaultSchema = z25.object({
988
+ import { z as z26 } from "zod";
989
+ var KeySchema = z26.string().min(1).max(255);
990
+ var DeletionProtectionSchema2 = z26.boolean().describe("Specifies if you want to protect the table from being deleted by awsless.");
991
+ var TableDefaultSchema = z26.object({
967
992
  deletionProtection: DeletionProtectionSchema2.optional()
968
993
  }).optional();
969
- var TablesSchema = z25.record(
994
+ var TablesSchema = z26.record(
970
995
  ResourceIdSchema,
971
- z25.object({
996
+ z26.object({
972
997
  hash: KeySchema.describe(
973
998
  "Specifies the name of the partition / hash key that makes up the primary key for the table."
974
999
  ),
975
1000
  sort: KeySchema.optional().describe(
976
1001
  "Specifies the name of the range / sort key that makes up the primary key for the table."
977
1002
  ),
978
- fields: z25.record(z25.string(), z25.enum(["string", "number", "binary"])).optional().describe(
1003
+ fields: z26.record(z26.string(), z26.enum(["string", "number", "binary"])).optional().describe(
979
1004
  '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
1005
  ),
981
- class: z25.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
982
- pointInTimeRecovery: z25.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
1006
+ class: z26.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
1007
+ pointInTimeRecovery: z26.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
983
1008
  timeToLiveAttribute: KeySchema.optional().describe(
984
1009
  "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
1010
  ),
986
1011
  deletionProtection: DeletionProtectionSchema2.optional(),
987
- stream: z25.object({
988
- type: z25.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
1012
+ stream: z26.object({
1013
+ type: z26.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
989
1014
  "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
1015
  ),
991
1016
  consumer: FunctionSchema.describe("The consuming lambda function for the stream")
992
1017
  }).optional().describe(
993
1018
  "The settings for the DynamoDB table stream, which capture changes to items stored in the table."
994
1019
  ),
995
- indexes: z25.record(
996
- z25.string(),
997
- z25.object({
1020
+ indexes: z26.record(
1021
+ z26.string(),
1022
+ z26.object({
998
1023
  /** Specifies the name of the partition / hash key that makes up the primary key for the global secondary index. */
999
1024
  hash: KeySchema,
1000
1025
  /** Specifies the name of the range / sort key that makes up the primary key for the global secondary index. */
@@ -1004,49 +1029,49 @@ var TablesSchema = z25.record(
1004
1029
  * - keys-only - Only the index and primary keys are projected into the index.
1005
1030
  * @default 'all'
1006
1031
  */
1007
- projection: z25.enum(["all", "keys-only"]).default("all")
1032
+ projection: z26.enum(["all", "keys-only"]).default("all")
1008
1033
  })
1009
1034
  ).optional().describe("Specifies the global secondary indexes to be created on the table.")
1010
1035
  })
1011
1036
  ).optional().describe("Define the tables in your stack.");
1012
1037
 
1013
1038
  // src/feature/task/schema.ts
1014
- import { z as z26 } from "zod";
1015
- var RetryAttemptsSchema2 = z26.number().int().min(0).max(2).describe(
1039
+ import { z as z27 } from "zod";
1040
+ var RetryAttemptsSchema2 = z27.number().int().min(0).max(2).describe(
1016
1041
  "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
1017
1042
  );
1018
- var TaskSchema = z26.union([
1043
+ var TaskSchema = z27.union([
1019
1044
  LocalFileSchema.transform((file) => ({
1020
1045
  consumer: { file },
1021
1046
  retryAttempts: void 0
1022
1047
  })),
1023
- z26.object({
1048
+ z27.object({
1024
1049
  consumer: FunctionSchema,
1025
1050
  retryAttempts: RetryAttemptsSchema2.optional()
1026
1051
  })
1027
1052
  ]);
1028
- var TasksSchema = z26.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
1053
+ var TasksSchema = z27.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
1029
1054
 
1030
1055
  // src/feature/test/schema.ts
1031
- import { z as z27 } from "zod";
1032
- var TestsSchema = z27.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
1056
+ import { z as z28 } from "zod";
1057
+ var TestsSchema = z28.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
1033
1058
 
1034
1059
  // src/feature/topic/schema.ts
1035
1060
  import { paramCase as paramCase2 } from "change-case";
1036
- import { z as z28 } from "zod";
1037
- var TopicNameSchema = z28.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => paramCase2(value)).describe("Define event topic name.");
1038
- var TopicsSchema = z28.array(TopicNameSchema).refine((topics) => {
1061
+ import { z as z29 } from "zod";
1062
+ 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.");
1063
+ var TopicsSchema = z29.array(TopicNameSchema).refine((topics) => {
1039
1064
  return topics.length === new Set(topics).size;
1040
1065
  }, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
1041
- var SubscribersSchema = z28.record(TopicNameSchema, z28.union([EmailSchema, FunctionSchema])).optional().describe("Define the event topics to subscribe too in your stack.");
1066
+ var SubscribersSchema = z29.record(TopicNameSchema, z29.union([EmailSchema, FunctionSchema])).optional().describe("Define the event topics to subscribe too in your stack.");
1042
1067
 
1043
1068
  // src/config/stack.ts
1044
1069
  var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
1045
1070
  var NameSchema = ResourceIdSchema.refine((name) => !["base"].includes(name), {
1046
1071
  message: `Stack name can't be a reserved name.`
1047
1072
  }).describe("Stack name.");
1048
- var StackSchema = z29.object({
1049
- $schema: z29.string().optional(),
1073
+ var StackSchema = z30.object({
1074
+ $schema: z30.string().optional(),
1050
1075
  name: NameSchema,
1051
1076
  depends: DependsSchema,
1052
1077
  commands: CommandsSchema,
@@ -1055,6 +1080,7 @@ var StackSchema = z29.object({
1055
1080
  graphql: GraphQLSchema,
1056
1081
  http: HttpSchema,
1057
1082
  rest: RestSchema,
1083
+ rpc: RpcSchema,
1058
1084
  configs: ConfigsSchema,
1059
1085
  crons: CronsSchema,
1060
1086
  caches: CachesSchema,
@@ -1074,21 +1100,21 @@ var StackSchema = z29.object({
1074
1100
  });
1075
1101
 
1076
1102
  // src/config/app.ts
1077
- import { z as z32 } from "zod";
1103
+ import { z as z33 } from "zod";
1078
1104
 
1079
1105
  // src/feature/domain/schema.ts
1080
- import { z as z30 } from "zod";
1081
- var DomainNameSchema = z30.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
1106
+ import { z as z31 } from "zod";
1107
+ var DomainNameSchema = z31.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
1082
1108
  "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
1109
  );
1084
- var DNSTypeSchema = z30.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
1110
+ var DNSTypeSchema = z31.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
1085
1111
  var TTLSchema = DurationSchema.describe("The resource record cache time to live (TTL).");
1086
- var RecordsSchema = z30.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
1087
- var DomainsDefaultSchema = z30.record(
1112
+ var RecordsSchema = z31.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
1113
+ var DomainsDefaultSchema = z31.record(
1088
1114
  ResourceIdSchema,
1089
- z30.object({
1115
+ z31.object({
1090
1116
  domain: DomainNameSchema.describe("Define the domain name"),
1091
- dns: z30.object({
1117
+ dns: z31.object({
1092
1118
  name: DomainNameSchema.optional(),
1093
1119
  type: DNSTypeSchema,
1094
1120
  ttl: TTLSchema,
@@ -1097,8 +1123,13 @@ var DomainsDefaultSchema = z30.record(
1097
1123
  })
1098
1124
  ).optional().describe("Define the domains for your application.");
1099
1125
 
1126
+ // src/feature/log-subscription/schema.ts
1127
+ var LogSubscriptionSchema2 = FunctionSchema.optional().describe(
1128
+ "Log Subscription allow you to subscribe to a real-time stream of log events and have them delivered to a specific destination."
1129
+ );
1130
+
1100
1131
  // src/config/schema/region.ts
1101
- import { z as z31 } from "zod";
1132
+ import { z as z32 } from "zod";
1102
1133
  var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
1103
1134
  var AF = ["af-south-1"];
1104
1135
  var AP = [
@@ -1127,20 +1158,22 @@ var EU = [
1127
1158
  var ME = ["me-south-1", "me-central-1"];
1128
1159
  var SA = ["sa-east-1"];
1129
1160
  var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
1130
- var RegionSchema = z31.enum(regions);
1161
+ var RegionSchema = z32.enum(regions);
1131
1162
 
1132
1163
  // src/config/app.ts
1133
- var AppSchema = z32.object({
1134
- $schema: z32.string().optional(),
1164
+ var AppSchema = z33.object({
1165
+ $schema: z33.string().optional(),
1135
1166
  name: ResourceIdSchema.describe("App name."),
1136
1167
  region: RegionSchema.describe("The AWS region to deploy to."),
1137
- profile: z32.string().describe("The AWS profile to deploy to."),
1168
+ profile: z33.string().describe("The AWS profile to deploy to."),
1138
1169
  // stage: z
1139
1170
  // .string()
1140
1171
  // .regex(/^[a-z]+$/)
1141
1172
  // .default('prod')
1142
1173
  // .describe('The deployment stage.'),
1143
- defaults: z32.object({
1174
+ // onFailure: OnFailureSchema,
1175
+ logSubscription: LogSubscriptionSchema2,
1176
+ defaults: z33.object({
1144
1177
  auth: AuthDefaultSchema,
1145
1178
  domains: DomainsDefaultSchema,
1146
1179
  function: FunctionDefaultSchema,
@@ -1149,6 +1182,7 @@ var AppSchema = z32.object({
1149
1182
  graphql: GraphQLDefaultSchema,
1150
1183
  http: HttpDefaultSchema,
1151
1184
  rest: RestDefaultSchema,
1185
+ rpc: RpcDefaultSchema,
1152
1186
  pubsub: PubSubDefaultSchema,
1153
1187
  table: TableDefaultSchema,
1154
1188
  store: StoreDefaultSchema
@@ -0,0 +1 @@
1
+ 34eafe8e5556b34a6841941b5c52a41a598492dc
Binary file
@@ -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
+ }