@meetkai/mka1 0.54.45 → 0.54.46
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/README.md +315 -303
- package/bin/mcp-server.js +3125 -2627
- package/bin/mcp-server.js.map +20 -9
- package/dist/commonjs/funcs/analyticsEventsSearch.d.ts +21 -0
- package/dist/commonjs/funcs/analyticsEventsSearch.d.ts.map +1 -0
- package/dist/commonjs/funcs/analyticsEventsSearch.js +140 -0
- package/dist/commonjs/funcs/analyticsEventsSearch.js.map +1 -0
- package/dist/commonjs/funcs/analyticsVisitorsSearch.d.ts +21 -0
- package/dist/commonjs/funcs/analyticsVisitorsSearch.d.ts.map +1 -0
- package/dist/commonjs/funcs/analyticsVisitorsSearch.js +140 -0
- package/dist/commonjs/funcs/analyticsVisitorsSearch.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/server.js +5 -1
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/analyticsEventsSearch.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/analyticsEventsSearch.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/analyticsEventsSearch.js +64 -0
- package/dist/commonjs/mcp-server/tools/analyticsEventsSearch.js.map +1 -0
- package/dist/commonjs/mcp-server/tools/analyticsVisitorsSearch.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/analyticsVisitorsSearch.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/analyticsVisitorsSearch.js +64 -0
- package/dist/commonjs/mcp-server/tools/analyticsVisitorsSearch.js.map +1 -0
- package/dist/commonjs/models/components/analyticsevent.d.ts +2 -2
- package/dist/commonjs/models/components/analyticseventsearchrequest.d.ts +110 -0
- package/dist/commonjs/models/components/analyticseventsearchrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/analyticseventsearchrequest.js +130 -0
- package/dist/commonjs/models/components/analyticseventsearchrequest.js.map +1 -0
- package/dist/commonjs/models/components/analyticseventsearchresponse.d.ts +26 -0
- package/dist/commonjs/models/components/analyticseventsearchresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/analyticseventsearchresponse.js +70 -0
- package/dist/commonjs/models/components/analyticseventsearchresponse.js.map +1 -0
- package/dist/commonjs/models/components/analyticsvisitor.d.ts +35 -0
- package/dist/commonjs/models/components/analyticsvisitor.d.ts.map +1 -0
- package/dist/commonjs/models/components/analyticsvisitor.js +79 -0
- package/dist/commonjs/models/components/analyticsvisitor.js.map +1 -0
- package/dist/commonjs/models/components/analyticsvisitorsearchrequest.d.ts +105 -0
- package/dist/commonjs/models/components/analyticsvisitorsearchrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/analyticsvisitorsearchrequest.js +126 -0
- package/dist/commonjs/models/components/analyticsvisitorsearchrequest.js.map +1 -0
- package/dist/commonjs/models/components/analyticsvisitorsearchresponse.d.ts +26 -0
- package/dist/commonjs/models/components/analyticsvisitorsearchresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/analyticsvisitorsearchresponse.js +70 -0
- package/dist/commonjs/models/components/analyticsvisitorsearchresponse.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +5 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +5 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/operations/analyticseventssearch.d.ts +23 -0
- package/dist/commonjs/models/operations/analyticseventssearch.d.ts.map +1 -0
- package/dist/commonjs/models/operations/analyticseventssearch.js +70 -0
- package/dist/commonjs/models/operations/analyticseventssearch.js.map +1 -0
- package/dist/commonjs/models/operations/analyticsvisitorssearch.d.ts +23 -0
- package/dist/commonjs/models/operations/analyticsvisitorssearch.d.ts.map +1 -0
- package/dist/commonjs/models/operations/analyticsvisitorssearch.js +70 -0
- package/dist/commonjs/models/operations/analyticsvisitorssearch.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +2 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +2 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/react-query/analyticsEventsSearch.d.ts +30 -0
- package/dist/commonjs/react-query/analyticsEventsSearch.d.ts.map +1 -0
- package/dist/commonjs/react-query/analyticsEventsSearch.js +47 -0
- package/dist/commonjs/react-query/analyticsEventsSearch.js.map +1 -0
- package/dist/commonjs/react-query/analyticsVisitorsSearch.d.ts +30 -0
- package/dist/commonjs/react-query/analyticsVisitorsSearch.d.ts.map +1 -0
- package/dist/commonjs/react-query/analyticsVisitorsSearch.js +47 -0
- package/dist/commonjs/react-query/analyticsVisitorsSearch.js.map +1 -0
- package/dist/commonjs/react-query/index.d.ts +2 -0
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +2 -0
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/sdk/analytics.d.ts +6 -0
- package/dist/commonjs/sdk/analytics.d.ts.map +1 -1
- package/dist/commonjs/sdk/analytics.js +8 -0
- package/dist/commonjs/sdk/analytics.js.map +1 -1
- package/dist/commonjs/sdk/events.d.ts +13 -0
- package/dist/commonjs/sdk/events.d.ts.map +1 -0
- package/dist/commonjs/sdk/events.js +22 -0
- package/dist/commonjs/sdk/events.js.map +1 -0
- package/dist/commonjs/sdk/visitors.d.ts +13 -0
- package/dist/commonjs/sdk/visitors.d.ts.map +1 -0
- package/dist/commonjs/sdk/visitors.js +22 -0
- package/dist/commonjs/sdk/visitors.js.map +1 -0
- package/dist/esm/funcs/analyticsEventsSearch.d.ts +21 -0
- package/dist/esm/funcs/analyticsEventsSearch.d.ts.map +1 -0
- package/dist/esm/funcs/analyticsEventsSearch.js +104 -0
- package/dist/esm/funcs/analyticsEventsSearch.js.map +1 -0
- package/dist/esm/funcs/analyticsVisitorsSearch.d.ts +21 -0
- package/dist/esm/funcs/analyticsVisitorsSearch.d.ts.map +1 -0
- package/dist/esm/funcs/analyticsVisitorsSearch.js +104 -0
- package/dist/esm/funcs/analyticsVisitorsSearch.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.d.ts.map +1 -1
- package/dist/esm/mcp-server/server.js +5 -1
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/mcp-server/tools/analyticsEventsSearch.d.ts +8 -0
- package/dist/esm/mcp-server/tools/analyticsEventsSearch.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/analyticsEventsSearch.js +28 -0
- package/dist/esm/mcp-server/tools/analyticsEventsSearch.js.map +1 -0
- package/dist/esm/mcp-server/tools/analyticsVisitorsSearch.d.ts +8 -0
- package/dist/esm/mcp-server/tools/analyticsVisitorsSearch.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/analyticsVisitorsSearch.js +28 -0
- package/dist/esm/mcp-server/tools/analyticsVisitorsSearch.js.map +1 -0
- package/dist/esm/models/components/analyticsevent.d.ts +2 -2
- package/dist/esm/models/components/analyticseventsearchrequest.d.ts +110 -0
- package/dist/esm/models/components/analyticseventsearchrequest.d.ts.map +1 -0
- package/dist/esm/models/components/analyticseventsearchrequest.js +88 -0
- package/dist/esm/models/components/analyticseventsearchrequest.js.map +1 -0
- package/dist/esm/models/components/analyticseventsearchresponse.d.ts +26 -0
- package/dist/esm/models/components/analyticseventsearchresponse.d.ts.map +1 -0
- package/dist/esm/models/components/analyticseventsearchresponse.js +32 -0
- package/dist/esm/models/components/analyticseventsearchresponse.js.map +1 -0
- package/dist/esm/models/components/analyticsvisitor.d.ts +35 -0
- package/dist/esm/models/components/analyticsvisitor.d.ts.map +1 -0
- package/dist/esm/models/components/analyticsvisitor.js +41 -0
- package/dist/esm/models/components/analyticsvisitor.js.map +1 -0
- package/dist/esm/models/components/analyticsvisitorsearchrequest.d.ts +105 -0
- package/dist/esm/models/components/analyticsvisitorsearchrequest.d.ts.map +1 -0
- package/dist/esm/models/components/analyticsvisitorsearchrequest.js +84 -0
- package/dist/esm/models/components/analyticsvisitorsearchrequest.js.map +1 -0
- package/dist/esm/models/components/analyticsvisitorsearchresponse.d.ts +26 -0
- package/dist/esm/models/components/analyticsvisitorsearchresponse.d.ts.map +1 -0
- package/dist/esm/models/components/analyticsvisitorsearchresponse.js +32 -0
- package/dist/esm/models/components/analyticsvisitorsearchresponse.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +5 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +5 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/operations/analyticseventssearch.d.ts +23 -0
- package/dist/esm/models/operations/analyticseventssearch.d.ts.map +1 -0
- package/dist/esm/models/operations/analyticseventssearch.js +32 -0
- package/dist/esm/models/operations/analyticseventssearch.js.map +1 -0
- package/dist/esm/models/operations/analyticsvisitorssearch.d.ts +23 -0
- package/dist/esm/models/operations/analyticsvisitorssearch.d.ts.map +1 -0
- package/dist/esm/models/operations/analyticsvisitorssearch.js +32 -0
- package/dist/esm/models/operations/analyticsvisitorssearch.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +2 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +2 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/react-query/analyticsEventsSearch.d.ts +30 -0
- package/dist/esm/react-query/analyticsEventsSearch.d.ts.map +1 -0
- package/dist/esm/react-query/analyticsEventsSearch.js +42 -0
- package/dist/esm/react-query/analyticsEventsSearch.js.map +1 -0
- package/dist/esm/react-query/analyticsVisitorsSearch.d.ts +30 -0
- package/dist/esm/react-query/analyticsVisitorsSearch.d.ts.map +1 -0
- package/dist/esm/react-query/analyticsVisitorsSearch.js +42 -0
- package/dist/esm/react-query/analyticsVisitorsSearch.js.map +1 -0
- package/dist/esm/react-query/index.d.ts +2 -0
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +2 -0
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/sdk/analytics.d.ts +6 -0
- package/dist/esm/sdk/analytics.d.ts.map +1 -1
- package/dist/esm/sdk/analytics.js +8 -0
- package/dist/esm/sdk/analytics.js.map +1 -1
- package/dist/esm/sdk/events.d.ts +13 -0
- package/dist/esm/sdk/events.d.ts.map +1 -0
- package/dist/esm/sdk/events.js +18 -0
- package/dist/esm/sdk/events.js.map +1 -0
- package/dist/esm/sdk/visitors.d.ts +13 -0
- package/dist/esm/sdk/visitors.d.ts.map +1 -0
- package/dist/esm/sdk/visitors.js +18 -0
- package/dist/esm/sdk/visitors.js.map +1 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/analyticsEventsSearch.ts +199 -0
- package/src/funcs/analyticsVisitorsSearch.ts +199 -0
- package/src/lib/config.ts +2 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +5 -1
- package/src/mcp-server/tools/analyticsEventsSearch.ts +37 -0
- package/src/mcp-server/tools/analyticsVisitorsSearch.ts +37 -0
- package/src/models/components/analyticsevent.ts +2 -2
- package/src/models/components/analyticseventsearchrequest.ts +249 -0
- package/src/models/components/analyticseventsearchresponse.ts +78 -0
- package/src/models/components/analyticsvisitor.ts +90 -0
- package/src/models/components/analyticsvisitorsearchrequest.ts +241 -0
- package/src/models/components/analyticsvisitorsearchresponse.ts +78 -0
- package/src/models/components/index.ts +5 -0
- package/src/models/operations/analyticseventssearch.ts +72 -0
- package/src/models/operations/analyticsvisitorssearch.ts +73 -0
- package/src/models/operations/index.ts +2 -0
- package/src/react-query/analyticsEventsSearch.ts +112 -0
- package/src/react-query/analyticsVisitorsSearch.ts +112 -0
- package/src/react-query/index.ts +2 -0
- package/src/sdk/analytics.ts +12 -0
- package/src/sdk/events.ts +28 -0
- package/src/sdk/visitors.ts +28 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { SDKCore } from "../core.js";
|
|
6
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import * as components from "../models/components/index.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
24
|
+
import { SDKError } from "../models/errors/sdkerror.js";
|
|
25
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
26
|
+
import * as operations from "../models/operations/index.js";
|
|
27
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
28
|
+
import { Result } from "../types/fp.js";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Search events in a time range
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* List individual events in a time range, newest first, with their properties. Optionally filter by event name, event properties, or one visitor's distinct_id. The range includes from and excludes to, and duplicate event IDs are returned once, so a search over a chart bucket's range with the same filters lists exactly the events that bucket counted. A page holds up to 100 events; pass next_cursor as cursor for the following page until it is null. The first page takes a snapshot from ClickHouse's clock before reading its rows and its cursor carries it, so every page of the sequence, the first included, reads only deliveries received at or before that snapshot and ages events out of retention as of it: no event repeats or is skipped, and events received after the snapshot, including a redelivery that revises a listed event, appear only when paging restarts without a cursor. One window blurs that boundary: ClickHouse stamps a receipt at whole seconds when an insert starts and commits its rows when it finishes, so a delivery stamped in or before the snapshot's second that commits after the first page was read is inside the sequence but missing from the first page; it joins from the next page, where an unlisted event it adds or moves ahead of the cursor is skipped and a listed event that a lower-hash redelivery moves behind the cursor repeats at its revised position. A cursor that does not decode, or one from another list, returns 400. A page whose events exceed the response size limit returns 413; request a smaller limit.
|
|
35
|
+
*
|
|
36
|
+
* If set, this operation will use {@link Security.bearerAuth} from the global security.
|
|
37
|
+
*/
|
|
38
|
+
export function analyticsEventsSearch(
|
|
39
|
+
client: SDKCore,
|
|
40
|
+
request: operations.AnalyticsEventsSearchRequest,
|
|
41
|
+
options?: RequestOptions,
|
|
42
|
+
): APIPromise<
|
|
43
|
+
Result<
|
|
44
|
+
components.AnalyticsEventSearchResponse,
|
|
45
|
+
| errors.AnalyticsError
|
|
46
|
+
| SDKError
|
|
47
|
+
| ResponseValidationError
|
|
48
|
+
| ConnectionError
|
|
49
|
+
| RequestAbortedError
|
|
50
|
+
| RequestTimeoutError
|
|
51
|
+
| InvalidRequestError
|
|
52
|
+
| UnexpectedClientError
|
|
53
|
+
| SDKValidationError
|
|
54
|
+
>
|
|
55
|
+
> {
|
|
56
|
+
return new APIPromise($do(
|
|
57
|
+
client,
|
|
58
|
+
request,
|
|
59
|
+
options,
|
|
60
|
+
));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function $do(
|
|
64
|
+
client: SDKCore,
|
|
65
|
+
request: operations.AnalyticsEventsSearchRequest,
|
|
66
|
+
options?: RequestOptions,
|
|
67
|
+
): Promise<
|
|
68
|
+
[
|
|
69
|
+
Result<
|
|
70
|
+
components.AnalyticsEventSearchResponse,
|
|
71
|
+
| errors.AnalyticsError
|
|
72
|
+
| SDKError
|
|
73
|
+
| ResponseValidationError
|
|
74
|
+
| ConnectionError
|
|
75
|
+
| RequestAbortedError
|
|
76
|
+
| RequestTimeoutError
|
|
77
|
+
| InvalidRequestError
|
|
78
|
+
| UnexpectedClientError
|
|
79
|
+
| SDKValidationError
|
|
80
|
+
>,
|
|
81
|
+
APICall,
|
|
82
|
+
]
|
|
83
|
+
> {
|
|
84
|
+
const parsed = safeParse(
|
|
85
|
+
request,
|
|
86
|
+
(value) =>
|
|
87
|
+
operations.AnalyticsEventsSearchRequest$outboundSchema.parse(value),
|
|
88
|
+
"Input validation failed",
|
|
89
|
+
);
|
|
90
|
+
if (!parsed.ok) {
|
|
91
|
+
return [parsed, { status: "invalid" }];
|
|
92
|
+
}
|
|
93
|
+
const payload = parsed.value;
|
|
94
|
+
const body = encodeJSON("body", payload.AnalyticsEventSearchRequest, {
|
|
95
|
+
explode: true,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const pathParams = {
|
|
99
|
+
id: encodeSimple("id", payload.id, {
|
|
100
|
+
explode: false,
|
|
101
|
+
charEncoding: "percent",
|
|
102
|
+
}),
|
|
103
|
+
};
|
|
104
|
+
const path = pathToFunc("/api/v1/analytics/projects/{id}/events/search")(
|
|
105
|
+
pathParams,
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
const headers = new Headers(compactMap({
|
|
109
|
+
"Content-Type": "application/json",
|
|
110
|
+
Accept: "application/json",
|
|
111
|
+
}));
|
|
112
|
+
|
|
113
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
114
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
115
|
+
const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
|
|
116
|
+
|
|
117
|
+
const context = {
|
|
118
|
+
options: client._options,
|
|
119
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
120
|
+
operationID: "analytics_events_search",
|
|
121
|
+
oAuth2Scopes: null,
|
|
122
|
+
|
|
123
|
+
resolvedSecurity: requestSecurity,
|
|
124
|
+
|
|
125
|
+
securitySource: client._options.bearerAuth,
|
|
126
|
+
retryConfig: options?.retries
|
|
127
|
+
|| client._options.retryConfig
|
|
128
|
+
|| {
|
|
129
|
+
strategy: "backoff",
|
|
130
|
+
backoff: {
|
|
131
|
+
initialInterval: 500,
|
|
132
|
+
maxInterval: 5000,
|
|
133
|
+
exponent: 1.5,
|
|
134
|
+
maxElapsedTime: 15000,
|
|
135
|
+
},
|
|
136
|
+
retryConnectionErrors: true,
|
|
137
|
+
}
|
|
138
|
+
|| { strategy: "none" },
|
|
139
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const requestRes = client._createRequest(context, {
|
|
143
|
+
security: requestSecurity,
|
|
144
|
+
method: "POST",
|
|
145
|
+
baseURL: options?.serverURL,
|
|
146
|
+
path: path,
|
|
147
|
+
headers: headers,
|
|
148
|
+
body: body,
|
|
149
|
+
userAgent: client._options.userAgent,
|
|
150
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
151
|
+
}, options);
|
|
152
|
+
if (!requestRes.ok) {
|
|
153
|
+
return [requestRes, { status: "invalid" }];
|
|
154
|
+
}
|
|
155
|
+
const req = requestRes.value;
|
|
156
|
+
|
|
157
|
+
const doResult = await client._do(req, {
|
|
158
|
+
context,
|
|
159
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
160
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
161
|
+
retryConfig: context.retryConfig,
|
|
162
|
+
retryCodes: context.retryCodes,
|
|
163
|
+
});
|
|
164
|
+
if (!doResult.ok) {
|
|
165
|
+
return [doResult, { status: "request-error", request: req }];
|
|
166
|
+
}
|
|
167
|
+
const response = doResult.value;
|
|
168
|
+
|
|
169
|
+
const responseFields = {
|
|
170
|
+
HttpMeta: { Response: response, Request: req },
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const [result] = await M.match<
|
|
174
|
+
components.AnalyticsEventSearchResponse,
|
|
175
|
+
| errors.AnalyticsError
|
|
176
|
+
| SDKError
|
|
177
|
+
| ResponseValidationError
|
|
178
|
+
| ConnectionError
|
|
179
|
+
| RequestAbortedError
|
|
180
|
+
| RequestTimeoutError
|
|
181
|
+
| InvalidRequestError
|
|
182
|
+
| UnexpectedClientError
|
|
183
|
+
| SDKValidationError
|
|
184
|
+
>(
|
|
185
|
+
M.json(200, components.AnalyticsEventSearchResponse$inboundSchema),
|
|
186
|
+
M.jsonErr(
|
|
187
|
+
[400, 401, 403, 404, 409, 413, 415, 429],
|
|
188
|
+
errors.AnalyticsError$inboundSchema,
|
|
189
|
+
),
|
|
190
|
+
M.jsonErr([500, 503], errors.AnalyticsError$inboundSchema),
|
|
191
|
+
M.fail("4XX"),
|
|
192
|
+
M.fail("5XX"),
|
|
193
|
+
)(response, req, { extraFields: responseFields });
|
|
194
|
+
if (!result.ok) {
|
|
195
|
+
return [result, { status: "complete", request: req, response }];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return [result, { status: "complete", request: req, response }];
|
|
199
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { SDKCore } from "../core.js";
|
|
6
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import * as components from "../models/components/index.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
24
|
+
import { SDKError } from "../models/errors/sdkerror.js";
|
|
25
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
26
|
+
import * as operations from "../models/operations/index.js";
|
|
27
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
28
|
+
import { Result } from "../types/fp.js";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Search visitors in a time range
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* List visitors with matching events in a time range, most recently active first. Each visitor is one distinct_id with the timestamps of its first and last matching event and its event count over the whole range, so for a range that receives no further events the number of visitors across all pages equals the unique_visitors query for the same range and filters. The range includes from and excludes to, and duplicate event IDs are counted once. A page holds up to 100 visitors; pass next_cursor as cursor for the following page until it is null. The first page takes a snapshot from ClickHouse's clock before reading its rows and its cursor carries it, so every page of the sequence, the first included, reads only deliveries received at or before that snapshot and ages events out of retention as of it: a visitor keeps the position, first_seen, last_seen and event_count the sequence started with, no visitor repeats or is skipped, and activity received after the snapshot appears only when paging restarts without a cursor. One window blurs that boundary: ClickHouse stamps a receipt at whole seconds when an insert starts and commits its rows when it finishes, so a delivery stamped in or before the snapshot's second that commits after the first page was read is inside the sequence but missing from the first page; it joins from the next page, where an unlisted visitor it adds or moves ahead of the cursor is skipped and a listed visitor whose winning delivery a lower-hash redelivery moves behind the cursor repeats with revised totals; a listed visitor's totals otherwise stay as listed. A cursor that does not decode, or one from another list, returns 400.
|
|
35
|
+
*
|
|
36
|
+
* If set, this operation will use {@link Security.bearerAuth} from the global security.
|
|
37
|
+
*/
|
|
38
|
+
export function analyticsVisitorsSearch(
|
|
39
|
+
client: SDKCore,
|
|
40
|
+
request: operations.AnalyticsVisitorsSearchRequest,
|
|
41
|
+
options?: RequestOptions,
|
|
42
|
+
): APIPromise<
|
|
43
|
+
Result<
|
|
44
|
+
components.AnalyticsVisitorSearchResponse,
|
|
45
|
+
| errors.AnalyticsError
|
|
46
|
+
| SDKError
|
|
47
|
+
| ResponseValidationError
|
|
48
|
+
| ConnectionError
|
|
49
|
+
| RequestAbortedError
|
|
50
|
+
| RequestTimeoutError
|
|
51
|
+
| InvalidRequestError
|
|
52
|
+
| UnexpectedClientError
|
|
53
|
+
| SDKValidationError
|
|
54
|
+
>
|
|
55
|
+
> {
|
|
56
|
+
return new APIPromise($do(
|
|
57
|
+
client,
|
|
58
|
+
request,
|
|
59
|
+
options,
|
|
60
|
+
));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function $do(
|
|
64
|
+
client: SDKCore,
|
|
65
|
+
request: operations.AnalyticsVisitorsSearchRequest,
|
|
66
|
+
options?: RequestOptions,
|
|
67
|
+
): Promise<
|
|
68
|
+
[
|
|
69
|
+
Result<
|
|
70
|
+
components.AnalyticsVisitorSearchResponse,
|
|
71
|
+
| errors.AnalyticsError
|
|
72
|
+
| SDKError
|
|
73
|
+
| ResponseValidationError
|
|
74
|
+
| ConnectionError
|
|
75
|
+
| RequestAbortedError
|
|
76
|
+
| RequestTimeoutError
|
|
77
|
+
| InvalidRequestError
|
|
78
|
+
| UnexpectedClientError
|
|
79
|
+
| SDKValidationError
|
|
80
|
+
>,
|
|
81
|
+
APICall,
|
|
82
|
+
]
|
|
83
|
+
> {
|
|
84
|
+
const parsed = safeParse(
|
|
85
|
+
request,
|
|
86
|
+
(value) =>
|
|
87
|
+
operations.AnalyticsVisitorsSearchRequest$outboundSchema.parse(value),
|
|
88
|
+
"Input validation failed",
|
|
89
|
+
);
|
|
90
|
+
if (!parsed.ok) {
|
|
91
|
+
return [parsed, { status: "invalid" }];
|
|
92
|
+
}
|
|
93
|
+
const payload = parsed.value;
|
|
94
|
+
const body = encodeJSON("body", payload.AnalyticsVisitorSearchRequest, {
|
|
95
|
+
explode: true,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const pathParams = {
|
|
99
|
+
id: encodeSimple("id", payload.id, {
|
|
100
|
+
explode: false,
|
|
101
|
+
charEncoding: "percent",
|
|
102
|
+
}),
|
|
103
|
+
};
|
|
104
|
+
const path = pathToFunc("/api/v1/analytics/projects/{id}/visitors/search")(
|
|
105
|
+
pathParams,
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
const headers = new Headers(compactMap({
|
|
109
|
+
"Content-Type": "application/json",
|
|
110
|
+
Accept: "application/json",
|
|
111
|
+
}));
|
|
112
|
+
|
|
113
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
114
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
115
|
+
const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
|
|
116
|
+
|
|
117
|
+
const context = {
|
|
118
|
+
options: client._options,
|
|
119
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
120
|
+
operationID: "analytics_visitors_search",
|
|
121
|
+
oAuth2Scopes: null,
|
|
122
|
+
|
|
123
|
+
resolvedSecurity: requestSecurity,
|
|
124
|
+
|
|
125
|
+
securitySource: client._options.bearerAuth,
|
|
126
|
+
retryConfig: options?.retries
|
|
127
|
+
|| client._options.retryConfig
|
|
128
|
+
|| {
|
|
129
|
+
strategy: "backoff",
|
|
130
|
+
backoff: {
|
|
131
|
+
initialInterval: 500,
|
|
132
|
+
maxInterval: 5000,
|
|
133
|
+
exponent: 1.5,
|
|
134
|
+
maxElapsedTime: 15000,
|
|
135
|
+
},
|
|
136
|
+
retryConnectionErrors: true,
|
|
137
|
+
}
|
|
138
|
+
|| { strategy: "none" },
|
|
139
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const requestRes = client._createRequest(context, {
|
|
143
|
+
security: requestSecurity,
|
|
144
|
+
method: "POST",
|
|
145
|
+
baseURL: options?.serverURL,
|
|
146
|
+
path: path,
|
|
147
|
+
headers: headers,
|
|
148
|
+
body: body,
|
|
149
|
+
userAgent: client._options.userAgent,
|
|
150
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
151
|
+
}, options);
|
|
152
|
+
if (!requestRes.ok) {
|
|
153
|
+
return [requestRes, { status: "invalid" }];
|
|
154
|
+
}
|
|
155
|
+
const req = requestRes.value;
|
|
156
|
+
|
|
157
|
+
const doResult = await client._do(req, {
|
|
158
|
+
context,
|
|
159
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
160
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
161
|
+
retryConfig: context.retryConfig,
|
|
162
|
+
retryCodes: context.retryCodes,
|
|
163
|
+
});
|
|
164
|
+
if (!doResult.ok) {
|
|
165
|
+
return [doResult, { status: "request-error", request: req }];
|
|
166
|
+
}
|
|
167
|
+
const response = doResult.value;
|
|
168
|
+
|
|
169
|
+
const responseFields = {
|
|
170
|
+
HttpMeta: { Response: response, Request: req },
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const [result] = await M.match<
|
|
174
|
+
components.AnalyticsVisitorSearchResponse,
|
|
175
|
+
| errors.AnalyticsError
|
|
176
|
+
| SDKError
|
|
177
|
+
| ResponseValidationError
|
|
178
|
+
| ConnectionError
|
|
179
|
+
| RequestAbortedError
|
|
180
|
+
| RequestTimeoutError
|
|
181
|
+
| InvalidRequestError
|
|
182
|
+
| UnexpectedClientError
|
|
183
|
+
| SDKValidationError
|
|
184
|
+
>(
|
|
185
|
+
M.json(200, components.AnalyticsVisitorSearchResponse$inboundSchema),
|
|
186
|
+
M.jsonErr(
|
|
187
|
+
[400, 401, 403, 404, 409, 413, 415, 429],
|
|
188
|
+
errors.AnalyticsError$inboundSchema,
|
|
189
|
+
),
|
|
190
|
+
M.jsonErr([500, 503], errors.AnalyticsError$inboundSchema),
|
|
191
|
+
M.fail("4XX"),
|
|
192
|
+
M.fail("5XX"),
|
|
193
|
+
)(response, req, { extraFields: responseFields });
|
|
194
|
+
if (!result.ok) {
|
|
195
|
+
return [result, { status: "complete", request: req, response }];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return [result, { status: "complete", request: req, response }];
|
|
199
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -65,7 +65,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
65
65
|
export const SDK_METADATA = {
|
|
66
66
|
language: "typescript",
|
|
67
67
|
openapiDocVersion: "1.1.0",
|
|
68
|
-
sdkVersion: "0.54.
|
|
68
|
+
sdkVersion: "0.54.46",
|
|
69
69
|
genVersion: "2.938.0",
|
|
70
|
-
userAgent: "speakeasy-sdk/typescript 0.54.
|
|
70
|
+
userAgent: "speakeasy-sdk/typescript 0.54.46 2.938.0 1.1.0 @meetkai/mka1",
|
|
71
71
|
} as const;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -40,6 +40,7 @@ import { tool$agentsUpdateAgent } from "./tools/agentsUpdateAgent.js";
|
|
|
40
40
|
import { tool$agentVersionsGetAgentVersion } from "./tools/agentVersionsGetAgentVersion.js";
|
|
41
41
|
import { tool$agentVersionsListAgentVersions } from "./tools/agentVersionsListAgentVersions.js";
|
|
42
42
|
import { tool$agentVersionsRollbackAgentVersion } from "./tools/agentVersionsRollbackAgentVersion.js";
|
|
43
|
+
import { tool$analyticsEventsSearch } from "./tools/analyticsEventsSearch.js";
|
|
43
44
|
import { tool$analyticsKeysCreate } from "./tools/analyticsKeysCreate.js";
|
|
44
45
|
import { tool$analyticsKeysList } from "./tools/analyticsKeysList.js";
|
|
45
46
|
import { tool$analyticsKeysRevoke } from "./tools/analyticsKeysRevoke.js";
|
|
@@ -49,6 +50,7 @@ import { tool$analyticsProjectsGet } from "./tools/analyticsProjectsGet.js";
|
|
|
49
50
|
import { tool$analyticsProjectsList } from "./tools/analyticsProjectsList.js";
|
|
50
51
|
import { tool$analyticsProjectsUpdate } from "./tools/analyticsProjectsUpdate.js";
|
|
51
52
|
import { tool$analyticsQuery } from "./tools/analyticsQuery.js";
|
|
53
|
+
import { tool$analyticsVisitorsSearch } from "./tools/analyticsVisitorsSearch.js";
|
|
52
54
|
import { tool$authApiKeyGetJwtFromKey } from "./tools/authApiKeyGetJwtFromKey.js";
|
|
53
55
|
import { tool$authApiKeysCreate } from "./tools/authApiKeysCreate.js";
|
|
54
56
|
import { tool$authApiKeysExchangeToken } from "./tools/authApiKeysExchangeToken.js";
|
|
@@ -440,7 +442,7 @@ export function createMCPServer(deps: {
|
|
|
440
442
|
}) {
|
|
441
443
|
const server = new McpServer({
|
|
442
444
|
name: "SDK",
|
|
443
|
-
version: "0.54.
|
|
445
|
+
version: "0.54.46",
|
|
444
446
|
});
|
|
445
447
|
|
|
446
448
|
const client = new SDKCore({
|
|
@@ -898,6 +900,8 @@ export function createMCPServer(deps: {
|
|
|
898
900
|
tool(tool$analyticsKeysCreate);
|
|
899
901
|
tool(tool$analyticsKeysList);
|
|
900
902
|
tool(tool$analyticsKeysRevoke);
|
|
903
|
+
tool(tool$analyticsEventsSearch);
|
|
904
|
+
tool(tool$analyticsVisitorsSearch);
|
|
901
905
|
|
|
902
906
|
return server;
|
|
903
907
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { analyticsEventsSearch } from "../../funcs/analyticsEventsSearch.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.AnalyticsEventsSearchRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$analyticsEventsSearch: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "analytics-events-search",
|
|
15
|
+
description: `Search events in a time range
|
|
16
|
+
|
|
17
|
+
List individual events in a time range, newest first, with their properties. Optionally filter by event name, event properties, or one visitor's distinct_id. The range includes from and excludes to, and duplicate event IDs are returned once, so a search over a chart bucket's range with the same filters lists exactly the events that bucket counted. A page holds up to 100 events; pass next_cursor as cursor for the following page until it is null. The first page takes a snapshot from ClickHouse's clock before reading its rows and its cursor carries it, so every page of the sequence, the first included, reads only deliveries received at or before that snapshot and ages events out of retention as of it: no event repeats or is skipped, and events received after the snapshot, including a redelivery that revises a listed event, appear only when paging restarts without a cursor. One window blurs that boundary: ClickHouse stamps a receipt at whole seconds when an insert starts and commits its rows when it finishes, so a delivery stamped in or before the snapshot's second that commits after the first page was read is inside the sequence but missing from the first page; it joins from the next page, where an unlisted event it adds or moves ahead of the cursor is skipped and a listed event that a lower-hash redelivery moves behind the cursor repeats at its revised position. A cursor that does not decode, or one from another list, returns 400. A page whose events exceed the response size limit returns 413; request a smaller limit.`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await analyticsEventsSearch(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const value = result.value;
|
|
34
|
+
|
|
35
|
+
return formatResult(value, apiCall);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { analyticsVisitorsSearch } from "../../funcs/analyticsVisitorsSearch.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.AnalyticsVisitorsSearchRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$analyticsVisitorsSearch: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "analytics-visitors-search",
|
|
15
|
+
description: `Search visitors in a time range
|
|
16
|
+
|
|
17
|
+
List visitors with matching events in a time range, most recently active first. Each visitor is one distinct_id with the timestamps of its first and last matching event and its event count over the whole range, so for a range that receives no further events the number of visitors across all pages equals the unique_visitors query for the same range and filters. The range includes from and excludes to, and duplicate event IDs are counted once. A page holds up to 100 visitors; pass next_cursor as cursor for the following page until it is null. The first page takes a snapshot from ClickHouse's clock before reading its rows and its cursor carries it, so every page of the sequence, the first included, reads only deliveries received at or before that snapshot and ages events out of retention as of it: a visitor keeps the position, first_seen, last_seen and event_count the sequence started with, no visitor repeats or is skipped, and activity received after the snapshot appears only when paging restarts without a cursor. One window blurs that boundary: ClickHouse stamps a receipt at whole seconds when an insert starts and commits its rows when it finishes, so a delivery stamped in or before the snapshot's second that commits after the first page was read is inside the sequence but missing from the first page; it joins from the next page, where an unlisted visitor it adds or moves ahead of the cursor is skipped and a listed visitor whose winning delivery a lower-hash redelivery moves behind the cursor repeats with revised totals; a listed visitor's totals otherwise stay as listed. A cursor that does not decode, or one from another list, returns 400.`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await analyticsVisitorsSearch(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const value = result.value;
|
|
34
|
+
|
|
35
|
+
return formatResult(value, apiCall);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -20,11 +20,11 @@ export type AnalyticsEvent = {
|
|
|
20
20
|
*/
|
|
21
21
|
eventName: string;
|
|
22
22
|
/**
|
|
23
|
-
* When the event occurred. Use an ISO 8601 timestamp with Z for UTC or an offset such as -07:00. Send current timestamps for new events.
|
|
23
|
+
* When the event occurred. Use an ISO 8601 timestamp with Z for UTC or an offset such as -07:00. Send current timestamps for new events. Event search returns it in UTC with milliseconds, ending in Z.
|
|
24
24
|
*/
|
|
25
25
|
timestamp: Date;
|
|
26
26
|
/**
|
|
27
|
-
* Your identifier for the visitor. Unique visitor queries count distinct values of this field.
|
|
27
|
+
* Your identifier for the visitor. Unique visitor queries count distinct values of this field, and visitor search lists one visitor per value.
|
|
28
28
|
*/
|
|
29
29
|
distinctId: string;
|
|
30
30
|
/**
|