@opengeni/capabilities 0.1.1 → 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/README.md +1 -1
- package/THIRD_PARTY_NOTICES +2 -2
- package/dist/graphql.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +136 -113
- package/dist/index.js.map +1 -1
- package/dist/integration-definitions.d.ts +58 -0
- package/dist/openapi.d.ts +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +1 -1
- package/src/graphql.ts +8 -8
- package/src/index.ts +1 -1
- package/src/{providers.ts → integration-definitions.ts} +149 -111
- package/src/openapi.ts +5 -5
- package/src/types.ts +2 -2
- package/dist/providers.d.ts +0 -44
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Security defaults:
|
|
|
13
13
|
|
|
14
14
|
- credentials are resolved for one exact destination and verified before use;
|
|
15
15
|
- header, query, and cookie placements are bounded and validated atomically;
|
|
16
|
-
- Google/Microsoft
|
|
16
|
+
- curated Google/Microsoft Integration Definition OAuth stays in the normal encrypted Connection spine;
|
|
17
17
|
- redirects are never followed on credential-bearing requests;
|
|
18
18
|
- response bodies, schemas, operation counts, and deadlines are bounded;
|
|
19
19
|
- mutating operations are marked approval-required by default;
|
package/THIRD_PARTY_NOTICES
CHANGED
|
@@ -2,8 +2,8 @@ This package contains adapted portions of Executor (https://github.com/executorj
|
|
|
2
2
|
copyright (c) 2026 Rhys Sullivan, used under the MIT License.
|
|
3
3
|
|
|
4
4
|
The adapted concepts include deterministic MCP tool identifiers, OpenAPI and
|
|
5
|
-
GraphQL extraction/invocation boundaries, auth-placement modeling,
|
|
6
|
-
|
|
5
|
+
GraphQL extraction/invocation boundaries, auth-placement modeling, curated
|
|
6
|
+
Integration Definition normalization, and MCP manifest projection. Executor's Effect/FumaDB
|
|
7
7
|
application architecture, persistence, secret stores, runtime hosts, and UI
|
|
8
8
|
state are not included.
|
|
9
9
|
|
package/dist/graphql.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface GraphqlOperationBinding {
|
|
|
12
12
|
}
|
|
13
13
|
export type GraphqlRevision = IntegrationRevision<GraphqlOperationBinding, "graphql">;
|
|
14
14
|
export interface CompileGraphqlOptions {
|
|
15
|
-
readonly
|
|
15
|
+
readonly definitionId: string;
|
|
16
16
|
readonly endpoint: string;
|
|
17
17
|
readonly name?: string;
|
|
18
18
|
readonly sourceUrl?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ export * from "./graphql.js";
|
|
|
3
3
|
export * from "./http.js";
|
|
4
4
|
export * from "./mcp-manifest.js";
|
|
5
5
|
export * from "./openapi.js";
|
|
6
|
-
export * from "./
|
|
6
|
+
export * from "./integration-definitions.js";
|
|
7
7
|
export * from "./revision.js";
|
|
8
8
|
export * from "./types.js";
|
package/dist/index.js
CHANGED
|
@@ -397,13 +397,13 @@ function compileGraphqlRevision(introspection, options) {
|
|
|
397
397
|
return {
|
|
398
398
|
id,
|
|
399
399
|
protocol: "graphql",
|
|
400
|
-
|
|
400
|
+
definitionId: options.definitionId,
|
|
401
401
|
contentSha256,
|
|
402
402
|
source: {
|
|
403
403
|
url: options.sourceUrl ?? endpoint,
|
|
404
404
|
...options.provider ? { provider: options.provider } : {}
|
|
405
405
|
},
|
|
406
|
-
title: options.name?.trim() || options.
|
|
406
|
+
title: options.name?.trim() || options.definitionId,
|
|
407
407
|
tools,
|
|
408
408
|
bindings
|
|
409
409
|
};
|
|
@@ -463,7 +463,7 @@ async function fetchGraphqlIntrospection(options) {
|
|
|
463
463
|
var GraphqlMcpServer = class {
|
|
464
464
|
constructor(options) {
|
|
465
465
|
this.options = options;
|
|
466
|
-
this.name = `graphql:${stableToolId(options.revision.
|
|
466
|
+
this.name = `graphql:${stableToolId(options.revision.definitionId)}`;
|
|
467
467
|
}
|
|
468
468
|
cacheToolsList = true;
|
|
469
469
|
useStructuredContent = true;
|
|
@@ -534,7 +534,7 @@ async function invokeGraphqlOperation(options, toolId, args, signal) {
|
|
|
534
534
|
const request = { query, variables, operationName: binding.operationName };
|
|
535
535
|
const firstCredential = await resolveGraphqlCredential(
|
|
536
536
|
options,
|
|
537
|
-
options.revision.
|
|
537
|
+
options.revision.definitionId,
|
|
538
538
|
options.revision.id,
|
|
539
539
|
toolId,
|
|
540
540
|
false
|
|
@@ -543,7 +543,7 @@ async function invokeGraphqlOperation(options, toolId, args, signal) {
|
|
|
543
543
|
if (response.status === 401 && options.credentialResolver && options.authority.connectionRef) {
|
|
544
544
|
const refreshed = await resolveGraphqlCredential(
|
|
545
545
|
options,
|
|
546
|
-
options.revision.
|
|
546
|
+
options.revision.definitionId,
|
|
547
547
|
options.revision.id,
|
|
548
548
|
toolId,
|
|
549
549
|
true
|
|
@@ -592,12 +592,12 @@ async function invokeGraphqlOperation(options, toolId, args, signal) {
|
|
|
592
592
|
errors: graph.errors ?? null
|
|
593
593
|
};
|
|
594
594
|
}
|
|
595
|
-
async function resolveGraphqlCredential(options,
|
|
595
|
+
async function resolveGraphqlCredential(options, definitionId, revisionId, operationKey, forceRefresh) {
|
|
596
596
|
if (!options.credentialResolver || !options.authority.connectionRef) return null;
|
|
597
597
|
const credential = await options.credentialResolver.resolve({
|
|
598
598
|
...options.authority,
|
|
599
599
|
protocol: "graphql",
|
|
600
|
-
|
|
600
|
+
definitionId,
|
|
601
601
|
revisionId,
|
|
602
602
|
operationKey,
|
|
603
603
|
destinationUrl: graphqlEndpoint(options).toString(),
|
|
@@ -947,13 +947,13 @@ function compileOpenApiRevision(source, options) {
|
|
|
947
947
|
return {
|
|
948
948
|
id: revisionId,
|
|
949
949
|
protocol: "openapi",
|
|
950
|
-
|
|
950
|
+
definitionId: options.definitionId,
|
|
951
951
|
contentSha256,
|
|
952
952
|
source: {
|
|
953
953
|
...options.sourceUrl ? { url: options.sourceUrl } : {},
|
|
954
954
|
...options.provider ? { provider: options.provider } : {}
|
|
955
955
|
},
|
|
956
|
-
title: stringValue(info.title) ?? options.
|
|
956
|
+
title: stringValue(info.title) ?? options.definitionId,
|
|
957
957
|
...stringValue(info.description) ? { description: stringValue(info.description) } : {},
|
|
958
958
|
...stringValue(info.version) ? { version: stringValue(info.version) } : {},
|
|
959
959
|
tools,
|
|
@@ -986,7 +986,7 @@ function discoverOpenApiAuth(document) {
|
|
|
986
986
|
var OpenApiMcpServer = class {
|
|
987
987
|
constructor(options) {
|
|
988
988
|
this.options = options;
|
|
989
|
-
this.name = `openapi:${stableToolId(options.revision.
|
|
989
|
+
this.name = `openapi:${stableToolId(options.revision.definitionId)}`;
|
|
990
990
|
}
|
|
991
991
|
cacheToolsList = true;
|
|
992
992
|
useStructuredContent = true;
|
|
@@ -1103,7 +1103,7 @@ async function resolveOpenApiCredential(options, binding, toolId, args, forceRef
|
|
|
1103
1103
|
const credential = await options.credentialResolver.resolve({
|
|
1104
1104
|
...options.authority,
|
|
1105
1105
|
protocol: "openapi",
|
|
1106
|
-
|
|
1106
|
+
definitionId: options.revision.definitionId,
|
|
1107
1107
|
revisionId: options.revision.id,
|
|
1108
1108
|
operationKey: toolId,
|
|
1109
1109
|
destinationUrl,
|
|
@@ -1435,9 +1435,9 @@ function isRecord2(value) {
|
|
|
1435
1435
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1436
1436
|
}
|
|
1437
1437
|
|
|
1438
|
-
// src/
|
|
1439
|
-
var
|
|
1440
|
-
|
|
1438
|
+
// src/integration-definitions.ts
|
|
1439
|
+
var accountIdentityFacet = (provider) => ({
|
|
1440
|
+
facetKey: "account-identity",
|
|
1441
1441
|
kind: "identity_link",
|
|
1442
1442
|
configSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
1443
1443
|
capabilities: {
|
|
@@ -1446,8 +1446,8 @@ var accountIdentityFeature = (provider) => ({
|
|
|
1446
1446
|
identity: "connected_account"
|
|
1447
1447
|
}
|
|
1448
1448
|
});
|
|
1449
|
-
var
|
|
1450
|
-
|
|
1449
|
+
var driveKnowledgeFacet = (provider) => ({
|
|
1450
|
+
facetKey: "drive-content",
|
|
1451
1451
|
kind: "knowledge_source",
|
|
1452
1452
|
configSchema: {
|
|
1453
1453
|
type: "object",
|
|
@@ -1501,9 +1501,9 @@ var driveKnowledgeFeature = (provider) => ({
|
|
|
1501
1501
|
cursor: provider === "google-drive" ? "page_token" : "delta_link"
|
|
1502
1502
|
}
|
|
1503
1503
|
});
|
|
1504
|
-
var
|
|
1504
|
+
var mailboxFacets = (provider) => [
|
|
1505
1505
|
{
|
|
1506
|
-
|
|
1506
|
+
facetKey: "mail-inbox",
|
|
1507
1507
|
kind: "inbound_trigger",
|
|
1508
1508
|
configSchema: {
|
|
1509
1509
|
type: "object",
|
|
@@ -1521,7 +1521,7 @@ var mailboxFeatures = (provider) => [
|
|
|
1521
1521
|
}
|
|
1522
1522
|
},
|
|
1523
1523
|
{
|
|
1524
|
-
|
|
1524
|
+
facetKey: "mail-delivery",
|
|
1525
1525
|
kind: "delivery_destination",
|
|
1526
1526
|
configSchema: {
|
|
1527
1527
|
type: "object",
|
|
@@ -1537,90 +1537,104 @@ var mailboxFeatures = (provider) => [
|
|
|
1537
1537
|
delivery: "email"
|
|
1538
1538
|
}
|
|
1539
1539
|
},
|
|
1540
|
-
|
|
1540
|
+
accountIdentityFacet(provider === "google-gmail" ? "google" : "microsoft")
|
|
1541
1541
|
];
|
|
1542
1542
|
var googleDiscoveryUrl = (service, version) => `https://www.googleapis.com/discovery/v1/apis/${service}/${version}/rest`;
|
|
1543
1543
|
var googleOAuth = (scopes) => ({
|
|
1544
|
+
kind: "oauth2",
|
|
1545
|
+
provider: "google",
|
|
1544
1546
|
authorizationUrl: "https://accounts.google.com/o/oauth2/v2/auth",
|
|
1545
1547
|
tokenUrl: "https://oauth2.googleapis.com/token",
|
|
1546
1548
|
scopes: ["openid", "email", "profile", ...scopes],
|
|
1547
1549
|
tokenPlacement: { carrier: "header", name: "Authorization", prefix: "Bearer " }
|
|
1548
1550
|
});
|
|
1549
|
-
var
|
|
1551
|
+
var GOOGLE_DRIVE_INTEGRATION_DEFINITION = {
|
|
1550
1552
|
id: "google-drive",
|
|
1551
1553
|
name: "Google Drive",
|
|
1552
1554
|
summary: "Files, folders, permissions, and shared drives.",
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1555
|
+
protocol: "openapi",
|
|
1556
|
+
provider: { id: "google", domain: "www.googleapis.com" },
|
|
1557
|
+
source: { kind: "google_discovery", url: googleDiscoveryUrl("drive", "v3") },
|
|
1556
1558
|
baseUrl: "https://www.googleapis.com/drive/v3/",
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1559
|
+
authentication: googleOAuth(["https://www.googleapis.com/auth/drive"]),
|
|
1560
|
+
healthCheck: {
|
|
1561
|
+
operationKey: "drive.about.get",
|
|
1562
|
+
arguments: { query: { fields: "user" } }
|
|
1563
|
+
},
|
|
1564
|
+
facets: [driveKnowledgeFacet("google-drive"), accountIdentityFacet("google")]
|
|
1561
1565
|
};
|
|
1562
|
-
var
|
|
1566
|
+
var GOOGLE_GMAIL_INTEGRATION_DEFINITION = {
|
|
1563
1567
|
id: "google-gmail",
|
|
1564
1568
|
name: "Gmail",
|
|
1565
1569
|
summary: "Messages, threads, labels, drafts, and sending mail.",
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1570
|
+
protocol: "openapi",
|
|
1571
|
+
provider: { id: "google", domain: "gmail.googleapis.com" },
|
|
1572
|
+
source: { kind: "google_discovery", url: googleDiscoveryUrl("gmail", "v1") },
|
|
1569
1573
|
baseUrl: "https://gmail.googleapis.com/",
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
+
authentication: googleOAuth(["https://mail.google.com/"]),
|
|
1575
|
+
healthCheck: {
|
|
1576
|
+
operationKey: "gmail.users.labels.list",
|
|
1577
|
+
arguments: { path: { userId: "me" } }
|
|
1578
|
+
},
|
|
1579
|
+
facets: mailboxFacets("google-gmail")
|
|
1574
1580
|
};
|
|
1575
1581
|
var MICROSOFT_GRAPH_OPENAPI_URL = "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml";
|
|
1576
1582
|
var MICROSOFT_GRAPH_BASE_URL = "https://graph.microsoft.com/v1.0";
|
|
1577
1583
|
var microsoftOAuth = (scopes) => ({
|
|
1584
|
+
kind: "oauth2",
|
|
1585
|
+
provider: "microsoft",
|
|
1578
1586
|
authorizationUrl: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
|
|
1579
1587
|
tokenUrl: "https://login.microsoftonline.com/common/oauth2/v2.0/token",
|
|
1580
1588
|
scopes: ["offline_access", "User.Read", ...scopes],
|
|
1581
1589
|
tokenPlacement: { carrier: "header", name: "Authorization", prefix: "Bearer " }
|
|
1582
1590
|
});
|
|
1583
|
-
var
|
|
1591
|
+
var MICROSOFT_OUTLOOK_MAIL_INTEGRATION_DEFINITION = {
|
|
1584
1592
|
id: "microsoft-outlook-mail",
|
|
1585
1593
|
name: "Outlook Mail",
|
|
1586
1594
|
summary: "Messages, folders, attachments, settings, and sending mail.",
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1595
|
+
protocol: "openapi",
|
|
1596
|
+
provider: { id: "microsoft", domain: "graph.microsoft.com" },
|
|
1597
|
+
source: {
|
|
1598
|
+
kind: "openapi",
|
|
1599
|
+
url: MICROSOFT_GRAPH_OPENAPI_URL,
|
|
1600
|
+
operationPathPrefixes: [
|
|
1601
|
+
"/me/messages",
|
|
1602
|
+
"/me/mailFolders",
|
|
1603
|
+
"/me/sendMail",
|
|
1604
|
+
"/me/getMailTips",
|
|
1605
|
+
"/me/inferenceClassification",
|
|
1606
|
+
"/me/mailboxSettings",
|
|
1607
|
+
"/me/outlook"
|
|
1608
|
+
]
|
|
1609
|
+
},
|
|
1590
1610
|
baseUrl: MICROSOFT_GRAPH_BASE_URL,
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
"/me/messages",
|
|
1594
|
-
"/me/mailFolders",
|
|
1595
|
-
"/me/sendMail",
|
|
1596
|
-
"/me/getMailTips",
|
|
1597
|
-
"/me/inferenceClassification",
|
|
1598
|
-
"/me/mailboxSettings",
|
|
1599
|
-
"/me/outlook"
|
|
1600
|
-
],
|
|
1601
|
-
features: mailboxFeatures("microsoft-outlook-mail")
|
|
1611
|
+
authentication: microsoftOAuth(["Mail.ReadWrite", "Mail.Send", "MailboxSettings.ReadWrite"]),
|
|
1612
|
+
facets: mailboxFacets("microsoft-outlook-mail")
|
|
1602
1613
|
};
|
|
1603
|
-
var
|
|
1614
|
+
var MICROSOFT_OUTLOOK_CALENDAR_INTEGRATION_DEFINITION = {
|
|
1604
1615
|
id: "microsoft-outlook-calendar",
|
|
1605
1616
|
name: "Outlook Calendar",
|
|
1606
1617
|
summary: "Calendars, events, availability, and scheduling.",
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1618
|
+
protocol: "openapi",
|
|
1619
|
+
provider: { id: "microsoft", domain: "graph.microsoft.com" },
|
|
1620
|
+
source: {
|
|
1621
|
+
kind: "openapi",
|
|
1622
|
+
url: MICROSOFT_GRAPH_OPENAPI_URL,
|
|
1623
|
+
operationPathPrefixes: [
|
|
1624
|
+
"/me/calendar",
|
|
1625
|
+
"/me/calendars",
|
|
1626
|
+
"/me/calendarGroups",
|
|
1627
|
+
"/me/calendarView",
|
|
1628
|
+
"/me/events",
|
|
1629
|
+
"/me/findMeetingTimes",
|
|
1630
|
+
"/me/reminderView"
|
|
1631
|
+
]
|
|
1632
|
+
},
|
|
1610
1633
|
baseUrl: MICROSOFT_GRAPH_BASE_URL,
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
"/me/calendar",
|
|
1614
|
-
"/me/calendars",
|
|
1615
|
-
"/me/calendarGroups",
|
|
1616
|
-
"/me/calendarView",
|
|
1617
|
-
"/me/events",
|
|
1618
|
-
"/me/findMeetingTimes",
|
|
1619
|
-
"/me/reminderView"
|
|
1620
|
-
],
|
|
1621
|
-
features: [
|
|
1634
|
+
authentication: microsoftOAuth(["Calendars.ReadWrite"]),
|
|
1635
|
+
facets: [
|
|
1622
1636
|
{
|
|
1623
|
-
|
|
1637
|
+
facetKey: "calendar-events",
|
|
1624
1638
|
kind: "inbound_trigger",
|
|
1625
1639
|
configSchema: {
|
|
1626
1640
|
type: "object",
|
|
@@ -1638,7 +1652,7 @@ var MICROSOFT_OUTLOOK_CALENDAR_PRESET = {
|
|
|
1638
1652
|
}
|
|
1639
1653
|
},
|
|
1640
1654
|
{
|
|
1641
|
-
|
|
1655
|
+
facetKey: "calendar-delivery",
|
|
1642
1656
|
kind: "delivery_destination",
|
|
1643
1657
|
configSchema: {
|
|
1644
1658
|
type: "object",
|
|
@@ -1653,70 +1667,79 @@ var MICROSOFT_OUTLOOK_CALENDAR_PRESET = {
|
|
|
1653
1667
|
delivery: "calendar_event"
|
|
1654
1668
|
}
|
|
1655
1669
|
},
|
|
1656
|
-
|
|
1670
|
+
accountIdentityFacet("microsoft")
|
|
1657
1671
|
]
|
|
1658
1672
|
};
|
|
1659
|
-
var
|
|
1673
|
+
var MICROSOFT_OUTLOOK_CONTACTS_INTEGRATION_DEFINITION = {
|
|
1660
1674
|
id: "microsoft-outlook-contacts",
|
|
1661
1675
|
name: "Outlook Contacts",
|
|
1662
1676
|
summary: "Contacts, contact folders, and people suggestions.",
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1677
|
+
protocol: "openapi",
|
|
1678
|
+
provider: { id: "microsoft", domain: "graph.microsoft.com" },
|
|
1679
|
+
source: {
|
|
1680
|
+
kind: "openapi",
|
|
1681
|
+
url: MICROSOFT_GRAPH_OPENAPI_URL,
|
|
1682
|
+
operationPathPrefixes: ["/me/contacts", "/me/contactFolders", "/me/people"]
|
|
1683
|
+
},
|
|
1666
1684
|
baseUrl: MICROSOFT_GRAPH_BASE_URL,
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
features: [accountIdentityFeature("microsoft")]
|
|
1685
|
+
authentication: microsoftOAuth(["Contacts.ReadWrite", "People.Read.All"]),
|
|
1686
|
+
facets: [accountIdentityFacet("microsoft")]
|
|
1670
1687
|
};
|
|
1671
|
-
var
|
|
1688
|
+
var MICROSOFT_ONEDRIVE_INTEGRATION_DEFINITION = {
|
|
1672
1689
|
id: "microsoft-onedrive",
|
|
1673
1690
|
name: "OneDrive",
|
|
1674
1691
|
summary: "Drives, files, folders, sharing links, and permissions.",
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1692
|
+
protocol: "openapi",
|
|
1693
|
+
provider: { id: "microsoft", domain: "graph.microsoft.com" },
|
|
1694
|
+
source: {
|
|
1695
|
+
kind: "openapi",
|
|
1696
|
+
url: MICROSOFT_GRAPH_OPENAPI_URL,
|
|
1697
|
+
operationPathPrefixes: ["/me/drive", "/me/drives", "/me/followedSites", "/drives", "/shares"]
|
|
1698
|
+
},
|
|
1678
1699
|
baseUrl: MICROSOFT_GRAPH_BASE_URL,
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
features: [driveKnowledgeFeature("microsoft-onedrive"), accountIdentityFeature("microsoft")]
|
|
1700
|
+
authentication: microsoftOAuth(["Files.ReadWrite.All", "Sites.ReadWrite.All"]),
|
|
1701
|
+
facets: [driveKnowledgeFacet("microsoft-onedrive"), accountIdentityFacet("microsoft")]
|
|
1682
1702
|
};
|
|
1683
|
-
var
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1703
|
+
var CORE_INTEGRATION_DEFINITIONS = [
|
|
1704
|
+
GOOGLE_DRIVE_INTEGRATION_DEFINITION,
|
|
1705
|
+
GOOGLE_GMAIL_INTEGRATION_DEFINITION,
|
|
1706
|
+
MICROSOFT_OUTLOOK_MAIL_INTEGRATION_DEFINITION,
|
|
1707
|
+
MICROSOFT_OUTLOOK_CALENDAR_INTEGRATION_DEFINITION,
|
|
1708
|
+
MICROSOFT_OUTLOOK_CONTACTS_INTEGRATION_DEFINITION,
|
|
1709
|
+
MICROSOFT_ONEDRIVE_INTEGRATION_DEFINITION
|
|
1690
1710
|
];
|
|
1691
|
-
function
|
|
1692
|
-
return
|
|
1711
|
+
function integrationDefinitionById(id) {
|
|
1712
|
+
return CORE_INTEGRATION_DEFINITIONS.find((definition) => definition.id === id);
|
|
1693
1713
|
}
|
|
1694
|
-
function
|
|
1695
|
-
return
|
|
1714
|
+
function integrationDefinitionProviderDomain(definition) {
|
|
1715
|
+
return definition.provider.domain;
|
|
1696
1716
|
}
|
|
1697
|
-
function
|
|
1698
|
-
return
|
|
1717
|
+
function integrationFacetDefinitions(definitionId) {
|
|
1718
|
+
return definitionId ? integrationDefinitionById(definitionId)?.facets ?? [] : [];
|
|
1699
1719
|
}
|
|
1700
|
-
function
|
|
1701
|
-
if (!
|
|
1720
|
+
function filterOpenApiDocumentForDefinition(document, definition) {
|
|
1721
|
+
if (definition.source.kind !== "openapi" || !definition.source.operationPathPrefixes?.length) {
|
|
1722
|
+
return document;
|
|
1723
|
+
}
|
|
1724
|
+
const operationPathPrefixes = definition.source.operationPathPrefixes;
|
|
1702
1725
|
if (!isRecord3(document.paths)) {
|
|
1703
1726
|
throw new IntegrationProtocolError("openapi_paths", "OpenAPI document has no paths object");
|
|
1704
1727
|
}
|
|
1705
1728
|
const paths = Object.fromEntries(
|
|
1706
1729
|
Object.entries(document.paths).filter(
|
|
1707
|
-
([path]) =>
|
|
1730
|
+
([path]) => operationPathPrefixes.some((prefix) => path === prefix || path.startsWith(`${prefix}/`))
|
|
1708
1731
|
)
|
|
1709
1732
|
);
|
|
1710
1733
|
if (Object.keys(paths).length === 0) {
|
|
1711
1734
|
throw new IntegrationProtocolError(
|
|
1712
|
-
"
|
|
1713
|
-
`${
|
|
1735
|
+
"integration_definition_empty",
|
|
1736
|
+
`${definition.name} did not match any operations in the supplied OpenAPI document`
|
|
1714
1737
|
);
|
|
1715
1738
|
}
|
|
1716
1739
|
return {
|
|
1717
1740
|
...document,
|
|
1718
1741
|
paths,
|
|
1719
|
-
|
|
1742
|
+
servers: [{ url: definition.baseUrl }]
|
|
1720
1743
|
};
|
|
1721
1744
|
}
|
|
1722
1745
|
function googleDiscoveryToOpenApi(discovery) {
|
|
@@ -1895,11 +1918,11 @@ function isRecord3(value) {
|
|
|
1895
1918
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1896
1919
|
}
|
|
1897
1920
|
export {
|
|
1898
|
-
|
|
1921
|
+
CORE_INTEGRATION_DEFINITIONS,
|
|
1899
1922
|
DEFAULT_INTEGRATION_RESPONSE_BYTES,
|
|
1900
1923
|
DEFAULT_INTEGRATION_TIMEOUT_MS,
|
|
1901
|
-
|
|
1902
|
-
|
|
1924
|
+
GOOGLE_DRIVE_INTEGRATION_DEFINITION,
|
|
1925
|
+
GOOGLE_GMAIL_INTEGRATION_DEFINITION,
|
|
1903
1926
|
GraphqlMcpServer,
|
|
1904
1927
|
IntegrationInvocationError,
|
|
1905
1928
|
IntegrationProtocolError,
|
|
@@ -1907,10 +1930,10 @@ export {
|
|
|
1907
1930
|
MAX_INTEGRATION_TOOLS,
|
|
1908
1931
|
MICROSOFT_GRAPH_BASE_URL,
|
|
1909
1932
|
MICROSOFT_GRAPH_OPENAPI_URL,
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1933
|
+
MICROSOFT_ONEDRIVE_INTEGRATION_DEFINITION,
|
|
1934
|
+
MICROSOFT_OUTLOOK_CALENDAR_INTEGRATION_DEFINITION,
|
|
1935
|
+
MICROSOFT_OUTLOOK_CONTACTS_INTEGRATION_DEFINITION,
|
|
1936
|
+
MICROSOFT_OUTLOOK_MAIL_INTEGRATION_DEFINITION,
|
|
1914
1937
|
OpenApiMcpServer,
|
|
1915
1938
|
applyCredentialPlacements,
|
|
1916
1939
|
assertCredentialAudience,
|
|
@@ -1927,15 +1950,15 @@ export {
|
|
|
1927
1950
|
fetchGraphqlIntrospection,
|
|
1928
1951
|
fetchIntegrationSourceDocument,
|
|
1929
1952
|
fetchWithDeadline,
|
|
1930
|
-
|
|
1953
|
+
filterOpenApiDocumentForDefinition,
|
|
1931
1954
|
googleDiscoveryToOpenApi,
|
|
1932
1955
|
immutableRevisionId,
|
|
1933
|
-
|
|
1956
|
+
integrationDefinitionById,
|
|
1957
|
+
integrationDefinitionProviderDomain,
|
|
1958
|
+
integrationFacetDefinitions,
|
|
1934
1959
|
invokeGraphqlOperation,
|
|
1935
1960
|
invokeOpenApiOperation,
|
|
1936
1961
|
parseOpenApiDocument,
|
|
1937
|
-
providerDomainForPreset,
|
|
1938
|
-
providerPresetById,
|
|
1939
1962
|
readIntegrationResponse,
|
|
1940
1963
|
sha256Hex,
|
|
1941
1964
|
stableToolId,
|