Skip to content

Commit

Permalink
125 rename project (#126)
Browse files Browse the repository at this point in the history
* remove lock

* change scope

* rename package

* change lock

* readme

* remove logs

* compose

* new
  • Loading branch information
nitzano authored Oct 22, 2024
1 parent 2e45fa5 commit 1c36ae4
Show file tree
Hide file tree
Showing 78 changed files with 1,149 additions and 2,362 deletions.
16 changes: 16 additions & 0 deletions .changeset/odd-ravens-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@datazar-cli/knex-processor": patch
"@datazar-cli/anonymizers": patch
"@datazar-cli/postgres": patch
"@datazar-cli/mariadb": patch
"@datazar-cli/sqlite": patch
"@datazar-cli/processor": patch
"@datazar-cli/mongo": patch
"@datazar-cli/mssql": patch
"datazar": patch
"@datazar-cli/common": patch
"@datazar-cli/csv": patch
"@datazar-cli/cli": patch
---

release new packages
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@databye:registry=https://registry.npmjs.org
@datazar-cli:registry=https://registry.npmjs.org
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@


<h1 align="center">DataBye 📊👋</h1>
<h1 align="center">DataZar 📊👋</h1>
<h2 align="center">CLI Database & File Anonymizer</h2>

<div align="center">

[![npm](https://img.shields.io/npm/v/databye)](https://www.npmjs.com/package/databye)
[![npm](https://img.shields.io/npm/v/datazar)](https://www.npmjs.com/package/datazar)
[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo)
[![GitHub Repo stars](https://img.shields.io/github/stars/nitzano/databye?style=flat)](https://github.com/nitzano/databye/stargazers)
![GitHub License](https://img.shields.io/github/license/nitzano/databye)
![npm](https://img.shields.io/npm/dw/databye)
[![GitHub Repo stars](https://img.shields.io/github/stars/nitzano/datazar?style=flat)](https://github.com/nitzano/datazar/stargazers)
![GitHub License](https://img.shields.io/github/license/nitzano/datazar)
![npm](https://img.shields.io/npm/dw/datazar)

</div>

Expand All @@ -35,13 +35,13 @@ A command-line tool to anonymize and transform sensitive data in databases, file

```
# npm
npx databye <command> [options]
npx datazar <command> [options]
# pnpm
pnpm dlx databye <command> [options]
pnpm dlx datazar <command> [options]
# yarn
yarn dlx databye <command> [options]
yarn dlx datazar <command> [options]
```

# Examples
Expand All @@ -50,7 +50,7 @@ yarn dlx databye <command> [options]

Mask `firstName` column in `users` table in `test` db:
```
npx databye anon-col postgres \
npx datazar anon-col postgres \
--uri postgresql:/localhost \
--database test \
--table users \
Expand All @@ -64,7 +64,7 @@ npx databye anon-col postgres \

Scramble `lastName` column in `users` table in `test` db:
```
npx databye anon-col mongo
npx datazar anon-col mongo
--uri mongodb://localhost \
--database test \
--table users \
Expand All @@ -78,7 +78,7 @@ npx databye anon-col mongo

Mask `firstName` column in `users` table in `dev.db`:
```
npx databye anon-col sqlite \
npx datazar anon-col sqlite \
--uri /home/dev.db \
--table users \
--column firstName \
Expand All @@ -89,7 +89,7 @@ npx databye anon-col sqlite \

Fake `email` column in `file.csv` with a fake one:
```
npx databye anon-col csv \
npx datazar anon-col csv \
--file /home/file.csv \
--column email \
fake email
Expand Down Expand Up @@ -141,12 +141,12 @@ Coming Soon:
Anonymize a single column in a table

```
Usage: databye anon-col <engine> [engine_options] <anonymizer> [anonymizer_options]
Usage: datazar anon-col <engine> [engine_options] <anonymizer> [anonymizer_options]
```

# License

DataBye
DataZar
Copyright (C) 2024 Nitzan Ohana

This program is free software: you can redistribute it and/or modify
Expand Down
129 changes: 0 additions & 129 deletions packages/anonymizers/CHANGELOG.md

This file was deleted.

4 changes: 2 additions & 2 deletions packages/anonymizers/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# @databye/anonymizers
# @datazar-cli/anonymizers

Part of [DataBye](https://www.npmjs.com/package/databye) package
Part of [DataZar](https://www.npmjs.com/package/datazar) package
4 changes: 2 additions & 2 deletions packages/anonymizers/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@databye/anonymizers",
"name": "@datazar-cli/anonymizers",
"version": "1.1.3",
"license": "AGPL-3.0-only",
"files": [
Expand All @@ -23,7 +23,7 @@
"dev": "tsc --watch"
},
"dependencies": {
"@databye/common": "workspace:^",
"@datazar-cli/common": "workspace:^",
"chance": "^1.1.12",
"lodash-es": "^4.17.21"
},
Expand Down
76 changes: 38 additions & 38 deletions packages/anonymizers/src/providers/base/base-anonymizer.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
import { Anonymizer, ColumnType, ProviderType } from '@databye/common';
import { Anonymizer, ColumnType, ProviderType } from "@datazar-cli/common";

export abstract class BaseAnonymizer implements Anonymizer {
abstract name: ProviderType;

anonymizeString?(value: string): string;
anonymizeNumber?(value: number): number;
anonymizeBoolean?(value: boolean): boolean;

anonymize(value: any, columnType?: ColumnType): any {
switch (columnType) {
case ColumnType.String: {
if (this.anonymizeString) {
return this.anonymizeString(value as string);
}

break;
}

case ColumnType.Number: {
if (this.anonymizeNumber) {
return this.anonymizeNumber(value as number);
}

break;
}

case ColumnType.Boolean: {
if (this.anonymizeBoolean) {
return this.anonymizeBoolean(value as boolean);
}

break;
}

default: {
throw new Error('could not detect column type');
}
}
}
abstract name: ProviderType;

anonymizeString?(value: string): string;
anonymizeNumber?(value: number): number;
anonymizeBoolean?(value: boolean): boolean;

anonymize(value: any, columnType?: ColumnType): any {
switch (columnType) {
case ColumnType.String: {
if (this.anonymizeString) {
return this.anonymizeString(value as string);
}

break;
}

case ColumnType.Number: {
if (this.anonymizeNumber) {
return this.anonymizeNumber(value as number);
}

break;
}

case ColumnType.Boolean: {
if (this.anonymizeBoolean) {
return this.anonymizeBoolean(value as boolean);
}

break;
}

default: {
throw new Error("could not detect column type");
}
}
}
}
22 changes: 10 additions & 12 deletions packages/anonymizers/src/providers/base/types.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
import { Anonymizer, ProviderType } from '@databye/common';
import { type FakeOptions } from '../fake/fake-options.js';
import { type MaskOptions } from '../mask/mask-options.js';


import { Anonymizer, ProviderType } from "@datazar-cli/common";
import { type FakeOptions } from "../fake/fake-options.js";
import { type MaskOptions } from "../mask/mask-options.js";

export type BaseProvider = {
type: ProviderType;
type: ProviderType;
};

export type FakeProvider = {
type: ProviderType.Fake;
options?: FakeOptions;
type: ProviderType.Fake;
options?: FakeOptions;
} & Anonymizer;

export type MaskProvider = {
type: ProviderType.Mask;
options?: MaskOptions;
type: ProviderType.Mask;
options?: MaskOptions;
} & Anonymizer;

export type ScrambleProvider = {
type: ProviderType.Scramble;
options: undefined;
type: ProviderType.Scramble;
options: undefined;
} & Anonymizer;

export type Provider = FakeProvider | MaskProvider | ScrambleProvider;
Loading

0 comments on commit 1c36ae4

Please sign in to comment.