syllable-sdk 0.1.0-alpha.34 → 0.1.0-alpha.36

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 (164) hide show
  1. package/README.md +23 -0
  2. package/docs/sdks/agents/README.md +18 -6
  3. package/docs/sdks/custommessages/README.md +160 -2
  4. package/docs/sdks/datasources/README.md +417 -0
  5. package/docs/sdks/prompts/README.md +0 -8
  6. package/docs/sdks/sessionlabels/README.md +6 -0
  7. package/docs/sdks/targets/README.md +10 -18
  8. package/docs/sdks/tools/README.md +6 -6
  9. package/docs/sdks/v1/README.md +408 -0
  10. package/funcs/agentsCreate.js +1 -1
  11. package/funcs/agentsCreate.js.map +1 -1
  12. package/funcs/agentsDelete.js +1 -1
  13. package/funcs/agentsDelete.js.map +1 -1
  14. package/funcs/agentsUpdate.js +1 -1
  15. package/funcs/agentsUpdate.js.map +1 -1
  16. package/funcs/dataSourcesCreate.d.ts +16 -0
  17. package/funcs/dataSourcesCreate.d.ts.map +1 -0
  18. package/funcs/dataSourcesCreate.js +101 -0
  19. package/funcs/dataSourcesCreate.js.map +1 -0
  20. package/funcs/dataSourcesDataSourcesDeleteByName.d.ts +16 -0
  21. package/funcs/dataSourcesDataSourcesDeleteByName.d.ts.map +1 -0
  22. package/funcs/dataSourcesDataSourcesDeleteByName.js +111 -0
  23. package/funcs/dataSourcesDataSourcesDeleteByName.js.map +1 -0
  24. package/funcs/dataSourcesGetByName.d.ts +17 -0
  25. package/funcs/dataSourcesGetByName.d.ts.map +1 -0
  26. package/funcs/dataSourcesGetByName.js +107 -0
  27. package/funcs/dataSourcesGetByName.js.map +1 -0
  28. package/funcs/dataSourcesList.d.ts +17 -0
  29. package/funcs/dataSourcesList.d.ts.map +1 -0
  30. package/funcs/dataSourcesList.js +113 -0
  31. package/funcs/dataSourcesList.js.map +1 -0
  32. package/funcs/dataSourcesUpdate.d.ts +16 -0
  33. package/funcs/dataSourcesUpdate.d.ts.map +1 -0
  34. package/funcs/dataSourcesUpdate.js +101 -0
  35. package/funcs/dataSourcesUpdate.js.map +1 -0
  36. package/funcs/v1Create.d.ts +16 -0
  37. package/funcs/v1Create.d.ts.map +1 -0
  38. package/funcs/v1Create.js +101 -0
  39. package/funcs/v1Create.js.map +1 -0
  40. package/funcs/v1DataSourcesDeleteByName.d.ts +16 -0
  41. package/funcs/v1DataSourcesDeleteByName.d.ts.map +1 -0
  42. package/funcs/v1DataSourcesDeleteByName.js +111 -0
  43. package/funcs/v1DataSourcesDeleteByName.js.map +1 -0
  44. package/funcs/v1GetByName.d.ts +17 -0
  45. package/funcs/v1GetByName.d.ts.map +1 -0
  46. package/funcs/v1GetByName.js +107 -0
  47. package/funcs/v1GetByName.js.map +1 -0
  48. package/funcs/v1List.d.ts +17 -0
  49. package/funcs/v1List.d.ts.map +1 -0
  50. package/funcs/v1List.js +113 -0
  51. package/funcs/v1List.js.map +1 -0
  52. package/funcs/v1Update.d.ts +16 -0
  53. package/funcs/v1Update.d.ts.map +1 -0
  54. package/funcs/v1Update.js +101 -0
  55. package/funcs/v1Update.js.map +1 -0
  56. package/jsr.json +1 -1
  57. package/lib/config.d.ts +3 -3
  58. package/lib/config.js +3 -3
  59. package/lib/config.js.map +1 -1
  60. package/lib/retries.js +0 -1
  61. package/lib/retries.js.map +1 -1
  62. package/lib/schemas.d.ts +1 -1
  63. package/lib/schemas.d.ts.map +1 -1
  64. package/lib/schemas.js +4 -1
  65. package/lib/schemas.js.map +1 -1
  66. package/mintlify/mint.json +1 -1
  67. package/models/components/agentcreate.d.ts +6 -23
  68. package/models/components/agentcreate.d.ts.map +1 -1
  69. package/models/components/agentcreate.js +3 -26
  70. package/models/components/agentcreate.js.map +1 -1
  71. package/models/components/agentupdate.d.ts +6 -23
  72. package/models/components/agentupdate.d.ts.map +1 -1
  73. package/models/components/agentupdate.js +3 -26
  74. package/models/components/agentupdate.js.map +1 -1
  75. package/models/components/datasourcecreaterequest.d.ts +57 -0
  76. package/models/components/datasourcecreaterequest.d.ts.map +1 -0
  77. package/models/components/datasourcecreaterequest.js +78 -0
  78. package/models/components/datasourcecreaterequest.js.map +1 -0
  79. package/models/components/datasourcedetailresponse.d.ts +75 -0
  80. package/models/components/datasourcedetailresponse.d.ts.map +1 -0
  81. package/models/components/datasourcedetailresponse.js +90 -0
  82. package/models/components/datasourcedetailresponse.js.map +1 -0
  83. package/models/components/datasourcemetadataresponse.d.ts +70 -0
  84. package/models/components/datasourcemetadataresponse.d.ts.map +1 -0
  85. package/models/components/datasourcemetadataresponse.js +88 -0
  86. package/models/components/datasourcemetadataresponse.js.map +1 -0
  87. package/models/components/datasourceproperties.d.ts +43 -0
  88. package/models/components/datasourceproperties.d.ts.map +1 -0
  89. package/models/components/datasourceproperties.js +55 -0
  90. package/models/components/datasourceproperties.js.map +1 -0
  91. package/models/components/datasourceupdaterequest.d.ts +62 -0
  92. package/models/components/datasourceupdaterequest.d.ts.map +1 -0
  93. package/models/components/datasourceupdaterequest.js +82 -0
  94. package/models/components/datasourceupdaterequest.js.map +1 -0
  95. package/models/components/index.d.ts +6 -0
  96. package/models/components/index.d.ts.map +1 -1
  97. package/models/components/index.js +6 -0
  98. package/models/components/index.js.map +1 -1
  99. package/models/components/listresponsedatasourcemetadataresponse.d.ts +38 -0
  100. package/models/components/listresponsedatasourcemetadataresponse.d.ts.map +1 -0
  101. package/models/components/listresponsedatasourcemetadataresponse.js +81 -0
  102. package/models/components/listresponsedatasourcemetadataresponse.js.map +1 -0
  103. package/models/operations/datasourcesdeletebyname.d.ts +31 -0
  104. package/models/operations/datasourcesdeletebyname.d.ts.map +1 -0
  105. package/models/operations/datasourcesdeletebyname.js +61 -0
  106. package/models/operations/datasourcesdeletebyname.js.map +1 -0
  107. package/models/operations/datasourcesgetbyname.d.ts +29 -0
  108. package/models/operations/datasourcesgetbyname.d.ts.map +1 -0
  109. package/models/operations/datasourcesgetbyname.js +59 -0
  110. package/models/operations/datasourcesgetbyname.js.map +1 -0
  111. package/models/operations/datasourceslist.d.ts +46 -0
  112. package/models/operations/datasourceslist.d.ts.map +1 -0
  113. package/models/operations/datasourceslist.js +103 -0
  114. package/models/operations/datasourceslist.js.map +1 -0
  115. package/models/operations/index.d.ts +3 -0
  116. package/models/operations/index.d.ts.map +1 -1
  117. package/models/operations/index.js +3 -0
  118. package/models/operations/index.js.map +1 -1
  119. package/openapi.json +3080 -1612
  120. package/package.json +6 -7
  121. package/sdk/datasources.d.ts +41 -0
  122. package/sdk/datasources.d.ts.map +1 -0
  123. package/sdk/datasources.js +62 -0
  124. package/sdk/datasources.js.map +1 -0
  125. package/sdk/sdk.d.ts +5 -2
  126. package/sdk/sdk.d.ts.map +1 -1
  127. package/sdk/sdk.js +7 -3
  128. package/sdk/sdk.js.map +1 -1
  129. package/sdk/v1.d.ts +36 -0
  130. package/sdk/v1.d.ts.map +1 -1
  131. package/sdk/v1.js +50 -0
  132. package/sdk/v1.js.map +1 -1
  133. package/src/funcs/agentsCreate.ts +1 -1
  134. package/src/funcs/agentsDelete.ts +1 -1
  135. package/src/funcs/agentsUpdate.ts +1 -1
  136. package/src/funcs/dataSourcesCreate.ts +134 -0
  137. package/src/funcs/dataSourcesDataSourcesDeleteByName.ts +147 -0
  138. package/src/funcs/dataSourcesGetByName.ts +142 -0
  139. package/src/funcs/dataSourcesList.ts +150 -0
  140. package/src/funcs/dataSourcesUpdate.ts +134 -0
  141. package/src/funcs/v1Create.ts +134 -0
  142. package/src/funcs/v1DataSourcesDeleteByName.ts +147 -0
  143. package/src/funcs/v1GetByName.ts +142 -0
  144. package/src/funcs/v1List.ts +150 -0
  145. package/src/funcs/v1Update.ts +134 -0
  146. package/src/lib/config.ts +3 -3
  147. package/src/lib/retries.ts +0 -1
  148. package/src/lib/schemas.ts +5 -0
  149. package/src/models/components/agentcreate.ts +4 -50
  150. package/src/models/components/agentupdate.ts +4 -54
  151. package/src/models/components/datasourcecreaterequest.ts +113 -0
  152. package/src/models/components/datasourcedetailresponse.ts +143 -0
  153. package/src/models/components/datasourcemetadataresponse.ts +136 -0
  154. package/src/models/components/datasourceproperties.ts +38 -0
  155. package/src/models/components/datasourceupdaterequest.ts +122 -0
  156. package/src/models/components/index.ts +6 -0
  157. package/src/models/components/listresponsedatasourcemetadataresponse.ts +107 -0
  158. package/src/models/operations/datasourcesdeletebyname.ts +72 -0
  159. package/src/models/operations/datasourcesgetbyname.ts +68 -0
  160. package/src/models/operations/datasourceslist.ts +126 -0
  161. package/src/models/operations/index.ts +3 -0
  162. package/src/sdk/datasources.ts +100 -0
  163. package/src/sdk/sdk.ts +11 -5
  164. package/src/sdk/v1.ts +91 -0
