@inixiative/integrations 0.2.1 → 0.4.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 +21 -13
- package/package.json +4 -3
- package/src/catalog/acceptedCredentialMethods.ts +17 -0
- package/src/catalog/catalogOperationMeta.ts +4 -0
- package/src/catalog/catalogOperations.ts +10 -0
- package/src/catalog/integrationFamilies.ts +12 -0
- package/src/catalog/integrationFamilyDefinition.ts +6 -0
- package/src/catalog/isAccountSuppliedByHost.ts +2 -2
- package/src/catalog/providerAuthenticatesThroughIntegrationFamily.ts +6 -0
- package/src/catalog/providerModel.ts +0 -1
- package/src/catalog/providers.ts +0 -4
- package/src/catalog/providersInIntegrationFamily.ts +5 -0
- package/src/contracts.ts +36 -25
- package/src/credentials/credentialAuth.ts +38 -0
- package/src/credentials/credentialClient.ts +2 -2
- package/src/credentials/exchangeOauthCode.ts +41 -41
- package/src/credentials/mintProviderCredential.ts +26 -40
- package/src/credentials/providerExchangeTimeoutMs.ts +1 -1
- package/src/credentials/refreshProviderCredential.ts +102 -83
- package/src/credentials/renewalError.ts +11 -0
- package/src/credentials/renewalOwner.ts +3 -0
- package/src/credentials/requestOauthToken.ts +28 -0
- package/src/credentials/validateCredentialSecret.ts +5 -5
- package/src/index.ts +0 -1
- package/src/integrationFamilies/atlassianIntegrationFamily.ts +12 -0
- package/src/{providers/github/githubProvider.ts → integrationFamilies/githubIntegrationFamily.ts} +2 -3
- package/src/{providers/google/googleProvider.ts → integrationFamilies/googleIntegrationFamily.ts} +2 -3
- package/src/integrationFamilies/inixiativeIntegrationFamily.ts +8 -0
- package/src/operations/providerOperationInput.ts +6 -0
- package/src/operations/providerOperationInputSchema.ts +36 -0
- package/src/operations/providerOperationOrThrow.ts +23 -0
- package/src/operations/providerOperationSet.ts +7 -0
- package/src/operations/providerOperations.ts +38 -0
- package/src/providers/chorus/chorusProvider.ts +1 -0
- package/src/providers/confluence/confluenceApiBaseUrl.ts +1 -0
- package/src/providers/confluence/confluenceOperations.ts +4 -0
- package/src/providers/confluence/confluenceProvider.ts +6 -8
- package/src/providers/confluence/models/page/fetchConfluencePage.ts +23 -0
- package/src/providers/discord/discordApiBaseUrl.ts +1 -0
- package/src/providers/discord/discordOperations.ts +8 -0
- package/src/providers/discord/discordProvider.ts +5 -14
- package/src/providers/discord/models/channel/discordChannelKind.ts +1 -0
- package/src/providers/discord/models/channel/fetchDiscordChannel.ts +25 -0
- package/src/providers/discord/models/channel/fetchDiscordChannelMessages.ts +37 -0
- package/src/providers/drive/driveApiBaseUrl.ts +1 -0
- package/src/providers/drive/driveOperations.ts +4 -0
- package/src/providers/drive/driveProvider.ts +7 -10
- package/src/providers/drive/models/file/fetchDriveFile.ts +27 -0
- package/src/providers/github/auth/createGithubInstallationToken.ts +19 -0
- package/src/providers/github/auth/fetchGithubAppInstallUrl.ts +21 -0
- package/src/providers/github/auth/fetchGithubAppInstallation.ts +16 -19
- package/src/providers/github/auth/fetchGithubOrganizationRole.ts +22 -22
- package/src/providers/github/auth/fetchGithubUser.ts +10 -4
- package/src/providers/github/auth/githubAppAuth.ts +6 -0
- package/src/providers/github/auth/githubUserAuthorizeUrl.ts +2 -2
- package/src/providers/github/auth/listGithubUserInstallationPage.ts +18 -0
- package/src/providers/github/events/listGithubNotificationPage.ts +18 -0
- package/src/providers/github/githubApiBaseUrl.ts +1 -0
- package/src/providers/github/githubOrganizationProvider.ts +6 -2
- package/src/providers/github/githubPagination.ts +2 -2
- package/src/providers/github/githubRequestHeaders.ts +4 -6
- package/src/providers/github/githubUserProvider.ts +7 -4
- package/src/providers/github/models/account/githubAccount.ts +0 -1
- package/src/providers/github/models/repository/fetchGithubBlob.ts +59 -0
- package/src/providers/github/models/repository/fetchGithubCommit.ts +38 -0
- package/src/providers/github/models/repository/fetchGithubTree.ts +74 -0
- package/src/providers/github/models/repository/githubObjectRequest.ts +15 -0
- package/src/providers/github/models/repository/githubRepository.ts +1 -11
- package/src/providers/github/models/repository/githubRepositoryOperations.ts +10 -0
- package/src/providers/github/models/repository/listGithubInstallationRepositoryPage.ts +18 -0
- package/src/providers/github/models/repository/listGithubUserInstallationRepositoryPage.ts +22 -0
- package/src/providers/github/models/repository/readGithubObjectIdentity.ts +9 -0
- package/src/providers/github/services/fetchGithubUserInstallation.ts +25 -0
- package/src/providers/github/services/listGithubNotifications.ts +27 -0
- package/src/providers/github/services/listInstallationRepositories.ts +34 -0
- package/src/providers/github/services/listUserRepositories.ts +43 -0
- package/src/providers/gmail/gmailApiBaseUrl.ts +1 -0
- package/src/providers/gmail/gmailOperations.ts +10 -0
- package/src/providers/gmail/gmailProvider.ts +8 -11
- package/src/providers/gmail/models/label/listGmailLabelMessages.ts +45 -0
- package/src/providers/gmail/models/message/fetchGmailMessage.ts +19 -0
- package/src/providers/gmail/models/message/fetchGmailMessageBatch.ts +20 -0
- package/src/providers/gmail/models/message/gmailMessageKind.ts +1 -0
- package/src/providers/gmail/models/message/gmailMessageRequest.ts +9 -0
- package/src/providers/gmail/models/message/readGmailMessage.ts +26 -0
- package/src/providers/google/auth/buildGoogleAuthorizationUrl.ts +2 -1
- package/src/providers/google/auth/verifyGoogleIdToken.ts +3 -3
- package/src/providers/jira/jiraApiBaseUrl.ts +1 -0
- package/src/providers/jira/jiraOperations.ts +4 -0
- package/src/providers/jira/jiraProvider.ts +6 -8
- package/src/providers/jira/models/issue/fetchJiraIssue.ts +22 -0
- package/src/providers/linear/events/createLinearWebhook.ts +29 -20
- package/src/providers/linear/events/deleteLinearWebhook.ts +16 -9
- package/src/providers/linear/events/linearWebhook.ts +1 -1
- package/src/providers/linear/events/listLinearWebhookPage.ts +23 -0
- package/src/providers/linear/events/repairLinearWebhook.ts +17 -13
- package/src/providers/linear/linearApiBaseUrl.ts +1 -0
- package/src/providers/linear/linearGraphqlErrorCode.ts +8 -0
- package/src/providers/linear/linearOperations.ts +4 -0
- package/src/providers/linear/linearPagination.ts +3 -9
- package/src/providers/linear/linearProvider.ts +5 -2
- package/src/providers/linear/models/issue/fetchLinearIssue.ts +32 -0
- package/src/providers/linear/models/team/fetchLinearWorkspace.ts +23 -13
- package/src/providers/linear/models/team/linearTeam.ts +0 -1
- package/src/providers/linear/services/listLinearWebhooks.ts +45 -0
- package/src/providers/notion/models/page/fetchNotionPage.ts +32 -0
- package/src/providers/notion/models/page/fetchNotionPageBlocks.ts +39 -0
- package/src/providers/notion/models/page/notionPageKind.ts +1 -0
- package/src/providers/notion/notionApiBaseUrl.ts +1 -0
- package/src/providers/notion/notionOperations.ts +8 -0
- package/src/providers/notion/notionProvider.ts +5 -14
- package/src/providers/notion/notionVersion.ts +1 -0
- package/src/providers/oracle/oracleProvider.ts +1 -0
- package/src/providers/slack/auth/fetchSlackIdentity.ts +14 -6
- package/src/providers/slack/models/account/slackAccount.ts +0 -1
- package/src/providers/slack/models/channel/fetchSlackChannel.ts +32 -0
- package/src/providers/slack/models/channel/fetchSlackChannelMessages.ts +34 -0
- package/src/providers/slack/models/channel/listSlackUserConversations.ts +19 -0
- package/src/providers/slack/models/channel/slackChannel.ts +0 -14
- package/src/providers/slack/readSlackBody.ts +10 -0
- package/src/providers/slack/services/listSlackChannels.ts +23 -0
- package/src/providers/slack/slackApiBaseUrl.ts +1 -0
- package/src/providers/slack/slackOperations.ts +8 -0
- package/src/providers/slack/slackPagination.ts +2 -2
- package/src/providers/slack/slackProvider.ts +9 -1
- package/src/providers/slack/slackProviderError.ts +2 -2
- package/src/providers/teams/models/channel/fetchTeamsChannelMessages.ts +36 -0
- package/src/providers/teams/teamsApiBaseUrl.ts +1 -0
- package/src/providers/teams/teamsOperations.ts +6 -0
- package/src/providers/teams/teamsProvider.ts +5 -8
- package/src/utils/acceptJsonHeaders.ts +1 -0
- package/src/utils/pageQuerySchema.ts +13 -0
- package/src/utils/readProviderLimits.ts +1 -2
- package/src/catalog/familyProducts.ts +0 -5
- package/src/catalog/isFamilyManaged.ts +0 -7
- package/src/catalog/providerFamily.ts +0 -4
- package/src/credentials/fetchRenewalResponse.ts +0 -41
- package/src/credentials/renewalRequest.ts +0 -1
- package/src/operations/buildProviderRequest.ts +0 -54
- package/src/operations/executeProvider.ts +0 -26
- package/src/operations/findOperationHandler.ts +0 -6
- package/src/operations/operationHandler.ts +0 -8
- package/src/operations/operationHandlers.ts +0 -41
- package/src/operations/operationRequestInput.ts +0 -12
- package/src/operations/providerRequestSpec.ts +0 -1
- package/src/providers/confluence/confluenceOperationHandler.ts +0 -14
- package/src/providers/discord/discordOperationHandler.ts +0 -30
- package/src/providers/drive/driveOperationHandler.ts +0 -21
- package/src/providers/github/auth/fetchGithubUserInstallation.ts +0 -21
- package/src/providers/github/auth/githubAppClient.ts +0 -4
- package/src/providers/github/auth/githubAppInstallUrl.ts +0 -20
- package/src/providers/github/auth/githubClientForApp.ts +0 -11
- package/src/providers/github/events/listGithubNotifications.ts +0 -27
- package/src/providers/github/fetchAllGithubPages.ts +0 -12
- package/src/providers/github/iterateGithubPages.ts +0 -12
- package/src/providers/github/models/repository/githubOperationHandler.ts +0 -36
- package/src/providers/github/models/repository/listInstallationRepositories.ts +0 -31
- package/src/providers/github/models/repository/listUserRepositories.ts +0 -36
- package/src/providers/github/models/repository/readGithubObject.ts +0 -85
- package/src/providers/github/requestGithub.ts +0 -18
- package/src/providers/gmail/buildGmailMessageRequest.ts +0 -22
- package/src/providers/gmail/fetchGmailMessages.ts +0 -81
- package/src/providers/gmail/gmailOperationHandler.ts +0 -12
- package/src/providers/jira/jiraOperationHandler.ts +0 -14
- package/src/providers/linear/events/listLinearWebhooks.ts +0 -44
- package/src/providers/linear/fetchAllLinearPages.ts +0 -40
- package/src/providers/linear/linearClient.ts +0 -5
- package/src/providers/linear/linearRequestInput.ts +0 -1
- package/src/providers/linear/models/issue/linearIssue.ts +0 -11
- package/src/providers/linear/models/issue/linearOperationHandler.ts +0 -30
- package/src/providers/linear/requestLinear.ts +0 -51
- package/src/providers/notion/notionOperationHandler.ts +0 -32
- package/src/providers/slack/fetchAllSlackPages.ts +0 -12
- package/src/providers/slack/models/channel/listSlackChannels.ts +0 -26
- package/src/providers/slack/models/channel/slackOperationHandler.ts +0 -30
- package/src/providers/slack/requestSlack.ts +0 -22
- package/src/providers/teams/teamsOperationHandler.ts +0 -24
- package/src/utils/headerNumber.ts +0 -6
- package/src/utils/pagination/applyCaps.ts +0 -18
- package/src/utils/pagination/byCursorKeys.ts +0 -7
- package/src/utils/pagination/byCursorOptions.ts +0 -7
- package/src/utils/pagination/byPageKeys.ts +0 -7
- package/src/utils/pagination/byPageOptions.ts +0 -8
- package/src/utils/pagination/collectPages.ts +0 -27
- package/src/utils/pagination/compactRequest.ts +0 -4
- package/src/utils/pagination/fetchAllByCursor.ts +0 -6
- package/src/utils/pagination/fetchAllByPage.ts +0 -6
- package/src/utils/pagination/fetchAllRequestPages.ts +0 -16
- package/src/utils/pagination/incompletePageWalkError.ts +0 -8
- package/src/utils/pagination/isAnotherPage.ts +0 -20
- package/src/utils/pagination/iterateByCursor.ts +0 -49
- package/src/utils/pagination/iterateByPage.ts +0 -59
- package/src/utils/pagination/iterateProviderPages.ts +0 -27
- package/src/utils/pagination/iterateRequestPages.ts +0 -18
- package/src/utils/pagination/pageWalkError.ts +0 -6
- package/src/utils/pagination/paginationOptions.ts +0 -9
- package/src/utils/pagination/providerPagesOptions.ts +0 -8
- package/src/utils/pagination/providerPagination.ts +0 -6
- package/src/utils/pagination/readPage.ts +0 -29
- package/src/utils/pagination/readPath.ts +0 -12
- package/src/utils/pagination/repeatedCursorError.ts +0 -10
- package/src/utils/providerClient.ts +0 -3
- package/src/utils/providerError.ts +0 -10
- package/src/utils/providerRequest.ts +0 -22
- package/src/utils/providerRequestInput.ts +0 -7
- package/src/utils/providerResponseLimit.ts +0 -1
- package/src/utils/providerSend.ts +0 -1
- package/src/utils/readProviderJson.ts +0 -38
- package/src/utils/readRateLimit.ts +0 -29
- package/src/utils/requestProviderJson.ts +0 -13
- package/src/utils/responseBudget.ts +0 -1
- package/src/utils/sendProviderRequest.ts +0 -33
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { makeApiOperation } from '@inixiative/api-client/operation';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { providerOperationInputSchema } from '../../../../operations/providerOperationInputSchema';
|
|
4
|
+
import { acceptJsonHeaders } from '../../../../utils/acceptJsonHeaders';
|
|
5
|
+
import { select } from '../../../../utils/select';
|
|
6
|
+
import { discordChannelKind } from './discordChannelKind';
|
|
7
|
+
|
|
8
|
+
export const fetchDiscordChannelMessages = makeApiOperation({
|
|
9
|
+
key: 'messages.read',
|
|
10
|
+
idempotent: true,
|
|
11
|
+
response: 'json',
|
|
12
|
+
meta: {
|
|
13
|
+
name: 'Read channel messages',
|
|
14
|
+
resourceKind: discordChannelKind,
|
|
15
|
+
requiredScopes: ['VIEW_CHANNEL and READ_MESSAGE_HISTORY'],
|
|
16
|
+
},
|
|
17
|
+
input: providerOperationInputSchema(['discord'], discordChannelKind),
|
|
18
|
+
toRequest: ({ resource, limit }) => ({
|
|
19
|
+
path: 'channels/:channelId/messages',
|
|
20
|
+
headers: acceptJsonHeaders,
|
|
21
|
+
params: { channelId: resource.externalId },
|
|
22
|
+
query: { limit },
|
|
23
|
+
}),
|
|
24
|
+
parse: ({ body }, { limit }) => {
|
|
25
|
+
const messages = z.array(z.unknown()).parse(body);
|
|
26
|
+
return {
|
|
27
|
+
messages: messages.map((item) => {
|
|
28
|
+
const message = select(item, ['id', 'content', 'timestamp', 'type', 'author']);
|
|
29
|
+
return {
|
|
30
|
+
...message,
|
|
31
|
+
author: select(message.author ?? {}, ['id', 'username', 'global_name']),
|
|
32
|
+
};
|
|
33
|
+
}),
|
|
34
|
+
hasMore: messages.length >= limit,
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const driveApiBaseUrl = 'https://www.googleapis.com/drive/v3/';
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
+
import { catalogOperations } from '../../catalog/catalogOperations';
|
|
1
2
|
import type { ProviderDefinition } from '../../contracts';
|
|
3
|
+
import { driveApiBaseUrl } from './driveApiBaseUrl';
|
|
4
|
+
import { driveOperations } from './driveOperations';
|
|
2
5
|
|
|
3
6
|
export const driveProvider: ProviderDefinition = {
|
|
4
7
|
key: 'drive',
|
|
5
8
|
name: 'Google Drive',
|
|
6
9
|
documentationUrl: 'https://developers.google.com/workspace/drive/api/reference/rest/v3/files/get',
|
|
7
|
-
authMethods: ['
|
|
8
|
-
|
|
10
|
+
authMethods: ['integrationFamily'],
|
|
11
|
+
integrationFamily: 'google',
|
|
9
12
|
oauthScopes: ['https://www.googleapis.com/auth/drive.metadata.readonly'],
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
key: 'files.read',
|
|
13
|
-
name: 'Read file metadata',
|
|
14
|
-
resourceKind: 'file',
|
|
15
|
-
requiredScopes: ['https://www.googleapis.com/auth/drive.metadata.readonly'],
|
|
16
|
-
},
|
|
17
|
-
],
|
|
13
|
+
apiBaseUrl: driveApiBaseUrl,
|
|
14
|
+
operations: catalogOperations(driveOperations),
|
|
18
15
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { makeApiOperation } from '@inixiative/api-client/operation';
|
|
2
|
+
import { providerOperationInputSchema } from '../../../../operations/providerOperationInputSchema';
|
|
3
|
+
import { acceptJsonHeaders } from '../../../../utils/acceptJsonHeaders';
|
|
4
|
+
import { objectSchema } from '../../../../utils/objectSchema';
|
|
5
|
+
import { select } from '../../../../utils/select';
|
|
6
|
+
|
|
7
|
+
const kind = 'file';
|
|
8
|
+
const fields = ['id', 'name', 'mimeType', 'description', 'modifiedTime', 'size'];
|
|
9
|
+
|
|
10
|
+
export const fetchDriveFile = makeApiOperation({
|
|
11
|
+
key: 'files.read',
|
|
12
|
+
idempotent: true,
|
|
13
|
+
response: 'json',
|
|
14
|
+
meta: {
|
|
15
|
+
name: 'Read file metadata',
|
|
16
|
+
resourceKind: kind,
|
|
17
|
+
requiredScopes: ['https://www.googleapis.com/auth/drive.metadata.readonly'],
|
|
18
|
+
},
|
|
19
|
+
input: providerOperationInputSchema(['drive'], kind),
|
|
20
|
+
toRequest: ({ resource }) => ({
|
|
21
|
+
path: 'files/:fileId',
|
|
22
|
+
headers: acceptJsonHeaders,
|
|
23
|
+
params: { fileId: resource.externalId },
|
|
24
|
+
query: { fields: fields.join(','), supportsAllDrives: 'true' },
|
|
25
|
+
}),
|
|
26
|
+
parse: ({ body }) => select(objectSchema.parse(body), fields),
|
|
27
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { makeApiOperation } from '@inixiative/api-client/operation';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { githubRequestHeaders } from '../githubRequestHeaders';
|
|
4
|
+
|
|
5
|
+
export const createGithubInstallationToken = makeApiOperation({
|
|
6
|
+
key: 'app.installations.accessTokens.create',
|
|
7
|
+
idempotent: false,
|
|
8
|
+
response: 'json',
|
|
9
|
+
responseLimitBytes: 128 * 1024,
|
|
10
|
+
input: z.strictObject({ installationId: z.string().min(1) }),
|
|
11
|
+
toRequest: ({ installationId }) => ({
|
|
12
|
+
path: 'app/installations/:installationId/access_tokens',
|
|
13
|
+
method: 'POST',
|
|
14
|
+
params: { installationId },
|
|
15
|
+
headers: githubRequestHeaders,
|
|
16
|
+
body: { permissions: { contents: 'read' } },
|
|
17
|
+
}),
|
|
18
|
+
parse: ({ body }) => z.record(z.string(), z.unknown()).parse(body),
|
|
19
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { makeApiOperation } from '@inixiative/api-client/operation';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { githubRequestHeaders } from '../githubRequestHeaders';
|
|
4
|
+
|
|
5
|
+
const githubAppSchema = z.object({
|
|
6
|
+
html_url: z.url({ protocol: /^https$/, hostname: /^github\.com$/ }),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const fetchGithubAppInstallUrl = makeApiOperation({
|
|
10
|
+
key: 'app.read',
|
|
11
|
+
idempotent: true,
|
|
12
|
+
response: 'json',
|
|
13
|
+
input: z.strictObject({ state: z.string().min(1) }),
|
|
14
|
+
toRequest: () => ({ path: 'app', headers: githubRequestHeaders }),
|
|
15
|
+
parse: ({ body }, { state }) => {
|
|
16
|
+
const { html_url } = githubAppSchema.parse(body);
|
|
17
|
+
const url = new URL(`${html_url.replace(/\/+$/, '')}/installations/new`);
|
|
18
|
+
url.searchParams.set('state', state);
|
|
19
|
+
return url.toString();
|
|
20
|
+
},
|
|
21
|
+
});
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { githubClientForApp } from './githubClientForApp';
|
|
1
|
+
import { makeApiOperation } from '@inixiative/api-client/operation';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { githubRequestHeaders } from '../githubRequestHeaders';
|
|
5
4
|
import { githubInstallationSchema } from './githubInstallationSchema';
|
|
6
5
|
|
|
7
|
-
export const fetchGithubAppInstallation =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
};
|
|
6
|
+
export const fetchGithubAppInstallation = makeApiOperation({
|
|
7
|
+
key: 'app.installations.read',
|
|
8
|
+
idempotent: true,
|
|
9
|
+
response: 'json',
|
|
10
|
+
readableStatuses: [404],
|
|
11
|
+
input: z.strictObject({ installationId: z.string().min(1) }),
|
|
12
|
+
toRequest: ({ installationId }) => ({
|
|
13
|
+
path: 'app/installations/:installationId',
|
|
14
|
+
params: { installationId },
|
|
15
|
+
headers: githubRequestHeaders,
|
|
16
|
+
}),
|
|
17
|
+
parse: ({ status, body }) => (status === 404 ? null : githubInstallationSchema.parse(body)),
|
|
18
|
+
});
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
+
import { ApiError } from '@inixiative/api-client';
|
|
2
|
+
import { readRateLimit } from '@inixiative/api-client/http';
|
|
3
|
+
import { makeApiOperation } from '@inixiative/api-client/operation';
|
|
1
4
|
import { z } from 'zod';
|
|
2
|
-
import
|
|
3
|
-
import { ProviderError } from '../../../utils/providerError';
|
|
4
|
-
import { requestGithub } from '../requestGithub';
|
|
5
|
+
import { githubRequestHeaders } from '../githubRequestHeaders';
|
|
5
6
|
|
|
6
7
|
const membershipSchema = z.object({ state: z.string(), role: z.string() });
|
|
7
8
|
|
|
8
|
-
export const fetchGithubOrganizationRole =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
export const fetchGithubOrganizationRole = makeApiOperation({
|
|
10
|
+
key: 'user.memberships.orgs.read',
|
|
11
|
+
idempotent: true,
|
|
12
|
+
response: 'json',
|
|
13
|
+
readableStatuses: [403, 404],
|
|
14
|
+
input: z.strictObject({ organizationLogin: z.string().min(1) }),
|
|
15
|
+
toRequest: ({ organizationLogin }) => ({
|
|
16
|
+
path: 'user/memberships/orgs/:organizationLogin',
|
|
17
|
+
params: { organizationLogin },
|
|
18
|
+
headers: githubRequestHeaders,
|
|
19
|
+
}),
|
|
20
|
+
parse: ({ status, headers, body }) => {
|
|
21
|
+
const { rateLimited, retryAfterMs } = readRateLimit(headers, status);
|
|
22
|
+
if (rateLimited) throw new ApiError('provider_rate_limited', 502, retryAfterMs);
|
|
23
|
+
if (status !== 200) return null;
|
|
24
|
+
const membership = membershipSchema.parse(body);
|
|
18
25
|
return membership.state === 'active' ? membership.role : null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
error instanceof ProviderError &&
|
|
22
|
-
['provider_not_found', 'provider_access_denied'].includes(error.code)
|
|
23
|
-
)
|
|
24
|
-
return null;
|
|
25
|
-
throw error;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
import { makeApiOperation } from '@inixiative/api-client/operation';
|
|
1
2
|
import { z } from 'zod';
|
|
2
|
-
import
|
|
3
|
-
import { requestGithub } from '../requestGithub';
|
|
3
|
+
import { githubRequestHeaders } from '../githubRequestHeaders';
|
|
4
4
|
|
|
5
5
|
const githubUserSchema = z.object({
|
|
6
6
|
id: z.number().int().positive(),
|
|
7
7
|
login: z.string().min(1).max(39),
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
export const fetchGithubUser =
|
|
11
|
-
|
|
10
|
+
export const fetchGithubUser = makeApiOperation({
|
|
11
|
+
key: 'user.read',
|
|
12
|
+
idempotent: true,
|
|
13
|
+
response: 'json',
|
|
14
|
+
input: z.strictObject({}),
|
|
15
|
+
toRequest: () => ({ path: 'user', headers: githubRequestHeaders }),
|
|
16
|
+
parse: ({ body }) => githubUserSchema.parse(body),
|
|
17
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { bearerAuth } from '@inixiative/api-client/operation';
|
|
2
|
+
import type { SigningClient } from '../../../contracts';
|
|
3
|
+
import { githubAppJwt } from './githubAppJwt';
|
|
4
|
+
|
|
5
|
+
export const githubAppAuth = (app: Pick<SigningClient, 'appId' | 'privateKey'>) =>
|
|
6
|
+
bearerAuth(() => githubAppJwt(app));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { integrationFamilyDefinition } from '../../../catalog/integrationFamilyDefinition';
|
|
3
3
|
import type { OAuthClient } from '../../../contracts';
|
|
4
4
|
|
|
5
5
|
export const githubUserAuthorizeUrl = (app: Pick<OAuthClient, 'clientId'>, state: string) => {
|
|
6
|
-
const url = new URL(z.url().parse(
|
|
6
|
+
const url = new URL(z.url().parse(integrationFamilyDefinition('github')?.oauth?.authorizeUrl));
|
|
7
7
|
url.searchParams.set('client_id', app.clientId);
|
|
8
8
|
url.searchParams.set('state', state);
|
|
9
9
|
return url.toString();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { makeApiOperation } from '@inixiative/api-client/operation';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { pageQuerySchema } from '../../../utils/pageQuerySchema';
|
|
4
|
+
import { githubPagination } from '../githubPagination';
|
|
5
|
+
import { githubRequestHeaders } from '../githubRequestHeaders';
|
|
6
|
+
|
|
7
|
+
export const listGithubUserInstallationPage = makeApiOperation({
|
|
8
|
+
key: 'user.installations.list',
|
|
9
|
+
idempotent: true,
|
|
10
|
+
response: 'json',
|
|
11
|
+
input: z.object({ query: pageQuerySchema(githubPagination) }),
|
|
12
|
+
toRequest: ({ query }) => ({
|
|
13
|
+
path: 'user/installations',
|
|
14
|
+
query: query,
|
|
15
|
+
headers: githubRequestHeaders,
|
|
16
|
+
}),
|
|
17
|
+
parse: ({ body }) => body,
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { makeApiOperation } from '@inixiative/api-client/operation';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { pageQuerySchema } from '../../../utils/pageQuerySchema';
|
|
4
|
+
import { githubPagination } from '../githubPagination';
|
|
5
|
+
import { githubRequestHeaders } from '../githubRequestHeaders';
|
|
6
|
+
|
|
7
|
+
export const listGithubNotificationPage = makeApiOperation({
|
|
8
|
+
key: 'notifications.list',
|
|
9
|
+
idempotent: true,
|
|
10
|
+
response: 'json',
|
|
11
|
+
input: z.object({ since: z.iso.datetime(), query: pageQuerySchema(githubPagination) }),
|
|
12
|
+
toRequest: ({ since, query }) => ({
|
|
13
|
+
path: 'notifications',
|
|
14
|
+
query: { all: 'true', participating: 'true', since, ...query },
|
|
15
|
+
headers: githubRequestHeaders,
|
|
16
|
+
}),
|
|
17
|
+
parse: ({ body }) => body,
|
|
18
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const githubApiBaseUrl = 'https://api.github.com/';
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { catalogOperations } from '../../catalog/catalogOperations';
|
|
1
2
|
import type { ProviderDefinition } from '../../contracts';
|
|
3
|
+
import { githubApiBaseUrl } from './githubApiBaseUrl';
|
|
2
4
|
import { githubRepository } from './models/repository/githubRepository';
|
|
5
|
+
import { githubRepositoryOperations } from './models/repository/githubRepositoryOperations';
|
|
3
6
|
|
|
4
7
|
export const githubOrganizationProvider: ProviderDefinition = {
|
|
5
8
|
key: 'githubOrganization',
|
|
@@ -7,7 +10,8 @@ export const githubOrganizationProvider: ProviderDefinition = {
|
|
|
7
10
|
documentationUrl:
|
|
8
11
|
'https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation',
|
|
9
12
|
authMethods: ['clientCredentials'],
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
integrationFamily: 'github',
|
|
14
|
+
apiBaseUrl: githubApiBaseUrl,
|
|
15
|
+
operations: [...catalogOperations(githubRepositoryOperations), ...githubRepository.events],
|
|
12
16
|
eventResourceExternalId: githubRepository.externalIdOfEvent,
|
|
13
17
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ApiPagination } from '@inixiative/api-client/http/pagination';
|
|
2
2
|
|
|
3
3
|
export const githubPagination = {
|
|
4
4
|
strategy: 'page',
|
|
5
5
|
keys: { page: 'page', pageSize: 'per_page', data: '', total: 'total_count' },
|
|
6
6
|
pageSize: 100,
|
|
7
|
-
} satisfies
|
|
7
|
+
} satisfies ApiPagination;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { githubApiVersion } from './githubApiVersion';
|
|
2
2
|
|
|
3
|
-
export const githubRequestHeaders =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (token) headers.set('Authorization', `Bearer ${token}`);
|
|
8
|
-
return headers;
|
|
3
|
+
export const githubRequestHeaders = {
|
|
4
|
+
Accept: 'application/vnd.github+json',
|
|
5
|
+
'X-GitHub-Api-Version': githubApiVersion,
|
|
6
|
+
'User-Agent': 'inixiative-integrations',
|
|
9
7
|
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { catalogOperations } from '../../catalog/catalogOperations';
|
|
1
2
|
import type { ProviderDefinition } from '../../contracts';
|
|
3
|
+
import { githubApiBaseUrl } from './githubApiBaseUrl';
|
|
2
4
|
import { githubAccount } from './models/account/githubAccount';
|
|
3
|
-
import {
|
|
5
|
+
import { githubRepositoryOperations } from './models/repository/githubRepositoryOperations';
|
|
4
6
|
|
|
5
7
|
export const githubUserProvider: ProviderDefinition = {
|
|
6
8
|
key: 'githubUser',
|
|
7
9
|
name: 'GitHub user',
|
|
8
10
|
documentationUrl:
|
|
9
11
|
'https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-with-a-github-app-on-behalf-of-a-user',
|
|
10
|
-
authMethods: ['
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
authMethods: ['integrationFamily', 'bearer'],
|
|
13
|
+
integrationFamily: 'github',
|
|
14
|
+
apiBaseUrl: githubApiBaseUrl,
|
|
15
|
+
operations: [...catalogOperations(githubRepositoryOperations), ...githubAccount.events],
|
|
13
16
|
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { ApiError } from '@inixiative/api-client';
|
|
3
|
+
import { makeApiOperation } from '@inixiative/api-client/operation';
|
|
4
|
+
import {
|
|
5
|
+
githubInputSchemas,
|
|
6
|
+
githubOperationNames,
|
|
7
|
+
githubOperationSchema,
|
|
8
|
+
gitObjectIdSchema,
|
|
9
|
+
repositoryResourceKind,
|
|
10
|
+
} from '@inixiative/signet/contracts';
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import { providerOperationInputSchema } from '../../../../operations/providerOperationInputSchema';
|
|
13
|
+
import { githubObjectRequest } from './githubObjectRequest';
|
|
14
|
+
import { readGithubObjectIdentity } from './readGithubObjectIdentity';
|
|
15
|
+
|
|
16
|
+
const key = githubOperationSchema.enum['blobs.read'];
|
|
17
|
+
const blobSchema = z.object({
|
|
18
|
+
sha: gitObjectIdSchema,
|
|
19
|
+
encoding: z.literal('base64'),
|
|
20
|
+
size: z
|
|
21
|
+
.number()
|
|
22
|
+
.int()
|
|
23
|
+
.min(0)
|
|
24
|
+
.max(512 * 1024),
|
|
25
|
+
content: z
|
|
26
|
+
.string()
|
|
27
|
+
.max(750000)
|
|
28
|
+
.regex(/^[A-Za-z0-9+/=\r\n]*$/),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const fetchGithubBlob = makeApiOperation({
|
|
32
|
+
key,
|
|
33
|
+
idempotent: true,
|
|
34
|
+
response: 'json',
|
|
35
|
+
meta: {
|
|
36
|
+
name: githubOperationNames[key],
|
|
37
|
+
resourceKind: repositoryResourceKind,
|
|
38
|
+
requiredScopes: ['contents:read'],
|
|
39
|
+
},
|
|
40
|
+
input: providerOperationInputSchema(
|
|
41
|
+
['githubOrganization', 'githubUser'],
|
|
42
|
+
repositoryResourceKind,
|
|
43
|
+
githubInputSchemas[key],
|
|
44
|
+
),
|
|
45
|
+
toRequest: ({ resource, input }) =>
|
|
46
|
+
githubObjectRequest('blobs', resource.metadata.fullName, input.objectId),
|
|
47
|
+
parse: ({ body }, { input }) => {
|
|
48
|
+
const blob = blobSchema.parse(readGithubObjectIdentity(body, input.objectId));
|
|
49
|
+
const encoded = blob.content.replace(/[\r\n]/g, '');
|
|
50
|
+
const bytes = Buffer.from(encoded, 'base64');
|
|
51
|
+
if (
|
|
52
|
+
bytes.toString('base64') !== encoded ||
|
|
53
|
+
bytes.length !== blob.size ||
|
|
54
|
+
createHash('sha1').update(`blob ${bytes.length}\0`).update(bytes).digest('hex') !== blob.sha
|
|
55
|
+
)
|
|
56
|
+
throw new ApiError('provider_invalid_response');
|
|
57
|
+
return { sha: blob.sha, encoding: blob.encoding, size: blob.size, content: encoded };
|
|
58
|
+
},
|
|
59
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { makeApiOperation } from '@inixiative/api-client/operation';
|
|
2
|
+
import {
|
|
3
|
+
githubInputSchemas,
|
|
4
|
+
githubOperationNames,
|
|
5
|
+
githubOperationSchema,
|
|
6
|
+
gitObjectIdSchema,
|
|
7
|
+
repositoryResourceKind,
|
|
8
|
+
} from '@inixiative/signet/contracts';
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import { providerOperationInputSchema } from '../../../../operations/providerOperationInputSchema';
|
|
11
|
+
import { githubObjectRequest } from './githubObjectRequest';
|
|
12
|
+
import { readGithubObjectIdentity } from './readGithubObjectIdentity';
|
|
13
|
+
|
|
14
|
+
const key = githubOperationSchema.enum['commits.read'];
|
|
15
|
+
const commitSchema = z.object({
|
|
16
|
+
sha: gitObjectIdSchema,
|
|
17
|
+
tree: z.object({ sha: gitObjectIdSchema }),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const fetchGithubCommit = makeApiOperation({
|
|
21
|
+
key,
|
|
22
|
+
idempotent: true,
|
|
23
|
+
response: 'json',
|
|
24
|
+
meta: {
|
|
25
|
+
name: githubOperationNames[key],
|
|
26
|
+
resourceKind: repositoryResourceKind,
|
|
27
|
+
requiredScopes: ['contents:read'],
|
|
28
|
+
},
|
|
29
|
+
input: providerOperationInputSchema(
|
|
30
|
+
['githubOrganization', 'githubUser'],
|
|
31
|
+
repositoryResourceKind,
|
|
32
|
+
githubInputSchemas[key],
|
|
33
|
+
),
|
|
34
|
+
toRequest: ({ resource, input }) =>
|
|
35
|
+
githubObjectRequest('commits', resource.metadata.fullName, input.objectId),
|
|
36
|
+
parse: ({ body }, { input }) =>
|
|
37
|
+
commitSchema.parse(readGithubObjectIdentity(body, input.objectId)),
|
|
38
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ApiError } from '@inixiative/api-client';
|
|
2
|
+
import { makeApiOperation } from '@inixiative/api-client/operation';
|
|
3
|
+
import {
|
|
4
|
+
githubInputSchemas,
|
|
5
|
+
githubOperationNames,
|
|
6
|
+
githubOperationSchema,
|
|
7
|
+
gitObjectIdSchema,
|
|
8
|
+
repositoryResourceKind,
|
|
9
|
+
} from '@inixiative/signet/contracts';
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { providerOperationInputSchema } from '../../../../operations/providerOperationInputSchema';
|
|
12
|
+
import { githubObjectRequest } from './githubObjectRequest';
|
|
13
|
+
import { githubTreeEntryModeSchema } from './githubTreeEntryModeSchema';
|
|
14
|
+
import { githubTreeEntryTypeForMode } from './githubTreeEntryTypeForMode';
|
|
15
|
+
import { githubTreeEntryTypeSchema } from './githubTreeEntryTypeSchema';
|
|
16
|
+
import { readGithubObjectIdentity } from './readGithubObjectIdentity';
|
|
17
|
+
|
|
18
|
+
const key = githubOperationSchema.enum['trees.read'];
|
|
19
|
+
|
|
20
|
+
const isEntryName = (path: string) =>
|
|
21
|
+
path !== '.' &&
|
|
22
|
+
path !== '..' &&
|
|
23
|
+
[...path].every(
|
|
24
|
+
(character) =>
|
|
25
|
+
character.charCodeAt(0) >= 32 &&
|
|
26
|
+
character.charCodeAt(0) !== 127 &&
|
|
27
|
+
character !== '/' &&
|
|
28
|
+
character !== String.fromCharCode(92),
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const entrySchema = z
|
|
32
|
+
.object({
|
|
33
|
+
path: z.string().min(1).max(255).refine(isEntryName),
|
|
34
|
+
mode: githubTreeEntryModeSchema,
|
|
35
|
+
type: githubTreeEntryTypeSchema,
|
|
36
|
+
sha: gitObjectIdSchema,
|
|
37
|
+
size: z
|
|
38
|
+
.number()
|
|
39
|
+
.int()
|
|
40
|
+
.min(0)
|
|
41
|
+
.max(512 * 1024)
|
|
42
|
+
.optional(),
|
|
43
|
+
})
|
|
44
|
+
.refine((entry) => githubTreeEntryTypeForMode[entry.mode] === entry.type);
|
|
45
|
+
|
|
46
|
+
export const fetchGithubTree = makeApiOperation({
|
|
47
|
+
key,
|
|
48
|
+
idempotent: true,
|
|
49
|
+
response: 'json',
|
|
50
|
+
meta: {
|
|
51
|
+
name: githubOperationNames[key],
|
|
52
|
+
resourceKind: repositoryResourceKind,
|
|
53
|
+
requiredScopes: ['contents:read'],
|
|
54
|
+
},
|
|
55
|
+
input: providerOperationInputSchema(
|
|
56
|
+
['githubOrganization', 'githubUser'],
|
|
57
|
+
repositoryResourceKind,
|
|
58
|
+
githubInputSchemas[key],
|
|
59
|
+
),
|
|
60
|
+
toRequest: ({ resource, input }) =>
|
|
61
|
+
githubObjectRequest('trees', resource.metadata.fullName, input.objectId),
|
|
62
|
+
parse: ({ body }, { input, limit }) => {
|
|
63
|
+
const tree = z
|
|
64
|
+
.object({
|
|
65
|
+
sha: gitObjectIdSchema,
|
|
66
|
+
truncated: z.literal(false),
|
|
67
|
+
tree: z.array(entrySchema).max(limit),
|
|
68
|
+
})
|
|
69
|
+
.parse(readGithubObjectIdentity(body, input.objectId));
|
|
70
|
+
if (new Set(tree.tree.map((entry) => entry.path)).size !== tree.tree.length)
|
|
71
|
+
throw new ApiError('provider_invalid_response');
|
|
72
|
+
return tree;
|
|
73
|
+
},
|
|
74
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ApiRequestInput } from '@inixiative/api-client/http';
|
|
2
|
+
import { githubRequestHeaders } from '../../githubRequestHeaders';
|
|
3
|
+
|
|
4
|
+
export const githubObjectRequest = (
|
|
5
|
+
objectKind: 'commits' | 'trees' | 'blobs',
|
|
6
|
+
fullName: string,
|
|
7
|
+
objectId: string,
|
|
8
|
+
): ApiRequestInput => {
|
|
9
|
+
const [owner = '', repository = ''] = fullName.split('/');
|
|
10
|
+
return {
|
|
11
|
+
path: `repos/:owner/:repository/git/${objectKind}/:objectId`,
|
|
12
|
+
params: { owner, repository, objectId },
|
|
13
|
+
headers: githubRequestHeaders,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
githubOperationNames,
|
|
3
|
-
githubOperationSchema,
|
|
4
|
-
repositoryResourceKind,
|
|
5
|
-
} from '@inixiative/signet/contracts';
|
|
1
|
+
import { repositoryResourceKind } from '@inixiative/signet/contracts';
|
|
6
2
|
import { declaredOperations } from '../../../../catalog/declaredOperations';
|
|
7
3
|
import type { ProviderModel } from '../../../../catalog/providerModel';
|
|
8
4
|
import { githubEventRepositoryId } from '../../events/githubEventRepositoryId';
|
|
@@ -13,12 +9,6 @@ export const githubRepository = {
|
|
|
13
9
|
kind: repositoryResourceKind,
|
|
14
10
|
externalIdSchema: githubRepositoryIdSchema,
|
|
15
11
|
metadataSchema: githubRepositoryMetadataSchema,
|
|
16
|
-
operations: declaredOperations(
|
|
17
|
-
githubOperationNames,
|
|
18
|
-
repositoryResourceKind,
|
|
19
|
-
['contents:read'],
|
|
20
|
-
githubOperationSchema.options,
|
|
21
|
-
),
|
|
22
12
|
events: declaredOperations(
|
|
23
13
|
{
|
|
24
14
|
'events.pull_request.opened': 'Receive pull requests opened in this repository',
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defineApiOperations } from '@inixiative/api-client/operation';
|
|
2
|
+
import { fetchGithubBlob } from './fetchGithubBlob';
|
|
3
|
+
import { fetchGithubCommit } from './fetchGithubCommit';
|
|
4
|
+
import { fetchGithubTree } from './fetchGithubTree';
|
|
5
|
+
|
|
6
|
+
export const githubRepositoryOperations = defineApiOperations({
|
|
7
|
+
'commits.read': fetchGithubCommit,
|
|
8
|
+
'trees.read': fetchGithubTree,
|
|
9
|
+
'blobs.read': fetchGithubBlob,
|
|
10
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { makeApiOperation } from '@inixiative/api-client/operation';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { pageQuerySchema } from '../../../../utils/pageQuerySchema';
|
|
4
|
+
import { githubPagination } from '../../githubPagination';
|
|
5
|
+
import { githubRequestHeaders } from '../../githubRequestHeaders';
|
|
6
|
+
|
|
7
|
+
export const listGithubInstallationRepositoryPage = makeApiOperation({
|
|
8
|
+
key: 'installation.repositories.list',
|
|
9
|
+
idempotent: true,
|
|
10
|
+
response: 'json',
|
|
11
|
+
input: z.object({ query: pageQuerySchema(githubPagination) }),
|
|
12
|
+
toRequest: ({ query }) => ({
|
|
13
|
+
path: 'installation/repositories',
|
|
14
|
+
query: query,
|
|
15
|
+
headers: githubRequestHeaders,
|
|
16
|
+
}),
|
|
17
|
+
parse: ({ body }) => body,
|
|
18
|
+
});
|