@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @zapier/zapier-sdk
|
|
2
2
|
|
|
3
|
+
## 0.45.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 15dce25: `registryPlugin` is now deprecated, because `getRegistry` is built into the SDK and added after each plugin is added. Plugins will always be registered; there is no need to call `createZapierSdkWithoutRegistry`, add custom plugins, and then `.addPlugin(registryPlugin)`. Because of this, `createZapierSdkWithoutRegistry` is now deprecated, and calling it will still give you an SDK with `getRegistry` on it. Calling `addPlugin(registryPlugin)` on that SDK is a no-op.
|
|
8
|
+
|
|
3
9
|
## 0.44.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -545,6 +545,10 @@ function createAppsProxy(options) {
|
|
|
545
545
|
}
|
|
546
546
|
var appsPlugin = (sdk) => {
|
|
547
547
|
return {
|
|
548
|
+
// Cast: ZapierSdkApps is augmented by user-generated .d.ts files to
|
|
549
|
+
// give specific types like `slack: SlackAppWithFactory`. At runtime
|
|
550
|
+
// the Proxy intercepts any property access, so the augmented entries
|
|
551
|
+
// always resolve correctly even though TS can't see that statically.
|
|
548
552
|
apps: createAppsProxy({ sdk }),
|
|
549
553
|
context: {
|
|
550
554
|
meta: {
|
|
@@ -7877,119 +7881,75 @@ var updateTableRecordsPlugin = (sdk) => {
|
|
|
7877
7881
|
};
|
|
7878
7882
|
};
|
|
7879
7883
|
|
|
7880
|
-
// src/
|
|
7881
|
-
var
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
title: "Table"
|
|
7903
|
-
},
|
|
7904
|
-
http: {
|
|
7905
|
-
title: "HTTP Request"
|
|
7906
|
-
},
|
|
7907
|
-
utility: {
|
|
7908
|
-
title: "Utility",
|
|
7909
|
-
titlePlural: "Utilities"
|
|
7910
|
-
},
|
|
7911
|
-
other: {
|
|
7912
|
-
title: "Other"
|
|
7913
|
-
}
|
|
7914
|
-
};
|
|
7915
|
-
const functions = metaKeys.filter((key) => {
|
|
7884
|
+
// src/registry.ts
|
|
7885
|
+
var categoryDefinitions = {
|
|
7886
|
+
account: { title: "Account" },
|
|
7887
|
+
app: { title: "App", titlePlural: "Apps" },
|
|
7888
|
+
connection: { title: "Connection" },
|
|
7889
|
+
action: { title: "Action" },
|
|
7890
|
+
"client-credentials": {
|
|
7891
|
+
title: "Client Credentials",
|
|
7892
|
+
titlePlural: "Client Credentials"
|
|
7893
|
+
},
|
|
7894
|
+
table: { title: "Table" },
|
|
7895
|
+
http: { title: "HTTP Request" },
|
|
7896
|
+
utility: { title: "Utility", titlePlural: "Utilities" },
|
|
7897
|
+
other: { title: "Other" }
|
|
7898
|
+
};
|
|
7899
|
+
var knownCategories = Object.keys(categoryDefinitions);
|
|
7900
|
+
function buildRegistry({
|
|
7901
|
+
sdk,
|
|
7902
|
+
meta,
|
|
7903
|
+
packageFilter
|
|
7904
|
+
}) {
|
|
7905
|
+
const functions = Object.keys(meta).filter((key) => {
|
|
7916
7906
|
const property = sdk[key];
|
|
7917
|
-
if (typeof property === "function")
|
|
7918
|
-
return true;
|
|
7919
|
-
}
|
|
7907
|
+
if (typeof property === "function") return true;
|
|
7920
7908
|
const [rootKey] = key.split(".");
|
|
7921
7909
|
const rootProperty = sdk[rootKey];
|
|
7922
|
-
|
|
7923
|
-
return true;
|
|
7924
|
-
}
|
|
7925
|
-
return false;
|
|
7910
|
+
return typeof rootProperty === "object" && rootProperty !== null;
|
|
7926
7911
|
}).map((key) => {
|
|
7927
|
-
const
|
|
7912
|
+
const m = meta[key];
|
|
7928
7913
|
return {
|
|
7929
7914
|
name: key,
|
|
7930
|
-
description:
|
|
7931
|
-
type:
|
|
7932
|
-
itemType:
|
|
7933
|
-
returnType:
|
|
7934
|
-
inputSchema:
|
|
7935
|
-
inputParameters:
|
|
7936
|
-
outputSchema:
|
|
7937
|
-
categories:
|
|
7938
|
-
resolvers:
|
|
7939
|
-
formatter:
|
|
7940
|
-
packages:
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
supportsJsonOutput: meta.supportsJsonOutput ?? true
|
|
7915
|
+
description: m.description,
|
|
7916
|
+
type: m.type,
|
|
7917
|
+
itemType: m.itemType,
|
|
7918
|
+
returnType: m.returnType,
|
|
7919
|
+
inputSchema: m.inputSchema,
|
|
7920
|
+
inputParameters: m.inputParameters,
|
|
7921
|
+
outputSchema: m.outputSchema,
|
|
7922
|
+
categories: m.categories || [],
|
|
7923
|
+
resolvers: m.resolvers,
|
|
7924
|
+
formatter: m.formatter,
|
|
7925
|
+
packages: m.packages,
|
|
7926
|
+
confirm: m.confirm ?? (m.type === "delete" ? "delete" : void 0),
|
|
7927
|
+
deprecation: m.deprecation,
|
|
7928
|
+
aliases: m.aliases,
|
|
7929
|
+
supportsJsonOutput: m.supportsJsonOutput ?? true
|
|
7946
7930
|
};
|
|
7947
7931
|
}).sort((a, b) => a.name.localeCompare(b.name));
|
|
7948
|
-
const
|
|
7949
|
-
const
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
const
|
|
7957
|
-
(f) => (
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
const titleA = categoryDefinitions[a].title;
|
|
7966
|
-
const titleB = categoryDefinitions[b].title;
|
|
7967
|
-
return titleA.localeCompare(titleB);
|
|
7968
|
-
}).map((categoryKey) => {
|
|
7969
|
-
const categoryFunctions = filteredFunctions.filter(
|
|
7970
|
-
(f) => f.categories.includes(categoryKey) || // If the category is "other" and the function is not in any other category, include it
|
|
7971
|
-
categoryKey === "other" && !f.categories.some((c) => knownCategories.includes(c))
|
|
7972
|
-
).map((f) => f.name).sort();
|
|
7973
|
-
const definition = categoryDefinitions[categoryKey];
|
|
7974
|
-
const title = definition.title;
|
|
7975
|
-
return {
|
|
7976
|
-
key: categoryKey,
|
|
7977
|
-
title,
|
|
7978
|
-
titlePlural: definition.titlePlural ?? `${title}s`,
|
|
7979
|
-
functions: categoryFunctions
|
|
7980
|
-
};
|
|
7981
|
-
}).filter((category) => category.functions.length > 0);
|
|
7982
|
-
const result = {
|
|
7983
|
-
functions: filteredFunctions,
|
|
7984
|
-
categories: filteredCategories
|
|
7932
|
+
const filteredFunctions = packageFilter ? functions.filter((f) => !f.packages || f.packages.includes(packageFilter)) : functions;
|
|
7933
|
+
const filteredCategories = knownCategories.slice().sort((a, b) => {
|
|
7934
|
+
if (a === "other") return 1;
|
|
7935
|
+
if (b === "other") return -1;
|
|
7936
|
+
return categoryDefinitions[a].title.localeCompare(
|
|
7937
|
+
categoryDefinitions[b].title
|
|
7938
|
+
);
|
|
7939
|
+
}).map((categoryKey) => {
|
|
7940
|
+
const categoryFunctions = filteredFunctions.filter(
|
|
7941
|
+
(f) => f.categories.includes(categoryKey) || categoryKey === "other" && !f.categories.some((c) => knownCategories.includes(c))
|
|
7942
|
+
).map((f) => f.name).sort();
|
|
7943
|
+
const definition = categoryDefinitions[categoryKey];
|
|
7944
|
+
return {
|
|
7945
|
+
key: categoryKey,
|
|
7946
|
+
title: definition.title,
|
|
7947
|
+
titlePlural: definition.titlePlural ?? `${definition.title}s`,
|
|
7948
|
+
functions: categoryFunctions
|
|
7985
7949
|
};
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
return {
|
|
7990
|
-
getRegistry
|
|
7991
|
-
};
|
|
7992
|
-
};
|
|
7950
|
+
}).filter((category) => category.functions.length > 0);
|
|
7951
|
+
return { functions: filteredFunctions, categories: filteredCategories };
|
|
7952
|
+
}
|
|
7993
7953
|
|
|
7994
7954
|
// src/plugins/deprecated/authentications.ts
|
|
7995
7955
|
var listAuthenticationsPlugin = (sdk) => ({
|
|
@@ -8990,13 +8950,28 @@ function createSdk() {
|
|
|
8990
8950
|
}
|
|
8991
8951
|
function buildSdk(properties, context) {
|
|
8992
8952
|
const frozenContext = Object.freeze(context);
|
|
8993
|
-
|
|
8953
|
+
const registryCache = /* @__PURE__ */ new Map();
|
|
8954
|
+
const sdk = {
|
|
8994
8955
|
...properties,
|
|
8995
8956
|
get context() {
|
|
8996
8957
|
return frozenContext;
|
|
8997
8958
|
},
|
|
8998
8959
|
getContext: () => frozenContext,
|
|
8999
8960
|
// runtime compat shim, not in types
|
|
8961
|
+
getRegistry(options) {
|
|
8962
|
+
const cacheKey = options?.package ?? "__all__";
|
|
8963
|
+
if (!registryCache.has(cacheKey)) {
|
|
8964
|
+
registryCache.set(
|
|
8965
|
+
cacheKey,
|
|
8966
|
+
buildRegistry({
|
|
8967
|
+
sdk,
|
|
8968
|
+
meta: frozenContext.meta,
|
|
8969
|
+
packageFilter: options?.package
|
|
8970
|
+
})
|
|
8971
|
+
);
|
|
8972
|
+
}
|
|
8973
|
+
return registryCache.get(cacheKey);
|
|
8974
|
+
},
|
|
9000
8975
|
addPlugin(plugin) {
|
|
9001
8976
|
const pluginResult = plugin({
|
|
9002
8977
|
...properties,
|
|
@@ -9027,12 +9002,16 @@ function buildSdk(properties, context) {
|
|
|
9027
9002
|
);
|
|
9028
9003
|
}
|
|
9029
9004
|
};
|
|
9005
|
+
return sdk;
|
|
9030
9006
|
}
|
|
9031
9007
|
function createZapierSdkWithoutRegistry(options = {}) {
|
|
9032
|
-
|
|
9008
|
+
logDeprecation(
|
|
9009
|
+
"createZapierSdkWithoutRegistry is deprecated; use createZapierSdk instead. getRegistry is now available on every sdk."
|
|
9010
|
+
);
|
|
9011
|
+
return createZapierSdk(options);
|
|
9033
9012
|
}
|
|
9034
9013
|
function createZapierSdk(options = {}) {
|
|
9035
|
-
return
|
|
9014
|
+
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);
|
|
9036
9015
|
}
|
|
9037
9016
|
var BaseSdkOptionsSchema = zod.z.object({
|
|
9038
9017
|
credentials: CredentialsSchema.optional().describe(
|
|
@@ -9076,6 +9055,14 @@ var BaseSdkOptionsSchema = zod.z.object({
|
|
|
9076
9055
|
// Use credentials instead
|
|
9077
9056
|
});
|
|
9078
9057
|
|
|
9058
|
+
// src/plugins/registry/index.ts
|
|
9059
|
+
var registryPlugin = () => {
|
|
9060
|
+
logDeprecation(
|
|
9061
|
+
"registryPlugin is deprecated and a no-op; getRegistry is now built into every sdk. Remove .addPlugin(registryPlugin)."
|
|
9062
|
+
);
|
|
9063
|
+
return {};
|
|
9064
|
+
};
|
|
9065
|
+
|
|
9079
9066
|
exports.ActionKeyPropertySchema = ActionKeyPropertySchema;
|
|
9080
9067
|
exports.ActionPropertySchema = ActionPropertySchema;
|
|
9081
9068
|
exports.ActionTimeoutMsPropertySchema = ActionTimeoutMsPropertySchema;
|