@gleanwork/api-client 0.14.4 → 0.14.6
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 +17 -7
- package/dist/commonjs/__tests__/authentication.test.d.ts +2 -0
- package/dist/commonjs/__tests__/authentication.test.d.ts.map +1 -0
- package/dist/commonjs/__tests__/authentication.test.js +19 -0
- package/dist/commonjs/__tests__/authentication.test.js.map +1 -0
- package/dist/commonjs/__tests__/summarize.test.js +2 -2
- package/dist/commonjs/__tests__/summarize.test.js.map +1 -1
- package/dist/commonjs/funcs/authenticationCheckdatasourceauth.d.ts +23 -0
- package/dist/commonjs/funcs/authenticationCheckdatasourceauth.d.ts.map +1 -0
- package/dist/commonjs/funcs/authenticationCheckdatasourceauth.js +110 -0
- package/dist/commonjs/funcs/authenticationCheckdatasourceauth.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/models/components/authstatus.d.ts +19 -0
- package/dist/commonjs/models/components/authstatus.d.ts.map +1 -0
- package/dist/commonjs/models/components/authstatus.js +54 -0
- package/dist/commonjs/models/components/authstatus.js.map +1 -0
- package/dist/commonjs/models/components/chatmessage.d.ts +24 -0
- package/dist/commonjs/models/components/chatmessage.d.ts.map +1 -1
- package/dist/commonjs/models/components/chatmessage.js +24 -0
- package/dist/commonjs/models/components/chatmessage.js.map +1 -1
- package/dist/commonjs/models/components/chatresponse.d.ts +7 -0
- package/dist/commonjs/models/components/chatresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/chatresponse.js +2 -0
- package/dist/commonjs/models/components/chatresponse.js.map +1 -1
- package/dist/commonjs/models/components/checkdatasourceauthresponse.d.ts +16 -0
- package/dist/commonjs/models/components/checkdatasourceauthresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/checkdatasourceauthresponse.js +51 -0
- package/dist/commonjs/models/components/checkdatasourceauthresponse.js.map +1 -0
- package/dist/commonjs/models/components/gleandataerror.d.ts +7 -0
- package/dist/commonjs/models/components/gleandataerror.d.ts.map +1 -1
- package/dist/commonjs/models/components/gleandataerror.js +2 -0
- package/dist/commonjs/models/components/gleandataerror.js.map +1 -1
- package/dist/commonjs/models/components/index.d.ts +3 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +3 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/unauthorizeddatasourceinstance.d.ts +35 -0
- package/dist/commonjs/models/components/unauthorizeddatasourceinstance.d.ts.map +1 -0
- package/dist/commonjs/models/components/unauthorizeddatasourceinstance.js +54 -0
- package/dist/commonjs/models/components/unauthorizeddatasourceinstance.js.map +1 -0
- package/dist/commonjs/models/errors/gleandataerror.d.ts +12 -0
- package/dist/commonjs/models/errors/gleandataerror.d.ts.map +1 -1
- package/dist/commonjs/models/errors/gleandataerror.js +5 -0
- package/dist/commonjs/models/errors/gleandataerror.js.map +1 -1
- package/dist/commonjs/react-query/authenticationCheckdatasourceauth.d.ts +33 -0
- package/dist/commonjs/react-query/authenticationCheckdatasourceauth.d.ts.map +1 -0
- package/dist/commonjs/react-query/authenticationCheckdatasourceauth.js +53 -0
- package/dist/commonjs/react-query/authenticationCheckdatasourceauth.js.map +1 -0
- package/dist/commonjs/react-query/index.d.ts +1 -0
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +1 -0
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/sdk/authentication.d.ts +18 -0
- package/dist/commonjs/sdk/authentication.d.ts.map +1 -0
- package/dist/commonjs/sdk/authentication.js +28 -0
- package/dist/commonjs/sdk/authentication.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +3 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +4 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/esm/__tests__/authentication.test.d.ts +2 -0
- package/dist/esm/__tests__/authentication.test.d.ts.map +1 -0
- package/dist/esm/__tests__/authentication.test.js +17 -0
- package/dist/esm/__tests__/authentication.test.js.map +1 -0
- package/dist/esm/__tests__/summarize.test.js +2 -2
- package/dist/esm/__tests__/summarize.test.js.map +1 -1
- package/dist/esm/funcs/authenticationCheckdatasourceauth.d.ts +23 -0
- package/dist/esm/funcs/authenticationCheckdatasourceauth.d.ts.map +1 -0
- package/dist/esm/funcs/authenticationCheckdatasourceauth.js +74 -0
- package/dist/esm/funcs/authenticationCheckdatasourceauth.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/models/components/authstatus.d.ts +19 -0
- package/dist/esm/models/components/authstatus.d.ts.map +1 -0
- package/dist/esm/models/components/authstatus.js +18 -0
- package/dist/esm/models/components/authstatus.js.map +1 -0
- package/dist/esm/models/components/chatmessage.d.ts +24 -0
- package/dist/esm/models/components/chatmessage.d.ts.map +1 -1
- package/dist/esm/models/components/chatmessage.js +24 -0
- package/dist/esm/models/components/chatmessage.js.map +1 -1
- package/dist/esm/models/components/chatresponse.d.ts +7 -0
- package/dist/esm/models/components/chatresponse.d.ts.map +1 -1
- package/dist/esm/models/components/chatresponse.js +2 -0
- package/dist/esm/models/components/chatresponse.js.map +1 -1
- package/dist/esm/models/components/checkdatasourceauthresponse.d.ts +16 -0
- package/dist/esm/models/components/checkdatasourceauthresponse.d.ts.map +1 -0
- package/dist/esm/models/components/checkdatasourceauthresponse.js +14 -0
- package/dist/esm/models/components/checkdatasourceauthresponse.js.map +1 -0
- package/dist/esm/models/components/gleandataerror.d.ts +7 -0
- package/dist/esm/models/components/gleandataerror.d.ts.map +1 -1
- package/dist/esm/models/components/gleandataerror.js +2 -0
- package/dist/esm/models/components/gleandataerror.js.map +1 -1
- package/dist/esm/models/components/index.d.ts +3 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +3 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/unauthorizeddatasourceinstance.d.ts +35 -0
- package/dist/esm/models/components/unauthorizeddatasourceinstance.d.ts.map +1 -0
- package/dist/esm/models/components/unauthorizeddatasourceinstance.js +17 -0
- package/dist/esm/models/components/unauthorizeddatasourceinstance.js.map +1 -0
- package/dist/esm/models/errors/gleandataerror.d.ts +12 -0
- package/dist/esm/models/errors/gleandataerror.d.ts.map +1 -1
- package/dist/esm/models/errors/gleandataerror.js +5 -0
- package/dist/esm/models/errors/gleandataerror.js.map +1 -1
- package/dist/esm/react-query/authenticationCheckdatasourceauth.d.ts +33 -0
- package/dist/esm/react-query/authenticationCheckdatasourceauth.d.ts.map +1 -0
- package/dist/esm/react-query/authenticationCheckdatasourceauth.js +48 -0
- package/dist/esm/react-query/authenticationCheckdatasourceauth.js.map +1 -0
- package/dist/esm/react-query/index.d.ts +1 -0
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +1 -0
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/sdk/authentication.d.ts +18 -0
- package/dist/esm/sdk/authentication.d.ts.map +1 -0
- package/dist/esm/sdk/authentication.js +24 -0
- package/dist/esm/sdk/authentication.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +3 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +4 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/authentication.test.ts +20 -0
- package/src/__tests__/summarize.test.ts +2 -2
- package/src/funcs/authenticationCheckdatasourceauth.ts +148 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/authstatus.ts +25 -0
- package/src/models/components/chatmessage.ts +24 -0
- package/src/models/components/chatresponse.ts +15 -0
- package/src/models/components/checkdatasourceauthresponse.ts +44 -0
- package/src/models/components/gleandataerror.ts +15 -0
- package/src/models/components/index.ts +3 -0
- package/src/models/components/unauthorizeddatasourceinstance.ts +59 -0
- package/src/models/errors/gleandataerror.ts +23 -0
- package/src/react-query/authenticationCheckdatasourceauth.ts +112 -0
- package/src/react-query/index.ts +1 -0
- package/src/sdk/authentication.ts +31 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -48,6 +48,30 @@ export const MessageType = {
|
|
|
48
48
|
* A message providing context in addition to the user query.
|
|
49
49
|
*/
|
|
50
50
|
Context: "CONTEXT",
|
|
51
|
+
/**
|
|
52
|
+
* Control signal for message streaming.
|
|
53
|
+
*/
|
|
54
|
+
Control: "CONTROL",
|
|
55
|
+
/**
|
|
56
|
+
* Control signal indicating the start of a message stream.
|
|
57
|
+
*/
|
|
58
|
+
ControlStart: "CONTROL_START",
|
|
59
|
+
/**
|
|
60
|
+
* Control signal indicating the end of a message stream.
|
|
61
|
+
*/
|
|
62
|
+
ControlFinish: "CONTROL_FINISH",
|
|
63
|
+
/**
|
|
64
|
+
* Control signal indicating the message stream was cancelled.
|
|
65
|
+
*/
|
|
66
|
+
ControlCancel: "CONTROL_CANCEL",
|
|
67
|
+
/**
|
|
68
|
+
* Indicates the message streaming needed to be retried.
|
|
69
|
+
*/
|
|
70
|
+
ControlRetry: "CONTROL_RETRY",
|
|
71
|
+
/**
|
|
72
|
+
* Fallback control signal for unrecognized control types.
|
|
73
|
+
*/
|
|
74
|
+
ControlUnknown: "CONTROL_UNKNOWN",
|
|
51
75
|
/**
|
|
52
76
|
* A debug message. Strictly used internally.
|
|
53
77
|
*/
|
|
@@ -7,6 +7,10 @@ import { safeParse } from "../../lib/schemas.js";
|
|
|
7
7
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
8
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
9
|
import { ChatMessage, ChatMessage$inboundSchema } from "./chatmessage.js";
|
|
10
|
+
import {
|
|
11
|
+
UnauthorizedDatasourceInstance,
|
|
12
|
+
UnauthorizedDatasourceInstance$inboundSchema,
|
|
13
|
+
} from "./unauthorizeddatasourceinstance.js";
|
|
10
14
|
|
|
11
15
|
/**
|
|
12
16
|
* A single response from the /chat backend.
|
|
@@ -29,6 +33,14 @@ export type ChatResponse = {
|
|
|
29
33
|
* A token that is used to track the session.
|
|
30
34
|
*/
|
|
31
35
|
chatSessionTrackingToken?: string | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Datasource instances that could not be queried because the user has not completed or has expired per-user OAuth, aggregated across all tools invoked in this turn.
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
*/
|
|
41
|
+
unauthorizedDatasourceInstances?:
|
|
42
|
+
| Array<UnauthorizedDatasourceInstance>
|
|
43
|
+
| undefined;
|
|
32
44
|
};
|
|
33
45
|
|
|
34
46
|
/** @internal */
|
|
@@ -42,6 +54,9 @@ export const ChatResponse$inboundSchema: z.ZodType<
|
|
|
42
54
|
followUpPrompts: z.array(z.string()).optional(),
|
|
43
55
|
backendTimeMillis: z.number().int().optional(),
|
|
44
56
|
chatSessionTrackingToken: z.string().optional(),
|
|
57
|
+
unauthorizedDatasourceInstances: z.array(
|
|
58
|
+
UnauthorizedDatasourceInstance$inboundSchema,
|
|
59
|
+
).optional(),
|
|
45
60
|
});
|
|
46
61
|
|
|
47
62
|
export function chatResponseFromJSON(
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
UnauthorizedDatasourceInstance,
|
|
11
|
+
UnauthorizedDatasourceInstance$inboundSchema,
|
|
12
|
+
} from "./unauthorizeddatasourceinstance.js";
|
|
13
|
+
|
|
14
|
+
export type CheckDatasourceAuthResponse = {
|
|
15
|
+
/**
|
|
16
|
+
* Datasource instances that require per-user OAuth authorization. Empty or absent when all datasources are authorized.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
*/
|
|
20
|
+
unauthorizedDatasourceInstances?:
|
|
21
|
+
| Array<UnauthorizedDatasourceInstance>
|
|
22
|
+
| undefined;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const CheckDatasourceAuthResponse$inboundSchema: z.ZodType<
|
|
27
|
+
CheckDatasourceAuthResponse,
|
|
28
|
+
z.ZodTypeDef,
|
|
29
|
+
unknown
|
|
30
|
+
> = z.object({
|
|
31
|
+
unauthorizedDatasourceInstances: z.array(
|
|
32
|
+
UnauthorizedDatasourceInstance$inboundSchema,
|
|
33
|
+
).optional(),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export function checkDatasourceAuthResponseFromJSON(
|
|
37
|
+
jsonString: string,
|
|
38
|
+
): SafeParseResult<CheckDatasourceAuthResponse, SDKValidationError> {
|
|
39
|
+
return safeParse(
|
|
40
|
+
jsonString,
|
|
41
|
+
(x) => CheckDatasourceAuthResponse$inboundSchema.parse(JSON.parse(x)),
|
|
42
|
+
`Failed to parse 'CheckDatasourceAuthResponse' from JSON`,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -11,6 +11,10 @@ import {
|
|
|
11
11
|
InvalidOperatorValueError,
|
|
12
12
|
InvalidOperatorValueError$inboundSchema,
|
|
13
13
|
} from "./invalidoperatorvalueerror.js";
|
|
14
|
+
import {
|
|
15
|
+
UnauthorizedDatasourceInstance,
|
|
16
|
+
UnauthorizedDatasourceInstance$inboundSchema,
|
|
17
|
+
} from "./unauthorizeddatasourceinstance.js";
|
|
14
18
|
|
|
15
19
|
export type GleanDataError = {
|
|
16
20
|
/**
|
|
@@ -30,6 +34,14 @@ export type GleanDataError = {
|
|
|
30
34
|
* Indicates the federated search results could not be fetched due to rate limiting.
|
|
31
35
|
*/
|
|
32
36
|
federatedSearchRateLimitError?: boolean | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Datasource instances that could not be queried because the user has not completed or has expired per-user OAuth.
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
*/
|
|
42
|
+
unauthorizedDatasourceInstances?:
|
|
43
|
+
| Array<UnauthorizedDatasourceInstance>
|
|
44
|
+
| undefined;
|
|
33
45
|
};
|
|
34
46
|
|
|
35
47
|
/** @internal */
|
|
@@ -43,6 +55,9 @@ export const GleanDataError$inboundSchema: z.ZodType<
|
|
|
43
55
|
invalidOperators: z.array(InvalidOperatorValueError$inboundSchema).optional(),
|
|
44
56
|
errorMessages: z.array(ErrorMessage$inboundSchema).optional(),
|
|
45
57
|
federatedSearchRateLimitError: z.boolean().optional(),
|
|
58
|
+
unauthorizedDatasourceInstances: z.array(
|
|
59
|
+
UnauthorizedDatasourceInstance$inboundSchema,
|
|
60
|
+
).optional(),
|
|
46
61
|
});
|
|
47
62
|
|
|
48
63
|
export function gleanDataErrorFromJSON(
|
|
@@ -32,6 +32,7 @@ export * from "./answerresult.js";
|
|
|
32
32
|
export * from "./appresult.js";
|
|
33
33
|
export * from "./assistantinsightsresponse.js";
|
|
34
34
|
export * from "./authconfig.js";
|
|
35
|
+
export * from "./authstatus.js";
|
|
35
36
|
export * from "./authtoken.js";
|
|
36
37
|
export * from "./autocompleterequest.js";
|
|
37
38
|
export * from "./autocompleteresponse.js";
|
|
@@ -67,6 +68,7 @@ export * from "./chatrestrictionfilters.js";
|
|
|
67
68
|
export * from "./chatresult.js";
|
|
68
69
|
export * from "./chatsuggestion.js";
|
|
69
70
|
export * from "./chatzerostatesuggestionoptions.js";
|
|
71
|
+
export * from "./checkdatasourceauthresponse.js";
|
|
70
72
|
export * from "./checkdocumentaccessrequest.js";
|
|
71
73
|
export * from "./checkdocumentaccessresponse.js";
|
|
72
74
|
export * from "./clustergroup.js";
|
|
@@ -394,6 +396,7 @@ export * from "./toolscallresponse.js";
|
|
|
394
396
|
export * from "./toolsets.js";
|
|
395
397
|
export * from "./toolslistresponse.js";
|
|
396
398
|
export * from "./ugctype.js";
|
|
399
|
+
export * from "./unauthorizeddatasourceinstance.js";
|
|
397
400
|
export * from "./unpin.js";
|
|
398
401
|
export * from "./updateannouncementrequest.js";
|
|
399
402
|
export * from "./updatedlpconfigrequest.js";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import { AuthStatus, AuthStatus$inboundSchema } from "./authstatus.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A datasource instance that could not return results for this request because the user has not completed or has expired per-user OAuth.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
*/
|
|
16
|
+
export type UnauthorizedDatasourceInstance = {
|
|
17
|
+
/**
|
|
18
|
+
* The instance identifier (e.g. "github", "github_enterprise_0", "slack_0"). Matches the instance names used in datasource configuration.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
*/
|
|
22
|
+
datasourceInstance?: string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Human-readable name of the datasource instance for display.
|
|
25
|
+
*/
|
|
26
|
+
displayName?: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The per-user authorization status for a datasource.
|
|
29
|
+
*/
|
|
30
|
+
authStatus?: AuthStatus | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Relative path to initiate or resume OAuth for the current user and instance, including a one-time authentication token as a query parameter. Clients should prepend their configured Glean backend base URL.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
*/
|
|
36
|
+
authUrlRelativePath?: string | undefined;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** @internal */
|
|
40
|
+
export const UnauthorizedDatasourceInstance$inboundSchema: z.ZodType<
|
|
41
|
+
UnauthorizedDatasourceInstance,
|
|
42
|
+
z.ZodTypeDef,
|
|
43
|
+
unknown
|
|
44
|
+
> = z.object({
|
|
45
|
+
datasourceInstance: z.string().optional(),
|
|
46
|
+
displayName: z.string().optional(),
|
|
47
|
+
authStatus: AuthStatus$inboundSchema.optional(),
|
|
48
|
+
authUrlRelativePath: z.string().optional(),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export function unauthorizedDatasourceInstanceFromJSON(
|
|
52
|
+
jsonString: string,
|
|
53
|
+
): SafeParseResult<UnauthorizedDatasourceInstance, SDKValidationError> {
|
|
54
|
+
return safeParse(
|
|
55
|
+
jsonString,
|
|
56
|
+
(x) => UnauthorizedDatasourceInstance$inboundSchema.parse(JSON.parse(x)),
|
|
57
|
+
`Failed to parse 'UnauthorizedDatasourceInstance' from JSON`,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -24,6 +24,14 @@ export type GleanDataErrorData = {
|
|
|
24
24
|
* Indicates the federated search results could not be fetched due to rate limiting.
|
|
25
25
|
*/
|
|
26
26
|
federatedSearchRateLimitError?: boolean | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Datasource instances that could not be queried because the user has not completed or has expired per-user OAuth.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
*/
|
|
32
|
+
unauthorizedDatasourceInstances?:
|
|
33
|
+
| Array<components.UnauthorizedDatasourceInstance>
|
|
34
|
+
| undefined;
|
|
27
35
|
};
|
|
28
36
|
|
|
29
37
|
export class GleanDataError extends GleanBaseError {
|
|
@@ -44,6 +52,14 @@ export class GleanDataError extends GleanBaseError {
|
|
|
44
52
|
* Indicates the federated search results could not be fetched due to rate limiting.
|
|
45
53
|
*/
|
|
46
54
|
federatedSearchRateLimitError?: boolean | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Datasource instances that could not be queried because the user has not completed or has expired per-user OAuth.
|
|
57
|
+
*
|
|
58
|
+
* @remarks
|
|
59
|
+
*/
|
|
60
|
+
unauthorizedDatasourceInstances?:
|
|
61
|
+
| Array<components.UnauthorizedDatasourceInstance>
|
|
62
|
+
| undefined;
|
|
47
63
|
|
|
48
64
|
/** The original data that was passed to this error instance. */
|
|
49
65
|
data$: GleanDataErrorData;
|
|
@@ -66,6 +82,10 @@ export class GleanDataError extends GleanBaseError {
|
|
|
66
82
|
if (err.federatedSearchRateLimitError != null) {
|
|
67
83
|
this.federatedSearchRateLimitError = err.federatedSearchRateLimitError;
|
|
68
84
|
}
|
|
85
|
+
if (err.unauthorizedDatasourceInstances != null) {
|
|
86
|
+
this.unauthorizedDatasourceInstances =
|
|
87
|
+
err.unauthorizedDatasourceInstances;
|
|
88
|
+
}
|
|
69
89
|
|
|
70
90
|
this.name = "GleanDataError";
|
|
71
91
|
}
|
|
@@ -83,6 +103,9 @@ export const GleanDataError$inboundSchema: z.ZodType<
|
|
|
83
103
|
.optional(),
|
|
84
104
|
errorMessages: z.array(components.ErrorMessage$inboundSchema).optional(),
|
|
85
105
|
federatedSearchRateLimitError: z.boolean().optional(),
|
|
106
|
+
unauthorizedDatasourceInstances: z.array(
|
|
107
|
+
components.UnauthorizedDatasourceInstance$inboundSchema,
|
|
108
|
+
).optional(),
|
|
86
109
|
request$: z.instanceof(Request),
|
|
87
110
|
response$: z.instanceof(Response),
|
|
88
111
|
body$: z.string(),
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
MutationKey,
|
|
7
|
+
useMutation,
|
|
8
|
+
UseMutationResult,
|
|
9
|
+
} from "@tanstack/react-query";
|
|
10
|
+
import { GleanCore } from "../core.js";
|
|
11
|
+
import { authenticationCheckdatasourceauth } from "../funcs/authenticationCheckdatasourceauth.js";
|
|
12
|
+
import { combineSignals } from "../lib/primitives.js";
|
|
13
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
14
|
+
import * as components from "../models/components/index.js";
|
|
15
|
+
import { GleanBaseError } from "../models/errors/gleanbaseerror.js";
|
|
16
|
+
import {
|
|
17
|
+
ConnectionError,
|
|
18
|
+
InvalidRequestError,
|
|
19
|
+
RequestAbortedError,
|
|
20
|
+
RequestTimeoutError,
|
|
21
|
+
UnexpectedClientError,
|
|
22
|
+
} from "../models/errors/httpclienterrors.js";
|
|
23
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
24
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
25
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
26
|
+
import { useGleanContext } from "./_context.js";
|
|
27
|
+
import { MutationHookOptions } from "./_types.js";
|
|
28
|
+
|
|
29
|
+
export type AuthenticationCheckdatasourceauthMutationVariables = {
|
|
30
|
+
options?: RequestOptions;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type AuthenticationCheckdatasourceauthMutationData =
|
|
34
|
+
components.CheckDatasourceAuthResponse;
|
|
35
|
+
|
|
36
|
+
export type AuthenticationCheckdatasourceauthMutationError =
|
|
37
|
+
| GleanBaseError
|
|
38
|
+
| ResponseValidationError
|
|
39
|
+
| ConnectionError
|
|
40
|
+
| RequestAbortedError
|
|
41
|
+
| RequestTimeoutError
|
|
42
|
+
| InvalidRequestError
|
|
43
|
+
| UnexpectedClientError
|
|
44
|
+
| SDKValidationError;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Check datasource authorization
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* Returns all datasource instances that require per-user OAuth authorization
|
|
51
|
+
* for the authenticated user, along with a transient auth token that can be
|
|
52
|
+
* appended to auth URLs to complete OAuth flows.
|
|
53
|
+
*
|
|
54
|
+
* Clients construct the full OAuth URL by combining the backend base URL,
|
|
55
|
+
* the `authUrlRelativePath` from each instance, and the transient auth token:
|
|
56
|
+
* `<backend>/<authUrlRelativePath>?transient_auth_token=<token>`.
|
|
57
|
+
*/
|
|
58
|
+
export function useAuthenticationCheckdatasourceauthMutation(
|
|
59
|
+
options?: MutationHookOptions<
|
|
60
|
+
AuthenticationCheckdatasourceauthMutationData,
|
|
61
|
+
AuthenticationCheckdatasourceauthMutationError,
|
|
62
|
+
AuthenticationCheckdatasourceauthMutationVariables
|
|
63
|
+
>,
|
|
64
|
+
): UseMutationResult<
|
|
65
|
+
AuthenticationCheckdatasourceauthMutationData,
|
|
66
|
+
AuthenticationCheckdatasourceauthMutationError,
|
|
67
|
+
AuthenticationCheckdatasourceauthMutationVariables
|
|
68
|
+
> {
|
|
69
|
+
const client = useGleanContext();
|
|
70
|
+
return useMutation({
|
|
71
|
+
...buildAuthenticationCheckdatasourceauthMutation(client, options),
|
|
72
|
+
...options,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function mutationKeyAuthenticationCheckdatasourceauth(): MutationKey {
|
|
77
|
+
return ["@gleanwork/api-client", "Authentication", "checkdatasourceauth"];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function buildAuthenticationCheckdatasourceauthMutation(
|
|
81
|
+
client$: GleanCore,
|
|
82
|
+
hookOptions?: RequestOptions,
|
|
83
|
+
): {
|
|
84
|
+
mutationKey: MutationKey;
|
|
85
|
+
mutationFn: (
|
|
86
|
+
variables: AuthenticationCheckdatasourceauthMutationVariables,
|
|
87
|
+
) => Promise<AuthenticationCheckdatasourceauthMutationData>;
|
|
88
|
+
} {
|
|
89
|
+
return {
|
|
90
|
+
mutationKey: mutationKeyAuthenticationCheckdatasourceauth(),
|
|
91
|
+
mutationFn: function authenticationCheckdatasourceauthMutationFn({
|
|
92
|
+
options,
|
|
93
|
+
}): Promise<AuthenticationCheckdatasourceauthMutationData> {
|
|
94
|
+
const mergedOptions = {
|
|
95
|
+
...hookOptions,
|
|
96
|
+
...options,
|
|
97
|
+
fetchOptions: {
|
|
98
|
+
...hookOptions?.fetchOptions,
|
|
99
|
+
...options?.fetchOptions,
|
|
100
|
+
signal: combineSignals(
|
|
101
|
+
hookOptions?.fetchOptions?.signal,
|
|
102
|
+
options?.fetchOptions?.signal,
|
|
103
|
+
),
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
return unwrapAsync(authenticationCheckdatasourceauth(
|
|
107
|
+
client$,
|
|
108
|
+
mergedOptions,
|
|
109
|
+
));
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
package/src/react-query/index.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
export { GleanProvider, useGleanContext } from "./_context.js";
|
|
6
6
|
export * from "./_types.js";
|
|
7
7
|
|
|
8
|
+
export * from "./authenticationCheckdatasourceauth.js";
|
|
8
9
|
export * from "./clientActivityFeedback.js";
|
|
9
10
|
export * from "./clientActivityReport.js";
|
|
10
11
|
export * from "./clientAgentsList.js";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { authenticationCheckdatasourceauth } from "../funcs/authenticationCheckdatasourceauth.js";
|
|
6
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
7
|
+
import * as components from "../models/components/index.js";
|
|
8
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
9
|
+
|
|
10
|
+
export class Authentication extends ClientSDK {
|
|
11
|
+
/**
|
|
12
|
+
* Check datasource authorization
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Returns all datasource instances that require per-user OAuth authorization
|
|
16
|
+
* for the authenticated user, along with a transient auth token that can be
|
|
17
|
+
* appended to auth URLs to complete OAuth flows.
|
|
18
|
+
*
|
|
19
|
+
* Clients construct the full OAuth URL by combining the backend base URL,
|
|
20
|
+
* the `authUrlRelativePath` from each instance, and the transient auth token:
|
|
21
|
+
* `<backend>/<authUrlRelativePath>?transient_auth_token=<token>`.
|
|
22
|
+
*/
|
|
23
|
+
async checkdatasourceauth(
|
|
24
|
+
options?: RequestOptions,
|
|
25
|
+
): Promise<components.CheckDatasourceAuthResponse> {
|
|
26
|
+
return unwrapAsync(authenticationCheckdatasourceauth(
|
|
27
|
+
this,
|
|
28
|
+
options,
|
|
29
|
+
));
|
|
30
|
+
}
|
|
31
|
+
}
|
package/src/sdk/sdk.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { ClientSDK } from "../lib/sdks.js";
|
|
6
|
+
import { Authentication } from "./authentication.js";
|
|
6
7
|
import { Client } from "./client.js";
|
|
7
8
|
import { Governance } from "./governance.js";
|
|
8
9
|
import { Indexing } from "./indexing.js";
|
|
@@ -13,6 +14,11 @@ export class Glean extends ClientSDK {
|
|
|
13
14
|
return (this._client ??= new Client(this._options));
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
private _authentication?: Authentication;
|
|
18
|
+
get authentication(): Authentication {
|
|
19
|
+
return (this._authentication ??= new Authentication(this._options));
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
private _indexing?: Indexing;
|
|
17
23
|
get indexing(): Indexing {
|
|
18
24
|
return (this._indexing ??= new Indexing(this._options));
|