Skip to content

Commit 1986cca

Browse files
committed
post rebase
1 parent ad739f5 commit 1986cca

File tree

4 files changed

+32
-26
lines changed

4 files changed

+32
-26
lines changed

packages/compass-user-data/src/user-data.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,14 @@ export class AtlasUserData<T extends z.Schema> extends IUserData<T> {
282282
constructor(
283283
validator: T,
284284
dataType: string,
285-
orgId: string,
286-
projectId: string,
287-
getResourceUrl: GetResourceUrl,
288-
authenticatedFetch: AuthenticatedFetch,
289-
{ serialize, deserialize }: AtlasUserDataOptions<z.input<T>>
285+
{
286+
orgId,
287+
projectId,
288+
getResourceUrl,
289+
authenticatedFetch,
290+
serialize,
291+
deserialize,
292+
}: AtlasUserDataOptions<z.input<T>>
290293
) {
291294
super(validator, dataType, { serialize, deserialize });
292295
this.authenticatedFetch = authenticatedFetch;

packages/compass-web/src/entrypoint.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ import {
7878
type FavoriteQueryStorageAccess,
7979
type RecentQueryStorageAccess,
8080
} from '@mongodb-js/my-queries-storage/provider';
81+
import { CompassAssistantDrawerWithConnections } from './compass-assistant-drawer';
8182

8283
/** @public */
8384
export type TrackFunction = (
@@ -108,7 +109,7 @@ const WithStorageProviders: React.FC<{ orgId: string; projectId: string }> = ({
108109
const authenticatedFetch = atlasService.authenticatedFetch.bind(atlasService);
109110
const getResourceUrl = (path?: string) => {
110111
const url = atlasService.userDataEndpoint(`/${path || ''}`);
111-
return Promise.resolve(url);
112+
return url;
112113
};
113114
const pipelineStorage = useRef(
114115
new CompassPipelineStorage({
@@ -502,7 +503,10 @@ const CompassWeb = ({
502503
></CompassWorkspace>
503504
</WithConnectionsStore>
504505
</FieldStorePlugin>
505-
<CompassGenerativeAIPlugin projectId={projectId} />
506+
<CompassGenerativeAIPlugin
507+
projectId={projectId}
508+
isCloudOptIn={true}
509+
/>
506510
</CompassInstanceStorePlugin>
507511
</CompassConnections>
508512
</AtlasCloudConnectionStorageProvider>

packages/my-queries-storage/src/compass-pipeline-storage.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { EJSON } from 'bson';
12
import {
23
type IUserData,
34
FileUserData,
@@ -21,7 +22,6 @@ export type PipelineStorageOptions = {
2122
export class CompassPipelineStorage implements PipelineStorage {
2223
private readonly userData: IUserData<typeof PipelineSchema>;
2324
constructor(options: PipelineStorageOptions = {}) {
24-
const dataType = 'SavedPipelines';
2525
if (
2626
options.orgId &&
2727
options.projectId &&
@@ -31,14 +31,17 @@ export class CompassPipelineStorage implements PipelineStorage {
3131
this.userData = new AtlasUserData(
3232
PipelineSchema,
3333
'favoriteAggregations',
34-
options.orgId,
35-
options.projectId,
36-
options.getResourceUrl,
37-
options.authenticatedFetch,
38-
{}
34+
{
35+
orgId: options.orgId,
36+
projectId: options.projectId,
37+
getResourceUrl: options.getResourceUrl,
38+
authenticatedFetch: options.authenticatedFetch,
39+
serialize: (content) => EJSON.stringify(content),
40+
deserialize: (content: string) => EJSON.parse(content),
41+
}
3942
);
4043
} else {
41-
this.userData = new FileUserData(PipelineSchema, dataType, {
44+
this.userData = new FileUserData(PipelineSchema, 'SavedPipelines', {
4245
basePath: options.basePath,
4346
});
4447
}

packages/my-queries-storage/src/compass-query-storage.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,14 @@ export abstract class CompassQueryStorage<TSchema extends z.Schema> {
3434
) {
3535
const type =
3636
dataType === 'RecentQueries' ? 'recentQueries' : 'favoriteQueries';
37-
this.userData = new AtlasUserData(
38-
schemaValidator,
39-
type,
40-
options.orgId,
41-
options.projectId,
42-
options.getResourceUrl,
43-
options.authenticatedFetch,
44-
{
45-
serialize: (content) => EJSON.stringify(content, undefined, 2),
46-
deserialize: (content: string) => EJSON.parse(content),
47-
}
48-
);
37+
this.userData = new AtlasUserData(schemaValidator, type, {
38+
orgId: options.orgId,
39+
projectId: options.projectId,
40+
getResourceUrl: options.getResourceUrl,
41+
authenticatedFetch: options.authenticatedFetch,
42+
serialize: (content) => EJSON.stringify(content),
43+
deserialize: (content: string) => EJSON.parse(content),
44+
});
4945
} else {
5046
this.userData = new FileUserData(schemaValidator, dataType, {
5147
basePath: options.basepath,

0 commit comments

Comments
 (0)