Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions redisinsight/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"@nestjs/websockets": "^10.4.5",
"@okta/okta-auth-js": "^7.8.1",
"@segment/analytics-node": "^2.1.3",
"@types/json-bigint": "^1.0.4",
"adm-zip": "^0.5.9",
"axios": "^1.7.4",
"body-parser": "^1.20.3",
Expand All @@ -80,7 +79,6 @@
"fs-extra": "^10.0.0",
"ioredis": "^5.2.2",
"is-glob": "^4.0.1",
"json-bigint": "^1.0.0",
"jsonwebtoken": "^9.0.2",
"keytar": "^7.9.0",
"lodash": "^4.17.20",
Expand Down Expand Up @@ -176,13 +174,10 @@
},
"reporters": [
"default",
[
"jest-html-reporters",
{
"publicPath": "./report",
"filename": "index.html"
}
]
["jest-html-reporters", {
"publicPath": "./report",
"filename": "index.html"
}]
]
}
}
6 changes: 0 additions & 6 deletions redisinsight/api/src/__mocks__/databases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ export const mockDatabaseModules = [
semanticVersion: '1.2.5',
},
];

export const mockDatabaseWithModules = Object.assign(new Database(), {
...mockDatabase,
modules: mockDatabaseModules,
});

export const mockDatabaseWithCloudDetails = Object.assign(new Database(), {
...mockDatabase,
cloudDetails: mockCloudDatabaseDetails,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe('RejsonRlKeyInfoStrategy', () => {

describe('getInfo', () => {
const key = getKeyInfoResponse.name;
const path = '.';
beforeEach(() => {
when(mockStandaloneRedisClient.sendPipeline)
.calledWith([
Expand All @@ -47,13 +48,13 @@ describe('RejsonRlKeyInfoStrategy', () => {
]);
when(mockStandaloneRedisClient.sendCommand)
.calledWith(
[BrowserToolRejsonRlCommands.JsonType, key],
[BrowserToolRejsonRlCommands.JsonType, key, path],
{ replyEncoding: 'utf8' },
)
.mockResolvedValue('object');
when(mockStandaloneRedisClient.sendCommand)
.calledWith(
[BrowserToolRejsonRlCommands.JsonObjLen, key],
[BrowserToolRejsonRlCommands.JsonObjLen, key, path],
{ replyEncoding: 'utf8' },
)
.mockResolvedValue(10);
Expand All @@ -70,13 +71,13 @@ describe('RejsonRlKeyInfoStrategy', () => {
it('should return appropriate value for key that store string', async () => {
when(mockStandaloneRedisClient.sendCommand)
.calledWith(
[BrowserToolRejsonRlCommands.JsonType, key],
[BrowserToolRejsonRlCommands.JsonType, key, path],
{ replyEncoding: 'utf8' },
)
.mockResolvedValue('string');
when(mockStandaloneRedisClient.sendCommand)
.calledWith(
[BrowserToolRejsonRlCommands.JsonStrLen, key],
[BrowserToolRejsonRlCommands.JsonStrLen, key, path],
{ replyEncoding: 'utf8' },
)
.mockResolvedValue(10);
Expand All @@ -92,13 +93,13 @@ describe('RejsonRlKeyInfoStrategy', () => {
it('should return appropriate value for key that store array', async () => {
when(mockStandaloneRedisClient.sendCommand)
.calledWith(
[BrowserToolRejsonRlCommands.JsonType, key],
[BrowserToolRejsonRlCommands.JsonType, key, path],
{ replyEncoding: 'utf8' },
)
.mockResolvedValue('array');
when(mockStandaloneRedisClient.sendCommand)
.calledWith(
[BrowserToolRejsonRlCommands.JsonArrLen, key],
[BrowserToolRejsonRlCommands.JsonArrLen, key, path],
{ replyEncoding: 'utf8' },
)
.mockResolvedValue(10);
Expand All @@ -114,7 +115,7 @@ describe('RejsonRlKeyInfoStrategy', () => {
it('should return appropriate value for key that store not iterable type', async () => {
when(mockStandaloneRedisClient.sendCommand)
.calledWith(
[BrowserToolRejsonRlCommands.JsonType, key],
[BrowserToolRejsonRlCommands.JsonType, key, path],
{ replyEncoding: 'utf8' },
)
.mockResolvedValue('boolean');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,24 @@ export class RejsonRlKeyInfoStrategy extends KeyInfoStrategy {
private async getLength(client: RedisClient, key: RedisString): Promise<number> {
try {
const objectKeyType = await client.sendCommand(
[BrowserToolRejsonRlCommands.JsonType, key],
[BrowserToolRejsonRlCommands.JsonType, key, '.'],
{ replyEncoding: 'utf8' },
);

switch (objectKeyType) {
case 'object':
return await client.sendCommand(
[BrowserToolRejsonRlCommands.JsonObjLen, key],
[BrowserToolRejsonRlCommands.JsonObjLen, key, '.'],
{ replyEncoding: 'utf8' },
) as number;
case 'array':
return await client.sendCommand(
[BrowserToolRejsonRlCommands.JsonArrLen, key],
[BrowserToolRejsonRlCommands.JsonArrLen, key, '.'],
{ replyEncoding: 'utf8' },
) as number;
case 'string':
return await client.sendCommand(
[BrowserToolRejsonRlCommands.JsonStrLen, key],
[BrowserToolRejsonRlCommands.JsonStrLen, key, '.'],
{ replyEncoding: 'utf8' },
) as number;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ export class GetRejsonRlDto extends KeyDto {
@ApiPropertyOptional({
type: String,
description: 'Path to look for data',
})
})
@IsString()
@IsNotEmpty()
path?: string = '$';
path?: string = '.';

@ApiPropertyOptional({
type: Boolean,
description:
"Don't check for json size and return whole json in path when enabled",
})
"Don't check for json size and return whole json in path when enabled",
})
@IsBoolean()
forceRetrieve?: boolean;
}
Loading
Loading