@gleanwork/api-client 0.14.4 → 0.14.5

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.
Files changed (77) hide show
  1. package/README.md +11 -7
  2. package/dist/commonjs/__tests__/messages.test.js +1 -1
  3. package/dist/commonjs/__tests__/messages.test.js.map +1 -1
  4. package/dist/commonjs/lib/config.d.ts +3 -3
  5. package/dist/commonjs/lib/config.js +3 -3
  6. package/dist/commonjs/models/components/authstatus.d.ts +19 -0
  7. package/dist/commonjs/models/components/authstatus.d.ts.map +1 -0
  8. package/dist/commonjs/models/components/authstatus.js +54 -0
  9. package/dist/commonjs/models/components/authstatus.js.map +1 -0
  10. package/dist/commonjs/models/components/chatmessage.d.ts +24 -0
  11. package/dist/commonjs/models/components/chatmessage.d.ts.map +1 -1
  12. package/dist/commonjs/models/components/chatmessage.js +24 -0
  13. package/dist/commonjs/models/components/chatmessage.js.map +1 -1
  14. package/dist/commonjs/models/components/chatresponse.d.ts +7 -0
  15. package/dist/commonjs/models/components/chatresponse.d.ts.map +1 -1
  16. package/dist/commonjs/models/components/chatresponse.js +2 -0
  17. package/dist/commonjs/models/components/chatresponse.js.map +1 -1
  18. package/dist/commonjs/models/components/gleandataerror.d.ts +7 -0
  19. package/dist/commonjs/models/components/gleandataerror.d.ts.map +1 -1
  20. package/dist/commonjs/models/components/gleandataerror.js +2 -0
  21. package/dist/commonjs/models/components/gleandataerror.js.map +1 -1
  22. package/dist/commonjs/models/components/index.d.ts +2 -0
  23. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  24. package/dist/commonjs/models/components/index.js +2 -0
  25. package/dist/commonjs/models/components/index.js.map +1 -1
  26. package/dist/commonjs/models/components/unauthorizeddatasourceinstance.d.ts +35 -0
  27. package/dist/commonjs/models/components/unauthorizeddatasourceinstance.d.ts.map +1 -0
  28. package/dist/commonjs/models/components/unauthorizeddatasourceinstance.js +54 -0
  29. package/dist/commonjs/models/components/unauthorizeddatasourceinstance.js.map +1 -0
  30. package/dist/commonjs/models/errors/gleandataerror.d.ts +12 -0
  31. package/dist/commonjs/models/errors/gleandataerror.d.ts.map +1 -1
  32. package/dist/commonjs/models/errors/gleandataerror.js +5 -0
  33. package/dist/commonjs/models/errors/gleandataerror.js.map +1 -1
  34. package/dist/esm/__tests__/messages.test.js +1 -1
  35. package/dist/esm/__tests__/messages.test.js.map +1 -1
  36. package/dist/esm/lib/config.d.ts +3 -3
  37. package/dist/esm/lib/config.js +3 -3
  38. package/dist/esm/models/components/authstatus.d.ts +19 -0
  39. package/dist/esm/models/components/authstatus.d.ts.map +1 -0
  40. package/dist/esm/models/components/authstatus.js +18 -0
  41. package/dist/esm/models/components/authstatus.js.map +1 -0
  42. package/dist/esm/models/components/chatmessage.d.ts +24 -0
  43. package/dist/esm/models/components/chatmessage.d.ts.map +1 -1
  44. package/dist/esm/models/components/chatmessage.js +24 -0
  45. package/dist/esm/models/components/chatmessage.js.map +1 -1
  46. package/dist/esm/models/components/chatresponse.d.ts +7 -0
  47. package/dist/esm/models/components/chatresponse.d.ts.map +1 -1
  48. package/dist/esm/models/components/chatresponse.js +2 -0
  49. package/dist/esm/models/components/chatresponse.js.map +1 -1
  50. package/dist/esm/models/components/gleandataerror.d.ts +7 -0
  51. package/dist/esm/models/components/gleandataerror.d.ts.map +1 -1
  52. package/dist/esm/models/components/gleandataerror.js +2 -0
  53. package/dist/esm/models/components/gleandataerror.js.map +1 -1
  54. package/dist/esm/models/components/index.d.ts +2 -0
  55. package/dist/esm/models/components/index.d.ts.map +1 -1
  56. package/dist/esm/models/components/index.js +2 -0
  57. package/dist/esm/models/components/index.js.map +1 -1
  58. package/dist/esm/models/components/unauthorizeddatasourceinstance.d.ts +35 -0
  59. package/dist/esm/models/components/unauthorizeddatasourceinstance.d.ts.map +1 -0
  60. package/dist/esm/models/components/unauthorizeddatasourceinstance.js +17 -0
  61. package/dist/esm/models/components/unauthorizeddatasourceinstance.js.map +1 -0
  62. package/dist/esm/models/errors/gleandataerror.d.ts +12 -0
  63. package/dist/esm/models/errors/gleandataerror.d.ts.map +1 -1
  64. package/dist/esm/models/errors/gleandataerror.js +5 -0
  65. package/dist/esm/models/errors/gleandataerror.js.map +1 -1
  66. package/examples/package-lock.json +1 -1
  67. package/jsr.json +1 -1
  68. package/package.json +1 -1
  69. package/src/__tests__/messages.test.ts +1 -1
  70. package/src/lib/config.ts +3 -3
  71. package/src/models/components/authstatus.ts +25 -0
  72. package/src/models/components/chatmessage.ts +24 -0
  73. package/src/models/components/chatresponse.ts +15 -0
  74. package/src/models/components/gleandataerror.ts +15 -0
  75. package/src/models/components/index.ts +2 -0
  76. package/src/models/components/unauthorizeddatasourceinstance.ts +59 -0
  77. package/src/models/errors/gleandataerror.ts +23 -0
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@gleanwork/api-client",
5
- "version": "0.14.4",
5
+ "version": "0.14.5",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gleanwork/api-client",
3
- "version": "0.14.4",
3
+ "version": "0.14.5",
4
4
  "author": "Speakeasy",
