@zapier/zapier-sdk 0.44.0 → 0.45.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/api/client.d.ts.map +1 -1
  3. package/dist/api/client.js +19 -1
  4. package/dist/api/types.d.ts +11 -0
  5. package/dist/api/types.d.ts.map +1 -1
  6. package/dist/constants.d.ts +6 -0
  7. package/dist/constants.d.ts.map +1 -1
  8. package/dist/constants.js +8 -0
  9. package/dist/index.cjs +125 -114
  10. package/dist/index.d.mts +2490 -2458
  11. package/dist/index.d.ts +2 -2
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.mjs +125 -115
  14. package/dist/plugins/api/index.d.ts.map +1 -1
  15. package/dist/plugins/api/index.js +2 -1
  16. package/dist/plugins/apps/index.d.ts +1 -1
  17. package/dist/plugins/apps/index.d.ts.map +1 -1
  18. package/dist/plugins/apps/index.js +4 -0
  19. package/dist/plugins/eventEmission/builders.js +1 -1
  20. package/dist/plugins/registry/index.d.ts +11 -16
  21. package/dist/plugins/registry/index.d.ts.map +1 -1
  22. package/dist/plugins/registry/index.js +9 -130
  23. package/dist/registry.d.ts +9 -0
  24. package/dist/registry.d.ts.map +1 -0
  25. package/dist/registry.js +77 -0
  26. package/dist/sdk-version.d.ts +28 -0
  27. package/dist/sdk-version.d.ts.map +1 -0
  28. package/dist/sdk-version.js +29 -0
  29. package/dist/sdk.d.ts +20 -2
  30. package/dist/sdk.d.ts.map +1 -1
  31. package/dist/sdk.js +25 -9
  32. package/dist/types/plugin.d.ts +7 -1
  33. package/dist/types/plugin.d.ts.map +1 -1
  34. package/dist/types/registry.d.ts +49 -0
  35. package/dist/types/registry.d.ts.map +1 -0
  36. package/dist/types/registry.js +1 -0
  37. package/dist/types/sdk.d.ts +8 -78
  38. package/dist/types/sdk.d.ts.map +1 -1
  39. package/dist/types/sdk.js +4 -0
  40. package/dist/utils/schema-utils.d.ts +1 -1
  41. package/dist/utils/schema-utils.d.ts.map +1 -1
  42. package/dist/utils/telemetry-context.d.ts.map +1 -1
  43. package/dist/utils/telemetry-context.js +13 -6
  44. package/package.json +6 -2
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/sdk";
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 "./types/sdk";
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";
@@ -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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B,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
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { buildHttpRequestContext, buildActionRunContext } from '@zapier/policy-context';
3
+ import { AsyncLocalStorage } from 'async_hooks';
3
4
  import { ListAppsQuerySchema, AppItemSchema as AppItemSchema$1 } from '@zapier/zapier-sdk-core/v0/schemas/apps';
4
5
  import { ListConnectionsQuerySchema as ListConnectionsQuerySchema$1, ConnectionItemSchema as ConnectionItemSchema$1 } from '@zapier/zapier-sdk-core/v0/schemas/connections';
5
6
  import { ListClientCredentialsQuerySchema as ListClientCredentialsQuerySchema$1, CreateClientCredentialsRequestSchema, ClientCredentialsItemSchema as ClientCredentialsItemSchema$1, ClientCredentialsCreatedItemSchema as ClientCredentialsCreatedItemSchema$1 } from '@zapier/zapier-sdk-core/v0/schemas/client-credentials';
