@slates/provider 1.0.0-rc.34 → 1.0.0-rc.35

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/index.cjs CHANGED
@@ -48,6 +48,7 @@ __export(index_exports, {
48
48
  SlateDefaultPollingIntervalSeconds: () => SlateDefaultPollingIntervalSeconds,
49
49
  SlateError: () => SlateError,
50
50
  SlateLogger: () => SlateLogger,
51
+ SlateOptionList: () => SlateOptionList,
51
52
  SlatePublicContext: () => SlatePublicContext,
52
53
  SlatePublicTool: () => SlatePublicTool,
53
54
  SlateSpecification: () => SlateSpecification,
@@ -102,6 +103,7 @@ __export(index_exports, {
102
103
  mergeScopes: () => mergeScopes,
103
104
  metaWebhookHttp: () => metaWebhookHttp,
104
105
  normalizeOAuthTokenResponse: () => normalizeOAuthTokenResponse,
106
+ optionList: () => optionList,
105
107
  parseWithServiceError: () => parseWithServiceError,
106
108
  pickDefined: () => pickDefined,
107
109
  pruneSeenEntries: () => pruneSeenEntries,
@@ -1987,6 +1989,45 @@ var isClause = (value) => typeof value === "object" && value !== null && "OR" in
1987
1989
  var isScopes = (value) => typeof value === "object" && value !== null && "AND" in value && Array.isArray(value.AND);
1988
1990
 
1989
1991
  // src/action/builder.ts
1992
+ var EVENT_ATTRIBUTE_KEY_PATTERN = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;
1993
+ var EVENT_ATTRIBUTE_MAX_KEYS = 8;
1994
+ var checkEventAttributeNames = (fields) => {
1995
+ if (!Array.isArray(fields)) {
1996
+ throw new SlateDeclarationError("Event attributes must be a list of output field names");
1997
+ }
1998
+ if (fields.length > EVENT_ATTRIBUTE_MAX_KEYS) {
1999
+ throw new SlateDeclarationError(
2000
+ `A trigger can declare at most ${EVENT_ATTRIBUTE_MAX_KEYS} event attributes`
2001
+ );
2002
+ }
2003
+ let seen = /* @__PURE__ */ new Set();
2004
+ for (let field of fields) {
2005
+ if (typeof field !== "string" || !EVENT_ATTRIBUTE_KEY_PATTERN.test(field)) {
2006
+ throw new SlateDeclarationError(
2007
+ `Event attribute "${field}" must start with a letter and contain only letters, digits and underscores (at most 64 characters)`
2008
+ );
2009
+ }
2010
+ if (seen.has(field)) {
2011
+ throw new SlateDeclarationError(`Event attribute "${field}" is declared more than once`);
2012
+ }
2013
+ seen.add(field);
2014
+ }
2015
+ };
2016
+ var checkEventAttributeFields = (fields, outputSchema) => {
2017
+ if (outputSchema._zod?.def?.type !== "object") {
2018
+ throw new SlateDeclarationError(
2019
+ "Event attributes require the output schema to be a zod object"
2020
+ );
2021
+ }
2022
+ let shape = outputSchema.shape;
2023
+ for (let field of fields) {
2024
+ if (!Object.hasOwn(shape, field)) {
2025
+ throw new SlateDeclarationError(
2026
+ `Event attribute "${field}" is not a top-level property of the output schema`
2027
+ );
2028
+ }
2029
+ }
2030
+ };
1990
2031
  var SlateActionBuilder = class {
1991
2032
  constructor(type, spec2, params, factory, isPublicTool = false) {
1992
2033
  this.type = type;
@@ -2012,6 +2053,7 @@ var SlateActionBuilder = class {
2012
2053
  #triggerGroup = null;
2013
2054
  #triggerMatches = null;
2014
2055
  #triggerMap = null;
2056
+ #eventAttributes = null;
2015
2057
  #interfaceLocked = false;
2016
2058
  input(schema) {
2017
2059
  if (this.#interfaceLocked) {
@@ -2082,6 +2124,21 @@ var SlateActionBuilder = class {
2082
2124
  this.#triggerMap = handler;
2083
2125
  return this;
2084
2126
  }
2127
+ /**
2128
+ * Returns the values of these top-level output fields with every mapped event, so events
2129
+ * can be filtered by them. Strings, finite numbers, booleans and arrays of those are used.
2130
+ */
2131
+ eventAttributes(fields) {
2132
+ if (this.type !== "trigger") {
2133
+ throw new SlateDeclarationError("eventAttributes can only be set for trigger actions");
2134
+ }
2135
+ checkEventAttributeNames(fields);
2136
+ if (this.#outputSchema) {
2137
+ checkEventAttributeFields(fields, this.#outputSchema);
2138
+ }
2139
+ this.#eventAttributes = [...fields];
2140
+ return this;
2141
+ }
2085
2142
  build() {
2086
2143
  let scopes = this.#scopes ?? this.params.scopes;
2087
2144
  if (scopes) {
@@ -2109,11 +2166,15 @@ var SlateActionBuilder = class {
2109
2166
  if (this.type === "trigger" && !this.#triggerMap) {
2110
2167
  throw new SlateDeclarationError("Trigger map handler is not defined");
2111
2168
  }
2169
+ if (this.#eventAttributes) {
2170
+ checkEventAttributeFields(this.#eventAttributes, this.#outputSchema);
2171
+ }
2112
2172
  let triggerParams = this.type === "trigger" ? {
2113
2173
  type: "trigger",
2114
2174
  triggerGroup: this.#triggerGroup,
2115
2175
  matches: this.#triggerMatches,
2116
- map: this.#triggerMap
2176
+ map: this.#triggerMap,
2177
+ ...this.#eventAttributes?.length ? { eventAttributes: this.#eventAttributes } : {}
2117
2178
  } : null;
2118
2179
  return this.factory({
2119
2180
  ...this.params,
@@ -2185,6 +2246,41 @@ var getFileUrlTool = (spec2, handleGetFileUrl) => tool(spec2, {
2185
2246
  };
2186
2247
  }).build();
2187
2248
 
2249
+ // src/action/optionList.ts
2250
+ var import_zod2 = require("zod");
2251
+ var SlateOptionList = class _SlateOptionList {
2252
+ constructor(_spec, _params, _paramsSchema) {
2253
+ this._spec = _spec;
2254
+ this._params = _params;
2255
+ this._paramsSchema = _paramsSchema;
2256
+ }
2257
+ _spec;
2258
+ _params;
2259
+ _paramsSchema;
2260
+ static create(spec2, params) {
2261
+ let paramsSchema = params.paramsSchema ?? import_zod2.z.object({});
2262
+ if (paramsSchema?._zod?.def?.type !== "object") {
2263
+ throw new SlateDeclarationError(
2264
+ `Option list "${params.key}" params schema must be a zod object`
2265
+ );
2266
+ }
2267
+ return new _SlateOptionList(spec2, params, paramsSchema.strict());
2268
+ }
2269
+ get spec() {
2270
+ return this._spec;
2271
+ }
2272
+ get key() {
2273
+ return this._params.key;
2274
+ }
2275
+ get paramsSchema() {
2276
+ return this._paramsSchema;
2277
+ }
2278
+ get list() {
2279
+ return this._params.list;
2280
+ }
2281
+ };
2282
+ var optionList = (spec2, params) => SlateOptionList.create(spec2, params);
2283
+
2188
2284
  // src/action/publicTool.ts
2189
2285
  var SlatePublicTool = class {
2190
2286
  constructor() {
@@ -2238,11 +2334,13 @@ var SlateTrigger = class _SlateTrigger extends SlateAction {
2238
2334
  #triggerGroup;
2239
2335
  #matches;
2240
2336
  #map;
2337
+ #eventAttributes;
2241
2338
  constructor(spec2, inputSchema, outputSchema, params) {
2242
2339
  super("trigger", spec2, inputSchema, outputSchema, params);
2243
2340
  this.#triggerGroup = params.triggerGroup;
2244
2341
  this.#matches = params.matches;
2245
2342
  this.#map = params.map;
2343
+ this.#eventAttributes = params.eventAttributes ?? [];
2246
2344
  }
2247
2345
  static create(spec2, params) {
2248
2346
  return new SlateActionBuilder("trigger", spec2, params, (params2) => {
@@ -2259,12 +2357,53 @@ var SlateTrigger = class _SlateTrigger extends SlateAction {
2259
2357
  get map() {
2260
2358
  return this.#map;
2261
2359
  }
2360
+ get eventAttributes() {
2361
+ return [...this.#eventAttributes];
2362
+ }
2262
2363
  };
2263
2364
  var trigger = (spec2, params) => SlateTrigger.create(spec2, params);
2264
2365
 
2265
2366
  // src/action/triggerGroup.ts
2266
- var import_zod2 = require("zod");
2367
+ var import_zod3 = require("zod");
2267
2368
  var SlateDefaultPollingIntervalSeconds = 60 * 10;
2369
+ var LINKED_SLATE_PATTERN = /^[^/\s]+\/[^/\s]+$/;
2370
+ var checkSelectionOptions = (field, sources, shape) => {
2371
+ if (!Object.hasOwn(shape, field)) {
2372
+ throw new SlateDeclarationError(
2373
+ `Selection field "${field}" is not a top-level property of the selection schema`
2374
+ );
2375
+ }
2376
+ if (typeof sources !== "object" || sources === null) {
2377
+ throw new SlateDeclarationError(
2378
+ `Selection field "${field}" must be declared as { list, linked }`
2379
+ );
2380
+ }
2381
+ let { list, linked } = sources;
2382
+ if (!list && !linked) {
2383
+ throw new SlateDeclarationError(
2384
+ `Selection field "${field}" needs its own options list, a linked option list, or both`
2385
+ );
2386
+ }
2387
+ if (list !== void 0 && typeof list !== "function") {
2388
+ throw new SlateDeclarationError(`Selection field "${field}" list must be a function`);
2389
+ }
2390
+ if (linked) {
2391
+ if (typeof linked.slate !== "string" || !LINKED_SLATE_PATTERN.test(linked.slate)) {
2392
+ throw new SlateDeclarationError(
2393
+ `Selection field "${field}" links to slate "${linked.slate}", which must be written as <scope>/<name>`
2394
+ );
2395
+ }
2396
+ if (typeof linked.optionList !== "string" || !linked.optionList.trim()) {
2397
+ throw new SlateDeclarationError(
2398
+ `Selection field "${field}" must name the option list it links to`
2399
+ );
2400
+ }
2401
+ }
2402
+ return {
2403
+ ...list ? { list } : {},
2404
+ ...linked ? { linked } : {}
2405
+ };
2406
+ };
2268
2407
  var SlateTriggerGroup = class _SlateTriggerGroup {
2269
2408
  constructor(_spec, _params) {
2270
2409
  this._spec = _spec;
@@ -2291,7 +2430,7 @@ var SlateTriggerGroup = class _SlateTriggerGroup {
2291
2430
  return this._params.metadata;
2292
2431
  }
2293
2432
  get eventSchema() {
2294
- return this._params.eventSchema ?? import_zod2.z.object({}).passthrough();
2433
+ return this._params.eventSchema ?? import_zod3.z.object({}).passthrough();
2295
2434
  }
2296
2435
  get source() {
2297
2436
  return this._params.source;
@@ -2311,6 +2450,9 @@ var SlateTriggerGroup = class _SlateTriggerGroup {
2311
2450
  get routingMatchers() {
2312
2451
  return this._params.routingMatchers;
2313
2452
  }
2453
+ get selectionOptions() {
2454
+ return this._params.selectionOptions ?? {};
2455
+ }
2314
2456
  };
2315
2457
  var SlateTriggerGroupBuilder = class {
2316
2458
  constructor(spec2, params, factory) {
@@ -2326,6 +2468,7 @@ var SlateTriggerGroupBuilder = class {
2326
2468
  #webhook = null;
2327
2469
  #gateway = null;
2328
2470
  #routingMatchers = null;
2471
+ #selectionOptions = {};
2329
2472
  polling(props) {
2330
2473
  if (this.#source) {
2331
2474
  throw new SlateDeclarationError("Trigger group invocation is already defined");
@@ -2397,6 +2540,27 @@ var SlateTriggerGroupBuilder = class {
2397
2540
  this.#routingMatchers = handler;
2398
2541
  return this;
2399
2542
  }
2543
+ /**
2544
+ * Lets the dashboard offer a list for these selection fields instead of a typed-in value.
2545
+ * Each field must be a top-level property of the selection schema, which must be a zod object.
2546
+ * For an array property the listed options are values for its items.
2547
+ */
2548
+ selectionOptions(declarations) {
2549
+ let schema = this.params.selectionSchema;
2550
+ if (!schema) {
2551
+ throw new SlateDeclarationError("Selection options require a selection schema");
2552
+ }
2553
+ if (schema._zod?.def?.type !== "object") {
2554
+ throw new SlateDeclarationError(
2555
+ "Selection options require the selection schema to be a zod object"
2556
+ );
2557
+ }
2558
+ let shape = schema.shape;
2559
+ for (let [field, sources] of Object.entries(declarations)) {
2560
+ this.#selectionOptions[field] = checkSelectionOptions(field, sources, shape);
2561
+ }
2562
+ return this;
2563
+ }
2400
2564
  build() {
2401
2565
  if (!this.#source) {
2402
2566
  throw new SlateDeclarationError(
@@ -2412,7 +2576,8 @@ var SlateTriggerGroupBuilder = class {
2412
2576
  polling: this.#polling ?? void 0,
2413
2577
  webhook: this.#webhook ?? void 0,
2414
2578
  gateway: this.#gateway ?? void 0,
2415
- routingMatchers: this.#routingMatchers
2579
+ routingMatchers: this.#routingMatchers,
2580
+ selectionOptions: this.#selectionOptions
2416
2581
  });
2417
2582
  }
2418
2583
  };
@@ -3171,8 +3336,8 @@ var verifyHmacSignature = (options) => timingSafeStringEqual(createHmacSignature
3171
3336
 
3172
3337
  // src/dedup/index.ts
3173
3338
  var import_crypto2 = require("crypto");
3174
- var import_zod3 = require("zod");
3175
- var seenEntrySchema = import_zod3.z.object({ key: import_zod3.z.string().min(1), at: import_zod3.z.number().finite() });
3339
+ var import_zod4 = require("zod");
3340
+ var seenEntrySchema = import_zod4.z.object({ key: import_zod4.z.string().min(1), at: import_zod4.z.number().finite() });
3176
3341
  var seenEntryKey = (idempotencyKey) => (0, import_crypto2.createHash)("sha256").update(idempotencyKey).digest("base64url").slice(0, 16);
3177
3342
  var pruneSeenEntries = (entries, options) => {
3178
3343
  let kept = [];
@@ -3324,13 +3489,14 @@ var assertNewPageToken = (seen, token, repeated) => {
3324
3489
 
3325
3490
  // src/specification/slate.ts
3326
3491
  var Slate = class _Slate {
3327
- constructor(_spec, _actions, _adapters, _triggerGroups, _toolCategories, _toolCategoryKeysByActionKey) {
3492
+ constructor(_spec, _actions, _adapters, _triggerGroups, _toolCategories, _toolCategoryKeysByActionKey, _optionLists) {
3328
3493
  this._spec = _spec;
3329
3494
  this._actions = _actions;
3330
3495
  this._adapters = _adapters;
3331
3496
  this._triggerGroups = _triggerGroups;
3332
3497
  this._toolCategories = _toolCategories;
3333
3498
  this._toolCategoryKeysByActionKey = _toolCategoryKeysByActionKey;
3499
+ this._optionLists = _optionLists;
3334
3500
  }
3335
3501
  _spec;
3336
3502
  _actions;
@@ -3338,6 +3504,7 @@ var Slate = class _Slate {
3338
3504
  _triggerGroups;
3339
3505
  _toolCategories;
3340
3506
  _toolCategoryKeysByActionKey;
3507
+ _optionLists;
3341
3508
  static create(params) {
3342
3509
  let adapters = params.adapters ?? [];
3343
3510
  let actions = [...params.triggers, ...params.tools];
@@ -3381,6 +3548,16 @@ var Slate = class _Slate {
3381
3548
  `Only one trigger group may use manual webhook registration or a delivery config, but found: ${configuredWebhookTriggerGroups.map((group) => group.key).join(", ")}`
3382
3549
  );
3383
3550
  }
3551
+ let optionLists = params.optionLists ?? [];
3552
+ let seenOptionListKeys = /* @__PURE__ */ new Set();
3553
+ for (let list of optionLists) {
3554
+ if (seenOptionListKeys.has(list.key)) {
3555
+ throw new SlateDeclarationError(
3556
+ `Option list "${list.key}" is registered more than once`
3557
+ );
3558
+ }
3559
+ seenOptionListKeys.add(list.key);
3560
+ }
3384
3561
  let toolCategories = params.toolCategories ?? [];
3385
3562
  let toolCategoryKeysByActionKey = resolveToolCategoryMembership(toolCategories, actions);
3386
3563
  return new _Slate(
@@ -3389,7 +3566,8 @@ var Slate = class _Slate {
3389
3566
  adapters,
3390
3567
  triggerGroups,
3391
3568
  toolCategories,
3392
- toolCategoryKeysByActionKey
3569
+ toolCategoryKeysByActionKey,
3570
+ optionLists
3393
3571
  );
3394
3572
  }
3395
3573
  get spec() {
@@ -3407,6 +3585,9 @@ var Slate = class _Slate {
3407
3585
  get toolCategories() {
3408
3586
  return this._toolCategories ?? [];
3409
3587
  }
3588
+ get optionLists() {
3589
+ return this._optionLists ?? [];
3590
+ }
3410
3591
  // Keys of the tool categories an action belongs to, in declared category order.
3411
3592
  getToolCategoryKeys(actionKey) {
3412
3593
  return [...this._toolCategoryKeysByActionKey?.get(actionKey) ?? []];
@@ -3480,7 +3661,7 @@ var resolveToolCategoryMembership = (toolCategories, actions) => {
3480
3661
  };
3481
3662
 
3482
3663
  // src/specification/specification.ts
3483
- var import_zod4 = __toESM(require("zod"), 1);
3664
+ var import_zod5 = __toESM(require("zod"), 1);
3484
3665
  var SlateSpecification = class _SlateSpecification {
3485
3666
  constructor(_config, _auth, _params) {
3486
3667
  this._config = _config;
@@ -3497,7 +3678,7 @@ var SlateSpecification = class _SlateSpecification {
3497
3678
  return this._config.configSchema;
3498
3679
  }
3499
3680
  get authSchema() {
3500
- return "outputSchema" in this._auth ? this._auth.outputSchema : import_zod4.default.object({});
3681
+ return "outputSchema" in this._auth ? this._auth.outputSchema : import_zod5.default.object({});
3501
3682
  }
3502
3683
  get config() {
3503
3684
  return this._config;
@@ -3602,6 +3783,7 @@ var skipWebhook = (reason, response) => ({
3602
3783
  SlateDefaultPollingIntervalSeconds,
3603
3784
  SlateError,
3604
3785
  SlateLogger,
3786
+ SlateOptionList,
3605
3787
  SlatePublicContext,
3606
3788
  SlatePublicTool,
3607
3789
  SlateSpecification,
@@ -3656,6 +3838,7 @@ var skipWebhook = (reason, response) => ({
3656
3838
  mergeScopes,
3657
3839
  metaWebhookHttp,
3658
3840
  normalizeOAuthTokenResponse,
3841
+ optionList,
3659
3842
  parseWithServiceError,
3660
3843
  pickDefined,
3661
3844
  pruneSeenEntries,
package/dist/index.d.cts CHANGED
@@ -535,6 +535,40 @@ declare let runWithContext: <InputType extends {}, RV>(context: SlatePublicConte
535
535
  declare let getCurrentContext: <ConfigType extends {}, AuthType extends {}, InputType extends {}>() => SlateContext<ConfigType, AuthType, InputType>;
536
536
  declare let getRuntimeInfo: () => Readonly<SlateRuntimeInfo> | null;
537
537
 
538
+ interface SlateOption {
539
+ value: string | number;
540
+ label: string;
541
+ description?: string;
542
+ }
543
+ interface SlateOptionListPage {
544
+ options: SlateOption[];
545
+ nextPageToken?: any | null;
546
+ }
547
+ type SlateOptionListHandler<ConfigType extends {}, AuthType extends {}, ParamsType extends {} = {}> = (context: SlateContext<ConfigType, AuthType, {
548
+ query: string | null;
549
+ pageToken: any | null;
550
+ params: ParamsType;
551
+ }>) => Promise<SlateOptionListPage>;
552
+ interface SlateOptionListParameters<ConfigType extends {}, AuthType extends {}, ParamsSchema extends z$1.ZodObject<any> = z$1.ZodObject<{}>> {
553
+ key: string;
554
+ /** Made strict when declared, so params with a key the schema does not name are rejected. */
555
+ paramsSchema?: ParamsSchema;
556
+ list: SlateOptionListHandler<ConfigType, AuthType, z$1.output<ParamsSchema>>;
557
+ }
558
+ /** A list of options other integrations can link their selection fields to. */
559
+ declare class SlateOptionList<ConfigType extends {}, AuthType extends {}, ParamsSchema extends z$1.ZodObject<any> = z$1.ZodObject<{}>> {
560
+ private readonly _spec;
561
+ private readonly _params;
562
+ private readonly _paramsSchema;
563
+ private constructor();
564
+ static create<ConfigType extends {}, AuthType extends {}, ParamsSchema extends z$1.ZodObject<any> = z$1.ZodObject<{}>>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateOptionListParameters<ConfigType, AuthType, ParamsSchema>): SlateOptionList<ConfigType, AuthType, ParamsSchema>;
565
+ get spec(): SlateSpecification<ConfigType, AuthType>;
566
+ get key(): string;
567
+ get paramsSchema(): z$1.ZodObject<any, z$1.core.$strip>;
568
+ get list(): SlateOptionListHandler<ConfigType, AuthType, z$1.core.output<ParamsSchema>>;
569
+ }
570
+ declare let optionList: <ConfigType extends {}, AuthType extends {}, ParamsSchema extends z$1.ZodObject<any> = z$1.ZodObject<{}>>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateOptionListParameters<ConfigType, AuthType, ParamsSchema>) => SlateOptionList<ConfigType, AuthType, ParamsSchema>;
571
+
538
572
  declare let SlateDefaultPollingIntervalSeconds: number;
539
573
  type SlateTriggerRoutingMatcher = Record<string, any>;
540
574
  type SlateTriggerGroupSelection = Record<string, any>;
@@ -548,6 +582,23 @@ interface SlateWebhookTarget {
548
582
  targetOwnership: SlateWebhookTargetOwnership;
549
583
  }
550
584
  type SlateTriggerGroupRoutingMatchersHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {}>) => Promise<SlateTriggerRoutingMatcher[]>;
585
+ /** Lists the values an account can pick for one selection field. `selection` holds what is entered so far and may be incomplete. */
586
+ type SlateTriggerGroupSelectionOptionsHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
587
+ query: string | null;
588
+ pageToken: any | null;
589
+ selection: SlateTriggerGroupSelection;
590
+ }>) => Promise<SlateOptionListPage>;
591
+ /** An option list exported by another integration, run with that integration's connection for the same account. */
592
+ interface SlateLinkedOptionList {
593
+ /** Registry name of the integration, as `<scope>/<name>`. */
594
+ slate: string;
595
+ optionList: string;
596
+ params?: Record<string, any>;
597
+ }
598
+ interface SlateTriggerGroupSelectionOptionsSources<ConfigType extends {}, AuthType extends {}> {
599
+ list?: SlateTriggerGroupSelectionOptionsHandler<ConfigType, AuthType>;
600
+ linked?: SlateLinkedOptionList;
601
+ }
551
602
  type SlateTriggerGroupPollHandler<ConfigType extends {}, AuthType extends {}> = (context: SlateContext<ConfigType, AuthType, {
552
603
  state: any | null;
553
604
  selection?: SlateTriggerGroupSelection;
@@ -736,6 +787,7 @@ interface SlateTriggerGroupParameters<ConfigType extends {}, AuthType extends {}
736
787
  webhook?: SlateTriggerGroupWebhookParameters<ConfigType, AuthType>;
737
788
  gateway?: SlateTriggerGroupGatewayParameters<ConfigType, AuthType>;
738
789
  routingMatchers: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>;
790
+ selectionOptions?: Record<string, SlateTriggerGroupSelectionOptionsSources<ConfigType, AuthType>>;
739
791
  }
740
792
  declare class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>> {
741
793
  private readonly _spec;
@@ -754,6 +806,7 @@ declare class SlateTriggerGroup<ConfigType extends {}, AuthType extends {}, Inpu
754
806
  get webhook(): SlateTriggerGroupWebhookParameters<ConfigType, AuthType> | undefined;
755
807
  get gateway(): SlateTriggerGroupGatewayParameters<ConfigType, AuthType> | undefined;
756
808
  get routingMatchers(): SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>;
809
+ get selectionOptions(): Record<string, SlateTriggerGroupSelectionOptionsSources<ConfigType, AuthType>>;
757
810
  }
758
811
  declare class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>> {
759
812
  #private;
@@ -776,6 +829,12 @@ declare class SlateTriggerGroupBuilder<ConfigType extends {}, AuthType extends {
776
829
  /** Receive events over a platform-managed persistent connection (e.g. a WebSocket gateway). */
777
830
  gateway(props: SlateTriggerGroupGatewayParameters<ConfigType, AuthType>): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
778
831
  routingMatchers(handler: SlateTriggerGroupRoutingMatchersHandler<ConfigType, AuthType>): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
832
+ /**
833
+ * Lets the dashboard offer a list for these selection fields instead of a typed-in value.
834
+ * Each field must be a top-level property of the selection schema, which must be a zod object.
835
+ * For an array property the listed options are values for its items.
836
+ */
837
+ selectionOptions(declarations: Record<string, SlateTriggerGroupSelectionOptionsSources<ConfigType, AuthType>>): SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
779
838
  build(): SlateTriggerGroup<ConfigType, AuthType, InputType>;
780
839
  }
781
840
  declare let triggerGroup: <ConfigType extends {}, AuthType extends {}, InputType extends {} = Record<string, unknown>>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateTriggerGroupCreateParameters<InputType>) => SlateTriggerGroupBuilder<ConfigType, AuthType, InputType>;
@@ -835,6 +894,7 @@ interface SlateActionParametersTrigger<ConfigType extends {}, AuthType extends {
835
894
  triggerGroup: SlateTriggerGroup<ConfigType, AuthType>;
836
895
  matches: SlateTriggerMatchesHandler;
837
896
  map: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
897
+ eventAttributes?: string[];
838
898
  }
839
899
  type SlateActionParametersAny<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = SlateActionParametersTool<ConfigType, AuthType, InputType, OutputType> | SlateActionParametersTrigger<ConfigType, AuthType, InputType, OutputType>;
840
900
  type SlateActionCreateParameters<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {}> = SlateActionParametersAny<ConfigType, AuthType, InputType, OutputType> & SlateActionParameters & {
@@ -890,6 +950,11 @@ declare class SlateActionBuilder<Type extends SlateActionType, ConfigType extend
890
950
  triggerGroup(group: SlateTriggerGroup<ConfigType, AuthType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
891
951
  matches(handler: SlateTriggerMatchesHandler): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
892
952
  map(handler: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
953
+ /**
954
+ * Returns the values of these top-level output fields with every mapped event, so events
955
+ * can be filtered by them. Strings, finite numbers, booleans and arrays of those are used.
956
+ */
957
+ eventAttributes(fields: (keyof OutputType & string)[]): SlateActionBuilder<Type, ConfigType, AuthType, InputType, OutputType, Result, IsPublic>;
893
958
  build(): Result;
894
959
  }
895
960
 
@@ -970,6 +1035,7 @@ interface SlateTriggerParameters<ConfigType extends {}, AuthType extends {}, Inp
970
1035
  triggerGroup: SlateTriggerGroup<ConfigType, AuthType>;
971
1036
  matches: SlateTriggerMatchesHandler;
972
1037
  map: SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
1038
+ eventAttributes?: string[];
973
1039
  }
974
1040
  declare class SlateTrigger<ConfigType extends {}, AuthType extends {}, InputType extends {}, OutputType extends {
975
1041
  type: string;
@@ -980,6 +1046,7 @@ declare class SlateTrigger<ConfigType extends {}, AuthType extends {}, InputType
980
1046
  get triggerGroup(): SlateTriggerGroup<ConfigType, AuthType, Record<string, unknown>>;
981
1047
  get matches(): SlateTriggerMatchesHandler;
982
1048
  get map(): SlateTriggerMappingHandler<ConfigType, AuthType, InputType, OutputType>;
1049
+ get eventAttributes(): string[];
983
1050
  }
984
1051
  declare let trigger: <ConfigType extends {}, AuthType extends {}>(spec: SlateSpecification<ConfigType, AuthType>, params: SlateActionParameters) => SlateActionBuilder<"trigger", ConfigType, AuthType, {}, {}, SlateTrigger<any, any, any, any>, false>;
985
1052
 
@@ -1263,6 +1330,7 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
1263
1330
  private readonly _triggerGroups;
1264
1331
  private readonly _toolCategories;
1265
1332
  private readonly _toolCategoryKeysByActionKey;
1333
+ private readonly _optionLists;
1266
1334
  private constructor();
1267
1335
  static create<ConfigType extends {}, AuthType extends {}>(params: {
1268
1336
  spec: SlateSpecification<ConfigType, AuthType>;
@@ -1271,12 +1339,14 @@ declare class Slate<ConfigType extends {}, AuthType extends {}> {
1271
1339
  adapters?: SlateAdapter<ConfigType, AuthType>[];
1272
1340
  triggerGroups?: SlateTriggerGroup<ConfigType, AuthType>[];
1273
1341
  toolCategories?: SlateToolCategory[];
1342
+ optionLists?: SlateOptionList<ConfigType, AuthType, any>[];
1274
1343
  }): Slate<ConfigType, AuthType>;
1275
1344
  get spec(): SlateSpecification<ConfigType, AuthType>;
1276
1345
  get actions(): (SlateTrigger<ConfigType, AuthType, any, any> | SlateTool<ConfigType, AuthType, any, any>)[];
1277
1346
  get adapters(): SlateAdapter<ConfigType, AuthType>[];
1278
1347
  get triggerGroups(): SlateTriggerGroup<ConfigType, AuthType, Record<string, unknown>>[];
1279
1348
  get toolCategories(): SlateToolCategory[];
1349
+ get optionLists(): SlateOptionList<ConfigType, AuthType, any>[];
1280
1350
  getToolCategoryKeys(actionKey: string): string[];
1281
1351
  }
1282
1352
 
@@ -1311,4 +1381,4 @@ declare let skipWebhook: (reason: string, response?: Response | SlateWebhookHttp
1311
1381
  response: Response | SlateWebhookHttpResponseInit;
1312
1382
  };
1313
1383
 
1314
- export { API_ERROR_MAX_DETAILS, API_ERROR_MAX_MESSAGE_LENGTH, API_ERROR_TRUNCATED_PLACEHOLDER, AUTH_CONFIG_SECRET_PLACEHOLDER_PREFIX, type ApiErrorBuildHelpers, type ApiErrorDetailOptions, type ApiErrorResponse, type ApiErrorStatus, type ApiErrorTextOptions, type ApiServiceError, type AuthConfigSecretFilter, AuthConfigSecretRedactor, type BoundedApiErrorDetailOptions, type BuildApiServiceErrorOptions, type CreateHmacSignatureOptions, type DecodeApiErrorBodyOptions, GET_FILE_URL_TOOL_ID, type GetFileUrlHandler, type GetFileUrlToolInput, type GetFileUrlToolOutput, type NormalizeOAuthTokenResponseOptions, type OAuthExpiresAtOptions, type OAuthRefreshTokenFallbackMode, type OAuthTokenResponse, type SeenEntry, Slate, SlateAction, SlateActionBuilder, type SlateActionCreateParameters, type SlateActionDocsReference, type SlateActionParameters, type SlateActionParametersAny, type SlateActionParametersTool, type SlateActionParametersTrigger, type SlateActionScopeClause, type SlateActionScopeClauseInput, type SlateActionScopeValue, type SlateActionScopes, type SlateActionScopesInput, type SlateActionType, SlateAdapter, type SlateAdapterCapability, SlateAdapterSpec, type SlateAdapterSpecParameters, type SlateAddAttachmentContent, type SlateAddAttachmentInput, type SlateAttachment, type SlateAttachmentInlineContent, type SlateAttachmentUploadReferenceContent, type SlateAttachmentUrlContent, SlateAuth, type SlateAuthDocsReference, type SlateAuthType, type SlateAuthWithCustomData, type SlateAuthWithNone, type SlateAuthWithOauth, type SlateAuthWithServiceAccount, type SlateAuthWithToken, type SlateAuthenticatedAxiosDefaults, type SlateAxiosDefaults, type SlateAxiosErrorAdapter, type SlateAxiosErrorOptions, SlateConfig, type SlateConfigDocsReference, SlateContext, SlateDeclarationError, SlateDefaultPollingIntervalSeconds, type SlateDirectUploadInput, type SlateDocsReference, SlateError, type SlateErrorInput, type SlateErrorIssue, type SlateErrorKind, type SlateErrorProviderInfo, type SlateErrorResponse, type SlateErrorUpstreamInfo, type SlateGatewayEvent, type SlateLiveInvocationInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type SlateProviderDocsReference, SlatePublicContext, SlatePublicTool, type SlatePublicToolInvocationHandler, type SlatePublicToolParameters, type SlateRuntimeInfo, type SlateServiceErrorData, SlateSpecification, type SlateSpecificationCreateParameters, type SlateSpecificationParameters, SlateTool, SlateToolCategory, type SlateToolCategoryParameters, type SlateToolInvocationHandler, type SlateToolParameters, SlateTrigger, SlateTriggerGroup, SlateTriggerGroupBuilder, type SlateTriggerGroupCreateParameters, type SlateTriggerGroupGatewayConnectHandler, type SlateTriggerGroupGatewayParameters, type SlateTriggerGroupGatewayReceiveHandler, type SlateTriggerGroupParameters, type SlateTriggerGroupPollHandler, type SlateTriggerGroupPollingParameters, type SlateTriggerGroupRoutingMatchersHandler, type SlateTriggerGroupSelection, type SlateTriggerGroupWebhookAutoRegistrationParameters, type SlateTriggerGroupWebhookDeliveryConfigParameters, type SlateTriggerGroupWebhookManualRegistrationParameters, type SlateTriggerGroupWebhookParameters, type SlateTriggerMappingHandler, type SlateTriggerMatchesHandler, type SlateTriggerParameters, type SlateTriggerRoutingMatcher, type SlateTypedDocsReference, type SlateWebhookDeliveryAuthenticateHandler, type SlateWebhookDeliveryAuthentication, type SlateWebhookExpandHandler, type SlateWebhookHttpResponseInit, type SlateWebhookManualFinishHandler, type SlateWebhookManualSetupHandler, type SlateWebhookProcessHandler, type SlateWebhookRegisterHandler, type SlateWebhookRegistrationResult, type SlateWebhookRenewHandler, type SlateWebhookSkipped, type SlateWebhookTarget, type SlateWebhookTargetListHandler, type SlateWebhookTargetOwnership, type SlateWebhookUnregisterHandler, type VerifyHmacSignatureOptions, adapterSpec, allOf, anyOf, assertNewPageToken, auth, axios, buildApiServiceError, collectApiErrorDetails, config, createApiServiceError, createAuthenticatedAxios, createAxios, createBase64Attachment, createHmacSignature, createSlateError, createTextAttachment, createUrlAttachment, decodeApiErrorBody, extractApiErrorMessage, getApiErrorResponse, getApiErrorResponseWithBody, getApiErrorStatus, getBase64ByteLength, getCurrentContext, getFileUrlTool, getFileUrlToolInputSchema, getFileUrlToolOutputSchema, getGraphWebhookValidationResponse, getMetaWebhookVerificationResponse, getOAuthExpiresAtFromExpiresIn, getResponseHeaderValue, getRuntimeInfo, getServiceErrorData, getUpstreamErrorStatus, graphWebhookHttp, inferSlateErrorFromAxios, isApiErrorRecord, isAxiosErrorLike, isServiceErrorData, isUrlEmbeddedCredential, looksLikeHtmlErrorBody, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, metaWebhookHttp, normalizeOAuthTokenResponse, parseWithServiceError, pickDefined, pruneSeenEntries, publicTool, pushBoundedApiErrorDetail, readApiErrorText, redactUrlAttachmentSecrets, rememberPageToken, requestAxios, requestAxiosData, runWithContext, scopeClause, seenEntryKey, seenEntrySchema, setIfDefined, skipWebhook, spec, statusLabelForApiError, timingSafeStringEqual, tool, toolCategory, trigger, triggerGroup, truncateApiErrorMessage, uploadAttachmentDirect, validateScopes, verifyHmacSignature };
1384
+ export { API_ERROR_MAX_DETAILS, API_ERROR_MAX_MESSAGE_LENGTH, API_ERROR_TRUNCATED_PLACEHOLDER, AUTH_CONFIG_SECRET_PLACEHOLDER_PREFIX, type ApiErrorBuildHelpers, type ApiErrorDetailOptions, type ApiErrorResponse, type ApiErrorStatus, type ApiErrorTextOptions, type ApiServiceError, type AuthConfigSecretFilter, AuthConfigSecretRedactor, type BoundedApiErrorDetailOptions, type BuildApiServiceErrorOptions, type CreateHmacSignatureOptions, type DecodeApiErrorBodyOptions, GET_FILE_URL_TOOL_ID, type GetFileUrlHandler, type GetFileUrlToolInput, type GetFileUrlToolOutput, type NormalizeOAuthTokenResponseOptions, type OAuthExpiresAtOptions, type OAuthRefreshTokenFallbackMode, type OAuthTokenResponse, type SeenEntry, Slate, SlateAction, SlateActionBuilder, type SlateActionCreateParameters, type SlateActionDocsReference, type SlateActionParameters, type SlateActionParametersAny, type SlateActionParametersTool, type SlateActionParametersTrigger, type SlateActionScopeClause, type SlateActionScopeClauseInput, type SlateActionScopeValue, type SlateActionScopes, type SlateActionScopesInput, type SlateActionType, SlateAdapter, type SlateAdapterCapability, SlateAdapterSpec, type SlateAdapterSpecParameters, type SlateAddAttachmentContent, type SlateAddAttachmentInput, type SlateAttachment, type SlateAttachmentInlineContent, type SlateAttachmentUploadReferenceContent, type SlateAttachmentUrlContent, SlateAuth, type SlateAuthDocsReference, type SlateAuthType, type SlateAuthWithCustomData, type SlateAuthWithNone, type SlateAuthWithOauth, type SlateAuthWithServiceAccount, type SlateAuthWithToken, type SlateAuthenticatedAxiosDefaults, type SlateAxiosDefaults, type SlateAxiosErrorAdapter, type SlateAxiosErrorOptions, SlateConfig, type SlateConfigDocsReference, SlateContext, SlateDeclarationError, SlateDefaultPollingIntervalSeconds, type SlateDirectUploadInput, type SlateDocsReference, SlateError, type SlateErrorInput, type SlateErrorIssue, type SlateErrorKind, type SlateErrorProviderInfo, type SlateErrorResponse, type SlateErrorUpstreamInfo, type SlateGatewayEvent, type SlateLinkedOptionList, type SlateLiveInvocationInfo, type SlateLogEntry, type SlateLogFields, type SlateLogListener, type SlateLogMessageInput, type SlateLogType, SlateLogger, type SlateOption, SlateOptionList, type SlateOptionListHandler, type SlateOptionListPage, type SlateOptionListParameters, type SlateProviderDocsReference, SlatePublicContext, SlatePublicTool, type SlatePublicToolInvocationHandler, type SlatePublicToolParameters, type SlateRuntimeInfo, type SlateServiceErrorData, SlateSpecification, type SlateSpecificationCreateParameters, type SlateSpecificationParameters, SlateTool, SlateToolCategory, type SlateToolCategoryParameters, type SlateToolInvocationHandler, type SlateToolParameters, SlateTrigger, SlateTriggerGroup, SlateTriggerGroupBuilder, type SlateTriggerGroupCreateParameters, type SlateTriggerGroupGatewayConnectHandler, type SlateTriggerGroupGatewayParameters, type SlateTriggerGroupGatewayReceiveHandler, type SlateTriggerGroupParameters, type SlateTriggerGroupPollHandler, type SlateTriggerGroupPollingParameters, type SlateTriggerGroupRoutingMatchersHandler, type SlateTriggerGroupSelection, type SlateTriggerGroupSelectionOptionsHandler, type SlateTriggerGroupSelectionOptionsSources, type SlateTriggerGroupWebhookAutoRegistrationParameters, type SlateTriggerGroupWebhookDeliveryConfigParameters, type SlateTriggerGroupWebhookManualRegistrationParameters, type SlateTriggerGroupWebhookParameters, type SlateTriggerMappingHandler, type SlateTriggerMatchesHandler, type SlateTriggerParameters, type SlateTriggerRoutingMatcher, type SlateTypedDocsReference, type SlateWebhookDeliveryAuthenticateHandler, type SlateWebhookDeliveryAuthentication, type SlateWebhookExpandHandler, type SlateWebhookHttpResponseInit, type SlateWebhookManualFinishHandler, type SlateWebhookManualSetupHandler, type SlateWebhookProcessHandler, type SlateWebhookRegisterHandler, type SlateWebhookRegistrationResult, type SlateWebhookRenewHandler, type SlateWebhookSkipped, type SlateWebhookTarget, type SlateWebhookTargetListHandler, type SlateWebhookTargetOwnership, type SlateWebhookUnregisterHandler, type VerifyHmacSignatureOptions, adapterSpec, allOf, anyOf, assertNewPageToken, auth, axios, buildApiServiceError, collectApiErrorDetails, config, createApiServiceError, createAuthenticatedAxios, createAxios, createBase64Attachment, createHmacSignature, createSlateError, createTextAttachment, createUrlAttachment, decodeApiErrorBody, extractApiErrorMessage, getApiErrorResponse, getApiErrorResponseWithBody, getApiErrorStatus, getBase64ByteLength, getCurrentContext, getFileUrlTool, getFileUrlToolInputSchema, getFileUrlToolOutputSchema, getGraphWebhookValidationResponse, getMetaWebhookVerificationResponse, getOAuthExpiresAtFromExpiresIn, getResponseHeaderValue, getRuntimeInfo, getServiceErrorData, getUpstreamErrorStatus, graphWebhookHttp, inferSlateErrorFromAxios, isApiErrorRecord, isAxiosErrorLike, isServiceErrorData, isUrlEmbeddedCredential, looksLikeHtmlErrorBody, mapServiceErrorCode, mapServiceErrorToSlateErrorInput, mergeScopes, metaWebhookHttp, normalizeOAuthTokenResponse, optionList, parseWithServiceError, pickDefined, pruneSeenEntries, publicTool, pushBoundedApiErrorDetail, readApiErrorText, redactUrlAttachmentSecrets, rememberPageToken, requestAxios, requestAxiosData, runWithContext, scopeClause, seenEntryKey, seenEntrySchema, setIfDefined, skipWebhook, spec, statusLabelForApiError, timingSafeStringEqual, tool, toolCategory, trigger, triggerGroup, truncateApiErrorMessage, uploadAttachmentDirect, validateScopes, verifyHmacSignature };