effortless-aws 0.7.1 → 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.
@@ -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.params);
179
+ resolvedParams = await buildParams(handler.config);
180
180
  return resolvedParams;
181
181
  };
182
- const getCtx = async () => {
182
+ const getSetup = async () => {
183
183
  if (ctx !== null) return ctx;
184
- if (handler.context) {
184
+ if (handler.setup) {
185
185
  const params = await getParams();
186
- ctx = params ? await handler.context({ params }) : await handler.context();
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.context) args.ctx = await getCtx();
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.params = params;
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
@@ -61193,12 +61193,12 @@ function processNext(state) {
61193
61193
  }
61194
61194
  function defaultProcessor(value5, state) {
61195
61195
  if (/\d/.test(value5)) {
61196
- const typed = state.typed + value5;
61197
- state.dateParts[state.cursor].setValue(typed);
61196
+ const typed2 = state.typed + value5;
61197
+ state.dateParts[state.cursor].setValue(typed2);
61198
61198
  return Action.NextFrame({
61199
61199
  state: {
61200
61200
  ...state,
61201
- typed
61201
+ typed: typed2
61202
61202
  }
61203
61203
  });
61204
61204
  }
@@ -66693,7 +66693,7 @@ var getWizardPrefix = (builtIn2, rootCommand, commandLineArgs) => {
66693
66693
  return appendAll(rootCommand.split(/\s+/), args2);
66694
66694
  };
66695
66695
  var renderWizardArgs = (args2) => {
66696
- const params = pipe(filter2(args2, (param) => param.length > 0), join(" "));
66696
+ const params = pipe(filter2(args2, (param2) => param2.length > 0), join(" "));
66697
66697
  const executeMsg = text4("You may now execute your command directly with the following options and arguments:");
66698
66698
  return blocks([p(strong(code("Wizard Mode Complete!"))), p(executeMsg), p(concat3(text4(" "), highlight(params, cyan3)))]);
66699
66699
  };
@@ -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", "context", "schema", "onError", "deps", "params", "static"];
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 paramsProp = obj.getProperties().find((p3) => {
71820
+ const configProp = obj.getProperties().find((p3) => {
71821
71821
  if (p3.getKind() === SyntaxKind.PropertyAssignment) {
71822
- return p3.getName() === "params";
71822
+ return p3.getName() === "config";
71823
71823
  }
71824
71824
  return false;
71825
71825
  });
71826
- if (!paramsProp || paramsProp.getKind() !== SyntaxKind.PropertyAssignment) return [];
71827
- const init = paramsProp.getInitializer();
71826
+ if (!configProp || configProp.getKind() !== SyntaxKind.PropertyAssignment) return [];
71827
+ const init = configProp.getInitializer();
71828
71828
  if (!init || init.getKind() !== SyntaxKind.ObjectLiteralExpression) return [];
71829
- const paramsObj = init;
71829
+ const configObj = init;
71830
71830
  const entries2 = [];
71831
- for (const p3 of paramsObj.getProperties()) {
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 || propInit.getKind() !== SyntaxKind.CallExpression) continue;
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;