@@ -0,0 +1,142 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { SyllableSDKCore } from "../core.js";
6
+ import { encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import * as components from "../models/components/index.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
22
+ import { SDKError } from "../models/errors/sdkerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as operations from "../models/operations/index.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * Get Data Source
29
+ *
30
+ * @remarks
31
+ * Fetch a given data source, including its text.
32
+ */
33
+ export async function v1GetByName(
34
+ client: SyllableSDKCore,
35
+ request: operations.DataSourcesGetByNameRequest,
36
+ options?: RequestOptions,
37
+ ): Promise<
38
+ Result<
39
+ components.DataSourceDetailResponse,
40
+ | errors.HTTPValidationError
41
+ | SDKError
42
+ | SDKValidationError
43
+ | UnexpectedClientError
44
+ | InvalidRequestError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | ConnectionError
48
+ >
49
+ > {
50
+ const parsed = safeParse(
51
+ request,
52
+ (value) =>
53
+ operations.DataSourcesGetByNameRequest$outboundSchema.parse(value),
54
+ "Input validation failed",
55
+ );
56
+ if (!parsed.ok) {
57
+ return parsed;
58
+ }
59
+ const payload = parsed.value;
60
+ const body = null;
61
+
62
+ const pathParams = {
63
+ name: encodeSimple("name", payload.name, {
64
+ explode: false,
65
+ charEncoding: "percent",
66
+ }),
67
+ };
68
+
69
+ const path = pathToFunc("/api/v1/data_sources/{name}")(pathParams);
70
+
71
+ const headers = new Headers(compactMap({
72
+ Accept: "application/json",
73
+ }));
74
+
75
+ const secConfig = await extractSecurity(client._options.apiKeyHeader);
76
+ const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig };
77
+ const requestSecurity = resolveGlobalSecurity(securityInput);
78
+
79
+ const context = {
80
+ operationID: "data_sources_get_by_name",
81
+ oAuth2Scopes: [],
82
+
83
+ resolvedSecurity: requestSecurity,
84
+
85
+ securitySource: client._options.apiKeyHeader,
86
+ retryConfig: options?.retries
87
+ || client._options.retryConfig
88
+ || { strategy: "none" },
89
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
90
+ };
91
+
92
+ const requestRes = client._createRequest(context, {
93
+ security: requestSecurity,
94
+ method: "GET",
95
+ baseURL: options?.serverURL,
96
+ path: path,
97
+ headers: headers,
98
+ body: body,
99
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
100
+ }, options);
101
+ if (!requestRes.ok) {
102
+ return requestRes;
103
+ }
104
+ const req = requestRes.value;
105
+
106
+ const doResult = await client._do(req, {
107
+ context,
108
+ errorCodes: ["422", "4XX", "5XX"],
109
+ retryConfig: context.retryConfig,
110
+ retryCodes: context.retryCodes,
111
+ });
112
+ if (!doResult.ok) {
113
+ return doResult;
114
+ }
115
+ const response = doResult.value;
116
+
117
+ const responseFields = {
118
+ HttpMeta: { Response: response, Request: req },
119
+ };
120
+
121
+ const [result] = await M.match<
122
+ components.DataSourceDetailResponse,
123
+ | errors.HTTPValidationError
124
+ | SDKError
125
+ | SDKValidationError
126
+ | UnexpectedClientError
127
+ | InvalidRequestError
128
+ | RequestAbortedError
129
+ | RequestTimeoutError
130
+ | ConnectionError
131
+ >(
132
+ M.json(200, components.DataSourceDetailResponse$inboundSchema),
133
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
134
+ M.fail("4XX"),
135
+ M.fail("5XX"),
136
+ )(response, { extraFields: responseFields });
137
+ if (!result.ok) {
138
+ return result;
139
+ }
140
+
141
+ return result;
142
+ }
@@ -0,0 +1,150 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { SyllableSDKCore } from "../core.js";
6
+ import { encodeFormQuery } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import * as components from "../models/components/index.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
22
+ import { SDKError } from "../models/errors/sdkerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as operations from "../models/operations/index.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * List Data Sources
29
+ *
30
+ * @remarks
31
+ * Fetch metadata about all data sources, not including their text.
32
+ */
33
+ export async function v1List(
34
+ client: SyllableSDKCore,
35
+ request: operations.DataSourcesListRequest,
36
+ options?: RequestOptions,
37
+ ): Promise<
38
+ Result<
39
+ components.ListResponseDataSourceMetadataResponse,
40
+ | errors.HTTPValidationError
41
+ | SDKError
42
+ | SDKValidationError
43
+ | UnexpectedClientError
44
+ | InvalidRequestError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | ConnectionError
48
+ >
49
+ > {
50
+ const parsed = safeParse(
51
+ request,
52
+ (value) => operations.DataSourcesListRequest$outboundSchema.parse(value),
53
+ "Input validation failed",
54
+ );
55
+ if (!parsed.ok) {
56
+ return parsed;
57
+ }
58
+ const payload = parsed.value;
59
+ const body = null;
60
+
61
+ const path = pathToFunc("/api/v1/data_sources/")();
62
+
63
+ const query = encodeFormQuery({
64
+ "end_datetime": payload.end_datetime,
65
+ "fields": payload.fields,
66
+ "limit": payload.limit,
67
+ "order_by": payload.order_by,
68
+ "order_by_direction": payload.order_by_direction,
69
+ "page": payload.page,
70
+ "search_field_values": payload.search_field_values,
71
+ "search_fields": payload.search_fields,
72
+ "start_datetime": payload.start_datetime,
73
+ });
74
+
75
+ const headers = new Headers(compactMap({
76
+ Accept: "application/json",
77
+ }));
78
+
79
+ const secConfig = await extractSecurity(client._options.apiKeyHeader);
80
+ const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig };
81
+ const requestSecurity = resolveGlobalSecurity(securityInput);
82
+
83
+ const context = {
84
+ operationID: "data_sources_list",
85
+ oAuth2Scopes: [],
86
+
87
+ resolvedSecurity: requestSecurity,
88
+
89
+ securitySource: client._options.apiKeyHeader,
90
+ retryConfig: options?.retries
91
+ || client._options.retryConfig
92
+ || { strategy: "none" },
93
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
94
+ };
95
+
96
+ const requestRes = client._createRequest(context, {
97
+ security: requestSecurity,
98
+ method: "GET",
99
+ baseURL: options?.serverURL,
100
+ path: path,
101
+ headers: headers,
102
+ query: query,
103
+ body: body,
104
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
105
+ }, options);
106
+ if (!requestRes.ok) {
107
+ return requestRes;
108
+ }
109
+ const req = requestRes.value;
110
+
111
+ const doResult = await client._do(req, {
112
+ context,
113
+ errorCodes: ["422", "4XX", "5XX"],
114
+ retryConfig: context.retryConfig,
115
+ retryCodes: context.retryCodes,
116
+ });
117
+ if (!doResult.ok) {
118
+ return doResult;
119
+ }
120
+ const response = doResult.value;
121
+
122
+ const responseFields = {
123
+ HttpMeta: { Response: response, Request: req },
124
+ };
125
+
126
+ const [result] = await M.match<
127
+ components.ListResponseDataSourceMetadataResponse,
128
+ | errors.HTTPValidationError
129
+ | SDKError
130
+ | SDKValidationError
131
+ | UnexpectedClientError
132
+ | InvalidRequestError
133
+ | RequestAbortedError
134
+ | RequestTimeoutError
135
+ | ConnectionError
136
+ >(
137
+ M.json(
138
+ 200,
139
+ components.ListResponseDataSourceMetadataResponse$inboundSchema,
140
+ ),
141
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
142
+ M.fail("4XX"),
143
+ M.fail("5XX"),
144
+ )(response, { extraFields: responseFields });
145
+ if (!result.ok) {
146
+ return result;
147
+ }
148
+
149
+ return result;
150
+ }
@@ -0,0 +1,134 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { SyllableSDKCore } from "../core.js";
6
+ import { encodeJSON } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import * as components from "../models/components/index.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
22
+ import { SDKError } from "../models/errors/sdkerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import { Result } from "../types/fp.js";
25
+
26
+ /**
27
+ * Update Data Source
28
+ *
29
+ * @remarks
30
+ * Update an existing data source.
31
+ */
32
+ export async function v1Update(
33
+ client: SyllableSDKCore,
34
+ request: components.DataSourceUpdateRequest,
35
+ options?: RequestOptions,
36
+ ): Promise<
37
+ Result<
38
+ components.DataSourceDetailResponse,
39
+ | errors.HTTPValidationError
40
+ | SDKError
41
+ | SDKValidationError
42
+ | UnexpectedClientError
43
+ | InvalidRequestError
44
+ | RequestAbortedError
45
+ | RequestTimeoutError
46
+ | ConnectionError
47
+ >
48
+ > {
49
+ const parsed = safeParse(
50
+ request,
51
+ (value) => components.DataSourceUpdateRequest$outboundSchema.parse(value),
52
+ "Input validation failed",
53
+ );
54
+ if (!parsed.ok) {
55
+ return parsed;
56
+ }
57
+ const payload = parsed.value;
58
+ const body = encodeJSON("body", payload, { explode: true });
59
+
60
+ const path = pathToFunc("/api/v1/data_sources/")();
61
+
62
+ const headers = new Headers(compactMap({
63
+ "Content-Type": "application/json",
64
+ Accept: "application/json",
65
+ }));
66
+
67
+ const secConfig = await extractSecurity(client._options.apiKeyHeader);
68
+ const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig };
69
+ const requestSecurity = resolveGlobalSecurity(securityInput);
70
+
71
+ const context = {
72
+ operationID: "data_sources_update",
73
+ oAuth2Scopes: [],
74
+
75
+ resolvedSecurity: requestSecurity,
76
+
77
+ securitySource: client._options.apiKeyHeader,
78
+ retryConfig: options?.retries
79
+ || client._options.retryConfig
80
+ || { strategy: "none" },
81
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
82
+ };
83
+
84
+ const requestRes = client._createRequest(context, {
85
+ security: requestSecurity,
86
+ method: "PUT",
87
+ baseURL: options?.serverURL,
88
+ path: path,
89
+ headers: headers,
90
+ body: body,
91
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
92
+ }, options);
93
+ if (!requestRes.ok) {
94
+ return requestRes;
95
+ }
96
+ const req = requestRes.value;
97
+
98
+ const doResult = await client._do(req, {
99
+ context,
100
+ errorCodes: ["422", "4XX", "5XX"],
101
+ retryConfig: context.retryConfig,
102
+ retryCodes: context.retryCodes,
103
+ });
104
+ if (!doResult.ok) {
105
+ return doResult;
106
+ }
107
+ const response = doResult.value;
108
+
109
+ const responseFields = {
110
+ HttpMeta: { Response: response, Request: req },
111
+ };
112
+
113
+ const [result] = await M.match<
114
+ components.DataSourceDetailResponse,
115
+ | errors.HTTPValidationError
116
+ | SDKError
117
+ | SDKValidationError
118
+ | UnexpectedClientError
119
+ | InvalidRequestError
120
+ | RequestAbortedError
121
+ | RequestTimeoutError
122
+ | ConnectionError
123
+ >(
124
+ M.json(200, components.DataSourceDetailResponse$inboundSchema),
125
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
126
+ M.fail("4XX"),
127
+ M.fail("5XX"),
128
+ )(response, { extraFields: responseFields });
129
+ if (!result.ok) {
130
+ return result;
131
+ }
132
+
133
+ return result;
134
+ }
package/src/lib/config.ts CHANGED
@@ -61,8 +61,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
61
61
  export const SDK_METADATA = {
62
62
  language: "typescript",
63
63
  openapiDocVersion: "0.0.2",
64
- sdkVersion: "0.1.0-alpha.34",
65
- genVersion: "2.493.21",
64
+ sdkVersion: "0.1.0-alpha.36",
65
+ genVersion: "2.500.5",
66
66
  userAgent:
67
- "speakeasy-sdk/typescript 0.1.0-alpha.34 2.493.21 0.0.2 syllable-sdk",
67
+ "speakeasy-sdk/typescript 0.1.0-alpha.36 2.500.5 0.0.2 syllable-sdk",
68
68
  } as const;
