@superdurable/connector-notion 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +18 -2
- package/dex-connector.json +206 -0
- package/dist/chunk-LZTWSFD4.js +390 -0
- package/dist/connection-CFdIOEsZ.d.ts +762 -0
- package/dist/index.d.ts +352 -0
- package/dist/index.js +1187 -0
- package/dist/mock.d.ts +159 -0
- package/dist/mock.js +381 -0
- package/package.json +58 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { C as CreatePageInput, a as CreatePageOutput, b as Connection, G as GetPageInput, c as GetPageOutput, Q as QueryDatabaseInput, d as QueryDatabaseOutput, S as SearchInput, e as SearchOutput, U as UpdatePagePropertiesInput, f as UpdatePagePropertiesOutput, O as Operations, g as Config, h as Credentials } from './connection-CFdIOEsZ.js';
|
|
2
|
+
export { i as ConfigSchema, j as CreatePageInputSchema, k as CreatePageOutputSchema, l as CredentialSource, D as DateRange, m as DateRangeSchema, n as GetPageInputSchema, o as GetPageOutputSchema, P as Page, p as PageContent, q as PageContentSchema, r as PageProperty, s as PagePropertySchema, t as PageSchema, u as Parent, v as ParentSchema, w as PropertyValue, x as PropertyValueSchema, y as QueryDatabaseInputSchema, z as QueryDatabaseOutputSchema, A as QueryFilter, B as QueryFilterSchema, E as QuerySort, F as QuerySortSchema, H as SearchInputSchema, I as SearchMatch, J as SearchMatchSchema, K as SearchOutputSchema, L as UpdatePagePropertiesInputSchema, M as UpdatePagePropertiesOutputSchema, N as decodeCredentials, R as newConnection, T as newConnectionWithOperations } from './connection-CFdIOEsZ.js';
|
|
3
|
+
import * as _superdurable_connectors_sdk from '@superdurable/connectors-sdk';
|
|
4
|
+
import { MutationDefinition, QueryDefinition, MutationStepConfig, Mutation, MutationResult, QueryStepConfig, Query, QueryResult, MutationStep, QueryStep, Call, QueryAttempt, MutationAttempt, CredentialProvider, ReceiptDraft, Failure } from '@superdurable/connectors-sdk';
|
|
5
|
+
import { StepTarget } from '@superdurable/dex';
|
|
6
|
+
import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
|
|
7
|
+
import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
|
|
8
|
+
import 'zod';
|
|
9
|
+
|
|
10
|
+
/** Stable connector identity. */
|
|
11
|
+
declare const ConnectorID = "notion";
|
|
12
|
+
/** Provider identity for named connections. */
|
|
13
|
+
declare const ProviderID = "notion";
|
|
14
|
+
/** Branch IDs for search. */
|
|
15
|
+
declare const SearchBranch: {
|
|
16
|
+
readonly Searched: "searched";
|
|
17
|
+
readonly NoMatch: "noMatch";
|
|
18
|
+
readonly ProviderRejected: "providerRejected";
|
|
19
|
+
readonly InvalidResponse: "invalidResponse";
|
|
20
|
+
readonly Defect: "defect";
|
|
21
|
+
};
|
|
22
|
+
/** One page of title matches was read; Notion search matches titles only, is not guaranteed to be exhaustive, and indexes new pages with a delay. */
|
|
23
|
+
declare const SearchBranchSearched: "searched";
|
|
24
|
+
/** The first page of results is empty: no shared page or data source title contains the query, or the object was never shared with the connection. */
|
|
25
|
+
declare const SearchBranchNoMatch: "noMatch";
|
|
26
|
+
/** Notion conclusively rejected the search, such as an invalid token, a stale cursor, or a blocked connection. */
|
|
27
|
+
declare const SearchBranchProviderRejected: "providerRejected";
|
|
28
|
+
/** Notion returned an invalid or oversized search page. */
|
|
29
|
+
declare const SearchBranchInvalidResponse: "invalidResponse";
|
|
30
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
31
|
+
declare const SearchBranchDefect: "defect";
|
|
32
|
+
/** Manifest definition for search. */
|
|
33
|
+
declare const SearchDefinition: QueryDefinition;
|
|
34
|
+
/** Manifest metadata for search. */
|
|
35
|
+
declare const SearchMetadata: {
|
|
36
|
+
readonly kind: "query";
|
|
37
|
+
readonly idempotency: "none";
|
|
38
|
+
readonly authorization: "required";
|
|
39
|
+
};
|
|
40
|
+
/** Branch IDs for queryDatabase. */
|
|
41
|
+
declare const QueryDatabaseBranch: {
|
|
42
|
+
readonly Queried: "queried";
|
|
43
|
+
readonly NotFound: "notFound";
|
|
44
|
+
readonly ProviderRejected: "providerRejected";
|
|
45
|
+
readonly InvalidResponse: "invalidResponse";
|
|
46
|
+
readonly Defect: "defect";
|
|
47
|
+
};
|
|
48
|
+
/** One page of matching rows was read; it can be empty. */
|
|
49
|
+
declare const QueryDatabaseBranchQueried: "queried";
|
|
50
|
+
/** The database or data source does not exist or is not shared with the connection. */
|
|
51
|
+
declare const QueryDatabaseBranchNotFound: "notFound";
|
|
52
|
+
/** Notion conclusively rejected the query, such as a filter on a missing property or a type mismatch. */
|
|
53
|
+
declare const QueryDatabaseBranchProviderRejected: "providerRejected";
|
|
54
|
+
/** Notion returned an invalid or oversized query page. */
|
|
55
|
+
declare const QueryDatabaseBranchInvalidResponse: "invalidResponse";
|
|
56
|
+
/** Local input, connection configuration, or connector definition is invalid, including a database ID whose database holds several data sources. */
|
|
57
|
+
declare const QueryDatabaseBranchDefect: "defect";
|
|
58
|
+
/** Manifest definition for queryDatabase. */
|
|
59
|
+
declare const QueryDatabaseDefinition: QueryDefinition;
|
|
60
|
+
/** Manifest metadata for queryDatabase. */
|
|
61
|
+
declare const QueryDatabaseMetadata: {
|
|
62
|
+
readonly kind: "query";
|
|
63
|
+
readonly idempotency: "none";
|
|
64
|
+
readonly authorization: "required";
|
|
65
|
+
};
|
|
66
|
+
/** Branch IDs for getPage. */
|
|
67
|
+
declare const GetPageBranch: {
|
|
68
|
+
readonly Found: "found";
|
|
69
|
+
readonly NotFound: "notFound";
|
|
70
|
+
readonly ProviderRejected: "providerRejected";
|
|
71
|
+
readonly InvalidResponse: "invalidResponse";
|
|
72
|
+
readonly Defect: "defect";
|
|
73
|
+
};
|
|
74
|
+
/** The page and its bounded content were read. */
|
|
75
|
+
declare const GetPageBranchFound: "found";
|
|
76
|
+
/** The page does not exist or is not shared with the connection. */
|
|
77
|
+
declare const GetPageBranchNotFound: "notFound";
|
|
78
|
+
/** Notion conclusively rejected the page read. */
|
|
79
|
+
declare const GetPageBranchProviderRejected: "providerRejected";
|
|
80
|
+
/** Notion returned an invalid or oversized page or block list. */
|
|
81
|
+
declare const GetPageBranchInvalidResponse: "invalidResponse";
|
|
82
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
83
|
+
declare const GetPageBranchDefect: "defect";
|
|
84
|
+
/** Manifest definition for getPage. */
|
|
85
|
+
declare const GetPageDefinition: QueryDefinition;
|
|
86
|
+
/** Manifest metadata for getPage. */
|
|
87
|
+
declare const GetPageMetadata: {
|
|
88
|
+
readonly kind: "query";
|
|
89
|
+
readonly idempotency: "none";
|
|
90
|
+
readonly authorization: "required";
|
|
91
|
+
};
|
|
92
|
+
/** Branch IDs for createPage. */
|
|
93
|
+
declare const CreatePageBranch: {
|
|
94
|
+
readonly Created: "created";
|
|
95
|
+
readonly NotFound: "notFound";
|
|
96
|
+
readonly ProviderRejected: "providerRejected";
|
|
97
|
+
readonly Uncertain: "uncertain";
|
|
98
|
+
readonly InvalidResponse: "invalidResponse";
|
|
99
|
+
readonly Defect: "defect";
|
|
100
|
+
};
|
|
101
|
+
/** Notion created the page and returned or confirmed its ID. */
|
|
102
|
+
declare const CreatePageBranchCreated: "created";
|
|
103
|
+
/** The database or data source does not exist or is not shared with the connection; nothing was created. */
|
|
104
|
+
declare const CreatePageBranchNotFound: "notFound";
|
|
105
|
+
/** Notion conclusively rejected the page, such as a missing property, a value of the wrong type, missing Insert content capability, or a workspace limit; nothing was created. */
|
|
106
|
+
declare const CreatePageBranchProviderRejected: "providerRejected";
|
|
107
|
+
/** The request was dispatched but its outcome cannot be confirmed; Notion has no idempotency key, so the page may exist and must not be created again automatically. */
|
|
108
|
+
declare const CreatePageBranchUncertain: "uncertain";
|
|
109
|
+
/** Notion returned an invalid or oversized database while the connector resolved its data source; nothing was created. */
|
|
110
|
+
declare const CreatePageBranchInvalidResponse: "invalidResponse";
|
|
111
|
+
/** Local input, credential authorization, or connector definition is invalid, including a database ID whose database holds several data sources. */
|
|
112
|
+
declare const CreatePageBranchDefect: "defect";
|
|
113
|
+
/** Manifest definition for createPage. */
|
|
114
|
+
declare const CreatePageDefinition: MutationDefinition;
|
|
115
|
+
/** Manifest metadata for createPage. */
|
|
116
|
+
declare const CreatePageMetadata: {
|
|
117
|
+
readonly kind: "mutation";
|
|
118
|
+
readonly idempotency: "required";
|
|
119
|
+
readonly authorization: "required";
|
|
120
|
+
};
|
|
121
|
+
/** Branch IDs for updatePageProperties. */
|
|
122
|
+
declare const UpdatePagePropertiesBranch: {
|
|
123
|
+
readonly Updated: "updated";
|
|
124
|
+
readonly NotFound: "notFound";
|
|
125
|
+
readonly ProviderRejected: "providerRejected";
|
|
126
|
+
readonly InvalidResponse: "invalidResponse";
|
|
127
|
+
readonly Defect: "defect";
|
|
128
|
+
};
|
|
129
|
+
/** Notion applied the property values and returned the page. */
|
|
130
|
+
declare const UpdatePagePropertiesBranchUpdated: "updated";
|
|
131
|
+
/** The page does not exist or is not shared with the connection; nothing was changed. */
|
|
132
|
+
declare const UpdatePagePropertiesBranchNotFound: "notFound";
|
|
133
|
+
/** Notion conclusively rejected the update, such as a missing property, a value of the wrong type, a locked or archived page, or missing Update content capability. */
|
|
134
|
+
declare const UpdatePagePropertiesBranchProviderRejected: "providerRejected";
|
|
135
|
+
/** Notion applied the update but returned an invalid or oversized page. */
|
|
136
|
+
declare const UpdatePagePropertiesBranchInvalidResponse: "invalidResponse";
|
|
137
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
138
|
+
declare const UpdatePagePropertiesBranchDefect: "defect";
|
|
139
|
+
/** Manifest definition for updatePageProperties. */
|
|
140
|
+
declare const UpdatePagePropertiesDefinition: MutationDefinition;
|
|
141
|
+
/** Manifest metadata for updatePageProperties. */
|
|
142
|
+
declare const UpdatePagePropertiesMetadata: {
|
|
143
|
+
readonly kind: "mutation";
|
|
144
|
+
readonly idempotency: "required";
|
|
145
|
+
readonly authorization: "required";
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/** Configuration for the search connector Step. */
|
|
149
|
+
interface SearchStepConfig<StepInput, OperationInput = SearchInput, OperationOutput = SearchOutput> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
150
|
+
/** Named connection supplying this operation. */
|
|
151
|
+
connection: Connection<{
|
|
152
|
+
search(): Query<OperationInput, OperationOutput>;
|
|
153
|
+
}>;
|
|
154
|
+
/** Name matching the bound connection. */
|
|
155
|
+
connectionName: string;
|
|
156
|
+
/** One page of title matches was read; Notion search matches titles only, is not guaranteed to be exhaustive, and indexes new pages with a delay. */
|
|
157
|
+
searched: StepTarget<QueryResult<OperationOutput>>;
|
|
158
|
+
/** The first page of results is empty: no shared page or data source title contains the query, or the object was never shared with the connection. */
|
|
159
|
+
noMatch?: StepTarget<QueryResult<OperationOutput>>;
|
|
160
|
+
/** Notion conclusively rejected the search, such as an invalid token, a stale cursor, or a blocked connection. */
|
|
161
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
162
|
+
/** Notion returned an invalid or oversized search page. */
|
|
163
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
164
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
165
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
166
|
+
}
|
|
167
|
+
/** Build the search Step from a named connection. */
|
|
168
|
+
declare function newSearchStep<StepInput, OperationInput = SearchInput, OperationOutput = SearchOutput>(configuration: SearchStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
169
|
+
/** Configuration for the queryDatabase connector Step. */
|
|
170
|
+
interface QueryDatabaseStepConfig<StepInput, OperationInput = QueryDatabaseInput, OperationOutput = QueryDatabaseOutput> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
171
|
+
/** Named connection supplying this operation. */
|
|
172
|
+
connection: Connection<{
|
|
173
|
+
queryDatabase(): Query<OperationInput, OperationOutput>;
|
|
174
|
+
}>;
|
|
175
|
+
/** Name matching the bound connection. */
|
|
176
|
+
connectionName: string;
|
|
177
|
+
/** One page of matching rows was read; it can be empty. */
|
|
178
|
+
queried: StepTarget<QueryResult<OperationOutput>>;
|
|
179
|
+
/** The database or data source does not exist or is not shared with the connection. */
|
|
180
|
+
notFound?: StepTarget<QueryResult<OperationOutput>>;
|
|
181
|
+
/** Notion conclusively rejected the query, such as a filter on a missing property or a type mismatch. */
|
|
182
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
183
|
+
/** Notion returned an invalid or oversized query page. */
|
|
184
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
185
|
+
/** Local input, connection configuration, or connector definition is invalid, including a database ID whose database holds several data sources. */
|
|
186
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
187
|
+
}
|
|
188
|
+
/** Build the queryDatabase Step from a named connection. */
|
|
189
|
+
declare function newQueryDatabaseStep<StepInput, OperationInput = QueryDatabaseInput, OperationOutput = QueryDatabaseOutput>(configuration: QueryDatabaseStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
190
|
+
/** Configuration for the getPage connector Step. */
|
|
191
|
+
interface GetPageStepConfig<StepInput, OperationInput = GetPageInput, OperationOutput = GetPageOutput> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
192
|
+
/** Named connection supplying this operation. */
|
|
193
|
+
connection: Connection<{
|
|
194
|
+
getPage(): Query<OperationInput, OperationOutput>;
|
|
195
|
+
}>;
|
|
196
|
+
/** Name matching the bound connection. */
|
|
197
|
+
connectionName: string;
|
|
198
|
+
/** The page and its bounded content were read. */
|
|
199
|
+
found: StepTarget<QueryResult<OperationOutput>>;
|
|
200
|
+
/** The page does not exist or is not shared with the connection. */
|
|
201
|
+
notFound?: StepTarget<QueryResult<OperationOutput>>;
|
|
202
|
+
/** Notion conclusively rejected the page read. */
|
|
203
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
204
|
+
/** Notion returned an invalid or oversized page or block list. */
|
|
205
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
206
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
207
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
208
|
+
}
|
|
209
|
+
/** Build the getPage Step from a named connection. */
|
|
210
|
+
declare function newGetPageStep<StepInput, OperationInput = GetPageInput, OperationOutput = GetPageOutput>(configuration: GetPageStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
211
|
+
/** Configuration for the createPage connector Step. */
|
|
212
|
+
interface CreatePageStepConfig<StepInput, OperationInput = CreatePageInput, OperationOutput = CreatePageOutput> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
213
|
+
/** Named connection supplying this operation. */
|
|
214
|
+
connection: Connection<{
|
|
215
|
+
createPage(): Mutation<OperationInput, OperationOutput>;
|
|
216
|
+
}>;
|
|
217
|
+
/** Name matching the bound connection. */
|
|
218
|
+
connectionName: string;
|
|
219
|
+
/** Notion created the page and returned or confirmed its ID. */
|
|
220
|
+
created: StepTarget<MutationResult<OperationOutput>>;
|
|
221
|
+
/** The database or data source does not exist or is not shared with the connection; nothing was created. */
|
|
222
|
+
notFound?: StepTarget<MutationResult<OperationOutput>>;
|
|
223
|
+
/** Notion conclusively rejected the page, such as a missing property, a value of the wrong type, missing Insert content capability, or a workspace limit; nothing was created. */
|
|
224
|
+
providerRejected?: StepTarget<MutationResult<OperationOutput>>;
|
|
225
|
+
/** The request was dispatched but its outcome cannot be confirmed; Notion has no idempotency key, so the page may exist and must not be created again automatically. */
|
|
226
|
+
uncertain?: StepTarget<MutationResult<OperationOutput>>;
|
|
227
|
+
/** Notion returned an invalid or oversized database while the connector resolved its data source; nothing was created. */
|
|
228
|
+
invalidResponse?: StepTarget<MutationResult<OperationOutput>>;
|
|
229
|
+
/** Local input, credential authorization, or connector definition is invalid, including a database ID whose database holds several data sources. */
|
|
230
|
+
defect?: StepTarget<MutationResult<OperationOutput>>;
|
|
231
|
+
}
|
|
232
|
+
/** Build the createPage Step from a named connection. */
|
|
233
|
+
declare function newCreatePageStep<StepInput, OperationInput = CreatePageInput, OperationOutput = CreatePageOutput>(configuration: CreatePageStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
|
|
234
|
+
/** Configuration for the updatePageProperties connector Step. */
|
|
235
|
+
interface UpdatePagePropertiesStepConfig<StepInput, OperationInput = UpdatePagePropertiesInput, OperationOutput = UpdatePagePropertiesOutput> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
236
|
+
/** Named connection supplying this operation. */
|
|
237
|
+
connection: Connection<{
|
|
238
|
+
updatePageProperties(): Mutation<OperationInput, OperationOutput>;
|
|
239
|
+
}>;
|
|
240
|
+
/** Name matching the bound connection. */
|
|
241
|
+
connectionName: string;
|
|
242
|
+
/** Notion applied the property values and returned the page. */
|
|
243
|
+
updated: StepTarget<MutationResult<OperationOutput>>;
|
|
244
|
+
/** The page does not exist or is not shared with the connection; nothing was changed. */
|
|
245
|
+
notFound?: StepTarget<MutationResult<OperationOutput>>;
|
|
246
|
+
/** Notion conclusively rejected the update, such as a missing property, a value of the wrong type, a locked or archived page, or missing Update content capability. */
|
|
247
|
+
providerRejected?: StepTarget<MutationResult<OperationOutput>>;
|
|
248
|
+
/** Notion applied the update but returned an invalid or oversized page. */
|
|
249
|
+
invalidResponse?: StepTarget<MutationResult<OperationOutput>>;
|
|
250
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
251
|
+
defect?: StepTarget<MutationResult<OperationOutput>>;
|
|
252
|
+
}
|
|
253
|
+
/** Build the updatePageProperties Step from a named connection. */
|
|
254
|
+
declare function newUpdatePagePropertiesStep<StepInput, OperationInput = UpdatePagePropertiesInput, OperationOutput = UpdatePagePropertiesOutput>(configuration: UpdatePagePropertiesStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
|
|
255
|
+
|
|
256
|
+
/** Open one static Notion connection declared in a Dex project. */
|
|
257
|
+
declare function newProjectConnection(project: LoadedProject, connectionName: string): Connection<Operations>;
|
|
258
|
+
|
|
259
|
+
/** Search shared pages and data sources by title. */
|
|
260
|
+
declare class SearchOperation implements Query<SearchInput, SearchOutput> {
|
|
261
|
+
private readonly client;
|
|
262
|
+
/** Bind one Notion client. */ constructor(client: NotionClient);
|
|
263
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
264
|
+
/** Validate and search one bounded page. */
|
|
265
|
+
invoke(call: Call, input: SearchInput): Promise<QueryAttempt<SearchOutput>>;
|
|
266
|
+
}
|
|
267
|
+
/** Query one bounded page of database rows. */
|
|
268
|
+
declare class QueryDatabaseOperation implements Query<QueryDatabaseInput, QueryDatabaseOutput> {
|
|
269
|
+
private readonly client;
|
|
270
|
+
/** Bind one Notion client. */ constructor(client: NotionClient);
|
|
271
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
272
|
+
/** Resolve the data source and query rows. */
|
|
273
|
+
invoke(call: Call, input: QueryDatabaseInput): Promise<QueryAttempt<QueryDatabaseOutput>>;
|
|
274
|
+
}
|
|
275
|
+
/** Read one page with optional bounded top-level content. */
|
|
276
|
+
declare class GetPageOperation implements Query<GetPageInput, GetPageOutput> {
|
|
277
|
+
private readonly client;
|
|
278
|
+
/** Bind one Notion client. */ constructor(client: NotionClient);
|
|
279
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
280
|
+
/** Read metadata and optionally render block content. */
|
|
281
|
+
invoke(call: Call, input: GetPageInput): Promise<QueryAttempt<GetPageOutput>>;
|
|
282
|
+
}
|
|
283
|
+
/** Create a page through the durable single-dispatch fence. */
|
|
284
|
+
declare class CreatePageOperation implements Mutation<CreatePageInput, CreatePageOutput> {
|
|
285
|
+
private readonly client;
|
|
286
|
+
/** Bind one Notion client. */ constructor(client: NotionClient);
|
|
287
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
288
|
+
/** Record the stable call identity without sending it to Notion. */ idempotencyKey(callId: string): string;
|
|
289
|
+
/** Never repeat a write that may have reached Notion. */
|
|
290
|
+
invoke(call: Call, input: CreatePageInput): Promise<MutationAttempt<CreatePageOutput>>;
|
|
291
|
+
private confirmPage;
|
|
292
|
+
}
|
|
293
|
+
/** Replace named page properties with absolute values. */
|
|
294
|
+
declare class UpdatePagePropertiesOperation implements Mutation<UpdatePagePropertiesInput, UpdatePagePropertiesOutput> {
|
|
295
|
+
private readonly client;
|
|
296
|
+
/** Bind one Notion client. */ constructor(client: NotionClient);
|
|
297
|
+
/** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
298
|
+
/** Repeating absolute values converges on the same page state. */ idempotencyKey(callId: string): string;
|
|
299
|
+
/** Validate and send one repeat-safe update. */
|
|
300
|
+
invoke(call: Call, input: UpdatePagePropertiesInput): Promise<MutationAttempt<UpdatePagePropertiesOutput>>;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** Injectable bounded provider sender. */
|
|
304
|
+
type NotionRequestSender = (request: ProviderRequest) => Promise<ProviderResponse>;
|
|
305
|
+
/** One provider exchange, including positive evidence about request dispatch. */
|
|
306
|
+
type NotionExchange = {
|
|
307
|
+
response: ProviderResponse;
|
|
308
|
+
receipt: ReceiptDraft;
|
|
309
|
+
} | {
|
|
310
|
+
failure: Failure;
|
|
311
|
+
disposition: 'retry' | 'notFound' | 'providerRejected' | 'invalidResponse' | 'defect' | 'uncertain' | 'committed';
|
|
312
|
+
retryAfterMs?: number;
|
|
313
|
+
receipt: ReceiptDraft;
|
|
314
|
+
providerId?: string;
|
|
315
|
+
isProvablyNotSent?: boolean;
|
|
316
|
+
};
|
|
317
|
+
/** A classified exchange before any successful response. */
|
|
318
|
+
type NotionExchangeFailure = Extract<NotionExchange, {
|
|
319
|
+
failure: Failure;
|
|
320
|
+
}>;
|
|
321
|
+
/** Replace the network transport in deterministic provider tests. */
|
|
322
|
+
interface NotionClientOptions {
|
|
323
|
+
/** Bounded provider request sender. */ send?: (request: ProviderRequest) => Promise<ProviderResponse>;
|
|
324
|
+
/** Clock for receipt timestamps and Retry-After. */ now?: () => Date;
|
|
325
|
+
}
|
|
326
|
+
/** Notion API client with call-time credential resolution. */
|
|
327
|
+
declare class NotionClient {
|
|
328
|
+
private readonly credentials;
|
|
329
|
+
readonly endpoint: string;
|
|
330
|
+
readonly maxResponseBytes: number;
|
|
331
|
+
private readonly send;
|
|
332
|
+
private readonly now;
|
|
333
|
+
/** Validate the endpoint and required credential source without contacting Notion. */
|
|
334
|
+
constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: NotionClientOptions);
|
|
335
|
+
/** Bind title search. */ search(): SearchOperation;
|
|
336
|
+
/** Bind database row query. */ queryDatabase(): QueryDatabaseOperation;
|
|
337
|
+
/** Bind page read. */ getPage(): GetPageOperation;
|
|
338
|
+
/** Bind single-dispatch page creation. */ createPage(): CreatePageOperation;
|
|
339
|
+
/** Bind absolute page property update. */ updatePageProperties(): UpdatePagePropertiesOperation;
|
|
340
|
+
/** Build a secret-safe receipt. */
|
|
341
|
+
receipt(call: Call, response?: ProviderResponse, providerObjectId?: string): ReceiptDraft;
|
|
342
|
+
/** Resolve a credential before a single-dispatch write is claimed. */
|
|
343
|
+
resolveToken(call: Call, operation: string, signal?: AbortSignal): Promise<{
|
|
344
|
+
token: string;
|
|
345
|
+
} | {
|
|
346
|
+
outcome: NotionExchangeFailure;
|
|
347
|
+
}>;
|
|
348
|
+
/** Send one bounded API request and classify its transport and HTTP outcome. */
|
|
349
|
+
exchange(call: Call, operation: string, subject: string, method: string, path: string, body?: unknown, mode?: 'read' | 'repeatableWrite' | 'unkeyedWrite', signal?: AbortSignal, resolvedToken?: string, providerObjectId?: string): Promise<NotionExchange>;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export { Config, Connection, ConnectorID, CreatePageBranch, CreatePageBranchCreated, CreatePageBranchDefect, CreatePageBranchInvalidResponse, CreatePageBranchNotFound, CreatePageBranchProviderRejected, CreatePageBranchUncertain, CreatePageDefinition, CreatePageInput, CreatePageMetadata, CreatePageOperation, CreatePageOutput, type CreatePageStepConfig, Credentials, GetPageBranch, GetPageBranchDefect, GetPageBranchFound, GetPageBranchInvalidResponse, GetPageBranchNotFound, GetPageBranchProviderRejected, GetPageDefinition, GetPageInput, GetPageMetadata, GetPageOperation, GetPageOutput, type GetPageStepConfig, NotionClient, type NotionClientOptions, type NotionRequestSender, ProviderID, QueryDatabaseBranch, QueryDatabaseBranchDefect, QueryDatabaseBranchInvalidResponse, QueryDatabaseBranchNotFound, QueryDatabaseBranchProviderRejected, QueryDatabaseBranchQueried, QueryDatabaseDefinition, QueryDatabaseInput, QueryDatabaseMetadata, QueryDatabaseOperation, QueryDatabaseOutput, type QueryDatabaseStepConfig, SearchBranch, SearchBranchDefect, SearchBranchInvalidResponse, SearchBranchNoMatch, SearchBranchProviderRejected, SearchBranchSearched, SearchDefinition, SearchInput, SearchMetadata, SearchOperation, SearchOutput, type SearchStepConfig, UpdatePagePropertiesBranch, UpdatePagePropertiesBranchDefect, UpdatePagePropertiesBranchInvalidResponse, UpdatePagePropertiesBranchNotFound, UpdatePagePropertiesBranchProviderRejected, UpdatePagePropertiesBranchUpdated, UpdatePagePropertiesDefinition, UpdatePagePropertiesInput, UpdatePagePropertiesMetadata, UpdatePagePropertiesOperation, UpdatePagePropertiesOutput, type UpdatePagePropertiesStepConfig, newCreatePageStep, newGetPageStep, newProjectConnection, newQueryDatabaseStep, newSearchStep, newUpdatePagePropertiesStep };
|