@awsless/awsless 0.0.505 → 0.0.507
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/client.d.ts +75 -0
- package/dist/prebuild/images/bundle.zip +0 -0
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/server.d.ts +162 -0
- package/package.json +13 -13
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as _awsless_mqtt from '@awsless/mqtt';
|
|
2
|
+
import { QoS } from '@awsless/mqtt';
|
|
3
|
+
|
|
4
|
+
interface AuthResources {
|
|
5
|
+
}
|
|
6
|
+
declare const Auth: AuthResources;
|
|
7
|
+
declare const getAuthProps: (name: string) => {
|
|
8
|
+
readonly userPoolId: string;
|
|
9
|
+
readonly clientId: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
interface GraphQLSchema {
|
|
13
|
+
}
|
|
14
|
+
interface GraphQLResources {
|
|
15
|
+
}
|
|
16
|
+
declare const GraphQL: GraphQLResources;
|
|
17
|
+
declare const getGraphQLProps: (name: string) => {
|
|
18
|
+
endpoint: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
interface HTTP {
|
|
22
|
+
}
|
|
23
|
+
type Method = 'GET' | 'POST';
|
|
24
|
+
type Path = string;
|
|
25
|
+
type Params = Record<string, string | number>;
|
|
26
|
+
type Query = Record<string, string>;
|
|
27
|
+
type Body = unknown;
|
|
28
|
+
type Route = {
|
|
29
|
+
param?: Params;
|
|
30
|
+
query?: Query;
|
|
31
|
+
body?: Body;
|
|
32
|
+
response: unknown;
|
|
33
|
+
};
|
|
34
|
+
type Routes = Record<Path, Route>;
|
|
35
|
+
type Schema = Partial<Record<Method, Routes>>;
|
|
36
|
+
type GetRoute<S extends Schema, M extends keyof S, P extends keyof S[M]> = S[M] extends Routes ? S[M][P] : never;
|
|
37
|
+
type Props<R extends Route> = {
|
|
38
|
+
headers?: Record<string, string>;
|
|
39
|
+
params?: R['param'] extends Params ? R['param'] : never;
|
|
40
|
+
query?: R['query'] extends Query ? R['query'] : never;
|
|
41
|
+
body?: R['body'] extends Body ? R['body'] : never;
|
|
42
|
+
};
|
|
43
|
+
type HttpFetcher = (props: {
|
|
44
|
+
method: Method;
|
|
45
|
+
path: Path;
|
|
46
|
+
headers: Headers;
|
|
47
|
+
query?: Query;
|
|
48
|
+
body?: Body;
|
|
49
|
+
}) => unknown;
|
|
50
|
+
declare const createHttpFetcher: (host: string) => HttpFetcher;
|
|
51
|
+
declare const createHttpClient: <S extends Schema>(fetcher: HttpFetcher) => {
|
|
52
|
+
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"]>;
|
|
53
|
+
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"]>;
|
|
54
|
+
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"]>;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
type MessageCallback = (payload: any) => void;
|
|
58
|
+
type ClientProps = {
|
|
59
|
+
endpoint: string;
|
|
60
|
+
authorizer: string;
|
|
61
|
+
token?: string;
|
|
62
|
+
};
|
|
63
|
+
type ClientPropsProvider = () => Promise<ClientProps> | ClientProps;
|
|
64
|
+
declare const createPubSubClient: (app: string | (() => string), props: ClientProps | ClientPropsProvider) => {
|
|
65
|
+
connected: boolean;
|
|
66
|
+
topics: string[];
|
|
67
|
+
publish(topic: string, event: string, payload: unknown, qos: QoS): Promise<void>;
|
|
68
|
+
subscribe(topic: string, event: string, callback: MessageCallback): Promise<_awsless_mqtt.Unsubscribe>;
|
|
69
|
+
destroy(): Promise<void>;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
interface RpcSchema {
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { Auth, type AuthResources, GraphQL, type GraphQLResources, type GraphQLSchema, type HTTP, type HttpFetcher, type RpcSchema, createHttpClient, createHttpFetcher, createPubSubClient, getAuthProps, getGraphQLProps };
|
|
Binary file
|
|
Binary file
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { AwsCredentialIdentityProvider } from '@aws-sdk/types';
|
|
2
|
+
import * as vitest from 'vitest';
|
|
3
|
+
import { Duration, DurationFormat } from '@awsless/duration';
|
|
4
|
+
import { QoS } from '@awsless/iot';
|
|
5
|
+
export { QoS } from '@awsless/iot';
|
|
6
|
+
import { IoTCustomAuthorizerResult } from 'aws-lambda';
|
|
7
|
+
|
|
8
|
+
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"];
|
|
9
|
+
type Region = (typeof regions)[number];
|
|
10
|
+
|
|
11
|
+
type Credentials = AwsCredentialIdentityProvider;
|
|
12
|
+
|
|
13
|
+
type CommandContext = {
|
|
14
|
+
region: Region;
|
|
15
|
+
credentials: Credentials;
|
|
16
|
+
accountId: string;
|
|
17
|
+
};
|
|
18
|
+
type CommandHandler = (context: CommandContext) => Promise<void>;
|
|
19
|
+
|
|
20
|
+
interface AlertMock {
|
|
21
|
+
}
|
|
22
|
+
interface AlertMockResponse {
|
|
23
|
+
}
|
|
24
|
+
declare const mockAlert: (cb: (mock: AlertMock) => void) => AlertMockResponse;
|
|
25
|
+
|
|
26
|
+
declare const mockCache: () => void;
|
|
27
|
+
|
|
28
|
+
interface FunctionMock {
|
|
29
|
+
}
|
|
30
|
+
interface FunctionMockResponse {
|
|
31
|
+
}
|
|
32
|
+
declare const mockFunction: (cb: (mock: FunctionMock) => void) => FunctionMockResponse;
|
|
33
|
+
|
|
34
|
+
declare const mockPubSub: () => vitest.Mock<any, any>;
|
|
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 getAlertName: <N extends string>(resourceName: N) => `app--alert--${N}`;
|
|
55
|
+
interface AlertResources {
|
|
56
|
+
}
|
|
57
|
+
declare const Alert: AlertResources;
|
|
58
|
+
|
|
59
|
+
declare const getAuthProps: (name: string) => {
|
|
60
|
+
readonly userPoolId: string | undefined;
|
|
61
|
+
readonly clientId: string | undefined;
|
|
62
|
+
};
|
|
63
|
+
interface AuthResources {
|
|
64
|
+
}
|
|
65
|
+
declare const Auth: AuthResources;
|
|
66
|
+
|
|
67
|
+
declare const getCacheProps: (name: string, stack?: string) => {
|
|
68
|
+
readonly host: string;
|
|
69
|
+
readonly port: number;
|
|
70
|
+
};
|
|
71
|
+
interface CacheResources {
|
|
72
|
+
}
|
|
73
|
+
declare const Cache: CacheResources;
|
|
74
|
+
|
|
75
|
+
declare const getConfigName: (name: string) => string;
|
|
76
|
+
declare const getConfigValue: (name: string) => string;
|
|
77
|
+
declare const setConfigValue: (name: string, value: string) => void;
|
|
78
|
+
interface ConfigResources {
|
|
79
|
+
}
|
|
80
|
+
declare const Config: ConfigResources;
|
|
81
|
+
|
|
82
|
+
declare const getFunctionName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--function--${N}`;
|
|
83
|
+
interface FunctionResources {
|
|
84
|
+
}
|
|
85
|
+
declare const Function: FunctionResources;
|
|
86
|
+
declare const Fn: FunctionResources;
|
|
87
|
+
|
|
88
|
+
declare const getPubSubTopic: <N extends string>(name: N) => `app/pubsub/${N}`;
|
|
89
|
+
|
|
90
|
+
type PublishOptions = {
|
|
91
|
+
qos?: QoS;
|
|
92
|
+
};
|
|
93
|
+
declare const PubSub: {
|
|
94
|
+
publish(topic: string, event: string, payload: unknown, opts?: PublishOptions): Promise<void>;
|
|
95
|
+
};
|
|
96
|
+
type PubsubAuthorizerResponse = {
|
|
97
|
+
authorized: boolean;
|
|
98
|
+
principalId?: string;
|
|
99
|
+
publish?: string[];
|
|
100
|
+
subscribe?: string[];
|
|
101
|
+
disconnectAfter?: Duration;
|
|
102
|
+
refreshAfter?: Duration;
|
|
103
|
+
};
|
|
104
|
+
type PubsubAuthorizerEvent = {
|
|
105
|
+
protocolData: {
|
|
106
|
+
mqtt?: {
|
|
107
|
+
password?: string;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
declare const pubsubAuthorizerHandle: (cb: (token: string) => PubsubAuthorizerResponse | Promise<PubsubAuthorizerResponse>) => Promise<(event: PubsubAuthorizerEvent) => Promise<IoTCustomAuthorizerResult>>;
|
|
112
|
+
declare const pubsubAuthorizerResponse: (props: PubsubAuthorizerResponse) => IoTCustomAuthorizerResult;
|
|
113
|
+
|
|
114
|
+
declare const getQueueName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--queue--${N}`;
|
|
115
|
+
declare const getQueueUrl: (name: string, stack?: string) => string | undefined;
|
|
116
|
+
interface QueueResources {
|
|
117
|
+
}
|
|
118
|
+
declare const Queue: QueueResources;
|
|
119
|
+
|
|
120
|
+
type RpcAuthorizerResponse = {
|
|
121
|
+
authorized: false;
|
|
122
|
+
} | {
|
|
123
|
+
authorized: true;
|
|
124
|
+
context?: unknown;
|
|
125
|
+
lockKey?: string;
|
|
126
|
+
ttl: DurationFormat;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
declare const getSearchName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--search--${N}`;
|
|
130
|
+
declare const getSearchProps: (name: string, stack?: string) => {
|
|
131
|
+
readonly domain: string | undefined;
|
|
132
|
+
};
|
|
133
|
+
interface SearchResources {
|
|
134
|
+
}
|
|
135
|
+
declare const Search: SearchResources;
|
|
136
|
+
|
|
137
|
+
declare const getSiteBucketName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--site--${N}--${string}`;
|
|
138
|
+
|
|
139
|
+
declare const getStoreName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--store--${N}--${string}`;
|
|
140
|
+
interface StoreResources {
|
|
141
|
+
}
|
|
142
|
+
declare const Store: StoreResources;
|
|
143
|
+
|
|
144
|
+
declare const getTableName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--table--${N}`;
|
|
145
|
+
interface TableResources {
|
|
146
|
+
}
|
|
147
|
+
declare const Table: TableResources;
|
|
148
|
+
|
|
149
|
+
declare const getTaskName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--task--${N}`;
|
|
150
|
+
interface TaskResources {
|
|
151
|
+
}
|
|
152
|
+
declare const Task: TaskResources;
|
|
153
|
+
|
|
154
|
+
declare const getTopicName: <N extends string>(resourceName: N) => `app--topic--${N}`;
|
|
155
|
+
interface TopicResources {
|
|
156
|
+
}
|
|
157
|
+
declare const Topic: TopicResources;
|
|
158
|
+
|
|
159
|
+
declare const APP: "app";
|
|
160
|
+
declare const STACK: "stack";
|
|
161
|
+
|
|
162
|
+
export { APP, Alert, type AlertMock, type AlertMockResponse, type AlertResources, Auth, type AuthResources, Cache, type CacheResources, type CommandContext, type CommandHandler, Config, type ConfigResources, Fn, Function, type FunctionMock, type FunctionMockResponse, type FunctionResources, PubSub, type PublishOptions, Queue, type QueueMock, type QueueMockResponse, type QueueResources, type RpcAuthorizerResponse, STACK, Search, type SearchResources, Store, type StoreResources, Table, type TableResources, Task, type TaskMock, type TaskMockResponse, type TaskResources, Topic, type TopicMock, type TopicMockResponse, type TopicResources, getAlertName, getAuthProps, getCacheProps, getConfigName, getConfigValue, getFunctionName, getPubSubTopic, getQueueName, getQueueUrl, getSearchName, getSearchProps, getSiteBucketName, getStoreName, getTableName, getTaskName, getTopicName, mockAlert, mockCache, mockFunction, mockPubSub, mockQueue, mockTask, mockTopic, pubsubAuthorizerHandle, pubsubAuthorizerResponse, setConfigValue };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.507",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,18 +35,18 @@
|
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@awsless/big-float": "^0.0.6",
|
|
37
37
|
"@awsless/json": "^0.0.10",
|
|
38
|
-
"@awsless/
|
|
39
|
-
"@awsless/mqtt": "^0.0.2",
|
|
40
|
-
"@awsless/s3": "^0.0.21",
|
|
41
|
-
"@awsless/redis": "^0.0.14",
|
|
38
|
+
"@awsless/lambda": "^0.0.33",
|
|
42
39
|
"@awsless/dynamodb": "^0.1.5",
|
|
43
|
-
"@awsless/
|
|
44
|
-
"@awsless/
|
|
40
|
+
"@awsless/s3": "^0.0.21",
|
|
41
|
+
"@awsless/mqtt": "^0.0.2",
|
|
42
|
+
"@awsless/iot": "^0.0.3",
|
|
43
|
+
"@awsless/clui": "^0.0.6",
|
|
45
44
|
"@awsless/validate": "^0.0.19",
|
|
45
|
+
"@awsless/redis": "^0.0.14",
|
|
46
46
|
"@awsless/weak-cache": "^0.0.1",
|
|
47
|
-
"@awsless/
|
|
48
|
-
"@awsless/iot": "^0.0.3",
|
|
47
|
+
"@awsless/open-search": "^0.0.17",
|
|
49
48
|
"@awsless/sns": "^0.0.10",
|
|
49
|
+
"@awsless/ssm": "^0.0.7",
|
|
50
50
|
"@awsless/sqs": "^0.0.8"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
@@ -132,12 +132,12 @@
|
|
|
132
132
|
"@awsless/duration": "^0.0.3",
|
|
133
133
|
"@awsless/code": "^0.0.10",
|
|
134
134
|
"@awsless/formation": "^0.0.77",
|
|
135
|
-
"@awsless/json": "^0.0.10",
|
|
136
|
-
"@awsless/size": "^0.0.2",
|
|
137
135
|
"@awsless/graphql": "^0.0.9",
|
|
136
|
+
"@awsless/json": "^0.0.10",
|
|
138
137
|
"@awsless/validate": "^0.0.19",
|
|
139
|
-
"@awsless/
|
|
140
|
-
"@awsless/
|
|
138
|
+
"@awsless/clui": "^0.0.6",
|
|
139
|
+
"@awsless/size": "^0.0.2",
|
|
140
|
+
"@awsless/ts-file-cache": "^0.0.12"
|
|
141
141
|
},
|
|
142
142
|
"devDependencies": {
|
|
143
143
|
"@node-rs/bcrypt": "^1.10.5",
|