@awsless/awsless 0.0.423 → 0.0.425

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 ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/bin.js CHANGED
@@ -10699,10 +10699,9 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
10699
10699
  const version = await generateFileHash(workspace, local2.file);
10700
10700
  return build3(version, async (write) => {
10701
10701
  const temp = await createTempFolder(`function--${name}`);
10702
- const external = [...props.build.external ?? [], ...props.layers.map((id2) => id2)];
10703
10702
  const bundle = await bundleTypeScript({
10704
10703
  file: local2.file,
10705
- external,
10704
+ external: [...props.build.external ?? [], ...props.layers ?? []],
10706
10705
  minify: props.build.minify,
10707
10706
  nativeDir: temp.path
10708
10707
  });
@@ -10755,7 +10754,7 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
10755
10754
  role: role.arn,
10756
10755
  code,
10757
10756
  runtime: props.runtime === "container" ? void 0 : props.runtime,
10758
- layers: props.layers.map((id2) => ctx.shared.get(`layer-${id2}-arn`)),
10757
+ layers: (props.layers ?? []).map((id2) => ctx.shared.get(`layer-${id2}-arn`)),
10759
10758
  // Remove conflicting props.
10760
10759
  vpc: void 0,
10761
10760
  log: props.log
@@ -13824,7 +13823,6 @@ var layerFeature = defineFeature({
13824
13823
  return;
13825
13824
  }
13826
13825
  for (const [id, props] of layers) {
13827
- console.log(id, props);
13828
13826
  const group = new Node26(ctx.base, "lambda-layer", id);
13829
13827
  const item = new aws26.s3.BucketObject(group, "code", {
13830
13828
  bucket: ctx.shared.get("layer-bucket-name"),
@@ -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, 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
@@ -0,0 +1,169 @@
1
+ import { AwsCredentialIdentityProvider } from '@aws-sdk/types';
2
+ import { Mock } 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
+ update: (msg: string) => void;
18
+ };
19
+ type CommandHandler = (options: CommandOptions, context: CommandContext) => Promise<string | undefined | void>;
20
+ declare class CommandOptions {
21
+ private opts;
22
+ constructor(args: string[]);
23
+ get(name: string): any;
24
+ private getAssertType;
25
+ number(name: string): number;
26
+ string(name: string): string;
27
+ boolean(name: string): boolean;
28
+ }
29
+
30
+ interface AlertMock {
31
+ }
32
+ interface AlertMockResponse {
33
+ }
34
+ declare const mockAlert: (cb: (mock: AlertMock) => void) => AlertMockResponse;
35
+
36
+ interface FunctionMock {
37
+ }
38
+ interface FunctionMockResponse {
39
+ }
40
+ declare const mockFunction: (cb: (mock: FunctionMock) => void) => FunctionMockResponse;
41
+
42
+ declare const mockPubSub: () => Mock;
43
+
44
+ interface QueueMock {
45
+ }
46
+ interface QueueMockResponse {
47
+ }
48
+ declare const mockQueue: (cb: (mock: QueueMock) => void) => QueueMockResponse;
49
+
50
+ interface TaskMock {
51
+ }
52
+ interface TaskMockResponse {
53
+ }
54
+ declare const mockTask: (cb: (mock: TaskMock) => void) => TaskMockResponse;
55
+
56
+ interface TopicMock {
57
+ }
58
+ interface TopicMockResponse {
59
+ }
60
+ declare const mockTopic: (cb: (mock: TopicMock) => void) => TopicMockResponse;
61
+
62
+ declare const getAlertName: <N extends string>(resourceName: N) => `app--alert--${N}`;
63
+ interface AlertResources {
64
+ }
65
+ declare const Alert: AlertResources;
66
+
67
+ declare const getAuthProps: (name: string) => {
68
+ readonly userPoolId: string | undefined;
69
+ readonly clientId: string | undefined;
70
+ };
71
+ interface AuthResources {
72
+ }
73
+ declare const Auth: AuthResources;
74
+
75
+ declare const getCacheProps: (name: string, stack?: string) => {
76
+ readonly host: string;
77
+ readonly port: number;
78
+ };
79
+ interface CacheResources {
80
+ }
81
+ declare const Cache: CacheResources;
82
+
83
+ declare const getConfigName: (name: string) => string;
84
+ declare const getConfigValue: (name: string) => string;
85
+ declare const setConfigValue: (name: string, value: string) => void;
86
+ interface ConfigResources {
87
+ }
88
+ declare const Config: ConfigResources;
89
+
90
+ declare const getFunctionName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--function--${N}`;
91
+ interface FunctionResources {
92
+ }
93
+ declare const Function: FunctionResources;
94
+ declare const Fn: FunctionResources;
95
+
96
+ declare const getPubSubTopic: <N extends string>(name: N) => `app/pubsub/${N}`;
97
+
98
+ type PublishOptions = {
99
+ qos?: QoS;
100
+ };
101
+ declare const PubSub: {
102
+ publish(topic: string, event: string, payload: unknown, opts?: PublishOptions): Promise<void>;
103
+ };
104
+ type PubsubAuthorizerResponse = {
105
+ authorized: boolean;
106
+ principalId?: string;
107
+ publish?: string[];
108
+ subscribe?: string[];
109
+ disconnectAfter?: Duration;
110
+ refreshAfter?: Duration;
111
+ };
112
+ type PubsubAuthorizerEvent = {
113
+ protocolData: {
114
+ mqtt?: {
115
+ password?: string;
116
+ };
117
+ };
118
+ };
119
+ declare const pubsubAuthorizerHandle: (cb: (token: string) => PubsubAuthorizerResponse | Promise<PubsubAuthorizerResponse>) => Promise<(event: PubsubAuthorizerEvent) => Promise<IoTCustomAuthorizerResult>>;
120
+ declare const pubsubAuthorizerResponse: (props: PubsubAuthorizerResponse) => IoTCustomAuthorizerResult;
121
+
122
+ declare const getQueueName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--queue--${N}`;
123
+ declare const getQueueUrl: (name: string, stack?: string) => string | undefined;
124
+ interface QueueResources {
125
+ }
126
+ declare const Queue: QueueResources;
127
+
128
+ type RpcAuthorizerResponse = {
129
+ authorized: false;
130
+ } | {
131
+ authorized: true;
132
+ context?: unknown;
133
+ ttl: DurationFormat;
134
+ };
135
+
136
+ declare const getSearchName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--search--${N}`;
137
+ declare const getSearchProps: (name: string, stack?: string) => {
138
+ readonly domain: string | undefined;
139
+ };
140
+ interface SearchResources {
141
+ }
142
+ declare const Search: SearchResources;
143
+
144
+ declare const getSiteBucketName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--site--${N}--${string}`;
145
+
146
+ declare const getStoreName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--store--${N}--${string}`;
147
+ interface StoreResources {
148
+ }
149
+ declare const Store: StoreResources;
150
+
151
+ declare const getTableName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--table--${N}`;
152
+ interface TableResources {
153
+ }
154
+ declare const Table: TableResources;
155
+
156
+ declare const getTaskName: <N extends string, S extends string = "stack">(resourceName: N, stackName?: S) => `app--${S}--task--${N}`;
157
+ interface TaskResources {
158
+ }
159
+ declare const Task: TaskResources;
160
+
161
+ declare const getTopicName: <N extends string>(resourceName: N) => `app--topic--${N}`;
162
+ interface TopicResources {
163
+ }
164
+ declare const Topic: TopicResources;
165
+
166
+ declare const APP: "app";
167
+ declare const STACK: "stack";
168
+
169
+ export { APP, Alert, type AlertMock, type AlertMockResponse, type AlertResources, Auth, type AuthResources, 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, 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, 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.423",
3
+ "version": "0.0.425",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -29,18 +29,18 @@
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@awsless/dynamodb": "^0.1.5",
32
- "@awsless/lambda": "^0.0.30",
33
- "@awsless/json": "^0.0.6",
34
32
  "@awsless/iot": "^0.0.3",
35
- "@awsless/s3": "^0.0.20",
36
- "@awsless/redis": "^0.0.13",
33
+ "@awsless/json": "^0.0.6",
34
+ "@awsless/lambda": "^0.0.30",
37
35
  "@awsless/open-search": "^0.0.17",
38
- "@awsless/validate": "^0.0.17",
36
+ "@awsless/redis": "^0.0.13",
39
37
  "@awsless/sns": "^0.0.10",
38
+ "@awsless/sqs": "^0.0.8",
39
+ "@awsless/validate": "^0.0.17",
40
40
  "@awsless/ssm": "^0.0.7",
41
+ "@awsless/mqtt": "^0.0.2",
41
42
  "@awsless/weak-cache": "^0.0.1",
42
- "@awsless/sqs": "^0.0.8",
43
- "@awsless/mqtt": "^0.0.2"
43
+ "@awsless/s3": "^0.0.20"
44
44
  },
45
45
  "dependencies": {
46
46
  "@arcanyx/cidr-slicer": "^0.3.0",
@@ -117,10 +117,10 @@
117
117
  "zod": "^3.21.4",
118
118
  "zod-to-json-schema": "^3.22.3",
119
119
  "@awsless/code": "^0.0.10",
120
- "@awsless/graphql": "^0.0.9",
121
120
  "@awsless/duration": "^0.0.1",
122
- "@awsless/json": "^0.0.6",
123
121
  "@awsless/formation": "^0.0.59",
122
+ "@awsless/graphql": "^0.0.9",
123
+ "@awsless/json": "^0.0.6",
124
124
  "@awsless/size": "^0.0.1",
125
125
  "@awsless/validate": "^0.0.17",
126
126
  "@awsless/ts-file-cache": "^0.0.10"