@ocxp/client 0.2.5 → 0.2.7

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.js CHANGED
@@ -1185,6 +1185,29 @@ var deleteRepo = (options) => (options.client ?? client).delete({
1185
1185
  url: "/ocxp/repo/{repo_id}",
1186
1186
  ...options
1187
1187
  });
1188
+ var syncAllRepos = (options) => (options?.client ?? client).post({
1189
+ security: [{ scheme: "bearer", type: "http" }],
1190
+ url: "/ocxp/repo/sync-all",
1191
+ ...options,
1192
+ headers: {
1193
+ "Content-Type": "application/json",
1194
+ ...options?.headers
1195
+ }
1196
+ });
1197
+ var getRepoCommits = (options) => (options.client ?? client).get({
1198
+ security: [{ scheme: "bearer", type: "http" }],
1199
+ url: "/ocxp/repo/{repo_id}/commits",
1200
+ ...options
1201
+ });
1202
+ var syncRepo = (options) => (options.client ?? client).post({
1203
+ security: [{ scheme: "bearer", type: "http" }],
1204
+ url: "/ocxp/repo/{repo_id}/sync",
1205
+ ...options,
1206
+ headers: {
1207
+ "Content-Type": "application/json",
1208
+ ...options.headers
1209
+ }
1210
+ });
1188
1211
  var githubCheckAccess = (options) => (options.client ?? client).post({
1189
1212
  security: [{ scheme: "bearer", type: "http" }],
1190
1213
  url: "/ocxp/github/check-access",
@@ -1997,6 +2020,48 @@ var OCXPClient = class {
1997
2020
  });
1998
2021
  return extractData(response);
1999
2022
  }
2023
+ /**
2024
+ * Sync a repository with its remote GitHub branch
2025
+ * @param repoId - Repository ID (owner/repo format)
2026
+ * @param force - Force sync even if no changes detected
2027
+ */
2028
+ async syncRepo(repoId, force = false) {
2029
+ const headers = await this.getHeaders();
2030
+ const response = await syncRepo({
2031
+ client: this.client,
2032
+ path: { repo_id: repoId },
2033
+ body: { force },
2034
+ headers
2035
+ });
2036
+ return extractData(response);
2037
+ }
2038
+ /**
2039
+ * Sync all repositories with their remote GitHub branches
2040
+ * @param force - Force sync all repos even if no changes
2041
+ */
2042
+ async syncAllRepos(force = false) {
2043
+ const headers = await this.getHeaders();
2044
+ const response = await syncAllRepos({
2045
+ client: this.client,
2046
+ body: { force },
2047
+ headers
2048
+ });
2049
+ return extractData(response);
2050
+ }
2051
+ /**
2052
+ * Get commit status for a repository
2053
+ * Shows how many commits behind and lists missing commits
2054
+ * @param repoId - Repository ID (owner/repo format)
2055
+ */
2056
+ async getRepoCommitStatus(repoId) {
2057
+ const headers = await this.getHeaders();
2058
+ const response = await getRepoCommits({
2059
+ client: this.client,
2060
+ path: { repo_id: repoId },
2061
+ headers
2062
+ });
2063
+ return extractData(response);
2064
+ }
2000
2065
  // ============== Database Operations ==============
2001
2066
  /**
2002
2067
  * List all database configurations in workspace
@@ -2506,7 +2571,7 @@ var OCXPClient = class {
2506
2571
  body: { github_token: token }
2507
2572
  });
2508
2573
  if (response.error) {
2509
- throw new Error(`Failed to set GitHub token: ${typeof response.error === "object" ? JSON.stringify(response.error) : response.error}`);
2574
+ throw new Error(`Failed to set GitHub token: ${JSON.stringify(response.error)}`);
2510
2575
  }
2511
2576
  if (response.data === true) {
2512
2577
  return { success: true };
@@ -2519,13 +2584,15 @@ var OCXPClient = class {
2519
2584
  */
