Moved UI to separate project, added Dockerfile & renamed project
All checks were successful
Run the JSON parser tests / test (push) Has been skipped

This commit is contained in:
mdnapo 2024-10-19 12:04:40 +02:00
parent 585447193d
commit 96c203f842
135 changed files with 153 additions and 15710 deletions

View File

@ -0,0 +1,20 @@
name: Run the JSON parser tests
run-name: ${{ gitea.actor }} triggered a test for the Json.Parser
on: [ push ]
jobs:
test:
runs-on: ubuntu-latest
if: gitea.ref == 'refs/heads/develop'
steps:
- uses: https://github.com/actions/checkout@v4
- uses: https://github.com/actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- name: "Reference MycroForge.Core in MycroForge.PluginTemplate"
# The MycroForge.PluginTemplate project references MycroForge.Core as a package and not as a reference.
# This allows the 'm4g plugin init' command to pull in the core package from a package repository.
# To prevent the test command from trying to pull from the package repository, we reference the local project.
run: dotnet add MycroForge.PluginTemplate reference MycroForge.Core
- name: "Run Json.Parser.Tests"
run: dotnet test

View File

@ -1,5 +0,0 @@
namespace DevDisciples.Json.Tools.API.Requests;
public class UglifyRequest : TransformRequest
{
}

View File

@ -1,16 +0,0 @@
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = single
[*.md]
max_line_length = off
trim_trailing_whitespace = false

View File

@ -1,42 +0,0 @@
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
# Compiled output
/dist
/tmp
/out-tsc
/bazel-out
# Node
/node_modules
npm-debug.log
yarn-error.log
# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings
# System files
.DS_Store
Thumbs.db

View File

@ -1,27 +0,0 @@
# DevDisciplesJsonToolsApp
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.2.4.
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.

View File

@ -1,110 +0,0 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"DevDisciples.Json.Tools.App": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/dev-disciples.json.tools.app",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
{
"glob": "**/*",
"input": "public"
},
{ "glob": "**/*",
"input": "node_modules/monaco-editor",
"output": "/assets/monaco/"
}
],
"styles": [
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kB",
"maximumError": "1MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kB",
"maximumError": "4kB"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "DevDisciples.Json.Tools.App:build:production"
},
"development": {
"buildTarget": "DevDisciples.Json.Tools.App:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "scss",
"assets": [
{
"glob": "**/*",
"input": "public"
},
{ "glob": "**/*",
"input": "node_modules/monaco-editor",
"output": "/assets/monaco/"
}
],
"styles": [
"src/styles.scss"
],
"scripts": []
}
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,42 +0,0 @@
{
"name": "dev-disciples.json.tools.app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "^18.2.0",
"@angular/cdk": "^18.2.4",
"@angular/common": "^18.2.0",
"@angular/compiler": "^18.2.0",
"@angular/core": "^18.2.0",
"@angular/forms": "^18.2.0",
"@angular/material": "^18.2.4",
"@angular/platform-browser": "^18.2.0",
"@angular/platform-browser-dynamic": "^18.2.0",
"@angular/router": "^18.2.0",
"monaco-editor": "^0.50.0",
"ngx-monaco-editor-v2": "^18.1.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.10"
},
"devDependencies": {
"@angular-devkit/build-angular": "^18.2.4",
"@angular/cli": "^18.2.4",
"@angular/compiler-cli": "^18.2.0",
"@types/jasmine": "~5.1.0",
"jasmine-core": "~5.2.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.5.2"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@ -1 +0,0 @@
<app-layout></app-layout>

View File

@ -1,23 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AppComponent],
}).compileComponents();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, DevDisciples.Json.Tools.App');
});
});

View File

@ -1,13 +0,0 @@
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import {LayoutComponent} from "./layout/layout.component";
@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet, LayoutComponent],
templateUrl: './app.component.html',
styleUrl: './app.component.scss'
})
export class AppComponent {
}

View File

@ -1,16 +0,0 @@
import {ApplicationConfig, importProvidersFrom, provideZoneChangeDetection} from '@angular/core';
import { provideRouter } from '@angular/router';
import { routes } from './app.routes';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
import {MonacoEditorModule} from "ngx-monaco-editor-v2";
import {HttpClientModule, provideHttpClient} from "@angular/common/http";
export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(routes), provideAnimationsAsync(),
importProvidersFrom(MonacoEditorModule.forRoot()),
provideHttpClient(),
]
};