@@ -158,7 +158,6 @@ async function retryBackoff(
158
158
  const start = Date.now();
159
159
  let x = 0;
160
160
 
161
- // eslint-disable-next-line no-constant-condition
162
161
  while (true) {
163
162
  try {
164
163
  const res = await fn();
@@ -57,6 +57,7 @@ export function collectExtraKeys<
57
57
  >(
58
58
  obj: ZodObject<Shape, "strip", Catchall>,
59
59
  extrasKey: K,
60
+ optional: boolean,
60
61
  ): ZodEffects<
61
62
  typeof obj,
62
63
  & output<ZodObject<Shape, "strict">>
@@ -81,6 +82,10 @@ export function collectExtraKeys<
81
82
  delete val[key];
82
83
  }
83
84
 
85
+ if (optional && Object.keys(extras).length === 0) {
86
+ return val;
87
+ }
88
+
84
89
  return { ...val, [extrasKey]: extras };
85
90
  });
86
91
  }
@@ -14,8 +14,6 @@ import {
14
14
  AgentToolDefaults$outboundSchema,
15
15
  } from "./agenttooldefaults.js";
16
16
 
17
- export type Variables = {};
18
-
19
17
  export type AgentCreate = {
20
18
  /**
21
19
  * The agent name
@@ -56,57 +54,13 @@ export type AgentCreate = {
56
54
  /**
57
55
  * Custom context variables for the conversation session. Keys should be prefixed with "vars.".
58
56
  */
59
- variables: Variables | null;
57
+ variables: { [k: string]: string };
60
58
  /**
61
59
  * Optional headers to include in tool calls for agent.
62
60
  */
63
61
  toolHeaders: { [k: string]: string } | null;
64
62
  };
