@awsless/awsless 0.0.435 → 0.0.437
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 +293 -172
- package/dist/build-json-schema.js +162 -138
- 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
|
@@ -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,6 +7615,10 @@ 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";
|
|
@@ -7638,10 +7642,20 @@ var LocalFileSchema = z5.string().transform((path) => resolvePath(path)).refine(
|
|
|
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,61 @@ 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
|
+
minify: true,
|
|
7765
|
+
external: []
|
|
7766
|
+
})),
|
|
7767
|
+
FileCodeSchema,
|
|
7768
|
+
BundleCodeSchema
|
|
7769
|
+
]).describe("Specify the code of your function.");
|
|
7770
|
+
var FnSchema = z8.object({
|
|
7771
|
+
code: CodeSchema,
|
|
7746
7772
|
// node
|
|
7747
7773
|
handler: HandlerSchema.optional(),
|
|
7748
|
-
build: BuildSchema.optional(),
|
|
7774
|
+
// build: BuildSchema.optional(),
|
|
7775
|
+
// bundle: BundleSchema.optional(),
|
|
7749
7776
|
// container
|
|
7750
7777
|
// ...
|
|
7751
7778
|
runtime: RuntimeSchema.optional(),
|
|
@@ -7763,20 +7790,25 @@ var FnSchema = z7.object({
|
|
|
7763
7790
|
environment: EnvironmentSchema.optional(),
|
|
7764
7791
|
permissions: PermissionsSchema.optional()
|
|
7765
7792
|
});
|
|
7766
|
-
var FunctionSchema =
|
|
7793
|
+
var FunctionSchema = z8.union([
|
|
7767
7794
|
LocalFileSchema.transform((file) => ({
|
|
7768
|
-
|
|
7795
|
+
code: {
|
|
7796
|
+
file,
|
|
7797
|
+
minify: true,
|
|
7798
|
+
external: []
|
|
7799
|
+
}
|
|
7769
7800
|
})),
|
|
7770
7801
|
FnSchema
|
|
7771
7802
|
]);
|
|
7772
|
-
var FunctionsSchema =
|
|
7773
|
-
var FunctionDefaultSchema =
|
|
7803
|
+
var FunctionsSchema = z8.record(ResourceIdSchema, FunctionSchema).optional().describe("Define the functions in your stack.");
|
|
7804
|
+
var FunctionDefaultSchema = z8.object({
|
|
7774
7805
|
runtime: RuntimeSchema.default("nodejs20.x"),
|
|
7775
7806
|
// node
|
|
7776
7807
|
handler: HandlerSchema.default("index.default"),
|
|
7777
|
-
build: BuildSchema.default({
|
|
7778
|
-
|
|
7779
|
-
|
|
7808
|
+
// build: BuildSchema.default({
|
|
7809
|
+
// type: 'simple',
|
|
7810
|
+
// minify: true,
|
|
7811
|
+
// }),
|
|
7780
7812
|
// container
|
|
7781
7813
|
warm: WarmSchema.default(0),
|
|
7782
7814
|
vpc: VPCSchema.default(false),
|
|
@@ -7798,7 +7830,7 @@ var FunctionDefaultSchema = z7.object({
|
|
|
7798
7830
|
}).default({});
|
|
7799
7831
|
|
|
7800
7832
|
// src/feature/auth/schema.ts
|
|
7801
|
-
var TriggersSchema =
|
|
7833
|
+
var TriggersSchema = z9.object({
|
|
7802
7834
|
beforeToken: FunctionSchema.optional().describe("A pre jwt token generation AWS Lambda trigger."),
|
|
7803
7835
|
beforeLogin: FunctionSchema.optional().describe("A pre user login AWS Lambda trigger."),
|
|
7804
7836
|
afterLogin: FunctionSchema.optional().describe("A post user login AWS Lambda trigger."),
|
|
@@ -7811,42 +7843,42 @@ var TriggersSchema = z8.object({
|
|
|
7811
7843
|
createChallenge: FunctionSchema.optional().describe("Creates an authentication challenge."),
|
|
7812
7844
|
verifyChallenge: FunctionSchema.optional().describe("Verifies the authentication challenge response.")
|
|
7813
7845
|
}).describe("Specifies the configuration for AWS Lambda triggers.");
|
|
7814
|
-
var AuthSchema =
|
|
7846
|
+
var AuthSchema = z9.record(
|
|
7815
7847
|
ResourceIdSchema,
|
|
7816
|
-
|
|
7817
|
-
access:
|
|
7848
|
+
z9.object({
|
|
7849
|
+
access: z9.boolean().default(false).describe("Give access to every function in this stack to your cognito instance."),
|
|
7818
7850
|
triggers: TriggersSchema.optional()
|
|
7819
7851
|
})
|
|
7820
7852
|
).optional().describe("Define the auth triggers in your stack.");
|
|
7821
|
-
var AuthDefaultSchema =
|
|
7853
|
+
var AuthDefaultSchema = z9.record(
|
|
7822
7854
|
ResourceIdSchema,
|
|
7823
|
-
|
|
7824
|
-
allowUserRegistration:
|
|
7825
|
-
messaging:
|
|
7855
|
+
z9.object({
|
|
7856
|
+
allowUserRegistration: z9.boolean().default(true).describe("Specifies whether users can create an user account or if only the administrator can."),
|
|
7857
|
+
messaging: z9.object({
|
|
7826
7858
|
fromEmail: EmailSchema.describe("Specifies the sender's email address."),
|
|
7827
|
-
fromName:
|
|
7859
|
+
fromName: z9.string().optional().describe("Specifies the sender's name."),
|
|
7828
7860
|
replyTo: EmailSchema.optional().describe(
|
|
7829
7861
|
"The destination to which the receiver of the email should reply."
|
|
7830
7862
|
)
|
|
7831
7863
|
}).optional().describe("The email configuration for sending messages."),
|
|
7832
7864
|
// secret: z.boolean().default(false).describe('Specifies whether you want to generate a client secret.'),
|
|
7833
|
-
username:
|
|
7834
|
-
emailAlias:
|
|
7835
|
-
caseSensitive:
|
|
7865
|
+
username: z9.object({
|
|
7866
|
+
emailAlias: z9.boolean().default(true).describe("Allow the user email to be used as username."),
|
|
7867
|
+
caseSensitive: z9.boolean().default(false).describe(
|
|
7836
7868
|
"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
7869
|
)
|
|
7838
7870
|
}).default({}).describe("The username policy."),
|
|
7839
|
-
password:
|
|
7840
|
-
minLength:
|
|
7841
|
-
uppercase:
|
|
7842
|
-
lowercase:
|
|
7843
|
-
numbers:
|
|
7844
|
-
symbols:
|
|
7871
|
+
password: z9.object({
|
|
7872
|
+
minLength: z9.number().int().min(6).max(99).default(12).describe("Required users to have at least the minimum password length."),
|
|
7873
|
+
uppercase: z9.boolean().default(true).describe("Required users to use at least one uppercase letter in their password."),
|
|
7874
|
+
lowercase: z9.boolean().default(true).describe("Required users to use at least one lowercase letter in their password."),
|
|
7875
|
+
numbers: z9.boolean().default(true).describe("Required users to use at least one number in their password."),
|
|
7876
|
+
symbols: z9.boolean().default(true).describe("Required users to use at least one symbol in their password."),
|
|
7845
7877
|
temporaryPasswordValidity: DurationSchema.default("7 days").describe(
|
|
7846
7878
|
"The duration a temporary password is valid. If the user doesn't sign in during this time, an administrator must reset their password."
|
|
7847
7879
|
)
|
|
7848
7880
|
}).default({}).describe("The password policy."),
|
|
7849
|
-
validity:
|
|
7881
|
+
validity: z9.object({
|
|
7850
7882
|
idToken: DurationSchema.default("1 hour").describe(
|
|
7851
7883
|
"The ID token time limit. After this limit expires, your user can't use their ID token."
|
|
7852
7884
|
),
|
|
@@ -7862,18 +7894,18 @@ var AuthDefaultSchema = z8.record(
|
|
|
7862
7894
|
).default({}).describe("Define the authenticatable users in your app.");
|
|
7863
7895
|
|
|
7864
7896
|
// src/feature/domain/schema.ts
|
|
7865
|
-
import { z as
|
|
7866
|
-
var DomainNameSchema =
|
|
7897
|
+
import { z as z10 } from "zod";
|
|
7898
|
+
var DomainNameSchema = z10.string().regex(/[a-z\-\_\.]/g, "Invalid domain name").describe(
|
|
7867
7899
|
"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
7900
|
);
|
|
7869
|
-
var DNSTypeSchema =
|
|
7901
|
+
var DNSTypeSchema = z10.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]).describe("The DNS record type.");
|
|
7870
7902
|
var TTLSchema = DurationSchema.describe("The resource record cache time to live (TTL).");
|
|
7871
|
-
var RecordsSchema =
|
|
7872
|
-
var DomainsDefaultSchema =
|
|
7903
|
+
var RecordsSchema = z10.string().array().describe("One or more values that correspond with the value that you specified for the Type property.");
|
|
7904
|
+
var DomainsDefaultSchema = z10.record(
|
|
7873
7905
|
ResourceIdSchema,
|
|
7874
|
-
|
|
7906
|
+
z10.object({
|
|
7875
7907
|
domain: DomainNameSchema.describe("Define the domain name"),
|
|
7876
|
-
dns:
|
|
7908
|
+
dns: z10.object({
|
|
7877
7909
|
name: DomainNameSchema.optional(),
|
|
7878
7910
|
type: DNSTypeSchema,
|
|
7879
7911
|
ttl: TTLSchema,
|
|
@@ -7883,18 +7915,18 @@ var DomainsDefaultSchema = z9.record(
|
|
|
7883
7915
|
).optional().describe("Define the domains for your application.");
|
|
7884
7916
|
|
|
7885
7917
|
// src/feature/graphql/schema.ts
|
|
7886
|
-
import { z as
|
|
7918
|
+
import { z as z11 } from "zod";
|
|
7887
7919
|
var AuthorizerTtl = DurationSchema.describe(
|
|
7888
7920
|
`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
7921
|
);
|
|
7890
|
-
var GraphQLDefaultSchema =
|
|
7922
|
+
var GraphQLDefaultSchema = z11.record(
|
|
7891
7923
|
ResourceIdSchema,
|
|
7892
|
-
|
|
7924
|
+
z11.object({
|
|
7893
7925
|
domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
|
|
7894
|
-
subDomain:
|
|
7895
|
-
auth:
|
|
7926
|
+
subDomain: z11.string().optional(),
|
|
7927
|
+
auth: z11.union([
|
|
7896
7928
|
ResourceIdSchema,
|
|
7897
|
-
|
|
7929
|
+
z11.object({
|
|
7898
7930
|
authorizer: FunctionSchema,
|
|
7899
7931
|
ttl: AuthorizerTtl.default("1 hour")
|
|
7900
7932
|
})
|
|
@@ -7906,22 +7938,22 @@ var GraphQLDefaultSchema = z10.record(
|
|
|
7906
7938
|
resolver: LocalFileSchema.optional()
|
|
7907
7939
|
})
|
|
7908
7940
|
).describe(`Define the global GraphQL API's.`).optional();
|
|
7909
|
-
var GraphQLSchema =
|
|
7941
|
+
var GraphQLSchema = z11.record(
|
|
7910
7942
|
ResourceIdSchema,
|
|
7911
|
-
|
|
7943
|
+
z11.object({
|
|
7912
7944
|
// schema: z.union([LocalFileSchema.transform(v => [v]), z.array(LocalFileSchema).min(1)]).optional(),
|
|
7913
7945
|
schema: LocalFileSchema.describe("The graphql schema file."),
|
|
7914
|
-
resolvers:
|
|
7946
|
+
resolvers: z11.record(
|
|
7915
7947
|
// TypeName
|
|
7916
|
-
|
|
7917
|
-
|
|
7948
|
+
z11.string(),
|
|
7949
|
+
z11.record(
|
|
7918
7950
|
// FieldName
|
|
7919
|
-
|
|
7920
|
-
|
|
7951
|
+
z11.string(),
|
|
7952
|
+
z11.union([
|
|
7921
7953
|
FunctionSchema.transform((consumer) => ({
|
|
7922
7954
|
consumer
|
|
7923
7955
|
})),
|
|
7924
|
-
|
|
7956
|
+
z11.object({
|
|
7925
7957
|
consumer: FunctionSchema,
|
|
7926
7958
|
resolver: LocalFileSchema.optional()
|
|
7927
7959
|
})
|
|
@@ -7932,34 +7964,20 @@ var GraphQLSchema = z10.record(
|
|
|
7932
7964
|
).describe("Define the schema & resolvers in your stack for your global GraphQL API.").optional();
|
|
7933
7965
|
|
|
7934
7966
|
// src/feature/http/schema.ts
|
|
7935
|
-
import { z as
|
|
7936
|
-
var RouteSchema =
|
|
7937
|
-
var HttpDefaultSchema =
|
|
7967
|
+
import { z as z12 } from "zod";
|
|
7968
|
+
var RouteSchema = z12.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route").transform((v) => v);
|
|
7969
|
+
var HttpDefaultSchema = z12.record(
|
|
7938
7970
|
ResourceIdSchema,
|
|
7939
|
-
|
|
7971
|
+
z12.object({
|
|
7940
7972
|
domain: ResourceIdSchema.describe("The domain id to link your API with."),
|
|
7941
|
-
subDomain:
|
|
7973
|
+
subDomain: z12.string().optional()
|
|
7942
7974
|
// auth: ResourceIdSchema.optional(),
|
|
7943
7975
|
})
|
|
7944
7976
|
).optional().describe("Define your global HTTP API's.");
|
|
7945
|
-
var HttpSchema =
|
|
7977
|
+
var HttpSchema = z12.record(ResourceIdSchema, z12.record(RouteSchema, FunctionSchema)).optional().describe("Define routes in your stack for your global HTTP API.");
|
|
7946
7978
|
|
|
7947
7979
|
// src/feature/instance/schema.ts
|
|
7948
7980
|
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((path) => resolvePath(path)).refine(async (path) => {
|
|
7954
|
-
try {
|
|
7955
|
-
const s = await stat2(path);
|
|
7956
|
-
return s.isDirectory();
|
|
7957
|
-
} catch (error) {
|
|
7958
|
-
return false;
|
|
7959
|
-
}
|
|
7960
|
-
}, `Directory doesn't exist`);
|
|
7961
|
-
|
|
7962
|
-
// src/feature/instance/schema.ts
|
|
7963
7981
|
var ImageSchema = z13.string().regex(/^ami\-[0-9a-f]+/).describe("The ID of the AMI.");
|
|
7964
7982
|
var TypeSchema = z13.enum([
|
|
7965
7983
|
"t3.nano",
|
|
@@ -7980,7 +7998,7 @@ var TypeSchema = z13.enum([
|
|
|
7980
7998
|
"g4dn.xlarge"
|
|
7981
7999
|
]).describe(`The instance type.`);
|
|
7982
8000
|
var CommandSchema = z13.string().describe(`The script you want to execute when the instance starts up.`);
|
|
7983
|
-
var
|
|
8001
|
+
var CodeSchema2 = LocalDirectorySchema.describe(`The code directory that will be deployed to your instance.`);
|
|
7984
8002
|
var ConnectSchema = z13.boolean().describe("Allows you to connect to all instances with an Instance Connect Endpoint.");
|
|
7985
8003
|
var EnvironmentSchema2 = z13.record(z13.string(), z13.string()).optional().describe("Environment variable key-value pairs.");
|
|
7986
8004
|
var ActionSchema2 = z13.string();
|
|
@@ -8003,7 +8021,7 @@ var InstancesSchema = z13.record(
|
|
|
8003
8021
|
z13.object({
|
|
8004
8022
|
image: ImageSchema,
|
|
8005
8023
|
type: TypeSchema,
|
|
8006
|
-
code:
|
|
8024
|
+
code: CodeSchema2,
|
|
8007
8025
|
user: z13.string().default("ec2-user"),
|
|
8008
8026
|
command: CommandSchema.optional(),
|
|
8009
8027
|
environment: EnvironmentSchema2.optional(),
|
|
@@ -8733,7 +8751,13 @@ var RetryAttemptsSchema2 = z34.number().int().min(0).max(2).describe(
|
|
|
8733
8751
|
);
|
|
8734
8752
|
var TaskSchema = z34.union([
|
|
8735
8753
|
LocalFileSchema.transform((file) => ({
|
|
8736
|
-
consumer: {
|
|
8754
|
+
consumer: {
|
|
8755
|
+
code: {
|
|
8756
|
+
file,
|
|
8757
|
+
minify: true,
|
|
8758
|
+
external: []
|
|
8759
|
+
}
|
|
8760
|
+
},
|
|
8737
8761
|
retryAttempts: void 0
|
|
8738
8762
|
})),
|
|
8739
8763
|
z34.object({
|
|
@@ -10627,6 +10651,71 @@ var formatFilterPattern = (filters) => {
|
|
|
10627
10651
|
return `{${filters.map((filter) => `$.level = "${filter.toUpperCase()}"`).join(" || ")}}`;
|
|
10628
10652
|
};
|
|
10629
10653
|
|
|
10654
|
+
// src/feature/function/build/bundle/bundle.ts
|
|
10655
|
+
import JSZip2 from "jszip";
|
|
10656
|
+
import { createReadStream as createReadStream2 } from "node:fs";
|
|
10657
|
+
import { readdir as readdir2 } from "node:fs/promises";
|
|
10658
|
+
import { join as join9, relative as relative2 } from "node:path";
|
|
10659
|
+
var zipBundle = async ({ directory }) => {
|
|
10660
|
+
const zip2 = new JSZip2();
|
|
10661
|
+
const list4 = await readdir2(directory, {
|
|
10662
|
+
recursive: true,
|
|
10663
|
+
withFileTypes: true
|
|
10664
|
+
});
|
|
10665
|
+
for (const file of list4) {
|
|
10666
|
+
if (file.isFile()) {
|
|
10667
|
+
const path = join9(file.path, file.name);
|
|
10668
|
+
const rel = relative2(directory, path);
|
|
10669
|
+
zip2.file(rel, createReadStream2(path));
|
|
10670
|
+
}
|
|
10671
|
+
}
|
|
10672
|
+
return zip2.generateAsync({
|
|
10673
|
+
type: "nodebuffer",
|
|
10674
|
+
compression: "DEFLATE",
|
|
10675
|
+
compressionOptions: {
|
|
10676
|
+
level: 9
|
|
10677
|
+
}
|
|
10678
|
+
});
|
|
10679
|
+
};
|
|
10680
|
+
|
|
10681
|
+
// src/feature/function/build/bundle/cache.ts
|
|
10682
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
10683
|
+
import { createReadStream as createReadStream3 } from "node:fs";
|
|
10684
|
+
import { lstat as lstat2, readdir as readdir3 } from "node:fs/promises";
|
|
10685
|
+
import { join as join10 } from "node:path";
|
|
10686
|
+
var bundleCacheKey = async (props) => {
|
|
10687
|
+
const files = await listAllFiles([props.directory]);
|
|
10688
|
+
const hashes = {};
|
|
10689
|
+
for (const file of files) {
|
|
10690
|
+
hashes[file] = await createHashFromFile(file);
|
|
10691
|
+
}
|
|
10692
|
+
return createHash3("md5").update(JSON.stringify(hashes)).digest("hex");
|
|
10693
|
+
};
|
|
10694
|
+
var createHashFromFile = (file) => {
|
|
10695
|
+
return new Promise((resolve2) => {
|
|
10696
|
+
const hash = createHash3("md5");
|
|
10697
|
+
const stream = createReadStream3(file);
|
|
10698
|
+
stream.on("data", (data) => hash.update(data));
|
|
10699
|
+
stream.on("end", () => resolve2(hash.digest("hex")));
|
|
10700
|
+
});
|
|
10701
|
+
};
|
|
10702
|
+
var listAllFiles = async (list4) => {
|
|
10703
|
+
const files = [];
|
|
10704
|
+
for (const entry of list4) {
|
|
10705
|
+
const stat5 = await lstat2(entry);
|
|
10706
|
+
if (stat5.isDirectory()) {
|
|
10707
|
+
const dirents = await readdir3(entry, {
|
|
10708
|
+
recursive: true,
|
|
10709
|
+
withFileTypes: true
|
|
10710
|
+
});
|
|
10711
|
+
files.push(...dirents.filter((d) => d.isFile()).map((file) => join10(file.path, file.name)));
|
|
10712
|
+
} else if (stat5.isFile()) {
|
|
10713
|
+
files.push(entry);
|
|
10714
|
+
}
|
|
10715
|
+
}
|
|
10716
|
+
return files;
|
|
10717
|
+
};
|
|
10718
|
+
|
|
10630
10719
|
// src/feature/function/build/container/build.ts
|
|
10631
10720
|
import { exec } from "promisify-child-process";
|
|
10632
10721
|
var buildDockerImage = async (opts) => {
|
|
@@ -10671,7 +10760,10 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
|
|
|
10671
10760
|
let code;
|
|
10672
10761
|
if (props.runtime === "container") {
|
|
10673
10762
|
ctx.registerBuild("function", name, async (build3) => {
|
|
10674
|
-
|
|
10763
|
+
if (!("file" in local2.code)) {
|
|
10764
|
+
throw new Error('code.file needs to be set for functions with the "container" runtime');
|
|
10765
|
+
}
|
|
10766
|
+
const cwd = dirname7(local2.code.file);
|
|
10675
10767
|
const version = await hashElement(cwd, {
|
|
10676
10768
|
files: {
|
|
10677
10769
|
exclude: ["stack.json"]
|
|
@@ -10698,18 +10790,19 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
|
|
|
10698
10790
|
code = {
|
|
10699
10791
|
imageUri: image.uri
|
|
10700
10792
|
};
|
|
10701
|
-
} else {
|
|
10793
|
+
} else if ("file" in local2.code) {
|
|
10794
|
+
const fileCode = local2.code;
|
|
10702
10795
|
ctx.registerBuild("function", name, async (build3, { workspace }) => {
|
|
10703
|
-
const version = await generateFileHash(workspace,
|
|
10796
|
+
const version = await generateFileHash(workspace, fileCode.file);
|
|
10704
10797
|
return build3(version, async (write) => {
|
|
10705
10798
|
const temp = await createTempFolder(`function--${name}`);
|
|
10706
10799
|
const bundle = await bundleTypeScript({
|
|
10707
|
-
file:
|
|
10800
|
+
file: fileCode.file,
|
|
10708
10801
|
external: [
|
|
10709
|
-
...
|
|
10802
|
+
...fileCode.external ?? [],
|
|
10710
10803
|
...(props.layers ?? []).flatMap((id2) => ctx.shared.get(`layer-${id2}-packages`))
|
|
10711
10804
|
],
|
|
10712
|
-
minify:
|
|
10805
|
+
minify: fileCode.minify,
|
|
10713
10806
|
nativeDir: temp.path
|
|
10714
10807
|
});
|
|
10715
10808
|
const nativeFiles = await temp.files();
|
|
@@ -10737,6 +10830,28 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
|
|
|
10737
10830
|
key: `/lambda/${name}.zip`,
|
|
10738
10831
|
body: Asset.fromFile(getBuildPath("function", name, "bundle.zip"))
|
|
10739
10832
|
});
|
|
10833
|
+
} else {
|
|
10834
|
+
const bundleCode = local2.code;
|
|
10835
|
+
ctx.registerBuild("function", name, async (build3) => {
|
|
10836
|
+
const version = await bundleCacheKey({
|
|
10837
|
+
directory: bundleCode.bundle
|
|
10838
|
+
});
|
|
10839
|
+
return build3(version, async (write) => {
|
|
10840
|
+
const bundle = await zipBundle({
|
|
10841
|
+
directory: bundleCode.bundle
|
|
10842
|
+
});
|
|
10843
|
+
await write("HASH", version);
|
|
10844
|
+
await write("bundle.zip", bundle);
|
|
10845
|
+
return {
|
|
10846
|
+
size: formatByteSize(bundle.byteLength)
|
|
10847
|
+
};
|
|
10848
|
+
});
|
|
10849
|
+
});
|
|
10850
|
+
code = new aws2.s3.BucketObject(group, "code", {
|
|
10851
|
+
bucket: ctx.shared.get("function-bucket-name"),
|
|
10852
|
+
key: `/lambda/${name}.zip`,
|
|
10853
|
+
body: Asset.fromFile(getBuildPath("function", name, "bundle.zip"))
|
|
10854
|
+
});
|
|
10740
10855
|
}
|
|
10741
10856
|
const role = new aws2.iam.Role(group, "role", {
|
|
10742
10857
|
name,
|
|
@@ -11408,7 +11523,7 @@ var domainFeature = defineFeature({
|
|
|
11408
11523
|
// src/feature/function/index.ts
|
|
11409
11524
|
import { aws as aws7, Node as Node6 } from "@awsless/formation";
|
|
11410
11525
|
import { camelCase as camelCase3 } from "change-case";
|
|
11411
|
-
import { relative as
|
|
11526
|
+
import { relative as relative3 } from "path";
|
|
11412
11527
|
import deepmerge2 from "deepmerge";
|
|
11413
11528
|
import { days as days3 } from "@awsless/duration";
|
|
11414
11529
|
var typeGenCode2 = `
|
|
@@ -11458,16 +11573,18 @@ var functionFeature = defineFeature({
|
|
|
11458
11573
|
resourceType: "function",
|
|
11459
11574
|
resourceName: name
|
|
11460
11575
|
});
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
11464
|
-
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
|
|
11470
|
-
|
|
11576
|
+
if ("file" in local2.code) {
|
|
11577
|
+
const relFile = relative3(directories.types, local2.code.file);
|
|
11578
|
+
if (props.runtime === "container") {
|
|
11579
|
+
resource2.addType(name, `Invoke<'${funcName}', Func>`);
|
|
11580
|
+
mock.addType(name, `MockBuilder<Func>`);
|
|
11581
|
+
mockResponse.addType(name, `MockObject<Func>`);
|
|
11582
|
+
} else {
|
|
11583
|
+
types2.addImport(varName, relFile);
|
|
11584
|
+
resource2.addType(name, `Invoke<'${funcName}', typeof ${varName}>`);
|
|
11585
|
+
mock.addType(name, `MockBuilder<typeof ${varName}>`);
|
|
11586
|
+
mockResponse.addType(name, `MockObject<typeof ${varName}>`);
|
|
11587
|
+
}
|
|
11471
11588
|
}
|
|
11472
11589
|
}
|
|
11473
11590
|
mocks.addType(stack.name, mock);
|
|
@@ -11522,7 +11639,7 @@ var functionFeature = defineFeature({
|
|
|
11522
11639
|
});
|
|
11523
11640
|
},
|
|
11524
11641
|
onStack(ctx) {
|
|
11525
|
-
for (const [id, props] of Object.entries(ctx.stackConfig.functions
|
|
11642
|
+
for (const [id, props] of Object.entries(ctx.stackConfig.functions ?? {})) {
|
|
11526
11643
|
const group = new Node6(ctx.stack, "function", id);
|
|
11527
11644
|
createLambdaFunction(group, ctx, "function", id, props);
|
|
11528
11645
|
}
|
|
@@ -11536,12 +11653,12 @@ import { mergeTypeDefs } from "@graphql-tools/merge";
|
|
|
11536
11653
|
import { readFile as readFile5 } from "fs/promises";
|
|
11537
11654
|
import { buildSchema, print } from "graphql";
|
|
11538
11655
|
import { Asset as Asset2, aws as aws8, Node as Node7 } from "@awsless/formation";
|
|
11539
|
-
import { createHash as
|
|
11656
|
+
import { createHash as createHash5 } from "crypto";
|
|
11540
11657
|
|
|
11541
11658
|
// src/util/id.ts
|
|
11542
|
-
import { createHash as
|
|
11659
|
+
import { createHash as createHash4 } from "crypto";
|
|
11543
11660
|
var shortId = (ns) => {
|
|
11544
|
-
return
|
|
11661
|
+
return createHash4("md5").update(ns).digest("hex").substring(0, 10);
|
|
11545
11662
|
};
|
|
11546
11663
|
|
|
11547
11664
|
// src/feature/domain/util.ts
|
|
@@ -11749,12 +11866,12 @@ var graphqlFeature = defineFeature({
|
|
|
11749
11866
|
const file = stack.graphql?.[id]?.schema;
|
|
11750
11867
|
if (file) {
|
|
11751
11868
|
const source = await readFile5(file, "utf8");
|
|
11752
|
-
const finger2 =
|
|
11869
|
+
const finger2 = createHash5("sha1").update(source).digest("hex");
|
|
11753
11870
|
sources.push(source);
|
|
11754
11871
|
fingers.push(finger2);
|
|
11755
11872
|
}
|
|
11756
11873
|
}
|
|
11757
|
-
const finger =
|
|
11874
|
+
const finger = createHash5("sha1").update(sources.sort().join(" ")).digest("hex");
|
|
11758
11875
|
return build3(finger, async (write) => {
|
|
11759
11876
|
const defs = mergeTypeDefs([scalarSchema, baseSchema, ...sources]);
|
|
11760
11877
|
const output = print(defs);
|
|
@@ -11890,7 +12007,7 @@ var graphqlFeature = defineFeature({
|
|
|
11890
12007
|
// src/feature/http/index.ts
|
|
11891
12008
|
import { aws as aws9, Node as Node8 } from "@awsless/formation";
|
|
11892
12009
|
import { camelCase as camelCase4, constantCase as constantCase6 } from "change-case";
|
|
11893
|
-
import { relative as
|
|
12010
|
+
import { relative as relative4 } from "path";
|
|
11894
12011
|
var parseRoute = (route) => {
|
|
11895
12012
|
const [method, ...paths] = route.split(" ");
|
|
11896
12013
|
const path = paths.join(" ");
|
|
@@ -11934,7 +12051,7 @@ var httpFeature = defineFeature({
|
|
|
11934
12051
|
paramType.addType(param[0], "string | number");
|
|
11935
12052
|
}
|
|
11936
12053
|
const varName = camelCase4(`${id}-${path}-${method}`);
|
|
11937
|
-
const relFile =
|
|
12054
|
+
const relFile = relative4(directories.types, file);
|
|
11938
12055
|
types2.addImport(varName, relFile);
|
|
11939
12056
|
methodType.add(`'${path}'`, `Route<typeof ${varName}, ${paramType.toString() || "never"}>`);
|
|
11940
12057
|
}
|
|
@@ -12416,7 +12533,7 @@ var pubsubFeature = defineFeature({
|
|
|
12416
12533
|
import { aws as aws14, Node as Node13 } from "@awsless/formation";
|
|
12417
12534
|
import { camelCase as camelCase5, constantCase as constantCase8 } from "change-case";
|
|
12418
12535
|
import deepmerge3 from "deepmerge";
|
|
12419
|
-
import { relative as
|
|
12536
|
+
import { relative as relative5 } from "path";
|
|
12420
12537
|
var typeGenCode3 = `
|
|
12421
12538
|
import { SendMessageOptions, SendMessageBatchOptions, BatchItem } from '@awsless/sqs'
|
|
12422
12539
|
import type { Mock } from 'vitest'
|
|
@@ -12454,7 +12571,7 @@ var queueFeature = defineFeature({
|
|
|
12454
12571
|
resourceName: name
|
|
12455
12572
|
});
|
|
12456
12573
|
const file = typeof fileOrProps === "string" ? fileOrProps : typeof fileOrProps.consumer === "string" ? fileOrProps.consumer : fileOrProps.consumer.file;
|
|
12457
|
-
const relFile =
|
|
12574
|
+
const relFile = relative5(directories.types, file);
|
|
12458
12575
|
gen.addImport(varName, relFile);
|
|
12459
12576
|
mock.addType(name, `MockBuilder<typeof ${varName}>`);
|
|
12460
12577
|
resource2.addType(name, `Send<'${queueName}', typeof ${varName}>`);
|
|
@@ -12602,7 +12719,7 @@ var restFeature = defineFeature({
|
|
|
12602
12719
|
import { camelCase as camelCase6, constantCase as constantCase10, paramCase as paramCase7 } from "change-case";
|
|
12603
12720
|
import { Asset as Asset5, aws as aws17, Node as Node16 } from "@awsless/formation";
|
|
12604
12721
|
import { mebibytes as mebibytes2 } from "@awsless/size";
|
|
12605
|
-
import { dirname as dirname10, join as
|
|
12722
|
+
import { dirname as dirname10, join as join11, relative as relative6 } from "path";
|
|
12606
12723
|
import { fileURLToPath } from "node:url";
|
|
12607
12724
|
|
|
12608
12725
|
// src/feature/function/prebuild.ts
|
|
@@ -12648,6 +12765,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, local2) => {
|
|
|
12648
12765
|
role: role.arn,
|
|
12649
12766
|
code,
|
|
12650
12767
|
runtime: props.runtime === "container" ? void 0 : props.runtime,
|
|
12768
|
+
layers: (props.layers ?? []).map((id2) => ctx.shared.get(`layer-${id2}-arn`)),
|
|
12651
12769
|
// Remove conflicting props.
|
|
12652
12770
|
vpc: void 0,
|
|
12653
12771
|
log: props.log
|
|
@@ -12760,7 +12878,7 @@ var rpcFeature = defineFeature({
|
|
|
12760
12878
|
const schema = new TypeObject(2);
|
|
12761
12879
|
for (const stack of ctx.stackConfigs) {
|
|
12762
12880
|
for (const [name, props] of Object.entries(stack.rpc?.[id] ?? {})) {
|
|
12763
|
-
const relFile =
|
|
12881
|
+
const relFile = relative6(directories.types, props.file);
|
|
12764
12882
|
const varName = camelCase6(`${stack.name}-${name}`);
|
|
12765
12883
|
types2.addImport(varName, relFile);
|
|
12766
12884
|
schema.addType(name, `Handle<typeof ${varName}>`);
|
|
@@ -12798,8 +12916,8 @@ var rpcFeature = defineFeature({
|
|
|
12798
12916
|
resourceName: id
|
|
12799
12917
|
});
|
|
12800
12918
|
const { lambda, policy, code } = createPrebuildLambdaFunction(group, ctx, "rpc", id, {
|
|
12801
|
-
bundleFile:
|
|
12802
|
-
bundleHash:
|
|
12919
|
+
bundleFile: join11(__dirname, "/prebuild/rpc/bundle.zip"),
|
|
12920
|
+
bundleHash: join11(__dirname, "/prebuild/rpc/HASH"),
|
|
12803
12921
|
memorySize: mebibytes2(256),
|
|
12804
12922
|
warm: 3,
|
|
12805
12923
|
log: props.log
|
|
@@ -12987,7 +13105,7 @@ var searchFeature = defineFeature({
|
|
|
12987
13105
|
import { days as days6, seconds as seconds4 } from "@awsless/duration";
|
|
12988
13106
|
import { Asset as Asset6, aws as aws19, Node as Node18 } from "@awsless/formation";
|
|
12989
13107
|
import { glob as glob2 } from "glob";
|
|
12990
|
-
import { join as
|
|
13108
|
+
import { join as join12 } from "path";
|
|
12991
13109
|
|
|
12992
13110
|
// src/feature/site/util.ts
|
|
12993
13111
|
import { lookup, contentType } from "mime-types";
|
|
@@ -13097,7 +13215,7 @@ var siteFeature = defineFeature({
|
|
|
13097
13215
|
const object = new aws19.s3.BucketObject(group, file, {
|
|
13098
13216
|
bucket: bucket.name,
|
|
13099
13217
|
key: file,
|
|
13100
|
-
body: Asset6.fromFile(
|
|
13218
|
+
body: Asset6.fromFile(join12(props.static, file)),
|
|
13101
13219
|
cacheControl: getCacheControl(file),
|
|
13102
13220
|
contentType: getContentType(file)
|
|
13103
13221
|
});
|
|
@@ -13478,7 +13596,7 @@ var tableFeature = defineFeature({
|
|
|
13478
13596
|
// src/feature/task/index.ts
|
|
13479
13597
|
import { Node as Node22 } from "@awsless/formation";
|
|
13480
13598
|
import { camelCase as camelCase7 } from "change-case";
|
|
13481
|
-
import { relative as
|
|
13599
|
+
import { relative as relative7 } from "path";
|
|
13482
13600
|
var typeGenCode6 = `
|
|
13483
13601
|
import { InvokeOptions } from '@awsless/lambda'
|
|
13484
13602
|
import type { Mock } from 'vitest'
|
|
@@ -13520,11 +13638,13 @@ var taskFeature = defineFeature({
|
|
|
13520
13638
|
resourceType: "task",
|
|
13521
13639
|
resourceName: name
|
|
13522
13640
|
});
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
|
|
13527
|
-
|
|
13641
|
+
if ("file" in props.consumer.code) {
|
|
13642
|
+
const relFile = relative7(directories.types, props.consumer.code.file);
|
|
13643
|
+
types2.addImport(varName, relFile);
|
|
13644
|
+
resource2.addType(name, `Invoke<'${funcName}', typeof ${varName}>`);
|
|
13645
|
+
mock.addType(name, `MockBuilder<typeof ${varName}>`);
|
|
13646
|
+
mockResponse.addType(name, `MockObject<typeof ${varName}>`);
|
|
13647
|
+
}
|
|
13528
13648
|
}
|
|
13529
13649
|
mocks.addType(stack.name, mock);
|
|
13530
13650
|
resources.addType(stack.name, resource2);
|
|
@@ -14669,13 +14789,13 @@ import wildstring4 from "wildstring";
|
|
|
14669
14789
|
import { log as log8 } from "@clack/prompts";
|
|
14670
14790
|
import chalk6 from "chalk";
|
|
14671
14791
|
import { mkdir as mkdir5, readFile as readFile7, writeFile as writeFile3 } from "fs/promises";
|
|
14672
|
-
import { join as
|
|
14792
|
+
import { join as join15 } from "path";
|
|
14673
14793
|
import wildstring3 from "wildstring";
|
|
14674
14794
|
|
|
14675
14795
|
// src/build/__fingerprint.ts
|
|
14676
|
-
import { createHash as
|
|
14677
|
-
import { readdir as
|
|
14678
|
-
import { basename as basename5, dirname as dirname11, extname as extname3, join as
|
|
14796
|
+
import { createHash as createHash6 } from "crypto";
|
|
14797
|
+
import { readdir as readdir4, readFile as readFile6, stat as stat4 } from "fs/promises";
|
|
14798
|
+
import { basename as basename5, dirname as dirname11, extname as extname3, join as join13 } from "path";
|
|
14679
14799
|
import parseStaticImports from "parse-static-imports";
|
|
14680
14800
|
var extensions = ["js", "mjs", "jsx", "ts", "mts", "tsx"];
|
|
14681
14801
|
var generateFileHashes = async (file, hashes) => {
|
|
@@ -14684,7 +14804,7 @@ var generateFileHashes = async (file, hashes) => {
|
|
|
14684
14804
|
}
|
|
14685
14805
|
const code = await readModuleFile(file);
|
|
14686
14806
|
const deps = await findDependencies(file, code);
|
|
14687
|
-
const hash =
|
|
14807
|
+
const hash = createHash6("sha1").update(code).digest();
|
|
14688
14808
|
hashes.set(file, hash);
|
|
14689
14809
|
for (const dep of deps) {
|
|
14690
14810
|
if (dep.startsWith("/")) {
|
|
@@ -14694,14 +14814,14 @@ var generateFileHashes = async (file, hashes) => {
|
|
|
14694
14814
|
};
|
|
14695
14815
|
var fingerprintFromDirectory = async (dir) => {
|
|
14696
14816
|
const hashes = /* @__PURE__ */ new Map();
|
|
14697
|
-
const files = await
|
|
14817
|
+
const files = await readdir4(dir, { recursive: true });
|
|
14698
14818
|
for (const file of files) {
|
|
14699
14819
|
if (extensions.includes(extname3(file).substring(1)) && file.at(0) !== "_") {
|
|
14700
|
-
await generateFileHashes(
|
|
14820
|
+
await generateFileHashes(join13(dir, file), hashes);
|
|
14701
14821
|
}
|
|
14702
14822
|
}
|
|
14703
14823
|
const merge2 = Buffer.concat(Array.from(hashes.values()).sort());
|
|
14704
|
-
return
|
|
14824
|
+
return createHash6("sha1").update(merge2).digest("hex");
|
|
14705
14825
|
};
|
|
14706
14826
|
var readModuleFile = (file) => {
|
|
14707
14827
|
if (file.endsWith(".js")) {
|
|
@@ -14711,7 +14831,7 @@ var readModuleFile = (file) => {
|
|
|
14711
14831
|
return readFiles([
|
|
14712
14832
|
file,
|
|
14713
14833
|
...extensions.map((exp) => `${file}.${exp}`),
|
|
14714
|
-
...extensions.map((exp) =>
|
|
14834
|
+
...extensions.map((exp) => join13(file, `/index.${exp}`))
|
|
14715
14835
|
]);
|
|
14716
14836
|
}
|
|
14717
14837
|
return readFile6(file, "utf8");
|
|
@@ -14731,7 +14851,7 @@ var readFiles = async (files) => {
|
|
|
14731
14851
|
};
|
|
14732
14852
|
var findDependencies = async (file, code) => {
|
|
14733
14853
|
const imports = await parseStaticImports(code);
|
|
14734
|
-
return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ?
|
|
14854
|
+
return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ? join13(dirname11(file), value) : value);
|
|
14735
14855
|
};
|
|
14736
14856
|
|
|
14737
14857
|
// src/test/reporter.ts
|
|
@@ -14814,7 +14934,7 @@ import { startVitest } from "vitest/node";
|
|
|
14814
14934
|
import commonjs3 from "@rollup/plugin-commonjs";
|
|
14815
14935
|
import nodeResolve3 from "@rollup/plugin-node-resolve";
|
|
14816
14936
|
import json3 from "@rollup/plugin-json";
|
|
14817
|
-
import { dirname as dirname12, join as
|
|
14937
|
+
import { dirname as dirname12, join as join14 } from "path";
|
|
14818
14938
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
14819
14939
|
var startTest = async (props) => {
|
|
14820
14940
|
const __dirname2 = dirname12(fileURLToPath2(import.meta.url));
|
|
@@ -14831,7 +14951,7 @@ var startTest = async (props) => {
|
|
|
14831
14951
|
exclude: ["**/_*", "**/_*/**", ...configDefaults.exclude],
|
|
14832
14952
|
globals: true,
|
|
14833
14953
|
reporters: props.reporter,
|
|
14834
|
-
globalSetup:
|
|
14954
|
+
globalSetup: join14(__dirname2, "test-global-setup.js")
|
|
14835
14955
|
// env: {
|
|
14836
14956
|
// TZ: 'UTC',
|
|
14837
14957
|
// },
|
|
@@ -14925,7 +15045,7 @@ var logTestErrors = (event) => {
|
|
|
14925
15045
|
var runTest = async (stack, dir, filters) => {
|
|
14926
15046
|
await mkdir5(directories.test, { recursive: true });
|
|
14927
15047
|
const fingerprint = await fingerprintFromDirectory(dir);
|
|
14928
|
-
const file =
|
|
15048
|
+
const file = join15(directories.test, `${stack}.json`);
|
|
14929
15049
|
const exists = await fileExist(file);
|
|
14930
15050
|
if (exists && !process.env.NO_CACHE) {
|
|
14931
15051
|
const raw = await readFile7(file, { encoding: "utf8" });
|
|
@@ -15179,12 +15299,13 @@ var bind = (program2) => {
|
|
|
15179
15299
|
} else {
|
|
15180
15300
|
log9.warning("No bindings available.");
|
|
15181
15301
|
}
|
|
15302
|
+
const configList = opts.config ?? [];
|
|
15182
15303
|
const configs = {};
|
|
15183
|
-
for (const name of
|
|
15304
|
+
for (const name of configList) {
|
|
15184
15305
|
configs[`CONFIG_${constantCase14(name)}`] = name;
|
|
15185
15306
|
}
|
|
15186
|
-
if (
|
|
15187
|
-
note3(wrap(
|
|
15307
|
+
if (configList.length ?? 0 > 0) {
|
|
15308
|
+
note3(wrap(configList.map((v) => color.label(constantCase14(v)))), "Bind Config");
|
|
15188
15309
|
}
|
|
15189
15310
|
if (commands7.length === 0) {
|
|
15190
15311
|
return "No command to execute.";
|
|
@@ -15247,7 +15368,7 @@ import { log as log10 } from "@clack/prompts";
|
|
|
15247
15368
|
|
|
15248
15369
|
// src/type-gen/generate.ts
|
|
15249
15370
|
import { mkdir as mkdir6, writeFile as writeFile4 } from "fs/promises";
|
|
15250
|
-
import { dirname as dirname13, join as
|
|
15371
|
+
import { dirname as dirname13, join as join16, relative as relative8 } from "path";
|
|
15251
15372
|
var generateTypes = async (props) => {
|
|
15252
15373
|
const files = [];
|
|
15253
15374
|
await Promise.all(
|
|
@@ -15256,10 +15377,10 @@ var generateTypes = async (props) => {
|
|
|
15256
15377
|
...props,
|
|
15257
15378
|
async write(file, data, include = false) {
|
|
15258
15379
|
const code = data?.toString("utf8");
|
|
15259
|
-
const path =
|
|
15380
|
+
const path = join16(directories.types, file);
|
|
15260
15381
|
if (code) {
|
|
15261
15382
|
if (include) {
|
|
15262
|
-
files.push(
|
|
15383
|
+
files.push(relative8(directories.root, path));
|
|
15263
15384
|
}
|
|
15264
15385
|
await mkdir6(dirname13(path), { recursive: true });
|
|
15265
15386
|
await writeFile4(path, code);
|
|
@@ -15270,7 +15391,7 @@ var generateTypes = async (props) => {
|
|
|
15270
15391
|
);
|
|
15271
15392
|
if (files.length) {
|
|
15272
15393
|
const code = files.map((file) => `/// <reference path='${file}' />`).join("\n");
|
|
15273
|
-
await writeFile4(
|
|
15394
|
+
await writeFile4(join16(directories.root, `awsless.d.ts`), code);
|
|
15274
15395
|
}
|
|
15275
15396
|
};
|
|
15276
15397
|
|