View File

@ -1,14 +0,0 @@
import { Routes } from '@angular/router';
import {HomeComponent} from "./home/home.component";
import {BeautifyComponent} from "./beautify/beautify.component";
import {UglifyComponent} from "./uglify/uglify.component";
import {Json2CsharpComponent} from "./json2csharp/json2-csharp.component";
import {JsonPathComponent} from "./json-path/json-path.component";
export const routes: Routes = [
{ path: 'home', component: HomeComponent },
{ path: 'beautify', component: BeautifyComponent },
{ path: 'uglify', component: UglifyComponent },
{ path: 'json2csharp', component: Json2CsharpComponent },
{ path: 'jsonpath', component: JsonPathComponent },
];

View File

@ -1,8 +0,0 @@
<h1>JSON Beautify</h1>
<app-input-output [input]="$input.value"
[inputOptions]="inputOptions"
(onInputChange)="handleInputChange($event)"
[output]="output"
[outputOptions]="outputOptions">
</app-input-output>

View File

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { BeautifyComponent } from './beautify.component';
describe('BeautifyComponent', () => {
let component: BeautifyComponent;
let fixture: ComponentFixture<BeautifyComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [BeautifyComponent]
})
.compileComponents();
fixture = TestBed.createComponent(BeautifyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,66 +0,0 @@
import {Component, OnInit} from '@angular/core';
import {EditorComponent} from "ngx-monaco-editor-v2";
import {FormsModule} from "@angular/forms";
import {InputOutputComponent} from "../input-output/input-output.component";
import {JsonTransformService} from "../json-transform.service";
import {
DebounceTime,
GenerateDefaultJsonObjectString,
MonacoJsonConfig,
ReadOnlyMonacoJsonConfig
} from "../defaults";
import {BehaviorSubject, debounceTime} from "rxjs";
@Component({
selector: 'app-beautify',
standalone: true,
imports: [
EditorComponent,
FormsModule,
InputOutputComponent
],
templateUrl: './beautify.component.html',
styleUrl: './beautify.component.scss'
})
export class BeautifyComponent implements OnInit {
// input: string = ;
$input: BehaviorSubject<string> = new BehaviorSubject<string>(GenerateDefaultJsonObjectString());
inputOptions = MonacoJsonConfig;
output: string = GenerateDefaultJsonObjectString(2);
outputOptions = ReadOnlyMonacoJsonConfig;
// error: string = "";
constructor(private service: JsonTransformService) {
}
ngOnInit(): void {
this.$input
.pipe(debounceTime(DebounceTime))
.subscribe(input => {
this.update(input)
});
}
update(input: string): void {
this.service
.beautify(input)
.subscribe({
next: response => {
console.log(response);
this.output = response.body.result;
},
error: response => {
console.log(response)
if (response.status === 499) {
this.output = response.error.detail;
console.log(response.error.detail);
}
}
});
}
handleInputChange($event: any): void {
console.log($event);
this.$input.next($event);
}
}

View File

@ -1,26 +0,0 @@
export const MonacoJsonConfig = {
theme: 'vs-dark',
language: 'json',
readOnly: false,
automaticLayout: true
};
export const ReadOnlyMonacoJsonConfig = {
theme: 'vs-dark',
language: 'json',
readOnly: true,
automaticLayout: true
};
export const ReadOnlyMonacoCSharpConfig = {
theme: 'vs-dark',
language: 'csharp',
readOnly: false,
automaticLayout: true
};
export const GenerateDefaultJsonObjectString = (space: number = 0): string => {
return JSON.stringify({first_name: "John", last_name: "Doe"}, null, space);
}
export const DebounceTime: number = 750;

View File

@ -1 +0,0 @@
<p>home works!</p>

View File

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component';
describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HomeComponent]
})
.compileComponents();
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,12 +0,0 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-home',
standalone: true,
imports: [],
templateUrl: './home.component.html',
styleUrl: './home.component.scss'
})
export class HomeComponent {
}

View File

@ -1,15 +0,0 @@
<main>
<section id="left">
<h3>Input</h3>
<ngx-monaco-editor (ngModelChange)="handleInputChange($event)"
[options]="inputOptions"
[(ngModel)]="input">
</ngx-monaco-editor>
</section>
<section id="right">
<h3>Output</h3>
<ngx-monaco-editor [options]="outputOptions"
[(ngModel)]="output">
</ngx-monaco-editor>
</section>
</main>

