@awsless/awsless 0.0.288 → 0.0.290
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 +6 -5
- package/dist/chunk-DVWXAVM2.js +34 -0
- package/dist/server.d.ts +24 -1
- package/dist/server.js +4 -0
- package/package.json +4 -4
package/dist/bin.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
CommandOptions
|
|
4
|
+
} from "./chunk-DVWXAVM2.js";
|
|
2
5
|
|
|
3
6
|
// src/cli/program.ts
|
|
4
|
-
import { Command } from "commander";
|
|
7
|
+
import { Command as Command2 } from "commander";
|
|
5
8
|
|
|
6
9
|
// src/cli/ui/style.ts
|
|
7
10
|
import chalk from "chalk";
|
|
@@ -5611,7 +5614,6 @@ var resource = (program2) => {
|
|
|
5611
5614
|
|
|
5612
5615
|
// src/cli/command/run.ts
|
|
5613
5616
|
import { isCancel, select as select2 } from "@clack/prompts";
|
|
5614
|
-
import minimist from "minimist";
|
|
5615
5617
|
import { tsImport } from "tsx/esm/api";
|
|
5616
5618
|
var run = (program2) => {
|
|
5617
5619
|
program2.command("run").allowUnknownOption(true).argument("[command]", "The command you want to run").description("Run one of your defined commands.").action(async (selected) => {
|
|
@@ -5652,8 +5654,7 @@ var run = (program2) => {
|
|
|
5652
5654
|
throw new Error(`No "${command.handler}" handler found.`);
|
|
5653
5655
|
}
|
|
5654
5656
|
const result = await task("Running", (update) => {
|
|
5655
|
-
const options =
|
|
5656
|
-
delete options._;
|
|
5657
|
+
const options = new CommandOptions(program2.args);
|
|
5657
5658
|
return handler(options, {
|
|
5658
5659
|
region,
|
|
5659
5660
|
credentials,
|
|
@@ -5784,7 +5785,7 @@ var commands6 = [
|
|
|
5784
5785
|
];
|
|
5785
5786
|
|
|
5786
5787
|
// src/cli/program.ts
|
|
5787
|
-
var program = new
|
|
5788
|
+
var program = new Command2();
|
|
5788
5789
|
program.name(logo());
|
|
5789
5790
|
program.option("--config-file <string>", "The app config file location");
|
|
5790
5791
|
program.option("--stage <string>", "The stage to use, defaults to prod stage", "prod");
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/command.ts
|
|
2
|
+
import minimist from "minimist";
|
|
3
|
+
var CommandOptions = class {
|
|
4
|
+
opts;
|
|
5
|
+
constructor(args) {
|
|
6
|
+
this.opts = minimist(args);
|
|
7
|
+
}
|
|
8
|
+
get(name) {
|
|
9
|
+
if (name in this.opts) {
|
|
10
|
+
return this.opts[name];
|
|
11
|
+
}
|
|
12
|
+
throw new Error(`Option "${name}" not found`);
|
|
13
|
+
}
|
|
14
|
+
getAssertType(name, type) {
|
|
15
|
+
const value = this.get(name);
|
|
16
|
+
if (typeof value === type) {
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
throw new Error(`Option "${name}" is not type of ${type}`);
|
|
20
|
+
}
|
|
21
|
+
number(name) {
|
|
22
|
+
return this.getAssertType(name, "number");
|
|
23
|
+
}
|
|
24
|
+
string(name) {
|
|
25
|
+
return this.getAssertType(name, "string");
|
|
26
|
+
}
|
|
27
|
+
boolean(name) {
|
|
28
|
+
return this.getAssertType(name, "boolean");
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
CommandOptions
|
|
34
|
+
};
|
package/dist/server.d.ts
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
|
+
import { AwsCredentialIdentityProvider } from '@aws-sdk/types';
|
|
1
2
|
import * as _awsless_lambda from '@awsless/lambda';
|
|
2
3
|
import { Handler, Loggers } from '@awsless/lambda';
|
|
3
4
|
import { BaseSchema, SqsQueueSchema, SnsTopicSchema } from '@awsless/validate';
|
|
4
5
|
import * as valibot from 'valibot';
|
|
5
6
|
|
|
7
|
+
declare const regions: readonly ["us-east-2", "us-east-1", "us-west-1", "us-west-2", "af-south-1", "ap-east-1", "ap-south-2", "ap-southeast-3", "ap-southeast-4", "ap-south-1", "ap-northeast-3", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-south-1", "eu-west-3", "eu-south-2", "eu-north-1", "eu-central-2", "me-south-1", "me-central-1", "sa-east-1"];
|
|
8
|
+
type Region = (typeof regions)[number];
|
|
9
|
+
|
|
10
|
+
type Credentials = AwsCredentialIdentityProvider;
|
|
11
|
+
|
|
12
|
+
type CommandContext = {
|
|
13
|
+
region: Region;
|
|
14
|
+
credentials: Credentials;
|
|
15
|
+
accountId: string;
|
|
16
|
+
update: (msg: string) => void;
|
|
17
|
+
};
|
|
18
|
+
type CommandHandler = (options: CommandOptions, context: CommandContext) => Promise<string | undefined | void>;
|
|
19
|
+
declare class CommandOptions {
|
|
20
|
+
private opts;
|
|
21
|
+
constructor(args: string[]);
|
|
22
|
+
get(name: string): any;
|
|
23
|
+
private getAssertType;
|
|
24
|
+
number(name: string): any;
|
|
25
|
+
string(name: string): any;
|
|
26
|
+
boolean(name: string): any;
|
|
27
|
+
}
|
|
28
|
+
|
|
6
29
|
type CronProps<H extends Handler<S>, S extends BaseSchema> = {
|
|
7
30
|
handle: H;
|
|
8
31
|
schema?: S;
|
|
@@ -118,4 +141,4 @@ declare const Topic: TopicResources;
|
|
|
118
141
|
declare const APP: "app";
|
|
119
142
|
declare const STACK: "stack";
|
|
120
143
|
|
|
121
|
-
export { APP, Cache, CacheResources, Config, ConfigResources, CronProps, Fn, Function, FunctionMock, FunctionMockResponse, FunctionProps, FunctionResources, Queue, QueueMock, QueueMockResponse, QueueProps, QueueResources, STACK, Search, SearchResources, Store, StoreResources, Table, TableResources, Task, TaskMock, TaskMockResponse, TaskResources, Topic, TopicMock, TopicMockResponse, TopicProps, TopicResources, cron, func, getCacheProps, getConfigName, getFunctionName, getQueueName, getSearchName, getStoreName, getTableName, getTaskName, getTopicName, mockFunction, mockQueue, mockTask, mockTopic, queue, topic };
|
|
144
|
+
export { APP, Cache, CacheResources, CommandContext, CommandHandler, CommandOptions, Config, ConfigResources, CronProps, Fn, Function, FunctionMock, FunctionMockResponse, FunctionProps, FunctionResources, Queue, QueueMock, QueueMockResponse, QueueProps, QueueResources, STACK, Search, SearchResources, Store, StoreResources, Table, TableResources, Task, TaskMock, TaskMockResponse, TaskResources, Topic, TopicMock, TopicMockResponse, TopicProps, TopicResources, cron, func, getCacheProps, getConfigName, getFunctionName, getQueueName, getSearchName, getStoreName, getTableName, getTaskName, getTopicName, mockFunction, mockQueue, mockTask, mockTopic, queue, topic };
|
package/dist/server.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createProxy
|
|
3
3
|
} from "./chunk-2LRBH7VV.js";
|
|
4
|
+
import {
|
|
5
|
+
CommandOptions
|
|
6
|
+
} from "./chunk-DVWXAVM2.js";
|
|
4
7
|
|
|
5
8
|
// src/lib/handle/cron.ts
|
|
6
9
|
import { lambda } from "@awsless/lambda";
|
|
@@ -417,6 +420,7 @@ var Table = /* @__PURE__ */ createProxy((stack) => {
|
|
|
417
420
|
export {
|
|
418
421
|
APP,
|
|
419
422
|
Cache,
|
|
423
|
+
CommandOptions,
|
|
420
424
|
Config,
|
|
421
425
|
Fn,
|
|
422
426
|
Function,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.290",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"@awsless/lambda": "^0.0.19",
|
|
32
32
|
"@awsless/open-search": "^0.0.12",
|
|
33
33
|
"@awsless/redis": "^0.0.12",
|
|
34
|
+
"@awsless/s3": "^0.0.15",
|
|
34
35
|
"@awsless/sns": "^0.0.7",
|
|
36
|
+
"@awsless/sqs": "^0.0.7",
|
|
35
37
|
"@awsless/validate": "^0.0.14",
|
|
36
38
|
"@awsless/ssm": "^0.0.7",
|
|
37
|
-
"@awsless/s3": "^0.0.15",
|
|
38
|
-
"@awsless/sqs": "^0.0.7",
|
|
39
39
|
"@awsless/weak-cache": "^0.0.1"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
@@ -105,11 +105,11 @@
|
|
|
105
105
|
"zip-a-folder": "^3.1.6",
|
|
106
106
|
"zod": "^3.21.4",
|
|
107
107
|
"zod-to-json-schema": "^3.22.3",
|
|
108
|
+
"@awsless/duration": "^0.0.1",
|
|
108
109
|
"@awsless/formation": "^0.0.38",
|
|
109
110
|
"@awsless/size": "^0.0.1",
|
|
110
111
|
"@awsless/graphql": "^0.0.9",
|
|
111
112
|
"@awsless/validate": "^0.0.14",
|
|
112
|
-
"@awsless/duration": "^0.0.1",
|
|
113
113
|
"@awsless/code": "^0.0.10"
|
|
114
114
|
},
|
|
115
115
|
"scripts": {
|