@zapier/zapier-sdk 0.40.3 → 0.41.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 +12 -0
- package/dist/api/polling.js +3 -4
- package/dist/api/schemas.d.ts +1 -0
- package/dist/api/schemas.d.ts.map +1 -1
- package/dist/api/schemas.js +1 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +14 -7
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -2
- package/dist/credentials.d.ts.map +1 -1
- package/dist/credentials.js +21 -19
- package/dist/index.cjs +143 -105
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +143 -85
- package/dist/plugins/capabilities/index.d.ts.map +1 -1
- package/dist/plugins/capabilities/index.js +1 -3
- package/dist/plugins/eventEmission/builders.d.ts.map +1 -1
- package/dist/plugins/eventEmission/builders.js +4 -4
- package/dist/plugins/eventEmission/index.d.ts.map +1 -1
- package/dist/plugins/eventEmission/index.js +11 -11
- package/dist/plugins/eventEmission/utils.d.ts.map +1 -1
- package/dist/plugins/eventEmission/utils.js +43 -36
- package/dist/plugins/getConnection/index.d.ts.map +1 -1
- package/dist/plugins/getConnection/index.js +6 -1
- package/dist/plugins/getProfile/index.js +1 -1
- package/dist/plugins/listConnections/index.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.js +5 -2
- package/dist/plugins/tables/createTable/schemas.d.ts +2 -0
- package/dist/plugins/tables/createTable/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/getTable/schemas.d.ts +2 -0
- package/dist/plugins/tables/getTable/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/listTables/schemas.d.ts +5 -1
- package/dist/plugins/tables/listTables/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/listTables/schemas.js +3 -1
- package/dist/plugins/tables/utils.d.ts.map +1 -1
- package/dist/plugins/tables/utils.js +3 -2
- package/dist/utils/batch-utils.d.ts.map +1 -1
- package/dist/utils/batch-utils.js +5 -6
- package/dist/utils/domain-utils.d.ts +7 -1
- package/dist/utils/domain-utils.d.ts.map +1 -1
- package/dist/utils/domain-utils.js +35 -0
- package/dist/utils/url-utils.js +2 -2
- package/package.json +6 -2
|
@@ -24,7 +24,7 @@ function removeExistingListeners() {
|
|
|
24
24
|
for (const event of events) {
|
|
25
25
|
const listener = registeredListeners[event];
|
|
26
26
|
if (listener) {
|
|
27
|
-
process
|
|
27
|
+
globalThis.process?.removeListener(event, listener);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
registeredListeners = {};
|
|
@@ -84,7 +84,7 @@ async function silentEmit(transport, subject, event, userContextPromise) {
|
|
|
84
84
|
}
|
|
85
85
|
// Helper to get transport config from environment or options
|
|
86
86
|
function getTransportConfig(options) {
|
|
87
|
-
const envTransport = process?.env?.ZAPIER_SDK_TELEMETRY_TRANSPORT;
|
|
87
|
+
const envTransport = globalThis.process?.env?.ZAPIER_SDK_TELEMETRY_TRANSPORT;
|
|
88
88
|
if (envTransport === "noop" || envTransport === "disabled") {
|
|
89
89
|
return { type: "noop" };
|
|
90
90
|
}
|
|
@@ -92,7 +92,7 @@ function getTransportConfig(options) {
|
|
|
92
92
|
return { type: "console" };
|
|
93
93
|
}
|
|
94
94
|
// Default to HTTP transport with resolved tracking URL
|
|
95
|
-
const endpoint = process?.env?.ZAPIER_SDK_TELEMETRY_ENDPOINT ||
|
|
95
|
+
const endpoint = globalThis.process?.env?.ZAPIER_SDK_TELEMETRY_ENDPOINT ||
|
|
96
96
|
`${getTrackingBaseUrl({
|
|
97
97
|
trackingBaseUrl: options?.trackingBaseUrl,
|
|
98
98
|
baseUrl: options?.baseUrl,
|
|
@@ -113,7 +113,7 @@ export const eventEmissionPlugin = ({ context }) => {
|
|
|
113
113
|
callContext: context.options.eventEmission?.callContext,
|
|
114
114
|
transport:
|
|
115
115
|
// If env var is set, use it (defaultTransport will be from env)
|
|
116
|
-
process?.env?.ZAPIER_SDK_TELEMETRY_TRANSPORT
|
|
116
|
+
globalThis.process?.env?.ZAPIER_SDK_TELEMETRY_TRANSPORT
|
|
117
117
|
? defaultTransport
|
|
118
118
|
: // Otherwise, use option transport or default
|
|
119
119
|
(context.options.eventEmission?.transport ?? defaultTransport),
|
|
@@ -213,7 +213,7 @@ export const eventEmissionPlugin = ({ context }) => {
|
|
|
213
213
|
});
|
|
214
214
|
trackEmission(silentEmit(transport, APPLICATION_LIFECYCLE_EVENT_SUBJECT, startupEvent, getUserContext));
|
|
215
215
|
// Register process event handlers (Node.js only)
|
|
216
|
-
if (typeof process?.on === "function") {
|
|
216
|
+
if (typeof globalThis.process?.on === "function") {
|
|
217
217
|
// Remove any existing listeners from previous SDK instances to prevent memory leaks
|
|
218
218
|
removeExistingListeners();
|
|
219
219
|
// Handle normal process exit
|
|
@@ -234,7 +234,7 @@ export const eventEmissionPlugin = ({ context }) => {
|
|
|
234
234
|
trackEmission(silentEmit(transport, APPLICATION_LIFECYCLE_EVENT_SUBJECT, exitEvent, getUserContext));
|
|
235
235
|
};
|
|
236
236
|
registeredListeners.exit = exitHandler;
|
|
237
|
-
process.on("exit", exitHandler);
|
|
237
|
+
globalThis.process.on("exit", exitHandler);
|
|
238
238
|
// Handle uncaught exceptions
|
|
239
239
|
const uncaughtExceptionHandler = async (error) => {
|
|
240
240
|
let errorEvent = buildErrorEventWithContext({
|
|
@@ -257,7 +257,7 @@ export const eventEmissionPlugin = ({ context }) => {
|
|
|
257
257
|
await emitWithTimeout(transport, ERROR_OCCURRED_EVENT_SUBJECT, errorEvent);
|
|
258
258
|
};
|
|
259
259
|
registeredListeners.uncaughtException = uncaughtExceptionHandler;
|
|
260
|
-
process.on("uncaughtException", uncaughtExceptionHandler);
|
|
260
|
+
globalThis.process.on("uncaughtException", uncaughtExceptionHandler);
|
|
261
261
|
// Handle unhandled promise rejections
|
|
262
262
|
const unhandledRejectionHandler = async (reason, promise) => {
|
|
263
263
|
const errorMessage = reason instanceof Error
|
|
@@ -289,7 +289,7 @@ export const eventEmissionPlugin = ({ context }) => {
|
|
|
289
289
|
await emitWithTimeout(transport, ERROR_OCCURRED_EVENT_SUBJECT, errorEvent);
|
|
290
290
|
};
|
|
291
291
|
registeredListeners.unhandledRejection = unhandledRejectionHandler;
|
|
292
|
-
process.on("unhandledRejection", unhandledRejectionHandler);
|
|
292
|
+
globalThis.process.on("unhandledRejection", unhandledRejectionHandler);
|
|
293
293
|
// Handle termination signals
|
|
294
294
|
const handleSignal = async (signal) => {
|
|
295
295
|
shutdownStartTime = Date.now();
|
|
@@ -311,15 +311,15 @@ export const eventEmissionPlugin = ({ context }) => {
|
|
|
311
311
|
await emitWithTimeout(transport, APPLICATION_LIFECYCLE_EVENT_SUBJECT, signalEvent);
|
|
312
312
|
// Exit with appropriate code (128 + signal number)
|
|
313
313
|
const exitCode = signal === "SIGINT" ? 130 : 143;
|
|
314
|
-
process.exit(exitCode);
|
|
314
|
+
globalThis.process.exit(exitCode);
|
|
315
315
|
};
|
|
316
316
|
// Register signal handlers
|
|
317
317
|
const sigintHandler = () => handleSignal("SIGINT");
|
|
318
318
|
const sigtermHandler = () => handleSignal("SIGTERM");
|
|
319
319
|
registeredListeners.SIGINT = sigintHandler;
|
|
320
320
|
registeredListeners.SIGTERM = sigtermHandler;
|
|
321
|
-
process.on("SIGINT", sigintHandler);
|
|
322
|
-
process.on("SIGTERM", sigtermHandler);
|
|
321
|
+
globalThis.process.on("SIGINT", sigintHandler);
|
|
322
|
+
globalThis.process.on("SIGTERM", sigtermHandler);
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
const close = async (exitCode) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/plugins/eventEmission/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/plugins/eventEmission/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAaA;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAQnE;AAED;;GAEG;AACH,wBAAgB,IAAI,IAAI,OAAO,CAa9B;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,GAAG,IAAI,CAgB7C;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAM9C;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,GAAG,IAAI,CAM1C"}
|
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
* Simple utility functions for event emission
|
|
3
3
|
* These are pure functions that can be used to populate common event fields
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
// Intentional dynamic require for browser compatibility. The os module is only
|
|
6
|
+
// available in Node; in browser environments this gracefully falls back to nulls.
|
|
7
|
+
let osModule = null;
|
|
8
|
+
try {
|
|
9
|
+
osModule = require("os");
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
osModule = null;
|
|
13
|
+
}
|
|
6
14
|
/**
|
|
7
15
|
* Generate a unique event ID
|
|
8
16
|
*/
|
|
@@ -19,26 +27,24 @@ export function getCurrentTimestamp() {
|
|
|
19
27
|
* Get release ID (git SHA) - in production this would come from build process
|
|
20
28
|
*/
|
|
21
29
|
export function getReleaseId() {
|
|
22
|
-
return process?.env?.SDK_RELEASE_ID || "development";
|
|
30
|
+
return globalThis.process?.env?.SDK_RELEASE_ID || "development";
|
|
23
31
|
}
|
|
24
32
|
/**
|
|
25
33
|
* Get operating system information
|
|
26
34
|
*/
|
|
27
35
|
export function getOsInfo() {
|
|
36
|
+
if (!osModule) {
|
|
37
|
+
return { platform: null, release: null, architecture: null };
|
|
38
|
+
}
|
|
28
39
|
try {
|
|
29
40
|
return {
|
|
30
|
-
platform:
|
|
31
|
-
release:
|
|
32
|
-
architecture:
|
|
41
|
+
platform: osModule.platform() || null,
|
|
42
|
+
release: osModule.release() || null,
|
|
43
|
+
architecture: osModule.arch() || null,
|
|
33
44
|
};
|
|
34
45
|
}
|
|
35
46
|
catch {
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
platform: null,
|
|
39
|
-
release: null,
|
|
40
|
-
architecture: null,
|
|
41
|
-
};
|
|
47
|
+
return { platform: null, release: null, architecture: null };
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
/**
|
|
@@ -46,8 +52,8 @@ export function getOsInfo() {
|
|
|
46
52
|
*/
|
|
47
53
|
export function getPlatformVersions() {
|
|
48
54
|
const versions = {};
|
|
49
|
-
if (typeof process?.versions === "object") {
|
|
50
|
-
for (const [key, value] of Object.entries(process.versions)) {
|
|
55
|
+
if (typeof globalThis.process?.versions === "object") {
|
|
56
|
+
for (const [key, value] of Object.entries(globalThis.process.versions)) {
|
|
51
57
|
versions[key] = value || null;
|
|
52
58
|
}
|
|
53
59
|
}
|
|
@@ -57,38 +63,39 @@ export function getPlatformVersions() {
|
|
|
57
63
|
* Check if running in CI environment
|
|
58
64
|
*/
|
|
59
65
|
export function isCi() {
|
|
60
|
-
return !!(process?.env?.CI ||
|
|
61
|
-
process?.env?.CONTINUOUS_INTEGRATION ||
|
|
62
|
-
process?.env?.GITHUB_ACTIONS ||
|
|
63
|
-
process?.env?.JENKINS_URL ||
|
|
64
|
-
process?.env?.GITLAB_CI ||
|
|
65
|
-
process?.env?.CIRCLECI ||
|
|
66
|
-
process?.env?.TRAVIS ||
|
|
67
|
-
process?.env?.BUILDKITE ||
|
|
68
|
-
process?.env?.DRONE ||
|
|
69
|
-
process?.env?.BITBUCKET_PIPELINES_UUID);
|
|
66
|
+
return !!(globalThis.process?.env?.CI ||
|
|
67
|
+
globalThis.process?.env?.CONTINUOUS_INTEGRATION ||
|
|
68
|
+
globalThis.process?.env?.GITHUB_ACTIONS ||
|
|
69
|
+
globalThis.process?.env?.JENKINS_URL ||
|
|
70
|
+
globalThis.process?.env?.GITLAB_CI ||
|
|
71
|
+
globalThis.process?.env?.CIRCLECI ||
|
|
72
|
+
globalThis.process?.env?.TRAVIS ||
|
|
73
|
+
globalThis.process?.env?.BUILDKITE ||
|
|
74
|
+
globalThis.process?.env?.DRONE ||
|
|
75
|
+
globalThis.process?.env?.BITBUCKET_PIPELINES_UUID);
|
|
70
76
|
}
|
|
71
77
|
/**
|
|
72
78
|
* Get CI platform name if running in CI
|
|
73
79
|
*/
|
|
74
80
|
export function getCiPlatform() {
|
|
75
|
-
if (process?.env?.GITHUB_ACTIONS)
|
|
81
|
+
if (globalThis.process?.env?.GITHUB_ACTIONS)
|
|
76
82
|
return "github-actions";
|
|
77
|
-
if (process?.env?.JENKINS_URL)
|
|
83
|
+
if (globalThis.process?.env?.JENKINS_URL)
|
|
78
84
|
return "jenkins";
|
|
79
|
-
if (process?.env?.GITLAB_CI)
|
|
85
|
+
if (globalThis.process?.env?.GITLAB_CI)
|
|
80
86
|
return "gitlab-ci";
|
|
81
|
-
if (process?.env?.CIRCLECI)
|
|
87
|
+
if (globalThis.process?.env?.CIRCLECI)
|
|
82
88
|
return "circleci";
|
|
83
|
-
if (process?.env?.TRAVIS)
|
|
89
|
+
if (globalThis.process?.env?.TRAVIS)
|
|
84
90
|
return "travis";
|
|
85
|
-
if (process?.env?.BUILDKITE)
|
|
91
|
+
if (globalThis.process?.env?.BUILDKITE)
|
|
86
92
|
return "buildkite";
|
|
87
|
-
if (process?.env?.DRONE)
|
|
93
|
+
if (globalThis.process?.env?.DRONE)
|
|
88
94
|
return "drone";
|
|
89
|
-
if (process?.env?.BITBUCKET_PIPELINES_UUID)
|
|
95
|
+
if (globalThis.process?.env?.BITBUCKET_PIPELINES_UUID)
|
|
90
96
|
return "bitbucket-pipelines";
|
|
91
|
-
if (process?.env?.CI ||
|
|
97
|
+
if (globalThis.process?.env?.CI ||
|
|
98
|
+
globalThis.process?.env?.CONTINUOUS_INTEGRATION)
|
|
92
99
|
return "unknown-ci";
|
|
93
100
|
return null;
|
|
94
101
|
}
|
|
@@ -96,8 +103,8 @@ export function getCiPlatform() {
|
|
|
96
103
|
* Get memory usage in bytes
|
|
97
104
|
*/
|
|
98
105
|
export function getMemoryUsage() {
|
|
99
|
-
if (process?.memoryUsage) {
|
|
100
|
-
const usage = process.memoryUsage();
|
|
106
|
+
if (globalThis.process?.memoryUsage) {
|
|
107
|
+
const usage = globalThis.process.memoryUsage();
|
|
101
108
|
return usage.rss || null; // Resident Set Size
|
|
102
109
|
}
|
|
103
110
|
return null;
|
|
@@ -106,8 +113,8 @@ export function getMemoryUsage() {
|
|
|
106
113
|
* Get CPU time in milliseconds
|
|
107
114
|
*/
|
|
108
115
|
export function getCpuTime() {
|
|
109
|
-
if (process?.cpuUsage) {
|
|
110
|
-
const usage = process.cpuUsage();
|
|
116
|
+
if (globalThis.process?.cpuUsage) {
|
|
117
|
+
const usage = globalThis.process.cpuUsage();
|
|
111
118
|
return Math.round((usage.user + usage.system) / 1000); // Convert to milliseconds
|
|
112
119
|
}
|
|
113
120
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getConnection/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getConnection/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAK3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAC5F,OAAO,EAAE,wBAAwB,EAAE,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE9E,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,CACb,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACpC,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,aAAa,EAAE;gBACb,WAAW,EAAE,OAAO,wBAAwB,CAAC;aAC9C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,mBAAmB,EAAE,MAAM,CACtC,EAAE,EAAE,sBAAsB;AAC1B,AADI,sBAAsB;AAC1B;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,EAAE,0BAA0B;AACrE,2BAA2B,CAgD5B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createFunction } from "../../utils/function-utils";
|
|
2
2
|
import { connectionIdGenericResolver } from "../../resolvers";
|
|
3
|
+
import { transformConnectionItem } from "../../utils/domain-utils";
|
|
3
4
|
import { ConnectionItemSchema } from "../../schemas/Connection";
|
|
4
5
|
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
5
6
|
import { GetConnectionParamSchema } from "./schemas";
|
|
@@ -10,7 +11,11 @@ export const getConnectionPlugin = ({ context }) => {
|
|
|
10
11
|
if (!resolvedConnectionId) {
|
|
11
12
|
throw new Error("connection is required");
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
+
const response = await api.get(`/api/v0/connections/${encodeURIComponent(String(resolvedConnectionId))}`);
|
|
15
|
+
return {
|
|
16
|
+
...response,
|
|
17
|
+
data: transformConnectionItem(response.data),
|
|
18
|
+
};
|
|
14
19
|
}
|
|
15
20
|
const getConnectionDefinition = createFunction(getConnection, GetConnectionParamSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, getConnection.name));
|
|
16
21
|
return {
|
|
@@ -10,7 +10,7 @@ export const getProfilePlugin = ({ context }) => {
|
|
|
10
10
|
});
|
|
11
11
|
return {
|
|
12
12
|
data: {
|
|
13
|
-
id: String(profile.id),
|
|
13
|
+
id: String(profile.public_id ?? profile.id),
|
|
14
14
|
first_name: profile.first_name,
|
|
15
15
|
last_name: profile.last_name,
|
|
16
16
|
full_name: `${profile.first_name} ${profile.last_name}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listConnections/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EACL,0BAA0B,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACzB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listConnections/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EACL,0BAA0B,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACzB,MAAM,WAAW,CAAC;AASnB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAG1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAQ7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAEhE,MAAM,WAAW,6BAA6B;IAC5C,eAAe,EAAE,CACf,OAAO,CAAC,EAAE,sBAAsB,KAC7B,OAAO,CAAC,mBAAmB,CAAC,GAC/B,aAAa,CAAC,mBAAmB,CAAC,GAAG;QACnC,KAAK,IAAI,aAAa,CAAC,cAAc,CAAC,CAAC;KACxC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,eAAe,EAAE;gBACf,WAAW,EAAE,OAAO,0BAA0B,CAAC;aAChD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,qBAAqB,EAAE,MAAM,CACxC,UAAU,CAAC,sBAAsB,CAAC,EAClC;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,GACtB,mBAAmB,GACnB,yBAAyB,CAAC,SAAS,CAAC,EACtC,6BAA6B,CA6I9B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ListConnectionsQuerySchema, } from "./schemas";
|
|
2
|
-
import { splitVersionedKey, resolveConnectionId, } from "../../utils/domain-utils";
|
|
2
|
+
import { splitVersionedKey, resolveConnectionId, transformConnectionItem, } from "../../utils/domain-utils";
|
|
3
3
|
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
4
4
|
import { DEFAULT_PAGE_SIZE } from "../../constants";
|
|
5
5
|
import { appKeyResolver } from "../../resolvers";
|
|
@@ -92,7 +92,10 @@ export const listConnectionsPlugin = ({ context }) => {
|
|
|
92
92
|
},
|
|
93
93
|
authRequired: true,
|
|
94
94
|
});
|
|
95
|
-
return
|
|
95
|
+
return {
|
|
96
|
+
...response,
|
|
97
|
+
data: response.data.map(transformConnectionItem),
|
|
98
|
+
};
|
|
96
99
|
}
|
|
97
100
|
const methodName = stripPageSuffix(listConnectionsPage.name);
|
|
98
101
|
const listConnectionsDefinition = createPaginatedFunction(listConnectionsPage, ListConnectionsQuerySchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName, DEFAULT_PAGE_SIZE);
|
|
@@ -16,8 +16,10 @@ export declare const CreateTableApiResponseSchema: z.ZodObject<{
|
|
|
16
16
|
virtual_table: "virtual_table";
|
|
17
17
|
}>;
|
|
18
18
|
owner_account_id: z.ZodNumber;
|
|
19
|
+
owner_account_public_id: z.ZodOptional<z.ZodString>;
|
|
19
20
|
owner_user_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
20
21
|
owner_zapier_customuser_id: z.ZodNumber;
|
|
22
|
+
owner_zapier_customuser_public_id: z.ZodOptional<z.ZodString>;
|
|
21
23
|
parent_table_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
24
|
}, z.core.$strip>;
|
|
23
25
|
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/createTable/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;AAExC,eAAO,MAAM,4BAA4B
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/createTable/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;AAExC,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;iBAEvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CACpC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;iBAQJ,CAAC;AAElC,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,GACvE,eAAe,CAAC;AAGlB,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,SAAS,CAAC;CACjB;AAGD,MAAM,MAAM,gBAAgB,GACxB,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC1E"}
|
|
@@ -15,8 +15,10 @@ export declare const GetTableApiResponseSchema: z.ZodObject<{
|
|
|
15
15
|
virtual_table: "virtual_table";
|
|
16
16
|
}>;
|
|
17
17
|
owner_account_id: z.ZodNumber;
|
|
18
|
+
owner_account_public_id: z.ZodOptional<z.ZodString>;
|
|
18
19
|
owner_user_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
19
20
|
owner_zapier_customuser_id: z.ZodNumber;
|
|
21
|
+
owner_zapier_customuser_public_id: z.ZodOptional<z.ZodString>;
|
|
20
22
|
parent_table_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
21
23
|
}, z.core.$strip>;
|
|
22
24
|
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/getTable/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;AAExC,eAAO,MAAM,yBAAyB
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/getTable/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;AAExC,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;iBAEpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAK5E,eAAO,MAAM,qBAAqB;;;;iBAKQ,CAAC;AAG3C,QAAA,MAAM,+BAA+B;;iBAKnC,CAAC;AAGH,eAAO,MAAM,0BAA0B;;;;;;mBAEP,CAAC;AAGjC,MAAM,MAAM,eAAe,GACvB,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,GACrC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,EAAE,SAAS,CAAC,GAAG;IAClE,uCAAuC;IACvC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC,SAAS,CAAC,CAAC;CACrE,CAAC,CAAC;AAGP,MAAM,MAAM,aAAa,GACrB,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;CACtE"}
|
|
@@ -12,8 +12,10 @@ export declare const TableApiItemSchema: z.ZodObject<{
|
|
|
12
12
|
virtual_table: "virtual_table";
|
|
13
13
|
}>;
|
|
14
14
|
owner_account_id: z.ZodNumber;
|
|
15
|
+
owner_account_public_id: z.ZodOptional<z.ZodString>;
|
|
15
16
|
owner_user_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
16
17
|
owner_zapier_customuser_id: z.ZodNumber;
|
|
18
|
+
owner_zapier_customuser_public_id: z.ZodOptional<z.ZodString>;
|
|
17
19
|
parent_table_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
18
20
|
}, z.core.$strip>;
|
|
19
21
|
export type TableApiItem = z.infer<typeof TableApiItemSchema>;
|
|
@@ -29,8 +31,10 @@ export declare const ListTablesApiResponseSchema: z.ZodObject<{
|
|
|
29
31
|
virtual_table: "virtual_table";
|
|
30
32
|
}>;
|
|
31
33
|
owner_account_id: z.ZodNumber;
|
|
34
|
+
owner_account_public_id: z.ZodOptional<z.ZodString>;
|
|
32
35
|
owner_user_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
33
36
|
owner_zapier_customuser_id: z.ZodNumber;
|
|
37
|
+
owner_zapier_customuser_public_id: z.ZodOptional<z.ZodString>;
|
|
34
38
|
parent_table_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
35
39
|
}, z.core.$strip>>;
|
|
36
40
|
links: z.ZodOptional<z.ZodObject<{
|
|
@@ -48,7 +52,7 @@ export declare const TableItemSchema: z.ZodObject<{
|
|
|
48
52
|
table: "table";
|
|
49
53
|
virtual_table: "virtual_table";
|
|
50
54
|
}>;
|
|
51
|
-
|
|
55
|
+
account_id: z.ZodString;
|
|
52
56
|
profile_id: z.ZodString;
|
|
53
57
|
parent_table_id: z.ZodOptional<z.ZodString>;
|
|
54
58
|
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTables/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAE/B,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTables/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0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
owner_account_id: z.number(),
|
|
11
|
+
owner_account_public_id: z.string().optional(),
|
|
11
12
|
owner_user_id: z.number().nullable().optional(),
|
|
12
13
|
owner_zapier_customuser_id: z.number(),
|
|
14
|
+
owner_zapier_customuser_public_id: z.string().optional(),
|
|
13
15
|
parent_table_id: z.string().nullable().optional(),
|
|
14
16
|
});
|
|
15
17
|
export const ListTablesApiResponseSchema = z.object({
|
|
@@ -27,7 +29,7 @@ export const TableItemSchema = z.object({
|
|
|
27
29
|
created_at: z.string(),
|
|
28
30
|
edited_at: z.string(),
|
|
29
31
|
kind: z.enum(["table", "virtual_table"]),
|
|
30
|
-
|
|
32
|
+
account_id: z.string(),
|
|
31
33
|
profile_id: z.string(),
|
|
32
34
|
parent_table_id: z.string().optional(),
|
|
33
35
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/plugins/tables/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEzE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAUnD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAS5D;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/plugins/tables/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,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AO,EACP,SAAS,GACV,EAAE;IACD,GAAG,EAAE,SAAS,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CACnC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAyBpB;AAED,MAAM,WAAW,kBAAkB;IACjC,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvE,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxE,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACxC;AAED;;;;GAIG;AACH,wBAAsB,wBAAwB,CAAC,EAC7C,GAAG,EACH,OAAO,EACP,OAAO,GACR,EAAE;IACD,GAAG,EAAE,SAAS,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAkF9B"}
|
|
@@ -34,8 +34,9 @@ export function transformTableItem(apiItem) {
|
|
|
34
34
|
created_at: apiItem.created_at,
|
|
35
35
|
edited_at: apiItem.edited_at,
|
|
36
36
|
kind: apiItem.kind,
|
|
37
|
-
|
|
38
|
-
profile_id: String(apiItem.
|
|
37
|
+
account_id: String(apiItem.owner_account_public_id ?? apiItem.owner_account_id),
|
|
38
|
+
profile_id: String(apiItem.owner_zapier_customuser_public_id ??
|
|
39
|
+
apiItem.owner_zapier_customuser_id),
|
|
39
40
|
parent_table_id: apiItem.parent_table_id ?? undefined,
|
|
40
41
|
};
|
|
41
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-utils.d.ts","sourceRoot":"","sources":["../../src/utils/batch-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"batch-utils.d.ts","sourceRoot":"","sources":["../../src/utils/batch-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2BH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,KAAK,CAAC,CAAC,EAC3B,KAAK,EAAE,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,EAC3B,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC,CAuIpC"}
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* This module provides utilities for executing multiple async operations
|
|
5
5
|
* with concurrency control and retry logic.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import { calculateErrorBackoffMs, MAX_CONSECUTIVE_ERRORS } from "./retry-utils";
|
|
7
|
+
import { sleep, calculateErrorBackoffMs, MAX_CONSECUTIVE_ERRORS, } from "./retry-utils";
|
|
9
8
|
import { ZapierTimeoutError } from "../types/errors";
|
|
10
9
|
/**
|
|
11
10
|
* Default number of concurrent operations
|
|
@@ -88,7 +87,7 @@ export async function batch(tasks, options = {}) {
|
|
|
88
87
|
let result;
|
|
89
88
|
// Apply per-task timeout if specified
|
|
90
89
|
if (taskTimeoutMs !== undefined) {
|
|
91
|
-
const timeoutPromise =
|
|
90
|
+
const timeoutPromise = sleep(taskTimeoutMs).then(() => {
|
|
92
91
|
throw new ZapierTimeoutError(`Task timed out after ${taskTimeoutMs}ms`);
|
|
93
92
|
});
|
|
94
93
|
result = await Promise.race([task(), timeoutPromise]);
|
|
@@ -106,7 +105,7 @@ export async function batch(tasks, options = {}) {
|
|
|
106
105
|
if (retry && !isTimeout && newErrorCount < MAX_CONSECUTIVE_ERRORS) {
|
|
107
106
|
// Calculate backoff delay (base 1000ms with jitter and error scaling)
|
|
108
107
|
const waitTime = calculateErrorBackoffMs(1000, newErrorCount);
|
|
109
|
-
await
|
|
108
|
+
await sleep(waitTime);
|
|
110
109
|
// Re-queue the task with incremented error count
|
|
111
110
|
taskQueue.push({
|
|
112
111
|
index,
|
|
@@ -138,7 +137,7 @@ export async function batch(tasks, options = {}) {
|
|
|
138
137
|
// Small delay to prevent burst patterns within a worker
|
|
139
138
|
// Only delay if there are more tasks to process
|
|
140
139
|
if (taskQueue.length > 0 && batchDelay > 0) {
|
|
141
|
-
await
|
|
140
|
+
await sleep(batchDelay);
|
|
142
141
|
}
|
|
143
142
|
}
|
|
144
143
|
}
|
|
@@ -153,7 +152,7 @@ export async function batch(tasks, options = {}) {
|
|
|
153
152
|
// Add small delay between starting workers to stagger the initial requests
|
|
154
153
|
// Skip delay for last worker
|
|
155
154
|
if (i < workerCount - 1 && batchDelay > 0) {
|
|
156
|
-
await
|
|
155
|
+
await sleep(batchDelay / 10); // 10ms between worker starts
|
|
157
156
|
}
|
|
158
157
|
}
|
|
159
158
|
// Wait for all workers to complete
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { Action, ImplementationMeta } from "../api/types";
|
|
5
5
|
import type { ConnectionEntry } from "../types/connections";
|
|
6
|
-
import type { ActionItem, AppItem } from "../types/domain";
|
|
6
|
+
import type { ActionItem, AppItem, ConnectionItem } from "../types/domain";
|
|
7
7
|
/**
|
|
8
8
|
* Checks if a string value looks like a direct connection ID rather than a named alias.
|
|
9
9
|
* Returns true for numeric strings and UUIDs.
|
|
@@ -42,6 +42,12 @@ export declare function splitVersionedKey(versionedKey: string): [string, string
|
|
|
42
42
|
*/
|
|
43
43
|
export declare function normalizeImplementationMetaToAppItem(implementationMeta: ImplementationMeta): AppItem;
|
|
44
44
|
export declare function normalizeActionItem(action: Action): ActionItem;
|
|
45
|
+
/**
|
|
46
|
+
* Prefer public IDs over numeric IDs in a connection item.
|
|
47
|
+
* The API returns extra public_id, account_public_id, and customuser_public_id
|
|
48
|
+
* fields alongside the stringified numeric IDs. This function swaps them in.
|
|
49
|
+
*/
|
|
50
|
+
export declare function transformConnectionItem(item: ConnectionItem): ConnectionItem;
|
|
45
51
|
/**
|
|
46
52
|
* Groups app keys by their type based on format patterns
|
|
47
53
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-utils.d.ts","sourceRoot":"","sources":["../../src/utils/domain-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"domain-utils.d.ts","sourceRoot":"","sources":["../../src/utils/domain-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAM3E;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,GACN,EAAE;IACD,YAA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1D;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACpD,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAI9C;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAkBvD;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,UAAU,GACrB,UAAU,IAAI,kBAAkB,CAElC;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAEzE"}
|
|
@@ -102,6 +102,41 @@ export function normalizeActionItem(action) {
|
|
|
102
102
|
type: "action",
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Prefer public IDs over numeric IDs in a connection item.
|
|
107
|
+
* The API returns extra public_id, account_public_id, and customuser_public_id
|
|
108
|
+
* fields alongside the stringified numeric IDs. This function swaps them in.
|
|
109
|
+
*/
|
|
110
|
+
export function transformConnectionItem(item) {
|
|
111
|
+
const raw = item;
|
|
112
|
+
const publicId = raw.public_id;
|
|
113
|
+
const accountPublicId = raw.account_public_id;
|
|
114
|
+
const customuserPublicId = raw.customuser_public_id;
|
|
115
|
+
return {
|
|
116
|
+
id: String(publicId ?? item.id),
|
|
117
|
+
date: item.date,
|
|
118
|
+
account_id: String(accountPublicId ?? item.account_id),
|
|
119
|
+
is_invite_only: item.is_invite_only,
|
|
120
|
+
is_private: item.is_private,
|
|
121
|
+
shared_with_all: item.shared_with_all,
|
|
122
|
+
title: item.title,
|
|
123
|
+
lastchanged: item.lastchanged,
|
|
124
|
+
is_stale: item.is_stale,
|
|
125
|
+
is_shared: item.is_shared,
|
|
126
|
+
identifier: item.identifier,
|
|
127
|
+
groups: item.groups,
|
|
128
|
+
members: item.members,
|
|
129
|
+
permissions: item.permissions,
|
|
130
|
+
implementation_id: item.implementation_id,
|
|
131
|
+
profile_id: customuserPublicId
|
|
132
|
+
? String(customuserPublicId)
|
|
133
|
+
: item.profile_id,
|
|
134
|
+
is_expired: item.is_expired,
|
|
135
|
+
expired_at: item.expired_at,
|
|
136
|
+
app_key: item.app_key,
|
|
137
|
+
app_version: item.app_version,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
105
140
|
/**
|
|
106
141
|
* Groups app keys by their type based on format patterns
|
|
107
142
|
*
|
package/dist/utils/url-utils.js
CHANGED
|
@@ -43,8 +43,8 @@ export function getTrackingBaseUrl({ trackingBaseUrl, baseUrl, }) {
|
|
|
43
43
|
return trackingBaseUrl;
|
|
44
44
|
}
|
|
45
45
|
// 2. Environment variable override
|
|
46
|
-
if (process
|
|
47
|
-
return process
|
|
46
|
+
if (globalThis.process?.env?.ZAPIER_TRACKING_BASE_URL) {
|
|
47
|
+
return globalThis.process?.env?.ZAPIER_TRACKING_BASE_URL;
|
|
48
48
|
}
|
|
49
49
|
// 3. Try to derive from baseUrl if it's a Zapier domain
|
|
50
50
|
if (baseUrl) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zapier/zapier-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "Complete Zapier SDK - combines all Zapier SDK packages",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
+
"browser": {
|
|
44
|
+
"@zapier/zapier-sdk-cli/login": false,
|
|
45
|
+
"@zapier/zapier-sdk-cli-login": false
|
|
46
|
+
},
|
|
43
47
|
"files": [
|
|
44
48
|
"dist",
|
|
45
49
|
"README.md",
|
|
@@ -72,7 +76,7 @@
|
|
|
72
76
|
"@types/node": "^24.0.1",
|
|
73
77
|
"tsup": "^8.5.0",
|
|
74
78
|
"typescript": "^5.8.3",
|
|
75
|
-
"vitest": "^
|
|
79
|
+
"vitest": "^4.1.4",
|
|
76
80
|
"@zapier/zapier-sdk-cli-login": "0.9.0"
|
|
77
81
|
},
|
|
78
82
|
"scripts": {
|