@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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Super Durable
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated keyation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Amazon Lambda TypeScript connector
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `getFunction` Query reads a Lambda function name and ARN. Configure AWS Region and signing credentials as described in the [connector README](../README.md). The [runnable Flow](examples/function-lookup/README.md) exercises a real Dex Worker and local provider fixture. Live AWS access has not been verified.
|
|
4
|
+
|
|
5
|
+
The [function management examples](examples/function-lookup/) list a page, update an absolute description, and delete an explicitly named function in separate Flows. Custom operation bindings must now supply all four operations. The provider client and generated mock include all four.
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
{
|
|
2
|
+
"connectorId": "amazon-lambda",
|
|
3
|
+
"releaseTag": "connectors/amazon/lambda/go/v0.2.0",
|
|
4
|
+
"package": {
|
|
5
|
+
"ecosystem": "npm",
|
|
6
|
+
"name": "@superdurable/connector-amazon-lambda",
|
|
7
|
+
"version": "0.2.0"
|
|
8
|
+
},
|
|
9
|
+
"factories": [
|
|
10
|
+
{
|
|
11
|
+
"name": "newGetFunctionStep",
|
|
12
|
+
"kind": "query",
|
|
13
|
+
"operationId": "getFunction",
|
|
14
|
+
"inputType": "GetFunctionInput",
|
|
15
|
+
"description": "Read the function name and ARN from AWS Lambda GetFunction.",
|
|
16
|
+
"fields": {
|
|
17
|
+
"stepType": "stepType",
|
|
18
|
+
"annotations": "annotations",
|
|
19
|
+
"connectionName": "connectionName",
|
|
20
|
+
"resultAttribute": "resultAttribute"
|
|
21
|
+
},
|
|
22
|
+
"branches": [
|
|
23
|
+
{
|
|
24
|
+
"id": "found",
|
|
25
|
+
"field": "found",
|
|
26
|
+
"optional": false
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "missing",
|
|
30
|
+
"field": "missing",
|
|
31
|
+
"optional": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "providerRejected",
|
|
35
|
+
"field": "providerRejected",
|
|
36
|
+
"optional": true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "invalidResponse",
|
|
40
|
+
"field": "invalidResponse",
|
|
41
|
+
"optional": true
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": "defect",
|
|
45
|
+
"field": "defect",
|
|
46
|
+
"optional": true
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"inputSchema": {
|
|
50
|
+
"additionalProperties": false,
|
|
51
|
+
"description": "GetFunctionInput identifies one Lambda function in the configured Region.",
|
|
52
|
+
"properties": {
|
|
53
|
+
"functionName": {
|
|
54
|
+
"type": "string"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"required": [
|
|
58
|
+
"functionName"
|
|
59
|
+
],
|
|
60
|
+
"type": "object"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "newListFunctionsStep",
|
|
65
|
+
"kind": "query",
|
|
66
|
+
"operationId": "listFunctions",
|
|
67
|
+
"inputType": "ListFunctionsInput",
|
|
68
|
+
"description": "List one page of function names and ARNs in the configured Region.",
|
|
69
|
+
"fields": {
|
|
70
|
+
"stepType": "stepType",
|
|
71
|
+
"annotations": "annotations",
|
|
72
|
+
"connectionName": "connectionName",
|
|
73
|
+
"resultAttribute": "resultAttribute"
|
|
74
|
+
},
|
|
75
|
+
"branches": [
|
|
76
|
+
{
|
|
77
|
+
"id": "listed",
|
|
78
|
+
"field": "listed",
|
|
79
|
+
"optional": false
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"id": "providerRejected",
|
|
83
|
+
"field": "providerRejected",
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"id": "invalidResponse",
|
|
88
|
+
"field": "invalidResponse",
|
|
89
|
+
"optional": true
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"id": "defect",
|
|
93
|
+
"field": "defect",
|
|
94
|
+
"optional": true
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"inputSchema": {
|
|
98
|
+
"additionalProperties": false,
|
|
99
|
+
"description": "ListFunctionsInput selects a bounded page of functions in the configured Region.",
|
|
100
|
+
"properties": {
|
|
101
|
+
"marker": {
|
|
102
|
+
"description": "Marker resumes from a prior page's NextMarker; blank starts at the beginning.",
|
|
103
|
+
"type": "string"
|
|
104
|
+
},
|
|
105
|
+
"maxItems": {
|
|
106
|
+
"description": "MaxItems requests 1 to 50 functions; zero uses AWS's page size.",
|
|
107
|
+
"type": "integer"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"required": [
|
|
111
|
+
"marker",
|
|
112
|
+
"maxItems"
|
|
113
|
+
],
|
|
114
|
+
"type": "object"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"name": "newUpdateFunctionDescriptionStep",
|
|
119
|
+
"kind": "mutation",
|
|
120
|
+
"operationId": "updateFunctionDescription",
|
|
121
|
+
"inputType": "UpdateFunctionDescriptionInput",
|
|
122
|
+
"description": "Set a function's description to an absolute value.",
|
|
123
|
+
"fields": {
|
|
124
|
+
"stepType": "stepType",
|
|
125
|
+
"annotations": "annotations",
|
|
126
|
+
"connectionName": "connectionName",
|
|
127
|
+
"resultAttribute": "resultAttribute"
|
|
128
|
+
},
|
|
129
|
+
"branches": [
|
|
130
|
+
{
|
|
131
|
+
"id": "updated",
|
|
132
|
+
"field": "updated",
|
|
133
|
+
"optional": false
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"id": "missing",
|
|
137
|
+
"field": "missing",
|
|
138
|
+
"optional": true
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"id": "providerRejected",
|
|
142
|
+
"field": "providerRejected",
|
|
143
|
+
"optional": true
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"id": "invalidResponse",
|
|
147
|
+
"field": "invalidResponse",
|
|
148
|
+
"optional": true
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"id": "defect",
|
|
152
|
+
"field": "defect",
|
|
153
|
+
"optional": true
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
"inputSchema": {
|
|
157
|
+
"additionalProperties": false,
|
|
158
|
+
"description": "UpdateFunctionDescriptionInput sets the complete description of one function.",
|
|
159
|
+
"properties": {
|
|
160
|
+
"description": {
|
|
161
|
+
"description": "Description replaces the entire description; blank clears it.",
|
|
162
|
+
"type": "string"
|
|
163
|
+
},
|
|
164
|
+
"functionName": {
|
|
165
|
+
"description": "FunctionName identifies the unpublished function configuration.",
|
|
166
|
+
"type": "string"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
"required": [
|
|
170
|
+
"description",
|
|
171
|
+
"functionName"
|
|
172
|
+
],
|
|
173
|
+
"type": "object"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"name": "newDeleteFunctionStep",
|
|
178
|
+
"kind": "mutation",
|
|
179
|
+
"operationId": "deleteFunction",
|
|
180
|
+
"inputType": "DeleteFunctionInput",
|
|
181
|
+
"description": "Delete a function and all its versions and aliases by name.",
|
|
182
|
+
"fields": {
|
|
183
|
+
"stepType": "stepType",
|
|
184
|
+
"annotations": "annotations",
|
|
185
|
+
"connectionName": "connectionName",
|
|
186
|
+
"resultAttribute": "resultAttribute"
|
|
187
|
+
},
|
|
188
|
+
"branches": [
|
|
189
|
+
{
|
|
190
|
+
"id": "deleted",
|
|
191
|
+
"field": "deleted",
|
|
192
|
+
"optional": false
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"id": "providerRejected",
|
|
196
|
+
"field": "providerRejected",
|
|
197
|
+
"optional": true
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"id": "defect",
|
|
201
|
+
"field": "defect",
|
|
202
|
+
"optional": true
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
"inputSchema": {
|
|
206
|
+
"additionalProperties": false,
|
|
207
|
+
"description": "DeleteFunctionInput identifies a complete function to delete.",
|
|
208
|
+
"properties": {
|
|
209
|
+
"functionName": {
|
|
210
|
+
"description": "FunctionName identifies the complete function and all its versions and aliases.",
|
|
211
|
+
"type": "string"
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
"required": [
|
|
215
|
+
"functionName"
|
|
216
|
+
],
|
|
217
|
+
"type": "object"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
// src/generated/models.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { SecretString } from "@superdurable/connectors-sdk";
|
|
4
|
+
var ConfigSchema = z.object({
|
|
5
|
+
"region": z.string().optional(),
|
|
6
|
+
"endpoint": z.string().optional(),
|
|
7
|
+
"timeoutMs": z.number().int().optional(),
|
|
8
|
+
"maxResponseBytes": z.number().int().optional()
|
|
9
|
+
});
|
|
10
|
+
var CredentialMaterialError = class extends TypeError {
|
|
11
|
+
constructor(message) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.name = "CredentialMaterialError";
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var sdkCredentialDecodingFailureMessages = /* @__PURE__ */ new Set([
|
|
17
|
+
"project credential decoding failed",
|
|
18
|
+
"shared project credential decoding failed",
|
|
19
|
+
"project credential decoding failed: this connector version does not support shared credentials"
|
|
20
|
+
]);
|
|
21
|
+
function isCredentialMaterialError(error) {
|
|
22
|
+
return error instanceof CredentialMaterialError || error instanceof TypeError && sdkCredentialDecodingFailureMessages.has(error.message);
|
|
23
|
+
}
|
|
24
|
+
function decodeCredentials(value) {
|
|
25
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new CredentialMaterialError("credential fields are invalid");
|
|
26
|
+
const fields = value;
|
|
27
|
+
const allowed = /* @__PURE__ */ new Set(["access_key_id", "secret_access_key", "session_token"]);
|
|
28
|
+
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new CredentialMaterialError("stored credential does not match the connector credential fields");
|
|
29
|
+
if (fields["access_key_id"] != null && !(typeof fields["access_key_id"] === "string")) throw new CredentialMaterialError("credential access_key_id has an invalid type");
|
|
30
|
+
if (fields["secret_access_key"] != null && !(typeof fields["secret_access_key"] === "string")) throw new CredentialMaterialError("credential secret_access_key has an invalid type");
|
|
31
|
+
if (fields["session_token"] != null && !(typeof fields["session_token"] === "string")) throw new CredentialMaterialError("credential session_token has an invalid type");
|
|
32
|
+
const credentials = {};
|
|
33
|
+
if (!fields["access_key_id"]) throw new CredentialMaterialError("credential access_key_id is required");
|
|
34
|
+
credentials.accessKeyId = new SecretString(fields["access_key_id"] ?? "");
|
|
35
|
+
if (!fields["secret_access_key"]) throw new CredentialMaterialError("credential secret_access_key is required");
|
|
36
|
+
credentials.secretAccessKey = new SecretString(fields["secret_access_key"] ?? "");
|
|
37
|
+
credentials.sessionToken = new SecretString(fields["session_token"] ?? "");
|
|
38
|
+
return credentials;
|
|
39
|
+
}
|
|
40
|
+
var GetFunctionInputSchema = z.strictObject({
|
|
41
|
+
"functionName": z.string()
|
|
42
|
+
});
|
|
43
|
+
var FunctionDetailsSchema = z.strictObject({
|
|
44
|
+
"name": z.string(),
|
|
45
|
+
"arn": z.string()
|
|
46
|
+
});
|
|
47
|
+
var ListFunctionsInputSchema = z.strictObject({
|
|
48
|
+
"marker": z.string(),
|
|
49
|
+
"maxItems": z.number().int()
|
|
50
|
+
});
|
|
51
|
+
var FunctionPageSchema = z.strictObject({
|
|
52
|
+
"functions": z.array(FunctionDetailsSchema).nullable(),
|
|
53
|
+
"nextMarker": z.string()
|
|
54
|
+
});
|
|
55
|
+
var UpdateFunctionDescriptionInputSchema = z.strictObject({
|
|
56
|
+
"functionName": z.string(),
|
|
57
|
+
"description": z.string()
|
|
58
|
+
});
|
|
59
|
+
var DeleteFunctionInputSchema = z.strictObject({
|
|
60
|
+
"functionName": z.string()
|
|
61
|
+
});
|
|
62
|
+
var FunctionWriteResultSchema = z.strictObject({
|
|
63
|
+
"applied": z.boolean()
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// src/generated/definitions.ts
|
|
67
|
+
var ConnectorID = "amazon-lambda";
|
|
68
|
+
var ProviderID = "amazon-lambda";
|
|
69
|
+
var GetFunctionBranch = {
|
|
70
|
+
Found: "found",
|
|
71
|
+
Missing: "missing",
|
|
72
|
+
ProviderRejected: "providerRejected",
|
|
73
|
+
InvalidResponse: "invalidResponse",
|
|
74
|
+
Defect: "defect"
|
|
75
|
+
};
|
|
76
|
+
var GetFunctionBranchFound = GetFunctionBranch.Found;
|
|
77
|
+
var GetFunctionBranchMissing = GetFunctionBranch.Missing;
|
|
78
|
+
var GetFunctionBranchProviderRejected = GetFunctionBranch.ProviderRejected;
|
|
79
|
+
var GetFunctionBranchInvalidResponse = GetFunctionBranch.InvalidResponse;
|
|
80
|
+
var GetFunctionBranchDefect = GetFunctionBranch.Defect;
|
|
81
|
+
var GetFunctionDefinition = {
|
|
82
|
+
operation: { connectorId: ConnectorID, operationId: "getFunction" },
|
|
83
|
+
branches: [
|
|
84
|
+
{ id: "found", description: "AWS returned the function configuration." },
|
|
85
|
+
{ id: "missing", description: "The function does not exist in the selected Region.", optional: true },
|
|
86
|
+
{ id: "providerRejected", description: "AWS conclusively rejected the request or credentials.", optional: true },
|
|
87
|
+
{ id: "invalidResponse", description: "AWS returned malformed or oversized function metadata.", optional: true },
|
|
88
|
+
{ id: "defect", description: "The function name, endpoint, Region, or credentials are invalid.", optional: true }
|
|
89
|
+
],
|
|
90
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
91
|
+
};
|
|
92
|
+
var GetFunctionMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
93
|
+
var ListFunctionsBranch = {
|
|
94
|
+
Listed: "listed",
|
|
95
|
+
ProviderRejected: "providerRejected",
|
|
96
|
+
InvalidResponse: "invalidResponse",
|
|
97
|
+
Defect: "defect"
|
|
98
|
+
};
|
|
99
|
+
var ListFunctionsBranchListed = ListFunctionsBranch.Listed;
|
|
100
|
+
var ListFunctionsBranchProviderRejected = ListFunctionsBranch.ProviderRejected;
|
|
101
|
+
var ListFunctionsBranchInvalidResponse = ListFunctionsBranch.InvalidResponse;
|
|
102
|
+
var ListFunctionsBranchDefect = ListFunctionsBranch.Defect;
|
|
103
|
+
var ListFunctionsDefinition = {
|
|
104
|
+
operation: { connectorId: ConnectorID, operationId: "listFunctions" },
|
|
105
|
+
branches: [
|
|
106
|
+
{ id: "listed", description: "AWS returned a page of functions." },
|
|
107
|
+
{ id: "providerRejected", description: "AWS conclusively rejected the request or credentials.", optional: true },
|
|
108
|
+
{ id: "invalidResponse", description: "AWS returned malformed or oversized function metadata.", optional: true },
|
|
109
|
+
{ id: "defect", description: "The page input or connection settings are invalid.", optional: true }
|
|
110
|
+
],
|
|
111
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
112
|
+
};
|
|
113
|
+
var ListFunctionsMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
114
|
+
var UpdateFunctionDescriptionBranch = {
|
|
115
|
+
Updated: "updated",
|
|
116
|
+
Missing: "missing",
|
|
117
|
+
ProviderRejected: "providerRejected",
|
|
118
|
+
InvalidResponse: "invalidResponse",
|
|
119
|
+
Defect: "defect"
|
|
120
|
+
};
|
|
121
|
+
var UpdateFunctionDescriptionBranchUpdated = UpdateFunctionDescriptionBranch.Updated;
|
|
122
|
+
var UpdateFunctionDescriptionBranchMissing = UpdateFunctionDescriptionBranch.Missing;
|
|
123
|
+
var UpdateFunctionDescriptionBranchProviderRejected = UpdateFunctionDescriptionBranch.ProviderRejected;
|
|
124
|
+
var UpdateFunctionDescriptionBranchInvalidResponse = UpdateFunctionDescriptionBranch.InvalidResponse;
|
|
125
|
+
var UpdateFunctionDescriptionBranchDefect = UpdateFunctionDescriptionBranch.Defect;
|
|
126
|
+
var UpdateFunctionDescriptionDefinition = {
|
|
127
|
+
operation: { connectorId: ConnectorID, operationId: "updateFunctionDescription" },
|
|
128
|
+
branches: [
|
|
129
|
+
{ id: "updated", description: "AWS accepted the description update." },
|
|
130
|
+
{ id: "missing", description: "The function does not exist.", optional: true },
|
|
131
|
+
{ id: "providerRejected", description: "AWS conclusively rejected the update.", optional: true },
|
|
132
|
+
{ id: "invalidResponse", description: "AWS returned malformed or oversized metadata.", optional: true },
|
|
133
|
+
{ id: "defect", description: "The update input or connection settings are invalid.", optional: true }
|
|
134
|
+
],
|
|
135
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
136
|
+
};
|
|
137
|
+
var UpdateFunctionDescriptionMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
138
|
+
var DeleteFunctionBranch = {
|
|
139
|
+
Deleted: "deleted",
|
|
140
|
+
ProviderRejected: "providerRejected",
|
|
141
|
+
Defect: "defect"
|
|
142
|
+
};
|
|
143
|
+
var DeleteFunctionBranchDeleted = DeleteFunctionBranch.Deleted;
|
|
144
|
+
var DeleteFunctionBranchProviderRejected = DeleteFunctionBranch.ProviderRejected;
|
|
145
|
+
var DeleteFunctionBranchDefect = DeleteFunctionBranch.Defect;
|
|
146
|
+
var DeleteFunctionDefinition = {
|
|
147
|
+
operation: { connectorId: ConnectorID, operationId: "deleteFunction" },
|
|
148
|
+
branches: [
|
|
149
|
+
{ id: "deleted", description: "The function is absent after deletion." },
|
|
150
|
+
{ id: "providerRejected", description: "AWS conclusively rejected the deletion.", optional: true },
|
|
151
|
+
{ id: "defect", description: "The function name or connection settings are invalid.", optional: true }
|
|
152
|
+
],
|
|
153
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
154
|
+
};
|
|
155
|
+
var DeleteFunctionMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
156
|
+
|
|
157
|
+
// src/generated/connection.ts
|
|
158
|
+
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
159
|
+
var Connection = class {
|
|
160
|
+
/** Stable provider and connection name. */
|
|
161
|
+
reference;
|
|
162
|
+
/** Bound provider operations. */
|
|
163
|
+
operations;
|
|
164
|
+
/** Validate a reference and bind operations. */
|
|
165
|
+
constructor(reference, operations) {
|
|
166
|
+
this.reference = ConnectionRefSchema.parse(reference);
|
|
167
|
+
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
168
|
+
if (!operations) throw new TypeError("connector operations are required");
|
|
169
|
+
this.operations = operations;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
function newConnection(client, reference) {
|
|
173
|
+
if (!client) throw new TypeError("connector client is required");
|
|
174
|
+
return new Connection(reference, client);
|
|
175
|
+
}
|
|
176
|
+
function newConnectionWithOperations(operations, reference) {
|
|
177
|
+
return new Connection(reference, operations);
|
|
178
|
+
}
|
|
179
|
+
function newProjectConnection(project, connectionName, createClient) {
|
|
180
|
+
if (!project) throw new TypeError("loaded project is required");
|
|
181
|
+
const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
|
|
182
|
+
const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
|
|
183
|
+
if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
|
|
184
|
+
return newConnection(createClient(project, connectionName), reference);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export {
|
|
188
|
+
ConfigSchema,
|
|
189
|
+
CredentialMaterialError,
|
|
190
|
+
isCredentialMaterialError,
|
|
191
|
+
decodeCredentials,
|
|
192
|
+
GetFunctionInputSchema,
|
|
193
|
+
FunctionDetailsSchema,
|
|
194
|
+
ListFunctionsInputSchema,
|
|
195
|
+
FunctionPageSchema,
|
|
196
|
+
UpdateFunctionDescriptionInputSchema,
|
|
197
|
+
DeleteFunctionInputSchema,
|
|
198
|
+
FunctionWriteResultSchema,
|
|
199
|
+
ConnectorID,
|
|
200
|
+
ProviderID,
|
|
201
|
+
GetFunctionBranch,
|
|
202
|
+
GetFunctionBranchFound,
|
|
203
|
+
GetFunctionBranchMissing,
|
|
204
|
+
GetFunctionBranchProviderRejected,
|
|
205
|
+
GetFunctionBranchInvalidResponse,
|
|
206
|
+
GetFunctionBranchDefect,
|
|
207
|
+
GetFunctionDefinition,
|
|
208
|
+
GetFunctionMetadata,
|
|
209
|
+
ListFunctionsBranch,
|
|
210
|
+
ListFunctionsBranchListed,
|
|
211
|
+
ListFunctionsBranchProviderRejected,
|
|
212
|
+
ListFunctionsBranchInvalidResponse,
|
|
213
|
+
ListFunctionsBranchDefect,
|
|
214
|
+
ListFunctionsDefinition,
|
|
215
|
+
ListFunctionsMetadata,
|
|
216
|
+
UpdateFunctionDescriptionBranch,
|
|
217
|
+
UpdateFunctionDescriptionBranchUpdated,
|
|
218
|
+
UpdateFunctionDescriptionBranchMissing,
|
|
219
|
+
UpdateFunctionDescriptionBranchProviderRejected,
|
|
220
|
+
UpdateFunctionDescriptionBranchInvalidResponse,
|
|
221
|
+
UpdateFunctionDescriptionBranchDefect,
|
|
222
|
+
UpdateFunctionDescriptionDefinition,
|
|
223
|
+
UpdateFunctionDescriptionMetadata,
|
|
224
|
+
DeleteFunctionBranch,
|
|
225
|
+
DeleteFunctionBranchDeleted,
|
|
226
|
+
DeleteFunctionBranchProviderRejected,
|
|
227
|
+
DeleteFunctionBranchDefect,
|
|
228
|
+
DeleteFunctionDefinition,
|
|
229
|
+
DeleteFunctionMetadata,
|
|
230
|
+
Connection,
|
|
231
|
+
newConnection,
|
|
232
|
+
newConnectionWithOperations,
|
|
233
|
+
newProjectConnection
|
|
234
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { SecretString, CredentialProvider, Query, Mutation, ConnectionRef } from '@superdurable/connectors-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/** Connector configuration; omitted fields use manifest defaults. */
|
|
5
|
+
interface Config {
|
|
6
|
+
/** AWS Region of the Lambda function, as a Region code such as eu-west-1. In https://console.aws.amazon.com/lambda > Functions, use the console Region selector and the function ARN. Blank uses the displayed default; change it when your function is elsewhere. */
|
|
7
|
+
region?: string;
|
|
8
|
+
/** Optional Lambda-compatible API root. Blank derives the regional AWS endpoint from region. Override only for a trusted compatible endpoint; local tests may use loopback HTTP. */
|
|
9
|
+
endpoint?: string;
|
|
10
|
+
/** Maximum duration of one Lambda API request as a positive Go duration such as 15s. Blank uses the displayed default; increase only for a slow network. Runtime value in milliseconds. */
|
|
11
|
+
timeoutMs?: number;
|
|
12
|
+
/** Maximum complete Lambda API response in bytes. Blank uses the displayed default; increase only for unusually large responses. */
|
|
13
|
+
maxResponseBytes?: number;
|
|
14
|
+
}
|
|
15
|
+
/** Runtime schema for manifest configuration. */
|
|
16
|
+
declare const ConfigSchema: z.ZodObject<{
|
|
17
|
+
region: z.ZodOptional<z.ZodString>;
|
|
18
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
19
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
/** Private connector credentials resolved by the host. */
|
|
23
|
+
interface Credentials {
|
|
24
|
+
/** Secret-stored AWS access key ID from https://console.aws.amazon.com/iam > Users > selected user > Security credentials > Access keys > Create access key. Long-term IDs start AKIA and temporary IDs start ASIA. Blank prevents signing. Dex stores it as a secret. */
|
|
25
|
+
accessKeyId: SecretString;
|
|
26
|
+
/** Secret access key paired with access_key_id, shown once on the IAM Retrieve access keys page. Copy the Value, never the key ID. Blank prevents signing; rotate by creating another key and deleting the old one after verification. */
|
|
27
|
+
secretAccessKey: SecretString;
|
|
28
|
+
/** Secret session token for temporary ASIA credentials, from AWS STS. Blank means long-term IAM user credentials. Temporary credentials expire; replace all three fields before expiry. */
|
|
29
|
+
sessionToken?: SecretString;
|
|
30
|
+
}
|
|
31
|
+
/** Stored credential material that fails the connector credential checks, so no retry can succeed. */
|
|
32
|
+
declare class CredentialMaterialError extends TypeError {
|
|
33
|
+
constructor(message: string);
|
|
34
|
+
}
|
|
35
|
+
/** Report malformed stored credential material, also behind the SDK provider's decoding TypeError. */
|
|
36
|
+
declare function isCredentialMaterialError(error: unknown): boolean;
|
|
37
|
+
/** Decode private credential fields for the connector. */
|
|
38
|
+
declare function decodeCredentials(value: unknown): Credentials;
|
|
39
|
+
/** Host-owned source of private connector credentials. */
|
|
40
|
+
type CredentialSource = CredentialProvider<Credentials>;
|
|
41
|
+
/** GetFunctionInput identifies one Lambda function in the configured Region. */
|
|
42
|
+
interface GetFunctionInput {
|
|
43
|
+
"functionName": string;
|
|
44
|
+
}
|
|
45
|
+
/** FunctionDetails returns the stable identity of a Lambda function. */
|
|
46
|
+
interface FunctionDetails {
|
|
47
|
+
"name": string;
|
|
48
|
+
"arn": string;
|
|
49
|
+
}
|
|
50
|
+
/** ListFunctionsInput selects a bounded page of functions in the configured Region. */
|
|
51
|
+
interface ListFunctionsInput {
|
|
52
|
+
/** Marker resumes from a prior page's NextMarker; blank starts at the beginning. */
|
|
53
|
+
"marker": string;
|
|
54
|
+
/** MaxItems requests 1 to 50 functions; zero uses AWS's page size. */
|
|
55
|
+
"maxItems": number;
|
|
56
|
+
}
|
|
57
|
+
/** FunctionPage contains one page of function identities and its continuation marker. */
|
|
58
|
+
interface FunctionPage {
|
|
59
|
+
/** Functions are the identities returned in this page. */
|
|
60
|
+
"functions": Array<FunctionDetails> | null;
|
|
61
|
+
/** NextMarker resumes the next page; blank means the list is complete. */
|
|
62
|
+
"nextMarker": string;
|
|
63
|
+
}
|
|
64
|
+
/** UpdateFunctionDescriptionInput sets the complete description of one function. */
|
|
65
|
+
interface UpdateFunctionDescriptionInput {
|
|
66
|
+
/** FunctionName identifies the unpublished function configuration. */
|
|
67
|
+
"functionName": string;
|
|
68
|
+
/** Description replaces the entire description; blank clears it. */
|
|
69
|
+
"description": string;
|
|
70
|
+
}
|
|
71
|
+
/** DeleteFunctionInput identifies a complete function to delete. */
|
|
72
|
+
interface DeleteFunctionInput {
|
|
73
|
+
/** FunctionName identifies the complete function and all its versions and aliases. */
|
|
74
|
+
"functionName": string;
|
|
75
|
+
}
|
|
76
|
+
/** FunctionWriteResult confirms the function is absent after a deletion. */
|
|
77
|
+
interface FunctionWriteResult {
|
|
78
|
+
/** Applied confirms the function is absent. */
|
|
79
|
+
"applied": boolean;
|
|
80
|
+
}
|
|
81
|
+
/** Runtime validator for GetFunctionInput. */
|
|
82
|
+
declare const GetFunctionInputSchema: z.ZodObject<{
|
|
83
|
+
functionName: z.ZodString;
|
|
84
|
+
}, z.core.$strict>;
|
|
85
|
+
/** Runtime validator for FunctionDetails. */
|
|
86
|
+
declare const FunctionDetailsSchema: z.ZodObject<{
|
|
87
|
+
name: z.ZodString;
|
|
88
|
+
arn: z.ZodString;
|
|
89
|
+
}, z.core.$strict>;
|
|
90
|
+
/** Runtime validator for ListFunctionsInput. */
|
|
91
|
+
declare const ListFunctionsInputSchema: z.ZodObject<{
|
|
92
|
+
marker: z.ZodString;
|
|
93
|
+
maxItems: z.ZodNumber;
|
|
94
|
+
}, z.core.$strict>;
|
|
95
|
+
/** Runtime validator for FunctionPage. */
|
|
96
|
+
declare const FunctionPageSchema: z.ZodObject<{
|
|
97
|
+
functions: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
98
|
+
name: z.ZodString;
|
|
99
|
+
arn: z.ZodString;
|
|
100
|
+
}, z.core.$strict>>>;
|
|
101
|
+
nextMarker: z.ZodString;
|
|
102
|
+
}, z.core.$strict>;
|
|
103
|
+
/** Runtime validator for UpdateFunctionDescriptionInput. */
|
|
104
|
+
declare const UpdateFunctionDescriptionInputSchema: z.ZodObject<{
|
|
105
|
+
functionName: z.ZodString;
|
|
106
|
+
description: z.ZodString;
|
|
107
|
+
}, z.core.$strict>;
|
|
108
|
+
/** Runtime validator for DeleteFunctionInput. */
|
|
109
|
+
declare const DeleteFunctionInputSchema: z.ZodObject<{
|
|
110
|
+
functionName: z.ZodString;
|
|
111
|
+
}, z.core.$strict>;
|
|
112
|
+
/** Runtime validator for FunctionWriteResult. */
|
|
113
|
+
declare const FunctionWriteResultSchema: z.ZodObject<{
|
|
114
|
+
applied: z.ZodBoolean;
|
|
115
|
+
}, z.core.$strict>;
|
|
116
|
+
|
|
117
|
+
/** Typed operations supplied by a client or mock. */
|
|
118
|
+
interface Operations {
|
|
119
|
+
/** Invoke getFunction through this connection. */
|
|
120
|
+
getFunction(): Query<GetFunctionInput, FunctionDetails>;
|
|
121
|
+
/** Invoke listFunctions through this connection. */
|
|
122
|
+
listFunctions(): Query<ListFunctionsInput, FunctionPage>;
|
|
123
|
+
/** Invoke updateFunctionDescription through this connection. */
|
|
124
|
+
updateFunctionDescription(): Mutation<UpdateFunctionDescriptionInput, FunctionDetails>;
|
|
125
|
+
/** Invoke deleteFunction through this connection. */
|
|
126
|
+
deleteFunction(): Mutation<DeleteFunctionInput, FunctionWriteResult>;
|
|
127
|
+
}
|
|
128
|
+
/** Named connector connection kept outside Flow state. */
|
|
129
|
+
declare class Connection<BoundOperations = Operations> {
|
|
130
|
+
/** Stable provider and connection name. */
|
|
131
|
+
readonly reference: ConnectionRef;
|
|
132
|
+
/** Bound provider operations. */
|
|
133
|
+
readonly operations: BoundOperations;
|
|
134
|
+
/** Validate a reference and bind operations. */
|
|
135
|
+
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
136
|
+
}
|
|
137
|
+
/** Bind a client to a named connection. */
|
|
138
|
+
declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
|
|
139
|
+
/** Bind scripted operations to a named connection. */
|
|
140
|
+
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
141
|
+
|
|
142
|
+
export { Connection as C, type DeleteFunctionInput as D, type FunctionWriteResult as F, type GetFunctionInput as G, type ListFunctionsInput as L, type Operations as O, type UpdateFunctionDescriptionInput as U, type FunctionDetails as a, type FunctionPage as b, type Config as c, type Credentials as d, ConfigSchema as e, CredentialMaterialError as f, type CredentialSource as g, DeleteFunctionInputSchema as h, FunctionDetailsSchema as i, FunctionPageSchema as j, FunctionWriteResultSchema as k, GetFunctionInputSchema as l, ListFunctionsInputSchema as m, UpdateFunctionDescriptionInputSchema as n, decodeCredentials as o, isCredentialMaterialError as p, newConnection as q, newConnectionWithOperations as r };
|