codemie-sdk 0.1.440 → 0.1.443
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +135 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +174 -171
- package/dist/index.d.ts +174 -171
- package/dist/index.js +134 -123
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
package/dist/index.cjs
CHANGED
|
@@ -72,6 +72,7 @@ __export(index_exports, {
|
|
|
72
72
|
NotFoundError: () => NotFoundError,
|
|
73
73
|
PaginatedAnalyticsQueryParamsSchema: () => PaginatedAnalyticsQueryParamsSchema,
|
|
74
74
|
SkillCategory: () => SkillCategory,
|
|
75
|
+
SkillListParamsSchema: () => SkillListParamsSchema,
|
|
75
76
|
SkillScopeFilter: () => SkillScopeFilter,
|
|
76
77
|
SkillService: () => SkillService,
|
|
77
78
|
SkillSortBy: () => SkillSortBy,
|
|
@@ -131,14 +132,20 @@ var _KeycloakCredentials = class _KeycloakCredentials {
|
|
|
131
132
|
} else {
|
|
132
133
|
payload = this.createClientCredentialsPayload();
|
|
133
134
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
135
|
+
try {
|
|
136
|
+
const { data } = await import_axios.default.post(url, this.createSearchParams(payload), {
|
|
137
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
138
|
+
httpsAgent: this.httpAgent
|
|
139
|
+
});
|
|
140
|
+
this.cachedToken = data.access_token;
|
|
141
|
+
const expiresIn = data.expires_in ?? 300;
|
|
142
|
+
this.tokenExpiresAt = now + expiresIn * 1e3 - _KeycloakCredentials.TOKEN_EXPIRY_BUFFER_MS;
|
|
143
|
+
return this.cachedToken;
|
|
144
|
+
} catch (err) {
|
|
145
|
+
const axiosErr = err;
|
|
146
|
+
const reason = axiosErr.message ?? String(err);
|
|
147
|
+
throw new Error(`Cannot connect to Keycloak at ${url}: ${reason}`);
|
|
148
|
+
}
|
|
142
149
|
}
|
|
143
150
|
clearCache() {
|
|
144
151
|
this.cachedToken = null;
|
|
@@ -338,7 +345,7 @@ var ApiRequestHandler = class {
|
|
|
338
345
|
throw new ApiError(errorMessage2 || "Validation error", status, data);
|
|
339
346
|
}
|
|
340
347
|
const errorMessage = [data.error?.message, data.error?.detail, data.error?.help].filter(Boolean).join(". ");
|
|
341
|
-
throw new ApiError(errorMessage
|
|
348
|
+
throw new ApiError(errorMessage || `HTTP ${status} error`, status, data);
|
|
342
349
|
}
|
|
343
350
|
};
|
|
344
351
|
|
|
@@ -547,6 +554,7 @@ var AssistantCreateParamsSchema = import_zod2.z.object({
|
|
|
547
554
|
})
|
|
548
555
|
),
|
|
549
556
|
assistant_ids: import_zod2.z.array(import_zod2.z.string()),
|
|
557
|
+
skill_ids: import_zod2.z.array(import_zod2.z.string()).optional(),
|
|
550
558
|
prompt_variables: import_zod2.z.array(PromptVariableSchema).optional().default([]),
|
|
551
559
|
categories: import_zod2.z.array(import_zod2.z.string()).max(3).optional(),
|
|
552
560
|
skip_integration_validation: import_zod2.z.boolean().optional().default(false)
|
|
@@ -1317,7 +1325,8 @@ var DatasourceService = class {
|
|
|
1317
1325
|
"/v1/index",
|
|
1318
1326
|
queryParams
|
|
1319
1327
|
);
|
|
1320
|
-
|
|
1328
|
+
const items = Array.isArray(response?.data) ? response.data : [];
|
|
1329
|
+
return items.map(DatasourceMapper.mapDatasourceResponse);
|
|
1321
1330
|
}
|
|
1322
1331
|
/**
|
|
1323
1332
|
* Get datasource by ID.
|
|
@@ -1527,7 +1536,7 @@ var IntegrationService = class {
|
|
|
1527
1536
|
this.getBasePath(settingType),
|
|
1528
1537
|
queryParams
|
|
1529
1538
|
);
|
|
1530
|
-
return response.data;
|
|
1539
|
+
return Array.isArray(response?.data) ? response.data : [];
|
|
1531
1540
|
}
|
|
1532
1541
|
/**
|
|
1533
1542
|
* Get integration by ID.
|
|
@@ -1614,114 +1623,6 @@ var LLMService = class {
|
|
|
1614
1623
|
}
|
|
1615
1624
|
};
|
|
1616
1625
|
|
|
1617
|
-
// src/services/task.ts
|
|
1618
|
-
var TaskService = class {
|
|
1619
|
-
constructor(config) {
|
|
1620
|
-
this.api = new ApiRequestHandler(config);
|
|
1621
|
-
}
|
|
1622
|
-
/**
|
|
1623
|
-
* Get a background task by ID.
|
|
1624
|
-
*/
|
|
1625
|
-
async get(taskId) {
|
|
1626
|
-
return this.api.get(`/v1/tasks/${taskId}`);
|
|
1627
|
-
}
|
|
1628
|
-
};
|
|
1629
|
-
|
|
1630
|
-
// src/mappers/user.mapper.ts
|
|
1631
|
-
var UserMapper = class {
|
|
1632
|
-
static mapAboutUserResponse(response) {
|
|
1633
|
-
return omitUndefined({
|
|
1634
|
-
user_id: response.user_id,
|
|
1635
|
-
name: response.name,
|
|
1636
|
-
username: response.username,
|
|
1637
|
-
email: response.email,
|
|
1638
|
-
is_admin: response.is_admin,
|
|
1639
|
-
applications: response.applications,
|
|
1640
|
-
applications_admin: response.applications_admin,
|
|
1641
|
-
picture: response.picture,
|
|
1642
|
-
knowledge_bases: response.knowledge_bases
|
|
1643
|
-
});
|
|
1644
|
-
}
|
|
1645
|
-
};
|
|
1646
|
-
|
|
1647
|
-
// src/services/user.ts
|
|
1648
|
-
var UserService = class {
|
|
1649
|
-
constructor(config) {
|
|
1650
|
-
this.api = new ApiRequestHandler(config);
|
|
1651
|
-
}
|
|
1652
|
-
/**
|
|
1653
|
-
* Get current user profile.
|
|
1654
|
-
*/
|
|
1655
|
-
async aboutMe() {
|
|
1656
|
-
const response = await this.api.get("/v1/user");
|
|
1657
|
-
return UserMapper.mapAboutUserResponse(response);
|
|
1658
|
-
}
|
|
1659
|
-
/**
|
|
1660
|
-
* Get user data and preferences.
|
|
1661
|
-
*/
|
|
1662
|
-
async getData() {
|
|
1663
|
-
return this.api.get("/v1/user/data");
|
|
1664
|
-
}
|
|
1665
|
-
};
|
|
1666
|
-
|
|
1667
|
-
// src/services/category.ts
|
|
1668
|
-
var CategoryService = class {
|
|
1669
|
-
constructor(config) {
|
|
1670
|
-
this.api = new ApiRequestHandler(config);
|
|
1671
|
-
}
|
|
1672
|
-
/**
|
|
1673
|
-
* Get all available assistant categories (legacy, non-paginated).
|
|
1674
|
-
* Public endpoint — no admin access required.
|
|
1675
|
-
* GET /v1/assistants/categories
|
|
1676
|
-
*/
|
|
1677
|
-
async getCategories() {
|
|
1678
|
-
return this.api.get("/v1/assistants/categories");
|
|
1679
|
-
}
|
|
1680
|
-
/**
|
|
1681
|
-
* Get paginated list of categories with marketplace/project assistant counts.
|
|
1682
|
-
* Admin access required.
|
|
1683
|
-
* GET /v1/assistants/categories/list
|
|
1684
|
-
*/
|
|
1685
|
-
async listCategories(page = 0, perPage = 10) {
|
|
1686
|
-
return this.api.get("/v1/assistants/categories/list", {
|
|
1687
|
-
page,
|
|
1688
|
-
per_page: perPage
|
|
1689
|
-
});
|
|
1690
|
-
}
|
|
1691
|
-
/**
|
|
1692
|
-
* Get a specific category by ID with assistant counts.
|
|
1693
|
-
* Admin access required.
|
|
1694
|
-
* GET /v1/assistants/categories/{id}
|
|
1695
|
-
*/
|
|
1696
|
-
async getCategory(categoryId) {
|
|
1697
|
-
return this.api.get(`/v1/assistants/categories/${categoryId}`);
|
|
1698
|
-
}
|
|
1699
|
-
/**
|
|
1700
|
-
* Create a new category. The ID is auto-generated from the name.
|
|
1701
|
-
* Admin access required.
|
|
1702
|
-
* POST /v1/assistants/categories
|
|
1703
|
-
*/
|
|
1704
|
-
async createCategory(params) {
|
|
1705
|
-
return this.api.post("/v1/assistants/categories", params);
|
|
1706
|
-
}
|
|
1707
|
-
/**
|
|
1708
|
-
* Update an existing category.
|
|
1709
|
-
* Admin access required.
|
|
1710
|
-
* PUT /v1/assistants/categories/{id}
|
|
1711
|
-
*/
|
|
1712
|
-
async updateCategory(categoryId, params) {
|
|
1713
|
-
return this.api.put(`/v1/assistants/categories/${categoryId}`, params);
|
|
1714
|
-
}
|
|
1715
|
-
/**
|
|
1716
|
-
* Delete a category. Fails with 409 if any assistants are assigned to it.
|
|
1717
|
-
* Admin access required.
|
|
1718
|
-
* DELETE /v1/assistants/categories/{id}
|
|
1719
|
-
*/
|
|
1720
|
-
async deleteCategory(categoryId) {
|
|
1721
|
-
return this.api.delete(`/v1/assistants/categories/${categoryId}`);
|
|
1722
|
-
}
|
|
1723
|
-
};
|
|
1724
|
-
|
|
1725
1626
|
// src/schemas/skill.ts
|
|
1726
1627
|
var import_zod6 = require("zod");
|
|
1727
1628
|
|
|
@@ -1915,6 +1816,114 @@ var SkillService = class {
|
|
|
1915
1816
|
}
|
|
1916
1817
|
};
|
|
1917
1818
|
|
|
1819
|
+
// src/services/task.ts
|
|
1820
|
+
var TaskService = class {
|
|
1821
|
+
constructor(config) {
|
|
1822
|
+
this.api = new ApiRequestHandler(config);
|
|
1823
|
+
}
|
|
1824
|
+
/**
|
|
1825
|
+
* Get a background task by ID.
|
|
1826
|
+
*/
|
|
1827
|
+
async get(taskId) {
|
|
1828
|
+
return this.api.get(`/v1/tasks/${taskId}`);
|
|
1829
|
+
}
|
|
1830
|
+
};
|
|
1831
|
+
|
|
1832
|
+
// src/mappers/user.mapper.ts
|
|
1833
|
+
var UserMapper = class {
|
|
1834
|
+
static mapAboutUserResponse(response) {
|
|
1835
|
+
return omitUndefined({
|
|
1836
|
+
user_id: response.user_id,
|
|
1837
|
+
name: response.name,
|
|
1838
|
+
username: response.username,
|
|
1839
|
+
email: response.email,
|
|
1840
|
+
is_admin: response.is_admin,
|
|
1841
|
+
applications: response.applications,
|
|
1842
|
+
applications_admin: response.applications_admin,
|
|
1843
|
+
picture: response.picture,
|
|
1844
|
+
knowledge_bases: response.knowledge_bases
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
};
|
|
1848
|
+
|
|
1849
|
+
// src/services/user.ts
|
|
1850
|
+
var UserService = class {
|
|
1851
|
+
constructor(config) {
|
|
1852
|
+
this.api = new ApiRequestHandler(config);
|
|
1853
|
+
}
|
|
1854
|
+
/**
|
|
1855
|
+
* Get current user profile.
|
|
1856
|
+
*/
|
|
1857
|
+
async aboutMe() {
|
|
1858
|
+
const response = await this.api.get("/v1/user");
|
|
1859
|
+
return UserMapper.mapAboutUserResponse(response);
|
|
1860
|
+
}
|
|
1861
|
+
/**
|
|
1862
|
+
* Get user data and preferences.
|
|
1863
|
+
*/
|
|
1864
|
+
async getData() {
|
|
1865
|
+
return this.api.get("/v1/user/data");
|
|
1866
|
+
}
|
|
1867
|
+
};
|
|
1868
|
+
|
|
1869
|
+
// src/services/category.ts
|
|
1870
|
+
var CategoryService = class {
|
|
1871
|
+
constructor(config) {
|
|
1872
|
+
this.api = new ApiRequestHandler(config);
|
|
1873
|
+
}
|
|
1874
|
+
/**
|
|
1875
|
+
* Get all available assistant categories (legacy, non-paginated).
|
|
1876
|
+
* Public endpoint — no admin access required.
|
|
1877
|
+
* GET /v1/assistants/categories
|
|
1878
|
+
*/
|
|
1879
|
+
async getCategories() {
|
|
1880
|
+
return this.api.get("/v1/assistants/categories");
|
|
1881
|
+
}
|
|
1882
|
+
/**
|
|
1883
|
+
* Get paginated list of categories with marketplace/project assistant counts.
|
|
1884
|
+
* Admin access required.
|
|
1885
|
+
* GET /v1/assistants/categories/list
|
|
1886
|
+
*/
|
|
1887
|
+
async listCategories(page = 0, perPage = 10) {
|
|
1888
|
+
return this.api.get("/v1/assistants/categories/list", {
|
|
1889
|
+
page,
|
|
1890
|
+
per_page: perPage
|
|
1891
|
+
});
|
|
1892
|
+
}
|
|
1893
|
+
/**
|
|
1894
|
+
* Get a specific category by ID with assistant counts.
|
|
1895
|
+
* Admin access required.
|
|
1896
|
+
* GET /v1/assistants/categories/{id}
|
|
1897
|
+
*/
|
|
1898
|
+
async getCategory(categoryId) {
|
|
1899
|
+
return this.api.get(`/v1/assistants/categories/${categoryId}`);
|
|
1900
|
+
}
|
|
1901
|
+
/**
|
|
1902
|
+
* Create a new category. The ID is auto-generated from the name.
|
|
1903
|
+
* Admin access required.
|
|
1904
|
+
* POST /v1/assistants/categories
|
|
1905
|
+
*/
|
|
1906
|
+
async createCategory(params) {
|
|
1907
|
+
return this.api.post("/v1/assistants/categories", params);
|
|
1908
|
+
}
|
|
1909
|
+
/**
|
|
1910
|
+
* Update an existing category.
|
|
1911
|
+
* Admin access required.
|
|
1912
|
+
* PUT /v1/assistants/categories/{id}
|
|
1913
|
+
*/
|
|
1914
|
+
async updateCategory(categoryId, params) {
|
|
1915
|
+
return this.api.put(`/v1/assistants/categories/${categoryId}`, params);
|
|
1916
|
+
}
|
|
1917
|
+
/**
|
|
1918
|
+
* Delete a category. Fails with 409 if any assistants are assigned to it.
|
|
1919
|
+
* Admin access required.
|
|
1920
|
+
* DELETE /v1/assistants/categories/{id}
|
|
1921
|
+
*/
|
|
1922
|
+
async deleteCategory(categoryId) {
|
|
1923
|
+
return this.api.delete(`/v1/assistants/categories/${categoryId}`);
|
|
1924
|
+
}
|
|
1925
|
+
};
|
|
1926
|
+
|
|
1918
1927
|
// src/mappers/workflow.mapper.ts
|
|
1919
1928
|
var WorkflowMapper = class {
|
|
1920
1929
|
static mapWorkflowResponse(response) {
|
|
@@ -2128,7 +2137,8 @@ var WorkflowService = class {
|
|
|
2128
2137
|
*/
|
|
2129
2138
|
async getPrebuilt() {
|
|
2130
2139
|
const response = await this.api.get("/v1/workflows/prebuilt");
|
|
2131
|
-
|
|
2140
|
+
const prebuiltItems = Array.isArray(response) ? response : [];
|
|
2141
|
+
return prebuiltItems.map(WorkflowMapper.mapWorkflowResponse);
|
|
2132
2142
|
}
|
|
2133
2143
|
/**
|
|
2134
2144
|
* Create a new workflow.
|
|
@@ -2162,7 +2172,8 @@ var WorkflowService = class {
|
|
|
2162
2172
|
"/v1/workflows",
|
|
2163
2173
|
queryParams
|
|
2164
2174
|
);
|
|
2165
|
-
|
|
2175
|
+
const items = Array.isArray(workflows?.data) ? workflows.data : [];
|
|
2176
|
+
return items.map(WorkflowMapper.mapWorkflowResponse);
|
|
2166
2177
|
}
|
|
2167
2178
|
/**
|
|
2168
2179
|
* Get workflow by ID.
|
|
@@ -2255,9 +2266,9 @@ var CodeMieClient = class {
|
|
|
2255
2266
|
this._integrations = new IntegrationService(authConfig);
|
|
2256
2267
|
this._llms = new LLMService(authConfig);
|
|
2257
2268
|
this._tasks = new TaskService(authConfig);
|
|
2269
|
+
this._skills = new SkillService(authConfig);
|
|
2258
2270
|
this._users = new UserService(authConfig);
|
|
2259
2271
|
this._categories = new CategoryService(authConfig);
|
|
2260
|
-
this._skills = new SkillService(authConfig);
|
|
2261
2272
|
this._workflows = new WorkflowService(authConfig);
|
|
2262
2273
|
}
|
|
2263
2274
|
/**
|
|
@@ -2405,10 +2416,10 @@ var CodeMieClient = class {
|
|
|
2405
2416
|
this._files = new FileService(authConfig);
|
|
2406
2417
|
this._integrations = new IntegrationService(authConfig);
|
|
2407
2418
|
this._llms = new LLMService(authConfig);
|
|
2419
|
+
this._skills = new SkillService(authConfig);
|
|
2408
2420
|
this._tasks = new TaskService(authConfig);
|
|
2409
2421
|
this._users = new UserService(authConfig);
|
|
2410
2422
|
this._categories = new CategoryService(authConfig);
|
|
2411
|
-
this._skills = new SkillService(authConfig);
|
|
2412
2423
|
this._workflows = new WorkflowService(authConfig);
|
|
2413
2424
|
}
|
|
2414
2425
|
};
|
|
@@ -2619,6 +2630,7 @@ var BackgroundTaskStatus = {
|
|
|
2619
2630
|
NotFoundError,
|
|
2620
2631
|
PaginatedAnalyticsQueryParamsSchema,
|
|
2621
2632
|
SkillCategory,
|
|
2633
|
+
SkillListParamsSchema,
|
|
2622
2634
|
SkillScopeFilter,
|
|
2623
2635
|
SkillService,
|
|
2624
2636
|
SkillSortBy,
|