@zapier/zapier-sdk 0.33.0 → 0.33.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 (121) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.mjs +1 -1
  4. package/package.json +2 -2
  5. package/dist/api/auth.test.d.ts +0 -2
  6. package/dist/api/auth.test.d.ts.map +0 -1
  7. package/dist/api/auth.test.js +0 -220
  8. package/dist/api/client.test.d.ts +0 -2
  9. package/dist/api/client.test.d.ts.map +0 -1
  10. package/dist/api/client.test.js +0 -611
  11. package/dist/api/debug.test.d.ts +0 -2
  12. package/dist/api/debug.test.d.ts.map +0 -1
  13. package/dist/api/debug.test.js +0 -59
  14. package/dist/api/polling.test.d.ts +0 -2
  15. package/dist/api/polling.test.d.ts.map +0 -1
  16. package/dist/api/polling.test.js +0 -360
  17. package/dist/auth.test.d.ts +0 -2
  18. package/dist/auth.test.d.ts.map +0 -1
  19. package/dist/auth.test.js +0 -480
  20. package/dist/plugins/eventEmission/builders.test.d.ts +0 -2
  21. package/dist/plugins/eventEmission/builders.test.d.ts.map +0 -1
  22. package/dist/plugins/eventEmission/builders.test.js +0 -138
  23. package/dist/plugins/eventEmission/index.test.d.ts +0 -5
  24. package/dist/plugins/eventEmission/index.test.d.ts.map +0 -1
  25. package/dist/plugins/eventEmission/index.test.js +0 -712
  26. package/dist/plugins/eventEmission/transport.test.d.ts +0 -5
  27. package/dist/plugins/eventEmission/transport.test.d.ts.map +0 -1
  28. package/dist/plugins/eventEmission/transport.test.js +0 -164
  29. package/dist/plugins/fetch/index.test.d.ts +0 -2
  30. package/dist/plugins/fetch/index.test.d.ts.map +0 -1
  31. package/dist/plugins/fetch/index.test.js +0 -428
  32. package/dist/plugins/findFirstConnection/index.test.d.ts +0 -2
  33. package/dist/plugins/findFirstConnection/index.test.d.ts.map +0 -1
  34. package/dist/plugins/findFirstConnection/index.test.js +0 -177
  35. package/dist/plugins/findUniqueConnection/index.test.d.ts +0 -2
  36. package/dist/plugins/findUniqueConnection/index.test.d.ts.map +0 -1
  37. package/dist/plugins/findUniqueConnection/index.test.js +0 -159
  38. package/dist/plugins/getAction/index.test.d.ts +0 -2
  39. package/dist/plugins/getAction/index.test.d.ts.map +0 -1
  40. package/dist/plugins/getAction/index.test.js +0 -211
  41. package/dist/plugins/getApp/index.test.d.ts +0 -2
  42. package/dist/plugins/getApp/index.test.d.ts.map +0 -1
  43. package/dist/plugins/getApp/index.test.js +0 -157
  44. package/dist/plugins/getConnection/index.test.d.ts +0 -2
  45. package/dist/plugins/getConnection/index.test.d.ts.map +0 -1
  46. package/dist/plugins/getConnection/index.test.js +0 -124
  47. package/dist/plugins/getInputFieldsSchema/index.test.d.ts +0 -2
  48. package/dist/plugins/getInputFieldsSchema/index.test.d.ts.map +0 -1
  49. package/dist/plugins/getInputFieldsSchema/index.test.js +0 -291
  50. package/dist/plugins/listActions/index.test.d.ts +0 -2
  51. package/dist/plugins/listActions/index.test.d.ts.map +0 -1
  52. package/dist/plugins/listActions/index.test.js +0 -454
  53. package/dist/plugins/listApps/index.test.d.ts +0 -2
  54. package/dist/plugins/listApps/index.test.d.ts.map +0 -1
  55. package/dist/plugins/listApps/index.test.js +0 -124
  56. package/dist/plugins/listConnections/index.test.d.ts +0 -2
  57. package/dist/plugins/listConnections/index.test.d.ts.map +0 -1
  58. package/dist/plugins/listConnections/index.test.js +0 -920
  59. package/dist/plugins/listInputFieldChoices/index.test.d.ts +0 -2
  60. package/dist/plugins/listInputFieldChoices/index.test.d.ts.map +0 -1
  61. package/dist/plugins/listInputFieldChoices/index.test.js +0 -717
  62. package/dist/plugins/listInputFields/index.test.d.ts +0 -2
  63. package/dist/plugins/listInputFields/index.test.d.ts.map +0 -1
  64. package/dist/plugins/listInputFields/index.test.js +0 -359
  65. package/dist/plugins/manifest/index.test.d.ts +0 -2
  66. package/dist/plugins/manifest/index.test.d.ts.map +0 -1
  67. package/dist/plugins/manifest/index.test.js +0 -1179
  68. package/dist/plugins/request/index.test.d.ts +0 -2
  69. package/dist/plugins/request/index.test.d.ts.map +0 -1
  70. package/dist/plugins/request/index.test.js +0 -458
  71. package/dist/plugins/runAction/index.test.d.ts +0 -2
  72. package/dist/plugins/runAction/index.test.d.ts.map +0 -1
  73. package/dist/plugins/runAction/index.test.js +0 -350
  74. package/dist/resolvers/connectionId.test.d.ts +0 -2
  75. package/dist/resolvers/connectionId.test.d.ts.map +0 -1
  76. package/dist/resolvers/connectionId.test.js +0 -61
  77. package/dist/sdk.test.d.ts +0 -2
  78. package/dist/sdk.test.d.ts.map +0 -1
  79. package/dist/sdk.test.js +0 -260
  80. package/dist/types/domain.test.d.ts +0 -2
  81. package/dist/types/domain.test.d.ts.map +0 -1
  82. package/dist/types/domain.test.js +0 -39
  83. package/dist/utils/array-utils.test.d.ts +0 -2
  84. package/dist/utils/array-utils.test.d.ts.map +0 -1
  85. package/dist/utils/array-utils.test.js +0 -107
  86. package/dist/utils/batch-utils.test.d.ts +0 -2
  87. package/dist/utils/batch-utils.test.d.ts.map +0 -1
  88. package/dist/utils/batch-utils.test.js +0 -476
  89. package/dist/utils/domain-utils.test.d.ts +0 -2
  90. package/dist/utils/domain-utils.test.d.ts.map +0 -1
  91. package/dist/utils/domain-utils.test.js +0 -346
  92. package/dist/utils/file-utils.test.d.ts +0 -2
  93. package/dist/utils/file-utils.test.d.ts.map +0 -1
  94. package/dist/utils/file-utils.test.js +0 -51
  95. package/dist/utils/function-utils.test.d.ts +0 -2
  96. package/dist/utils/function-utils.test.d.ts.map +0 -1
  97. package/dist/utils/function-utils.test.js +0 -188
  98. package/dist/utils/id-utils.test.d.ts +0 -2
  99. package/dist/utils/id-utils.test.d.ts.map +0 -1
  100. package/dist/utils/id-utils.test.js +0 -22
  101. package/dist/utils/pagination-utils.test.d.ts +0 -17
  102. package/dist/utils/pagination-utils.test.d.ts.map +0 -1
  103. package/dist/utils/pagination-utils.test.js +0 -461
  104. package/dist/utils/retry-utils.test.d.ts +0 -2
  105. package/dist/utils/retry-utils.test.d.ts.map +0 -1
  106. package/dist/utils/retry-utils.test.js +0 -90
  107. package/dist/utils/string-utils.test.d.ts +0 -2
  108. package/dist/utils/string-utils.test.d.ts.map +0 -1
  109. package/dist/utils/string-utils.test.js +0 -59
  110. package/dist/utils/telemetry-context.test.d.ts +0 -2
  111. package/dist/utils/telemetry-context.test.d.ts.map +0 -1
  112. package/dist/utils/telemetry-context.test.js +0 -154
  113. package/dist/utils/telemetry-utils.test.d.ts +0 -2
  114. package/dist/utils/telemetry-utils.test.d.ts.map +0 -1
  115. package/dist/utils/telemetry-utils.test.js +0 -155
  116. package/dist/utils/url-utils.test.d.ts +0 -2
  117. package/dist/utils/url-utils.test.d.ts.map +0 -1
  118. package/dist/utils/url-utils.test.js +0 -103
  119. package/dist/utils/validation.test.d.ts +0 -2
  120. package/dist/utils/validation.test.d.ts.map +0 -1
  121. package/dist/utils/validation.test.js +0 -44
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.33.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 42edf6e: Remove test files from published packages
8
+
3
9
  ## 0.33.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -5512,7 +5512,7 @@ function getCpuTime() {