65
63
 
66
- /** @internal */
67
- export const Variables$inboundSchema: z.ZodType<
68
- Variables,
69
- z.ZodTypeDef,
70
- unknown
71
- > = z.object({});
72
-
73
- /** @internal */
74
- export type Variables$Outbound = {};
75
-
76
- /** @internal */
77
- export const Variables$outboundSchema: z.ZodType<
78
- Variables$Outbound,
79
- z.ZodTypeDef,
80
- Variables
81
- > = z.object({});
82
-
83
- /**
84
- * @internal
85
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
86
- */
87
- export namespace Variables$ {
88
- /** @deprecated use `Variables$inboundSchema` instead. */
89
- export const inboundSchema = Variables$inboundSchema;
90
- /** @deprecated use `Variables$outboundSchema` instead. */
91
- export const outboundSchema = Variables$outboundSchema;
92
- /** @deprecated use `Variables$Outbound` instead. */
93
- export type Outbound = Variables$Outbound;
94
- }
95
-
96
- export function variablesToJSON(variables: Variables): string {
97
- return JSON.stringify(Variables$outboundSchema.parse(variables));
98
- }
99
-
100
- export function variablesFromJSON(
101
- jsonString: string,
102
- ): SafeParseResult<Variables, SDKValidationError> {
103
- return safeParse(
104
- jsonString,
105
- (x) => Variables$inboundSchema.parse(JSON.parse(x)),
106
- `Failed to parse 'Variables' from JSON`,
107
- );
108
- }
109
-
110
64
  /** @internal */
