Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
1142a9e
chore: update node.js to v22.22.0
renovate[bot] Jan 14, 2026
85bc2b2
chore: update dependency eslint-plugin-prettier to v5.5.5
renovate[bot] Feb 12, 2026
6c5cb7c
Merge pull request #137 from andreafspeziale/renovate/eslint-plugin-p…
andreafspeziale Mar 5, 2026
109467c
chore: update eslint monorepo to v9.39.3
renovate[bot] Mar 5, 2026
0fb9d92
Merge pull request #136 from andreafspeziale/renovate/supertest-7.x-l…
andreafspeziale Mar 5, 2026
4406777
chore: update dependency @aws-sdk/credential-providers to v3.1002.0
renovate[bot] Mar 5, 2026
cd6e94c
Merge pull request #135 from andreafspeziale/renovate/eslint-monorepo
andreafspeziale Mar 5, 2026
4ae293d
Merge pull request #130 from andreafspeziale/renovate/aws-sdk-js-v3-m…
andreafspeziale Mar 5, 2026
fe741a7
chore: update dependency @types/node to v22.19.13
renovate[bot] Mar 5, 2026
9825921
chore: update dependency eslint-plugin-unused-imports to v4.4.1
renovate[bot] Mar 5, 2026
6034bbb
Merge pull request #140 from andreafspeziale/renovate/eslint-plugin-u…
andreafspeziale Mar 5, 2026
87eb61a
Merge pull request #134 from andreafspeziale/renovate/node-22.x-lockfile
andreafspeziale Mar 5, 2026
d7e8701
chore: update dependency prettier to v3.8.1
renovate[bot] Mar 5, 2026
54d935b
chore: update dependency ts-jest to v29.4.6
renovate[bot] Mar 5, 2026
bfcc01f
Merge pull request #133 from andreafspeziale/renovate/ts-jest-29.x-lo…
andreafspeziale Mar 5, 2026
4688c81
Merge pull request #132 from andreafspeziale/renovate/prettier-3.x-lo…
andreafspeziale Mar 5, 2026
9fc14dd
chore: update nest monorepo
renovate[bot] Mar 5, 2026
a9ea558
chore: update dependency typescript-eslint to v8.56.1
renovate[bot] Mar 5, 2026
03dfde6
Merge pull request #131 from andreafspeziale/renovate/nest-monorepo
andreafspeziale Mar 5, 2026
7fdffc7
Merge pull request #129 from andreafspeziale/renovate/typescript-esli…
andreafspeziale Mar 5, 2026
5a1310f
Merge pull request #128 from andreafspeziale/renovate/node-22.x
andreafspeziale Mar 5, 2026
ffdecfa
fix: properly bubble up errors from CLI bootstrap
andreafspeziale Mar 5, 2026
c870fc1
Merge pull request #141 from andreafspeziale/fix/#139-error-bubble
andreafspeziale Mar 5, 2026
99489fd
chore: automerge all type of deps when minor and patch
andreafspeziale Mar 5, 2026
6c6ba8c
Merge pull request #142 from andreafspeziale/chore/renovate
andreafspeziale Mar 5, 2026
9e15fe9
chore: upgrade nodejs to 24.14.0 and pnpm to 10.30.3
andreafspeziale Mar 5, 2026
6e736ae
chore: update pnpm/action-setup version to 10 in release workflow
andreafspeziale Mar 5, 2026
9e4a991
chore: bump @types/node to 24.x and tsconfig target to ES2024
andreafspeziale Mar 5, 2026
7c39277
Merge pull request #143 from andreafspeziale/chore/nodejs-upgrade
andreafspeziale Mar 5, 2026
9ef93e6
chore: simplify renovate config automerge strategy
andreafspeziale Mar 5, 2026
b502600
chore: update nest monorepo
renovate[bot] Mar 5, 2026
272b180
feat: add slices, requests-per-second, max-docs, and batch-size optio…
andreafspeziale Mar 5, 2026
c6eea19
fix: use correct flag type labels for optional options and fix reinde…
andreafspeziale Mar 5, 2026
902b300
feat: add zod validation for reindex optional numeric options
andreafspeziale Mar 5, 2026
1af0066
chore: update dependency eslint-plugin-unused-imports to v4.4.1
renovate[bot] Mar 5, 2026
f09935f
chore: update dependency prettier to v3.8.1
renovate[bot] Mar 5, 2026
d244537
Merge pull request #146 from andreafspeziale/feat/#138-improve-reinde…
andreafspeziale Mar 5, 2026
9d4883c
Merge pull request #148 from andreafspeziale/renovate/prettier-3.x-lo…
andreafspeziale Mar 5, 2026
515e4a7
Merge pull request #147 from andreafspeziale/renovate/eslint-plugin-u…
andreafspeziale Mar 5, 2026
41ffc53
Merge pull request #145 from andreafspeziale/renovate/nest-monorepo
andreafspeziale Mar 5, 2026
be08e72
chore: update dependency ts-jest to v29.4.6
renovate[bot] Mar 5, 2026
1435895
Merge pull request #144 from andreafspeziale/renovate/ts-jest-29.x-lo…
andreafspeziale Mar 5, 2026
853b7a4
chore: update dependency typescript-eslint to v8.56.1
renovate[bot] Mar 5, 2026
e9177af
Merge pull request #149 from andreafspeziale/renovate/typescript-esli…
andreafspeziale Mar 5, 2026
091d235
fix: remove incorrect analyzer default and fix analyze success log me…
andreafspeziale Mar 5, 2026
9f63464
feat: add get document command
andreafspeziale Mar 5, 2026
cb8afa4
Merge pull request #153 from andreafspeziale/feat/#151-get-document-c…
andreafspeziale Mar 5, 2026
72581f1
chore: update dependency @aws-sdk/credential-providers to v3.1003.0
renovate[bot] Mar 5, 2026
71feb7c
feat: add exists document command
andreafspeziale Mar 5, 2026
eea47a7
Merge pull request #155 from andreafspeziale/feat/#152-exist-document…
andreafspeziale Mar 5, 2026
5e193ae
Merge pull request #154 from andreafspeziale/renovate/aws-sdk-js-v3-m…
andreafspeziale Mar 5, 2026
91ecbcb
fix: release workflow GITHUB_TOKEN and skip npm publish
andreafspeziale Mar 5, 2026
6666f21
fix: disable npm publish and fix GITHUB_TOKEN in release workflow
andreafspeziale Mar 5, 2026
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
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ on:
jobs:
release:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -17,12 +15,12 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 22.14.0
node-version: 24.14.0
- name: Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 9
version: 10
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
Expand All @@ -48,6 +46,8 @@ jobs:
run: pnpm config set //registry.npmjs.org/:_authToken ${{ secrets.CI_NPM_TOKEN }}
- name: Release
run: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update develop
run: |
git checkout develop
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.14.0
24.14.0
1 change: 1 addition & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"release": true
},
"npm": {
"publish": false,
"skipChecks": true
},
"plugins": {
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:22.14.0-alpine AS base
FROM node:24.14.0-alpine AS base

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export AWS_SECRET_ACCESS_KEY=
After cloning the repository:

- `cd os-cli`
- `cp ./env/.env.development ./env`
- `cp ./env/.env.development .env`
- `docker compose up -d`
- `pnpm install`

Expand All @@ -128,4 +128,3 @@ I personally prefer build in a terminal window and run the compiled version in a
## License

os-cli [MIT licensed](LICENSE).

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"engines": {
"node": ">=18.16.1"
},
"packageManager": "pnpm@9.15.9",
"packageManager": "pnpm@10.30.3",
"bin": {
"os-cli": "dist/os-cli.js"
},
Expand Down Expand Up @@ -65,7 +65,7 @@
"@nestjs/testing": "^11.0.11",
"@release-it/conventional-changelog": "8.0.2",
"@types/jest": "^29.5.14",
"@types/node": "^22.13.10",
"@types/node": "^24.11.0",
"@types/supertest": "^6.0.2",
"eslint": "^9.22.0",
"eslint-config-prettier": "^10.1.1",
Expand Down
2,368 changes: 1,153 additions & 1,215 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"semanticCommits": "enabled",
"automerge": true,
"packageRules": [
{
"matchUpdateTypes": ["major"],
"dependencyDashboardApproval": true
},
{
"matchDepTypes": ["devDependencies"],
"automerge": true
"dependencyDashboardApproval": true,
"automerge": false
}
],
"extends": [
Expand Down
2 changes: 1 addition & 1 deletion src/aliases/commands/create.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class CreateAliasCommand extends CommandRunner {
}

@Option({
flags: '-wr, --write-index, <boolean>',
flags: '-wr, --write-index, [boolean]',
description: 'is write index',
required: false,
defaultValue: false,
Expand Down
5 changes: 2 additions & 3 deletions src/analyzer/analyze.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export class AnalyzeCommand extends CommandRunner {
@Option({
flags: '-a, --analyzer, [string]',
description: 'analyzer name',
defaultValue: 'default',
})
parseAnalyzer(val: string): string {
return val;
Expand Down Expand Up @@ -71,7 +70,7 @@ export class AnalyzeCommand extends CommandRunner {
passedParam: string[],
options: {
index?: string;
analyzer: string;
analyzer?: string;
text?: string;
payload?: Record<string, unknown>;
file?: Record<string, unknown>;
Expand Down Expand Up @@ -99,7 +98,7 @@ export class AnalyzeCommand extends CommandRunner {
try {
const res = await this.analyzeService.analyze(payload);

this.logger.log('Index successfully created', {
this.logger.log('Text successfully analyzed', {
fn: this.run.name,
res,
});
Expand Down
10 changes: 9 additions & 1 deletion src/documents/commands/documents.command.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Command, CommandRunner } from 'nest-commander';
import { ExistsDocumentCommand } from './exists.command';
import { GetDocumentCommand } from './get.command';
import { DeleteDocumentsCommand } from './delete.command';
import { CreateDocumentsCommand } from './create.command';
import { QueryDocumentsCommand } from './query.command';
Expand All @@ -7,7 +9,13 @@ import { QueryDocumentsCommand } from './query.command';
name: 'documents',
description: 'opensearch documents related commands',
aliases: ['d'],
subCommands: [DeleteDocumentsCommand, CreateDocumentsCommand, QueryDocumentsCommand],
subCommands: [
ExistsDocumentCommand,
GetDocumentCommand,
DeleteDocumentsCommand,
CreateDocumentsCommand,
QueryDocumentsCommand,
],
})
export class DocumentsCommand extends CommandRunner {
constructor() {
Expand Down
67 changes: 67 additions & 0 deletions src/documents/commands/exists.command.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { SubCommand, CommandRunner, Option } from 'nest-commander';
import { LoggerService } from '@andreafspeziale/nestjs-log';
import { DocumentsService } from '../documents.service';

@SubCommand({
name: 'exists',
description: 'check if document exists',
aliases: ['e'],
})
export class ExistsDocumentCommand extends CommandRunner {
constructor(
private readonly logger: LoggerService,
private readonly documentsService: DocumentsService,
) {
super();
this.logger.setContext(ExistsDocumentCommand.name);
}

@Option({
flags: '-i, --index, <string>',
description: 'index name',
required: true,
})
parseIndex(val: string): string {
return val;
}

@Option({
flags: '-d, --document, <string>',
description: 'document id',
required: true,
})
parseDocument(val: string): string {
return val;
}

async run(
passedParam: string[],
options: {
index: string;
document: string;
},
): Promise<void> {
this.logger.debug('Running command...', {
fn: this.run.name,
passedParam,
options,
});

try {
const res = await this.documentsService.exists(options.index, options.document);

this.logger.log('Document exists check completed', {
fn: this.run.name,
res,
});
} catch (error) {
this.logger.error('Error while checking document existence', {
fn: this.run.name,
index: options.index,
name: error.name,
...(error.meta.body ? { body: error.meta.body } : {}),
...(error.meta.statusCode ? { statusCode: error.meta.statusCode } : {}),
});
}
}
}
67 changes: 67 additions & 0 deletions src/documents/commands/get.command.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { SubCommand, CommandRunner, Option } from 'nest-commander';
import { LoggerService } from '@andreafspeziale/nestjs-log';
import { DocumentsService } from '../documents.service';

@SubCommand({
name: 'get',
description: 'get document',
aliases: ['g'],
})
export class GetDocumentCommand extends CommandRunner {
constructor(
private readonly logger: LoggerService,
private readonly documentsService: DocumentsService,
) {
super();
this.logger.setContext(GetDocumentCommand.name);
}

@Option({
flags: '-i, --index, <string>',
description: 'index name',
required: true,
})
parseIndex(val: string): string {
return val;
}

@Option({
flags: '-d, --document, <string>',
description: 'document id',
required: true,
})
parseDocument(val: string): string {
return val;
}

async run(
passedParam: string[],
options: {
index: string;
document: string;
},
): Promise<void> {
this.logger.debug('Running command...', {
fn: this.run.name,
passedParam,
options,
});

try {
const res = await this.documentsService.get(options.index, options.document);

this.logger.log('Document successfully retrieved', {
fn: this.run.name,
res,
});
} catch (error) {
this.logger.error('Error while getting document', {
fn: this.run.name,
index: options.index,
name: error.name,
...(error.meta.body ? { body: error.meta.body } : {}),
...(error.meta.statusCode ? { statusCode: error.meta.statusCode } : {}),
});
}
}
}
2 changes: 2 additions & 0 deletions src/documents/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export * from './exists.command';
export * from './get.command';
export * from './delete.command';
export * from './create.command';
export * from './query.command';
Expand Down
4 changes: 4 additions & 0 deletions src/documents/documents.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Module } from '@nestjs/common';
import { DeleteQuestions } from '../common';
import {
ExistsDocumentCommand,
GetDocumentCommand,
DeleteDocumentsCommand,
DocumentsCommand,
CreateDocumentsCommand,
Expand All @@ -13,6 +15,8 @@ import { DocumentsService } from './documents.service';
providers: [
DocumentsService,
DocumentsCommand,
ExistsDocumentCommand,
GetDocumentCommand,
DeleteDocumentsCommand,
DeleteQuestions,
BulkQuestions,
Expand Down
18 changes: 18 additions & 0 deletions src/documents/documents.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ export class DocumentsService {
this.logger.setContext(DocumentsService.name);
}

async exists(index: string, id: string) {
return (
await this.osClient.exists({
index,
id,
})
).body;
}

async get(index: string, id: string) {
return (
await this.osClient.get({
index,
id,
})
).body;
}

async delete(index: string, id: string) {
return (
await this.osClient.delete({
Expand Down
Loading
Loading