@zapier/zapier-sdk 0.44.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 +6 -0
- package/dist/index.cjs +94 -107
- package/dist/index.d.mts +2483 -2464
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +94 -107
- 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/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/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/plugin.d.ts +7 -1
- package/dist/types/plugin.d.ts.map +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,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAG/C,YAAY,EACV,iCAAiC,EACjC,+BAA+B,EAC/B,qCAAqC,EACrC,sCAAsC,GACvC,MAAM,sCAAsC,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oB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,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
|
@@ -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: {
|
|
@@ -7875,119 +7879,75 @@ var updateTableRecordsPlugin = (sdk) => {
|
|
|
7875
7879
|
};
|
|
7876
7880
|
};
|
|
7877
7881
|
|
|
7878
|
-
// src/
|
|
7879
|
-
var
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
title: "Table"
|
|
7901
|
-
},
|
|
7902
|
-
http: {
|
|
7903
|
-
title: "HTTP Request"
|
|
7904
|
-
},
|
|
7905
|
-
utility: {
|
|
7906
|
-
title: "Utility",
|
|
7907
|
-
titlePlural: "Utilities"
|
|
7908
|
-
},
|
|
7909
|
-
other: {
|
|
7910
|
-
title: "Other"
|
|
7911
|
-
}
|
|
7912
|
-
};
|
|
7913
|
-
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) => {
|
|
7914
7904
|
const property = sdk[key];
|
|
7915
|
-
if (typeof property === "function")
|
|
7916
|
-
return true;
|
|
7917
|
-
}
|
|
7905
|
+
if (typeof property === "function") return true;
|
|
7918
7906
|
const [rootKey] = key.split(".");
|
|
7919
7907
|
const rootProperty = sdk[rootKey];
|
|
7920
|
-
|
|
7921
|
-
return true;
|
|
7922
|
-
}
|
|
7923
|
-
return false;
|
|
7908
|
+
return typeof rootProperty === "object" && rootProperty !== null;
|
|
7924
7909
|
}).map((key) => {
|
|
7925
|
-
const
|
|
7910
|
+
const m = meta[key];
|
|
7926
7911
|
return {
|
|
7927
7912
|
name: key,
|
|
7928
|
-
description:
|
|
7929
|
-
type:
|
|
7930
|
-
itemType:
|
|
7931
|
-
returnType:
|
|
7932
|
-
inputSchema:
|
|
7933
|
-
inputParameters:
|
|
7934
|
-
outputSchema:
|
|
7935
|
-
categories:
|
|
7936
|
-
resolvers:
|
|
7937
|
-
formatter:
|
|
7938
|
-
packages:
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
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
|
|
7944
7928
|
};
|
|
7945
7929
|
}).sort((a, b) => a.name.localeCompare(b.name));
|
|
7946
|
-
const
|
|
7947
|
-
const
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
const
|
|
7955
|
-
(f) => (
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
const titleA = categoryDefinitions[a].title;
|
|
7964
|
-
const titleB = categoryDefinitions[b].title;
|
|
7965
|
-
return titleA.localeCompare(titleB);
|
|
7966
|
-
}).map((categoryKey) => {
|
|
7967
|
-
const categoryFunctions = filteredFunctions.filter(
|
|
7968
|
-
(f) => f.categories.includes(categoryKey) || // If the category is "other" and the function is not in any other category, include it
|
|
7969
|
-
categoryKey === "other" && !f.categories.some((c) => knownCategories.includes(c))
|
|
7970
|
-
).map((f) => f.name).sort();
|
|
7971
|
-
const definition = categoryDefinitions[categoryKey];
|
|
7972
|
-
const title = definition.title;
|
|
7973
|
-
return {
|
|
7974
|
-
key: categoryKey,
|
|
7975
|
-
title,
|
|
7976
|
-
titlePlural: definition.titlePlural ?? `${title}s`,
|
|
7977
|
-
functions: categoryFunctions
|
|
7978
|
-
};
|
|
7979
|
-
}).filter((category) => category.functions.length > 0);
|
|
7980
|
-
const result = {
|
|
7981
|
-
functions: filteredFunctions,
|
|
7982
|
-
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
|
|
7983
7947
|
};
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
return {
|
|
7988
|
-
getRegistry
|
|
7989
|
-
};
|
|
7990
|
-
};
|
|
7948
|
+
}).filter((category) => category.functions.length > 0);
|
|
7949
|
+
return { functions: filteredFunctions, categories: filteredCategories };
|
|
7950
|
+
}
|
|
7991
7951
|
|
|
7992
7952
|
// src/plugins/deprecated/authentications.ts
|
|
7993
7953
|
var listAuthenticationsPlugin = (sdk) => ({
|
|
@@ -8988,13 +8948,28 @@ function createSdk() {
|
|
|
8988
8948
|
}
|
|
8989
8949
|
function buildSdk(properties, context) {
|
|
8990
8950
|
const frozenContext = Object.freeze(context);
|
|
8991
|
-
|
|
8951
|
+
const registryCache = /* @__PURE__ */ new Map();
|
|
8952
|
+
const sdk = {
|
|
8992
8953
|
...properties,
|
|
8993
8954
|
get context() {
|
|
8994
8955
|
return frozenContext;
|
|
8995
8956
|
},
|
|
8996
8957
|
getContext: () => frozenContext,
|
|
8997
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
|
+
},
|
|
8998
8973
|
addPlugin(plugin) {
|
|
8999
8974
|
const pluginResult = plugin({
|
|
9000
8975
|
...properties,
|
|
@@ -9025,12 +9000,16 @@ function buildSdk(properties, context) {
|
|
|
9025
9000
|
);
|
|
9026
9001
|
}
|
|
9027
9002
|
};
|
|
9003
|
+
return sdk;
|
|
9028
9004
|
}
|
|
9029
9005
|
function createZapierSdkWithoutRegistry(options = {}) {
|
|
9030
|
-
|
|
9006
|
+
logDeprecation(
|
|
9007
|
+
"createZapierSdkWithoutRegistry is deprecated; use createZapierSdk instead. getRegistry is now available on every sdk."
|
|
9008
|
+
);
|
|
9009
|
+
return createZapierSdk(options);
|
|
9031
9010
|
}
|
|
9032
9011
|
function createZapierSdk(options = {}) {
|
|
9033
|
-
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);
|
|
9034
9013
|
}
|
|
9035
9014
|
var BaseSdkOptionsSchema = z.object({
|
|
9036
9015
|
credentials: CredentialsSchema.optional().describe(
|
|
@@ -9074,4 +9053,12 @@ var BaseSdkOptionsSchema = z.object({
|
|
|
9074
9053
|
// Use credentials instead
|
|
9075
9054
|
});
|
|
9076
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
|
+
|
|
9077
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: {
|
|
@@ -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
|
};
|
|
@@ -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"}
|
package/dist/registry.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const categoryDefinitions = {
|
|
2
|
+
account: { title: "Account" },
|
|
3
|
+
app: { title: "App", titlePlural: "Apps" },
|
|
4
|
+
connection: { title: "Connection" },
|
|
5
|
+
action: { title: "Action" },
|
|
6
|
+
"client-credentials": {
|
|
7
|
+
title: "Client Credentials",
|
|
8
|
+
titlePlural: "Client Credentials",
|
|
9
|
+
},
|
|
10
|
+
table: { title: "Table" },
|
|
11
|
+
http: { title: "HTTP Request" },
|
|
12
|
+
utility: { title: "Utility", titlePlural: "Utilities" },
|
|
13
|
+
other: { title: "Other" },
|
|
14
|
+
};
|
|
15
|
+
const knownCategories = Object.keys(categoryDefinitions);
|
|
16
|
+
export function buildRegistry({ sdk, meta, packageFilter, }) {
|
|
17
|
+
const functions = Object.keys(meta)
|
|
18
|
+
.filter((key) => {
|
|
19
|
+
const property = sdk[key];
|
|
20
|
+
if (typeof property === "function")
|
|
21
|
+
return true;
|
|
22
|
+
const [rootKey] = key.split(".");
|
|
23
|
+
const rootProperty = sdk[rootKey];
|
|
24
|
+
return typeof rootProperty === "object" && rootProperty !== null;
|
|
25
|
+
})
|
|
26
|
+
.map((key) => {
|
|
27
|
+
const m = meta[key];
|
|
28
|
+
return {
|
|
29
|
+
name: key,
|
|
30
|
+
description: m.description,
|
|
31
|
+
type: m.type,
|
|
32
|
+
itemType: m.itemType,
|
|
33
|
+
returnType: m.returnType,
|
|
34
|
+
inputSchema: m.inputSchema,
|
|
35
|
+
inputParameters: m.inputParameters,
|
|
36
|
+
outputSchema: m.outputSchema,
|
|
37
|
+
categories: m.categories || [],
|
|
38
|
+
resolvers: m.resolvers,
|
|
39
|
+
formatter: m.formatter,
|
|
40
|
+
packages: m.packages,
|
|
41
|
+
confirm: m.confirm ?? (m.type === "delete" ? "delete" : undefined),
|
|
42
|
+
deprecation: m.deprecation,
|
|
43
|
+
aliases: m.aliases,
|
|
44
|
+
supportsJsonOutput: m.supportsJsonOutput ?? true,
|
|
45
|
+
};
|
|
46
|
+
})
|
|
47
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
48
|
+
const filteredFunctions = packageFilter
|
|
49
|
+
? functions.filter((f) => !f.packages || f.packages.includes(packageFilter))
|
|
50
|
+
: functions;
|
|
51
|
+
const filteredCategories = knownCategories
|
|
52
|
+
.slice()
|
|
53
|
+
.sort((a, b) => {
|
|
54
|
+
if (a === "other")
|
|
55
|
+
return 1;
|
|
56
|
+
if (b === "other")
|
|
57
|
+
return -1;
|
|
58
|
+
return categoryDefinitions[a].title.localeCompare(categoryDefinitions[b].title);
|
|
59
|
+
})
|
|
60
|
+
.map((categoryKey) => {
|
|
61
|
+
const categoryFunctions = filteredFunctions
|
|
62
|
+
.filter((f) => f.categories.includes(categoryKey) ||
|
|
63
|
+
(categoryKey === "other" &&
|
|
64
|
+
!f.categories.some((c) => knownCategories.includes(c))))
|
|
65
|
+
.map((f) => f.name)
|
|
66
|
+
.sort();
|
|
67
|
+
const definition = categoryDefinitions[categoryKey];
|
|
68
|
+
return {
|
|
69
|
+
key: categoryKey,
|
|
70
|
+
title: definition.title,
|
|
71
|
+
titlePlural: definition.titlePlural ?? `${definition.title}s`,
|
|
72
|
+
functions: categoryFunctions,
|
|
73
|
+
};
|
|
74
|
+
})
|
|
75
|
+
.filter((category) => category.functions.length > 0);
|
|
76
|
+
return { functions: filteredFunctions, categories: filteredCategories };
|
|
77
|
+
}
|
package/dist/sdk.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { BaseSdkOptions
|
|
1
|
+
import type { BaseSdkOptions } from "./types/sdk";
|
|
2
2
|
import type { WithAddPlugin, Plugin, PluginProvides, PluginMeta } from "./types/plugin";
|
|
3
|
+
import { type RegistryResult } from "./registry";
|
|
3
4
|
export interface ZapierSdkOptions extends BaseSdkOptions {
|
|
4
5
|
}
|
|
5
6
|
export declare function createOptionsPlugin(options: ZapierSdkOptions): () => {
|
|
@@ -14,6 +15,9 @@ export declare function createSdk(): {
|
|
|
14
15
|
getContext: () => Readonly<{
|
|
15
16
|
meta: Record<string, PluginMeta>;
|
|
16
17
|
}>;
|
|
18
|
+
getRegistry(options?: {
|
|
19
|
+
package?: string;
|
|
20
|
+
} | undefined): RegistryResult;
|
|
17
21
|
addPlugin<TProvides extends PluginProvides>(plugin: Plugin<{
|
|
18
22
|
context: {
|
|
19
23
|
meta: Record<string, PluginMeta>;
|
|
@@ -24,6 +28,11 @@ export declare function createSdk(): {
|
|
|
24
28
|
};
|
|
25
29
|
} & TProvides>;
|
|
26
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated `getRegistry` is now built into every sdk, so the "without
|
|
33
|
+
* registry" form has no behavioral difference from {@link createZapierSdk}.
|
|
34
|
+
* Use {@link createZapierSdk} instead.
|
|
35
|
+
*/
|
|
27
36
|
export declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): WithAddPlugin<{
|
|
28
37
|
context: {
|
|
29
38
|
meta: Record<string, PluginMeta>;
|
|
@@ -33,5 +42,14 @@ export declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOption
|
|
|
33
42
|
options: ZapierSdkOptions;
|
|
34
43
|
};
|
|
35
44
|
} & import(".").EventEmissionProvides & import(".").ApiPluginProvides & import(".").ManifestPluginProvides & import("./plugins/capabilities").CapabilitiesPluginProvides & import(".").ConnectionsPluginProvides & import(".").ListAppsPluginProvides & import(".").GetAppPluginProvides & import(".").ListActionsPluginProvides & import(".").GetActionPluginProvides & import(".").ListInputFieldsPluginProvides & import("./plugins/getInputFieldsSchema").GetInputFieldsSchemaPluginProvides & import("./plugins/listInputFieldChoices").ListInputFieldChoicesPluginProvides & import(".").RunActionPluginProvides & import(".").ListConnectionsPluginProvides & import(".").GetConnectionPluginProvides & import(".").FindFirstConnectionPluginProvides & import(".").FindUniqueConnectionPluginProvides & import(".").ListAuthenticationsPluginProvides & import(".").GetAuthenticationPluginProvides & import(".").FindFirstAuthenticationPluginProvides & import(".").FindUniqueAuthenticationPluginProvides & import(".").ListClientCredentialsPluginProvides & import(".").CreateClientCredentialsPluginProvides & import(".").DeleteClientCredentialsPluginProvides & import(".").FetchPluginProvides & import(".").RequestPluginProvides & import(".").ListTablesPluginProvides & import(".").GetTablePluginProvides & import(".").DeleteTablePluginProvides & import(".").CreateTablePluginProvides & import(".").ListTableFieldsPluginProvides & import(".").CreateTableFieldsPluginProvides & import(".").DeleteTableFieldsPluginProvides & import(".").GetTableRecordPluginProvides & import(".").ListTableRecordsPluginProvides & import(".").CreateTableRecordsPluginProvides & import(".").DeleteTableRecordsPluginProvides & import(".").UpdateTableRecordsPluginProvides & import(".").AppsPluginProvides & import(".").GetProfilePluginProvides>;
|
|
36
|
-
export declare function createZapierSdk(options?: ZapierSdkOptions):
|
|
45
|
+
export declare function createZapierSdk(options?: ZapierSdkOptions): WithAddPlugin<{
|
|
46
|
+
context: {
|
|
47
|
+
meta: Record<string, PluginMeta>;
|
|
48
|
+
};
|
|
49
|
+
} & {
|
|
50
|
+
context: {
|
|
51
|
+
options: ZapierSdkOptions;
|
|
52
|
+
};
|
|
53
|
+
} & import(".").EventEmissionProvides & import(".").ApiPluginProvides & import(".").ManifestPluginProvides & import("./plugins/capabilities").CapabilitiesPluginProvides & import(".").ConnectionsPluginProvides & import(".").ListAppsPluginProvides & import(".").GetAppPluginProvides & import(".").ListActionsPluginProvides & import(".").GetActionPluginProvides & import(".").ListInputFieldsPluginProvides & import("./plugins/getInputFieldsSchema").GetInputFieldsSchemaPluginProvides & import("./plugins/listInputFieldChoices").ListInputFieldChoicesPluginProvides & import(".").RunActionPluginProvides & import(".").ListConnectionsPluginProvides & import(".").GetConnectionPluginProvides & import(".").FindFirstConnectionPluginProvides & import(".").FindUniqueConnectionPluginProvides & import(".").ListAuthenticationsPluginProvides & import(".").GetAuthenticationPluginProvides & import(".").FindFirstAuthenticationPluginProvides & import(".").FindUniqueAuthenticationPluginProvides & import(".").ListClientCredentialsPluginProvides & import(".").CreateClientCredentialsPluginProvides & import(".").DeleteClientCredentialsPluginProvides & import(".").FetchPluginProvides & import(".").RequestPluginProvides & import(".").ListTablesPluginProvides & import(".").GetTablePluginProvides & import(".").DeleteTablePluginProvides & import(".").CreateTablePluginProvides & import(".").ListTableFieldsPluginProvides & import(".").CreateTableFieldsPluginProvides & import(".").DeleteTableFieldsPluginProvides & import(".").GetTableRecordPluginProvides & import(".").ListTableRecordsPluginProvides & import(".").CreateTableRecordsPluginProvides & import(".").DeleteTableRecordsPluginProvides & import(".").UpdateTableRecordsPluginProvides & import(".").AppsPluginProvides & import(".").GetProfilePluginProvides>;
|
|
54
|
+
export type ZapierSdk = ReturnType<typeof createZapierSdk>;
|
|
37
55
|
//# sourceMappingURL=sdk.d.ts.map
|