@awsless/awsless 0.0.329 → 0.0.330
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.d.ts +1 -0
- package/dist/bin.js +1 -2
- package/dist/build-json-schema.js +2 -2
- package/dist/client.d.ts +54 -0
- package/dist/server.d.ts +121 -0
- package/dist/server.js +1 -2
- package/package.json +10 -10
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/bin.js
CHANGED
|
@@ -3399,8 +3399,7 @@ var httpFeature = defineFeature({
|
|
|
3399
3399
|
const api = {};
|
|
3400
3400
|
for (const stack of ctx.stackConfigs) {
|
|
3401
3401
|
for (const [id, routes] of Object.entries(stack.http ?? {})) {
|
|
3402
|
-
if (!(id in api))
|
|
3403
|
-
api[id] = {};
|
|
3402
|
+
if (!(id in api)) api[id] = {};
|
|
3404
3403
|
for (const [route, props] of Object.entries(routes)) {
|
|
3405
3404
|
const { path, method } = parseRoute(route);
|
|
3406
3405
|
const file = typeof props === "string" ? props : props.file;
|
|
@@ -1157,8 +1157,8 @@ var AppSchema = z32.object({
|
|
|
1157
1157
|
});
|
|
1158
1158
|
|
|
1159
1159
|
// cli/build-json-schema.ts
|
|
1160
|
-
import { writeFileSync } from "fs";
|
|
1161
|
-
import { join as join3 } from "path";
|
|
1160
|
+
import { writeFileSync } from "node:fs";
|
|
1161
|
+
import { join as join3 } from "node:path";
|
|
1162
1162
|
var generateJsonSchema = (props) => {
|
|
1163
1163
|
const file = join3(process.cwd(), `dist/${props.name}.json`);
|
|
1164
1164
|
const schema = zodToJsonSchema(props.schema, {
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
interface AuthResources {
|
|
2
|
+
}
|
|
3
|
+
declare const Auth: AuthResources;
|
|
4
|
+
declare const getAuthProps: (name: string) => {
|
|
5
|
+
readonly userPoolId: string;
|
|
6
|
+
readonly clientId: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
interface GraphQLSchema {
|
|
10
|
+
}
|
|
11
|
+
interface GraphQLResources {
|
|
12
|
+
}
|
|
13
|
+
declare const GraphQL: GraphQLResources;
|
|
14
|
+
declare const getGraphQLProps: (name: string) => {
|
|
15
|
+
endpoint: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
interface HTTP {
|
|
19
|
+
}
|
|
20
|
+
type Method = 'GET' | 'POST';
|
|
21
|
+
type Path = string;
|
|
22
|
+
type Params = Record<string, string | number>;
|
|
23
|
+
type Query = Record<string, string>;
|
|
24
|
+
type Body = unknown;
|
|
25
|
+
type Route = {
|
|
26
|
+
param?: Params;
|
|
27
|
+
query?: Query;
|
|
28
|
+
body?: Body;
|
|
29
|
+
response: unknown;
|
|
30
|
+
};
|
|
31
|
+
type Routes = Record<Path, Route>;
|
|
32
|
+
type Schema = Partial<Record<Method, Routes>>;
|
|
33
|
+
type GetRoute<S extends Schema, M extends keyof S, P extends keyof S[M]> = S[M] extends Routes ? S[M][P] : never;
|
|
34
|
+
type Props<R extends Route> = {
|
|
35
|
+
headers?: Record<string, string>;
|
|
36
|
+
params?: R['param'] extends Params ? R['param'] : never;
|
|
37
|
+
query?: R['query'] extends Query ? R['query'] : never;
|
|
38
|
+
body?: R['body'] extends Body ? R['body'] : never;
|
|
39
|
+
};
|
|
40
|
+
type HttpFetcher = (props: {
|
|
41
|
+
method: Method;
|
|
42
|
+
path: Path;
|
|
43
|
+
headers: Headers;
|
|
44
|
+
query?: Query;
|
|
45
|
+
body?: Body;
|
|
46
|
+
}) => unknown;
|
|
47
|
+
declare const createHttpFetcher: (host: string) => HttpFetcher;
|
|
48
|
+
declare const createHttpClient: <S extends Schema>(fetcher: HttpFetcher) => {
|
|
49
|
+
fetch: <M extends keyof S, P extends keyof S[M]>(method: M, routeKey: Extract<P, string>, props?: Props<GetRoute<S, M, P>>) => Promise<GetRoute<S, M, P>["response"]>;
|
|
50
|
+
get<P_1 extends keyof S["GET"]>(routeKey: Extract<P_1, string>, props?: Props<GetRoute<S, "GET", P_1>>): Promise<GetRoute<S, "GET", P_1>["response"]>;
|
|
51
|
+
post<P_1 extends keyof S["POST"]>(routeKey: Extract<P_1, string>, props?: Props<GetRoute<S, "POST", P_1>>): Promise<GetRoute<S, "POST", P_1>["response"]>;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { Auth, type AuthResources, GraphQL, type GraphQLResources, type GraphQLSchema, type HTTP, type HttpFetcher, createHttpClient, createHttpFetcher, getAuthProps, getGraphQLProps };
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { AwsCredentialIdentityProvider } from '@aws-sdk/types';
|
|
2
|
+
import { Mock } from 'vitest';
|
|
3
|
+
import { QoS } from '@awsless/iot';
|
|
4
|
+
export { QoS } from '@awsless/iot';
|
|
5
|
+
|
|
6
|
+
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"];
|
|
7
|
+
type Region = (typeof regions)[number];
|
|
8
|
+
|
|
9
|
+
type Credentials = AwsCredentialIdentityProvider;
|
|
10
|
+
|
|
11
|
+
type CommandContext = {
|
|
12
|
+
region: Region;
|
|
13
|
+
credentials: Credentials;
|
|
14
|
+
accountId: string;
|
|
15
|
+
update: (msg: string) => void;
|
|
16
|
+
};
|
|
17
|
+
type CommandHandler = (options: CommandOptions, context: CommandContext) => Promise<string | undefined | void>;
|
|
18
|
+
declare class CommandOptions {
|
|
19
|
+
private opts;
|
|
20
|
+
constructor(args: string[]);
|
|
21
|
+
get(name: string): any;
|
|
22
|
+
private getAssertType;
|
|
23
|
+
number(name: string): number;
|
|
24
|
+
string(name: string): string;
|
|
25
|
+
boolean(name: string): boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface FunctionMock {
|
|
29
|
+
}
|
|
30
|
+
interface FunctionMockResponse {
|
|
31
|
+
}
|
|
32
|
+
declare const mockFunction: (cb: (mock: FunctionMock) => void) => FunctionMockResponse;
|
|
33
|
+
|
|
34
|
+
declare const mockPubSub: () => Mock;
|
|
35
|
+
|
|
36
|
+
interface QueueMock {
|
|
37
|
+
}
|
|
38
|
+
interface QueueMockResponse {
|
|
39
|
+
}
|
|
40
|
+
declare const mockQueue: (cb: (mock: QueueMock) => void) => QueueMockResponse;
|
|
41
|
+
|
|
42
|
+
interface TaskMock {
|
|
43
|
+
}
|
|
44
|
+
interface TaskMockResponse {
|
|
45
|
+
}
|
|
46
|
+
declare const mockTask: (cb: (mock: TaskMock) => void) => TaskMockResponse;
|
|
47
|
+
|
|
48
|
+
interface TopicMock {
|
|
49
|
+
}
|
|
50
|
+
interface TopicMockResponse {
|
|
51
|
+
}
|
|
52
|
+
declare const mockTopic: (cb: (mock: TopicMock) => void) => TopicMockResponse;
|
|
53
|
+
|
|
54
|
+
declare const getCacheProps: (name: string, stack?: string) => {
|
|
55
|
+
readonly host: string;
|
|
56
|
+
readonly port: number;
|
|
57
|
+
};
|
|
58
|
+
interface CacheResources {
|
|
59
|
+
}
|
|
60
|
+
declare const Cache: CacheResources;
|
|
61
|
+
|
|
62
|
+
declare const getConfigName: (name: string) => string;
|
|
63
|
+
interface ConfigResources {
|
|
64
|
+
}
|
|
65
|
+
declare const Config: ConfigResources;
|
|
66
|
+
|
|
67
|
+
declare const getFunctionName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--function--${N}`;
|
|
68
|
+
interface FunctionResources {
|
|
69
|
+
}
|
|
70
|
+
declare const Function: FunctionResources;
|
|
71
|
+
declare const Fn: FunctionResources;
|
|
72
|
+
|
|
73
|
+
declare const getPubSubTopic: <N extends string>(name: N) => `app/pubsub/${N}`;
|
|
74
|
+
|
|
75
|
+
type PublishOptions = {
|
|
76
|
+
qos?: QoS;
|
|
77
|
+
};
|
|
78
|
+
declare const PubSub: {
|
|
79
|
+
publish(topic: string, event: string, payload: unknown, opts?: PublishOptions): Promise<void>;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
declare const getQueueName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--queue--${N}`;
|
|
83
|
+
declare const getQueueUrl: (name: string, stack?: string) => string | undefined;
|
|
84
|
+
interface QueueResources {
|
|
85
|
+
}
|
|
86
|
+
declare const Queue: QueueResources;
|
|
87
|
+
|
|
88
|
+
declare const getSearchName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--search--${N}`;
|
|
89
|
+
declare const getSearchProps: (name: string, stack?: string) => {
|
|
90
|
+
readonly domain: string | undefined;
|
|
91
|
+
};
|
|
92
|
+
interface SearchResources {
|
|
93
|
+
}
|
|
94
|
+
declare const Search: SearchResources;
|
|
95
|
+
|
|
96
|
+
declare const getSiteBucketName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--site--${N}--${string}`;
|
|
97
|
+
|
|
98
|
+
declare const getStoreName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--store--${N}--${string}`;
|
|
99
|
+
interface StoreResources {
|
|
100
|
+
}
|
|
101
|
+
declare const Store: StoreResources;
|
|
102
|
+
|
|
103
|
+
declare const getTableName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--table--${N}`;
|
|
104
|
+
interface TableResources {
|
|
105
|
+
}
|
|
106
|
+
declare const Table: TableResources;
|
|
107
|
+
|
|
108
|
+
declare const getTaskName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--task--${N}`;
|
|
109
|
+
interface TaskResources {
|
|
110
|
+
}
|
|
111
|
+
declare const Task: TaskResources;
|
|
112
|
+
|
|
113
|
+
declare const getTopicName: <N extends string>(resourceName: N) => `app--topic--${N}`;
|
|
114
|
+
interface TopicResources {
|
|
115
|
+
}
|
|
116
|
+
declare const Topic: TopicResources;
|
|
117
|
+
|
|
118
|
+
declare const APP: "app";
|
|
119
|
+
declare const STACK: "stack";
|
|
120
|
+
|
|
121
|
+
export { APP, Cache, type CacheResources, type CommandContext, type CommandHandler, CommandOptions, Config, type ConfigResources, Fn, Function, type FunctionMock, type FunctionMockResponse, type FunctionResources, PubSub, type PublishOptions, Queue, type QueueMock, type QueueMockResponse, type QueueResources, STACK, Search, type SearchResources, Store, type StoreResources, Table, type TableResources, Task, type TaskMock, type TaskMockResponse, type TaskResources, Topic, type TopicMock, type TopicMockResponse, type TopicResources, getCacheProps, getConfigName, getFunctionName, getPubSubTopic, getQueueName, getQueueUrl, getSearchName, getSearchProps, getSiteBucketName, getStoreName, getTableName, getTaskName, getTopicName, mockFunction, mockPubSub, mockQueue, mockTask, mockTopic };
|
package/dist/server.js
CHANGED
|
@@ -358,8 +358,7 @@ var Search = /* @__PURE__ */ createProxy((stack) => {
|
|
|
358
358
|
domain,
|
|
359
359
|
defineTable(tableName, schema) {
|
|
360
360
|
return define(tableName, schema, () => {
|
|
361
|
-
if (!client)
|
|
362
|
-
client = searchClient({ node: domain }, "es");
|
|
361
|
+
if (!client) client = searchClient({ node: domain }, "es");
|
|
363
362
|
return client;
|
|
364
363
|
});
|
|
365
364
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.330",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@awsless/lambda": "^0.0.26",
|
|
32
|
-
"@awsless/
|
|
33
|
-
"@awsless/redis": "^0.0.12",
|
|
32
|
+
"@awsless/open-search": "^0.0.15",
|
|
34
33
|
"@awsless/sns": "^0.0.7",
|
|
35
|
-
"@awsless/
|
|
36
|
-
"@awsless/iot": "^0.0.2",
|
|
34
|
+
"@awsless/s3": "^0.0.18",
|
|
37
35
|
"@awsless/sqs": "^0.0.7",
|
|
38
36
|
"@awsless/ssm": "^0.0.7",
|
|
39
|
-
"@awsless/
|
|
40
|
-
"@awsless/
|
|
37
|
+
"@awsless/iot": "^0.0.2",
|
|
38
|
+
"@awsless/redis": "^0.0.12",
|
|
39
|
+
"@awsless/validate": "^0.0.14",
|
|
40
|
+
"@awsless/weak-cache": "^0.0.1"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@arcanyx/cidr-slicer": "^0.3.0",
|
|
@@ -108,11 +108,11 @@
|
|
|
108
108
|
"zod-to-json-schema": "^3.22.3",
|
|
109
109
|
"@awsless/code": "^0.0.10",
|
|
110
110
|
"@awsless/duration": "^0.0.1",
|
|
111
|
+
"@awsless/formation": "^0.0.48",
|
|
111
112
|
"@awsless/graphql": "^0.0.9",
|
|
112
113
|
"@awsless/size": "^0.0.1",
|
|
113
|
-
"@awsless/
|
|
114
|
-
"@awsless/ts-file-cache": "^0.0.1"
|
|
115
|
-
"@awsless/validate": "^0.0.14"
|
|
114
|
+
"@awsless/validate": "^0.0.14",
|
|
115
|
+
"@awsless/ts-file-cache": "^0.0.1"
|
|
116
116
|
},
|
|
117
117
|
"scripts": {
|
|
118
118
|
"test": "pnpm code test",
|