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