@overmap-ai/core 1.0.48-activity-history.1 → 1.0.48-activity-history.3
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/README.md +0 -0
- package/dist/components/FileViewer/context.d.ts +1 -1
- package/dist/forms/builder/FieldActions.d.ts +1 -1
- package/dist/forms/constants.d.ts +2 -0
- package/dist/forms/constantsJsx.d.ts +9 -0
- package/dist/overmap-core.js +127 -41
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +127 -41
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/sdk.d.ts +2 -1
- package/dist/sdk/services/AgentService.d.ts +39 -0
- package/dist/sdk/services/AuthService.d.ts +1 -1
- package/dist/sdk/services/IssueCommentService.d.ts +2 -2
- package/dist/sdk/services/LicenseService.d.ts +1 -1
- package/dist/sdk/services/index.d.ts +1 -0
- package/dist/store/slices/componentSlice.d.ts +2 -2
- package/dist/store/slices/componentTypeSlice.d.ts +5 -5
- package/dist/store/slices/issueSlice.d.ts +6 -2
- package/dist/store/slices/licenseSlice.d.ts +1 -2
- package/dist/store/slices/organizationSlice.d.ts +1 -1
- package/dist/typings/models/base.d.ts +5 -0
- package/dist/typings/models/issues.d.ts +3 -1
- package/dist/typings/models/users.d.ts +2 -3
- package/package.json +4 -2
package/README.md
CHANGED
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { FileViewerConfig } from "./typings
|
|
2
|
+
import { FileViewerConfig } from "./typings";
|
|
3
3
|
export type FileViewerContextType = (func: (close: () => void) => FileViewerConfig) => void;
|
|
4
4
|
export declare const FileViewerContext: import("react").Context<FileViewerContextType>;
|
|
5
5
|
export declare const useFileViewer: () => FileViewerContextType;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from "react";
|
|
2
|
+
interface FullScreenImagePreviewProps {
|
|
3
|
+
file: File;
|
|
4
|
+
url: string;
|
|
5
|
+
name: string;
|
|
6
|
+
setShowPreview: Dispatch<SetStateAction<boolean>>;
|
|
7
|
+
}
|
|
8
|
+
export declare const FullScreenImagePreview: import("react").MemoExoticComponent<(props: FullScreenImagePreviewProps) => import("react/jsx-runtime").JSX.Element>;
|
|
9
|
+
export {};
|
package/dist/overmap-core.js
CHANGED
|
@@ -2144,20 +2144,55 @@ const issueSlice = createSlice({
|
|
|
2144
2144
|
setVisibleUserIds: (state, action) => {
|
|
2145
2145
|
state.visibleUserIds = [...new Set(action.payload)];
|
|
2146
2146
|
},
|
|
2147
|
-
|
|
2147
|
+
// Comments
|
|
2148
|
+
addIssueComment: (state, action) => {
|
|
2149
|
+
if (action.payload.offline_id in state.comments) {
|
|
2150
|
+
throw new Error(
|
|
2151
|
+
`Tried to add issue comment with offline_id: ${action.payload.offline_id} that already exists`
|
|
2152
|
+
);
|
|
2153
|
+
}
|
|
2154
|
+
state.comments[action.payload.offline_id] = action.payload;
|
|
2155
|
+
},
|
|
2156
|
+
addIssueComments: (state, action) => {
|
|
2157
|
+
for (const comment of action.payload) {
|
|
2158
|
+
if (comment.offline_id in state.comments) {
|
|
2159
|
+
throw new Error(
|
|
2160
|
+
`Tried to add issue comment with offline_id: ${comment.offline_id} that already exists`
|
|
2161
|
+
);
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2148
2164
|
for (const comment of action.payload) {
|
|
2149
2165
|
state.comments[comment.offline_id] = comment;
|
|
2150
2166
|
}
|
|
2151
2167
|
},
|
|
2168
|
+
setIssueComment: (state, action) => {
|
|
2169
|
+
state.comments[action.payload.offline_id] = action.payload;
|
|
2170
|
+
},
|
|
2171
|
+
setIssueComments: (state, action) => {
|
|
2172
|
+
const newComments = {};
|
|
2173
|
+
for (const comment of action.payload) {
|
|
2174
|
+
newComments[comment.offline_id] = comment;
|
|
2175
|
+
}
|
|
2176
|
+
state.comments = newComments;
|
|
2177
|
+
},
|
|
2152
2178
|
addOrReplaceIssueComment: (state, action) => {
|
|
2153
2179
|
state.comments[action.payload.offline_id] = action.payload;
|
|
2154
2180
|
},
|
|
2155
2181
|
removeIssueComment: (state, action) => {
|
|
2156
|
-
if (action.payload in state.comments) {
|
|
2157
|
-
delete state.comments[action.payload];
|
|
2158
|
-
} else {
|
|
2182
|
+
if (!(action.payload in state.comments)) {
|
|
2159
2183
|
throw new Error(`Failed to remove issue comment because ID doesn't exist: ${action.payload}`);
|
|
2160
2184
|
}
|
|
2185
|
+
delete state.comments[action.payload];
|
|
2186
|
+
},
|
|
2187
|
+
removeIssueComments: (state, action) => {
|
|
2188
|
+
for (const commentId of action.payload) {
|
|
2189
|
+
if (!(commentId in state.comments)) {
|
|
2190
|
+
throw new Error(`Failed to remove issue comment because ID doesn't exist: ${commentId}`);
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
for (const commentId of action.payload) {
|
|
2194
|
+
delete state.comments[commentId];
|
|
2195
|
+
}
|
|
2161
2196
|
},
|
|
2162
2197
|
cleanRecentIssues: (state) => {
|
|
2163
2198
|
state.recentIssueIds = state.recentIssueIds.filter((recentIssue) => state.issues[recentIssue.offlineId]);
|
|
@@ -2196,20 +2231,25 @@ const {
|
|
|
2196
2231
|
removeIssueAttachment,
|
|
2197
2232
|
removeAttachmentsOfIssue,
|
|
2198
2233
|
removeIssue,
|
|
2199
|
-
removeIssueComment,
|
|
2200
2234
|
removeIssueUpdate,
|
|
2201
2235
|
removeIssueUpdates,
|
|
2202
2236
|
removeRecentIssue,
|
|
2203
2237
|
resetRecentIssues,
|
|
2204
2238
|
setActiveIssueId,
|
|
2205
2239
|
setIssueAttachments,
|
|
2206
|
-
setIssueComments,
|
|
2207
2240
|
setIssueUpdates,
|
|
2208
2241
|
setIssues,
|
|
2209
2242
|
setVisibleStatuses,
|
|
2210
2243
|
setVisibleUserIds,
|
|
2211
2244
|
updateIssueAttachment,
|
|
2212
|
-
updateIssue
|
|
2245
|
+
updateIssue,
|
|
2246
|
+
// Commments
|
|
2247
|
+
addIssueComment,
|
|
2248
|
+
addIssueComments,
|
|
2249
|
+
setIssueComment,
|
|
2250
|
+
setIssueComments,
|
|
2251
|
+
removeIssueComment,
|
|
2252
|
+
removeIssueComments
|
|
2213
2253
|
} = issueSlice.actions;
|
|
2214
2254
|
const selectIssueMapping = (state) => state.issueReducer.issues;
|
|
2215
2255
|
const selectRecentIssueIds = (state) => state.issueReducer.recentIssueIds;
|
|
@@ -4225,7 +4265,7 @@ async function performRequest(action, client) {
|
|
|
4225
4265
|
const errorResponse = extractResponseFromError(error2);
|
|
4226
4266
|
const status = errorResponse == null ? void 0 : errorResponse.status;
|
|
4227
4267
|
if (status === 401) {
|
|
4228
|
-
if (url.endsWith("
|
|
4268
|
+
if (url.endsWith("/token/refresh/")) {
|
|
4229
4269
|
if (state.authReducer.isLoggedIn) {
|
|
4230
4270
|
console.warn("No signed-in user to sign out.");
|
|
4231
4271
|
}
|
|
@@ -5065,6 +5105,10 @@ class AuthService extends BaseApiService {
|
|
|
5065
5105
|
checkAuth: false,
|
|
5066
5106
|
// Don't wait for other requests to finish, or we might end up in a deadlock.
|
|
5067
5107
|
immediate: true
|
|
5108
|
+
}).catch((e) => {
|
|
5109
|
+
console.error("Could not renew tokens; logging out due to error:", e);
|
|
5110
|
+
void this.logout();
|
|
5111
|
+
return void 0;
|
|
5068
5112
|
});
|
|
5069
5113
|
let response = void 0;
|
|
5070
5114
|
try {
|
|
@@ -5073,7 +5117,7 @@ class AuthService extends BaseApiService {
|
|
|
5073
5117
|
await this.logout();
|
|
5074
5118
|
}
|
|
5075
5119
|
if (!response)
|
|
5076
|
-
|
|
5120
|
+
return void 0;
|
|
5077
5121
|
if (!response.access)
|
|
5078
5122
|
throw new Error("Missing access token");
|
|
5079
5123
|
if (!response.refresh)
|
|
@@ -5145,7 +5189,11 @@ class AuthService extends BaseApiService {
|
|
|
5145
5189
|
throw new Error("No refresh token found");
|
|
5146
5190
|
}
|
|
5147
5191
|
try {
|
|
5148
|
-
const
|
|
5192
|
+
const tokens = await this._getRenewedTokens(dyingRefreshToken);
|
|
5193
|
+
if (!tokens) {
|
|
5194
|
+
return void 0;
|
|
5195
|
+
}
|
|
5196
|
+
const { accessToken, refreshToken } = tokens;
|
|
5149
5197
|
console.log("Got renewed tokens");
|
|
5150
5198
|
store.dispatch(setTokens({ accessToken, refreshToken }));
|
|
5151
5199
|
} catch (e) {
|
|
@@ -5758,49 +5806,36 @@ class ComponentTypeService extends BaseApiService {
|
|
|
5758
5806
|
}
|
|
5759
5807
|
}
|
|
5760
5808
|
class IssueCommentService extends BaseApiService {
|
|
5809
|
+
// Omit author and submitted_at since these will always be set internally
|
|
5761
5810
|
add(comment) {
|
|
5762
|
-
const offlinePayload = offline(comment);
|
|
5763
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5764
5811
|
const { store } = this.client;
|
|
5765
|
-
const offlineComment = {
|
|
5766
|
-
...
|
|
5812
|
+
const offlineComment = offline({
|
|
5813
|
+
...comment,
|
|
5767
5814
|
author: store.getState().userReducer.currentUser.id,
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5815
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5816
|
+
resolved: false
|
|
5817
|
+
});
|
|
5818
|
+
store.dispatch(addIssueComment(offlineComment));
|
|
5771
5819
|
const promise = this.enqueueRequest({
|
|
5772
5820
|
description: `${truncate(comment.content, 80)}`,
|
|
5773
5821
|
method: HttpMethod.POST,
|
|
5774
5822
|
url: `/issues/${comment.issue}/comment/`,
|
|
5775
|
-
payload:
|
|
5823
|
+
payload: offlineComment,
|
|
5776
5824
|
blockers: [comment.issue],
|
|
5777
|
-
blocks: [
|
|
5825
|
+
blocks: [offlineComment.offline_id]
|
|
5826
|
+
});
|
|
5827
|
+
promise.catch(() => {
|
|
5828
|
+
store.dispatch(removeIssueComment(offlineComment.offline_id));
|
|
5778
5829
|
});
|
|
5779
5830
|
return [offlineComment, promise];
|
|
5780
5831
|
}
|
|
5781
|
-
|
|
5832
|
+
update(comment) {
|
|
5782
5833
|
const { store } = this.client;
|
|
5783
|
-
const
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
// TODO: Choose between /issues/comments/in-project/${projectId}/ and /projects/${projectId}/issue-comments/
|
|
5787
|
-
url: `/projects/${store.getState().projectReducer.activeProjectId}/comments/`,
|
|
5788
|
-
blockers: [],
|
|
5789
|
-
blocks: []
|
|
5790
|
-
});
|
|
5791
|
-
let filteredResult = result.filter(onlyUniqueOfflineIds);
|
|
5792
|
-
filteredResult = filteredResult.map((comment) => {
|
|
5793
|
-
return { ...comment };
|
|
5794
|
-
});
|
|
5795
|
-
if (result.length !== filteredResult.length) {
|
|
5796
|
-
console.error(
|
|
5797
|
-
`Received duplicate comments from the API (new length ${filteredResult.length}); filtered in browser.`
|
|
5798
|
-
);
|
|
5834
|
+
const commentToUpdate = store.getState().issueReducer.comments[comment.offline_id];
|
|
5835
|
+
if (!commentToUpdate) {
|
|
5836
|
+
throw new Error(`Comment with offline_id ${comment.offline_id} not found in store`);
|
|
5799
5837
|
}
|
|
5800
|
-
store.dispatch(
|
|
5801
|
-
}
|
|
5802
|
-
update(comment) {
|
|
5803
|
-
this.client.store.dispatch(addOrReplaceIssueComment(comment));
|
|
5838
|
+
store.dispatch(setIssueComment(comment));
|
|
5804
5839
|
const promise = this.enqueueRequest({
|
|
5805
5840
|
description: `Edit comment: ${truncate(comment.content, 80)}`,
|
|
5806
5841
|
method: HttpMethod.PATCH,
|
|
@@ -5809,17 +5844,40 @@ class IssueCommentService extends BaseApiService {
|
|
|
5809
5844
|
blockers: [comment.issue],
|
|
5810
5845
|
blocks: [comment.offline_id]
|
|
5811
5846
|
});
|
|
5847
|
+
promise.catch(() => {
|
|
5848
|
+
store.dispatch(setIssueComment(commentToUpdate));
|
|
5849
|
+
});
|
|
5812
5850
|
return [comment, promise];
|
|
5813
5851
|
}
|
|
5814
5852
|
remove(offline_id) {
|
|
5853
|
+
const commentToRemove = this.client.store.getState().issueReducer.comments[offline_id];
|
|
5854
|
+
if (!commentToRemove) {
|
|
5855
|
+
throw new Error(`Comment with offline_id ${offline_id} not found in store`);
|
|
5856
|
+
}
|
|
5815
5857
|
this.client.store.dispatch(removeIssueComment(offline_id));
|
|
5816
|
-
|
|
5858
|
+
const promise = this.enqueueRequest({
|
|
5817
5859
|
description: "Delete comment",
|
|
5818
5860
|
method: HttpMethod.DELETE,
|
|
5819
5861
|
url: `/issues/comments/${offline_id}/`,
|
|
5820
5862
|
blockers: [offline_id],
|
|
5821
5863
|
blocks: []
|
|
5822
5864
|
});
|
|
5865
|
+
promise.catch(() => {
|
|
5866
|
+
this.client.store.dispatch(addIssueComment(commentToRemove));
|
|
5867
|
+
});
|
|
5868
|
+
return promise;
|
|
5869
|
+
}
|
|
5870
|
+
async refreshStore() {
|
|
5871
|
+
const { store } = this.client;
|
|
5872
|
+
const result = await this.enqueueRequest({
|
|
5873
|
+
description: "Get comments",
|
|
5874
|
+
method: HttpMethod.GET,
|
|
5875
|
+
// TODO: Choose between /issues/comments/in-project/${projectId}/ and /projects/${projectId}/issue-comments/
|
|
5876
|
+
url: `/projects/${store.getState().projectReducer.activeProjectId}/comments/`,
|
|
5877
|
+
blockers: [],
|
|
5878
|
+
blocks: []
|
|
5879
|
+
});
|
|
5880
|
+
store.dispatch(setIssueComments(result));
|
|
5823
5881
|
}
|
|
5824
5882
|
}
|
|
5825
5883
|
class IssueUpdateService extends BaseApiService {
|
|
@@ -7647,10 +7705,33 @@ class DocumentService extends BaseApiService {
|
|
|
7647
7705
|
store.dispatch(setDocuments(result));
|
|
7648
7706
|
}
|
|
7649
7707
|
}
|
|
7708
|
+
class AgentService extends BaseApiService {
|
|
7709
|
+
/**
|
|
7710
|
+
* Prompt the agent with a message.
|
|
7711
|
+
* @param request The message to prompt the agent with.
|
|
7712
|
+
* @param conversationId If continuing an existing message, the UUID of that conversation.
|
|
7713
|
+
*/
|
|
7714
|
+
prompt(request2, conversationId) {
|
|
7715
|
+
const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
|
|
7716
|
+
return this.enqueueRequest({
|
|
7717
|
+
description: "Prompt agent",
|
|
7718
|
+
method: HttpMethod.POST,
|
|
7719
|
+
url: "/agents/prompt/",
|
|
7720
|
+
payload: {
|
|
7721
|
+
prompt: request2,
|
|
7722
|
+
active_project: activeProjectId
|
|
7723
|
+
},
|
|
7724
|
+
blockers: ["prompt"],
|
|
7725
|
+
blocks: ["prompt"],
|
|
7726
|
+
queryParams: conversationId ? { conversation_id: conversationId } : {}
|
|
7727
|
+
});
|
|
7728
|
+
}
|
|
7729
|
+
}
|
|
7650
7730
|
class OvermapSDK {
|
|
7651
7731
|
constructor(apiUrl, store) {
|
|
7652
7732
|
__publicField(this, "API_URL");
|
|
7653
7733
|
__publicField(this, "store");
|
|
7734
|
+
__publicField(this, "agent", new AgentService(this));
|
|
7654
7735
|
__publicField(this, "files", new FileService(this));
|
|
7655
7736
|
__publicField(this, "attachments", new AttachmentService(this));
|
|
7656
7737
|
__publicField(this, "auth", new AuthService(this));
|
|
@@ -15340,6 +15421,7 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
15340
15421
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
15341
15422
|
export {
|
|
15342
15423
|
APIError,
|
|
15424
|
+
AgentService,
|
|
15343
15425
|
AttachmentService,
|
|
15344
15426
|
AuthService,
|
|
15345
15427
|
BaseApiService,
|
|
@@ -15452,6 +15534,8 @@ export {
|
|
|
15452
15534
|
addIssue,
|
|
15453
15535
|
addIssueAttachment,
|
|
15454
15536
|
addIssueAttachments,
|
|
15537
|
+
addIssueComment,
|
|
15538
|
+
addIssueComments,
|
|
15455
15539
|
addIssueUpdate,
|
|
15456
15540
|
addIssueUpdates,
|
|
15457
15541
|
addLicenses,
|
|
@@ -15613,6 +15697,7 @@ export {
|
|
|
15613
15697
|
removeIssue,
|
|
15614
15698
|
removeIssueAttachment,
|
|
15615
15699
|
removeIssueComment,
|
|
15700
|
+
removeIssueComments,
|
|
15616
15701
|
removeIssueUpdate,
|
|
15617
15702
|
removeIssueUpdates,
|
|
15618
15703
|
removeOrganizationAccess,
|
|
@@ -15813,6 +15898,7 @@ export {
|
|
|
15813
15898
|
setIsImportingProjectFile,
|
|
15814
15899
|
setIsLoading,
|
|
15815
15900
|
setIssueAttachments,
|
|
15901
|
+
setIssueComment,
|
|
15816
15902
|
setIssueComments,
|
|
15817
15903
|
setIssueUpdates,
|
|
15818
15904
|
setIssues,
|