5512
5512
  }
5513
5513
 
5514
5514
  // src/plugins/eventEmission/builders.ts
5515
- var SDK_VERSION = "0.33.0";
5515
+ var SDK_VERSION = "0.33.1";
5516
5516
  function createBaseEvent(context = {}) {
5517
5517
  return {
5518
5518
  event_id: generateEventId(),
package/dist/index.mjs CHANGED
@@ -5490,7 +5490,7 @@ function getCpuTime() {
5490
5490
  }
5491
5491
 
5492
5492
  // src/plugins/eventEmission/builders.ts
5493
- var SDK_VERSION = "0.33.0";
5493
+ var SDK_VERSION = "0.33.1";
5494
5494
  function createBaseEvent(context = {}) {
5495
5495
  return {
5496
5496
  event_id: generateEventId(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.33.0",
3
+ "version": "0.33.1",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -46,7 +46,7 @@
46
46
  "tsup": "^8.5.0",
47
47
  "typescript": "^5.8.3",
48
48
  "vitest": "^3.2.3",
49
- "@zapier/zapier-sdk-cli-login": "0.8.1"
49
+ "@zapier/zapier-sdk-cli-login": "0.8.2"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "tsup",
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=auth.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.test.d.ts","sourceRoot":"","sources":["../../src/api/auth.test.ts"],"names":[],"mappings":""}
@@ -1,220 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { isJwt, getAuthorizationHeader, extractUserIdsFromJwt } from "./auth";
3
- describe("api/auth", () => {
4
- describe("isJwt", () => {
5
- it("should return true for valid JWT tokens", () => {
6
- const validJwt = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
7
- expect(isJwt(validJwt)).toBe(true);
8
- });
9
- it("should return true for JWT with minimal valid parts", () => {
10
- const minimalJwt = "a.b.c";
11
- expect(isJwt(minimalJwt)).toBe(true);
12
- });
13
- it("should return false for tokens with fewer than 3 parts", () => {
14
- expect(isJwt("header.payload")).toBe(false);
15
- expect(isJwt("onlyonepart")).toBe(false);
16
- expect(isJwt("")).toBe(false);
17
- });
18
- it("should return false for tokens with more than 3 parts", () => {
19
- expect(isJwt("part1.part2.part3.part4")).toBe(false);
20
- });
21
- it("should return false for tokens with empty parts", () => {
22
- expect(isJwt("..")).toBe(false);
23
- expect(isJwt(".payload.signature")).toBe(false);
24
- expect(isJwt("header..signature")).toBe(false);
25
- expect(isJwt("header.payload.")).toBe(false);
26
- });
27
- it("should return false for tokens with invalid base64url characters", () => {
28
- expect(isJwt("header+plus.payload.signature")).toBe(false);
29
- expect(isJwt("header.payload/slash.signature")).toBe(false);
30
- expect(isJwt("header.payload=padding.signature")).toBe(false);
31
- expect(isJwt("header.payload with space.signature")).toBe(false);
32
- });
33
- it("should accept valid base64url characters including dashes and underscores", () => {
34
- const validBase64Url = "abc-123_XYZ.def-456_UVW.ghi-789_RST";
35
- expect(isJwt(validBase64Url)).toBe(true);
36
- });
37
- });
38
- describe("getAuthorizationHeader", () => {
39
- it("should return JWT prefix for valid JWT tokens", () => {
40
- const jwt = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.dozjgNryP4J3jVmNHl0w5N_XgL0n3I9PlFUP0THsR8U";
41
- expect(getAuthorizationHeader(jwt)).toBe(`JWT ${jwt}`);
42
- });
43
- it("should return Bearer prefix for non-JWT tokens", () => {
44
- const apiKey = "sk_test_1234567890abcdef";
45
- expect(getAuthorizationHeader(apiKey)).toBe(`Bearer ${apiKey}`);
46
- });
47
- it("should return Bearer prefix for tokens with wrong number of parts", () => {
48
- expect(getAuthorizationHeader("header.payload")).toBe("Bearer header.payload");
49
- });
50
- it("should return Bearer prefix for empty string", () => {
51
- expect(getAuthorizationHeader("")).toBe("Bearer ");
52
- });
53
- });
54
- describe("extractUserIdsFromJwt", () => {
55
- function createJwt(payload) {
56
- const header = Buffer.from(JSON.stringify({ alg: "HS256", typ: "JWT" })).toString("base64url");
57
- const payloadEncoded = Buffer.from(JSON.stringify(payload)).toString("base64url");
58
- const signature = "fake_signature_for_testing";
59
- return `${header}.${payloadEncoded}.${signature}`;
60
- }
61
- it("should return null values for invalid JWT tokens", () => {
62
- expect(extractUserIdsFromJwt("not-a-jwt")).toEqual({
63
- customuser_id: null,
64
- account_id: null,
65
- });
66
- });
67
- it("should return null values for JWT with invalid payload", () => {
68
- const invalidJwt = "header.not-valid-base64!.signature";
69
- expect(extractUserIdsFromJwt(invalidJwt)).toEqual({
70
- customuser_id: null,
71
- account_id: null,
72
- });
73
- });
74
- it("should extract customuser_id and account_id from regular JWT", () => {
75
- const payload = {
76
- sub: "12345",
77
- sub_type: "customuser",
78
- "zap:acc": "67890",
79
- };
80
- const jwt = createJwt(payload);
81
- expect(extractUserIdsFromJwt(jwt)).toEqual({
82
- customuser_id: 12345,
83
- account_id: 67890,
84
- });
85
- });
86
- it("should handle numeric sub and zap:acc values", () => {
87
- const payload = {
88
- sub: 99999,
89
- sub_type: "customuser",
90
- "zap:acc": 11111,
91
- };
92
- const jwt = createJwt(payload);
93
- expect(extractUserIdsFromJwt(jwt)).toEqual({
94
- customuser_id: 99999,
95
- account_id: 11111,
96
- });
97
- });
98
- it("should return null customuser_id when sub_type is not customuser", () => {
99
- const payload = {
100
- sub: "12345",
101
- sub_type: "other",
102
- "zap:acc": "67890",
103
- };
104
- const jwt = createJwt(payload);
105
- expect(extractUserIdsFromJwt(jwt)).toEqual({
106
- customuser_id: null,
107
- account_id: 67890,
108
- });
109
- });
110
- it("should return null customuser_id when sub is missing", () => {
111
- const payload = {
112
- sub_type: "customuser",
113
- "zap:acc": "67890",
114
- };
115
- const jwt = createJwt(payload);
116
- expect(extractUserIdsFromJwt(jwt)).toEqual({
117
- customuser_id: null,
118
- account_id: 67890,
119
- });
120
- });
121
- it("should return null account_id when zap:acc is missing", () => {
122
- const payload = {
123
- sub: "12345",
124
- sub_type: "customuser",
125
- };
126
- const jwt = createJwt(payload);
127
- expect(extractUserIdsFromJwt(jwt)).toEqual({
128
- customuser_id: 12345,
129
- account_id: null,
130
- });
131
- });
132
- it("should return null values when both fields are missing", () => {
133
- const payload = {
134
- other_field: "value",
135
- };
136
- const jwt = createJwt(payload);
137
- expect(extractUserIdsFromJwt(jwt)).toEqual({
138
- customuser_id: null,
139
- account_id: null,
140
- });
141
- });
142
- it("should handle nested JWT for service tokens", () => {
143
- const nestedPayload = {
144
- sub: "12345",
145
- sub_type: "customuser",
146
- "zap:acc": "67890",
147
- };
148
- const nestedJwt = createJwt(nestedPayload);
149
- const servicePayload = {
150
- sub_type: "service",
151
- njwt: nestedJwt,
152
- };
153
- const serviceJwt = createJwt(servicePayload);
154
- expect(extractUserIdsFromJwt(serviceJwt)).toEqual({
155
- customuser_id: 12345,
156
- account_id: 67890,
157
- });
158
- });
159
- it("should fall back to outer payload when nested JWT is invalid", () => {
160
- const servicePayload = {
161
- sub_type: "service",
162
- njwt: "invalid.jwt",
163
- "zap:acc": "99999",
164
- };
165
- const serviceJwt = createJwt(servicePayload);
166
- expect(extractUserIdsFromJwt(serviceJwt)).toEqual({
167
- customuser_id: null,
168
- account_id: 99999,
169
- });
170
- });
171
- it("should use outer payload when sub_type is service but njwt is missing", () => {
172
- const servicePayload = {
173
- sub: "12345",
174
- sub_type: "service",
175
- "zap:acc": "67890",
176
- };
177
- const serviceJwt = createJwt(servicePayload);
178
- expect(extractUserIdsFromJwt(serviceJwt)).toEqual({
179
- customuser_id: null,
180
- account_id: 67890,
181
- });
182
- });
183
- it("should return null for non-numeric sub values", () => {
184
- const payload = {
185
- sub: "not-a-number",
186
- sub_type: "customuser",
187
- "zap:acc": "67890",
188
- };
189
- const jwt = createJwt(payload);
190
- expect(extractUserIdsFromJwt(jwt)).toEqual({
191
- customuser_id: null,
192
- account_id: 67890,
193
- });
194
- });
195
- it("should return null for non-numeric zap:acc values", () => {
196
- const payload = {
197
- sub: "12345",
198
- sub_type: "customuser",
199
- "zap:acc": "not-a-number",
200
- };
201
- const jwt = createJwt(payload);
202
- expect(extractUserIdsFromJwt(jwt)).toEqual({
203
- customuser_id: 12345,
204
- account_id: null,
205
- });
206
- });
207
- it("should return null for values that parse to NaN", () => {
208
- const payload = {
209
- sub: "abc",
210
- sub_type: "customuser",
211
- "zap:acc": "xyz",
212
- };
213
- const jwt = createJwt(payload);
214
- expect(extractUserIdsFromJwt(jwt)).toEqual({
215
- customuser_id: null,
216
- account_id: null,
217
- });
218
- });
219
- });
220
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=client.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.test.d.ts","sourceRoot":"","sources":["../../src/api/client.test.ts"],"names":[],"mappings":""}