@superdurable/connector-notion 0.0.0-stage → 0.2.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 +32 -2
- package/dex-connector.json +748 -0
- package/dist/chunk-5TNYF4VH.js +395 -0
- package/dist/connection-C7B_dh-s.d.ts +768 -0
- package/dist/index.d.ts +530 -0
- package/dist/index.js +1804 -0
- package/dist/mock.d.ts +159 -0
- package/dist/mock.js +381 -0
- package/package.json +60 -4
package/dist/mock.d.ts
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { MockQuery, MockMutation, Case } from '@superdurable/connectors-sdk/connectormock';
|
|
2
|
+
import { Failure } from '@superdurable/connectors-sdk';
|
|
3
|
+
import { O as Operations, b as Connection, S as SearchInput, e as SearchOutput, Q as QueryDatabaseInput, d as QueryDatabaseOutput, G as GetPageInput, c as GetPageOutput, C as CreatePageInput, a as CreatePageOutput, U as UpdatePagePropertiesInput, f as UpdatePagePropertiesOutput, D as DateRange, P as Page, p as PageContent, r as PageProperty, u as Parent, w as PropertyValue, A as QueryFilter, E as QuerySort, I as SearchMatch } from './connection-C7B_dh-s.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
|
|
6
|
+
/** Go zero value for SearchInput in scripted cases. */
|
|
7
|
+
declare const emptySearchInput: SearchInput;
|
|
8
|
+
/** Go zero value for Parent in scripted cases. */
|
|
9
|
+
declare const emptyParent: Parent;
|
|
10
|
+
/** Go zero value for SearchMatch in scripted cases. */
|
|
11
|
+
declare const emptySearchMatch: SearchMatch;
|
|
12
|
+
/** Go zero value for SearchOutput in scripted cases. */
|
|
13
|
+
declare const emptySearchOutput: SearchOutput;
|
|
14
|
+
/** Go zero value for QueryFilter in scripted cases. */
|
|
15
|
+
declare const emptyQueryFilter: QueryFilter;
|
|
16
|
+
/** Go zero value for QuerySort in scripted cases. */
|
|
17
|
+
declare const emptyQuerySort: QuerySort;
|
|
18
|
+
/** Go zero value for QueryDatabaseInput in scripted cases. */
|
|
19
|
+
declare const emptyQueryDatabaseInput: QueryDatabaseInput;
|
|
20
|
+
/** Go zero value for DateRange in scripted cases. */
|
|
21
|
+
declare const emptyDateRange: DateRange;
|
|
22
|
+
/** Go zero value for PageProperty in scripted cases. */
|
|
23
|
+
declare const emptyPageProperty: PageProperty;
|
|
24
|
+
/** Go zero value for Page in scripted cases. */
|
|
25
|
+
declare const emptyPage: Page;
|
|
26
|
+
/** Go zero value for QueryDatabaseOutput in scripted cases. */
|
|
27
|
+
declare const emptyQueryDatabaseOutput: QueryDatabaseOutput;
|
|
28
|
+
/** Go zero value for GetPageInput in scripted cases. */
|
|
29
|
+
declare const emptyGetPageInput: GetPageInput;
|
|
30
|
+
/** Go zero value for PageContent in scripted cases. */
|
|
31
|
+
declare const emptyPageContent: PageContent;
|
|
32
|
+
/** Go zero value for GetPageOutput in scripted cases. */
|
|
33
|
+
declare const emptyGetPageOutput: GetPageOutput;
|
|
34
|
+
/** Go zero value for PropertyValue in scripted cases. */
|
|
35
|
+
declare const emptyPropertyValue: PropertyValue;
|
|
36
|
+
/** Go zero value for CreatePageInput in scripted cases. */
|
|
37
|
+
declare const emptyCreatePageInput: CreatePageInput;
|
|
38
|
+
/** Go zero value for CreatePageOutput in scripted cases. */
|
|
39
|
+
declare const emptyCreatePageOutput: CreatePageOutput;
|
|
40
|
+
/** Go zero value for UpdatePagePropertiesInput in scripted cases. */
|
|
41
|
+
declare const emptyUpdatePagePropertiesInput: UpdatePagePropertiesInput;
|
|
42
|
+
/** Go zero value for UpdatePagePropertiesOutput in scripted cases. */
|
|
43
|
+
declare const emptyUpdatePagePropertiesOutput: UpdatePagePropertiesOutput;
|
|
44
|
+
/** Script the searched branch. */
|
|
45
|
+
declare function searchSearched(value: SearchOutput, failure?: Failure): Case<SearchOutput>;
|
|
46
|
+
/** Script the noMatch branch. */
|
|
47
|
+
declare function searchNoMatch(value: SearchOutput, failure?: Failure): Case<SearchOutput>;
|
|
48
|
+
/** Script the providerRejected branch. */
|
|
49
|
+
declare function searchProviderRejected(value: SearchOutput, failure?: Failure): Case<SearchOutput>;
|
|
50
|
+
/** Script the invalidResponse branch. */
|
|
51
|
+
declare function searchInvalidResponse(value: SearchOutput, failure?: Failure): Case<SearchOutput>;
|
|
52
|
+
/** Script the defect branch. */
|
|
53
|
+
declare function searchDefect(value: SearchOutput, failure?: Failure): Case<SearchOutput>;
|
|
54
|
+
/** Script a safe retry of search. */
|
|
55
|
+
declare function searchRetry(failure: Failure, retryAfterMs?: number): Case<SearchOutput>;
|
|
56
|
+
/** Manifest scenario submissionsSearch for search. */
|
|
57
|
+
declare function searchSubmissionsSearch(): Case<SearchOutput>;
|
|
58
|
+
/** Default search scenario. */
|
|
59
|
+
declare function searchDefault(): Case<SearchOutput>;
|
|
60
|
+
/** Manifest scenario noSharedTitle for search. */
|
|
61
|
+
declare function searchNoSharedTitle(): Case<SearchOutput>;
|
|
62
|
+
/** Manifest scenario searchRejected for search. */
|
|
63
|
+
declare function searchSearchRejected(): Case<SearchOutput>;
|
|
64
|
+
/** Script the queried branch. */
|
|
65
|
+
declare function queryDatabaseQueried(value: QueryDatabaseOutput, failure?: Failure): Case<QueryDatabaseOutput>;
|
|
66
|
+
/** Script the notFound branch. */
|
|
67
|
+
declare function queryDatabaseNotFound(value: QueryDatabaseOutput, failure?: Failure): Case<QueryDatabaseOutput>;
|
|
68
|
+
/** Script the providerRejected branch. */
|
|
69
|
+
declare function queryDatabaseProviderRejected(value: QueryDatabaseOutput, failure?: Failure): Case<QueryDatabaseOutput>;
|
|
70
|
+
/** Script the invalidResponse branch. */
|
|
71
|
+
declare function queryDatabaseInvalidResponse(value: QueryDatabaseOutput, failure?: Failure): Case<QueryDatabaseOutput>;
|
|
72
|
+
/** Script the defect branch. */
|
|
73
|
+
declare function queryDatabaseDefect(value: QueryDatabaseOutput, failure?: Failure): Case<QueryDatabaseOutput>;
|
|
74
|
+
/** Script a safe retry of queryDatabase. */
|
|
75
|
+
declare function queryDatabaseRetry(failure: Failure, retryAfterMs?: number): Case<QueryDatabaseOutput>;
|
|
76
|
+
/** Manifest scenario existingSubmission for queryDatabase. */
|
|
77
|
+
declare function queryDatabaseExistingSubmission(): Case<QueryDatabaseOutput>;
|
|
78
|
+
/** Default queryDatabase scenario. */
|
|
79
|
+
declare function queryDatabaseDefault(): Case<QueryDatabaseOutput>;
|
|
80
|
+
/** Manifest scenario dataSourceMissing for queryDatabase. */
|
|
81
|
+
declare function queryDatabaseDataSourceMissing(): Case<QueryDatabaseOutput>;
|
|
82
|
+
/** Manifest scenario queryRejected for queryDatabase. */
|
|
83
|
+
declare function queryDatabaseQueryRejected(): Case<QueryDatabaseOutput>;
|
|
84
|
+
/** Script the found branch. */
|
|
85
|
+
declare function getPageFound(value: GetPageOutput, failure?: Failure): Case<GetPageOutput>;
|
|
86
|
+
/** Script the notFound branch. */
|
|
87
|
+
declare function getPageNotFound(value: GetPageOutput, failure?: Failure): Case<GetPageOutput>;
|
|
88
|
+
/** Script the providerRejected branch. */
|
|
89
|
+
declare function getPageProviderRejected(value: GetPageOutput, failure?: Failure): Case<GetPageOutput>;
|
|
90
|
+
/** Script the invalidResponse branch. */
|
|
91
|
+
declare function getPageInvalidResponse(value: GetPageOutput, failure?: Failure): Case<GetPageOutput>;
|
|
92
|
+
/** Script the defect branch. */
|
|
93
|
+
declare function getPageDefect(value: GetPageOutput, failure?: Failure): Case<GetPageOutput>;
|
|
94
|
+
/** Script a safe retry of getPage. */
|
|
95
|
+
declare function getPageRetry(failure: Failure, retryAfterMs?: number): Case<GetPageOutput>;
|
|
96
|
+
/** Manifest scenario submittedPage for getPage. */
|
|
97
|
+
declare function getPageSubmittedPage(): Case<GetPageOutput>;
|
|
98
|
+
/** Default getPage scenario. */
|
|
99
|
+
declare function getPageDefault(): Case<GetPageOutput>;
|
|
100
|
+
/** Manifest scenario pageMissing for getPage. */
|
|
101
|
+
declare function getPagePageMissing(): Case<GetPageOutput>;
|
|
102
|
+
/** Manifest scenario pageReadRejected for getPage. */
|
|
103
|
+
declare function getPagePageReadRejected(): Case<GetPageOutput>;
|
|
104
|
+
/** Script the created branch. */
|
|
105
|
+
declare function createPageCreated(value: CreatePageOutput, failure?: Failure): Case<CreatePageOutput>;
|
|
106
|
+
/** Script the notFound branch. */
|
|
107
|
+
declare function createPageNotFound(value: CreatePageOutput, failure?: Failure): Case<CreatePageOutput>;
|
|
108
|
+
/** Script the providerRejected branch. */
|
|
109
|
+
declare function createPageProviderRejected(value: CreatePageOutput, failure?: Failure): Case<CreatePageOutput>;
|
|
110
|
+
/** Script the invalidResponse branch. */
|
|
111
|
+
declare function createPageInvalidResponse(value: CreatePageOutput, failure?: Failure): Case<CreatePageOutput>;
|
|
112
|
+
/** Script the defect branch. */
|
|
113
|
+
declare function createPageDefect(value: CreatePageOutput, failure?: Failure): Case<CreatePageOutput>;
|
|
114
|
+
/** Script a safe retry of createPage. */
|
|
115
|
+
declare function createPageRetry(failure: Failure, retryAfterMs?: number): Case<CreatePageOutput>;
|
|
116
|
+
/** Script an uncertain createPage attempt. */
|
|
117
|
+
declare function createPageUncertain(value: CreatePageOutput, failure: Failure): Case<CreatePageOutput>;
|
|
118
|
+
/** Manifest scenario createdSubmission for createPage. */
|
|
119
|
+
declare function createPageCreatedSubmission(): Case<CreatePageOutput>;
|
|
120
|
+
/** Default createPage scenario. */
|
|
121
|
+
declare function createPageDefault(): Case<CreatePageOutput>;
|
|
122
|
+
/** Manifest scenario createSourceMissing for createPage. */
|
|
123
|
+
declare function createPageCreateSourceMissing(): Case<CreatePageOutput>;
|
|
124
|
+
/** Manifest scenario createRejected for createPage. */
|
|
125
|
+
declare function createPageCreateRejected(): Case<CreatePageOutput>;
|
|
126
|
+
/** Script the updated branch. */
|
|
127
|
+
declare function updatePagePropertiesUpdated(value: UpdatePagePropertiesOutput, failure?: Failure): Case<UpdatePagePropertiesOutput>;
|
|
128
|
+
/** Script the notFound branch. */
|
|
129
|
+
declare function updatePagePropertiesNotFound(value: UpdatePagePropertiesOutput, failure?: Failure): Case<UpdatePagePropertiesOutput>;
|
|
130
|
+
/** Script the providerRejected branch. */
|
|
131
|
+
declare function updatePagePropertiesProviderRejected(value: UpdatePagePropertiesOutput, failure?: Failure): Case<UpdatePagePropertiesOutput>;
|
|
132
|
+
/** Script the invalidResponse branch. */
|
|
133
|
+
declare function updatePagePropertiesInvalidResponse(value: UpdatePagePropertiesOutput, failure?: Failure): Case<UpdatePagePropertiesOutput>;
|
|
134
|
+
/** Script the defect branch. */
|
|
135
|
+
declare function updatePagePropertiesDefect(value: UpdatePagePropertiesOutput, failure?: Failure): Case<UpdatePagePropertiesOutput>;
|
|
136
|
+
/** Script a safe retry of updatePageProperties. */
|
|
137
|
+
declare function updatePagePropertiesRetry(failure: Failure, retryAfterMs?: number): Case<UpdatePagePropertiesOutput>;
|
|
138
|
+
/** Manifest scenario updatedSubmission for updatePageProperties. */
|
|
139
|
+
declare function updatePagePropertiesUpdatedSubmission(): Case<UpdatePagePropertiesOutput>;
|
|
140
|
+
/** Default updatePageProperties scenario. */
|
|
141
|
+
declare function updatePagePropertiesDefault(): Case<UpdatePagePropertiesOutput>;
|
|
142
|
+
/** Manifest scenario updatePageMissing for updatePageProperties. */
|
|
143
|
+
declare function updatePagePropertiesUpdatePageMissing(): Case<UpdatePagePropertiesOutput>;
|
|
144
|
+
/** Manifest scenario updateRejected for updatePageProperties. */
|
|
145
|
+
declare function updatePagePropertiesUpdateRejected(): Case<UpdatePagePropertiesOutput>;
|
|
146
|
+
/** Scripted operations and manifest defaults for this connector. */
|
|
147
|
+
declare class GeneratedMock implements Operations {
|
|
148
|
+
#private;
|
|
149
|
+
constructor(connectionName: string);
|
|
150
|
+
connection(): Connection;
|
|
151
|
+
search(): MockQuery<SearchInput, SearchOutput>;
|
|
152
|
+
queryDatabase(): MockQuery<QueryDatabaseInput, QueryDatabaseOutput>;
|
|
153
|
+
getPage(): MockQuery<GetPageInput, GetPageOutput>;
|
|
154
|
+
createPage(): MockMutation<CreatePageInput, CreatePageOutput>;
|
|
155
|
+
updatePageProperties(): MockMutation<UpdatePagePropertiesInput, UpdatePagePropertiesOutput>;
|
|
156
|
+
assertNoFailures(): void;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export { GeneratedMock, createPageCreateRejected, createPageCreateSourceMissing, createPageCreated, createPageCreatedSubmission, createPageDefault, createPageDefect, createPageInvalidResponse, createPageNotFound, createPageProviderRejected, createPageRetry, createPageUncertain, emptyCreatePageInput, emptyCreatePageOutput, emptyDateRange, emptyGetPageInput, emptyGetPageOutput, emptyPage, emptyPageContent, emptyPageProperty, emptyParent, emptyPropertyValue, emptyQueryDatabaseInput, emptyQueryDatabaseOutput, emptyQueryFilter, emptyQuerySort, emptySearchInput, emptySearchMatch, emptySearchOutput, emptyUpdatePagePropertiesInput, emptyUpdatePagePropertiesOutput, getPageDefault, getPageDefect, getPageFound, getPageInvalidResponse, getPageNotFound, getPagePageMissing, getPagePageReadRejected, getPageProviderRejected, getPageRetry, getPageSubmittedPage, queryDatabaseDataSourceMissing, queryDatabaseDefault, queryDatabaseDefect, queryDatabaseExistingSubmission, queryDatabaseInvalidResponse, queryDatabaseNotFound, queryDatabaseProviderRejected, queryDatabaseQueried, queryDatabaseQueryRejected, queryDatabaseRetry, searchDefault, searchDefect, searchInvalidResponse, searchNoMatch, searchNoSharedTitle, searchProviderRejected, searchRetry, searchSearchRejected, searchSearched, searchSubmissionsSearch, updatePagePropertiesDefault, updatePagePropertiesDefect, updatePagePropertiesInvalidResponse, updatePagePropertiesNotFound, updatePagePropertiesProviderRejected, updatePagePropertiesRetry, updatePagePropertiesUpdatePageMissing, updatePagePropertiesUpdateRejected, updatePagePropertiesUpdated, updatePagePropertiesUpdatedSubmission };
|
package/dist/mock.js
ADDED
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConnectorID,
|
|
3
|
+
CreatePageDefinition,
|
|
4
|
+
CreatePageInputSchema,
|
|
5
|
+
CreatePageOutputSchema,
|
|
6
|
+
DateRangeSchema,
|
|
7
|
+
GetPageDefinition,
|
|
8
|
+
GetPageInputSchema,
|
|
9
|
+
GetPageOutputSchema,
|
|
10
|
+
PageContentSchema,
|
|
11
|
+
PagePropertySchema,
|
|
12
|
+
PageSchema,
|
|
13
|
+
ParentSchema,
|
|
14
|
+
PropertyValueSchema,
|
|
15
|
+
ProviderID,
|
|
16
|
+
QueryDatabaseDefinition,
|
|
17
|
+
QueryDatabaseInputSchema,
|
|
18
|
+
QueryDatabaseOutputSchema,
|
|
19
|
+
QueryFilterSchema,
|
|
20
|
+
QuerySortSchema,
|
|
21
|
+
SearchDefinition,
|
|
22
|
+
SearchInputSchema,
|
|
23
|
+
SearchMatchSchema,
|
|
24
|
+
SearchOutputSchema,
|
|
25
|
+
UpdatePagePropertiesDefinition,
|
|
26
|
+
UpdatePagePropertiesInputSchema,
|
|
27
|
+
UpdatePagePropertiesOutputSchema,
|
|
28
|
+
newConnectionWithOperations
|
|
29
|
+
} from "./chunk-5TNYF4VH.js";
|
|
30
|
+
|
|
31
|
+
// src/generated/mock.ts
|
|
32
|
+
import { branchCase, retryCase, uncertainCase, newMutation, newQuery } from "@superdurable/connectors-sdk/connectormock";
|
|
33
|
+
var emptySearchInput = SearchInputSchema.parse({});
|
|
34
|
+
var emptyParent = ParentSchema.parse({
|
|
35
|
+
"type": ""
|
|
36
|
+
});
|
|
37
|
+
var emptySearchMatch = SearchMatchSchema.parse({
|
|
38
|
+
"objectType": "",
|
|
39
|
+
"id": "",
|
|
40
|
+
"title": "",
|
|
41
|
+
"parent": emptyParent,
|
|
42
|
+
"inTrash": false
|
|
43
|
+
});
|
|
44
|
+
var emptySearchOutput = SearchOutputSchema.parse({
|
|
45
|
+
"matches": [],
|
|
46
|
+
"hasMore": false
|
|
47
|
+
});
|
|
48
|
+
var emptyQueryFilter = QueryFilterSchema.parse({});
|
|
49
|
+
var emptyQuerySort = QuerySortSchema.parse({});
|
|
50
|
+
var emptyQueryDatabaseInput = QueryDatabaseInputSchema.parse({});
|
|
51
|
+
var emptyDateRange = DateRangeSchema.parse({
|
|
52
|
+
"start": ""
|
|
53
|
+
});
|
|
54
|
+
var emptyPageProperty = PagePropertySchema.parse({
|
|
55
|
+
"id": "",
|
|
56
|
+
"type": "",
|
|
57
|
+
"plainText": ""
|
|
58
|
+
});
|
|
59
|
+
var emptyPage = PageSchema.parse({
|
|
60
|
+
"id": "",
|
|
61
|
+
"title": "",
|
|
62
|
+
"parent": emptyParent,
|
|
63
|
+
"inTrash": false,
|
|
64
|
+
"archived": false,
|
|
65
|
+
"properties": {}
|
|
66
|
+
});
|
|
67
|
+
var emptyQueryDatabaseOutput = QueryDatabaseOutputSchema.parse({
|
|
68
|
+
"dataSourceId": "",
|
|
69
|
+
"pages": [],
|
|
70
|
+
"hasMore": false,
|
|
71
|
+
"resultLimitReached": false
|
|
72
|
+
});
|
|
73
|
+
var emptyGetPageInput = GetPageInputSchema.parse({
|
|
74
|
+
"pageId": ""
|
|
75
|
+
});
|
|
76
|
+
var emptyPageContent = PageContentSchema.parse({
|
|
77
|
+
"text": "",
|
|
78
|
+
"blockCount": 0,
|
|
79
|
+
"hasMoreBlocks": false,
|
|
80
|
+
"textTruncated": false,
|
|
81
|
+
"nestedBlockCount": 0,
|
|
82
|
+
"skippedBlockCount": 0
|
|
83
|
+
});
|
|
84
|
+
var emptyGetPageOutput = GetPageOutputSchema.parse({
|
|
85
|
+
"page": emptyPage,
|
|
86
|
+
"content": emptyPageContent
|
|
87
|
+
});
|
|
88
|
+
var emptyPropertyValue = PropertyValueSchema.parse({
|
|
89
|
+
"type": ""
|
|
90
|
+
});
|
|
91
|
+
var emptyCreatePageInput = CreatePageInputSchema.parse({});
|
|
92
|
+
var emptyCreatePageOutput = CreatePageOutputSchema.parse({});
|
|
93
|
+
var emptyUpdatePagePropertiesInput = UpdatePagePropertiesInputSchema.parse({
|
|
94
|
+
"pageId": "",
|
|
95
|
+
"properties": {}
|
|
96
|
+
});
|
|
97
|
+
var emptyUpdatePagePropertiesOutput = UpdatePagePropertiesOutputSchema.parse({
|
|
98
|
+
"page": emptyPage
|
|
99
|
+
});
|
|
100
|
+
function searchSearched(value, failure) {
|
|
101
|
+
return branchCase("searched", value, failure);
|
|
102
|
+
}
|
|
103
|
+
function searchNoMatch(value, failure) {
|
|
104
|
+
return branchCase("noMatch", value, failure);
|
|
105
|
+
}
|
|
106
|
+
function searchProviderRejected(value, failure) {
|
|
107
|
+
return branchCase("providerRejected", value, failure);
|
|
108
|
+
}
|
|
109
|
+
function searchInvalidResponse(value, failure) {
|
|
110
|
+
return branchCase("invalidResponse", value, failure);
|
|
111
|
+
}
|
|
112
|
+
function searchDefect(value, failure) {
|
|
113
|
+
return branchCase("defect", value, failure);
|
|
114
|
+
}
|
|
115
|
+
function searchRetry(failure, retryAfterMs = 0) {
|
|
116
|
+
return retryCase(failure, retryAfterMs);
|
|
117
|
+
}
|
|
118
|
+
function searchSubmissionsSearch() {
|
|
119
|
+
const value = emptySearchOutput;
|
|
120
|
+
return branchCase("searched", value);
|
|
121
|
+
}
|
|
122
|
+
function searchDefault() {
|
|
123
|
+
return searchSubmissionsSearch();
|
|
124
|
+
}
|
|
125
|
+
function searchNoSharedTitle() {
|
|
126
|
+
const value = emptySearchOutput;
|
|
127
|
+
return branchCase("noMatch", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "search", message: "No shared Notion title matches the search." });
|
|
128
|
+
}
|
|
129
|
+
function searchSearchRejected() {
|
|
130
|
+
const value = emptySearchOutput;
|
|
131
|
+
return branchCase("providerRejected", value, { kind: "AUTHORIZATION", provider: ConnectorID, operation: "search", message: "Notion rejected the search." });
|
|
132
|
+
}
|
|
133
|
+
function queryDatabaseQueried(value, failure) {
|
|
134
|
+
return branchCase("queried", value, failure);
|
|
135
|
+
}
|
|
136
|
+
function queryDatabaseNotFound(value, failure) {
|
|
137
|
+
return branchCase("notFound", value, failure);
|
|
138
|
+
}
|
|
139
|
+
function queryDatabaseProviderRejected(value, failure) {
|
|
140
|
+
return branchCase("providerRejected", value, failure);
|
|
141
|
+
}
|
|
142
|
+
function queryDatabaseInvalidResponse(value, failure) {
|
|
143
|
+
return branchCase("invalidResponse", value, failure);
|
|
144
|
+
}
|
|
145
|
+
function queryDatabaseDefect(value, failure) {
|
|
146
|
+
return branchCase("defect", value, failure);
|
|
147
|
+
}
|
|
148
|
+
function queryDatabaseRetry(failure, retryAfterMs = 0) {
|
|
149
|
+
return retryCase(failure, retryAfterMs);
|
|
150
|
+
}
|
|
151
|
+
function queryDatabaseExistingSubmission() {
|
|
152
|
+
const value = emptyQueryDatabaseOutput;
|
|
153
|
+
return branchCase("queried", value);
|
|
154
|
+
}
|
|
155
|
+
function queryDatabaseDefault() {
|
|
156
|
+
return queryDatabaseExistingSubmission();
|
|
157
|
+
}
|
|
158
|
+
function queryDatabaseDataSourceMissing() {
|
|
159
|
+
const value = emptyQueryDatabaseOutput;
|
|
160
|
+
return branchCase("notFound", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "queryDatabase", message: "Notion could not find the data source." });
|
|
161
|
+
}
|
|
162
|
+
function queryDatabaseQueryRejected() {
|
|
163
|
+
const value = emptyQueryDatabaseOutput;
|
|
164
|
+
return branchCase("providerRejected", value, { kind: "VALIDATION", provider: ConnectorID, operation: "queryDatabase", message: "Notion rejected the database filter." });
|
|
165
|
+
}
|
|
166
|
+
function getPageFound(value, failure) {
|
|
167
|
+
return branchCase("found", value, failure);
|
|
168
|
+
}
|
|
169
|
+
function getPageNotFound(value, failure) {
|
|
170
|
+
return branchCase("notFound", value, failure);
|
|
171
|
+
}
|
|
172
|
+
function getPageProviderRejected(value, failure) {
|
|
173
|
+
return branchCase("providerRejected", value, failure);
|
|
174
|
+
}
|
|
175
|
+
function getPageInvalidResponse(value, failure) {
|
|
176
|
+
return branchCase("invalidResponse", value, failure);
|
|
177
|
+
}
|
|
178
|
+
function getPageDefect(value, failure) {
|
|
179
|
+
return branchCase("defect", value, failure);
|
|
180
|
+
}
|
|
181
|
+
function getPageRetry(failure, retryAfterMs = 0) {
|
|
182
|
+
return retryCase(failure, retryAfterMs);
|
|
183
|
+
}
|
|
184
|
+
function getPageSubmittedPage() {
|
|
185
|
+
const value = GetPageOutputSchema.parse({ "content": { "blockCount": 2, "hasMoreBlocks": false, "nestedBlockCount": 0, "skippedBlockCount": 0, "text": "Hello from the form.\nSecond paragraph.", "textTruncated": false }, "page": { "archived": false, "id": "2a4d6f80-1b3c-4d5e-8f70-112233445577", "inTrash": false, "parent": { "databaseId": "2a4d6f80-1b3c-4d5e-8f70-112233445500", "id": "2a4d6f80-1b3c-4d5e-8f70-112233445566", "type": "data_source_id" }, "properties": { "Email": { "email": "ada@example.com", "id": "email", "plainText": "ada@example.com", "type": "email" }, "Name": { "id": "title", "plainText": "Ada Lovelace", "text": "Ada Lovelace", "type": "title" }, "Submission ID": { "id": "submission-id", "plainText": "sub-new-1", "text": "sub-new-1", "type": "rich_text" }, "Submitted at": { "date": { "start": "2026-10-25T00:00:00Z" }, "id": "submitted-at", "plainText": "2026-10-25T00:00:00Z", "type": "date" } }, "title": "Ada Lovelace", "url": "https://www.notion.so/2a4d6f801b3c4d5e8f70112233445577" } });
|
|
186
|
+
return branchCase("found", value);
|
|
187
|
+
}
|
|
188
|
+
function getPageDefault() {
|
|
189
|
+
return getPageSubmittedPage();
|
|
190
|
+
}
|
|
191
|
+
function getPagePageMissing() {
|
|
192
|
+
const value = emptyGetPageOutput;
|
|
193
|
+
return branchCase("notFound", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "getPage", message: "Notion could not find the page." });
|
|
194
|
+
}
|
|
195
|
+
function getPagePageReadRejected() {
|
|
196
|
+
const value = emptyGetPageOutput;
|
|
197
|
+
return branchCase("providerRejected", value, { kind: "AUTHORIZATION", provider: ConnectorID, operation: "getPage", message: "Notion rejected the page read." });
|
|
198
|
+
}
|
|
199
|
+
function createPageCreated(value, failure) {
|
|
200
|
+
return branchCase("created", value, failure);
|
|
201
|
+
}
|
|
202
|
+
function createPageNotFound(value, failure) {
|
|
203
|
+
return branchCase("notFound", value, failure);
|
|
204
|
+
}
|
|
205
|
+
function createPageProviderRejected(value, failure) {
|
|
206
|
+
return branchCase("providerRejected", value, failure);
|
|
207
|
+
}
|
|
208
|
+
function createPageInvalidResponse(value, failure) {
|
|
209
|
+
return branchCase("invalidResponse", value, failure);
|
|
210
|
+
}
|
|
211
|
+
function createPageDefect(value, failure) {
|
|
212
|
+
return branchCase("defect", value, failure);
|
|
213
|
+
}
|
|
214
|
+
function createPageRetry(failure, retryAfterMs = 0) {
|
|
215
|
+
return retryCase(failure, retryAfterMs);
|
|
216
|
+
}
|
|
217
|
+
function createPageUncertain(value, failure) {
|
|
218
|
+
return uncertainCase(value, failure);
|
|
219
|
+
}
|
|
220
|
+
function createPageCreatedSubmission() {
|
|
221
|
+
const value = CreatePageOutputSchema.parse({ "dataSourceId": "2a4d6f80-1b3c-4d5e-8f70-112233445566", "page": { "archived": false, "id": "2a4d6f80-1b3c-4d5e-8f70-112233445577", "inTrash": false, "parent": { "databaseId": "2a4d6f80-1b3c-4d5e-8f70-112233445500", "id": "2a4d6f80-1b3c-4d5e-8f70-112233445566", "type": "data_source_id" }, "properties": { "Email": { "email": "ada@example.com", "id": "email", "plainText": "ada@example.com", "type": "email" }, "Name": { "id": "title", "plainText": "Ada Lovelace", "text": "Ada Lovelace", "type": "title" }, "Submission ID": { "id": "submission-id", "plainText": "sub-new-1", "text": "sub-new-1", "type": "rich_text" }, "Submitted at": { "date": { "start": "2026-10-25T00:00:00Z" }, "id": "submitted-at", "plainText": "2026-10-25T00:00:00Z", "type": "date" } }, "title": "Ada Lovelace", "url": "https://www.notion.so/2a4d6f801b3c4d5e8f70112233445577" }, "pageId": "2a4d6f80-1b3c-4d5e-8f70-112233445577" });
|
|
222
|
+
return branchCase("created", value);
|
|
223
|
+
}
|
|
224
|
+
function createPageDefault() {
|
|
225
|
+
return createPageCreatedSubmission();
|
|
226
|
+
}
|
|
227
|
+
function createPageCreateSourceMissing() {
|
|
228
|
+
const value = emptyCreatePageOutput;
|
|
229
|
+
return branchCase("notFound", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "createPage", message: "Notion could not find the destination data source." });
|
|
230
|
+
}
|
|
231
|
+
function createPageCreateRejected() {
|
|
232
|
+
const value = emptyCreatePageOutput;
|
|
233
|
+
return branchCase("providerRejected", value, { kind: "VALIDATION", provider: ConnectorID, operation: "createPage", message: "Notion rejected the submitted row." });
|
|
234
|
+
}
|
|
235
|
+
function updatePagePropertiesUpdated(value, failure) {
|
|
236
|
+
return branchCase("updated", value, failure);
|
|
237
|
+
}
|
|
238
|
+
function updatePagePropertiesNotFound(value, failure) {
|
|
239
|
+
return branchCase("notFound", value, failure);
|
|
240
|
+
}
|
|
241
|
+
function updatePagePropertiesProviderRejected(value, failure) {
|
|
242
|
+
return branchCase("providerRejected", value, failure);
|
|
243
|
+
}
|
|
244
|
+
function updatePagePropertiesInvalidResponse(value, failure) {
|
|
245
|
+
return branchCase("invalidResponse", value, failure);
|
|
246
|
+
}
|
|
247
|
+
function updatePagePropertiesDefect(value, failure) {
|
|
248
|
+
return branchCase("defect", value, failure);
|
|
249
|
+
}
|
|
250
|
+
function updatePagePropertiesRetry(failure, retryAfterMs = 0) {
|
|
251
|
+
return retryCase(failure, retryAfterMs);
|
|
252
|
+
}
|
|
253
|
+
function updatePagePropertiesUpdatedSubmission() {
|
|
254
|
+
const value = UpdatePagePropertiesOutputSchema.parse({ "page": { "archived": false, "id": "2a4d6f80-1b3c-4d5e-8f70-112233445577", "inTrash": false, "parent": { "databaseId": "2a4d6f80-1b3c-4d5e-8f70-112233445500", "id": "2a4d6f80-1b3c-4d5e-8f70-112233445566", "type": "data_source_id" }, "properties": { "Email": { "email": "ada@example.com", "id": "email", "plainText": "ada@example.com", "type": "email" }, "Name": { "id": "title", "plainText": "Ada Lovelace", "text": "Ada Lovelace", "type": "title" }, "Submission ID": { "id": "submission-id", "plainText": "sub-new-1", "text": "sub-new-1", "type": "rich_text" }, "Submitted at": { "date": { "start": "2026-10-25T00:00:00Z" }, "id": "submitted-at", "plainText": "2026-10-25T00:00:00Z", "type": "date" } }, "title": "Ada Lovelace", "url": "https://www.notion.so/2a4d6f801b3c4d5e8f70112233445577" } });
|
|
255
|
+
return branchCase("updated", value);
|
|
256
|
+
}
|
|
257
|
+
function updatePagePropertiesDefault() {
|
|
258
|
+
return updatePagePropertiesUpdatedSubmission();
|
|
259
|
+
}
|
|
260
|
+
function updatePagePropertiesUpdatePageMissing() {
|
|
261
|
+
const value = emptyUpdatePagePropertiesOutput;
|
|
262
|
+
return branchCase("notFound", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "updatePageProperties", message: "Notion could not find the row to update." });
|
|
263
|
+
}
|
|
264
|
+
function updatePagePropertiesUpdateRejected() {
|
|
265
|
+
const value = emptyUpdatePagePropertiesOutput;
|
|
266
|
+
return branchCase("providerRejected", value, { kind: "VALIDATION", provider: ConnectorID, operation: "updatePageProperties", message: "Notion rejected the row update." });
|
|
267
|
+
}
|
|
268
|
+
var GeneratedMock = class {
|
|
269
|
+
#search;
|
|
270
|
+
#queryDatabase;
|
|
271
|
+
#getPage;
|
|
272
|
+
#createPage;
|
|
273
|
+
#updatePageProperties;
|
|
274
|
+
#connection;
|
|
275
|
+
constructor(connectionName) {
|
|
276
|
+
this.#search = newQuery(SearchDefinition).default(searchDefault());
|
|
277
|
+
this.#queryDatabase = newQuery(QueryDatabaseDefinition).default(queryDatabaseDefault());
|
|
278
|
+
this.#getPage = newQuery(GetPageDefinition).default(getPageDefault());
|
|
279
|
+
this.#createPage = newMutation(CreatePageDefinition).default(createPageDefault());
|
|
280
|
+
this.#updatePageProperties = newMutation(UpdatePagePropertiesDefinition).default(updatePagePropertiesDefault());
|
|
281
|
+
this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
|
|
282
|
+
}
|
|
283
|
+
connection() {
|
|
284
|
+
return this.#connection;
|
|
285
|
+
}
|
|
286
|
+
search() {
|
|
287
|
+
return this.#search;
|
|
288
|
+
}
|
|
289
|
+
queryDatabase() {
|
|
290
|
+
return this.#queryDatabase;
|
|
291
|
+
}
|
|
292
|
+
getPage() {
|
|
293
|
+
return this.#getPage;
|
|
294
|
+
}
|
|
295
|
+
createPage() {
|
|
296
|
+
return this.#createPage;
|
|
297
|
+
}
|
|
298
|
+
updatePageProperties() {
|
|
299
|
+
return this.#updatePageProperties;
|
|
300
|
+
}
|
|
301
|
+
assertNoFailures() {
|
|
302
|
+
this.#search.assertNoFailures();
|
|
303
|
+
this.#queryDatabase.assertNoFailures();
|
|
304
|
+
this.#getPage.assertNoFailures();
|
|
305
|
+
this.#createPage.assertNoFailures();
|
|
306
|
+
this.#updatePageProperties.assertNoFailures();
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
export {
|
|
310
|
+
GeneratedMock,
|
|
311
|
+
createPageCreateRejected,
|
|
312
|
+
createPageCreateSourceMissing,
|
|
313
|
+
createPageCreated,
|
|
314
|
+
createPageCreatedSubmission,
|
|
315
|
+
createPageDefault,
|
|
316
|
+
createPageDefect,
|
|
317
|
+
createPageInvalidResponse,
|
|
318
|
+
createPageNotFound,
|
|
319
|
+
createPageProviderRejected,
|
|
320
|
+
createPageRetry,
|
|
321
|
+
createPageUncertain,
|
|
322
|
+
emptyCreatePageInput,
|
|
323
|
+
emptyCreatePageOutput,
|
|
324
|
+
emptyDateRange,
|
|
325
|
+
emptyGetPageInput,
|
|
326
|
+
emptyGetPageOutput,
|
|
327
|
+
emptyPage,
|
|
328
|
+
emptyPageContent,
|
|
329
|
+
emptyPageProperty,
|
|
330
|
+
emptyParent,
|
|
331
|
+
emptyPropertyValue,
|
|
332
|
+
emptyQueryDatabaseInput,
|
|
333
|
+
emptyQueryDatabaseOutput,
|
|
334
|
+
emptyQueryFilter,
|
|
335
|
+
emptyQuerySort,
|
|
336
|
+
emptySearchInput,
|
|
337
|
+
emptySearchMatch,
|
|
338
|
+
emptySearchOutput,
|
|
339
|
+
emptyUpdatePagePropertiesInput,
|
|
340
|
+
emptyUpdatePagePropertiesOutput,
|
|
341
|
+
getPageDefault,
|
|
342
|
+
getPageDefect,
|
|
343
|
+
getPageFound,
|
|
344
|
+
getPageInvalidResponse,
|
|
345
|
+
getPageNotFound,
|
|
346
|
+
getPagePageMissing,
|
|
347
|
+
getPagePageReadRejected,
|
|
348
|
+
getPageProviderRejected,
|
|
349
|
+
getPageRetry,
|
|
350
|
+
getPageSubmittedPage,
|
|
351
|
+
queryDatabaseDataSourceMissing,
|
|
352
|
+
queryDatabaseDefault,
|
|
353
|
+
queryDatabaseDefect,
|
|
354
|
+
queryDatabaseExistingSubmission,
|
|
355
|
+
queryDatabaseInvalidResponse,
|
|
356
|
+
queryDatabaseNotFound,
|
|
357
|
+
queryDatabaseProviderRejected,
|
|
358
|
+
queryDatabaseQueried,
|
|
359
|
+
queryDatabaseQueryRejected,
|
|
360
|
+
queryDatabaseRetry,
|
|
361
|
+
searchDefault,
|
|
362
|
+
searchDefect,
|
|
363
|
+
searchInvalidResponse,
|
|
364
|
+
searchNoMatch,
|
|
365
|
+
searchNoSharedTitle,
|
|
366
|
+
searchProviderRejected,
|
|
367
|
+
searchRetry,
|
|
368
|
+
searchSearchRejected,
|
|
369
|
+
searchSearched,
|
|
370
|
+
searchSubmissionsSearch,
|
|
371
|
+
updatePagePropertiesDefault,
|
|
372
|
+
updatePagePropertiesDefect,
|
|
373
|
+
updatePagePropertiesInvalidResponse,
|
|
374
|
+
updatePagePropertiesNotFound,
|
|
375
|
+
updatePagePropertiesProviderRejected,
|
|
376
|
+
updatePagePropertiesRetry,
|
|
377
|
+
updatePagePropertiesUpdatePageMissing,
|
|
378
|
+
updatePagePropertiesUpdateRejected,
|
|
379
|
+
updatePagePropertiesUpdated,
|
|
380
|
+
updatePagePropertiesUpdatedSubmission
|
|
381
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/connector-notion",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Notion connector and databaseRowChanged poll Trigger for Dex TypeScript applications",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/superdurable/dex-connectors-library.git",
|
|
9
|
+
"directory": "connectors/notion/typescript"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": "^22.0.0 || ^24.0.0"
|
|
14
|
+
},
|
|
15
|
+
"module": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./mock": {
|
|
23
|
+
"types": "./dist/mock.d.ts",
|
|
24
|
+
"import": "./dist/mock.js"
|
|
25
|
+
},
|
|
26
|
+
"./dex-connector.json": "./dex-connector.json"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE",
|
|
32
|
+
"dex-connector.json"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"prepack": "npm run build",
|
|
36
|
+
"build": "tsup src/index.ts src/mock.ts --format esm --dts --clean",
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"lint": "eslint src test examples",
|
|
39
|
+
"test": "npm run build && vitest run --exclude \"test/integration/**\"",
|
|
40
|
+
"test:integration": "npm run build && vitest run test/integration/*.integration.test.ts",
|
|
41
|
+
"example:worker": "tsx examples/search-pages/worker.ts",
|
|
42
|
+
"example:start": "tsx examples/search-pages/start.ts",
|
|
43
|
+
"example:row-changed": "tsx examples/row-changed/main.ts",
|
|
44
|
+
"check": "npm run typecheck && npm run lint && npm test && npm run build"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@superdurable/connectors-sdk": "0.12.0",
|
|
48
|
+
"@superdurable/dex": ">=1.45.4",
|
|
49
|
+
"zod": "^4.1.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@eslint/js": "^9.0.0",
|
|
53
|
+
"@types/node": "^22.0.0",
|
|
54
|
+
"eslint": "^9.0.0",
|
|
55
|
+
"tsup": "^8.0.0",
|
|
56
|
+
"tsx": "^4.23.15",
|
|
57
|
+
"typescript": "^5.9.0",
|
|
58
|
+
"typescript-eslint": "^8.0.0",
|
|
59
|
+
"vitest": "^3.0.0",
|
|
60
|
+
"yaml": "^2.9.1"
|
|
61
|
+
}
|
|
62
|
+
}
|