@zapier/zapier-sdk 0.9.0 → 0.10.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.
Files changed (174) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +7 -7
  3. package/dist/api/client.d.ts.map +1 -1
  4. package/dist/api/client.js +14 -0
  5. package/dist/api/debug.d.ts +1 -0
  6. package/dist/api/debug.d.ts.map +1 -1
  7. package/dist/api/debug.js +42 -1
  8. package/dist/api/debug.test.d.ts +2 -0
  9. package/dist/api/debug.test.d.ts.map +1 -0
  10. package/dist/api/debug.test.js +59 -0
  11. package/dist/api/schemas.d.ts +451 -251
  12. package/dist/api/schemas.d.ts.map +1 -1
  13. package/dist/api/schemas.js +51 -29
  14. package/dist/index.cjs +834 -563
  15. package/dist/index.d.mts +2287 -2085
  16. package/dist/index.d.ts +2 -3
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +2 -3
  19. package/dist/index.mjs +832 -557
  20. package/dist/plugins/findFirstAuthentication/index.d.ts +1 -1
  21. package/dist/plugins/findFirstAuthentication/index.d.ts.map +1 -1
  22. package/dist/plugins/findFirstAuthentication/index.js +9 -1
  23. package/dist/plugins/findFirstAuthentication/index.test.js +3 -4
  24. package/dist/plugins/findFirstAuthentication/schemas.d.ts +5 -3
  25. package/dist/plugins/findFirstAuthentication/schemas.d.ts.map +1 -1
  26. package/dist/plugins/findUniqueAuthentication/index.d.ts.map +1 -1
  27. package/dist/plugins/findUniqueAuthentication/index.js +4 -0
  28. package/dist/plugins/findUniqueAuthentication/schemas.d.ts +5 -3
  29. package/dist/plugins/findUniqueAuthentication/schemas.d.ts.map +1 -1
  30. package/dist/plugins/getAction/index.d.ts.map +1 -1
  31. package/dist/plugins/getAction/index.js +10 -0
  32. package/dist/plugins/getAction/schemas.d.ts +5 -3
  33. package/dist/plugins/getAction/schemas.d.ts.map +1 -1
  34. package/dist/plugins/getApp/index.d.ts.map +1 -1
  35. package/dist/plugins/getApp/index.js +8 -0
  36. package/dist/plugins/getApp/index.test.js +2 -2
  37. package/dist/plugins/getApp/schemas.d.ts +3 -1
  38. package/dist/plugins/getApp/schemas.d.ts.map +1 -1
  39. package/dist/plugins/getApp/schemas.js +2 -4
  40. package/dist/plugins/getAuthentication/index.d.ts.map +1 -1
  41. package/dist/plugins/getAuthentication/index.js +8 -0
  42. package/dist/plugins/getProfile/index.d.ts.map +1 -1
  43. package/dist/plugins/getProfile/index.js +4 -0
  44. package/dist/plugins/getProfile/schemas.d.ts.map +1 -1
  45. package/dist/plugins/getProfile/schemas.js +4 -3
  46. package/dist/plugins/listActions/index.d.ts.map +1 -1
  47. package/dist/plugins/listActions/index.js +9 -0
  48. package/dist/plugins/listActions/schemas.d.ts +5 -3
  49. package/dist/plugins/listActions/schemas.d.ts.map +1 -1
  50. package/dist/plugins/listActions/schemas.js +2 -4
  51. package/dist/plugins/listApps/index.d.ts.map +1 -1
  52. package/dist/plugins/listApps/index.js +4 -0
  53. package/dist/plugins/listApps/index.test.js +1 -1
  54. package/dist/plugins/listApps/schemas.d.ts.map +1 -1
  55. package/dist/plugins/listApps/schemas.js +3 -9
  56. package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
  57. package/dist/plugins/listAuthentications/index.js +8 -0
  58. package/dist/plugins/listAuthentications/schemas.d.ts +5 -3
  59. package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -1
  60. package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
  61. package/dist/plugins/listInputFieldChoices/index.js +14 -2
  62. package/dist/plugins/listInputFieldChoices/schemas.d.ts +5 -3
  63. package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +1 -1
  64. package/dist/plugins/listInputFieldChoices/schemas.js +10 -19
  65. package/dist/plugins/listInputFields/index.d.ts.map +1 -1
  66. package/dist/plugins/listInputFields/index.js +14 -2
  67. package/dist/plugins/listInputFields/index.test.js +5 -9
  68. package/dist/plugins/listInputFields/schemas.d.ts +5 -3
  69. package/dist/plugins/listInputFields/schemas.d.ts.map +1 -1
  70. package/dist/plugins/registry/index.d.ts.map +1 -1
  71. package/dist/plugins/registry/index.js +8 -2
  72. package/dist/plugins/request/index.d.ts.map +1 -1
  73. package/dist/plugins/request/index.js +1 -0
  74. package/dist/plugins/runAction/index.d.ts.map +1 -1
  75. package/dist/plugins/runAction/index.js +12 -0
  76. package/dist/plugins/runAction/schemas.d.ts +5 -3
  77. package/dist/plugins/runAction/schemas.d.ts.map +1 -1
  78. package/dist/resolvers/actionKey.d.ts +13 -7
  79. package/dist/resolvers/actionKey.d.ts.map +1 -1
  80. package/dist/resolvers/actionType.d.ts +8 -7
  81. package/dist/resolvers/actionType.d.ts.map +1 -1
  82. package/dist/resolvers/appKey.d.ts +2 -6
  83. package/dist/resolvers/appKey.d.ts.map +1 -1
  84. package/dist/resolvers/authenticationId.d.ts +7 -7
  85. package/dist/resolvers/authenticationId.d.ts.map +1 -1
  86. package/dist/resolvers/authenticationId.js +16 -7
  87. package/dist/resolvers/index.d.ts +3 -35
  88. package/dist/resolvers/index.d.ts.map +1 -1
  89. package/dist/resolvers/index.js +4 -87
  90. package/dist/resolvers/inputFieldKey.d.ts +11 -0
  91. package/dist/resolvers/inputFieldKey.d.ts.map +1 -0
  92. package/dist/resolvers/inputFieldKey.js +23 -0
  93. package/dist/resolvers/inputs.d.ts +11 -6
  94. package/dist/resolvers/inputs.d.ts.map +1 -1
  95. package/dist/resolvers/inputs.js +17 -0
  96. package/dist/schemas/Action.d.ts +8 -8
  97. package/dist/schemas/Action.d.ts.map +1 -1
  98. package/dist/schemas/Action.js +8 -3
  99. package/dist/schemas/App.d.ts +183 -11
  100. package/dist/schemas/App.d.ts.map +1 -1
  101. package/dist/schemas/App.js +7 -9
  102. package/dist/schemas/Auth.d.ts +12 -12
  103. package/dist/schemas/Auth.js +1 -1
  104. package/dist/schemas/Field.d.ts +5 -98
  105. package/dist/schemas/Field.d.ts.map +1 -1
  106. package/dist/schemas/Field.js +24 -52
  107. package/dist/schemas/Run.d.ts +3 -0
  108. package/dist/schemas/Run.d.ts.map +1 -0
  109. package/dist/schemas/Run.js +31 -0
  110. package/dist/schemas/UserProfile.d.ts +11 -11
  111. package/dist/schemas/UserProfile.d.ts.map +1 -1
  112. package/dist/schemas/UserProfile.js +21 -7
  113. package/dist/sdk.d.ts +11 -4
  114. package/dist/sdk.d.ts.map +1 -1
  115. package/dist/types/plugin.d.ts +5 -0
  116. package/dist/types/plugin.d.ts.map +1 -1
  117. package/dist/types/properties.d.ts +3 -1
  118. package/dist/types/properties.d.ts.map +1 -1
  119. package/dist/types/sdk.d.ts +5 -0
  120. package/dist/types/sdk.d.ts.map +1 -1
  121. package/dist/utils/domain-utils.d.ts +1 -16
  122. package/dist/utils/domain-utils.d.ts.map +1 -1
  123. package/dist/utils/domain-utils.js +7 -51
  124. package/dist/utils/schema-utils.d.ts +44 -21
  125. package/dist/utils/schema-utils.d.ts.map +1 -1
  126. package/dist/utils/schema-utils.js +17 -11
  127. package/package.json +1 -1
  128. package/src/api/client.ts +12 -0
  129. package/src/api/debug.test.ts +76 -0
  130. package/src/api/debug.ts +46 -2
  131. package/src/api/schemas.ts +51 -29
  132. package/src/index.ts +4 -5
  133. package/src/plugins/findFirstAuthentication/index.test.ts +8 -5
  134. package/src/plugins/findFirstAuthentication/index.ts +14 -2
  135. package/src/plugins/findUniqueAuthentication/index.ts +4 -0
  136. package/src/plugins/getAction/index.ts +14 -0
  137. package/src/plugins/getApp/index.test.ts +2 -2
  138. package/src/plugins/getApp/index.ts +8 -0
  139. package/src/plugins/getApp/schemas.ts +7 -12
  140. package/src/plugins/getAuthentication/index.ts +8 -0
  141. package/src/plugins/getProfile/index.ts +4 -0
  142. package/src/plugins/getProfile/schemas.ts +4 -6
  143. package/src/plugins/listActions/index.ts +9 -0
  144. package/src/plugins/listActions/schemas.ts +20 -25
  145. package/src/plugins/listApps/index.test.ts +1 -1
  146. package/src/plugins/listApps/index.ts +4 -0
  147. package/src/plugins/listApps/schemas.ts +17 -26
  148. package/src/plugins/listAuthentications/index.ts +8 -0
  149. package/src/plugins/listInputFieldChoices/index.ts +21 -1
  150. package/src/plugins/listInputFieldChoices/schemas.ts +61 -76
  151. package/src/plugins/listInputFields/index.test.ts +5 -9
  152. package/src/plugins/listInputFields/index.ts +20 -2
  153. package/src/plugins/registry/index.ts +8 -2
  154. package/src/plugins/request/index.ts +1 -0
  155. package/src/plugins/runAction/index.ts +18 -0
  156. package/src/resolvers/actionKey.ts +15 -13
  157. package/src/resolvers/actionType.ts +10 -12
  158. package/src/resolvers/appKey.ts +2 -6
  159. package/src/resolvers/authenticationId.ts +25 -19
  160. package/src/resolvers/index.ts +7 -113
  161. package/src/resolvers/inputFieldKey.ts +38 -0
  162. package/src/resolvers/inputs.ts +28 -10
  163. package/src/schemas/Action.ts +8 -3
  164. package/src/schemas/App.ts +7 -9
  165. package/src/schemas/Auth.ts +1 -1
  166. package/src/schemas/Field.ts +24 -57
  167. package/src/schemas/Run.ts +40 -0
  168. package/src/schemas/UserProfile.ts +24 -7
  169. package/src/sdk.ts +17 -7
  170. package/src/types/plugin.ts +5 -0
  171. package/src/types/sdk.ts +5 -0
  172. package/src/utils/domain-utils.ts +9 -67
  173. package/src/utils/schema-utils.ts +96 -44
  174. package/tsconfig.tsbuildinfo +1 -1
