@zapier/zapier-sdk 0.15.11 → 0.15.13

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 (43) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +2 -0
  3. package/dist/index.cjs +538 -521
  4. package/dist/index.mjs +538 -521
  5. package/dist/plugins/findFirstAuthentication/index.d.ts.map +1 -1
  6. package/dist/plugins/findFirstAuthentication/index.js +4 -3
  7. package/dist/plugins/findUniqueAuthentication/index.d.ts.map +1 -1
  8. package/dist/plugins/findUniqueAuthentication/index.js +4 -3
  9. package/dist/plugins/getAction/index.d.ts.map +1 -1
  10. package/dist/plugins/getAction/index.js +4 -3
  11. package/dist/plugins/getApp/index.d.ts.map +1 -1
  12. package/dist/plugins/getApp/index.js +4 -3
  13. package/dist/plugins/getAuthentication/index.d.ts.map +1 -1
  14. package/dist/plugins/getAuthentication/index.js +4 -3
  15. package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -1
  16. package/dist/plugins/getInputFieldsSchema/index.js +4 -3
  17. package/dist/plugins/getProfile/index.d.ts.map +1 -1
  18. package/dist/plugins/getProfile/index.js +4 -3
  19. package/dist/plugins/listActions/index.d.ts.map +1 -1
  20. package/dist/plugins/listActions/index.js +6 -3
  21. package/dist/plugins/listApps/index.d.ts.map +1 -1
  22. package/dist/plugins/listApps/index.js +6 -3
  23. package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
  24. package/dist/plugins/listAuthentications/index.js +6 -3
  25. package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
  26. package/dist/plugins/listInputFieldChoices/index.js +6 -3
  27. package/dist/plugins/listInputFields/index.d.ts.map +1 -1
  28. package/dist/plugins/listInputFields/index.js +6 -4
  29. package/dist/plugins/request/index.d.ts.map +1 -1
  30. package/dist/plugins/request/index.js +4 -3
  31. package/dist/plugins/runAction/index.d.ts.map +1 -1
  32. package/dist/plugins/runAction/index.js +6 -3
  33. package/dist/utils/function-utils.d.ts +1 -1
  34. package/dist/utils/function-utils.d.ts.map +1 -1
  35. package/dist/utils/function-utils.js +2 -2
  36. package/dist/utils/string-utils.d.ts +19 -0
  37. package/dist/utils/string-utils.d.ts.map +1 -1
  38. package/dist/utils/string-utils.js +21 -0
  39. package/dist/utils/string-utils.test.js +24 -1
  40. package/dist/utils/telemetry-utils.d.ts +25 -13
  41. package/dist/utils/telemetry-utils.d.ts.map +1 -1
  42. package/dist/utils/telemetry-utils.js +25 -13
  43. package/package.json +3 -3
@@ -7,24 +7,36 @@ import type { EventEmissionContext } from "../plugins/eventEmission";
7
7
  * of the onMethodCalled callback used by createFunction and createPaginatedFunction.
8
8
  *
9
9
  * @param emitMethodCalled - The event emission function from EventEmissionContext
10
- * @param methodName - The explicit method name to use in telemetry. This avoids bundler
11
- * mangling where esbuild/tsup renames inner functions to avoid collisions. For example:
12
- * ```typescript
13
- * // Source code:
14
- * const getAction = createFunction(async function getAction(options) { ... });
15
- *
16
- * // Bundled output (inner function renamed to avoid collision with outer const):
17
- * const getAction = createFunction(async function getAction2(options) { ... });
18
- * ```
19
- * Without an explicit methodName, telemetry would report "getAction2" instead of "getAction".
10
+ * @param methodName - The method name to report in telemetry. Use `function.name` to derive
11
+ * this automatically from the function declaration, ensuring DRY principles and making
12
+ * refactoring easier. Function names are preserved through bundling.
20
13
  * @returns TelemetryCallbacks object with standardized onMethodCalled implementation
21
14
  *
22
15
  * @example