View File

@ -1,19 +0,0 @@
main {
display: flex;
flex-direction: row;
height: 100%;
width: 100%;
#left {
flex: 0.5;
}
#right {
flex: 0.5;
}
ngx-monaco-editor {
height: 100%;
width: 100%;
}
}

View File

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { InputOutputComponent } from './input-output.component';
describe('InputOutputComponent', () => {
let component: InputOutputComponent;
let fixture: ComponentFixture<InputOutputComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [InputOutputComponent]
})
.compileComponents();
fixture = TestBed.createComponent(InputOutputComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,25 +0,0 @@
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {EditorComponent} from "ngx-monaco-editor-v2";
import {FormsModule} from "@angular/forms";
@Component({
selector: 'app-input-output',
standalone: true,
imports: [
EditorComponent,
FormsModule
],
templateUrl: './input-output.component.html',
styleUrl: './input-output.component.scss'
})
export class InputOutputComponent {
@Input() input!: string;
@Input() inputOptions!: any;
@Output() onInputChange = new EventEmitter();
@Input() output!: string;
@Input() outputOptions!: any;
handleInputChange($event: string) {
this.onInputChange.emit($event);
}
}

View File

@ -1,13 +0,0 @@
<h1>JSON to C#</h1>
<mat-form-field>
<mat-label>Path</mat-label>
<input matInput placeholder="$.*" [value]="$path.value" (input)="handlePathChange($event)">
</mat-form-field>
<app-input-output [input]="$input.value"
[inputOptions]="inputOptions"
(onInputChange)="handleInputChange($event)"
[output]="output"
[outputOptions]="outputOptions">
</app-input-output>

View File

@ -1,3 +0,0 @@
mat-form-field {
width: 100%;
}

View File

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { JsonPathComponent } from './json-path.component';
describe('JsonPathComponent', () => {
let component: JsonPathComponent;
let fixture: ComponentFixture<JsonPathComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [JsonPathComponent]
})
.compileComponents();
fixture = TestBed.createComponent(JsonPathComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,69 +0,0 @@
import {Component, OnInit} from '@angular/core';
import {InputOutputComponent} from "../input-output/input-output.component";
import {DebounceTime, GenerateDefaultJsonObjectString, MonacoJsonConfig, ReadOnlyMonacoCSharpConfig} from "../defaults";
import {BehaviorSubject, debounceTime} from "rxjs";
import {JsonTransformService} from "../json-transform.service";
import {MatFormField} from "@angular/material/form-field";
import {MatInputModule} from "@angular/material/input";
@Component({
selector: 'app-json-path',
standalone: true,
imports: [
InputOutputComponent,
MatFormField,
MatInputModule
],
templateUrl: './json-path.component.html',
styleUrl: './json-path.component.scss'
})
export class JsonPathComponent implements OnInit {
$path: BehaviorSubject<string> = new BehaviorSubject<string>("$.*");
$input: BehaviorSubject<string> = new BehaviorSubject<string>(GenerateDefaultJsonObjectString(2));
inputOptions = MonacoJsonConfig;
output: string = "";
outputOptions = ReadOnlyMonacoCSharpConfig;
constructor(private service: JsonTransformService) {
}
ngOnInit(): void {
this.$input
.pipe(debounceTime(DebounceTime))
.subscribe(input => this.update(input, this.$path.value));
this.$path
.pipe(debounceTime(DebounceTime))
.subscribe(path => this.update(this.$input.value, path));
this.update(this.$input.value, this.$path.value);
}
update(input: string, path: string): void {
this.service
.jsonPath(input, path)
.subscribe({
next: response => {
console.log(response);
this.output = response.body.result;
},
error: response => {
console.log(response)
if (response.status === 499) {
this.output = response.error.detail;
console.log(response.error.detail);
}
}
});
}
handlePathChange($event: any): void {
console.log($event);
this.$path.next($event.target.value);
}
handleInputChange($event: any): void {
console.log($event);
this.$input.next($event);
}
}

View File

@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { JsonTransformService } from './json-transform.service';
describe('JsonTransformService', () => {
let service: JsonTransformService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(JsonTransformService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@ -1,29 +0,0 @@
import {Injectable} from '@angular/core';
import {HttpClient, HttpResponse} from "@angular/common/http";
import {Observable} from "rxjs";
@Injectable({
providedIn: 'root'
})
export class JsonTransformService {
private url: string = "https://localhost:5001";
constructor(private http: HttpClient) {
}
public beautify(source: string): Observable<HttpResponse<any>> {
return this.http.post(`${this.url}/api/transform/beautify`, {Source: source}, {observe: "response"});
}
public uglify(source: string): Observable<HttpResponse<any>> {
return this.http.post(`${this.url}/api/transform/uglify`, {Source: source}, {observe: "response"});
}
public json2csharp(source: string): Observable<HttpResponse<any>> {
return this.http.post(`${this.url}/api/transform/json2csharp`, {Source: source}, {observe: "response"});
}
public jsonPath(source: string, path: string): Observable<HttpResponse<any>> {
return this.http.post(`${this.url}/api/transform/jsonpath`, {source: source, path: path}, {observe: "response"});
}
}

View File

@ -1,8 +0,0 @@
<h1>JSON to C#</h1>
<app-input-output [input]="$input.value"
[inputOptions]="inputOptions"
(onInputChange)="handleInputChange($event)"
[output]="output"
[outputOptions]="outputOptions">
</app-input-output>

View File

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Json2CsharpComponent } from './json2-csharp.component';
describe('Json2csharpComponent', () => {
let component: Json2CsharpComponent;
let fixture: ComponentFixture<Json2CsharpComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Json2CsharpComponent]
})
.compileComponents();
fixture = TestBed.createComponent(Json2CsharpComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,60 +0,0 @@
import {Component, OnInit} from '@angular/core';
import {InputOutputComponent} from "../input-output/input-output.component";
import {JsonTransformService} from "../json-transform.service";
import {
DebounceTime,
GenerateDefaultJsonObjectString,
MonacoJsonConfig,
ReadOnlyMonacoCSharpConfig
} from "../defaults";
import {BehaviorSubject, debounceTime} from "rxjs";
@Component({
selector: 'app-json2csharp',
standalone: true,
imports: [
InputOutputComponent
],
templateUrl: './json2-csharp.component.html',
styleUrl: './json2-csharp.component.scss'
})
export class Json2CsharpComponent implements OnInit {
$input: BehaviorSubject<string> = new BehaviorSubject<string>(GenerateDefaultJsonObjectString(2));
inputOptions = MonacoJsonConfig;
output: string = "";
outputOptions = ReadOnlyMonacoCSharpConfig;
constructor(private service: JsonTransformService) {
}
ngOnInit(): void {
this.$input
.pipe(debounceTime(DebounceTime))
.subscribe(input => this.update(input));
this.update(this.$input.value);
}
update(input: string): void {
this.service
.json2csharp(input)
.subscribe({
next: response => {
console.log(response);
this.output = response.body.result;
},
error: response => {
console.log(response)
if (response.status === 499) {
this.output = response.error.detail;
console.log(response.error.detail);
}
}
});
}
handleInputChange($event: any): void {
console.log($event);
this.$input.next($event);
}
}

View File

@ -1,26 +0,0 @@
<mat-sidenav-container class="sidenav-container">
<mat-sidenav #drawer class="sidenav" mode="side" opened>
<mat-toolbar>Menu</mat-toolbar>
<mat-nav-list>
<mat-list-item routerLink="/home">Home</mat-list-item>
<mat-list-item routerLink="/beautify">Beautify</mat-list-item>
<mat-list-item routerLink="/uglify">Uglify</mat-list-item>
<mat-list-item routerLink="/json2csharp">JSON to C#</mat-list-item>
<mat-list-item routerLink="/jsonpath">JSON Path</mat-list-item>
</mat-nav-list>
</mat-sidenav>
<mat-sidenav-content>
<mat-toolbar color="primary">
<button mat-icon-button (click)="drawer.toggle()">
<mat-icon>menu</mat-icon>
</button>
<span>JSON Transform</span>
</mat-toolbar>
<main>
<!-- Add your dashboard content here -->
<router-outlet></router-outlet>
</main>
</mat-sidenav-content>
</mat-sidenav-container>

View File

@ -1,16 +0,0 @@
mat-sidenav-container {
height: 100%;
}
mat-sidenav-content {
overflow: hidden;
}
mat-sidenav {
width: 250px;
}
main {
height: 100%;
padding: 20px;
}

View File

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LayoutComponent } from './layout.component';
describe('LayoutComponent', () => {
let component: LayoutComponent;
let fixture: ComponentFixture<LayoutComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [LayoutComponent]
})
.compileComponents();
fixture = TestBed.createComponent(LayoutComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,27 +0,0 @@
import { Component } from '@angular/core';
import {MatSidenavContainer, MatSidenavModule} from "@angular/material/sidenav";
import {MatToolbarModule} from "@angular/material/toolbar";
import {MatListItem, MatNavList} from "@angular/material/list";
import {RouterLink, RouterOutlet} from "@angular/router";
import {MatIconButton} from "@angular/material/button";
import {MatIconModule} from "@angular/material/icon";
@Component({
selector: 'app-layout',
standalone: true,
imports: [
MatSidenavContainer,
MatToolbarModule,
MatNavList,
MatListItem,
MatSidenavModule,
RouterLink,
MatIconButton,
MatIconModule,
RouterOutlet
],
templateUrl: './layout.component.html',
styleUrl: './layout.component.scss'
})
export class LayoutComponent {
}

View File

@ -1,8 +0,0 @@
<h1>JSON Uglify</h1>
<app-input-output [input]="$input.value"
[inputOptions]="inputOptions"
(onInputChange)="handleInputChange($event)"
[output]="output"
[outputOptions]="outputOptions">
</app-input-output>

View File

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { UglifyComponent } from './uglify.component';
describe('UglifyComponent', () => {
let component: UglifyComponent;
let fixture: ComponentFixture<UglifyComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [UglifyComponent]
})
.compileComponents();
fixture = TestBed.createComponent(UglifyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,61 +0,0 @@
import {Component, OnInit} from '@angular/core';
import {JsonTransformService} from "../json-transform.service";
import {InputOutputComponent} from "../input-output/input-output.component";
import {
DebounceTime,
GenerateDefaultJsonObjectString,
MonacoJsonConfig,
ReadOnlyMonacoJsonConfig
} from "../defaults";
import {debounceTime, BehaviorSubject} from "rxjs";
@Component({
selector: 'app-uglify',
standalone: true,
imports: [
InputOutputComponent
],
templateUrl: './uglify.component.html',
styleUrl: './uglify.component.scss'
})
export class UglifyComponent implements OnInit {
// input: string = ;
$input: BehaviorSubject<string> = new BehaviorSubject<string>(GenerateDefaultJsonObjectString(2));
inputOptions = MonacoJsonConfig;
output: string = GenerateDefaultJsonObjectString();
outputOptions = ReadOnlyMonacoJsonConfig;
constructor(private service: JsonTransformService) {
}
ngOnInit(): void {
this.$input
.pipe(debounceTime(DebounceTime))
.subscribe(input => {
this.update(input)
});
}
update(input: string): void {
this.service
.uglify(input)
.subscribe({
next: response => {
console.log(response);
this.output = response.body.result;
},
error: response => {
console.log(response)
if (response.status === 499) {
this.output = response.error.detail;
console.log(response.error.detail);
}
}
});
}
handleInputChange($event: any): void {
console.log($event);
this.$input.next($event);
}
}

View File

@ -1,15 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>DevDisciplesJsonToolsApp</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body class="mat-typography">
<app-root></app-root>
</body>
</html>

View File

@ -1,6 +0,0 @@
import { bootstrapApplication } from '@angular/platform-browser';
import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component';
bootstrapApplication(AppComponent, appConfig)
.catch((err) => console.error(err));

View File

@ -1,40 +0,0 @@
// Custom Theming for Angular Material
// For more information: https://material.angular.io/guide/theming
@use '@angular/material' as mat;
// Plus imports for other components in your app.
// Include the common styles for Angular Material. We include this here so that you only
// have to load a single css file for Angular Material in your app.
// Be sure that you only ever include this mixin once!
@include mat.core();
// Define the theme object.
$DevDisciples-Json-Tools-App-theme: mat.define-theme((
color: (
theme-type: light,
primary: mat.$azure-palette,
tertiary: mat.$blue-palette,
),
density: (
scale: 0,
)
));
// Include theme styles for core and each component used in your app.
// Alternatively, you can import and @include the theme mixins for each component
// that you are using.
:root {
@include mat.all-component-themes($DevDisciples-Json-Tools-App-theme);
}
// Comment out the line below if you want to use the pre-defined typography utility classes.
// For more information: https://material.angular.io/guide/typography#using-typography-styles-in-your-application.
// @include mat.typography-hierarchy($DevDisciples.Json.Tools.App-theme);
// Comment out the line below if you want to use the deprecated `color` inputs.
// @include mat.color-variants-backwards-compatibility($DevDisciples.Json.Tools.App-theme);
/* You can add global styles to this file, and also import other style files */
html, body { height: 100%; }
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }

View File

@ -1,15 +0,0 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts"
],
"include": [
"src/**/*.d.ts"
]
}

View File

@ -1,33 +0,0 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,
"isolatedModules": true,
"esModuleInterop": true,
"sourceMap": true,
"declaration": false,
"experimentalDecorators": true,
"moduleResolution": "bundler",
"importHelpers": true,
"target": "ES2022",
"module": "ES2022",
"lib": [
"ES2022",
"dom"
]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}

View File

@ -1,15 +0,0 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
]
},
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}