2520
2585
  async getGitHubTokenStatus() {
2521
2586
  const headers = await this.getHeaders();
2522
- const response = await this.client.request({
2523
- method: "GET",
2524
- url: "/auth/github-token",
2525
- headers
2526
- });
2587
+ const response = await this.client.request(
2588
+ {
2589
+ method: "GET",
2590
+ url: "/auth/github-token",
2591
+ headers
2592
+ }
2593
+ );
2527
2594
  if (response.error) {
2528
- throw new Error(`Failed to get GitHub token status: ${typeof response.error === "object" ? JSON.stringify(response.error) : response.error}`);
2595
+ throw new Error(`Failed to get GitHub token status: ${JSON.stringify(response.error)}`);
2529
2596
  }
2530
2597
  const data = response.data;
2531
2598
  if (data && typeof data === "object" && "configured" in data) {
@@ -2545,13 +2612,87 @@ var OCXPClient = class {
2545
2612
  headers
2546
2613
  });
2547
2614
  if (response.error) {
2548
- throw new Error(`Failed to delete GitHub token: ${typeof response.error === "object" ? JSON.stringify(response.error) : response.error}`);
2615
+ throw new Error(`Failed to delete GitHub token: ${JSON.stringify(response.error)}`);
2549
2616
  }
2550
2617
  if (response.data === true) {
2551
2618
  return { success: true };
2552
2619
  }
2553
2620
  return response.data || { success: true };
2554
2621
  }
2622
+ // ============== Project Credential Operations ==============
2623
+ /**
2624
+ * Get project credentials for frontend authentication
2625
+ * @param projectId - Project ID
2626
+ * @returns Project credentials
2627
+ */
2628
+ async getProjectCredentials(projectId) {
2629
+ const headers = await this.getHeaders();
2630
+ const response = await this.client.request({
2631
+ method: "GET",
2632
+ url: `/ocxp/project/${projectId}/credentials`,
2633
+ headers
2634
+ });
2635
+ if (response.error) {
2636
+ throw new Error(`Failed to get credentials: ${JSON.stringify(response.error)}`);
2637
+ }
2638
+ return response.data;
2639
+ }
2640
+ /**
2641
+ * Update project credentials for frontend authentication
2642
+ * @param projectId - Project ID
2643
+ * @param updates - Partial credential updates
2644
+ * @returns Updated project credentials
2645
+ */
2646
+ async updateProjectCredentials(projectId, updates) {
2647
+ const headers = await this.getHeaders();
2648
+ const response = await this.client.request({
2649
+ method: "PATCH",
2650
+ url: `/ocxp/project/${projectId}/credentials`,
2651
+ headers,
2652
+ body: updates
2653
+ });
2654
+ if (response.error) {
2655
+ throw new Error(`Failed to update credentials: ${JSON.stringify(response.error)}`);
2656
+ }
2657
+ return response.data;
2658
+ }
2659
+ /**
2660
+ * Test project credentials
2661
+ * @param projectId - Project ID
2662
+ * @returns Test result with success flag and optional message
2663
+ */
2664
+ async testProjectCredentials(projectId) {
2665
+ const headers = await this.getHeaders();
2666
+ const response = await this.client.request({
2667
+ method: "POST",
2668
+ url: `/ocxp/project/${projectId}/credentials/test`,
2669
+ headers
2670
+ });
2671
+ if (response.error) {
2672
+ throw new Error(`Failed to test credentials: ${JSON.stringify(response.error)}`);
2673
+ }
2674
+ const data = response.data;
2675
+ if (data && typeof data === "object" && "success" in data) {
2676
+ return data;
2677
+ }
2678
+ return { success: false };
2679
+ }
2680
+ /**
2681
+ * Delete project credentials
2682
+ * @param projectId - Project ID
2683
+ * @returns void
2684
+ */
2685
+ async deleteProjectCredentials(projectId) {
2686
+ const headers = await this.getHeaders();
2687
+ const response = await this.client.request({
2688
+ method: "DELETE",
2689
+ url: `/ocxp/project/${projectId}/credentials`,
2690
+ headers
2691
+ });
2692
+ if (response.error) {
2693
+ throw new Error(`Failed to delete credentials: ${JSON.stringify(response.error)}`);
2694
+ }
2695
+ }
2555
2696
  // ============== Namespaced Accessors ==============
