@awsless/awsless 0.0.86 → 0.0.88

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
@@ -5479,6 +5479,14 @@ var sitePlugin = definePlugin({
5479
5479
  static: LocalDirectorySchema.optional(),
5480
5480
  /** Specifies the ssr file. */
5481
5481
  ssr: FunctionSchema.optional(),
5482
+ // ssr: z.union([
5483
+ // FunctionSchema.optional(),
5484
+ // z.object({
5485
+ // consumer: FunctionSchema.optional(),
5486
+ // responseStreaming: z.boolean().default(false),
5487
+ // build: z.string().optional(),
5488
+ // }),
5489
+ // ]),
5482
5490
  /** Customize the error responses for specific HTTP status codes. */
5483
5491
  errors: z25.object({
5484
5492
  /** Customize a `400 Bad Request` response */
@@ -5587,7 +5595,9 @@ var sitePlugin = definePlugin({
5587
5595
  urlAuthType: "none"
5588
5596
  // sourceArn: distribution.arn,
5589
5597
  }).dependsOn(lambda);
5590
- const url = lambda.addUrl();
5598
+ const url = lambda.addUrl({
5599
+ invokeMode: "buffered"
5600
+ });
5591
5601
  stack.add(url, lambda, permissions);
5592
5602
  origins.push(
5593
5603
  new Origin({
@@ -6356,10 +6366,7 @@ var getAllDepends = (filters) => {
6356
6366
  var toApp = async (config, filters) => {
6357
6367
  const app = new App(config.name);
6358
6368
  const stacks = [];
6359
- const plugins = [
6360
- ...defaultPlugins,
6361
- ...config.plugins || []
6362
- ];
6369
+ const plugins = [...defaultPlugins, ...config.plugins || []];
6363
6370
  debug("Plugins detected:", plugins.map((plugin) => style.info(plugin.name)).join(", "));
6364
6371
  const bootstrap2 = new Stack("bootstrap", config.region);
6365
6372
  const usEastBootstrap = new Stack("us-east-bootstrap", "us-east-1");
@@ -6395,6 +6402,7 @@ var toApp = async (config, filters) => {
6395
6402
  app.add(stack);
6396
6403
  stacks.push({ stack, config: stackConfig, bindings: bindings2 });
6397
6404
  }
6405
+ debug(app.stacks);
6398
6406
  for (const plugin of plugins) {
6399
6407
  for (const stack of app.stacks) {
6400
6408
  for (const resource of stack) {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  import * as zod from 'zod';
2
2
  import { z, AnyZodObject } from 'zod';
3
3
  import { AwsCredentialIdentityProvider } from '@aws-sdk/types';
4
+ import * as _awsless_lambda from '@awsless/lambda';
5
+ import { Handler, Loggers } from '@awsless/lambda';
6
+ import { BaseSchema, SnsTopicSchema, SqsQueueSchema } from '@awsless/validate';
7
+ import * as valibot from 'valibot';
4
8
 
5
9
  type AssetRead = (name: string) => Promise<Buffer>;
6
10
  type AssetWrite = (name: string, data: string | Buffer) => Promise<void>;
@@ -11058,7 +11062,7 @@ declare class Url extends Resource {
11058
11062
  };
11059
11063
  }
11060
11064
 
11061
- type FunctionProps = {
11065
+ type FunctionProps$1 = {
11062
11066
  code: ICode;
11063
11067
  name?: string;
11064
11068
  description?: string;
@@ -11081,7 +11085,7 @@ declare class Function$1 extends Resource {
11081
11085
  private role;
11082
11086
  private policy;
11083
11087
  private environmentVariables;
11084
- constructor(_logicalId: string, props: FunctionProps);
11088
+ constructor(_logicalId: string, props: FunctionProps$1);
11085
11089
  enableLogs(retention?: Duration): this;
11086
11090
  warmUp(concurrency: number): this;
11087
11091
  addUrl(props?: Omit<UrlProps, 'target'>): Url;
@@ -11226,6 +11230,45 @@ interface SearchResources {
11226
11230
  }
11227
11231
  declare const Search: SearchResources;
11228
11232
 
11233
+ type FunctionProps<H extends Handler<S>, S extends BaseSchema> = {
11234
+ handle: H;
11235
+ schema?: S;
11236
+ logger?: Loggers;
11237
+ logViewableErrors?: boolean;
11238
+ };
11239
+ declare const func: <H extends Handler<S>, S extends BaseSchema<any, any>>(props: FunctionProps<H, S>) => (event: _awsless_lambda.Input<S>, context?: _awsless_lambda.LambdaContext | undefined) => Promise<ReturnType<H>>;
11240
+
11241
+ type TopicProps<H extends Handler<S>, S extends BaseSchema> = {
11242
+ handle: H;
11243
+ schema?: S;
11244
+ logger?: Loggers;
11245
+ };
11246
+ declare const topic: <H extends Handler<SnsTopicSchema<S>>, S extends BaseSchema<any, any>>(props: TopicProps<H, S>) => (event: valibot.Input<S> | valibot.Input<S>[] | {
11247
+ Records: {
11248
+ Sns: {
11249
+ Message: string | valibot.Input<S>;
11250
+ };
11251
+ }[];
11252
+ }, context?: _awsless_lambda.LambdaContext | undefined) => Promise<ReturnType<H>>;
11253
+
11254
+ type QueueProps<H extends Handler<S>, S extends BaseSchema> = {
11255
+ handle: H;
11256
+ schema?: S;
11257
+ logger?: Loggers;
11258
+ };
11259
+ declare const queue: <H extends Handler<SqsQueueSchema<S>>, S extends BaseSchema<any, any>>(props: QueueProps<H, S>) => (event: valibot.Input<S> | valibot.Input<S>[] | {
11260
+ Records: {
11261
+ body: string | valibot.Input<S>;
11262
+ }[];
11263
+ }, context?: _awsless_lambda.LambdaContext | undefined) => Promise<ReturnType<H>>;
11264
+
11265
+ type CronProps<H extends Handler<S>, S extends BaseSchema> = {
11266
+ handle: H;
11267
+ schema?: S;
11268
+ logger?: Loggers;
11269
+ };
11270
+ declare const cron: <H extends Handler<S>, S extends BaseSchema<any, any>>(props: CronProps<H, S>) => (event: _awsless_lambda.Input<S>, context?: _awsless_lambda.LambdaContext | undefined) => Promise<ReturnType<H>>;
11271
+
11229
11272
  type AppConfig = CombinedDefaultPluginsConfigInput;
11230
11273
  type StackConfig = CombinedDefaultPluginsConfigInput['stacks'][number];
11231
11274
  declare const defineStackConfig: (config: StackConfig) => StackConfig$1 | (StackConfig$1 & {
@@ -12027,4 +12070,4 @@ declare const defineStackConfig: (config: StackConfig) => StackConfig$1 | (Stack
12027
12070
  });
12028
12071
  declare const defineAppConfig: (config: AppConfig | AppConfigFactory<AppConfig>) => CombinedDefaultPluginsConfigInput | AppConfigFactory<CombinedDefaultPluginsConfigInput>;
12029
12072
 
12030
- export { APP, AppConfig, Auth, AuthResources, Cache, CacheResources, Config, ConfigResources, Fn, Function, FunctionResources, Plugin, Queue, QueueResources, STACK, Search, SearchResources, StackConfig, Store, StoreResources, Table, TableResources, Topic, TopicResources, defineAppConfig, definePlugin, defineStackConfig, getAuthName, getAuthProps, getCacheProps, getConfigName, getFunctionName, getGlobalResourceName, getLocalResourceName, getQueueName, getSearchName, getStoreName, getTableName, getTopicName };
12073
+ export { APP, AppConfig, Auth, AuthResources, Cache, CacheResources, Config, ConfigResources, CronProps, Fn, Function, FunctionProps, FunctionResources, Plugin, Queue, QueueProps, QueueResources, STACK, Search, SearchResources, StackConfig, Store, StoreResources, Table, TableResources, Topic, TopicProps, TopicResources, cron, defineAppConfig, definePlugin, defineStackConfig, func, getAuthName, getAuthProps, getCacheProps, getConfigName, getFunctionName, getGlobalResourceName, getLocalResourceName, getQueueName, getSearchName, getStoreName, getTableName, getTopicName, queue, topic };
package/dist/index.js CHANGED
@@ -89,17 +89,17 @@ var Table = /* @__PURE__ */ createProxy((stack) => {
89
89
  import { publish } from "@awsless/sns";
90
90
  var getTopicName = getGlobalResourceName;
91
91
  var Topic = /* @__PURE__ */ createProxy((name) => {
92
- const topic = getTopicName(name);
92
+ const topic2 = getTopicName(name);
93
93
  const ctx = {
94
- [topic]: async (payload, options = {}) => {
94
+ [topic2]: async (payload, options = {}) => {
95
95
  await publish({
96
96
  ...options,
97
- topic,
97
+ topic: topic2,
98
98
  payload
99
99
  });
100
100
  }
101
101
  };
102
- const call = ctx[topic];
102
+ const call = ctx[topic2];
103
103
  return call;
104
104
  });
105
105
 
@@ -114,9 +114,9 @@ var getQueueUrl = (name, stack = STACK) => {
114
114
  return process.env[`QUEUE_${constantCase2(stack)}_${constantCase2(name)}_URL`];
115
115
  };
116
116
  var Queue = /* @__PURE__ */ createProxy((stack) => {
117
- return createProxy((queue) => {
118
- const url = getQueueUrl(queue, stack);
119
- const name = getQueueName(queue, stack);
117
+ return createProxy((queue2) => {
118
+ const url = getQueueUrl(queue2, stack);
119
+ const name = getQueueName(queue2, stack);
120
120
  const ctx = {
121
121
  [name]: (payload, options = {}) => {
122
122
  return sendMessage({
@@ -236,13 +236,48 @@ var Search = /* @__PURE__ */ createProxy((stack) => {
236
236
  });
237
237
  });
238
238
 
239
- // src/index.ts
240
- var defineStackConfig = (config) => {
241
- return config;
239
+ // src/node/handle/function.ts
240
+ import { lambda } from "@awsless/lambda";
241
+ var func = (props) => {
242
+ return lambda(props);
243
+ };
244
+
245
+ // src/node/handle/topic.ts
246
+ import { snsTopic } from "@awsless/validate";
247
+ import { lambda as lambda2 } from "@awsless/lambda";
248
+ var topic = (props) => {
249
+ return lambda2({
250
+ logger: props.logger,
251
+ schema: snsTopic(props.schema),
252
+ handle: props.handle,
253
+ logViewableErrors: true
254
+ });
242
255
  };
243
- var defineAppConfig = (config) => {
244
- return config;
256
+
257
+ // src/node/handle/queue.ts
258
+ import { lambda as lambda3 } from "@awsless/lambda";
259
+ import { sqsQueue } from "@awsless/validate";
260
+ var queue = (props) => {
261
+ return lambda3({
262
+ logger: props.logger,
263
+ schema: sqsQueue(props.schema),
264
+ handle: props.handle,
265
+ logViewableErrors: true
266
+ });
245
267
  };
268
+
269
+ // src/node/handle/cron.ts
270
+ import { lambda as lambda4 } from "@awsless/lambda";
271
+ var cron = (props) => {
272
+ return lambda4({
273
+ ...props,
274
+ logViewableErrors: true
275
+ });
276
+ };
277
+
278
+ // src/index.ts
279
+ var defineStackConfig = (config) => config;
280
+ var defineAppConfig = (config) => config;
246
281
  export {
247
282
  APP,
248
283
  Auth,
@@ -256,9 +291,11 @@ export {
256
291
  Store,
257
292
  Table,
258
293
  Topic,
294
+ cron,
259
295
  defineAppConfig,
260
296
  definePlugin,
261
297
  defineStackConfig,
298
+ func,
262
299
  getAuthName,
263
300
  getAuthProps,
264
301
  getCacheProps,
@@ -270,5 +307,7 @@ export {
270
307
  getSearchName,
271
308
  getStoreName,
272
309
  getTableName,
273
- getTopicName
310
+ getTopicName,
311
+ queue,
312
+ topic
274
313
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.86",
3
+ "version": "0.0.88",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -24,11 +24,12 @@
24
24
  }
25
25
  },
26
26
  "peerDependencies": {
27
- "@awsless/lambda": "^0.0.6",
28
- "@awsless/sns": "^0.0.6",
29
- "@awsless/sqs": "^0.0.6",
30
- "@awsless/ssm": "^0.0.7",
31
- "@awsless/redis": "^0.0.8"
27
+ "@awsless/validate": "^0.0.5",
28
+ "@awsless/redis": "^0.0.8",
29
+ "@awsless/sqs": "^0.0.7",
30
+ "@awsless/lambda": "^0.0.9",
31
+ "@awsless/sns": "^0.0.7",
32
+ "@awsless/ssm": "^0.0.7"
32
33
  },
33
34
  "dependencies": {
34
35
  "@aws-appsync/utils": "^1.5.0",