@hasna/connectors 1.3.27 → 1.3.28
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/bin/index.js +39 -2
- package/bin/mcp.js +39 -2
- package/bin/serve.js +38 -1
- package/dist/index.js +38 -1
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -1909,7 +1909,7 @@ var package_default;
|
|
|
1909
1909
|
var init_package = __esm(() => {
|
|
1910
1910
|
package_default = {
|
|
1911
1911
|
name: "@hasna/connectors",
|
|
1912
|
-
version: "1.3.
|
|
1912
|
+
version: "1.3.28",
|
|
1913
1913
|
description: "Open source connector library - Install API connectors with a single command",
|
|
1914
1914
|
type: "module",
|
|
1915
1915
|
bin: {
|
|
@@ -7463,6 +7463,35 @@ function listProfiles2() {
|
|
|
7463
7463
|
}
|
|
7464
7464
|
return Array.from(profiles).sort((a, b) => a.localeCompare(b));
|
|
7465
7465
|
}
|
|
7466
|
+
function listProfileStatuses(profile) {
|
|
7467
|
+
const profiles = profile ? [profile] : listProfiles2();
|
|
7468
|
+
const uniqueProfiles = profiles.length ? profiles : ["default"];
|
|
7469
|
+
const now = Date.now();
|
|
7470
|
+
return uniqueProfiles.map((name) => {
|
|
7471
|
+
const tokens = loadTokens2(name);
|
|
7472
|
+
const credentials = loadCredentials2(name);
|
|
7473
|
+
const hasAccessToken = Boolean(tokens?.accessToken || process.env.GOOGLE_ACCESS_TOKEN);
|
|
7474
|
+
const hasRefreshToken = Boolean(tokens?.refreshToken);
|
|
7475
|
+
const hasOAuthCredentials = Boolean(credentials.clientId && credentials.clientSecret);
|
|
7476
|
+
const expiresAt = tokens?.expiresAt ?? null;
|
|
7477
|
+
const expired = Boolean(expiresAt && now >= expiresAt - REFRESH_BUFFER_MS2);
|
|
7478
|
+
const authenticated = Boolean(process.env.GOOGLE_ACCESS_TOKEN || hasRefreshToken || hasAccessToken && !expired);
|
|
7479
|
+
const configured = authenticated || hasOAuthCredentials;
|
|
7480
|
+
const authRequired = !authenticated || expired && !hasRefreshToken;
|
|
7481
|
+
return {
|
|
7482
|
+
profile: name,
|
|
7483
|
+
configured,
|
|
7484
|
+
authenticated,
|
|
7485
|
+
expired,
|
|
7486
|
+
expiresAt,
|
|
7487
|
+
hasAccessToken,
|
|
7488
|
+
hasRefreshToken,
|
|
7489
|
+
hasOAuthCredentials,
|
|
7490
|
+
authRequired,
|
|
7491
|
+
message: authRequired ? `Google Drive profile "${name}" needs authentication. Run: connectors auth googledrive` : expired ? `Google Drive profile "${name}" access token is expired but can refresh.` : `Google Drive profile "${name}" is authenticated.`
|
|
7492
|
+
};
|
|
7493
|
+
});
|
|
7494
|
+
}
|
|
7466
7495
|
function loadCredentials2(profile) {
|
|
7467
7496
|
const envClientId = process.env.GOOGLE_CLIENT_ID;
|
|
7468
7497
|
const envClientSecret = process.env.GOOGLE_CLIENT_SECRET;
|
|
@@ -7535,7 +7564,7 @@ function extractGoogleError(body) {
|
|
|
7535
7564
|
return body;
|
|
7536
7565
|
}
|
|
7537
7566
|
}
|
|
7538
|
-
var DRIVE_API_BASE = "https://www.googleapis.com/drive/v3", TOKEN_URL2 = "https://oauth2.googleapis.com/token", REFRESH_BUFFER_MS2, DEFAULT_FILE_FIELDS, DEFAULT_EXPORT_FORMATS, EXPORT_EXTENSIONS, listFilesSchema, listDrivesSchema, fileIdSchema, downloadSchema, googleDriveConnector;
|
|
7567
|
+
var DRIVE_API_BASE = "https://www.googleapis.com/drive/v3", TOKEN_URL2 = "https://oauth2.googleapis.com/token", REFRESH_BUFFER_MS2, DEFAULT_FILE_FIELDS, DEFAULT_EXPORT_FORMATS, EXPORT_EXTENSIONS, listFilesSchema, listDrivesSchema, fileIdSchema, downloadSchema, profilesStatusSchema, googleDriveConnector;
|
|
7539
7568
|
var init_googledrive = __esm(() => {
|
|
7540
7569
|
init_zod();
|
|
7541
7570
|
init_connector();
|
|
@@ -7600,6 +7629,9 @@ var init_googledrive = __esm(() => {
|
|
|
7600
7629
|
}).optional(),
|
|
7601
7630
|
exportMimeType: exports_external.string().optional()
|
|
7602
7631
|
});
|
|
7632
|
+
profilesStatusSchema = exports_external.object({
|
|
7633
|
+
profile: exports_external.string().optional()
|
|
7634
|
+
});
|
|
7603
7635
|
googleDriveConnector = defineConnector({
|
|
7604
7636
|
meta: {
|
|
7605
7637
|
name: "googledrive",
|
|
@@ -7622,6 +7654,11 @@ var init_googledrive = __esm(() => {
|
|
|
7622
7654
|
summary: "List configured Google Drive profiles.",
|
|
7623
7655
|
execute: () => ({ profiles: listProfiles2() })
|
|
7624
7656
|
},
|
|
7657
|
+
"profiles.status": {
|
|
7658
|
+
summary: "List Google Drive profile authentication status.",
|
|
7659
|
+
inputSchema: profilesStatusSchema,
|
|
7660
|
+
execute: (_ctx, input) => ({ profiles: listProfileStatuses(input.profile) })
|
|
7661
|
+
},
|
|
7625
7662
|
"files.list": {
|
|
7626
7663
|
summary: "List Google Drive files.",
|
|
7627
7664
|
inputSchema: listFilesSchema,
|
package/bin/mcp.js
CHANGED
|
@@ -11988,6 +11988,35 @@ function listProfiles2() {
|
|
|
11988
11988
|
}
|
|
11989
11989
|
return Array.from(profiles).sort((a, b) => a.localeCompare(b));
|
|
11990
11990
|
}
|
|
11991
|
+
function listProfileStatuses(profile) {
|
|
11992
|
+
const profiles = profile ? [profile] : listProfiles2();
|
|
11993
|
+
const uniqueProfiles = profiles.length ? profiles : ["default"];
|
|
11994
|
+
const now = Date.now();
|
|
11995
|
+
return uniqueProfiles.map((name) => {
|
|
11996
|
+
const tokens = loadTokens2(name);
|
|
11997
|
+
const credentials = loadCredentials2(name);
|
|
11998
|
+
const hasAccessToken = Boolean(tokens?.accessToken || process.env.GOOGLE_ACCESS_TOKEN);
|
|
11999
|
+
const hasRefreshToken = Boolean(tokens?.refreshToken);
|
|
12000
|
+
const hasOAuthCredentials = Boolean(credentials.clientId && credentials.clientSecret);
|
|
12001
|
+
const expiresAt = tokens?.expiresAt ?? null;
|
|
12002
|
+
const expired = Boolean(expiresAt && now >= expiresAt - REFRESH_BUFFER_MS2);
|
|
12003
|
+
const authenticated = Boolean(process.env.GOOGLE_ACCESS_TOKEN || hasRefreshToken || hasAccessToken && !expired);
|
|
12004
|
+
const configured = authenticated || hasOAuthCredentials;
|
|
12005
|
+
const authRequired = !authenticated || expired && !hasRefreshToken;
|
|
12006
|
+
return {
|
|
12007
|
+
profile: name,
|
|
12008
|
+
configured,
|
|
12009
|
+
authenticated,
|
|
12010
|
+
expired,
|
|
12011
|
+
expiresAt,
|
|
12012
|
+
hasAccessToken,
|
|
12013
|
+
hasRefreshToken,
|
|
12014
|
+
hasOAuthCredentials,
|
|
12015
|
+
authRequired,
|
|
12016
|
+
message: authRequired ? `Google Drive profile "${name}" needs authentication. Run: connectors auth googledrive` : expired ? `Google Drive profile "${name}" access token is expired but can refresh.` : `Google Drive profile "${name}" is authenticated.`
|
|
12017
|
+
};
|
|
12018
|
+
});
|
|
12019
|
+
}
|
|
11991
12020
|
function loadCredentials2(profile) {
|
|
11992
12021
|
const envClientId = process.env.GOOGLE_CLIENT_ID;
|
|
11993
12022
|
const envClientSecret = process.env.GOOGLE_CLIENT_SECRET;
|
|
@@ -12060,7 +12089,7 @@ function extractGoogleError(body) {
|
|
|
12060
12089
|
return body;
|
|
12061
12090
|
}
|
|
12062
12091
|
}
|
|
12063
|
-
var DRIVE_API_BASE = "https://www.googleapis.com/drive/v3", TOKEN_URL2 = "https://oauth2.googleapis.com/token", REFRESH_BUFFER_MS2, DEFAULT_FILE_FIELDS, DEFAULT_EXPORT_FORMATS, EXPORT_EXTENSIONS, listFilesSchema, listDrivesSchema, fileIdSchema, downloadSchema, googleDriveConnector;
|
|
12092
|
+
var DRIVE_API_BASE = "https://www.googleapis.com/drive/v3", TOKEN_URL2 = "https://oauth2.googleapis.com/token", REFRESH_BUFFER_MS2, DEFAULT_FILE_FIELDS, DEFAULT_EXPORT_FORMATS, EXPORT_EXTENSIONS, listFilesSchema, listDrivesSchema, fileIdSchema, downloadSchema, profilesStatusSchema, googleDriveConnector;
|
|
12064
12093
|
var init_googledrive = __esm(() => {
|
|
12065
12094
|
init_zod();
|
|
12066
12095
|
init_connector();
|
|
@@ -12125,6 +12154,9 @@ var init_googledrive = __esm(() => {
|
|
|
12125
12154
|
}).optional(),
|
|
12126
12155
|
exportMimeType: exports_external.string().optional()
|
|
12127
12156
|
});
|
|
12157
|
+
profilesStatusSchema = exports_external.object({
|
|
12158
|
+
profile: exports_external.string().optional()
|
|
12159
|
+
});
|
|
12128
12160
|
googleDriveConnector = defineConnector({
|
|
12129
12161
|
meta: {
|
|
12130
12162
|
name: "googledrive",
|
|
@@ -12147,6 +12179,11 @@ var init_googledrive = __esm(() => {
|
|
|
12147
12179
|
summary: "List configured Google Drive profiles.",
|
|
12148
12180
|
execute: () => ({ profiles: listProfiles2() })
|
|
12149
12181
|
},
|
|
12182
|
+
"profiles.status": {
|
|
12183
|
+
summary: "List Google Drive profile authentication status.",
|
|
12184
|
+
inputSchema: profilesStatusSchema,
|
|
12185
|
+
execute: (_ctx, input) => ({ profiles: listProfileStatuses(input.profile) })
|
|
12186
|
+
},
|
|
12150
12187
|
"files.list": {
|
|
12151
12188
|
summary: "List Google Drive files.",
|
|
12152
12189
|
inputSchema: listFilesSchema,
|
|
@@ -12203,7 +12240,7 @@ var package_default;
|
|
|
12203
12240
|
var init_package = __esm(() => {
|
|
12204
12241
|
package_default = {
|
|
12205
12242
|
name: "@hasna/connectors",
|
|
12206
|
-
version: "1.3.
|
|
12243
|
+
version: "1.3.28",
|
|
12207
12244
|
description: "Open source connector library - Install API connectors with a single command",
|
|
12208
12245
|
type: "module",
|
|
12209
12246
|
bin: {
|
package/bin/serve.js
CHANGED
|
@@ -15691,6 +15691,9 @@ var downloadSchema = exports_external2.object({
|
|
|
15691
15691
|
}).optional(),
|
|
15692
15692
|
exportMimeType: exports_external2.string().optional()
|
|
15693
15693
|
});
|
|
15694
|
+
var profilesStatusSchema = exports_external2.object({
|
|
15695
|
+
profile: exports_external2.string().optional()
|
|
15696
|
+
});
|
|
15694
15697
|
var googleDriveConnector = defineConnector({
|
|
15695
15698
|
meta: {
|
|
15696
15699
|
name: "googledrive",
|
|
@@ -15713,6 +15716,11 @@ var googleDriveConnector = defineConnector({
|
|
|
15713
15716
|
summary: "List configured Google Drive profiles.",
|
|
15714
15717
|
execute: () => ({ profiles: listProfiles2() })
|
|
15715
15718
|
},
|
|
15719
|
+
"profiles.status": {
|
|
15720
|
+
summary: "List Google Drive profile authentication status.",
|
|
15721
|
+
inputSchema: profilesStatusSchema,
|
|
15722
|
+
execute: (_ctx, input) => ({ profiles: listProfileStatuses(input.profile) })
|
|
15723
|
+
},
|
|
15716
15724
|
"files.list": {
|
|
15717
15725
|
summary: "List Google Drive files.",
|
|
15718
15726
|
inputSchema: listFilesSchema,
|
|
@@ -15841,6 +15849,35 @@ function listProfiles2() {
|
|
|
15841
15849
|
}
|
|
15842
15850
|
return Array.from(profiles).sort((a, b) => a.localeCompare(b));
|
|
15843
15851
|
}
|
|
15852
|
+
function listProfileStatuses(profile) {
|
|
15853
|
+
const profiles = profile ? [profile] : listProfiles2();
|
|
15854
|
+
const uniqueProfiles = profiles.length ? profiles : ["default"];
|
|
15855
|
+
const now3 = Date.now();
|
|
15856
|
+
return uniqueProfiles.map((name) => {
|
|
15857
|
+
const tokens = loadTokens2(name);
|
|
15858
|
+
const credentials = loadCredentials2(name);
|
|
15859
|
+
const hasAccessToken = Boolean(tokens?.accessToken || process.env.GOOGLE_ACCESS_TOKEN);
|
|
15860
|
+
const hasRefreshToken = Boolean(tokens?.refreshToken);
|
|
15861
|
+
const hasOAuthCredentials = Boolean(credentials.clientId && credentials.clientSecret);
|
|
15862
|
+
const expiresAt = tokens?.expiresAt ?? null;
|
|
15863
|
+
const expired = Boolean(expiresAt && now3 >= expiresAt - REFRESH_BUFFER_MS2);
|
|
15864
|
+
const authenticated = Boolean(process.env.GOOGLE_ACCESS_TOKEN || hasRefreshToken || hasAccessToken && !expired);
|
|
15865
|
+
const configured = authenticated || hasOAuthCredentials;
|
|
15866
|
+
const authRequired = !authenticated || expired && !hasRefreshToken;
|
|
15867
|
+
return {
|
|
15868
|
+
profile: name,
|
|
15869
|
+
configured,
|
|
15870
|
+
authenticated,
|
|
15871
|
+
expired,
|
|
15872
|
+
expiresAt,
|
|
15873
|
+
hasAccessToken,
|
|
15874
|
+
hasRefreshToken,
|
|
15875
|
+
hasOAuthCredentials,
|
|
15876
|
+
authRequired,
|
|
15877
|
+
message: authRequired ? `Google Drive profile "${name}" needs authentication. Run: connectors auth googledrive` : expired ? `Google Drive profile "${name}" access token is expired but can refresh.` : `Google Drive profile "${name}" is authenticated.`
|
|
15878
|
+
};
|
|
15879
|
+
});
|
|
15880
|
+
}
|
|
15844
15881
|
function loadCredentials2(profile) {
|
|
15845
15882
|
const envClientId = process.env.GOOGLE_CLIENT_ID;
|
|
15846
15883
|
const envClientSecret = process.env.GOOGLE_CLIENT_SECRET;
|
|
@@ -15916,7 +15953,7 @@ function extractGoogleError(body) {
|
|
|
15916
15953
|
// package.json
|
|
15917
15954
|
var package_default = {
|
|
15918
15955
|
name: "@hasna/connectors",
|
|
15919
|
-
version: "1.3.
|
|
15956
|
+
version: "1.3.28",
|
|
15920
15957
|
description: "Open source connector library - Install API connectors with a single command",
|
|
15921
15958
|
type: "module",
|
|
15922
15959
|
bin: {
|
package/dist/index.js
CHANGED
|
@@ -5465,6 +5465,9 @@ var downloadSchema = exports_external.object({
|
|
|
5465
5465
|
}).optional(),
|
|
5466
5466
|
exportMimeType: exports_external.string().optional()
|
|
5467
5467
|
});
|
|
5468
|
+
var profilesStatusSchema = exports_external.object({
|
|
5469
|
+
profile: exports_external.string().optional()
|
|
5470
|
+
});
|
|
5468
5471
|
var googleDriveConnector = defineConnector({
|
|
5469
5472
|
meta: {
|
|
5470
5473
|
name: "googledrive",
|
|
@@ -5487,6 +5490,11 @@ var googleDriveConnector = defineConnector({
|
|
|
5487
5490
|
summary: "List configured Google Drive profiles.",
|
|
5488
5491
|
execute: () => ({ profiles: listProfiles2() })
|
|
5489
5492
|
},
|
|
5493
|
+
"profiles.status": {
|
|
5494
|
+
summary: "List Google Drive profile authentication status.",
|
|
5495
|
+
inputSchema: profilesStatusSchema,
|
|
5496
|
+
execute: (_ctx, input) => ({ profiles: listProfileStatuses(input.profile) })
|
|
5497
|
+
},
|
|
5490
5498
|
"files.list": {
|
|
5491
5499
|
summary: "List Google Drive files.",
|
|
5492
5500
|
inputSchema: listFilesSchema,
|
|
@@ -5615,6 +5623,35 @@ function listProfiles2() {
|
|
|
5615
5623
|
}
|
|
5616
5624
|
return Array.from(profiles).sort((a, b) => a.localeCompare(b));
|
|
5617
5625
|
}
|
|
5626
|
+
function listProfileStatuses(profile) {
|
|
5627
|
+
const profiles = profile ? [profile] : listProfiles2();
|
|
5628
|
+
const uniqueProfiles = profiles.length ? profiles : ["default"];
|
|
5629
|
+
const now = Date.now();
|
|
5630
|
+
return uniqueProfiles.map((name) => {
|
|
5631
|
+
const tokens = loadTokens2(name);
|
|
5632
|
+
const credentials = loadCredentials2(name);
|
|
5633
|
+
const hasAccessToken = Boolean(tokens?.accessToken || process.env.GOOGLE_ACCESS_TOKEN);
|
|
5634
|
+
const hasRefreshToken = Boolean(tokens?.refreshToken);
|
|
5635
|
+
const hasOAuthCredentials = Boolean(credentials.clientId && credentials.clientSecret);
|
|
5636
|
+
const expiresAt = tokens?.expiresAt ?? null;
|
|
5637
|
+
const expired = Boolean(expiresAt && now >= expiresAt - REFRESH_BUFFER_MS2);
|
|
5638
|
+
const authenticated = Boolean(process.env.GOOGLE_ACCESS_TOKEN || hasRefreshToken || hasAccessToken && !expired);
|
|
5639
|
+
const configured = authenticated || hasOAuthCredentials;
|
|
5640
|
+
const authRequired = !authenticated || expired && !hasRefreshToken;
|
|
5641
|
+
return {
|
|
5642
|
+
profile: name,
|
|
5643
|
+
configured,
|
|
5644
|
+
authenticated,
|
|
5645
|
+
expired,
|
|
5646
|
+
expiresAt,
|
|
5647
|
+
hasAccessToken,
|
|
5648
|
+
hasRefreshToken,
|
|
5649
|
+
hasOAuthCredentials,
|
|
5650
|
+
authRequired,
|
|
5651
|
+
message: authRequired ? `Google Drive profile "${name}" needs authentication. Run: connectors auth googledrive` : expired ? `Google Drive profile "${name}" access token is expired but can refresh.` : `Google Drive profile "${name}" is authenticated.`
|
|
5652
|
+
};
|
|
5653
|
+
});
|
|
5654
|
+
}
|
|
5618
5655
|
function loadCredentials2(profile) {
|
|
5619
5656
|
const envClientId = process.env.GOOGLE_CLIENT_ID;
|
|
5620
5657
|
const envClientSecret = process.env.GOOGLE_CLIENT_SECRET;
|
|
@@ -5690,7 +5727,7 @@ function extractGoogleError(body) {
|
|
|
5690
5727
|
// package.json
|
|
5691
5728
|
var package_default = {
|
|
5692
5729
|
name: "@hasna/connectors",
|
|
5693
|
-
version: "1.3.
|
|
5730
|
+
version: "1.3.28",
|
|
5694
5731
|
description: "Open source connector library - Install API connectors with a single command",
|
|
5695
5732
|
type: "module",
|
|
5696
5733
|
bin: {
|