@@ -40,6 +41,9 @@ function isPositional(schema) {
40
41
 
41
42
  // src/constants.ts
42
43
  var ZAPIER_BASE_URL = globalThis.process?.env?.ZAPIER_BASE_URL || "https://zapier.com";
44
+ function getZapierSdkService() {
45
+ return globalThis.process?.env?.ZAPIER_SDK_SERVICE;
46
+ }
43
47
  var MAX_PAGE_LIMIT = 1e4;
44
48
  var DEFAULT_PAGE_SIZE = 100;
45
49
  var DEFAULT_ACTION_TIMEOUT_MS = 18e4;
@@ -543,6 +547,10 @@ function createAppsProxy(options) {
543
547
  }
544
548
  var appsPlugin = (sdk) => {
545
549
  return {
550
+ // Cast: ZapierSdkApps is augmented by user-generated .d.ts files to
551
+ // give specific types like `slack: SlackAppWithFactory`. At runtime
552
+ // the Proxy intercepts any property access, so the augmented entries
553
+ // always resolve correctly even though TS can't see that statically.
546
554
  apps: createAppsProxy({ sdk }),
547
555
  context: {
548
556
  meta: {
@@ -828,12 +836,9 @@ function isPlainObject(value) {
828
836
  const proto = Object.getPrototypeOf(value);
829
837
  return proto === Object.prototype || proto === null;
830
838
  }
831
-
832
- // src/utils/telemetry-context.ts
833
839
  var telemetryStore = null;
834
840
  try {
835
- const mod = __require("async_hooks");
836
- telemetryStore = new mod.AsyncLocalStorage();
841
+ telemetryStore = new AsyncLocalStorage();
837
842
  } catch {
838
843
  }
839
844
  function isTelemetryNested() {
@@ -5738,6 +5743,9 @@ async function invalidateCredentialsToken(options) {
5738
5743
  }
5739
5744
  }
5740
5745
 
5746
+ // src/sdk-version.ts
5747
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.45.1" : void 0) || "unknown";
5748
+
5741
5749
  // src/utils/open-url.ts
5742
5750
  var nodePrefix = "node:";
5743
5751
  async function loadChildProcess() {
@@ -5910,6 +5918,7 @@ var ZapierApiClient = class {
5910
5918
  inputHeaders.forEach((value, key) => {
5911
5919
  mergedHeaders.set(key, value);
5912
5920
  });
5921
+ this.applyTelemetryHeaders(mergedHeaders);
5913
5922
  let retries = 0;
5914
5923
  while (true) {
5915
5924
  const response = await this.options.fetch(url, {
@@ -6279,6 +6288,22 @@ var ZapierApiClient = class {
6279
6288
  }
6280
6289
  return headers;
6281
6290
  }
6291
+ // Telemetry headers consumed by sdkapi's ApiRequestCompletedEvent.
6292
+ // Applied at the outbound layer (after caller-supplied header merging) so
6293
+ // they always reflect the SDK's actual identity and can't be spoofed via
6294
+ // options.headers.
6295
+ applyTelemetryHeaders(headers) {
6296
+ headers.set("x-zapier-sdk-version", SDK_VERSION);
6297
+ const sdkService = getZapierSdkService();
6298
+ if (sdkService) {
6299
+ headers.set("x-zapier-service", sdkService);
6300
+ }
6301
+ const callerPackage = this.options.callerPackage;
6302
+ if (callerPackage) {
6303
+ headers.set("x-zapier-sdk-package", callerPackage.name);
6304
+ headers.set("x-zapier-sdk-package-version", callerPackage.version);
6305
+ }
6306
+ }
6282
6307
  // Helper to perform HTTP requests with JSON handling
6283
6308
  async fetchJson(method, path, data, options = {}) {
6284
6309
  const headers = { ...options.headers };
@@ -6484,7 +6509,8 @@ var apiPlugin = (sdk) => {
6484
6509
  isInteractive,
6485
6510
  approvalTimeoutMs,
6486
6511
  maxApprovalRetries,
6487
- approvalMode
6512
+ approvalMode,
6513
+ callerPackage
6488
6514
  } = sdk.context.options;
6489
6515
  const api = createZapierApi({
6490
6516
  baseUrl,
@@ -6498,7 +6524,8 @@ var apiPlugin = (sdk) => {
6498
6524
  isInteractive,
6499
6525
  approvalTimeoutMs,
6500
6526
  maxApprovalRetries,
6501
- approvalMode
6527
+ approvalMode,
6528
+ callerPackage
6502
6529
  });
6503
6530
  return {
6504
6531
  context: {
@@ -7875,119 +7902,75 @@ var updateTableRecordsPlugin = (sdk) => {
7875
7902
  };
7876
7903
  };
7877
7904
 
7878
- // src/plugins/registry/index.ts
7879
- var registryPlugin = (sdk) => {
7880
- const metaKeys = Object.keys(sdk.context.meta || {});
7881
- const categoryDefinitions = {
7882
- account: {
7883
- title: "Account"
7884
- },
7885
- app: {
7886
- title: "App",
7887
- titlePlural: "Apps"
7888
- },
7889
- connection: {
7890
- title: "Connection"
7891
- },
7892
- action: {
7893
- title: "Action"
7894
- },
7895
- "client-credentials": {
7896
- title: "Client Credentials",
7897
- titlePlural: "Client Credentials"
7898
- },
7899
- table: {
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) => {
7905
+ // src/registry.ts
7906
+ var categoryDefinitions = {
7907
+ account: { title: "Account" },
7908
+ app: { title: "App", titlePlural: "Apps" },
7909
+ connection: { title: "Connection" },
7910
+ action: { title: "Action" },
7911
+ "client-credentials": {
7912
+ title: "Client Credentials",
7913
+ titlePlural: "Client Credentials"
7914
+ },
7915
+ table: { title: "Table" },
7916
+ http: { title: "HTTP Request" },
7917
+ utility: { title: "Utility", titlePlural: "Utilities" },
7918
+ other: { title: "Other" }
7919
+ };
7920
+ var knownCategories = Object.keys(categoryDefinitions);
7921
+ function buildRegistry({
7922
+ sdk,
7923
+ meta,
7924
+ packageFilter
7925
+ }) {
7926
+ const functions = Object.keys(meta).filter((key) => {
7914
7927
  const property = sdk[key];
7915
- if (typeof property === "function") {
7916
- return true;
7917
- }
7928
+ if (typeof property === "function") return true;
7918
7929
  const [rootKey] = key.split(".");
7919
7930
  const rootProperty = sdk[rootKey];
7920
- if (typeof rootProperty === "object" && rootProperty !== null) {
7921
- return true;
7922
- }
7923
- return false;
7931
+ return typeof rootProperty === "object" && rootProperty !== null;
7924
7932
  }).map((key) => {
7925
- const meta = sdk.context.meta[key];
7933
+ const m = meta[key];
7926
7934
  return {
7927
7935
  name: key,
7928
- description: meta.description,
7929
- type: meta.type,
7930
- itemType: meta.itemType,
7931
- returnType: meta.returnType,
7932
- inputSchema: meta.inputSchema,
7933
- inputParameters: meta.inputParameters,
7934
- outputSchema: meta.outputSchema,
7935
- categories: meta.categories || [],
7936
- resolvers: meta.resolvers,
7937
- formatter: meta.formatter,
7938
- packages: meta.packages,
7939
- // Auto-infer confirm: "delete" from type: "delete" (all deletes should confirm)
7940
- confirm: meta.confirm ?? (meta.type === "delete" ? "delete" : void 0),
7941
- deprecation: meta.deprecation,
7942
- aliases: meta.aliases,
7943
- supportsJsonOutput: meta.supportsJsonOutput ?? true
7936
+ description: m.description,
7937
+ type: m.type,
7938
+ itemType: m.itemType,
7939
+ returnType: m.returnType,
7940
+ inputSchema: m.inputSchema,
7941
+ inputParameters: m.inputParameters,
7942
+ outputSchema: m.outputSchema,
7943
+ categories: m.categories || [],
7944
+ resolvers: m.resolvers,
7945
+ formatter: m.formatter,
7946
+ packages: m.packages,
7947
+ confirm: m.confirm ?? (m.type === "delete" ? "delete" : void 0),
7948
+ deprecation: m.deprecation,
7949
+ aliases: m.aliases,
7950
+ supportsJsonOutput: m.supportsJsonOutput ?? true
7944
7951
  };
7945
7952
  }).sort((a, b) => a.name.localeCompare(b.name));
7946
- const knownCategories = Object.keys(categoryDefinitions);
7947
- const registryCache = /* @__PURE__ */ new Map();
7948
- function getRegistry(options) {
7949
- const packageFilter = options?.package;
7950
- const cacheKey = packageFilter || "__all__";
7951
- if (registryCache.has(cacheKey)) {
7952
- return registryCache.get(cacheKey);
7953
- }
7954
- const filteredFunctions = packageFilter ? functions.filter(
7955
- (f) => (
7956
- // Include if packages is undefined (belongs to all packages) or includes the specified package
7957
- !f.packages || f.packages.includes(packageFilter)
7958
- )
7959
- ) : functions;
7960
- const filteredCategories = knownCategories.sort((a, b) => {
7961
- if (a === "other") return 1;
7962
- if (b === "other") return -1;
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
7953
+ const filteredFunctions = packageFilter ? functions.filter((f) => !f.packages || f.packages.includes(packageFilter)) : functions;
7954
+ const filteredCategories = knownCategories.slice().sort((a, b) => {
7955
+ if (a === "other") return 1;
7956
+ if (b === "other") return -1;
7957
+ return categoryDefinitions[a].title.localeCompare(
7958
+ categoryDefinitions[b].title
7959
+ );
7960
+ }).map((categoryKey) => {
7961
+ const categoryFunctions = filteredFunctions.filter(
7962
+ (f) => f.categories.includes(categoryKey) || categoryKey === "other" && !f.categories.some((c) => knownCategories.includes(c))
7963
+ ).map((f) => f.name).sort();
7964
+ const definition = categoryDefinitions[categoryKey];
7965
+ return {
7966
+ key: categoryKey,
7967
+ title: definition.title,
7968
+ titlePlural: definition.titlePlural ?? `${definition.title}s`,
7969
+ functions: categoryFunctions
7983
7970
  };
7984
- registryCache.set(cacheKey, result);
7985
- return result;
7986
- }
7987
- return {
7988
- getRegistry
7989
- };
7990
- };
7971
+ }).filter((category) => category.functions.length > 0);
7972
+ return { functions: filteredFunctions, categories: filteredCategories };
7973
+ }
7991
7974
 
7992
7975
  // src/plugins/deprecated/authentications.ts
7993
7976
  var listAuthenticationsPlugin = (sdk) => ({
@@ -8531,7 +8514,6 @@ function getCpuTime() {
8531
8514
  }
8532
8515
 
8533
8516
  // src/plugins/eventEmission/builders.ts
8534
- var SDK_VERSION = globalThis.process?.env?.SDK_VERSION || "unknown";
8535
8517
  function createBaseEvent(context = {}) {
8536
8518
  return {
8537
8519
  event_id: generateEventId(),
@@ -8988,13 +8970,28 @@ function createSdk() {
8988
8970
  }
8989
8971
  function buildSdk(properties, context) {
8990
8972
  const frozenContext = Object.freeze(context);
8991
- return {
8973
+ const registryCache = /* @__PURE__ */ new Map();
8974
+ const sdk = {
8992
8975
  ...properties,
8993
8976
  get context() {
8994
8977
  return frozenContext;
8995
8978
  },
8996
8979
  getContext: () => frozenContext,
8997
8980
  // runtime compat shim, not in types
8981
+ getRegistry(options) {
8982
+ const cacheKey = options?.package ?? "__all__";
8983
+ if (!registryCache.has(cacheKey)) {
8984
+ registryCache.set(
8985
+ cacheKey,
8986
+ buildRegistry({
8987
+ sdk,
8988
+ meta: frozenContext.meta,
8989
+ packageFilter: options?.package
8990
+ })
8991
+ );
8992
+ }
8993
+ return registryCache.get(cacheKey);
8994
+ },
8998
8995
  addPlugin(plugin) {
8999
8996
  const pluginResult = plugin({
9000
8997
  ...properties,
@@ -9025,12 +9022,16 @@ function buildSdk(properties, context) {
9025
9022
  );
9026
9023
  }
9027
9024
  };
9025
+ return sdk;
9028
9026
  }
9029
9027
  function createZapierSdkWithoutRegistry(options = {}) {
9030
- 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);
9028
+ logDeprecation(
9029
+ "createZapierSdkWithoutRegistry is deprecated; use createZapierSdk instead. getRegistry is now available on every sdk."
9030
+ );
9031
+ return createZapierSdk(options);
9031
9032
  }
9032
9033
  function createZapierSdk(options = {}) {
9033
- return createZapierSdkWithoutRegistry(options).addPlugin(registryPlugin);
9034
+ 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
9035
  }
9035
9036
  var BaseSdkOptionsSchema = z.object({
9036
9037
  credentials: CredentialsSchema.optional().describe(
@@ -9066,6 +9067,7 @@ var BaseSdkOptionsSchema = z.object({
9066
9067
  onEvent: z.custom().optional().meta({ internal: true }),
9067
9068
  fetch: z.custom().optional().meta({ internal: true }),
9068
9069
  eventEmission: z.custom().optional().meta({ internal: true }),
9070
+ callerPackage: z.custom().optional().meta({ internal: true }),
9069
9071
  canIncludeSharedConnections: z.boolean().optional().describe("Allow listing shared connections."),
9070
9072
  canIncludeSharedTables: z.boolean().optional().describe("Allow listing shared tables."),
9071
9073
  canDeleteTables: z.boolean().optional().describe("Allow deleting tables."),
@@ -9074,4 +9076,12 @@ var BaseSdkOptionsSchema = z.object({
9074
9076
  // Use credentials instead
9075
9077
  });
9076
9078
 
9077
- 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 };
9079
+ // src/plugins/registry/index.ts
9080
+ var registryPlugin = () => {
9081
+ logDeprecation(
9082
+ "registryPlugin is deprecated and a no-op; getRegistry is now built into every sdk. Remove .addPlugin(registryPlugin)."
9083
+ );
9084
+ return {};
9085
+ };
9086
+
9087
+ 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, getZapierSdkService, 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 };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/api/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAQnE,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAG3D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE;QACP,GAAG,EAAE,SAAS,CAAC;QACf,kBAAkB,EAAE,MAAM,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC;KACpE,CAAC;CACH;AAED,eAAO,MAAM,SAAS,EAAE,MAAM,CAC5B;IAAE,OAAO,EAAE;QAAE,OAAO,EAAE,cAAc,CAAA;KAAE,CAAA;CAAE,EACxC,iBAAiB,CA8ClB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/api/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAQnE,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAG3D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE;QACP,GAAG,EAAE,SAAS,CAAC;QACf,kBAAkB,EAAE,MAAM,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC;KACpE,CAAC;CACH;AAED,eAAO,MAAM,SAAS,EAAE,MAAM,CAC5B;IAAE,OAAO,EAAE;QAAE,OAAO,EAAE,cAAc,CAAA;KAAE,CAAA;CAAE,EACxC,iBAAiB,CAgDlB,CAAC"}
@@ -3,7 +3,7 @@ import { resolveCredentials } from "../../credentials";
3
3
  import { ZAPIER_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, } from "../../constants";
4
4
  export const apiPlugin = (sdk) => {
5
5
  // Extract all options - everything passed to the plugin
6
- const { fetch: customFetch = globalThis.fetch, baseUrl = ZAPIER_BASE_URL, credentials, token, onEvent, debug = false, maxNetworkRetries = ZAPIER_MAX_NETWORK_RETRIES, maxNetworkRetryDelayMs = ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, isInteractive, approvalTimeoutMs, maxApprovalRetries, approvalMode, } = sdk.context.options;
6
+ const { fetch: customFetch = globalThis.fetch, baseUrl = ZAPIER_BASE_URL, credentials, token, onEvent, debug = false, maxNetworkRetries = ZAPIER_MAX_NETWORK_RETRIES, maxNetworkRetryDelayMs = ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, isInteractive, approvalTimeoutMs, maxApprovalRetries, approvalMode, callerPackage, } = sdk.context.options;
7
7
  // Create the API client - it will handle token resolution internally
8
8
  const api = createZapierApi({
9
9
  baseUrl,
@@ -18,6 +18,7 @@ export const apiPlugin = (sdk) => {
18
18
  approvalTimeoutMs,
19
19
  maxApprovalRetries,
20
20
  approvalMode,
21
+ callerPackage,
21
22
  });
22
23
  // Return flat structure with context only
23
24
  return {
@@ -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;CACnB;AAuOD,eAAO,MAAM,UAAU,EAAE,MAAM,CAC7B,mBAAmB,GAAG,uBAAuB,EAAE,6DAA6D;AAC5G,kBAAkB,CAyBnB,CAAC;AAGF,YAAY,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACzE,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAI7D,MAAM,WAAW,aAAa;CAAG"}
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: {
@@ -5,7 +5,7 @@
5
5
  * schema compliance for all event types.
6
6
  */
7
7
  import { generateEventId, getCurrentTimestamp, getReleaseId, getOsInfo, getPlatformVersions, getMemoryUsage, getCpuTime, isCi, getCiPlatform, } from "./utils";
8
- const SDK_VERSION = globalThis.process?.env?.SDK_VERSION || "unknown";
8
+ import { SDK_VERSION } from "../../sdk-version";
9
9
  // Create base event with auto-populated common fields
10
10
  // Kept for backward compatibility but can be replaced with direct construction
11
11
  export function createBaseEvent(context = {}) {
@@ -1,20 +1,15 @@
1
1
  import type { Plugin } from "../../types/plugin";
2
- import type { FunctionRegistryEntry } from "../../types/sdk";
3
- export interface RegisterPluginFunctionOptions {
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
- export declare const registryPlugin: Plugin<{}, // accepts any SDK shape, requires no context
19
- RegistryPluginProvides>;
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;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,WAAW,6BAA6B;CAAG;AAEjD,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK;QAC/C,SAAS,EAAE,qBAAqB,EAAE,CAAC;QACnC,UAAU,EAAE;YACV,GAAG,EAAE,MAAM,CAAC;YACZ,KAAK,EAAE,MAAM,CAAC;YACd,WAAW,EAAE,MAAM,CAAC;YACpB,SAAS,EAAE,MAAM,EAAE,CAAC;SACrB,EAAE,CAAC;KACL,CAAC;CACH;AAGD,eAAO,MAAM,cAAc,EAAE,MAAM,CACjC,EAAE,EAAE,6CAA6C;AACjD,sBAAsB,CAyJvB,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
- // Registry plugin requires no context but collects SDK metadata
2
- export const registryPlugin = (sdk) => {
3
- const metaKeys = Object.keys(sdk.context.meta || {});
4
- const categoryDefinitions = {
5
- account: {
6
- title: "Account",
7
- },
8
- app: {
9
- title: "App",
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
  };