syllable-sdk 0.1.0-alpha.35 → 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.
- package/FUNCTIONS.md +1 -3
- package/README.md +30 -21
- package/docs/sdks/agents/README.md +6 -8
- package/docs/sdks/channels/README.md +2 -6
- package/docs/sdks/conversations/README.md +2 -6
- package/docs/sdks/custommessages/README.md +2 -10
- package/docs/sdks/datasources/README.md +417 -0
- package/docs/sdks/events/README.md +2 -6
- package/docs/sdks/prompts/README.md +2 -10
- package/docs/sdks/services/README.md +2 -6
- package/docs/sdks/sessionlabels/README.md +6 -10
- package/docs/sdks/sessions/README.md +2 -6
- package/docs/sdks/targets/README.md +4 -16
- package/docs/sdks/test/README.md +0 -2
- package/docs/sdks/tools/README.md +2 -6
- package/docs/sdks/v1/README.md +408 -0
- package/funcs/agentsCreate.js +1 -1
- package/funcs/agentsCreate.js.map +1 -1
- package/funcs/agentsDelete.js +1 -1
- package/funcs/agentsDelete.js.map +1 -1
- package/funcs/agentsUpdate.js +1 -1
- package/funcs/agentsUpdate.js.map +1 -1
- package/funcs/dataSourcesCreate.d.ts +16 -0
- package/funcs/dataSourcesCreate.d.ts.map +1 -0
- package/funcs/dataSourcesCreate.js +101 -0
- package/funcs/dataSourcesCreate.js.map +1 -0
- package/funcs/dataSourcesDataSourcesDeleteByName.d.ts +16 -0
- package/funcs/dataSourcesDataSourcesDeleteByName.d.ts.map +1 -0
- package/funcs/dataSourcesDataSourcesDeleteByName.js +111 -0
- package/funcs/dataSourcesDataSourcesDeleteByName.js.map +1 -0
- package/funcs/dataSourcesGetByName.d.ts +17 -0
- package/funcs/dataSourcesGetByName.d.ts.map +1 -0
- package/funcs/dataSourcesGetByName.js +107 -0
- package/funcs/dataSourcesGetByName.js.map +1 -0
- package/funcs/dataSourcesList.d.ts +17 -0
- package/funcs/dataSourcesList.d.ts.map +1 -0
- package/funcs/dataSourcesList.js +113 -0
- package/funcs/dataSourcesList.js.map +1 -0
- package/funcs/dataSourcesUpdate.d.ts +16 -0
- package/funcs/dataSourcesUpdate.d.ts.map +1 -0
- package/funcs/dataSourcesUpdate.js +101 -0
- package/funcs/dataSourcesUpdate.js.map +1 -0
- package/funcs/v1Create.d.ts +16 -0
- package/funcs/v1Create.d.ts.map +1 -0
- package/funcs/v1Create.js +101 -0
- package/funcs/v1Create.js.map +1 -0
- package/funcs/v1DataSourcesDeleteByName.d.ts +16 -0
- package/funcs/v1DataSourcesDeleteByName.d.ts.map +1 -0
- package/funcs/v1DataSourcesDeleteByName.js +111 -0
- package/funcs/v1DataSourcesDeleteByName.js.map +1 -0
- package/funcs/v1GetByName.d.ts +17 -0
- package/funcs/v1GetByName.d.ts.map +1 -0
- package/funcs/v1GetByName.js +107 -0
- package/funcs/v1GetByName.js.map +1 -0
- package/funcs/v1List.d.ts +17 -0
- package/funcs/v1List.d.ts.map +1 -0
- package/funcs/v1List.js +113 -0
- package/funcs/v1List.js.map +1 -0
- package/funcs/v1Update.d.ts +16 -0
- package/funcs/v1Update.d.ts.map +1 -0
- package/funcs/v1Update.js +101 -0
- package/funcs/v1Update.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/lib/config.js.map +1 -1
- package/lib/retries.js +0 -1
- package/lib/retries.js.map +1 -1
- package/models/components/datasourcecreaterequest.d.ts +57 -0
- package/models/components/datasourcecreaterequest.d.ts.map +1 -0
- package/models/components/datasourcecreaterequest.js +78 -0
- package/models/components/datasourcecreaterequest.js.map +1 -0
- package/models/components/datasourcedetailresponse.d.ts +75 -0
- package/models/components/datasourcedetailresponse.d.ts.map +1 -0
- package/models/components/datasourcedetailresponse.js +90 -0
- package/models/components/datasourcedetailresponse.js.map +1 -0
- package/models/components/datasourcemetadataresponse.d.ts +70 -0
- package/models/components/datasourcemetadataresponse.d.ts.map +1 -0
- package/models/components/datasourcemetadataresponse.js +88 -0
- package/models/components/datasourcemetadataresponse.js.map +1 -0
- package/models/components/datasourceproperties.d.ts +43 -0
- package/models/components/datasourceproperties.d.ts.map +1 -0
- package/models/components/datasourceproperties.js +55 -0
- package/models/components/datasourceproperties.js.map +1 -0
- package/models/components/datasourceupdaterequest.d.ts +62 -0
- package/models/components/datasourceupdaterequest.d.ts.map +1 -0
- package/models/components/datasourceupdaterequest.js +82 -0
- package/models/components/datasourceupdaterequest.js.map +1 -0
- package/models/components/index.d.ts +6 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +6 -0
- package/models/components/index.js.map +1 -1
- package/models/components/listresponsedatasourcemetadataresponse.d.ts +38 -0
- package/models/components/listresponsedatasourcemetadataresponse.d.ts.map +1 -0
- package/models/components/listresponsedatasourcemetadataresponse.js +81 -0
- package/models/components/listresponsedatasourcemetadataresponse.js.map +1 -0
- package/models/operations/datasourcesdeletebyname.d.ts +31 -0
- package/models/operations/datasourcesdeletebyname.d.ts.map +1 -0
- package/models/operations/datasourcesdeletebyname.js +61 -0
- package/models/operations/datasourcesdeletebyname.js.map +1 -0
- package/models/operations/datasourcesgetbyname.d.ts +29 -0
- package/models/operations/datasourcesgetbyname.d.ts.map +1 -0
- package/models/operations/datasourcesgetbyname.js +59 -0
- package/models/operations/datasourcesgetbyname.js.map +1 -0
- package/models/operations/datasourceslist.d.ts +46 -0
- package/models/operations/datasourceslist.d.ts.map +1 -0
- package/models/operations/datasourceslist.js +103 -0
- package/models/operations/datasourceslist.js.map +1 -0
- package/models/operations/index.d.ts +3 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +3 -0
- package/models/operations/index.js.map +1 -1
- package/openapi.json +3072 -1596
- package/package.json +6 -7
- package/sdk/datasources.d.ts +41 -0
- package/sdk/datasources.d.ts.map +1 -0
- package/sdk/datasources.js +62 -0
- package/sdk/datasources.js.map +1 -0
- package/sdk/sdk.d.ts +5 -2
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +7 -3
- package/sdk/sdk.js.map +1 -1
- package/sdk/v1.d.ts +36 -0
- package/sdk/v1.d.ts.map +1 -1
- package/sdk/v1.js +50 -0
- package/sdk/v1.js.map +1 -1
- package/src/funcs/agentsCreate.ts +1 -1
- package/src/funcs/agentsDelete.ts +1 -1
- package/src/funcs/agentsUpdate.ts +1 -1
- package/src/funcs/dataSourcesCreate.ts +134 -0
- package/src/funcs/dataSourcesDataSourcesDeleteByName.ts +147 -0
- package/src/funcs/dataSourcesGetByName.ts +142 -0
- package/src/funcs/dataSourcesList.ts +150 -0
- package/src/funcs/dataSourcesUpdate.ts +134 -0
- package/src/funcs/v1Create.ts +134 -0
- package/src/funcs/v1DataSourcesDeleteByName.ts +147 -0
- package/src/funcs/v1GetByName.ts +142 -0
- package/src/funcs/v1List.ts +150 -0
- package/src/funcs/v1Update.ts +134 -0
- package/src/lib/config.ts +3 -3
- package/src/lib/retries.ts +0 -1
- package/src/models/components/datasourcecreaterequest.ts +113 -0
- package/src/models/components/datasourcedetailresponse.ts +143 -0
- package/src/models/components/datasourcemetadataresponse.ts +136 -0
- package/src/models/components/datasourceproperties.ts +38 -0
- package/src/models/components/datasourceupdaterequest.ts +122 -0
- package/src/models/components/index.ts +6 -0
- package/src/models/components/listresponsedatasourcemetadataresponse.ts +107 -0
- package/src/models/operations/datasourcesdeletebyname.ts +72 -0
- package/src/models/operations/datasourcesgetbyname.ts +68 -0
- package/src/models/operations/datasourceslist.ts +126 -0
- package/src/models/operations/index.ts +3 -0
- package/src/sdk/datasources.ts +100 -0
- package/src/sdk/sdk.ts +11 -5
- 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.
|
|
65
|
-
genVersion: "2.
|
|
64
|
+
sdkVersion: "0.1.0-alpha.36",
|
|
65
|
+
genVersion: "2.500.5",
|
|
66
66
|
userAgent:
|
|
67
|
-
"speakeasy-sdk/typescript 0.1.0-alpha.
|
|
67
|
+
"speakeasy-sdk/typescript 0.1.0-alpha.36 2.500.5 0.0.2 syllable-sdk",
|
|
68
68
|
} as const;
|
package/src/lib/retries.ts
CHANGED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type DataSourceCreateRequest = {
|
|
12
|
+
/**
|
|
13
|
+
* The data source name. Must be unique within suborg.
|
|
14
|
+
*/
|
|
15
|
+
name: string;
|
|
16
|
+
/**
|
|
17
|
+
* The description of the data source.
|
|
18
|
+
*/
|
|
19
|
+
description?: string | null | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Searchable labels for the data source. Can be included in agent.prompt_tool_defaults for a given tool to give the agent access to data sources with those labels when calling that tool.
|
|
22
|
+
*/
|
|
23
|
+
labels?: Array<string> | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the content should be split into smaller chunks. This can improve agent performance when searching a large data source but risks some relevant information being left off search results if chunk_delimiter is not set up properly.
|
|
26
|
+
*/
|
|
27
|
+
chunk: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* String that should be treated as delimiter between intended chunks if chunk == True. This string will not be included in any chunks. If chunk == True and chunk_delimiter is None, the default chunking algorithm will be used. It is recommended that a delimiter be specified if chunking is enabled.
|
|
30
|
+
*/
|
|
31
|
+
chunkDelimiter?: string | null | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Information that the data source will provide to the agent accessing it.
|
|
34
|
+
*/
|
|
35
|
+
text: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** @internal */
|
|
39
|
+
export const DataSourceCreateRequest$inboundSchema: z.ZodType<
|
|
40
|
+
DataSourceCreateRequest,
|
|
41
|
+
z.ZodTypeDef,
|
|
42
|
+
unknown
|
|
43
|
+
> = z.object({
|
|
44
|
+
name: z.string(),
|
|
45
|
+
description: z.nullable(z.string()).optional(),
|
|
46
|
+
labels: z.array(z.string()).optional(),
|
|
47
|
+
chunk: z.boolean(),
|
|
48
|
+
chunk_delimiter: z.nullable(z.string()).optional(),
|
|
49
|
+
text: z.string(),
|
|
50
|
+
}).transform((v) => {
|
|
51
|
+
return remap$(v, {
|
|
52
|
+
"chunk_delimiter": "chunkDelimiter",
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
/** @internal */
|
|
57
|
+
export type DataSourceCreateRequest$Outbound = {
|
|
58
|
+
name: string;
|
|
59
|
+
description?: string | null | undefined;
|
|
60
|
+
labels?: Array<string> | undefined;
|
|
61
|
+
chunk: boolean;
|
|
62
|
+
chunk_delimiter?: string | null | undefined;
|
|
63
|
+
text: string;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/** @internal */
|
|
67
|
+
export const DataSourceCreateRequest$outboundSchema: z.ZodType<
|
|
68
|
+
DataSourceCreateRequest$Outbound,
|
|
69
|
+
z.ZodTypeDef,
|
|
70
|
+
DataSourceCreateRequest
|
|
71
|
+
> = z.object({
|
|
72
|
+
name: z.string(),
|
|
73
|
+
description: z.nullable(z.string()).optional(),
|
|
74
|
+
labels: z.array(z.string()).optional(),
|
|
75
|
+
chunk: z.boolean(),
|
|
76
|
+
chunkDelimiter: z.nullable(z.string()).optional(),
|
|
77
|
+
text: z.string(),
|
|
78
|
+
}).transform((v) => {
|
|
79
|
+
return remap$(v, {
|
|
80
|
+
chunkDelimiter: "chunk_delimiter",
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
87
|
+
*/
|
|
88
|
+
export namespace DataSourceCreateRequest$ {
|
|
89
|
+
/** @deprecated use `DataSourceCreateRequest$inboundSchema` instead. */
|
|
90
|
+
export const inboundSchema = DataSourceCreateRequest$inboundSchema;
|
|
91
|
+
/** @deprecated use `DataSourceCreateRequest$outboundSchema` instead. */
|
|
92
|
+
export const outboundSchema = DataSourceCreateRequest$outboundSchema;
|
|
93
|
+
/** @deprecated use `DataSourceCreateRequest$Outbound` instead. */
|
|
94
|
+
export type Outbound = DataSourceCreateRequest$Outbound;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function dataSourceCreateRequestToJSON(
|
|
98
|
+
dataSourceCreateRequest: DataSourceCreateRequest,
|
|
99
|
+
): string {
|
|
100
|
+
return JSON.stringify(
|
|
101
|
+
DataSourceCreateRequest$outboundSchema.parse(dataSourceCreateRequest),
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function dataSourceCreateRequestFromJSON(
|
|
106
|
+
jsonString: string,
|
|
107
|
+
): SafeParseResult<DataSourceCreateRequest, SDKValidationError> {
|
|
108
|
+
return safeParse(
|
|
109
|
+
jsonString,
|
|
110
|
+
(x) => DataSourceCreateRequest$inboundSchema.parse(JSON.parse(x)),
|
|
111
|
+
`Failed to parse 'DataSourceCreateRequest' from JSON`,
|
|
112
|
+
);
|
|
113
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Metadata about a data source, along with the text.
|
|
13
|
+
*/
|
|
14
|
+
export type DataSourceDetailResponse = {
|
|
15
|
+
/**
|
|
16
|
+
* The data source name. Must be unique within suborg.
|
|
17
|
+
*/
|
|
18
|
+
name: string;
|
|
19
|
+
/**
|
|
20
|
+
* The description of the data source.
|
|
21
|
+
*/
|
|
22
|
+
description?: string | null | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Searchable labels for the data source. Can be included in agent.prompt_tool_defaults for a given tool to give the agent access to data sources with those labels when calling that tool.
|
|
25
|
+
*/
|
|
26
|
+
labels?: Array<string> | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the content should be split into smaller chunks. This can improve agent performance when searching a large data source but risks some relevant information being left off search results if chunk_delimiter is not set up properly.
|
|
29
|
+
*/
|
|
30
|
+
chunk: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* String that should be treated as delimiter between intended chunks if chunk == True. This string will not be included in any chunks. If chunk == True and chunk_delimiter is None, the default chunking algorithm will be used. It is recommended that a delimiter be specified if chunking is enabled.
|
|
33
|
+
*/
|
|
34
|
+
chunkDelimiter?: string | null | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* The comments for the most recent edit to the data source
|
|
37
|
+
*/
|
|
38
|
+
editComments?: string | null | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Timestamp of most recent update
|
|
41
|
+
*/
|
|
42
|
+
updatedAt: Date;
|
|
43
|
+
/**
|
|
44
|
+
* Email of the user who last updated the data source
|
|
45
|
+
*/
|
|
46
|
+
lastUpdatedBy: string | null;
|
|
47
|
+
/**
|
|
48
|
+
* Information that the data source will provide to the agent accessing it.
|
|
49
|
+
*/
|
|
50
|
+
text: string;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** @internal */
|
|
54
|
+
export const DataSourceDetailResponse$inboundSchema: z.ZodType<
|
|
55
|
+
DataSourceDetailResponse,
|
|
56
|
+
z.ZodTypeDef,
|
|
57
|
+
unknown
|
|
58
|
+
> = z.object({
|
|
59
|
+
name: z.string(),
|
|
60
|
+
description: z.nullable(z.string()).optional(),
|
|
61
|
+
labels: z.array(z.string()).optional(),
|
|
62
|
+
chunk: z.boolean(),
|
|
63
|
+
chunk_delimiter: z.nullable(z.string()).optional(),
|
|
64
|
+
edit_comments: z.nullable(z.string()).optional(),
|
|
65
|
+
updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
66
|
+
last_updated_by: z.nullable(z.string()),
|
|
67
|
+
text: z.string(),
|
|
68
|
+
}).transform((v) => {
|
|
69
|
+
return remap$(v, {
|
|
70
|
+
"chunk_delimiter": "chunkDelimiter",
|
|
71
|
+
"edit_comments": "editComments",
|
|
72
|
+
"updated_at": "updatedAt",
|
|
73
|
+
"last_updated_by": "lastUpdatedBy",
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
/** @internal */
|
|
78
|
+
export type DataSourceDetailResponse$Outbound = {
|
|
79
|
+
name: string;
|
|
80
|
+
description?: string | null | undefined;
|
|
81
|
+
labels?: Array<string> | undefined;
|
|
82
|
+
chunk: boolean;
|
|
83
|
+
chunk_delimiter?: string | null | undefined;
|
|
84
|
+
edit_comments?: string | null | undefined;
|
|
85
|
+
updated_at: string;
|
|
86
|
+
last_updated_by: string | null;
|
|
87
|
+
text: string;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/** @internal */
|
|
91
|
+
export const DataSourceDetailResponse$outboundSchema: z.ZodType<
|
|
92
|
+
DataSourceDetailResponse$Outbound,
|
|
93
|
+
z.ZodTypeDef,
|
|
94
|
+
DataSourceDetailResponse
|
|
95
|
+
> = z.object({
|
|
96
|
+
name: z.string(),
|
|
97
|
+
description: z.nullable(z.string()).optional(),
|
|
98
|
+
labels: z.array(z.string()).optional(),
|
|
99
|
+
chunk: z.boolean(),
|
|
100
|
+
chunkDelimiter: z.nullable(z.string()).optional(),
|
|
101
|
+
editComments: z.nullable(z.string()).optional(),
|
|
102
|
+
updatedAt: z.date().transform(v => v.toISOString()),
|
|
103
|
+
lastUpdatedBy: z.nullable(z.string()),
|
|
104
|
+
text: z.string(),
|
|
105
|
+
}).transform((v) => {
|
|
106
|
+
return remap$(v, {
|
|
107
|
+
chunkDelimiter: "chunk_delimiter",
|
|
108
|
+
editComments: "edit_comments",
|
|
109
|
+
updatedAt: "updated_at",
|
|
110
|
+
lastUpdatedBy: "last_updated_by",
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @internal
|
|
116
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
117
|
+
*/
|
|
118
|
+
export namespace DataSourceDetailResponse$ {
|
|
119
|
+
/** @deprecated use `DataSourceDetailResponse$inboundSchema` instead. */
|
|
120
|
+
export const inboundSchema = DataSourceDetailResponse$inboundSchema;
|
|
121
|
+
/** @deprecated use `DataSourceDetailResponse$outboundSchema` instead. */
|
|
122
|
+
export const outboundSchema = DataSourceDetailResponse$outboundSchema;
|
|
123
|
+
/** @deprecated use `DataSourceDetailResponse$Outbound` instead. */
|
|
124
|
+
export type Outbound = DataSourceDetailResponse$Outbound;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function dataSourceDetailResponseToJSON(
|
|
128
|
+
dataSourceDetailResponse: DataSourceDetailResponse,
|
|
129
|
+
): string {
|
|
130
|
+
return JSON.stringify(
|
|
131
|
+
DataSourceDetailResponse$outboundSchema.parse(dataSourceDetailResponse),
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function dataSourceDetailResponseFromJSON(
|
|
136
|
+
jsonString: string,
|
|
137
|
+
): SafeParseResult<DataSourceDetailResponse, SDKValidationError> {
|
|
138
|
+
return safeParse(
|
|
139
|
+
jsonString,
|
|
140
|
+
(x) => DataSourceDetailResponse$inboundSchema.parse(JSON.parse(x)),
|
|
141
|
+
`Failed to parse 'DataSourceDetailResponse' from JSON`,
|
|
142
|
+
);
|
|
143
|
+
}
|