-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.ts
More file actions
222 lines (202 loc) · 7.24 KB
/
Copy pathmod.ts
File metadata and controls
222 lines (202 loc) · 7.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
import { Google } from "./integrations/google/runtime.ts";
export type { Google };
import { Gmail } from "./integrations/gmail/runtime.ts";
export type { Gmail };
import { Webhook } from "./integrations/webhook/runtime.ts";
export type { Webhook };
import { Github } from "./integrations/github/runtime.ts";
export type { Github };
import { Streak } from "./integrations/streak/runtime.ts";
export type { Streak };
import { Stripe } from "./integrations/stripe/runtime.ts";
export type { Stripe };
import { Cron } from "./integrations/cron/runtime.ts";
export type { Cron };
import { Intercom } from "./integrations/intercom/runtime.ts";
export type { Intercom };
import { Slack } from "./integrations/slack/runtime.ts";
export type { Slack };
import { Resend } from "./integrations/resend/runtime.ts";
export type { Resend };
import { OpenAI } from "./integrations/openai/runtime.ts";
export type { OpenAI };
import { Claude } from "./integrations/claude/runtime.ts";
export type { Claude };
import { Notion } from "./integrations/notion/runtime.ts";
export type { Notion };
import { Debug } from "./integrations/debug/runtime.ts";
export type { Debug };
import { Drive } from "./integrations/drive/runtime.ts";
export type { Drive };
import { Sheets } from "./integrations/sheets/runtime.ts";
export type { Sheets };
import { Tasks } from "./tasks.ts";
export type { Tasks };
import { Secrets } from "./secrets.ts";
export type { Secrets };
export type { GoogleCredentialFetcherOptions } from "./integrations/google/runtime.ts";
export type { GmailMessageEvent, GmailTriggerOptions } from "./integrations/gmail/runtime.ts";
export type {
DriveChangeEvent,
DriveChangesTriggerOptions,
DriveSingleFileChangeEvent,
DriveSingleFileTriggerOptions,
} from "./integrations/drive/runtime.ts";
export type {
SheetNewCommentEvent,
SheetNewOrUpdatedRowEvent,
SheetNewRowEvent,
SheetNewWorksheetEvent,
SheetsTriggerOptions,
} from "./integrations/sheets/runtime.ts";
export type { GithubEvent, GithubTriggerOptions } from "./integrations/github/runtime.ts";
export type { WebhookEvent, WebhookTriggerOptions } from "./integrations/webhook/runtime.ts";
export type { CronEvent } from "./integrations/cron/runtime.ts";
export type {
BoxEventType,
StreakCredentialFetcherOptions,
StreakEvent,
StreakTriggerOptions,
} from "./integrations/streak/runtime.ts";
export type { StripeEvent, StripeTriggerOptions } from "./integrations/stripe/runtime.ts";
export type {
IntercomConversationPartTag,
IntercomEvent,
IntercomTriggerOptions,
} from "./integrations/intercom/runtime.ts";
export type {
SlackCredentialFetcherOptions,
SlackEventType,
SlackEventWebhook,
SlackTriggerOptions,
} from "./integrations/slack/runtime.ts";
export type { ResendCredentialFetcherOptions } from "./integrations/resend/runtime.ts";
export type { OpenAICredentialFetcherOptions } from "./integrations/openai/runtime.ts";
export type { ClaudeCredentialFetcherOptions } from "./integrations/claude/runtime.ts";
export type {
NotionCredentialFetcherOptions,
NotionEventType,
NotionTriggerOptions,
NotionWebhookPayload,
} from "./integrations/notion/runtime.ts";
export type {
AccessTokenCredential,
ApiKeyCredential,
CredentialFetcher,
} from "./runtimeSupport.ts";
export type { DelayedTask, DelayedTaskScheduleOptions } from "./tasks.ts";
export type { DelayedTaskSchedule, DelayedTaskTimePeriod } from "./tasks/schedule.ts";
export type { SecretFetcher, SecretFetcherOptions } from "./secrets.ts";
export type { CommonCredentialFetcherOptions, CommonTriggerOptions } from "./common.ts";
/**
* The main Glue runtime class that provides access to all event sources.
*
* This class acts as a facade to all available event source integrations,
* providing a unified interface for registering event listeners across
* different platforms and services.
*
* This class is made available to users through the {@link glue} singleton.
*/
class Glue {
/**
* Google Drive event source for listening to changes in Drive.
*/
readonly drive: Drive = new Drive();
/**
* Google Sheets event source for listening to changes in Sheets.
*/
readonly sheets: Sheets = new Sheets();
/**
* Gmail event source for listening to email events.
* Allows you to react to new emails in connected Gmail accounts.
*/
readonly gmail: Gmail = new Gmail();
readonly google: Google = new Google();
/**
* Webhook event source for handling HTTP webhook requests.
* Creates endpoints that can receive HTTP requests from external services.
*/
readonly webhook: Webhook = new Webhook();
/**
* Cron event source for scheduling recurring tasks.
* Supports standard cron expressions and convenience methods for common intervals.
*/
readonly cron: Cron = new Cron();
/**
* GitHub event source for repository and organization events.
* Listens to GitHub webhooks for events like pull requests, issues, and pushes.
*/
readonly github: Github = new Github();
/**
* Streak CRM event source for pipeline and box events.
* Monitors changes in Streak CRM pipelines, boxes, tasks, and emails.
*/
readonly streak: Streak = new Streak();
/**
* Stripe event source for payment and subscription events.
* Handles Stripe webhooks for customer, payment, and subscription lifecycle events.
*/
readonly stripe: Stripe = new Stripe();
/**
* Intercom event source for customer conversation events.
* Tracks events in Intercom workspaces like conversation closures.
*/
readonly intercom: Intercom = new Intercom();
/**
* Slack event source for all Slack events.
* Tracks events in Slack workspaces like messages, channels, users, etc.
*/
readonly slack: Slack = new Slack();
/**
* Resend event source for sending emails.
* Sends emails using the Resend API.
*/
readonly resend: Resend = new Resend();
/**
* OpenAI service for fetching API credentials.
* Use with the OpenAI SDK to call OpenAI APIs from trigger handlers.
*/
readonly openai: OpenAI = new OpenAI();
/**
* Claude service for fetching API credentials.
* Use with the Anthropic SDK to call Claude APIs from trigger handlers.
*/
readonly claude: Claude = new Claude();
/**
* Notion event source and credentials.
* Tracks Notion webhooks and provides access tokens for the Notion API.
*/
readonly notion: Notion = new Notion();
/**
* Debug utilities exposing low-level registration helpers.
* These APIs are unstable and intended for internal / experimental use.
*/
readonly debug: Debug = new Debug();
/**
* Tasks utilities to allow work to be scheduled to run later from inside an
* event handler.
*/
readonly tasks: Tasks = new Tasks();
/**
* Allow fetching named secret values at runtime. Secrets are an alternative
* to environment variables for Glue scripts.
*/
readonly secrets: Secrets = new Secrets();
}
export type { Glue };
/**
* The global Glue runtime instance.
*
* This is the primary way to interact with the Glue runtime. Import this
* instance to register event listeners in your application.
*
* @example
* ```typescript
* import { glue } from "jsr:@streak-glue/runtime";
*
* glue.stripe.onCustomerCreated((event) => {
* console.log("New customer:", event.data.object.email);
* });
* ```
*/
export const glue: Glue = new Glue();