@particle-academy/microsoft-outlook-js 0.0.0 → 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/CHANGELOG.md +25 -0
- package/LICENSE +21 -0
- package/README.md +162 -2
- package/art/fancified.svg +26 -0
- package/dist/chunk-VMFOMB6N.js +360 -0
- package/dist/chunk-VMFOMB6N.js.map +1 -0
- package/dist/flow.cjs +457 -0
- package/dist/flow.cjs.map +1 -0
- package/dist/flow.d.cts +31 -0
- package/dist/flow.d.ts +31 -0
- package/dist/flow.js +100 -0
- package/dist/flow.js.map +1 -0
- package/dist/index.cjs +384 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +342 -0
- package/dist/index.d.ts +342 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/package.json +78 -6
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@particle-academy/microsoft-outlook-ui`,
|
|
4
|
+
`@particle-academy/microsoft-outlook-js`, `particle-academy/microsoft-outlook-php`
|
|
5
|
+
and `fancy-microsoft-outlook`.
|
|
6
|
+
|
|
7
|
+
The four packages share one version, because they are generated from one
|
|
8
|
+
`provider/` definition and a version that meant something different in each
|
|
9
|
+
would be a version nobody could reason about.
|
|
10
|
+
|
|
11
|
+
## [0.1.0] — 2026-09-15
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **First release.** The calendar half of Outlook, on Microsoft Graph v1.0:
|
|
16
|
+
actions `event_get`, `event_list`, `subscription_create`,
|
|
17
|
+
`subscription_renew` and `subscription_delete`; the `calendar_changed`
|
|
18
|
+
trigger with `delivery: "subscription"` — a Graph subscription capped at
|
|
19
|
+
10080 minutes, renewed by `subscription_renew` 3600 seconds before expiry,
|
|
20
|
+
its lease read from `expirationDateTime`. Deliveries are batches, verified
|
|
21
|
+
by the `clientState` Graph echoes in every item, and the endpoint answers
|
|
22
|
+
Graph's `validationToken` challenge before anything is delivered.
|
|
23
|
+
- Requires `fancy-connector-core` ≥ 0.8.0 in js and php — the release that
|
|
24
|
+
carries `LeaseDeclaration`, the shared-token verification scheme and the
|
|
25
|
+
challenge handshake.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Particle Academy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,163 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Microsoft Outlook
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://particle.academy)
|
|
4
|
+
|
|
5
|
+
Microsoft Outlook for [fancy-flow][flow] — as **four imported, versioned packages**, one
|
|
6
|
+
per runtime. Not vendored source: a copy cannot be upgraded, and third-party APIs
|
|
7
|
+
change.
|
|
8
|
+
|
|
9
|
+
[flow]: https://github.com/Particle-Academy/fancy-flow
|
|
10
|
+
|
|
11
|
+
| Runtime | Package | Install |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Authoring surface (every host) | `@particle-academy/microsoft-outlook-ui` | `npm install @particle-academy/microsoft-outlook-ui` |
|
|
14
|
+
| Node | `@particle-academy/microsoft-outlook-js` | `npm install @particle-academy/microsoft-outlook-js` |
|
|
15
|
+
| PHP 8.4+ | `particle-academy/microsoft-outlook-php` | `composer require particle-academy/microsoft-outlook-php` |
|
|
16
|
+
| Python 3.11+ | `fancy-microsoft-outlook` | `pip install fancy-microsoft-outlook` |
|
|
17
|
+
|
|
18
|
+
The `ui` package is the editor surface and is React on every host — a PHP or
|
|
19
|
+
Python project installs it *and* its own runtime package, and never the `js` one.
|
|
20
|
+
|
|
21
|
+
## What it costs you
|
|
22
|
+
|
|
23
|
+
One dependency: `@particle-academy/fancy-connector-core` (or
|
|
24
|
+
`particle-academy/fancy-connector-core` on Composer), which the `js` and `php`
|
|
25
|
+
packages pull in themselves. The Python package has **zero** runtime
|
|
26
|
+
dependencies.
|
|
27
|
+
|
|
28
|
+
**No Microsoft Outlook SDK.** Plain HTTP, deliberately: a vendor SDK is third-party code
|
|
29
|
+
subject to the kit's full approval bar, and one per provider is hundreds of
|
|
30
|
+
dependencies nobody is tracking.
|
|
31
|
+
|
|
32
|
+
## Setting it up
|
|
33
|
+
|
|
34
|
+
Everything below is generated from `provider/manifest.json`, so it cannot disagree with what the packages do.
|
|
35
|
+
|
|
36
|
+
### Credentials
|
|
37
|
+
|
|
38
|
+
A Microsoft Outlook connection holds 5 values.
|
|
39
|
+
|
|
40
|
+
**Two kinds of value, and mixing them up matters.** A `provider` credential is ONE value for the whole installation — an OAuth app's client secret serves every connected account. An `account` credential is one per connected account. A host that stores the second where it stores the first lets one account's credentials reach another's.
|
|
41
|
+
|
|
42
|
+
| Field | Scope | Secret | Where it comes from |
|
|
43
|
+
|---|---|---|---|
|
|
44
|
+
| **Application (client) ID** | per installation | not secret | From the Microsoft Entra admin center -> App registrations. ONE value for the whole installation, not per connected account. |
|
|
45
|
+
| **Client secret** | per installation | **secret** | A client secret of the same app registration. One value for the whole installation; Entra expires them, so record the expiry. |
|
|
46
|
+
| **Access token** | per connected account | **secret** | Per connected Microsoft account, and it expires after about ONE HOUR. The host refreshes it with the refresh token. |
|
|
47
|
+
| **Refresh token** | per connected account | **secret** | Per connected Microsoft account; issued only when the consent request includes offline_access. Every refresh answers with a NEW one -- persist it -- while the old one keeps working until it expires. |
|
|
48
|
+
| **Client state** | per connected account | **secret** | A secret the host chooses per connected account and sends as `clientState` on every subscription. Graph echoes it inside every notification, and that echo is the ONLY thing that authenticates a delivery -- Graph does not sign them. At most 128 characters. |
|
|
49
|
+
|
|
50
|
+
### Authorising
|
|
51
|
+
|
|
52
|
+
Microsoft Outlook uses OAuth2 (authorization_code). The package DECLARES the exchange; the HOST performs it — a consent screen needs a browser, a redirect URI and somewhere to persist the result, and all three belong to the host.
|
|
53
|
+
|
|
54
|
+
- **Authorize URL** — https://login.microsoftonline.com/common/oauth2/v2.0/authorize
|
|
55
|
+
- **Token URL** — https://login.microsoftonline.com/common/oauth2/v2.0/token
|
|
56
|
+
- **Scopes** — `Calendars.Read`, `offline_access`
|
|
57
|
+
- **Access token lifetime** — 3600 seconds (1 hours). A host that never refreshes works all afternoon and is broken by morning.
|
|
58
|
+
|
|
59
|
+
The refresh tokens do **not** rotate: the same one is reusable, so a refresh may safely be retried and may run concurrently. Stated rather than assumed, because the opposite — a provider that spends the token and revokes the grant on a replay — looks identical until it happens.
|
|
60
|
+
|
|
61
|
+
### The estate
|
|
62
|
+
|
|
63
|
+
Microsoft Outlook has a test estate on the same host, reached with credentials from a SEPARATE test account you register. Selecting sandbox mode uses those credentials.
|
|
64
|
+
|
|
65
|
+
> Microsoft's test estate is a Microsoft 365 Developer Program sandbox: a separate E5 tenant with its own users, its own calendars and its own OAuth consent, on the SAME host. Eligibility is limited -- Visual Studio Professional or Enterprise subscribers, ISV Success / Microsoft AI Cloud Partner Program members, or Premier/Unified Support customers -- and the tenant expires after 90 days of no development activity. Without one, every call reaches a real mailbox.
|
|
66
|
+
|
|
67
|
+
## What it can do
|
|
68
|
+
|
|
69
|
+
### Actions
|
|
70
|
+
|
|
71
|
+
#### `event_get` — Outlook calendar event
|
|
72
|
+
|
|
73
|
+
Read one event from the connected account's Outlook calendar.
|
|
74
|
+
|
|
75
|
+
`GET /v1.0/me/events/{id}` · reads only — safe to replay
|
|
76
|
+
|
|
77
|
+
| Input | Required | What it is |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| `id` | yes | The event's id, as published by a notification's resourceData.id or by event_list. |
|
|
80
|
+
|
|
81
|
+
#### `event_list` — Outlook calendar events
|
|
82
|
+
|
|
83
|
+
List events from the connected account's Outlook calendar.
|
|
84
|
+
|
|
85
|
+
`GET /v1.0/me/events` · reads only — safe to replay
|
|
86
|
+
|
|
87
|
+
| Input | Required | What it is |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| `top` | no | Events per page. An @odata.nextLink in the response means there are more. |
|
|
90
|
+
| `filter` | no | An OData $filter. Leave blank for everything. |
|
|
91
|
+
| `orderby` | no | An OData $orderby. Leave blank for Graph's default order. |
|
|
92
|
+
| `select` | no | An OData $select, comma separated. Leave blank for Graph's default set. |
|
|
93
|
+
|
|
94
|
+
#### `subscription_create` — Outlook subscription
|
|
95
|
+
|
|
96
|
+
Subscribe to change notifications on the connected account's calendar events. The host's subscription machinery calls this; it is not a node most workflows need.
|
|
97
|
+
|
|
98
|
+
`POST /v1.0/subscriptions` · **unsafe to replay** — a retried durable run does it TWICE
|
|
99
|
+
|
|
100
|
+
| Input | Required | What it is |
|
|
101
|
+
|---|---|---|
|
|
102
|
+
| `changeType` | no | Which changes raise a notification. Graph accepts a comma-separated combination. |
|
|
103
|
+
| `resource` | yes | The Graph resource to watch, without the base URL. `me/events` is the connected account's calendar events. |
|
|
104
|
+
| `notificationUrl` | yes | The HTTPS URL the host mounts for this trigger. Graph validates it with a validationToken challenge before creating the subscription, then POSTs change notifications to it. |
|
|
105
|
+
| `lifecycleNotificationUrl` | no | Where Graph sends `reauthorizationRequired`, `subscriptionRemoved` and `missed` events. May be the notification URL itself. Optional, but without it a subscription Graph removed is one nobody hears about. |
|
|
106
|
+
| `expirationDateTime` | yes | When the subscription expires, as an ISO 8601 instant in UTC. The host computes now + the trigger's lifetime; Graph caps an event subscription at 10080 minutes (under seven days) and raises anything under 45 minutes to 45. |
|
|
107
|
+
| `clientState` | yes | The connection's clientState. The host fills this from the connection -- never type a value here. Graph echoes it inside every notification, and that echo is how a delivery is verified. At most 128 characters. |
|
|
108
|
+
|
|
109
|
+
#### `subscription_delete` — Outlook subscription removal
|
|
110
|
+
|
|
111
|
+
Delete a change-notification subscription. The host's subscription machinery calls this when a trigger is removed.
|
|
112
|
+
|
|
113
|
+
`DELETE /v1.0/subscriptions/{id}` · idempotent — safe to replay
|
|
114
|
+
|
|
115
|
+
| Input | Required | What it is |
|
|
116
|
+
|---|---|---|
|
|
117
|
+
| `id` | yes | The id subscription_create answered with. |
|
|
118
|
+
|
|
119
|
+
#### `subscription_renew` — Outlook subscription renewal
|
|
120
|
+
|
|
121
|
+
Extend a change-notification subscription before it expires. The host's subscription machinery calls this when the lease is due.
|
|
122
|
+
|
|
123
|
+
`PATCH /v1.0/subscriptions/{id}` · idempotent — safe to replay
|
|
124
|
+
|
|
125
|
+
| Input | Required | What it is |
|
|
126
|
+
|---|---|---|
|
|
127
|
+
| `id` | yes | The id subscription_create answered with. |
|
|
128
|
+
| `expirationDateTime` | yes | The new expiry, as an ISO 8601 instant in UTC. The host computes now + the trigger's lifetime, capped at 10080 minutes for events. |
|
|
129
|
+
|
|
130
|
+
### Triggers
|
|
131
|
+
|
|
132
|
+
#### `calendar_changed` — Outlook calendar change
|
|
133
|
+
|
|
134
|
+
Start a run when an event is created, updated or deleted on a subscribed Outlook calendar.
|
|
135
|
+
|
|
136
|
+
A SUBSCRIPTION: Microsoft Outlook delivers to your endpoint only while a subscription it issued is alive, at most 168 hours at a time. Its expiry is read from the `subscription_create` response (`expirationDateTime`); 3600 seconds before it, the host renews it (`subscription_renew`). A lease that lapses is re-listed AND re-subscribed, because notifications during the gap are gone. Every delivery: the token Microsoft Outlook echoes back is compared with the connection's `clientState` before anything runs. Microsoft Outlook sends a `validationToken` challenge before it delivers anything, and the endpoint must echo it as plain text.
|
|
137
|
+
|
|
138
|
+
**You have to set this up with the provider first:**
|
|
139
|
+
|
|
140
|
+
The host calls subscription_create with its own URL for this trigger, an expiry of now plus this lifetime, and the connection's clientState, and must answer Graph's validationToken challenge on that URL as plain text within 10 seconds or the subscription is refused. It stores the returned id and expirationDateTime. 3600 seconds before expiry it calls subscription_renew; a 404 there means the subscription is gone and it re-lists (event_list) and creates again, because notifications during the gap are gone. Every notification is a batch: the host compares each item's clientState with the connection's clientState, answers 202, and then processes the items. A `missed` lifecycle event means re-list; `reauthorizationRequired` means renew; `subscriptionRemoved` means create again and re-list.
|
|
141
|
+
|
|
142
|
+
## Run it before you have credentials
|
|
143
|
+
|
|
144
|
+
Every operation ships a **faker**, whether or not Microsoft Outlook has a sandbox. Set a
|
|
145
|
+
node's mode to `fake` and it returns the shape Microsoft Outlook actually publishes — the
|
|
146
|
+
same field names, deterministically — so you can wire the downstream nodes before
|
|
147
|
+
touching an account, a key, or a network.
|
|
148
|
+
|
|
149
|
+
## This repository is generated
|
|
150
|
+
|
|
151
|
+
`provider/` is the source. Everything under `packages/` is emitted from it and
|
|
152
|
+
**must not be hand-edited** — CI regenerates and diffs on every push, and the
|
|
153
|
+
next protocol sync destroys anything it finds. See [`AGENTS.md`](AGENTS.md).
|
|
154
|
+
|
|
155
|
+
## Two namespaces, which do not match on purpose
|
|
156
|
+
|
|
157
|
+
The repo is `github.com/Fancy-Friends/microsoft-outlook`; the packages publish under
|
|
158
|
+
`particle-academy`. Nothing derives one from the other — the names come from
|
|
159
|
+
weaver's `friends.json` and nowhere else.
|
|
160
|
+
|
|
161
|
+
## Licence
|
|
162
|
+
|
|
163
|
+
MIT.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="28" role="img" aria-label="Fancified — built with Fancy UI">
|
|
2
|
+
<title>Fancified · built with Fancy UI</title>
|
|
3
|
+
<defs>
|
|
4
|
+
<linearGradient id="fcdBg" x1="0" y1="0" x2="1" y2="1">
|
|
5
|
+
<stop offset="0" stop-color="#6d28d9"/>
|
|
6
|
+
<stop offset=".5" stop-color="#9333ea"/>
|
|
7
|
+
<stop offset="1" stop-color="#d946ef"/>
|
|
8
|
+
</linearGradient>
|
|
9
|
+
<linearGradient id="fcdGloss" x1="0" y1="0" x2="0" y2="1">
|
|
10
|
+
<stop offset="0" stop-color="#ffffff" stop-opacity=".30"/>
|
|
11
|
+
<stop offset=".55" stop-color="#ffffff" stop-opacity="0"/>
|
|
12
|
+
</linearGradient>
|
|
13
|
+
<clipPath id="fcdClip"><rect width="128" height="28" rx="7"/></clipPath>
|
|
14
|
+
</defs>
|
|
15
|
+
<g clip-path="url(#fcdClip)">
|
|
16
|
+
<rect width="128" height="28" fill="url(#fcdBg)"/>
|
|
17
|
+
<rect width="34" height="28" fill="#3b0764" fill-opacity=".5"/>
|
|
18
|
+
<rect width="128" height="13" fill="url(#fcdGloss)"/>
|
|
19
|
+
<g fill="#fff">
|
|
20
|
+
<path transform="translate(17 14)" d="M0 -7 C.6 -2.2 2.2 -.6 7 0 C2.2 .6 .6 2.2 0 7 C-.6 2.2 -2.2 .6 -7 0 C-2.2 -.6 -.6 -2.2 0 -7 Z"/>
|
|
21
|
+
<path transform="translate(25.5 7.5) scale(.34)" fill-opacity=".85" d="M0 -7 C.6 -2.2 2.2 -.6 7 0 C2.2 .6 .6 2.2 0 7 C-.6 2.2 -2.2 .6 -7 0 C-2.2 -.6 -.6 -2.2 0 -7 Z"/>
|
|
22
|
+
</g>
|
|
23
|
+
<text x="81" y="18.5" fill="#ffffff" text-anchor="middle" font-family="'Segoe UI',Verdana,'DejaVu Sans',sans-serif" font-size="12" font-weight="700" letter-spacing=".3">Fancified</text>
|
|
24
|
+
</g>
|
|
25
|
+
<rect x=".5" y=".5" width="127" height="27" rx="6.5" fill="none" stroke="#ffffff" stroke-opacity=".22"/>
|
|
26
|
+
</svg>
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import { callConnector, verifyDelivery, handshakeResponse } from '@particle-academy/fancy-connector-core';
|
|
2
|
+
|
|
3
|
+
// src/faker.ts
|
|
4
|
+
function fakeEventGet({ config, fake }) {
|
|
5
|
+
const boundId = config.id !== void 0 && config.id !== null && config.id !== "" ? String(config.id) : fake.id("AAMkAGI2");
|
|
6
|
+
return {
|
|
7
|
+
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('ada%40example.test')/events/$entity",
|
|
8
|
+
"@odata.etag": 'W/"ZlnW4RIAV06KYYwlrfNZvQAALfZeRQ=="',
|
|
9
|
+
"id": boundId,
|
|
10
|
+
"createdDateTime": "2026-09-01T09:00:00.0000000Z",
|
|
11
|
+
"lastModifiedDateTime": "2026-09-10T15:30:00.0000000Z",
|
|
12
|
+
"subject": "Design review",
|
|
13
|
+
"bodyPreview": "Quarterly design review with the platform team.",
|
|
14
|
+
"isCancelled": false,
|
|
15
|
+
"isAllDay": false,
|
|
16
|
+
"showAs": "busy",
|
|
17
|
+
"webLink": "https://outlook.office365.com/owa/?itemid=AAMkAGI2&exvsurl=1&path=/calendar/item",
|
|
18
|
+
"start": {
|
|
19
|
+
"dateTime": "2026-09-22T14:00:00.0000000",
|
|
20
|
+
"timeZone": "UTC"
|
|
21
|
+
},
|
|
22
|
+
"end": {
|
|
23
|
+
"dateTime": "2026-09-22T15:00:00.0000000",
|
|
24
|
+
"timeZone": "UTC"
|
|
25
|
+
},
|
|
26
|
+
"location": {
|
|
27
|
+
"displayName": "Room 4"
|
|
28
|
+
},
|
|
29
|
+
"organizer": {
|
|
30
|
+
"emailAddress": {
|
|
31
|
+
"name": "Ada Example",
|
|
32
|
+
"address": "ada@example.test"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"attendees": [
|
|
36
|
+
{
|
|
37
|
+
"type": "required",
|
|
38
|
+
"status": {
|
|
39
|
+
"response": "accepted",
|
|
40
|
+
"time": "2026-09-02T10:00:00.0000000Z"
|
|
41
|
+
},
|
|
42
|
+
"emailAddress": {
|
|
43
|
+
"name": "Grace Example",
|
|
44
|
+
"address": "grace@example.test"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function fakeEventList({ config, fake }) {
|
|
51
|
+
return {
|
|
52
|
+
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('ada%40example.test')/events",
|
|
53
|
+
"value": [
|
|
54
|
+
{
|
|
55
|
+
"@odata.etag": 'W/"ZlnW4RIAV06KYYwlrfNZvQAALfZeRQ=="',
|
|
56
|
+
"id": fake.id("AAMkAGI2"),
|
|
57
|
+
"createdDateTime": "2026-09-01T09:00:00.0000000Z",
|
|
58
|
+
"lastModifiedDateTime": "2026-09-10T15:30:00.0000000Z",
|
|
59
|
+
"subject": "Design review",
|
|
60
|
+
"bodyPreview": "Quarterly design review with the platform team.",
|
|
61
|
+
"isCancelled": false,
|
|
62
|
+
"isAllDay": false,
|
|
63
|
+
"showAs": "busy",
|
|
64
|
+
"webLink": "https://outlook.office365.com/owa/?itemid=AAMkAGI2&exvsurl=1&path=/calendar/item",
|
|
65
|
+
"start": {
|
|
66
|
+
"dateTime": "2026-09-22T14:00:00.0000000",
|
|
67
|
+
"timeZone": "UTC"
|
|
68
|
+
},
|
|
69
|
+
"end": {
|
|
70
|
+
"dateTime": "2026-09-22T15:00:00.0000000",
|
|
71
|
+
"timeZone": "UTC"
|
|
72
|
+
},
|
|
73
|
+
"organizer": {
|
|
74
|
+
"emailAddress": {
|
|
75
|
+
"name": "Ada Example",
|
|
76
|
+
"address": "ada@example.test"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function fakeSubscriptionCreate({ config, fake }) {
|
|
84
|
+
const boundResource = config.resource !== void 0 && config.resource !== null && config.resource !== "" ? String(config.resource) : "me/events";
|
|
85
|
+
const boundChangetype = config.changeType !== void 0 && config.changeType !== null && config.changeType !== "" ? String(config.changeType) : "created,updated,deleted";
|
|
86
|
+
const boundNotificationurl = config.notificationUrl !== void 0 && config.notificationUrl !== null && config.notificationUrl !== "" ? String(config.notificationUrl) : "https://host.example.test/hooks/microsoft-outlook";
|
|
87
|
+
const boundClientstate = config.clientState !== void 0 && config.clientState !== null && config.clientState !== "" ? String(config.clientState) : fake.id("cs");
|
|
88
|
+
return {
|
|
89
|
+
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#subscriptions/$entity",
|
|
90
|
+
"id": `${fake.hex(8)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(12)}`,
|
|
91
|
+
"resource": boundResource,
|
|
92
|
+
"applicationId": `${fake.hex(8)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(12)}`,
|
|
93
|
+
"changeType": boundChangetype,
|
|
94
|
+
"clientState": boundClientstate,
|
|
95
|
+
"notificationUrl": boundNotificationurl,
|
|
96
|
+
"expirationDateTime": "2026-09-22T18:23:45.9356913Z",
|
|
97
|
+
"creatorId": `${fake.hex(8)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(12)}`,
|
|
98
|
+
"latestSupportedTlsVersion": "v1_2",
|
|
99
|
+
"notificationContentType": "application/json"
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function fakeSubscriptionDelete({ config, fake }) {
|
|
103
|
+
return {};
|
|
104
|
+
}
|
|
105
|
+
function fakeSubscriptionRenew({ config, fake }) {
|
|
106
|
+
const boundId = config.id !== void 0 && config.id !== null && config.id !== "" ? String(config.id) : `${fake.hex(8)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(12)}`;
|
|
107
|
+
const boundExpirationdatetime = config.expirationDateTime !== void 0 && config.expirationDateTime !== null && config.expirationDateTime !== "" ? String(config.expirationDateTime) : "2026-09-29T18:23:45.9356913Z";
|
|
108
|
+
return {
|
|
109
|
+
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#subscriptions/$entity",
|
|
110
|
+
"id": boundId,
|
|
111
|
+
"resource": "me/events",
|
|
112
|
+
"applicationId": `${fake.hex(8)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(12)}`,
|
|
113
|
+
"changeType": "created,updated,deleted",
|
|
114
|
+
"notificationUrl": "https://host.example.test/hooks/microsoft-outlook",
|
|
115
|
+
"expirationDateTime": boundExpirationdatetime,
|
|
116
|
+
"latestSupportedTlsVersion": "v1_2",
|
|
117
|
+
"notificationContentType": "application/json"
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function fakeCalendarChanged({ config, fake }) {
|
|
121
|
+
const boundSubscriptionid = `${fake.hex(8)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(12)}`;
|
|
122
|
+
const boundEventid = fake.id("AAMkAGI2");
|
|
123
|
+
return {
|
|
124
|
+
"value": [
|
|
125
|
+
{
|
|
126
|
+
"subscriptionId": boundSubscriptionid,
|
|
127
|
+
"subscriptionExpirationDateTime": "2026-09-22T18:23:45.9356913Z",
|
|
128
|
+
"changeType": config.sample !== void 0 && config.sample !== null && config.sample !== "" ? String(config.sample) : "updated",
|
|
129
|
+
"resource": "Users/ada%40example.test/Events/AAMkAGI2",
|
|
130
|
+
"tenantId": `${fake.hex(8)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(12)}`,
|
|
131
|
+
"clientState": "verified-before-injection",
|
|
132
|
+
"resourceData": {
|
|
133
|
+
"@odata.type": "#Microsoft.Graph.Event",
|
|
134
|
+
"@odata.id": "Users/ada%40example.test/Events/AAMkAGI2",
|
|
135
|
+
"@odata.etag": 'W/"ZlnW4RIAV06KYYwlrfNZvQAALfZeRQ=="',
|
|
136
|
+
"id": boundEventid
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
var microsoftOutlookFaker = (operation, request) => {
|
|
143
|
+
switch (operation) {
|
|
144
|
+
case "event_get":
|
|
145
|
+
return fakeEventGet(request);
|
|
146
|
+
case "event_list":
|
|
147
|
+
return fakeEventList(request);
|
|
148
|
+
case "subscription_create":
|
|
149
|
+
return fakeSubscriptionCreate(request);
|
|
150
|
+
case "subscription_delete":
|
|
151
|
+
return fakeSubscriptionDelete(request);
|
|
152
|
+
case "subscription_renew":
|
|
153
|
+
return fakeSubscriptionRenew(request);
|
|
154
|
+
case "calendar_changed":
|
|
155
|
+
return fakeCalendarChanged(request);
|
|
156
|
+
default:
|
|
157
|
+
throw new Error(
|
|
158
|
+
`microsoft_outlook: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// src/service.ts
|
|
164
|
+
var CONNECTOR_API_VERSION = 1;
|
|
165
|
+
var MICROSOFT_OUTLOOK_BASE_URLS = {
|
|
166
|
+
"live": "https://graph.microsoft.com",
|
|
167
|
+
"sandbox": "https://graph.microsoft.com"
|
|
168
|
+
};
|
|
169
|
+
var MICROSOFT_OUTLOOK_REQUIRES = [
|
|
170
|
+
"accessToken",
|
|
171
|
+
"refreshToken",
|
|
172
|
+
"clientId",
|
|
173
|
+
"clientSecret"
|
|
174
|
+
];
|
|
175
|
+
function microsoftOutlookAuthorize(credentials, request, _mode) {
|
|
176
|
+
request.headers.Authorization = `Bearer ${credentials.accessToken ?? ""}`;
|
|
177
|
+
}
|
|
178
|
+
var MICROSOFT_OUTLOOK = {
|
|
179
|
+
service: "microsoft_outlook",
|
|
180
|
+
title: "Microsoft Outlook",
|
|
181
|
+
sandbox: "separate-account",
|
|
182
|
+
baseUrls: { ...MICROSOFT_OUTLOOK_BASE_URLS },
|
|
183
|
+
requires: [...MICROSOFT_OUTLOOK_REQUIRES],
|
|
184
|
+
authorize: microsoftOutlookAuthorize,
|
|
185
|
+
faker: microsoftOutlookFaker
|
|
186
|
+
};
|
|
187
|
+
var EVENT_GET_OPERATION = "event_get";
|
|
188
|
+
async function microsoftOutlookEventGet(options) {
|
|
189
|
+
const config = options.config ?? {};
|
|
190
|
+
if (config.id === void 0 || config.id === null || config.id === "") {
|
|
191
|
+
throw new Error(`event_get: "id" is required (Event ID).`);
|
|
192
|
+
}
|
|
193
|
+
return callConnector(MICROSOFT_OUTLOOK, {
|
|
194
|
+
operation: EVENT_GET_OPERATION,
|
|
195
|
+
config,
|
|
196
|
+
input: options.input,
|
|
197
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
198
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
199
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
200
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
201
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
202
|
+
request: {
|
|
203
|
+
method: "GET",
|
|
204
|
+
path: `/v1.0/me/events/${encodeURIComponent(String(config.id))}`,
|
|
205
|
+
query: {}
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
var EVENT_LIST_OPERATION = "event_list";
|
|
210
|
+
async function microsoftOutlookEventList(options) {
|
|
211
|
+
const config = options.config ?? {};
|
|
212
|
+
{
|
|
213
|
+
const n = Number(config.top);
|
|
214
|
+
const given = config.top !== void 0 && config.top !== null && config.top !== "";
|
|
215
|
+
if (given && !(Number.isInteger(n) && n >= 1 && n <= 999)) {
|
|
216
|
+
throw new Error(
|
|
217
|
+
`event_list: "top" must be a integer, got ${JSON.stringify(config.top)}.`
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return callConnector(MICROSOFT_OUTLOOK, {
|
|
222
|
+
operation: EVENT_LIST_OPERATION,
|
|
223
|
+
config,
|
|
224
|
+
input: options.input,
|
|
225
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
226
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
227
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
228
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
229
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
230
|
+
request: {
|
|
231
|
+
method: "GET",
|
|
232
|
+
path: "/v1.0/me/events",
|
|
233
|
+
query: {
|
|
234
|
+
"$top": config.top !== void 0 && config.top !== null && config.top !== "" ? Math.trunc(Number(config.top)) : 50,
|
|
235
|
+
...config.filter !== void 0 && config.filter !== null && config.filter !== "" ? { "$filter": String(config.filter) } : {},
|
|
236
|
+
...config.orderby !== void 0 && config.orderby !== null && config.orderby !== "" ? { "$orderby": String(config.orderby) } : {},
|
|
237
|
+
...config.select !== void 0 && config.select !== null && config.select !== "" ? { "$select": String(config.select) } : {}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
var SUBSCRIPTION_CREATE_OPERATION = "subscription_create";
|
|
243
|
+
async function microsoftOutlookSubscriptionCreate(options) {
|
|
244
|
+
const config = options.config ?? {};
|
|
245
|
+
if (config.resource === void 0 || config.resource === null || config.resource === "") {
|
|
246
|
+
throw new Error(`subscription_create: "resource" is required (Resource).`);
|
|
247
|
+
}
|
|
248
|
+
if (config.notificationUrl === void 0 || config.notificationUrl === null || config.notificationUrl === "") {
|
|
249
|
+
throw new Error(`subscription_create: "notificationUrl" is required (Notification URL).`);
|
|
250
|
+
}
|
|
251
|
+
if (config.expirationDateTime === void 0 || config.expirationDateTime === null || config.expirationDateTime === "") {
|
|
252
|
+
throw new Error(`subscription_create: "expirationDateTime" is required (Expires at).`);
|
|
253
|
+
}
|
|
254
|
+
if (config.clientState === void 0 || config.clientState === null || config.clientState === "") {
|
|
255
|
+
throw new Error(`subscription_create: "clientState" is required (Client state).`);
|
|
256
|
+
}
|
|
257
|
+
return callConnector(MICROSOFT_OUTLOOK, {
|
|
258
|
+
operation: SUBSCRIPTION_CREATE_OPERATION,
|
|
259
|
+
config,
|
|
260
|
+
input: options.input,
|
|
261
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
262
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
263
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
264
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
265
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
266
|
+
request: {
|
|
267
|
+
method: "POST",
|
|
268
|
+
path: "/v1.0/subscriptions",
|
|
269
|
+
json: {
|
|
270
|
+
...config.changeType !== void 0 && config.changeType !== null && config.changeType !== "" ? { "changeType": String(config.changeType) } : {},
|
|
271
|
+
"resource": String(config.resource),
|
|
272
|
+
"notificationUrl": String(config.notificationUrl),
|
|
273
|
+
...config.lifecycleNotificationUrl !== void 0 && config.lifecycleNotificationUrl !== null && config.lifecycleNotificationUrl !== "" ? { "lifecycleNotificationUrl": String(config.lifecycleNotificationUrl) } : {},
|
|
274
|
+
"expirationDateTime": String(config.expirationDateTime),
|
|
275
|
+
"clientState": String(config.clientState)
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
var SUBSCRIPTION_DELETE_OPERATION = "subscription_delete";
|
|
281
|
+
async function microsoftOutlookSubscriptionDelete(options) {
|
|
282
|
+
const config = options.config ?? {};
|
|
283
|
+
if (config.id === void 0 || config.id === null || config.id === "") {
|
|
284
|
+
throw new Error(`subscription_delete: "id" is required (Subscription ID).`);
|
|
285
|
+
}
|
|
286
|
+
return callConnector(MICROSOFT_OUTLOOK, {
|
|
287
|
+
operation: SUBSCRIPTION_DELETE_OPERATION,
|
|
288
|
+
config,
|
|
289
|
+
input: options.input,
|
|
290
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
291
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
292
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
293
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
294
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
295
|
+
request: {
|
|
296
|
+
method: "DELETE",
|
|
297
|
+
path: `/v1.0/subscriptions/${encodeURIComponent(String(config.id))}`,
|
|
298
|
+
query: {}
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
var SUBSCRIPTION_RENEW_OPERATION = "subscription_renew";
|
|
303
|
+
async function microsoftOutlookSubscriptionRenew(options) {
|
|
304
|
+
const config = options.config ?? {};
|
|
305
|
+
if (config.id === void 0 || config.id === null || config.id === "") {
|
|
306
|
+
throw new Error(`subscription_renew: "id" is required (Subscription ID).`);
|
|
307
|
+
}
|
|
308
|
+
if (config.expirationDateTime === void 0 || config.expirationDateTime === null || config.expirationDateTime === "") {
|
|
309
|
+
throw new Error(`subscription_renew: "expirationDateTime" is required (Expires at).`);
|
|
310
|
+
}
|
|
311
|
+
return callConnector(MICROSOFT_OUTLOOK, {
|
|
312
|
+
operation: SUBSCRIPTION_RENEW_OPERATION,
|
|
313
|
+
config,
|
|
314
|
+
input: options.input,
|
|
315
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
316
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
317
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
318
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
319
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
320
|
+
request: {
|
|
321
|
+
method: "PATCH",
|
|
322
|
+
path: `/v1.0/subscriptions/${encodeURIComponent(String(config.id))}`,
|
|
323
|
+
json: {
|
|
324
|
+
"expirationDateTime": String(config.expirationDateTime)
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
var MICROSOFT_OUTLOOK_CALENDAR_CHANGED_TOKEN_SCHEME = { kind: "shared-token", in: "body", path: "value[].clientState" };
|
|
330
|
+
var MICROSOFT_OUTLOOK_CALENDAR_CHANGED_HANDSHAKE = { kind: "echo-query", param: "validationToken" };
|
|
331
|
+
var MICROSOFT_OUTLOOK_CALENDAR_CHANGED_LEASE = {
|
|
332
|
+
expiresAtFrom: "expirationDateTime",
|
|
333
|
+
expiresAtUnit: "rfc3339",
|
|
334
|
+
renewBeforeSeconds: 3600,
|
|
335
|
+
renewOperation: "subscription_renew"
|
|
336
|
+
};
|
|
337
|
+
var MICROSOFT_OUTLOOK_CALENDAR_CHANGED_SUBSCRIPTION = { create: "subscription_create", renew: "subscription_renew", stop: "subscription_delete" };
|
|
338
|
+
var MICROSOFT_OUTLOOK_CALENDAR_CHANGED = {
|
|
339
|
+
service: "microsoft_outlook",
|
|
340
|
+
operation: "calendar_changed",
|
|
341
|
+
delivery: "subscription",
|
|
342
|
+
setup: "The host calls subscription_create with its own URL for this trigger, an expiry of now plus this lifetime, and the connection's clientState, and must answer Graph's validationToken challenge on that URL as plain text within 10 seconds or the subscription is refused. It stores the returned id and expirationDateTime. 3600 seconds before expiry it calls subscription_renew; a 404 there means the subscription is gone and it re-lists (event_list) and creates again, because notifications during the gap are gone. Every notification is a batch: the host compares each item's clientState with the connection's clientState, answers 202, and then processes the items. A `missed` lifecycle event means re-list; `reauthorizationRequired` means renew; `subscriptionRemoved` means create again and re-list.",
|
|
343
|
+
subscriptionTtl: 604800,
|
|
344
|
+
lease: MICROSOFT_OUTLOOK_CALENDAR_CHANGED_LEASE,
|
|
345
|
+
verification: {
|
|
346
|
+
scheme: MICROSOFT_OUTLOOK_CALENDAR_CHANGED_TOKEN_SCHEME,
|
|
347
|
+
handshake: MICROSOFT_OUTLOOK_CALENDAR_CHANGED_HANDSHAKE
|
|
348
|
+
},
|
|
349
|
+
faker: microsoftOutlookFaker
|
|
350
|
+
};
|
|
351
|
+
function verifyMicrosoftOutlookDelivery(delivery, clientState, now) {
|
|
352
|
+
return verifyDelivery(MICROSOFT_OUTLOOK_CALENDAR_CHANGED, delivery, clientState, now);
|
|
353
|
+
}
|
|
354
|
+
function answerMicrosoftOutlookHandshake(query) {
|
|
355
|
+
return handshakeResponse(MICROSOFT_OUTLOOK_CALENDAR_CHANGED_HANDSHAKE, query);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export { CONNECTOR_API_VERSION, EVENT_GET_OPERATION, EVENT_LIST_OPERATION, MICROSOFT_OUTLOOK, MICROSOFT_OUTLOOK_BASE_URLS, MICROSOFT_OUTLOOK_CALENDAR_CHANGED, MICROSOFT_OUTLOOK_CALENDAR_CHANGED_HANDSHAKE, MICROSOFT_OUTLOOK_CALENDAR_CHANGED_LEASE, MICROSOFT_OUTLOOK_CALENDAR_CHANGED_SUBSCRIPTION, MICROSOFT_OUTLOOK_CALENDAR_CHANGED_TOKEN_SCHEME, MICROSOFT_OUTLOOK_REQUIRES, SUBSCRIPTION_CREATE_OPERATION, SUBSCRIPTION_DELETE_OPERATION, SUBSCRIPTION_RENEW_OPERATION, answerMicrosoftOutlookHandshake, microsoftOutlookAuthorize, microsoftOutlookEventGet, microsoftOutlookEventList, microsoftOutlookFaker, microsoftOutlookSubscriptionCreate, microsoftOutlookSubscriptionDelete, microsoftOutlookSubscriptionRenew, verifyMicrosoftOutlookDelivery };
|
|
359
|
+
//# sourceMappingURL=chunk-VMFOMB6N.js.map
|
|
360
|
+
//# sourceMappingURL=chunk-VMFOMB6N.js.map
|