2556
2697
  _mission;
2557
2698
  _project;
@@ -4176,6 +4317,6 @@ var GithubCommitsDataSchema = z.object({
4176
4317
  });
4177
4318
  var GithubCommitsResponseSchema = createResponseSchema(GithubCommitsDataSchema);
4178
4319
 
4179
- export { AddProjectRepoDataSchema, AddProjectRepoResponseSchema, AuthTokenDataSchema, AuthTokenResponseSchema, AuthUserInfoResponseSchema, AuthUserInfoSchema, AuthValidateDataSchema, AuthValidateResponseSchema, ContentTypeInfoSchema, ContentTypeSchema, ContentTypesDataSchema, ContentTypesResponseSchema, ContextReposDataSchema, ContextReposResponseSchema, CreateProjectDataSchema, CreateProjectResponseSchema, CreateSessionDataSchema, CreateSessionResponseSchema, DeleteDataSchema, DeleteProjectDataSchema, DeleteProjectResponseSchema, DeleteResponseSchema, DiscoveryDataSchema, DiscoveryEndpointSchema, DiscoveryResponseSchema, ErrorResponseSchema, ForkSessionDataSchema, ForkSessionResponseSchema, GetProjectDataSchema, GetProjectResponseSchema, GetSessionMessagesDataSchema, GetSessionMessagesResponseSchema, GithubBranchInfoSchema, GithubBranchesDataSchema, GithubBranchesResponseSchema, GithubCommitInfoSchema, GithubCommitsDataSchema, GithubCommitsResponseSchema, GithubDirectoryDataSchema, GithubDirectoryResponseSchema, GithubFileDataSchema, GithubFileInfoSchema, GithubFileResponseSchema, GithubRepoDataSchema, GithubRepoInfoSchema, GithubRepoResponseSchema, IngestionJobResponseSchema, IngestionJobSchema, KBDocumentSchema, KBIngestDataSchema, KBIngestResponseSchema, KBListDataSchema, KBListResponseSchema, KBNamespace, ListDataSchema, ListEntrySchema, ListProjectsDataSchema, ListProjectsResponseSchema, ListResponseSchema, ListSessionsDataSchema, ListSessionsResponseSchema, MetaSchema, MissionNamespace, OCXPAuthError, OCXPClient, OCXPConflictError, OCXPError, OCXPErrorCode, OCXPNetworkError, OCXPNotFoundError, OCXPPathService, OCXPRateLimitError, OCXPResponseSchema, OCXPTimeoutError, OCXPValidationError, PaginationSchema, PresignedUrlDataSchema, PresignedUrlResponseSchema, ProjectMissionSchema, ProjectNamespace, ProjectRepoSchema, ProjectSchema, PrototypeNamespace, QueryDataSchema, QueryFilterSchema, QueryResponseSchema, ReadDataSchema, ReadResponseSchema, RepoDeleteDataSchema, RepoDeleteResponseSchema, RepoDownloadDataSchema, RepoDownloadRequestSchema, RepoDownloadResponseSchema, RepoExistsDataSchema, RepoExistsResponseSchema, RepoListDataSchema, RepoListItemSchema, RepoListResponseSchema, RepoStatusDataSchema, RepoStatusEnum, RepoStatusResponseSchema, SearchDataSchema, SearchResponseSchema, SearchResultItemSchema, SessionMessageSchema, SessionNamespace, SessionSchema, StatsDataSchema, StatsResponseSchema, TreeDataSchema, TreeNodeSchema, TreeResponseSchema, UpdateProjectDataSchema, UpdateProjectResponseSchema, UpdateSessionMetadataDataSchema, UpdateSessionMetadataResponseSchema, VALID_CONTENT_TYPES, VectorSearchDataSchema, VectorSearchResponseSchema, WSBaseMessageSchema, WSChatMessageSchema, WSChatResponseSchema, WSConnectedSchema, WSErrorMessageSchema, WSMessageSchema, WSMessageTypeSchema, WSPingPongSchema, WSStatusSchema, WSStreamChunkSchema, WSStreamEndSchema, WSStreamStartSchema, WebSocketService, WriteDataSchema, WriteResponseSchema, acknowledgeMemo, addDatabase, addLinkedRepo, addMission, archiveSession, buildPath, bulkDeleteContent, bulkReadContent, bulkWriteContent, createClient, createConfig, createDatabase, createMemo, createOCXPClient, createPathService, createProject, createResponseSchema, createWebSocketService, deleteContent, deleteDatabase, deleteMemo, deleteProject, deleteRepo, downloadRepository, forkSession, getAuthConfig, getCanonicalType, getContentStats, getContentTree, getContentTypes, getContextRepos, getCurrentUser, getDatabase, getMemo, getMemoForSource, getMissionContext, getProject, getProjectDatabases, getPrototypeChat, getRepoDownloadStatus, getSample, getSchema, getSessionMessages, getStoredVersions, getSyncStatus, githubCheckAccess, githubGetContents, githubListBranches, ignoreMemo, isOCXPAuthError, isOCXPConflictError, isOCXPError, isOCXPNetworkError, isOCXPNotFoundError, isOCXPRateLimitError, isOCXPTimeoutError, isOCXPValidationError, isValidContentType, linkPrototypeChat, listContent, listContextDatabases, listDatabases, listDownloadedRepos, listMemos, listProjects, listPrototypeChats, listSessions, listTables, listWorkspaces, lockContent, login, loginForAccessToken, mapHttpError, moveContent, normalizePath, parsePath, parseWSMessage, previewPrototypeChat, queryContent, queryKnowledgeBase, ragKnowledgeBase, readContent, refreshTokens, regenerateMission, removeDatabase, removeLinkedRepo, removeMission, resolveMemo, safeParseWSMessage, searchContent, setDefaultDatabase, setDefaultRepo, syncPrototypeChat, syncPrototypeChatAsync, testDatabaseConnection, toolCreateMission, toolUpdateMission, unlockContent, updateDatabase, updateProject, updateSessionMetadata, writeContent };
4320
+ export { AddProjectRepoDataSchema, AddProjectRepoResponseSchema, AuthTokenDataSchema, AuthTokenResponseSchema, AuthUserInfoResponseSchema, AuthUserInfoSchema, AuthValidateDataSchema, AuthValidateResponseSchema, ContentTypeInfoSchema, ContentTypeSchema, ContentTypesDataSchema, ContentTypesResponseSchema, ContextReposDataSchema, ContextReposResponseSchema, CreateProjectDataSchema, CreateProjectResponseSchema, CreateSessionDataSchema, CreateSessionResponseSchema, DeleteDataSchema, DeleteProjectDataSchema, DeleteProjectResponseSchema, DeleteResponseSchema, DiscoveryDataSchema, DiscoveryEndpointSchema, DiscoveryResponseSchema, ErrorResponseSchema, ForkSessionDataSchema, ForkSessionResponseSchema, GetProjectDataSchema, GetProjectResponseSchema, GetSessionMessagesDataSchema, GetSessionMessagesResponseSchema, GithubBranchInfoSchema, GithubBranchesDataSchema, GithubBranchesResponseSchema, GithubCommitInfoSchema, GithubCommitsDataSchema, GithubCommitsResponseSchema, GithubDirectoryDataSchema, GithubDirectoryResponseSchema, GithubFileDataSchema, GithubFileInfoSchema, GithubFileResponseSchema, GithubRepoDataSchema, GithubRepoInfoSchema, GithubRepoResponseSchema, IngestionJobResponseSchema, IngestionJobSchema, KBDocumentSchema, KBIngestDataSchema, KBIngestResponseSchema, KBListDataSchema, KBListResponseSchema, KBNamespace, ListDataSchema, ListEntrySchema, ListProjectsDataSchema, ListProjectsResponseSchema, ListResponseSchema, ListSessionsDataSchema, ListSessionsResponseSchema, MetaSchema, MissionNamespace, OCXPAuthError, OCXPClient, OCXPConflictError, OCXPError, OCXPErrorCode, OCXPNetworkError, OCXPNotFoundError, OCXPPathService, OCXPRateLimitError, OCXPResponseSchema, OCXPTimeoutError, OCXPValidationError, PaginationSchema, PresignedUrlDataSchema, PresignedUrlResponseSchema, ProjectMissionSchema, ProjectNamespace, ProjectRepoSchema, ProjectSchema, PrototypeNamespace, QueryDataSchema, QueryFilterSchema, QueryResponseSchema, ReadDataSchema, ReadResponseSchema, RepoDeleteDataSchema, RepoDeleteResponseSchema, RepoDownloadDataSchema, RepoDownloadRequestSchema, RepoDownloadResponseSchema, RepoExistsDataSchema, RepoExistsResponseSchema, RepoListDataSchema, RepoListItemSchema, RepoListResponseSchema, RepoStatusDataSchema, RepoStatusEnum, RepoStatusResponseSchema, SearchDataSchema, SearchResponseSchema, SearchResultItemSchema, SessionMessageSchema, SessionNamespace, SessionSchema, StatsDataSchema, StatsResponseSchema, TreeDataSchema, TreeNodeSchema, TreeResponseSchema, UpdateProjectDataSchema, UpdateProjectResponseSchema, UpdateSessionMetadataDataSchema, UpdateSessionMetadataResponseSchema, VALID_CONTENT_TYPES, VectorSearchDataSchema, VectorSearchResponseSchema, WSBaseMessageSchema, WSChatMessageSchema, WSChatResponseSchema, WSConnectedSchema, WSErrorMessageSchema, WSMessageSchema, WSMessageTypeSchema, WSPingPongSchema, WSStatusSchema, WSStreamChunkSchema, WSStreamEndSchema, WSStreamStartSchema, WebSocketService, WriteDataSchema, WriteResponseSchema, acknowledgeMemo, addDatabase, addLinkedRepo, addMission, archiveSession, buildPath, bulkDeleteContent, bulkReadContent, bulkWriteContent, createClient, createConfig, createDatabase, createMemo, createOCXPClient, createPathService, createProject, createResponseSchema, createWebSocketService, deleteContent, deleteDatabase, deleteMemo, deleteProject, deleteRepo, downloadRepository, forkSession, getAuthConfig, getCanonicalType, getContentStats, getContentTree, getContentTypes, getContextRepos, getCurrentUser, getDatabase, getMemo, getMemoForSource, getMissionContext, getProject, getProjectDatabases, getPrototypeChat, getRepoCommits, getRepoDownloadStatus, getSample, getSchema, getSessionMessages, getStoredVersions, getSyncStatus, githubCheckAccess, githubGetContents, githubListBranches, ignoreMemo, isOCXPAuthError, isOCXPConflictError, isOCXPError, isOCXPNetworkError, isOCXPNotFoundError, isOCXPRateLimitError, isOCXPTimeoutError, isOCXPValidationError, isValidContentType, linkPrototypeChat, listContent, listContextDatabases, listDatabases, listDownloadedRepos, listMemos, listProjects, listPrototypeChats, listSessions, listTables, listWorkspaces, lockContent, login, loginForAccessToken, mapHttpError, moveContent, normalizePath, parsePath, parseWSMessage, previewPrototypeChat, queryContent, queryKnowledgeBase, ragKnowledgeBase, readContent, refreshTokens, regenerateMission, removeDatabase, removeLinkedRepo, removeMission, resolveMemo, safeParseWSMessage, searchContent, setDefaultDatabase, setDefaultRepo, syncAllRepos, syncPrototypeChat, syncPrototypeChatAsync, syncRepo, testDatabaseConnection, toolCreateMission, toolUpdateMission, unlockContent, updateDatabase, updateProject, updateSessionMetadata, writeContent };
4180
4321
  //# sourceMappingURL=index.js.map
4181
4322
  //# sourceMappingURL=index.js.map