├── libs
├── .gitkeep
├── utils
│ ├── src
│ │ ├── index.ts
│ │ └── lib
│ │ │ ├── trycatch.ts
│ │ │ └── https.ts
│ ├── package.json
│ ├── tsconfig.lib.json
│ ├── tsconfig.spec.json
│ ├── jest.config.ts
│ ├── CHANGELOG.md
│ ├── tsconfig.json
│ ├── .eslintrc.json
│ ├── README.md
│ └── project.json
├── ngx-maintenance
│ ├── README.md
│ ├── package.json
│ ├── tsconfig.spec.json
│ ├── jest.config.ts
│ ├── tsconfig.lib.json
│ ├── .eslintrc.json
│ ├── tsconfig.json
│ ├── CHANGELOG.md
│ └── project.json
├── devkit
│ ├── README.md
│ ├── src
│ │ ├── index.ts
│ │ └── lib
│ │ │ └── to-maintenance-initiative.ts
│ ├── package.json
│ ├── tsconfig.lib.json
│ ├── tsconfig.spec.json
│ ├── jest.config.ts
│ ├── tsconfig.json
│ ├── .eslintrc.json
│ ├── project.json
│ └── CHANGELOG.md
└── npm-api
│ ├── package.json
│ ├── src
│ ├── index.ts
│ └── lib
│ │ └── interfaces
│ │ ├── registry-info.ts
│ │ └── search.ts
│ ├── tsconfig.lib.json
│ ├── tsconfig.spec.json
│ ├── jest.config.ts
│ ├── CHANGELOG.md
│ ├── tsconfig.json
│ ├── .eslintrc.json
│ ├── README.md
│ └── project.json
├── .github
├── .gitkeep
└── workflows
│ └── publish.yml
├── tools
└── .gitkeep
├── angular-pkgs
├── .gitkeep
├── ngx-pipes
│ ├── src
│ │ ├── lib
│ │ │ ├── pipes
│ │ │ │ ├── index.html
│ │ │ │ ├── index.ts
│ │ │ │ ├── boolean
│ │ │ │ │ ├── is-null.ts
│ │ │ │ │ ├── is-array.ts
│ │ │ │ │ ├── is-less-than.ts
│ │ │ │ │ ├── is-identical-to.ts
│ │ │ │ │ ├── is-greater-than.ts
│ │ │ │ │ ├── is-not-identical-to.ts
│ │ │ │ │ ├── is-less-equal-than.ts
│ │ │ │ │ ├── is-greater-equal-than.ts
│ │ │ │ │ ├── is-number.ts
│ │ │ │ │ ├── is-object.ts
│ │ │ │ │ ├── is-string.ts
│ │ │ │ │ ├── is-defined.ts
│ │ │ │ │ ├── is-function.ts
│ │ │ │ │ ├── is-equal-to.ts
│ │ │ │ │ ├── is-undefined.ts
│ │ │ │ │ ├── is-not-equal-to.ts
│ │ │ │ │ ├── is-less-than.spec.ts
│ │ │ │ │ ├── is-greater-than.spec.ts
│ │ │ │ │ ├── is-less-equal-than.spec.ts
│ │ │ │ │ ├── is-equal-to.spec.ts
│ │ │ │ │ ├── is-greater-equal-than.spec.ts
│ │ │ │ │ ├── is-not-equal-to.spec.ts
│ │ │ │ │ ├── is-null.spec.ts
│ │ │ │ │ ├── is-identical-to.spec.ts
│ │ │ │ │ ├── is-defined.spec.ts
│ │ │ │ │ ├── is-not-identical-to.spec.ts
│ │ │ │ │ ├── is-undefined.spec.ts
│ │ │ │ │ ├── is-function.spec.ts
│ │ │ │ │ ├── is-string.spec.ts
│ │ │ │ │ ├── is-array.spec.ts
│ │ │ │ │ ├── is-number.spec.ts
│ │ │ │ │ └── is-object.spec.ts
│ │ │ │ ├── math
│ │ │ │ │ ├── max.ts
│ │ │ │ │ ├── min.ts
│ │ │ │ │ ├── sqrt.ts
│ │ │ │ │ ├── round.ts
│ │ │ │ │ ├── sum.ts
│ │ │ │ │ ├── pow.ts
│ │ │ │ │ ├── ceil.ts
│ │ │ │ │ ├── floor.ts
│ │ │ │ │ ├── degrees.ts
│ │ │ │ │ ├── radians.ts
│ │ │ │ │ ├── average.ts
│ │ │ │ │ ├── min.spec.ts
│ │ │ │ │ ├── max.spec.ts
│ │ │ │ │ ├── degrees.spec.ts
│ │ │ │ │ ├── radians.spec.ts
│ │ │ │ │ ├── ceil.spec.ts
│ │ │ │ │ ├── sqrt.spec.ts
│ │ │ │ │ ├── floor.spec.ts
│ │ │ │ │ ├── round.spec.ts
│ │ │ │ │ ├── percentage.ts
│ │ │ │ │ ├── sum.spec.ts
│ │ │ │ │ ├── pow.spec.ts
│ │ │ │ │ ├── average.spec.ts
│ │ │ │ │ ├── percentage.spec.ts
│ │ │ │ │ ├── bytes.ts
│ │ │ │ │ ├── bytes.spec.ts
│ │ │ │ │ └── index.ts
│ │ │ │ ├── array
│ │ │ │ │ ├── group-by-impure.ts
│ │ │ │ │ ├── order-by-impure.ts
│ │ │ │ │ ├── filter-by-impure.ts
│ │ │ │ │ ├── range.ts
│ │ │ │ │ ├── every.ts
│ │ │ │ │ ├── truthify.ts
│ │ │ │ │ ├── tail.ts
│ │ │ │ │ ├── initial.ts
│ │ │ │ │ ├── reverse.ts
│ │ │ │ │ ├── without.ts
│ │ │ │ │ ├── diff.ts
│ │ │ │ │ ├── from-pairs.ts
│ │ │ │ │ ├── some.ts
│ │ │ │ │ ├── intersection.ts
│ │ │ │ │ ├── chunk.ts
│ │ │ │ │ ├── pluck.ts
│ │ │ │ │ ├── sample.ts
│ │ │ │ │ ├── every.spec.ts
│ │ │ │ │ ├── flatten.ts
│ │ │ │ │ ├── shuffle.ts
│ │ │ │ │ ├── union.ts
│ │ │ │ │ ├── shuffle.spec.ts
│ │ │ │ │ ├── truthify.spec.ts
│ │ │ │ │ ├── diff.spec.ts
│ │ │ │ │ ├── from-pairs.spec.ts
│ │ │ │ │ ├── sample.spec.ts
│ │ │ │ │ ├── initial.spec.ts
│ │ │ │ │ ├── unique.ts
│ │ │ │ │ ├── without.spec.ts
│ │ │ │ │ ├── flatten.spec.ts
│ │ │ │ │ ├── intersection.spec.ts
│ │ │ │ │ ├── some.spec.ts
│ │ │ │ │ ├── tail.spec.ts
│ │ │ │ │ ├── group-by.ts
│ │ │ │ │ ├── chunk.spec.ts
│ │ │ │ │ ├── pluck.spec.ts
│ │ │ │ │ └── reverse.spec.ts
│ │ │ │ ├── date
│ │ │ │ │ ├── index.ts
│ │ │ │ │ └── time-ago.ts
│ │ │ │ ├── string
│ │ │ │ │ ├── lines.ts
│ │ │ │ │ ├── ltrim.ts
│ │ │ │ │ ├── rtrim.ts
│ │ │ │ │ ├── trim.ts
│ │ │ │ │ ├── ucfirst.ts
│ │ │ │ │ ├── strip-tags.ts
│ │ │ │ │ ├── scan.ts
│ │ │ │ │ ├── slugify.ts
│ │ │ │ │ ├── wrap.ts
│ │ │ │ │ ├── lpad.ts
│ │ │ │ │ ├── rpad.ts
│ │ │ │ │ ├── trim.spec.ts
│ │ │ │ │ ├── ucwords.ts
│ │ │ │ │ ├── ltrim.spec.ts
│ │ │ │ │ ├── rtrim.spec.ts
│ │ │ │ │ ├── test-pipe.ts
│ │ │ │ │ ├── match.ts
│ │ │ │ │ ├── repeat.ts
│ │ │ │ │ ├── underscore.ts
│ │ │ │ │ ├── latinise.spec.ts
│ │ │ │ │ ├── camelize.ts
│ │ │ │ │ ├── underscore.spec.ts
│ │ │ │ │ ├── lpad.spec.ts
│ │ │ │ │ ├── match.spec.ts
│ │ │ │ │ ├── strip-tags.spec.ts
│ │ │ │ │ ├── repeat.spec.ts
│ │ │ │ │ ├── lines.spec.ts
│ │ │ │ │ ├── test-pipe.spec.ts
│ │ │ │ │ ├── rpad.spec.ts
│ │ │ │ │ ├── slugify.spec.ts
│ │ │ │ │ ├── shorten.ts
│ │ │ │ │ ├── ucfirst.spec.ts
│ │ │ │ │ ├── ucwords.spec.ts
│ │ │ │ │ ├── camelize.spec.ts
│ │ │ │ │ ├── scan.spec.ts
│ │ │ │ │ ├── a-or-an.ts
│ │ │ │ │ └── shorten.spec.ts
│ │ │ │ └── object
│ │ │ │ │ ├── keys.ts
│ │ │ │ │ ├── pairs.ts
│ │ │ │ │ ├── values.ts
│ │ │ │ │ ├── invert.ts
│ │ │ │ │ ├── pick.ts
│ │ │ │ │ ├── invert-by.ts
│ │ │ │ │ ├── omit.ts
│ │ │ │ │ ├── diff-obj.ts
│ │ │ │ │ ├── keys.spec.ts
│ │ │ │ │ ├── values.spec.ts
│ │ │ │ │ ├── index.ts
│ │ │ │ │ ├── pairs.spec.ts
│ │ │ │ │ ├── omit.spec.ts
│ │ │ │ │ ├── pick.spec.ts
│ │ │ │ │ ├── diff-obj.spec.ts
│ │ │ │ │ └── invert.spec.ts
│ │ │ └── ng-pipes.module.ts
│ │ ├── index.ts
│ │ ├── test-setup.ts
│ │ └── migration
│ │ │ └── migrate-to-maintenance-initiative.ts
│ ├── assets
│ │ └── ngx-logo.png
│ ├── tsconfig.lib.prod.json
│ ├── ng-package.json
│ ├── migrations.json
│ ├── tsconfig.spec.json
│ ├── tsconfig.lib.json
│ ├── package.json
│ ├── jest.config.ts
│ ├── tsconfig.json
│ ├── project.json
│ ├── LICENSE.md
│ └── .eslintrc.json
├── ng2-search-filter
│ ├── src
│ │ ├── index.ts
│ │ ├── lib
│ │ │ └── ng2-filter.module.ts
│ │ ├── test-setup.ts
│ │ └── migration
│ │ │ └── migrate-to-maintenance-initiative.ts
│ ├── tsconfig.lib.prod.json
│ ├── ng-package.json
│ ├── migrations.json
│ ├── tsconfig.spec.json
│ ├── tsconfig.lib.json
│ ├── package.json
│ ├── jest.config.ts
│ ├── tsconfig.json
│ ├── project.json
│ ├── LICENSE
│ └── .eslintrc.json
├── ng2-image-viewer
│ ├── src
│ │ ├── index.ts
│ │ ├── test-setup.ts
│ │ ├── migration
│ │ │ └── migrate-to-maintenance-initiative.ts
│ │ └── lib
│ │ │ └── image-viewer.module.ts
│ ├── tsconfig.lib.prod.json
│ ├── ng-package.json
│ ├── migrations.json
│ ├── tsconfig.spec.json
│ ├── tsconfig.lib.json
│ ├── package.json
│ ├── CHANGELOG.md
│ ├── tsconfig.json
│ ├── jest.config.ts
│ ├── project.json
│ └── .eslintrc.json
└── angular-material-rail-drawer
│ ├── src
│ ├── lib
│ │ ├── default.config.ts
│ │ ├── drawer-rail.module.ts
│ │ └── animations.settings.ts
│ ├── index.ts
│ ├── test-setup.ts
│ └── migration
│ │ └── migrate-to-maintenance-initiative.ts
│ ├── tsconfig.lib.prod.json
│ ├── ng-package.json
│ ├── migrations.json
│ ├── tsconfig.spec.json
│ ├── tsconfig.lib.json
│ ├── package.json
│ ├── tsconfig.json
│ ├── jest.config.ts
│ ├── project.json
│ ├── CHANGELOG.md
│ └── .eslintrc.json
├── .eslintignore
├── .prettierrc
├── apps
├── ngx-maintenance-dashboard
│ ├── src
│ │ ├── assets
│ │ │ └── .gitkeep
│ │ ├── app
│ │ │ ├── app.component.css
│ │ │ ├── app.routes.ts
│ │ │ ├── app.component.html
│ │ │ ├── app.config.ts
│ │ │ ├── app.component.ts
│ │ │ └── app.component.spec.ts
│ │ ├── styles.css
│ │ ├── favicon.ico
│ │ ├── main.ts
│ │ ├── test-setup.ts
│ │ └── index.html
│ ├── tsconfig.editor.json
│ ├── tsconfig.app.json
│ ├── tsconfig.spec.json
│ ├── jest.config.ts
│ ├── tsconfig.json
│ └── .eslintrc.json
└── ngx-maintenance-dashboard-e2e
│ ├── src
│ └── example.spec.ts
│ ├── project.json
│ ├── .eslintrc.json
│ └── tsconfig.json
├── commitlint.config.js
├── .husky
├── pre-commit
└── commit-msg
├── jest.preset.js
├── .prettierignore
├── jest.config.ts
├── .vscode
└── extensions.json
├── lint-staged.config.js
├── .editorconfig
├── project.json
├── .gitignore
├── .verdaccio
└── config.yml
├── .eslintrc.json
├── .eslintrc.base.json
├── LICENSE
├── tsconfig.base.json
└── CHANGELOG.md
/libs/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.github/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tools/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/angular-pkgs/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/index.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/index.ts:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": true
3 | }
4 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/src/assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/src/app/app.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './lib/ng-pipes.module';
2 |
--------------------------------------------------------------------------------
/commitlint.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ['@commitlint/config-conventional'],
3 | };
--------------------------------------------------------------------------------
/.husky/pre-commit:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 | . "$(dirname -- "$0")/_/husky.sh"
3 |
4 | npx lint-staged
5 |
--------------------------------------------------------------------------------
/libs/utils/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './lib/trycatch';
2 | export { httpsGet, httpsRequest } from './lib/https'
--------------------------------------------------------------------------------
/jest.preset.js:
--------------------------------------------------------------------------------
1 | const nxPreset = require('@nx/jest/preset').default;
2 |
3 | module.exports = { ...nxPreset };
4 |
--------------------------------------------------------------------------------
/.husky/commit-msg:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 | . "$(dirname -- "$0")/_/husky.sh"
3 |
4 | npx --no-install commitlint --edit "$1"
--------------------------------------------------------------------------------
/libs/ngx-maintenance/README.md:
--------------------------------------------------------------------------------
1 | # ngx-maintenance
2 |
3 | Our bulit in CLI to manage and integrate packages into our repo
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | # Add files here to ignore them from prettier formatting
2 | /dist
3 | /coverage
4 | /.nx/cache
5 | .angular
6 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-search-filter/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './lib/ng2-filter.module';
2 | export * from './lib/ng2-filter.pipe';
3 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/jest.config.ts:
--------------------------------------------------------------------------------
1 | import { getJestProjects } from '@nx/jest';
2 |
3 | export default {
4 | projects: getJestProjects(),
5 | };
6 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-image-viewer/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './lib/image-viewer.component';
2 | export * from './lib/image-viewer.module';
3 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/src/app/app.routes.ts:
--------------------------------------------------------------------------------
1 | import { Route } from '@angular/router';
2 |
3 | export const appRoutes: Route[] = [];
4 |
--------------------------------------------------------------------------------
/libs/devkit/README.md:
--------------------------------------------------------------------------------
1 | # devkit
2 |
3 | Our devkit is designed to help develop and support the Angular Compatibility Maintenance Initiative efforts
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/assets/ngx-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danielglejzner/ngx-maintenance/HEAD/angular-pkgs/ngx-pipes/assets/ngx-logo.png
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danielglejzner/ngx-maintenance/HEAD/apps/ngx-maintenance-dashboard/src/favicon.ico
--------------------------------------------------------------------------------
/angular-pkgs/angular-material-rail-drawer/src/lib/default.config.ts:
--------------------------------------------------------------------------------
1 | export const miniConfig = {
2 | defaultDuration: '100ms',
3 | defaultMinWidth: '60px',
4 | defaultMaxWidth: '200px',
5 | };
6 |
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": [
3 | "nrwl.angular-console",
4 | "esbenp.prettier-vscode",
5 | "firsttris.vscode-jest-runner",
6 | "ms-playwright.playwright"
7 | ]
8 | }
9 |
--------------------------------------------------------------------------------
/libs/devkit/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './lib/to-maintenance-initiative';
2 | export { checkoutImportAndMigrateAngular, } from './lib/checkout-and-update'
3 | export { httpsGet, httpsRequest, tryCatch } from '@ngx-maintenance/utils'
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/tsconfig.editor.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src/**/*.ts"],
4 | "compilerOptions": {},
5 | "exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"]
6 | }
7 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/tsconfig.lib.prod.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.lib.json",
3 | "compilerOptions": {
4 | "declarationMap": false
5 | },
6 | "angularCompilerOptions": {
7 | "compilationMode": "partial"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-image-viewer/tsconfig.lib.prod.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.lib.json",
3 | "compilerOptions": {
4 | "declarationMap": false
5 | },
6 | "angularCompilerOptions": {
7 | "compilationMode": "partial"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-search-filter/tsconfig.lib.prod.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.lib.json",
3 | "compilerOptions": {
4 | "declarationMap": false
5 | },
6 | "angularCompilerOptions": {
7 | "compilationMode": "partial"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/libs/devkit/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ngx-maintenance/devkit",
3 | "version": "0.1.1",
4 | "dependencies": {
5 | "tslib": "^2.3.0"
6 | },
7 | "type": "commonjs",
8 | "main": "./src/index.js",
9 | "typings": "./src/index.d.ts"
10 | }
11 |
--------------------------------------------------------------------------------
/libs/utils/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ngx-maintenance/utils",
3 | "version": "0.1.1",
4 | "dependencies": {
5 | "tslib": "^2.3.0"
6 | },
7 | "type": "commonjs",
8 | "main": "./src/index.js",
9 | "typings": "./src/index.d.ts"
10 | }
11 |
--------------------------------------------------------------------------------
/angular-pkgs/angular-material-rail-drawer/tsconfig.lib.prod.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.lib.json",
3 | "compilerOptions": {
4 | "declarationMap": false
5 | },
6 | "angularCompilerOptions": {
7 | "compilationMode": "partial"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/libs/npm-api/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ngx-maintenance/npm-api",
3 | "version": "0.1.1",
4 | "dependencies": {
5 | "tslib": "^2.3.0"
6 | },
7 | "type": "commonjs",
8 | "main": "./src/index.js",
9 | "typings": "./src/index.d.ts"
10 | }
11 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-search-filter/src/lib/ng2-filter.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Ng2SearchPipe } from './ng2-filter.pipe';
3 |
4 | @NgModule({
5 | imports: [Ng2SearchPipe],
6 | exports: [Ng2SearchPipe]
7 | })
8 |
9 | export class Ng2SearchPipeModule { }
10 |
--------------------------------------------------------------------------------
/lint-staged.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | '{packages,tools}/**/*.{ts,js,json,md,html,css,scss}': [
3 | 'nx workspace-lint',
4 | 'nx affected --target lint --uncommitted --fix true',
5 | 'nx affected --target test --uncommitted',
6 | 'nx format:write --uncommitted --libs-and-apps',
7 | ],
8 | };
--------------------------------------------------------------------------------
/angular-pkgs/angular-material-rail-drawer/src/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Public API Surface of angular-material-rail-drawer
3 | */
4 | export * from './lib/default.config';
5 | export * from './lib/animations.settings';
6 | export * from './lib/drawer-rail.directive';
7 | export * from './lib/drawer-rail.module';
8 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-image-viewer/ng-package.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3 | "dest": "../../dist/angular-pkgs/ng2-image-viewer",
4 | "lib": {
5 | "entryFile": "src/index.ts"
6 | },
7 | "allowedNonPeerDependencies": ["iv-viewer", "@nx/devkit"]
8 | }
9 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/ng-package.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3 | "dest": "../../dist/angular-pkgs/ngx-pipes",
4 | "lib": {
5 | "entryFile": "src/index.ts"
6 | },
7 | "allowedNonPeerDependencies": [
8 | "@nx/devkit"
9 | ]
10 | }
11 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard-e2e/src/example.spec.ts:
--------------------------------------------------------------------------------
1 | import { test, expect } from '@playwright/test';
2 |
3 | test('has title', async ({ page }) => {
4 | await page.goto('/');
5 |
6 | // Expect h1 to contain a substring.
7 | expect(await page.locator('h1').innerText()).toContain('Welcome');
8 | });
9 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/src/app/app.config.ts:
--------------------------------------------------------------------------------
1 | import { ApplicationConfig } from '@angular/core';
2 | import { provideRouter } from '@angular/router';
3 | import { appRoutes } from './app.routes';
4 |
5 | export const appConfig: ApplicationConfig = {
6 | providers: [provideRouter(appRoutes)],
7 | };
8 |
--------------------------------------------------------------------------------
/angular-pkgs/angular-material-rail-drawer/ng-package.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3 | "dest": "../../dist/angular-pkgs/angular-material-rail-drawer",
4 | "lib": {
5 | "entryFile": "src/index.ts"
6 | },
7 | "allowedNonPeerDependencies": ["@nx/devkit"]
8 | }
9 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/src/main.ts:
--------------------------------------------------------------------------------
1 | import { bootstrapApplication } from '@angular/platform-browser';
2 | import { appConfig } from './app/app.config';
3 | import { AppComponent } from './app/app.component';
4 |
5 | bootstrapApplication(AppComponent, appConfig).catch((err) =>
6 | console.error(err)
7 | );
8 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see http://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 2
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | max_line_length = off
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-search-filter/ng-package.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3 | "dest": "../../dist/angular-pkgs/ng2-search-filter",
4 | "lib": {
5 | "entryFile": "src/index.ts"
6 | },
7 | "allowedNonPeerDependencies": [
8 | "@nx/devkit"
9 | ]
10 | }
11 |
--------------------------------------------------------------------------------
/libs/npm-api/src/index.ts:
--------------------------------------------------------------------------------
1 | export { fetchNpmApi, findCompatibleVersion } from './lib/npm-registry';
2 | export { PackageJson, PackageMetadata } from './lib/interfaces/package'
3 | export { RegistryInfo } from './lib/interfaces/registry-info'
4 | export { SearchQueryParams, SearchResponse } from './lib/interfaces/search'
5 |
--------------------------------------------------------------------------------
/libs/utils/tsconfig.lib.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "declaration": true,
6 | "types": ["node"]
7 | },
8 | "include": ["src/**/*.ts"],
9 | "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-null.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'isNull',
5 | standalone: true,
6 | })
7 | export class IsNullPipe implements PipeTransform {
8 | transform(input: any): boolean {
9 | return input === null;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/libs/devkit/tsconfig.lib.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "declaration": true,
6 | "types": ["node"]
7 | },
8 | "include": ["src/**/*.ts"],
9 | "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/libs/npm-api/tsconfig.lib.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "declaration": true,
6 | "types": ["node"]
7 | },
8 | "include": ["src/**/*.ts"],
9 | "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/libs/ngx-maintenance/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ngx-maintenance",
3 | "version": "0.1.2",
4 | "dependencies": {
5 | "tslib": "^2.3.0"
6 | },
7 | "type": "module",
8 | "main": "./bin/index.js",
9 | "typings": "./bin/index.d.ts",
10 | "bin": {
11 | "ngx-maintenance": "./bin/index.js"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-array.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'isArray',
5 | standalone: true,
6 | })
7 | export class IsArrayPipe implements PipeTransform {
8 | transform(input: any): boolean {
9 | return Array.isArray(input);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/test-setup.ts:
--------------------------------------------------------------------------------
1 | // @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
2 | globalThis.ngJest = {
3 | testEnvironmentOptions: {
4 | errorOnUnknownElements: true,
5 | errorOnUnknownProperties: true,
6 | },
7 | };
8 | import 'jest-preset-angular/setup-jest';
9 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "types": []
6 | },
7 | "files": ["src/main.ts"],
8 | "include": ["src/**/*.d.ts"],
9 | "exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-image-viewer/src/test-setup.ts:
--------------------------------------------------------------------------------
1 | // @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
2 | globalThis.ngJest = {
3 | testEnvironmentOptions: {
4 | errorOnUnknownElements: true,
5 | errorOnUnknownProperties: true,
6 | },
7 | };
8 | import 'jest-preset-angular/setup-jest';
9 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/migration/migrate-to-maintenance-initiative.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable @typescript-eslint/no-unused-vars */
2 | import { Tree } from '@nx/devkit';
3 | import { toMaintenanceInitiative } from '@ngx-maintenance/devkit'
4 |
5 | export default function update(tree: Tree) {
6 | toMaintenanceInitiative(tree, 'ngx-pipes');
7 | }
8 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-search-filter/src/test-setup.ts:
--------------------------------------------------------------------------------
1 | // @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
2 | globalThis.ngJest = {
3 | testEnvironmentOptions: {
4 | errorOnUnknownElements: true,
5 | errorOnUnknownProperties: true,
6 | },
7 | };
8 | import 'jest-preset-angular/setup-jest';
9 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/max.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'max',
5 | standalone: true,
6 | })
7 | export class MaxPipe implements PipeTransform {
8 | transform(arr: any): number | number[] {
9 | return Array.isArray(arr) ? Math.max(...arr) : arr;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/min.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'min',
5 | standalone: true,
6 | })
7 | export class MinPipe implements PipeTransform {
8 | transform(arr: any): number | number[] {
9 | return Array.isArray(arr) ? Math.min(...arr) : arr;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard-e2e/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ngx-maintenance-dashboard-e2e",
3 | "$schema": "../../node_modules/nx/schemas/project-schema.json",
4 | "projectType": "application",
5 | "sourceRoot": "apps/ngx-maintenance-dashboard-e2e/src",
6 | "targets": {},
7 | "implicitDependencies": ["ngx-maintenance-dashboard"]
8 | }
9 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/src/test-setup.ts:
--------------------------------------------------------------------------------
1 | // @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
2 | globalThis.ngJest = {
3 | testEnvironmentOptions: {
4 | errorOnUnknownElements: true,
5 | errorOnUnknownProperties: true,
6 | },
7 | };
8 | import 'jest-preset-angular/setup-jest';
9 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-less-than.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'isLessThan',
5 | standalone: true,
6 | })
7 | export class IsLessThanPipe implements PipeTransform {
8 | transform(input: number, other: number): boolean {
9 | return input < other;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/angular-pkgs/angular-material-rail-drawer/src/test-setup.ts:
--------------------------------------------------------------------------------
1 | // @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
2 | globalThis.ngJest = {
3 | testEnvironmentOptions: {
4 | errorOnUnknownElements: true,
5 | errorOnUnknownProperties: true,
6 | },
7 | };
8 | import 'jest-preset-angular/setup-jest';
9 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-image-viewer/src/migration/migrate-to-maintenance-initiative.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable @typescript-eslint/no-unused-vars */
2 | import { Tree } from '@nx/devkit';
3 | import { toMaintenanceInitiative } from '@ngx-maintenance/devkit'
4 |
5 | export default function update(tree: Tree) {
6 | toMaintenanceInitiative(tree, 'ng2-image-viewer');
7 | }
8 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-search-filter/src/migration/migrate-to-maintenance-initiative.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable @typescript-eslint/no-unused-vars */
2 | import { Tree } from '@nx/devkit';
3 | import { toMaintenanceInitiative } from '@ngx-maintenance/devkit'
4 |
5 | export default function update(tree: Tree) {
6 | toMaintenanceInitiative(tree, 'ng2-search-filter');
7 | }
8 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/group-by-impure.ts:
--------------------------------------------------------------------------------
1 | import { Pipe } from '@angular/core';
2 | import { GroupByPipe } from './group-by';
3 |
4 | // tslint:disable use-pipe-transform-interface
5 | @Pipe({
6 | name: 'groupByImpure',
7 | pure: false,
8 | standalone: true,
9 | })
10 | export class GroupByImpurePipe extends GroupByPipe {}
11 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/order-by-impure.ts:
--------------------------------------------------------------------------------
1 | import { Pipe } from '@angular/core';
2 | import { OrderByPipe } from './order-by';
3 |
4 | // tslint:disable use-pipe-transform-interface
5 | @Pipe({
6 | name: 'orderByImpure',
7 | pure: false,
8 | standalone: true,
9 | })
10 | export class OrderByImpurePipe extends OrderByPipe {}
11 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-identical-to.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'isIdenticalTo',
5 | standalone: true,
6 | })
7 | export class IsIdenticalToPipe implements PipeTransform {
8 | transform(input: any, other: any): boolean {
9 | return input === other;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/libs/devkit/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "module": "commonjs",
6 | "types": ["jest", "node"]
7 | },
8 | "include": [
9 | "jest.config.ts",
10 | "src/**/*.test.ts",
11 | "src/**/*.spec.ts",
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/libs/npm-api/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "module": "commonjs",
6 | "types": ["jest", "node"]
7 | },
8 | "include": [
9 | "jest.config.ts",
10 | "src/**/*.test.ts",
11 | "src/**/*.spec.ts",
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/libs/utils/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "module": "commonjs",
6 | "types": ["jest", "node"]
7 | },
8 | "include": [
9 | "jest.config.ts",
10 | "src/**/*.test.ts",
11 | "src/**/*.spec.ts",
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/filter-by-impure.ts:
--------------------------------------------------------------------------------
1 | import { Pipe } from '@angular/core';
2 | import { FilterByPipe } from './filter-by';
3 |
4 | // tslint:disable use-pipe-transform-interface
5 | @Pipe({
6 | name: 'filterByImpure',
7 | pure: false,
8 | standalone: true,
9 | })
10 | export class FilterByImpurePipe extends FilterByPipe {}
11 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-greater-than.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'isGreaterThan',
5 | standalone: true,
6 | })
7 | export class IsGreaterThanPipe implements PipeTransform {
8 | transform(input: number, other: number): boolean {
9 | return input > other;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-not-identical-to.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'isNotIdenticalTo',
5 | standalone: true,
6 | })
7 | export class IsNotIdenticalToPipe implements PipeTransform {
8 | transform(input: any, other: any): boolean {
9 | return input !== other;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/libs/ngx-maintenance/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "module": "commonjs",
6 | "types": ["jest", "node"]
7 | },
8 | "include": [
9 | "jest.config.ts",
10 | "src/**/*.test.ts",
11 | "src/**/*.spec.ts",
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-less-equal-than.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'isLessEqualThan',
5 | standalone: true,
6 | })
7 | export class IsLessEqualThanPipe implements PipeTransform {
8 | transform(input: number, other: number): boolean {
9 | return input <= other;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/date/index.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { TimeAgoPipe } from './time-ago';
3 |
4 | export const DATE_PIPES = [TimeAgoPipe];
5 |
6 | @NgModule({
7 | imports: [...DATE_PIPES],
8 | exports: DATE_PIPES,
9 | })
10 | export class NgDatePipesModule {}
11 |
12 | export { TimeAgoPipe } from './time-ago';
13 |
--------------------------------------------------------------------------------
/angular-pkgs/angular-material-rail-drawer/src/migration/migrate-to-maintenance-initiative.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable @typescript-eslint/no-unused-vars */
2 | import { Tree } from '@nx/devkit';
3 | import { toMaintenanceInitiative } from '@ngx-maintenance/devkit'
4 |
5 | export default function update(tree: Tree) {
6 | toMaintenanceInitiative(tree, 'angular-material-rail-drawer');
7 | }
8 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-greater-equal-than.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'isGreaterEqualThan',
5 | standalone: true,
6 | })
7 | export class IsGreaterEqualThanPipe implements PipeTransform {
8 | transform(input: number, other: number): boolean {
9 | return input >= other;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-number.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isNumber } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'isNumber',
6 | standalone: true,
7 | })
8 | export class IsNumberPipe implements PipeTransform {
9 | transform(input: any): boolean {
10 | return isNumber(input);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-object.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isObject } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'isObject',
6 | standalone: true,
7 | })
8 | export class IsObjectPipe implements PipeTransform {
9 | transform(input: any): boolean {
10 | return isObject(input);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-string.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'isString',
6 | standalone: true,
7 | })
8 | export class IsStringPipe implements PipeTransform {
9 | transform(input: any): boolean {
10 | return isString(input);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-defined.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isUndefined } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'isDefined',
6 | standalone: true,
7 | })
8 | export class IsDefinedPipe implements PipeTransform {
9 | transform(input: any): boolean {
10 | return !isUndefined(input);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-function.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isFunction } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'isFunction',
6 | standalone: true,
7 | })
8 | export class IsFunctionPipe implements PipeTransform {
9 | transform(input: any): boolean {
10 | return isFunction(input);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/libs/utils/jest.config.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | export default {
3 | displayName: 'utils',
4 | preset: '../../jest.preset.js',
5 | testEnvironment: 'node',
6 | transform: {
7 | '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }],
8 | },
9 | moduleFileExtensions: ['ts', 'js', 'html'],
10 | coverageDirectory: '../../coverage/libs/utils',
11 | };
12 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-equal-to.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'isEqualTo',
5 | standalone: true,
6 | })
7 | export class IsEqualToPipe implements PipeTransform {
8 | transform(input: any, other: any): boolean {
9 | // tslint:disable-next-line:triple-equals
10 | return input == other;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-undefined.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isUndefined } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'isUndefined',
6 | standalone: true,
7 | })
8 | export class IsUndefinedPipe implements PipeTransform {
9 | transform(input: any): boolean {
10 | return isUndefined(input);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/libs/devkit/jest.config.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | export default {
3 | displayName: 'devkit',
4 | preset: '../../jest.preset.js',
5 | testEnvironment: 'node',
6 | transform: {
7 | '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }],
8 | },
9 | moduleFileExtensions: ['ts', 'js', 'html'],
10 | coverageDirectory: '../../coverage/libs/devkit',
11 | };
12 |
--------------------------------------------------------------------------------
/libs/npm-api/jest.config.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | export default {
3 | displayName: 'npm-api',
4 | preset: '../../jest.preset.js',
5 | testEnvironment: 'node',
6 | transform: {
7 | '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }],
8 | },
9 | moduleFileExtensions: ['ts', 'js', 'html'],
10 | coverageDirectory: '../../coverage/libs/npm-api',
11 | };
12 |
--------------------------------------------------------------------------------
/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ngx-maintenance/source",
3 | "$schema": "node_modules/nx/schemas/project-schema.json",
4 | "targets": {
5 | "local-registry": {
6 | "executor": "@nx/js:verdaccio",
7 | "options": {
8 | "port": 4873,
9 | "config": ".verdaccio/config.yml",
10 | "storage": "tmp/local-registry/storage"
11 | }
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-not-equal-to.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'isNotEqualTo',
5 | standalone: true,
6 | })
7 | export class IsNotEqualToPipe implements PipeTransform {
8 | transform(input: any, other: any): boolean {
9 | // tslint:disable-next-line:triple-equals
10 | return input != other;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/sqrt.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'sqrt',
5 | standalone: true,
6 | })
7 | export class SqrtPipe implements PipeTransform {
8 | transform(num: number): number;
9 | transform(num: T): T;
10 |
11 | transform(num: any): any {
12 | return !isNaN(num) ? Math.sqrt(num) : num;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/round.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { applyPrecision } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'round',
6 | standalone: true,
7 | })
8 | export class RoundPipe implements PipeTransform {
9 | transform(num: number, precision: number = 0): number {
10 | return applyPrecision(num, precision);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/range.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'range',
5 | standalone: true,
6 | })
7 | export class RangePipe implements PipeTransform {
8 | transform(start: number = 1, count: number = 0, step: number = 1): any {
9 | return Array(count)
10 | .fill('')
11 | .map((v, i) => step * i + start);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/libs/ngx-maintenance/jest.config.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | export default {
3 | displayName: 'ngx-maintenance',
4 | preset: '../../jest.preset.js',
5 | testEnvironment: 'node',
6 | transform: {
7 | '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }],
8 | },
9 | moduleFileExtensions: ['ts', 'js', 'html'],
10 | coverageDirectory: '../../coverage/libs/ngx-maintenance',
11 | };
12 |
--------------------------------------------------------------------------------
/libs/utils/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.1.1 (2024-04-06)
2 |
3 |
4 | ### 🩹 Fixes
5 |
6 | - update documentation ([d2968b2](https://github.com/danielglejzner/ngx-maintenance/commit/d2968b2))
7 |
8 |
9 | ### ❤️ Thank You
10 |
11 | - Arturo Volpe @aVolpe
12 | - Jordan Hall @Jordan-Hall
13 |
14 | ## 0.1.0 (2024-03-13)
15 |
16 | This was a version bump only for utils to align it with other projects, there were no code changes.
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/migrations.json:
--------------------------------------------------------------------------------
1 | {
2 | "generators": {
3 | "migrate-to-maintenance-initiative": {
4 | "version": "1.0.0",
5 | "description": "Migration for v1.0.0",
6 | "implementation": ".src//migration/migrate-to-maintenance-initiative"
7 | }
8 | },
9 | "packageJsonUpdates": {
10 | "1.0.0": {
11 | "version": "1.0.0",
12 | "packages": {}
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-image-viewer/migrations.json:
--------------------------------------------------------------------------------
1 | {
2 | "generators": {
3 | "migrate-to-maintenance-initiative": {
4 | "version": "1.0.0",
5 | "description": "Migration for v1.0.0",
6 | "implementation": ".src/migration/migrate-to-maintenance-initiative"
7 | }
8 | },
9 | "packageJsonUpdates": {
10 | "1.0.0": {
11 | "version": "1.0.0",
12 | "packages": {}
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-search-filter/migrations.json:
--------------------------------------------------------------------------------
1 | {
2 | "generators": {
3 | "migrate-to-maintenance-initiative": {
4 | "version": "1.0.0",
5 | "description": "Migration for v1.0.0",
6 | "implementation": ".src//migration/migrate-to-maintenance-initiative"
7 | }
8 | },
9 | "packageJsonUpdates": {
10 | "1.0.0": {
11 | "version": "1.0.0",
12 | "packages": {}
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/every.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'every',
5 | standalone: true,
6 | })
7 | export class EveryPipe implements PipeTransform {
8 | transform(input: any, predicate: (value: any, index: number, array: any[]) => boolean): boolean | any[] {
9 | return Array.isArray(input) ? input.every(predicate) : false;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/sum.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'sum',
5 | standalone: true,
6 | })
7 | export class SumPipe implements PipeTransform {
8 | transform(num: any[]): number;
9 | transform(num: any): T;
10 |
11 | transform(arr: any): any {
12 | return Array.isArray(arr) ? arr.reduce((sum, curr) => sum + curr, 0) : arr;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "module": "commonjs",
6 | "target": "es2016",
7 | "types": ["jest", "node"]
8 | },
9 | "files": ["src/test-setup.ts"],
10 | "include": [
11 | "jest.config.ts",
12 | "src/**/*.test.ts",
13 | "src/**/*.spec.ts",
14 | "src/**/*.d.ts"
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/angular-pkgs/angular-material-rail-drawer/src/lib/drawer-rail.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { MatSidenavModule } from '@angular/material/sidenav';
3 | import { MatDrawerRailDirective } from './drawer-rail.directive';
4 |
5 | @NgModule({
6 | imports: [MatSidenavModule],
7 | declarations: [MatDrawerRailDirective],
8 | exports: [MatDrawerRailDirective],
9 | })
10 | export class DrawerRailModule {}
11 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-image-viewer/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "module": "commonjs",
6 | "target": "es2016",
7 | "types": ["jest", "node"]
8 | },
9 | "files": ["src/test-setup.ts"],
10 | "include": [
11 | "jest.config.ts",
12 | "src/**/*.test.ts",
13 | "src/**/*.spec.ts",
14 | "src/**/*.d.ts"
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-search-filter/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "module": "commonjs",
6 | "target": "es2016",
7 | "types": ["jest", "node"]
8 | },
9 | "files": ["src/test-setup.ts"],
10 | "include": [
11 | "jest.config.ts",
12 | "src/**/*.test.ts",
13 | "src/**/*.spec.ts",
14 | "src/**/*.d.ts"
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/truthify.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'truthify',
5 | standalone: true,
6 | })
7 | export class TrurthifyPipe implements PipeTransform {
8 | transform(input: any[]): any[];
9 | transform(input: T): T;
10 |
11 | transform(input: any): any {
12 | return Array.isArray(input) ? input.filter((e) => !!e) : input;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "module": "commonjs",
6 | "target": "es2016",
7 | "types": ["jest", "node"]
8 | },
9 | "files": ["src/test-setup.ts"],
10 | "include": [
11 | "jest.config.ts",
12 | "src/**/*.test.ts",
13 | "src/**/*.spec.ts",
14 | "src/**/*.d.ts"
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/angular-pkgs/angular-material-rail-drawer/migrations.json:
--------------------------------------------------------------------------------
1 | {
2 | "generators": {
3 | "migrate-to-maintenance-initiative": {
4 | "version": "1.0.0",
5 | "description": "Migration for v1.0.0",
6 | "implementation": ".src//migration/migrate-to-maintenance-initiative"
7 | }
8 | },
9 | "packageJsonUpdates": {
10 | "1.0.0": {
11 | "version": "1.0.0",
12 | "packages": {}
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/lines.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'lines',
6 | standalone: true,
7 | })
8 | export class LinesPipe implements PipeTransform {
9 | transform(text: any, chars: string = '\\s'): Array | any {
10 | return isString(text) ? text.replace(/\r\n/g, '\n').split('\n') : text;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/ltrim.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'ltrim',
6 | standalone: true,
7 | })
8 | export class LeftTrimPipe implements PipeTransform {
9 | transform(text: string, chars: string = '\\s'): string {
10 | return isString(text) ? text.replace(new RegExp(`^[${chars}]+`), '') : text;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/rtrim.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'rtrim',
6 | standalone: true,
7 | })
8 | export class RightTrimPipe implements PipeTransform {
9 | transform(text: string, chars: string = '\\s'): string {
10 | return isString(text) ? text.replace(new RegExp(`[${chars}]+$`), '') : text;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/libs/ngx-maintenance/tsconfig.lib.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "declaration": true,
6 | "types": [
7 | "node"
8 | ]
9 | },
10 | "include": [
11 | "bin/**/*.ts",
12 | "src/**/*.ts",
13 | "bin/**/*.ts"
14 | ],
15 | "exclude": [
16 | "jest.config.ts",
17 | "src/**/*.spec.ts",
18 | "src/**/*.test.ts"
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/angular-pkgs/angular-material-rail-drawer/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "module": "commonjs",
6 | "target": "es2016",
7 | "types": ["jest", "node"]
8 | },
9 | "files": ["src/test-setup.ts"],
10 | "include": [
11 | "jest.config.ts",
12 | "src/**/*.test.ts",
13 | "src/**/*.spec.ts",
14 | "src/**/*.d.ts"
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/pow.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'pow',
5 | standalone: true,
6 | })
7 | export class PowerPipe implements PipeTransform {
8 | transform(num: number, power?: number): number;
9 | transform(num: any, power?: number): any;
10 |
11 | transform(num: any, power: number = 2): number {
12 | return !isNaN(num) ? num ** power : num;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/object/keys.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isObject } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'keys',
6 | standalone: true,
7 | })
8 | export class KeysPipe implements PipeTransform {
9 | transform(obj: any): any[] {
10 | if (Array.isArray(obj) || !isObject(obj)) {
11 | return obj;
12 | }
13 |
14 | return Object.keys(obj);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/tsconfig.lib.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "declaration": true,
6 | "declarationMap": true,
7 | "inlineSources": true,
8 | "types": []
9 | },
10 | "exclude": [
11 | "src/**/*.spec.ts",
12 | "src/test-setup.ts",
13 | "jest.config.ts",
14 | "src/**/*.test.ts"
15 | ],
16 | "include": ["src/**/*.ts"]
17 | }
18 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-image-viewer/tsconfig.lib.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "declaration": true,
6 | "declarationMap": true,
7 | "inlineSources": true,
8 | "types": []
9 | },
10 | "exclude": [
11 | "src/**/*.spec.ts",
12 | "src/test-setup.ts",
13 | "jest.config.ts",
14 | "src/**/*.test.ts"
15 | ],
16 | "include": ["src/**/*.ts"]
17 | }
18 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-search-filter/tsconfig.lib.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "declaration": true,
6 | "declarationMap": true,
7 | "inlineSources": true,
8 | "types": []
9 | },
10 | "exclude": [
11 | "src/**/*.spec.ts",
12 | "src/test-setup.ts",
13 | "jest.config.ts",
14 | "src/**/*.test.ts"
15 | ],
16 | "include": ["src/**/*.ts"]
17 | }
18 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/trim.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'trim',
6 | standalone: true,
7 | })
8 | export class TrimPipe implements PipeTransform {
9 | transform(text: string, chars: string = '\\s'): string {
10 | return isString(text) ? text.replace(new RegExp(`^[${chars}]+|[${chars}]+$`, 'g'), '') : text;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/libs/npm-api/src/lib/interfaces/registry-info.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Interface representing registry data.
3 | */
4 | export interface RegistryInfo {
5 | db_name: string;
6 | doc_count: number;
7 | doc_del_count: number;
8 | update_seq: number;
9 | purge_seq: number;
10 | compact_running: boolean;
11 | disk_size: number;
12 | data_size: number;
13 | instance_start_time: string;
14 | disk_format_version: number;
15 | committed_update_seq: number;
16 | }
17 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/tail.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'tail',
5 | standalone: true,
6 | })
7 | export class TailPipe implements PipeTransform {
8 | transform(input: T, num?: number): T;
9 | transform(input: any[], num?: number): any[];
10 |
11 | transform(input: any, num: number = 0): any {
12 | return Array.isArray(input) ? input.slice(num) : input;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/object/pairs.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isObject } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'pairs',
6 | standalone: true,
7 | })
8 | export class PairsPipe implements PipeTransform {
9 | transform(obj: any): any[] {
10 | if (Array.isArray(obj) || !isObject(obj)) {
11 | return obj;
12 | }
13 |
14 | return Object.entries(obj);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ngx-maintenance-dashboard
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/angular-pkgs/angular-material-rail-drawer/tsconfig.lib.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../../dist/out-tsc",
5 | "declaration": true,
6 | "declarationMap": true,
7 | "inlineSources": true,
8 | "types": []
9 | },
10 | "exclude": [
11 | "src/**/*.spec.ts",
12 | "src/test-setup.ts",
13 | "jest.config.ts",
14 | "src/**/*.test.ts"
15 | ],
16 | "include": ["src/**/*.ts"]
17 | }
18 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/ceil.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'ceil',
5 | standalone: true,
6 | })
7 | export class CeilPipe implements PipeTransform {
8 | transform(num: number, precision: number = 0): number {
9 | if (precision <= 0) {
10 | return Math.ceil(num);
11 | }
12 |
13 | const tho = 10 ** precision;
14 |
15 | return Math.ceil(num * tho) / tho;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/initial.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'initial',
5 | standalone: true,
6 | })
7 | export class InitialPipe implements PipeTransform {
8 | transform(input: any[], num: number): any[];
9 | transform(input: any): any;
10 |
11 | transform(input: any, num: number = 0): any[] {
12 | return Array.isArray(input) ? input.slice(0, input.length - num) : input;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/floor.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'floor',
5 | standalone: true,
6 | })
7 | export class FloorPipe implements PipeTransform {
8 | transform(num: number, precision: number = 0): number {
9 | if (precision <= 0) {
10 | return Math.floor(num);
11 | }
12 |
13 | const tho = 10 ** precision;
14 |
15 | return Math.floor(num * tho) / tho;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/object/values.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isObject } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'values',
6 | standalone: true,
7 | })
8 | export class ValuesPipe implements PipeTransform {
9 | transform(obj: any): any[] {
10 | if (Array.isArray(obj) || !isObject(obj)) {
11 | return obj;
12 | }
13 |
14 | return Object.keys(obj).map((k) => obj[k]);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ngx-maintenance/ngx-pipes",
3 | "version": "1.2.0",
4 | "scripts": {
5 | "postinstall": "npx ngx-maintenance warn ngx-pipes"
6 | },
7 | "peerDependencies": {
8 | "@angular/common": "^17.1.0",
9 | "@angular/core": "^17.1.0"
10 | },
11 | "dependencies": {
12 | "tslib": "^2.3.0"
13 | },
14 | "sideEffects": false,
15 | "nx-migrations": {
16 | "migrations": "./migrations.json"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/ucfirst.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString, ucFirst } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'ucfirst',
6 | standalone: true,
7 | })
8 | export class UcFirstPipe implements PipeTransform {
9 | transform(input: string): string;
10 | transform(input: any): any;
11 |
12 | transform(text: any): string {
13 | return isString(text) ? ucFirst(text) : text;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/degrees.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isNumberFinite } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'degrees',
6 | standalone: true,
7 | })
8 | export class DegreesPipe implements PipeTransform {
9 | transform(radians: number | null | undefined): number {
10 | if (!isNumberFinite(radians)) {
11 | return NaN;
12 | }
13 |
14 | return (radians * 180) / Math.PI;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/radians.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isNumberFinite } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'radians',
6 | standalone: true,
7 | })
8 | export class RadiansPipe implements PipeTransform {
9 | transform(degrees: number | null | undefined): number {
10 | if (!isNumberFinite(degrees)) {
11 | return NaN;
12 | }
13 |
14 | return (degrees * Math.PI) / 180;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-image-viewer/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ngx-maintenance/ng2-image-viewer",
3 | "version": "1.2.0",
4 | "publishConfig": {
5 | "access": "public"
6 | },
7 | "peerDependencies": {
8 | "@angular/common": "^17.1.0",
9 | "@angular/core": "^17.1.0"
10 | },
11 | "dependencies": {
12 | "iv-viewer": "^2.0.1",
13 | "tslib": "^2.3.0"
14 | },
15 | "sideEffects": false,
16 | "nx-migrations": {
17 | "migrations": "./migrations.json"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/strip-tags.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'stripTags',
5 | standalone: true,
6 | })
7 | export class StripTagsPipe implements PipeTransform {
8 | transform(text: string, ...allowedTags: any[]): string {
9 | return allowedTags.length > 0
10 | ? text.replace(new RegExp(`<(?!\/?(${allowedTags.join('|')})\s*\/?)[^>]+>`, 'g'), '')
11 | : text.replace(/<(?:.|\s)*?>/g, '');
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-search-filter/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ngx-maintenance/ng2-search-filter",
3 | "version": "1.2.0",
4 | "scripts": {
5 | "postinstall": "npx ngx-maintenance warn ng2-search-filter"
6 | },
7 | "peerDependencies": {
8 | "@angular/common": "^17.1.0",
9 | "@angular/core": "^17.1.0"
10 | },
11 | "dependencies": {
12 | "tslib": "^2.3.0"
13 | },
14 | "sideEffects": false,
15 | "nx-migrations": {
16 | "migrations": "./migrations.json"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/reverse.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'reverse',
6 | standalone: true,
7 | })
8 | export class ReversePipe implements PipeTransform {
9 | transform(input: any): any {
10 | if (isString(input)) {
11 | return input.split('').reverse().join('');
12 | }
13 |
14 | return Array.isArray(input) ? input.slice().reverse() : input;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-less-than.spec.ts:
--------------------------------------------------------------------------------
1 | import { IsLessThanPipe } from './is-less-than';
2 |
3 | describe('IsLessThanPipe', () => {
4 | let pipe: IsLessThanPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new IsLessThanPipe();
8 | });
9 |
10 | it('should check if of given value is less than other', () => {
11 | expect(pipe.transform(1, 1)).toBeFalsy();
12 | expect(pipe.transform(1, 2)).toBeTruthy();
13 | expect(pipe.transform(2, 1)).toBeFalsy();
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/libs/utils/src/lib/trycatch.ts:
--------------------------------------------------------------------------------
1 | export async function tryCatch(
2 | mainOperation: () => Promise | T
3 | ): Promise<{ error?: E; result?: T }> {
4 | try {
5 | const result = await Promise.resolve(mainOperation());
6 | return { result };
7 | } catch (error) {
8 | if (error instanceof Error) {
9 | return { error: error as E };
10 | }
11 | console.error("Caught an unexpected error type:", error);
12 | return { error: new Error("An unexpected error occurred") as E };
13 | }
14 | }
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/scan.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString, isUndefined } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'scan',
6 | standalone: true,
7 | })
8 | export class ScanPipe implements PipeTransform {
9 | transform(text: string, args: string[] = []): string {
10 | return isString(text)
11 | ? text.replace(/\{(\d+)}/g, (match, index) => (!isUndefined(args[index]) ? args[index] : match))
12 | : text;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 | import { RouterModule } from '@angular/router';
3 | import { NxWelcomeComponent } from './nx-welcome.component';
4 |
5 | @Component({
6 | standalone: true,
7 | imports: [NxWelcomeComponent, RouterModule],
8 | selector: 'ngx-maintenance-root',
9 | templateUrl: './app.component.html',
10 | styleUrl: './app.component.css',
11 | })
12 | export class AppComponent {
13 | title = 'ngx-maintenance-dashboard';
14 | }
15 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-greater-than.spec.ts:
--------------------------------------------------------------------------------
1 | import { IsGreaterThanPipe } from './is-greater-than';
2 |
3 | describe('IsGreaterThanPipe', () => {
4 | let pipe: IsGreaterThanPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new IsGreaterThanPipe();
8 | });
9 |
10 | it('should check if of given value is greater than other', () => {
11 | expect(pipe.transform(1, 1)).toBeFalsy();
12 | expect(pipe.transform(1, 2)).toBeFalsy();
13 | expect(pipe.transform(2, 1)).toBeTruthy();
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/average.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isNumberFinite } from '../helpers/helpers';
3 |
4 | @Pipe({ name: 'average' })
5 | export class AveragePipe implements PipeTransform {
6 | transform(arr: number[]): string | number {
7 | const isValid = arr.every((value) => isNumberFinite(value));
8 |
9 | if (!isValid) {
10 | return NaN;
11 | }
12 |
13 | return arr.length ? arr.reduce((sum, value) => sum + value, 0) / arr.length : 0;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/object/invert.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isObject } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'invert',
6 | standalone: true,
7 | })
8 | export class InvertPipe implements PipeTransform {
9 | transform(obj: any): Object {
10 | if (Array.isArray(obj) || !isObject(obj)) {
11 | return obj;
12 | }
13 |
14 | return Object.keys(obj).reduce((o, k) => {
15 | return Object.assign(o, { [obj[k]]: k });
16 | }, {});
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/slugify.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'slugify',
6 | standalone: true,
7 | })
8 | export class SlugifyPipe implements PipeTransform {
9 | transform(str: string | null | undefined) {
10 | return isString(str)
11 | ? str
12 | .toLowerCase()
13 | .trim()
14 | .replace(/[^\w\-]+/g, ' ')
15 | .replace(/\s+/g, '-')
16 | : str;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-image-viewer/src/lib/image-viewer.module.ts:
--------------------------------------------------------------------------------
1 | import { ModuleWithProviders, NgModule } from '@angular/core';
2 | import { ImageViewerComponent } from './image-viewer.component';
3 |
4 | export * from './image-viewer.component'
5 |
6 | @NgModule({
7 | imports: [
8 | ImageViewerComponent
9 | ],
10 | exports: [
11 | ImageViewerComponent,
12 | ]
13 | })
14 | export class ImageViewerModule {
15 | static forRoot(): ModuleWithProviders {
16 | return {
17 | ngModule: ImageViewerModule,
18 | };
19 | }
20 | }
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/min.spec.ts:
--------------------------------------------------------------------------------
1 | import { MinPipe } from './min';
2 |
3 | describe('MinPipe', () => {
4 | let pipe: MinPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new MinPipe();
8 | });
9 |
10 | it('should return min element from array', () => {
11 | expect(pipe.transform(42)).toEqual(42);
12 | expect(pipe.transform([1, 2, 3])).toEqual(1);
13 | expect(pipe.transform([5, 4, 3, 2, 1, 2, 3, 4, 5])).toEqual(1);
14 | expect(pipe.transform([5, 4, 3, 2, 1, 2, 3, 4, -5])).toEqual(-5);
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-less-equal-than.spec.ts:
--------------------------------------------------------------------------------
1 | import { IsLessEqualThanPipe } from './is-less-equal-than';
2 |
3 | describe('IsLessEqualThanPipe', () => {
4 | let pipe: IsLessEqualThanPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new IsLessEqualThanPipe();
8 | });
9 |
10 | it('should check if of given value is less or equal than other', () => {
11 | expect(pipe.transform(1, 1)).toBeTruthy();
12 | expect(pipe.transform(1, 2)).toBeTruthy();
13 | expect(pipe.transform(2, 1)).toBeFalsy();
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/max.spec.ts:
--------------------------------------------------------------------------------
1 | import { MaxPipe } from './max';
2 |
3 | describe('MaxPipe', () => {
4 | let pipe: MaxPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new MaxPipe();
8 | });
9 |
10 | it('should return max element from array', () => {
11 | expect(pipe.transform(1)).toEqual(1);
12 | expect(pipe.transform([1, 2, 3])).toEqual(3);
13 | expect(pipe.transform([5, 4, 3, 2, 1, 2, 3, 4, 5])).toEqual(5);
14 | expect(pipe.transform([5, 4, 3, 2, 1, 2, 3, 4, -5, 19])).toEqual(19);
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/object/pick.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isObject } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'pick',
6 | standalone: true,
7 | })
8 | export class PickPipe implements PipeTransform {
9 | transform(obj: any, ...args: Array): Object {
10 | if (Array.isArray(obj) || !isObject(obj)) {
11 | return obj;
12 | }
13 |
14 | return args.reduce((o, k) => {
15 | return Object.assign(o, { [k]: obj[k] });
16 | }, {});
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-equal-to.spec.ts:
--------------------------------------------------------------------------------
1 | import { IsEqualToPipe } from './is-equal-to';
2 |
3 | describe('IsEqualToPipe', () => {
4 | let pipe: IsEqualToPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new IsEqualToPipe();
8 | });
9 |
10 | it('should check if of given value is equal to other', () => {
11 | expect(pipe.transform(1, 1)).toBeTruthy();
12 | expect(pipe.transform(1, '1')).toBeTruthy();
13 | expect(pipe.transform(1, 2)).toBeFalsy();
14 | expect(pipe.transform(2, 1)).toBeFalsy();
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/without.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'without',
5 | standalone: true,
6 | })
7 | export class WithoutPipe implements PipeTransform {
8 | transform(input: any[], args?: any[]): any[];
9 | transform(input: any, args?: any[]): any;
10 |
11 | transform(input: any, args: any[] = []): any[] {
12 | return Array.isArray(input)
13 | ? // tslint:disable-next-line:no-bitwise
14 | input.filter((e) => !~args.indexOf(e))
15 | : input;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-greater-equal-than.spec.ts:
--------------------------------------------------------------------------------
1 | import { IsGreaterEqualThanPipe } from './is-greater-equal-than';
2 |
3 | describe('IsGreaterEqualThanPipe', () => {
4 | let pipe: IsGreaterEqualThanPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new IsGreaterEqualThanPipe();
8 | });
9 |
10 | it('should check if of given value is greater than other', () => {
11 | expect(pipe.transform(1, 1)).toBeTruthy();
12 | expect(pipe.transform(1, 2)).toBeFalsy();
13 | expect(pipe.transform(2, 1)).toBeTruthy();
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/wrap.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'wrap',
6 | standalone: true,
7 | })
8 | export class WrapPipe implements PipeTransform {
9 | transform(str: string | null | undefined, prefix: string = '', suffix: string = '') {
10 | if (!isString(str)) {
11 | return str;
12 | }
13 |
14 | return (!!prefix && isString(prefix) ? prefix : '') + str + (!!suffix && isString(suffix) ? suffix : '');
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/degrees.spec.ts:
--------------------------------------------------------------------------------
1 | import { DegreesPipe } from './degrees';
2 |
3 | describe('DegreesPipe', () => {
4 | let pipe: DegreesPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new DegreesPipe();
8 | });
9 |
10 | it('should return degrees of given number in radians', () => {
11 | expect(pipe.transform(null)).toEqual(NaN);
12 | expect(pipe.transform(undefined)).toEqual(NaN);
13 | expect(pipe.transform(1.5707963267948966)).toEqual(90);
14 | expect(pipe.transform(3.141592653589793)).toEqual(180);
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/radians.spec.ts:
--------------------------------------------------------------------------------
1 | import { RadiansPipe } from './radians';
2 |
3 | describe('RadiansPipe', () => {
4 | let pipe: RadiansPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new RadiansPipe();
8 | });
9 |
10 | it('should return degrees of given number in radians', () => {
11 | expect(pipe.transform(null)).toEqual(NaN);
12 | expect(pipe.transform(undefined)).toEqual(NaN);
13 | expect(pipe.transform(90)).toEqual(1.5707963267948966);
14 | expect(pipe.transform(180)).toEqual(3.141592653589793);
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/ceil.spec.ts:
--------------------------------------------------------------------------------
1 | import { CeilPipe } from './ceil';
2 |
3 | describe('CeilPipe', () => {
4 | let pipe: CeilPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new CeilPipe();
8 | });
9 |
10 | it('should return ceil of given number', () => {
11 | expect(pipe.transform(1.2345)).toEqual(2);
12 | expect(pipe.transform(42.123)).toEqual(43);
13 | expect(pipe.transform(42.123, 1)).toEqual(42.2);
14 | expect(pipe.transform(42.4242, 2)).toEqual(42.43);
15 | expect(pipe.transform(42, -1)).toEqual(42);
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/lpad.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'lpad',
6 | standalone: true,
7 | })
8 | export class LeftPadPipe implements PipeTransform {
9 | transform(str: string, length: number, padCharacter: string = ' '): string {
10 | if (!isString(str) || str.length >= length) {
11 | return str;
12 | }
13 | while (str.length < length) {
14 | str = padCharacter + str;
15 | }
16 |
17 | return str;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-not-equal-to.spec.ts:
--------------------------------------------------------------------------------
1 | import { IsNotEqualToPipe } from './is-not-equal-to';
2 |
3 | describe('IsNotEqualToPipe', () => {
4 | let pipe: IsNotEqualToPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new IsNotEqualToPipe();
8 | });
9 |
10 | it('should check if of given value is not equal to other', () => {
11 | expect(pipe.transform(1, 1)).toBeFalsy();
12 | expect(pipe.transform(1, '1')).toBeFalsy();
13 | expect(pipe.transform(1, 2)).toBeTruthy();
14 | expect(pipe.transform(2, 1)).toBeTruthy();
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-null.spec.ts:
--------------------------------------------------------------------------------
1 | import { IsNullPipe } from './is-null';
2 |
3 | describe('IsNullPipe', () => {
4 | let pipe: IsNullPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new IsNullPipe();
8 | });
9 |
10 | it('should check if of given value is null', () => {
11 | expect(pipe.transform(null)).toBeTruthy();
12 | expect(pipe.transform(1)).toBeFalsy();
13 | expect(pipe.transform(undefined)).toBeFalsy();
14 | expect(pipe.transform(false)).toBeFalsy();
15 | expect(pipe.transform(true)).toBeFalsy();
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/rpad.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'rpad',
6 | standalone: true,
7 | })
8 | export class RightPadPipe implements PipeTransform {
9 | transform(str: string, length: number = 1, padCharacter: string = ' '): string {
10 | if (!isString(str) || str.length >= length) {
11 | return str;
12 | }
13 | while (str.length < length) {
14 | str = str + padCharacter;
15 | }
16 |
17 | return str;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/libs/devkit/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "compilerOptions": {
4 | "module": "commonjs",
5 | "forceConsistentCasingInFileNames": true,
6 | "strict": true,
7 | "noImplicitOverride": true,
8 | "noPropertyAccessFromIndexSignature": true,
9 | "noImplicitReturns": true,
10 | "noFallthroughCasesInSwitch": true
11 | },
12 | "files": [],
13 | "include": [],
14 | "references": [
15 | {
16 | "path": "./tsconfig.lib.json"
17 | },
18 | {
19 | "path": "./tsconfig.spec.json"
20 | }
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/libs/npm-api/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.1.1 (2024-04-06)
2 |
3 |
4 | ### 🩹 Fixes
5 |
6 | - update documentation ([d2968b2](https://github.com/danielglejzner/ngx-maintenance/commit/d2968b2))
7 |
8 |
9 | ### ❤️ Thank You
10 |
11 | - Arturo Volpe @aVolpe
12 | - Jordan Hall @Jordan-Hall
13 |
14 | ## 0.1.0 (2024-03-13)
15 |
16 |
17 | ### 🚀 Features
18 |
19 | - **npm-api:** refactor npm registry api into a standalone lib and strongly typed ([cc10093](https://github.com/danielglejzner/ngx-maintenance/commit/cc10093))
20 |
21 |
22 | ### ❤️ Thank You
23 |
24 | - Jordan Hall @Jordan-Hall
--------------------------------------------------------------------------------
/libs/utils/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "compilerOptions": {
4 | "module": "commonjs",
5 | "forceConsistentCasingInFileNames": true,
6 | "strict": true,
7 | "noImplicitOverride": true,
8 | "noPropertyAccessFromIndexSignature": true,
9 | "noImplicitReturns": true,
10 | "noFallthroughCasesInSwitch": true
11 | },
12 | "files": [],
13 | "include": [],
14 | "references": [
15 | {
16 | "path": "./tsconfig.lib.json"
17 | },
18 | {
19 | "path": "./tsconfig.spec.json"
20 | }
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-identical-to.spec.ts:
--------------------------------------------------------------------------------
1 | import { IsIdenticalToPipe } from './is-identical-to';
2 |
3 | describe('IsIdenticalToPipe', () => {
4 | let pipe: IsIdenticalToPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new IsIdenticalToPipe();
8 | });
9 |
10 | it('should check if of given value is identical to other', () => {
11 | expect(pipe.transform(1, 1)).toBeTruthy();
12 | expect(pipe.transform(1, '1')).toBeFalsy();
13 | expect(pipe.transform(1, 2)).toBeFalsy();
14 | expect(pipe.transform(2, 1)).toBeFalsy();
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/libs/devkit/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["../../.eslintrc.base.json"],
3 | "ignorePatterns": ["!**/*"],
4 | "overrides": [
5 | {
6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7 | "rules": {}
8 | },
9 | {
10 | "files": ["*.ts", "*.tsx"],
11 | "rules": {}
12 | },
13 | {
14 | "files": ["*.js", "*.jsx"],
15 | "rules": {}
16 | },
17 | {
18 | "files": ["*.json"],
19 | "parser": "jsonc-eslint-parser",
20 | "rules": {
21 | "@nx/dependency-checks": "error"
22 | }
23 | }
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/libs/npm-api/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "compilerOptions": {
4 | "module": "commonjs",
5 | "forceConsistentCasingInFileNames": true,
6 | "strict": true,
7 | "noImplicitOverride": true,
8 | "noPropertyAccessFromIndexSignature": true,
9 | "noImplicitReturns": true,
10 | "noFallthroughCasesInSwitch": true
11 | },
12 | "files": [],
13 | "include": [],
14 | "references": [
15 | {
16 | "path": "./tsconfig.lib.json"
17 | },
18 | {
19 | "path": "./tsconfig.spec.json"
20 | }
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/libs/utils/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["../../.eslintrc.base.json"],
3 | "ignorePatterns": ["!**/*"],
4 | "overrides": [
5 | {
6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7 | "rules": {}
8 | },
9 | {
10 | "files": ["*.ts", "*.tsx"],
11 | "rules": {}
12 | },
13 | {
14 | "files": ["*.js", "*.jsx"],
15 | "rules": {}
16 | },
17 | {
18 | "files": ["*.json"],
19 | "parser": "jsonc-eslint-parser",
20 | "rules": {
21 | "@nx/dependency-checks": "error"
22 | }
23 | }
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/libs/npm-api/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["../../.eslintrc.base.json"],
3 | "ignorePatterns": ["!**/*"],
4 | "overrides": [
5 | {
6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7 | "rules": {}
8 | },
9 | {
10 | "files": ["*.ts", "*.tsx"],
11 | "rules": {}
12 | },
13 | {
14 | "files": ["*.js", "*.jsx"],
15 | "rules": {}
16 | },
17 | {
18 | "files": ["*.json"],
19 | "parser": "jsonc-eslint-parser",
20 | "rules": {
21 | "@nx/dependency-checks": "error"
22 | }
23 | }
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/trim.spec.ts:
--------------------------------------------------------------------------------
1 | import { TrimPipe } from './trim';
2 |
3 | describe('TrimPipe Tests', () => {
4 | let pipe: TrimPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new TrimPipe();
8 | });
9 |
10 | it('Should trim whitespace from string', () => {
11 | const result = pipe.transform(' foo bar ');
12 | expect(result).toEqual('foo bar');
13 | });
14 |
15 | it('Should trim other characters from string', () => {
16 | const result = pipe.transform('42foo bar4242', '42');
17 | expect(result).toEqual('foo bar');
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/libs/ngx-maintenance/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["../../.eslintrc.base.json"],
3 | "ignorePatterns": ["!**/*"],
4 | "overrides": [
5 | {
6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7 | "rules": {}
8 | },
9 | {
10 | "files": ["*.ts", "*.tsx"],
11 | "rules": {}
12 | },
13 | {
14 | "files": ["*.js", "*.jsx"],
15 | "rules": {}
16 | },
17 | {
18 | "files": ["*.json"],
19 | "parser": "jsonc-eslint-parser",
20 | "rules": {
21 | "@nx/dependency-checks": "error"
22 | }
23 | }
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-defined.spec.ts:
--------------------------------------------------------------------------------
1 | import { IsDefinedPipe } from './is-defined';
2 |
3 | describe('IsDefinedPipe', () => {
4 | let pipe: IsDefinedPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new IsDefinedPipe();
8 | });
9 |
10 | it('should check if of given value is null', () => {
11 | expect(pipe.transform(null)).toBeTruthy();
12 | expect(pipe.transform(1)).toBeTruthy();
13 | expect(pipe.transform(undefined)).toBeFalsy();
14 | expect(pipe.transform(false)).toBeTruthy();
15 | expect(pipe.transform(true)).toBeTruthy();
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/diff.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'diff',
5 | standalone: true,
6 | })
7 | export class DiffPipe implements PipeTransform {
8 | transform(input: T, ...args: any[]): T;
9 | transform(input: any[], ...args: any[]): any[];
10 |
11 | transform(input: any, ...args: any[]): any {
12 | if (!Array.isArray(input)) {
13 | return input;
14 | }
15 |
16 | // tslint:disable-next-line no-bitwise
17 | return args.reduce((d, c) => d.filter((e: any) => !~c.indexOf(e)), input);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/from-pairs.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'fromPairs',
5 | standalone: true,
6 | })
7 | export class FromPairsPipe implements PipeTransform {
8 | transform(input: any): any {
9 | if (!Array.isArray(input)) {
10 | return input;
11 | }
12 |
13 | return input.reduce((obj, arr) => {
14 | if (!Array.isArray(arr)) {
15 | return obj;
16 | }
17 |
18 | const [prop, val] = arr;
19 |
20 | obj[prop] = val;
21 |
22 | return obj;
23 | }, {});
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/libs/utils/README.md:
--------------------------------------------------------------------------------
1 | # utils
2 |
3 | Helper functions for node http and our try catch function
4 |
5 | ```
6 | export async function tryCatch(
7 | mainOperation: () => Promise | T
8 | ): Promise<{ error?: E; result?: T }> {
9 | try {
10 | const result = await Promise.resolve(mainOperation());
11 | return { result };
12 | } catch (error) {
13 | if (error instanceof Error) {
14 | return { error: error as E };
15 | }
16 | console.error("Caught an unexpected error type:", error);
17 | return { error: new Error("An unexpected error occurred") as E };
18 | }
19 | }
20 | ```
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-not-identical-to.spec.ts:
--------------------------------------------------------------------------------
1 | import { IsNotIdenticalToPipe } from './is-not-identical-to';
2 |
3 | describe('IsNotIdenticalToPipe', () => {
4 | let pipe: IsNotIdenticalToPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new IsNotIdenticalToPipe();
8 | });
9 |
10 | it('should check if of given value is not identical to other', () => {
11 | expect(pipe.transform(1, 1)).toBeFalsy();
12 | expect(pipe.transform(1, '1')).toBeTruthy();
13 | expect(pipe.transform(1, 2)).toBeTruthy();
14 | expect(pipe.transform(2, 1)).toBeTruthy();
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-undefined.spec.ts:
--------------------------------------------------------------------------------
1 | import { IsUndefinedPipe } from './is-undefined';
2 |
3 | describe('IsUndefinedPipe', () => {
4 | let pipe: IsUndefinedPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new IsUndefinedPipe();
8 | });
9 |
10 | it('should check if of given value is null', () => {
11 | expect(pipe.transform(null)).toBeFalsy();
12 | expect(pipe.transform(1)).toBeFalsy();
13 | expect(pipe.transform(undefined)).toBeTruthy();
14 | expect(pipe.transform(false)).toBeFalsy();
15 | expect(pipe.transform(true)).toBeFalsy();
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/ucwords.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString, ucFirst } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'ucwords',
6 | standalone: true,
7 | })
8 | export class UcWordsPipe implements PipeTransform {
9 | transform(input: string): string;
10 | transform(input: any): any;
11 |
12 | transform(text: any): string {
13 | if (isString(text)) {
14 | return text
15 | .split(' ')
16 | .map((sub: any) => ucFirst(sub))
17 | .join(' ');
18 | }
19 |
20 | return text;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/some.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'some',
5 | standalone: true,
6 | })
7 | export class SomePipe implements PipeTransform {
8 | transform(input: any[], predicate: (value: any, index: number, array: any[]) => boolean): boolean;
9 | transform(input: T, predicate: (value: any, index: number, array: any[]) => boolean): T;
10 |
11 | transform(input: any, predicate: (value: any, index: number, array: any[]) => boolean): any {
12 | return Array.isArray(input) ? input.some(predicate) : input;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard-e2e/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "plugin:playwright/recommended",
4 | "../../.eslintrc.json",
5 | "../../.eslintrc.base.json"
6 | ],
7 | "ignorePatterns": ["!**/*"],
8 | "overrides": [
9 | {
10 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
11 | "rules": {}
12 | },
13 | {
14 | "files": ["*.ts", "*.tsx"],
15 | "rules": {}
16 | },
17 | {
18 | "files": ["*.js", "*.jsx"],
19 | "rules": {}
20 | },
21 | {
22 | "files": ["src/**/*.{ts,js,tsx,jsx}"],
23 | "rules": {}
24 | }
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/ltrim.spec.ts:
--------------------------------------------------------------------------------
1 | import { LeftTrimPipe } from './ltrim';
2 |
3 | describe('LeftTrimPipe Tests', () => {
4 | let pipe: LeftTrimPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new LeftTrimPipe();
8 | });
9 |
10 | it('Should left trim whitespace from string', () => {
11 | const result = pipe.transform(' foo bar ');
12 | expect(result).toEqual('foo bar ');
13 | });
14 |
15 | it('Should left trim other characters from string', () => {
16 | const result = pipe.transform('42foo bar42', '42');
17 | expect(result).toEqual('foo bar42');
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/libs/ngx-maintenance/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "compilerOptions": {
4 | "module": "CommonJS",
5 | "forceConsistentCasingInFileNames": true,
6 | "strict": true,
7 | "noImplicitOverride": true,
8 | "noPropertyAccessFromIndexSignature": true,
9 | "noImplicitReturns": true,
10 | "noFallthroughCasesInSwitch": true,
11 | "resolveJsonModule": true
12 | },
13 | "files": [],
14 | "include": [],
15 | "references": [
16 | {
17 | "path": "./tsconfig.lib.json"
18 | },
19 | {
20 | "path": "./tsconfig.spec.json"
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/intersection.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'intersection',
5 | standalone: true,
6 | })
7 | export class IntersectionPipe implements PipeTransform {
8 | transform(input: T, ...args: any[]): T;
9 | transform(input: any[], ...args: any[]): any[];
10 |
11 | transform(input: any, ...args: any[]): any {
12 | if (!Array.isArray(input)) {
13 | return input;
14 | }
15 |
16 | // tslint:disable-next-line no-bitwise
17 | return args.reduce((n, c) => n.filter((e: any) => !!~c.indexOf(e)), input);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/sqrt.spec.ts:
--------------------------------------------------------------------------------
1 | import { SqrtPipe } from './sqrt';
2 |
3 | describe('SqrtPipe', () => {
4 | let pipe: SqrtPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new SqrtPipe();
8 | });
9 |
10 | it('should return value if not a number', () => {
11 | expect(pipe.transform({ a: 1 })).toEqual({ a: 1 });
12 | expect(pipe.transform(NaN)).toEqual(NaN);
13 | });
14 |
15 | it('should return square of given number', () => {
16 | expect(pipe.transform(9)).toEqual(3);
17 | expect(pipe.transform(16)).toEqual(4);
18 | expect(pipe.transform(81)).toEqual(9);
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/rtrim.spec.ts:
--------------------------------------------------------------------------------
1 | import { RightTrimPipe } from './rtrim';
2 |
3 | describe('RightTrimPipe Tests', () => {
4 | let pipe: RightTrimPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new RightTrimPipe();
8 | });
9 |
10 | it('Should right trim whitespace from string', () => {
11 | const result = pipe.transform(' foo bar ');
12 | expect(result).toEqual(' foo bar');
13 | });
14 |
15 | it('Should right trim other characters from string', () => {
16 | const result = pipe.transform('42foo bar42', '42');
17 | expect(result).toEqual('42foo bar');
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/test-pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'test',
6 | standalone: true,
7 | })
8 | export class TestPipe implements PipeTransform {
9 | transform(text: string, pattern: string, flags?: string): boolean;
10 | transform(text: T, pattern: string, flags?: string): T;
11 |
12 | transform(text: any, pattern: string, flags?: string): any {
13 | if (!isString(text)) {
14 | return text;
15 | }
16 |
17 | return new RegExp(pattern, flags).test(text);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/floor.spec.ts:
--------------------------------------------------------------------------------
1 | import { FloorPipe } from './floor';
2 |
3 | describe('FloorPipe', () => {
4 | let pipe: FloorPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new FloorPipe();
8 | });
9 |
10 | it('should return floor of given number', () => {
11 | expect(pipe.transform(1.2345)).toEqual(1);
12 | expect(pipe.transform(1.2345)).toEqual(1);
13 | expect(pipe.transform(42.123)).toEqual(42);
14 | expect(pipe.transform(42.123, 1)).toEqual(42.1);
15 | expect(pipe.transform(42.4242, 2)).toEqual(42.42);
16 | expect(pipe.transform(42, -1)).toEqual(42);
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/round.spec.ts:
--------------------------------------------------------------------------------
1 | import { RoundPipe } from './round';
2 |
3 | describe('RoundPipe', () => {
4 | let pipe: RoundPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new RoundPipe();
8 | });
9 |
10 | it('should return rounded number of given number', () => {
11 | expect(pipe.transform(1.2)).toEqual(1);
12 | expect(pipe.transform(1.5)).toEqual(2);
13 | expect(pipe.transform(42.42)).toEqual(42);
14 | expect(pipe.transform(1.35, 1)).toEqual(1.4);
15 | expect(pipe.transform(1.3557, 2)).toEqual(1.36);
16 | expect(pipe.transform(1.3547, 2)).toEqual(1.35);
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/percentage.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'percentage',
5 | standalone: true,
6 | })
7 | export class PercentagePipe implements PipeTransform {
8 | transform(num: number, total?: number, floor?: boolean): number;
9 | transform(num: T, total?: number, floor?: boolean): T;
10 |
11 | transform(num: any, total: number = 100, floor: boolean = false): any {
12 | if (isNaN(num)) {
13 | return num;
14 | }
15 |
16 | const percent = (num * 100) / total;
17 |
18 | return floor ? Math.floor(percent) : percent;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/match.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'match',
6 | standalone: true,
7 | })
8 | export class MatchPipe implements PipeTransform {
9 | transform(text: string, pattern: string, flags?: string): RegExpMatchArray | null;
10 | transform(text: T, pattern: string, flags?: string): T;
11 |
12 | transform(text: any, pattern: string, flags?: string): any {
13 | if (!isString(text)) {
14 | return text;
15 | }
16 |
17 | return text.match(new RegExp(pattern, flags));
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-function.spec.ts:
--------------------------------------------------------------------------------
1 | import { IsFunctionPipe } from './is-function';
2 |
3 | describe('IsFunctionPipe', () => {
4 | let pipe: IsFunctionPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new IsFunctionPipe();
8 | });
9 |
10 | it('should check if of given value is a function', () => {
11 | expect(pipe.transform(null)).toBeFalsy();
12 | expect(pipe.transform(undefined)).toBeFalsy();
13 | expect(pipe.transform(1)).toBeFalsy();
14 | expect(pipe.transform('')).toBeFalsy();
15 | expect(pipe.transform(() => {})).toBeTruthy();
16 | expect(pipe.transform(function () {})).toBeTruthy();
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/object/invert-by.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isObject } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'invertBy',
6 | standalone: true,
7 | })
8 | export class InvertByPipe implements PipeTransform {
9 | transform(obj: any, cb?: Function): Object {
10 | if (Array.isArray(obj) || !isObject(obj)) {
11 | return obj;
12 | }
13 |
14 | return Object.keys(obj).reduce((o: any, k: string) => {
15 | const key = cb ? cb(obj[k]) : obj[k];
16 |
17 | return Array.isArray(o[key]) ? (o[key].push(k), o) : Object.assign(o, { [key]: [k] });
18 | }, {});
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/sum.spec.ts:
--------------------------------------------------------------------------------
1 | import { SumPipe } from './sum';
2 |
3 | describe('SumPipe', () => {
4 | let pipe: SumPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new SumPipe();
8 | });
9 |
10 | it('should return value if not an array', () => {
11 | expect(pipe.transform({ a: 1 })).toEqual({ a: 1 });
12 | expect(pipe.transform(NaN)).toEqual(NaN);
13 | });
14 |
15 | it('should return sum of element', () => {
16 | expect(pipe.transform([1, 2, 3, 4])).toEqual(10);
17 | expect(pipe.transform([5, 4, 3, 2, 1, -2, -3, -4, -5])).toEqual(1);
18 | expect(pipe.transform([1, 2, 3, 4, 4, 3, 2, 1, -10])).toEqual(10);
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/pow.spec.ts:
--------------------------------------------------------------------------------
1 | import { PowerPipe } from './pow';
2 |
3 | describe('PowerPipe', () => {
4 | let pipe: PowerPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new PowerPipe();
8 | });
9 |
10 | it('should return value if not a number', () => {
11 | expect(pipe.transform({ a: 1 })).toEqual({ a: 1 });
12 | expect(pipe.transform(NaN)).toEqual(NaN);
13 | });
14 |
15 | it('should return power of a given number', () => {
16 | expect(pipe.transform(3)).toEqual(9);
17 | expect(pipe.transform(3, 3)).toEqual(27);
18 | expect(pipe.transform(9)).toEqual(81);
19 | expect(pipe.transform(9, 4)).toEqual(6561);
20 | });
21 | });
22 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-string.spec.ts:
--------------------------------------------------------------------------------
1 | import { IsStringPipe } from './is-string';
2 |
3 | describe('IsStringPipe', () => {
4 | let pipe: IsStringPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new IsStringPipe();
8 | });
9 |
10 | it('should check if of given value is a string', () => {
11 | expect(pipe.transform(null)).toBeFalsy();
12 | expect(pipe.transform(1)).toBeFalsy();
13 | expect(pipe.transform('')).toBeTruthy();
14 | expect(pipe.transform('str')).toBeTruthy();
15 | expect(pipe.transform(undefined)).toBeFalsy();
16 | expect(pipe.transform(false)).toBeFalsy();
17 | expect(pipe.transform(true)).toBeFalsy();
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/object/omit.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isObject } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'omit',
6 | standalone: true,
7 | })
8 | export class OmitPipe implements PipeTransform {
9 | transform(obj: any, ...args: Array): Object {
10 | if (Array.isArray(obj) || !isObject(obj)) {
11 | return obj;
12 | }
13 |
14 | return (
15 | Object.keys(obj)
16 | // tslint:disable-next-line:no-bitwise
17 | .filter((k) => !~args.indexOf(k))
18 | .reduce((o, k) => {
19 | return Object.assign(o, { [k]: obj[k] });
20 | }, {})
21 | );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/angular-pkgs/angular-material-rail-drawer/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@ngx-maintenance/angular-material-rail-drawer",
3 | "version": "1.3.0",
4 | "scripts": {
5 | "postinstall": "npx ngx-maintenance warn angular-material-rail-drawer"
6 | },
7 | "peerDependencies": {
8 | "@angular/common": ">=12.0.0 <18.0.0",
9 | "@angular/core": ">=12.0.0 <18.0.0",
10 | "@angular/animations": ">=12.0.0 <18.0.0",
11 | "@angular/cdk": ">=12.0.0 <18.0.0",
12 | "rxjs": ">=6.5.5"
13 | },
14 | "dependencies": {
15 | "@nx/devkit": "18.0.8",
16 | "tslib": "^2.3.0"
17 | },
18 | "sideEffects": false,
19 | "nx-migrations": {
20 | "migrations": "./migrations.json"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/repeat.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'repeat',
6 | standalone: true,
7 | })
8 | export class RepeatPipe implements PipeTransform {
9 | transform(str: string, n: number = 1, separator: string = ''): string {
10 | if (n <= 0) {
11 | throw new RangeError();
12 | }
13 |
14 | return n === 1 ? str : this.repeat(str, n - 1, separator);
15 | }
16 |
17 | private repeat(str: string, n: number, separator: string): string {
18 | return isString(str) ? (n === 0 ? str : str + separator + this.repeat(str, n - 1, separator)) : str;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-image-viewer/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 1.2.0 (2024-04-06)
2 |
3 |
4 | ### 🚀 Features
5 |
6 | - **ng2-image-viewer:** add inital release ([73102c5](https://github.com/danielglejzner/ngx-maintenance/commit/73102c5))
7 |
8 |
9 | ### 🩹 Fixes
10 |
11 | - repair nx-release to use the dist folder ([27913af](https://github.com/danielglejzner/ngx-maintenance/commit/27913af))
12 |
13 |
14 | ### ❤️ Thank You
15 |
16 | - Jordan Hall @Jordan-Hall
17 |
18 | ## 1.1.0 (2024-04-06)
19 |
20 |
21 | ### 🚀 Features
22 |
23 | - **ng2-image-viewer:** add inital release ([73102c5](https://github.com/danielglejzner/ngx-maintenance/commit/73102c5))
24 |
25 |
26 | ### ❤️ Thank You
27 |
28 | - Jordan Hall @Jordan-Hall
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | dist
5 | tmp
6 | /out-tsc
7 |
8 | # dependencies
9 | node_modules
10 |
11 | # IDEs and editors
12 | /.idea
13 | .project
14 | .classpath
15 | .c9/
16 | *.launch
17 | .settings/
18 | *.sublime-workspace
19 |
20 | # IDE - VSCode
21 | .vscode/*
22 | !.vscode/settings.json
23 | !.vscode/tasks.json
24 | !.vscode/launch.json
25 | !.vscode/extensions.json
26 |
27 | # misc
28 | /.sass-cache
29 | /connect.lock
30 | /coverage
31 | /libpeerconnection.log
32 | npm-debug.log
33 | yarn-error.log
34 | testem.log
35 | /typings
36 |
37 | # System Files
38 | .DS_Store
39 | Thumbs.db
40 |
41 | .nx/cache
42 | .angular
43 |
--------------------------------------------------------------------------------
/libs/utils/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "utils",
3 | "$schema": "../../node_modules/nx/schemas/project-schema.json",
4 | "sourceRoot": "libs/utils/src",
5 | "projectType": "library",
6 | "targets": {
7 | "build": {
8 | "executor": "@nx/js:tsc",
9 | "outputs": ["{options.outputPath}"],
10 | "options": {
11 | "outputPath": "dist/libs/utils",
12 | "main": "libs/utils/src/index.ts",
13 | "tsConfig": "libs/utils/tsconfig.lib.json",
14 | "assets": ["libs/utils/*.md"]
15 | }
16 | },
17 | "publish": {
18 | "command": "node tools/scripts/publish.mjs utils {args.ver} {args.tag}",
19 | "dependsOn": ["build"]
20 | }
21 | },
22 | "tags": []
23 | }
24 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard-e2e/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "compilerOptions": {
4 | "allowJs": true,
5 | "outDir": "../../dist/out-tsc",
6 | "module": "commonjs",
7 | "sourceMap": false,
8 | "forceConsistentCasingInFileNames": true,
9 | "strict": true,
10 | "noImplicitOverride": true,
11 | "noPropertyAccessFromIndexSignature": true,
12 | "noImplicitReturns": true,
13 | "noFallthroughCasesInSwitch": true
14 | },
15 | "include": [
16 | "**/*.ts",
17 | "**/*.js",
18 | "playwright.config.ts",
19 | "src/**/*.spec.ts",
20 | "src/**/*.spec.js",
21 | "src/**/*.test.ts",
22 | "src/**/*.test.js",
23 | "src/**/*.d.ts"
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/libs/devkit/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "devkit",
3 | "$schema": "../../node_modules/nx/schemas/project-schema.json",
4 | "sourceRoot": "libs/devkit/src",
5 | "projectType": "library",
6 | "targets": {
7 | "build": {
8 | "executor": "@nx/js:tsc",
9 | "outputs": ["{options.outputPath}"],
10 | "options": {
11 | "outputPath": "dist/libs/devkit",
12 | "main": "libs/devkit/src/index.ts",
13 | "tsConfig": "libs/devkit/tsconfig.lib.json",
14 | "assets": ["libs/devkit/*.md"]
15 | }
16 | },
17 | "publish": {
18 | "command": "node tools/scripts/publish.mjs devkit {args.ver} {args.tag}",
19 | "dependsOn": ["build"]
20 | }
21 | },
22 | "tags": []
23 | }
24 |
--------------------------------------------------------------------------------
/libs/npm-api/README.md:
--------------------------------------------------------------------------------
1 | # @ngx-maintenance/npm-api
2 |
3 | ## Overview
4 | @ngx-maintenance/npm-api is a strongly typed API SDK for the npm registry API, providing easy access to various endpoints and functionalities.
5 |
6 | ## Installation
7 | To install @ngx-maintenance/npm-api, simply run:
8 |
9 | ```bash
10 | npm install @ngx-maintenance/npm-api
11 | ```
12 |
13 | ## Usage
14 | ```typescript
15 | import { fetchNpmApi, findCompatibleVersion } from '@ngx-maintenance/npm-api';
16 |
17 | // Fetch registry information
18 | const registryInfo = await fetchNpmApi('/');
19 |
20 | // Find compatible version for a package
21 | const compatibleVersion = await findCompatibleVersion('packageName', 'versionRange', 'peerDependency');
22 | ```
23 |
24 |
--------------------------------------------------------------------------------
/libs/npm-api/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "npm-api",
3 | "$schema": "../../node_modules/nx/schemas/project-schema.json",
4 | "sourceRoot": "libs/npm-api/src",
5 | "projectType": "library",
6 | "targets": {
7 | "build": {
8 | "executor": "@nx/js:tsc",
9 | "outputs": ["{options.outputPath}"],
10 | "options": {
11 | "outputPath": "dist/libs/npm-api",
12 | "main": "libs/npm-api/src/index.ts",
13 | "tsConfig": "libs/npm-api/tsconfig.lib.json",
14 | "assets": ["libs/npm-api/*.md"]
15 | }
16 | },
17 | "publish": {
18 | "command": "node tools/scripts/publish.mjs npm-api {args.ver} {args.tag}",
19 | "dependsOn": ["build"]
20 | }
21 | },
22 | "tags": []
23 | }
24 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/underscore.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'underscore',
6 | standalone: true,
7 | })
8 | export class UnderscorePipe implements PipeTransform {
9 | transform(input: string, chars?: string): string;
10 | transform(input: any, chars?: string): any;
11 |
12 | transform(text: any, chars: string = '\\s'): string {
13 | return isString(text)
14 | ? text
15 | .trim()
16 | .replace(/\s+/g, '')
17 | .replace(/[A-Z]/g, (c: string, k: any) => {
18 | return k ? `_${c.toLowerCase()}` : c.toLowerCase();
19 | })
20 | : text;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-image-viewer/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2022",
4 | "useDefineForClassFields": false,
5 | "forceConsistentCasingInFileNames": true,
6 | "noFallthroughCasesInSwitch": true,
7 | "allowSyntheticDefaultImports": true,
8 | },
9 | "files": [],
10 | "include": [],
11 | "references": [
12 | {
13 | "path": "./tsconfig.lib.json"
14 | },
15 | {
16 | "path": "./tsconfig.spec.json"
17 | }
18 | ],
19 | "extends": "../../tsconfig.base.json",
20 | "angularCompilerOptions": {
21 | "enableI18nLegacyMessageIdFormat": false,
22 | "strictInjectionParameters": true,
23 | "strictInputAccessModifiers": true,
24 | "strictTemplates": true
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/object/diff-obj.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { getKeysTwoObjects, isDeepEqual, isObject } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'diffObj',
6 | standalone: true,
7 | })
8 | export class DiffObjPipe implements PipeTransform {
9 | transform(obj: any, original: any = {}): any {
10 | if (Array.isArray(obj) || Array.isArray(original) || !isObject(obj) || !isObject(original)) {
11 | return {};
12 | }
13 |
14 | return getKeysTwoObjects(obj, original).reduce((diff: any, key: any) => {
15 | if (!isDeepEqual(original[key], obj[key])) {
16 | diff[key] = obj[key];
17 | }
18 |
19 | return diff;
20 | }, {});
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/chunk.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'chunk',
6 | standalone: true,
7 | })
8 | export class ChunkPipe implements PipeTransform {
9 | transform(input: any, size: number = 1): any {
10 | if (isString(input)) {
11 | return this.chunk(input.split(''), size);
12 | }
13 |
14 | return Array.isArray(input) ? this.chunk(input, size) : input;
15 | }
16 |
17 | private chunk(input: any[], size: number) {
18 | return Array(Math.ceil(input.length / size))
19 | .fill([])
20 | .map((_, index) => index * size)
21 | .map((begin) => input.slice(begin, begin + size));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-array.spec.ts:
--------------------------------------------------------------------------------
1 | import { IsArrayPipe } from './is-array';
2 |
3 | describe('IsArrayPipe', () => {
4 | let pipe: IsArrayPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new IsArrayPipe();
8 | });
9 |
10 | it('should check if of given value is an array', () => {
11 | expect(pipe.transform(null)).toBeFalsy();
12 | expect(pipe.transform(1)).toBeFalsy();
13 | expect(pipe.transform([])).toBeTruthy();
14 | expect(pipe.transform([1, 2])).toBeTruthy();
15 | expect(pipe.transform([{ a: 1 }, { a: 2 }])).toBeTruthy();
16 | expect(pipe.transform(undefined)).toBeFalsy();
17 | expect(pipe.transform(false)).toBeFalsy();
18 | expect(pipe.transform(true)).toBeFalsy();
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/.verdaccio/config.yml:
--------------------------------------------------------------------------------
1 | # path to a directory with all packages
2 | storage: ../tmp/local-registry/storage
3 |
4 | # a list of other known repositories we can talk to
5 | uplinks:
6 | npmjs:
7 | url: https://registry.npmjs.org/
8 | maxage: 60m
9 |
10 | packages:
11 | '**':
12 | # give all users (including non-authenticated users) full access
13 | # because it is a local registry
14 | access: $all
15 | publish: $all
16 | unpublish: $all
17 |
18 | # if package is not available locally, proxy requests to npm registry
19 | proxy: npmjs
20 |
21 | # log settings
22 | logs:
23 | type: stdout
24 | format: pretty
25 | level: warn
26 |
27 | publish:
28 | allow_offline: true # set offline to true to allow publish offline
29 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/pluck.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { extractDeepPropertyByMapKey, isObject } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'pluck',
6 | pure: false,
7 | standalone: true,
8 | })
9 | export class PluckPipe implements PipeTransform {
10 | transform(input: T, map: keyof T): T[K];
11 | transform(input: any[], map: string): any[];
12 | transform(input: any, map: string): any;
13 |
14 | transform(input: any, map: string): any {
15 | if (Array.isArray(input)) {
16 | return input.map((e) => extractDeepPropertyByMapKey(e, map));
17 | }
18 |
19 | return isObject(input) ? extractDeepPropertyByMapKey(input, map) : input;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/sample.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'sample',
5 | standalone: true,
6 | })
7 | export class SamplePipe implements PipeTransform {
8 | transform(input: any[], len?: number): any[];
9 | transform(input: T, len?: number): T;
10 |
11 | transform(input: any, len: number = 1): any {
12 | if (!Array.isArray(input)) {
13 | return input;
14 | }
15 |
16 | let sample: any[] = [];
17 | const tmp = [...input];
18 | const l = len < tmp.length ? len : tmp.length;
19 | for (let i = 0; i < l; ++i) {
20 | sample = sample.concat(tmp.splice(Math.floor(Math.random() * tmp.length), 1));
21 | }
22 |
23 | return sample;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-number.spec.ts:
--------------------------------------------------------------------------------
1 | import { IsNumberPipe } from './is-number';
2 |
3 | describe('IsNumberPipe', () => {
4 | let pipe: IsNumberPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new IsNumberPipe();
8 | });
9 |
10 | it('should check if of given value is a number', () => {
11 | expect(pipe.transform(null)).toBeFalsy();
12 | expect(pipe.transform(1)).toBeTruthy();
13 | expect(pipe.transform(1e3)).toBeTruthy();
14 | expect(pipe.transform(0.42)).toBeTruthy();
15 | expect(pipe.transform(42)).toBeTruthy();
16 | expect(pipe.transform(-42)).toBeTruthy();
17 | expect(pipe.transform(undefined)).toBeFalsy();
18 | expect(pipe.transform(false)).toBeFalsy();
19 | expect(pipe.transform(true)).toBeFalsy();
20 | });
21 | });
22 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/latinise.spec.ts:
--------------------------------------------------------------------------------
1 | import { LatinisePipe } from './latinise';
2 |
3 | describe('LatinisePipe Tests', () => {
4 | let pipe: LatinisePipe;
5 |
6 | beforeEach(() => {
7 | pipe = new LatinisePipe();
8 | });
9 |
10 | it('Should not do anything if not a string', () => {
11 | expect(pipe.transform(null)).toEqual(null);
12 | expect(pipe.transform(undefined)).toEqual(undefined);
13 | expect(pipe.transform(42)).toEqual(42);
14 | expect(pipe.transform({ name: 'foo' })).toEqual({ name: 'foo' });
15 | });
16 |
17 | it('Should latinise properly', () => {
18 | expect(pipe.transform('foo')).toEqual('foo');
19 | expect(pipe.transform('Féé')).toEqual('Fee');
20 | expect(pipe.transform('ÁĂẤ')).toEqual('AAA');
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/average.spec.ts:
--------------------------------------------------------------------------------
1 | import { AveragePipe } from './average';
2 |
3 | describe('AveragePipe', () => {
4 | let pipe: AveragePipe;
5 |
6 | beforeEach(() => {
7 | pipe = new AveragePipe();
8 | });
9 |
10 | it('should not do anything if array contain anything else than numbers', () => {
11 | expect(pipe.transform([Infinity])).toEqual(NaN);
12 | expect(pipe.transform([1, 2, Infinity])).toEqual(NaN);
13 | });
14 |
15 | it('should return average of numbers', () => {
16 | expect(pipe.transform([10, 20, 30])).toEqual(20);
17 | expect(pipe.transform([1, 2, 3])).toEqual(2);
18 | expect(pipe.transform([1, 2])).toEqual(1.5);
19 | expect(pipe.transform([1])).toEqual(1);
20 | expect(pipe.transform([])).toEqual(0);
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/jest.config.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | export default {
3 | displayName: 'ngx-pipes',
4 | preset: '../../jest.preset.js',
5 | setupFilesAfterEnv: ['/src/test-setup.ts'],
6 | coverageDirectory: '../../coverage/angular-pkgs/ngx-pipes',
7 | transform: {
8 | '^.+\\.(ts|mjs|js|html)$': [
9 | 'jest-preset-angular',
10 | {
11 | tsconfig: '/tsconfig.spec.json',
12 | stringifyContentPathRegex: '\\.(html|svg)$',
13 | },
14 | ],
15 | },
16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
17 | snapshotSerializers: [
18 | 'jest-preset-angular/build/serializers/no-ng-attributes',
19 | 'jest-preset-angular/build/serializers/ng-snapshot',
20 | 'jest-preset-angular/build/serializers/html-comment',
21 | ],
22 | };
23 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/camelize.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'camelize',
6 | standalone: true,
7 | })
8 | export class CamelizePipe implements PipeTransform {
9 | transform(input: string, chars?: string): string;
10 | transform(input: any, chars?: string): any;
11 |
12 | transform(text: any, chars: string = '\\s'): string {
13 | if (!isString(text)) {
14 | return text;
15 | }
16 |
17 | return text
18 | .toLowerCase()
19 | .split(/[-_\s]/g)
20 | .filter((v: string) => !!v)
21 | .map((word: string, key: any) => {
22 | return !key ? word : word.slice(0, 1).toUpperCase() + word.slice(1);
23 | })
24 | .join('');
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/every.spec.ts:
--------------------------------------------------------------------------------
1 | import { EveryPipe } from './every';
2 | import { isNumber, isUndefined } from '../helpers/helpers';
3 |
4 | describe('EveryPipe', () => {
5 | let pipe: EveryPipe;
6 |
7 | beforeEach(() => {
8 | pipe = new EveryPipe();
9 | });
10 |
11 | it('should check if every elements of the array fits the predicate', () => {
12 | expect(pipe.transform(42, isNumber)).toBeFalsy();
13 | expect(pipe.transform([1, 2, 3, 4], isNumber)).toBeTruthy();
14 | expect(pipe.transform([1, 2, 3, 'a'], isNumber)).toBeFalsy();
15 | expect(pipe.transform([1, 2, 3, 4], isUndefined)).toBeFalsy();
16 | expect(pipe.transform([undefined, undefined, 1], isUndefined)).toBeFalsy();
17 | expect(pipe.transform([undefined, undefined], isUndefined)).toBeTruthy();
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/percentage.spec.ts:
--------------------------------------------------------------------------------
1 | import { PercentagePipe } from './percentage';
2 |
3 | describe('PercentagePipe', () => {
4 | let pipe: PercentagePipe;
5 |
6 | beforeEach(() => {
7 | pipe = new PercentagePipe();
8 | });
9 |
10 | it('should not change anything if not a number', () => {
11 | expect(pipe.transform('foo')).toEqual('foo');
12 | expect(pipe.transform(undefined)).toEqual(undefined);
13 | expect(pipe.transform([1, 2, 3])).toEqual([1, 2, 3]);
14 | expect(pipe.transform({ foo: 1, bar: 2 })).toEqual({ foo: 1, bar: 2 });
15 | });
16 |
17 | it('should return percent between numbers', () => {
18 | expect(pipe.transform(5)).toEqual(5);
19 | expect(pipe.transform(5, 160)).toEqual(3.125);
20 | expect(pipe.transform(5, 160, true)).toEqual(3);
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-image-viewer/jest.config.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | export default {
3 | displayName: 'ng2-image-viewer',
4 | preset: '../../jest.preset.js',
5 | setupFilesAfterEnv: ['/src/test-setup.ts'],
6 | coverageDirectory: '../../coverage/angular-pkgs/ng2-image-viewer',
7 | transform: {
8 | '^.+\\.(ts|mjs|js|html)$': [
9 | 'jest-preset-angular',
10 | {
11 | tsconfig: '/tsconfig.spec.json',
12 | stringifyContentPathRegex: '\\.(html|svg)$',
13 | },
14 | ],
15 | },
16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
17 | snapshotSerializers: [
18 | 'jest-preset-angular/build/serializers/no-ng-attributes',
19 | 'jest-preset-angular/build/serializers/ng-snapshot',
20 | 'jest-preset-angular/build/serializers/html-comment',
21 | ],
22 | };
23 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-search-filter/jest.config.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | export default {
3 | displayName: 'ng2-search-filter',
4 | preset: '../../jest.preset.js',
5 | setupFilesAfterEnv: ['/src/test-setup.ts'],
6 | coverageDirectory: '../../coverage/angular-pkgs/ng2-search-filter',
7 | transform: {
8 | '^.+\\.(ts|mjs|js|html)$': [
9 | 'jest-preset-angular',
10 | {
11 | tsconfig: '/tsconfig.spec.json',
12 | stringifyContentPathRegex: '\\.(html|svg)$',
13 | },
14 | ],
15 | },
16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
17 | snapshotSerializers: [
18 | 'jest-preset-angular/build/serializers/no-ng-attributes',
19 | 'jest-preset-angular/build/serializers/ng-snapshot',
20 | 'jest-preset-angular/build/serializers/html-comment',
21 | ],
22 | };
23 |
--------------------------------------------------------------------------------
/libs/devkit/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.1.1 (2024-04-06)
2 |
3 |
4 | ### 🩹 Fixes
5 |
6 | - update documentation ([d2968b2](https://github.com/danielglejzner/ngx-maintenance/commit/d2968b2))
7 |
8 |
9 | ### ❤️ Thank You
10 |
11 | - Arturo Volpe @aVolpe
12 | - Jordan Hall @Jordan-Hall
13 |
14 | ## 0.1.0 (2024-03-13)
15 |
16 |
17 | ### 🚀 Features
18 |
19 | - import angular material rail drawer ([1f81f54](https://github.com/danielglejzner/ngx-maintenance/commit/1f81f54))
20 |
21 | - use cli to get from package json or github URL ([f9d4ea4](https://github.com/danielglejzner/ngx-maintenance/commit/f9d4ea4))
22 |
23 | - **npm-api:** refactor npm registry api into a standalone lib and strongly typed ([cc10093](https://github.com/danielglejzner/ngx-maintenance/commit/cc10093))
24 |
25 |
26 | ### ❤️ Thank You
27 |
28 | - Jordan Hall @Jordan-Hall
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/flatten.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'flatten',
5 | standalone: true,
6 | })
7 | export class FlattenPipe implements PipeTransform {
8 | transform(input: T, shallow?: boolean): T;
9 | transform(input: any[], shallow?: boolean): any[];
10 |
11 | transform(input: any, shallow: boolean = false): any {
12 | if (!Array.isArray(input)) {
13 | return input;
14 | }
15 |
16 | return shallow ? [].concat.apply([], input) : this.flatten(input);
17 | }
18 |
19 | private flatten(array: any[]): any[] {
20 | return array.reduce((arr: any[], elm: any) => {
21 | if (Array.isArray(elm)) {
22 | return arr.concat(this.flatten(elm));
23 | }
24 |
25 | return arr.concat(elm);
26 | }, []);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2022",
4 | "useDefineForClassFields": false,
5 | "forceConsistentCasingInFileNames": true,
6 | "strict": true,
7 | "noImplicitOverride": true,
8 | "noPropertyAccessFromIndexSignature": true,
9 | "noImplicitReturns": true,
10 | "noFallthroughCasesInSwitch": true
11 | },
12 | "files": [],
13 | "include": [],
14 | "references": [
15 | {
16 | "path": "./tsconfig.lib.json"
17 | },
18 | {
19 | "path": "./tsconfig.spec.json"
20 | }
21 | ],
22 | "extends": "../../tsconfig.base.json",
23 | "angularCompilerOptions": {
24 | "enableI18nLegacyMessageIdFormat": false,
25 | "strictInjectionParameters": true,
26 | "strictInputAccessModifiers": true,
27 | "strictTemplates": true
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/jest.config.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | export default {
3 | displayName: 'ngx-maintenance-dashboard',
4 | preset: '../../jest.preset.js',
5 | setupFilesAfterEnv: ['/src/test-setup.ts'],
6 | coverageDirectory: '../../coverage/apps/ngx-maintenance-dashboard',
7 | transform: {
8 | '^.+\\.(ts|mjs|js|html)$': [
9 | 'jest-preset-angular',
10 | {
11 | tsconfig: '/tsconfig.spec.json',
12 | stringifyContentPathRegex: '\\.(html|svg)$',
13 | },
14 | ],
15 | },
16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
17 | snapshotSerializers: [
18 | 'jest-preset-angular/build/serializers/no-ng-attributes',
19 | 'jest-preset-angular/build/serializers/ng-snapshot',
20 | 'jest-preset-angular/build/serializers/html-comment',
21 | ],
22 | };
23 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-search-filter/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2022",
4 | "useDefineForClassFields": false,
5 | "forceConsistentCasingInFileNames": true,
6 | "strict": true,
7 | "noImplicitOverride": true,
8 | "noPropertyAccessFromIndexSignature": true,
9 | "noImplicitReturns": true,
10 | "noFallthroughCasesInSwitch": true
11 | },
12 | "files": [],
13 | "include": [],
14 | "references": [
15 | {
16 | "path": "./tsconfig.lib.json"
17 | },
18 | {
19 | "path": "./tsconfig.spec.json"
20 | }
21 | ],
22 | "extends": "../../tsconfig.base.json",
23 | "angularCompilerOptions": {
24 | "enableI18nLegacyMessageIdFormat": false,
25 | "strictInjectionParameters": true,
26 | "strictInputAccessModifiers": true,
27 | "strictTemplates": true
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/shuffle.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'shuffle',
5 | standalone: true,
6 | })
7 | export class ShufflePipe implements PipeTransform {
8 | transform(input: T): T;
9 | transform(input: any[]): any[];
10 |
11 | // Using a version of the Fisher-Yates shuffle algorithm
12 | // https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
13 | transform(input: any): any {
14 | if (!Array.isArray(input)) {
15 | return input;
16 | }
17 |
18 | const shuffled = [...input];
19 | const n = input.length - 1;
20 | for (let i = 0; i < n; ++i) {
21 | const j = Math.floor(Math.random() * (n - i + 1)) + i;
22 | [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
23 | }
24 |
25 | return shuffled;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ngx-pipes",
3 | "$schema": "../../node_modules/nx/schemas/project-schema.json",
4 | "sourceRoot": "angular-pkgs/ngx-pipes/src",
5 | "prefix": "ngx-maintenance",
6 | "tags": [],
7 | "projectType": "library",
8 | "targets": {
9 | "build": {
10 | "executor": "@nx/angular:package",
11 | "outputs": ["{workspaceRoot}/dist/{projectRoot}"],
12 | "options": {
13 | "project": "angular-pkgs/ngx-pipes/ng-package.json"
14 | },
15 | "configurations": {
16 | "production": {
17 | "tsConfig": "angular-pkgs/ngx-pipes/tsconfig.lib.prod.json"
18 | },
19 | "development": {
20 | "tsConfig": "angular-pkgs/ngx-pipes/tsconfig.lib.json"
21 | }
22 | },
23 | "defaultConfiguration": "production"
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/union.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'union',
5 | standalone: true,
6 | })
7 | export class UnionPipe implements PipeTransform {
8 | transform(input: T, args?: any[]): T;
9 | transform(input: any[], args?: any[]): any[];
10 |
11 | transform(input: any, args: any[] = []): any {
12 | if (!Array.isArray(input) || !Array.isArray(args)) {
13 | return input;
14 | }
15 |
16 | return args.reduce((newArr, currArr) => {
17 | return newArr.concat(
18 | currArr.reduce((noDupArr: any[], curr: any) => {
19 | // tslint:disable-next-line:no-bitwise
20 | return !~noDupArr.indexOf(curr) && !~newArr.indexOf(curr) ? noDupArr.concat([curr]) : noDupArr;
21 | }, [])
22 | );
23 | }, input);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/object/keys.spec.ts:
--------------------------------------------------------------------------------
1 | import { KeysPipe } from './keys';
2 |
3 | describe('Keys Pipe', () => {
4 | let pipe: KeysPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new KeysPipe();
8 | });
9 |
10 | it('should keep the element the same way if its not an object', () => {
11 | expect(pipe.transform([1, 2, 3])).toEqual([1, 2, 3]);
12 | expect(pipe.transform([])).toEqual([]);
13 | expect(pipe.transform('foo')).toEqual('foo');
14 | expect(pipe.transform(null)).toEqual(null);
15 | expect(pipe.transform(undefined)).toEqual(undefined);
16 | });
17 |
18 | it('should return array of keys', () => {
19 | expect(pipe.transform({})).toEqual([]);
20 | expect(pipe.transform({ foo: 'bar' })).toEqual(['foo']);
21 | expect(pipe.transform({ foo: 1, bar: 42 })).toEqual(['foo', 'bar']);
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/angular-pkgs/angular-material-rail-drawer/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2022",
4 | "useDefineForClassFields": false,
5 | "forceConsistentCasingInFileNames": true,
6 | "strict": true,
7 | "noImplicitOverride": true,
8 | "noPropertyAccessFromIndexSignature": true,
9 | "noImplicitReturns": true,
10 | "noFallthroughCasesInSwitch": true
11 | },
12 | "files": [],
13 | "include": [],
14 | "references": [
15 | {
16 | "path": "./tsconfig.lib.json"
17 | },
18 | {
19 | "path": "./tsconfig.spec.json"
20 | }
21 | ],
22 | "extends": "../../tsconfig.base.json",
23 | "angularCompilerOptions": {
24 | "enableI18nLegacyMessageIdFormat": false,
25 | "strictInjectionParameters": true,
26 | "strictInputAccessModifiers": true,
27 | "strictTemplates": true
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/object/values.spec.ts:
--------------------------------------------------------------------------------
1 | import { ValuesPipe } from './values';
2 |
3 | describe('Values Pipe', () => {
4 | let pipe: ValuesPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new ValuesPipe();
8 | });
9 |
10 | it('should keep the element the same way if its not an object', () => {
11 | expect(pipe.transform([1, 2, 3])).toEqual([1, 2, 3]);
12 | expect(pipe.transform([])).toEqual([]);
13 | expect(pipe.transform('foo')).toEqual('foo');
14 | expect(pipe.transform(null)).toEqual(null);
15 | expect(pipe.transform(undefined)).toEqual(undefined);
16 | });
17 |
18 | it('should return array of values', () => {
19 | expect(pipe.transform({})).toEqual([]);
20 | expect(pipe.transform({ foo: 'bar' })).toEqual(['bar']);
21 | expect(pipe.transform({ foo: 1, bar: 42 })).toEqual([1, 42]);
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/angular-pkgs/angular-material-rail-drawer/jest.config.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | export default {
3 | displayName: 'angular-material-rail-drawer',
4 | preset: '../../jest.preset.js',
5 | setupFilesAfterEnv: ['/src/test-setup.ts'],
6 | coverageDirectory: '../../coverage/angular-pkgs/angular-material-rail-drawer',
7 | transform: {
8 | '^.+\\.(ts|mjs|js|html)$': [
9 | 'jest-preset-angular',
10 | {
11 | tsconfig: '/tsconfig.spec.json',
12 | stringifyContentPathRegex: '\\.(html|svg)$',
13 | },
14 | ],
15 | },
16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
17 | snapshotSerializers: [
18 | 'jest-preset-angular/build/serializers/no-ng-attributes',
19 | 'jest-preset-angular/build/serializers/ng-snapshot',
20 | 'jest-preset-angular/build/serializers/html-comment',
21 | ],
22 | };
23 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/boolean/is-object.spec.ts:
--------------------------------------------------------------------------------
1 | import { IsObjectPipe } from './is-object';
2 |
3 | describe('IsObjectPipe', () => {
4 | let pipe: IsObjectPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new IsObjectPipe();
8 | });
9 |
10 | it('should check if of given value is an object', () => {
11 | expect(pipe.transform(null)).toBeFalsy();
12 | expect(pipe.transform(1)).toBeFalsy();
13 | expect(pipe.transform({})).toBeTruthy();
14 | expect(pipe.transform({ a: 1, b: 2 })).toBeTruthy();
15 | expect(pipe.transform([])).toBeTruthy();
16 | expect(pipe.transform([1, 2])).toBeTruthy();
17 | expect(pipe.transform([{ a: 1 }, { a: 2 }])).toBeTruthy();
18 | expect(pipe.transform(undefined)).toBeFalsy();
19 | expect(pipe.transform(false)).toBeFalsy();
20 | expect(pipe.transform(true)).toBeFalsy();
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/shuffle.spec.ts:
--------------------------------------------------------------------------------
1 | import { ShufflePipe } from './shuffle';
2 |
3 | describe('ShufflePipe', () => {
4 | let pipe: ShufflePipe;
5 |
6 | beforeEach(() => {
7 | pipe = new ShufflePipe();
8 | });
9 |
10 | it('should not change anything if not array', () => {
11 | expect(pipe.transform('foo')).toEqual('foo');
12 | expect(pipe.transform(null)).toEqual(null);
13 | expect(pipe.transform(undefined)).toEqual(undefined);
14 | expect(pipe.transform(42)).toEqual(42);
15 | expect(pipe.transform({ foo: 1, bar: 2 })).toEqual({ foo: 1, bar: 2 });
16 | });
17 |
18 | it('should return shuffled array', () => {
19 | expect(pipe.transform([42])).toEqual([42]);
20 | expect(pipe.transform(['foo'])).toEqual(['foo']);
21 | expect(pipe.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).length).toEqual(10);
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/underscore.spec.ts:
--------------------------------------------------------------------------------
1 | import { UnderscorePipe } from './underscore';
2 |
3 | describe('UnderscorePipe Tests', () => {
4 | let pipe: UnderscorePipe;
5 |
6 | beforeEach(() => {
7 | pipe = new UnderscorePipe();
8 | });
9 |
10 | it('Should not do anything if not a string', () => {
11 | expect(pipe.transform(null)).toEqual(null);
12 | expect(pipe.transform(undefined)).toEqual(undefined);
13 | expect(pipe.transform(42)).toEqual(42);
14 | expect(pipe.transform({ name: 'foo' })).toEqual({ name: 'foo' });
15 | });
16 |
17 | it('Should transform from camelCase to underscore properly', () => {
18 | expect(pipe.transform('fooBar')).toEqual('foo_bar');
19 | expect(pipe.transform('FooBar')).toEqual('foo_bar');
20 | expect(pipe.transform('AngularIsAwesome')).toEqual('angular_is_awesome');
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-image-viewer/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ng2-image-viewer",
3 | "$schema": "../../node_modules/nx/schemas/project-schema.json",
4 | "sourceRoot": "angular-pkgs/ng2-image-viewer/src",
5 | "prefix": "ngx-maintenance",
6 | "tags": [],
7 | "projectType": "library",
8 | "targets": {
9 | "build": {
10 | "executor": "@nx/angular:package",
11 | "outputs": ["{workspaceRoot}/dist/{projectRoot}"],
12 | "options": {
13 | "project": "angular-pkgs/ng2-image-viewer/ng-package.json"
14 | },
15 | "configurations": {
16 | "production": {
17 | "tsConfig": "angular-pkgs/ng2-image-viewer/tsconfig.lib.prod.json"
18 | },
19 | "development": {
20 | "tsConfig": "angular-pkgs/ng2-image-viewer/tsconfig.lib.json"
21 | }
22 | },
23 | "defaultConfiguration": "production"
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/lpad.spec.ts:
--------------------------------------------------------------------------------
1 | import { LeftPadPipe } from './lpad';
2 |
3 | describe('LeftPadPipe Tests', () => {
4 | let pipe: LeftPadPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new LeftPadPipe();
8 | });
9 |
10 | it('Should left pad with 2 blanks', () => {
11 | const result = pipe.transform('foo', 5);
12 | expect(result).toEqual(' foo');
13 | });
14 |
15 | it('Should left pad a number casted to string with 5 zeros', () => {
16 | const result = pipe.transform(String(2), 6, '0');
17 | expect(result).toEqual('000002');
18 | });
19 |
20 | it('Should not add padding', () => {
21 | const result = pipe.transform('foo', 3);
22 | expect(result).toEqual('foo');
23 | });
24 |
25 | it('Should not add padding', () => {
26 | const result = pipe.transform('foofoo', 3);
27 | expect(result).toEqual('foofoo');
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-search-filter/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ng2-search-filter",
3 | "$schema": "../../node_modules/nx/schemas/project-schema.json",
4 | "sourceRoot": "angular-pkgs/ng2-search-filter/src",
5 | "prefix": "ngx-maintenance",
6 | "tags": [],
7 | "projectType": "library",
8 | "targets": {
9 | "build": {
10 | "executor": "@nx/angular:package",
11 | "outputs": ["{workspaceRoot}/dist/{projectRoot}"],
12 | "options": {
13 | "project": "angular-pkgs/ng2-search-filter/ng-package.json"
14 | },
15 | "configurations": {
16 | "production": {
17 | "tsConfig": "angular-pkgs/ng2-search-filter/tsconfig.lib.prod.json"
18 | },
19 | "development": {
20 | "tsConfig": "angular-pkgs/ng2-search-filter/tsconfig.lib.json"
21 | }
22 | },
23 | "defaultConfiguration": "production"
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/match.spec.ts:
--------------------------------------------------------------------------------
1 | import { MatchPipe } from './match';
2 |
3 | describe('MatchPipe Tests', () => {
4 | let pipe: MatchPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new MatchPipe();
8 | });
9 |
10 | it('Should not do anything if not a string', () => {
11 | expect(pipe.transform(null, '')).toEqual(null);
12 | expect(pipe.transform(undefined, '')).toEqual(undefined);
13 | expect(pipe.transform(42, '')).toEqual(42);
14 | expect(pipe.transform({ name: 'foo' }, '')).toEqual({ name: 'foo' });
15 | });
16 |
17 | it('Should camelize properly', () => {
18 | expect(pipe.transform('foo 42', '[\\d]+$', 'g')).toEqual(['42']);
19 | expect(pipe.transform('42 foo', '[\\d]+$', 'g')).toEqual(null);
20 | expect(pipe.transform('foo', '[\\d]+$', 'g')).toEqual(null);
21 | expect(pipe.transform('FOO', '^foo')).toEqual(null);
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/strip-tags.spec.ts:
--------------------------------------------------------------------------------
1 | import { StripTagsPipe } from './strip-tags';
2 |
3 | describe('StripTagsPipe Tests', () => {
4 | let pipe: StripTagsPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new StripTagsPipe();
8 | });
9 |
10 | it('Should strip tags', () => {
11 | expect(pipe.transform('foo')).toEqual('foo');
12 | expect(pipe.transform('bar
')).toEqual('bar');
13 | });
14 |
15 | it('Should strip tags only tags which are not allowed', () => {
16 | expect(pipe.transform('foobar
', 'p')).toEqual('foobar
');
17 | expect(pipe.transform('foobar
', 'a')).toEqual('foobar');
18 | expect(pipe.transform('foobar
', 'p', 'a')).toEqual(
19 | 'foobar
'
20 | );
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/repeat.spec.ts:
--------------------------------------------------------------------------------
1 | import { RepeatPipe } from './repeat';
2 |
3 | describe('RepeatPipe Tests', () => {
4 | let pipe: RepeatPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new RepeatPipe();
8 | });
9 |
10 | it('Should repeat string', () => {
11 | const result = pipe.transform('foo', 3);
12 | expect(result).toEqual('foofoofoo');
13 | });
14 |
15 | it('Should repeat string with separator', () => {
16 | const result = pipe.transform('foo', 3, '-');
17 | expect(result).toEqual('foo-foo-foo');
18 | });
19 |
20 | it('Should return the same value when there are no arguments', () => {
21 | const result = pipe.transform('foo');
22 | expect(result).toEqual('foo');
23 | });
24 |
25 | it('Should throw range exception if times count is below zero', () => {
26 | expect(() => {
27 | pipe.transform('foo', -1);
28 | }).toThrow(new RangeError());
29 | });
30 | });
31 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/lines.spec.ts:
--------------------------------------------------------------------------------
1 | import { LinesPipe } from './lines';
2 |
3 | describe('LinesPipe Tests', () => {
4 | let pipe: LinesPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new LinesPipe();
8 | });
9 |
10 | it('Should not do anything if not a string', () => {
11 | expect(pipe.transform(null)).toEqual(null);
12 | expect(pipe.transform(undefined)).toEqual(undefined);
13 | expect(pipe.transform(42)).toEqual(42);
14 | expect(pipe.transform({ name: 'foo' })).toEqual({ name: 'foo' });
15 | });
16 |
17 | it('Should extract lines properly', () => {
18 | expect(pipe.transform('foo\r\n')).toEqual(['foo', '']);
19 | expect(pipe.transform('foo\nbar')).toEqual(['foo', 'bar']);
20 | expect(pipe.transform('foo\r\nbar\nbaz')).toEqual(['foo', 'bar', 'baz']);
21 | expect(pipe.transform('Some\nSentence\r\nwith\r\nNew line')).toEqual(['Some', 'Sentence', 'with', 'New line']);
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2022",
4 | "useDefineForClassFields": false,
5 | "esModuleInterop": true,
6 | "forceConsistentCasingInFileNames": true,
7 | "strict": true,
8 | "noImplicitOverride": true,
9 | "noPropertyAccessFromIndexSignature": true,
10 | "noImplicitReturns": true,
11 | "noFallthroughCasesInSwitch": true
12 | },
13 | "files": [],
14 | "include": [],
15 | "references": [
16 | {
17 | "path": "./tsconfig.editor.json"
18 | },
19 | {
20 | "path": "./tsconfig.app.json"
21 | },
22 | {
23 | "path": "./tsconfig.spec.json"
24 | }
25 | ],
26 | "extends": "../../tsconfig.base.json",
27 | "angularCompilerOptions": {
28 | "enableI18nLegacyMessageIdFormat": false,
29 | "strictInjectionParameters": true,
30 | "strictInputAccessModifiers": true,
31 | "strictTemplates": true
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/truthify.spec.ts:
--------------------------------------------------------------------------------
1 | import { TrurthifyPipe } from './truthify';
2 |
3 | describe('TrurthifyPipe', () => {
4 | let pipe: TrurthifyPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new TrurthifyPipe();
8 | });
9 |
10 | it('should not change anything if not array', () => {
11 | expect(pipe.transform('foo')).toEqual('foo');
12 | expect(pipe.transform(null)).toEqual(null);
13 | expect(pipe.transform(undefined)).toEqual(undefined);
14 | expect(pipe.transform(42)).toEqual(42);
15 | expect(pipe.transform({ foo: 1, bar: 2 })).toEqual({ foo: 1, bar: 2 });
16 | });
17 |
18 | it('should not change array without falsy values', () => {
19 | expect(pipe.transform([1, 2, 3])).toEqual([1, 2, 3]);
20 | });
21 |
22 | it('should check if is `truthifying` array properly', () => {
23 | expect(pipe.transform([null, 1, false, undefined, 2, 0, 3, NaN, 4, ''])).toEqual([1, 2, 3, 4]);
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/diff.spec.ts:
--------------------------------------------------------------------------------
1 | import { DiffPipe } from './diff';
2 |
3 | describe('DiffPipe', () => {
4 | let pipe: DiffPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new DiffPipe();
8 | });
9 |
10 | it('should return the input if not an array', () => {
11 | expect(pipe.transform(true)).toEqual(true);
12 | expect(pipe.transform(42)).toEqual(42);
13 | });
14 |
15 | it("should keep the array the same way if it doesn't have any without arguments", () => {
16 | expect(pipe.transform([1, 2, 3])).toEqual([1, 2, 3]);
17 | expect(pipe.transform([])).toEqual([]);
18 | });
19 |
20 | it('should returns an array of diff between arrays', () => {
21 | expect(pipe.transform([2, 3], [])).toEqual([2, 3]);
22 | expect(pipe.transform([], [2, 3])).toEqual([]);
23 | expect(pipe.transform([1, 2, 3], [2, 3])).toEqual([1]);
24 | expect(pipe.transform([1, 2, 3], [1, 4], [2, 5])).toEqual([3]);
25 | });
26 | });
27 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/from-pairs.spec.ts:
--------------------------------------------------------------------------------
1 | import { FromPairsPipe } from './from-pairs';
2 |
3 | describe('FromPairsPipe', () => {
4 | let pipe: FromPairsPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new FromPairsPipe();
8 | });
9 |
10 | it('should not do anything with non-arrays', () => {
11 | expect(pipe.transform(42)).toBe(42);
12 | expect(pipe.transform('foo')).toBe('foo');
13 | expect(pipe.transform(undefined)).toBe(undefined);
14 | });
15 |
16 | it('should transform array to object', () => {
17 | expect(pipe.transform([['foo', 42]])).toEqual({ foo: 42 });
18 | expect(
19 | pipe.transform([
20 | ['foo', 42],
21 | ['bar', 'foobar'],
22 | ])
23 | ).toEqual({ foo: 42, bar: 'foobar' });
24 | });
25 |
26 | it('should ignore non-array elements', () => {
27 | expect(pipe.transform([['foo', 42], 1, ['bar', null], 'baz'])).toEqual({ foo: 42, bar: null });
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/test-pipe.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestPipe } from './test-pipe';
2 |
3 | describe('TestPipe Tests', () => {
4 | let pipe: TestPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new TestPipe();
8 | });
9 |
10 | it('Should not do anything if not a string', () => {
11 | expect(pipe.transform(null, '')).toEqual(null);
12 | expect(pipe.transform(undefined, '')).toEqual(undefined);
13 | expect(pipe.transform(42, '')).toEqual(42);
14 | expect(pipe.transform({ name: 'foo' }, '')).toEqual({ name: 'foo' });
15 | });
16 |
17 | it('Should camelize properly', () => {
18 | expect(pipe.transform('foo 42', '[\\d]+$', 'g')).toBeTruthy();
19 | expect(pipe.transform('42 foo', '[\\d]+$', 'g')).toBeFalsy();
20 | expect(pipe.transform('foo', '[\\d]+$', 'g')).toBeFalsy();
21 | expect(pipe.transform('FOO', '^foo')).toBeFalsy();
22 | expect(pipe.transform('FOO', '^foo', 'i')).toBeTruthy();
23 | });
24 | });
25 |
--------------------------------------------------------------------------------
/angular-pkgs/angular-material-rail-drawer/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "angular-material-rail-drawer",
3 | "$schema": "../../node_modules/nx/schemas/project-schema.json",
4 | "sourceRoot": "angular-pkgs/angular-material-rail-drawer/src",
5 | "prefix": "ngx-maintenance",
6 | "tags": [],
7 | "projectType": "library",
8 | "targets": {
9 | "build": {
10 | "executor": "@nx/angular:package",
11 | "outputs": ["{workspaceRoot}/dist/{projectRoot}"],
12 | "options": {
13 | "project": "angular-pkgs/angular-material-rail-drawer/ng-package.json"
14 | },
15 | "configurations": {
16 | "production": {
17 | "tsConfig": "angular-pkgs/angular-material-rail-drawer/tsconfig.lib.prod.json"
18 | },
19 | "development": {
20 | "tsConfig": "angular-pkgs/angular-material-rail-drawer/tsconfig.lib.json"
21 | }
22 | },
23 | "defaultConfiguration": "production"
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "ignorePatterns": ["**/*"],
3 | "overrides": [
4 | {
5 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
6 | "rules": {
7 | "@nx/enforce-module-boundaries": [
8 | "error",
9 | {
10 | "enforceBuildableLibDependency": true,
11 | "allow": [],
12 | "depConstraints": [
13 | {
14 | "sourceTag": "*",
15 | "onlyDependOnLibsWithTags": ["*"]
16 | }
17 | ]
18 | }
19 | ]
20 | }
21 | },
22 | {
23 | "files": ["*.ts", "*.tsx"],
24 | "rules": {}
25 | },
26 | {
27 | "files": ["*.js", "*.jsx"],
28 | "rules": {}
29 | },
30 | {
31 | "files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
32 | "env": {
33 | "jest": true
34 | },
35 | "rules": {}
36 | }
37 | ],
38 | "extends": ["./.eslintrc.base.json"]
39 | }
40 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/ng-pipes.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { NgArrayPipesModule } from './pipes/array/index';
3 | import { NgObjectPipesModule } from './pipes/object/index';
4 | import { NgStringPipesModule } from './pipes/string/index';
5 | import { NgMathPipesModule } from './pipes/math/index';
6 | import { NgBooleanPipesModule } from './pipes/boolean/index';
7 | import { NgDatePipesModule } from './pipes/date/index';
8 |
9 | @NgModule({
10 | exports: [
11 | NgArrayPipesModule,
12 | NgStringPipesModule,
13 | NgMathPipesModule,
14 | NgBooleanPipesModule,
15 | NgObjectPipesModule,
16 | NgDatePipesModule,
17 | ],
18 | })
19 | export class NgPipesModule {}
20 |
21 | export * from './pipes/array/index';
22 | export * from './pipes/object/index';
23 | export * from './pipes/string/index';
24 | export * from './pipes/math/index';
25 | export * from './pipes/boolean/index';
26 | export * from './pipes/date/index';
27 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/rpad.spec.ts:
--------------------------------------------------------------------------------
1 | import { RightPadPipe } from './rpad';
2 |
3 | describe('RightPadPipe Tests', () => {
4 | let pipe: RightPadPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new RightPadPipe();
8 | });
9 |
10 | it('Should right pad with 2 blanks', () => {
11 | const result = pipe.transform('foo', 5);
12 | expect(result).toEqual('foo ');
13 | });
14 |
15 | it('Should right pad a number casted to string with 5 zeros', () => {
16 | const result = pipe.transform(String(2), 6, '0');
17 | expect(result).toEqual('200000');
18 | });
19 |
20 | it('Should not add padding if sting length is the same as length', () => {
21 | const result = pipe.transform('foo', 3);
22 | expect(result).toEqual('foo');
23 | });
24 |
25 | it('Should not add padding if sting length is greater than length', () => {
26 | const result = pipe.transform('foofoo', 3);
27 | expect(result).toEqual('foofoo');
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/slugify.spec.ts:
--------------------------------------------------------------------------------
1 | import { SlugifyPipe } from './slugify';
2 |
3 | describe('SlugifyPipe Tests', () => {
4 | let pipe: SlugifyPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new SlugifyPipe();
8 | });
9 |
10 | it('Should slugify strings', () => {
11 | expect(pipe.transform(null)).toEqual(null);
12 | expect(pipe.transform(undefined)).toEqual(undefined);
13 | expect(pipe.transform('')).toEqual('');
14 | expect(pipe.transform('Foo')).toEqual('foo');
15 | expect(pipe.transform('Foo Bar')).toEqual('foo-bar');
16 | expect(pipe.transform('Foo Bar Baz')).toEqual('foo-bar-baz');
17 | expect(pipe.transform('UPPER CASE TEXT')).toEqual('upper-case-text');
18 | });
19 |
20 | it('Should slugify special strings', () => {
21 | expect(pipe.transform('http://example.com/foo')).toEqual('http-example-com-foo');
22 | expect(pipe.transform(' http://example.com/foo ')).toEqual('http-example-com-foo');
23 | });
24 | });
25 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/shorten.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isString } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'shorten',
6 | standalone: true,
7 | })
8 | export class ShortenPipe implements PipeTransform {
9 | transform(input: string, length?: number, suffix?: string, wordBreak?: boolean): string;
10 | transform(input: any, length?: number, suffix?: string, wordBreak?: boolean): any;
11 |
12 | transform(text: any, length: number = 0, suffix: string = '', wordBreak: boolean = true): string {
13 | if (!isString(text)) {
14 | return text;
15 | }
16 |
17 | if (text.length > length) {
18 | if (wordBreak) {
19 | return text.slice(0, length) + suffix;
20 | }
21 |
22 | // tslint:disable-next-line:no-bitwise
23 | if (!!~text.indexOf(' ', length)) {
24 | return text.slice(0, text.indexOf(' ', length)) + suffix;
25 | }
26 | }
27 |
28 | return text;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/bytes.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { applyPrecision, isNumberFinite, isUndefined } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'bytes',
6 | standalone: true,
7 | })
8 | export class BytesPipe implements PipeTransform {
9 | private dictionary: Array<{ max: number; type: string }> = [
10 | { max: 1024, type: 'B' },
11 | { max: 1048576, type: 'KB' },
12 | { max: 1073741824, type: 'MB' },
13 | { max: 1.0995116e12, type: 'GB' },
14 | ];
15 |
16 | transform(value: number, precision?: number | undefined): string | number {
17 | if (!isNumberFinite(value)) {
18 | return NaN;
19 | }
20 |
21 | const format = this.dictionary.find((d) => value < d.max) || this.dictionary[this.dictionary.length - 1];
22 | const calc = value / (format.max / 1024);
23 | const num = isUndefined(precision) ? calc : applyPrecision(calc, precision);
24 |
25 | return `${num} ${format.type}`;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/object/index.ts:
--------------------------------------------------------------------------------
1 | import { KeysPipe } from './keys';
2 | import { ValuesPipe } from './values';
3 | import { PairsPipe } from './pairs';
4 | import { PickPipe } from './pick';
5 | import { OmitPipe } from './omit';
6 | import { InvertPipe } from './invert';
7 | import { InvertByPipe } from './invert-by';
8 | import { DiffObjPipe } from './diff-obj';
9 | import { NgModule } from '@angular/core';
10 |
11 | const OBJECT_PIPES = [KeysPipe, ValuesPipe, PairsPipe, PickPipe, InvertPipe, InvertByPipe, OmitPipe, DiffObjPipe];
12 |
13 | @NgModule({
14 | imports: [...OBJECT_PIPES],
15 | exports: OBJECT_PIPES,
16 | })
17 | export class NgObjectPipesModule {}
18 |
19 | export { KeysPipe } from './keys';
20 | export { ValuesPipe } from './values';
21 | export { PairsPipe } from './pairs';
22 | export { PickPipe } from './pick';
23 | export { OmitPipe } from './omit';
24 | export { InvertPipe } from './invert';
25 | export { InvertByPipe } from './invert-by';
26 | export { DiffObjPipe } from './diff-obj';
27 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["../../.eslintrc.json", "../../.eslintrc.base.json"],
3 | "ignorePatterns": ["!**/*"],
4 | "overrides": [
5 | {
6 | "files": ["*.ts"],
7 | "extends": [
8 | "plugin:@nx/angular",
9 | "plugin:@angular-eslint/template/process-inline-templates"
10 | ],
11 | "rules": {
12 | "@angular-eslint/directive-selector": [
13 | "error",
14 | {
15 | "type": "attribute",
16 | "prefix": "ngxMaintenance",
17 | "style": "camelCase"
18 | }
19 | ],
20 | "@angular-eslint/component-selector": [
21 | "error",
22 | {
23 | "type": "element",
24 | "prefix": "ngx-maintenance",
25 | "style": "kebab-case"
26 | }
27 | ]
28 | }
29 | },
30 | {
31 | "files": ["*.html"],
32 | "extends": ["plugin:@nx/angular-template"],
33 | "rules": {}
34 | }
35 | ]
36 | }
37 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/sample.spec.ts:
--------------------------------------------------------------------------------
1 | import { SamplePipe } from './sample';
2 |
3 | describe('SamplePipe', () => {
4 | let pipe: SamplePipe;
5 |
6 | beforeEach(() => {
7 | pipe = new SamplePipe();
8 | });
9 |
10 | it('should not change anything if not array', () => {
11 | expect(pipe.transform('foo')).toEqual('foo');
12 | expect(pipe.transform(null)).toEqual(null);
13 | expect(pipe.transform(undefined)).toEqual(undefined);
14 | expect(pipe.transform(42)).toEqual(42);
15 | expect(pipe.transform({ foo: 1, bar: 2 })).toEqual({ foo: 1, bar: 2 });
16 | });
17 |
18 | it('should return randomly sampled array', () => {
19 | expect(pipe.transform([42])).toEqual([42]);
20 | expect(pipe.transform(['foo'])).toEqual(['foo']);
21 | expect(pipe.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).length).toEqual(1);
22 | expect(pipe.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 3).length).toEqual(3);
23 | expect(pipe.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 30).length).toEqual(10);
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/ucfirst.spec.ts:
--------------------------------------------------------------------------------
1 | import { UcFirstPipe } from './ucfirst';
2 |
3 | describe('UcFirstPipe Tests', () => {
4 | let pipe: UcFirstPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new UcFirstPipe();
8 | });
9 |
10 | it('Should return value if not a string', () => {
11 | expect(pipe.transform(42)).toEqual(42);
12 | expect(pipe.transform(false)).toEqual(false);
13 | });
14 |
15 | it('Should capitalize first word in a string', () => {
16 | const result = pipe.transform('foo bar baz');
17 | expect(result).toEqual('Foo bar baz');
18 | });
19 |
20 | it('Should capitalize first word in a string, and keep other capitalized letters.', () => {
21 | const result = pipe.transform('foo BAR BaZ');
22 | expect(result).toEqual('Foo BAR BaZ');
23 | });
24 |
25 | it('Should capitalize special names properly', () => {
26 | expect(pipe.transform('JEAN-LUC PICARD')).toEqual('Jean-Luc PICARD');
27 | expect(pipe.transform(`MILES O'BRIEN`)).toEqual(`Miles O'BRIEN`);
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/object/pairs.spec.ts:
--------------------------------------------------------------------------------
1 | import { PairsPipe } from './pairs';
2 |
3 | describe('PairsPipe', () => {
4 | let pipe: PairsPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new PairsPipe();
8 | });
9 |
10 | it('should keep the element the same way if its not an object', () => {
11 | expect(pipe.transform([1, 2, 3])).toEqual([1, 2, 3]);
12 | expect(pipe.transform([])).toEqual([]);
13 | expect(pipe.transform('foo')).toEqual('foo');
14 | expect(pipe.transform(null)).toEqual(null);
15 | expect(pipe.transform(undefined)).toEqual(undefined);
16 | });
17 |
18 | it('should return array of pairs', () => {
19 | expect(pipe.transform({})).toEqual([]);
20 | expect(pipe.transform({ foo: 'bar' })).toEqual([['foo', 'bar']]);
21 | expect(pipe.transform({ foo: 1, bar: 42 })).toEqual([
22 | ['foo', 1],
23 | ['bar', 42],
24 | ]);
25 | expect(pipe.transform({ foo: [1, 2], bar: { a: 2 } })).toEqual([
26 | ['foo', [1, 2]],
27 | ['bar', { a: 2 }],
28 | ]);
29 | });
30 | });
31 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/ucwords.spec.ts:
--------------------------------------------------------------------------------
1 | import { UcWordsPipe } from './ucwords';
2 |
3 | describe('UcFirstPipe Tests', () => {
4 | let pipe: UcWordsPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new UcWordsPipe();
8 | });
9 |
10 | it('Should return value if not a string', () => {
11 | expect(pipe.transform(42)).toEqual(42);
12 | expect(pipe.transform(false)).toEqual(false);
13 | });
14 |
15 | it('Should capitalize all words in a string', () => {
16 | const result = pipe.transform('foo bar baz');
17 | expect(result).toEqual('Foo Bar Baz');
18 | });
19 |
20 | it('Should test mixed strings capitalize behaviour', () => {
21 | const result = pipe.transform('foo bar baz $a $b $c some string to test');
22 | expect(result).toEqual('Foo Bar Baz $a $b $c Some String To Test');
23 | });
24 |
25 | it('Should test special names', () => {
26 | expect(pipe.transform('JEAN-LUC PICARD')).toEqual('Jean-Luc Picard');
27 | expect(pipe.transform(`shaquille o'neal`)).toEqual(`Shaquille O'Neal`);
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/.eslintrc.base.json:
--------------------------------------------------------------------------------
1 | {
2 | "root": true,
3 | "ignorePatterns": ["**/*"],
4 | "plugins": ["@nx"],
5 | "overrides": [
6 | {
7 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
8 | "rules": {
9 | "@nx/enforce-module-boundaries": [
10 | "error",
11 | {
12 | "enforceBuildableLibDependency": true,
13 | "allow": [],
14 | "depConstraints": [
15 | {
16 | "sourceTag": "*",
17 | "onlyDependOnLibsWithTags": ["*"]
18 | }
19 | ]
20 | }
21 | ]
22 | }
23 | },
24 | {
25 | "files": ["*.ts", "*.tsx"],
26 | "extends": ["plugin:@nx/typescript"],
27 | "rules": {}
28 | },
29 | {
30 | "files": ["*.js", "*.jsx"],
31 | "extends": ["plugin:@nx/javascript"],
32 | "rules": {}
33 | },
34 | {
35 | "files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
36 | "env": {
37 | "jest": true
38 | },
39 | "rules": {}
40 | }
41 | ]
42 | }
43 |
--------------------------------------------------------------------------------
/libs/ngx-maintenance/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.1.2 (2024-04-06)
2 |
3 |
4 | ### 🩹 Fixes
5 |
6 | - update documentation ([d2968b2](https://github.com/danielglejzner/ngx-maintenance/commit/d2968b2))
7 |
8 |
9 | ### ❤️ Thank You
10 |
11 | - Jordan Hall @Jordan-Hall
12 |
13 | ## 0.1.1 (2024-04-06)
14 |
15 |
16 | ### 🩹 Fixes
17 |
18 | - **ngx-maintenance:** ensure bin folder compiles ([f4565e9](https://github.com/danielglejzner/ngx-maintenance/commit/f4565e9))
19 |
20 |
21 | ### ❤️ Thank You
22 |
23 | - Arturo Volpe @aVolpe
24 | - Jordan Hall @Jordan-Hall
25 |
26 | ## 0.1.0 (2024-03-13)
27 |
28 |
29 | ### 🚀 Features
30 |
31 | - add ngx-maintenance CLI ([5707932](https://github.com/danielglejzner/ngx-maintenance/commit/5707932))
32 |
33 | - use cli to get from package json or github URL ([f9d4ea4](https://github.com/danielglejzner/ngx-maintenance/commit/f9d4ea4))
34 |
35 | - **npm-api:** refactor npm registry api into a standalone lib and strongly typed ([cc10093](https://github.com/danielglejzner/ngx-maintenance/commit/cc10093))
36 |
37 |
38 | ### ❤️ Thank You
39 |
40 | - Jordan Hall @Jordan-Hall
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) Dan Revah
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/camelize.spec.ts:
--------------------------------------------------------------------------------
1 | import { CamelizePipe } from './camelize';
2 |
3 | describe('CamelizePipe Tests', () => {
4 | let pipe: CamelizePipe;
5 |
6 | beforeEach(() => {
7 | pipe = new CamelizePipe();
8 | });
9 |
10 | it('Should not do anything if not a string', () => {
11 | expect(pipe.transform(null)).toEqual(null);
12 | expect(pipe.transform(undefined)).toEqual(undefined);
13 | expect(pipe.transform(42)).toEqual(42);
14 | expect(pipe.transform({ name: 'foo' })).toEqual({ name: 'foo' });
15 | });
16 |
17 | it('Should camelize properly', () => {
18 | expect(pipe.transform('foo-bar')).toEqual('fooBar');
19 | expect(pipe.transform('foo_bar')).toEqual('fooBar');
20 | expect(pipe.transform('some_dashed-with-underscore')).toEqual('someDashedWithUnderscore');
21 | expect(pipe.transform('dash-foo-')).toEqual('dashFoo');
22 | expect(pipe.transform('-dash-foo')).toEqual('dashFoo');
23 | expect(pipe.transform('-dash-foo-')).toEqual('dashFoo');
24 | expect(pipe.transform('-dash foo ')).toEqual('dashFoo');
25 | });
26 | });
27 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/object/omit.spec.ts:
--------------------------------------------------------------------------------
1 | import { OmitPipe } from './omit';
2 |
3 | describe('OmitPipe', () => {
4 | let pipe: OmitPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new OmitPipe();
8 | });
9 |
10 | it('should keep the element the same way if its not an object', () => {
11 | expect(pipe.transform([1, 2, 3])).toEqual([1, 2, 3]);
12 | expect(pipe.transform([])).toEqual([]);
13 | expect(pipe.transform('foo')).toEqual('foo');
14 | expect(pipe.transform(null)).toEqual(null);
15 | expect(pipe.transform(undefined)).toEqual(undefined);
16 | });
17 |
18 | it('should return picked object by args', () => {
19 | expect(pipe.transform({})).toEqual({});
20 | expect(pipe.transform({ foo: 1 })).toEqual({ foo: 1 });
21 | expect(pipe.transform({ a: 1, b: 2, c: 3 }, 'a')).toEqual({ b: 2, c: 3 });
22 | expect(pipe.transform({ a: 1, b: 2, c: 3 }, 'a', 'b')).toEqual({ c: 3 });
23 | expect(pipe.transform({ a: 1, b: 2, c: 3 }, 'b', 'c')).toEqual({ a: 1 });
24 | expect(pipe.transform({ a: 1, b: 2, c: 3 }, 'b')).toEqual({ a: 1, c: 3 });
25 | });
26 | });
27 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/initial.spec.ts:
--------------------------------------------------------------------------------
1 | import { InitialPipe } from './initial';
2 |
3 | describe('InitialPipe', () => {
4 | let pipe: InitialPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new InitialPipe();
8 | });
9 |
10 | it('should return value if not array', () => {
11 | expect(pipe.transform(42)).toEqual(42);
12 | expect(pipe.transform(false)).toEqual(false);
13 | });
14 |
15 | it('should check that nothing happens if there are no parameters', () => {
16 | const arr = [1, 2, 3];
17 | const result = pipe.transform(arr);
18 | expect(result).toEqual([1, 2, 3]);
19 | });
20 |
21 | it('should slice properly', () => {
22 | expect(pipe.transform([1, 2, 3, 4], 1)).toEqual([1, 2, 3]);
23 | expect(pipe.transform([1, 2, 3, 4], 3)).toEqual([1]);
24 | });
25 |
26 | it('should slice properly array of objects', () => {
27 | const fooObj = { id: 1, name: 'foo' };
28 | const barObj = { id: 2, name: 'bar' };
29 | const cazObj = { id: 3, name: 'caz' };
30 |
31 | expect(pipe.transform([fooObj, barObj, cazObj], 1)).toEqual([fooObj, barObj]);
32 | });
33 | });
34 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/unique.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { extractDeepPropertyByMapKey, isObject, isUndefined } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'unique',
6 | standalone: true,
7 | })
8 | export class UniquePipe implements PipeTransform {
9 | transform(input: any[], args?: string | undefined): any[];
10 | transform(input: T, args?: string | undefined): T;
11 |
12 | transform(input: any, propertyName?: string | undefined): any {
13 | const uniques: boolean[] = [];
14 |
15 | return Array.isArray(input)
16 | ? isUndefined(propertyName)
17 | ? input.filter((e, i) => input.indexOf(e) === i)
18 | : input.filter((e, i) => {
19 | let value = extractDeepPropertyByMapKey(e, propertyName);
20 | value = isObject(value) ? JSON.stringify(value) : value;
21 |
22 | if (isUndefined(value) || uniques[value]) {
23 | return false;
24 | }
25 |
26 | uniques[value] = true;
27 |
28 | return true;
29 | })
30 | : input;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/without.spec.ts:
--------------------------------------------------------------------------------
1 | import { WithoutPipe } from './without';
2 |
3 | describe('WithoutPipe', () => {
4 | let pipe: WithoutPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new WithoutPipe();
8 | });
9 |
10 | it('should not change anything if not array', () => {
11 | expect(pipe.transform('foo')).toEqual('foo');
12 | expect(pipe.transform(null)).toEqual(null);
13 | expect(pipe.transform(undefined)).toEqual(undefined);
14 | expect(pipe.transform(42)).toEqual(42);
15 | expect(pipe.transform({ foo: 1, bar: 2 })).toEqual({ foo: 1, bar: 2 });
16 | });
17 |
18 | it("should keep the array the same way if it doesn't have any without arguments", () => {
19 | expect(pipe.transform([1, 2, 3])).toEqual([1, 2, 3]);
20 | expect(pipe.transform([1, 2, 3, { id: 1 }])).toEqual([1, 2, 3, { id: 1 }]);
21 | });
22 |
23 | it('should return an array without the one specified in the arguments', () => {
24 | expect(pipe.transform([1, 2, 3, 1, 2, 3], [1])).toEqual([2, 3, 2, 3]);
25 | expect(pipe.transform([1, 2, 3, 1, 2, 3], [1, 3])).toEqual([2, 2]);
26 | });
27 | });
28 |
--------------------------------------------------------------------------------
/apps/ngx-maintenance-dashboard/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 | import { AppComponent } from './app.component';
3 | import { NxWelcomeComponent } from './nx-welcome.component';
4 | import { RouterTestingModule } from '@angular/router/testing';
5 |
6 | describe('AppComponent', () => {
7 | beforeEach(async () => {
8 | await TestBed.configureTestingModule({
9 | imports: [AppComponent, NxWelcomeComponent, RouterTestingModule],
10 | }).compileComponents();
11 | });
12 |
13 | it('should render title', () => {
14 | const fixture = TestBed.createComponent(AppComponent);
15 | fixture.detectChanges();
16 | const compiled = fixture.nativeElement as HTMLElement;
17 | expect(compiled.querySelector('h1')?.textContent).toContain(
18 | 'Welcome ngx-maintenance-dashboard'
19 | );
20 | });
21 |
22 | it(`should have as title 'ngx-maintenance-dashboard'`, () => {
23 | const fixture = TestBed.createComponent(AppComponent);
24 | const app = fixture.componentInstance;
25 | expect(app.title).toEqual('ngx-maintenance-dashboard');
26 | });
27 | });
28 |
--------------------------------------------------------------------------------
/libs/ngx-maintenance/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ngx-maintenance",
3 | "$schema": "../../node_modules/nx/schemas/project-schema.json",
4 | "sourceRoot": "libs/ngx-maintenance/bin",
5 | "projectType": "library",
6 | "targets": {
7 | "build": {
8 | "executor": "@nx/js:tsc",
9 | "outputs": ["{options.outputPath}"],
10 | "options": {
11 | "outputPath": "dist/libs/ngx-maintenance",
12 | "main": "libs/ngx-maintenance/bin/index.ts",
13 | "tsConfig": "libs/ngx-maintenance/tsconfig.lib.json",
14 | "assets": ["libs/ngx-maintenance/*.md"]
15 | }
16 | },
17 | "publish": {
18 | "command": "node tools/scripts/publish.mjs ngx-maintenance {args.ver} {args.tag}",
19 | "dependsOn": ["build"]
20 | },
21 | "lint": {
22 | "executor": "@nx/eslint:lint"
23 | },
24 | "test": {
25 | "executor": "@nx/jest:jest",
26 | "outputs": [
27 | "{workspaceRoot}/coverage/{projectRoot}"
28 | ],
29 | "options": {
30 | "jestConfig": "libs/ngx-maintenance/jest.config.ts"
31 | }
32 | }
33 | },
34 | "tags": []
35 | }
36 |
--------------------------------------------------------------------------------
/.github/workflows/publish.yml:
--------------------------------------------------------------------------------
1 | # ./.github/workflows/publish.yml
2 | name: Publish
3 |
4 | on:
5 | push:
6 | tags:
7 | - v*.*.*
8 | workflow_dispatch:
9 |
10 | jobs:
11 | test:
12 | name: Publish
13 | runs-on: ubuntu-latest
14 | permissions:
15 | contents: read
16 | id-token: write # needed for provenance data generation
17 | timeout-minutes: 10
18 | steps:
19 | - name: Checkout repository
20 | uses: actions/checkout@v4
21 | with:
22 | fetch-depth: 0
23 |
24 | - name: Install Node
25 | uses: actions/setup-node@v4
26 | with:
27 | node-version: 20
28 | registry-url: https://registry.npmjs.org/
29 |
30 | - name: Install dependencies
31 | run: npm install
32 | shell: bash
33 |
34 | - name: Print Environment Info
35 | run: npx nx report
36 | shell: bash
37 |
38 | - name: Publish packages
39 | run: npx nx release publish
40 | shell: bash
41 | env:
42 | NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
43 | NPM_CONFIG_PROVENANCE: true
44 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 Daniel Glejzner
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/angular-pkgs/angular-material-rail-drawer/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 1.3.0 (2024-04-06)
2 |
3 |
4 | ### 🚀 Features
5 |
6 | - **ng2-image-viewer:** add inital release ([73102c5](https://github.com/danielglejzner/ngx-maintenance/commit/73102c5))
7 |
8 |
9 | ### 🩹 Fixes
10 |
11 | - repair nx-release to use the dist folder ([27913af](https://github.com/danielglejzner/ngx-maintenance/commit/27913af))
12 |
13 |
14 | ### ❤️ Thank You
15 |
16 | - Arturo Volpe @aVolpe
17 | - Jordan Hall @Jordan-Hall
18 |
19 | ## 1.2.0 (2024-04-06)
20 |
21 |
22 | ### 🚀 Features
23 |
24 | - **ng2-image-viewer:** add inital release ([73102c5](https://github.com/danielglejzner/ngx-maintenance/commit/73102c5))
25 |
26 |
27 | ### ❤️ Thank You
28 |
29 | - Arturo Volpe @aVolpe
30 | - Jordan Hall @Jordan-Hall
31 |
32 | ## 1.1.0 (2024-03-13)
33 |
34 |
35 | ### 🚀 Features
36 |
37 | - import angular material rail drawer ([1f81f54](https://github.com/danielglejzner/ngx-maintenance/commit/1f81f54))
38 |
39 | - add ngx-maintenance CLI ([5707932](https://github.com/danielglejzner/ngx-maintenance/commit/5707932))
40 |
41 |
42 | ### ❤️ Thank You
43 |
44 | - Jordan Hall @Jordan-Hall
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["../../.eslintrc.base.json"],
3 | "ignorePatterns": ["!**/*"],
4 | "overrides": [
5 | {
6 | "files": ["*.ts"],
7 | "extends": [
8 | "plugin:@nx/angular",
9 | "plugin:@angular-eslint/template/process-inline-templates"
10 | ],
11 | "rules": {
12 | "@angular-eslint/directive-selector": [
13 | "error",
14 | {
15 | "type": "attribute",
16 | "prefix": "ngxMaintenance",
17 | "style": "camelCase"
18 | }
19 | ],
20 | "@angular-eslint/component-selector": [
21 | "error",
22 | {
23 | "type": "element",
24 | "prefix": "ngx-maintenance",
25 | "style": "kebab-case"
26 | }
27 | ]
28 | }
29 | },
30 | {
31 | "files": ["*.html"],
32 | "extends": ["plugin:@nx/angular-template"],
33 | "rules": {}
34 | },
35 | {
36 | "files": ["*.json"],
37 | "parser": "jsonc-eslint-parser",
38 | "rules": {
39 | "@nx/dependency-checks": "error"
40 | }
41 | }
42 | ]
43 | }
44 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/object/pick.spec.ts:
--------------------------------------------------------------------------------
1 | import { PickPipe } from './pick';
2 |
3 | describe('PickPipe', () => {
4 | let pipe: PickPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new PickPipe();
8 | });
9 |
10 | it('should keep the element the same way if its not an object', () => {
11 | expect(pipe.transform([1, 2, 3])).toEqual([1, 2, 3]);
12 | expect(pipe.transform([])).toEqual([]);
13 | expect(pipe.transform('foo')).toEqual('foo');
14 | expect(pipe.transform(null)).toEqual(null);
15 | expect(pipe.transform(undefined)).toEqual(undefined);
16 | });
17 |
18 | it('should return picked object by args', () => {
19 | expect(pipe.transform({})).toEqual({});
20 | expect(pipe.transform({ foo: 1 })).toEqual({});
21 | expect(pipe.transform({ a: 1, b: 2, c: 3 }, 'a')).toEqual({ a: 1 });
22 | expect(pipe.transform({ a: 1, b: 2, c: 3 }, 'a', 'b')).toEqual({
23 | a: 1,
24 | b: 2,
25 | });
26 | expect(pipe.transform({ a: 1, b: 2, c: 3 }, 'b', 'c')).toEqual({
27 | b: 2,
28 | c: 3,
29 | });
30 | expect(pipe.transform({ a: 1, b: 2, c: 3 }, 'b')).toEqual({ b: 2 });
31 | });
32 | });
33 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-search-filter/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 Solodynamo
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-image-viewer/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["../../.eslintrc.base.json"],
3 | "ignorePatterns": ["!**/*"],
4 | "overrides": [
5 | {
6 | "files": ["*.ts"],
7 | "extends": [
8 | "plugin:@nx/angular",
9 | "plugin:@angular-eslint/template/process-inline-templates"
10 | ],
11 | "rules": {
12 | "@angular-eslint/directive-selector": [
13 | "error",
14 | {
15 | "type": "attribute",
16 | "prefix": "ngxMaintenance",
17 | "style": "camelCase"
18 | }
19 | ],
20 | "@angular-eslint/component-selector": [
21 | "error",
22 | {
23 | "type": "element",
24 | "prefix": "ngx-maintenance",
25 | "style": "kebab-case"
26 | }
27 | ]
28 | }
29 | },
30 | {
31 | "files": ["*.html"],
32 | "extends": ["plugin:@nx/angular-template"],
33 | "rules": {}
34 | },
35 | {
36 | "files": ["*.json"],
37 | "parser": "jsonc-eslint-parser",
38 | "rules": {
39 | "@nx/dependency-checks": "error"
40 | }
41 | }
42 | ]
43 | }
44 |
--------------------------------------------------------------------------------
/angular-pkgs/ng2-search-filter/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["../../.eslintrc.base.json"],
3 | "ignorePatterns": ["!**/*"],
4 | "overrides": [
5 | {
6 | "files": ["*.ts"],
7 | "extends": [
8 | "plugin:@nx/angular",
9 | "plugin:@angular-eslint/template/process-inline-templates"
10 | ],
11 | "rules": {
12 | "@angular-eslint/directive-selector": [
13 | "error",
14 | {
15 | "type": "attribute",
16 | "prefix": "ngxMaintenance",
17 | "style": "camelCase"
18 | }
19 | ],
20 | "@angular-eslint/component-selector": [
21 | "error",
22 | {
23 | "type": "element",
24 | "prefix": "ngx-maintenance",
25 | "style": "kebab-case"
26 | }
27 | ]
28 | }
29 | },
30 | {
31 | "files": ["*.html"],
32 | "extends": ["plugin:@nx/angular-template"],
33 | "rules": {}
34 | },
35 | {
36 | "files": ["*.json"],
37 | "parser": "jsonc-eslint-parser",
38 | "rules": {
39 | "@nx/dependency-checks": "error"
40 | }
41 | }
42 | ]
43 | }
44 |
--------------------------------------------------------------------------------
/libs/devkit/src/lib/to-maintenance-initiative.ts:
--------------------------------------------------------------------------------
1 | import { Tree, updateJson, addDependenciesToPackageJson, formatFiles, visitNotIgnoredFiles } from '@nx/devkit';
2 |
3 | export function toMaintenanceInitiative(tree: Tree, oldPackageName: string, newVersion = "1.0.0") {
4 | // Strip existing scope if present
5 | const packageNameWithoutScope = oldPackageName.replace(/^@[^\/]+\//, '');
6 | const newPackageName = `@ngx-maintenance/${packageNameWithoutScope}`;
7 |
8 | updateJson(tree, 'package.json', (json) => {
9 | for (const deps of [json.dependencies, json.devDependencies]) {
10 | if (deps && deps[oldPackageName]) {
11 | delete deps[oldPackageName];
12 | deps[newPackageName] = newVersion;
13 | }
14 | }
15 | return json;
16 | });
17 |
18 | visitNotIgnoredFiles(tree, '.', (file) => {
19 | if (!file.endsWith('.ts')) return;
20 |
21 | let content = tree.read(file, 'utf-8');
22 | if (!content) return;
23 |
24 | const importRegex = new RegExp(oldPackageName, 'g');
25 | content = content.replace(importRegex, newPackageName);
26 |
27 | tree.write(file, content);
28 | console.log(`Updated imports in ${file}`);
29 | });
30 |
31 | formatFiles(tree);
32 | }
33 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/bytes.spec.ts:
--------------------------------------------------------------------------------
1 | import { BytesPipe } from './bytes';
2 |
3 | describe('BytesPipe', () => {
4 | let pipe: BytesPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new BytesPipe();
8 | });
9 |
10 | it('should not do anything if infinity', () => {
11 | expect(pipe.transform(Infinity)).toEqual(NaN);
12 | });
13 |
14 | it('should return correct bytes format', () => {
15 | expect(pipe.transform(98)).toEqual('98 B');
16 | expect(pipe.transform(999)).toEqual('999 B');
17 | expect(pipe.transform(1024)).toEqual('1 KB');
18 | expect(pipe.transform(10240)).toEqual('10 KB');
19 | expect(pipe.transform(102400)).toEqual('100 KB');
20 | expect(pipe.transform(1023488)).toEqual('999.5 KB');
21 | expect(pipe.transform(15456864)).toEqual('14.740814208984375 MB');
22 | expect(pipe.transform(4616548610)).toEqual('4.299496045917114 GB');
23 | expect(pipe.transform(461654861500)).toEqual('429.94960505737276 GB');
24 | expect(pipe.transform(12345678)).toEqual('11.77375602722168 MB');
25 | expect(pipe.transform(12345678, 1)).toEqual('11.8 MB');
26 | expect(pipe.transform(12345678, 2)).toEqual('11.77 MB');
27 | });
28 | });
29 |
--------------------------------------------------------------------------------
/angular-pkgs/angular-material-rail-drawer/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["../../.eslintrc.json", "../../.eslintrc.base.json"],
3 | "ignorePatterns": ["!**/*"],
4 | "overrides": [
5 | {
6 | "files": ["*.ts"],
7 | "extends": [
8 | "plugin:@nx/angular",
9 | "plugin:@angular-eslint/template/process-inline-templates"
10 | ],
11 | "rules": {
12 | "@angular-eslint/directive-selector": [
13 | "error",
14 | {
15 | "type": "attribute",
16 | "prefix": "ngxMaintenance",
17 | "style": "camelCase"
18 | }
19 | ],
20 | "@angular-eslint/component-selector": [
21 | "error",
22 | {
23 | "type": "element",
24 | "prefix": "ngx-maintenance",
25 | "style": "kebab-case"
26 | }
27 | ]
28 | }
29 | },
30 | {
31 | "files": ["*.html"],
32 | "extends": ["plugin:@nx/angular-template"],
33 | "rules": {}
34 | },
35 | {
36 | "files": ["*.json"],
37 | "parser": "jsonc-eslint-parser",
38 | "rules": {
39 | "@nx/dependency-checks": "error"
40 | }
41 | }
42 | ]
43 | }
44 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/scan.spec.ts:
--------------------------------------------------------------------------------
1 | import { ScanPipe } from './scan';
2 |
3 | describe('ScanPipe Tests', () => {
4 | let pipe: ScanPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new ScanPipe();
8 | });
9 |
10 | it('should keep the string identical', () => {
11 | expect(pipe.transform('Lorem ipsum dolor sit amet')).toEqual('Lorem ipsum dolor sit amet');
12 | });
13 |
14 | it('should switch the variables properly', () => {
15 | expect(pipe.transform('Lorem ipsum {0} sit amet {1}', ['foo', 'bar'])).toEqual('Lorem ipsum foo sit amet bar');
16 | expect(pipe.transform('Lorem ipsum {1} sit amet {0}', ['bar', 'foo'])).toEqual('Lorem ipsum foo sit amet bar');
17 | expect(pipe.transform('Lorem ipsum {0}{0} sit amet {0}{1}', ['foo', 'bar'])).toEqual(
18 | 'Lorem ipsum foofoo sit amet foobar'
19 | );
20 | });
21 |
22 | it('should keep missing variables', () => {
23 | expect(pipe.transform('Lorem ipsum {0} sit amet {1}{2}', ['foo', 'bar'])).toEqual(
24 | 'Lorem ipsum foo sit amet bar{2}'
25 | );
26 | expect(pipe.transform('Lorem ipsum {1} sit amet {0}{2}{3}', ['foo', 'bar'])).toEqual(
27 | 'Lorem ipsum bar sit amet foo{2}{3}'
28 | );
29 | });
30 | });
31 |
--------------------------------------------------------------------------------
/tsconfig.base.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "rootDir": ".",
5 | "sourceMap": true,
6 | "declaration": false,
7 | "moduleResolution": "node",
8 | "emitDecoratorMetadata": true,
9 | "experimentalDecorators": true,
10 | "importHelpers": true,
11 | "target": "es2015",
12 | "module": "esnext",
13 | "lib": ["es2020", "dom"],
14 | "skipLibCheck": true,
15 | "skipDefaultLibCheck": true,
16 | "baseUrl": ".",
17 | "paths": {
18 | "@ngx-maintenance/angular-material-rail-drawer": [
19 | "angular-pkgs/angular-material-rail-drawer/src/index.ts"
20 | ],
21 | "@ngx-maintenance/devkit": ["libs/devkit/src/index.ts"],
22 | "@ngx-maintenance/ng2-image-viewer": [
23 | "angular-pkgs/ng2-image-viewer/src/index.ts"
24 | ],
25 | "@ngx-maintenance/ng2-search-filter": [
26 | "angular-pkgs/ng2-search-filter/src/index.ts"
27 | ],
28 | "@ngx-maintenance/ngx-pipes": ["angular-pkgs/ngx-pipes/src/index.ts"],
29 | "@ngx-maintenance/npm-api": ["libs/npm-api/src/index.ts"],
30 | "@ngx-maintenance/utils": ["libs/utils/src/index.ts"]
31 | }
32 | },
33 | "exclude": ["node_modules", "tmp"]
34 | }
35 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/flatten.spec.ts:
--------------------------------------------------------------------------------
1 | import { FlattenPipe } from './flatten';
2 |
3 | describe('FlattenPipe', () => {
4 | let pipe: FlattenPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new FlattenPipe();
8 | });
9 |
10 | it('should not change anything if not array', () => {
11 | expect(pipe.transform('foo')).toEqual('foo');
12 | expect(pipe.transform(null)).toEqual(null);
13 | expect(pipe.transform(undefined)).toEqual(undefined);
14 | expect(pipe.transform(42)).toEqual(42);
15 | expect(pipe.transform({ foo: 1, bar: 2 })).toEqual({ foo: 1, bar: 2 });
16 | });
17 |
18 | it('should deep flatten array', () => {
19 | const deepArray = [1, 2, 3, [4, 5, 6, [7, 8, 9], [10, 11, 12, 13, [14], [15], [16, [17]]]]];
20 | const result = pipe.transform(deepArray);
21 | expect(result).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]);
22 | });
23 |
24 | it('should shallow flatten array', () => {
25 | const deepArray = [1, 2, 3, [4, 5, 6, [7, 8, 9], [10, 11, 12, 13, [14], [15], [16, [17]]]]];
26 | const result = pipe.transform(deepArray, true);
27 | expect(result).toEqual([1, 2, 3, 4, 5, 6, [7, 8, 9], [10, 11, 12, 13, [14], [15], [16, [17]]]]);
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/a-or-an.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { isVowel } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'aOrAn',
6 | standalone: true,
7 | })
8 | /**
9 | * Takes a string and returns the string prepended by 'a' or 'an'.
10 | * Uses both naive and holdout-list approaches.
11 | * @constructor
12 | * @param {string} stringEntity - Entity to prepend 'a' or 'an' to.
13 | */
14 | export class AorAnPipe implements PipeTransform {
15 | private irregularMap: any = {
16 | herb: 'an',
17 | honor: 'an',
18 | honorable: 'an',
19 | hour: 'an',
20 | mba: 'an',
21 | msc: 'an',
22 | 'm.sc.': 'an',
23 | unicorn: 'a',
24 | };
25 | transform(stringEntity: string | null | undefined): string {
26 | if (!stringEntity || stringEntity === '') {
27 | return '';
28 | } else {
29 | const firstWord = stringEntity.trim().split(' ')[0];
30 | if (this.irregularMap[firstWord.toLocaleLowerCase()]) {
31 | return `${this.irregularMap[firstWord.toLocaleLowerCase()]} ${stringEntity}`;
32 | } else {
33 | return isVowel(stringEntity[0]) ? `an ${stringEntity}` : `a ${stringEntity}`;
34 | }
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/libs/npm-api/src/lib/interfaces/search.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Interface representing registry search query params.
3 | */
4 | export interface SearchQueryParams {
5 | text?: string;
6 | size?: number;
7 | from?: number;
8 | quality?: number;
9 | popularity?: number;
10 | maintenance?: number;
11 | }
12 | /**
13 | * Interface representing registry search response.
14 | */
15 | export interface SearchResponse {
16 | objects: SearchResult[];
17 | total: number;
18 | time: string;
19 | }
20 |
21 | interface SearchResult {
22 | package: Package;
23 | score: Score;
24 | searchScore: number;
25 | }
26 |
27 | interface Package {
28 | name: string;
29 | version: string;
30 | description: string;
31 | keywords: string[];
32 | date: string;
33 | links: Links;
34 | publisher: Publisher;
35 | maintainers: Maintainer[];
36 | }
37 |
38 | interface Links {
39 | npm: string;
40 | homepage: string;
41 | repository: string;
42 | bugs: string;
43 | }
44 |
45 | interface Publisher {
46 | username: string;
47 | email: string;
48 | }
49 |
50 | interface Maintainer extends Publisher {
51 | }
52 |
53 | interface Score {
54 | final: number;
55 | detail: {
56 | quality: number;
57 | popularity: number;
58 | maintenance: number;
59 | };
60 | }
61 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/intersection.spec.ts:
--------------------------------------------------------------------------------
1 | import { IntersectionPipe } from './intersection';
2 |
3 | describe('IntersectionPipe', () => {
4 | let pipe: IntersectionPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new IntersectionPipe();
8 | });
9 |
10 | it('should not change anything if not array', () => {
11 | expect(pipe.transform('foo')).toEqual('foo');
12 | expect(pipe.transform(null)).toEqual(null);
13 | expect(pipe.transform(undefined)).toEqual(undefined);
14 | expect(pipe.transform(42)).toEqual(42);
15 | expect(pipe.transform({ foo: 1, bar: 2 })).toEqual({ foo: 1, bar: 2 });
16 | });
17 |
18 | it('should not change when calling pipe without arguments', () => {
19 | expect(pipe.transform([1, 2, 3])).toEqual([1, 2, 3]);
20 | });
21 |
22 | it('should return empty array if there are no elements in the intersection', () => {
23 | expect(pipe.transform([1, 2, 3], [4, 5, 6])).toEqual([]);
24 | expect(pipe.transform([1, 2, 3], [4, 5, 6], [7, 8, 9])).toEqual([]);
25 | });
26 |
27 | it('should return intersection of arrays', () => {
28 | expect(pipe.transform([1, 2, 3], [1, 2, 3, 4, 5, 6])).toEqual([1, 2, 3]);
29 | expect(pipe.transform([1, 2, 3], [1, 2, 4, 5, 6], [1, 2, 7, 8, 9])).toEqual([1, 2]);
30 | });
31 | });
32 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/some.spec.ts:
--------------------------------------------------------------------------------
1 | import { SomePipe } from './some';
2 | import { isNumber, isUndefined } from '../helpers/helpers';
3 |
4 | describe('SomePipe', () => {
5 | let pipe: SomePipe;
6 |
7 | beforeEach(() => {
8 | pipe = new SomePipe();
9 | });
10 |
11 | it('should not change anything if not array', () => {
12 | expect(pipe.transform('foo', isNumber)).toEqual('foo');
13 | expect(pipe.transform(null, isNumber)).toEqual(null);
14 | expect(pipe.transform(undefined, isNumber)).toEqual(undefined);
15 | expect(pipe.transform(42, isNumber)).toEqual(42);
16 | expect(pipe.transform({ foo: 1, bar: 2 }, isNumber)).toEqual({
17 | foo: 1,
18 | bar: 2,
19 | });
20 | });
21 |
22 | it('should check if some elements of the array fits the predicate', () => {
23 | expect(pipe.transform([1, 2, 3, 4], isNumber)).toBeTruthy();
24 | expect(pipe.transform([1, 2, 3, 'a'], isNumber)).toBeTruthy();
25 | expect(pipe.transform([null, undefined, 'a', {}, []], isNumber)).toBeFalsy();
26 | expect(pipe.transform([1, 2, 3, 4], isUndefined)).toBeFalsy();
27 | expect(pipe.transform([undefined, undefined, 1], isUndefined)).toBeTruthy();
28 | expect(pipe.transform([undefined, undefined], isUndefined)).toBeTruthy();
29 | });
30 | });
31 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/tail.spec.ts:
--------------------------------------------------------------------------------
1 | import { TailPipe } from './tail';
2 |
3 | describe('TailPipe', () => {
4 | let pipe: TailPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new TailPipe();
8 | });
9 |
10 | it('should not change anything if not array', () => {
11 | expect(pipe.transform('foo')).toEqual('foo');
12 | expect(pipe.transform(null)).toEqual(null);
13 | expect(pipe.transform(undefined)).toEqual(undefined);
14 | expect(pipe.transform(42)).toEqual(42);
15 | expect(pipe.transform({ foo: 1, bar: 2 })).toEqual({ foo: 1, bar: 2 });
16 | });
17 |
18 | it('should check that nothing happens if there are no parameters', () => {
19 | const arr = [1, 2, 3];
20 | const result = pipe.transform(arr);
21 | expect(result).toEqual([1, 2, 3]);
22 | });
23 |
24 | it('should slice properly', () => {
25 | expect(pipe.transform([1, 2, 3, 4], 1)).toEqual([2, 3, 4]);
26 | expect(pipe.transform([1, 2, 3, 4], 3)).toEqual([4]);
27 | });
28 |
29 | it('should slice properly array of objects', () => {
30 | const fooObj = { id: 1, name: 'foo' };
31 | const barObj = { id: 2, name: 'bar' };
32 | const cazObj = { id: 3, name: 'caz' };
33 |
34 | expect(pipe.transform([fooObj, barObj, cazObj], 1)).toEqual([barObj, cazObj]);
35 | });
36 | });
37 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/object/diff-obj.spec.ts:
--------------------------------------------------------------------------------
1 | import { DiffObjPipe } from './diff-obj';
2 |
3 | describe('DiffObj Pipe', () => {
4 | let pipe: DiffObjPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new DiffObjPipe();
8 | });
9 |
10 | it('should keep the element the same way if its not an object', () => {
11 | expect(pipe.transform([1, 2, 3], {})).toEqual({});
12 | expect(pipe.transform([], {})).toEqual({});
13 | expect(pipe.transform('foo', {})).toEqual({});
14 | expect(pipe.transform(null, {})).toEqual({});
15 | expect(pipe.transform(undefined, {})).toEqual({});
16 | });
17 |
18 | it('should return an empty object when there is no difference', () => {
19 | expect(pipe.transform({}, {})).toEqual({});
20 | expect(pipe.transform({ a: 1 }, { a: 1 })).toEqual({});
21 | expect(pipe.transform({ a: { b: 1 }, c: 3 }, { a: { b: 1 }, c: 3 })).toEqual({});
22 | });
23 |
24 | it('should return a diff object', () => {
25 | expect(pipe.transform({ a: 1 }, { a: 2 })).toEqual({ a: 1 });
26 | expect(pipe.transform({ a: 1, b: 1 }, { a: 1, b: 2 })).toEqual({ b: 1 });
27 | expect(pipe.transform({ a: 1, b: true }, { a: 1, b: 2 })).toEqual({
28 | b: true,
29 | });
30 | expect(pipe.transform({ a: 1, b: { c: 1 } }, { a: 1, b: { c: 2 } })).toEqual({ b: { c: 1 } });
31 | });
32 | });
33 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/group-by.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { extractDeepPropertyByMapKey, isFunction } from '../helpers/helpers';
3 |
4 | @Pipe({
5 | name: 'groupBy',
6 | standalone: true,
7 | })
8 | export class GroupByPipe implements PipeTransform {
9 | transform(input: any, discriminator: any = [], delimiter: string = '|'): any {
10 | if (!Array.isArray(input)) {
11 | return input;
12 | }
13 |
14 | return this.groupBy(input, discriminator, delimiter);
15 | }
16 |
17 | private groupBy(list: any[], discriminator: any, delimiter: string) {
18 | return list.reduce((acc: any, payload: string) => {
19 | const key = this.extractKeyByDiscriminator(discriminator, payload, delimiter);
20 |
21 | acc[key] = Array.isArray(acc[key]) ? acc[key].concat([payload]) : [payload];
22 |
23 | return acc;
24 | }, {});
25 | }
26 |
27 | private extractKeyByDiscriminator(discriminator: any, payload: string, delimiter: string) {
28 | if (isFunction(discriminator)) {
29 | return (discriminator)(payload);
30 | }
31 |
32 | if (Array.isArray(discriminator)) {
33 | return discriminator.map((k) => extractDeepPropertyByMapKey(payload, k)).join(delimiter);
34 | }
35 |
36 | return extractDeepPropertyByMapKey(payload, discriminator);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/chunk.spec.ts:
--------------------------------------------------------------------------------
1 | import { ChunkPipe } from './chunk';
2 |
3 | describe('ChunkPipe', () => {
4 | let pipe: ChunkPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new ChunkPipe();
8 | });
9 |
10 | it('should not do anything when not an array or string', () => {
11 | expect(pipe.transform(null)).toEqual(null);
12 | expect(pipe.transform(undefined)).toEqual(undefined);
13 | expect(pipe.transform(42)).toEqual(42);
14 | expect(pipe.transform({ foo: 1, bar: 2 })).toEqual({ foo: 1, bar: 2 });
15 | });
16 |
17 | it('should chunk array without size parameter', () => {
18 | const array = [1, 2, 3, 4, 5];
19 | const result = pipe.transform(array);
20 | expect(result).toEqual([[1], [2], [3], [4], [5]]);
21 | });
22 |
23 | it('should chunk array', () => {
24 | const array = [1, 2, 3, 4, 5];
25 | const result = pipe.transform(array, 2);
26 | expect(result).toEqual([[1, 2], [3, 4], [5]]);
27 | });
28 |
29 | it('should chunk string without size parameter', () => {
30 | const target = 'abcde';
31 | const result = pipe.transform(target);
32 | expect(result).toEqual([['a'], ['b'], ['c'], ['d'], ['e']]);
33 | });
34 |
35 | it('should chunk string', () => {
36 | const target = 'abcde';
37 | const result = pipe.transform(target, 2);
38 | expect(result).toEqual([['a', 'b'], ['c', 'd'], ['e']]);
39 | });
40 | });
41 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/pluck.spec.ts:
--------------------------------------------------------------------------------
1 | import { PluckPipe } from './pluck';
2 |
3 | describe('PluckPipe', () => {
4 | let pipe: PluckPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new PluckPipe();
8 | });
9 |
10 | it('should not change anything if not array', () => {
11 | expect(pipe.transform('foo', '')).toEqual('foo');
12 | expect(pipe.transform(null, '')).toEqual(null);
13 | expect(pipe.transform(undefined, '')).toEqual(undefined);
14 | expect(pipe.transform(42, '')).toEqual(42);
15 | });
16 |
17 | it('should return only the properties of the array of object', () => {
18 | const arr = [
19 | { foo: 'bar', a: 1, b: { c: 4 } },
20 | { foo: 'bar2', a: 2, b: { c: 5 } },
21 | { foo: 'bar3', a: 3, b: { c: 6 } },
22 | ];
23 | expect(pipe.transform(arr, 'a')).toEqual([1, 2, 3]);
24 | expect(pipe.transform(arr, 'foo')).toEqual(['bar', 'bar2', 'bar3']);
25 | expect(pipe.transform(arr, 'foo.d')).toEqual([undefined, undefined, undefined]);
26 | expect(pipe.transform(arr, 'b.c')).toEqual([4, 5, 6]);
27 | expect(pipe.transform(arr, 'b.c.')).toEqual([undefined, undefined, undefined]);
28 | });
29 |
30 | it('should support object while ', () => {
31 | const arr = { foo: 'bar', a: 1, b: { c: 4 } };
32 |
33 | expect(pipe.transform(arr, 'a')).toEqual(1);
34 | expect(pipe.transform(arr, 'b.c')).toEqual(4);
35 | });
36 | });
37 |
--------------------------------------------------------------------------------
/libs/utils/src/lib/https.ts:
--------------------------------------------------------------------------------
1 | import { get, request, RequestOptions } from 'https';
2 | import { URL } from 'url';
3 |
4 | export function httpsGet(url: string | URL): Promise {
5 | const urlString = typeof url === 'string' ? url : url.toString();
6 | return new Promise((resolve, reject) => {
7 | get(urlString, res => {
8 | if (res.statusCode === 429) {
9 | return reject(new Error('Rate limited by the API'));
10 | } else if (res.statusCode && (res.statusCode < 200 || res?.statusCode >= 300)) {
11 | return reject(new Error(`HTTP Status Code: ${res.statusCode}`));
12 | }
13 | let data = '';
14 | res.on('data', chunk => data += chunk);
15 | res.on('end', () => resolve(JSON.parse(data)));
16 | }).on('error', reject);
17 | });
18 | }
19 |
20 | export function httpsRequest(options: string | URL | RequestOptions): Promise {
21 | return new Promise((resolve, reject) => {
22 | const req = request(options, res => {
23 | if (res.statusCode === 429) {
24 | return reject(new Error('Rate limited by the API'));
25 | } else if (res.statusCode && (res.statusCode < 200 || res.statusCode >= 300)) {
26 | return reject(new Error(`HTTP Status Code: ${res.statusCode}`));
27 | }
28 |
29 | let data = '';
30 | res.on('data', chunk => data += chunk);
31 | res.on('end', () => resolve(JSON.parse(data)));
32 | });
33 |
34 | req.on('error', reject);
35 | req.end();
36 | });
37 | }
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/math/index.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { MaxPipe } from './max';
3 | import { MinPipe } from './min';
4 | import { PercentagePipe } from './percentage';
5 | import { SumPipe } from './sum';
6 | import { FloorPipe } from './floor';
7 | import { RoundPipe } from './round';
8 | import { SqrtPipe } from './sqrt';
9 | import { PowerPipe } from './pow';
10 | import { CeilPipe } from './ceil';
11 | import { DegreesPipe } from './degrees';
12 | import { BytesPipe } from './bytes';
13 | import { RadiansPipe } from './radians';
14 |
15 | export const MATH_PIPES = [
16 | MaxPipe,
17 | MinPipe,
18 | PercentagePipe,
19 | SumPipe,
20 | FloorPipe,
21 | RoundPipe,
22 | SqrtPipe,
23 | PowerPipe,
24 | CeilPipe,
25 | DegreesPipe,
26 | BytesPipe,
27 | RadiansPipe,
28 | ];
29 |
30 | @NgModule({
31 | imports: [...MATH_PIPES],
32 | exports: MATH_PIPES,
33 | })
34 | export class NgMathPipesModule {}
35 |
36 | export { MaxPipe } from './max';
37 | export { MinPipe } from './min';
38 | export { PercentagePipe } from './percentage';
39 | export { SumPipe } from './sum';
40 | export { FloorPipe } from './floor';
41 | export { RoundPipe } from './round';
42 | export { SqrtPipe } from './sqrt';
43 | export { PowerPipe } from './pow';
44 | export { CeilPipe } from './ceil';
45 | export { DegreesPipe } from './degrees';
46 | export { BytesPipe } from './bytes';
47 | export { RadiansPipe } from './radians';
48 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/array/reverse.spec.ts:
--------------------------------------------------------------------------------
1 | import { ReversePipe } from './reverse';
2 |
3 | describe('ReversePipe', () => {
4 | let pipe: ReversePipe;
5 |
6 | beforeEach(() => {
7 | pipe = new ReversePipe();
8 | });
9 |
10 | it('should not do anything when not an array or string', () => {
11 | expect(pipe.transform(null)).toEqual(null);
12 | expect(pipe.transform(undefined)).toEqual(undefined);
13 | expect(pipe.transform(42)).toEqual(42);
14 | expect(pipe.transform({ foo: 1, bar: 2 })).toEqual({ foo: 1, bar: 2 });
15 | });
16 |
17 | it('should reverse array', () => {
18 | const array = [1, 2, 3, 4, 5];
19 | const result = pipe.transform(array);
20 | expect(result).toEqual([5, 4, 3, 2, 1]);
21 | });
22 |
23 | it('should reverse array of objects', () => {
24 | const fooObj = { id: 1, name: 'foo' };
25 | const barObj = { id: 2, name: 'bar' };
26 | const cazObj = { id: 3, name: 'caz' };
27 |
28 | const array = [fooObj, barObj, cazObj];
29 | const result = pipe.transform(array);
30 | expect(result).toEqual([cazObj, barObj, fooObj]);
31 | });
32 |
33 | it('should reverse string', () => {
34 | const target = 'lorem ipsum';
35 | const result = pipe.transform(target);
36 | expect(result).toEqual('muspi merol');
37 | });
38 |
39 | it('should not modify order of original array', () => {
40 | const target = [1, 2, 3];
41 | pipe.transform(target);
42 | expect(target).toEqual([1, 2, 3]);
43 | });
44 | });
45 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/object/invert.spec.ts:
--------------------------------------------------------------------------------
1 | import { InvertPipe } from './invert';
2 |
3 | describe('Invert Pipe', () => {
4 | let pipe: InvertPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new InvertPipe();
8 | });
9 |
10 | it('should keep the element the same way if its not an object', () => {
11 | expect(pipe.transform([1, 2, 3])).toEqual([1, 2, 3]);
12 | expect(pipe.transform([])).toEqual([]);
13 | expect(pipe.transform('foo')).toEqual('foo');
14 | expect(pipe.transform(null)).toEqual(null);
15 | expect(pipe.transform(undefined)).toEqual(undefined);
16 | });
17 |
18 | it('should return inverted values / keys object', () => {
19 | expect(pipe.transform({})).toEqual({});
20 | expect(pipe.transform({ foo: 'bar' })).toEqual({ bar: 'foo' });
21 | expect(pipe.transform({ foo: 1, bar: 42 })).toEqual({
22 | 1: 'foo',
23 | 42: 'bar',
24 | });
25 | expect(pipe.transform({ foo: [1, 2], bar: 42 })).toEqual({
26 | '1,2': 'foo',
27 | 42: 'bar',
28 | });
29 | expect(pipe.transform({ foo: { a: 1, b: 2 }, bar: 42 })).toEqual({
30 | '[object Object]': 'foo',
31 | 42: 'bar',
32 | });
33 | });
34 |
35 | it('should return inverted values / keys subsequent values override previous value', () => {
36 | expect(pipe.transform({ a: 1, b: 2, c: 1 })).toEqual({ 1: 'c', 2: 'b' });
37 | expect(pipe.transform({ a: 1, b: 2, c: 1, d: 2, e: 3 })).toEqual({
38 | 1: 'c',
39 | 2: 'd',
40 | 3: 'e',
41 | });
42 | });
43 | });
44 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/string/shorten.spec.ts:
--------------------------------------------------------------------------------
1 | import { ShortenPipe } from './shorten';
2 |
3 | describe('ShortenPipe Tests', () => {
4 | let pipe: ShortenPipe;
5 |
6 | beforeEach(() => {
7 | pipe = new ShortenPipe();
8 | });
9 |
10 | it('should not do anything when not a string', () => {
11 | expect(pipe.transform(null)).toEqual(null);
12 | expect(pipe.transform(undefined)).toEqual(undefined);
13 | expect(pipe.transform(42)).toEqual(42);
14 | expect(pipe.transform({ foo: 1, bar: 2 })).toEqual({ foo: 1, bar: 2 });
15 | });
16 |
17 | it('should not change the string if the length is more than the string size', () => {
18 | expect(pipe.transform('lorem ipsum', 20)).toEqual('lorem ipsum');
19 | expect(pipe.transform('lorem ipsum', 20, '..')).toEqual('lorem ipsum');
20 | });
21 |
22 | it('should shorten the string', () => {
23 | expect(pipe.transform('lorem ipsum', 5)).toEqual('lorem');
24 | expect(pipe.transform('lorem ipsum', 7)).toEqual('lorem i');
25 | });
26 |
27 | it('should shorten the string with suffix', () => {
28 | expect(pipe.transform('lorem ipsum', 5, '...')).toEqual('lorem...');
29 | expect(pipe.transform('lorem ipsum', 6, 'abc')).toEqual('lorem abc');
30 | });
31 |
32 | it('should shorten the string without word breaking', () => {
33 | expect(pipe.transform('lorem ipsum', 4, '...', false)).toEqual('lorem...');
34 | expect(pipe.transform('lorem ipsum', 2, '...', false)).toEqual('lorem...');
35 | expect(pipe.transform('lorem ipsum', 7, '...', false)).toEqual('lorem ipsum');
36 | });
37 | });
38 |
--------------------------------------------------------------------------------
/angular-pkgs/ngx-pipes/src/lib/pipes/date/time-ago.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'timeAgo',
5 | standalone: true,
6 | })
7 | export class TimeAgoPipe implements PipeTransform {
8 | private static YEAR_MS: number = 1000 * 60 * 60 * 24 * 7 * 4 * 12;
9 | private static MAPPER: any = [
10 | { single: 'last year', many: 'years', div: 1 },
11 | { single: 'last month', many: 'months', div: 12 },
12 | { single: 'last week', many: 'weeks', div: 4 },
13 | { single: 'yesterday', many: 'days', div: 7 },
14 | { single: 'an hour ago', many: 'hours', div: 24 },
15 | { single: 'just now', many: 'minutes', div: 60 },
16 | ];
17 |
18 | /**
19 | * @param inputDate: Date | Moment - not included as TypeScript interface,
20 | * in order to keep `ngx-pipes` "pure" from dependencies!
21 | */
22 | public transform(inputDate: any): string {
23 | if (!inputDate || (!inputDate.getTime && !inputDate.toDate)) {
24 | return 'Invalid date';
25 | }
26 |
27 | const past = inputDate.toDate ? inputDate.toDate() : inputDate.getTime();
28 | const now = +new Date();
29 |
30 | if (past > now) {
31 | return 'in the future';
32 | }
33 |
34 | for (let i = 0, l = TimeAgoPipe.MAPPER.length, ms = now - past, div = TimeAgoPipe.YEAR_MS; i < l; ++i) {
35 | const elm = TimeAgoPipe.MAPPER[i];
36 | const unit = Math.floor(ms / (div /= elm.div));
37 |
38 | if (unit >= 1) {
39 | return unit === 1 ? elm.single : `${unit} ${elm.many} ago`;
40 | }
41 | }
42 |
43 | return 'just now';
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.2.1 (2024-04-06)
2 |
3 |
4 | ### 🩹 Fixes
5 |
6 | - **angular-material-rail-drawer:** add packages to root for build ([402ec02](https://github.com/danielglejzner/ngx-maintenance/commit/402ec02))
7 |
8 |
9 | ### ❤️ Thank You
10 |
11 | - Jordan Hall @Jordan-Hall
12 |
13 | ## 0.2.0 (2024-04-06)
14 |
15 |
16 | ### 🚀 Features
17 |
18 | - Add ngPackagr to produce an angular 5 lib ([34898aa](https://github.com/danielglejzner/ngx-maintenance/commit/34898aa))
19 |
20 | - Add test ([f468e05](https://github.com/danielglejzner/ngx-maintenance/commit/f468e05))
21 |
22 | - **ngx-pipes): start work to bring in ngx-pipes feat(ng2-search-filter:** inital work for ng2-search-filter ([ea23492](https://github.com/danielglejzner/ngx-maintenance/commit/ea23492))
23 |
24 | - **ng2-image-viewer:** add inital release ([73102c5](https://github.com/danielglejzner/ngx-maintenance/commit/73102c5))
25 |
26 |
27 | ### 🩹 Fixes
28 |
29 | - **ngx-pipes:** ensure typings correct for tests to pass ([304ffac](https://github.com/danielglejzner/ngx-maintenance/commit/304ffac))
30 |
31 |
32 | ### ❤️ Thank You
33 |
34 | - Arturo Volpe @aVolpe
35 | - Jordan Hall @Jordan-Hall
36 |
37 | ## 0.1.0 (2024-03-13)
38 |
39 |
40 | ### 🚀 Features
41 |
42 | - import angular material rail drawer ([1f81f54](https://github.com/danielglejzner/ngx-maintenance/commit/1f81f54))
43 |
44 | - added automatic release ([273d671](https://github.com/danielglejzner/ngx-maintenance/commit/273d671))
45 |
46 |
47 | ### 🩹 Fixes
48 |
49 | - repair ci pipeline ([6b5db7f](https://github.com/danielglejzner/ngx-maintenance/commit/6b5db7f))
50 |
51 |
52 | ### ❤️ Thank You
53 |
54 | - Jordan Hall @Jordan-Hall
--------------------------------------------------------------------------------
/angular-pkgs/angular-material-rail-drawer/src/lib/animations.settings.ts:
--------------------------------------------------------------------------------
1 | import {
2 | group,
3 | query,
4 | animateChild,
5 | animate,
6 | style,
7 | AnimationStyleMetadata,
8 | AnimationGroupMetadata,
9 | } from '@angular/animations';
10 | import { miniConfig } from './default.config';
11 |
12 | export function sidebarClose(
13 | minWidth: string = miniConfig.defaultMinWidth
14 | ): AnimationStyleMetadata {
15 | return style({
16 | width: minWidth,
17 | visibility: 'visible',
18 | transform: 'none',
19 | overflow: 'hidden',
20 | });
21 | }
22 |
23 | export function sidebarOpen(
24 | maxWidth: string = miniConfig.defaultMaxWidth
25 | ): AnimationStyleMetadata {
26 | return style({
27 | width: maxWidth,
28 | visibility: 'visible',
29 | });
30 | }
31 |
32 | export function sidebarAnimationOpenGroup(
33 | animationDuration: string = miniConfig.defaultDuration,
34 | maxWidth: string = miniConfig.defaultMaxWidth
35 | ): AnimationGroupMetadata {
36 | return group([
37 | query('@iconAnimation', animateChild(), { optional: true }),
38 | query('@labelAnimation', animateChild(), { optional: true }),
39 | animate(`${animationDuration} ease-in-out`, sidebarOpen(maxWidth)),
40 | ]);
41 | }
42 |
43 | export function sidebarAnimationCloseGroup(
44 | animationDuration: string = miniConfig.defaultDuration,
45 | minWidth: string = miniConfig.defaultMinWidth
46 | ): AnimationGroupMetadata {
47 | return group([
48 | query('@iconAnimation', animateChild(), { optional: true }),
49 | query('@labelAnimation', animateChild(), { optional: true }),
50 | animate(`${animationDuration} ease-in-out`, sidebarClose(minWidth)),
51 | ]);
52 | }
53 |
--------------------------------------------------------------------------------