5
5
  "tshy": {
6
6
  "sourceDialects": [
@@ -19,7 +19,7 @@ test("Messages Messages", async () => {
19
19
  idType: "CONVERSATION_ID",
20
20
  id: "<id>",
21
21
  timestampMillis: 558834,
22
- datasource: "MICROSOFTTEAMS",
22
+ datasource: "GCHAT",
23
23
  });
24
24
  expect(result).toBeDefined();
25
25
  });
package/src/lib/config.ts CHANGED
@@ -68,8 +68,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
68
68
  export const SDK_METADATA = {
69
69
  language: "typescript",
70
70
  openapiDocVersion: "0.9.0",
71
- sdkVersion: "0.14.4",
72
- genVersion: "2.814.0",
71
+ sdkVersion: "0.14.5",
72
+ genVersion: "2.829.1",
73
73
  userAgent:
74
- "speakeasy-sdk/typescript 0.14.4 2.814.0 0.9.0 @gleanwork/api-client",
74
+ "speakeasy-sdk/typescript 0.14.5 2.829.1 0.9.0 @gleanwork/api-client",
75
75
  } as const;
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { ClosedEnum } from "../../types/enums.js";
7
+
8
+ /**
9
+ * The per-user authorization status for a datasource.
10
+ */
11
+ export const AuthStatus = {
12
+ Disabled: "DISABLED",
13
+ AwaitingAuth: "AWAITING_AUTH",
14
+ Authorized: "AUTHORIZED",
15
+ StaleOauth: "STALE_OAUTH",
16
+ SegMigration: "SEG_MIGRATION",
17
+ } as const;
18
+ /**
19
+ * The per-user authorization status for a datasource.
20
+ */
21
+ export type AuthStatus = ClosedEnum<typeof AuthStatus>;
22
+
23
+ /** @internal */
24
+ export const AuthStatus$inboundSchema: z.ZodNativeEnum<typeof AuthStatus> = z
25
+ .nativeEnum(AuthStatus);
@@ -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(
@@ -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";
@@ -394,6 +395,7 @@ export * from "./toolscallresponse.js";
394
395
  export * from "./toolsets.js";
395
396
  export * from "./toolslistresponse.js";
396
397
  export * from "./ugctype.js";
398
+ export * from "./unauthorizeddatasourceinstance.js";
397
399
  export * from "./unpin.js";
398
400
  export * from "./updateannouncementrequest.js";
399
401
  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. 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(),