@notionhq/client 5.25.1 → 5.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/package.json +1 -1
- package/build/src/Client.d.ts +67 -1
- package/build/src/Client.d.ts.map +1 -1
- package/build/src/Client.js +332 -3
- package/build/src/Client.js.map +1 -1
- package/build/src/api-endpoints/agents.d.ts +3241 -0
- package/build/src/api-endpoints/agents.d.ts.map +1 -0
- package/build/src/api-endpoints/agents.js +336 -0
- package/build/src/api-endpoints/agents.js.map +1 -0
- package/build/src/api-endpoints/common.d.ts +4 -1
- package/build/src/api-endpoints/common.d.ts.map +1 -1
- package/build/src/api-endpoints/common.js.map +1 -1
- package/build/src/api-endpoints.d.ts +1 -0
- package/build/src/api-endpoints.d.ts.map +1 -1
- package/build/src/api-endpoints.js +1 -0
- package/build/src/api-endpoints.js.map +1 -1
- package/build/src/fetch-types.d.ts +11 -0
- package/build/src/fetch-types.d.ts.map +1 -1
- package/build/src/fetch-types.js.map +1 -1
- package/build/src/index.d.ts +1 -1
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js.map +1 -1
- package/package.json +1 -1
package/build/package.json
CHANGED
package/build/src/Client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Agent } from "node:http";
|
|
2
2
|
import { type Logger, LogLevel } from "./logging";
|
|
3
|
-
import { type GetBlockParameters, type GetBlockResponse, type UpdateBlockParameters, type UpdateBlockResponse, type DeleteBlockParameters, type DeleteBlockResponse, type AppendBlockChildrenParameters, type AppendBlockChildrenResponse, type ListBlockChildrenParameters, type ListBlockChildrenResponse, type QueryDataSourceParameters, type QueryDataSourceResponse, type CreateDataSourceParameters, type CreateDataSourceResponse, type UpdateDataSourceParameters, type UpdateDataSourceResponse, type GetDataSourceParameters, type GetDataSourceResponse, type CreatePageParameters, type CreatePageResponse, type GetPageParameters, type GetPageResponse, type UpdatePageParameters, type UpdatePageResponse, type MovePageParameters, type MovePageResponse, type GetPageMarkdownParameters, type GetPageMarkdownResponse, type UpdatePageMarkdownParameters, type UpdatePageMarkdownResponse, type GetUserParameters, type GetUserResponse, type ListUsersParameters, type ListUsersResponse, type SearchParameters, type SearchResponse, type GetSelfParameters, type GetSelfResponse, type GetPagePropertyParameters, type GetPagePropertyResponse, type CreateCommentParameters, type CreateCommentResponse, type ListCommentsParameters, type ListCommentsResponse, type GetCommentParameters, type GetCommentResponse, type UpdateCommentParameters, type UpdateCommentResponse, type DeleteCommentParameters, type DeleteCommentResponse, type OauthTokenResponse, type OauthTokenParameters, type OauthIntrospectResponse, type OauthIntrospectParameters, type OauthRevokeResponse, type OauthRevokeParameters, type CreateFileUploadParameters, type CreateFileUploadResponse, type GetFileUploadResponse, type GetFileUploadParameters, type SendFileUploadParameters, type SendFileUploadResponse, type CompleteFileUploadParameters, type CompleteFileUploadResponse, type ListFileUploadsParameters, type ListFileUploadsResponse, GetDatabaseParameters, GetDatabaseResponse, CreateDatabaseResponse, CreateDatabaseParameters, UpdateDatabaseParameters, UpdateDatabaseResponse, ListDataSourceTemplatesResponse, ListDataSourceTemplatesParameters, type ListDatabaseViewsParameters, type ListDatabaseViewsResponse, type CreateViewParameters, type CreateViewResponse, type GetViewParameters, type GetViewResponse, type UpdateViewParameters, type UpdateViewResponse, type DeleteViewParameters, type DeleteViewResponse, type CreateViewQueryParameters, type CreateViewQueryResponse, type GetViewQueryResultsParameters, type GetViewQueryResultsResponse, type DeleteViewQueryParameters, type DeleteViewQueryResponse, type ListCustomEmojisParameters, type ListCustomEmojisResponse, type GetAsyncTaskParameters, type GetAsyncTaskResponse } from "./api-endpoints";
|
|
3
|
+
import { type GetBlockParameters, type GetBlockResponse, type UpdateBlockParameters, type UpdateBlockResponse, type DeleteBlockParameters, type DeleteBlockResponse, type AppendBlockChildrenParameters, type AppendBlockChildrenResponse, type ListBlockChildrenParameters, type ListBlockChildrenResponse, type QueryDataSourceParameters, type QueryDataSourceResponse, type CreateDataSourceParameters, type CreateDataSourceResponse, type UpdateDataSourceParameters, type UpdateDataSourceResponse, type GetDataSourceParameters, type GetDataSourceResponse, type CreatePageParameters, type CreatePageResponse, type GetPageParameters, type GetPageResponse, type UpdatePageParameters, type UpdatePageResponse, type MovePageParameters, type MovePageResponse, type GetPageMarkdownParameters, type GetPageMarkdownResponse, type UpdatePageMarkdownParameters, type UpdatePageMarkdownResponse, type GetUserParameters, type GetUserResponse, type ListUsersParameters, type ListUsersResponse, type SearchParameters, type SearchResponse, type GetSelfParameters, type GetSelfResponse, type GetPagePropertyParameters, type GetPagePropertyResponse, type CreateCommentParameters, type CreateCommentResponse, type ListCommentsParameters, type ListCommentsResponse, type GetCommentParameters, type GetCommentResponse, type UpdateCommentParameters, type UpdateCommentResponse, type DeleteCommentParameters, type DeleteCommentResponse, type OauthTokenResponse, type OauthTokenParameters, type OauthIntrospectResponse, type OauthIntrospectParameters, type OauthRevokeResponse, type OauthRevokeParameters, type CreateFileUploadParameters, type CreateFileUploadResponse, type GetFileUploadResponse, type GetFileUploadParameters, type SendFileUploadParameters, type SendFileUploadResponse, type CompleteFileUploadParameters, type CompleteFileUploadResponse, type ListFileUploadsParameters, type ListFileUploadsResponse, GetDatabaseParameters, GetDatabaseResponse, CreateDatabaseResponse, CreateDatabaseParameters, UpdateDatabaseParameters, UpdateDatabaseResponse, ListDataSourceTemplatesResponse, ListDataSourceTemplatesParameters, type ListDatabaseViewsParameters, type ListDatabaseViewsResponse, type CreateViewParameters, type CreateViewResponse, type GetViewParameters, type GetViewResponse, type UpdateViewParameters, type UpdateViewResponse, type DeleteViewParameters, type DeleteViewResponse, type CreateViewQueryParameters, type CreateViewQueryResponse, type GetViewQueryResultsParameters, type GetViewQueryResultsResponse, type DeleteViewQueryParameters, type DeleteViewQueryResponse, type ListCustomEmojisParameters, type ListCustomEmojisResponse, type GetAsyncTaskParameters, type GetAsyncTaskResponse, type AgentBatchParameters, type AgentBatchResponse, type DeleteAgentParameters, type DeleteAgentResponse, type GetAgentParameters, type GetAgentResponse, type GetInsightsParameters, type GetInsightsResponse, type QueryAgentsParameters, type QueryAgentsResponse, type RetrieveSessionParameters, type RetrieveSessionResponse, type UpdateSessionParameters, type UpdateSessionResponse, type UpdateSessionStreamParameters, type UpdateSessionStreamResponse, type CancelSessionParameters, type CancelSessionResponse, type QuerySessionsParameters, type QuerySessionsResponse, type QuerySessionEventsParameters, type QuerySessionEventsResponse, type UpdateAgentCreditLimitParameters, type UpdateAgentCreditLimitResponse, type UpdateAgentStatusParameters, type UpdateAgentStatusResponse } from "./api-endpoints";
|
|
4
4
|
import { type CreateMeetingNoteParameters, type CreateMeetingNoteResponse, type QueryMeetingNotesResponse } from "./api-endpoints/meeting-notes";
|
|
5
5
|
import type { QueryMeetingNotesParameters } from "./meeting-notes";
|
|
6
6
|
import type { SupportedFetch } from "./fetch-types";
|
|
@@ -67,6 +67,10 @@ export default class Client {
|
|
|
67
67
|
* Sends a request.
|
|
68
68
|
*/
|
|
69
69
|
request<ResponseBody extends object>(args: RequestParameters): Promise<ResponseBody>;
|
|
70
|
+
/**
|
|
71
|
+
* Opens an SSE response and yields each parsed event as it arrives.
|
|
72
|
+
*/
|
|
73
|
+
private streamRequest;
|
|
70
74
|
/**
|
|
71
75
|
* Builds the full URL with query parameters.
|
|
72
76
|
*/
|
|
@@ -96,6 +100,12 @@ export default class Client {
|
|
|
96
100
|
* Executes a single HTTP request (no retry).
|
|
97
101
|
*/
|
|
98
102
|
private executeSingleRequest;
|
|
103
|
+
/**
|
|
104
|
+
* Opens an SSE response without consuming its body. Retry orchestration is
|
|
105
|
+
* shared with JSON requests so only the initial, retryable HTTP failures are
|
|
106
|
+
* retried; once a stream has opened, its events are never replayed.
|
|
107
|
+
*/
|
|
108
|
+
private executeSingleStreamRequest;
|
|
99
109
|
/**
|
|
100
110
|
* Logs a request error with appropriate detail level.
|
|
101
111
|
*/
|
|
@@ -125,6 +135,62 @@ export default class Client {
|
|
|
125
135
|
*/
|
|
126
136
|
private parseRetryAfterHeader;
|
|
127
137
|
private sleep;
|
|
138
|
+
readonly agents: {
|
|
139
|
+
/**
|
|
140
|
+
* Retrieve an agent
|
|
141
|
+
*/
|
|
142
|
+
retrieve: (args: WithAuth<GetAgentParameters>) => Promise<GetAgentResponse>;
|
|
143
|
+
/**
|
|
144
|
+
* Query agents
|
|
145
|
+
*/
|
|
146
|
+
query: (args: WithAuth<QueryAgentsParameters>) => Promise<QueryAgentsResponse>;
|
|
147
|
+
/**
|
|
148
|
+
* Retrieve agent insights
|
|
149
|
+
*/
|
|
150
|
+
retrieveInsights: (args: WithAuth<GetInsightsParameters>) => Promise<GetInsightsResponse>;
|
|
151
|
+
/**
|
|
152
|
+
* Update an agent's credit limit
|
|
153
|
+
*/
|
|
154
|
+
updateCreditLimit: (args: WithAuth<UpdateAgentCreditLimitParameters>) => Promise<UpdateAgentCreditLimitResponse>;
|
|
155
|
+
/**
|
|
156
|
+
* Update an agent's status
|
|
157
|
+
*/
|
|
158
|
+
updateStatus: (args: WithAuth<UpdateAgentStatusParameters>) => Promise<UpdateAgentStatusResponse>;
|
|
159
|
+
/**
|
|
160
|
+
* Delete an agent
|
|
161
|
+
*/
|
|
162
|
+
delete: (args: WithAuth<DeleteAgentParameters>) => Promise<DeleteAgentResponse>;
|
|
163
|
+
/**
|
|
164
|
+
* Apply many agent operations
|
|
165
|
+
*/
|
|
166
|
+
batch: (args: WithAuth<AgentBatchParameters>) => Promise<AgentBatchResponse>;
|
|
167
|
+
};
|
|
168
|
+
readonly sessions: {
|
|
169
|
+
/**
|
|
170
|
+
* Retrieve a session
|
|
171
|
+
*/
|
|
172
|
+
retrieve: (args: WithAuth<RetrieveSessionParameters>) => Promise<RetrieveSessionResponse>;
|
|
173
|
+
/**
|
|
174
|
+
* Update a session
|
|
175
|
+
*/
|
|
176
|
+
update: (args: WithAuth<UpdateSessionParameters>) => Promise<UpdateSessionResponse>;
|
|
177
|
+
/**
|
|
178
|
+
* Open a session stream
|
|
179
|
+
*/
|
|
180
|
+
stream: (args: WithAuth<UpdateSessionStreamParameters>) => AsyncIterable<UpdateSessionStreamResponse>;
|
|
181
|
+
/**
|
|
182
|
+
* Cancel a session
|
|
183
|
+
*/
|
|
184
|
+
cancel: (args: WithAuth<CancelSessionParameters>) => Promise<CancelSessionResponse>;
|
|
185
|
+
/**
|
|
186
|
+
* Query sessions
|
|
187
|
+
*/
|
|
188
|
+
query: (args: WithAuth<QuerySessionsParameters>) => Promise<QuerySessionsResponse>;
|
|
189
|
+
/**
|
|
190
|
+
* Query session events
|
|
191
|
+
*/
|
|
192
|
+
queryEvents: (args: WithAuth<QuerySessionEventsParameters>) => Promise<QuerySessionEventsResponse>;
|
|
193
|
+
};
|
|
128
194
|
readonly asyncTasks: {
|
|
129
195
|
/**
|
|
130
196
|
* Retrieve an async task
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Client.d.ts","sourceRoot":"","sources":["../../src/Client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EACL,KAAK,MAAM,EACX,QAAQ,EAGT,MAAM,WAAW,CAAA;AAoBlB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EAErB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAExB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAExB,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,EAEhC,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAE9B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAE5B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAE7B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAE7B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAE1B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EAEvB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EAEpB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EAEv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G,QAAQ,CAAA;AACjD,KAAK,WAAW,GACZ,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC,GAC3D,eAAe,CAAA;AAEnB,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA"}
|
package/build/src/Client.js
CHANGED
|
@@ -38,6 +38,180 @@ class Client {
|
|
|
38
38
|
/*
|
|
39
39
|
* Notion API endpoints
|
|
40
40
|
*/
|
|
41
|
+
this.agents = {
|
|
42
|
+
/**
|
|
43
|
+
* Retrieve an agent
|
|
44
|
+
*/
|
|
45
|
+
retrieve: (args) => {
|
|
46
|
+
this.warnUnknownParams(args, api_endpoints_1.getAgent);
|
|
47
|
+
return this.request({
|
|
48
|
+
path: api_endpoints_1.getAgent.path(args),
|
|
49
|
+
method: api_endpoints_1.getAgent.method,
|
|
50
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.getAgent.queryParams),
|
|
51
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.getAgent.bodyParams),
|
|
52
|
+
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* Query agents
|
|
57
|
+
*/
|
|
58
|
+
query: (args) => {
|
|
59
|
+
this.warnUnknownParams(args, api_endpoints_1.queryAgents);
|
|
60
|
+
return this.request({
|
|
61
|
+
path: api_endpoints_1.queryAgents.path(),
|
|
62
|
+
method: api_endpoints_1.queryAgents.method,
|
|
63
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.queryAgents.queryParams),
|
|
64
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.queryAgents.bodyParams),
|
|
65
|
+
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* Retrieve agent insights
|
|
70
|
+
*/
|
|
71
|
+
retrieveInsights: (args) => {
|
|
72
|
+
this.warnUnknownParams(args, api_endpoints_1.getInsights);
|
|
73
|
+
return this.request({
|
|
74
|
+
path: api_endpoints_1.getInsights.path(args),
|
|
75
|
+
method: api_endpoints_1.getInsights.method,
|
|
76
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.getInsights.queryParams),
|
|
77
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.getInsights.bodyParams),
|
|
78
|
+
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
/**
|
|
82
|
+
* Update an agent's credit limit
|
|
83
|
+
*/
|
|
84
|
+
updateCreditLimit: (args) => {
|
|
85
|
+
this.warnUnknownParams(args, api_endpoints_1.updateAgentCreditLimit);
|
|
86
|
+
return this.request({
|
|
87
|
+
path: api_endpoints_1.updateAgentCreditLimit.path(args),
|
|
88
|
+
method: api_endpoints_1.updateAgentCreditLimit.method,
|
|
89
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.updateAgentCreditLimit.queryParams),
|
|
90
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.updateAgentCreditLimit.bodyParams),
|
|
91
|
+
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
/**
|
|
95
|
+
* Update an agent's status
|
|
96
|
+
*/
|
|
97
|
+
updateStatus: (args) => {
|
|
98
|
+
this.warnUnknownParams(args, api_endpoints_1.updateAgentStatus);
|
|
99
|
+
return this.request({
|
|
100
|
+
path: api_endpoints_1.updateAgentStatus.path(args),
|
|
101
|
+
method: api_endpoints_1.updateAgentStatus.method,
|
|
102
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.updateAgentStatus.queryParams),
|
|
103
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.updateAgentStatus.bodyParams),
|
|
104
|
+
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
/**
|
|
108
|
+
* Delete an agent
|
|
109
|
+
*/
|
|
110
|
+
delete: (args) => {
|
|
111
|
+
this.warnUnknownParams(args, api_endpoints_1.deleteAgent);
|
|
112
|
+
return this.request({
|
|
113
|
+
path: api_endpoints_1.deleteAgent.path(args),
|
|
114
|
+
method: api_endpoints_1.deleteAgent.method,
|
|
115
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.deleteAgent.queryParams),
|
|
116
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.deleteAgent.bodyParams),
|
|
117
|
+
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* Apply many agent operations
|
|
122
|
+
*/
|
|
123
|
+
batch: (args) => {
|
|
124
|
+
this.warnUnknownParams(args, api_endpoints_1.agentBatch);
|
|
125
|
+
return this.request({
|
|
126
|
+
path: api_endpoints_1.agentBatch.path(),
|
|
127
|
+
method: api_endpoints_1.agentBatch.method,
|
|
128
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.agentBatch.queryParams),
|
|
129
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.agentBatch.bodyParams),
|
|
130
|
+
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
this.sessions = {
|
|
135
|
+
/**
|
|
136
|
+
* Retrieve a session
|
|
137
|
+
*/
|
|
138
|
+
retrieve: (args) => {
|
|
139
|
+
this.warnUnknownParams(args, api_endpoints_1.retrieveSession);
|
|
140
|
+
return this.request({
|
|
141
|
+
path: api_endpoints_1.retrieveSession.path(args),
|
|
142
|
+
method: api_endpoints_1.retrieveSession.method,
|
|
143
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.retrieveSession.queryParams),
|
|
144
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.retrieveSession.bodyParams),
|
|
145
|
+
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
/**
|
|
149
|
+
* Update a session
|
|
150
|
+
*/
|
|
151
|
+
update: (args) => {
|
|
152
|
+
this.warnUnknownParams(args, api_endpoints_1.updateSession);
|
|
153
|
+
return this.request({
|
|
154
|
+
path: api_endpoints_1.updateSession.path(),
|
|
155
|
+
method: api_endpoints_1.updateSession.method,
|
|
156
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.updateSession.queryParams),
|
|
157
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.updateSession.bodyParams),
|
|
158
|
+
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
159
|
+
});
|
|
160
|
+
},
|
|
161
|
+
/**
|
|
162
|
+
* Open a session stream
|
|
163
|
+
*/
|
|
164
|
+
stream: (args) => {
|
|
165
|
+
this.warnUnknownParams(args, api_endpoints_1.updateSessionStream);
|
|
166
|
+
return this.streamRequest({
|
|
167
|
+
path: api_endpoints_1.updateSessionStream.path(),
|
|
168
|
+
method: api_endpoints_1.updateSessionStream.method,
|
|
169
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.updateSessionStream.queryParams),
|
|
170
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.updateSessionStream.bodyParams),
|
|
171
|
+
headers: api_endpoints_1.updateSessionStream.headers,
|
|
172
|
+
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
173
|
+
}, parseSessionStreamEvent);
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* Cancel a session
|
|
177
|
+
*/
|
|
178
|
+
cancel: (args) => {
|
|
179
|
+
this.warnUnknownParams(args, api_endpoints_1.cancelSession);
|
|
180
|
+
return this.request({
|
|
181
|
+
path: api_endpoints_1.cancelSession.path(args),
|
|
182
|
+
method: api_endpoints_1.cancelSession.method,
|
|
183
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.cancelSession.queryParams),
|
|
184
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.cancelSession.bodyParams),
|
|
185
|
+
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
186
|
+
});
|
|
187
|
+
},
|
|
188
|
+
/**
|
|
189
|
+
* Query sessions
|
|
190
|
+
*/
|
|
191
|
+
query: (args) => {
|
|
192
|
+
this.warnUnknownParams(args, api_endpoints_1.querySessions);
|
|
193
|
+
return this.request({
|
|
194
|
+
path: api_endpoints_1.querySessions.path(),
|
|
195
|
+
method: api_endpoints_1.querySessions.method,
|
|
196
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.querySessions.queryParams),
|
|
197
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.querySessions.bodyParams),
|
|
198
|
+
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
199
|
+
});
|
|
200
|
+
},
|
|
201
|
+
/**
|
|
202
|
+
* Query session events
|
|
203
|
+
*/
|
|
204
|
+
queryEvents: (args) => {
|
|
205
|
+
this.warnUnknownParams(args, api_endpoints_1.querySessionEvents);
|
|
206
|
+
return this.request({
|
|
207
|
+
path: api_endpoints_1.querySessionEvents.path(args),
|
|
208
|
+
method: api_endpoints_1.querySessionEvents.method,
|
|
209
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.querySessionEvents.queryParams),
|
|
210
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.querySessionEvents.bodyParams),
|
|
211
|
+
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
212
|
+
});
|
|
213
|
+
},
|
|
214
|
+
};
|
|
41
215
|
this.asyncTasks = {
|
|
42
216
|
/**
|
|
43
217
|
* Retrieve an async task
|
|
@@ -769,7 +943,76 @@ class Client {
|
|
|
769
943
|
path,
|
|
770
944
|
headers,
|
|
771
945
|
body: bodyAsJsonString !== null && bodyAsJsonString !== void 0 ? bodyAsJsonString : formData,
|
|
772
|
-
});
|
|
946
|
+
}, request => this.executeSingleRequest(request));
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* Opens an SSE response and yields each parsed event as it arrives.
|
|
950
|
+
*/
|
|
951
|
+
async *streamRequest(args, parseEvent) {
|
|
952
|
+
var _a;
|
|
953
|
+
const { path, method, query, body, auth } = args;
|
|
954
|
+
(0, errors_1.validateRequestPath)(path);
|
|
955
|
+
this.log(logging_1.LogLevel.INFO, "stream request start", { method, path });
|
|
956
|
+
const url = this.buildRequestUrl(path, query);
|
|
957
|
+
const bodyAsJsonString = this.serializeBody(body);
|
|
958
|
+
const headers = this.buildRequestHeaders(args.headers, auth, bodyAsJsonString);
|
|
959
|
+
const response = await this.executeWithRetry({
|
|
960
|
+
url,
|
|
961
|
+
method,
|
|
962
|
+
path,
|
|
963
|
+
headers,
|
|
964
|
+
body: bodyAsJsonString,
|
|
965
|
+
}, request => this.executeSingleStreamRequest(request));
|
|
966
|
+
this.log(logging_1.LogLevel.INFO, "stream request opened", { method, path });
|
|
967
|
+
if (response.body === undefined || response.body === null) {
|
|
968
|
+
for (const frame of takeSseFrames({
|
|
969
|
+
content: await response.text(),
|
|
970
|
+
complete: true,
|
|
971
|
+
}).frames) {
|
|
972
|
+
yield parseEvent(frame);
|
|
973
|
+
}
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
const reader = response.body.getReader();
|
|
977
|
+
const decoder = new TextDecoder();
|
|
978
|
+
let remaining = "";
|
|
979
|
+
let complete = false;
|
|
980
|
+
try {
|
|
981
|
+
while (!complete) {
|
|
982
|
+
const { done, value } = await reader.read();
|
|
983
|
+
if (done) {
|
|
984
|
+
complete = true;
|
|
985
|
+
continue;
|
|
986
|
+
}
|
|
987
|
+
if (value === undefined) {
|
|
988
|
+
throw new Error("SSE response body ended without a data chunk.");
|
|
989
|
+
}
|
|
990
|
+
const frames = takeSseFrames({
|
|
991
|
+
content: `${remaining}${decoder.decode(value, { stream: true })}`,
|
|
992
|
+
complete: false,
|
|
993
|
+
});
|
|
994
|
+
remaining = frames.remaining;
|
|
995
|
+
for (const frame of frames.frames) {
|
|
996
|
+
yield parseEvent(frame);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
for (const frame of takeSseFrames({
|
|
1000
|
+
content: `${remaining}${decoder.decode()}`,
|
|
1001
|
+
complete: true,
|
|
1002
|
+
}).frames) {
|
|
1003
|
+
yield parseEvent(frame);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
finally {
|
|
1007
|
+
try {
|
|
1008
|
+
if (!complete) {
|
|
1009
|
+
await ((_a = reader.cancel) === null || _a === void 0 ? void 0 : _a.call(reader));
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
finally {
|
|
1013
|
+
reader.releaseLock();
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
773
1016
|
}
|
|
774
1017
|
/**
|
|
775
1018
|
* Builds the full URL with query parameters.
|
|
@@ -862,13 +1105,13 @@ class Client {
|
|
|
862
1105
|
/**
|
|
863
1106
|
* Executes the request with retry logic.
|
|
864
1107
|
*/
|
|
865
|
-
async executeWithRetry(args) {
|
|
1108
|
+
async executeWithRetry(args, execute) {
|
|
866
1109
|
const { url, method, path, headers, body } = args;
|
|
867
1110
|
let attempt = 0;
|
|
868
1111
|
// eslint-disable-next-line no-constant-condition
|
|
869
1112
|
while (true) {
|
|
870
1113
|
try {
|
|
871
|
-
return await
|
|
1114
|
+
return await execute({
|
|
872
1115
|
url,
|
|
873
1116
|
method,
|
|
874
1117
|
path,
|
|
@@ -920,6 +1163,24 @@ class Client {
|
|
|
920
1163
|
});
|
|
921
1164
|
return responseJson;
|
|
922
1165
|
}
|
|
1166
|
+
/**
|
|
1167
|
+
* Opens an SSE response without consuming its body. Retry orchestration is
|
|
1168
|
+
* shared with JSON requests so only the initial, retryable HTTP failures are
|
|
1169
|
+
* retried; once a stream has opened, its events are never replayed.
|
|
1170
|
+
*/
|
|
1171
|
+
async executeSingleStreamRequest(args) {
|
|
1172
|
+
const { url, method, body } = args;
|
|
1173
|
+
const response = await errors_1.RequestTimeoutError.rejectAfterTimeout(__classPrivateFieldGet(this, _Client_fetch, "f").call(this, url.toString(), {
|
|
1174
|
+
method: method.toUpperCase(),
|
|
1175
|
+
headers: args.headers,
|
|
1176
|
+
body,
|
|
1177
|
+
agent: __classPrivateFieldGet(this, _Client_agent, "f"),
|
|
1178
|
+
}), __classPrivateFieldGet(this, _Client_timeoutMs, "f"));
|
|
1179
|
+
if (!response.ok) {
|
|
1180
|
+
throw (0, errors_1.buildRequestError)(response, await response.text());
|
|
1181
|
+
}
|
|
1182
|
+
return response;
|
|
1183
|
+
}
|
|
923
1184
|
/**
|
|
924
1185
|
* Logs a request error with appropriate detail level.
|
|
925
1186
|
*/
|
|
@@ -1071,4 +1332,72 @@ class Client {
|
|
|
1071
1332
|
_Client_auth = new WeakMap(), _Client_logLevel = new WeakMap(), _Client_logger = new WeakMap(), _Client_prefixUrl = new WeakMap(), _Client_timeoutMs = new WeakMap(), _Client_notionVersion = new WeakMap(), _Client_fetch = new WeakMap(), _Client_agent = new WeakMap(), _Client_userAgent = new WeakMap(), _Client_maxRetries = new WeakMap(), _Client_initialRetryDelayMs = new WeakMap(), _Client_maxRetryDelayMs = new WeakMap();
|
|
1072
1333
|
Client.defaultNotionVersion = "2025-09-03";
|
|
1073
1334
|
exports.default = Client;
|
|
1335
|
+
const sessionStreamEventTypes = new Set([
|
|
1336
|
+
"session.snapshot",
|
|
1337
|
+
"event.provisional",
|
|
1338
|
+
"event.committed",
|
|
1339
|
+
"stream.timeout",
|
|
1340
|
+
"stream.end",
|
|
1341
|
+
"stream.error",
|
|
1342
|
+
]);
|
|
1343
|
+
function takeSseFrames(args) {
|
|
1344
|
+
const frames = [];
|
|
1345
|
+
let remaining = args.content.replace(/\r\n/g, "\n");
|
|
1346
|
+
let boundary = remaining.indexOf("\n\n");
|
|
1347
|
+
while (boundary !== -1) {
|
|
1348
|
+
const frame = parseSseFrame(remaining.slice(0, boundary));
|
|
1349
|
+
if (frame !== undefined) {
|
|
1350
|
+
frames.push(frame);
|
|
1351
|
+
}
|
|
1352
|
+
remaining = remaining.slice(boundary + 2);
|
|
1353
|
+
boundary = remaining.indexOf("\n\n");
|
|
1354
|
+
}
|
|
1355
|
+
if (args.complete && remaining !== "") {
|
|
1356
|
+
const frame = parseSseFrame(remaining);
|
|
1357
|
+
if (frame !== undefined) {
|
|
1358
|
+
frames.push(frame);
|
|
1359
|
+
}
|
|
1360
|
+
remaining = "";
|
|
1361
|
+
}
|
|
1362
|
+
return { frames, remaining };
|
|
1363
|
+
}
|
|
1364
|
+
function parseSseFrame(content) {
|
|
1365
|
+
let eventName;
|
|
1366
|
+
const dataLines = [];
|
|
1367
|
+
for (const line of content.split("\n")) {
|
|
1368
|
+
if (line.startsWith(":")) {
|
|
1369
|
+
continue;
|
|
1370
|
+
}
|
|
1371
|
+
const colonIndex = line.indexOf(":");
|
|
1372
|
+
if (colonIndex === -1) {
|
|
1373
|
+
continue;
|
|
1374
|
+
}
|
|
1375
|
+
const field = line.slice(0, colonIndex);
|
|
1376
|
+
const valueStart = line.charAt(colonIndex + 1) === " " ? colonIndex + 2 : colonIndex + 1;
|
|
1377
|
+
const value = line.slice(valueStart);
|
|
1378
|
+
if (field === "event") {
|
|
1379
|
+
eventName = value;
|
|
1380
|
+
}
|
|
1381
|
+
else if (field === "data") {
|
|
1382
|
+
dataLines.push(value);
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
if (dataLines.length === 0) {
|
|
1386
|
+
return undefined;
|
|
1387
|
+
}
|
|
1388
|
+
if (eventName === undefined) {
|
|
1389
|
+
throw new Error("Session stream event is missing its SSE event name.");
|
|
1390
|
+
}
|
|
1391
|
+
return { eventName, data: dataLines.join("\n") };
|
|
1392
|
+
}
|
|
1393
|
+
function parseSessionStreamEvent(frame) {
|
|
1394
|
+
const event = JSON.parse(frame.data);
|
|
1395
|
+
if (typeof event !== "object" ||
|
|
1396
|
+
event === null ||
|
|
1397
|
+
!sessionStreamEventTypes.has(event.type) ||
|
|
1398
|
+
event.type !== frame.eventName) {
|
|
1399
|
+
throw new Error("Session stream event does not match its SSE event name.");
|
|
1400
|
+
}
|
|
1401
|
+
return event;
|
|
1402
|
+
}
|
|
1074
1403
|
//# sourceMappingURL=Client.js.map
|