@langchain/google-gauth 0.2.12 → 0.2.14
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/auth.cjs +10 -18
- package/dist/auth.d.ts +2 -3
- package/dist/auth.js +11 -19
- package/package.json +7 -7
package/dist/auth.cjs
CHANGED
|
@@ -56,8 +56,9 @@ class NodeSseJsonStream extends NodeAbstractStream {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
exports.NodeSseJsonStream = NodeSseJsonStream;
|
|
59
|
-
class GAuthClient {
|
|
59
|
+
class GAuthClient extends google_common_1.GoogleAbstractedFetchClient {
|
|
60
60
|
constructor(fields) {
|
|
61
|
+
super();
|
|
61
62
|
Object.defineProperty(this, "gauth", {
|
|
62
63
|
enumerable: true,
|
|
63
64
|
configurable: true,
|
|
@@ -66,6 +67,13 @@ class GAuthClient {
|
|
|
66
67
|
});
|
|
67
68
|
const options = (0, google_common_1.ensureAuthOptionScopes)(fields?.authOptions, "scopes", fields?.platformType);
|
|
68
69
|
this.gauth = new google_auth_library_1.GoogleAuth(options);
|
|
70
|
+
this._fetch = async (...args) => {
|
|
71
|
+
const url = args[0];
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
73
|
+
const opts = args[1] ?? {};
|
|
74
|
+
opts.responseType = "stream";
|
|
75
|
+
return await this.gauth.fetch(url, opts);
|
|
76
|
+
};
|
|
69
77
|
}
|
|
70
78
|
get clientType() {
|
|
71
79
|
return "gauth";
|
|
@@ -74,23 +82,7 @@ class GAuthClient {
|
|
|
74
82
|
return this.gauth.getProjectId();
|
|
75
83
|
}
|
|
76
84
|
async request(opts) {
|
|
77
|
-
|
|
78
|
-
const [contentType] = ret?.headers?.["content-type"]?.split(/;/) ?? [""];
|
|
79
|
-
if (opts.responseType !== "stream") {
|
|
80
|
-
return ret;
|
|
81
|
-
}
|
|
82
|
-
else if (contentType === "text/event-stream") {
|
|
83
|
-
return {
|
|
84
|
-
...ret,
|
|
85
|
-
data: new NodeSseJsonStream(ret.data),
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
return {
|
|
90
|
-
...ret,
|
|
91
|
-
data: new NodeJsonStream(ret.data),
|
|
92
|
-
};
|
|
93
|
-
}
|
|
85
|
+
return this._request(opts?.url, opts, {});
|
|
94
86
|
}
|
|
95
87
|
}
|
|
96
88
|
exports.GAuthClient = GAuthClient;
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
1
|
import { Readable } from "stream";
|
|
3
|
-
import { AbstractStream,
|
|
2
|
+
import { AbstractStream, GoogleAbstractedClientOps, GoogleAbstractedFetchClient, GoogleConnectionParams } from "@langchain/google-common";
|
|
4
3
|
import { GoogleAuth, GoogleAuthOptions } from "google-auth-library";
|
|
5
4
|
export declare class NodeAbstractStream implements AbstractStream {
|
|
6
5
|
private baseStream;
|
|
@@ -19,7 +18,7 @@ export declare class NodeSseStream extends NodeAbstractStream {
|
|
|
19
18
|
export declare class NodeSseJsonStream extends NodeAbstractStream {
|
|
20
19
|
constructor(data: Readable);
|
|
21
20
|
}
|
|
22
|
-
export declare class GAuthClient
|
|
21
|
+
export declare class GAuthClient extends GoogleAbstractedFetchClient {
|
|
23
22
|
gauth: GoogleAuth;
|
|
24
23
|
constructor(fields?: GoogleConnectionParams<GoogleAuthOptions>);
|
|
25
24
|
get clientType(): string;
|
package/dist/auth.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ensureAuthOptionScopes, JsonStream, SseJsonStream, SseStream, } from "@langchain/google-common";
|
|
1
|
+
import { ensureAuthOptionScopes, GoogleAbstractedFetchClient, JsonStream, SseJsonStream, SseStream, } from "@langchain/google-common";
|
|
2
2
|
import { GoogleAuth } from "google-auth-library";
|
|
3
3
|
export class NodeAbstractStream {
|
|
4
4
|
constructor(baseStream, data) {
|
|
@@ -49,8 +49,9 @@ export class NodeSseJsonStream extends NodeAbstractStream {
|
|
|
49
49
|
super(new SseJsonStream(), data);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
export class GAuthClient {
|
|
52
|
+
export class GAuthClient extends GoogleAbstractedFetchClient {
|
|
53
53
|
constructor(fields) {
|
|
54
|
+
super();
|
|
54
55
|
Object.defineProperty(this, "gauth", {
|
|
55
56
|
enumerable: true,
|
|
56
57
|
configurable: true,
|
|
@@ -59,6 +60,13 @@ export class GAuthClient {
|
|
|
59
60
|
});
|
|
60
61
|
const options = ensureAuthOptionScopes(fields?.authOptions, "scopes", fields?.platformType);
|
|
61
62
|
this.gauth = new GoogleAuth(options);
|
|
63
|
+
this._fetch = async (...args) => {
|
|
64
|
+
const url = args[0];
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
66
|
+
const opts = args[1] ?? {};
|
|
67
|
+
opts.responseType = "stream";
|
|
68
|
+
return await this.gauth.fetch(url, opts);
|
|
69
|
+
};
|
|
62
70
|
}
|
|
63
71
|
get clientType() {
|
|
64
72
|
return "gauth";
|
|
@@ -67,22 +75,6 @@ export class GAuthClient {
|
|
|
67
75
|
return this.gauth.getProjectId();
|
|
68
76
|
}
|
|
69
77
|
async request(opts) {
|
|
70
|
-
|
|
71
|
-
const [contentType] = ret?.headers?.["content-type"]?.split(/;/) ?? [""];
|
|
72
|
-
if (opts.responseType !== "stream") {
|
|
73
|
-
return ret;
|
|
74
|
-
}
|
|
75
|
-
else if (contentType === "text/event-stream") {
|
|
76
|
-
return {
|
|
77
|
-
...ret,
|
|
78
|
-
data: new NodeSseJsonStream(ret.data),
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
return {
|
|
83
|
-
...ret,
|
|
84
|
-
data: new NodeJsonStream(ret.data),
|
|
85
|
-
};
|
|
86
|
-
}
|
|
78
|
+
return this._request(opts?.url, opts, {});
|
|
87
79
|
}
|
|
88
80
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/google-gauth",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"description": "Google auth based authentication support for Google services",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"build": "yarn turbo:command build:internal --filter=@langchain/google-gauth",
|
|
18
18
|
"build:internal": "yarn lc_build --create-entrypoints --pre --tree-shaking",
|
|
19
19
|
"lint:eslint": "NODE_OPTIONS=--max-old-space-size=4096 eslint --cache --ext .ts,.js src/",
|
|
20
|
-
"lint:dpdm": "dpdm --exit-code circular:1 --no-warning --no-tree src/*.ts src/**/*.ts",
|
|
20
|
+
"lint:dpdm": "dpdm --skip-dynamic-imports circular --exit-code circular:1 --no-warning --no-tree src/*.ts src/**/*.ts",
|
|
21
21
|
"lint": "yarn lint:eslint && yarn lint:dpdm",
|
|
22
22
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:dpdm",
|
|
23
23
|
"clean": "rm -rf .turbo dist/",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"author": "LangChain",
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@langchain/google-common": "^0.2.
|
|
39
|
-
"google-auth-library": "^
|
|
38
|
+
"@langchain/google-common": "^0.2.14",
|
|
39
|
+
"google-auth-library": "^10.1.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@langchain/core": ">=0.3.
|
|
42
|
+
"@langchain/core": ">=0.3.58 <0.4.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@jest/globals": "^29.5.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
|
52
52
|
"@typescript-eslint/parser": "^6.12.0",
|
|
53
53
|
"dotenv": "^16.3.1",
|
|
54
|
-
"dpdm": "^3.
|
|
54
|
+
"dpdm": "^3.14.0",
|
|
55
55
|
"eslint": "^8.33.0",
|
|
56
56
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
57
57
|
"eslint-config-prettier": "^8.6.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"release-it": "^18.1.2",
|
|
65
65
|
"rollup": "^4.5.2",
|
|
66
66
|
"ts-jest": "^29.1.0",
|
|
67
|
-
"typescript": "
|
|
67
|
+
"typescript": "~5.8.3",
|
|
68
68
|
"zod": "^3.22.4"
|
|
69
69
|
},
|
|
70
70
|
"publishConfig": {
|