View File

@ -1,11 +0,0 @@
using TranslationScope = DevDisciples.Json.Tools.Json2CSharpTranslator.Context.TranslationScope;
namespace DevDisciples.Json.Tools.Extensions;
public static class TranslationScopeExtensions
{
public static bool IsChildOf(this Stack<TranslationScope> stack, TranslationScope type)
{
return stack.Count > 1 && stack.ElementAt(1) == type;
}
}

View File

@ -1,6 +1,4 @@
using DevDisciples.Parsing; namespace Jtr.Parsing.Json;
namespace DevDisciples.Json.Parser;
public class JsonLexer : Lexer<JsonToken> public class JsonLexer : Lexer<JsonToken>
{ {

View File

@ -1,6 +1,4 @@
using DevDisciples.Parsing; namespace Jtr.Parsing.Json;
namespace DevDisciples.Json.Parser;
public static partial class JsonParser public static partial class JsonParser
{ {

View File

@ -1,7 +1,6 @@
using DevDisciples.Json.Parser.Syntax; using Jtr.Parsing.Json.Syntax;
using DevDisciples.Parsing;
namespace DevDisciples.Json.Parser; namespace Jtr.Parsing.Json;
public static partial class JsonParser public static partial class JsonParser
{ {
@ -52,7 +51,7 @@ public static partial class JsonParser
ctx.Consume(JsonToken.RightBracket, "Expected ']'"); ctx.Consume(JsonToken.RightBracket, "Expected ']'");
return new JsonArraySyntax(previous, elements?.ToArray() ?? System.Array.Empty<IJsonSyntax>()); return new JsonArraySyntax(previous, elements?.ToArray() ?? Array.Empty<IJsonSyntax>());
} }
private static IJsonSyntax ObjectExpression(ParserContext<JsonToken> ctx) private static IJsonSyntax ObjectExpression(ParserContext<JsonToken> ctx)
@ -75,7 +74,7 @@ public static partial class JsonParser
var propertiesArray = properties?.Select(kv => new JsonPropertySyntax(kv.Key, kv.Value)).ToArray(); var propertiesArray = properties?.Select(kv => new JsonPropertySyntax(kv.Key, kv.Value)).ToArray();
return new JsonObjectSyntax(previous, propertiesArray ?? System.Array.Empty<JsonPropertySyntax>()); return new JsonObjectSyntax(previous, propertiesArray ?? Array.Empty<JsonPropertySyntax>());
} }
private static IJsonSyntax NumberExpression(ParserContext<JsonToken> ctx) private static IJsonSyntax NumberExpression(ParserContext<JsonToken> ctx)

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Json.Parser; namespace Jtr.Parsing.Json;
public enum JsonToken public enum JsonToken
{ {

View File

@ -7,7 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DevDisciples.Parsing\DevDisciples.Parsing.csproj" /> <ProjectReference Include="..\Jtr.Parsing\Jtr.Parsing.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,6 +1,4 @@
using DevDisciples.Parsing; namespace Jtr.Parsing.Json.Syntax;
namespace DevDisciples.Json.Parser.Syntax;
public interface IJsonSyntax public interface IJsonSyntax
{ {

View File

@ -1,6 +1,4 @@
using DevDisciples.Parsing; namespace Jtr.Parsing.Json.Syntax;
namespace DevDisciples.Json.Parser.Syntax;
public readonly struct JsonArraySyntax : IJsonSyntax public readonly struct JsonArraySyntax : IJsonSyntax
{ {

View File

@ -1,6 +1,4 @@
using DevDisciples.Parsing; namespace Jtr.Parsing.Json.Syntax;
namespace DevDisciples.Json.Parser.Syntax;
public readonly struct JsonBoolSyntax : IJsonSyntax public readonly struct JsonBoolSyntax : IJsonSyntax
{ {

View File

@ -1,6 +1,4 @@
using DevDisciples.Parsing; namespace Jtr.Parsing.Json.Syntax;
namespace DevDisciples.Json.Parser.Syntax;
public readonly struct JsonNullSyntax : IJsonSyntax public readonly struct JsonNullSyntax : IJsonSyntax
{ {

View File

@ -1,6 +1,4 @@
using DevDisciples.Parsing; namespace Jtr.Parsing.Json.Syntax;
namespace DevDisciples.Json.Parser.Syntax;
public readonly struct JsonNumberSyntax : IJsonSyntax public readonly struct JsonNumberSyntax : IJsonSyntax
{ {

View File

@ -1,6 +1,4 @@
using DevDisciples.Parsing; namespace Jtr.Parsing.Json.Syntax;
namespace DevDisciples.Json.Parser.Syntax;
public readonly partial struct JsonObjectSyntax : IJsonSyntax public readonly partial struct JsonObjectSyntax : IJsonSyntax
{ {

View File

@ -1,6 +1,4 @@
using DevDisciples.Parsing; namespace Jtr.Parsing.Json.Syntax;
namespace DevDisciples.Json.Parser.Syntax;
public readonly struct JsonPropertySyntax : IJsonSyntax public readonly struct JsonPropertySyntax : IJsonSyntax
{ {

View File

@ -1,6 +1,4 @@
using DevDisciples.Parsing; namespace Jtr.Parsing.Json.Syntax;
namespace DevDisciples.Json.Parser.Syntax;
public readonly struct JsonStringSyntax : IJsonSyntax public readonly struct JsonStringSyntax : IJsonSyntax
{ {

View File

@ -1,4 +1,6 @@
namespace DevDisciples.Json.Parser.Tests; using Jtr.Parsing.Json;
namespace Jtr.Parsing.Tests;
public class JsonLexerTests public class JsonLexerTests
{ {

View File

@ -1,7 +1,8 @@
using DevDisciples.Json.Parser.Syntax; using Jtr.Parsing.Extensions;
using DevDisciples.Parsing.Extensions; using Jtr.Parsing.Json;
using Jtr.Parsing.Json.Syntax;
namespace DevDisciples.Json.Parser.Tests; namespace Jtr.Parsing.Tests;
public class JsonParserTests public class JsonParserTests
{ {

View File

@ -18,7 +18,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DevDisciples.Json.Parser\DevDisciples.Json.Parser.csproj" /> <ProjectReference Include="..\Jtr.Parsing.Json\Jtr.Parsing.Json.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Parsing.Extensions; namespace Jtr.Parsing.Extensions;
public static class CastingExtensions public static class CastingExtensions
{ {

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Parsing; namespace Jtr.Parsing;
public interface ISourceLocation public interface ISourceLocation
{ {

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Parsing; namespace Jtr.Parsing;
public abstract partial class Lexer<TToken> where TToken : Enum public abstract partial class Lexer<TToken> where TToken : Enum
{ {

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Parsing; namespace Jtr.Parsing;
public abstract partial class Lexer<TToken> where TToken : Enum public abstract partial class Lexer<TToken> where TToken : Enum
{ {

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Parsing; namespace Jtr.Parsing;
public abstract partial class Lexer<TToken> where TToken : Enum public abstract partial class Lexer<TToken> where TToken : Enum
{ {

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Parsing; namespace Jtr.Parsing;
public abstract partial class Lexer<TToken> where TToken : Enum public abstract partial class Lexer<TToken> where TToken : Enum
{ {

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Parsing; namespace Jtr.Parsing;
public abstract class ParsableStream<T> public abstract class ParsableStream<T>
{ {

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Parsing; namespace Jtr.Parsing;
public class ParserContext<TToken> : ParsableStream<Lexer<TToken>.Token> where TToken : Enum public class ParserContext<TToken> : ParsableStream<Lexer<TToken>.Token> where TToken : Enum
{ {

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Parsing; namespace Jtr.Parsing;
public static class Report public static class Report
{ {

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Parsing; namespace Jtr.Parsing;
public class Source : ParsableStream<char>, ISourceLocation public class Source : ParsableStream<char>, ISourceLocation
{ {

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Parsing; namespace Jtr.Parsing;
public class SyntaxException : Exception public class SyntaxException : Exception
{ {

View File

@ -1,10 +1,8 @@
namespace DevDisciples.Parsing; namespace Jtr.Parsing;
public static class Visitor public static class Visitor
{ {
public delegate void Visit<TVisitee>(TVisitee visitee); public delegate void Visit<TVisitee>(TVisitee visitee);
public delegate void Visit<TVisitee, TContext>(TVisitee visitee, TContext context); public delegate void Visit<TVisitee, TContext>(TVisitee visitee, TContext context);
public delegate TOut Visit<TVisitee, TContext, TOut>(TVisitee visitee, TContext context); public delegate TOut Visit<TVisitee, TContext, TOut>(TVisitee visitee, TContext context);
} }

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Parsing; namespace Jtr.Parsing;
public class VisitorContainer<TBase> public class VisitorContainer<TBase>
{ {

View File

@ -1,7 +1,7 @@
using DevDisciples.Json.Tools.API.Requests; using Jtr.Tools.API.Requests;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace DevDisciples.Json.Tools.API.Controllers; namespace Jtr.Tools.API.Controllers;
[ApiController] [ApiController]
[Route("api/[controller]")] [Route("api/[controller]")]

View File

@ -1,8 +1,8 @@
using DevDisciples.Parsing; using Jtr.Parsing;
using Microsoft.AspNetCore.Diagnostics; using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace DevDisciples.Json.Tools.API; namespace Jtr.Tools.API;
public class GlobalExceptionHandler : IExceptionHandler public class GlobalExceptionHandler : IExceptionHandler
{ {

View File

@ -5,6 +5,7 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization> <InvariantGlobalization>true</InvariantGlobalization>
<RootNamespace>Jtr.Tools.API</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -13,7 +14,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DevDisciples.Json.Tools\DevDisciples.Json.Tools.csproj" /> <ProjectReference Include="..\Jtr.Tools\Jtr.Tools.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,5 +1,5 @@
using System.Threading.RateLimiting; using System.Threading.RateLimiting;
using DevDisciples.Json.Tools.API; using Jtr.Tools.API;
using Microsoft.AspNetCore.RateLimiting; using Microsoft.AspNetCore.RateLimiting;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Json.Tools.API.Requests; namespace Jtr.Tools.API.Requests;
public class BeautifyRequest : TransformRequest public class BeautifyRequest : TransformRequest
{ {

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Json.Tools.API.Requests; namespace Jtr.Tools.API.Requests;
public class Json2CsharpRequest : TransformRequest public class Json2CsharpRequest : TransformRequest
{ {

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Json.Tools.API.Requests; namespace Jtr.Tools.API.Requests;
public class JsonPathRequest : TransformRequest public class JsonPathRequest : TransformRequest
{ {

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Json.Tools.API.Requests; namespace Jtr.Tools.API.Requests;
public abstract class TransformRequest public abstract class TransformRequest
{ {

View File

@ -0,0 +1,5 @@
namespace Jtr.Tools.API.Requests;
public class UglifyRequest : TransformRequest
{
}

View File

@ -1,4 +1,4 @@
namespace DevDisciples.Json.Tools.CLI; namespace Jtr.Tools.CLI;
public class CommandOptions public class CommandOptions
{ {

View File

@ -1,7 +1,7 @@
using System.CommandLine.Binding; using System.CommandLine.Binding;
using DevDisciples.Json.Tools.CLI.Extensions; using Jtr.Tools.CLI.Extensions;
namespace DevDisciples.Json.Tools.CLI; namespace Jtr.Tools.CLI;
public class CommandOptionsBinder : BinderBase<CommandOptions> public class CommandOptionsBinder : BinderBase<CommandOptions>
{ {

View File

@ -1,6 +1,6 @@
using System.CommandLine; using System.CommandLine;
namespace DevDisciples.Json.Tools.CLI.Extensions; namespace Jtr.Tools.CLI.Extensions;
public static class CommandExtensions public static class CommandExtensions
{ {

View File

@ -1,6 +1,6 @@
using System.CommandLine.Binding; using System.CommandLine.Binding;
namespace DevDisciples.Json.Tools.CLI.Extensions; namespace Jtr.Tools.CLI.Extensions;
public static class CommandOptionsExtensions public static class CommandOptionsExtensions
{ {

Some files were not shown because too many files have changed in this diff Show More