@zapier/zapier-sdk 0.13.2 → 0.13.4
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/debug.d.ts.map +1 -1
- package/dist/api/debug.js +36 -1
- package/dist/api/schemas.d.ts +174 -174
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/index.cjs +475 -9
- package/dist/index.d.mts +381 -157
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.mjs +446 -13
- package/dist/plugins/api/index.d.ts +1 -3
- package/dist/plugins/api/index.d.ts.map +1 -1
- package/dist/plugins/eventEmission/builders.d.ts +13 -0
- package/dist/plugins/eventEmission/builders.d.ts.map +1 -0
- package/dist/plugins/eventEmission/builders.js +78 -0
- package/dist/plugins/eventEmission/index.d.ts +34 -0
- package/dist/plugins/eventEmission/index.d.ts.map +1 -0
- package/dist/plugins/eventEmission/index.js +216 -0
- package/dist/plugins/eventEmission/index.test.d.ts +5 -0
- package/dist/plugins/eventEmission/index.test.d.ts.map +1 -0
- package/dist/plugins/eventEmission/index.test.js +143 -0
- package/dist/plugins/eventEmission/transport.d.ts +37 -0
- package/dist/plugins/eventEmission/transport.d.ts.map +1 -0
- package/dist/plugins/eventEmission/transport.js +96 -0
- package/dist/plugins/eventEmission/transport.test.d.ts +5 -0
- package/dist/plugins/eventEmission/transport.test.d.ts.map +1 -0
- package/dist/plugins/eventEmission/transport.test.js +153 -0
- package/dist/plugins/eventEmission/types.d.ts +53 -0
- package/dist/plugins/eventEmission/types.d.ts.map +1 -0
- package/dist/plugins/eventEmission/types.js +1 -0
- package/dist/plugins/eventEmission/utils.d.ts +45 -0
- package/dist/plugins/eventEmission/utils.d.ts.map +1 -0
- package/dist/plugins/eventEmission/utils.js +114 -0
- package/dist/plugins/fetch/schemas.d.ts +4 -4
- package/dist/plugins/getAction/index.d.ts.map +1 -1
- package/dist/plugins/getAction/index.js +3 -2
- package/dist/plugins/getAction/schemas.d.ts +2 -2
- package/dist/plugins/listActions/schemas.d.ts +2 -2
- package/dist/plugins/listInputFieldChoices/schemas.d.ts +4 -4
- package/dist/plugins/listInputFields/index.d.ts +2 -1
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.js +7 -2
- package/dist/plugins/listInputFields/index.test.js +36 -5
- package/dist/plugins/listInputFields/schemas.d.ts +2 -2
- package/dist/plugins/request/schemas.d.ts +4 -4
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +6 -1
- package/dist/plugins/runAction/schemas.d.ts +2 -2
- package/dist/resolvers/actionType.d.ts.map +1 -1
- package/dist/resolvers/actionType.js +2 -3
- package/dist/resolvers/authenticationId.d.ts.map +1 -1
- package/dist/schemas/Action.d.ts +2 -2
- package/dist/schemas/App.d.ts +30 -30
- package/dist/sdk.d.ts +2 -2
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +4 -1
- package/dist/types/sdk.d.ts +5 -1
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/telemetry-events.d.ts +76 -0
- package/dist/types/telemetry-events.d.ts.map +1 -0
- package/dist/types/telemetry-events.js +8 -0
- package/package.json +1 -1
- package/src/api/debug.ts +44 -1
- package/src/constants.ts +6 -0
- package/src/index.ts +24 -0
- package/src/plugins/api/index.ts +1 -5
- package/src/plugins/eventEmission/builders.ts +115 -0
- package/src/plugins/eventEmission/index.test.ts +169 -0
- package/src/plugins/eventEmission/index.ts +294 -0
- package/src/plugins/eventEmission/transport.test.ts +214 -0
- package/src/plugins/eventEmission/transport.ts +135 -0
- package/src/plugins/eventEmission/types.ts +58 -0
- package/src/plugins/eventEmission/utils.ts +121 -0
- package/src/plugins/getAction/index.ts +5 -2
- package/src/plugins/listInputFields/index.test.ts +37 -5
- package/src/plugins/listInputFields/index.ts +10 -3
- package/src/plugins/runAction/index.ts +9 -0
- package/src/resolvers/actionType.ts +4 -3
- package/src/resolvers/authenticationId.ts +2 -1
- package/src/sdk.ts +5 -1
- package/src/types/sdk.ts +7 -1
- package/src/types/telemetry-events.ts +85 -0
- package/tsconfig.tsbuildinfo +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -31,4 +31,7 @@ export type { FunctionRegistryEntry } from "./types/sdk";
|
|
|
31
31
|
export type { Plugin, PluginProvides, PluginDependencies, PluginOptions, GetSdkType, GetContextType, Sdk, } from "./types/plugin";
|
|
32
32
|
export { registryPlugin } from "./plugins/registry";
|
|
33
33
|
export type { ZapierSdk } from "./types/sdk";
|
|
34
|
+
export type { BaseEvent } from "./types/telemetry-events";
|
|
35
|
+
export type { EventEmissionContext, EventContext, ApplicationLifecycleEventData, EnhancedErrorEventData, } from "./plugins/eventEmission";
|
|
36
|
+
export { generateEventId, getCurrentTimestamp, getReleaseId, getOsInfo, getPlatformVersions, isCi, getCiPlatform, getMemoryUsage, getCpuTime, buildApplicationLifecycleEvent, buildErrorEventWithContext, buildErrorEvent, createBaseEvent, } from "./plugins/eventEmission";
|
|
34
37
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAG9B,YAAY,EACV,MAAM,EACN,GAAG,EACH,IAAI,EACJ,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG1E,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGhE,cAAc,aAAa,CAAC;AAG5B,cAAc,QAAQ,CAAC;AAIvB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,eAAe,EACf,8BAA8B,EAC9B,SAAS,EACT,gBAAgB,GACjB,MAAM,OAAO,CAAC;AAGf,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGzD,YAAY,EACV,MAAM,EACN,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,cAAc,EACd,GAAG,GACJ,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
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,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAG9B,YAAY,EACV,MAAM,EACN,GAAG,EACH,IAAI,EACJ,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG1E,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGhE,cAAc,aAAa,CAAC;AAG5B,cAAc,QAAQ,CAAC;AAIvB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,eAAe,EACf,8BAA8B,EAC9B,SAAS,EACT,gBAAgB,GACjB,MAAM,OAAO,CAAC;AAGf,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGzD,YAAY,EACV,MAAM,EACN,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,cAAc,EACd,GAAG,GACJ,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,YAAY,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,YAAY,EACV,oBAAoB,EACpB,YAAY,EACZ,6BAA6B,EAC7B,sBAAsB,GACvB,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,GAChB,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -35,3 +35,4 @@ export { RelayRequestSchema, RelayFetchSchema, } from "./plugins/request/schemas
|
|
|
35
35
|
export { createZapierSdk, createZapierSdkWithoutRegistry, createSdk, } from "./sdk";
|
|
36
36
|
// Export registry plugin for manual use
|
|
37
37
|
export { registryPlugin } from "./plugins/registry";
|
|
38
|
+
export { generateEventId, getCurrentTimestamp, getReleaseId, getOsInfo, getPlatformVersions, isCi, getCiPlatform, getMemoryUsage, getCpuTime, buildApplicationLifecycleEvent, buildErrorEventWithContext, buildErrorEvent, createBaseEvent, } from "./plugins/eventEmission";
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { setTimeout } from 'timers/promises';
|
|
2
|
+
import { setTimeout as setTimeout$1 } from 'timers/promises';
|
|
3
|
+
import * as os from 'os';
|
|
3
4
|
|
|
4
5
|
// src/types/properties.ts
|
|
5
6
|
function withFormatter(schema, formatMeta) {
|
|
@@ -32,6 +33,7 @@ function isPositional(schema) {
|
|
|
32
33
|
|
|
33
34
|
// src/constants.ts
|
|
34
35
|
var MAX_PAGE_LIMIT = 1e4;
|
|
36
|
+
var TRACKING_API_ENDPOINT = "https://zapier.com/api/v4/tracking/event/";
|
|
35
37
|
|
|
36
38
|
// src/types/properties.ts
|
|
37
39
|
var AppKeyPropertySchema = withPositional(
|
|
@@ -368,7 +370,7 @@ var FetchInitSchema = z.object({
|
|
|
368
370
|
// src/plugins/fetch/index.ts
|
|
369
371
|
var fetchPlugin = ({ sdk }) => {
|
|
370
372
|
return {
|
|
371
|
-
fetch: async function
|
|
373
|
+
fetch: async function fetch2(url, init) {
|
|
372
374
|
const {
|
|
373
375
|
authenticationId,
|
|
374
376
|
callbackUrl,
|
|
@@ -1407,9 +1409,10 @@ var actionTypeResolver = {
|
|
|
1407
1409
|
const actionsResponse = await sdk.listActions({
|
|
1408
1410
|
appKey: resolvedParams.appKey
|
|
1409
1411
|
});
|
|
1410
|
-
const
|
|
1411
|
-
|
|
1412
|
-
|
|
1412
|
+
const actionTypes = actionsResponse.data.map(
|
|
1413
|
+
(action) => action.action_type
|
|
1414
|
+
);
|
|
1415
|
+
const types = [...new Set(actionTypes)];
|
|
1413
1416
|
return types.map((type) => ({ key: type, name: type }));
|
|
1414
1417
|
},
|
|
1415
1418
|
prompt: (types) => ({
|
|
@@ -1886,7 +1889,7 @@ function transformNeedsToFields(needs) {
|
|
|
1886
1889
|
}
|
|
1887
1890
|
return rootFields;
|
|
1888
1891
|
}
|
|
1889
|
-
var listInputFieldsPlugin = ({ context }) => {
|
|
1892
|
+
var listInputFieldsPlugin = ({ sdk, context }) => {
|
|
1890
1893
|
const listInputFields = createPaginatedFunction(
|
|
1891
1894
|
async function listInputFieldsPage(options) {
|
|
1892
1895
|
const { api, getVersionedImplementationId } = context;
|
|
@@ -1898,9 +1901,14 @@ var listInputFieldsPlugin = ({ context }) => {
|
|
|
1898
1901
|
{ configType: "current_implementation_id" }
|
|
1899
1902
|
);
|
|
1900
1903
|
}
|
|
1904
|
+
const { data: action } = await sdk.getAction({
|
|
1905
|
+
appKey,
|
|
1906
|
+
actionType,
|
|
1907
|
+
actionKey
|
|
1908
|
+
});
|
|
1901
1909
|
const needsRequest = {
|
|
1902
1910
|
selected_api: selectedApi,
|
|
1903
|
-
action:
|
|
1911
|
+
action: action.key,
|
|
1904
1912
|
type_of: actionType,
|
|
1905
1913
|
params: inputs || {}
|
|
1906
1914
|
};
|
|
@@ -2141,7 +2149,7 @@ var getActionPlugin = ({ sdk }) => {
|
|
|
2141
2149
|
const { actionKey, actionType, appKey } = options;
|
|
2142
2150
|
const actionsResult = await sdk.listActions({ appKey });
|
|
2143
2151
|
for (const action of actionsResult.data) {
|
|
2144
|
-
if (action.key === actionKey && action.action_type === actionType) {
|
|
2152
|
+
if ((action.key === actionKey || action.id === actionKey) && action.action_type === actionType) {
|
|
2145
2153
|
return { data: action };
|
|
2146
2154
|
}
|
|
2147
2155
|
}
|
|
@@ -2346,6 +2354,7 @@ async function executeAction(actionOptions) {
|
|
|
2346
2354
|
api,
|
|
2347
2355
|
context,
|
|
2348
2356
|
appKey,
|
|
2357
|
+
actionId,
|
|
2349
2358
|
actionKey,
|
|
2350
2359
|
actionType,
|
|
2351
2360
|
executionOptions,
|
|
@@ -2360,6 +2369,7 @@ async function executeAction(actionOptions) {
|
|
|
2360
2369
|
}
|
|
2361
2370
|
const runRequestData = {
|
|
2362
2371
|
selected_api: selectedApi,
|
|
2372
|
+
action_id: actionId,
|
|
2363
2373
|
action_key: actionKey,
|
|
2364
2374
|
action_type: actionType,
|
|
2365
2375
|
inputs: executionOptions.inputs || {}
|
|
@@ -2401,10 +2411,14 @@ var runActionPlugin = ({ sdk, context }) => {
|
|
|
2401
2411
|
`Action type mismatch: expected ${actionType}, got ${actionData.data.action_type}`
|
|
2402
2412
|
);
|
|
2403
2413
|
}
|
|
2414
|
+
const actionId = actionData.data.id;
|
|
2404
2415
|
const result = await executeAction({
|
|
2405
2416
|
api,
|
|
2406
2417
|
context,
|
|
2407
2418
|
appKey,
|
|
2419
|
+
// Some actions require the action ID to run them, but technically the ID is not guaranteed to be available when
|
|
2420
|
+
// we retrieve actions (probably legacy reasons), so we just pass along all the things!
|
|
2421
|
+
actionId,
|
|
2408
2422
|
actionKey,
|
|
2409
2423
|
actionType,
|
|
2410
2424
|
executionOptions: { inputs },
|
|
@@ -2949,13 +2963,37 @@ function getAuthorizationHeader(token) {
|
|
|
2949
2963
|
}
|
|
2950
2964
|
|
|
2951
2965
|
// src/api/debug.ts
|
|
2966
|
+
var utilModule = null;
|
|
2967
|
+
var utilPromise = null;
|
|
2952
2968
|
function createDebugLogger(enabled) {
|
|
2953
2969
|
if (!enabled) {
|
|
2954
2970
|
return () => {
|
|
2955
2971
|
};
|
|
2956
2972
|
}
|
|
2973
|
+
if (!utilPromise) {
|
|
2974
|
+
utilPromise = import('util').then((util) => {
|
|
2975
|
+
utilModule = util;
|
|
2976
|
+
return util;
|
|
2977
|
+
}).catch(() => {
|
|
2978
|
+
utilModule = null;
|
|
2979
|
+
return null;
|
|
2980
|
+
});
|
|
2981
|
+
}
|
|
2957
2982
|
return (message, data) => {
|
|
2958
|
-
|
|
2983
|
+
if (data === void 0 || data === "") {
|
|
2984
|
+
console.log(`[Zapier SDK] ${message}`);
|
|
2985
|
+
return;
|
|
2986
|
+
}
|
|
2987
|
+
if (utilModule) {
|
|
2988
|
+
const formatted = utilModule.inspect(data, {
|
|
2989
|
+
colors: true,
|
|
2990
|
+
depth: null,
|
|
2991
|
+
breakLength: 80
|
|
2992
|
+
});
|
|
2993
|
+
console.log(`[Zapier SDK] ${message}`, formatted);
|
|
2994
|
+
} else {
|
|
2995
|
+
console.log(`[Zapier SDK] ${message}`, data);
|
|
2996
|
+
}
|
|
2959
2997
|
};
|
|
2960
2998
|
}
|
|
2961
2999
|
function censorHeaders(headers) {
|
|
@@ -3125,7 +3163,7 @@ async function pollUntilComplete(options) {
|
|
|
3125
3163
|
// Up to timeout + 10s: poll every 10s
|
|
3126
3164
|
];
|
|
3127
3165
|
if (initialDelay > 0) {
|
|
3128
|
-
await setTimeout(initialDelay);
|
|
3166
|
+
await setTimeout$1(initialDelay);
|
|
3129
3167
|
}
|
|
3130
3168
|
while (true) {
|
|
3131
3169
|
attempts++;
|
|
@@ -3145,7 +3183,7 @@ async function pollUntilComplete(options) {
|
|
|
3145
3183
|
}
|
|
3146
3184
|
if (attempts > 1) {
|
|
3147
3185
|
const waitTime = calculateWaitTime(pollingInterval[1], errorCount);
|
|
3148
|
-
await setTimeout(waitTime);
|
|
3186
|
+
await setTimeout$1(waitTime);
|
|
3149
3187
|
}
|
|
3150
3188
|
try {
|
|
3151
3189
|
const response = await fetchPoll();
|
|
@@ -3774,6 +3812,401 @@ var listInputFieldChoicesPlugin = ({ context, sdk }) => {
|
|
|
3774
3812
|
};
|
|
3775
3813
|
};
|
|
3776
3814
|
|
|
3815
|
+
// src/plugins/eventEmission/transport.ts
|
|
3816
|
+
var DEFAULT_RETRY_ATTEMPTS = 2;
|
|
3817
|
+
var DEFAULT_RETRY_DELAY_MS = 300;
|
|
3818
|
+
var HttpTransport = class {
|
|
3819
|
+
constructor(config) {
|
|
3820
|
+
this.config = config;
|
|
3821
|
+
}
|
|
3822
|
+
async emit(subject, event) {
|
|
3823
|
+
try {
|
|
3824
|
+
await this.emitWithRetry(
|
|
3825
|
+
subject,
|
|
3826
|
+
event,
|
|
3827
|
+
this.config.retryAttempts || DEFAULT_RETRY_ATTEMPTS
|
|
3828
|
+
);
|
|
3829
|
+
} catch {
|
|
3830
|
+
}
|
|
3831
|
+
}
|
|
3832
|
+
async emitWithRetry(subject, event, attemptsLeft) {
|
|
3833
|
+
try {
|
|
3834
|
+
const payload = {
|
|
3835
|
+
subject,
|
|
3836
|
+
properties: event
|
|
3837
|
+
};
|
|
3838
|
+
const response = await fetch(this.config.endpoint, {
|
|
3839
|
+
method: "POST",
|
|
3840
|
+
headers: {
|
|
3841
|
+
"Content-Type": "application/json",
|
|
3842
|
+
...this.config.headers
|
|
3843
|
+
},
|
|
3844
|
+
body: JSON.stringify(payload)
|
|
3845
|
+
});
|
|
3846
|
+
if (!response.ok && attemptsLeft > 1) {
|
|
3847
|
+
await this.delay(this.config.retryDelayMs || DEFAULT_RETRY_DELAY_MS);
|
|
3848
|
+
return this.emitWithRetry(subject, event, attemptsLeft - 1);
|
|
3849
|
+
}
|
|
3850
|
+
} catch (error) {
|
|
3851
|
+
if (attemptsLeft > 1) {
|
|
3852
|
+
await this.delay(this.config.retryDelayMs || DEFAULT_RETRY_DELAY_MS);
|
|
3853
|
+
return this.emitWithRetry(subject, event, attemptsLeft - 1);
|
|
3854
|
+
}
|
|
3855
|
+
throw error;
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
async delay(ms) {
|
|
3859
|
+
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
3860
|
+
}
|
|
3861
|
+
};
|
|
3862
|
+
var ConsoleTransport = class {
|
|
3863
|
+
async emit(subject, event) {
|
|
3864
|
+
try {
|
|
3865
|
+
console.log(
|
|
3866
|
+
"[SDK Telemetry]",
|
|
3867
|
+
JSON.stringify({ subject, properties: event }, null, 2)
|
|
3868
|
+
);
|
|
3869
|
+
} catch {
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3872
|
+
};
|
|
3873
|
+
var NoopTransport = class {
|
|
3874
|
+
async emit(_subject, _event) {
|
|
3875
|
+
}
|
|
3876
|
+
};
|
|
3877
|
+
function createTransport(config) {
|
|
3878
|
+
try {
|
|
3879
|
+
switch (config.type) {
|
|
3880
|
+
case "http":
|
|
3881
|
+
if (!config.endpoint) {
|
|
3882
|
+
throw new Error("HTTP transport requires endpoint");
|
|
3883
|
+
}
|
|
3884
|
+
return new HttpTransport({
|
|
3885
|
+
endpoint: config.endpoint,
|
|
3886
|
+
headers: config.headers,
|
|
3887
|
+
retryAttempts: config.retryAttempts,
|
|
3888
|
+
retryDelayMs: config.retryDelayMs
|
|
3889
|
+
});
|
|
3890
|
+
case "console":
|
|
3891
|
+
return new ConsoleTransport();
|
|
3892
|
+
case "noop":
|
|
3893
|
+
default:
|
|
3894
|
+
return new NoopTransport();
|
|
3895
|
+
}
|
|
3896
|
+
} catch {
|
|
3897
|
+
return new NoopTransport();
|
|
3898
|
+
}
|
|
3899
|
+
}
|
|
3900
|
+
function generateEventId() {
|
|
3901
|
+
return crypto.randomUUID();
|
|
3902
|
+
}
|
|
3903
|
+
function getCurrentTimestamp() {
|
|
3904
|
+
return Date.now();
|
|
3905
|
+
}
|
|
3906
|
+
function getReleaseId() {
|
|
3907
|
+
return process?.env?.SDK_RELEASE_ID || "development";
|
|
3908
|
+
}
|
|
3909
|
+
function getOsInfo() {
|
|
3910
|
+
try {
|
|
3911
|
+
return {
|
|
3912
|
+
platform: os.platform() || null,
|
|
3913
|
+
release: os.release() || null,
|
|
3914
|
+
architecture: os.arch() || null
|
|
3915
|
+
};
|
|
3916
|
+
} catch {
|
|
3917
|
+
return {
|
|
3918
|
+
platform: null,
|
|
3919
|
+
release: null,
|
|
3920
|
+
architecture: null
|
|
3921
|
+
};
|
|
3922
|
+
}
|
|
3923
|
+
}
|
|
3924
|
+
function getPlatformVersions() {
|
|
3925
|
+
const versions = {};
|
|
3926
|
+
if (typeof process?.versions === "object") {
|
|
3927
|
+
for (const [key, value] of Object.entries(process.versions)) {
|
|
3928
|
+
versions[key] = value || null;
|
|
3929
|
+
}
|
|
3930
|
+
}
|
|
3931
|
+
return versions;
|
|
3932
|
+
}
|
|
3933
|
+
function isCi() {
|
|
3934
|
+
return !!(process?.env?.CI || process?.env?.CONTINUOUS_INTEGRATION || process?.env?.GITHUB_ACTIONS || process?.env?.JENKINS_URL || process?.env?.GITLAB_CI || process?.env?.CIRCLECI || process?.env?.TRAVIS || process?.env?.BUILDKITE || process?.env?.DRONE || process?.env?.BITBUCKET_PIPELINES_UUID);
|
|
3935
|
+
}
|
|
3936
|
+
function getCiPlatform() {
|
|
3937
|
+
if (process?.env?.GITHUB_ACTIONS) return "github-actions";
|
|
3938
|
+
if (process?.env?.JENKINS_URL) return "jenkins";
|
|
3939
|
+
if (process?.env?.GITLAB_CI) return "gitlab-ci";
|
|
3940
|
+
if (process?.env?.CIRCLECI) return "circleci";
|
|
3941
|
+
if (process?.env?.TRAVIS) return "travis";
|
|
3942
|
+
if (process?.env?.BUILDKITE) return "buildkite";
|
|
3943
|
+
if (process?.env?.DRONE) return "drone";
|
|
3944
|
+
if (process?.env?.BITBUCKET_PIPELINES_UUID) return "bitbucket-pipelines";
|
|
3945
|
+
if (process?.env?.CI || process?.env?.CONTINUOUS_INTEGRATION)
|
|
3946
|
+
return "unknown-ci";
|
|
3947
|
+
return null;
|
|
3948
|
+
}
|
|
3949
|
+
function getMemoryUsage() {
|
|
3950
|
+
if (process?.memoryUsage) {
|
|
3951
|
+
const usage = process.memoryUsage();
|
|
3952
|
+
return usage.rss || null;
|
|
3953
|
+
}
|
|
3954
|
+
return null;
|
|
3955
|
+
}
|
|
3956
|
+
function getCpuTime() {
|
|
3957
|
+
if (process?.cpuUsage) {
|
|
3958
|
+
const usage = process.cpuUsage();
|
|
3959
|
+
return Math.round((usage.user + usage.system) / 1e3);
|
|
3960
|
+
}
|
|
3961
|
+
return null;
|
|
3962
|
+
}
|
|
3963
|
+
|
|
3964
|
+
// package.json
|
|
3965
|
+
var package_default = {
|
|
3966
|
+
version: "0.13.4"};
|
|
3967
|
+
|
|
3968
|
+
// src/plugins/eventEmission/builders.ts
|
|
3969
|
+
function createBaseEvent(context = {}) {
|
|
3970
|
+
return {
|
|
3971
|
+
event_id: generateEventId(),
|
|
3972
|
+
timestamp_ms: getCurrentTimestamp(),
|
|
3973
|
+
release_id: getReleaseId(),
|
|
3974
|
+
customuser_id: context.customuser_id,
|
|
3975
|
+
account_id: context.account_id,
|
|
3976
|
+
identity_id: context.identity_id,
|
|
3977
|
+
visitor_id: context.visitor_id,
|
|
3978
|
+
correlation_id: context.correlation_id
|
|
3979
|
+
};
|
|
3980
|
+
}
|
|
3981
|
+
function buildErrorEvent(data, context = {}) {
|
|
3982
|
+
return {
|
|
3983
|
+
...createBaseEvent(context),
|
|
3984
|
+
zap_id: context.zap_id,
|
|
3985
|
+
node_id: context.node_id,
|
|
3986
|
+
selected_api: context.selected_api,
|
|
3987
|
+
app_id: context.app_id,
|
|
3988
|
+
app_version_id: context.app_version_id,
|
|
3989
|
+
environment: context.environment,
|
|
3990
|
+
sdk_version: package_default.version,
|
|
3991
|
+
...data
|
|
3992
|
+
};
|
|
3993
|
+
}
|
|
3994
|
+
function buildApplicationLifecycleEvent(data, context = {}) {
|
|
3995
|
+
const osInfo = getOsInfo();
|
|
3996
|
+
const platformVersions = getPlatformVersions();
|
|
3997
|
+
return {
|
|
3998
|
+
...createBaseEvent(context),
|
|
3999
|
+
selected_api: context.selected_api,
|
|
4000
|
+
app_id: context.app_id,
|
|
4001
|
+
app_version_id: context.app_version_id,
|
|
4002
|
+
sdk_version: package_default.version,
|
|
4003
|
+
cli_version: null,
|
|
4004
|
+
memory_usage_bytes: data.memory_usage_bytes ?? getMemoryUsage(),
|
|
4005
|
+
peak_memory_usage_bytes: data.peak_memory_usage_bytes ?? getMemoryUsage(),
|
|
4006
|
+
cpu_time_ms: data.cpu_time_ms ?? getCpuTime(),
|
|
4007
|
+
os_platform: osInfo.platform,
|
|
4008
|
+
os_release: osInfo.release,
|
|
4009
|
+
os_architecture: osInfo.architecture,
|
|
4010
|
+
platform_versions: platformVersions,
|
|
4011
|
+
environment: context.environment ?? (process.env.NODE_ENV || null),
|
|
4012
|
+
is_ci_environment: isCi(),
|
|
4013
|
+
ci_platform: getCiPlatform(),
|
|
4014
|
+
session_id: null,
|
|
4015
|
+
metadata: null,
|
|
4016
|
+
process_argv: process.argv || null,
|
|
4017
|
+
...data
|
|
4018
|
+
};
|
|
4019
|
+
}
|
|
4020
|
+
function buildErrorEventWithContext(data, context = {}) {
|
|
4021
|
+
const executionTime = data.execution_start_time ? Date.now() - data.execution_start_time : null;
|
|
4022
|
+
return {
|
|
4023
|
+
...createBaseEvent(context),
|
|
4024
|
+
zap_id: context.zap_id,
|
|
4025
|
+
node_id: context.node_id,
|
|
4026
|
+
selected_api: context.selected_api,
|
|
4027
|
+
app_id: context.app_id,
|
|
4028
|
+
app_version_id: context.app_version_id,
|
|
4029
|
+
environment: context.environment ?? (process.env.NODE_ENV || null),
|
|
4030
|
+
sdk_version: package_default.version,
|
|
4031
|
+
execution_time_before_error_ms: executionTime,
|
|
4032
|
+
...data
|
|
4033
|
+
};
|
|
4034
|
+
}
|
|
4035
|
+
|
|
4036
|
+
// src/plugins/eventEmission/index.ts
|
|
4037
|
+
var APPLICATION_LIFECYCLE_EVENT_SUBJECT = "platform.sdk.ApplicationLifecycleEvent";
|
|
4038
|
+
var ERROR_OCCURRED_EVENT_SUBJECT = "platform.sdk.ErrorOccurredEvent";
|
|
4039
|
+
async function silentEmit(transport, subject, event) {
|
|
4040
|
+
try {
|
|
4041
|
+
transport.emit(subject, event).catch(() => {
|
|
4042
|
+
});
|
|
4043
|
+
} catch {
|
|
4044
|
+
}
|
|
4045
|
+
}
|
|
4046
|
+
function getTransportConfig() {
|
|
4047
|
+
const envTransport = process?.env?.ZAPIER_SDK_TELEMETRY_TRANSPORT;
|
|
4048
|
+
if (envTransport === "noop" || envTransport === "disabled") {
|
|
4049
|
+
return { type: "noop" };
|
|
4050
|
+
}
|
|
4051
|
+
if (envTransport === "console") {
|
|
4052
|
+
return { type: "console" };
|
|
4053
|
+
}
|
|
4054
|
+
const endpoint = process?.env?.ZAPIER_SDK_TELEMETRY_ENDPOINT || TRACKING_API_ENDPOINT;
|
|
4055
|
+
return {
|
|
4056
|
+
type: "http",
|
|
4057
|
+
endpoint
|
|
4058
|
+
};
|
|
4059
|
+
}
|
|
4060
|
+
var eventEmissionPlugin = ({ context }) => {
|
|
4061
|
+
const defaultTransport = getTransportConfig();
|
|
4062
|
+
const config = {
|
|
4063
|
+
enabled: context.options.eventEmission?.enabled ?? true,
|
|
4064
|
+
transport: (
|
|
4065
|
+
// If env var is set, use it (defaultTransport will be from env)
|
|
4066
|
+
process?.env?.ZAPIER_SDK_TELEMETRY_TRANSPORT ? defaultTransport : (
|
|
4067
|
+
// Otherwise, use option transport or default
|
|
4068
|
+
context.options.eventEmission?.transport ?? defaultTransport
|
|
4069
|
+
)
|
|
4070
|
+
)
|
|
4071
|
+
};
|
|
4072
|
+
const startupTime = Date.now();
|
|
4073
|
+
let shutdownStartTime = null;
|
|
4074
|
+
if (!config.enabled) {
|
|
4075
|
+
return {
|
|
4076
|
+
context: {
|
|
4077
|
+
eventEmission: {
|
|
4078
|
+
transport: createTransport({ type: "noop" }),
|
|
4079
|
+
config,
|
|
4080
|
+
emit: () => {
|
|
4081
|
+
},
|
|
4082
|
+
createBaseEvent: () => ({
|
|
4083
|
+
event_id: generateEventId(),
|
|
4084
|
+
timestamp_ms: getCurrentTimestamp(),
|
|
4085
|
+
release_id: getReleaseId(),
|
|
4086
|
+
customuser_id: null,
|
|
4087
|
+
account_id: null,
|
|
4088
|
+
identity_id: null,
|
|
4089
|
+
visitor_id: null,
|
|
4090
|
+
correlation_id: null
|
|
4091
|
+
})
|
|
4092
|
+
}
|
|
4093
|
+
}
|
|
4094
|
+
};
|
|
4095
|
+
}
|
|
4096
|
+
let transport;
|
|
4097
|
+
try {
|
|
4098
|
+
transport = createTransport(config.transport || { type: "noop" });
|
|
4099
|
+
} catch {
|
|
4100
|
+
transport = createTransport({ type: "noop" });
|
|
4101
|
+
}
|
|
4102
|
+
const createBaseEventHelper = () => ({
|
|
4103
|
+
event_id: generateEventId(),
|
|
4104
|
+
timestamp_ms: getCurrentTimestamp(),
|
|
4105
|
+
release_id: getReleaseId(),
|
|
4106
|
+
customuser_id: null,
|
|
4107
|
+
account_id: null,
|
|
4108
|
+
identity_id: null,
|
|
4109
|
+
visitor_id: null,
|
|
4110
|
+
correlation_id: null
|
|
4111
|
+
});
|
|
4112
|
+
if (config.enabled) {
|
|
4113
|
+
const startupEvent = buildApplicationLifecycleEvent({
|
|
4114
|
+
lifecycle_event_type: "startup"
|
|
4115
|
+
});
|
|
4116
|
+
silentEmit(transport, APPLICATION_LIFECYCLE_EVENT_SUBJECT, startupEvent);
|
|
4117
|
+
if (typeof process?.on === "function") {
|
|
4118
|
+
process.on("exit", (code) => {
|
|
4119
|
+
const uptime = Date.now() - startupTime;
|
|
4120
|
+
const shutdownDuration = shutdownStartTime ? Date.now() - shutdownStartTime : null;
|
|
4121
|
+
const exitEvent = buildApplicationLifecycleEvent({
|
|
4122
|
+
lifecycle_event_type: "exit",
|
|
4123
|
+
exit_code: code,
|
|
4124
|
+
uptime_ms: uptime,
|
|
4125
|
+
is_graceful_shutdown: code === 0,
|
|
4126
|
+
shutdown_duration_ms: shutdownDuration
|
|
4127
|
+
});
|
|
4128
|
+
silentEmit(transport, APPLICATION_LIFECYCLE_EVENT_SUBJECT, exitEvent);
|
|
4129
|
+
});
|
|
4130
|
+
process.on("uncaughtException", async (error) => {
|
|
4131
|
+
const errorEvent = buildErrorEventWithContext({
|
|
4132
|
+
error_message: error.message || "Unknown error",
|
|
4133
|
+
error_type: "UncaughtException",
|
|
4134
|
+
error_stack_trace: error.stack || null,
|
|
4135
|
+
error_severity: "critical",
|
|
4136
|
+
is_user_facing: false,
|
|
4137
|
+
is_recoverable: false,
|
|
4138
|
+
execution_start_time: startupTime
|
|
4139
|
+
});
|
|
4140
|
+
try {
|
|
4141
|
+
await Promise.race([
|
|
4142
|
+
transport.emit(ERROR_OCCURRED_EVENT_SUBJECT, errorEvent),
|
|
4143
|
+
new Promise((resolve2) => setTimeout(resolve2, 300))
|
|
4144
|
+
]);
|
|
4145
|
+
} catch {
|
|
4146
|
+
}
|
|
4147
|
+
});
|
|
4148
|
+
process.on(
|
|
4149
|
+
"unhandledRejection",
|
|
4150
|
+
async (reason, promise) => {
|
|
4151
|
+
const errorMessage = reason instanceof Error ? reason.message : typeof reason === "string" ? reason : "Unhandled promise rejection";
|
|
4152
|
+
const errorStack = reason instanceof Error ? reason.stack : null;
|
|
4153
|
+
const errorEvent = buildErrorEventWithContext({
|
|
4154
|
+
error_message: errorMessage,
|
|
4155
|
+
error_type: "UnhandledRejection",
|
|
4156
|
+
error_stack_trace: errorStack,
|
|
4157
|
+
error_severity: "critical",
|
|
4158
|
+
is_user_facing: false,
|
|
4159
|
+
is_recoverable: false,
|
|
4160
|
+
execution_start_time: startupTime,
|
|
4161
|
+
error_metadata: {
|
|
4162
|
+
promise: String(promise)
|
|
4163
|
+
}
|
|
4164
|
+
});
|
|
4165
|
+
try {
|
|
4166
|
+
await Promise.race([
|
|
4167
|
+
transport.emit(ERROR_OCCURRED_EVENT_SUBJECT, errorEvent),
|
|
4168
|
+
new Promise((resolve2) => setTimeout(resolve2, 300))
|
|
4169
|
+
]);
|
|
4170
|
+
} catch {
|
|
4171
|
+
}
|
|
4172
|
+
}
|
|
4173
|
+
);
|
|
4174
|
+
const handleSignal = async (signal) => {
|
|
4175
|
+
shutdownStartTime = Date.now();
|
|
4176
|
+
const uptime = Date.now() - startupTime;
|
|
4177
|
+
const signalEvent = buildApplicationLifecycleEvent({
|
|
4178
|
+
lifecycle_event_type: "signal_termination",
|
|
4179
|
+
signal_name: signal,
|
|
4180
|
+
uptime_ms: uptime,
|
|
4181
|
+
is_graceful_shutdown: true
|
|
4182
|
+
});
|
|
4183
|
+
try {
|
|
4184
|
+
await Promise.race([
|
|
4185
|
+
transport.emit(APPLICATION_LIFECYCLE_EVENT_SUBJECT, signalEvent),
|
|
4186
|
+
new Promise((resolve2) => setTimeout(resolve2, 300))
|
|
4187
|
+
]);
|
|
4188
|
+
} catch {
|
|
4189
|
+
}
|
|
4190
|
+
};
|
|
4191
|
+
["SIGINT", "SIGTERM"].forEach((signal) => {
|
|
4192
|
+
process.on(signal, () => handleSignal(signal));
|
|
4193
|
+
});
|
|
4194
|
+
}
|
|
4195
|
+
}
|
|
4196
|
+
return {
|
|
4197
|
+
context: {
|
|
4198
|
+
eventEmission: {
|
|
4199
|
+
transport,
|
|
4200
|
+
config,
|
|
4201
|
+
emit: (subject, event) => {
|
|
4202
|
+
silentEmit(transport, subject, event);
|
|
4203
|
+
},
|
|
4204
|
+
createBaseEvent: createBaseEventHelper
|
|
4205
|
+
}
|
|
4206
|
+
}
|
|
4207
|
+
};
|
|
4208
|
+
};
|
|
4209
|
+
|
|
3777
4210
|
// src/sdk.ts
|
|
3778
4211
|
function createSdk(options = {}, initialSdk = {}, initialContext = { meta: {} }) {
|
|
3779
4212
|
return {
|
|
@@ -3823,10 +4256,10 @@ function createSdk(options = {}, initialSdk = {}, initialContext = { meta: {} })
|
|
|
3823
4256
|
};
|
|
3824
4257
|
}
|
|
3825
4258
|
function createZapierSdkWithoutRegistry(options = {}) {
|
|
3826
|
-
return createSdk(options).addPlugin(apiPlugin).addPlugin(manifestPlugin).addPlugin(listAppsPlugin).addPlugin(getAppPlugin).addPlugin(listActionsPlugin).addPlugin(getActionPlugin).addPlugin(listInputFieldsPlugin).addPlugin(listInputFieldChoicesPlugin).addPlugin(runActionPlugin).addPlugin(listAuthenticationsPlugin).addPlugin(getAuthenticationPlugin).addPlugin(findFirstAuthenticationPlugin).addPlugin(findUniqueAuthenticationPlugin).addPlugin(requestPlugin).addPlugin(fetchPlugin).addPlugin(appsPlugin).addPlugin(getProfilePlugin);
|
|
4259
|
+
return createSdk(options).addPlugin(eventEmissionPlugin).addPlugin(apiPlugin).addPlugin(manifestPlugin).addPlugin(listAppsPlugin).addPlugin(getAppPlugin).addPlugin(listActionsPlugin).addPlugin(getActionPlugin).addPlugin(listInputFieldsPlugin).addPlugin(listInputFieldChoicesPlugin).addPlugin(runActionPlugin).addPlugin(listAuthenticationsPlugin).addPlugin(getAuthenticationPlugin).addPlugin(findFirstAuthenticationPlugin).addPlugin(findUniqueAuthenticationPlugin).addPlugin(requestPlugin).addPlugin(fetchPlugin).addPlugin(appsPlugin).addPlugin(getProfilePlugin);
|
|
3827
4260
|
}
|
|
3828
4261
|
function createZapierSdk(options = {}) {
|
|
3829
4262
|
return createZapierSdkWithoutRegistry(options).addPlugin(registryPlugin);
|
|
3830
4263
|
}
|
|
3831
4264
|
|
|
3832
|
-
export { ActionKeyPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AuthenticationIdPropertySchema, DEFAULT_CONFIG_PATH, DebugPropertySchema, InputsPropertySchema, LimitPropertySchema, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, RelayFetchSchema, RelayRequestSchema, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, ZapierNotFoundError, ZapierResourceNotFoundError, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, authenticationIdGenericResolver, authenticationIdResolver, createFunction, createSdk, createZapierSdk, createZapierSdkWithoutRegistry, fetchPlugin, findFirstAuthenticationPlugin, findManifestEntry, findUniqueAuthenticationPlugin, formatErrorMessage, getActionPlugin, getAppPlugin, getAuthenticationPlugin, getPreferredManifestEntryKey, getProfilePlugin, getTokenFromCliLogin, getTokenFromEnv, getTokenFromEnvOrConfig, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, isPositional, listActionsPlugin, listAppsPlugin, listAuthenticationsPlugin, listInputFieldsPlugin, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, runActionPlugin, toSnakeCase, toTitleCase };
|
|
4265
|
+
export { ActionKeyPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AuthenticationIdPropertySchema, DEFAULT_CONFIG_PATH, DebugPropertySchema, InputsPropertySchema, LimitPropertySchema, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, RelayFetchSchema, RelayRequestSchema, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, ZapierNotFoundError, ZapierResourceNotFoundError, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, authenticationIdGenericResolver, authenticationIdResolver, buildApplicationLifecycleEvent, buildErrorEvent, buildErrorEventWithContext, createBaseEvent, createFunction, createSdk, createZapierSdk, createZapierSdkWithoutRegistry, fetchPlugin, findFirstAuthenticationPlugin, findManifestEntry, findUniqueAuthenticationPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getAuthenticationPlugin, getCiPlatform, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTokenFromCliLogin, getTokenFromEnv, getTokenFromEnvOrConfig, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, isCi, isPositional, listActionsPlugin, listAppsPlugin, listAuthenticationsPlugin, listInputFieldsPlugin, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, runActionPlugin, toSnakeCase, toTitleCase };
|
|
@@ -8,7 +8,5 @@ export interface ApiPluginProvides {
|
|
|
8
8
|
api: ApiClient;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
export declare const apiPlugin: Plugin<{},
|
|
12
|
-
{}, // requires no context
|
|
13
|
-
ApiPluginProvides>;
|
|
11
|
+
export declare const apiPlugin: Plugin<{}, {}, ApiPluginProvides>;
|
|
14
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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;AAEjD,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAG3D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE;QACP,GAAG,EAAE,SAAS,CAAC;KAChB,CAAC;CACH;AAGD,eAAO,MAAM,SAAS,EAAE,MAAM,
|
|
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;AAEjD,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAG3D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE;QACP,GAAG,EAAE,SAAS,CAAC;KAChB,CAAC;CACH;AAGD,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,iBAAiB,CA2BvD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event builder utilities for creating telemetry events
|
|
3
|
+
*
|
|
4
|
+
* Provides builder functions that auto-populate common fields and ensure
|
|
5
|
+
* schema compliance for all event types.
|
|
6
|
+
*/
|
|
7
|
+
import type { ErrorOccurredEvent, ApplicationLifecycleEvent, BaseEvent } from "../../types/telemetry-events";
|
|
8
|
+
import type { ApplicationLifecycleEventData, EnhancedErrorEventData, ErrorEventData, EventContext } from "./types";
|
|
9
|
+
export declare function createBaseEvent(context?: EventContext): BaseEvent;
|
|
10
|
+
export declare function buildErrorEvent(data: ErrorEventData, context?: EventContext): ErrorOccurredEvent;
|
|
11
|
+
export declare function buildApplicationLifecycleEvent(data: ApplicationLifecycleEventData, context?: EventContext): ApplicationLifecycleEvent;
|
|
12
|
+
export declare function buildErrorEventWithContext(data: EnhancedErrorEventData, context?: EventContext): ErrorOccurredEvent;
|
|
13
|
+
//# sourceMappingURL=builders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../../src/plugins/eventEmission/builders.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,SAAS,EACV,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,6BAA6B,EAC7B,sBAAsB,EACtB,cAAc,EACd,YAAY,EACb,MAAM,SAAS,CAAC;AAgBjB,wBAAgB,eAAe,CAAC,OAAO,GAAE,YAAiB,GAAG,SAAS,CAWrE;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,cAAc,EACpB,OAAO,GAAE,YAAiB,GACzB,kBAAkB,CAYpB;AAED,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,6BAA6B,EACnC,OAAO,GAAE,YAAiB,GACzB,yBAAyB,CA0B3B;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,sBAAsB,EAC5B,OAAO,GAAE,YAAiB,GACzB,kBAAkB,CAiBpB"}
|