@zapier/kitcore 0.5.0 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @zapier/kitcore
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 197a125: Breaking for plugin authors: an `output: "item"` method's `run` now returns the `{ data: item }` envelope itself (strictly `data`, no extra keys), symmetric with list's `SdkPage`, instead of returning the bare item for the framework to wrap. The public call surface is unchanged: callers still get `Promise<{ data: item }>`.
8
+
9
+ ## 0.5.1
10
+
11
+ ### Patch Changes
12
+
13
+ - c398f14: A caller-provided parameter is now used exactly as given: `controller.resolve()` and `controller.start()` settle seeded input up front, so the resolution walk no longer descends into provided objects or arrays and only asks for parameters the caller left out.
14
+
3
15
  ## 0.5.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -183,8 +183,13 @@ const transport = defineMethod({
183
183
  run: ({ input }) => fetch(input.url),
184
184
  });
185
185
 
186
- // item: run returns the value; the framework wraps it in { data }
187
- const getApp = defineMethod({ name: "getApp", output: "item", run: () => app });
186
+ // item: run returns the { data } envelope itself (data and nothing else),
187
+ // symmetric with list's page shape
188
+ const getApp = defineMethod({
189
+ name: "getApp",
190
+ output: "item",
191
+ run: () => ({ data: app }),
192
+ });
188
193
  const { data } = await sdk.getApp({ app: "slack" });
189
194
 
190
195
  // list: run returns one page; the surface is a paginated iterable
package/dist/index.cjs CHANGED
@@ -2274,9 +2274,7 @@ function buildMethodEntries(descriptors, context, states) {
2274
2274
  }
2275
2275
  );
2276
2276
  } else if (out.type === "item") {
2277
- const itemCore = async (input) => ({
2278
- data: await callRun(input)
2279
- });
2277
+ const itemCore = async (input) => callRun(input);
2280
2278
  entry.value = createFunction(
2281
2279
  fold(itemCore),
2282
2280
  {
@@ -3357,12 +3355,16 @@ async function advance(ctx, state) {
3357
3355
  }
3358
3356
  }
3359
3357
  async function start(ctx, input = {}, interactive = true) {
3360
- return advance(ctx, {
3358
+ const state = {
3361
3359
  method: ctx.method,
3362
3360
  resolved: { ...input },
3363
3361
  settled: [],
3364
3362
  interactive
3365
- });
3363
+ };
3364
+ for (const [name, value] of Object.entries(input)) {
3365
+ if (value !== void 0) settle(state, [name]);
3366
+ }
3367
+ return advance(ctx, state);
3366
3368
  }
3367
3369
  async function step(ctx, prior, action) {
3368
3370
  const state = clone(prior);