@zapier/zapier-sdk 0.18.2 → 0.18.3
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 +6 -0
- package/README.md +12 -12
- package/dist/api/schemas.d.ts +0 -49
- package/dist/api/schemas.d.ts.map +1 -1
- package/dist/api/schemas.js +0 -28
- package/dist/index.cjs +34 -106
- package/dist/index.d.mts +15 -17
- package/dist/index.mjs +35 -107
- package/dist/plugins/findFirstAuthentication/index.test.js +2 -2
- package/dist/plugins/findUniqueAuthentication/index.test.js +2 -2
- package/dist/plugins/listAuthentications/index.d.ts +4 -10
- package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/index.js +19 -31
- package/dist/plugins/listAuthentications/index.test.js +347 -127
- package/dist/plugins/listAuthentications/schemas.d.ts +7 -7
- package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/schemas.js +10 -16
- package/dist/sdk.d.ts +1 -1
- package/dist/temporary-internal-core/utils/transformations.d.ts +0 -14
- package/dist/temporary-internal-core/utils/transformations.d.ts.map +1 -1
- package/dist/temporary-internal-core/utils/transformations.js +0 -38
- package/dist/utils/domain-utils.d.ts +2 -15
- package/dist/utils/domain-utils.d.ts.map +1 -1
- package/dist/utils/domain-utils.js +0 -38
- package/dist/utils/function-utils.d.ts +1 -0
- package/dist/utils/function-utils.d.ts.map +1 -1
- package/dist/utils/function-utils.js +15 -3
- package/package.json +2 -2
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { PaginatedSdkFunction } from "../../types/functions";
|
|
3
|
-
import type { AuthenticationItem } from "
|
|
3
|
+
import type { AuthenticationItem } from "@zapier/zapier-sdk-core/v0/schemas/authentications";
|
|
4
4
|
import type { ZapierAuthenticationError, ZapierApiError, ZapierAppNotFoundError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const ListAuthenticationsQuerySchema: z.ZodObject<{
|
|
6
|
+
search: z.ZodOptional<z.ZodString>;
|
|
7
|
+
title: z.ZodOptional<z.ZodString>;
|
|
8
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
9
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
6
10
|
appKey: z.ZodOptional<z.ZodString & {
|
|
7
11
|
_def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
|
|
8
12
|
}>;
|
|
9
13
|
authenticationIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
10
|
-
search: z.ZodOptional<z.ZodString>;
|
|
11
|
-
title: z.ZodOptional<z.ZodString>;
|
|
12
|
-
accountId: z.ZodOptional<z.ZodString>;
|
|
13
|
-
owner: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"me">]>>;
|
|
14
14
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
15
15
|
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
16
16
|
cursor: z.ZodOptional<z.ZodString>;
|
|
@@ -18,7 +18,7 @@ export declare const ListAuthenticationsSchema: z.ZodObject<{
|
|
|
18
18
|
isNested: z.ZodOptional<z.ZodBoolean>;
|
|
19
19
|
}, z.core.$strip>>;
|
|
20
20
|
}, z.core.$strip>;
|
|
21
|
-
export type ListAuthenticationsOptions = z.infer<typeof
|
|
21
|
+
export type ListAuthenticationsOptions = z.infer<typeof ListAuthenticationsQuerySchema>;
|
|
22
22
|
export interface ListAuthenticationsPage {
|
|
23
23
|
data: AuthenticationItem[];
|
|
24
24
|
nextCursor?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listAuthentications/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listAuthentications/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAE7F,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;iBA+B0B,CAAC;AAGtE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,8BAA8B,CACtC,CAAC;AAGF,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,MAAM,wBAAwB,GAChC,yBAAyB,GACzB,cAAc,GACd,sBAAsB,GACtB,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,8BAA8B;IAC7C,mBAAmB,EAAE,oBAAoB,CACvC,0BAA0B,EAC1B,kBAAkB,CACnB,CAAC;CACH"}
|
|
@@ -1,37 +1,31 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AppKeyPropertySchema } from "../../types/properties";
|
|
3
|
+
import { ListAuthenticationsQuerySchema as ListAuthenticationsQueryBase } from "@zapier/zapier-sdk-core/v0/schemas/authentications";
|
|
3
4
|
import { TelemetryMarkerSchema } from "../../utils/function-utils";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
export const ListAuthenticationsQuerySchema = ListAuthenticationsQueryBase.omit({
|
|
6
|
+
offset: true,
|
|
7
|
+
})
|
|
8
|
+
.extend({
|
|
9
|
+
// Override appKey with our custom schema (array type, different description)
|
|
7
10
|
appKey: AppKeyPropertySchema.optional().describe("App key of authentications to list (e.g., 'SlackCLIAPI' or slug like 'github')"),
|
|
11
|
+
// Override authenticationIds to be an array instead of comma-separated string
|
|
8
12
|
authenticationIds: z
|
|
9
13
|
.array(z.string())
|
|
10
14
|
.optional()
|
|
11
15
|
.describe("List of authentication IDs to filter by"),
|
|
12
|
-
|
|
13
|
-
.string()
|
|
14
|
-
.optional()
|
|
15
|
-
.describe("Search term to filter authentications by title"),
|
|
16
|
-
title: z
|
|
17
|
-
.string()
|
|
18
|
-
.optional()
|
|
19
|
-
.describe("Filter authentications by exact title match"),
|
|
20
|
-
accountId: z.string().optional().describe("Filter by account ID"),
|
|
21
|
-
owner: z
|
|
22
|
-
.union([z.string(), z.literal("me")])
|
|
23
|
-
.optional()
|
|
24
|
-
.describe("Filter by owner, 'me' for your own authentications or a specific user ID"),
|
|
16
|
+
// Override pageSize to make optional (needs to be fixed in `zapier-sdk-core`)
|
|
25
17
|
pageSize: z
|
|
26
18
|
.number()
|
|
27
19
|
.min(1)
|
|
28
20
|
.optional()
|
|
29
21
|
.describe("Number of authentications per page"),
|
|
22
|
+
// SDK specific property for pagination/iterator helpers
|
|
30
23
|
maxItems: z
|
|
31
24
|
.number()
|
|
32
25
|
.min(1)
|
|
33
26
|
.optional()
|
|
34
27
|
.describe("Maximum total items to return across all pages"),
|
|
28
|
+
// SDK specific property for pagination/iterator helpers
|
|
35
29
|
cursor: z.string().optional().describe("Cursor to start from"),
|
|
36
30
|
})
|
|
37
31
|
.merge(TelemetryMarkerSchema)
|
package/dist/sdk.d.ts
CHANGED
|
@@ -94,7 +94,7 @@ export declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOption
|
|
|
94
94
|
} & {
|
|
95
95
|
meta: {
|
|
96
96
|
listAuthentications: {
|
|
97
|
-
inputSchema: typeof import("./plugins/listAuthentications/schemas").
|
|
97
|
+
inputSchema: typeof import("./plugins/listAuthentications/schemas").ListAuthenticationsQuerySchema;
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
100
|
} & {
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { ImplementationMeta } from "../schemas/implementations";
|
|
7
7
|
import type { AppItem } from "../schemas/apps";
|
|
8
|
-
import { type Authentication, type AuthenticationItem } from "@zapier/zapier-sdk-core/v0/schemas/authentications";
|
|
9
8
|
/**
|
|
10
9
|
* Transforms ImplementationMeta from internal API to AppItem for SDK responses
|
|
11
10
|
*/
|
|
@@ -16,17 +15,4 @@ export declare function transformImplementationMetaToAppItem(implementationMeta:
|
|
|
16
15
|
export declare function extractPaginationCursor(response: {
|
|
17
16
|
next?: string | null;
|
|
18
17
|
}): string | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Converts an API Authentication to an AuthenticationItem with normalized field names
|
|
21
|
-
*
|
|
22
|
-
* @param auth - Raw Authentication from API
|
|
23
|
-
* @param options - Additional fields to include
|
|
24
|
-
* @param options.app_key - selected_api from implementations endpoint
|
|
25
|
-
* @param options.app_version - Version extracted from selected_api
|
|
26
|
-
* @returns Normalized AuthenticationItem
|
|
27
|
-
*/
|
|
28
|
-
export declare function normalizeAuthenticationItem(auth: Authentication, options?: {
|
|
29
|
-
app_key?: string;
|
|
30
|
-
app_version?: string;
|
|
31
|
-
}): AuthenticationItem;
|
|
32
18
|
//# sourceMappingURL=transformations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformations.d.ts","sourceRoot":"","sources":["../../../src/temporary-internal-core/utils/transformations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"transformations.d.ts","sourceRoot":"","sources":["../../../src/temporary-internal-core/utils/transformations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG/C;;GAEG;AACH,wBAAgB,oCAAoC,CAClD,kBAAkB,EAAE,kBAAkB,GACrC,OAAO,CAYT;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE;IAChD,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,GAAG,MAAM,GAAG,SAAS,CAYrB"}
|
|
@@ -34,41 +34,3 @@ export function extractPaginationCursor(response) {
|
|
|
34
34
|
return undefined;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
/**
|
|
38
|
-
* Converts an API Authentication to an AuthenticationItem with normalized field names
|
|
39
|
-
*
|
|
40
|
-
* @param auth - Raw Authentication from API
|
|
41
|
-
* @param options - Additional fields to include
|
|
42
|
-
* @param options.app_key - selected_api from implementations endpoint
|
|
43
|
-
* @param options.app_version - Version extracted from selected_api
|
|
44
|
-
* @returns Normalized AuthenticationItem
|
|
45
|
-
*/
|
|
46
|
-
export function normalizeAuthenticationItem(auth, options = {}) {
|
|
47
|
-
// Extract app key and version from selected_api if not provided
|
|
48
|
-
let appKey = options.app_key;
|
|
49
|
-
let appVersion = options.app_version;
|
|
50
|
-
if (auth.selected_api) {
|
|
51
|
-
const [extractedAppKey, extractedVersion] = splitVersionedKey(auth.selected_api);
|
|
52
|
-
// Use extracted app key if not provided in options
|
|
53
|
-
if (!appKey) {
|
|
54
|
-
appKey = extractedAppKey;
|
|
55
|
-
}
|
|
56
|
-
// Use extracted version if not provided in options
|
|
57
|
-
if (!appVersion) {
|
|
58
|
-
appVersion = extractedVersion;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
const { selected_api: selectedApi, customuser_id: profileId, id, account_id: accountId, ...restOfAuth } = auth;
|
|
62
|
-
return {
|
|
63
|
-
...restOfAuth, // Pass through all other API response fields except selected_api
|
|
64
|
-
id: String(id), // Convert to string
|
|
65
|
-
account_id: String(accountId), // Convert to string
|
|
66
|
-
implementation_id: selectedApi, // Rename selected_api to implementation_id
|
|
67
|
-
title: auth.title || auth.label || undefined, // Coerce title from label if missing
|
|
68
|
-
is_expired: auth.is_stale, // Map is_stale to is_expired
|
|
69
|
-
expired_at: auth.marked_stale_at, // Map marked_stale_at to expired_at
|
|
70
|
-
app_key: appKey, // App key from implementations endpoint or parsed from selected_api
|
|
71
|
-
app_version: appVersion, // Version from selected_api or provided
|
|
72
|
-
profile_id: profileId != null ? String(profileId) : undefined, // Map customuser_id to profile_id, convert to string
|
|
73
|
-
};
|
|
74
|
-
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Domain utility functions for working with app identifiers and data normalization
|
|
3
3
|
*/
|
|
4
|
-
import type { Action,
|
|
5
|
-
import type { ActionItem, AppItem
|
|
4
|
+
import type { Action, ImplementationMeta } from "../api/types";
|
|
5
|
+
import type { ActionItem, AppItem } from "../types/domain";
|
|
6
6
|
/**
|
|
7
7
|
* Splits a versioned key to extract the base key and version
|
|
8
8
|
*
|
|
@@ -21,19 +21,6 @@ export declare function splitVersionedKey(versionedKey: string): [string, string
|
|
|
21
21
|
* @returns Normalized AppItem with essential fields only
|
|
22
22
|
*/
|
|
23
23
|
export declare function normalizeImplementationMetaToAppItem(implementationMeta: ImplementationMeta): AppItem;
|
|
24
|
-
/**
|
|
25
|
-
* Converts an API Authentication to an AuthenticationItem with normalized field names
|
|
26
|
-
*
|
|
27
|
-
* @param auth - Raw Authentication from API
|
|
28
|
-
* @param options - Additional fields to include
|
|
29
|
-
* @param options.app_key - selected_api from implementations endpoint
|
|
30
|
-
* @param options.app_version - Version extracted from selected_api
|
|
31
|
-
* @returns Normalized AuthenticationItem
|
|
32
|
-
*/
|
|
33
|
-
export declare function normalizeAuthenticationItem(auth: Authentication, options?: {
|
|
34
|
-
app_key?: string;
|
|
35
|
-
app_version?: string;
|
|
36
|
-
}): AuthenticationItem;
|
|
37
24
|
export declare function normalizeActionItem(action: Action): ActionItem;
|
|
38
25
|
/**
|
|
39
26
|
* Groups app keys by their type based on format patterns
|
|
@@ -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,
|
|
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,UAAU,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE3D;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,GACnB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAQ9B;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,kBAAkB,EAAE,kBAAkB,GACrC,OAAO,CAYT;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAsB9D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG;IAC9D,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAgCA;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG;IACrD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAUA;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOtD;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAY1D;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"}
|
|
@@ -37,44 +37,6 @@ export function normalizeImplementationMetaToAppItem(implementationMeta) {
|
|
|
37
37
|
version: appVersion,
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Converts an API Authentication to an AuthenticationItem with normalized field names
|
|
42
|
-
*
|
|
43
|
-
* @param auth - Raw Authentication from API
|
|
44
|
-
* @param options - Additional fields to include
|
|
45
|
-
* @param options.app_key - selected_api from implementations endpoint
|
|
46
|
-
* @param options.app_version - Version extracted from selected_api
|
|
47
|
-
* @returns Normalized AuthenticationItem
|
|
48
|
-
*/
|
|
49
|
-
export function normalizeAuthenticationItem(auth, options = {}) {
|
|
50
|
-
// Extract app key and version from selected_api if not provided
|
|
51
|
-
let appKey = options.app_key;
|
|
52
|
-
let appVersion = options.app_version;
|
|
53
|
-
if (auth.selected_api) {
|
|
54
|
-
const [extractedAppKey, extractedVersion] = splitVersionedKey(auth.selected_api);
|
|
55
|
-
// Use extracted app key if not provided in options
|
|
56
|
-
if (!appKey) {
|
|
57
|
-
appKey = extractedAppKey;
|
|
58
|
-
}
|
|
59
|
-
// Use extracted version if not provided in options
|
|
60
|
-
if (!appVersion) {
|
|
61
|
-
appVersion = extractedVersion;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
const { selected_api: selectedApi, customuser_id: profileId, id, account_id: accountId, ...restOfAuth } = auth;
|
|
65
|
-
return {
|
|
66
|
-
...restOfAuth, // Pass through all other API response fields except selected_api
|
|
67
|
-
id: String(id), // Convert to string
|
|
68
|
-
account_id: String(accountId), // Convert to string
|
|
69
|
-
implementation_id: selectedApi, // Rename selected_api to implementation_id
|
|
70
|
-
title: auth.title || auth.label || undefined, // Coerce title from label if missing
|
|
71
|
-
is_expired: auth.is_stale, // Map is_stale to is_expired
|
|
72
|
-
expired_at: auth.marked_stale_at, // Map marked_stale_at to expired_at
|
|
73
|
-
app_key: appKey, // App key from implementations endpoint or parsed from selected_api
|
|
74
|
-
app_version: appVersion, // Version from selected_api or provided
|
|
75
|
-
profile_id: profileId != null ? String(profileId) : undefined, // Map customuser_id to profile_id, convert to string
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
40
|
export function normalizeActionItem(action) {
|
|
79
41
|
const { name, type, selected_api: selectedApi } = action;
|
|
80
42
|
// Split version from selected_api
|
|
@@ -30,6 +30,7 @@ export interface TelemetryCallbacks {
|
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Helper function to extract cursor from pagination data
|
|
33
|
+
* Supports JSON:API style `links.next` URLs by extracting the `offset` parameter.
|
|
33
34
|
*/
|
|
34
35
|
export declare function extractCursor(data: {
|
|
35
36
|
next?: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function-utils.d.ts","sourceRoot":"","sources":["../../src/utils/function-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;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,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,GACpC,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,GAAG;IACxC,KAAK,IAAI,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;CAC3C,CAgHF"}
|
|
@@ -18,6 +18,7 @@ export const TelemetryMarkerSchema = z.object({
|
|
|
18
18
|
});
|
|
19
19
|
/**
|
|
20
20
|
* Helper function to extract cursor from pagination data
|
|
21
|
+
* Supports JSON:API style `links.next` URLs by extracting the `offset` parameter.
|
|
21
22
|
*/
|
|
22
23
|
export function extractCursor(data) {
|
|
23
24
|
if (!data?.next) {
|
|
@@ -123,10 +124,21 @@ function createPageFunction(coreFn) {
|
|
|
123
124
|
const result = await coreFn(options);
|
|
124
125
|
// If result already has a data property, ensure it's an array
|
|
125
126
|
if (result && typeof result === "object" && "data" in result) {
|
|
126
|
-
const
|
|
127
|
+
const paginatedResult = result;
|
|
128
|
+
// Support both nextCursor and JSON:API links.next format
|
|
129
|
+
let nextCursor;
|
|
130
|
+
if (paginatedResult.nextCursor) {
|
|
131
|
+
nextCursor = paginatedResult.nextCursor;
|
|
132
|
+
}
|
|
133
|
+
else if (paginatedResult.links?.next) {
|
|
134
|
+
// Extract cursor from fully qualified URL (JSON:API spec format)
|
|
135
|
+
nextCursor = extractCursor({ next: paginatedResult.links.next });
|
|
136
|
+
}
|
|
127
137
|
return {
|
|
128
|
-
data: Array.isArray(data)
|
|
129
|
-
|
|
138
|
+
data: Array.isArray(paginatedResult.data)
|
|
139
|
+
? paginatedResult.data
|
|
140
|
+
: [paginatedResult.data],
|
|
141
|
+
nextCursor,
|
|
130
142
|
};
|
|
131
143
|
}
|
|
132
144
|
// If result is an array, wrap in {data: result}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zapier/zapier-sdk",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.3",
|
|
4
4
|
"description": "Complete Zapier SDK - combines all Zapier SDK packages",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@zapier/zapier-sdk-core": "^0.5.
|
|
39
|
+
"@zapier/zapier-sdk-core": "^0.5.1",
|
|
40
40
|
"zod": "4.2.1"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|