111
65
  export const AgentCreate$inboundSchema: z.ZodType<
112
66
  AgentCreate,
@@ -122,7 +76,7 @@ export const AgentCreate$inboundSchema: z.ZodType<
122
76
  timezone: z.string(),
123
77
  prompt_tool_defaults: z.array(AgentToolDefaults$inboundSchema).optional(),
124
78
  languages: z.array(z.string()).optional(),
125
- variables: z.nullable(z.lazy(() => Variables$inboundSchema)),
79
+ variables: z.record(z.string()),
126
80
  tool_headers: z.nullable(z.record(z.string())),
127
81
  }).transform((v) => {
128
82
  return remap$(v, {
@@ -144,7 +98,7 @@ export type AgentCreate$Outbound = {
144
98
  timezone: string;
145
99
  prompt_tool_defaults?: Array<AgentToolDefaults$Outbound> | undefined;
146
100
  languages?: Array<string> | undefined;
147
- variables: Variables$Outbound | null;
101
+ variables: { [k: string]: string };
148
102
  tool_headers: { [k: string]: string } | null;
149
103
  };
150
104
 
@@ -163,7 +117,7 @@ export const AgentCreate$outboundSchema: z.ZodType<
163
117
  timezone: z.string(),
164
118
  promptToolDefaults: z.array(AgentToolDefaults$outboundSchema).optional(),
165
119
  languages: z.array(z.string()).optional(),
166
- variables: z.nullable(z.lazy(() => Variables$outboundSchema)),
120
+ variables: z.record(z.string()),
167
121
  toolHeaders: z.nullable(z.record(z.string())),
168
122
  }).transform((v) => {
169
123
  return remap$(v, {
@@ -14,8 +14,6 @@ import {
14
14
  AgentToolDefaults$outboundSchema,
15
15
  } from "./agenttooldefaults.js";
16
16
 
17
- export type AgentUpdateVariables = {};
18
-
19
17
  export type AgentUpdate = {
20
18
  /**
21
19
  * The agent name
@@ -56,7 +54,7 @@ export type AgentUpdate = {
56
54
  /**
57
55
  * Custom context variables for the conversation session. Keys should be prefixed with "vars.".
58
56
  */
59
- variables: AgentUpdateVariables | null;
57
+ variables: { [k: string]: string };
60
58
  /**
61
59
  * Optional headers to include in tool calls for agent.
62
60
  */
@@ -67,54 +65,6 @@ export type AgentUpdate = {
67
65
  id: number;
68
66
  };
69
67
 
70
- /** @internal */
71
- export const AgentUpdateVariables$inboundSchema: z.ZodType<
72
- AgentUpdateVariables,
73
- z.ZodTypeDef,
74
- unknown
75
- > = z.object({});
76
-
77
- /** @internal */
78
- export type AgentUpdateVariables$Outbound = {};
79
-
80
- /** @internal */
81
- export const AgentUpdateVariables$outboundSchema: z.ZodType<
82
- AgentUpdateVariables$Outbound,
83
- z.ZodTypeDef,
84
- AgentUpdateVariables
85
- > = z.object({});
86
-
87
- /**
88
- * @internal
89
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
90
- */
91
- export namespace AgentUpdateVariables$ {
92
- /** @deprecated use `AgentUpdateVariables$inboundSchema` instead. */
93
- export const inboundSchema = AgentUpdateVariables$inboundSchema;
94
- /** @deprecated use `AgentUpdateVariables$outboundSchema` instead. */
95
- export const outboundSchema = AgentUpdateVariables$outboundSchema;
96
- /** @deprecated use `AgentUpdateVariables$Outbound` instead. */
97
- export type Outbound = AgentUpdateVariables$Outbound;
98
- }
99
-
100
- export function agentUpdateVariablesToJSON(
101
- agentUpdateVariables: AgentUpdateVariables,
102
- ): string {
103
- return JSON.stringify(
104
- AgentUpdateVariables$outboundSchema.parse(agentUpdateVariables),
105
- );
106
- }
107
-
108
- export function agentUpdateVariablesFromJSON(
109
- jsonString: string,
110
- ): SafeParseResult<AgentUpdateVariables, SDKValidationError> {
111
- return safeParse(
112
- jsonString,
113
- (x) => AgentUpdateVariables$inboundSchema.parse(JSON.parse(x)),
114
- `Failed to parse 'AgentUpdateVariables' from JSON`,
115
- );
116
- }
117
-
118
68
  /** @internal */
119
69
  export const AgentUpdate$inboundSchema: z.ZodType<
120
70
  AgentUpdate,
@@ -130,7 +80,7 @@ export const AgentUpdate$inboundSchema: z.ZodType<
130
80
  timezone: z.string(),
131
81
  prompt_tool_defaults: z.array(AgentToolDefaults$inboundSchema).optional(),
132
82
  languages: z.array(z.string()).optional(),
133
- variables: z.nullable(z.lazy(() => AgentUpdateVariables$inboundSchema)),
83
+ variables: z.record(z.string()),
134
84
  tool_headers: z.nullable(z.record(z.string())),
135
85
  id: z.number().int(),
136
86
  }).transform((v) => {
@@ -153,7 +103,7 @@ export type AgentUpdate$Outbound = {
153
103
  timezone: string;
154
104
  prompt_tool_defaults?: Array<AgentToolDefaults$Outbound> | undefined;
155
105
  languages?: Array<string> | undefined;
156
- variables: AgentUpdateVariables$Outbound | null;
106
+ variables: { [k: string]: string };
157
107
  tool_headers: { [k: string]: string } | null;
158
108
  id: number;
159
109
  };
@@ -173,7 +123,7 @@ export const AgentUpdate$outboundSchema: z.ZodType<
173
123
  timezone: z.string(),
174
124
  promptToolDefaults: z.array(AgentToolDefaults$outboundSchema).optional(),
175
125
  languages: z.array(z.string()).optional(),
176
- variables: z.nullable(z.lazy(() => AgentUpdateVariables$outboundSchema)),
126
+ variables: z.record(z.string()),
177
127
  toolHeaders: z.nullable(z.record(z.string())),
178
128
  id: z.number().int(),
179
129
  }).transform((v) => {