effortless-aws 0.7.2 → 0.8.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/dist/{chunk-5L76NICW.js → chunk-B4P7ZKNM.js} +11 -7
- package/dist/cli/index.js +14 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +77 -70
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/runtime/wrap-app.js +3 -3
- package/dist/runtime/wrap-fifo-queue.js +2 -2
- package/dist/runtime/wrap-http.js +2 -2
- package/dist/runtime/wrap-table-stream.js +2 -2
- package/package.json +1 -1
|
@@ -162,7 +162,7 @@ var buildParams = async (params) => {
|
|
|
162
162
|
for (const { propName, ssmPath } of entries) {
|
|
163
163
|
const raw = values.get(ssmPath) ?? "";
|
|
164
164
|
const ref = params[propName];
|
|
165
|
-
result[propName] = ref?.transform ? ref.transform(raw) : raw;
|
|
165
|
+
result[propName] = typeof ref === "object" && ref?.transform ? ref.transform(raw) : raw;
|
|
166
166
|
}
|
|
167
167
|
return result;
|
|
168
168
|
};
|
|
@@ -176,24 +176,28 @@ var createHandlerRuntime = (handler, handlerType, logLevel = "info") => {
|
|
|
176
176
|
const getDeps = () => resolvedDeps ??= buildDeps(handler.deps);
|
|
177
177
|
const getParams = async () => {
|
|
178
178
|
if (resolvedParams !== null) return resolvedParams;
|
|
179
|
-
resolvedParams = await buildParams(handler.
|
|
179
|
+
resolvedParams = await buildParams(handler.config);
|
|
180
180
|
return resolvedParams;
|
|
181
181
|
};
|
|
182
|
-
const
|
|
182
|
+
const getSetup = async () => {
|
|
183
183
|
if (ctx !== null) return ctx;
|
|
184
|
-
if (handler.
|
|
184
|
+
if (handler.setup) {
|
|
185
185
|
const params = await getParams();
|
|
186
|
-
|
|
186
|
+
const deps = getDeps();
|
|
187
|
+
const args = {};
|
|
188
|
+
if (params) args.config = params;
|
|
189
|
+
if (deps) args.deps = deps;
|
|
190
|
+
ctx = Object.keys(args).length > 0 ? await handler.setup(args) : await handler.setup();
|
|
187
191
|
}
|
|
188
192
|
return ctx;
|
|
189
193
|
};
|
|
190
194
|
const commonArgs = async () => {
|
|
191
195
|
const args = {};
|
|
192
|
-
if (handler.
|
|
196
|
+
if (handler.setup) args.ctx = await getSetup();
|
|
193
197
|
const deps = getDeps();
|
|
194
198
|
if (deps) args.deps = deps;
|
|
195
199
|
const params = await getParams();
|
|
196
|
-
if (params) args.
|
|
200
|
+
if (params) args.config = params;
|
|
197
201
|
if (handler.static) args.readStatic = readStatic;
|
|
198
202
|
return args;
|
|
199
203
|
};
|
package/dist/cli/index.js
CHANGED
|
@@ -71771,7 +71771,7 @@ var parseSource = (source) => {
|
|
|
71771
71771
|
const project2 = new Project({ useInMemoryFileSystem: true });
|
|
71772
71772
|
return project2.createSourceFile("input.ts", source);
|
|
71773
71773
|
};
|
|
71774
|
-
var RUNTIME_PROPS = ["onRequest", "onRecord", "onBatchComplete", "onBatch", "onMessage", "
|
|
71774
|
+
var RUNTIME_PROPS = ["onRequest", "onRecord", "onBatchComplete", "onBatch", "onMessage", "setup", "schema", "onError", "deps", "config", "static"];
|
|
71775
71775
|
var buildConfigWithoutRuntime = (obj) => {
|
|
71776
71776
|
const props = obj.getProperties().filter((p3) => {
|
|
71777
71777
|
if (p3.getKind() === SyntaxKind.PropertyAssignment) {
|
|
@@ -71817,23 +71817,29 @@ var extractDepsKeys = (obj) => {
|
|
|
71817
71817
|
}).filter(Boolean);
|
|
71818
71818
|
};
|
|
71819
71819
|
var extractParamEntries = (obj) => {
|
|
71820
|
-
const
|
|
71820
|
+
const configProp = obj.getProperties().find((p3) => {
|
|
71821
71821
|
if (p3.getKind() === SyntaxKind.PropertyAssignment) {
|
|
71822
|
-
return p3.getName() === "
|
|
71822
|
+
return p3.getName() === "config";
|
|
71823
71823
|
}
|
|
71824
71824
|
return false;
|
|
71825
71825
|
});
|
|
71826
|
-
if (!
|
|
71827
|
-
const init =
|
|
71826
|
+
if (!configProp || configProp.getKind() !== SyntaxKind.PropertyAssignment) return [];
|
|
71827
|
+
const init = configProp.getInitializer();
|
|
71828
71828
|
if (!init || init.getKind() !== SyntaxKind.ObjectLiteralExpression) return [];
|
|
71829
|
-
const
|
|
71829
|
+
const configObj = init;
|
|
71830
71830
|
const entries2 = [];
|
|
71831
|
-
for (const p3 of
|
|
71831
|
+
for (const p3 of configObj.getProperties()) {
|
|
71832
71832
|
if (p3.getKind() !== SyntaxKind.PropertyAssignment) continue;
|
|
71833
71833
|
const propAssign = p3;
|
|
71834
71834
|
const propName = propAssign.getName();
|
|
71835
71835
|
const propInit = propAssign.getInitializer();
|
|
71836
|
-
if (!propInit
|
|
71836
|
+
if (!propInit) continue;
|
|
71837
|
+
if (propInit.getKind() === SyntaxKind.StringLiteral) {
|
|
71838
|
+
const ssmKey = propInit.asKindOrThrow(SyntaxKind.StringLiteral).getLiteralValue();
|
|
71839
|
+
entries2.push({ propName, ssmKey });
|
|
71840
|
+
continue;
|
|
71841
|
+
}
|
|
71842
|
+
if (propInit.getKind() !== SyntaxKind.CallExpression) continue;
|
|
71837
71843
|
const callExpr = propInit;
|
|
71838
71844
|
const callArgs = callExpr.getArguments();
|
|
71839
71845
|
if (callArgs.length === 0) continue;
|