@awsless/awsless 0.0.438 → 0.0.440

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/bin.js CHANGED
@@ -7759,11 +7759,11 @@ var BundleCodeSchema = z8.object({
7759
7759
  bundle: LocalDirectorySchema.describe("The directory that needs to be bundled.")
7760
7760
  });
7761
7761
  var CodeSchema = z8.union([
7762
- LocalFileSchema.transform((file) => ({
7763
- file,
7764
- minify: true,
7765
- external: []
7766
- })),
7762
+ LocalFileSchema.transform(
7763
+ (file) => FileCodeSchema.parse({
7764
+ file
7765
+ })
7766
+ ),
7767
7767
  FileCodeSchema,
7768
7768
  BundleCodeSchema
7769
7769
  ]).describe("Specify the code of your function.");
@@ -7792,11 +7792,9 @@ var FnSchema = z8.object({
7792
7792
  });
7793
7793
  var FunctionSchema = z8.union([
7794
7794
  LocalFileSchema.transform((file) => ({
7795
- code: {
7796
- file,
7797
- minify: true,
7798
- external: []
7799
- }
7795
+ code: FileCodeSchema.parse({
7796
+ file
7797
+ })
7800
7798
  })),
7801
7799
  FnSchema
7802
7800
  ]);
@@ -8166,10 +8164,10 @@ var QueueDefaultSchema = z18.object({
8166
8164
  var QueuesSchema = z18.record(
8167
8165
  ResourceIdSchema,
8168
8166
  z18.union([
8169
- LocalFileSchema.transform((file) => ({
8170
- consumer: {
8171
- file
8172
- }
8167
+ LocalFileSchema.transform((code) => ({
8168
+ consumer: FunctionSchema.parse({
8169
+ code
8170
+ })
8173
8171
  })),
8174
8172
  z18.object({
8175
8173
  consumer: FunctionSchema.describe("The consuming lambda function properties."),
@@ -10290,27 +10288,31 @@ var findImports = async (file, code) => {
10290
10288
  syntax: "typescript"
10291
10289
  });
10292
10290
  const importing = /* @__PURE__ */ new Set();
10293
- simple2(ast, {
10294
- ImportDeclaration(node) {
10295
- importing.add(node.source.value);
10296
- },
10297
- ExportAllDeclaration(node) {
10298
- importing.add(node.source.value);
10299
- },
10300
- ExportNamedDeclaration(node) {
10301
- if (node.source) {
10291
+ try {
10292
+ simple2(ast, {
10293
+ ImportDeclaration(node) {
10302
10294
  importing.add(node.source.value);
10303
- }
10304
- },
10305
- CallExpression(node) {
10306
- if (node.callee.type === "Import") {
10307
- const first = node.arguments.at(0);
10308
- if (first && first.expression.type === "StringLiteral") {
10309
- importing.add(first.expression.value);
10295
+ },
10296
+ ExportAllDeclaration(node) {
10297
+ importing.add(node.source.value);
10298
+ },
10299
+ ExportNamedDeclaration(node) {
10300
+ if (node.source) {
10301
+ importing.add(node.source.value);
10302
+ }
10303
+ },
10304
+ CallExpression(node) {
10305
+ if (node.callee.type === "Import") {
10306
+ const first = node.arguments.at(0);
10307
+ if (first && first.expression.type === "StringLiteral") {
10308
+ importing.add(first.expression.value);
10309
+ }
10310
10310
  }
10311
10311
  }
10312
- }
10313
- });
10312
+ });
10313
+ } catch (_) {
10314
+ return [];
10315
+ }
10314
10316
  return [...importing].map((importee) => {
10315
10317
  if (importee.startsWith(".")) {
10316
10318
  return resolve(dirname4(file), importee);
@@ -12037,11 +12039,12 @@ var httpFeature = defineFeature({
12037
12039
  if (!(id in api)) api[id] = {};
12038
12040
  for (const [route, props] of Object.entries(routes)) {
12039
12041
  const { path, method } = parseRoute(route);
12040
- const file = typeof props === "string" ? props : props.file;
12041
- if (!(method in api[id])) {
12042
- api[id][method] = {};
12042
+ if (props && "file" in props.code) {
12043
+ if (!(method in api[id])) {
12044
+ api[id][method] = {};
12045
+ }
12046
+ api[id][method][path] = props.code.file;
12043
12047
  }
12044
- api[id][method][path] = file;
12045
12048
  }
12046
12049
  }
12047
12050
  }
@@ -12566,7 +12569,7 @@ var queueFeature = defineFeature({
12566
12569
  const resource2 = new TypeObject(2);
12567
12570
  const mock = new TypeObject(2);
12568
12571
  const mockResponse = new TypeObject(2);
12569
- for (const [name, fileOrProps] of Object.entries(stack.queues || {})) {
12572
+ for (const [name, props] of Object.entries(stack.queues || {})) {
12570
12573
  const varName = camelCase5(`${stack.name}-${name}`);
12571
12574
  const queueName = formatLocalResourceName({
12572
12575
  appName: ctx.appConfig.name,
@@ -12574,12 +12577,13 @@ var queueFeature = defineFeature({
12574
12577
  resourceType: "queue",
12575
12578
  resourceName: name
12576
12579
  });
12577
- const file = typeof fileOrProps === "string" ? fileOrProps : typeof fileOrProps.consumer === "string" ? fileOrProps.consumer : fileOrProps.consumer.file;
12578
- const relFile = relative5(directories.types, file);
12579
- gen.addImport(varName, relFile);
12580
- mock.addType(name, `MockBuilder<typeof ${varName}>`);
12581
- resource2.addType(name, `Send<'${queueName}', typeof ${varName}>`);
12582
- mockResponse.addType(name, `MockObject<typeof ${varName}>`);
12580
+ if ("file" in props.consumer.code) {
12581
+ const relFile = relative5(directories.types, props.consumer.code.file);
12582
+ gen.addImport(varName, relFile);
12583
+ mock.addType(name, `MockBuilder<typeof ${varName}>`);
12584
+ resource2.addType(name, `Send<'${queueName}', typeof ${varName}>`);
12585
+ mockResponse.addType(name, `MockObject<typeof ${varName}>`);
12586
+ }
12583
12587
  }
12584
12588
  mocks.addType(stack.name, mock);
12585
12589
  resources.addType(stack.name, resource2);
@@ -12882,10 +12886,12 @@ var rpcFeature = defineFeature({
12882
12886
  const schema = new TypeObject(2);
12883
12887
  for (const stack of ctx.stackConfigs) {
12884
12888
  for (const [name, props] of Object.entries(stack.rpc?.[id] ?? {})) {
12885
- const relFile = relative6(directories.types, props.file);
12886
- const varName = camelCase6(`${stack.name}-${name}`);
12887
- types2.addImport(varName, relFile);
12888
- schema.addType(name, `Handle<typeof ${varName}>`);
12889
+ if ("file" in props.code) {
12890
+ const relFile = relative6(directories.types, props.code.file);
12891
+ const varName = camelCase6(`${stack.name}-${name}`);
12892
+ types2.addImport(varName, relFile);
12893
+ schema.addType(name, `Handle<typeof ${varName}>`);
12894
+ }
12889
12895
  }
12890
12896
  }
12891
12897
  schemas.addType(id, schema);
@@ -206,11 +206,11 @@ var BundleCodeSchema = z6.object({
206
206
  bundle: LocalDirectorySchema.describe("The directory that needs to be bundled.")
207
207
  });
208
208
  var CodeSchema = z6.union([
209
- LocalFileSchema.transform((file) => ({
210
- file,
211
- minify: true,
212
- external: []
213
- })),
209
+ LocalFileSchema.transform(
210
+ (file) => FileCodeSchema.parse({
211
+ file
212
+ })
213
+ ),
214
214
  FileCodeSchema,
215
215
  BundleCodeSchema
216
216
  ]).describe("Specify the code of your function.");
@@ -239,11 +239,9 @@ var FnSchema = z6.object({
239
239
  });
240
240
  var FunctionSchema = z6.union([
241
241
  LocalFileSchema.transform((file) => ({
242
- code: {
243
- file,
244
- minify: true,
245
- external: []
246
- }
242
+ code: FileCodeSchema.parse({
243
+ file
244
+ })
247
245
  })),
248
246
  FnSchema
249
247
  ]);
@@ -668,10 +666,10 @@ var QueueDefaultSchema = z18.object({
668
666
  var QueuesSchema = z18.record(
669
667
  ResourceIdSchema,
670
668
  z18.union([
671
- LocalFileSchema.transform((file) => ({
672
- consumer: {
673
- file
674
- }
669
+ LocalFileSchema.transform((code) => ({
670
+ consumer: FunctionSchema.parse({
671
+ code
672
+ })
675
673
  })),
676
674
  z18.object({
677
675
  consumer: FunctionSchema.describe("The consuming lambda function properties."),
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.438",
3
+ "version": "0.0.440",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -28,19 +28,19 @@
28
28
  }
29
29
  },
30
30
  "peerDependencies": {
31
- "@awsless/json": "^0.0.7",
32
- "@awsless/lambda": "^0.0.30",
33
- "@awsless/open-search": "^0.0.17",
34
- "@awsless/mqtt": "^0.0.2",
35
31
  "@awsless/dynamodb": "^0.1.5",
32
+ "@awsless/json": "^0.0.7",
36
33
  "@awsless/iot": "^0.0.3",
34
+ "@awsless/open-search": "^0.0.17",
37
35
  "@awsless/redis": "^0.0.13",
36
+ "@awsless/s3": "^0.0.20",
37
+ "@awsless/sqs": "^0.0.8",
38
+ "@awsless/ssm": "^0.0.7",
38
39
  "@awsless/sns": "^0.0.10",
39
40
  "@awsless/validate": "^0.0.17",
40
41
  "@awsless/weak-cache": "^0.0.1",
41
- "@awsless/ssm": "^0.0.7",
42
- "@awsless/s3": "^0.0.20",
43
- "@awsless/sqs": "^0.0.8"
42
+ "@awsless/lambda": "^0.0.30",
43
+ "@awsless/mqtt": "^0.0.2"
44
44
  },
45
45
  "dependencies": {
46
46
  "@arcanyx/cidr-slicer": "^0.3.0",
@@ -116,14 +116,14 @@
116
116
  "zip-a-folder": "^3.1.6",
117
117
  "zod": "^3.21.4",
118
118
  "zod-to-json-schema": "^3.22.3",
119
- "@awsless/formation": "^0.0.59",
119
+ "@awsless/code": "^0.0.10",
120
120
  "@awsless/duration": "^0.0.1",
121
- "@awsless/size": "^0.0.1",
121
+ "@awsless/graphql": "^0.0.9",
122
+ "@awsless/formation": "^0.0.59",
122
123
  "@awsless/json": "^0.0.7",
123
124
  "@awsless/validate": "^0.0.17",
124
- "@awsless/code": "^0.0.10",
125
- "@awsless/graphql": "^0.0.9",
126
- "@awsless/ts-file-cache": "^0.0.11"
125
+ "@awsless/size": "^0.0.1",
126
+ "@awsless/ts-file-cache": "^0.0.12"
127
127
  },
128
128
  "devDependencies": {
129
129
  "@node-rs/bcrypt": "^1.10.5"