@zapier/zapier-sdk 0.43.0 → 0.45.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 +75 -73
- package/dist/index.cjs +104 -113
- package/dist/index.d.mts +2486 -2467
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +104 -113
- package/dist/plugins/apps/index.d.ts +1 -1
- package/dist/plugins/apps/index.d.ts.map +1 -1
- package/dist/plugins/apps/index.js +4 -0
- package/dist/plugins/getInputFieldsSchema/schemas.js +1 -1
- package/dist/plugins/listInputFieldChoices/schemas.js +1 -1
- package/dist/plugins/listInputFields/schemas.js +1 -1
- package/dist/plugins/manifest/schemas.d.ts +2 -2
- package/dist/plugins/registry/index.d.ts +11 -16
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +9 -130
- package/dist/plugins/runAction/schemas.js +1 -1
- package/dist/registry.d.ts +9 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +77 -0
- package/dist/sdk.d.ts +20 -2
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +25 -9
- package/dist/types/connections.d.ts +2 -2
- package/dist/types/connections.d.ts.map +1 -1
- package/dist/types/connections.js +5 -3
- package/dist/types/plugin.d.ts +7 -1
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/properties.js +1 -1
- package/dist/types/registry.d.ts +49 -0
- package/dist/types/registry.d.ts.map +1 -0
- package/dist/types/registry.js +1 -0
- package/dist/types/sdk.d.ts +1 -78
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/utils/schema-utils.d.ts +1 -1
- package/dist/utils/schema-utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -53,11 +53,11 @@ export * from "./plugins/tables/createTableRecords";
|
|
|
53
53
|
export * from "./plugins/tables/deleteTableRecords";
|
|
54
54
|
export * from "./plugins/tables/updateTableRecords";
|
|
55
55
|
export { createZapierSdk, createZapierSdkWithoutRegistry, createSdk, createOptionsPlugin, ZapierSdkOptions, } from "./sdk";
|
|
56
|
-
export type { FunctionRegistryEntry, FunctionDeprecation } from "./types/
|
|
56
|
+
export type { FunctionRegistryEntry, FunctionDeprecation, } from "./types/registry";
|
|
57
57
|
export { BaseSdkOptionsSchema } from "./types/sdk";
|
|
58
58
|
export type { Plugin, PluginProvides, WithAddPlugin } from "./types/plugin";
|
|
59
59
|
export { registryPlugin } from "./plugins/registry";
|
|
60
|
-
export type { ZapierSdk } from "./
|
|
60
|
+
export type { ZapierSdk } from "./sdk";
|
|
61
61
|
export type { BaseEvent, MethodCalledEvent } from "./types/telemetry-events";
|
|
62
62
|
export type { EventEmissionContext, EventEmissionProvides, EventContext, ApplicationLifecycleEventData, EnhancedErrorEventData, MethodCalledEventData, } from "./plugins/eventEmission";
|
|
63
63
|
export { generateEventId, getCurrentTimestamp, getReleaseId, getOsInfo, getPlatformVersions, isCi, getCiPlatform, getMemoryUsage, getCpuTime, buildApplicationLifecycleEvent, buildErrorEventWithContext, buildErrorEvent, createBaseEvent, buildMethodCalledEvent, } from "./plugins/eventEmission";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAA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B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AAGpD,OAAO,EACL,eAAe,EACf,8BAA8B,EAC9B,SAAS,EACT,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,OAAO,CAAC;AAGf,YAAY,EACV,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG5E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,YAAY,EACZ,6BAA6B,EAC7B,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,mBAAmB,EACnB,IAAI,EACJ,aAAa,EACb,cAAc,EACd,UAAU,EACV,8BAA8B,EAC9B,0BAA0B,EAC1B,eAAe,EACf,eAAe,EACf,sBAAsB,GACvB,MAAM,yBAAyB,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -99,7 +99,7 @@ var AuthenticationIdPropertySchema = ConnectionIdPropertySchema.meta({
|
|
|
99
99
|
deprecated: true
|
|
100
100
|
});
|
|
101
101
|
var ConnectionPropertySchema = z.union([z.string(), z.number().int().positive()]).describe(
|
|
102
|
-
"Connection alias (
|
|
102
|
+
"Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly."
|
|
103
103
|
);
|
|
104
104
|
var InputsPropertySchema = z.record(z.string(), z.unknown()).describe("Input parameters for the action");
|
|
105
105
|
var LimitPropertySchema = z.number().int().min(1).max(MAX_PAGE_LIMIT).default(50).describe("Maximum number of items to return");
|
|
@@ -543,6 +543,10 @@ function createAppsProxy(options) {
|
|
|
543
543
|
}
|
|
544
544
|
var appsPlugin = (sdk) => {
|
|
545
545
|
return {
|
|
546
|
+
// Cast: ZapierSdkApps is augmented by user-generated .d.ts files to
|
|
547
|
+
// give specific types like `slack: SlackAppWithFactory`. At runtime
|
|
548
|
+
// the Proxy intercepts any property access, so the augmented entries
|
|
549
|
+
// always resolve correctly even though TS can't see that statically.
|
|
546
550
|
apps: createAppsProxy({ sdk }),
|
|
547
551
|
context: {
|
|
548
552
|
meta: {
|
|
@@ -3011,7 +3015,7 @@ var listActionsPlugin = (sdk) => {
|
|
|
3011
3015
|
var ListInputFieldsDescription = "Get the input fields required for a specific action";
|
|
3012
3016
|
var ListInputFieldsBaseSchema = z.object({
|
|
3013
3017
|
connection: ConnectionPropertySchema.optional().describe(
|
|
3014
|
-
"Connection alias (
|
|
3018
|
+
"Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly. Mutually exclusive with connectionId."
|
|
3015
3019
|
),
|
|
3016
3020
|
connectionId: ConnectionIdPropertySchema.nullable().optional().describe(
|
|
3017
3021
|
"Connection ID to use when listing input fields. Required if the action needs a connection to determine available fields."
|
|
@@ -4111,7 +4115,7 @@ var findUniqueConnectionPlugin = (sdk) => {
|
|
|
4111
4115
|
var RunActionDescription = "Execute an action with the given inputs";
|
|
4112
4116
|
var RunActionBaseSchema = z.object({
|
|
4113
4117
|
connection: ConnectionPropertySchema.optional().describe(
|
|
4114
|
-
"Connection alias (
|
|
4118
|
+
"Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly. Mutually exclusive with connectionId."
|
|
4115
4119
|
),
|
|
4116
4120
|
connectionId: ConnectionIdPropertySchema.nullable().optional().describe(
|
|
4117
4121
|
"Connection ID to use when running the action. Required if the action needs a connection to authenticate and interact with the service."
|
|
@@ -4490,8 +4494,12 @@ async function readFile(filePath) {
|
|
|
4490
4494
|
}
|
|
4491
4495
|
throw new Error(`File not found: ${filePath}`);
|
|
4492
4496
|
}
|
|
4497
|
+
var POSITIVE_INTEGER_OR_UUID = /^([1-9][0-9]*|[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
4493
4498
|
var ConnectionEntrySchema = z.object({
|
|
4494
|
-
connectionId: z.
|
|
4499
|
+
connectionId: z.union([
|
|
4500
|
+
z.string().regex(POSITIVE_INTEGER_OR_UUID),
|
|
4501
|
+
z.number().int().positive()
|
|
4502
|
+
]).describe("Zapier connection ID for the third-party service.")
|
|
4495
4503
|
});
|
|
4496
4504
|
var ConnectionsMapSchema = z.record(z.string(), ConnectionEntrySchema);
|
|
4497
4505
|
|
|
@@ -7871,119 +7879,75 @@ var updateTableRecordsPlugin = (sdk) => {
|
|
|
7871
7879
|
};
|
|
7872
7880
|
};
|
|
7873
7881
|
|
|
7874
|
-
// src/
|
|
7875
|
-
var
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
title: "Table"
|
|
7897
|
-
},
|
|
7898
|
-
http: {
|
|
7899
|
-
title: "HTTP Request"
|
|
7900
|
-
},
|
|
7901
|
-
utility: {
|
|
7902
|
-
title: "Utility",
|
|
7903
|
-
titlePlural: "Utilities"
|
|
7904
|
-
},
|
|
7905
|
-
other: {
|
|
7906
|
-
title: "Other"
|
|
7907
|
-
}
|
|
7908
|
-
};
|
|
7909
|
-
const functions = metaKeys.filter((key) => {
|
|
7882
|
+
// src/registry.ts
|
|
7883
|
+
var categoryDefinitions = {
|
|
7884
|
+
account: { title: "Account" },
|
|
7885
|
+
app: { title: "App", titlePlural: "Apps" },
|
|
7886
|
+
connection: { title: "Connection" },
|
|
7887
|
+
action: { title: "Action" },
|
|
7888
|
+
"client-credentials": {
|
|
7889
|
+
title: "Client Credentials",
|
|
7890
|
+
titlePlural: "Client Credentials"
|
|
7891
|
+
},
|
|
7892
|
+
table: { title: "Table" },
|
|
7893
|
+
http: { title: "HTTP Request" },
|
|
7894
|
+
utility: { title: "Utility", titlePlural: "Utilities" },
|
|
7895
|
+
other: { title: "Other" }
|
|
7896
|
+
};
|
|
7897
|
+
var knownCategories = Object.keys(categoryDefinitions);
|
|
7898
|
+
function buildRegistry({
|
|
7899
|
+
sdk,
|
|
7900
|
+
meta,
|
|
7901
|
+
packageFilter
|
|
7902
|
+
}) {
|
|
7903
|
+
const functions = Object.keys(meta).filter((key) => {
|
|
7910
7904
|
const property = sdk[key];
|
|
7911
|
-
if (typeof property === "function")
|
|
7912
|
-
return true;
|
|
7913
|
-
}
|
|
7905
|
+
if (typeof property === "function") return true;
|
|
7914
7906
|
const [rootKey] = key.split(".");
|
|
7915
7907
|
const rootProperty = sdk[rootKey];
|
|
7916
|
-
|
|
7917
|
-
return true;
|
|
7918
|
-
}
|
|
7919
|
-
return false;
|
|
7908
|
+
return typeof rootProperty === "object" && rootProperty !== null;
|
|
7920
7909
|
}).map((key) => {
|
|
7921
|
-
const
|
|
7910
|
+
const m = meta[key];
|
|
7922
7911
|
return {
|
|
7923
7912
|
name: key,
|
|
7924
|
-
description:
|
|
7925
|
-
type:
|
|
7926
|
-
itemType:
|
|
7927
|
-
returnType:
|
|
7928
|
-
inputSchema:
|
|
7929
|
-
inputParameters:
|
|
7930
|
-
outputSchema:
|
|
7931
|
-
categories:
|
|
7932
|
-
resolvers:
|
|
7933
|
-
formatter:
|
|
7934
|
-
packages:
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
supportsJsonOutput: meta.supportsJsonOutput ?? true
|
|
7913
|
+
description: m.description,
|
|
7914
|
+
type: m.type,
|
|
7915
|
+
itemType: m.itemType,
|
|
7916
|
+
returnType: m.returnType,
|
|
7917
|
+
inputSchema: m.inputSchema,
|
|
7918
|
+
inputParameters: m.inputParameters,
|
|
7919
|
+
outputSchema: m.outputSchema,
|
|
7920
|
+
categories: m.categories || [],
|
|
7921
|
+
resolvers: m.resolvers,
|
|
7922
|
+
formatter: m.formatter,
|
|
7923
|
+
packages: m.packages,
|
|
7924
|
+
confirm: m.confirm ?? (m.type === "delete" ? "delete" : void 0),
|
|
7925
|
+
deprecation: m.deprecation,
|
|
7926
|
+
aliases: m.aliases,
|
|
7927
|
+
supportsJsonOutput: m.supportsJsonOutput ?? true
|
|
7940
7928
|
};
|
|
7941
7929
|
}).sort((a, b) => a.name.localeCompare(b.name));
|
|
7942
|
-
const
|
|
7943
|
-
const
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
const
|
|
7951
|
-
(f) => (
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
const titleA = categoryDefinitions[a].title;
|
|
7960
|
-
const titleB = categoryDefinitions[b].title;
|
|
7961
|
-
return titleA.localeCompare(titleB);
|
|
7962
|
-
}).map((categoryKey) => {
|
|
7963
|
-
const categoryFunctions = filteredFunctions.filter(
|
|
7964
|
-
(f) => f.categories.includes(categoryKey) || // If the category is "other" and the function is not in any other category, include it
|
|
7965
|
-
categoryKey === "other" && !f.categories.some((c) => knownCategories.includes(c))
|
|
7966
|
-
).map((f) => f.name).sort();
|
|
7967
|
-
const definition = categoryDefinitions[categoryKey];
|
|
7968
|
-
const title = definition.title;
|
|
7969
|
-
return {
|
|
7970
|
-
key: categoryKey,
|
|
7971
|
-
title,
|
|
7972
|
-
titlePlural: definition.titlePlural ?? `${title}s`,
|
|
7973
|
-
functions: categoryFunctions
|
|
7974
|
-
};
|
|
7975
|
-
}).filter((category) => category.functions.length > 0);
|
|
7976
|
-
const result = {
|
|
7977
|
-
functions: filteredFunctions,
|
|
7978
|
-
categories: filteredCategories
|
|
7930
|
+
const filteredFunctions = packageFilter ? functions.filter((f) => !f.packages || f.packages.includes(packageFilter)) : functions;
|
|
7931
|
+
const filteredCategories = knownCategories.slice().sort((a, b) => {
|
|
7932
|
+
if (a === "other") return 1;
|
|
7933
|
+
if (b === "other") return -1;
|
|
7934
|
+
return categoryDefinitions[a].title.localeCompare(
|
|
7935
|
+
categoryDefinitions[b].title
|
|
7936
|
+
);
|
|
7937
|
+
}).map((categoryKey) => {
|
|
7938
|
+
const categoryFunctions = filteredFunctions.filter(
|
|
7939
|
+
(f) => f.categories.includes(categoryKey) || categoryKey === "other" && !f.categories.some((c) => knownCategories.includes(c))
|
|
7940
|
+
).map((f) => f.name).sort();
|
|
7941
|
+
const definition = categoryDefinitions[categoryKey];
|
|
7942
|
+
return {
|
|
7943
|
+
key: categoryKey,
|
|
7944
|
+
title: definition.title,
|
|
7945
|
+
titlePlural: definition.titlePlural ?? `${definition.title}s`,
|
|
7946
|
+
functions: categoryFunctions
|
|
7979
7947
|
};
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
return {
|
|
7984
|
-
getRegistry
|
|
7985
|
-
};
|
|
7986
|
-
};
|
|
7948
|
+
}).filter((category) => category.functions.length > 0);
|
|
7949
|
+
return { functions: filteredFunctions, categories: filteredCategories };
|
|
7950
|
+
}
|
|
7987
7951
|
|
|
7988
7952
|
// src/plugins/deprecated/authentications.ts
|
|
7989
7953
|
var listAuthenticationsPlugin = (sdk) => ({
|
|
@@ -8049,7 +8013,7 @@ var findUniqueAuthenticationPlugin = (sdk) => ({
|
|
|
8049
8013
|
var GetInputFieldsSchemaDescription = "Get the JSON Schema representation of input fields for an action. Returns a JSON Schema object describing the structure, types, and validation rules for the action's input parameters.";
|
|
8050
8014
|
var GetInputFieldsSchemaBaseSchema = z.object({
|
|
8051
8015
|
connection: ConnectionPropertySchema.optional().describe(
|
|
8052
|
-
"Connection alias (
|
|
8016
|
+
"Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly. Mutually exclusive with connectionId."
|
|
8053
8017
|
),
|
|
8054
8018
|
connectionId: ConnectionIdPropertySchema.nullable().optional().describe(
|
|
8055
8019
|
"Connection ID to use when fetching the schema. Required if the action needs a connection to determine available fields."
|
|
@@ -8187,7 +8151,7 @@ var InputFieldChoiceItemSchema = withFormatter(NeedChoicesSchema, {
|
|
|
8187
8151
|
var ListInputFieldChoicesDescription = "Get the available choices for a dynamic dropdown input field";
|
|
8188
8152
|
var ListInputFieldChoicesBaseSchema = z.object({
|
|
8189
8153
|
connection: ConnectionPropertySchema.optional().describe(
|
|
8190
|
-
"Connection alias (
|
|
8154
|
+
"Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly. Mutually exclusive with connectionId."
|
|
8191
8155
|
),
|
|
8192
8156
|
connectionId: ConnectionIdPropertySchema.nullable().optional().describe(
|
|
8193
8157
|
"Connection ID to use when listing available field choices. Required if the action needs a connection to populate dynamic dropdown options."
|
|
@@ -8984,13 +8948,28 @@ function createSdk() {
|
|
|
8984
8948
|
}
|
|
8985
8949
|
function buildSdk(properties, context) {
|
|
8986
8950
|
const frozenContext = Object.freeze(context);
|
|
8987
|
-
|
|
8951
|
+
const registryCache = /* @__PURE__ */ new Map();
|
|
8952
|
+
const sdk = {
|
|
8988
8953
|
...properties,
|
|
8989
8954
|
get context() {
|
|
8990
8955
|
return frozenContext;
|
|
8991
8956
|
},
|
|
8992
8957
|
getContext: () => frozenContext,
|
|
8993
8958
|
// runtime compat shim, not in types
|
|
8959
|
+
getRegistry(options) {
|
|
8960
|
+
const cacheKey = options?.package ?? "__all__";
|
|
8961
|
+
if (!registryCache.has(cacheKey)) {
|
|
8962
|
+
registryCache.set(
|
|
8963
|
+
cacheKey,
|
|
8964
|
+
buildRegistry({
|
|
8965
|
+
sdk,
|
|
8966
|
+
meta: frozenContext.meta,
|
|
8967
|
+
packageFilter: options?.package
|
|
8968
|
+
})
|
|
8969
|
+
);
|
|
8970
|
+
}
|
|
8971
|
+
return registryCache.get(cacheKey);
|
|
8972
|
+
},
|
|
8994
8973
|
addPlugin(plugin) {
|
|
8995
8974
|
const pluginResult = plugin({
|
|
8996
8975
|
...properties,
|
|
@@ -9021,12 +9000,16 @@ function buildSdk(properties, context) {
|
|
|
9021
9000
|
);
|
|
9022
9001
|
}
|
|
9023
9002
|
};
|
|
9003
|
+
return sdk;
|
|
9024
9004
|
}
|
|
9025
9005
|
function createZapierSdkWithoutRegistry(options = {}) {
|
|
9026
|
-
|
|
9006
|
+
logDeprecation(
|
|
9007
|
+
"createZapierSdkWithoutRegistry is deprecated; use createZapierSdk instead. getRegistry is now available on every sdk."
|
|
9008
|
+
);
|
|
9009
|
+
return createZapierSdk(options);
|
|
9027
9010
|
}
|
|
9028
9011
|
function createZapierSdk(options = {}) {
|
|
9029
|
-
return
|
|
9012
|
+
return createSdk().addPlugin(createOptionsPlugin(options)).addPlugin(eventEmissionPlugin).addPlugin(apiPlugin).addPlugin(manifestPlugin).addPlugin(capabilitiesPlugin).addPlugin(connectionsPlugin).addPlugin(listAppsPlugin).addPlugin(getAppPlugin).addPlugin(listActionsPlugin).addPlugin(getActionPlugin).addPlugin(listInputFieldsPlugin).addPlugin(getInputFieldsSchemaPlugin).addPlugin(listInputFieldChoicesPlugin).addPlugin(runActionPlugin).addPlugin(listConnectionsPlugin).addPlugin(getConnectionPlugin).addPlugin(findFirstConnectionPlugin).addPlugin(findUniqueConnectionPlugin).addPlugin(listAuthenticationsPlugin).addPlugin(getAuthenticationPlugin).addPlugin(findFirstAuthenticationPlugin).addPlugin(findUniqueAuthenticationPlugin).addPlugin(listClientCredentialsPlugin).addPlugin(createClientCredentialsPlugin).addPlugin(deleteClientCredentialsPlugin).addPlugin(fetchPlugin).addPlugin(requestPlugin).addPlugin(listTablesPlugin).addPlugin(getTablePlugin).addPlugin(deleteTablePlugin).addPlugin(createTablePlugin).addPlugin(listTableFieldsPlugin).addPlugin(createTableFieldsPlugin).addPlugin(deleteTableFieldsPlugin).addPlugin(getTableRecordPlugin).addPlugin(listTableRecordsPlugin).addPlugin(createTableRecordsPlugin).addPlugin(deleteTableRecordsPlugin).addPlugin(updateTableRecordsPlugin).addPlugin(appsPlugin).addPlugin(getProfilePlugin);
|
|
9030
9013
|
}
|
|
9031
9014
|
var BaseSdkOptionsSchema = z.object({
|
|
9032
9015
|
credentials: CredentialsSchema.optional().describe(
|
|
@@ -9070,4 +9053,12 @@ var BaseSdkOptionsSchema = z.object({
|
|
|
9070
9053
|
// Use credentials instead
|
|
9071
9054
|
});
|
|
9072
9055
|
|
|
9056
|
+
// src/plugins/registry/index.ts
|
|
9057
|
+
var registryPlugin = () => {
|
|
9058
|
+
logDeprecation(
|
|
9059
|
+
"registryPlugin is deprecated and a no-op; getRegistry is now built into every sdk. Remove .addPlugin(registryPlugin)."
|
|
9060
|
+
);
|
|
9061
|
+
return {};
|
|
9062
|
+
};
|
|
9063
|
+
|
|
9073
9064
|
export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DebugPropertySchema, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LimitPropertySchema, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierResourceNotFoundError, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createFunction, createOptionsPlugin, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierSdk, createZapierSdkWithoutRegistry, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getZapierApprovalMode, getZapierIsInteractive, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listInputFieldsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, updateTableRecordsPlugin };
|
|
@@ -3,7 +3,7 @@ import type { Plugin } from "../../types/plugin";
|
|
|
3
3
|
import type { FetchPluginProvides } from "../fetch/index";
|
|
4
4
|
import type { RunActionPluginProvides } from "../runAction/index";
|
|
5
5
|
export interface AppsPluginProvides {
|
|
6
|
-
apps: ActionProxy;
|
|
6
|
+
apps: ActionProxy & ZapierSdkApps;
|
|
7
7
|
}
|
|
8
8
|
export declare const appsPlugin: Plugin<FetchPluginProvides & RunActionPluginProvides, // requires fetch + runAction in SDK, no context requirements
|
|
9
9
|
AppsPluginProvides>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EAEZ,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGlE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EAEZ,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGlE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,WAAW,GAAG,aAAa,CAAC;CACnC;AAuOD,eAAO,MAAM,UAAU,EAAE,MAAM,CAC7B,mBAAmB,GAAG,uBAAuB,EAAE,6DAA6D;AAC5G,kBAAkB,CA6BnB,CAAC;AAGF,YAAY,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACzE,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAI7D,MAAM,WAAW,aAAa;CAAG"}
|
|
@@ -129,6 +129,10 @@ function createAppsProxy(options) {
|
|
|
129
129
|
export const appsPlugin = (sdk) => {
|
|
130
130
|
// Return flat structure - apps goes directly to SDK
|
|
131
131
|
return {
|
|
132
|
+
// Cast: ZapierSdkApps is augmented by user-generated .d.ts files to
|
|
133
|
+
// give specific types like `slack: SlackAppWithFactory`. At runtime
|
|
134
|
+
// the Proxy intercepts any property access, so the augmented entries
|
|
135
|
+
// always resolve correctly even though TS can't see that statically.
|
|
132
136
|
apps: createAppsProxy({ sdk }),
|
|
133
137
|
context: {
|
|
134
138
|
meta: {
|
|
@@ -3,7 +3,7 @@ import { AppKeyPropertySchema, AppPropertySchema, ActionTypePropertySchema, Acti
|
|
|
3
3
|
const GetInputFieldsSchemaDescription = "Get the JSON Schema representation of input fields for an action. Returns a JSON Schema object describing the structure, types, and validation rules for the action's input parameters.";
|
|
4
4
|
// Base schema for shared (optional) properties
|
|
5
5
|
const GetInputFieldsSchemaBaseSchema = z.object({
|
|
6
|
-
connection: ConnectionPropertySchema.optional().describe("Connection alias (
|
|
6
|
+
connection: ConnectionPropertySchema.optional().describe("Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly. Mutually exclusive with connectionId."),
|
|
7
7
|
connectionId: ConnectionIdPropertySchema.nullable()
|
|
8
8
|
.optional()
|
|
9
9
|
.describe("Connection ID to use when fetching the schema. Required if the action needs a connection to determine available fields.")
|
|
@@ -32,7 +32,7 @@ export const InputFieldChoiceItemSchema = withFormatter(NeedChoicesSchema, {
|
|
|
32
32
|
const ListInputFieldChoicesDescription = "Get the available choices for a dynamic dropdown input field";
|
|
33
33
|
// Base schema for shared (optional) properties
|
|
34
34
|
const ListInputFieldChoicesBaseSchema = z.object({
|
|
35
|
-
connection: ConnectionPropertySchema.optional().describe("Connection alias (
|
|
35
|
+
connection: ConnectionPropertySchema.optional().describe("Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly. Mutually exclusive with connectionId."),
|
|
36
36
|
connectionId: ConnectionIdPropertySchema.nullable()
|
|
37
37
|
.optional()
|
|
38
38
|
.describe("Connection ID to use when listing available field choices. Required if the action needs a connection to populate dynamic dropdown options.")
|
|
@@ -3,7 +3,7 @@ import { AppKeyPropertySchema, AppPropertySchema, ActionTypePropertySchema, Acti
|
|
|
3
3
|
const ListInputFieldsDescription = "Get the input fields required for a specific action";
|
|
4
4
|
// Base schema for shared (optional) properties
|
|
5
5
|
const ListInputFieldsBaseSchema = z.object({
|
|
6
|
-
connection: ConnectionPropertySchema.optional().describe("Connection alias (
|
|
6
|
+
connection: ConnectionPropertySchema.optional().describe("Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly. Mutually exclusive with connectionId."),
|
|
7
7
|
connectionId: ConnectionIdPropertySchema.nullable()
|
|
8
8
|
.optional()
|
|
9
9
|
.describe("Connection ID to use when listing input fields. Required if the action needs a connection to determine available fields.")
|
|
@@ -57,7 +57,7 @@ export declare const ManifestSchema: z.ZodObject<{
|
|
|
57
57
|
canIncludeSharedTables: z.ZodOptional<z.ZodBoolean>;
|
|
58
58
|
canDeleteTables: z.ZodOptional<z.ZodBoolean>;
|
|
59
59
|
connections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
60
|
-
connectionId: z.ZodNumber
|
|
60
|
+
connectionId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
61
61
|
}, z.core.$strip>>>;
|
|
62
62
|
}, z.core.$strip>;
|
|
63
63
|
export declare const ManifestPluginOptionsSchema: z.ZodObject<{
|
|
@@ -81,7 +81,7 @@ export declare const ManifestPluginOptionsSchema: z.ZodObject<{
|
|
|
81
81
|
canIncludeSharedTables: z.ZodOptional<z.ZodBoolean>;
|
|
82
82
|
canDeleteTables: z.ZodOptional<z.ZodBoolean>;
|
|
83
83
|
connections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
84
|
-
connectionId: z.ZodNumber
|
|
84
|
+
connectionId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
85
85
|
}, z.core.$strip>>>;
|
|
86
86
|
}, z.core.$strip>>;
|
|
87
87
|
}, z.core.$strip>;
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import type { Plugin } from "../../types/plugin";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Empty since the plugin no longer provides anything; the
|
|
4
|
+
* `getRegistry` method is now built into every sdk via `WithAddPlugin`.
|
|
5
|
+
* Kept as an export for any code that still references the type.
|
|
6
|
+
*/
|
|
5
7
|
export interface RegistryPluginProvides {
|
|
6
|
-
getRegistry: (options?: {
|
|
7
|
-
package?: string;
|
|
8
|
-
}) => {
|
|
9
|
-
functions: FunctionRegistryEntry[];
|
|
10
|
-
categories: {
|
|
11
|
-
key: string;
|
|
12
|
-
title: string;
|
|
13
|
-
titlePlural: string;
|
|
14
|
-
functions: string[];
|
|
15
|
-
}[];
|
|
16
|
-
};
|
|
17
8
|
}
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated `getRegistry` is now built into every sdk produced by
|
|
11
|
+
* `buildSdk`. Adding this plugin is a no-op. Remove the
|
|
12
|
+
* `.addPlugin(registryPlugin)` call.
|
|
13
|
+
*/
|
|
14
|
+
export declare const registryPlugin: Plugin<{}, {}>;
|
|
20
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/registry/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/registry/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjD;;;;GAIG;AAEH,MAAM,WAAW,sBAAsB;CAAG;AAE1C;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,CAKzC,CAAC"}
|
|
@@ -1,131 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
titlePlural: "Apps",
|
|
11
|
-
},
|
|
12
|
-
connection: {
|
|
13
|
-
title: "Connection",
|
|
14
|
-
},
|
|
15
|
-
action: {
|
|
16
|
-
title: "Action",
|
|
17
|
-
},
|
|
18
|
-
"client-credentials": {
|
|
19
|
-
title: "Client Credentials",
|
|
20
|
-
titlePlural: "Client Credentials",
|
|
21
|
-
},
|
|
22
|
-
table: {
|
|
23
|
-
title: "Table",
|
|
24
|
-
},
|
|
25
|
-
http: {
|
|
26
|
-
title: "HTTP Request",
|
|
27
|
-
},
|
|
28
|
-
utility: {
|
|
29
|
-
title: "Utility",
|
|
30
|
-
titlePlural: "Utilities",
|
|
31
|
-
},
|
|
32
|
-
other: {
|
|
33
|
-
title: "Other",
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
const functions = metaKeys
|
|
37
|
-
.filter((key) => {
|
|
38
|
-
const property = sdk[key];
|
|
39
|
-
if (typeof property === "function") {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
const [rootKey] = key.split(".");
|
|
43
|
-
const rootProperty = sdk[rootKey];
|
|
44
|
-
if (typeof rootProperty === "object" && rootProperty !== null) {
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
return false;
|
|
48
|
-
})
|
|
49
|
-
.map((key) => {
|
|
50
|
-
const meta = sdk.context.meta[key];
|
|
51
|
-
return {
|
|
52
|
-
name: key,
|
|
53
|
-
description: meta.description,
|
|
54
|
-
type: meta.type,
|
|
55
|
-
itemType: meta.itemType,
|
|
56
|
-
returnType: meta.returnType,
|
|
57
|
-
inputSchema: meta.inputSchema,
|
|
58
|
-
inputParameters: meta.inputParameters,
|
|
59
|
-
outputSchema: meta.outputSchema,
|
|
60
|
-
categories: meta.categories || [],
|
|
61
|
-
resolvers: meta.resolvers,
|
|
62
|
-
formatter: meta.formatter,
|
|
63
|
-
packages: meta.packages,
|
|
64
|
-
// Auto-infer confirm: "delete" from type: "delete" (all deletes should confirm)
|
|
65
|
-
confirm: meta.confirm ?? (meta.type === "delete" ? "delete" : undefined),
|
|
66
|
-
deprecation: meta.deprecation,
|
|
67
|
-
aliases: meta.aliases,
|
|
68
|
-
supportsJsonOutput: meta.supportsJsonOutput ?? true,
|
|
69
|
-
};
|
|
70
|
-
})
|
|
71
|
-
.sort((a, b) => a.name.localeCompare(b.name));
|
|
72
|
-
const knownCategories = Object.keys(categoryDefinitions);
|
|
73
|
-
// Cache the entire registry result for each package
|
|
74
|
-
const registryCache = new Map();
|
|
75
|
-
function getRegistry(options) {
|
|
76
|
-
const packageFilter = options?.package;
|
|
77
|
-
const cacheKey = packageFilter || "__all__";
|
|
78
|
-
// Return cached result if available
|
|
79
|
-
if (registryCache.has(cacheKey)) {
|
|
80
|
-
return registryCache.get(cacheKey);
|
|
81
|
-
}
|
|
82
|
-
// Filter functions by package if specified
|
|
83
|
-
const filteredFunctions = packageFilter
|
|
84
|
-
? functions.filter((f) =>
|
|
85
|
-
// Include if packages is undefined (belongs to all packages) or includes the specified package
|
|
86
|
-
!f.packages || f.packages.includes(packageFilter))
|
|
87
|
-
: functions;
|
|
88
|
-
// Build categories with filtered functions
|
|
89
|
-
const filteredCategories = knownCategories
|
|
90
|
-
.sort((a, b) => {
|
|
91
|
-
// Keep "other" category last
|
|
92
|
-
if (a === "other")
|
|
93
|
-
return 1;
|
|
94
|
-
if (b === "other")
|
|
95
|
-
return -1;
|
|
96
|
-
// Alphabetize by title, not key
|
|
97
|
-
const titleA = categoryDefinitions[a].title;
|
|
98
|
-
const titleB = categoryDefinitions[b].title;
|
|
99
|
-
return titleA.localeCompare(titleB);
|
|
100
|
-
})
|
|
101
|
-
.map((categoryKey) => {
|
|
102
|
-
// Find the functions that are in this category and match the package filter
|
|
103
|
-
const categoryFunctions = filteredFunctions
|
|
104
|
-
.filter((f) => f.categories.includes(categoryKey) ||
|
|
105
|
-
// If the category is "other" and the function is not in any other category, include it
|
|
106
|
-
(categoryKey === "other" &&
|
|
107
|
-
!f.categories.some((c) => knownCategories.includes(c))))
|
|
108
|
-
.map((f) => f.name)
|
|
109
|
-
.sort(); // Alphabetize functions within each category
|
|
110
|
-
const definition = categoryDefinitions[categoryKey];
|
|
111
|
-
const title = definition.title;
|
|
112
|
-
return {
|
|
113
|
-
key: categoryKey,
|
|
114
|
-
title,
|
|
115
|
-
titlePlural: definition.titlePlural ?? `${title}s`,
|
|
116
|
-
functions: categoryFunctions,
|
|
117
|
-
};
|
|
118
|
-
})
|
|
119
|
-
.filter((category) => category.functions.length > 0); // Only include categories with functions
|
|
120
|
-
const result = {
|
|
121
|
-
functions: filteredFunctions,
|
|
122
|
-
categories: filteredCategories,
|
|
123
|
-
};
|
|
124
|
-
// Cache the result
|
|
125
|
-
registryCache.set(cacheKey, result);
|
|
126
|
-
return result;
|
|
127
|
-
}
|
|
128
|
-
return {
|
|
129
|
-
getRegistry,
|
|
130
|
-
};
|
|
1
|
+
import { logDeprecation } from "../../utils/logging";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated `getRegistry` is now built into every sdk produced by
|
|
4
|
+
* `buildSdk`. Adding this plugin is a no-op. Remove the
|
|
5
|
+
* `.addPlugin(registryPlugin)` call.
|
|
6
|
+
*/
|
|
7
|
+
export const registryPlugin = () => {
|
|
8
|
+
logDeprecation("registryPlugin is deprecated and a no-op; getRegistry is now built into every sdk. Remove .addPlugin(registryPlugin).");
|
|
9
|
+
return {};
|
|
131
10
|
};
|
|
@@ -3,7 +3,7 @@ import { AppKeyPropertySchema, AppPropertySchema, ActionTypePropertySchema, Acti
|
|
|
3
3
|
const RunActionDescription = "Execute an action with the given inputs";
|
|
4
4
|
// Base schema for shared properties
|
|
5
5
|
const RunActionBaseSchema = z.object({
|
|
6
|
-
connection: ConnectionPropertySchema.optional().describe("Connection alias (
|
|
6
|
+
connection: ConnectionPropertySchema.optional().describe("Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly. Mutually exclusive with connectionId."),
|
|
7
7
|
connectionId: ConnectionIdPropertySchema.nullable()
|
|
8
8
|
.optional()
|
|
9
9
|
.describe("Connection ID to use when running the action. Required if the action needs a connection to authenticate and interact with the service.")
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PluginMeta } from "./types/plugin";
|
|
2
|
+
import type { RegistryResult } from "./types/registry";
|
|
3
|
+
export type { RegistryResult } from "./types/registry";
|
|
4
|
+
export declare function buildRegistry({ sdk, meta, packageFilter, }: {
|
|
5
|
+
sdk: Record<string, unknown>;
|
|
6
|
+
meta: Record<string, PluginMeta>;
|
|
7
|
+
packageFilter?: string;
|
|
8
|
+
}): RegistryResult;
|
|
9
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAsBvD,wBAAgB,aAAa,CAAC,EAC5B,GAAG,EACH,IAAI,EACJ,aAAa,GACd,EAAE;IACD,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,cAAc,CAmEjB"}
|