@composio/core 0.18.1 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CustomTool-Bz0f52QR.mjs → CustomTool-CM-roKk7.mjs} +1 -1
- package/dist/{CustomTool-VRfWzMix.d.mts → CustomTool-yMQjEyMz.d.mts} +1 -1
- package/dist/{FileModifierErrors-CwB-Inm9.mjs → FileModifierErrors-CdGSABoq.mjs} +1 -1
- package/dist/{FileToolModifier.utils.neutral-D_YkHwZP.mjs → FileToolModifier.utils.neutral-DWFpnsj2.mjs} +4 -2
- package/dist/{SsrfErrors-xhdVE4yw.mjs → SsrfErrors-DiQldIdC.mjs} +32 -17
- package/dist/{Telemetry-Dw9W5RSp.mjs → Telemetry-JRJJYS4I.mjs} +2 -2
- package/dist/{cancellation-P5YUlcfz.mjs → cancellation-BEpFk2S8.mjs} +7 -5
- package/dist/{composio-Cb3d1jFe.d.mts → composio-BVNJTVYa.d.mts} +2449 -118
- package/dist/{customTool.types-B6ej_8XZ.d.mts → customTool.types-CY5SXFfF.d.mts} +118 -5
- package/dist/{errors-Ue9wMrPK.mjs → errors-CvZjP9CH.mjs} +39 -4
- package/dist/experimental/index.d.mts +2 -2
- package/dist/experimental/index.mjs +1 -1
- package/dist/{fileUtils.node-KE5Fa-af.mjs → fileUtils.node-HQsywtTj.mjs} +8 -6
- package/dist/index.d.mts +292 -140
- package/dist/index.mjs +1914 -160
- package/dist/models/Files.node.d.mts +2 -3
- package/dist/models/Files.node.mjs +2 -2
- package/dist/models/Files.workerd.d.mts +2 -3
- package/dist/platform/node.d.mts +2 -3
- package/dist/platform/workerd.d.mts +2 -3
- package/dist/{sensitiveFileUploadPaths-QN7w4n8v.mjs → sensitiveFileUploadPaths-BlLp-Yo2.mjs} +10 -7
- package/dist/{ssrfGuard.node-BLX6b-Rf.mjs → ssrfGuard.node-BK50mYTq.mjs} +94 -8
- package/dist/{types-CGdgK442.d.mts → types-CqGfjlZg.d.mts} +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +3 -4
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +3 -4
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +3 -4
- package/dist/utils/modifiers/FileToolModifier.node.mjs +6 -6
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +3 -4
- package/dist/utils/modifiers/FileToolModifier.workerd.mjs +1 -1
- package/dist/utils/ssrfGuard.node.d.mts +7 -7
- package/dist/utils/ssrfGuard.node.mjs +1 -1
- package/dist/utils/ssrfGuard.workerd.d.mts +3 -4
- package/dist/utils/ssrfGuard.workerd.mjs +1 -1
- package/package.json +7 -7
- package/src/composio.ts +86 -2
- package/src/errors/ConnectedAccountsErrors.ts +47 -0
- package/src/index.ts +15 -0
- package/src/models/ConnectedAccounts.ts +118 -2
- package/src/models/CustomToolkits.ts +169 -0
- package/src/models/Experimental.ts +27 -0
- package/src/models/Keyring.ts +65 -0
- package/src/models/Logs.ts +101 -0
- package/src/models/ToolRouterSession.ts +51 -0
- package/src/models/Toolkits.ts +180 -0
- package/src/models/Tools.ts +3 -1
- package/src/models/Triggers.ts +2 -87
- package/src/models/Usage.ts +119 -0
- package/src/models/Webhooks.ts +520 -0
- package/src/types/authConfigs.types.ts +2 -0
- package/src/types/connectedAccounts.types.ts +54 -0
- package/src/types/customToolkits.types.ts +102 -0
- package/src/types/keyring.types.ts +32 -0
- package/src/types/logs.types.ts +108 -0
- package/src/types/toolRouter.types.ts +49 -1
- package/src/types/toolkit.types.ts +131 -0
- package/src/types/usage.types.ts +81 -0
- package/src/types/webhooks.types.ts +143 -0
- package/src/utils/constants.ts +1 -5
- package/src/utils/jsonSchema.ts +4 -1
- package/src/utils/logger.ts +39 -7
- package/src/utils/ssrfGuard.node.ts +98 -7
- package/src/utils/transformers/connectedAccounts.ts +37 -2
- package/src/utils/transformers/customToolkits.ts +98 -0
- package/src/utils/transformers/keyring.ts +24 -0
- package/src/utils/transformers/logs.ts +85 -0
- package/src/utils/transformers/toolkits.ts +100 -1
- package/src/utils/transformers/triggers.ts +2 -2
- package/src/utils/transformers/usage.ts +77 -0
- package/src/utils/transformers/webhooks.ts +139 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
UsageRetrieveParams as RawUsageBreakdownParams,
|
|
3
|
+
UsageRetrieveResponse as RawUsageBreakdownResponse,
|
|
4
|
+
UsageRetrieveSummaryParams as RawUsageSummaryParams,
|
|
5
|
+
UsageRetrieveSummaryResponse as RawUsageSummaryResponse,
|
|
6
|
+
} from '@composio/client/resources/project/usage';
|
|
7
|
+
import {
|
|
8
|
+
UsageBreakdownParams,
|
|
9
|
+
UsageBreakdownResponse,
|
|
10
|
+
UsageBreakdownResponseSchema,
|
|
11
|
+
UsageFilters,
|
|
12
|
+
UsageSummaryParams,
|
|
13
|
+
UsageSummaryResponse,
|
|
14
|
+
UsageSummaryResponseSchema,
|
|
15
|
+
} from '../../types/usage.types';
|
|
16
|
+
import { transform } from '../transform';
|
|
17
|
+
|
|
18
|
+
const transformUsageFilters = (
|
|
19
|
+
filters: UsageFilters | undefined
|
|
20
|
+
): RawUsageSummaryParams['filters'] =>
|
|
21
|
+
filters ? { user_id: filters.userId, session_id: filters.sessionId } : undefined;
|
|
22
|
+
|
|
23
|
+
export const transformUsageSummaryParams = (params: UsageSummaryParams): RawUsageSummaryParams => ({
|
|
24
|
+
from: params.from,
|
|
25
|
+
to: params.to,
|
|
26
|
+
entity_types: params.entityTypes,
|
|
27
|
+
filters: transformUsageFilters(params.filters),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const transformUsageBreakdownParams = (
|
|
31
|
+
params: UsageBreakdownParams
|
|
32
|
+
): RawUsageBreakdownParams => ({
|
|
33
|
+
from: params.from,
|
|
34
|
+
to: params.to,
|
|
35
|
+
group_by: params.groupBy,
|
|
36
|
+
order_by: params.orderBy,
|
|
37
|
+
order_direction: params.orderDirection,
|
|
38
|
+
limit: params.limit,
|
|
39
|
+
filters: transformUsageFilters(params.filters),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const transformUsageSummaryResponse = (
|
|
43
|
+
response: RawUsageSummaryResponse
|
|
44
|
+
): UsageSummaryResponse => {
|
|
45
|
+
return transform(response)
|
|
46
|
+
.with(UsageSummaryResponseSchema)
|
|
47
|
+
.using(response => ({
|
|
48
|
+
entities: Object.fromEntries(
|
|
49
|
+
Object.entries(response.entities).map(([entityType, entity]) => [
|
|
50
|
+
entityType,
|
|
51
|
+
{
|
|
52
|
+
unit: entity.unit,
|
|
53
|
+
totalQuantity: entity.total_quantity,
|
|
54
|
+
eventCount: entity.event_count,
|
|
55
|
+
},
|
|
56
|
+
])
|
|
57
|
+
),
|
|
58
|
+
}));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const transformUsageBreakdownResponse = (
|
|
62
|
+
response: RawUsageBreakdownResponse
|
|
63
|
+
): UsageBreakdownResponse => {
|
|
64
|
+
return transform(response)
|
|
65
|
+
.with(UsageBreakdownResponseSchema)
|
|
66
|
+
.using(response => ({
|
|
67
|
+
entityType: response.entity_type,
|
|
68
|
+
unit: response.unit,
|
|
69
|
+
totalQuantity: response.total_quantity,
|
|
70
|
+
eventCount: response.event_count,
|
|
71
|
+
groups: response.groups.map(group => ({
|
|
72
|
+
key: group.key,
|
|
73
|
+
totalQuantity: group.total_quantity,
|
|
74
|
+
eventCount: group.event_count,
|
|
75
|
+
})),
|
|
76
|
+
}));
|
|
77
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
WebhookSubscriptionCreateResponse as RawWebhookSubscriptionCreateResponse,
|
|
3
|
+
WebhookSubscriptionDeleteResponse as RawWebhookSubscriptionDeleteResponse,
|
|
4
|
+
WebhookSubscriptionListEventTypesResponse as RawWebhookSubscriptionListEventTypesResponse,
|
|
5
|
+
WebhookSubscriptionListResponse as RawWebhookSubscriptionListResponse,
|
|
6
|
+
WebhookSubscriptionRetrieveResponse as RawWebhookSubscriptionRetrieveResponse,
|
|
7
|
+
WebhookSubscriptionRotateSecretResponse as RawWebhookSubscriptionRotateSecretResponse,
|
|
8
|
+
WebhookSubscriptionUpdateResponse as RawWebhookSubscriptionUpdateResponse,
|
|
9
|
+
} from '@composio/client/resources/webhook-subscriptions';
|
|
10
|
+
import type {
|
|
11
|
+
WebhookEndpointCreateResponse as RawWebhookEndpointCreateResponse,
|
|
12
|
+
WebhookEndpointListResponse as RawWebhookEndpointListResponse,
|
|
13
|
+
WebhookEndpointReplaceResponse as RawWebhookEndpointReplaceResponse,
|
|
14
|
+
WebhookEndpointRetrieveResponse as RawWebhookEndpointRetrieveResponse,
|
|
15
|
+
WebhookEndpointUpdateResponse as RawWebhookEndpointUpdateResponse,
|
|
16
|
+
} from '@composio/client/resources/webhook-endpoints';
|
|
17
|
+
import type { WebhookSubscription } from '../../types/triggers.types';
|
|
18
|
+
import {
|
|
19
|
+
WebhookEndpoint,
|
|
20
|
+
WebhookEndpointListResponse,
|
|
21
|
+
WebhookEndpointListResponseSchema,
|
|
22
|
+
WebhookEndpointSchema,
|
|
23
|
+
WebhookSubscriptionEventTypesResponse,
|
|
24
|
+
WebhookSubscriptionEventTypesResponseSchema,
|
|
25
|
+
WebhookSubscriptionDeleteResponse,
|
|
26
|
+
WebhookSubscriptionDeleteResponseSchema,
|
|
27
|
+
WebhookSubscriptionListResponse,
|
|
28
|
+
WebhookSubscriptionListResponseSchema,
|
|
29
|
+
WebhookSubscriptionRotateSecretResponse,
|
|
30
|
+
WebhookSubscriptionRotateSecretResponseSchema,
|
|
31
|
+
WebhookSubscriptionSchema,
|
|
32
|
+
} from '../../types/webhooks.types';
|
|
33
|
+
import { transform } from '../transform';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Every subscription read/write on the wire returns the same object; the
|
|
37
|
+
* generated client only gives it a different nominal name per operation.
|
|
38
|
+
*/
|
|
39
|
+
export type RawWebhookSubscription =
|
|
40
|
+
| RawWebhookSubscriptionCreateResponse
|
|
41
|
+
| RawWebhookSubscriptionRetrieveResponse
|
|
42
|
+
| RawWebhookSubscriptionUpdateResponse
|
|
43
|
+
| RawWebhookSubscriptionListResponse['items'][number];
|
|
44
|
+
|
|
45
|
+
export const transformWebhookSubscription = (
|
|
46
|
+
response: RawWebhookSubscription
|
|
47
|
+
): WebhookSubscription => {
|
|
48
|
+
// Map to camelCase explicitly — do NOT spread `...response`, or the wire's
|
|
49
|
+
// snake_case keys (webhook_url, enabled_events, created_at, ...) leak into
|
|
50
|
+
// the public object alongside their camelCase counterparts.
|
|
51
|
+
return transform(response)
|
|
52
|
+
.with(WebhookSubscriptionSchema)
|
|
53
|
+
.using(response => ({
|
|
54
|
+
id: response.id,
|
|
55
|
+
webhookUrl: response.webhook_url,
|
|
56
|
+
version: response.version,
|
|
57
|
+
enabledEvents: response.enabled_events,
|
|
58
|
+
secret: response.secret,
|
|
59
|
+
createdAt: response.created_at,
|
|
60
|
+
updatedAt: response.updated_at,
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const transformWebhookSubscriptionListResponse = (
|
|
65
|
+
response: RawWebhookSubscriptionListResponse
|
|
66
|
+
): WebhookSubscriptionListResponse => {
|
|
67
|
+
return transform(response)
|
|
68
|
+
.with(WebhookSubscriptionListResponseSchema)
|
|
69
|
+
.using(response => ({
|
|
70
|
+
items: response.items.map(transformWebhookSubscription),
|
|
71
|
+
nextCursor: response.next_cursor ?? null,
|
|
72
|
+
totalPages: response.total_pages,
|
|
73
|
+
currentPage: response.current_page,
|
|
74
|
+
totalItems: response.total_items,
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const transformWebhookSubscriptionDeleteResponse = (
|
|
79
|
+
response: RawWebhookSubscriptionDeleteResponse
|
|
80
|
+
): WebhookSubscriptionDeleteResponse => {
|
|
81
|
+
return transform(response)
|
|
82
|
+
.with(WebhookSubscriptionDeleteResponseSchema)
|
|
83
|
+
.using(response => ({ success: response.success }));
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const transformWebhookSubscriptionRotateSecretResponse = (
|
|
87
|
+
response: RawWebhookSubscriptionRotateSecretResponse
|
|
88
|
+
): WebhookSubscriptionRotateSecretResponse => {
|
|
89
|
+
return transform(response)
|
|
90
|
+
.with(WebhookSubscriptionRotateSecretResponseSchema)
|
|
91
|
+
.using(response => ({ id: response.id, secret: response.secret }));
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const transformWebhookSubscriptionEventTypesResponse = (
|
|
95
|
+
response: RawWebhookSubscriptionListEventTypesResponse
|
|
96
|
+
): WebhookSubscriptionEventTypesResponse => {
|
|
97
|
+
return transform(response)
|
|
98
|
+
.with(WebhookSubscriptionEventTypesResponseSchema)
|
|
99
|
+
.using(response => ({
|
|
100
|
+
items: response.items.map(item => ({
|
|
101
|
+
eventType: item.event_type,
|
|
102
|
+
description: item.description,
|
|
103
|
+
supportedVersions: item.supported_versions,
|
|
104
|
+
})),
|
|
105
|
+
}));
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export type RawWebhookEndpoint =
|
|
109
|
+
| RawWebhookEndpointCreateResponse
|
|
110
|
+
| RawWebhookEndpointRetrieveResponse
|
|
111
|
+
| RawWebhookEndpointReplaceResponse
|
|
112
|
+
| RawWebhookEndpointUpdateResponse;
|
|
113
|
+
|
|
114
|
+
export const transformWebhookEndpoint = (response: RawWebhookEndpoint): WebhookEndpoint => {
|
|
115
|
+
return transform(response)
|
|
116
|
+
.with(WebhookEndpointSchema)
|
|
117
|
+
.using(response => ({
|
|
118
|
+
id: response.id,
|
|
119
|
+
toolkitSlug: response.toolkit_slug,
|
|
120
|
+
clientId: response.client_id,
|
|
121
|
+
webhookUrl: response.webhook_url,
|
|
122
|
+
data: response.data,
|
|
123
|
+
createdAt: response.created_at,
|
|
124
|
+
}));
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const transformWebhookEndpointListResponse = (
|
|
128
|
+
response: RawWebhookEndpointListResponse
|
|
129
|
+
): WebhookEndpointListResponse => {
|
|
130
|
+
return transform(response)
|
|
131
|
+
.with(WebhookEndpointListResponseSchema)
|
|
132
|
+
.using(response => ({
|
|
133
|
+
items: response.items.map(item => ({
|
|
134
|
+
id: item.id,
|
|
135
|
+
toolkitSlug: item.toolkit_slug,
|
|
136
|
+
clientId: item.client_id,
|
|
137
|
+
})),
|
|
138
|
+
}));
|
|
139
|
+
};
|