16
+ * Basic usage with createFunction:
17
+ * ```typescript
18
+ * async function listApps(options: ListAppsOptions) { ... }
19
+ *
20
+ * const listAppsDefinition = createFunction(
21
+ * listApps,
22
+ * ListAppsSchema,
23
+ * createTelemetryCallback(context.eventEmission.emitMethodCalled, listApps.name),
24
+ * );
25
+ * ```
26
+ *
27
+ * @example
28
+ * For paginated functions, use stripPageSuffix to remove the "Page" suffix:
23
29
  * ```typescript
24
- * const listApps = createFunction(
25
- * async function listApps(options) { ... },
30
+ * import { stripPageSuffix } from "./string-utils";
31
+ *
32
+ * async function listAppsPage(options: ListAppsOptions & { pageSize: number }) { ... }
33
+ *
34
+ * const methodName = stripPageSuffix(listAppsPage.name);
35
+ * const listAppsDefinition = createPaginatedFunction(
36
+ * listAppsPage,
26
37
  * ListAppsSchema,
27
- * createTelemetryCallback(context.eventEmission.emitMethodCalled, "listApps"),
38
+ * createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
39
+ * methodName,
28
40
  * );
29
41
  * ```
30
42
  */
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry-utils.d.ts","sourceRoot":"","sources":["../../src/utils/telemetry-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,uBAAuB,CACrC,gBAAgB,EAAE,oBAAoB,CAAC,eAAe,CAAC,CAAC,kBAAkB,CAAC,EAC3E,UAAU,EAAE,MAAM,GACjB,kBAAkB,CAcpB"}
1
+ {"version":3,"file":"telemetry-utils.d.ts","sourceRoot":"","sources":["../../src/utils/telemetry-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,uBAAuB,CACrC,gBAAgB,EAAE,oBAAoB,CAAC,eAAe,CAAC,CAAC,kBAAkB,CAAC,EAC3E,UAAU,EAAE,MAAM,GACjB,kBAAkB,CAcpB"}
@@ -5,24 +5,36 @@
5
5
  * of the onMethodCalled callback used by createFunction and createPaginatedFunction.
6
6
  *
7
7
  * @param emitMethodCalled - The event emission function from EventEmissionContext
8
- * @param methodName - The explicit method name to use in telemetry. This avoids bundler
9
- * mangling where esbuild/tsup renames inner functions to avoid collisions. For example:
10
- * ```typescript
11
- * // Source code:
12
- * const getAction = createFunction(async function getAction(options) { ... });
13
- *
14
- * // Bundled output (inner function renamed to avoid collision with outer const):
15
- * const getAction = createFunction(async function getAction2(options) { ... });
16
- * ```
17
- * Without an explicit methodName, telemetry would report "getAction2" instead of "getAction".
8
+ * @param methodName - The method name to report in telemetry. Use `function.name` to derive
9
+ * this automatically from the function declaration, ensuring DRY principles and making
10
+ * refactoring easier. Function names are preserved through bundling.
18
11
  * @returns TelemetryCallbacks object with standardized onMethodCalled implementation
19
12
  *
20
13
  * @example
14
+ * Basic usage with createFunction:
15
+ * ```typescript
16
+ * async function listApps(options: ListAppsOptions) { ... }
17
+ *
18
+ * const listAppsDefinition = createFunction(
19
+ * listApps,
20
+ * ListAppsSchema,
21
+ * createTelemetryCallback(context.eventEmission.emitMethodCalled, listApps.name),
22
+ * );
23
+ * ```
24
+ *
25
+ * @example
26
+ * For paginated functions, use stripPageSuffix to remove the "Page" suffix:
21
27
  * ```typescript
22
- * const listApps = createFunction(
23
- * async function listApps(options) { ... },
28
+ * import { stripPageSuffix } from "./string-utils";
29
+ *
30
+ * async function listAppsPage(options: ListAppsOptions & { pageSize: number }) { ... }
31
+ *
32
+ * const methodName = stripPageSuffix(listAppsPage.name);
33
+ * const listAppsDefinition = createPaginatedFunction(
34
+ * listAppsPage,
24
35
  * ListAppsSchema,
25
- * createTelemetryCallback(context.eventEmission.emitMethodCalled, "listApps"),
36
+ * createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
37
+ * methodName,
26
38
  * );
27
39
  * ```
28
40
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.15.11",
3
+ "version": "0.15.13",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -31,7 +31,7 @@
31
31
  "complete"
32
32
  ],
33
33
  "author": "",
34
- "license": "ISC",
34
+ "license": "SEE LICENSE IN LICENSE",
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
@@ -51,7 +51,7 @@
51
51
  "tsup": "^8.5.0",
52
52
  "typescript": "^5.8.3",
53
53
  "vitest": "^3.2.3",
54
- "@zapier/zapier-sdk-cli-login": "0.3.4"
54
+ "@zapier/zapier-sdk-cli-login": "0.3.5"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "tsup",