@commandable/integration-data 0.0.1 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/credentials-index.d.ts +4 -21
- package/dist/credentials-index.d.ts.map +1 -1
- package/dist/credentials-index.js +407 -215
- package/dist/credentials-index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +38 -2
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +70 -16
- package/dist/loader.js.map +1 -1
- package/integrations/__tests__/liveHarness.ts +84 -0
- package/integrations/__tests__/usageParity.ts +54 -0
- package/integrations/airtable/__tests__/get_handlers.test.ts +43 -31
- package/integrations/airtable/__tests__/usage_parity.test.ts +3 -29
- package/integrations/airtable/__tests__/write_and_admin_handlers.test.ts +20 -17
- package/integrations/airtable/credentials.json +21 -16
- package/integrations/github/__tests__/get_handlers.test.ts +101 -108
- package/integrations/github/__tests__/usage_parity.test.ts +15 -27
- package/integrations/github/__tests__/write_handlers.test.ts +223 -306
- package/integrations/github/credentials.json +40 -15
- package/integrations/github/credentials_hint_classic_pat.md +8 -0
- package/integrations/github/credentials_hint_fine_grained_pat.md +9 -0
- package/integrations/github/handlers/create_commit.js +2 -17
- package/integrations/github/manifest.json +2 -2
- package/integrations/google-calendar/__tests__/get_handlers.test.ts +21 -13
- package/integrations/google-calendar/__tests__/usage_parity.test.ts +3 -28
- package/integrations/google-calendar/__tests__/write_and_admin_handlers.test.ts +24 -17
- package/integrations/google-calendar/credentials.json +50 -29
- package/integrations/google-calendar/credentials_hint_oauth_token.md +8 -0
- package/integrations/google-calendar/credentials_hint_service_account.md +10 -0
- package/integrations/google-docs/__tests__/get_handlers.test.ts +87 -61
- package/integrations/google-docs/__tests__/usage_parity.test.ts +3 -28
- package/integrations/google-docs/__tests__/write_handlers.test.ts +251 -245
- package/integrations/google-docs/credentials.json +50 -29
- package/integrations/google-docs/credentials_hint_oauth_token.md +8 -0
- package/integrations/google-docs/credentials_hint_service_account.md +10 -0
- package/integrations/google-docs/handlers/insert_inline_image_after_first_match.js +1 -1
- package/integrations/google-docs/schemas/insert_inline_image_after_first_match.json +0 -1
- package/integrations/google-drive/__tests__/handlers.test.ts +102 -0
- package/integrations/google-drive/credentials.json +57 -0
- package/integrations/google-drive/credentials_hint_oauth_token.md +8 -0
- package/integrations/google-drive/credentials_hint_service_account.md +10 -0
- package/integrations/google-drive/handlers/create_file.js +15 -0
- package/integrations/google-drive/handlers/create_folder.js +15 -0
- package/integrations/google-drive/handlers/delete_file.js +14 -0
- package/integrations/google-drive/handlers/get_file.js +7 -0
- package/integrations/google-drive/handlers/move_file.js +12 -0
- package/integrations/google-drive/manifest.json +42 -0
- package/integrations/google-drive/schemas/create_file.json +12 -0
- package/integrations/google-drive/schemas/create_folder.json +11 -0
- package/integrations/google-drive/schemas/delete_file.json +10 -0
- package/integrations/google-drive/schemas/get_file.json +10 -0
- package/integrations/google-drive/schemas/move_file.json +12 -0
- package/integrations/google-sheet/__tests__/get_handlers.test.ts +48 -55
- package/integrations/google-sheet/__tests__/usage_parity.test.ts +3 -29
- package/integrations/google-sheet/__tests__/write_handlers.test.ts +65 -63
- package/integrations/google-sheet/credentials.json +50 -29
- package/integrations/google-sheet/credentials_hint_oauth_token.md +8 -0
- package/integrations/google-sheet/credentials_hint_service_account.md +10 -0
- package/integrations/google-slides/__tests__/get_handlers.test.ts +38 -36
- package/integrations/google-slides/__tests__/usage_parity.test.ts +3 -28
- package/integrations/google-slides/__tests__/write_handlers.test.ts +65 -59
- package/integrations/google-slides/credentials.json +50 -29
- package/integrations/google-slides/credentials_hint_oauth_token.md +8 -0
- package/integrations/google-slides/credentials_hint_service_account.md +10 -0
- package/integrations/notion/__tests__/get_handlers.test.ts +18 -15
- package/integrations/notion/__tests__/usage_parity.test.ts +3 -28
- package/integrations/notion/__tests__/write_and_admin_handlers.test.ts +56 -60
- package/integrations/notion/credentials.json +22 -17
- package/integrations/trello/__tests__/get_handlers.test.ts +58 -73
- package/integrations/trello/__tests__/usage_parity.test.ts +3 -28
- package/integrations/trello/__tests__/write_and_admin_handlers.test.ts +49 -67
- package/integrations/trello/credentials.json +26 -21
- package/integrations/trello/handlers/close_board.js +6 -0
- package/integrations/trello/handlers/create_board.js +11 -0
- package/integrations/trello/handlers/delete_board.js +13 -0
- package/integrations/trello/manifest.json +21 -0
- package/integrations/trello/schemas/close_board.json +10 -0
- package/integrations/trello/schemas/create_board.json +12 -0
- package/integrations/trello/schemas/delete_board.json +10 -0
- package/package.json +1 -1
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
"
|
|
6
|
-
"type": "
|
|
7
|
-
"
|
|
8
|
-
|
|
2
|
+
"variants": {
|
|
3
|
+
"personal_access_token": {
|
|
4
|
+
"label": "Personal Access Token",
|
|
5
|
+
"schema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"token": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"title": "Personal Access Token",
|
|
11
|
+
"description": "Airtable personal access token."
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"required": ["token"],
|
|
15
|
+
"additionalProperties": false
|
|
16
|
+
},
|
|
17
|
+
"injection": {
|
|
18
|
+
"headers": {
|
|
19
|
+
"Authorization": "Bearer {{token}}"
|
|
20
|
+
}
|
|
9
21
|
}
|
|
10
|
-
},
|
|
11
|
-
"required": ["token"],
|
|
12
|
-
"additionalProperties": false
|
|
13
|
-
},
|
|
14
|
-
"injection": {
|
|
15
|
-
"headers": {
|
|
16
|
-
"Authorization": "Bearer {{token}}"
|
|
17
22
|
}
|
|
18
|
-
}
|
|
23
|
+
},
|
|
24
|
+
"default": "personal_access_token"
|
|
19
25
|
}
|
|
20
|
-
|
|
@@ -1,117 +1,110 @@
|
|
|
1
1
|
import { beforeAll, describe, expect, it } from 'vitest'
|
|
2
|
-
import {
|
|
3
|
-
import { loadIntegrationTools } from '../../../src/integrations/dataLoader.js'
|
|
4
|
-
|
|
5
|
-
// LIVE GitHub integration tests using managed OAuth
|
|
6
|
-
// Required env vars:
|
|
7
|
-
// - COMMANDABLE_MANAGED_OAUTH_BASE_URL
|
|
8
|
-
// - COMMANDABLE_MANAGED_OAUTH_SECRET_KEY
|
|
9
|
-
// - GITHUB_TEST_CONNECTION_ID (managed OAuth connection for provider 'github')
|
|
10
|
-
|
|
11
|
-
interface Ctx {
|
|
12
|
-
owner?: string
|
|
13
|
-
repo?: string
|
|
14
|
-
issue_number?: number
|
|
15
|
-
}
|
|
2
|
+
import { createCredentialStore, createIntegrationNode, createProxy, createToolbox, hasEnv } from '../../__tests__/liveHarness.js'
|
|
16
3
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
: describe.skip
|
|
4
|
+
// LIVE GitHub read tests -- runs once per available credential variant.
|
|
5
|
+
// Required env vars (at least one):
|
|
6
|
+
// - GITHUB_CLASSIC_PAT
|
|
7
|
+
// - GITHUB_FINE_GRAINED_PAT
|
|
22
8
|
|
|
23
|
-
|
|
24
|
-
const ctx: Ctx = {}
|
|
25
|
-
let buildHandler: (name: string) => ((input: any) => Promise<any>)
|
|
9
|
+
const env = process.env as Record<string, string | undefined>
|
|
26
10
|
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
interface VariantConfig {
|
|
12
|
+
key: string
|
|
13
|
+
token: string
|
|
14
|
+
}
|
|
29
15
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const integrationNode = { id: 'node-github', type: 'github', label: 'GitHub', connectionId: GITHUB_TEST_CONNECTION_ID } as any
|
|
16
|
+
const variants: VariantConfig[] = [
|
|
17
|
+
{ key: 'classic_pat', token: env.GITHUB_CLASSIC_PAT || '' },
|
|
18
|
+
{ key: 'fine_grained_pat', token: env.GITHUB_FINE_GRAINED_PAT || '' },
|
|
19
|
+
].filter(v => v.token.trim().length > 0)
|
|
35
20
|
|
|
36
|
-
|
|
37
|
-
expect(tools).toBeTruthy()
|
|
21
|
+
const suiteOrSkip = variants.length > 0 ? describe : describe.skip
|
|
38
22
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
23
|
+
suiteOrSkip('github read handlers (live)', () => {
|
|
24
|
+
for (const variant of variants) {
|
|
25
|
+
describe(`variant: ${variant.key}`, () => {
|
|
26
|
+
interface Ctx {
|
|
27
|
+
owner?: string
|
|
28
|
+
repo?: string
|
|
29
|
+
issue_number?: number
|
|
44
30
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
31
|
+
|
|
32
|
+
const ctx: Ctx = {}
|
|
33
|
+
let toolbox: ReturnType<typeof createToolbox>
|
|
34
|
+
|
|
35
|
+
beforeAll(async () => {
|
|
36
|
+
const credentialStore = createCredentialStore(async () => ({ token: variant.token }))
|
|
37
|
+
const proxy = createProxy(credentialStore)
|
|
38
|
+
const node = createIntegrationNode('github', { credentialVariant: variant.key })
|
|
39
|
+
toolbox = createToolbox('github', proxy, node, variant.key)
|
|
40
|
+
|
|
41
|
+
const list_repos = toolbox.read('list_repos')
|
|
42
|
+
const repos = await list_repos({})
|
|
43
|
+
const first = Array.isArray(repos) ? repos[0] : undefined
|
|
44
|
+
ctx.owner = first?.owner?.login || first?.owner || first?.full_name?.split?.('/')[0]
|
|
45
|
+
ctx.repo = first?.name || first?.full_name?.split?.('/')[1]
|
|
46
|
+
|
|
47
|
+
if (ctx.owner && ctx.repo) {
|
|
48
|
+
const list_issues = toolbox.read('list_issues')
|
|
49
|
+
const issues = await list_issues({ owner: ctx.owner, repo: ctx.repo, state: 'all' })
|
|
50
|
+
const firstIssue = Array.isArray(issues) ? issues.find((i: any) => typeof i.number === 'number') : undefined
|
|
51
|
+
ctx.issue_number = firstIssue?.number
|
|
52
|
+
}
|
|
53
|
+
}, 60000)
|
|
54
|
+
|
|
55
|
+
it('list_repos returns repositories', async () => {
|
|
56
|
+
const handler = toolbox.read('list_repos')
|
|
57
|
+
const result = await handler({})
|
|
58
|
+
expect(result).toBeTruthy()
|
|
59
|
+
}, 30000)
|
|
60
|
+
|
|
61
|
+
it('get_repo returns repo details', async () => {
|
|
62
|
+
if (!ctx.owner || !ctx.repo)
|
|
63
|
+
return expect(true).toBe(true)
|
|
64
|
+
const handler = toolbox.read('get_repo')
|
|
65
|
+
const result = await handler({ owner: ctx.owner, repo: ctx.repo })
|
|
66
|
+
expect(result?.name?.toLowerCase?.()).toBe(ctx.repo?.toLowerCase?.())
|
|
67
|
+
}, 30000)
|
|
68
|
+
|
|
69
|
+
it('list_issues returns issues for repo', async () => {
|
|
70
|
+
if (!ctx.owner || !ctx.repo)
|
|
71
|
+
return expect(true).toBe(true)
|
|
72
|
+
const handler = toolbox.read('list_issues')
|
|
73
|
+
const result = await handler({ owner: ctx.owner, repo: ctx.repo, state: 'all' })
|
|
74
|
+
expect(Array.isArray(result)).toBe(true)
|
|
75
|
+
}, 30000)
|
|
76
|
+
|
|
77
|
+
it('get_issue returns a single issue if available', async () => {
|
|
78
|
+
if (!ctx.owner || !ctx.repo || !ctx.issue_number)
|
|
79
|
+
return expect(true).toBe(true)
|
|
80
|
+
const handler = toolbox.read('get_issue')
|
|
81
|
+
const result = await handler({ owner: ctx.owner, repo: ctx.repo, issue_number: ctx.issue_number })
|
|
82
|
+
expect(result?.number).toBe(ctx.issue_number)
|
|
83
|
+
}, 30000)
|
|
84
|
+
|
|
85
|
+
it('list_pull_requests returns PRs', async () => {
|
|
86
|
+
if (!ctx.owner || !ctx.repo)
|
|
87
|
+
return expect(true).toBe(true)
|
|
88
|
+
const handler = toolbox.read('list_pull_requests')
|
|
89
|
+
const result = await handler({ owner: ctx.owner, repo: ctx.repo, state: 'all' })
|
|
90
|
+
expect(Array.isArray(result)).toBe(true)
|
|
91
|
+
}, 30000)
|
|
92
|
+
|
|
93
|
+
it('list_branches returns branches', async () => {
|
|
94
|
+
if (!ctx.owner || !ctx.repo)
|
|
95
|
+
return expect(true).toBe(true)
|
|
96
|
+
const handler = toolbox.read('list_branches')
|
|
97
|
+
const result = await handler({ owner: ctx.owner, repo: ctx.repo })
|
|
98
|
+
expect(Array.isArray(result)).toBe(true)
|
|
99
|
+
}, 30000)
|
|
100
|
+
|
|
101
|
+
it('list_commits returns commits', async () => {
|
|
102
|
+
if (!ctx.owner || !ctx.repo)
|
|
103
|
+
return expect(true).toBe(true)
|
|
104
|
+
const handler = toolbox.read('list_commits')
|
|
105
|
+
const result = await handler({ owner: ctx.owner, repo: ctx.repo })
|
|
106
|
+
expect(Array.isArray(result)).toBe(true)
|
|
107
|
+
}, 30000)
|
|
108
|
+
})
|
|
109
|
+
}
|
|
117
110
|
})
|
|
@@ -1,34 +1,22 @@
|
|
|
1
|
-
import { existsSync, readdirSync, readFileSync } from 'node:fs'
|
|
2
|
-
import { resolve } from 'node:path'
|
|
3
|
-
import { fileURLToPath } from 'node:url'
|
|
4
1
|
import { describe, expect, it } from 'vitest'
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
function escapeRegExp(str: string): string {
|
|
8
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
9
|
-
}
|
|
2
|
+
import { getMissingToolUsages } from '../../__tests__/usageParity.js'
|
|
10
3
|
|
|
11
4
|
describe('github static usage parity', () => {
|
|
12
|
-
it('every
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
.map(f => resolve(testsDir, f))
|
|
21
|
-
|
|
22
|
-
const fileContents = testFiles.map(f => readFileSync(f, 'utf8'))
|
|
23
|
-
|
|
24
|
-
const missing: string[] = []
|
|
25
|
-
for (const name of toolNames) {
|
|
26
|
-
const nameRe = new RegExp(`build(?:Read|Write|Admin)?(?:Handler)?\\(\\s*['"\`]${escapeRegExp(name)}['"\`]\\s*\\)`, 'm')
|
|
27
|
-
const found = fileContents.some(src => nameRe.test(src))
|
|
28
|
-
if (!found)
|
|
29
|
-
missing.push(name)
|
|
30
|
-
}
|
|
5
|
+
it('every classic_pat tool is referenced in tests', () => {
|
|
6
|
+
const missing = getMissingToolUsages({
|
|
7
|
+
integrationName: 'github',
|
|
8
|
+
importMetaUrl: import.meta.url,
|
|
9
|
+
credentialVariant: 'classic_pat',
|
|
10
|
+
})
|
|
11
|
+
expect(missing, `Missing handler usages in tests: ${missing.join(', ')}`).toEqual([])
|
|
12
|
+
})
|
|
31
13
|
|
|
14
|
+
it('every fine_grained_pat tool is referenced in tests', () => {
|
|
15
|
+
const missing = getMissingToolUsages({
|
|
16
|
+
integrationName: 'github',
|
|
17
|
+
importMetaUrl: import.meta.url,
|
|
18
|
+
credentialVariant: 'fine_grained_pat',
|
|
19
|
+
})
|
|
32
20
|
expect(missing, `Missing handler usages in tests: ${missing.join(', ')}`).toEqual([])
|
|
33
21
|
})
|
|
34
22
|
})
|