@automate.ax/integration-contracts 0.88.9 → 0.89.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/dist/notion/index.d.ts +77 -0
- package/dist/notion/index.js +112 -0
- package/dist/notion/schemas.d.ts +2918 -0
- package/dist/notion/schemas.js +185 -0
- package/dist/triggers.d.ts +2 -1
- package/package.json +9 -2
- package/src/notion/index.ts +179 -0
- package/src/notion/schemas.ts +365 -0
- package/src/triggers.ts +2 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { type NotionSemanticWebhookEvent, type NotionWebhookEvent } from "./schemas.js";
|
|
3
|
+
export * from "./schemas.js";
|
|
4
|
+
export declare const NOTION_TRIGGER_CONFIG_SCHEMA: z.ZodObject<{}, z.core.$strip>;
|
|
5
|
+
export declare const NOTION_WEBHOOK_EVENT_TYPES: readonly ["comment.created", "comment.deleted", "comment.updated", "data_source.content_updated", "data_source.created", "data_source.deleted", "data_source.moved", "data_source.schema_updated", "data_source.undeleted", "database.created", "database.deleted", "database.moved", "database.undeleted", "file_upload.completed", "file_upload.created", "file_upload.expired", "file_upload.upload_failed", "page.content_updated", "page.created", "page.deleted", "page.locked", "page.moved", "page.properties_updated", "page.transcription_block.transcript_deleted", "page.undeleted", "page.unlocked", "view.created", "view.deleted", "view.updated"];
|
|
6
|
+
type NotionTriggerContract<TEvent> = {
|
|
7
|
+
readonly configSchema: typeof NOTION_TRIGGER_CONFIG_SCHEMA;
|
|
8
|
+
readonly eventSchema: z.ZodType<TEvent>;
|
|
9
|
+
};
|
|
10
|
+
type NotionSemanticTriggerTypes = {
|
|
11
|
+
readonly "notion.comment.created": "comment.created";
|
|
12
|
+
readonly "notion.comment.deleted": "comment.deleted";
|
|
13
|
+
readonly "notion.comment.updated": "comment.updated";
|
|
14
|
+
readonly "notion.database.created": "database.created";
|
|
15
|
+
readonly "notion.database.deleted": "database.deleted";
|
|
16
|
+
readonly "notion.database.moved": "database.moved";
|
|
17
|
+
readonly "notion.database.undeleted": "database.undeleted";
|
|
18
|
+
readonly "notion.dataSource.contentUpdated": "data_source.content_updated";
|
|
19
|
+
readonly "notion.dataSource.created": "data_source.created";
|
|
20
|
+
readonly "notion.dataSource.deleted": "data_source.deleted";
|
|
21
|
+
readonly "notion.dataSource.moved": "data_source.moved";
|
|
22
|
+
readonly "notion.dataSource.schemaUpdated": "data_source.schema_updated";
|
|
23
|
+
readonly "notion.dataSource.undeleted": "data_source.undeleted";
|
|
24
|
+
readonly "notion.fileUpload.completed": "file_upload.completed";
|
|
25
|
+
readonly "notion.fileUpload.created": "file_upload.created";
|
|
26
|
+
readonly "notion.fileUpload.expired": "file_upload.expired";
|
|
27
|
+
readonly "notion.fileUpload.failed": "file_upload.upload_failed";
|
|
28
|
+
readonly "notion.page.contentUpdated": "page.content_updated";
|
|
29
|
+
readonly "notion.page.created": "page.created";
|
|
30
|
+
readonly "notion.page.deleted": "page.deleted";
|
|
31
|
+
readonly "notion.page.locked": "page.locked";
|
|
32
|
+
readonly "notion.page.moved": "page.moved";
|
|
33
|
+
readonly "notion.page.propertiesUpdated": "page.properties_updated";
|
|
34
|
+
readonly "notion.page.transcriptDeleted": "page.transcription_block.transcript_deleted";
|
|
35
|
+
readonly "notion.page.undeleted": "page.undeleted";
|
|
36
|
+
readonly "notion.page.unlocked": "page.unlocked";
|
|
37
|
+
readonly "notion.view.created": "view.created";
|
|
38
|
+
readonly "notion.view.deleted": "view.deleted";
|
|
39
|
+
readonly "notion.view.updated": "view.updated";
|
|
40
|
+
};
|
|
41
|
+
type NotionTriggerContracts = {
|
|
42
|
+
readonly [TTrigger in keyof NotionSemanticTriggerTypes]: NotionTriggerContract<NotionSemanticWebhookEvent<NotionSemanticTriggerTypes[TTrigger]>>;
|
|
43
|
+
} & {
|
|
44
|
+
readonly "notion.event": NotionTriggerContract<NotionWebhookEvent>;
|
|
45
|
+
};
|
|
46
|
+
export declare const notionEventTypeMap: {
|
|
47
|
+
readonly "comment.created": "notion.comment.created";
|
|
48
|
+
readonly "comment.deleted": "notion.comment.deleted";
|
|
49
|
+
readonly "comment.updated": "notion.comment.updated";
|
|
50
|
+
readonly "data_source.content_updated": "notion.dataSource.contentUpdated";
|
|
51
|
+
readonly "data_source.created": "notion.dataSource.created";
|
|
52
|
+
readonly "data_source.deleted": "notion.dataSource.deleted";
|
|
53
|
+
readonly "data_source.moved": "notion.dataSource.moved";
|
|
54
|
+
readonly "data_source.schema_updated": "notion.dataSource.schemaUpdated";
|
|
55
|
+
readonly "data_source.undeleted": "notion.dataSource.undeleted";
|
|
56
|
+
readonly "database.created": "notion.database.created";
|
|
57
|
+
readonly "database.deleted": "notion.database.deleted";
|
|
58
|
+
readonly "database.moved": "notion.database.moved";
|
|
59
|
+
readonly "database.undeleted": "notion.database.undeleted";
|
|
60
|
+
readonly "file_upload.completed": "notion.fileUpload.completed";
|
|
61
|
+
readonly "file_upload.created": "notion.fileUpload.created";
|
|
62
|
+
readonly "file_upload.expired": "notion.fileUpload.expired";
|
|
63
|
+
readonly "file_upload.upload_failed": "notion.fileUpload.failed";
|
|
64
|
+
readonly "page.content_updated": "notion.page.contentUpdated";
|
|
65
|
+
readonly "page.created": "notion.page.created";
|
|
66
|
+
readonly "page.deleted": "notion.page.deleted";
|
|
67
|
+
readonly "page.locked": "notion.page.locked";
|
|
68
|
+
readonly "page.moved": "notion.page.moved";
|
|
69
|
+
readonly "page.properties_updated": "notion.page.propertiesUpdated";
|
|
70
|
+
readonly "page.transcription_block.transcript_deleted": "notion.page.transcriptDeleted";
|
|
71
|
+
readonly "page.undeleted": "notion.page.undeleted";
|
|
72
|
+
readonly "page.unlocked": "notion.page.unlocked";
|
|
73
|
+
readonly "view.created": "notion.view.created";
|
|
74
|
+
readonly "view.deleted": "notion.view.deleted";
|
|
75
|
+
readonly "view.updated": "notion.view.updated";
|
|
76
|
+
};
|
|
77
|
+
export declare const notionTriggerContracts: NotionTriggerContracts;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { NOTION_EVENT_SCHEMA, notionSemanticEventSchema, } from "./schemas.js";
|
|
3
|
+
export * from "./schemas.js";
|
|
4
|
+
export const NOTION_TRIGGER_CONFIG_SCHEMA = z.object({});
|
|
5
|
+
export const NOTION_WEBHOOK_EVENT_TYPES = [
|
|
6
|
+
"comment.created",
|
|
7
|
+
"comment.deleted",
|
|
8
|
+
"comment.updated",
|
|
9
|
+
"data_source.content_updated",
|
|
10
|
+
"data_source.created",
|
|
11
|
+
"data_source.deleted",
|
|
12
|
+
"data_source.moved",
|
|
13
|
+
"data_source.schema_updated",
|
|
14
|
+
"data_source.undeleted",
|
|
15
|
+
"database.created",
|
|
16
|
+
"database.deleted",
|
|
17
|
+
"database.moved",
|
|
18
|
+
"database.undeleted",
|
|
19
|
+
"file_upload.completed",
|
|
20
|
+
"file_upload.created",
|
|
21
|
+
"file_upload.expired",
|
|
22
|
+
"file_upload.upload_failed",
|
|
23
|
+
"page.content_updated",
|
|
24
|
+
"page.created",
|
|
25
|
+
"page.deleted",
|
|
26
|
+
"page.locked",
|
|
27
|
+
"page.moved",
|
|
28
|
+
"page.properties_updated",
|
|
29
|
+
"page.transcription_block.transcript_deleted",
|
|
30
|
+
"page.undeleted",
|
|
31
|
+
"page.unlocked",
|
|
32
|
+
"view.created",
|
|
33
|
+
"view.deleted",
|
|
34
|
+
"view.updated",
|
|
35
|
+
];
|
|
36
|
+
export const notionEventTypeMap = {
|
|
37
|
+
"comment.created": "notion.comment.created",
|
|
38
|
+
"comment.deleted": "notion.comment.deleted",
|
|
39
|
+
"comment.updated": "notion.comment.updated",
|
|
40
|
+
"data_source.content_updated": "notion.dataSource.contentUpdated",
|
|
41
|
+
"data_source.created": "notion.dataSource.created",
|
|
42
|
+
"data_source.deleted": "notion.dataSource.deleted",
|
|
43
|
+
"data_source.moved": "notion.dataSource.moved",
|
|
44
|
+
"data_source.schema_updated": "notion.dataSource.schemaUpdated",
|
|
45
|
+
"data_source.undeleted": "notion.dataSource.undeleted",
|
|
46
|
+
"database.created": "notion.database.created",
|
|
47
|
+
"database.deleted": "notion.database.deleted",
|
|
48
|
+
"database.moved": "notion.database.moved",
|
|
49
|
+
"database.undeleted": "notion.database.undeleted",
|
|
50
|
+
"file_upload.completed": "notion.fileUpload.completed",
|
|
51
|
+
"file_upload.created": "notion.fileUpload.created",
|
|
52
|
+
"file_upload.expired": "notion.fileUpload.expired",
|
|
53
|
+
"file_upload.upload_failed": "notion.fileUpload.failed",
|
|
54
|
+
"page.content_updated": "notion.page.contentUpdated",
|
|
55
|
+
"page.created": "notion.page.created",
|
|
56
|
+
"page.deleted": "notion.page.deleted",
|
|
57
|
+
"page.locked": "notion.page.locked",
|
|
58
|
+
"page.moved": "notion.page.moved",
|
|
59
|
+
"page.properties_updated": "notion.page.propertiesUpdated",
|
|
60
|
+
"page.transcription_block.transcript_deleted": "notion.page.transcriptDeleted",
|
|
61
|
+
"page.undeleted": "notion.page.undeleted",
|
|
62
|
+
"page.unlocked": "notion.page.unlocked",
|
|
63
|
+
"view.created": "notion.view.created",
|
|
64
|
+
"view.deleted": "notion.view.deleted",
|
|
65
|
+
"view.updated": "notion.view.updated",
|
|
66
|
+
};
|
|
67
|
+
export const notionTriggerContracts = {
|
|
68
|
+
"notion.comment.created": semanticContract("comment.created"),
|
|
69
|
+
"notion.comment.deleted": semanticContract("comment.deleted"),
|
|
70
|
+
"notion.comment.updated": semanticContract("comment.updated"),
|
|
71
|
+
"notion.database.created": semanticContract("database.created"),
|
|
72
|
+
"notion.database.deleted": semanticContract("database.deleted"),
|
|
73
|
+
"notion.database.moved": semanticContract("database.moved"),
|
|
74
|
+
"notion.database.undeleted": semanticContract("database.undeleted"),
|
|
75
|
+
"notion.dataSource.contentUpdated": semanticContract("data_source.content_updated"),
|
|
76
|
+
"notion.dataSource.created": semanticContract("data_source.created"),
|
|
77
|
+
"notion.dataSource.deleted": semanticContract("data_source.deleted"),
|
|
78
|
+
"notion.dataSource.moved": semanticContract("data_source.moved"),
|
|
79
|
+
"notion.dataSource.schemaUpdated": semanticContract("data_source.schema_updated"),
|
|
80
|
+
"notion.dataSource.undeleted": semanticContract("data_source.undeleted"),
|
|
81
|
+
"notion.event": {
|
|
82
|
+
configSchema: NOTION_TRIGGER_CONFIG_SCHEMA,
|
|
83
|
+
eventSchema: NOTION_EVENT_SCHEMA,
|
|
84
|
+
},
|
|
85
|
+
"notion.fileUpload.completed": semanticContract("file_upload.completed"),
|
|
86
|
+
"notion.fileUpload.created": semanticContract("file_upload.created"),
|
|
87
|
+
"notion.fileUpload.expired": semanticContract("file_upload.expired"),
|
|
88
|
+
"notion.fileUpload.failed": semanticContract("file_upload.upload_failed"),
|
|
89
|
+
"notion.page.contentUpdated": semanticContract("page.content_updated"),
|
|
90
|
+
"notion.page.created": semanticContract("page.created"),
|
|
91
|
+
"notion.page.deleted": semanticContract("page.deleted"),
|
|
92
|
+
"notion.page.locked": semanticContract("page.locked"),
|
|
93
|
+
"notion.page.moved": semanticContract("page.moved"),
|
|
94
|
+
"notion.page.propertiesUpdated": semanticContract("page.properties_updated"),
|
|
95
|
+
"notion.page.transcriptDeleted": semanticContract("page.transcription_block.transcript_deleted"),
|
|
96
|
+
"notion.page.undeleted": semanticContract("page.undeleted"),
|
|
97
|
+
"notion.page.unlocked": semanticContract("page.unlocked"),
|
|
98
|
+
"notion.view.created": semanticContract("view.created"),
|
|
99
|
+
"notion.view.deleted": semanticContract("view.deleted"),
|
|
100
|
+
"notion.view.updated": semanticContract("view.updated"),
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Creates one semantic trigger contract from an official webhook type.
|
|
104
|
+
*
|
|
105
|
+
* @param type - Official Notion webhook event type.
|
|
106
|
+
*/
|
|
107
|
+
function semanticContract(type) {
|
|
108
|
+
return {
|
|
109
|
+
configSchema: NOTION_TRIGGER_CONFIG_SCHEMA,
|
|
110
|
+
eventSchema: notionSemanticEventSchema(type),
|
|
111
|
+
};
|
|
112
|
+
}
|