Skip to content

Commit 71b414c

Browse files
author
aadamgough
committed
added utils func
1 parent 78a99da commit 71b414c

File tree

6 files changed

+110
-424
lines changed

6 files changed

+110
-424
lines changed

apps/sim/tools/google_drive/create_folder.ts

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,10 @@
11
import { createLogger } from '@sim/logger'
22
import type { GoogleDriveToolParams, GoogleDriveUploadResponse } from '@/tools/google_drive/types'
3+
import { ALL_FILE_FIELDS } from '@/tools/google_drive/utils'
34
import type { ToolConfig } from '@/tools/types'
45

56
const logger = createLogger('GoogleDriveCreateFolderTool')
67

7-
// All available file metadata fields from Google Drive API v3
8-
const ALL_FILE_FIELDS = [
9-
// Basic Info
10-
'id',
11-
'name',
12-
'mimeType',
13-
'kind',
14-
'description',
15-
'originalFilename',
16-
'fullFileExtension',
17-
'fileExtension',
18-
// Ownership & Sharing
19-
'owners',
20-
'permissions',
21-
'permissionIds',
22-
'shared',
23-
'ownedByMe',
24-
'writersCanShare',
25-
'viewersCanCopyContent',
26-
'copyRequiresWriterPermission',
27-
'sharingUser',
28-
// Labels/Tags
29-
'starred',
30-
'trashed',
31-
'explicitlyTrashed',
32-
'properties',
33-
'appProperties',
34-
'folderColorRgb',
35-
// Timestamps
36-
'createdTime',
37-
'modifiedTime',
38-
'modifiedByMeTime',
39-
'viewedByMeTime',
40-
'sharedWithMeTime',
41-
'trashedTime',
42-
// User Info
43-
'lastModifyingUser',
44-
'trashingUser',
45-
'viewedByMe',
46-
'modifiedByMe',
47-
// Links
48-
'webViewLink',
49-
'webContentLink',
50-
'iconLink',
51-
'thumbnailLink',
52-
'exportLinks',
53-
// Size & Storage
54-
'size',
55-
'quotaBytesUsed',
56-
// Checksums
57-
'md5Checksum',
58-
'sha1Checksum',
59-
'sha256Checksum',
60-
// Hierarchy & Location
61-
'parents',
62-
'spaces',
63-
'driveId',
64-
'teamDriveId',
65-
// Capabilities
66-
'capabilities',
67-
// Versions
68-
'version',
69-
'headRevisionId',
70-
// Media Metadata
71-
'hasThumbnail',
72-
'thumbnailVersion',
73-
'imageMediaMetadata',
74-
'videoMediaMetadata',
75-
'contentHints',
76-
// Other
77-
'isAppAuthorized',
78-
'contentRestrictions',
79-
'resourceKey',
80-
'shortcutDetails',
81-
'linkShareMetadata',
82-
].join(',')
83-
848
export const createFolderTool: ToolConfig<GoogleDriveToolParams, GoogleDriveUploadResponse> = {
859
id: 'google_drive_create_folder',
8610
name: 'Create Folder in Google Drive',

apps/sim/tools/google_drive/download.ts

Lines changed: 6 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -5,106 +5,16 @@ import type {
55
GoogleDriveRevision,
66
GoogleDriveToolParams,
77
} from '@/tools/google_drive/types'
8-
import { DEFAULT_EXPORT_FORMATS, GOOGLE_WORKSPACE_MIME_TYPES } from '@/tools/google_drive/utils'
8+
import {
9+
ALL_FILE_FIELDS,
10+
ALL_REVISION_FIELDS,
11+
DEFAULT_EXPORT_FORMATS,
12+
GOOGLE_WORKSPACE_MIME_TYPES,
13+
} from '@/tools/google_drive/utils'
914
import type { ToolConfig } from '@/tools/types'
1015

1116
const logger = createLogger('GoogleDriveDownloadTool')
1217

13-
// All available file metadata fields from Google Drive API v3
14-
const ALL_FILE_FIELDS = [
15-
// Basic Info
16-
'id',
17-
'name',
18-
'mimeType',
19-
'kind',
20-
'description',
21-
'originalFilename',
22-
'fullFileExtension',
23-
'fileExtension',
24-
// Ownership & Sharing
25-
'owners',
26-
'permissions',
27-
'permissionIds',
28-
'shared',
29-
'ownedByMe',
30-
'writersCanShare',
31-
'viewersCanCopyContent',
32-
'copyRequiresWriterPermission',
33-
'sharingUser',
34-
// Labels/Tags
35-
'starred',
36-
'trashed',
37-
'explicitlyTrashed',
38-
'properties',
39-
'appProperties',
40-
'folderColorRgb',
41-
// Timestamps
42-
'createdTime',
43-
'modifiedTime',
44-
'modifiedByMeTime',
45-
'viewedByMeTime',
46-
'sharedWithMeTime',
47-
'trashedTime',
48-
// User Info
49-
'lastModifyingUser',
50-
'trashingUser',
51-
'viewedByMe',
52-
'modifiedByMe',
53-
// Links
54-
'webViewLink',
55-
'webContentLink',
56-
'iconLink',
57-
'thumbnailLink',
58-
'exportLinks',
59-
// Size & Storage
60-
'size',
61-
'quotaBytesUsed',
62-
// Checksums
63-
'md5Checksum',
64-
'sha1Checksum',
65-
'sha256Checksum',
66-
// Hierarchy & Location
67-
'parents',
68-
'spaces',
69-
'driveId',
70-
'teamDriveId',
71-
// Capabilities
72-
'capabilities',
73-
// Versions
74-
'version',
75-
'headRevisionId',
76-
// Media Metadata
77-
'hasThumbnail',
78-
'thumbnailVersion',
79-
'imageMediaMetadata',
80-
'videoMediaMetadata',
81-
'contentHints',
82-
// Other
83-
'isAppAuthorized',
84-
'contentRestrictions',
85-
'resourceKey',
86-
'shortcutDetails',
87-
'linkShareMetadata',
88-
].join(',')
89-
90-
// All revision fields
91-
const ALL_REVISION_FIELDS = [
92-
'id',
93-
'mimeType',
94-
'modifiedTime',
95-
'keepForever',
96-
'published',
97-
'publishAuto',
98-
'publishedLink',
99-
'publishedOutsideDomain',
100-
'lastModifyingUser',
101-
'originalFilename',
102-
'md5Checksum',
103-
'size',
104-
'exportLinks',
105-
'kind',
106-
].join(',')
107-
10818
export const downloadTool: ToolConfig<GoogleDriveToolParams, GoogleDriveDownloadResponse> = {
10919
id: 'google_drive_download',
11020
name: 'Download File from Google Drive',

apps/sim/tools/google_drive/get_content.ts

Lines changed: 6 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -5,106 +5,16 @@ import type {
55
GoogleDriveRevision,
66
GoogleDriveToolParams,
77
} from '@/tools/google_drive/types'
8-
import { DEFAULT_EXPORT_FORMATS, GOOGLE_WORKSPACE_MIME_TYPES } from '@/tools/google_drive/utils'
8+
import {
9+
ALL_FILE_FIELDS,
10+
ALL_REVISION_FIELDS,
11+
DEFAULT_EXPORT_FORMATS,
12+
GOOGLE_WORKSPACE_MIME_TYPES,
13+
} from '@/tools/google_drive/utils'
914
import type { ToolConfig } from '@/tools/types'
1015

1116
const logger = createLogger('GoogleDriveGetContentTool')
1217

13-
// All available file metadata fields from Google Drive API v3
14-
const ALL_FILE_FIELDS = [
15-
// Basic Info
16-
'id',
17-
'name',
18-
'mimeType',
19-
'kind',
20-
'description',
21-
'originalFilename',
22-
'fullFileExtension',
23-
'fileExtension',
24-
// Ownership & Sharing
25-
'owners',
26-
'permissions',
27-
'permissionIds',
28-
'shared',
29-
'ownedByMe',
30-
'writersCanShare',
31-
'viewersCanCopyContent',
32-
'copyRequiresWriterPermission',
33-
'sharingUser',
34-
// Labels/Tags
35-
'starred',
36-
'trashed',
37-
'explicitlyTrashed',
38-
'properties',
39-
'appProperties',
40-
'folderColorRgb',
41-
// Timestamps
42-
'createdTime',
43-
'modifiedTime',
44-
'modifiedByMeTime',
45-
'viewedByMeTime',
46-
'sharedWithMeTime',
47-
'trashedTime',
48-
// User Info
49-
'lastModifyingUser',
50-
'trashingUser',
51-
'viewedByMe',
52-
'modifiedByMe',
53-
// Links
54-
'webViewLink',
55-
'webContentLink',
56-
'iconLink',
57-
'thumbnailLink',
58-
'exportLinks',
59-
// Size & Storage
60-
'size',
61-
'quotaBytesUsed',
62-
// Checksums
63-
'md5Checksum',
64-
'sha1Checksum',
65-
'sha256Checksum',
66-
// Hierarchy & Location
67-
'parents',
68-
'spaces',
69-
'driveId',
70-
'teamDriveId',
71-
// Capabilities
72-
'capabilities',
73-
// Versions
74-
'version',
75-
'headRevisionId',
76-
// Media Metadata
77-
'hasThumbnail',
78-
'thumbnailVersion',
79-
'imageMediaMetadata',
80-
'videoMediaMetadata',
81-
'contentHints',
82-
// Other
83-
'isAppAuthorized',
84-
'contentRestrictions',
85-
'resourceKey',
86-
'shortcutDetails',
87-
'linkShareMetadata',
88-
].join(',')
89-
90-
// All revision fields
91-
const ALL_REVISION_FIELDS = [
92-
'id',
93-
'mimeType',
94-
'modifiedTime',
95-
'keepForever',
96-
'published',
97-
'publishAuto',
98-
'publishedLink',
99-
'publishedOutsideDomain',
100-
'lastModifyingUser',
101-
'originalFilename',
102-
'md5Checksum',
103-
'size',
104-
'exportLinks',
105-
'kind',
106-
].join(',')
107-
10818
export const getContentTool: ToolConfig<GoogleDriveToolParams, GoogleDriveGetContentResponse> = {
10919
id: 'google_drive_get_content',
11020
name: 'Get Content from Google Drive',

apps/sim/tools/google_drive/list.ts

Lines changed: 1 addition & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,7 @@
11
import type { GoogleDriveListResponse, GoogleDriveToolParams } from '@/tools/google_drive/types'
2+
import { ALL_FILE_FIELDS } from '@/tools/google_drive/utils'
23
import type { ToolConfig } from '@/tools/types'
34

4-
// All available file metadata fields from Google Drive API v3
5-
// Note: For list operations, some nested fields may not be available depending on permissions
6-
const ALL_FILE_FIELDS = [
7-
// Basic Info
8-
'id',
9-
'name',
10-
'mimeType',
11-
'kind',
12-
'description',
13-
'originalFilename',
14-
'fullFileExtension',
15-
'fileExtension',
16-
// Ownership & Sharing
17-
'owners',
18-
'permissions',
19-
'permissionIds',
20-
'shared',
21-
'ownedByMe',
22-
'writersCanShare',
23-
'viewersCanCopyContent',
24-
'copyRequiresWriterPermission',
25-
'sharingUser',
26-
// Labels/Tags
27-
'starred',
28-
'trashed',
29-
'explicitlyTrashed',
30-
'properties',
31-
'appProperties',
32-
'folderColorRgb',
33-
// Timestamps
34-
'createdTime',
35-
'modifiedTime',
36-
'modifiedByMeTime',
37-
'viewedByMeTime',
38-
'sharedWithMeTime',
39-
'trashedTime',
40-
// User Info
41-
'lastModifyingUser',
42-
'trashingUser',
43-
'viewedByMe',
44-
'modifiedByMe',
45-
// Links
46-
'webViewLink',
47-
'webContentLink',
48-
'iconLink',
49-
'thumbnailLink',
50-
'exportLinks',
51-
// Size & Storage
52-
'size',
53-
'quotaBytesUsed',
54-
// Checksums
55-
'md5Checksum',
56-
'sha1Checksum',
57-
'sha256Checksum',
58-
// Hierarchy & Location
59-
'parents',
60-
'spaces',
61-
'driveId',
62-
'teamDriveId',
63-
// Capabilities
64-
'capabilities',
65-
// Versions
66-
'version',
67-
'headRevisionId',
68-
// Media Metadata
69-
'hasThumbnail',
70-
'thumbnailVersion',
71-
'imageMediaMetadata',
72-
'videoMediaMetadata',
73-
'contentHints',
74-
// Other
75-
'isAppAuthorized',
76-
'contentRestrictions',
77-
'resourceKey',
78-
'shortcutDetails',
79-
'linkShareMetadata',
80-
].join(',')
81-
825
export const listTool: ToolConfig<GoogleDriveToolParams, GoogleDriveListResponse> = {
836
id: 'google_drive_list',
847
name: 'List Google Drive Files',

0 commit comments

Comments
 (0)