package/dist/index.mjs CHANGED
@@ -3,19 +3,22 @@ import { setTimeout } from 'timers/promises';
3
3
 
4
4
  // src/types/properties.ts
5
5
  function withFormatter(schema, formatMeta) {
6
- schema._def.formatMeta = formatMeta;
6
+ Object.assign(schema._def, {
7
+ formatMeta
8
+ });
7
9
  return schema;
8
10
  }
9
- function withOutputSchema(inputSchema, outputSchema) {
10
- inputSchema._def.outputSchema = outputSchema;
11
- return inputSchema;
12
- }
13
11
  function withPositional(schema) {
14
- schema._def.positionalMeta = { positional: true };
12
+ Object.assign(schema._def, {
13
+ positionalMeta: { positional: true }
14
+ });
15
15
  return schema;
16
16
  }
17
+ function schemaHasPositionalMeta(schema) {
18
+ return "positionalMeta" in schema._def;
19
+ }
17
20
  function isPositional(schema) {
18
- if (schema._def.positionalMeta?.positional) {
21
+ if (schemaHasPositionalMeta(schema) && schema._def.positionalMeta?.positional) {
19
22
  return true;
20
23
  }
21
24
  if (schema instanceof z.ZodOptional) {
@@ -602,243 +605,14 @@ function createPaginatedFunction(coreFn, schema) {
602
605
  };
603
606
  return namedFunctions[functionName];
604
607
  }
605
- var AppItemSchema = withFormatter(
606
- z.object({
607
- // Essential properties only
608
- title: z.string(),
609
- // Mapped from name
610
- key: z.string(),
611
- // Mapped from selected_api
612
- current_implementation_id: z.string(),
613
- // From id, keeps the full version
614
- version: z.string().optional(),
615
- // Extracted from implementation ID
616
- description: z.string().optional(),
617
- slug: z.string().optional()
618
- }),
619
- {
620
- format: (item) => {
621
- return {
622
- title: item.title,
623
- subtitle: `(${item.key})`,
624
- details: []
625
- };
626
- }
627
- }
628
- );
629
-
630
- // src/plugins/listApps/schemas.ts
631
- var ListAppsSchema = withOutputSchema(
632
- z.object({
633
- appKeys: z.array(z.string()).optional().describe(
634
- "Filter apps by app keys (e.g., 'SlackCLIAPI' or slug like 'github')"
635
- ),
636
- search: z.string().optional().describe("Search for apps by name"),
637
- pageSize: z.number().min(1).optional().describe("Number of apps per page"),
638
- maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages")
639
- }).describe("List all available apps with optional filtering"),
640
- AppItemSchema
641
- );
642
-
643
- // src/utils/domain-utils.ts
644
- function splitVersionedKey(versionedKey) {
645
- const parts = versionedKey.split("@");
646
- if (parts.length >= 2) {
647
- const baseKey = parts[0];
648
- const version = parts.slice(1).join("@");
649
- return [baseKey, version];
650
- }
651
- return [versionedKey, void 0];
652
- }
653
- function normalizeImplementationMetaToAppItem(implementationMeta) {
654
- const [selectedApi, appVersion] = splitVersionedKey(implementationMeta.id);
655
- return {
656
- title: implementationMeta.name,
657
- key: selectedApi,
658
- current_implementation_id: implementationMeta.id,
659
- // Keep the full versioned ID
660
- version: appVersion,
661
- // Extract version separately
662
- slug: implementationMeta.slug
663
- };
664
- }
665
- function normalizeAuthenticationItem(auth, options = {}) {
666
- let appKey = options.app_key;
667
- let version = options.version;
668
- if (auth.selected_api) {
669
- const [extractedAppKey, extractedVersion] = splitVersionedKey(
670
- auth.selected_api
671
- );
672
- if (!appKey) {
673
- appKey = extractedAppKey;
674
- }
675
- if (!version) {
676
- version = extractedVersion;
677
- }
678
- }
679
- const {
680
- selected_api: selectedApi,
681
- customuser_id: userId,
682
- ...restOfAuth
683
- } = auth;
684
- return {
685
- ...restOfAuth,
686
- // Pass through all other API response fields except selected_api
687
- implementation_id: selectedApi,
688
- // Rename selected_api to implementation_id
689
- title: auth.title || auth.label || void 0,
690
- // Coerce title from label if missing
691
- is_expired: auth.is_stale,
692
- // Map is_stale to is_expired
693
- expired_at: auth.marked_stale_at,
694
- // Map marked_stale_at to expired_at
695
- app_key: appKey,
696
- // App key from implementations endpoint or parsed from selected_api
697
- version,
698
- // Version from selected_api or provided
699
- user_id: userId
700
- // Map customuser_id to user_id
701
- };
702
- }
703
- function normalizeActionItem(action) {
704
- const { name, type, selected_api: appKey, ...restOfAction } = action;
705
- return {
706
- ...restOfAction,
707
- app_key: appKey || "",
708
- action_type: type,
709
- title: name,
710
- // Map name to title
711
- type: "action"
712
- };
713
- }
714
- function isSlug(slug) {
715
- return !!slug.match(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);
716
- }
717
- function isSnakeCasedSlug(slug) {
718
- if (slug.match(/^_[0-9]/)) {
719
- slug = slug.slice(1);
720
- }
721
- return !!slug.match(/^[a-z0-9]+(?:_[a-z0-9]+)*$/);
722
- }
723
- function dashifySnakeCasedSlug(slug) {
724
- if (!isSnakeCasedSlug(slug)) {
725
- return slug;
726
- }
727
- if (slug.startsWith("_")) {
728
- slug = slug.slice(1);
729
- }
730
- return slug.replace(/_/g, "-");
731
- }
732
- function isUuid(appKey) {
733
- return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(
734
- appKey
735
- );
736
- }
737
- function toAppLocator(appKey) {
738
- const [appKeyWithoutVersion, version] = splitVersionedKey(appKey);
739
- if (isUuid(appKeyWithoutVersion)) {
740
- throw new Error(
741
- `UUID app keys are not supported. Use app slug or implementation ID instead of: ${appKey}`
742
- );
743
- }
744
- const slug = isSlug(appKeyWithoutVersion) ? appKeyWithoutVersion : isSnakeCasedSlug(appKeyWithoutVersion) ? dashifySnakeCasedSlug(appKeyWithoutVersion) : void 0;
745
- return {
746
- lookupAppKey: appKeyWithoutVersion,
747
- slug,
748
- implementationName: slug ? void 0 : appKeyWithoutVersion,
749
- version
750
- };
751
- }
752
- function isResolvedAppLocator(appLocator) {
753
- return !!appLocator.implementationName;
754
- }
755
- function toImplementationId(appLocator) {
756
- return `${appLocator.implementationName}@${appLocator.version || "latest"}`;
757
- }
758
-
759
- // src/plugins/listApps/index.ts
760
- var listAppsPlugin = ({ context }) => {
761
- const listApps = createPaginatedFunction(async function listAppsPage(options) {
762
- const api = context.api;
763
- const opts = options;
764
- const appLocators = await context.resolveAppKeys({
765
- appKeys: [...opts.appKeys ?? []]
766
- });
767
- const implementationNameToLocator = {};
768
- for (const locator of appLocators) {
769
- implementationNameToLocator[locator.implementationName] = [
770
- ...implementationNameToLocator[locator.implementationName] ?? [],
771
- locator
772
- ];
773
- }
774
- const duplicatedLookupAppKeys = Object.keys(implementationNameToLocator).filter((key) => implementationNameToLocator[key].length > 1).map((key) => implementationNameToLocator[key]).flat().map((locator) => locator.lookupAppKey);
775
- if (duplicatedLookupAppKeys.length > 0) {
776
- throw new Error(
777
- `Duplicate lookup app keys found: ${duplicatedLookupAppKeys.join(", ")}`
778
- );
779
- }
780
- if (opts.search) {
781
- const searchParams2 = {};
782
- searchParams2.term = opts.search;
783
- const searchEnvelope = await api.get(
784
- "/api/v4/implementations-meta/search/",
785
- {
786
- searchParams: searchParams2
787
- }
788
- );
789
- const implementations = searchEnvelope.results.map(
790
- normalizeImplementationMetaToAppItem
791
- );
792
- const implementationNameSet = new Set(
793
- appLocators.map((locator) => locator.implementationName)
794
- );
795
- for (const implementation of implementations) {
796
- const [implementationName] = splitVersionedKey(implementation.key);
797
- if (!implementationNameSet.has(implementationName)) {
798
- implementationNameSet.add(implementationName);
799
- appLocators.push({
800
- ...toAppLocator(implementation.key),
801
- implementationName
802
- });
803
- }
804
- }
805
- }
806
- const searchParams = {};
807
- if (opts.pageSize) {
808
- searchParams.limit = opts.pageSize.toString();
809
- }
810
- if (appLocators.length === 0) {
811
- searchParams.latest_only = "true";
812
- }
813
- if (opts.cursor) {
814
- searchParams.offset = opts.cursor;
815
- }
816
- searchParams.selected_apis = appLocators.map((locator) => toImplementationId(locator)).join(",");
817
- const implementationsEnvelope = await api.get(
818
- "/api/v4/implementations-meta/lookup/",
819
- {
820
- searchParams
821
- }
822
- );
823
- return {
824
- data: implementationsEnvelope.results.map(
825
- normalizeImplementationMetaToAppItem
826
- ),
827
- nextCursor: extractCursor(implementationsEnvelope)
828
- };
829
- }, ListAppsSchema);
830
- return {
831
- listApps,
832
- context: {
833
- meta: {
834
- listApps: {
835
- categories: ["app"],
836
- inputSchema: ListAppsSchema
837
- }
838
- }
839
- }
840
- };
841
- };
608
+ var ListAppsSchema = z.object({
609
+ appKeys: z.array(z.string()).optional().describe(
610
+ "Filter apps by app keys (e.g., 'SlackCLIAPI' or slug like 'github')"
611
+ ),
612
+ search: z.string().optional().describe("Search for apps by name"),
613
+ pageSize: z.number().min(1).optional().describe("Number of apps per page"),
614
+ maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages")
615
+ }).describe("List all available apps with optional filtering");
842
616
  var NeedChoicesSchema = z.object({
843
617
  key: z.string().optional(),
844
618
  label: z.string().optional(),
@@ -938,7 +712,7 @@ z.object({
938
712
  choices: z.array(ChoiceSchema).optional()
939
713
  });
940
714
  z.object({
941
- data: z.array(z.any())
715
+ data: z.array(z.unknown())
942
716
  });
943
717
  var ActionFieldChoiceSchema = z.object({
944
718
  value: z.union([z.string(), z.number()]),
@@ -1028,9 +802,9 @@ var UserProfileSchema = z.object({
1028
802
  enable_totp_2fa: z.boolean(),
1029
803
  viewed_help: z.record(z.boolean()),
1030
804
  show_editor_migration_mesaging: z.boolean(),
1031
- switches: z.record(z.any()),
1032
- organizations: z.array(z.any().nullable()),
1033
- primary_organization: z.any().nullable(),
805
+ switches: z.record(z.unknown()),
806
+ organizations: z.array(z.record(z.unknown()).nullable()),
807
+ primary_organization: z.record(z.unknown()).nullable(),
1034
808
  has_active_zaps: z.boolean(),
1035
809
  has_google_sso: z.boolean(),
1036
810
  auth_realm: z.string(),
@@ -1046,8 +820,8 @@ z.object({
1046
820
  api_docs_url: z.string().nullable().optional(),
1047
821
  app_profile_url: z.string(),
1048
822
  banner: z.string().optional(),
1049
- categories: z.array(z.any()).optional(),
1050
- // TODO: Define proper service_category type
823
+ categories: z.array(z.string()).optional(),
824
+ // Service category names
1051
825
  canonical_id: z.string().optional(),
1052
826
  current_implementation_id: z.string(),
1053
827
  days_since_last_update: z.string().optional(),
@@ -1098,7 +872,7 @@ z.object({
1098
872
  action: z.string(),
1099
873
  type_of: z.string(),
1100
874
  authentication_id: z.number().optional(),
1101
- params: z.record(z.any()).optional()
875
+ params: z.record(z.unknown()).optional()
1102
876
  });
1103
877
  z.object({
1104
878
  success: z.boolean(),
@@ -1134,18 +908,11 @@ z.object({
1134
908
  });
1135
909
  var ImplementationMetaSchema = z.object({
1136
910
  id: z.string(),
1137
- // e.g. "ZapierFormatterCLIAPI@1.0.7"
911
+ // e.g. "100HiresCLIAPI@1.2.1"
1138
912
  name: z.string(),
1139
913
  slug: z.string(),
1140
- images: z.object({
1141
- url_16x16: z.string().optional(),
1142
- url_32x32: z.string().optional(),
1143
- url_64x64: z.string().optional(),
1144
- url_128x128: z.string().optional()
1145
- }).optional(),
1146
- // Include other fields for completeness but we'll only use what we need
1147
- ageInDays: z.union([z.string(), z.number()]).optional(),
1148
- authType: z.string().nullable().optional(),
914
+ age_in_days: z.number().optional(),
915
+ auth_type: z.string().optional(),
1149
916
  banner: z.string().optional(),
1150
917
  categories: z.array(
1151
918
  z.object({
@@ -1154,18 +921,45 @@ var ImplementationMetaSchema = z.object({
1154
921
  slug: z.string()
1155
922
  })
1156
923
  ).optional(),
1157
- isBeta: z.boolean().optional(),
1158
- isBuiltIn: z.boolean().optional(),
1159
- isDeprecated: z.boolean().optional(),
1160
- isFeatured: z.boolean().optional(),
1161
- isHidden: z.boolean().optional(),
1162
- isInvite: z.boolean().optional(),
1163
- isPremium: z.boolean().optional(),
1164
- isPublic: z.boolean().optional(),
1165
- isUpcoming: z.boolean().optional(),
924
+ images: z.object({
925
+ url_16x16: z.string().optional(),
926
+ url_32x32: z.string().optional(),
927
+ url_64x64: z.string().optional(),
928
+ url_128x128: z.string().optional()
929
+ }).optional(),
1166
930
  popularity: z.number().optional(),
1167
- apiDocsUrl: z.string().optional(),
1168
- classification: z.string().optional()
931
+ has_filters: z.boolean().optional(),
932
+ has_reads: z.boolean().optional(),
933
+ has_searches: z.boolean().optional(),
934
+ has_searches_or_writes: z.boolean().optional(),
935
+ has_upfront_fields: z.boolean().optional(),
936
+ has_writes: z.boolean().optional(),
937
+ is_beta: z.boolean().optional(),
938
+ is_built_in: z.boolean().optional(),
939
+ is_deprecated: z.boolean().optional(),
940
+ is_featured: z.boolean().optional(),
941
+ is_hidden: z.boolean().optional(),
942
+ is_invite: z.boolean().optional(),
943
+ is_premium: z.boolean().optional(),
944
+ is_public: z.boolean().optional(),
945
+ is_upcoming: z.boolean().optional(),
946
+ version: z.string().optional(),
947
+ visibility: z.string().optional(),
948
+ actions: z.object({
949
+ read: z.number().optional(),
950
+ read_bulk: z.number().optional(),
951
+ write: z.number().optional(),
952
+ search: z.number().optional(),
953
+ search_or_write: z.number().optional(),
954
+ search_and_write: z.number().optional(),
955
+ filter: z.number().optional()
956
+ }).optional(),
957
+ description: z.string().optional(),
958
+ primary_color: z.string().optional(),
959
+ secondary_color: z.string().optional(),
960
+ classification: z.string().optional(),
961
+ api_docs_url: z.string().optional(),
962
+ image: z.string().optional()
1169
963
  });
1170
964
  z.object({
1171
965
  count: z.number(),
@@ -1187,7 +981,7 @@ z.object({
1187
981
  authentication_id: z.number().optional().describe(
1188
982
  "If the app needs auth, provide an `authentication_id` that has the `selected_api` of the app you want to run. Can be any auth visible to the user (including shared)."
1189
983
  ),
1190
- params: z.record(z.any()).optional().describe(
984
+ params: z.record(z.unknown()).optional().describe(
1191
985
  "Object that matches the input the node would normally get. Has all the same keys/types as the `needs` of the action."
1192
986
  ),
1193
987
  page: z.number().optional().default(0),
@@ -1210,23 +1004,259 @@ z.object({
1210
1004
  links: NeedChoicesResponseLinksSchema.optional()
1211
1005
  });
1212
1006
 
1213
- // src/schemas/Action.ts
1214
- var ActionItemSchema = withFormatter(
1215
- ActionSchema.omit({ type: true, name: true }).extend({
1216
- app_key: z.string(),
1217
- // Mapped from selected_api
1218
- action_type: ActionSchema.shape.type,
1219
- // Mapped from original 'type' field
1007
+ // src/schemas/App.ts
1008
+ var AppItemSchema = withFormatter(
1009
+ ImplementationMetaSchema.omit({ name: true, id: true }).extend({
1220
1010
  title: z.string(),
1221
- // Mapped from original 'name' field
1222
- type: z.literal("action")
1223
- // Fixed type identifier
1011
+ // Mapped from name
1012
+ key: z.string(),
1013
+ // Extracted from id (base part without version)
1014
+ implementation_id: z.string()
1015
+ // Mapped from id (full versioned ID)
1224
1016
  }),
1225
1017
  {
1226
1018
  format: (item) => {
1227
- const details = [];
1228
- details.push({
1229
- text: `Type: ${item.action_type}`,
1019
+ return {
1020
+ title: item.title,
1021
+ key: item.key,
1022
+ description: item.description,
1023
+ details: []
1024
+ };
1025
+ }
1026
+ }
1027
+ );
1028
+
1029
+ // src/utils/domain-utils.ts
1030
+ function splitVersionedKey(versionedKey) {
1031
+ const parts = versionedKey.split("@");
1032
+ if (parts.length >= 2) {
1033
+ const baseKey = parts[0];
1034
+ const version = parts.slice(1).join("@");
1035
+ return [baseKey, version];
1036
+ }
1037
+ return [versionedKey, void 0];
1038
+ }
1039
+ function normalizeImplementationMetaToAppItem(implementationMeta) {
1040
+ const [selectedApi, appVersion] = splitVersionedKey(implementationMeta.id);
1041
+ const { id, name, ...restOfImplementationMeta } = implementationMeta;
1042
+ return {
1043
+ // Pass through all ImplementationMeta fields except id and name
1044
+ ...restOfImplementationMeta,
1045
+ // Transform key fields
1046
+ title: name,
1047
+ key: selectedApi,
1048
+ implementation_id: id,
1049
+ // Keep the full versioned ID
1050
+ version: appVersion
1051
+ // Extract version separately
1052
+ };
1053
+ }
1054
+ function normalizeAuthenticationItem(auth, options = {}) {
1055
+ let appKey = options.app_key;
1056
+ let version = options.version;
1057
+ if (auth.selected_api) {
1058
+ const [extractedAppKey, extractedVersion] = splitVersionedKey(
1059
+ auth.selected_api
1060
+ );
1061
+ if (!appKey) {
1062
+ appKey = extractedAppKey;
1063
+ }
1064
+ if (!version) {
1065
+ version = extractedVersion;
1066
+ }
1067
+ }
1068
+ const {
1069
+ selected_api: selectedApi,
1070
+ customuser_id: userId,
1071
+ ...restOfAuth
1072
+ } = auth;
1073
+ return {
1074
+ ...restOfAuth,
1075
+ // Pass through all other API response fields except selected_api
1076
+ implementation_id: selectedApi,
1077
+ // Rename selected_api to implementation_id
1078
+ title: auth.title || auth.label || void 0,
1079
+ // Coerce title from label if missing
1080
+ is_expired: auth.is_stale,
1081
+ // Map is_stale to is_expired
1082
+ expired_at: auth.marked_stale_at,
1083
+ // Map marked_stale_at to expired_at
1084
+ app_key: appKey,
1085
+ // App key from implementations endpoint or parsed from selected_api
1086
+ version,
1087
+ // Version from selected_api or provided
1088
+ user_id: userId
1089
+ // Map customuser_id to user_id
1090
+ };
1091
+ }
1092
+ function normalizeActionItem(action) {
1093
+ const { name, type, selected_api: appKey, ...restOfAction } = action;
1094
+ return {
1095
+ ...restOfAction,
1096
+ app_key: appKey || "",
1097
+ action_type: type,
1098
+ title: name,
1099
+ // Map name to title
1100
+ type: "action"
1101
+ };
1102
+ }
1103
+ function isSlug(slug) {
1104
+ return !!slug.match(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);
1105
+ }
1106
+ function isSnakeCasedSlug(slug) {
1107
+ if (slug.match(/^_[0-9]/)) {
1108
+ slug = slug.slice(1);
1109
+ }
1110
+ return !!slug.match(/^[a-z0-9]+(?:_[a-z0-9]+)*$/);
1111
+ }
1112
+ function dashifySnakeCasedSlug(slug) {
1113
+ if (!isSnakeCasedSlug(slug)) {
1114
+ return slug;
1115
+ }
1116
+ if (slug.startsWith("_")) {
1117
+ slug = slug.slice(1);
1118
+ }
1119
+ return slug.replace(/_/g, "-");
1120
+ }
1121
+ function isUuid(appKey) {
1122
+ return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(
1123
+ appKey
1124
+ );
1125
+ }
1126
+ function toAppLocator(appKey) {
1127
+ const [appKeyWithoutVersion, version] = splitVersionedKey(appKey);
1128
+ if (isUuid(appKeyWithoutVersion)) {
1129
+ throw new Error(
1130
+ `UUID app keys are not supported. Use app slug or implementation ID instead of: ${appKey}`
1131
+ );
1132
+ }
1133
+ const slug = isSlug(appKeyWithoutVersion) ? appKeyWithoutVersion : isSnakeCasedSlug(appKeyWithoutVersion) ? dashifySnakeCasedSlug(appKeyWithoutVersion) : void 0;
1134
+ return {
1135
+ lookupAppKey: appKeyWithoutVersion,
1136
+ slug,
1137
+ implementationName: slug ? void 0 : appKeyWithoutVersion,
1138
+ version
1139
+ };
1140
+ }
1141
+ function isResolvedAppLocator(appLocator) {
1142
+ return !!appLocator.implementationName;
1143
+ }
1144
+ function toImplementationId(appLocator) {
1145
+ return `${appLocator.implementationName}@${appLocator.version || "latest"}`;
1146
+ }
1147
+
1148
+ // src/plugins/listApps/index.ts
1149
+ var listAppsPlugin = ({ context }) => {
1150
+ const listApps = createPaginatedFunction(async function listAppsPage(options) {
1151
+ const api = context.api;
1152
+ const opts = options;
1153
+ const appLocators = await context.resolveAppKeys({
1154
+ appKeys: [...opts.appKeys ?? []]
1155
+ });
1156
+ const implementationNameToLocator = {};
1157
+ for (const locator of appLocators) {
1158
+ implementationNameToLocator[locator.implementationName] = [
1159
+ ...implementationNameToLocator[locator.implementationName] ?? [],
1160
+ locator
1161
+ ];
1162
+ }
1163
+ const duplicatedLookupAppKeys = Object.keys(implementationNameToLocator).filter((key) => implementationNameToLocator[key].length > 1).map((key) => implementationNameToLocator[key]).flat().map((locator) => locator.lookupAppKey);
1164
+ if (duplicatedLookupAppKeys.length > 0) {
1165
+ throw new Error(
1166
+ `Duplicate lookup app keys found: ${duplicatedLookupAppKeys.join(", ")}`
1167
+ );
1168
+ }
1169
+ if (opts.search) {
1170
+ const searchParams2 = {};
1171
+ searchParams2.term = opts.search;
1172
+ const searchEnvelope = await api.get(
1173
+ "/api/v4/implementations-meta/search/",
1174
+ {
1175
+ searchParams: searchParams2
1176
+ }
1177
+ );
1178
+ const implementations = searchEnvelope.results.map(
1179
+ normalizeImplementationMetaToAppItem
1180
+ );
1181
+ const implementationNameSet = new Set(
1182
+ appLocators.map((locator) => locator.implementationName)
1183
+ );
1184
+ for (const implementation of implementations) {
1185
+ const [implementationName] = splitVersionedKey(implementation.key);
1186
+ if (!implementationNameSet.has(implementationName)) {
1187
+ implementationNameSet.add(implementationName);
1188
+ appLocators.push({
1189
+ ...toAppLocator(implementation.key),
1190
+ implementationName
1191
+ });
1192
+ }
1193
+ }
1194
+ }
1195
+ const searchParams = {};
1196
+ if (opts.pageSize) {
1197
+ searchParams.limit = opts.pageSize.toString();
1198
+ }
1199
+ if (appLocators.length === 0) {
1200
+ searchParams.latest_only = "true";
1201
+ }
1202
+ if (opts.cursor) {
1203
+ searchParams.offset = opts.cursor;
1204
+ }
1205
+ searchParams.selected_apis = appLocators.map((locator) => toImplementationId(locator)).join(",");
1206
+ const implementationsEnvelope = await api.get(
1207
+ "/api/v4/implementations-meta/lookup/",
1208
+ {
1209
+ searchParams
1210
+ }
1211
+ );
1212
+ return {
1213
+ data: implementationsEnvelope.results.map(
1214
+ normalizeImplementationMetaToAppItem
1215
+ ),
1216
+ nextCursor: extractCursor(implementationsEnvelope)
1217
+ };
1218
+ }, ListAppsSchema);
1219
+ return {
1220
+ listApps,
1221
+ context: {
1222
+ meta: {
1223
+ listApps: {
1224
+ categories: ["app"],
1225
+ type: "list",
1226
+ itemType: "App",
1227
+ inputSchema: ListAppsSchema,
1228
+ outputSchema: AppItemSchema
1229
+ }
1230
+ }
1231
+ }
1232
+ };
1233
+ };
1234
+ var ListActionsSchema = z.object({
1235
+ appKey: AppKeyPropertySchema.describe(
1236
+ "App key of actions to list (e.g., 'SlackCLIAPI')"
1237
+ ),
1238
+ actionType: ActionTypePropertySchema.optional().describe(
1239
+ "Filter actions by type"
1240
+ ),
1241
+ pageSize: z.number().min(1).optional().describe("Number of actions per page"),
1242
+ maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages")
1243
+ }).describe("List all actions for a specific app");
1244
+ var ActionItemSchema = withFormatter(
1245
+ ActionSchema.omit({ type: true, name: true }).extend({
1246
+ app_key: z.string(),
1247
+ // Mapped from selected_api
1248
+ action_type: ActionSchema.shape.type,
1249
+ // Mapped from original 'type' field
1250
+ title: z.string(),
1251
+ // Mapped from original 'name' field
1252
+ type: z.literal("action")
1253
+ // Fixed type identifier
1254
+ }),
1255
+ {
1256
+ format: (item) => {
1257
+ const details = [];
1258
+ details.push({
1259
+ text: `Type: ${item.action_type}`,
1230
1260
  style: "accent"
1231
1261
  });
1232
1262
  if (item.app_key) {
@@ -1236,31 +1266,178 @@ var ActionItemSchema = withFormatter(
1236
1266
  });
1237
1267
  }
1238
1268
  if (item.description) {
1239
- details.push({ text: item.description, style: "dim" });
1269
+ details.push({
1270
+ text: item.description,
1271
+ style: "dim"
1272
+ });
1240
1273
  }
1241
1274
  return {
1242
- title: item.title || item.name || item.key,
1243
- subtitle: `(${item.key})`,
1275
+ title: item.title || item.key,
1276
+ id: item.id,
1277
+ key: item.key,
1278
+ description: item.description,
1244
1279
  details
1245
1280
  };
1246
1281
  }
1247
1282
  }
1248
1283
  );
1249
1284
 
1250
- // src/plugins/listActions/schemas.ts
1251
- var ListActionsSchema = withOutputSchema(
1252
- z.object({
1253
- appKey: AppKeyPropertySchema.describe(
1254
- "App key of actions to list (e.g., 'SlackCLIAPI')"
1255
- ),
1256
- actionType: ActionTypePropertySchema.optional().describe(
1257
- "Filter actions by type"
1258
- ),
1259
- pageSize: z.number().min(1).optional().describe("Number of actions per page"),
1260
- maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages")
1261
- }).describe("List all actions for a specific app"),
1262
- ActionItemSchema
1263
- );
1285
+ // src/resolvers/appKey.ts
1286
+ var appKeyResolver = {
1287
+ type: "static",
1288
+ inputType: "text",
1289
+ placeholder: "Enter app key (e.g., 'SlackCLIAPI' or slug like 'github')"
1290
+ };
1291
+
1292
+ // src/resolvers/actionType.ts
1293
+ var actionTypeResolver = {
1294
+ type: "dynamic",
1295
+ depends: ["appKey"],
1296
+ fetch: async (sdk, resolvedParams) => {
1297
+ const actionsResponse = await sdk.listActions({
1298
+ appKey: resolvedParams.appKey
1299
+ });
1300
+ const types = [
1301
+ ...new Set(actionsResponse.data.map((action) => action.action_type))
1302
+ ];
1303
+ return types.map((type) => ({ key: type, name: type }));
1304
+ },
1305
+ prompt: (types) => ({
1306
+ type: "list",
1307
+ name: "actionType",
1308
+ message: "Select action type:",
1309
+ choices: types.map((type) => ({
1310
+ name: type.name,
1311
+ value: type.key
1312
+ }))
1313
+ })
1314
+ };
1315
+
1316
+ // src/resolvers/actionKey.ts
1317
+ var actionKeyResolver = {
1318
+ type: "dynamic",
1319
+ depends: ["appKey", "actionType"],
1320
+ fetch: async (sdk, resolvedParams) => {
1321
+ const actionsResponse = await sdk.listActions({
1322
+ appKey: resolvedParams.appKey
1323
+ });
1324
+ return actionsResponse.data.filter(
1325
+ (action) => action.action_type === resolvedParams.actionType
1326
+ );
1327
+ },
1328
+ prompt: (actions) => ({
1329
+ type: "list",
1330
+ name: "actionKey",
1331
+ message: "Select action:",
1332
+ choices: actions.map((action) => ({
1333
+ name: `${action.title || action.name || action.key} - ${action.description || "No description"}`,
1334
+ value: action.key
1335
+ }))
1336
+ })
1337
+ };
1338
+
1339
+ // src/resolvers/authenticationId.ts
1340
+ var authenticationIdResolver = {
1341
+ type: "dynamic",
1342
+ depends: ["appKey"],
1343
+ fetch: async (sdk, resolvedParams) => {
1344
+ const listOptions = {
1345
+ maxItems: 1e3
1346
+ };
1347
+ if (resolvedParams.appKey) {
1348
+ listOptions.appKey = resolvedParams.appKey;
1349
+ }
1350
+ const myAuths = await sdk.listAuthentications({
1351
+ ...listOptions,
1352
+ owner: "me"
1353
+ });
1354
+ const allAuths = await sdk.listAuthentications(listOptions);
1355
+ const otherAuths = allAuths.data.filter(
1356
+ (auth) => !myAuths.data.some((myAuth) => myAuth.id === auth.id)
1357
+ );
1358
+ return [...myAuths.data, ...otherAuths];
1359
+ },
1360
+ prompt: (auths, params) => ({
1361
+ type: "list",
1362
+ name: "authenticationId",
1363
+ message: params.appKey ? `Select authentication for ${params.appKey}:` : "Select authentication:",
1364
+ choices: [
1365
+ ...auths.map((auth) => ({
1366
+ name: `${auth.title || auth.label || "Authentication"} (ID: ${auth.id})`,
1367
+ value: auth.id
1368
+ })),
1369
+ {
1370
+ name: "\u2197 Skip authentication (may fail)",
1371
+ value: null
1372
+ }
1373
+ ]
1374
+ })
1375
+ };
1376
+ var authenticationIdGenericResolver = {
1377
+ ...authenticationIdResolver,
1378
+ depends: []
1379
+ };
1380
+
1381
+ // src/resolvers/inputs.ts
1382
+ var inputsResolver = {
1383
+ type: "fields",
1384
+ depends: ["appKey", "actionKey", "actionType", "authenticationId"],
1385
+ fetch: async (sdk, resolvedParams) => {
1386
+ const fieldsResponse = await sdk.listInputFields({
1387
+ appKey: resolvedParams.appKey,
1388
+ actionKey: resolvedParams.actionKey,
1389
+ actionType: resolvedParams.actionType,
1390
+ authenticationId: resolvedParams.authenticationId,
1391
+ inputs: resolvedParams.inputs
1392
+ // Pass along currently resolved inputs
1393
+ });
1394
+ return fieldsResponse.data;
1395
+ }
1396
+ };
1397
+ var inputsAllOptionalResolver = {
1398
+ type: "fields",
1399
+ depends: ["appKey", "actionKey", "actionType", "authenticationId"],
1400
+ fetch: async (sdk, resolvedParams) => {
1401
+ const fieldsResponse = await sdk.listInputFields({
1402
+ appKey: resolvedParams.appKey,
1403
+ actionKey: resolvedParams.actionKey,
1404
+ actionType: resolvedParams.actionType,
1405
+ authenticationId: resolvedParams.authenticationId,
1406
+ inputs: resolvedParams.inputs
1407
+ // Pass along currently resolved inputs
1408
+ });
1409
+ return fieldsResponse.data.map((field) => ({
1410
+ ...field,
1411
+ is_required: false
1412
+ }));
1413
+ }
1414
+ };
1415
+
1416
+ // src/resolvers/inputFieldKey.ts
1417
+ var inputFieldKeyResolver = {
1418
+ type: "dynamic",
1419
+ depends: ["appKey", "actionKey", "actionType", "authenticationId"],
1420
+ fetch: async (sdk, resolvedParams) => {
1421
+ const fieldsResponse = await sdk.listInputFields({
1422
+ appKey: resolvedParams.appKey,
1423
+ actionKey: resolvedParams.actionKey,
1424
+ actionType: resolvedParams.actionType,
1425
+ authenticationId: resolvedParams.authenticationId,
1426
+ inputs: resolvedParams.inputs
1427
+ // Pass along currently resolved inputs
1428
+ });
1429
+ return fieldsResponse.data;
1430
+ },
1431
+ prompt: (fields) => ({
1432
+ type: "list",
1433
+ name: "inputFieldKey",
1434
+ message: "Select input field:",
1435
+ choices: fields.map((field) => ({
1436
+ name: `${field.title || field.key} - ${field.value_type || "No type"} ${field.is_required ? "(required)" : "(optional)"}`,
1437
+ value: field.key
1438
+ }))
1439
+ })
1440
+ };
1264
1441
 
1265
1442
  // src/plugins/listActions/index.ts
1266
1443
  var listActionsPlugin = ({ context }) => {
@@ -1327,7 +1504,14 @@ var listActionsPlugin = ({ context }) => {
1327
1504
  meta: {
1328
1505
  listActions: {
1329
1506
  categories: ["action"],
1330
- inputSchema: ListActionsSchema
1507
+ type: "list",
1508
+ itemType: "Action",
1509
+ inputSchema: ListActionsSchema,
1510
+ outputSchema: ActionItemSchema,
1511
+ resolvers: {
1512
+ appKey: appKeyResolver,
1513
+ actionType: actionTypeResolver
1514
+ }
1331
1515
  }
1332
1516
  }
1333
1517
  }
@@ -1344,6 +1528,83 @@ var ListInputFieldsSchema = z.object({
1344
1528
  pageSize: z.number().min(1).optional().describe("Number of input fields per page"),
1345
1529
  maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages")
1346
1530
  }).describe("Get the input fields required for a specific action");
1531
+ var InputFieldItemSchema = withFormatter(
1532
+ z.object({
1533
+ key: z.string(),
1534
+ // From need.key
1535
+ default_value: z.string(),
1536
+ // Mapped from 'default' with fallback to ""
1537
+ depends_on: z.array(z.string()),
1538
+ // Mapped from 'depends_on' with fallback to []
1539
+ description: z.string(),
1540
+ // Mapped from 'help_text' with fallback to ""
1541
+ invalidates_input_fields: z.boolean(),
1542
+ // Mapped from 'alters_custom_fields' with fallback to false
1543
+ is_required: z.boolean(),
1544
+ // Mapped from 'required' with fallback to false
1545
+ placeholder: z.string(),
1546
+ // Mapped from 'placeholder' with fallback to ""
1547
+ title: z.string(),
1548
+ // Mapped from 'label' with fallback to ""
1549
+ value_type: z.string(),
1550
+ // Computed from InputFieldType enum
1551
+ format: z.string().optional(),
1552
+ // Computed from InputFieldFormat enum (optional)
1553
+ items: z.object({ type: z.string() }).optional()
1554
+ // Computed from ItemsType enum (optional, only for arrays)
1555
+ }),
1556
+ {
1557
+ format: (item) => {
1558
+ const details = [];
1559
+ const typeInfo = [
1560
+ item.value_type && `Type: ${item.value_type}`,
1561
+ `Required: ${item.is_required ? "Yes" : "No"}`
1562
+ ].filter(Boolean).join(" | ");
1563
+ if (typeInfo) {
1564
+ details.push({ text: typeInfo, style: "dim" });
1565
+ }
1566
+ if (item.description) {
1567
+ details.push({
1568
+ text: item.description,
1569
+ style: "normal"
1570
+ });
1571
+ }
1572
+ if (item.default_value) {
1573
+ details.push({
1574
+ text: `Default: ${item.default_value}`,
1575
+ style: "accent"
1576
+ });
1577
+ }
1578
+ if (item.placeholder) {
1579
+ details.push({
1580
+ text: `Placeholder: ${item.placeholder}`,
1581
+ style: "dim"
1582
+ });
1583
+ }
1584
+ if (item.depends_on && item.depends_on.length > 0) {
1585
+ details.push({
1586
+ text: `Depends on: ${item.depends_on.join(", ")}`,
1587
+ style: "warning"
1588
+ });
1589
+ }
1590
+ if (item.format) {
1591
+ details.push({ text: `Format: ${item.format}`, style: "dim" });
1592
+ }
1593
+ if (item.items) {
1594
+ details.push({
1595
+ text: `Items type: ${item.items.type}`,
1596
+ style: "dim"
1597
+ });
1598
+ }
1599
+ return {
1600
+ title: item.title || item.key,
1601
+ key: item.key,
1602
+ description: item.description,
1603
+ details
1604
+ };
1605
+ }
1606
+ }
1607
+ );
1347
1608
 
1348
1609
  // src/plugins/listInputFields/index.ts
1349
1610
  function getInputFieldTypeFromNeed(need) {
@@ -1388,9 +1649,8 @@ function getItemsTypeFromNeed(need) {
1388
1649
  function transformNeedToInputFieldItem(need) {
1389
1650
  const itemsType = getItemsTypeFromNeed(need);
1390
1651
  return {
1391
- ...need,
1392
- // Pass through all original Need fields
1393
- id: need.key,
1652
+ // Only the final computed/mapped fields that are in InputFieldItemSchema
1653
+ key: need.key,
1394
1654
  default_value: need.default || "",
1395
1655
  depends_on: need.depends_on || [],
1396
1656
  description: need.help_text || "",
@@ -1450,7 +1710,17 @@ var listInputFieldsPlugin = ({ context }) => {
1450
1710
  meta: {
1451
1711
  listInputFields: {
1452
1712
  categories: ["action"],
1453
- inputSchema: ListInputFieldsSchema
1713
+ type: "list",
1714
+ itemType: "InputField",
1715
+ inputSchema: ListInputFieldsSchema,
1716
+ outputSchema: InputFieldItemSchema,
1717
+ resolvers: {
1718
+ appKey: appKeyResolver,
1719
+ actionType: actionTypeResolver,
1720
+ actionKey: actionKeyResolver,
1721
+ authenticationId: authenticationIdResolver,
1722
+ inputs: inputsAllOptionalResolver
1723
+ }
1454
1724
  }
1455
1725
  }
1456
1726
  }
@@ -1468,6 +1738,49 @@ var ListAuthenticationsSchema = z.object({
1468
1738
  pageSize: z.number().min(1).optional().describe("Number of authentications per page"),
1469
1739
  maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages")
1470
1740
  }).describe("List available authentications with optional filtering");
1741
+ var AuthenticationItemSchema = withFormatter(
1742
+ AuthenticationSchema.omit({ selected_api: true, customuser_id: true }).extend(
1743
+ {
1744
+ implementation_id: z.string().optional(),
1745
+ // Renamed from selected_api
1746
+ is_expired: z.string().optional(),
1747
+ // Mapped from is_stale
1748
+ expired_at: z.string().nullable().optional(),
1749
+ // Mapped from marked_stale_at
1750
+ app_key: z.string().optional(),
1751
+ // App key from implementations endpoint
1752
+ version: z.string().optional(),
1753
+ // Version extracted from implementation_id
1754
+ user_id: z.number().optional()
1755
+ }
1756
+ ),
1757
+ {
1758
+ format: (item) => {
1759
+ const details = [];
1760
+ if (item.identifier) {
1761
+ details.push({
1762
+ text: `Identifier: ${item.identifier}`,
1763
+ style: "accent"
1764
+ });
1765
+ }
1766
+ details.push({
1767
+ text: `Account: ${item.account_id} | Private: ${item.is_private} | Shared: ${item.shared_with_all}`,
1768
+ style: "dim"
1769
+ });
1770
+ if (item.marked_stale_at) {
1771
+ details.push({
1772
+ text: `\u26A0\uFE0F Marked stale: ${new Date(item.marked_stale_at).toLocaleDateString()}`,
1773
+ style: "warning"
1774
+ });
1775
+ }
1776
+ return {
1777
+ title: item.title || `Authentication ${item.id}`,
1778
+ id: item.id?.toString(),
1779
+ details
1780
+ };
1781
+ }
1782
+ }
1783
+ );
1471
1784
 
1472
1785
  // src/plugins/listAuthentications/index.ts
1473
1786
  var listAuthenticationsPlugin = ({ context }) => {
@@ -1543,20 +1856,23 @@ var listAuthenticationsPlugin = ({ context }) => {
1543
1856
  meta: {
1544
1857
  listAuthentications: {
1545
1858
  categories: ["authentication"],
1546
- inputSchema: ListAuthenticationsSchema
1859
+ type: "list",
1860
+ itemType: "Authentication",
1861
+ inputSchema: ListAuthenticationsSchema,
1862
+ outputSchema: AuthenticationItemSchema,
1863
+ resolvers: {
1864
+ appKey: appKeyResolver
1865
+ }
1547
1866
  }
1548
1867
  }
1549
1868
  }
1550
1869
  };
1551
1870
  };
1552
- var GetAppSchema = withOutputSchema(
1553
- z.object({
1554
- appKey: AppKeyPropertySchema.describe(
1555
- "App key of app to fetch (e.g., 'SlackCLIAPI')"
1556
- )
1557
- }).describe("Get detailed information about a specific app"),
1558
- AppItemSchema
1559
- );
1871
+ var GetAppSchema = z.object({
1872
+ appKey: AppKeyPropertySchema.describe(
1873
+ "App key of app to fetch (e.g., 'SlackCLIAPI')"
1874
+ )
1875
+ }).describe("Get detailed information about a specific app");
1560
1876
 
1561
1877
  // src/plugins/getApp/index.ts
1562
1878
  var getAppPlugin = ({ sdk }) => {
@@ -1577,7 +1893,13 @@ var getAppPlugin = ({ sdk }) => {
1577
1893
  meta: {
1578
1894
  getApp: {
1579
1895
  categories: ["app"],
1580
- inputSchema: GetAppSchema
1896
+ type: "item",
1897
+ itemType: "App",
1898
+ inputSchema: GetAppSchema,
1899
+ outputSchema: AppItemSchema,
1900
+ resolvers: {
1901
+ appKey: appKeyResolver
1902
+ }
1581
1903
  }
1582
1904
  }
1583
1905
  }
@@ -1610,7 +1932,15 @@ var getActionPlugin = ({ sdk }) => {
1610
1932
  meta: {
1611
1933
  getAction: {
1612
1934
  categories: ["action"],
1613
- inputSchema: GetActionSchema
1935
+ type: "item",
1936
+ itemType: "Action",
1937
+ inputSchema: GetActionSchema,
1938
+ outputSchema: ActionItemSchema,
1939
+ resolvers: {
1940
+ appKey: appKeyResolver,
1941
+ actionType: actionTypeResolver,
1942
+ actionKey: actionKeyResolver
1943
+ }
1614
1944
  }
1615
1945
  }
1616
1946
  }
@@ -1665,7 +1995,13 @@ var getAuthenticationPlugin = ({ context }) => {
1665
1995
  meta: {
1666
1996
  getAuthentication: {
1667
1997
  categories: ["authentication"],
1668
- inputSchema: GetAuthenticationSchema
1998
+ type: "item",
1999
+ itemType: "Authentication",
2000
+ inputSchema: GetAuthenticationSchema,
2001
+ outputSchema: AuthenticationItemSchema,
2002
+ resolvers: {
2003
+ authenticationId: authenticationIdGenericResolver
2004
+ }
1669
2005
  }
1670
2006
  }
1671
2007
  }
@@ -1689,8 +2025,14 @@ var findFirstAuthenticationPlugin = ({ sdk }) => {
1689
2025
  ...options,
1690
2026
  maxItems: 1
1691
2027
  });
2028
+ if (authsResponse.data.length === 0) {
2029
+ throw new ZapierResourceNotFoundError(
2030
+ "No authentication found matching the specified criteria",
2031
+ { resourceType: "Authentication" }
2032
+ );
2033
+ }
1692
2034
  return {
1693
- data: authsResponse.data.length > 0 ? authsResponse.data[0] : null
2035
+ data: authsResponse.data[0]
1694
2036
  };
1695
2037
  },
1696
2038
  FindFirstAuthenticationSchema
@@ -1701,7 +2043,10 @@ var findFirstAuthenticationPlugin = ({ sdk }) => {
1701
2043
  meta: {
1702
2044
  findFirstAuthentication: {
1703
2045
  categories: ["authentication"],
1704
- inputSchema: FindFirstAuthenticationSchema
2046
+ type: "item",
2047
+ itemType: "Authentication",
2048
+ inputSchema: FindFirstAuthenticationSchema,
2049
+ outputSchema: AuthenticationItemSchema
1705
2050
  }
1706
2051
  }
1707
2052
  }
@@ -1749,7 +2094,10 @@ var findUniqueAuthenticationPlugin = ({ sdk }) => {
1749
2094
  meta: {
1750
2095
  findUniqueAuthentication: {
1751
2096
  categories: ["authentication"],
1752
- inputSchema: FindUniqueAuthenticationSchema
2097
+ type: "item",
2098
+ itemType: "Authentication",
2099
+ inputSchema: FindUniqueAuthenticationSchema,
2100
+ outputSchema: AuthenticationItemSchema
1753
2101
  }
1754
2102
  }
1755
2103
  }
@@ -1766,6 +2114,31 @@ var RunActionSchema = z.object({
1766
2114
  pageSize: z.number().min(1).optional().describe("Number of results per page"),
1767
2115
  maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages")
1768
2116
  }).describe("Execute an action with the given inputs");
2117
+ function getStringProperty(obj, key) {
2118
+ if (typeof obj === "object" && obj !== null && key in obj) {
2119
+ const value = obj[key];
2120
+ return typeof value === "string" ? value : void 0;
2121
+ }
2122
+ return void 0;
2123
+ }
2124
+ function formatActionResult(item) {
2125
+ const obj = typeof item === "object" && item !== null ? item : {};
2126
+ const title = getStringProperty(obj, "title") || getStringProperty(obj, "name") || getStringProperty(obj, "label") || getStringProperty(obj, "subject") || "Action Result";
2127
+ return {
2128
+ title,
2129
+ id: getStringProperty(obj, "id"),
2130
+ key: getStringProperty(obj, "key"),
2131
+ description: getStringProperty(obj, "description"),
2132
+ data: item,
2133
+ // Let formatJsonOutput handle the JSON rendering
2134
+ details: []
2135
+ // Not used when data is provided
2136
+ };
2137
+ }
2138
+ var ActionResultItemSchema = withFormatter(
2139
+ z.unknown().describe("Action execution result"),
2140
+ { format: formatActionResult }
2141
+ );
1769
2142
 
1770
2143
  // src/plugins/runAction/index.ts
1771
2144
  async function executeAction(actionOptions) {
@@ -1857,7 +2230,17 @@ var runActionPlugin = ({ sdk, context }) => {
1857
2230
  meta: {
1858
2231
  runAction: {
1859
2232
  categories: ["action"],
1860
- inputSchema: RunActionSchema
2233
+ type: "list",
2234
+ itemType: "ActionResult",
2235
+ inputSchema: RunActionSchema,
2236
+ outputSchema: ActionResultItemSchema,
2237
+ resolvers: {
2238
+ appKey: appKeyResolver,
2239
+ actionType: actionTypeResolver,
2240
+ actionKey: actionKeyResolver,
2241
+ authenticationId: authenticationIdResolver,
2242
+ inputs: inputsResolver
2243
+ }
1861
2244
  }
1862
2245
  }
1863
2246
  }
@@ -1929,6 +2312,7 @@ var requestPlugin = ({ context }) => {
1929
2312
  meta: {
1930
2313
  request: {
1931
2314
  categories: ["http"],
2315
+ returnType: "Response",
1932
2316
  inputSchema: RelayRequestSchema
1933
2317
  }
1934
2318
  }
@@ -2276,6 +2660,7 @@ var manifestPlugin = (params) => {
2276
2660
  }
2277
2661
  };
2278
2662
  };
2663
+ var GetProfileSchema = z.object({}).optional().describe("Get current user's profile information");
2279
2664
  var UserProfileItemSchema = withFormatter(
2280
2665
  UserProfileSchema.omit({ user_id: true }).extend({
2281
2666
  full_name: z.string()
@@ -2284,32 +2669,37 @@ var UserProfileItemSchema = withFormatter(
2284
2669
  {
2285
2670
  format: (item) => {
2286
2671
  const details = [];
2287
- details.push({ text: item.email, style: "dim" });
2288
- if (item.timezone) {
2672
+ if (item == null || typeof item !== "object" || !("full_name" in item) || !("username" in item)) {
2673
+ return {
2674
+ title: "User Profile",
2675
+ subtitle: "Malformatted result item",
2676
+ details: []
2677
+ };
2678
+ }
2679
+ if ("email" in item) {
2680
+ details.push({ text: item.email, style: "dim" });
2681
+ }
2682
+ if ("timezone" in item && item.timezone) {
2289
2683
  details.push({
2290
2684
  text: `Timezone: ${item.timezone}`,
2291
2685
  style: "accent"
2292
2686
  });
2293
2687
  }
2294
- details.push({
2295
- text: `Member since: ${item.since_signup}`,
2296
- style: "dim"
2297
- });
2688
+ if ("since_signup" in item && item.since_signup) {
2689
+ details.push({
2690
+ text: `Member since: ${item.since_signup}`,
2691
+ style: "dim"
2692
+ });
2693
+ }
2298
2694
  return {
2299
2695
  title: item.full_name,
2300
- subtitle: `@${item.username}`,
2696
+ id: item.id.toString(),
2301
2697
  details
2302
2698
  };
2303
2699
  }
2304
2700
  }
2305
2701
  );
2306
2702
 
2307
- // src/plugins/getProfile/schemas.ts
2308
- var GetProfileSchema = withOutputSchema(
2309
- z.object({}).optional().describe("Get current user's profile information"),
2310
- UserProfileItemSchema
2311
- );
2312
-
2313
2703
  // src/plugins/getProfile/index.ts
2314
2704
  var getProfilePlugin = ({ context }) => {
2315
2705
  const getProfile = createFunction(async function getProfile2() {
@@ -2332,7 +2722,10 @@ var getProfilePlugin = ({ context }) => {
2332
2722
  meta: {
2333
2723
  getProfile: {
2334
2724
  categories: ["account"],
2335
- inputSchema: GetProfileSchema
2725
+ type: "item",
2726
+ itemType: "Profile",
2727
+ inputSchema: GetProfileSchema,
2728
+ outputSchema: UserProfileItemSchema
2336
2729
  }
2337
2730
  }
2338
2731
  }
@@ -2365,6 +2758,38 @@ function createDebugLogger(enabled) {
2365
2758
  console.log(`[Zapier SDK] ${message}`, data || "");
2366
2759
  };
2367
2760
  }
2761
+ function censorHeaders(headers) {
2762
+ if (!headers) return headers;
2763
+ const headersObj = new Headers(headers);
2764
+ const authKeys = ["authorization", "x-api-key"];
2765
+ for (const [key, value] of headersObj.entries()) {
2766
+ if (authKeys.some((authKey) => key.toLowerCase() === authKey)) {
2767
+ const spaceIndex = value.indexOf(" ");
2768
+ if (spaceIndex > 0 && spaceIndex < value.length - 1) {
2769
+ const prefix = value.substring(0, spaceIndex + 1);
2770
+ const token = value.substring(spaceIndex + 1);
2771
+ if (token.length > 12) {
2772
+ const start = token.substring(0, 4);
2773
+ const end = token.substring(token.length - 4);
2774
+ headersObj.set(key, `${prefix}${start}...${end}`);
2775
+ } else {
2776
+ const firstChar = token.charAt(0);
2777
+ headersObj.set(key, `${prefix}${firstChar}...`);
2778
+ }
2779
+ } else {
2780
+ if (value.length > 12) {
2781
+ const start = value.substring(0, 4);
2782
+ const end = value.substring(value.length - 4);
2783
+ headersObj.set(key, `${start}...${end}`);
2784
+ } else {
2785
+ const firstChar = value.charAt(0);
2786
+ headersObj.set(key, `${firstChar}...`);
2787
+ }
2788
+ }
2789
+ }
2790
+ }
2791
+ return Object.fromEntries(headersObj);
2792
+ }
2368
2793
  function createDebugFetch(options) {
2369
2794
  const { originalFetch, debugLog } = options;
2370
2795
  return async (input, options2) => {
@@ -2372,7 +2797,7 @@ function createDebugFetch(options) {
2372
2797
  const url = typeof input === "string" ? input : input.toString();
2373
2798
  const method = options2?.method || "GET";
2374
2799
  debugLog(`\u2192 ${method} ${url}`, {
2375
- headers: options2?.headers,
2800
+ headers: censorHeaders(options2?.headers),
2376
2801
  body: options2?.body && typeof options2.body === "string" ? (() => {
2377
2802
  try {
2378
2803
  return JSON.parse(options2.body);
@@ -2723,6 +3148,16 @@ var ZapierApiClient = class {
2723
3148
  if ("errors" in data && Array.isArray(data.errors)) {
2724
3149
  if (this.isApiErrorArray(data.errors)) {
2725
3150
  return data.errors[0].detail || data.errors[0].title;
3151
+ } else if (data.errors.length > 0) {
3152
+ const firstError = data.errors[0];
3153
+ if (typeof firstError === "string") {
3154
+ return firstError;
3155
+ }
3156
+ try {
3157
+ return JSON.stringify(firstError);
3158
+ } catch {
3159
+ return String(firstError);
3160
+ }
2726
3161
  }
2727
3162
  }
2728
3163
  }
@@ -2907,174 +3342,6 @@ var apiPlugin = (params) => {
2907
3342
  };
2908
3343
  };
2909
3344
 
2910
- // src/resolvers/appKey.ts
2911
- var appKeyResolver = {
2912
- type: "static",
2913
- inputType: "text",
2914
- placeholder: "Enter app key (e.g., 'SlackCLIAPI' or slug like 'github')"
2915
- };
2916
-
2917
- // src/resolvers/actionType.ts
2918
- var actionTypeResolver = {
2919
- type: "dynamic",
2920
- depends: ["appKey"],
2921
- fetch: async (sdk, resolvedParams) => {
2922
- const actionsResponse = await sdk.listActions({
2923
- appKey: resolvedParams.appKey
2924
- });
2925
- const types = [
2926
- ...new Set(actionsResponse.data.map((action) => action.action_type))
2927
- ];
2928
- return types.map((type) => ({ key: type, name: type }));
2929
- },
2930
- prompt: (types) => ({
2931
- type: "list",
2932
- name: "actionType",
2933
- message: "Select action type:",
2934
- choices: types.map((type) => ({
2935
- name: type.name,
2936
- value: type.key
2937
- }))
2938
- })
2939
- };
2940
-
2941
- // src/resolvers/actionKey.ts
2942
- var actionKeyResolver = {
2943
- type: "dynamic",
2944
- depends: ["appKey", "actionType"],
2945
- fetch: async (sdk, resolvedParams) => {
2946
- const actionsResponse = await sdk.listActions({
2947
- appKey: resolvedParams.appKey
2948
- });
2949
- return actionsResponse.data.filter(
2950
- (action) => action.action_type === resolvedParams.actionType
2951
- );
2952
- },
2953
- prompt: (actions) => ({
2954
- type: "list",
2955
- name: "actionKey",
2956
- message: "Select action:",
2957
- choices: actions.map((action) => ({
2958
- name: `${action.title || action.name || action.key} - ${action.description || "No description"}`,
2959
- value: action.key
2960
- }))
2961
- })
2962
- };
2963
-
2964
- // src/resolvers/authenticationId.ts
2965
- var authenticationIdResolver = {
2966
- type: "dynamic",
2967
- depends: ["appKey"],
2968
- fetch: async (sdk, resolvedParams) => {
2969
- const myAuths = await sdk.listAuthentications({
2970
- appKey: resolvedParams.appKey,
2971
- maxItems: 1e3,
2972
- owner: "me"
2973
- });
2974
- const allAuths = await sdk.listAuthentications({
2975
- appKey: resolvedParams.appKey,
2976
- maxItems: 1e3
2977
- });
2978
- const otherAuths = allAuths.data.filter(
2979
- (auth) => !myAuths.data.some((myAuth) => myAuth.id === auth.id)
2980
- );
2981
- return [...myAuths.data, ...otherAuths];
2982
- },
2983
- prompt: (auths, params) => ({
2984
- type: "list",
2985
- name: "authenticationId",
2986
- message: `Select authentication for ${params.appKey}:`,
2987
- choices: [
2988
- ...auths.map((auth) => ({
2989
- name: `${auth.title || auth.label || "Authentication"} (ID: ${auth.id})`,
2990
- value: auth.id
2991
- })),
2992
- {
2993
- name: "\u2197 Skip authentication (may fail)",
2994
- value: null
2995
- }
2996
- ]
2997
- })
2998
- };
2999
-
3000
- // src/resolvers/inputs.ts
3001
- var inputsResolver = {
3002
- type: "fields",
3003
- depends: ["appKey", "actionKey", "actionType", "authenticationId"],
3004
- fetch: async (sdk, resolvedParams) => {
3005
- const fieldsResponse = await sdk.listInputFields({
3006
- appKey: resolvedParams.appKey,
3007
- actionKey: resolvedParams.actionKey,
3008
- actionType: resolvedParams.actionType,
3009
- authenticationId: resolvedParams.authenticationId,
3010
- inputs: resolvedParams.inputs
3011
- // Pass along currently resolved inputs
3012
- });
3013
- return fieldsResponse.data;
3014
- }
3015
- };
3016
-
3017
- // src/resolvers/index.ts
3018
- var resolverRegistry = {
3019
- appKey: appKeyResolver,
3020
- actionType: actionTypeResolver,
3021
- actionKey: actionKeyResolver,
3022
- authenticationId: authenticationIdResolver,
3023
- inputs: inputsResolver
3024
- };
3025
- function getResolver(name) {
3026
- return resolverRegistry[name];
3027
- }
3028
- function getResolversForMissingParams(missingParams) {
3029
- const resolvers = {};
3030
- for (const param of missingParams) {
3031
- const resolver = resolverRegistry[param];
3032
- if (resolver) {
3033
- resolvers[param] = resolver;
3034
- }
3035
- }
3036
- return resolvers;
3037
- }
3038
- function hasResolver(paramName) {
3039
- return paramName in resolverRegistry;
3040
- }
3041
- function getResolvableParams() {
3042
- return Object.keys(resolverRegistry);
3043
- }
3044
- function getResolutionOrder(paramName, resolved = /* @__PURE__ */ new Set()) {
3045
- const resolver = getResolver(paramName);
3046
- if (!resolver || resolver.type === "static") {
3047
- return [paramName];
3048
- }
3049
- const order = [];
3050
- if ("depends" in resolver && resolver.depends) {
3051
- for (const dependency of resolver.depends) {
3052
- if (!resolved.has(dependency)) {
3053
- order.push(...getResolutionOrder(dependency, resolved));
3054
- resolved.add(dependency);
3055
- }
3056
- }
3057
- }
3058
- if (!resolved.has(paramName)) {
3059
- order.push(paramName);
3060
- resolved.add(paramName);
3061
- }
3062
- return order;
3063
- }
3064
- function getResolutionOrderForParams(paramNames) {
3065
- const resolved = /* @__PURE__ */ new Set();
3066
- const order = [];
3067
- for (const paramName of paramNames) {
3068
- const paramOrder = getResolutionOrder(paramName, resolved);
3069
- for (const param of paramOrder) {
3070
- if (!order.includes(param)) {
3071
- order.push(param);
3072
- }
3073
- }
3074
- }
3075
- return order;
3076
- }
3077
-
3078
3345
  // src/plugins/registry/index.ts
3079
3346
  var registryPlugin = ({ sdk, context }) => {
3080
3347
  const metaKeys = Object.keys(context.meta || {});
@@ -3104,10 +3371,16 @@ var registryPlugin = ({ sdk, context }) => {
3104
3371
  }
3105
3372
  };
3106
3373
  const functions = metaKeys.filter((key) => typeof sdk[key] === "function").map((key) => {
3374
+ const meta = context.meta[key];
3107
3375
  return {
3108
- ...context.meta[key],
3109
- categories: context.meta[key].categories || [],
3110
- name: key
3376
+ name: key,
3377
+ type: meta.type,
3378
+ itemType: meta.itemType,
3379
+ returnType: meta.returnType,
3380
+ inputSchema: meta.inputSchema,
3381
+ outputSchema: meta.outputSchema,
3382
+ categories: meta.categories || [],
3383
+ resolvers: meta.resolvers
3111
3384
  };
3112
3385
  }).sort((a, b) => a.name.localeCompare(b.name));
3113
3386
  const knownCategories = Object.keys(categoryDefinitions);
@@ -3141,52 +3414,43 @@ var registryPlugin = ({ sdk, context }) => {
3141
3414
  getRegistry
3142
3415
  };
3143
3416
  };
3144
- var InputFieldChoiceItemSchema = withFormatter(
3145
- z.object({
3146
- key: z.string().optional().describe("Unique key/value for the choice"),
3147
- label: z.string().optional().describe("Human readable label for the choice"),
3148
- sample: z.string().optional().describe("Sample value for the choice"),
3149
- value: z.string().optional().describe("Value to be submitted when selected")
3150
- }),
3151
- {
3152
- format: (item) => {
3153
- const title = item.label || item.key || "Choice";
3154
- const subtitle = item.label && item.key && item.label !== item.key ? `(${item.key})` : void 0;
3155
- const details = [];
3156
- if (item.sample && item.sample !== item.key) {
3157
- details.push({ text: `Sample: ${item.sample}`, style: "dim" });
3158
- }
3159
- if (item.value && item.value !== item.key) {
3160
- details.push({ text: `Value: ${item.value}`, style: "normal" });
3161
- }
3162
- return {
3163
- title,
3164
- subtitle,
3165
- details
3166
- };
3417
+ var InputFieldChoiceItemSchema = withFormatter(NeedChoicesSchema, {
3418
+ format: (item) => {
3419
+ const title = item.label || item.key || "Choice";
3420
+ const details = [];
3421
+ if (item.label && item.key && item.label !== item.key) {
3422
+ details.push({ text: `Key: ${item.key}`, style: "dim" });
3423
+ }
3424
+ if (item.sample && item.sample !== item.key) {
3425
+ details.push({ text: `Sample: ${item.sample}`, style: "dim" });
3426
+ }
3427
+ if (item.value && item.value !== item.key) {
3428
+ details.push({ text: `Value: ${item.value}`, style: "normal" });
3167
3429
  }
3430
+ return {
3431
+ title,
3432
+ key: item.key,
3433
+ details
3434
+ };
3168
3435
  }
3169
- );
3170
- var ListInputFieldChoicesSchema = withOutputSchema(
3171
- z.object({
3172
- // Required action identification
3173
- appKey: AppKeyPropertySchema,
3174
- actionType: ActionTypePropertySchema,
3175
- actionKey: ActionKeyPropertySchema,
3176
- // Input field specification
3177
- inputFieldKey: z.string().min(1).describe("Input field key to get choices for."),
3178
- // Common parameters
3179
- authenticationId: AuthenticationIdPropertySchema.nullable().optional(),
3180
- inputs: InputsPropertySchema.optional().describe(
3181
- "Current input values that may affect available choices"
3182
- ),
3183
- page: z.number().int().min(0).optional().describe("Page number for paginated results"),
3184
- // Pagination options (SDK-level)
3185
- pageSize: z.number().min(1).optional().describe("Number of choices per page"),
3186
- maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages")
3187
- }).describe("Get the available choices for a dynamic dropdown input field"),
3188
- InputFieldChoiceItemSchema
3189
- );
3436
+ });
3437
+ var ListInputFieldChoicesSchema = z.object({
3438
+ // Required action identification
3439
+ appKey: AppKeyPropertySchema,
3440
+ actionType: ActionTypePropertySchema,
3441
+ actionKey: ActionKeyPropertySchema,
3442
+ // Input field specification
3443
+ inputFieldKey: z.string().min(1).describe("Input field key to get choices for."),
3444
+ // Common parameters
3445
+ authenticationId: AuthenticationIdPropertySchema.nullable().optional(),
3446
+ inputs: InputsPropertySchema.optional().describe(
3447
+ "Current input values that may affect available choices"
3448
+ ),
3449
+ page: z.number().int().min(0).optional().describe("Page number for paginated results"),
3450
+ // Pagination options (SDK-level)
3451
+ pageSize: z.number().min(1).optional().describe("Number of choices per page"),
3452
+ maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages")
3453
+ }).describe("Get the available choices for a dynamic dropdown input field");
3190
3454
 
3191
3455
  // src/plugins/listInputFieldChoices/index.ts
3192
3456
  function transformNeedChoicesToInputFieldChoiceItem(choice) {
@@ -3240,7 +3504,7 @@ var listInputFieldChoicesPlugin = ({ context, sdk }) => {
3240
3504
  transformNeedChoicesToInputFieldChoiceItem
3241
3505
  );
3242
3506
  let nextCursor;
3243
- if (choicesData.next_page !== void 0) {
3507
+ if (choicesData.next_page != null) {
3244
3508
  nextCursor = choicesData.next_page.toString();
3245
3509
  } else if (choicesData.links?.next) {
3246
3510
  try {
@@ -3264,7 +3528,18 @@ var listInputFieldChoicesPlugin = ({ context, sdk }) => {
3264
3528
  meta: {
3265
3529
  listInputFieldChoices: {
3266
3530
  categories: ["action"],
3267
- inputSchema: ListInputFieldChoicesSchema
3531
+ type: "list",
3532
+ itemType: "InputFieldChoice",
3533
+ inputSchema: ListInputFieldChoicesSchema,
3534
+ outputSchema: InputFieldChoiceItemSchema,
3535
+ resolvers: {
3536
+ appKey: appKeyResolver,
3537
+ actionType: actionTypeResolver,
3538
+ actionKey: actionKeyResolver,
3539
+ authenticationId: authenticationIdResolver,
3540
+ inputFieldKey: inputFieldKeyResolver,
3541
+ inputs: inputsAllOptionalResolver
3542
+ }
3268
3543
  }
3269
3544
  }
3270
3545
  }
@@ -3326,4 +3601,4 @@ function createZapierSdk(options = {}) {
3326
3601
  return createZapierSdkWithoutRegistry(options).addPlugin(registryPlugin);
3327
3602
  }
3328
3603
 
3329
- export { ActionKeyPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AuthenticationIdPropertySchema, DEFAULT_CONFIG_PATH, DebugPropertySchema, InputsPropertySchema, LimitPropertySchema, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, RelayFetchSchema, RelayRequestSchema, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, ZapierNotFoundError, ZapierResourceNotFoundError, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, authenticationIdResolver, createFunction, createSdk, createZapierSdk, createZapierSdkWithoutRegistry, fetchPlugin, findFirstAuthenticationPlugin, findManifestEntry, findUniqueAuthenticationPlugin, formatErrorMessage, getActionPlugin, getAppPlugin, getAuthenticationPlugin, getPreferredManifestEntryKey, getProfilePlugin, getResolutionOrder, getResolutionOrderForParams, getResolvableParams, getResolver, getResolversForMissingParams, getTokenFromCliLogin, getTokenFromEnv, getTokenFromEnvOrConfig, hasResolver, inputsResolver, isPositional, listActionsPlugin, listAppsPlugin, listAuthenticationsPlugin, listInputFieldsPlugin, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resolverRegistry, runActionPlugin };
3604
+ export { ActionKeyPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AuthenticationIdPropertySchema, DEFAULT_CONFIG_PATH, DebugPropertySchema, InputsPropertySchema, LimitPropertySchema, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, RelayFetchSchema, RelayRequestSchema, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, ZapierNotFoundError, ZapierResourceNotFoundError, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, authenticationIdGenericResolver, authenticationIdResolver, createFunction, createSdk, createZapierSdk, createZapierSdkWithoutRegistry, fetchPlugin, findFirstAuthenticationPlugin, findManifestEntry, findUniqueAuthenticationPlugin, formatErrorMessage, getActionPlugin, getAppPlugin, getAuthenticationPlugin, getPreferredManifestEntryKey, getProfilePlugin, getTokenFromCliLogin, getTokenFromEnv, getTokenFromEnvOrConfig, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, isPositional, listActionsPlugin, listAppsPlugin, listAuthenticationsPlugin, listInputFieldsPlugin, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, runActionPlugin };