@zapier/zapier-sdk 0.84.4 → 0.86.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/AGENTS.md +3 -1
- package/CHANGELOG.md +12 -0
- package/README.md +80 -56
- package/dist/experimental.cjs +709 -397
- package/dist/experimental.d.mts +4 -4
- package/dist/experimental.d.ts +4 -4
- package/dist/experimental.mjs +709 -397
- package/dist/{index-ChZuXQDn.d.mts → index-Pjitof_V.d.mts} +184 -96
- package/dist/{index-ChZuXQDn.d.ts → index-Pjitof_V.d.ts} +184 -96
- package/dist/index.cjs +681 -390
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +681 -390
- package/package.json +2 -2
|
@@ -229,31 +229,110 @@ interface SdkPage<T = unknown> {
|
|
|
229
229
|
nextCursor?: string;
|
|
230
230
|
}
|
|
231
231
|
/**
|
|
232
|
-
* Return type of every paginated SDK method. The
|
|
232
|
+
* Return type of every paginated SDK method. The documented surface is:
|
|
233
233
|
*
|
|
234
|
-
* -
|
|
235
|
-
* - an AsyncIterable
|
|
234
|
+
* - `await` the result for the first page (`SdkPage<TItem>`),
|
|
235
|
+
* - `.pages()` for an AsyncIterable over pages, and
|
|
236
|
+
* - `.items()` for an AsyncIterable over individual items across pages.
|
|
236
237
|
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
238
|
+
* `.pages()` and `.items()` return plain iterables (not thenables), so they
|
|
239
|
+
* survive being returned from an `async` function; the result itself is a
|
|
240
|
+
* thenable, so an `async` boundary silently collapses it to the first page.
|
|
241
|
+
* Named so paginated plugin signatures serialize as
|
|
242
|
+
* `PaginatedSdkResult<AppItem>` in `.d.ts` rather than expanding the full
|
|
243
|
+
* intersection at every callsite.
|
|
241
244
|
*
|
|
242
245
|
* The faces share one underlying cursor, so a result is consumed once:
|
|
243
246
|
*
|
|
244
247
|
* - `await` / `.then()` read the buffered first page without starting the
|
|
245
248
|
* stream, so awaiting is a repeatable peek and you can still iterate the
|
|
246
249
|
* result afterward.
|
|
247
|
-
* -
|
|
248
|
-
*
|
|
249
|
-
* does not replay page 1). To read a
|
|
250
|
-
* method again for a fresh result.
|
|
250
|
+
* - `.pages()`, `.items()`, and the deprecated bare iteration are views
|
|
251
|
+
* over one page stream, so consuming any view drains the others: the
|
|
252
|
+
* second view yields nothing (it does not replay page 1). To read a
|
|
253
|
+
* result more than once, call the method again for a fresh result.
|
|
251
254
|
*/
|
|
252
|
-
interface PaginatedSdkResult<TItem> extends Promise<SdkPage<TItem
|
|
255
|
+
interface PaginatedSdkResult<TItem> extends Promise<SdkPage<TItem>> {
|
|
256
|
+
/**
|
|
257
|
+
* @deprecated Iterate `.pages()` instead. Bare iteration works but is easy
|
|
258
|
+
* to break: because the result is also a thenable, an `async` boundary
|
|
259
|
+
* collapses it to its first page and the iterable is silently lost.
|
|
260
|
+
*
|
|
261
|
+
* Deliberately no runtime deprecation warning: this face is not scheduled
|
|
262
|
+
* for deletion (removing it is a breaking change deferred to a separate
|
|
263
|
+
* decision), and structural consumers such as the CLI's page streaming
|
|
264
|
+
* detect pagination via `Symbol.asyncIterator`, so a warning would fire on
|
|
265
|
+
* the SDK's own machinery.
|
|
266
|
+
*/
|
|
267
|
+
[Symbol.asyncIterator](): AsyncIterator<SdkPage<TItem>>;
|
|
268
|
+
pages(): AsyncIterable<SdkPage<TItem>>;
|
|
253
269
|
items(): AsyncIterable<TItem>;
|
|
254
270
|
}
|
|
255
271
|
type PaginatedSdkFunction<TOptions, TItem> = (options: TOptions) => PaginatedSdkResult<TItem>;
|
|
256
272
|
|
|
273
|
+
/**
|
|
274
|
+
* Per-call context threaded explicitly through the method boundary in place of
|
|
275
|
+
* ambient AsyncLocalStorage. It carries call identity, nesting depth, and a
|
|
276
|
+
* per-invocation annotation bag. Because it travels as data, correlation and
|
|
277
|
+
* nested-call dedup work without `async_hooks` — including in browsers, where
|
|
278
|
+
* the old ALS store was inert and nested calls all looked top-level.
|
|
279
|
+
*
|
|
280
|
+
* Framework-neutral: heads surface `callId` under their own name (e.g. a
|
|
281
|
+
* correlation id) and own their annotation field names.
|
|
282
|
+
*/
|
|
283
|
+
/**
|
|
284
|
+
* A private brand (a fresh `Symbol()`, never `Symbol.for`) makes a CallContext
|
|
285
|
+
* unforgeable: no outside code can name the symbol to synthesize an id-bearing
|
|
286
|
+
* context, and the brand never collides across bundled copies. This is the same
|
|
287
|
+
* unforgeability the `INTERNAL_CALL` sentinel relies on.
|
|
288
|
+
*/
|
|
289
|
+
declare const CALL_CONTEXT_BRAND: unique symbol;
|
|
290
|
+
interface CallContext {
|
|
291
|
+
/** Minted once at the root call; copied verbatim to every nested (child) call. */
|
|
292
|
+
callId: string | null;
|
|
293
|
+
/** 0 at the outermost call; `parent.depth + 1` for a delegated call. */
|
|
294
|
+
depth: number;
|
|
295
|
+
/**
|
|
296
|
+
* Per-invocation scratch space. Never forwarded to callees — a child call
|
|
297
|
+
* gets a fresh bag — so annotations describe one method's own invocation.
|
|
298
|
+
*/
|
|
299
|
+
annotations: Record<string, unknown>;
|
|
300
|
+
readonly [CALL_CONTEXT_BRAND]: true;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Method-call lifecycle hooks. Plugins contribute `onMethodStart` and/or
|
|
305
|
+
* `onMethodEnd` on their context; `buildHooks` composes contributions across
|
|
306
|
+
* plugins so multiple observers can coexist. Composition is right-additive
|
|
307
|
+
* (newer plugins fire after earlier ones); only opt-in methods built through
|
|
308
|
+
* `createPluginMethod` / `createPaginatedPluginMethod` trigger the hooks.
|
|
309
|
+
*/
|
|
310
|
+
interface OnMethodStartContext {
|
|
311
|
+
methodName: string;
|
|
312
|
+
args: unknown[];
|
|
313
|
+
isPaginated: boolean;
|
|
314
|
+
/**
|
|
315
|
+
* Depth of this method invocation in the SDK call tree. 0 = outermost
|
|
316
|
+
* (user-initiated) call; 1+ = called from inside another SDK method.
|
|
317
|
+
* Observers can use this to ignore nested calls if they only want
|
|
318
|
+
* top-level events.
|
|
319
|
+
*/
|
|
320
|
+
depth: number;
|
|
321
|
+
}
|
|
322
|
+
type OnMethodStart = (ctx: OnMethodStartContext) => void;
|
|
323
|
+
interface OnMethodEndContext {
|
|
324
|
+
methodName: string;
|
|
325
|
+
args: unknown[];
|
|
326
|
+
isPaginated: boolean;
|
|
327
|
+
depth: number;
|
|
328
|
+
durationMs: number;
|
|
329
|
+
error?: Error;
|
|
330
|
+
}
|
|
331
|
+
type OnMethodEnd = (ctx: OnMethodEndContext) => void;
|
|
332
|
+
interface MethodHooks {
|
|
333
|
+
onMethodStart?: OnMethodStart;
|
|
334
|
+
onMethodEnd?: OnMethodEnd;
|
|
335
|
+
}
|
|
257
336
|
interface FormattedItem {
|
|
258
337
|
title: string;
|
|
259
338
|
/**
|
|
@@ -344,8 +423,6 @@ type ListPromptConfig = PromptConfig & {
|
|
|
344
423
|
* - `filter` — no resolver uses it; transform values in `listItems` instead.
|
|
345
424
|
* - `validate`— validation is the resolver's top-level `validate`, which
|
|
346
425
|
* never routes through rendering (and gets `imports`).
|
|
347
|
-
* (The legacy `SchemaParameterResolver` still honors `default`/`filter`/
|
|
348
|
-
* `validate`, so the full `PromptConfig` stays for that path.)
|
|
349
426
|
*/
|
|
350
427
|
type ResolverPromptConfig = Omit<PromptConfig, "name" | "default" | "filter" | "validate">;
|
|
351
428
|
interface Resolver$1 {
|
|
@@ -515,40 +592,6 @@ interface PositionalMetadata {
|
|
|
515
592
|
}
|
|
516
593
|
declare function isPositional(schema: z.ZodType): boolean;
|
|
517
594
|
|
|
518
|
-
/**
|
|
519
|
-
* Method-call lifecycle hooks. Plugins contribute `onMethodStart` and/or
|
|
520
|
-
* `onMethodEnd` on their context; `buildHooks` composes contributions across
|
|
521
|
-
* plugins so multiple observers can coexist. Composition is right-additive
|
|
522
|
-
* (newer plugins fire after earlier ones); only opt-in methods built through
|
|
523
|
-
* `createPluginMethod` / `createPaginatedPluginMethod` trigger the hooks.
|
|
524
|
-
*/
|
|
525
|
-
interface OnMethodStartContext {
|
|
526
|
-
methodName: string;
|
|
527
|
-
args: unknown[];
|
|
528
|
-
isPaginated: boolean;
|
|
529
|
-
/**
|
|
530
|
-
* Depth of this method invocation in the SDK call tree. 0 = outermost
|
|
531
|
-
* (user-initiated) call; 1+ = called from inside another SDK method.
|
|
532
|
-
* Observers can use this to ignore nested calls if they only want
|
|
533
|
-
* top-level events.
|
|
534
|
-
*/
|
|
535
|
-
depth: number;
|
|
536
|
-
}
|
|
537
|
-
type OnMethodStart = (ctx: OnMethodStartContext) => void;
|
|
538
|
-
interface OnMethodEndContext {
|
|
539
|
-
methodName: string;
|
|
540
|
-
args: unknown[];
|
|
541
|
-
isPaginated: boolean;
|
|
542
|
-
depth: number;
|
|
543
|
-
durationMs: number;
|
|
544
|
-
error?: Error;
|
|
545
|
-
}
|
|
546
|
-
type OnMethodEnd = (ctx: OnMethodEndContext) => void;
|
|
547
|
-
interface MethodHooks {
|
|
548
|
-
onMethodStart?: OnMethodStart;
|
|
549
|
-
onMethodEnd?: OnMethodEnd;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
595
|
/**
|
|
553
596
|
* Descriptive metadata a leaf carries for the registry / CLI / MCP / docs:
|
|
554
597
|
* description, categories, type, formatter, resolvers, etc.
|
|
@@ -571,10 +614,6 @@ interface LeafMetaFields {
|
|
|
571
614
|
itemType?: string;
|
|
572
615
|
returnType?: string;
|
|
573
616
|
outputSchema?: z.ZodSchema;
|
|
574
|
-
inputParameters?: Array<{
|
|
575
|
-
name: string;
|
|
576
|
-
schema: z.ZodSchema;
|
|
577
|
-
}>;
|
|
578
617
|
packages?: string[];
|
|
579
618
|
experimental?: boolean;
|
|
580
619
|
confirm?: "create-secret" | "delete";
|
|
@@ -740,12 +779,11 @@ interface DynamicResolver extends ResolverBase {
|
|
|
740
779
|
input: Record<string, unknown>;
|
|
741
780
|
}) => PromiseLike<unknown>;
|
|
742
781
|
/** Produce the candidate list. Behaves like an SDK list method: returns a
|
|
743
|
-
* paginated result (
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
748
|
-
* auto-resolution someday) is the `static` kind's job. */
|
|
782
|
+
* paginated result (the engine awaits the first page + `nextCursor`), never a
|
|
783
|
+
* bare array. `cursor` is the stateless re-entry hook for "load more": the
|
|
784
|
+
* engine awaits one page, carries `nextCursor`, and calls again with `cursor`.
|
|
785
|
+
* Required: a dynamic resolver IS a candidate-lister; a free-text field (with
|
|
786
|
+
* or without auto-resolution someday) is the `static` kind's job. */
|
|
749
787
|
listItems: (bag: {
|
|
750
788
|
imports: Record<string, unknown>;
|
|
751
789
|
input: Record<string, unknown>;
|
|
@@ -829,6 +867,27 @@ interface ObjectResolver extends ResolverBase {
|
|
|
829
867
|
input: Record<string, unknown>;
|
|
830
868
|
}) => PromiseLike<Record<string, Field$1>>;
|
|
831
869
|
definitions?: Record<string, Resolver>;
|
|
870
|
+
/** Open-ended entries whose keys aren't known up front (a `z.record`): the
|
|
871
|
+
* walk collects entries in an add/done loop, asking each entry's key (via
|
|
872
|
+
* `keys`, default a free-text string) then its value (via `values`), and
|
|
873
|
+
* assembling them onto the object alongside any fixed `properties`. The
|
|
874
|
+
* JSON-Schema `additionalProperties` analog. */
|
|
875
|
+
additionalKeys?: AdditionalKeys;
|
|
876
|
+
}
|
|
877
|
+
/** The open-keyed-entry spec for an {@link ObjectResolver.additionalKeys}. */
|
|
878
|
+
interface AdditionalKeys {
|
|
879
|
+
/** Resolver for each entry's key; defaults to a free-text string prompt. A
|
|
880
|
+
* `{ ref }` resolves against the object's `definitions`. */
|
|
881
|
+
keys?: Resolver | ResolverRef;
|
|
882
|
+
/** Resolver for each entry's value. A `{ ref }` resolves against the
|
|
883
|
+
* object's `definitions`. */
|
|
884
|
+
values: Resolver | ResolverRef;
|
|
885
|
+
minEntries?: number;
|
|
886
|
+
maxEntries?: number;
|
|
887
|
+
/** Coarse value types so a free-text key/value answer coerces (usually
|
|
888
|
+
* `"string"` for the key), the way `Field.valueType` does. */
|
|
889
|
+
keyValueType?: string;
|
|
890
|
+
valueValueType?: string;
|
|
832
891
|
}
|
|
833
892
|
/** A homogeneous list: each element resolves through `items`. */
|
|
834
893
|
interface ArrayResolver extends ResolverBase {
|
|
@@ -874,9 +933,9 @@ interface Formatter extends MethodAttachment {
|
|
|
874
933
|
}) => FormattedItem;
|
|
875
934
|
}
|
|
876
935
|
/** What a dynamic resolver's `listItems` yields: an SDK list-method result
|
|
877
|
-
* (
|
|
878
|
-
*
|
|
879
|
-
*
|
|
936
|
+
* (the engine awaits the first page + `nextCursor`), or a plain page / promise
|
|
937
|
+
* of one. No bare array and no scalar: it behaves like any other list method,
|
|
938
|
+
* and exact-match short-circuits live on `tryResolveFromSearch`. */
|
|
880
939
|
type ListItemsResult<TItem> = PaginatedSdkResult<TItem> | SdkPage<TItem> | Promise<SdkPage<TItem>>;
|
|
881
940
|
/** A bound object resolver's literal property: its resolver is already bound
|
|
882
941
|
* (or a `{ ref }` the CLI resolves against `definitions` at runtime). */
|
|
@@ -947,7 +1006,8 @@ interface BoundDynamicResolver extends BoundResolverBase {
|
|
|
947
1006
|
} | null>;
|
|
948
1007
|
}
|
|
949
1008
|
/** Keyed members: static `properties` (bound) or a `getProperties`-built
|
|
950
|
-
* (unbound) field map; `definitions` holds ref targets.
|
|
1009
|
+
* (unbound) field map; `definitions` holds ref targets. `additionalKeys`
|
|
1010
|
+
* carries open-ended entries (a `z.record`). */
|
|
951
1011
|
interface BoundObjectResolver extends BoundResolverBase {
|
|
952
1012
|
type: "object";
|
|
953
1013
|
properties?: Record<string, BoundField>;
|
|
@@ -955,6 +1015,17 @@ interface BoundObjectResolver extends BoundResolverBase {
|
|
|
955
1015
|
getProperties?: (bag: {
|
|
956
1016
|
input: Record<string, unknown>;
|
|
957
1017
|
}) => PromiseLike<Record<string, Field$1>>;
|
|
1018
|
+
additionalKeys?: BoundAdditionalKeys;
|
|
1019
|
+
}
|
|
1020
|
+
/** The bound form of {@link AdditionalKeys}: `keys`/`values` are bound (or a
|
|
1021
|
+
* `{ ref }` into the object's `definitions`). */
|
|
1022
|
+
interface BoundAdditionalKeys {
|
|
1023
|
+
keys?: BoundResolver | ResolverRef;
|
|
1024
|
+
values: BoundResolver | ResolverRef;
|
|
1025
|
+
minEntries?: number;
|
|
1026
|
+
maxEntries?: number;
|
|
1027
|
+
keyValueType?: string;
|
|
1028
|
+
valueValueType?: string;
|
|
958
1029
|
}
|
|
959
1030
|
/** A homogeneous list resolved through `items` (bound, or a ref into
|
|
960
1031
|
* `definitions`). */
|
|
@@ -1345,9 +1416,18 @@ interface MethodEntry {
|
|
|
1345
1416
|
* `resolvePlugin` bind this; the surface and registry bind `value`. Absent
|
|
1346
1417
|
* on legacy graph entries (they bind `value`). */
|
|
1347
1418
|
internalValue?: (input: any) => any;
|
|
1419
|
+
/** Produce the import-facing twin for a given call context: with a context,
|
|
1420
|
+
* the twin mints a fresh child per invocation (callee inherits `callId`, sits
|
|
1421
|
+
* one level deeper); without one it is the parent-less `internalValue`.
|
|
1422
|
+
* `buildImports` binds this. Absent on legacy graph entries. */
|
|
1423
|
+
bindInternal?: (ctx?: CallContext) => (...args: any[]) => any;
|
|
1348
1424
|
chain: MiddlewareWrap[];
|
|
1349
1425
|
/** Carried from the descriptor for the registry / CLI / MCP / docs. */
|
|
1350
1426
|
inputSchema?: z.ZodType;
|
|
1427
|
+
/** When true, the method owns its input validation and the boundary passes it
|
|
1428
|
+
* through unparsed; carried so the controller skips its final `safeParse` too
|
|
1429
|
+
* (it still uses `inputSchema` to plan/prompt parameters). */
|
|
1430
|
+
skipInputValidation?: boolean;
|
|
1351
1431
|
meta?: LeafMeta;
|
|
1352
1432
|
/** Resolved output mode; the registry derives presentation from it. */
|
|
1353
1433
|
output?: NormalizedOutput;
|
|
@@ -1592,7 +1672,7 @@ interface CategoryDefinition {
|
|
|
1592
1672
|
/** Plural form of `title`. Auto-derived from the resolved title if omitted. */
|
|
1593
1673
|
titlePlural?: string;
|
|
1594
1674
|
}
|
|
1595
|
-
interface FunctionRegistryEntry
|
|
1675
|
+
interface FunctionRegistryEntry {
|
|
1596
1676
|
name: string;
|
|
1597
1677
|
/**
|
|
1598
1678
|
* Human-readable description of the function. Surfaced wherever the
|
|
@@ -1605,29 +1685,30 @@ interface FunctionRegistryEntry<TSdk = any> {
|
|
|
1605
1685
|
itemType?: string;
|
|
1606
1686
|
returnType?: string;
|
|
1607
1687
|
inputSchema?: z.ZodSchema;
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1688
|
+
/**
|
|
1689
|
+
* When true, the method owns its input validation and its boundary passes the
|
|
1690
|
+
* input through unparsed. The resolution controller reads this to skip its
|
|
1691
|
+
* final `safeParse` (it still uses `inputSchema` to plan/prompt parameters),
|
|
1692
|
+
* so a method routed through the controller isn't re-validated against a
|
|
1693
|
+
* schema it deliberately opts out of. Lifted off the materialized entry.
|
|
1694
|
+
*/
|
|
1695
|
+
skipInputValidation?: boolean;
|
|
1612
1696
|
outputSchema?: z.ZodSchema;
|
|
1613
1697
|
/**
|
|
1614
1698
|
* Ordered input keys the public surface projects onto positional arguments
|
|
1615
1699
|
* (the method's `positional` declaration). Absent when the method takes only
|
|
1616
1700
|
* the canonical single bag. Lifted off the materialized method entry by the
|
|
1617
|
-
* surface builder, like `
|
|
1701
|
+
* surface builder, like `resolvers` — a runtime projection, not
|
|
1618
1702
|
* descriptive meta.
|
|
1619
1703
|
*/
|
|
1620
1704
|
positional?: readonly string[];
|
|
1621
1705
|
categories: string[];
|
|
1622
|
-
resolvers?: Record<string, ResolverMetadata<TSdk, any, any>>;
|
|
1623
1706
|
/**
|
|
1624
|
-
* Per-parameter bound resolvers
|
|
1625
|
-
*
|
|
1626
|
-
*
|
|
1627
|
-
* entry. Additive bridge — populated for migrated `defineMethod` plugins; the
|
|
1628
|
-
* legacy `resolvers` field above stays the source for unmigrated ones.
|
|
1707
|
+
* Per-parameter bound resolvers (imports already captured, called with
|
|
1708
|
+
* `input` only, no sdk). Lifted off the materialized method entry by the
|
|
1709
|
+
* surface builder.
|
|
1629
1710
|
*/
|
|
1630
|
-
|
|
1711
|
+
resolvers?: Record<string, BoundResolver>;
|
|
1631
1712
|
packages?: string[];
|
|
1632
1713
|
/**
|
|
1633
1714
|
* True if the plugin is registered only in the experimental SDK
|
|
@@ -1661,8 +1742,8 @@ interface FunctionDeprecation {
|
|
|
1661
1742
|
/** User-facing deprecation message for why/how to migrate */
|
|
1662
1743
|
message: string;
|
|
1663
1744
|
}
|
|
1664
|
-
interface RegistryResult
|
|
1665
|
-
functions: FunctionRegistryEntry
|
|
1745
|
+
interface RegistryResult {
|
|
1746
|
+
functions: FunctionRegistryEntry[];
|
|
1666
1747
|
categories: {
|
|
1667
1748
|
key: string;
|
|
1668
1749
|
title: string;
|
|
@@ -1767,7 +1848,7 @@ type Sdk<T = {
|
|
|
1767
1848
|
}> = T & {
|
|
1768
1849
|
getRegistry(options?: {
|
|
1769
1850
|
package?: string;
|
|
1770
|
-
}): RegistryResult
|
|
1851
|
+
}): RegistryResult;
|
|
1771
1852
|
};
|
|
1772
1853
|
|
|
1773
1854
|
/**
|
|
@@ -2355,6 +2436,8 @@ declare function defineResolver<const TImports extends ImportsInput = readonly [
|
|
|
2355
2436
|
input: TInput;
|
|
2356
2437
|
}) => PromiseLike<Record<string, Field$1>>;
|
|
2357
2438
|
definitions?: Record<string, Resolver>;
|
|
2439
|
+
/** Open-ended entries whose keys aren't known up front (a `z.record`). */
|
|
2440
|
+
additionalKeys?: AdditionalKeys;
|
|
2358
2441
|
}): ObjectResolver;
|
|
2359
2442
|
declare function defineResolver(config: {
|
|
2360
2443
|
type: "array";
|
|
@@ -2729,7 +2812,7 @@ interface CoreOptions {
|
|
|
2729
2812
|
*/
|
|
2730
2813
|
declare const getRegistryPlugin: MethodPlugin<"getRegistry", {
|
|
2731
2814
|
package?: string | undefined;
|
|
2732
|
-
} | undefined, RegistryResult
|
|
2815
|
+
} | undefined, RegistryResult, readonly []> & LeafSummary<"kitcore", "getRegistry", readonly [PropertyPlugin<"context", SdkContext>]>;
|
|
2733
2816
|
|
|
2734
2817
|
/**
|
|
2735
2818
|
* The external escape-hatch key for an SDK's context. A Symbol,
|
|
@@ -2890,13 +2973,13 @@ type ControllerQuestion = {
|
|
|
2890
2973
|
path: ControllerPath;
|
|
2891
2974
|
message: string;
|
|
2892
2975
|
description?: string;
|
|
2893
|
-
/** Which container
|
|
2894
|
-
*
|
|
2895
|
-
* its fields are fetched
|
|
2896
|
-
*
|
|
2897
|
-
* needs nothing else; this is additive metadata for hosts
|
|
2898
|
-
* containers specially. */
|
|
2899
|
-
container: "array" | "object";
|
|
2976
|
+
/** Which container type this decision is about. `array`/`record` are the
|
|
2977
|
+
* add-another loops; `object` covers both the optional-object gate (fired
|
|
2978
|
+
* BEFORE its fields are fetched: `add` descends, `done` skips it) and the
|
|
2979
|
+
* optional-fields gate. A host that renders `message` + `actions`
|
|
2980
|
+
* generically needs nothing else; this is additive metadata for hosts
|
|
2981
|
+
* that render containers specially. */
|
|
2982
|
+
container: "array" | "object" | "record";
|
|
2900
2983
|
/** Object optionals gate only: the fields the `add` action would walk
|
|
2901
2984
|
* (key + display label + coarse value type), so a smart host can render
|
|
2902
2985
|
* them (or a form section) instead of a blind yes/no. Dumb hosts keep
|
|
@@ -3005,11 +3088,16 @@ interface ControllerState {
|
|
|
3005
3088
|
/** The path of the parameter (or nested field) currently being asked. */
|
|
3006
3089
|
current?: ControllerPath;
|
|
3007
3090
|
/** Which container decision the outstanding `collection` question is, when
|
|
3008
|
-
* `current` points at one
|
|
3009
|
-
*
|
|
3010
|
-
*
|
|
3011
|
-
*
|
|
3012
|
-
|
|
3091
|
+
* `current` points at one, named `<container>_<subject>`: `array_items` and
|
|
3092
|
+
* `record_entries` are the add/done loops; `object_optional` is whether to
|
|
3093
|
+
* provide an optional object at all (fired before its fields are fetched);
|
|
3094
|
+
* `object_optional_properties` is whether to fill that object's optional
|
|
3095
|
+
* fields. `record_key` marks the one bespoke record step (collecting an
|
|
3096
|
+
* entry's key); the value that follows is an ordinary leaf question with no
|
|
3097
|
+
* gate. Recorded explicitly so `step`'s handling never infers the decision
|
|
3098
|
+
* from value presence or resolver shape. Absent when `current` is a plain
|
|
3099
|
+
* leaf question. */
|
|
3100
|
+
gate?: "array_items" | "record_entries" | "record_key" | "object_optional" | "object_optional_properties";
|
|
3013
3101
|
/** Where pagination stands for the current dynamic leaf: coordinates only
|
|
3014
3102
|
* (cursor trail, generation), never items or live iterators — the page's
|
|
3015
3103
|
* items ride the ask's question. */
|
|
@@ -3228,7 +3316,7 @@ type FunctionSdk = {
|
|
|
3228
3316
|
* and `context.core`
|
|
3229
3317
|
* @param options.schema - optional Zod schema for input validation
|
|
3230
3318
|
*/
|
|
3231
|
-
declare function createFunction<TOptions, TResult, TSchemaOptions extends TOptions = TOptions>(coreFn: (options: TOptions) => Promise<TResult>, options: {
|
|
3319
|
+
declare function createFunction<TOptions, TResult, TSchemaOptions extends TOptions = TOptions>(coreFn: (options: TOptions, context?: CallContext) => Promise<TResult>, options: {
|
|
3232
3320
|
sdk: FunctionSdk;
|
|
3233
3321
|
schema?: z.ZodSchema<TSchemaOptions>;
|
|
3234
3322
|
name?: string;
|
|
@@ -3254,7 +3342,7 @@ type ItemType<TResult> = TResult extends {
|
|
|
3254
3342
|
declare function createPaginatedFunction<TUserOptions, TResponse, TItem = ItemType<TResponse>>(coreFn: (options: TUserOptions & {
|
|
3255
3343
|
cursor?: string;
|
|
3256
3344
|
pageSize?: number;
|
|
3257
|
-
}) => Promise<TResponse>, options: {
|
|
3345
|
+
}, context?: CallContext) => Promise<TResponse>, options: {
|
|
3258
3346
|
sdk: FunctionSdk;
|
|
3259
3347
|
schema?: z.ZodSchema<TUserOptions>;
|
|
3260
3348
|
name?: string;
|
|
@@ -7347,7 +7435,7 @@ interface ZapierSdkOptions extends BaseSdkOptions {
|
|
|
7347
7435
|
declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): {
|
|
7348
7436
|
getRegistry: (input?: {
|
|
7349
7437
|
package?: string | undefined;
|
|
7350
|
-
} | undefined) => RegistryResult
|
|
7438
|
+
} | undefined) => RegistryResult;
|
|
7351
7439
|
getProfile: (input?: Record<string, never> | undefined) => Promise<{
|
|
7352
7440
|
data: {
|
|
7353
7441
|
id: string;
|
|
@@ -8792,7 +8880,7 @@ declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): {
|
|
|
8792
8880
|
declare const zapierSdkPlugin: AggregatePlugin<"sdk", {
|
|
8793
8881
|
getRegistry: MethodPlugin<"getRegistry", {
|
|
8794
8882
|
package?: string | undefined;
|
|
8795
|
-
} | undefined, RegistryResult
|
|
8883
|
+
} | undefined, RegistryResult, readonly []> & LeafSummary<"kitcore", "getRegistry", readonly [PropertyPlugin<"context", SdkContext>]>;
|
|
8796
8884
|
} & {
|
|
8797
8885
|
getProfile: MethodPlugin<"getProfile", Record<string, never> | undefined, Promise<{
|
|
8798
8886
|
data: {
|
|
@@ -11555,7 +11643,7 @@ declare const zapierSdkPlugin: AggregatePlugin<"sdk", {
|
|
|
11555
11643
|
declare function createZapierSdk(options?: ZapierSdkOptions): {
|
|
11556
11644
|
getRegistry: (input?: {
|
|
11557
11645
|
package?: string | undefined;
|
|
11558
|
-
} | undefined) => RegistryResult
|
|
11646
|
+
} | undefined) => RegistryResult;
|
|
11559
11647
|
getProfile: (input?: Record<string, never> | undefined) => Promise<{
|
|
11560
11648
|
data: {
|
|
11561
11649
|
id: string;
|