@rnsk/toolkits 0.0.6 → 0.0.7
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 +10 -4
- package/dist/index.d.ts +7 -1
- package/dist/index.js +13 -1
- package/dist/toolkits/docker-hub/icon.d.ts +5 -0
- package/dist/toolkits/docker-hub/icon.js +29 -0
- package/dist/toolkits/docker-hub/manifest.d.ts +3 -0
- package/dist/toolkits/docker-hub/manifest.js +32 -0
- package/dist/toolkits/docker-hub/tools/add-org-member.d.ts +29 -0
- package/dist/toolkits/docker-hub/tools/add-org-member.js +39 -0
- package/dist/toolkits/docker-hub/tools/create-organization.d.ts +6 -0
- package/dist/toolkits/docker-hub/tools/create-organization.js +28 -0
- package/dist/toolkits/docker-hub/tools/create-repository.d.ts +9 -0
- package/dist/toolkits/docker-hub/tools/create-repository.js +37 -0
- package/dist/toolkits/docker-hub/tools/create-webhook.d.ts +48 -0
- package/dist/toolkits/docker-hub/tools/create-webhook.js +51 -0
- package/dist/toolkits/docker-hub/tools/delete-image.d.ts +11 -0
- package/dist/toolkits/docker-hub/tools/delete-image.js +46 -0
- package/dist/toolkits/docker-hub/tools/delete-organization.d.ts +23 -0
- package/dist/toolkits/docker-hub/tools/delete-organization.js +29 -0
- package/dist/toolkits/docker-hub/tools/delete-repository.d.ts +21 -0
- package/dist/toolkits/docker-hub/tools/delete-repository.js +29 -0
- package/dist/toolkits/docker-hub/tools/delete-tag.d.ts +25 -0
- package/dist/toolkits/docker-hub/tools/delete-tag.js +29 -0
- package/dist/toolkits/docker-hub/tools/delete-team.d.ts +24 -0
- package/dist/toolkits/docker-hub/tools/delete-team.js +25 -0
- package/dist/toolkits/docker-hub/tools/delete-webhook.d.ts +25 -0
- package/dist/toolkits/docker-hub/tools/delete-webhook.js +31 -0
- package/dist/toolkits/docker-hub/tools/get-image.d.ts +75 -0
- package/dist/toolkits/docker-hub/tools/get-image.js +51 -0
- package/dist/toolkits/docker-hub/tools/get-repository.d.ts +6 -0
- package/dist/toolkits/docker-hub/tools/get-repository.js +25 -0
- package/dist/toolkits/docker-hub/tools/get-tag.d.ts +7 -0
- package/dist/toolkits/docker-hub/tools/get-tag.js +26 -0
- package/dist/toolkits/docker-hub/tools/get-team.d.ts +6 -0
- package/dist/toolkits/docker-hub/tools/get-team.js +25 -0
- package/dist/toolkits/docker-hub/tools/get-webhook.d.ts +26 -0
- package/dist/toolkits/docker-hub/tools/get-webhook.js +26 -0
- package/dist/toolkits/docker-hub/tools/index.d.ts +437 -0
- package/dist/toolkits/docker-hub/tools/index.js +165 -0
- package/dist/toolkits/docker-hub/tools/list-org-access-tokens.d.ts +7 -0
- package/dist/toolkits/docker-hub/tools/list-org-access-tokens.js +26 -0
- package/dist/toolkits/docker-hub/tools/list-org-members.d.ts +7 -0
- package/dist/toolkits/docker-hub/tools/list-org-members.js +26 -0
- package/dist/toolkits/docker-hub/tools/list-organizations.d.ts +6 -0
- package/dist/toolkits/docker-hub/tools/list-organizations.js +25 -0
- package/dist/toolkits/docker-hub/tools/list-repositories.d.ts +10 -0
- package/dist/toolkits/docker-hub/tools/list-repositories.js +35 -0
- package/dist/toolkits/docker-hub/tools/list-team-members.d.ts +9 -0
- package/dist/toolkits/docker-hub/tools/list-team-members.js +32 -0
- package/dist/toolkits/docker-hub/tools/list-teams.d.ts +7 -0
- package/dist/toolkits/docker-hub/tools/list-teams.js +26 -0
- package/dist/toolkits/docker-hub/tools/list-webhooks.d.ts +8 -0
- package/dist/toolkits/docker-hub/tools/list-webhooks.js +38 -0
- package/dist/toolkits/docker-hub/tools/remove-org-member.d.ts +21 -0
- package/dist/toolkits/docker-hub/tools/remove-org-member.js +25 -0
- package/dist/toolkits/docker-hub/tools/remove-team-member.d.ts +25 -0
- package/dist/toolkits/docker-hub/tools/remove-team-member.js +26 -0
- package/dist/toolkits/docker-hub/tools/utils.d.ts +24 -0
- package/dist/toolkits/docker-hub/tools/utils.js +87 -0
- package/dist/toolkits/github/tools/Git/create-blob.d.ts +1 -1
- package/dist/toolkits/github/tools/Issues/remove-issue-label.d.ts +1 -1
- package/dist/toolkits/github/tools/Repos/star-repo.d.ts +1 -1
- package/dist/toolkits/github/tools/Users/follow-user.d.ts +1 -1
- package/dist/toolkits/github/tools/index.d.ts +4 -4
- package/dist/toolkits/gmail/manifest.js +82 -2
- package/dist/toolkits/gmail/tools/batch-delete-messages.d.ts +26 -0
- package/dist/toolkits/gmail/tools/batch-delete-messages.js +33 -0
- package/dist/toolkits/gmail/tools/batch-modify-messages.d.ts +34 -0
- package/dist/toolkits/gmail/tools/batch-modify-messages.js +39 -0
- package/dist/toolkits/gmail/tools/create-filter.d.ts +24 -0
- package/dist/toolkits/gmail/tools/create-filter.js +35 -0
- package/dist/toolkits/gmail/tools/create-label.d.ts +27 -0
- package/dist/toolkits/gmail/tools/create-label.js +46 -0
- package/dist/toolkits/gmail/tools/delete-filter.d.ts +23 -0
- package/dist/toolkits/gmail/tools/delete-filter.js +31 -0
- package/dist/toolkits/gmail/tools/delete-label.d.ts +23 -0
- package/dist/toolkits/gmail/tools/delete-label.js +31 -0
- package/dist/toolkits/gmail/tools/delete-message.d.ts +23 -0
- package/dist/toolkits/gmail/tools/delete-message.js +31 -0
- package/dist/toolkits/gmail/tools/delete-thread.d.ts +23 -0
- package/dist/toolkits/gmail/tools/delete-thread.js +31 -0
- package/dist/toolkits/gmail/tools/forward-message.d.ts +37 -0
- package/dist/toolkits/gmail/tools/forward-message.js +112 -0
- package/dist/toolkits/gmail/tools/get-attachment.d.ts +40 -0
- package/dist/toolkits/gmail/tools/get-attachment.js +41 -0
- package/dist/toolkits/gmail/tools/get-auto-forwarding.d.ts +22 -0
- package/dist/toolkits/gmail/tools/get-auto-forwarding.js +30 -0
- package/dist/toolkits/gmail/tools/get-contacts.d.ts +8 -0
- package/dist/toolkits/gmail/tools/get-contacts.js +50 -0
- package/dist/toolkits/gmail/tools/get-filter.d.ts +23 -0
- package/dist/toolkits/gmail/tools/get-filter.js +31 -0
- package/dist/toolkits/gmail/tools/index.d.ts +13 -0
- package/dist/toolkits/gmail/tools/index.js +13 -0
- package/dist/toolkits/gmail/tools/utils.d.ts +23 -0
- package/dist/toolkits/gmail/tools/utils.js +51 -0
- package/dist/toolkits/google-forms/icon.d.ts +5 -0
- package/dist/toolkits/google-forms/icon.js +6 -0
- package/dist/toolkits/google-forms/manifest.d.ts +3 -0
- package/dist/toolkits/google-forms/manifest.js +43 -0
- package/dist/toolkits/google-forms/tools/batch-update-form.d.ts +11 -0
- package/dist/toolkits/google-forms/tools/batch-update-form.js +49 -0
- package/dist/toolkits/google-forms/tools/create-form.d.ts +8 -0
- package/dist/toolkits/google-forms/tools/create-form.js +44 -0
- package/dist/toolkits/google-forms/tools/create-watch.d.ts +8 -0
- package/dist/toolkits/google-forms/tools/create-watch.js +48 -0
- package/dist/toolkits/google-forms/tools/delete-watch.d.ts +21 -0
- package/dist/toolkits/google-forms/tools/delete-watch.js +28 -0
- package/dist/toolkits/google-forms/tools/get-form.d.ts +5 -0
- package/dist/toolkits/google-forms/tools/get-form.js +27 -0
- package/dist/toolkits/google-forms/tools/get-response.d.ts +6 -0
- package/dist/toolkits/google-forms/tools/get-response.js +28 -0
- package/dist/toolkits/google-forms/tools/index.d.ts +130 -0
- package/dist/toolkits/google-forms/tools/index.js +85 -0
- package/dist/toolkits/google-forms/tools/list-responses.d.ts +8 -0
- package/dist/toolkits/google-forms/tools/list-responses.js +44 -0
- package/dist/toolkits/google-forms/tools/list-watches.d.ts +5 -0
- package/dist/toolkits/google-forms/tools/list-watches.js +27 -0
- package/dist/toolkits/google-forms/tools/renew-watch.d.ts +6 -0
- package/dist/toolkits/google-forms/tools/renew-watch.js +28 -0
- package/dist/toolkits/google-forms/tools/set-publish-settings.d.ts +8 -0
- package/dist/toolkits/google-forms/tools/set-publish-settings.js +43 -0
- package/dist/toolkits/google-forms/tools/utils.d.ts +15 -0
- package/dist/toolkits/google-forms/tools/utils.js +33 -0
- package/dist/toolkits/google-meet/icon.d.ts +5 -0
- package/dist/toolkits/google-meet/icon.js +153 -0
- package/dist/toolkits/google-meet/manifest.d.ts +3 -0
- package/dist/toolkits/google-meet/manifest.js +44 -0
- package/dist/toolkits/google-meet/tools/create-meet.d.ts +5 -0
- package/dist/toolkits/google-meet/tools/create-meet.js +33 -0
- package/dist/toolkits/google-meet/tools/end-active-conference.d.ts +26 -0
- package/dist/toolkits/google-meet/tools/end-active-conference.js +37 -0
- package/dist/toolkits/google-meet/tools/get-conference-record-by-name.d.ts +5 -0
- package/dist/toolkits/google-meet/tools/get-conference-record-by-name.js +30 -0
- package/dist/toolkits/google-meet/tools/get-meet.d.ts +5 -0
- package/dist/toolkits/google-meet/tools/get-meet.js +30 -0
- package/dist/toolkits/google-meet/tools/get-participant-session.d.ts +5 -0
- package/dist/toolkits/google-meet/tools/get-participant-session.js +29 -0
- package/dist/toolkits/google-meet/tools/get-recordings-by-conference-record-id.d.ts +7 -0
- package/dist/toolkits/google-meet/tools/get-recordings-by-conference-record-id.js +32 -0
- package/dist/toolkits/google-meet/tools/get-transcript-entry.d.ts +5 -0
- package/dist/toolkits/google-meet/tools/get-transcript-entry.js +29 -0
- package/dist/toolkits/google-meet/tools/get-transcript.d.ts +5 -0
- package/dist/toolkits/google-meet/tools/get-transcript.js +29 -0
- package/dist/toolkits/google-meet/tools/get-transcripts-by-conference-record-id.d.ts +7 -0
- package/dist/toolkits/google-meet/tools/get-transcripts-by-conference-record-id.js +32 -0
- package/dist/toolkits/google-meet/tools/index.d.ts +156 -0
- package/dist/toolkits/google-meet/tools/index.js +125 -0
- package/dist/toolkits/google-meet/tools/list-conference-records.d.ts +7 -0
- package/dist/toolkits/google-meet/tools/list-conference-records.js +31 -0
- package/dist/toolkits/google-meet/tools/list-participant-sessions.d.ts +9 -0
- package/dist/toolkits/google-meet/tools/list-participant-sessions.js +34 -0
- package/dist/toolkits/google-meet/tools/list-participants.d.ts +8 -0
- package/dist/toolkits/google-meet/tools/list-participants.js +35 -0
- package/dist/toolkits/google-meet/tools/list-recordings.d.ts +7 -0
- package/dist/toolkits/google-meet/tools/list-recordings.js +34 -0
- package/dist/toolkits/google-meet/tools/list-transcript-entries.d.ts +8 -0
- package/dist/toolkits/google-meet/tools/list-transcript-entries.js +33 -0
- package/dist/toolkits/google-meet/tools/update-space.d.ts +7 -0
- package/dist/toolkits/google-meet/tools/update-space.js +42 -0
- package/dist/toolkits/google-meet/tools/utils.d.ts +14 -0
- package/dist/toolkits/google-meet/tools/utils.js +39 -0
- package/dist/toolkits/google-search-console/icon.d.ts +5 -0
- package/dist/toolkits/google-search-console/icon.js +6 -0
- package/dist/toolkits/google-search-console/manifest.d.ts +3 -0
- package/dist/toolkits/google-search-console/manifest.js +46 -0
- package/dist/toolkits/google-search-console/tools/add-site.d.ts +29 -0
- package/dist/toolkits/google-search-console/tools/add-site.js +27 -0
- package/dist/toolkits/google-search-console/tools/delete-site.d.ts +26 -0
- package/dist/toolkits/google-search-console/tools/delete-site.js +27 -0
- package/dist/toolkits/google-search-console/tools/get-site.d.ts +5 -0
- package/dist/toolkits/google-search-console/tools/get-site.js +27 -0
- package/dist/toolkits/google-search-console/tools/get-sitemap.d.ts +6 -0
- package/dist/toolkits/google-search-console/tools/get-sitemap.js +28 -0
- package/dist/toolkits/google-search-console/tools/index.d.ts +178 -0
- package/dist/toolkits/google-search-console/tools/index.js +77 -0
- package/dist/toolkits/google-search-console/tools/inspect-url.d.ts +7 -0
- package/dist/toolkits/google-search-console/tools/inspect-url.js +41 -0
- package/dist/toolkits/google-search-console/tools/list-sitemaps.d.ts +6 -0
- package/dist/toolkits/google-search-console/tools/list-sitemaps.js +31 -0
- package/dist/toolkits/google-search-console/tools/list-sites.d.ts +4 -0
- package/dist/toolkits/google-search-console/tools/list-sites.js +26 -0
- package/dist/toolkits/google-search-console/tools/search-analytics-query.d.ts +14 -0
- package/dist/toolkits/google-search-console/tools/search-analytics-query.js +73 -0
- package/dist/toolkits/google-search-console/tools/submit-sitemap.d.ts +33 -0
- package/dist/toolkits/google-search-console/tools/submit-sitemap.js +28 -0
- package/dist/toolkits/google-search-console/tools/utils.d.ts +24 -0
- package/dist/toolkits/google-search-console/tools/utils.js +57 -0
- package/dist/toolkits/google-slides/icon.d.ts +5 -0
- package/dist/toolkits/google-slides/icon.js +6 -0
- package/dist/toolkits/google-slides/manifest.d.ts +3 -0
- package/dist/toolkits/google-slides/manifest.js +46 -0
- package/dist/toolkits/google-slides/tools/create-presentation.d.ts +8 -0
- package/dist/toolkits/google-slides/tools/create-presentation.js +42 -0
- package/dist/toolkits/google-slides/tools/create-slides-markdown.d.ts +56 -0
- package/dist/toolkits/google-slides/tools/create-slides-markdown.js +70 -0
- package/dist/toolkits/google-slides/tools/get-page-thumbnail2.d.ts +8 -0
- package/dist/toolkits/google-slides/tools/get-page-thumbnail2.js +41 -0
- package/dist/toolkits/google-slides/tools/index.d.ts +139 -0
- package/dist/toolkits/google-slides/tools/index.js +69 -0
- package/dist/toolkits/google-slides/tools/markdown.d.ts +6 -0
- package/dist/toolkits/google-slides/tools/markdown.js +222 -0
- package/dist/toolkits/google-slides/tools/presentations-batch-update.d.ts +8 -0
- package/dist/toolkits/google-slides/tools/presentations-batch-update.js +58 -0
- package/dist/toolkits/google-slides/tools/presentations-copy-from-template.d.ts +7 -0
- package/dist/toolkits/google-slides/tools/presentations-copy-from-template.js +42 -0
- package/dist/toolkits/google-slides/tools/presentations-get.d.ts +7 -0
- package/dist/toolkits/google-slides/tools/presentations-get.js +58 -0
- package/dist/toolkits/google-slides/tools/presentations-pages-get-thumbnail.d.ts +8 -0
- package/dist/toolkits/google-slides/tools/presentations-pages-get-thumbnail.js +41 -0
- package/dist/toolkits/google-slides/tools/presentations-pages-get.d.ts +6 -0
- package/dist/toolkits/google-slides/tools/presentations-pages-get.js +28 -0
- package/dist/toolkits/google-slides/tools/utils.d.ts +22 -0
- package/dist/toolkits/google-slides/tools/utils.js +51 -0
- package/dist/toolkits/grafana/icon.d.ts +5 -0
- package/dist/toolkits/grafana/icon.js +6 -0
- package/dist/toolkits/grafana/manifest.d.ts +3 -0
- package/dist/toolkits/grafana/manifest.js +31 -0
- package/dist/toolkits/grafana/tools/create-otlp-v1-logs.d.ts +23 -0
- package/dist/toolkits/grafana/tools/create-otlp-v1-logs.js +41 -0
- package/dist/toolkits/grafana/tools/get-distributor-ha-tracker.d.ts +22 -0
- package/dist/toolkits/grafana/tools/get-distributor-ha-tracker.js +33 -0
- package/dist/toolkits/grafana/tools/get-health.d.ts +4 -0
- package/dist/toolkits/grafana/tools/get-health.js +32 -0
- package/dist/toolkits/grafana/tools/get-index-gateway-ring.d.ts +22 -0
- package/dist/toolkits/grafana/tools/get-index-gateway-ring.js +33 -0
- package/dist/toolkits/grafana/tools/get-overrides-exporter-ring.d.ts +22 -0
- package/dist/toolkits/grafana/tools/get-overrides-exporter-ring.js +33 -0
- package/dist/toolkits/grafana/tools/get-ruler-ring.d.ts +22 -0
- package/dist/toolkits/grafana/tools/get-ruler-ring.js +33 -0
- package/dist/toolkits/grafana/tools/get-status.d.ts +22 -0
- package/dist/toolkits/grafana/tools/get-status.js +35 -0
- package/dist/toolkits/grafana/tools/get-store-gateway-tenants.d.ts +25 -0
- package/dist/toolkits/grafana/tools/get-store-gateway-tenants.js +33 -0
- package/dist/toolkits/grafana/tools/index.d.ts +183 -0
- package/dist/toolkits/grafana/tools/index.js +93 -0
- package/dist/toolkits/grafana/tools/post-acs.d.ts +16 -0
- package/dist/toolkits/grafana/tools/post-acs.js +44 -0
- package/dist/toolkits/grafana/tools/query-public-dashboard.d.ts +29 -0
- package/dist/toolkits/grafana/tools/query-public-dashboard.js +70 -0
- package/dist/toolkits/grafana/tools/retrieve-jwks.d.ts +4 -0
- package/dist/toolkits/grafana/tools/retrieve-jwks.js +32 -0
- package/dist/toolkits/grafana/tools/utils.d.ts +21 -0
- package/dist/toolkits/grafana/tools/utils.js +48 -0
- package/package.json +2 -1
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
function uniqueId(prefix, index) {
|
|
3
|
+
return `${prefix}_${index}_${Math.random().toString(36).slice(2, 8)}`;
|
|
4
|
+
}
|
|
5
|
+
export function parseMarkdownSlides(markdownText) {
|
|
6
|
+
let text = markdownText.trim();
|
|
7
|
+
if (/^Theme:\s*/im.test(text)) {
|
|
8
|
+
text = text.replace(/^Theme:\s*\S+\s*\n?/im, '').trim();
|
|
9
|
+
}
|
|
10
|
+
return text
|
|
11
|
+
.split(/\n---\n/)
|
|
12
|
+
.map((slide) => slide.trim())
|
|
13
|
+
.filter(Boolean);
|
|
14
|
+
}
|
|
15
|
+
function isTableSlide(content) {
|
|
16
|
+
const lines = content.split('\n').filter((line) => line.trim());
|
|
17
|
+
return lines.some((line) => line.includes('|')) && lines.length >= 2;
|
|
18
|
+
}
|
|
19
|
+
function parseMarkdownTable(content) {
|
|
20
|
+
const lines = content
|
|
21
|
+
.split('\n')
|
|
22
|
+
.map((line) => line.trim())
|
|
23
|
+
.filter((line) => line.includes('|'));
|
|
24
|
+
if (lines.length < 2)
|
|
25
|
+
return null;
|
|
26
|
+
const parseRow = (line) => line
|
|
27
|
+
.replace(/^\|/, '')
|
|
28
|
+
.replace(/\|$/, '')
|
|
29
|
+
.split('|')
|
|
30
|
+
.map((cell) => cell.trim());
|
|
31
|
+
const headers = parseRow(lines[0]);
|
|
32
|
+
const dataLines = lines.slice(2);
|
|
33
|
+
const rows = dataLines.map(parseRow).filter((row) => row.some(Boolean));
|
|
34
|
+
return { headers, rows };
|
|
35
|
+
}
|
|
36
|
+
function stripMarkdownFormatting(text) {
|
|
37
|
+
return text
|
|
38
|
+
.replace(/\*\*(.*?)\*\*/g, '$1')
|
|
39
|
+
.replace(/^>\s?/gm, '')
|
|
40
|
+
.replace(/^#+\s*/gm, '')
|
|
41
|
+
.replace(/^[-*+]\s+/gm, '• ')
|
|
42
|
+
.trim();
|
|
43
|
+
}
|
|
44
|
+
function buildTextBoxRequests(slideObjectId, shapeObjectId, text, options) {
|
|
45
|
+
const x = options?.x ?? 400000;
|
|
46
|
+
const y = options?.y ?? 400000;
|
|
47
|
+
const width = options?.width ?? 8200000;
|
|
48
|
+
const height = options?.height ?? 4300000;
|
|
49
|
+
return [
|
|
50
|
+
{
|
|
51
|
+
createShape: {
|
|
52
|
+
objectId: shapeObjectId,
|
|
53
|
+
shapeType: 'TEXT_BOX',
|
|
54
|
+
elementProperties: {
|
|
55
|
+
pageObjectId: slideObjectId,
|
|
56
|
+
size: {
|
|
57
|
+
width: { magnitude: width, unit: 'EMU' },
|
|
58
|
+
height: { magnitude: height, unit: 'EMU' },
|
|
59
|
+
},
|
|
60
|
+
transform: {
|
|
61
|
+
scaleX: 1,
|
|
62
|
+
scaleY: 1,
|
|
63
|
+
translateX: x,
|
|
64
|
+
translateY: y,
|
|
65
|
+
unit: 'EMU',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
insertText: {
|
|
72
|
+
objectId: shapeObjectId,
|
|
73
|
+
insertionIndex: 0,
|
|
74
|
+
text: stripMarkdownFormatting(text),
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
function buildTableRequests(slideObjectId, tableObjectId, content) {
|
|
80
|
+
const parsed = parseMarkdownTable(content);
|
|
81
|
+
if (!parsed)
|
|
82
|
+
return buildTextBoxRequests(slideObjectId, `${tableObjectId}_text`, content);
|
|
83
|
+
const rowCount = parsed.rows.length + 1;
|
|
84
|
+
const columnCount = parsed.headers.length;
|
|
85
|
+
const requests = [
|
|
86
|
+
{
|
|
87
|
+
createTable: {
|
|
88
|
+
objectId: tableObjectId,
|
|
89
|
+
elementProperties: {
|
|
90
|
+
pageObjectId: slideObjectId,
|
|
91
|
+
size: {
|
|
92
|
+
width: { magnitude: 8200000, unit: 'EMU' },
|
|
93
|
+
height: { magnitude: 4300000, unit: 'EMU' },
|
|
94
|
+
},
|
|
95
|
+
transform: {
|
|
96
|
+
scaleX: 1,
|
|
97
|
+
scaleY: 1,
|
|
98
|
+
translateX: 400000,
|
|
99
|
+
translateY: 400000,
|
|
100
|
+
unit: 'EMU',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
rows: rowCount,
|
|
104
|
+
columns: columnCount,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
];
|
|
108
|
+
parsed.headers.forEach((header, columnIndex) => {
|
|
109
|
+
requests.push({
|
|
110
|
+
insertText: {
|
|
111
|
+
objectId: tableObjectId,
|
|
112
|
+
cellLocation: { rowIndex: 0, columnIndex },
|
|
113
|
+
text: stripMarkdownFormatting(header),
|
|
114
|
+
insertionIndex: 0,
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
parsed.rows.forEach((row, rowIndex) => {
|
|
119
|
+
row.forEach((cell, columnIndex) => {
|
|
120
|
+
if (columnIndex >= columnCount)
|
|
121
|
+
return;
|
|
122
|
+
requests.push({
|
|
123
|
+
insertText: {
|
|
124
|
+
objectId: tableObjectId,
|
|
125
|
+
cellLocation: { rowIndex: rowIndex + 1, columnIndex },
|
|
126
|
+
text: stripMarkdownFormatting(cell),
|
|
127
|
+
insertionIndex: 0,
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
return requests;
|
|
133
|
+
}
|
|
134
|
+
function buildImageRequests(slideObjectId, imageObjectId, url) {
|
|
135
|
+
return [
|
|
136
|
+
{
|
|
137
|
+
createImage: {
|
|
138
|
+
objectId: imageObjectId,
|
|
139
|
+
url,
|
|
140
|
+
elementProperties: {
|
|
141
|
+
pageObjectId: slideObjectId,
|
|
142
|
+
size: {
|
|
143
|
+
width: { magnitude: 6400000, unit: 'EMU' },
|
|
144
|
+
height: { magnitude: 3600000, unit: 'EMU' },
|
|
145
|
+
},
|
|
146
|
+
transform: {
|
|
147
|
+
scaleX: 1,
|
|
148
|
+
scaleY: 1,
|
|
149
|
+
translateX: 1200000,
|
|
150
|
+
translateY: 800000,
|
|
151
|
+
unit: 'EMU',
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
];
|
|
157
|
+
}
|
|
158
|
+
function extractImageUrl(content) {
|
|
159
|
+
const match = content.match(/!\[[^\]]*]\(([^)]+)\)/);
|
|
160
|
+
return match?.[1]?.trim() ?? null;
|
|
161
|
+
}
|
|
162
|
+
export function buildMarkdownSlideRequests(markdownText, options) {
|
|
163
|
+
const slides = parseMarkdownSlides(markdownText);
|
|
164
|
+
const requests = [];
|
|
165
|
+
const prefix = options?.idPrefix ?? 'md';
|
|
166
|
+
slides.forEach((slideContent, index) => {
|
|
167
|
+
const slideObjectId = uniqueId(`${prefix}_slide`, index);
|
|
168
|
+
const insertionIndex = options?.insertionIndex !== undefined ? options.insertionIndex + index : index + 1;
|
|
169
|
+
requests.push({
|
|
170
|
+
createSlide: {
|
|
171
|
+
objectId: slideObjectId,
|
|
172
|
+
insertionIndex,
|
|
173
|
+
slideLayoutReference: { predefinedLayout: 'BLANK' },
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
if (slideContent.includes('|||')) {
|
|
177
|
+
const [left, right] = slideContent.split('|||').map((part) => part.trim());
|
|
178
|
+
requests.push(...buildTextBoxRequests(slideObjectId, uniqueId(`${prefix}_left`, index), left, {
|
|
179
|
+
x: 300000,
|
|
180
|
+
y: 400000,
|
|
181
|
+
width: 4000000,
|
|
182
|
+
height: 4300000,
|
|
183
|
+
}), ...buildTextBoxRequests(slideObjectId, uniqueId(`${prefix}_right`, index), right, {
|
|
184
|
+
x: 4500000,
|
|
185
|
+
y: 400000,
|
|
186
|
+
width: 4000000,
|
|
187
|
+
height: 4300000,
|
|
188
|
+
}));
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const imageUrl = extractImageUrl(slideContent);
|
|
192
|
+
if (imageUrl) {
|
|
193
|
+
requests.push(...buildImageRequests(slideObjectId, uniqueId(`${prefix}_image`, index), imageUrl));
|
|
194
|
+
const caption = slideContent.replace(/!\[[^\]]*]\([^)]+\)/, '').trim();
|
|
195
|
+
if (caption) {
|
|
196
|
+
requests.push(...buildTextBoxRequests(slideObjectId, uniqueId(`${prefix}_caption`, index), caption, {
|
|
197
|
+
y: 4500000,
|
|
198
|
+
height: 800000,
|
|
199
|
+
}));
|
|
200
|
+
}
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (isTableSlide(slideContent)) {
|
|
204
|
+
requests.push(...buildTableRequests(slideObjectId, uniqueId(`${prefix}_table`, index), slideContent));
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
const layout = slideContent.startsWith('# ') ? 'TITLE' : 'TITLE_AND_BODY';
|
|
208
|
+
if (layout === 'TITLE') {
|
|
209
|
+
requests.pop();
|
|
210
|
+
requests.push({
|
|
211
|
+
createSlide: {
|
|
212
|
+
objectId: slideObjectId,
|
|
213
|
+
insertionIndex,
|
|
214
|
+
slideLayoutReference: { predefinedLayout: 'TITLE' },
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
requests.push(...buildTextBoxRequests(slideObjectId, uniqueId(`${prefix}_body`, index), slideContent));
|
|
219
|
+
});
|
|
220
|
+
return requests;
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=markdown.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const presentationsBatchUpdate: import("ai").Tool<{
|
|
2
|
+
googleSlidesToken: string;
|
|
3
|
+
presentationId: string;
|
|
4
|
+
requests?: Record<string, unknown>[] | undefined;
|
|
5
|
+
writeControl?: Record<string, unknown> | undefined;
|
|
6
|
+
markdown_text?: string | undefined;
|
|
7
|
+
}, any>;
|
|
8
|
+
//# sourceMappingURL=presentations-batch-update.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { tool } from 'ai';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { buildMarkdownSlideRequests } from './markdown.js';
|
|
5
|
+
import { slidesRequest } from './utils.js';
|
|
6
|
+
export const presentationsBatchUpdate = tool({
|
|
7
|
+
description: 'Update a Google Slides presentation using raw Slides API batch requests or Markdown content.',
|
|
8
|
+
inputSchema: z.object({
|
|
9
|
+
googleSlidesToken: z.string().describe('The Google Slides access token'),
|
|
10
|
+
presentationId: z.string().describe('The ID of the presentation to update'),
|
|
11
|
+
requests: z
|
|
12
|
+
.array(z.record(z.unknown()))
|
|
13
|
+
.optional()
|
|
14
|
+
.describe('List of Google Slides batchUpdate request objects'),
|
|
15
|
+
writeControl: z
|
|
16
|
+
.record(z.unknown())
|
|
17
|
+
.optional()
|
|
18
|
+
.describe('Write control options such as requiredRevisionId'),
|
|
19
|
+
markdown_text: z
|
|
20
|
+
.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe('Markdown content to add as new slides. Separate slides with \\n---\\n'),
|
|
23
|
+
}),
|
|
24
|
+
execute: async ({ googleSlidesToken, presentationId, requests, writeControl, markdown_text }) => {
|
|
25
|
+
try {
|
|
26
|
+
const batchRequests = [...(requests ?? [])];
|
|
27
|
+
if (markdown_text) {
|
|
28
|
+
const presentation = await slidesRequest(googleSlidesToken, `/presentations/${presentationId}`);
|
|
29
|
+
const insertionIndex = presentation.data?.slides?.length ?? 0;
|
|
30
|
+
batchRequests.push(...buildMarkdownSlideRequests(markdown_text, {
|
|
31
|
+
insertionIndex,
|
|
32
|
+
idPrefix: 'batch',
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
if (batchRequests.length === 0) {
|
|
36
|
+
return { error: 'Provide requests and/or markdown_text to update the presentation' };
|
|
37
|
+
}
|
|
38
|
+
const body = { requests: batchRequests };
|
|
39
|
+
if (writeControl)
|
|
40
|
+
body.writeControl = writeControl;
|
|
41
|
+
const result = await slidesRequest(googleSlidesToken, `/presentations/${presentationId}:batchUpdate`, {
|
|
42
|
+
method: 'POST',
|
|
43
|
+
body,
|
|
44
|
+
});
|
|
45
|
+
if (!result.ok) {
|
|
46
|
+
return { error: 'Failed to batch update presentation', details: result.data, statusCode: result.status };
|
|
47
|
+
}
|
|
48
|
+
return result.data;
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
return {
|
|
52
|
+
error: 'Error batch updating presentation',
|
|
53
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=presentations-batch-update.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const presentationsCopyFromTemplate: import("ai").Tool<{
|
|
2
|
+
googleSlidesToken: string;
|
|
3
|
+
template_presentation_id: string;
|
|
4
|
+
new_title?: string | undefined;
|
|
5
|
+
parent_folder_id?: string | undefined;
|
|
6
|
+
}, any>;
|
|
7
|
+
//# sourceMappingURL=presentations-copy-from-template.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { tool } from 'ai';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { driveRequest } from './utils.js';
|
|
5
|
+
export const presentationsCopyFromTemplate = tool({
|
|
6
|
+
description: 'Copy a Google Slides template presentation to create a new deck, optionally with a new title and destination folder.',
|
|
7
|
+
inputSchema: z.object({
|
|
8
|
+
googleSlidesToken: z.string().describe('The Google Slides access token'),
|
|
9
|
+
template_presentation_id: z.string().describe('Drive file ID of the Slides template to copy'),
|
|
10
|
+
new_title: z.string().optional().describe('Title for the copied presentation'),
|
|
11
|
+
parent_folder_id: z.string().optional().describe('Destination Google Drive folder ID'),
|
|
12
|
+
}),
|
|
13
|
+
execute: async ({ googleSlidesToken, template_presentation_id, new_title, parent_folder_id }) => {
|
|
14
|
+
try {
|
|
15
|
+
const body = {};
|
|
16
|
+
if (new_title)
|
|
17
|
+
body.name = new_title;
|
|
18
|
+
if (parent_folder_id)
|
|
19
|
+
body.parents = [parent_folder_id];
|
|
20
|
+
const result = await driveRequest(googleSlidesToken, `/files/${template_presentation_id}/copy`, {
|
|
21
|
+
method: 'POST',
|
|
22
|
+
body,
|
|
23
|
+
});
|
|
24
|
+
if (!result.ok) {
|
|
25
|
+
return { error: 'Failed to copy presentation template', details: result.data, statusCode: result.status };
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
presentationId: result.data?.id,
|
|
29
|
+
name: result.data?.name,
|
|
30
|
+
webViewLink: result.data?.webViewLink,
|
|
31
|
+
...result.data,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return {
|
|
36
|
+
error: 'Error copying presentation template',
|
|
37
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=presentations-copy-from-template.js.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { tool } from 'ai';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { driveRequest, slidesRequest } from './utils.js';
|
|
5
|
+
export const presentationsGet = tool({
|
|
6
|
+
description: 'Retrieve a Google Slides presentation by ID or search for a presentation by name in Drive.',
|
|
7
|
+
inputSchema: z.object({
|
|
8
|
+
googleSlidesToken: z.string().describe('The Google Slides access token'),
|
|
9
|
+
presentationId: z.string().optional().describe('The ID of the presentation to retrieve'),
|
|
10
|
+
presentationName: z
|
|
11
|
+
.string()
|
|
12
|
+
.optional()
|
|
13
|
+
.describe('Presentation name to search for in Google Drive'),
|
|
14
|
+
fields: z
|
|
15
|
+
.string()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe('Comma-separated field mask for a partial Slides API response'),
|
|
18
|
+
}),
|
|
19
|
+
execute: async ({ googleSlidesToken, presentationId, presentationName, fields }) => {
|
|
20
|
+
try {
|
|
21
|
+
let resolvedId = presentationId;
|
|
22
|
+
if (!resolvedId && presentationName) {
|
|
23
|
+
const escaped = presentationName.replace(/'/g, "\\'");
|
|
24
|
+
const search = await driveRequest(googleSlidesToken, '/files', {
|
|
25
|
+
query: {
|
|
26
|
+
q: `name='${escaped}' and mimeType='application/vnd.google-apps.presentation' and trashed=false`,
|
|
27
|
+
pageSize: 1,
|
|
28
|
+
fields: 'files(id,name,webViewLink)',
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
if (!search.ok) {
|
|
32
|
+
return { error: 'Failed to search for presentation by name', details: search.data, statusCode: search.status };
|
|
33
|
+
}
|
|
34
|
+
resolvedId = search.data?.files?.[0]?.id;
|
|
35
|
+
if (!resolvedId) {
|
|
36
|
+
return { error: `No presentation found with name '${presentationName}'` };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (!resolvedId) {
|
|
40
|
+
return { error: 'Provide presentationId or presentationName' };
|
|
41
|
+
}
|
|
42
|
+
const result = await slidesRequest(googleSlidesToken, `/presentations/${resolvedId}`, {
|
|
43
|
+
query: fields ? { fields } : {},
|
|
44
|
+
});
|
|
45
|
+
if (!result.ok) {
|
|
46
|
+
return { error: 'Failed to get presentation', details: result.data, statusCode: result.status };
|
|
47
|
+
}
|
|
48
|
+
return result.data;
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
return {
|
|
52
|
+
error: 'Error getting presentation',
|
|
53
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=presentations-get.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const presentationsPagesGetThumbnail: import("ai").Tool<{
|
|
2
|
+
googleSlidesToken: string;
|
|
3
|
+
presentationId: string;
|
|
4
|
+
pageObjectId: string;
|
|
5
|
+
'thumbnailProperties.mimeType'?: string | undefined;
|
|
6
|
+
'thumbnailProperties.thumbnailSize'?: "LARGE" | "MEDIUM" | "SMALL" | "THUMBNAIL_SIZE_UNSPECIFIED" | undefined;
|
|
7
|
+
}, any>;
|
|
8
|
+
//# sourceMappingURL=presentations-pages-get-thumbnail.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { tool } from 'ai';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { slidesRequest } from './utils.js';
|
|
5
|
+
export const presentationsPagesGetThumbnail = tool({
|
|
6
|
+
description: 'Get a thumbnail image URL for a slide page. Deprecated in favor of getPageThumbnail2; kept for compatibility.',
|
|
7
|
+
inputSchema: z.object({
|
|
8
|
+
googleSlidesToken: z.string().describe('The Google Slides access token'),
|
|
9
|
+
presentationId: z.string().describe('The ID of the presentation containing the page'),
|
|
10
|
+
pageObjectId: z.string().describe('The object ID of the page whose thumbnail to retrieve'),
|
|
11
|
+
'thumbnailProperties.mimeType': z
|
|
12
|
+
.string()
|
|
13
|
+
.optional()
|
|
14
|
+
.describe("Optional thumbnail MIME type (currently only 'PNG' is supported)"),
|
|
15
|
+
'thumbnailProperties.thumbnailSize': z
|
|
16
|
+
.enum(['LARGE', 'MEDIUM', 'SMALL', 'THUMBNAIL_SIZE_UNSPECIFIED'])
|
|
17
|
+
.optional()
|
|
18
|
+
.describe('Optional thumbnail size'),
|
|
19
|
+
}),
|
|
20
|
+
execute: async ({ googleSlidesToken, presentationId, pageObjectId, 'thumbnailProperties.mimeType': mimeType, 'thumbnailProperties.thumbnailSize': thumbnailSize, }) => {
|
|
21
|
+
try {
|
|
22
|
+
const query = {};
|
|
23
|
+
if (mimeType)
|
|
24
|
+
query['thumbnailProperties.mimeType'] = mimeType;
|
|
25
|
+
if (thumbnailSize)
|
|
26
|
+
query['thumbnailProperties.thumbnailSize'] = thumbnailSize;
|
|
27
|
+
const result = await slidesRequest(googleSlidesToken, `/presentations/${presentationId}/pages/${pageObjectId}/thumbnail`, { query });
|
|
28
|
+
if (!result.ok) {
|
|
29
|
+
return { error: 'Failed to get page thumbnail', details: result.data, statusCode: result.status };
|
|
30
|
+
}
|
|
31
|
+
return result.data;
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
return {
|
|
35
|
+
error: 'Error getting page thumbnail',
|
|
36
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=presentations-pages-get-thumbnail.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { tool } from 'ai';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { slidesRequest } from './utils.js';
|
|
5
|
+
export const presentationsPagesGet = tool({
|
|
6
|
+
description: 'Retrieve a specific page (slide) from a Google Slides presentation.',
|
|
7
|
+
inputSchema: z.object({
|
|
8
|
+
googleSlidesToken: z.string().describe('The Google Slides access token'),
|
|
9
|
+
presentationId: z.string().describe('The ID of the presentation'),
|
|
10
|
+
pageObjectId: z.string().describe('The object ID of the page to retrieve'),
|
|
11
|
+
}),
|
|
12
|
+
execute: async ({ googleSlidesToken, presentationId, pageObjectId }) => {
|
|
13
|
+
try {
|
|
14
|
+
const result = await slidesRequest(googleSlidesToken, `/presentations/${presentationId}/pages/${pageObjectId}`);
|
|
15
|
+
if (!result.ok) {
|
|
16
|
+
return { error: 'Failed to get presentation page', details: result.data, statusCode: result.status };
|
|
17
|
+
}
|
|
18
|
+
return result.data;
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
return {
|
|
22
|
+
error: 'Error getting presentation page',
|
|
23
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=presentations-pages-get.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const SLIDES_BASE = "https://slides.googleapis.com/v1";
|
|
2
|
+
export declare const DRIVE_BASE = "https://www.googleapis.com/drive/v3";
|
|
3
|
+
export declare function buildQueryString(params: Record<string, unknown>): string;
|
|
4
|
+
export declare function slidesRequest(googleSlidesToken: string, path: string, options?: {
|
|
5
|
+
method?: string;
|
|
6
|
+
body?: unknown;
|
|
7
|
+
query?: Record<string, unknown>;
|
|
8
|
+
}): Promise<{
|
|
9
|
+
ok: boolean;
|
|
10
|
+
status: number;
|
|
11
|
+
data: any;
|
|
12
|
+
}>;
|
|
13
|
+
export declare function driveRequest(googleSlidesToken: string, path: string, options?: {
|
|
14
|
+
method?: string;
|
|
15
|
+
body?: unknown;
|
|
16
|
+
query?: Record<string, unknown>;
|
|
17
|
+
}): Promise<{
|
|
18
|
+
ok: boolean;
|
|
19
|
+
status: number;
|
|
20
|
+
data: any;
|
|
21
|
+
}>;
|
|
22
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
export const SLIDES_BASE = 'https://slides.googleapis.com/v1';
|
|
3
|
+
export const DRIVE_BASE = 'https://www.googleapis.com/drive/v3';
|
|
4
|
+
export function buildQueryString(params) {
|
|
5
|
+
const search = new URLSearchParams();
|
|
6
|
+
for (const [key, value] of Object.entries(params)) {
|
|
7
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
8
|
+
search.set(key, String(value));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const qs = search.toString();
|
|
12
|
+
return qs ? `?${qs}` : '';
|
|
13
|
+
}
|
|
14
|
+
export async function slidesRequest(googleSlidesToken, path, options) {
|
|
15
|
+
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
|
|
16
|
+
const url = `${SLIDES_BASE}${normalizedPath}${buildQueryString(options?.query ?? {})}`;
|
|
17
|
+
const headers = {
|
|
18
|
+
Authorization: `Bearer ${googleSlidesToken}`,
|
|
19
|
+
Accept: 'application/json',
|
|
20
|
+
};
|
|
21
|
+
const method = options?.method ?? 'GET';
|
|
22
|
+
const fetchOptions = { method, headers };
|
|
23
|
+
if (options?.body !== undefined) {
|
|
24
|
+
headers['Content-Type'] = 'application/json';
|
|
25
|
+
fetchOptions.body = JSON.stringify(options.body);
|
|
26
|
+
}
|
|
27
|
+
const response = await fetch(url, fetchOptions);
|
|
28
|
+
if (response.status === 204) {
|
|
29
|
+
return { ok: response.ok, status: response.status, data: null };
|
|
30
|
+
}
|
|
31
|
+
const data = await response.json().catch(() => null);
|
|
32
|
+
return { ok: response.ok, status: response.status, data };
|
|
33
|
+
}
|
|
34
|
+
export async function driveRequest(googleSlidesToken, path, options) {
|
|
35
|
+
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
|
|
36
|
+
const url = `${DRIVE_BASE}${normalizedPath}${buildQueryString(options?.query ?? {})}`;
|
|
37
|
+
const headers = {
|
|
38
|
+
Authorization: `Bearer ${googleSlidesToken}`,
|
|
39
|
+
Accept: 'application/json',
|
|
40
|
+
};
|
|
41
|
+
const method = options?.method ?? 'GET';
|
|
42
|
+
const fetchOptions = { method, headers };
|
|
43
|
+
if (options?.body !== undefined) {
|
|
44
|
+
headers['Content-Type'] = 'application/json';
|
|
45
|
+
fetchOptions.body = JSON.stringify(options.body);
|
|
46
|
+
}
|
|
47
|
+
const response = await fetch(url, fetchOptions);
|
|
48
|
+
const data = await response.json().catch(() => null);
|
|
49
|
+
return { ok: response.ok, status: response.status, data };
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const SVG = `<svg width="800px" height="800px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="none"><path fill="url(#grafana-color-16__paint0_linear_2372_364)" d="M13.985 7.175a4.408 4.408 0 00-.138-.802 5.035 5.035 0 00-1.054-1.998 2.96 2.96 0 00-.366-.393c.198-.787-.245-1.468-.245-1.468-.764-.046-1.237.227-1.42.363-.031-.015-.062-.03-.092-.03-.122-.046-.26-.106-.397-.137-.138-.045-.275-.075-.413-.12-.137-.031-.29-.061-.443-.092-.03 0-.046 0-.076-.015C9.005 1.44 8.058 1 8.058 1 7.004 1.666 6.79 2.604 6.79 2.604s0 .015-.016.06l-.183.046c-.076.03-.168.06-.244.076-.077.03-.168.06-.245.09-.153.076-.32.152-.473.228-.153.09-.306.181-.443.272-.016-.015-.03-.015-.03-.015-1.467-.545-2.766.136-2.766.136-.122 1.544.58 2.528.733 2.71-.03.09-.06.196-.091.287a8.104 8.104 0 00-.245 1.09c0 .06-.015.106-.015.166C1.397 8.386 1 9.748 1 9.748c1.13 1.287 2.46 1.377 2.46 1.377.167.303.366.575.58.848.092.106.183.212.29.318a3.014 3.014 0 00.061 2.149c1.268.045 2.093-.545 2.261-.681.122.045.26.076.382.106.382.106.78.151 1.176.181h.49c.595.848 1.634.954 1.634.954.748-.772.779-1.544.779-1.71v-.015-.03-.03c.153-.107.305-.228.443-.35a5.37 5.37 0 00.779-.892c.015-.03.046-.06.061-.09.84.045 1.436-.515 1.436-.515-.138-.863-.642-1.287-.749-1.378l-.015-.015h-.015s-.015 0-.015-.015c0-.045.015-.106.015-.151 0-.091.015-.182.015-.288V9.4v-.166-.076-.152l-.015-.075c-.015-.091-.03-.197-.061-.288a3.506 3.506 0 00-.428-1.044 3.856 3.856 0 00-.718-.848 3.784 3.784 0 00-.901-.575 3.347 3.347 0 00-.993-.272c-.168-.015-.336-.03-.504-.03H9.37 9.204c-.092.015-.169.015-.26.03-.336.06-.642.181-.932.348-.275.166-.52.363-.718.605a2.579 2.579 0 00-.459.757 2.63 2.63 0 00-.183.817v.393c.015.137.046.273.077.394.076.258.183.485.336.666.137.197.32.348.504.485.183.12.382.212.58.272.199.06.382.076.565.076h.244c.031 0 .047 0 .062-.015.015 0 .046-.015.061-.015.046-.016.076-.016.122-.03l.23-.092a.869.869 0 00.198-.12c.015-.016.03-.03.046-.03a.129.129 0 00.015-.198c-.046-.06-.122-.075-.183-.03-.015.015-.03.015-.046.03-.046.03-.107.046-.168.06l-.183.046c-.03 0-.061.015-.092.015H8.73a1.519 1.519 0 01-.825-.378 1.452 1.452 0 01-.306-.378 1.655 1.655 0 01-.168-.485c-.015-.09-.015-.166-.015-.257v-.106-.03c0-.046.015-.091.015-.136.061-.364.26-.727.55-1 .077-.075.153-.136.23-.181.076-.06.167-.106.259-.151.092-.046.183-.076.29-.106a.993.993 0 01.306-.046h.321c.107.015.229.03.336.046.214.045.427.12.626.242.397.212.733.56.947.969.107.211.183.423.214.65.015.06.015.121.015.167v.363c0 .06-.015.121-.015.182 0 .06-.015.12-.03.181l-.046.182c-.03.121-.077.242-.123.363a3.183 3.183 0 01-.366.666 3.002 3.002 0 01-1.91 1.18c-.122.016-.26.03-.382.046h-.198c-.061 0-.138 0-.199-.015a3.637 3.637 0 01-.81-.151 4.068 4.068 0 01-.748-.303 4.098 4.098 0 01-1.696-1.695 4.398 4.398 0 01-.29-.742c-.076-.257-.107-.514-.137-.772v-.302-.091c0-.136.015-.258.03-.394s.046-.272.061-.393c.03-.137.061-.258.092-.394a5.33 5.33 0 01.275-.741c.214-.47.504-.893.855-1.226.092-.091.184-.167.275-.243.092-.075.184-.136.29-.211a5.39 5.39 0 01.306-.182c.046-.03.107-.045.153-.076a.26.26 0 01.076-.03.26.26 0 01.077-.03c.107-.046.229-.091.336-.121.03-.015.06-.015.091-.03.03-.016.061-.016.092-.03.061-.016.122-.031.168-.046.03-.015.061-.015.092-.015.03 0 .06-.016.091-.016.03 0 .061-.015.092-.015l.046-.015h.046c.03 0 .06-.015.091-.015.03 0 .061-.015.107-.015.03 0 .077-.015.107-.015h.764c.23.015.443.03.657.075.428.076.84.212 1.207.394.366.182.702.393.977.636l.046.045.046.045c.03.03.061.061.107.091l.092.091.091.09c.123.122.23.258.336.394.199.258.367.515.49.772.014.015.014.03.03.046.015.015.015.03.015.045l.046.09.046.092.045.09c.046.122.092.228.123.333.06.167.107.318.137.455.015.045.061.09.122.075a.104.104 0 00.107-.106c.092-.227.092-.393.077-.575z"/><defs><linearGradient id="grafana-color-16__paint0_linear_2372_364" x1="7.502" x2="7.502" y1="18.142" y2="5.356" gradientUnits="userSpaceOnUse"><stop stop-color="#FFF200"/><stop offset="1" stop-color="#F15A29"/></linearGradient></defs></svg>`;
|
|
2
|
+
export const GRAFANA_ICON = {
|
|
3
|
+
kind: 'svg',
|
|
4
|
+
dataUri: `data:image/svg+xml;base64,${Buffer.from(SVG).toString('base64')}`,
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=icon.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defineToolkit, defineTool } from '../../core/define.js';
|
|
2
|
+
import { GRAFANA_ICON } from './icon.js';
|
|
3
|
+
import { grafanaTools } from './tools/index.js';
|
|
4
|
+
export default defineToolkit({
|
|
5
|
+
id: 'grafana',
|
|
6
|
+
displayName: 'Grafana',
|
|
7
|
+
shortDescription: 'Monitor Grafana health, query public dashboards, ingest OTLP logs, and inspect Mimir/Loki ring status.',
|
|
8
|
+
category: 'Developer Tools & DevOps',
|
|
9
|
+
icon: GRAFANA_ICON,
|
|
10
|
+
auth: {
|
|
11
|
+
type: 'service_account',
|
|
12
|
+
tokenField: 'grafanaCredentials',
|
|
13
|
+
provider: {
|
|
14
|
+
fields: ['baseUrl', 'apiToken'],
|
|
15
|
+
connectDescription: 'Connect your Grafana instance with its base URL (e.g. https://grafana.example.com) and an optional service account API token.',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
tools: grafanaTools.map((entry) => defineTool({
|
|
19
|
+
name: entry.name,
|
|
20
|
+
description: entry.description,
|
|
21
|
+
tool: entry.tool,
|
|
22
|
+
requiredAuth: entry.requiredAuth,
|
|
23
|
+
scope: entry.scope,
|
|
24
|
+
})),
|
|
25
|
+
meta: {
|
|
26
|
+
since: '0.0.6',
|
|
27
|
+
homepage: 'https://grafana.com',
|
|
28
|
+
docsUrl: 'https://grafana.com/docs/grafana/latest/developer-resources/api-reference/http-api/',
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const createOtlpV1Logs: import("ai").Tool<{
|
|
2
|
+
grafanaCredentials: string;
|
|
3
|
+
resourceLogs: Record<string, any>[];
|
|
4
|
+
}, {
|
|
5
|
+
error: string;
|
|
6
|
+
details: any;
|
|
7
|
+
statusCode: number;
|
|
8
|
+
success?: undefined;
|
|
9
|
+
message?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
success: boolean;
|
|
12
|
+
statusCode: number;
|
|
13
|
+
message: string;
|
|
14
|
+
error?: undefined;
|
|
15
|
+
details?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
error: string;
|
|
18
|
+
message: string;
|
|
19
|
+
details?: undefined;
|
|
20
|
+
statusCode?: undefined;
|
|
21
|
+
success?: undefined;
|
|
22
|
+
}>;
|
|
23
|
+
//# sourceMappingURL=create-otlp-v1-logs.d.ts.map
|