@superdurable/connector-amazon-lambda 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +4 -2
- package/dex-connector.json +221 -0
- package/dist/chunk-HI4S6PQZ.js +234 -0
- package/dist/connection-Cqa6vZYT.d.ts +142 -0
- package/dist/index.d.ts +258 -0
- package/dist/index.js +539 -0
- package/dist/mock.d.ts +90 -0
- package/dist/mock.js +209 -0
- package/package.json +59 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { D as DeleteFunctionInput, F as FunctionWriteResult, C as Connection, G as GetFunctionInput, a as FunctionDetails, L as ListFunctionsInput, b as FunctionPage, U as UpdateFunctionDescriptionInput, O as Operations, c as Config, d as Credentials } from './connection-Cqa6vZYT.js';
|
|
2
|
+
export { e as ConfigSchema, f as CredentialMaterialError, g as CredentialSource, h as DeleteFunctionInputSchema, i as FunctionDetailsSchema, j as FunctionPageSchema, k as FunctionWriteResultSchema, l as GetFunctionInputSchema, m as ListFunctionsInputSchema, n as UpdateFunctionDescriptionInputSchema, o as decodeCredentials, p as isCredentialMaterialError, q as newConnection, r as newConnectionWithOperations } from './connection-Cqa6vZYT.js';
|
|
3
|
+
import { MutationDefinition, QueryDefinition, MutationStepConfig, Mutation, MutationResult, QueryStepConfig, Query, QueryResult, MutationStep, QueryStep, CredentialProvider, Call, QueryAttempt, MutationAttempt } from '@superdurable/connectors-sdk';
|
|
4
|
+
import { StepTarget } from '@superdurable/dex';
|
|
5
|
+
import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
|
|
6
|
+
import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
|
|
7
|
+
import 'zod';
|
|
8
|
+
|
|
9
|
+
/** Stable connector identity. */
|
|
10
|
+
declare const ConnectorID = "amazon-lambda";
|
|
11
|
+
/** Provider identity for named connections. */
|
|
12
|
+
declare const ProviderID = "amazon-lambda";
|
|
13
|
+
/** Branch IDs for getFunction. */
|
|
14
|
+
declare const GetFunctionBranch: {
|
|
15
|
+
readonly Found: "found";
|
|
16
|
+
readonly Missing: "missing";
|
|
17
|
+
readonly ProviderRejected: "providerRejected";
|
|
18
|
+
readonly InvalidResponse: "invalidResponse";
|
|
19
|
+
readonly Defect: "defect";
|
|
20
|
+
};
|
|
21
|
+
/** AWS returned the function configuration. */
|
|
22
|
+
declare const GetFunctionBranchFound: "found";
|
|
23
|
+
/** The function does not exist in the selected Region. */
|
|
24
|
+
declare const GetFunctionBranchMissing: "missing";
|
|
25
|
+
/** AWS conclusively rejected the request or credentials. */
|
|
26
|
+
declare const GetFunctionBranchProviderRejected: "providerRejected";
|
|
27
|
+
/** AWS returned malformed or oversized function metadata. */
|
|
28
|
+
declare const GetFunctionBranchInvalidResponse: "invalidResponse";
|
|
29
|
+
/** The function name, endpoint, Region, or credentials are invalid. */
|
|
30
|
+
declare const GetFunctionBranchDefect: "defect";
|
|
31
|
+
/** Manifest definition for getFunction. */
|
|
32
|
+
declare const GetFunctionDefinition: QueryDefinition;
|
|
33
|
+
/** Manifest metadata for getFunction. */
|
|
34
|
+
declare const GetFunctionMetadata: {
|
|
35
|
+
readonly kind: "query";
|
|
36
|
+
readonly idempotency: "none";
|
|
37
|
+
readonly authorization: "required";
|
|
38
|
+
};
|
|
39
|
+
/** Branch IDs for listFunctions. */
|
|
40
|
+
declare const ListFunctionsBranch: {
|
|
41
|
+
readonly Listed: "listed";
|
|
42
|
+
readonly ProviderRejected: "providerRejected";
|
|
43
|
+
readonly InvalidResponse: "invalidResponse";
|
|
44
|
+
readonly Defect: "defect";
|
|
45
|
+
};
|
|
46
|
+
/** AWS returned a page of functions. */
|
|
47
|
+
declare const ListFunctionsBranchListed: "listed";
|
|
48
|
+
/** AWS conclusively rejected the request or credentials. */
|
|
49
|
+
declare const ListFunctionsBranchProviderRejected: "providerRejected";
|
|
50
|
+
/** AWS returned malformed or oversized function metadata. */
|
|
51
|
+
declare const ListFunctionsBranchInvalidResponse: "invalidResponse";
|
|
52
|
+
/** The page input or connection settings are invalid. */
|
|
53
|
+
declare const ListFunctionsBranchDefect: "defect";
|
|
54
|
+
/** Manifest definition for listFunctions. */
|
|
55
|
+
declare const ListFunctionsDefinition: QueryDefinition;
|
|
56
|
+
/** Manifest metadata for listFunctions. */
|
|
57
|
+
declare const ListFunctionsMetadata: {
|
|
58
|
+
readonly kind: "query";
|
|
59
|
+
readonly idempotency: "none";
|
|
60
|
+
readonly authorization: "required";
|
|
61
|
+
};
|
|
62
|
+
/** Branch IDs for updateFunctionDescription. */
|
|
63
|
+
declare const UpdateFunctionDescriptionBranch: {
|
|
64
|
+
readonly Updated: "updated";
|
|
65
|
+
readonly Missing: "missing";
|
|
66
|
+
readonly ProviderRejected: "providerRejected";
|
|
67
|
+
readonly InvalidResponse: "invalidResponse";
|
|
68
|
+
readonly Defect: "defect";
|
|
69
|
+
};
|
|
70
|
+
/** AWS accepted the description update. */
|
|
71
|
+
declare const UpdateFunctionDescriptionBranchUpdated: "updated";
|
|
72
|
+
/** The function does not exist. */
|
|
73
|
+
declare const UpdateFunctionDescriptionBranchMissing: "missing";
|
|
74
|
+
/** AWS conclusively rejected the update. */
|
|
75
|
+
declare const UpdateFunctionDescriptionBranchProviderRejected: "providerRejected";
|
|
76
|
+
/** AWS returned malformed or oversized metadata. */
|
|
77
|
+
declare const UpdateFunctionDescriptionBranchInvalidResponse: "invalidResponse";
|
|
78
|
+
/** The update input or connection settings are invalid. */
|
|
79
|
+
declare const UpdateFunctionDescriptionBranchDefect: "defect";
|
|
80
|
+
/** Manifest definition for updateFunctionDescription. */
|
|
81
|
+
declare const UpdateFunctionDescriptionDefinition: MutationDefinition;
|
|
82
|
+
/** Manifest metadata for updateFunctionDescription. */
|
|
83
|
+
declare const UpdateFunctionDescriptionMetadata: {
|
|
84
|
+
readonly kind: "mutation";
|
|
85
|
+
readonly idempotency: "required";
|
|
86
|
+
readonly authorization: "required";
|
|
87
|
+
};
|
|
88
|
+
/** Branch IDs for deleteFunction. */
|
|
89
|
+
declare const DeleteFunctionBranch: {
|
|
90
|
+
readonly Deleted: "deleted";
|
|
91
|
+
readonly ProviderRejected: "providerRejected";
|
|
92
|
+
readonly Defect: "defect";
|
|
93
|
+
};
|
|
94
|
+
/** The function is absent after deletion. */
|
|
95
|
+
declare const DeleteFunctionBranchDeleted: "deleted";
|
|
96
|
+
/** AWS conclusively rejected the deletion. */
|
|
97
|
+
declare const DeleteFunctionBranchProviderRejected: "providerRejected";
|
|
98
|
+
/** The function name or connection settings are invalid. */
|
|
99
|
+
declare const DeleteFunctionBranchDefect: "defect";
|
|
100
|
+
/** Manifest definition for deleteFunction. */
|
|
101
|
+
declare const DeleteFunctionDefinition: MutationDefinition;
|
|
102
|
+
/** Manifest metadata for deleteFunction. */
|
|
103
|
+
declare const DeleteFunctionMetadata: {
|
|
104
|
+
readonly kind: "mutation";
|
|
105
|
+
readonly idempotency: "required";
|
|
106
|
+
readonly authorization: "required";
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/** Configuration for the getFunction connector Step. */
|
|
110
|
+
interface GetFunctionStepConfig<StepInput, OperationInput = GetFunctionInput, OperationOutput = FunctionDetails> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
111
|
+
/** Named connection supplying this operation. */
|
|
112
|
+
connection: Connection<{
|
|
113
|
+
getFunction(): Query<OperationInput, OperationOutput>;
|
|
114
|
+
}>;
|
|
115
|
+
/** Name matching the bound connection. */
|
|
116
|
+
connectionName: string;
|
|
117
|
+
/** AWS returned the function configuration. */
|
|
118
|
+
found: StepTarget<QueryResult<OperationOutput>>;
|
|
119
|
+
/** The function does not exist in the selected Region. */
|
|
120
|
+
missing?: StepTarget<QueryResult<OperationOutput>>;
|
|
121
|
+
/** AWS conclusively rejected the request or credentials. */
|
|
122
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
123
|
+
/** AWS returned malformed or oversized function metadata. */
|
|
124
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
125
|
+
/** The function name, endpoint, Region, or credentials are invalid. */
|
|
126
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
127
|
+
}
|
|
128
|
+
/** Build the getFunction Step from a named connection. */
|
|
129
|
+
declare function newGetFunctionStep<StepInput, OperationInput = GetFunctionInput, OperationOutput = FunctionDetails>(configuration: GetFunctionStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
130
|
+
/** Configuration for the listFunctions connector Step. */
|
|
131
|
+
interface ListFunctionsStepConfig<StepInput, OperationInput = ListFunctionsInput, OperationOutput = FunctionPage> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
132
|
+
/** Named connection supplying this operation. */
|
|
133
|
+
connection: Connection<{
|
|
134
|
+
listFunctions(): Query<OperationInput, OperationOutput>;
|
|
135
|
+
}>;
|
|
136
|
+
/** Name matching the bound connection. */
|
|
137
|
+
connectionName: string;
|
|
138
|
+
/** AWS returned a page of functions. */
|
|
139
|
+
listed: StepTarget<QueryResult<OperationOutput>>;
|
|
140
|
+
/** AWS conclusively rejected the request or credentials. */
|
|
141
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
142
|
+
/** AWS returned malformed or oversized function metadata. */
|
|
143
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
144
|
+
/** The page input or connection settings are invalid. */
|
|
145
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
146
|
+
}
|
|
147
|
+
/** Build the listFunctions Step from a named connection. */
|
|
148
|
+
declare function newListFunctionsStep<StepInput, OperationInput = ListFunctionsInput, OperationOutput = FunctionPage>(configuration: ListFunctionsStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
149
|
+
/** Configuration for the updateFunctionDescription connector Step. */
|
|
150
|
+
interface UpdateFunctionDescriptionStepConfig<StepInput, OperationInput = UpdateFunctionDescriptionInput, OperationOutput = FunctionDetails> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
151
|
+
/** Named connection supplying this operation. */
|
|
152
|
+
connection: Connection<{
|
|
153
|
+
updateFunctionDescription(): Mutation<OperationInput, OperationOutput>;
|
|
154
|
+
}>;
|
|
155
|
+
/** Name matching the bound connection. */
|
|
156
|
+
connectionName: string;
|
|
157
|
+
/** AWS accepted the description update. */
|
|
158
|
+
updated: StepTarget<MutationResult<OperationOutput>>;
|
|
159
|
+
/** The function does not exist. */
|
|
160
|
+
missing?: StepTarget<MutationResult<OperationOutput>>;
|
|
161
|
+
/** AWS conclusively rejected the update. */
|
|
162
|
+
providerRejected?: StepTarget<MutationResult<OperationOutput>>;
|
|
163
|
+
/** AWS returned malformed or oversized metadata. */
|
|
164
|
+
invalidResponse?: StepTarget<MutationResult<OperationOutput>>;
|
|
165
|
+
/** The update input or connection settings are invalid. */
|
|
166
|
+
defect?: StepTarget<MutationResult<OperationOutput>>;
|
|
167
|
+
}
|
|
168
|
+
/** Build the updateFunctionDescription Step from a named connection. */
|
|
169
|
+
declare function newUpdateFunctionDescriptionStep<StepInput, OperationInput = UpdateFunctionDescriptionInput, OperationOutput = FunctionDetails>(configuration: UpdateFunctionDescriptionStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
|
|
170
|
+
/** Configuration for the deleteFunction connector Step. */
|
|
171
|
+
interface DeleteFunctionStepConfig<StepInput, OperationInput = DeleteFunctionInput, OperationOutput = FunctionWriteResult> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
172
|
+
/** Named connection supplying this operation. */
|
|
173
|
+
connection: Connection<{
|
|
174
|
+
deleteFunction(): Mutation<OperationInput, OperationOutput>;
|
|
175
|
+
}>;
|
|
176
|
+
/** Name matching the bound connection. */
|
|
177
|
+
connectionName: string;
|
|
178
|
+
/** The function is absent after deletion. */
|
|
179
|
+
deleted: StepTarget<MutationResult<OperationOutput>>;
|
|
180
|
+
/** AWS conclusively rejected the deletion. */
|
|
181
|
+
providerRejected?: StepTarget<MutationResult<OperationOutput>>;
|
|
182
|
+
/** The function name or connection settings are invalid. */
|
|
183
|
+
defect?: StepTarget<MutationResult<OperationOutput>>;
|
|
184
|
+
}
|
|
185
|
+
/** Build the deleteFunction Step from a named connection. */
|
|
186
|
+
declare function newDeleteFunctionStep<StepInput, OperationInput = DeleteFunctionInput, OperationOutput = FunctionWriteResult>(configuration: DeleteFunctionStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
|
|
187
|
+
|
|
188
|
+
/** Open one named Amazon Lambda connection from Dex project configuration. */
|
|
189
|
+
declare function newProjectConnection(project: LoadedProject, connectionName: string): Connection<Operations>;
|
|
190
|
+
|
|
191
|
+
declare const sendFunctionRequest: unique symbol;
|
|
192
|
+
/** Injectable transport and clock for tests and local applications. */
|
|
193
|
+
interface AmazonLambdaClientOptions {
|
|
194
|
+
/** Provider sender; omitted uses the SDK transport. */ send?: (request: ProviderRequest) => Promise<ProviderResponse>;
|
|
195
|
+
/** Signing clock; omitted uses the current time. */ now?: () => Date;
|
|
196
|
+
}
|
|
197
|
+
interface Exchange {
|
|
198
|
+
status: number;
|
|
199
|
+
body: Uint8Array;
|
|
200
|
+
retryAfterMs: number;
|
|
201
|
+
error?: 'credential' | 'request' | 'tooLarge';
|
|
202
|
+
}
|
|
203
|
+
/** Authenticated AWS Lambda client for signed GetFunction requests. */
|
|
204
|
+
declare class AmazonLambdaClient {
|
|
205
|
+
private readonly credentials;
|
|
206
|
+
private readonly endpoint;
|
|
207
|
+
private readonly region;
|
|
208
|
+
private readonly timeoutMs;
|
|
209
|
+
private readonly maxResponseBytes;
|
|
210
|
+
private readonly send;
|
|
211
|
+
private readonly now;
|
|
212
|
+
/** Validate the Region, endpoint, and limits without contacting AWS. */
|
|
213
|
+
constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: AmazonLambdaClientOptions);
|
|
214
|
+
/** Bind the listFunctions operation. */ listFunctions(): ListFunctionsOperation;
|
|
215
|
+
/** Bind the updateFunctionDescription operation. */ updateFunctionDescription(): UpdateFunctionDescriptionOperation;
|
|
216
|
+
/** Bind the deleteFunction operation. */ deleteFunction(): DeleteFunctionOperation;
|
|
217
|
+
/** Bind the getFunction Query. */ getFunction(): GetFunctionOperation;
|
|
218
|
+
/** Sign and send one bounded GetFunction request. */
|
|
219
|
+
readFunction(call: Call, name: string): Promise<Exchange>;
|
|
220
|
+
/** Sign and send a bounded Lambda API request using the credentials for this attempt. */
|
|
221
|
+
[sendFunctionRequest](call: Call, method: 'GET' | 'PUT' | 'DELETE', path: string, body?: Uint8Array): Promise<Exchange>;
|
|
222
|
+
}
|
|
223
|
+
/** Read the stable name and ARN of one Lambda function. */
|
|
224
|
+
declare class GetFunctionOperation implements Query<GetFunctionInput, FunctionDetails> {
|
|
225
|
+
private readonly client;
|
|
226
|
+
/** Bind the provider client. */ constructor(client: AmazonLambdaClient);
|
|
227
|
+
/** Return the generated Query contract. */ definition(): QueryDefinition;
|
|
228
|
+
/** Classify provider outcomes consistently with the Go implementation. */
|
|
229
|
+
invoke(call: Call, input: GetFunctionInput): Promise<QueryAttempt<FunctionDetails>>;
|
|
230
|
+
}
|
|
231
|
+
/** Read one bounded page of Lambda functions in the configured Region. */
|
|
232
|
+
declare class ListFunctionsOperation implements Query<ListFunctionsInput, FunctionPage> {
|
|
233
|
+
private readonly client;
|
|
234
|
+
/** Bind the signed provider client. */ constructor(client: AmazonLambdaClient);
|
|
235
|
+
/** Return the manifest Query definition. */ definition(): QueryDefinition;
|
|
236
|
+
/** Return function names, ARNs, and the next marker. */
|
|
237
|
+
invoke(call: Call, input: ListFunctionsInput): Promise<QueryAttempt<FunctionPage>>;
|
|
238
|
+
}
|
|
239
|
+
/** Replace the complete unpublished function description. */
|
|
240
|
+
declare class UpdateFunctionDescriptionOperation implements Mutation<UpdateFunctionDescriptionInput, FunctionDetails> {
|
|
241
|
+
private readonly client;
|
|
242
|
+
/** Bind the signed provider client. */ constructor(client: AmazonLambdaClient);
|
|
243
|
+
/** Return the generated Mutation definition. */ definition(): QueryDefinition;
|
|
244
|
+
/** Use the Dex Call ID for the idempotent mutation. */ idempotencyKey(callId: string): string;
|
|
245
|
+
/** Classify one signed provider write. */
|
|
246
|
+
invoke(call: Call, input: UpdateFunctionDescriptionInput): Promise<MutationAttempt<FunctionDetails>>;
|
|
247
|
+
}
|
|
248
|
+
/** Delete a named function and its versions and aliases. */
|
|
249
|
+
declare class DeleteFunctionOperation implements Mutation<DeleteFunctionInput, FunctionWriteResult> {
|
|
250
|
+
private readonly client;
|
|
251
|
+
/** Bind the signed provider client. */ constructor(client: AmazonLambdaClient);
|
|
252
|
+
/** Return the generated Mutation definition. */ definition(): QueryDefinition;
|
|
253
|
+
/** Use the Dex Call ID for the idempotent mutation. */ idempotencyKey(callId: string): string;
|
|
254
|
+
/** Classify one signed provider write. */
|
|
255
|
+
invoke(call: Call, input: DeleteFunctionInput): Promise<MutationAttempt<FunctionWriteResult>>;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export { AmazonLambdaClient, type AmazonLambdaClientOptions, Config, Connection, ConnectorID, Credentials, DeleteFunctionBranch, DeleteFunctionBranchDefect, DeleteFunctionBranchDeleted, DeleteFunctionBranchProviderRejected, DeleteFunctionDefinition, DeleteFunctionInput, DeleteFunctionMetadata, DeleteFunctionOperation, type DeleteFunctionStepConfig, FunctionDetails, FunctionPage, FunctionWriteResult, GetFunctionBranch, GetFunctionBranchDefect, GetFunctionBranchFound, GetFunctionBranchInvalidResponse, GetFunctionBranchMissing, GetFunctionBranchProviderRejected, GetFunctionDefinition, GetFunctionInput, GetFunctionMetadata, GetFunctionOperation, type GetFunctionStepConfig, ListFunctionsBranch, ListFunctionsBranchDefect, ListFunctionsBranchInvalidResponse, ListFunctionsBranchListed, ListFunctionsBranchProviderRejected, ListFunctionsDefinition, ListFunctionsInput, ListFunctionsMetadata, ListFunctionsOperation, type ListFunctionsStepConfig, ProviderID, UpdateFunctionDescriptionBranch, UpdateFunctionDescriptionBranchDefect, UpdateFunctionDescriptionBranchInvalidResponse, UpdateFunctionDescriptionBranchMissing, UpdateFunctionDescriptionBranchProviderRejected, UpdateFunctionDescriptionBranchUpdated, UpdateFunctionDescriptionDefinition, UpdateFunctionDescriptionInput, UpdateFunctionDescriptionMetadata, UpdateFunctionDescriptionOperation, type UpdateFunctionDescriptionStepConfig, newDeleteFunctionStep, newGetFunctionStep, newListFunctionsStep, newProjectConnection, newUpdateFunctionDescriptionStep };
|