From 59a99eb10dfc46bfba4e6f8f3e8d3ed9abc44e08 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Dec 2022 11:09:35 +0000 Subject: [PATCH 01/39] chore(deps-dev): bump @types/node from 18.11.9 to 18.11.10 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 18.11.9 to 18.11.10. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- packages/service/storage-server/package.json | 2 +- packages/starter/nanoservice/package.json | 2 +- yarn.lock | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/service/storage-server/package.json b/packages/service/storage-server/package.json index 9a8d5c9f4..1edb1295d 100644 --- a/packages/service/storage-server/package.json +++ b/packages/service/storage-server/package.json @@ -65,7 +65,7 @@ "@alwatr/storage-engine": "^0.24.1" }, "devDependencies": { - "@types/node": "~18.11.9", + "@types/node": "~18.11.10", "@typescript-eslint/eslint-plugin": "~5.45.0", "@typescript-eslint/parser": "~5.45.0", "eslint": "~8.28.0", diff --git a/packages/starter/nanoservice/package.json b/packages/starter/nanoservice/package.json index 37c91521f..2ddc323f9 100644 --- a/packages/starter/nanoservice/package.json +++ b/packages/starter/nanoservice/package.json @@ -57,7 +57,7 @@ "@alwatr/nano-server": "^0.24.1" }, "devDependencies": { - "@types/node": "~18.11.9", + "@types/node": "~18.11.10", "@typescript-eslint/eslint-plugin": "~5.45.0", "@typescript-eslint/parser": "~5.45.0", "eslint": "~8.28.0", diff --git a/yarn.lock b/yarn.lock index 3e3c09d1c..443d52f9e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1264,10 +1264,10 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== -"@types/node@*", "@types/node@^18.7.20", "@types/node@~18.11.9": - version "18.11.9" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.9.tgz#02d013de7058cea16d36168ef2fc653464cfbad4" - integrity sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg== +"@types/node@*", "@types/node@^18.7.20", "@types/node@~18.11.10": + version "18.11.10" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.10.tgz#4c64759f3c2343b7e6c4b9caf761c7a3a05cee34" + integrity sha512-juG3RWMBOqcOuXC643OAdSA525V44cVgGV6dUDuiFtss+8Fk5x1hI93Rsld43VeJVIeqlP9I7Fn9/qaVqoEAuQ== "@types/normalize-package-data@^2.4.0": version "2.4.1" From 508a9b22a792284f7b5c54d095d6212d6277dc6b Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Fri, 2 Dec 2022 16:27:07 +0330 Subject: [PATCH 02/39] fix(math): UnicodeDigits type issue --- packages/core/math/src/unicode-digits.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/math/src/unicode-digits.ts b/packages/core/math/src/unicode-digits.ts index be58c9bf2..a5bcf753f 100644 --- a/packages/core/math/src/unicode-digits.ts +++ b/packages/core/math/src/unicode-digits.ts @@ -106,7 +106,7 @@ export class UnicodeDigits { this._toLangZeroCode = supportedLanguageList[toLanguage]; - const regParts = []; + const regParts: Array = []; for (let n = 0; n < 10; n++) { regParts.push( '(' + fromLanguages.map((langKey) => String.fromCharCode(supportedLanguageList[langKey] + n)).join('|') + ')', From f5fa219d7dfeec6250c1cd0b61608d95f5649ec1 Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Fri, 2 Dec 2022 16:28:21 +0330 Subject: [PATCH 03/39] chore(tsconfig): more strict options --- tsconfig.json | 139 +++++++++++++++++++++----------------------------- 1 file changed, 59 insertions(+), 80 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index a459c063c..5b770f433 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,108 +1,87 @@ +// https://www.typescriptlang.org/tsconfig +// TODO: add all new configs + { "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - /* Basic Options */ - "incremental": true /* Enable incremental compilation */, - "target": "ES2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */, - "module": "ESNEXT" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */, - "lib": ["ES2022", "DOM", "DOM.Iterable"] /* Specify library files to be included in the compilation. */, - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx'. */ - "declaration": true /* Generates corresponding '.d.ts' file. */, - "declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */, - "sourceMap": true /* Generates corresponding '.map' file. */, - // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "./" /* Redirect output structure to the directory. */, - // "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - "composite": true /* Enable project compilation */, - "tsBuildInfoFile": ".tsbuildinfo" /* Specify file to store incremental compilation information */, - // "removeComments": false, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - "importHelpers": true /* Import emit helpers from 'tslib'. */, - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + "incremental": true, + "target": "ES2020", + "module": "ES2022", + "lib": ["ES2022", "DOM", "DOM.Iterable"], + // "allowJs": true, + // "checkJs": true, + // "jsx": "preserve", + "declaration": true, + "declarationMap": true, + // "outFile": "./", + "outDir": "./", + // "rootDir": "./src", + "composite": true, + "tsBuildInfoFile": ".tsbuildinfo", + "removeComments": false, + // "noEmit": true, + "importHelpers": true, + // "downlevelIteration": true, + // "isolatedModules": true, /* Strict Type-Checking Options */ - "strict": true /* Enable all strict type-checking options. */, - // "noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + "strict": true, + "noImplicitAny": false, + "strictNullChecks": true, + "strictFunctionTypes": true, + "strictBindCallApply": true, + "strictPropertyInitialization": true, + "noImplicitThis": true, + "alwaysStrict": true, /* Additional Checks */ - "noUnusedLocals": true /* Report errors on unused locals. */, - "noUnusedParameters": true /* Report errors on unused parameters. */, - "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, - "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, - "noImplicitOverride": true /* Force to use override keyword when override super class methods. */, - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "noImplicitOverride": true, + // "noUncheckedIndexedAccess": true, + // "noPropertyAccessFromIndexSignature": true, /* Module Resolution Options */ - "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */, - "baseUrl": "./package" /* Base directory to resolve non-absolute module names. */, - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - // "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + "moduleResolution": "node", + "baseUrl": "./package", + // "paths": {}, + // "rootDirs": [], + // "typeRoots": [], + // "types": [], + "allowSyntheticDefaultImports": true, + // "esModuleInterop": true, + // "preserveSymlinks": true, + // "allowUmdGlobalAccess": true, /* Source Map Options */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + "sourceMap": true, + // "sourceRoot": "", + // "mapRoot": "", + // "inlineSourceMap": true, + "inlineSources": true, /* Experimental Options */ - "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */, - "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, /* Advanced Options */ - "skipLibCheck": true /* Skip type checking of declaration files. */, - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */, - "useDefineForClassFields": false /* Must be disabled for lit, https://lit.dev/docs/components/properties/#avoiding-issues-with-class-fields */, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "useDefineForClassFields": false, "plugins": [ { "name": "ts-lit-plugin", - "rules": { - "no-unknown-tag-name": "error", - "no-unclosed-tag": "error", - "no-unknown-property": "error", - "no-unintended-mixed-binding": "error", - "no-invalid-boolean-binding": "error", - "no-expressionless-property-binding": "error", - "no-noncallable-event-binding": "error", - "no-boolean-in-attribute-binding": "error", - "no-complex-attribute-binding": "error", - "no-nullable-attribute-binding": "error", - "no-incompatible-type-binding": "error", - "no-invalid-directive-binding": "error", - "no-incompatible-property-type": "error", - "no-unknown-property-converter": "error", - "no-invalid-attribute-name": "error", - "no-invalid-tag-name": "error", - "no-property-visibility-mismatch": "error", - - "no-unknown-attribute": "off", - "no-unknown-event": "off", - "no-unknown-slot": "off", - "no-invalid-css": "off" - } + "strict": true } ] }, "include": ["*.ts"], "exclude": [], + "references": [ {"path": "./packages/core/logger"}, {"path": "./packages/core/fetch"}, From 7cbba9e2f0865b54feb45d0be0af4deda45e0a3b Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Fri, 2 Dec 2022 16:28:32 +0330 Subject: [PATCH 04/39] chore(deps): upgrade --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 443d52f9e..5631c61a8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1420,9 +1420,9 @@ eslint-visitor-keys "^3.3.0" "@typescript/lib-dom@npm:@types/web": - version "0.0.81" - resolved "https://registry.yarnpkg.com/@types/web/-/web-0.0.81.tgz#1cefdaa1ccabec2bc5c34ca453df81d62b542fb9" - integrity sha512-bWzja/Zer7bFijmzu38P+u+aOaKl0Ves0p3+Xnbyw5DKnVwOApNqHsNYmXKOp2WwIQIP1U2ECPsJ6D3B9xrhYA== + version "0.0.82" + resolved "https://registry.yarnpkg.com/@types/web/-/web-0.0.82.tgz#b147fdebd35fb1b711be751212b2b9dc9f749cfb" + integrity sha512-mktv7gA7V9mGKhAR9MXikOeNjsf3UptliH2yBFbNOqqbmse8II8irigyVJrW072ReHzPYSkJms9A5wZq3We5rw== "@web/config-loader@^0.1.3": version "0.1.3" From 880ca49c6be09d4bfb34943d955a6f2d5ba2d5bb Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Fri, 2 Dec 2022 18:34:42 +0330 Subject: [PATCH 05/39] chore(eslint): lit/recommended --- .eslintrc.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index ae5d73e2b..87ab4176c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,13 +5,14 @@ "google", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended", - "plugin:wc/recommended", "plugin:import/recommended", - "plugin:import/typescript" + "plugin:import/typescript", + "plugin:wc/best-practice", + "plugin:lit/recommended" ], "env": { - "browser": true, - "es2021": true + "shared-node-browser": true, + "es2022": true }, "parser": "@typescript-eslint/parser", "parserOptions": { From 2c7d85264166afbc514bafb8329ce2e84f95157a Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Fri, 2 Dec 2022 18:35:09 +0330 Subject: [PATCH 06/39] chore(vscode): show js files --- .vscode/settings.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index ed1f6a103..adf296587 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,7 +13,6 @@ "typescript.tsdk": "node_modules\\typescript\\lib", "files.exclude": { "**/*.map": true, - "**/*.js": true, "**/*.d.ts": true, "**/*.tsbuildinfo": true }, From 12577ecadad97cf776dc75f6c920bacb4908fb57 Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Fri, 2 Dec 2022 18:37:23 +0330 Subject: [PATCH 07/39] chore: lit best practices --- .gitignore | 4 ++-- package.json | 8 +++++--- tsconfig.json | 2 +- dev-server.mjs => web-dev-server.config.js | 16 +++++++++------ yarn.lock | 23 +++++++++++++++++++++- 5 files changed, 40 insertions(+), 13 deletions(-) rename dev-server.mjs => web-dev-server.config.js (62%) diff --git a/.gitignore b/.gitignore index f03dc3710..d487455bc 100644 --- a/.gitignore +++ b/.gitignore @@ -14,11 +14,11 @@ Desktop.ini *.log* # Build -dist .tsbuildinfo -*.js *.map *.d.ts +*.js +!/*.js # Dependencies node_modules diff --git a/package.json b/package.json index 7a163d2d4..d43723d58 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "l": "yarn lint", "b": "yarn build", "cb": "run-s clean build", - "s": "yarn serve:dev", + "s": "run-s build serve", "w": "yarn watch", "f": "yarn format", "fl": "yarn format:eslint", @@ -33,8 +33,8 @@ "format:eslint": "yarn lint:ts --fix", "format:prettier": "prettier . --ignore-path .gitignore --write", "clean": "yarn build:ts --clean && lerna run clean && rimraf \"{packages,demo}/**/*.{js,d.ts,map}\" \"{packages,demo}/**/.tsbuildinfo\" \"{packages,demo}/**/node_modules/\"", - "serve:dev": "web-dev-server --config dev-server.mjs", - "watch": "run-p watch:* serve:dev", + "serve": "wds", + "watch": "run-p watch:* serve", "watch:ts": "yarn build:ts --watch --preserveWatchOutput", "ver-minor": "lerna version minor --no-push", "ver-patch": "lerna version patch --no-push", @@ -52,8 +52,10 @@ "eslint-config-google": "~0.14.0", "eslint-import-resolver-typescript": "~3.5.2", "eslint-plugin-import": "~2.26.0", + "eslint-plugin-lit": "^1.6.1", "eslint-plugin-wc": "~1.4.0", "lerna": "~6.1.0", + "lit-analyzer": "^1.2.1", "npm-run-all": "~4.1.5", "prettier": "~2.8.0", "rimraf": "~3.0.2", diff --git a/tsconfig.json b/tsconfig.json index 5b770f433..9c75ec9f3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,7 @@ "compilerOptions": { /* Basic Options */ "incremental": true, - "target": "ES2020", + "target": "ES2019", "module": "ES2022", "lib": ["ES2022", "DOM", "DOM.Iterable"], // "allowJs": true, diff --git a/dev-server.mjs b/web-dev-server.config.js similarity index 62% rename from dev-server.mjs rename to web-dev-server.config.js index d66897828..ea9cec0bf 100644 --- a/dev-server.mjs +++ b/web-dev-server.config.js @@ -1,14 +1,18 @@ // https://modern-web.dev/docs/dev-server/cli-and-configuration/#configuration-file export default { - open: false, - nodeResolve: true, + hostname: '0.0.0.0', + port: 8080, + open: true, watch: true, - // appIndex: './', + appIndex: 'index.html', + nodeResolve: { + exportConditions: ['development'], + dedupe: true, + }, + esbuildTarget: 'auto', // in a monorepo you need to set set the root dir to resolve modules - // rootDir: '.', + rootDir: '.', // debug: false, - hostname: '0.0.0.0', - port: 8000, preserveSymlinks: true, plugins: [], middleware: [], diff --git a/yarn.lock b/yarn.lock index 5631c61a8..655cd2494 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2827,6 +2827,15 @@ eslint-plugin-import@~2.26.0: resolve "^1.22.0" tsconfig-paths "^3.14.1" +eslint-plugin-lit@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-lit/-/eslint-plugin-lit-1.6.1.tgz#e1f51fe9e580d4095b58cc4bc4dc6b44409af6b0" + integrity sha512-BpPoWVhf8dQ/Sz5Pi9NlqbGoH5BcMcVyXhi2XTx2XGMAO9U2lS+GTSsqJjI5hL3OuxCicNiUEWXazAwi9cAGxQ== + dependencies: + parse5 "^6.0.1" + parse5-htmlparser2-tree-adapter "^6.0.1" + requireindex "^1.2.0" + eslint-plugin-wc@~1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/eslint-plugin-wc/-/eslint-plugin-wc-1.4.0.tgz#5996b0c4d7183d0d51765e52bba886cd4aa70741" @@ -4484,7 +4493,7 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -lit-analyzer@1.2.1: +lit-analyzer@1.2.1, lit-analyzer@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/lit-analyzer/-/lit-analyzer-1.2.1.tgz#725331a4019ae870dd631d4dd709d39a237161ea" integrity sha512-OEARBhDidyaQENavLbzpTKbEmu5rnAI+SdYsH4ia1BlGlLiqQXoym7uH1MaRPtwtUPbkhUfT4OBDZ+74VHc3Cg== @@ -5538,6 +5547,13 @@ parse-url@^8.1.0: dependencies: parse-path "^7.0.0" +parse5-htmlparser2-tree-adapter@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz#2cdf9ad823321140370d4dbf5d3e92c7c8ddc6e6" + integrity sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA== + dependencies: + parse5 "^6.0.1" + parse5@5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.0.tgz#c59341c9723f414c452975564c7c00a68d58acd2" @@ -5930,6 +5946,11 @@ require-main-filename@^2.0.0: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== +requireindex@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/requireindex/-/requireindex-1.2.0.tgz#3463cdb22ee151902635aa6c9535d4de9c2ef1ef" + integrity sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww== + resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" From 98cbb53ca98bd8905d76cd2e419b5fb1a20b53f1 Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Fri, 2 Dec 2022 19:20:49 +0330 Subject: [PATCH 08/39] fix: web-dev-server --- package.json | 1 + web-dev-server.config.js | 6 +- yarn.lock | 153 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 156 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index d43723d58..deaf127ba 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "@typescript-eslint/parser": "~5.45.0", "@typescript/lib-dom": "npm:@types/web", "@web/dev-server": "~0.1.35", + "@web/dev-server-esbuild": "^0.3.3", "eslint": "~8.28.0", "eslint-config-google": "~0.14.0", "eslint-import-resolver-typescript": "~3.5.2", diff --git a/web-dev-server.config.js b/web-dev-server.config.js index ea9cec0bf..037818a25 100644 --- a/web-dev-server.config.js +++ b/web-dev-server.config.js @@ -1,13 +1,11 @@ // https://modern-web.dev/docs/dev-server/cli-and-configuration/#configuration-file export default { - hostname: '0.0.0.0', port: 8080, open: true, watch: true, - appIndex: 'index.html', + // appIndex: 'index.html', nodeResolve: { - exportConditions: ['development'], - dedupe: true, + exportConditions: ['development'] }, esbuildTarget: 'auto', // in a monorepo you need to set set the root dir to resolve modules diff --git a/yarn.lock b/yarn.lock index 655cd2494..15d390b87 100644 --- a/yarn.lock +++ b/yarn.lock @@ -30,6 +30,11 @@ dependencies: regenerator-runtime "^0.13.10" +"@esbuild/linux-loong64@0.14.54": + version "0.14.54" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.14.54.tgz#de2a4be678bd4d0d1ffbb86e6de779cde5999028" + integrity sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw== + "@eslint/eslintrc@^1.3.3": version "1.3.3" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.3.tgz#2b044ab39fdfa75b4688184f9e573ce3c5b0ff95" @@ -768,6 +773,11 @@ resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-1.4.2.tgz#65d659e89d1a7e2f4f2b547182aef0a224f4adb7" integrity sha512-VMOxsWh/QDwrxPsgkSQnuZ+8mfNy1OTjzzUdLBvvZtpahwPTHTeVZ51RZRqO4xfKVrR+btIPA8D01IL3xeG66w== +"@mdn/browser-compat-data@^4.0.0": + version "4.2.1" + resolved "https://registry.yarnpkg.com/@mdn/browser-compat-data/-/browser-compat-data-4.2.1.tgz#1fead437f3957ceebe2e8c3f46beccdb9bc575b8" + integrity sha512-EWUguj2kd7ldmrF9F+vI5hUOralPd+sdsUnYbRy33vZTuZkduC1shE9TtEMEjAQwyfyMb4ole5KtjF8MsnQOlA== + "@microsoft/eslint-formatter-sarif@~3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@microsoft/eslint-formatter-sarif/-/eslint-formatter-sarif-3.0.0.tgz#422382a1759c35a014fb96e77799cbce47fdb2fd" @@ -1455,6 +1465,17 @@ picomatch "^2.2.2" ws "^7.4.2" +"@web/dev-server-esbuild@^0.3.3": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@web/dev-server-esbuild/-/dev-server-esbuild-0.3.3.tgz#e82af2e5acec0e645b920400be9601601b3921c5" + integrity sha512-hB9C8X9NsFWUG2XKT3W+Xcw3IZ/VObf4LNbK14BTjApnNyZfV6hVhSlJfvhgOoJ4DxsImfhIB5+gMRKOG9NmBw== + dependencies: + "@mdn/browser-compat-data" "^4.0.0" + "@web/dev-server-core" "^0.3.19" + esbuild "^0.12 || ^0.13 || ^0.14" + parse5 "^6.0.1" + ua-parser-js "^1.0.2" + "@web/dev-server-rollup@^0.3.19": version "0.3.19" resolved "https://registry.yarnpkg.com/@web/dev-server-rollup/-/dev-server-rollup-0.3.19.tgz#188f3a37bcc38f4dc1b208663b14ab2d17321a57" @@ -2755,6 +2776,133 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" +esbuild-android-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-android-64/-/esbuild-android-64-0.14.54.tgz#505f41832884313bbaffb27704b8bcaa2d8616be" + integrity sha512-Tz2++Aqqz0rJ7kYBfz+iqyE3QMycD4vk7LBRyWaAVFgFtQ/O8EJOnVmTOiDWYZ/uYzB4kvP+bqejYdVKzE5lAQ== + +esbuild-android-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.14.54.tgz#8ce69d7caba49646e009968fe5754a21a9871771" + integrity sha512-F9E+/QDi9sSkLaClO8SOV6etqPd+5DgJje1F9lOWoNncDdOBL2YF59IhsWATSt0TLZbYCf3pNlTHvVV5VfHdvg== + +esbuild-darwin-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.14.54.tgz#24ba67b9a8cb890a3c08d9018f887cc221cdda25" + integrity sha512-jtdKWV3nBviOd5v4hOpkVmpxsBy90CGzebpbO9beiqUYVMBtSc0AL9zGftFuBon7PNDcdvNCEuQqw2x0wP9yug== + +esbuild-darwin-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.54.tgz#3f7cdb78888ee05e488d250a2bdaab1fa671bf73" + integrity sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw== + +esbuild-freebsd-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.54.tgz#09250f997a56ed4650f3e1979c905ffc40bbe94d" + integrity sha512-OKwd4gmwHqOTp4mOGZKe/XUlbDJ4Q9TjX0hMPIDBUWWu/kwhBAudJdBoxnjNf9ocIB6GN6CPowYpR/hRCbSYAg== + +esbuild-freebsd-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.54.tgz#bafb46ed04fc5f97cbdb016d86947a79579f8e48" + integrity sha512-sFwueGr7OvIFiQT6WeG0jRLjkjdqWWSrfbVwZp8iMP+8UHEHRBvlaxL6IuKNDwAozNUmbb8nIMXa7oAOARGs1Q== + +esbuild-linux-32@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.14.54.tgz#e2a8c4a8efdc355405325033fcebeb941f781fe5" + integrity sha512-1ZuY+JDI//WmklKlBgJnglpUL1owm2OX+8E1syCD6UAxcMM/XoWd76OHSjl/0MR0LisSAXDqgjT3uJqT67O3qw== + +esbuild-linux-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.14.54.tgz#de5fdba1c95666cf72369f52b40b03be71226652" + integrity sha512-EgjAgH5HwTbtNsTqQOXWApBaPVdDn7XcK+/PtJwZLT1UmpLoznPd8c5CxqsH2dQK3j05YsB3L17T8vE7cp4cCg== + +esbuild-linux-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.54.tgz#dae4cd42ae9787468b6a5c158da4c84e83b0ce8b" + integrity sha512-WL71L+0Rwv+Gv/HTmxTEmpv0UgmxYa5ftZILVi2QmZBgX3q7+tDeOQNqGtdXSdsL8TQi1vIaVFHUPDe0O0kdig== + +esbuild-linux-arm@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.14.54.tgz#a2c1dff6d0f21dbe8fc6998a122675533ddfcd59" + integrity sha512-qqz/SjemQhVMTnvcLGoLOdFpCYbz4v4fUo+TfsWG+1aOu70/80RV6bgNpR2JCrppV2moUQkww+6bWxXRL9YMGw== + +esbuild-linux-mips64le@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.54.tgz#d9918e9e4cb972f8d6dae8e8655bf9ee131eda34" + integrity sha512-qTHGQB8D1etd0u1+sB6p0ikLKRVuCWhYQhAHRPkO+OF3I/iSlTKNNS0Lh2Oc0g0UFGguaFZZiPJdJey3AGpAlw== + +esbuild-linux-ppc64le@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.54.tgz#3f9a0f6d41073fb1a640680845c7de52995f137e" + integrity sha512-j3OMlzHiqwZBDPRCDFKcx595XVfOfOnv68Ax3U4UKZ3MTYQB5Yz3X1mn5GnodEVYzhtZgxEBidLWeIs8FDSfrQ== + +esbuild-linux-riscv64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.54.tgz#618853c028178a61837bc799d2013d4695e451c8" + integrity sha512-y7Vt7Wl9dkOGZjxQZnDAqqn+XOqFD7IMWiewY5SPlNlzMX39ocPQlOaoxvT4FllA5viyV26/QzHtvTjVNOxHZg== + +esbuild-linux-s390x@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.54.tgz#d1885c4c5a76bbb5a0fe182e2c8c60eb9e29f2a6" + integrity sha512-zaHpW9dziAsi7lRcyV4r8dhfG1qBidQWUXweUjnw+lliChJqQr+6XD71K41oEIC3Mx1KStovEmlzm+MkGZHnHA== + +esbuild-netbsd-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.54.tgz#69ae917a2ff241b7df1dbf22baf04bd330349e81" + integrity sha512-PR01lmIMnfJTgeU9VJTDY9ZerDWVFIUzAtJuDHwwceppW7cQWjBBqP48NdeRtoP04/AtO9a7w3viI+PIDr6d+w== + +esbuild-openbsd-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.54.tgz#db4c8495287a350a6790de22edea247a57c5d47b" + integrity sha512-Qyk7ikT2o7Wu76UsvvDS5q0amJvmRzDyVlL0qf5VLsLchjCa1+IAvd8kTBgUxD7VBUUVgItLkk609ZHUc1oCaw== + +esbuild-sunos-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.14.54.tgz#54287ee3da73d3844b721c21bc80c1dc7e1bf7da" + integrity sha512-28GZ24KmMSeKi5ueWzMcco6EBHStL3B6ubM7M51RmPwXQGLe0teBGJocmWhgwccA1GeFXqxzILIxXpHbl9Q/Kw== + +esbuild-windows-32@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-windows-32/-/esbuild-windows-32-0.14.54.tgz#f8aaf9a5667630b40f0fb3aa37bf01bbd340ce31" + integrity sha512-T+rdZW19ql9MjS7pixmZYVObd9G7kcaZo+sETqNH4RCkuuYSuv9AGHUVnPoP9hhuE1WM1ZimHz1CIBHBboLU7w== + +esbuild-windows-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.14.54.tgz#bf54b51bd3e9b0f1886ffdb224a4176031ea0af4" + integrity sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ== + +esbuild-windows-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.54.tgz#937d15675a15e4b0e4fafdbaa3a01a776a2be982" + integrity sha512-M0kuUvXhot1zOISQGXwWn6YtS+Y/1RT9WrVIOywZnJHo3jCDyewAc79aKNQWFCQm+xNHVTq9h8dZKvygoXQQRg== + +"esbuild@^0.12 || ^0.13 || ^0.14": + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.14.54.tgz#8b44dcf2b0f1a66fc22459943dccf477535e9aa2" + integrity sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA== + optionalDependencies: + "@esbuild/linux-loong64" "0.14.54" + esbuild-android-64 "0.14.54" + esbuild-android-arm64 "0.14.54" + esbuild-darwin-64 "0.14.54" + esbuild-darwin-arm64 "0.14.54" + esbuild-freebsd-64 "0.14.54" + esbuild-freebsd-arm64 "0.14.54" + esbuild-linux-32 "0.14.54" + esbuild-linux-64 "0.14.54" + esbuild-linux-arm "0.14.54" + esbuild-linux-arm64 "0.14.54" + esbuild-linux-mips64le "0.14.54" + esbuild-linux-ppc64le "0.14.54" + esbuild-linux-riscv64 "0.14.54" + esbuild-linux-s390x "0.14.54" + esbuild-netbsd-64 "0.14.54" + esbuild-openbsd-64 "0.14.54" + esbuild-sunos-64 "0.14.54" + esbuild-windows-32 "0.14.54" + esbuild-windows-64 "0.14.54" + esbuild-windows-arm64 "0.14.54" + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -6778,6 +6926,11 @@ typical@^5.2.0: resolved "https://registry.yarnpkg.com/typical/-/typical-5.2.0.tgz#4daaac4f2b5315460804f0acf6cb69c52bb93066" integrity sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg== +ua-parser-js@^1.0.2: + version "1.0.32" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-1.0.32.tgz#786bf17df97de159d5b1c9d5e8e9e89806f8a030" + integrity sha512-dXVsz3M4j+5tTiovFVyVqssXBu5HM47//YSOeZ9fQkdDKkfzv2v3PP1jmH6FUyPW+yCSn7aBVK1fGGKNhowdDA== + uglify-js@^3.1.4: version "3.17.4" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.4.tgz#61678cf5fa3f5b7eb789bb345df29afb8257c22c" From 33e16fde9f95a1ffc2b2c9c4a7947d97cac4cae1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Dec 2022 15:53:37 +0000 Subject: [PATCH 09/39] chore(deps): bump decode-uri-component from 0.2.0 to 0.2.2 Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2. - [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases) - [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2) --- updated-dependencies: - dependency-name: decode-uri-component dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 15d390b87..ba6f5ac4d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2479,9 +2479,9 @@ decamelize@^1.1.0, decamelize@^1.2.0: integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== decode-uri-component@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" - integrity sha512-hjf+xovcEn31w/EUYdTXQh/8smFL/dzYjohQGEIgjyNavaJfBY2p5F527Bo1VPATxv0VYTUC2bOcXvqFwk78Og== + version "0.2.2" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" + integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ== dedent@^0.7.0: version "0.7.0" From c9b6c56182750444b1cced3343b02eea6a9f24c5 Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Sat, 3 Dec 2022 10:29:30 +0330 Subject: [PATCH 10/39] feat(logger): log incident in production mode --- packages/core/logger/src/logger.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/core/logger/src/logger.ts b/packages/core/logger/src/logger.ts index e878d0ded..470c3ccad 100644 --- a/packages/core/logger/src/logger.ts +++ b/packages/core/logger/src/logger.ts @@ -133,6 +133,10 @@ export const createLogger = (scope: string, color?: string | null, debug?: boole error: isBrowser ? console.error.bind(console, '%c%s%c.%s() Error `%s`\n', styleScope, scope, style.reset) : console.error.bind(console, `${styleScope}❌\n%s\x1b[31m.%s() Error \`%s\`${style.reset}\n`, scope), + + incident: isBrowser + ? console.log.bind(console, '%c%s%c.%s() Incident `%s` %s!', styleScope, scope, 'color: orange;') + : console.log.bind(console, `${styleScope}🚸\n%s${style.reset}.%s() Incident \`%s\` %s!${style.reset}`, scope), }; if (!debug) { @@ -142,7 +146,6 @@ export const createLogger = (scope: string, color?: string | null, debug?: boole logMethod: empty, logMethodArgs: empty, logMethodFull: empty, - incident: empty, logOther: empty, }; } @@ -159,10 +162,6 @@ export const createLogger = (scope: string, color?: string | null, debug?: boole logMethodFull: console.debug.bind(console, keySection + '.%s(%o) => %o', styleScope, scope, style.reset), - incident: isBrowser - ? console.log.bind(console, '%c%s%c.%s() Incident `%s` %s!', styleScope, scope, 'color: orange;') - : console.log.bind(console, `${styleScope}🚸\n%s${style.reset}.%s() Incident \`%s\` %s!${style.reset}`, scope), - logOther: console.debug.bind(console, keySection, styleScope, scope, style.reset), }; }; From 705d7b99c2cd7369d496051538f09de35660b2df Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Sun, 4 Dec 2022 15:19:37 +0330 Subject: [PATCH 11/39] feat(service/commenting): add base nano server --- packages/service/commenting/.dockerignore | 5 ++ packages/service/commenting/Dockerfile | 38 +++++++++ packages/service/commenting/README.md | 1 + packages/service/commenting/demo.http | 6 ++ packages/service/commenting/package.json | 84 +++++++++++++++++++ packages/service/commenting/src/index.ts | 4 + packages/service/commenting/src/lib/config.ts | 12 +++ .../service/commenting/src/lib/nano-server.ts | 5 ++ .../commenting/src/lib/storage-provider.ts | 5 ++ packages/service/commenting/src/route/home.ts | 11 +++ packages/service/commenting/tsconfig.json | 66 +++++++++++++++ 11 files changed, 237 insertions(+) create mode 100644 packages/service/commenting/.dockerignore create mode 100644 packages/service/commenting/Dockerfile create mode 100644 packages/service/commenting/README.md create mode 100644 packages/service/commenting/demo.http create mode 100644 packages/service/commenting/package.json create mode 100644 packages/service/commenting/src/index.ts create mode 100644 packages/service/commenting/src/lib/config.ts create mode 100644 packages/service/commenting/src/lib/nano-server.ts create mode 100644 packages/service/commenting/src/lib/storage-provider.ts create mode 100644 packages/service/commenting/src/route/home.ts create mode 100644 packages/service/commenting/tsconfig.json diff --git a/packages/service/commenting/.dockerignore b/packages/service/commenting/.dockerignore new file mode 100644 index 000000000..24435a155 --- /dev/null +++ b/packages/service/commenting/.dockerignore @@ -0,0 +1,5 @@ +* +!src/ +!package.json +!tsconfig.json +!*.lock diff --git a/packages/service/commenting/Dockerfile b/packages/service/commenting/Dockerfile new file mode 100644 index 000000000..89982400a --- /dev/null +++ b/packages/service/commenting/Dockerfile @@ -0,0 +1,38 @@ +ARG NODE_VERSION=19 +FROM docker.io/library/node:${NODE_VERSION}-alpine as builder + +WORKDIR /app + +COPY package.json *.lock ./ +RUN if [ -f *.lock ]; then \ + yarn install --frozen-lockfile --non-interactive; \ + else \ + yarn install --non-interactive; \ + fi; + +COPY . . +RUN yarn build && \ + rm -rf node_modules && \ + yarn install --frozen-lockfile --non-interactive --production && \ + ls -lahF && \ + ls -lAh dist + +# --- + +FROM docker.io/library/node:${NODE_VERSION}-alpine as app + +WORKDIR /app + +RUN apk add --no-cache tini +ENTRYPOINT ["/sbin/tini", "--"] +CMD ["node", "index.js"] + +ENV NODE_ENV production +ENV ALWATR_DEBUG * +ENV HOST 0.0.0.0 +ENV PORT 80 +EXPOSE 80 + +COPY --from=builder /app/node_modules/ ./node_modules/ +COPY --from=builder /app/dist/ ./ +RUN ls -lahF diff --git a/packages/service/commenting/README.md b/packages/service/commenting/README.md new file mode 100644 index 000000000..d3e6c5fbc --- /dev/null +++ b/packages/service/commenting/README.md @@ -0,0 +1 @@ +# Commenting Service diff --git a/packages/service/commenting/demo.http b/packages/service/commenting/demo.http new file mode 100644 index 000000000..70446c157 --- /dev/null +++ b/packages/service/commenting/demo.http @@ -0,0 +1,6 @@ +@apiUrl = http://127.0.0.1:8000 +@apiVersion = v0 +@token = YOUR_SECRET_TOKEN + +### home +GET {{apiUrl}}/ diff --git a/packages/service/commenting/package.json b/packages/service/commenting/package.json new file mode 100644 index 000000000..39464a69f --- /dev/null +++ b/packages/service/commenting/package.json @@ -0,0 +1,84 @@ +{ + "name": "@alwatr/commenting", + "version": "0.24.1", + "description": "Alwatr Commenting API Microservice", + "type": "module", + "keywords": [ + "database", + "storage", + "json", + "nosql", + "no-sql", + "api", + "data", + "data-storage", + "file", + "microservice", + "nanoservice", + "typescript", + "alwatr" + ], + "author": "S. Ali Mihandoost (https://ali.mihandoost.com)", + "contributors": [ + "S. Amir Mohammad Najafi (njfamirm.ir)" + ], + "license": "MIT", + "private": true, + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/AliMD/alwatr", + "directory": "packages/service/storage-server" + }, + "homepage": "https://github.com/AliMD/alwatr/tree/main/packages/service/storage-server#readme", + "bugs": { + "url": "https://github.com/AliMD/alwatr/issues" + }, + "scripts": { + "l": "yarn lint", + "b": "yarn build", + "cb": "run-s clean build", + "s": "run-s clean build serve", + "w": "yarn watch", + "f": "yarn format", + "fl": "yarn format:eslint", + "fp": "yarn format:prettier", + "start": "yarn serve", + "lint": "run-s lint:*", + "lint:ts": "eslint . --config .eslintrc.json --ext .ts", + "build": "run-s build:*", + "build:ts": "tsc --build", + "format": "run-s format:prettier format:eslint", + "format:eslint": "yarn lint:ts --fix", + "format:prettier": "prettier \"**/*.{html,json,md,ts}\" --write", + "clean": "rimraf dist/", + "serve": "node dist/index.js", + "serve:debug": "node --inspect dist/index.js", + "watch": "run-s clean build && run-p watch:ts watch:node", + "watch:node": "nodemon -w dist/ dist/index.js", + "watch:debug-node": "nodemon -w dist/ --inspect dist/index.js", + "watch:ts": "yarn build:ts --watch --preserveWatchOutput" + }, + "dependencies": { + "@alwatr/logger": "^0.24.1", + "@alwatr/nano-server": "^0.24.1", + "@alwatr/storage-engine": "^0.24.1" + }, + "devDependencies": { + "@types/node": "~18.11.10", + "@typescript-eslint/eslint-plugin": "~5.45.0", + "@typescript-eslint/parser": "~5.45.0", + "eslint": "~8.28.0", + "eslint-config-google": "~0.14.0", + "eslint-import-resolver-typescript": "~3.5.2", + "eslint-plugin-import": "~2.26.0", + "nodemon": "~2.0.20", + "npm-run-all": "~4.1.5", + "prettier": "~2.8.0", + "rimraf": "~3.0.2", + "typescript": "4.9.3" + } +} diff --git a/packages/service/commenting/src/index.ts b/packages/service/commenting/src/index.ts new file mode 100644 index 000000000..3769a8e56 --- /dev/null +++ b/packages/service/commenting/src/index.ts @@ -0,0 +1,4 @@ +import './route/home.js' +import {logger} from './lib/config.js'; + +logger.logOther('..:: Alwatr Storage Nanoservice API ::..'); diff --git a/packages/service/commenting/src/lib/config.ts b/packages/service/commenting/src/lib/config.ts new file mode 100644 index 000000000..59b829ddd --- /dev/null +++ b/packages/service/commenting/src/lib/config.ts @@ -0,0 +1,12 @@ +import {createLogger} from '@alwatr/logger'; + +export const logger = createLogger('storage-server'); + +export const config = { + host: process.env.HOST ?? '0.0.0.0', + port: process.env.PORT != null ? +process.env.PORT : 8000, + storagePath: process.env.STORAGE_PATH ?? 'db', + token: process.env.TOKEN ?? 'YOUR_SECRET_TOKEN', +}; + +logger.logProperty('config', {...config, token: '***'}); diff --git a/packages/service/commenting/src/lib/nano-server.ts b/packages/service/commenting/src/lib/nano-server.ts new file mode 100644 index 000000000..fdd730bd2 --- /dev/null +++ b/packages/service/commenting/src/lib/nano-server.ts @@ -0,0 +1,5 @@ +import {AlwatrNanoServer} from '@alwatr/nano-server'; + +import {config} from './config.js'; + +export const nanoServer = new AlwatrNanoServer({host: config.host, port: config.port, allowAllOrigin: true}); diff --git a/packages/service/commenting/src/lib/storage-provider.ts b/packages/service/commenting/src/lib/storage-provider.ts new file mode 100644 index 000000000..72175e038 --- /dev/null +++ b/packages/service/commenting/src/lib/storage-provider.ts @@ -0,0 +1,5 @@ +import {AlwatrStorageEngineProvider} from '@alwatr/storage-engine/provider.js'; + +import {config} from './config.js'; + +export const storageProvider = new AlwatrStorageEngineProvider({path: config.storagePath}); diff --git a/packages/service/commenting/src/route/home.ts b/packages/service/commenting/src/route/home.ts new file mode 100644 index 000000000..404b0f687 --- /dev/null +++ b/packages/service/commenting/src/route/home.ts @@ -0,0 +1,11 @@ +import {nanoServer} from '../lib/nano-server.js'; + +nanoServer.route('GET', '/', async (connection) => { + connection.reply({ + ok: true, + data: { + app: 'Alwatr Commenting API Microservice', + message: 'Hello ;)', + }, + }); +}); diff --git a/packages/service/commenting/tsconfig.json b/packages/service/commenting/tsconfig.json new file mode 100644 index 000000000..9361db5ad --- /dev/null +++ b/packages/service/commenting/tsconfig.json @@ -0,0 +1,66 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ESNext", + "lib": ["ESNext"], + // "allowJs": true, + // "checkJs": true, + // "jsx": "preserve", + "declaration": false, + "declarationMap": false, + "sourceMap": false, + // "outFile": "./", + "outDir": "./dist", + // "rootDir": "./src", + // "composite": true, + // "tsBuildInfoFile": ".tsbuildinfo", + "removeComments": true, + // "noEmit": true, + "importHelpers": true, + // "downlevelIteration": true, + // "isolatedModules": true, + + "strict": true, + // "noImplicitAny": false, + // "strictNullChecks": true, + // "strictFunctionTypes": true, + // "strictBindCallApply": true, + // "strictPropertyInitialization": true, + // "noImplicitThis": true, + // "alwaysStrict": true, + + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "noImplicitOverride": true, + // "noUncheckedIndexedAccess": true, + // "noPropertyAccessFromIndexSignature": true, + + "moduleResolution": "node", + "baseUrl": "./", + // "paths": {}, + // "rootDirs": [], + // "typeRoots": [], + // "types": [], + // "allowSyntheticDefaultImports": true, + // "esModuleInterop": true, + // "preserveSymlinks": true, + // "allowUmdGlobalAccess": true, + + // "sourceRoot": "", + // "mapRoot": "", + // "inlineSourceMap": true, + // "inlineSources": true, + + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "useDefineForClassFields": false + }, + + "include": ["src/**/*"], + "exclude": ["node_modules"] +} From 542cc529f42a9e524d0a8faa76de51011b12d655 Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Sun, 4 Dec 2022 15:53:56 +0330 Subject: [PATCH 12/39] feat(service/commenting): add route --- packages/service/commenting/demo.http | 10 ++++++ packages/service/commenting/package.json | 1 + packages/service/commenting/src/index.ts | 3 +- packages/service/commenting/src/lib/config.ts | 15 +++++--- .../service/commenting/src/lib/nano-server.ts | 6 +++- .../commenting/src/lib/storage-provider.ts | 5 --- .../service/commenting/src/lib/storage.ts | 6 ++++ packages/service/commenting/src/lib/type.ts | 6 ++++ packages/service/commenting/src/route/add.ts | 35 +++++++++++++++++++ 9 files changed, 76 insertions(+), 11 deletions(-) delete mode 100644 packages/service/commenting/src/lib/storage-provider.ts create mode 100644 packages/service/commenting/src/lib/storage.ts create mode 100644 packages/service/commenting/src/lib/type.ts create mode 100644 packages/service/commenting/src/route/add.ts diff --git a/packages/service/commenting/demo.http b/packages/service/commenting/demo.http index 70446c157..6757be9d4 100644 --- a/packages/service/commenting/demo.http +++ b/packages/service/commenting/demo.http @@ -4,3 +4,13 @@ ### home GET {{apiUrl}}/ + +### Add comment +PUT {{apiUrl}}/add?path=product/test +Authorization: Bearer {{token}} +Content-Type: application/json + +{ + "userName": "njfamirm", + "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." +} diff --git a/packages/service/commenting/package.json b/packages/service/commenting/package.json index 39464a69f..f9dcf684e 100644 --- a/packages/service/commenting/package.json +++ b/packages/service/commenting/package.json @@ -65,6 +65,7 @@ "dependencies": { "@alwatr/logger": "^0.24.1", "@alwatr/nano-server": "^0.24.1", + "@alwatr/storage-client": "^0.24.1", "@alwatr/storage-engine": "^0.24.1" }, "devDependencies": { diff --git a/packages/service/commenting/src/index.ts b/packages/service/commenting/src/index.ts index 3769a8e56..892c1ea86 100644 --- a/packages/service/commenting/src/index.ts +++ b/packages/service/commenting/src/index.ts @@ -1,4 +1,5 @@ -import './route/home.js' +import './route/home.js'; +import './route/add.js'; import {logger} from './lib/config.js'; logger.logOther('..:: Alwatr Storage Nanoservice API ::..'); diff --git a/packages/service/commenting/src/lib/config.ts b/packages/service/commenting/src/lib/config.ts index 59b829ddd..ce35d54e0 100644 --- a/packages/service/commenting/src/lib/config.ts +++ b/packages/service/commenting/src/lib/config.ts @@ -3,10 +3,17 @@ import {createLogger} from '@alwatr/logger'; export const logger = createLogger('storage-server'); export const config = { - host: process.env.HOST ?? '0.0.0.0', - port: process.env.PORT != null ? +process.env.PORT : 8000, - storagePath: process.env.STORAGE_PATH ?? 'db', - token: process.env.TOKEN ?? 'YOUR_SECRET_TOKEN', + nanoServer: { + host: process.env.HOST ?? '0.0.0.0', + port: process.env.PORT != null ? +process.env.PORT : 8000, + token: process.env.TOKEN ?? 'YOUR_SECRET_TOKEN', + }, + storage: { + host: process.env.STORAGE_HOST ?? '127.0.0.1', + port: process.env.STORAGE_PORT != null ? +process.env.STORAGE_PORT : 9000, + name: process.env.STORAGE_NAME ?? 'comment', + token: process.env.STORAGE_TOKEN ?? 'YOUR_SECRET_TOKEN', + }, }; logger.logProperty('config', {...config, token: '***'}); diff --git a/packages/service/commenting/src/lib/nano-server.ts b/packages/service/commenting/src/lib/nano-server.ts index fdd730bd2..c94fb5a39 100644 --- a/packages/service/commenting/src/lib/nano-server.ts +++ b/packages/service/commenting/src/lib/nano-server.ts @@ -2,4 +2,8 @@ import {AlwatrNanoServer} from '@alwatr/nano-server'; import {config} from './config.js'; -export const nanoServer = new AlwatrNanoServer({host: config.host, port: config.port, allowAllOrigin: true}); +export const nanoServer = new AlwatrNanoServer({ + host: config.nanoServer.host, + port: config.nanoServer.port, + allowAllOrigin: true, +}); diff --git a/packages/service/commenting/src/lib/storage-provider.ts b/packages/service/commenting/src/lib/storage-provider.ts deleted file mode 100644 index 72175e038..000000000 --- a/packages/service/commenting/src/lib/storage-provider.ts +++ /dev/null @@ -1,5 +0,0 @@ -import {AlwatrStorageEngineProvider} from '@alwatr/storage-engine/provider.js'; - -import {config} from './config.js'; - -export const storageProvider = new AlwatrStorageEngineProvider({path: config.storagePath}); diff --git a/packages/service/commenting/src/lib/storage.ts b/packages/service/commenting/src/lib/storage.ts new file mode 100644 index 000000000..8dcf38807 --- /dev/null +++ b/packages/service/commenting/src/lib/storage.ts @@ -0,0 +1,6 @@ +import {AlwatrStorageClient} from '@alwatr/storage-client'; + +import {config} from './config.js'; +import {Comment} from './type.js'; + +export const storage = new AlwatrStorageClient(config.storage); diff --git a/packages/service/commenting/src/lib/type.ts b/packages/service/commenting/src/lib/type.ts new file mode 100644 index 000000000..e30f3d781 --- /dev/null +++ b/packages/service/commenting/src/lib/type.ts @@ -0,0 +1,6 @@ +import {AlwatrDocumentObject} from '@alwatr/storage-engine'; + +export type Comment = AlwatrDocumentObject & { + userName: string; + text: string; +} diff --git a/packages/service/commenting/src/route/add.ts b/packages/service/commenting/src/route/add.ts new file mode 100644 index 000000000..ec5de689a --- /dev/null +++ b/packages/service/commenting/src/route/add.ts @@ -0,0 +1,35 @@ +import {logger} from 'src/lib/config.js'; + +import {nanoServer} from '../lib/nano-server.js'; +import {storage} from '../lib/storage.js'; +import {Comment} from '../lib/type.js'; + + +import type {AlwatrConnection} from '@alwatr/nano-server'; + +nanoServer.route('PUT', '/add', addComment); + +async function addComment(connection: AlwatrConnection): Promise { + const params = await connection.requireQueryParams<{path: string}>({path: 'string'}); + if (params == null) return; + + const bodyJson = await connection.requireJsonBody(); + if (bodyJson == null) return; + + storage.config.name = params.path; + + try { + connection.reply({ + ok: true, + data: await storage.set({...bodyJson, id: 'auto_increment'}), + }); + } + catch (err) { + logger.error('newJob', (err as Error).message ?? 'storage_error', (err as Error).stack ?? err); + connection.reply({ + ok: false, + statusCode: 500, + errorCode: 'storage_error', + }); + } +} From 170af3b198347a6cbaa1f0454da9d74e15f43f4e Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Sun, 4 Dec 2022 16:56:04 +0330 Subject: [PATCH 13/39] feat(service/commenting): rename add to put route --- packages/service/commenting/demo.http | 2 +- packages/service/commenting/package.json | 3 +-- packages/service/commenting/src/index.ts | 2 +- packages/service/commenting/src/route/{add.ts => put.ts} | 9 ++++++--- 4 files changed, 9 insertions(+), 7 deletions(-) rename packages/service/commenting/src/route/{add.ts => put.ts} (82%) diff --git a/packages/service/commenting/demo.http b/packages/service/commenting/demo.http index 6757be9d4..2d7df562d 100644 --- a/packages/service/commenting/demo.http +++ b/packages/service/commenting/demo.http @@ -6,7 +6,7 @@ GET {{apiUrl}}/ ### Add comment -PUT {{apiUrl}}/add?path=product/test +PUT {{apiUrl}}/?path=product/test Authorization: Bearer {{token}} Content-Type: application/json diff --git a/packages/service/commenting/package.json b/packages/service/commenting/package.json index f9dcf684e..ef2369a9c 100644 --- a/packages/service/commenting/package.json +++ b/packages/service/commenting/package.json @@ -65,8 +65,7 @@ "dependencies": { "@alwatr/logger": "^0.24.1", "@alwatr/nano-server": "^0.24.1", - "@alwatr/storage-client": "^0.24.1", - "@alwatr/storage-engine": "^0.24.1" + "@alwatr/storage-client": "^0.24.1" }, "devDependencies": { "@types/node": "~18.11.10", diff --git a/packages/service/commenting/src/index.ts b/packages/service/commenting/src/index.ts index 892c1ea86..04f98312c 100644 --- a/packages/service/commenting/src/index.ts +++ b/packages/service/commenting/src/index.ts @@ -1,5 +1,5 @@ import './route/home.js'; -import './route/add.js'; +import './route/put.js'; import {logger} from './lib/config.js'; logger.logOther('..:: Alwatr Storage Nanoservice API ::..'); diff --git a/packages/service/commenting/src/route/add.ts b/packages/service/commenting/src/route/put.ts similarity index 82% rename from packages/service/commenting/src/route/add.ts rename to packages/service/commenting/src/route/put.ts index ec5de689a..713032ea4 100644 --- a/packages/service/commenting/src/route/add.ts +++ b/packages/service/commenting/src/route/put.ts @@ -1,5 +1,4 @@ -import {logger} from 'src/lib/config.js'; - +import {config, logger} from '../lib/config.js'; import {nanoServer} from '../lib/nano-server.js'; import {storage} from '../lib/storage.js'; import {Comment} from '../lib/type.js'; @@ -7,9 +6,13 @@ import {Comment} from '../lib/type.js'; import type {AlwatrConnection} from '@alwatr/nano-server'; -nanoServer.route('PUT', '/add', addComment); +nanoServer.route('PUT', '/', addComment); async function addComment(connection: AlwatrConnection): Promise { + const token = connection.requireToken(config.nanoServer.token); + + if (token == null) return; + const params = await connection.requireQueryParams<{path: string}>({path: 'string'}); if (params == null) return; From 581cebe78840237619c820f4c45aa06b87672076 Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Sun, 4 Dec 2022 17:36:56 +0330 Subject: [PATCH 14/39] feat(service/commenting): get all route --- packages/service/commenting/demo.http | 11 +++++++ packages/service/commenting/src/index.ts | 1 + packages/service/commenting/src/route/all.ts | 33 ++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 packages/service/commenting/src/route/all.ts diff --git a/packages/service/commenting/demo.http b/packages/service/commenting/demo.http index 2d7df562d..53898825d 100644 --- a/packages/service/commenting/demo.http +++ b/packages/service/commenting/demo.http @@ -14,3 +14,14 @@ Content-Type: application/json "userName": "njfamirm", "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." } + +### Add reply comment +PUT {{apiUrl}}/?path=product/test +Authorization: Bearer {{token}} +Content-Type: application/json + +{ + "userName": "njfamirm", + "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", + "replyId": "5" +} \ No newline at end of file diff --git a/packages/service/commenting/src/index.ts b/packages/service/commenting/src/index.ts index 04f98312c..63c586b81 100644 --- a/packages/service/commenting/src/index.ts +++ b/packages/service/commenting/src/index.ts @@ -1,5 +1,6 @@ import './route/home.js'; import './route/put.js'; +import './route/all.js'; import {logger} from './lib/config.js'; logger.logOther('..:: Alwatr Storage Nanoservice API ::..'); diff --git a/packages/service/commenting/src/route/all.ts b/packages/service/commenting/src/route/all.ts new file mode 100644 index 000000000..5d7d86bd1 --- /dev/null +++ b/packages/service/commenting/src/route/all.ts @@ -0,0 +1,33 @@ +import {config, logger} from '../lib/config.js'; +import {nanoServer} from '../lib/nano-server.js'; +import {storage} from '../lib/storage.js'; + +import type {AlwatrConnection} from '@alwatr/nano-server'; + +nanoServer.route('GET', '/all', getAllComment); + +async function getAllComment(connection: AlwatrConnection): Promise { + logger.logMethod('getAllComment'); + const token = connection.requireToken(config.nanoServer.token); + if (token == null) return; + + const params = connection.requireQueryParams<{path: string}>({path: 'string'}); + if (params == null) return; + + storage.config.name = params.path; + + try { + connection.reply({ + ok: true, + data: await storage.getAll(), + }); + } + catch (err) { + logger.error('getAllComment', (err as Error).message ?? 'storage_error', (err as Error).stack ?? err); + connection.reply({ + ok: false, + statusCode: 500, + errorCode: 'storage_error', + }); + } +} From 5629a013916d479ea6816c76b0db4ff8befcdc7c Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Sun, 4 Dec 2022 17:37:21 +0330 Subject: [PATCH 15/39] feat(service/commenting): replyId --- packages/service/commenting/demo.http | 7 ++++++- packages/service/commenting/src/lib/type.ts | 3 ++- packages/service/commenting/src/route/put.ts | 11 ++++++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/packages/service/commenting/demo.http b/packages/service/commenting/demo.http index 53898825d..ab2d19875 100644 --- a/packages/service/commenting/demo.http +++ b/packages/service/commenting/demo.http @@ -24,4 +24,9 @@ Content-Type: application/json "userName": "njfamirm", "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", "replyId": "5" -} \ No newline at end of file +} + +### Get all comment +GET {{apiUrl}}/all?path=product/test +Authorization: Bearer {{token}} +Content-Type: application/json diff --git a/packages/service/commenting/src/lib/type.ts b/packages/service/commenting/src/lib/type.ts index e30f3d781..4f64e649e 100644 --- a/packages/service/commenting/src/lib/type.ts +++ b/packages/service/commenting/src/lib/type.ts @@ -1,6 +1,7 @@ import {AlwatrDocumentObject} from '@alwatr/storage-engine'; export type Comment = AlwatrDocumentObject & { - userName: string; + userId: string; text: string; + replyId?: string; } diff --git a/packages/service/commenting/src/route/put.ts b/packages/service/commenting/src/route/put.ts index 713032ea4..9d3863778 100644 --- a/packages/service/commenting/src/route/put.ts +++ b/packages/service/commenting/src/route/put.ts @@ -3,17 +3,17 @@ import {nanoServer} from '../lib/nano-server.js'; import {storage} from '../lib/storage.js'; import {Comment} from '../lib/type.js'; - import type {AlwatrConnection} from '@alwatr/nano-server'; nanoServer.route('PUT', '/', addComment); async function addComment(connection: AlwatrConnection): Promise { + logger.logMethod('addComment'); const token = connection.requireToken(config.nanoServer.token); if (token == null) return; - const params = await connection.requireQueryParams<{path: string}>({path: 'string'}); + const params = connection.requireQueryParams<{path: string}>({path: 'string'}); if (params == null) return; const bodyJson = await connection.requireJsonBody(); @@ -21,6 +21,11 @@ async function addComment(connection: AlwatrConnection): Promise { storage.config.name = params.path; + // check reply id exists + if (bodyJson.replyId !== undefined && !(await storage.has(bodyJson.replyId))) { + delete(bodyJson.replyId); + } + try { connection.reply({ ok: true, @@ -28,7 +33,7 @@ async function addComment(connection: AlwatrConnection): Promise { }); } catch (err) { - logger.error('newJob', (err as Error).message ?? 'storage_error', (err as Error).stack ?? err); + logger.error('addComment', (err as Error).message ?? 'storage_error', (err as Error).stack ?? err); connection.reply({ ok: false, statusCode: 500, From cac300e54de744c3232956fceaf6eff8aff70753 Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Sun, 4 Dec 2022 17:55:03 +0330 Subject: [PATCH 16/39] chore(.vscode): update extension recommendation --- .vscode/extensions.json | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 6d9e2332d..dbf009515 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,17 +1,21 @@ { "recommendations": [ - "editorconfig.editorconfig", + "bierner.lit-html", + "christian-kohler.path-intellisense", + "davidanson.vscode-markdownlint", "dbaeumer.vscode-eslint", - "streetsidesoftware.code-spell-checker", - "streetsidesoftware.code-spell-checker-persian", + "eamodio.gitlens", + "editorconfig.editorconfig", "esbenp.prettier-vscode", - "runem.lit-plugin", - "christian-kohler.path-intellisense", + "github.vscode-pull-request-github", + "humao.rest-client", + "irongeek.vscode-env", "jgclark.vscode-todo-highlight", "redhat.vscode-yaml", - "github.vscode-pull-request-github", - "davidanson.vscode-markdownlint", + "runem.lit-plugin", + "william-voyek.vscode-nginx", + "streetsidesoftware.code-spell-checker-persian", + "streetsidesoftware.code-spell-checker", "stylelint.vscode-stylelint", - "humao.rest-client" ] } From 60502a0a7f9e920c18ff1cc1ecc3e849a7189d06 Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Mon, 5 Dec 2022 13:48:26 +0330 Subject: [PATCH 17/39] chore(workflow/publish-container): add commenting service --- .github/workflows/publish-container.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/publish-container.yml b/.github/workflows/publish-container.yml index 652e23fa5..d1fae26ce 100644 --- a/.github/workflows/publish-container.yml +++ b/.github/workflows/publish-container.yml @@ -57,6 +57,13 @@ jobs: short: 0 full: 0.24.1 + - image: commenting + path: service/commenting + description: Elegant powerful nodejs server for commenting microservice, written in tiny TypeScript module. + version: + short: 0 + full: 0.24.1 + # - image: tdlib # path: container/tdlib # description: Cross-platform library for building Telegram clients. From e41f11a02e293d72705820800f6530b68bdabb58 Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Mon, 5 Dec 2022 13:48:43 +0330 Subject: [PATCH 18/39] chore(service/commenting): update readme --- packages/service/commenting/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/service/commenting/README.md b/packages/service/commenting/README.md index d3e6c5fbc..591a373b3 100644 --- a/packages/service/commenting/README.md +++ b/packages/service/commenting/README.md @@ -1 +1,7 @@ # Commenting Service + +Elegant powerful nodejs server for commenting microservice, written in tiny TypeScript module. + +## How to use + +Check [demo.http](demo.http). From da062126667492d95f21f31687b874c09770cf79 Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Mon, 5 Dec 2022 13:49:00 +0330 Subject: [PATCH 19/39] chore(service/commenting): update package.json --- packages/service/commenting/package.json | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/service/commenting/package.json b/packages/service/commenting/package.json index ef2369a9c..8213e5079 100644 --- a/packages/service/commenting/package.json +++ b/packages/service/commenting/package.json @@ -12,6 +12,9 @@ "api", "data", "data-storage", + "commenting", + "comment", + "chat", "file", "microservice", "nanoservice", @@ -20,20 +23,21 @@ ], "author": "S. Ali Mihandoost (https://ali.mihandoost.com)", "contributors": [ - "S. Amir Mohammad Najafi (njfamirm.ir)" + "S. Amir Mohammad Najafi (https://njfamirm.ir)" ], "license": "MIT", "private": true, "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" + "node": ">=19.0.0", + "npm": ">=8.0.0", + "yarn": ">=1.22.0" }, "repository": { "type": "git", "url": "https://github.com/AliMD/alwatr", - "directory": "packages/service/storage-server" + "directory": "packages/service/commenting" }, - "homepage": "https://github.com/AliMD/alwatr/tree/main/packages/service/storage-server#readme", + "homepage": "https://github.com/AliMD/alwatr/tree/main/packages/service/commenting#readme", "bugs": { "url": "https://github.com/AliMD/alwatr/issues" }, From 3ba09b42c517383bee1c05ac84625fd2bc81f93f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Dec 2022 11:14:29 +0000 Subject: [PATCH 20/39] chore(deps): bump dessant/lock-threads from 3 to 4 Bumps [dessant/lock-threads](https://github.com/dessant/lock-threads) from 3 to 4. - [Release notes](https://github.com/dessant/lock-threads/releases) - [Changelog](https://github.com/dessant/lock-threads/blob/master/CHANGELOG.md) - [Commits](https://github.com/dessant/lock-threads/compare/v3...v4) --- updated-dependencies: - dependency-name: dessant/lock-threads dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/lock-closed.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lock-closed.yml b/.github/workflows/lock-closed.yml index f306dfc27..d16a72c52 100644 --- a/.github/workflows/lock-closed.yml +++ b/.github/workflows/lock-closed.yml @@ -29,7 +29,7 @@ jobs: steps: - name: 🔒 Lock closed issues and PRs - uses: dessant/lock-threads@v3 + uses: dessant/lock-threads@v4 with: github-token: ${{ github.token }} issue-inactive-days: 7 From e6895e023a52a20f4a25a0540d2be5ebfb0ff325 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Dec 2022 11:15:34 +0000 Subject: [PATCH 21/39] chore(deps-dev): bump eslint from 8.28.0 to 8.29.0 Bumps [eslint](https://github.com/eslint/eslint) from 8.28.0 to 8.29.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.28.0...v8.29.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package.json | 2 +- packages/service/storage-server/package.json | 2 +- packages/starter/nanoservice/package.json | 2 +- yarn.lock | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index deaf127ba..2d6b27863 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "@typescript/lib-dom": "npm:@types/web", "@web/dev-server": "~0.1.35", "@web/dev-server-esbuild": "^0.3.3", - "eslint": "~8.28.0", + "eslint": "~8.29.0", "eslint-config-google": "~0.14.0", "eslint-import-resolver-typescript": "~3.5.2", "eslint-plugin-import": "~2.26.0", diff --git a/packages/service/storage-server/package.json b/packages/service/storage-server/package.json index 1edb1295d..89d9028cc 100644 --- a/packages/service/storage-server/package.json +++ b/packages/service/storage-server/package.json @@ -68,7 +68,7 @@ "@types/node": "~18.11.10", "@typescript-eslint/eslint-plugin": "~5.45.0", "@typescript-eslint/parser": "~5.45.0", - "eslint": "~8.28.0", + "eslint": "~8.29.0", "eslint-config-google": "~0.14.0", "eslint-import-resolver-typescript": "~3.5.2", "eslint-plugin-import": "~2.26.0", diff --git a/packages/starter/nanoservice/package.json b/packages/starter/nanoservice/package.json index 2ddc323f9..bd8570721 100644 --- a/packages/starter/nanoservice/package.json +++ b/packages/starter/nanoservice/package.json @@ -60,7 +60,7 @@ "@types/node": "~18.11.10", "@typescript-eslint/eslint-plugin": "~5.45.0", "@typescript-eslint/parser": "~5.45.0", - "eslint": "~8.28.0", + "eslint": "~8.29.0", "eslint-config-google": "~0.14.0", "eslint-import-resolver-typescript": "~3.5.2", "eslint-plugin-import": "~2.26.0", diff --git a/yarn.lock b/yarn.lock index ba6f5ac4d..8b7202592 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3025,10 +3025,10 @@ eslint-visitor-keys@^3.3.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -eslint@^8.9.0, eslint@~8.28.0: - version "8.28.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.28.0.tgz#81a680732634677cc890134bcdd9fdfea8e63d6e" - integrity sha512-S27Di+EVyMxcHiwDrFzk8dJYAaD+/5SoWKxL1ri/71CRHsnJnRDPNt2Kzj24+MT9FDupf4aqqyqPrvI8MvQ4VQ== +eslint@^8.9.0, eslint@~8.29.0: + version "8.29.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.29.0.tgz#d74a88a20fb44d59c51851625bc4ee8d0ec43f87" + integrity sha512-isQ4EEiyUjZFbEKvEGJKKGBwXtvXX+zJbkVKCgTuB9t/+jUBcy8avhkEwWJecI15BkRkOYmvIM5ynbhRjEkoeg== dependencies: "@eslint/eslintrc" "^1.3.3" "@humanwhocodes/config-array" "^0.11.6" From 0e863506ee7c4cbfde7f5d62ad4a79c639716172 Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Mon, 5 Dec 2022 17:31:45 +0330 Subject: [PATCH 22/39] chore(logger): review --- packages/core/logger/src/logger.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/logger/src/logger.ts b/packages/core/logger/src/logger.ts index 470c3ccad..26f55d906 100644 --- a/packages/core/logger/src/logger.ts +++ b/packages/core/logger/src/logger.ts @@ -126,6 +126,10 @@ export const createLogger = (scope: string, color?: string | null, debug?: boole color, scope, + incident: isBrowser + ? console.log.bind(console, '%c%s%c.%s() Incident `%s` %s!', styleScope, scope, 'color: orange;') + : console.log.bind(console, `${styleScope}🚸\n%s${style.reset}.%s() Incident \`%s\` %s!${style.reset}`, scope), + accident: isBrowser ? console.warn.bind(console, '%c%s%c.%s() Accident `%s` %s!', styleScope, scope, style.reset) : console.warn.bind(console, `${styleScope}⚠️\n%s\x1b[33m.%s() Accident \`%s\` %s!${style.reset}`, scope), @@ -133,10 +137,6 @@ export const createLogger = (scope: string, color?: string | null, debug?: boole error: isBrowser ? console.error.bind(console, '%c%s%c.%s() Error `%s`\n', styleScope, scope, style.reset) : console.error.bind(console, `${styleScope}❌\n%s\x1b[31m.%s() Error \`%s\`${style.reset}\n`, scope), - - incident: isBrowser - ? console.log.bind(console, '%c%s%c.%s() Incident `%s` %s!', styleScope, scope, 'color: orange;') - : console.log.bind(console, `${styleScope}🚸\n%s${style.reset}.%s() Incident \`%s\` %s!${style.reset}`, scope), }; if (!debug) { From bd4d30c1d2471bf6a87dbd50411d2482aa3fef0b Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Tue, 6 Dec 2022 15:36:58 +0330 Subject: [PATCH 23/39] refactor(commenting): move allowOrigin to config --- packages/service/commenting/src/lib/config.ts | 1 + packages/service/commenting/src/lib/nano-server.ts | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/service/commenting/src/lib/config.ts b/packages/service/commenting/src/lib/config.ts index ce35d54e0..6f00dce95 100644 --- a/packages/service/commenting/src/lib/config.ts +++ b/packages/service/commenting/src/lib/config.ts @@ -6,6 +6,7 @@ export const config = { nanoServer: { host: process.env.HOST ?? '0.0.0.0', port: process.env.PORT != null ? +process.env.PORT : 8000, + allowAllOrigin: true, token: process.env.TOKEN ?? 'YOUR_SECRET_TOKEN', }, storage: { diff --git a/packages/service/commenting/src/lib/nano-server.ts b/packages/service/commenting/src/lib/nano-server.ts index c94fb5a39..df789f689 100644 --- a/packages/service/commenting/src/lib/nano-server.ts +++ b/packages/service/commenting/src/lib/nano-server.ts @@ -2,8 +2,4 @@ import {AlwatrNanoServer} from '@alwatr/nano-server'; import {config} from './config.js'; -export const nanoServer = new AlwatrNanoServer({ - host: config.nanoServer.host, - port: config.nanoServer.port, - allowAllOrigin: true, -}); +export const nanoServer = new AlwatrNanoServer(config.nanoServer); From 13a0fe97a1f9b65fafea893a198fdea4310ddd8d Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Tue, 6 Dec 2022 16:32:54 +0330 Subject: [PATCH 24/39] feat(comment): new types --- packages/service/commenting/demo.http | 6 +++--- .../service/commenting/src/lib/storage.ts | 4 ++-- packages/service/commenting/src/lib/type.ts | 21 ++++++++++++++----- packages/service/commenting/src/route/all.ts | 4 ++-- packages/service/commenting/src/route/put.ts | 8 +++---- 5 files changed, 27 insertions(+), 16 deletions(-) diff --git a/packages/service/commenting/demo.http b/packages/service/commenting/demo.http index ab2d19875..d9c5a36fe 100644 --- a/packages/service/commenting/demo.http +++ b/packages/service/commenting/demo.http @@ -16,17 +16,17 @@ Content-Type: application/json } ### Add reply comment -PUT {{apiUrl}}/?path=product/test +PUT {{apiUrl}}/?storage=product/test Authorization: Bearer {{token}} Content-Type: application/json { - "userName": "njfamirm", + "user": "njfamirm", "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", "replyId": "5" } ### Get all comment -GET {{apiUrl}}/all?path=product/test +GET {{apiUrl}}/all?storage=product/test Authorization: Bearer {{token}} Content-Type: application/json diff --git a/packages/service/commenting/src/lib/storage.ts b/packages/service/commenting/src/lib/storage.ts index 8dcf38807..4f8d0e074 100644 --- a/packages/service/commenting/src/lib/storage.ts +++ b/packages/service/commenting/src/lib/storage.ts @@ -1,6 +1,6 @@ import {AlwatrStorageClient} from '@alwatr/storage-client'; import {config} from './config.js'; -import {Comment} from './type.js'; +import {Message} from './type.js'; -export const storage = new AlwatrStorageClient(config.storage); +export const storage = new AlwatrStorageClient(config.storage); diff --git a/packages/service/commenting/src/lib/type.ts b/packages/service/commenting/src/lib/type.ts index 4f64e649e..aef77102e 100644 --- a/packages/service/commenting/src/lib/type.ts +++ b/packages/service/commenting/src/lib/type.ts @@ -1,7 +1,18 @@ -import {AlwatrDocumentObject} from '@alwatr/storage-engine'; +import {AlwatrDocumentObject} from '@alwatr/storage-client'; -export type Comment = AlwatrDocumentObject & { - userId: string; - text: string; +type CommonMessage = AlwatrDocumentObject & { + user: unknown; replyId?: string; -} +}; + +export type TextMessage = CommonMessage & { + type: 'text'; + text: string; +}; + +export type PhotoMessage = CommonMessage & { + type: 'photo'; + photo: Record; +}; + +export type Message = TextMessage | PhotoMessage; diff --git a/packages/service/commenting/src/route/all.ts b/packages/service/commenting/src/route/all.ts index 5d7d86bd1..e37a6c660 100644 --- a/packages/service/commenting/src/route/all.ts +++ b/packages/service/commenting/src/route/all.ts @@ -11,10 +11,10 @@ async function getAllComment(connection: AlwatrConnection): Promise { const token = connection.requireToken(config.nanoServer.token); if (token == null) return; - const params = connection.requireQueryParams<{path: string}>({path: 'string'}); + const params = connection.requireQueryParams<{storage: string}>({storage: 'string'}); if (params == null) return; - storage.config.name = params.path; + storage.config.name = params.storage; try { connection.reply({ diff --git a/packages/service/commenting/src/route/put.ts b/packages/service/commenting/src/route/put.ts index 9d3863778..01cfc5b5c 100644 --- a/packages/service/commenting/src/route/put.ts +++ b/packages/service/commenting/src/route/put.ts @@ -1,7 +1,7 @@ import {config, logger} from '../lib/config.js'; import {nanoServer} from '../lib/nano-server.js'; import {storage} from '../lib/storage.js'; -import {Comment} from '../lib/type.js'; +import {Message} from '../lib/type.js'; import type {AlwatrConnection} from '@alwatr/nano-server'; @@ -13,13 +13,13 @@ async function addComment(connection: AlwatrConnection): Promise { if (token == null) return; - const params = connection.requireQueryParams<{path: string}>({path: 'string'}); + const params = connection.requireQueryParams<{storage: string}>({storage: 'string'}); if (params == null) return; - const bodyJson = await connection.requireJsonBody(); + const bodyJson = await connection.requireJsonBody(); if (bodyJson == null) return; - storage.config.name = params.path; + storage.config.name = params.storage; // check reply id exists if (bodyJson.replyId !== undefined && !(await storage.has(bodyJson.replyId))) { From 3c0d89353aa4a537a67290c787fa78cb8df47d9e Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Tue, 6 Dec 2022 16:33:42 +0330 Subject: [PATCH 25/39] chore(commenting): rename to comment --- .github/workflows/publish-container.yml | 6 +++--- packages/service/{commenting => comment}/.dockerignore | 0 packages/service/{commenting => comment}/Dockerfile | 0 packages/service/comment/README.md | 7 +++++++ packages/service/{commenting => comment}/demo.http | 0 packages/service/{commenting => comment}/package.json | 10 +++++----- packages/service/{commenting => comment}/src/index.ts | 0 .../service/{commenting => comment}/src/lib/config.ts | 0 .../{commenting => comment}/src/lib/nano-server.ts | 0 .../service/{commenting => comment}/src/lib/storage.ts | 0 .../service/{commenting => comment}/src/lib/type.ts | 0 .../service/{commenting => comment}/src/route/all.ts | 0 .../service/{commenting => comment}/src/route/home.ts | 2 +- .../service/{commenting => comment}/src/route/put.ts | 0 packages/service/{commenting => comment}/tsconfig.json | 0 packages/service/commenting/README.md | 7 ------- 16 files changed, 16 insertions(+), 16 deletions(-) rename packages/service/{commenting => comment}/.dockerignore (100%) rename packages/service/{commenting => comment}/Dockerfile (100%) create mode 100644 packages/service/comment/README.md rename packages/service/{commenting => comment}/demo.http (100%) rename packages/service/{commenting => comment}/package.json (92%) rename packages/service/{commenting => comment}/src/index.ts (100%) rename packages/service/{commenting => comment}/src/lib/config.ts (100%) rename packages/service/{commenting => comment}/src/lib/nano-server.ts (100%) rename packages/service/{commenting => comment}/src/lib/storage.ts (100%) rename packages/service/{commenting => comment}/src/lib/type.ts (100%) rename packages/service/{commenting => comment}/src/route/all.ts (100%) rename packages/service/{commenting => comment}/src/route/home.ts (79%) rename packages/service/{commenting => comment}/src/route/put.ts (100%) rename packages/service/{commenting => comment}/tsconfig.json (100%) delete mode 100644 packages/service/commenting/README.md diff --git a/.github/workflows/publish-container.yml b/.github/workflows/publish-container.yml index d1fae26ce..c7d069347 100644 --- a/.github/workflows/publish-container.yml +++ b/.github/workflows/publish-container.yml @@ -57,9 +57,9 @@ jobs: short: 0 full: 0.24.1 - - image: commenting - path: service/commenting - description: Elegant powerful nodejs server for commenting microservice, written in tiny TypeScript module. + - image: comment + path: service/comment + description: Elegant powerful nodejs server for comment microservice, written in tiny TypeScript module. version: short: 0 full: 0.24.1 diff --git a/packages/service/commenting/.dockerignore b/packages/service/comment/.dockerignore similarity index 100% rename from packages/service/commenting/.dockerignore rename to packages/service/comment/.dockerignore diff --git a/packages/service/commenting/Dockerfile b/packages/service/comment/Dockerfile similarity index 100% rename from packages/service/commenting/Dockerfile rename to packages/service/comment/Dockerfile diff --git a/packages/service/comment/README.md b/packages/service/comment/README.md new file mode 100644 index 000000000..b70020f9c --- /dev/null +++ b/packages/service/comment/README.md @@ -0,0 +1,7 @@ +# Comment Service + +Elegant powerful nodejs server for comment microservice, written in tiny TypeScript module. + +## How to use + +Check [demo.http](demo.http). diff --git a/packages/service/commenting/demo.http b/packages/service/comment/demo.http similarity index 100% rename from packages/service/commenting/demo.http rename to packages/service/comment/demo.http diff --git a/packages/service/commenting/package.json b/packages/service/comment/package.json similarity index 92% rename from packages/service/commenting/package.json rename to packages/service/comment/package.json index 8213e5079..91eae2b30 100644 --- a/packages/service/commenting/package.json +++ b/packages/service/comment/package.json @@ -1,7 +1,7 @@ { - "name": "@alwatr/commenting", + "name": "@alwatr/comment", "version": "0.24.1", - "description": "Alwatr Commenting API Microservice", + "description": "Alwatr Comment API Microservice", "type": "module", "keywords": [ "database", @@ -12,7 +12,7 @@ "api", "data", "data-storage", - "commenting", + "comment", "comment", "chat", "file", @@ -35,9 +35,9 @@ "repository": { "type": "git", "url": "https://github.com/AliMD/alwatr", - "directory": "packages/service/commenting" + "directory": "packages/service/comment" }, - "homepage": "https://github.com/AliMD/alwatr/tree/main/packages/service/commenting#readme", + "homepage": "https://github.com/AliMD/alwatr/tree/main/packages/service/comment#readme", "bugs": { "url": "https://github.com/AliMD/alwatr/issues" }, diff --git a/packages/service/commenting/src/index.ts b/packages/service/comment/src/index.ts similarity index 100% rename from packages/service/commenting/src/index.ts rename to packages/service/comment/src/index.ts diff --git a/packages/service/commenting/src/lib/config.ts b/packages/service/comment/src/lib/config.ts similarity index 100% rename from packages/service/commenting/src/lib/config.ts rename to packages/service/comment/src/lib/config.ts diff --git a/packages/service/commenting/src/lib/nano-server.ts b/packages/service/comment/src/lib/nano-server.ts similarity index 100% rename from packages/service/commenting/src/lib/nano-server.ts rename to packages/service/comment/src/lib/nano-server.ts diff --git a/packages/service/commenting/src/lib/storage.ts b/packages/service/comment/src/lib/storage.ts similarity index 100% rename from packages/service/commenting/src/lib/storage.ts rename to packages/service/comment/src/lib/storage.ts diff --git a/packages/service/commenting/src/lib/type.ts b/packages/service/comment/src/lib/type.ts similarity index 100% rename from packages/service/commenting/src/lib/type.ts rename to packages/service/comment/src/lib/type.ts diff --git a/packages/service/commenting/src/route/all.ts b/packages/service/comment/src/route/all.ts similarity index 100% rename from packages/service/commenting/src/route/all.ts rename to packages/service/comment/src/route/all.ts diff --git a/packages/service/commenting/src/route/home.ts b/packages/service/comment/src/route/home.ts similarity index 79% rename from packages/service/commenting/src/route/home.ts rename to packages/service/comment/src/route/home.ts index 404b0f687..b2ac8c184 100644 --- a/packages/service/commenting/src/route/home.ts +++ b/packages/service/comment/src/route/home.ts @@ -4,7 +4,7 @@ nanoServer.route('GET', '/', async (connection) => { connection.reply({ ok: true, data: { - app: 'Alwatr Commenting API Microservice', + app: 'Alwatr Comment API Microservice', message: 'Hello ;)', }, }); diff --git a/packages/service/commenting/src/route/put.ts b/packages/service/comment/src/route/put.ts similarity index 100% rename from packages/service/commenting/src/route/put.ts rename to packages/service/comment/src/route/put.ts diff --git a/packages/service/commenting/tsconfig.json b/packages/service/comment/tsconfig.json similarity index 100% rename from packages/service/commenting/tsconfig.json rename to packages/service/comment/tsconfig.json diff --git a/packages/service/commenting/README.md b/packages/service/commenting/README.md deleted file mode 100644 index 591a373b3..000000000 --- a/packages/service/commenting/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Commenting Service - -Elegant powerful nodejs server for commenting microservice, written in tiny TypeScript module. - -## How to use - -Check [demo.http](demo.http). From a24de65c5127186b63b5dde5475de26b94c805aa Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Tue, 6 Dec 2022 16:41:15 +0330 Subject: [PATCH 26/39] chore(comment): project description --- packages/service/comment/README.md | 2 +- packages/service/comment/demo.http | 4 ++-- packages/service/comment/package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/service/comment/README.md b/packages/service/comment/README.md index b70020f9c..9f32e57c2 100644 --- a/packages/service/comment/README.md +++ b/packages/service/comment/README.md @@ -1,6 +1,6 @@ # Comment Service -Elegant powerful nodejs server for comment microservice, written in tiny TypeScript module. +Distributed simple and fast comment nanoservice base on [@alwatr/storage-server](../storage-server/). ## How to use diff --git a/packages/service/comment/demo.http b/packages/service/comment/demo.http index d9c5a36fe..0f1674135 100644 --- a/packages/service/comment/demo.http +++ b/packages/service/comment/demo.http @@ -6,12 +6,12 @@ GET {{apiUrl}}/ ### Add comment -PUT {{apiUrl}}/?path=product/test +PUT {{apiUrl}}/?storage=product/test Authorization: Bearer {{token}} Content-Type: application/json { - "userName": "njfamirm", + "user": "njfamirm", "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." } diff --git a/packages/service/comment/package.json b/packages/service/comment/package.json index 91eae2b30..c7c1515af 100644 --- a/packages/service/comment/package.json +++ b/packages/service/comment/package.json @@ -1,7 +1,7 @@ { "name": "@alwatr/comment", "version": "0.24.1", - "description": "Alwatr Comment API Microservice", + "description": "Alwatr Comment API Microservice, Distributed simple and fast comment nanoservice base on @alwatr/storage-server", "type": "module", "keywords": [ "database", From b637cefa18ca776bcb3cd4f500460a3361f53634 Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Tue, 6 Dec 2022 16:46:07 +0330 Subject: [PATCH 27/39] chore(deps): upgrade --- demo/package.json | 2 +- package.json | 6 +-- packages/core/element/package.json | 2 +- packages/core/fetch/package.json | 2 +- packages/core/i18n/package.json | 6 +-- packages/core/nano-server/package.json | 6 +-- packages/core/router/package.json | 4 +- packages/core/signal/package.json | 2 +- packages/core/storage-client/package.json | 6 +-- packages/core/storage-engine/package.json | 4 +- packages/core/token/package.json | 4 +- packages/lab/zx-example/package.json | 2 +- packages/service/comment/package.json | 6 +-- packages/service/storage-server/package.json | 6 +-- packages/starter/nanoservice/package.json | 4 +- packages/ui/icon/package.json | 4 +- yarn.lock | 51 ++++++++++++++++++-- 17 files changed, 81 insertions(+), 36 deletions(-) diff --git a/demo/package.json b/demo/package.json index 71f9f15fc..905afc236 100644 --- a/demo/package.json +++ b/demo/package.json @@ -9,7 +9,7 @@ "MohammadMahdi Zamanian " ], "dependencies": { - "@alwatr/logger": "^0.24.1", + "@alwatr/logger": "~0.24.1", "tslib": "~2.4.1" } } diff --git a/package.json b/package.json index 2d6b27863..ba34d9c37 100644 --- a/package.json +++ b/package.json @@ -48,15 +48,15 @@ "@typescript-eslint/parser": "~5.45.0", "@typescript/lib-dom": "npm:@types/web", "@web/dev-server": "~0.1.35", - "@web/dev-server-esbuild": "^0.3.3", + "@web/dev-server-esbuild": "~0.3.3", "eslint": "~8.29.0", "eslint-config-google": "~0.14.0", "eslint-import-resolver-typescript": "~3.5.2", "eslint-plugin-import": "~2.26.0", - "eslint-plugin-lit": "^1.6.1", + "eslint-plugin-lit": "~1.6.1", "eslint-plugin-wc": "~1.4.0", "lerna": "~6.1.0", - "lit-analyzer": "^1.2.1", + "lit-analyzer": "~1.2.1", "npm-run-all": "~4.1.5", "prettier": "~2.8.0", "rimraf": "~3.0.2", diff --git a/packages/core/element/package.json b/packages/core/element/package.json index 7d970ee4f..2bfd93bfd 100644 --- a/packages/core/element/package.json +++ b/packages/core/element/package.json @@ -33,7 +33,7 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/logger": "^0.24.1", + "@alwatr/logger": "~0.24.1", "lit": "~2.4.1", "tslib": "~2.4.1" } diff --git a/packages/core/fetch/package.json b/packages/core/fetch/package.json index 716221091..59f0c01af 100644 --- a/packages/core/fetch/package.json +++ b/packages/core/fetch/package.json @@ -34,7 +34,7 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/logger": "^0.24.1", + "@alwatr/logger": "~0.24.1", "tslib": "~2.4.1" } } diff --git a/packages/core/i18n/package.json b/packages/core/i18n/package.json index 09c75a118..e87d48d69 100644 --- a/packages/core/i18n/package.json +++ b/packages/core/i18n/package.json @@ -32,9 +32,9 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/fetch": "^0.24.1", - "@alwatr/logger": "^0.24.1", - "@alwatr/signal": "^0.24.1", + "@alwatr/fetch": "~0.24.1", + "@alwatr/logger": "~0.24.1", + "@alwatr/signal": "~0.24.1", "tslib": "~2.4.1" } } diff --git a/packages/core/nano-server/package.json b/packages/core/nano-server/package.json index 5ed5ee45c..2cf24a4c9 100644 --- a/packages/core/nano-server/package.json +++ b/packages/core/nano-server/package.json @@ -31,9 +31,9 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/fetch": "^0.24.1", - "@alwatr/logger": "^0.24.1", - "@alwatr/math": "^0.24.1", + "@alwatr/fetch": "~0.24.1", + "@alwatr/logger": "~0.24.1", + "@alwatr/math": "~0.24.1", "tslib": "~2.4.1" } } diff --git a/packages/core/router/package.json b/packages/core/router/package.json index 8258cb7dd..aea3e35ac 100644 --- a/packages/core/router/package.json +++ b/packages/core/router/package.json @@ -32,8 +32,8 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/logger": "^0.24.1", - "@alwatr/signal": "^0.24.1", + "@alwatr/logger": "~0.24.1", + "@alwatr/signal": "~0.24.1", "tslib": "~2.4.1" } } diff --git a/packages/core/signal/package.json b/packages/core/signal/package.json index cd1a7078b..75a0af99e 100644 --- a/packages/core/signal/package.json +++ b/packages/core/signal/package.json @@ -32,7 +32,7 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/logger": "^0.24.1", + "@alwatr/logger": "~0.24.1", "tslib": "~2.4.1" } } diff --git a/packages/core/storage-client/package.json b/packages/core/storage-client/package.json index d19578220..ba94b45d5 100644 --- a/packages/core/storage-client/package.json +++ b/packages/core/storage-client/package.json @@ -36,9 +36,9 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/fetch": "^0.24.1", - "@alwatr/logger": "^0.24.1", - "@alwatr/storage-engine": "^0.24.1", + "@alwatr/fetch": "~0.24.1", + "@alwatr/logger": "~0.24.1", + "@alwatr/storage-engine": "~0.24.1", "tslib": "~2.4.1" } } diff --git a/packages/core/storage-engine/package.json b/packages/core/storage-engine/package.json index 721132cd0..1def8e9aa 100644 --- a/packages/core/storage-engine/package.json +++ b/packages/core/storage-engine/package.json @@ -36,8 +36,8 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/fetch": "^0.24.1", - "@alwatr/logger": "^0.24.1", + "@alwatr/fetch": "~0.24.1", + "@alwatr/logger": "~0.24.1", "exit-hook": "~3.1.2", "tslib": "~2.4.1" } diff --git a/packages/core/token/package.json b/packages/core/token/package.json index b58f40d48..4a2fcde6e 100644 --- a/packages/core/token/package.json +++ b/packages/core/token/package.json @@ -40,8 +40,8 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/logger": "^0.24.1", - "@alwatr/math": "^0.24.1", + "@alwatr/logger": "~0.24.1", + "@alwatr/math": "~0.24.1", "tslib": "~2.4.1" } } diff --git a/packages/lab/zx-example/package.json b/packages/lab/zx-example/package.json index 380c1328f..9de82eee2 100644 --- a/packages/lab/zx-example/package.json +++ b/packages/lab/zx-example/package.json @@ -34,7 +34,7 @@ "build": "chmod -v +x *.js" }, "dependencies": { - "@alwatr/logger": "^0.24.1", + "@alwatr/logger": "~0.24.1", "tslib": "~2.4.1", "zx": "~7.1.1" } diff --git a/packages/service/comment/package.json b/packages/service/comment/package.json index c7c1515af..7fbbaca85 100644 --- a/packages/service/comment/package.json +++ b/packages/service/comment/package.json @@ -67,9 +67,9 @@ "watch:ts": "yarn build:ts --watch --preserveWatchOutput" }, "dependencies": { - "@alwatr/logger": "^0.24.1", - "@alwatr/nano-server": "^0.24.1", - "@alwatr/storage-client": "^0.24.1" + "@alwatr/logger": "~0.24.1", + "@alwatr/nano-server": "~0.24.1", + "@alwatr/storage-client": "~0.24.1" }, "devDependencies": { "@types/node": "~18.11.10", diff --git a/packages/service/storage-server/package.json b/packages/service/storage-server/package.json index 89d9028cc..d91c61a85 100644 --- a/packages/service/storage-server/package.json +++ b/packages/service/storage-server/package.json @@ -60,9 +60,9 @@ "watch:ts": "yarn build:ts --watch --preserveWatchOutput" }, "dependencies": { - "@alwatr/logger": "^0.24.1", - "@alwatr/nano-server": "^0.24.1", - "@alwatr/storage-engine": "^0.24.1" + "@alwatr/logger": "~0.24.1", + "@alwatr/nano-server": "~0.24.1", + "@alwatr/storage-engine": "~0.24.1" }, "devDependencies": { "@types/node": "~18.11.10", diff --git a/packages/starter/nanoservice/package.json b/packages/starter/nanoservice/package.json index bd8570721..e825a8b7f 100644 --- a/packages/starter/nanoservice/package.json +++ b/packages/starter/nanoservice/package.json @@ -53,8 +53,8 @@ "watch:ts": "yarn build:ts --watch --preserveWatchOutput" }, "dependencies": { - "@alwatr/logger": "^0.24.1", - "@alwatr/nano-server": "^0.24.1" + "@alwatr/logger": "~0.24.1", + "@alwatr/nano-server": "~0.24.1" }, "devDependencies": { "@types/node": "~18.11.10", diff --git a/packages/ui/icon/package.json b/packages/ui/icon/package.json index 20b1f3c10..c56ecb5be 100644 --- a/packages/ui/icon/package.json +++ b/packages/ui/icon/package.json @@ -36,8 +36,8 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/element": "^0.24.1", - "@alwatr/fetch": "^0.24.1", + "@alwatr/element": "~0.24.1", + "@alwatr/fetch": "~0.24.1", "lit": "~2.4.1", "tslib": "~2.4.1" } diff --git a/yarn.lock b/yarn.lock index 8b7202592..af3083af5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1465,7 +1465,7 @@ picomatch "^2.2.2" ws "^7.4.2" -"@web/dev-server-esbuild@^0.3.3": +"@web/dev-server-esbuild@~0.3.3": version "0.3.3" resolved "https://registry.yarnpkg.com/@web/dev-server-esbuild/-/dev-server-esbuild-0.3.3.tgz#e82af2e5acec0e645b920400be9601601b3921c5" integrity sha512-hB9C8X9NsFWUG2XKT3W+Xcw3IZ/VObf4LNbK14BTjApnNyZfV6hVhSlJfvhgOoJ4DxsImfhIB5+gMRKOG9NmBw== @@ -2975,7 +2975,7 @@ eslint-plugin-import@~2.26.0: resolve "^1.22.0" tsconfig-paths "^3.14.1" -eslint-plugin-lit@^1.6.1: +eslint-plugin-lit@~1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/eslint-plugin-lit/-/eslint-plugin-lit-1.6.1.tgz#e1f51fe9e580d4095b58cc4bc4dc6b44409af6b0" integrity sha512-BpPoWVhf8dQ/Sz5Pi9NlqbGoH5BcMcVyXhi2XTx2XGMAO9U2lS+GTSsqJjI5hL3OuxCicNiUEWXazAwi9cAGxQ== @@ -3070,6 +3070,51 @@ eslint@^8.9.0, eslint@~8.29.0: strip-json-comments "^3.1.0" text-table "^0.2.0" +eslint@~8.28.0: + version "8.28.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.28.0.tgz#81a680732634677cc890134bcdd9fdfea8e63d6e" + integrity sha512-S27Di+EVyMxcHiwDrFzk8dJYAaD+/5SoWKxL1ri/71CRHsnJnRDPNt2Kzj24+MT9FDupf4aqqyqPrvI8MvQ4VQ== + dependencies: + "@eslint/eslintrc" "^1.3.3" + "@humanwhocodes/config-array" "^0.11.6" + "@humanwhocodes/module-importer" "^1.0.1" + "@nodelib/fs.walk" "^1.2.8" + ajv "^6.10.0" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + doctrine "^3.0.0" + escape-string-regexp "^4.0.0" + eslint-scope "^7.1.1" + eslint-utils "^3.0.0" + eslint-visitor-keys "^3.3.0" + espree "^9.4.0" + esquery "^1.4.0" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + find-up "^5.0.0" + glob-parent "^6.0.2" + globals "^13.15.0" + grapheme-splitter "^1.0.4" + ignore "^5.2.0" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + is-path-inside "^3.0.3" + js-sdsl "^4.1.4" + js-yaml "^4.1.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.1" + regexpp "^3.2.0" + strip-ansi "^6.0.1" + strip-json-comments "^3.1.0" + text-table "^0.2.0" + espree@^9.4.0: version "9.4.1" resolved "https://registry.yarnpkg.com/espree/-/espree-9.4.1.tgz#51d6092615567a2c2cff7833445e37c28c0065bd" @@ -4641,7 +4686,7 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -lit-analyzer@1.2.1, lit-analyzer@^1.2.1: +lit-analyzer@1.2.1, lit-analyzer@~1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/lit-analyzer/-/lit-analyzer-1.2.1.tgz#725331a4019ae870dd631d4dd709d39a237161ea" integrity sha512-OEARBhDidyaQENavLbzpTKbEmu5rnAI+SdYsH4ia1BlGlLiqQXoym7uH1MaRPtwtUPbkhUfT4OBDZ+74VHc3Cg== From 2f0ca5b85241c2298efc503e5f14f994a35be484 Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Tue, 6 Dec 2022 17:07:10 +0330 Subject: [PATCH 28/39] feat(storage-client): dynamic storage name --- packages/core/storage-client/src/storage-client.ts | 13 +++++++++---- packages/core/storage-client/src/type.ts | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/core/storage-client/src/storage-client.ts b/packages/core/storage-client/src/storage-client.ts index 86ddec723..911ae1672 100644 --- a/packages/core/storage-client/src/storage-client.ts +++ b/packages/core/storage-client/src/storage-client.ts @@ -60,7 +60,7 @@ alwatrRegisteredList.push({ * console.log('delete 404: %o', (err as Error).message); * } */ -export class AlwatrStorageClient { +export class AlwatrStorageClient { protected _logger = createLogger('alwatr-storage-client:' + this.config.name, undefined, this.config.debug); /** @@ -103,18 +103,23 @@ export class AlwatrStorageClient { * } * ``` */ - async get(documentId: string): Promise { + async get( + documentId: string, + storage: string | undefined = this.config.name, + ): Promise { this._logger.logMethodArgs('get', {documentId}); + if (storage == null) throw new Error('storage_not_defined'); + const response = await fetch({ ...this.fetchOption, queryParameters: { - storage: this.config.name, + storage, id: documentId, }, }); - let content: AlwatrServiceResponse; + let content: AlwatrServiceResponse; try { content = await response.json(); } diff --git a/packages/core/storage-client/src/type.ts b/packages/core/storage-client/src/type.ts index aa98fca91..39da5218c 100644 --- a/packages/core/storage-client/src/type.ts +++ b/packages/core/storage-client/src/type.ts @@ -2,7 +2,7 @@ export type AlwatrStorageClientConfig = { /** * Storage name (like database name). */ - name: string; + name?: string; /** * Storage server host name. From 95d8a7720e472b8b23feb272b3fd86eec4cfe323 Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Tue, 6 Dec 2022 17:12:14 +0330 Subject: [PATCH 29/39] refactor(comment): storage provider --- packages/service/comment/package.json | 9 --------- packages/service/comment/src/index.ts | 2 +- packages/service/comment/src/lib/config.ts | 3 +-- packages/service/comment/src/route/all.ts | 4 +--- packages/service/comment/src/route/put.ts | 6 ++---- 5 files changed, 5 insertions(+), 19 deletions(-) diff --git a/packages/service/comment/package.json b/packages/service/comment/package.json index 7fbbaca85..14c52be01 100644 --- a/packages/service/comment/package.json +++ b/packages/service/comment/package.json @@ -4,18 +4,9 @@ "description": "Alwatr Comment API Microservice, Distributed simple and fast comment nanoservice base on @alwatr/storage-server", "type": "module", "keywords": [ - "database", - "storage", - "json", - "nosql", - "no-sql", "api", - "data", - "data-storage", - "comment", "comment", "chat", - "file", "microservice", "nanoservice", "typescript", diff --git a/packages/service/comment/src/index.ts b/packages/service/comment/src/index.ts index 63c586b81..d60085b45 100644 --- a/packages/service/comment/src/index.ts +++ b/packages/service/comment/src/index.ts @@ -3,4 +3,4 @@ import './route/put.js'; import './route/all.js'; import {logger} from './lib/config.js'; -logger.logOther('..:: Alwatr Storage Nanoservice API ::..'); +logger.logOther('..:: Alwatr Comment Nanoservice API ::..'); diff --git a/packages/service/comment/src/lib/config.ts b/packages/service/comment/src/lib/config.ts index 6f00dce95..f5232f116 100644 --- a/packages/service/comment/src/lib/config.ts +++ b/packages/service/comment/src/lib/config.ts @@ -1,6 +1,6 @@ import {createLogger} from '@alwatr/logger'; -export const logger = createLogger('storage-server'); +export const logger = createLogger('comment'); export const config = { nanoServer: { @@ -12,7 +12,6 @@ export const config = { storage: { host: process.env.STORAGE_HOST ?? '127.0.0.1', port: process.env.STORAGE_PORT != null ? +process.env.STORAGE_PORT : 9000, - name: process.env.STORAGE_NAME ?? 'comment', token: process.env.STORAGE_TOKEN ?? 'YOUR_SECRET_TOKEN', }, }; diff --git a/packages/service/comment/src/route/all.ts b/packages/service/comment/src/route/all.ts index e37a6c660..69173a1fe 100644 --- a/packages/service/comment/src/route/all.ts +++ b/packages/service/comment/src/route/all.ts @@ -14,12 +14,10 @@ async function getAllComment(connection: AlwatrConnection): Promise { const params = connection.requireQueryParams<{storage: string}>({storage: 'string'}); if (params == null) return; - storage.config.name = params.storage; - try { connection.reply({ ok: true, - data: await storage.getAll(), + data: await storage.getAll(params.storage), }); } catch (err) { diff --git a/packages/service/comment/src/route/put.ts b/packages/service/comment/src/route/put.ts index 01cfc5b5c..350d9c8cf 100644 --- a/packages/service/comment/src/route/put.ts +++ b/packages/service/comment/src/route/put.ts @@ -19,17 +19,15 @@ async function addComment(connection: AlwatrConnection): Promise { const bodyJson = await connection.requireJsonBody(); if (bodyJson == null) return; - storage.config.name = params.storage; - // check reply id exists - if (bodyJson.replyId !== undefined && !(await storage.has(bodyJson.replyId))) { + if (bodyJson.replyId !== undefined && !(await storage.has(bodyJson.replyId, params.storage))) { delete(bodyJson.replyId); } try { connection.reply({ ok: true, - data: await storage.set({...bodyJson, id: 'auto_increment'}), + data: await storage.set({...bodyJson, id: 'auto_increment'}, params.storage), }); } catch (err) { From 07cf5fb2086d1f8ad0f731470a5dfb313038b51c Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Tue, 6 Dec 2022 17:44:07 +0330 Subject: [PATCH 30/39] feat(storage-client): dynamic storage name --- .../core/storage-client/src/storage-client.ts | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/packages/core/storage-client/src/storage-client.ts b/packages/core/storage-client/src/storage-client.ts index 911ae1672..02ba5f325 100644 --- a/packages/core/storage-client/src/storage-client.ts +++ b/packages/core/storage-client/src/storage-client.ts @@ -150,14 +150,16 @@ export class AlwatrStorageClient { + async has(documentId: string, storage: string | undefined = this.config.name): Promise { this._logger.logMethodArgs('has', {documentId}); + if (storage == null) throw new Error('storage_not_defined'); + const response = await fetch({ ...this.fetchOption, url: this.fetchOption.url + 'has', queryParameters: { - storage: this.config.name, + storage, id: documentId, }, }); @@ -192,19 +194,24 @@ export class AlwatrStorageClient { + async set( + documentObject: T, + storage: string | undefined = this.config.name, + ): Promise { this._logger.logMethodArgs('set', {documentId: documentObject.id}); + if (storage == null) throw new Error('storage_not_defined'); + const response = await fetch({ ...this.fetchOption, method: 'PATCH', queryParameters: { - storage: this.config.name, + storage, }, bodyJson: documentObject, }); - let content: AlwatrServiceResponse; + let content: AlwatrServiceResponse; try { content = await response.json(); } @@ -229,14 +236,16 @@ export class AlwatrStorageClient { + async delete(documentId: string, storage: string | undefined = this.config.name): Promise { this._logger.logMethodArgs('delete', {documentId}); + if (storage == null) throw new Error('storage_not_defined'); + const response = await fetch({ ...this.fetchOption, method: 'DELETE', queryParameters: { - storage: this.config.name, + storage, id: documentId, }, }); @@ -269,18 +278,22 @@ export class AlwatrStorageClient> { + async getAll( + storage: string | undefined = this.config.name, + ): Promise> { this._logger.logMethod('getAll'); + if (storage == null) throw new Error('storage_not_defined'); + const response = await fetch({ ...this.fetchOption, url: this.fetchOption.url + 'all', queryParameters: { - storage: this.config.name, + storage, }, }); - let content: AlwatrServiceResponse>; + let content: AlwatrServiceResponse>; try { content = await response.json(); } @@ -305,14 +318,16 @@ export class AlwatrStorageClient> { + async keys(storage?: string): Promise> { this._logger.logMethod('keys'); + if (storage == null) throw new Error('storage_not_defined'); + const response = await fetch({ ...this.fetchOption, url: this.fetchOption.url + 'keys', queryParameters: { - storage: this.config.name, + storage, }, }); From 3115a5e8f0c85255394239c521cc1caea883ea0c Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Tue, 6 Dec 2022 17:54:04 +0330 Subject: [PATCH 31/39] refactor(comment): review and fix --- packages/service/comment/demo.http | 20 +++++++++++-------- packages/service/comment/src/index.ts | 2 +- packages/service/comment/src/route/all.ts | 1 + .../comment/src/route/{put.ts => patch.ts} | 20 ++++++++++--------- 4 files changed, 25 insertions(+), 18 deletions(-) rename packages/service/comment/src/route/{put.ts => patch.ts} (65%) diff --git a/packages/service/comment/demo.http b/packages/service/comment/demo.http index 0f1674135..76abeac17 100644 --- a/packages/service/comment/demo.http +++ b/packages/service/comment/demo.http @@ -5,25 +5,29 @@ ### home GET {{apiUrl}}/ -### Add comment -PUT {{apiUrl}}/?storage=product/test +### Add new comment +PATCH {{apiUrl}}/?storage=product/test Authorization: Bearer {{token}} Content-Type: application/json { + "id": "auto_increment", "user": "njfamirm", - "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." + "type": "text", + "text": "سلام ;)" } -### Add reply comment -PUT {{apiUrl}}/?storage=product/test +### Add new reply +PATCH {{apiUrl}}/?storage=product/test Authorization: Bearer {{token}} Content-Type: application/json { - "user": "njfamirm", - "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", - "replyId": "5" + "id": "auto_increment", + "user": "alimd", + "type": "text", + "text": "علیک سلام :)", + "replyId": "1" } ### Get all comment diff --git a/packages/service/comment/src/index.ts b/packages/service/comment/src/index.ts index d60085b45..8e19684d1 100644 --- a/packages/service/comment/src/index.ts +++ b/packages/service/comment/src/index.ts @@ -1,5 +1,5 @@ import './route/home.js'; -import './route/put.js'; +import './route/patch.js'; import './route/all.js'; import {logger} from './lib/config.js'; diff --git a/packages/service/comment/src/route/all.ts b/packages/service/comment/src/route/all.ts index 69173a1fe..5fd1f7895 100644 --- a/packages/service/comment/src/route/all.ts +++ b/packages/service/comment/src/route/all.ts @@ -8,6 +8,7 @@ nanoServer.route('GET', '/all', getAllComment); async function getAllComment(connection: AlwatrConnection): Promise { logger.logMethod('getAllComment'); + const token = connection.requireToken(config.nanoServer.token); if (token == null) return; diff --git a/packages/service/comment/src/route/put.ts b/packages/service/comment/src/route/patch.ts similarity index 65% rename from packages/service/comment/src/route/put.ts rename to packages/service/comment/src/route/patch.ts index 350d9c8cf..5943baa18 100644 --- a/packages/service/comment/src/route/put.ts +++ b/packages/service/comment/src/route/patch.ts @@ -5,12 +5,12 @@ import {Message} from '../lib/type.js'; import type {AlwatrConnection} from '@alwatr/nano-server'; -nanoServer.route('PUT', '/', addComment); +nanoServer.route('PATCH', '/', setComment); -async function addComment(connection: AlwatrConnection): Promise { - logger.logMethod('addComment'); - const token = connection.requireToken(config.nanoServer.token); +async function setComment(connection: AlwatrConnection): Promise { + logger.logMethod('setComment'); + const token = connection.requireToken(config.nanoServer.token); if (token == null) return; const params = connection.requireQueryParams<{storage: string}>({storage: 'string'}); @@ -19,19 +19,21 @@ async function addComment(connection: AlwatrConnection): Promise { const bodyJson = await connection.requireJsonBody(); if (bodyJson == null) return; + bodyJson.id ??= 'auto_increment'; + // check reply id exists - if (bodyJson.replyId !== undefined && !(await storage.has(bodyJson.replyId, params.storage))) { - delete(bodyJson.replyId); - } + // if (bodyJson.replyId !== undefined && !(await storage.has(bodyJson.replyId, params.storage))) { + // delete bodyJson.replyId; + // } try { connection.reply({ ok: true, - data: await storage.set({...bodyJson, id: 'auto_increment'}, params.storage), + data: await storage.set(bodyJson, params.storage), }); } catch (err) { - logger.error('addComment', (err as Error).message ?? 'storage_error', (err as Error).stack ?? err); + logger.error('setComment', (err as Error).message ?? 'storage_error', (err as Error).stack ?? err); connection.reply({ ok: false, statusCode: 500, From 5b6d98c82350eef6df30f420e550dd4cf356b974 Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Tue, 6 Dec 2022 18:05:57 +0330 Subject: [PATCH 32/39] fix(deps): typescipt version --- packages/service/comment/package.json | 2 +- packages/service/storage-server/package.json | 2 +- packages/starter/nanoservice/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/service/comment/package.json b/packages/service/comment/package.json index 14c52be01..e3266a649 100644 --- a/packages/service/comment/package.json +++ b/packages/service/comment/package.json @@ -74,6 +74,6 @@ "npm-run-all": "~4.1.5", "prettier": "~2.8.0", "rimraf": "~3.0.2", - "typescript": "4.9.3" + "typescript": "~4.9.3" } } diff --git a/packages/service/storage-server/package.json b/packages/service/storage-server/package.json index d91c61a85..13c883298 100644 --- a/packages/service/storage-server/package.json +++ b/packages/service/storage-server/package.json @@ -76,6 +76,6 @@ "npm-run-all": "~4.1.5", "prettier": "~2.8.0", "rimraf": "~3.0.2", - "typescript": "4.9.3" + "typescript": "~4.9.3" } } diff --git a/packages/starter/nanoservice/package.json b/packages/starter/nanoservice/package.json index e825a8b7f..186282539 100644 --- a/packages/starter/nanoservice/package.json +++ b/packages/starter/nanoservice/package.json @@ -68,6 +68,6 @@ "npm-run-all": "~4.1.5", "prettier": "~2.8.0", "rimraf": "~3.0.2", - "typescript": "4.9.3" + "typescript": "~4.9.3" } } From 20c4c4b42b1dbf14872526147edb6168b54ee44b Mon Sep 17 00:00:00 2001 From: "S. Amir Mohammad Najafi" Date: Tue, 6 Dec 2022 18:16:21 +0330 Subject: [PATCH 33/39] chore(workflow/publish-container): comment description --- .github/workflows/publish-container.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-container.yml b/.github/workflows/publish-container.yml index c7d069347..adfd36943 100644 --- a/.github/workflows/publish-container.yml +++ b/.github/workflows/publish-container.yml @@ -59,7 +59,7 @@ jobs: - image: comment path: service/comment - description: Elegant powerful nodejs server for comment microservice, written in tiny TypeScript module. + description: Distributed simple and fast comment nanoservice base on @alwatr/storage-server version: short: 0 full: 0.24.1 From 892b48a40dc82c2ec06eff37fcbbe48f4cf85aa3 Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Tue, 6 Dec 2022 18:49:04 +0330 Subject: [PATCH 34/39] chore(vscode): clean unnecessary extension --- .vscode/extensions.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index dbf009515..55aee85f0 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,13 +1,10 @@ { "recommendations": [ - "bierner.lit-html", "christian-kohler.path-intellisense", "davidanson.vscode-markdownlint", "dbaeumer.vscode-eslint", - "eamodio.gitlens", "editorconfig.editorconfig", "esbenp.prettier-vscode", - "github.vscode-pull-request-github", "humao.rest-client", "irongeek.vscode-env", "jgclark.vscode-todo-highlight", From 5ab4209316f45365b258208d85083f8c9da2b342 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Dec 2022 15:26:53 +0000 Subject: [PATCH 35/39] chore(deps-dev): bump eslint-plugin-lit from 1.6.1 to 1.7.0 Bumps [eslint-plugin-lit](https://github.com/43081j/eslint-plugin-lit) from 1.6.1 to 1.7.0. - [Release notes](https://github.com/43081j/eslint-plugin-lit/releases) - [Commits](https://github.com/43081j/eslint-plugin-lit/compare/v1.6.1...v1.7.0) --- updated-dependencies: - dependency-name: eslint-plugin-lit dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index ba34d9c37..1c842edb7 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "eslint-config-google": "~0.14.0", "eslint-import-resolver-typescript": "~3.5.2", "eslint-plugin-import": "~2.26.0", - "eslint-plugin-lit": "~1.6.1", + "eslint-plugin-lit": "~1.7.0", "eslint-plugin-wc": "~1.4.0", "lerna": "~6.1.0", "lit-analyzer": "~1.2.1", diff --git a/yarn.lock b/yarn.lock index af3083af5..ea6b87b73 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2975,10 +2975,10 @@ eslint-plugin-import@~2.26.0: resolve "^1.22.0" tsconfig-paths "^3.14.1" -eslint-plugin-lit@~1.6.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-lit/-/eslint-plugin-lit-1.6.1.tgz#e1f51fe9e580d4095b58cc4bc4dc6b44409af6b0" - integrity sha512-BpPoWVhf8dQ/Sz5Pi9NlqbGoH5BcMcVyXhi2XTx2XGMAO9U2lS+GTSsqJjI5hL3OuxCicNiUEWXazAwi9cAGxQ== +eslint-plugin-lit@~1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-lit/-/eslint-plugin-lit-1.7.0.tgz#3304c3b8bdae4792c766a5635011adf942c4e094" + integrity sha512-V9cflbK3qn91BKZsqjfU0KX2bXv36VtVAty9k7D+SauR1mvmEaZpmEDT74H1PDdsuFQG+0fmoU/ufhPYlAhJxA== dependencies: parse5 "^6.0.1" parse5-htmlparser2-tree-adapter "^6.0.1" @@ -6951,7 +6951,7 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== -typescript@4.9.3, "typescript@^3 || ^4", typescript@~4.9.3: +"typescript@^3 || ^4", typescript@~4.9.3: version "4.9.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.3.tgz#3aea307c1746b8c384435d8ac36b8a2e580d85db" integrity sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA== From 836a235f51b67fb570aded1ef501c7e73116ae03 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Dec 2022 15:32:12 +0000 Subject: [PATCH 36/39] chore(deps-dev): bump @typescript-eslint/eslint-plugin Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.45.0 to 5.45.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.45.1/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package.json | 2 +- packages/service/comment/package.json | 2 +- packages/service/storage-server/package.json | 2 +- packages/starter/nanoservice/package.json | 2 +- yarn.lock | 76 ++++++++++++++------ 5 files changed, 59 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 1c842edb7..48008f4ef 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ }, "devDependencies": { "@microsoft/eslint-formatter-sarif": "~3.0.0", - "@typescript-eslint/eslint-plugin": "~5.45.0", + "@typescript-eslint/eslint-plugin": "~5.45.1", "@typescript-eslint/parser": "~5.45.0", "@typescript/lib-dom": "npm:@types/web", "@web/dev-server": "~0.1.35", diff --git a/packages/service/comment/package.json b/packages/service/comment/package.json index e3266a649..2a752b07b 100644 --- a/packages/service/comment/package.json +++ b/packages/service/comment/package.json @@ -64,7 +64,7 @@ }, "devDependencies": { "@types/node": "~18.11.10", - "@typescript-eslint/eslint-plugin": "~5.45.0", + "@typescript-eslint/eslint-plugin": "~5.45.1", "@typescript-eslint/parser": "~5.45.0", "eslint": "~8.28.0", "eslint-config-google": "~0.14.0", diff --git a/packages/service/storage-server/package.json b/packages/service/storage-server/package.json index 13c883298..bb947c76d 100644 --- a/packages/service/storage-server/package.json +++ b/packages/service/storage-server/package.json @@ -66,7 +66,7 @@ }, "devDependencies": { "@types/node": "~18.11.10", - "@typescript-eslint/eslint-plugin": "~5.45.0", + "@typescript-eslint/eslint-plugin": "~5.45.1", "@typescript-eslint/parser": "~5.45.0", "eslint": "~8.29.0", "eslint-config-google": "~0.14.0", diff --git a/packages/starter/nanoservice/package.json b/packages/starter/nanoservice/package.json index 186282539..342cc563a 100644 --- a/packages/starter/nanoservice/package.json +++ b/packages/starter/nanoservice/package.json @@ -58,7 +58,7 @@ }, "devDependencies": { "@types/node": "~18.11.10", - "@typescript-eslint/eslint-plugin": "~5.45.0", + "@typescript-eslint/eslint-plugin": "~5.45.1", "@typescript-eslint/parser": "~5.45.0", "eslint": "~8.29.0", "eslint-config-google": "~0.14.0", diff --git a/yarn.lock b/yarn.lock index ea6b87b73..b37931c39 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1346,14 +1346,14 @@ dependencies: "@types/node" "*" -"@typescript-eslint/eslint-plugin@~5.45.0": - version "5.45.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.45.0.tgz#ffa505cf961d4844d38cfa19dcec4973a6039e41" - integrity sha512-CXXHNlf0oL+Yg021cxgOdMHNTXD17rHkq7iW6RFHoybdFgQBjU3yIXhhcPpGwr1CjZlo6ET8C6tzX5juQoXeGA== - dependencies: - "@typescript-eslint/scope-manager" "5.45.0" - "@typescript-eslint/type-utils" "5.45.0" - "@typescript-eslint/utils" "5.45.0" +"@typescript-eslint/eslint-plugin@~5.45.1": + version "5.45.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.45.1.tgz#ee5b51405f6c9ee7e60e4006d68c69450d3b4536" + integrity sha512-cOizjPlKEh0bXdFrBLTrI/J6B/QMlhwE9auOov53tgB+qMukH6/h8YAK/qw+QJGct/PTbdh2lytGyipxCcEtAw== + dependencies: + "@typescript-eslint/scope-manager" "5.45.1" + "@typescript-eslint/type-utils" "5.45.1" + "@typescript-eslint/utils" "5.45.1" debug "^4.3.4" ignore "^5.2.0" natural-compare-lite "^1.4.0" @@ -1379,13 +1379,21 @@ "@typescript-eslint/types" "5.45.0" "@typescript-eslint/visitor-keys" "5.45.0" -"@typescript-eslint/type-utils@5.45.0": - version "5.45.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.45.0.tgz#aefbc954c40878fcebeabfb77d20d84a3da3a8b2" - integrity sha512-DY7BXVFSIGRGFZ574hTEyLPRiQIvI/9oGcN8t1A7f6zIs6ftbrU0nhyV26ZW//6f85avkwrLag424n+fkuoJ1Q== +"@typescript-eslint/scope-manager@5.45.1": + version "5.45.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.45.1.tgz#5b87d025eec7035d879b99c260f03be5c247883c" + integrity sha512-D6fCileR6Iai7E35Eb4Kp+k0iW7F1wxXYrOhX/3dywsOJpJAQ20Fwgcf+P/TDtvQ7zcsWsrJaglaQWDhOMsspQ== dependencies: - "@typescript-eslint/typescript-estree" "5.45.0" - "@typescript-eslint/utils" "5.45.0" + "@typescript-eslint/types" "5.45.1" + "@typescript-eslint/visitor-keys" "5.45.1" + +"@typescript-eslint/type-utils@5.45.1": + version "5.45.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.45.1.tgz#cb7d300c3c95802cea9f87c7f8be363cf8f8538c" + integrity sha512-aosxFa+0CoYgYEl3aptLe1svP910DJq68nwEJzyQcrtRhC4BN0tJAvZGAe+D0tzjJmFXe+h4leSsiZhwBa2vrA== + dependencies: + "@typescript-eslint/typescript-estree" "5.45.1" + "@typescript-eslint/utils" "5.45.1" debug "^4.3.4" tsutils "^3.21.0" @@ -1394,6 +1402,11 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.45.0.tgz#794760b9037ee4154c09549ef5a96599621109c5" integrity sha512-QQij+u/vgskA66azc9dCmx+rev79PzX8uDHpsqSjEFtfF2gBUTRCpvYMh2gw2ghkJabNkPlSUCimsyBEQZd1DA== +"@typescript-eslint/types@5.45.1": + version "5.45.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.45.1.tgz#8e1883041cee23f1bb7e1343b0139f97f6a17c14" + integrity sha512-HEW3U0E5dLjUT+nk7b4lLbOherS1U4ap+b9pfu2oGsW3oPu7genRaY9dDv3nMczC1rbnRY2W/D7SN05wYoGImg== + "@typescript-eslint/typescript-estree@5.45.0": version "5.45.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.45.0.tgz#f70a0d646d7f38c0dfd6936a5e171a77f1e5291d" @@ -1407,16 +1420,29 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/utils@5.45.0": - version "5.45.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.45.0.tgz#9cca2996eee1b8615485a6918a5c763629c7acf5" - integrity sha512-OUg2JvsVI1oIee/SwiejTot2OxwU8a7UfTFMOdlhD2y+Hl6memUSL4s98bpUTo8EpVEr0lmwlU7JSu/p2QpSvA== +"@typescript-eslint/typescript-estree@5.45.1": + version "5.45.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.45.1.tgz#b3dc37f0c4f0fe73e09917fc735e6f96eabf9ba4" + integrity sha512-76NZpmpCzWVrrb0XmYEpbwOz/FENBi+5W7ipVXAsG3OoFrQKJMiaqsBMbvGRyLtPotGqUfcY7Ur8j0dksDJDng== + dependencies: + "@typescript-eslint/types" "5.45.1" + "@typescript-eslint/visitor-keys" "5.45.1" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" + +"@typescript-eslint/utils@5.45.1": + version "5.45.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.45.1.tgz#39610c98bde82c4792f2a858b29b7d0053448be2" + integrity sha512-rlbC5VZz68+yjAzQBc4I7KDYVzWG2X/OrqoZrMahYq3u8FFtmQYc+9rovo/7wlJH5kugJ+jQXV5pJMnofGmPRw== dependencies: "@types/json-schema" "^7.0.9" "@types/semver" "^7.3.12" - "@typescript-eslint/scope-manager" "5.45.0" - "@typescript-eslint/types" "5.45.0" - "@typescript-eslint/typescript-estree" "5.45.0" + "@typescript-eslint/scope-manager" "5.45.1" + "@typescript-eslint/types" "5.45.1" + "@typescript-eslint/typescript-estree" "5.45.1" eslint-scope "^5.1.1" eslint-utils "^3.0.0" semver "^7.3.7" @@ -1429,6 +1455,14 @@ "@typescript-eslint/types" "5.45.0" eslint-visitor-keys "^3.3.0" +"@typescript-eslint/visitor-keys@5.45.1": + version "5.45.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.45.1.tgz#204428430ad6a830d24c5ac87c71366a1cfe1948" + integrity sha512-cy9ln+6rmthYWjH9fmx+5FU/JDpjQb586++x2FZlveq7GdGuLLW9a2Jcst2TGekH82bXpfmRNSwP9tyEs6RjvQ== + dependencies: + "@typescript-eslint/types" "5.45.1" + eslint-visitor-keys "^3.3.0" + "@typescript/lib-dom@npm:@types/web": version "0.0.82" resolved "https://registry.yarnpkg.com/@types/web/-/web-0.0.82.tgz#b147fdebd35fb1b711be751212b2b9dc9f749cfb" From 8508f381c7fc639812c030e4ceb8d9818bd1c273 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Dec 2022 15:41:28 +0000 Subject: [PATCH 37/39] chore(deps-dev): bump @typescript-eslint/parser from 5.45.0 to 5.45.1 Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.45.0 to 5.45.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.45.1/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package.json | 2 +- packages/service/comment/package.json | 2 +- packages/service/storage-server/package.json | 2 +- packages/starter/nanoservice/package.json | 2 +- yarn.lock | 50 ++++---------------- 5 files changed, 12 insertions(+), 46 deletions(-) diff --git a/package.json b/package.json index 48008f4ef..091a9871c 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "devDependencies": { "@microsoft/eslint-formatter-sarif": "~3.0.0", "@typescript-eslint/eslint-plugin": "~5.45.1", - "@typescript-eslint/parser": "~5.45.0", + "@typescript-eslint/parser": "~5.45.1", "@typescript/lib-dom": "npm:@types/web", "@web/dev-server": "~0.1.35", "@web/dev-server-esbuild": "~0.3.3", diff --git a/packages/service/comment/package.json b/packages/service/comment/package.json index 2a752b07b..6cbcd8258 100644 --- a/packages/service/comment/package.json +++ b/packages/service/comment/package.json @@ -65,7 +65,7 @@ "devDependencies": { "@types/node": "~18.11.10", "@typescript-eslint/eslint-plugin": "~5.45.1", - "@typescript-eslint/parser": "~5.45.0", + "@typescript-eslint/parser": "~5.45.1", "eslint": "~8.28.0", "eslint-config-google": "~0.14.0", "eslint-import-resolver-typescript": "~3.5.2", diff --git a/packages/service/storage-server/package.json b/packages/service/storage-server/package.json index bb947c76d..3e019a64a 100644 --- a/packages/service/storage-server/package.json +++ b/packages/service/storage-server/package.json @@ -67,7 +67,7 @@ "devDependencies": { "@types/node": "~18.11.10", "@typescript-eslint/eslint-plugin": "~5.45.1", - "@typescript-eslint/parser": "~5.45.0", + "@typescript-eslint/parser": "~5.45.1", "eslint": "~8.29.0", "eslint-config-google": "~0.14.0", "eslint-import-resolver-typescript": "~3.5.2", diff --git a/packages/starter/nanoservice/package.json b/packages/starter/nanoservice/package.json index 342cc563a..daeb5c536 100644 --- a/packages/starter/nanoservice/package.json +++ b/packages/starter/nanoservice/package.json @@ -59,7 +59,7 @@ "devDependencies": { "@types/node": "~18.11.10", "@typescript-eslint/eslint-plugin": "~5.45.1", - "@typescript-eslint/parser": "~5.45.0", + "@typescript-eslint/parser": "~5.45.1", "eslint": "~8.29.0", "eslint-config-google": "~0.14.0", "eslint-import-resolver-typescript": "~3.5.2", diff --git a/yarn.lock b/yarn.lock index b37931c39..5597b0e44 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1361,23 +1361,15 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/parser@~5.45.0": - version "5.45.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.45.0.tgz#b18a5f6b3cf1c2b3e399e9d2df4be40d6b0ddd0e" - integrity sha512-brvs/WSM4fKUmF5Ot/gEve6qYiCMjm6w4HkHPfS6ZNmxTS0m0iNN4yOChImaCkqc1hRwFGqUyanMXuGal6oyyQ== - dependencies: - "@typescript-eslint/scope-manager" "5.45.0" - "@typescript-eslint/types" "5.45.0" - "@typescript-eslint/typescript-estree" "5.45.0" - debug "^4.3.4" - -"@typescript-eslint/scope-manager@5.45.0": - version "5.45.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.45.0.tgz#7a4ac1bfa9544bff3f620ab85947945938319a96" - integrity sha512-noDMjr87Arp/PuVrtvN3dXiJstQR1+XlQ4R1EvzG+NMgXi8CuMCXpb8JqNtFHKceVSQ985BZhfRdowJzbv4yKw== +"@typescript-eslint/parser@~5.45.1": + version "5.45.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.45.1.tgz#6440ec283fa1373a12652d4e2fef4cb6e7b7e8c6" + integrity sha512-JQ3Ep8bEOXu16q0ztsatp/iQfDCtvap7sp/DKo7DWltUquj5AfCOpX2zSzJ8YkAVnrQNqQ5R62PBz2UtrfmCkA== dependencies: - "@typescript-eslint/types" "5.45.0" - "@typescript-eslint/visitor-keys" "5.45.0" + "@typescript-eslint/scope-manager" "5.45.1" + "@typescript-eslint/types" "5.45.1" + "@typescript-eslint/typescript-estree" "5.45.1" + debug "^4.3.4" "@typescript-eslint/scope-manager@5.45.1": version "5.45.1" @@ -1397,29 +1389,11 @@ debug "^4.3.4" tsutils "^3.21.0" -"@typescript-eslint/types@5.45.0": - version "5.45.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.45.0.tgz#794760b9037ee4154c09549ef5a96599621109c5" - integrity sha512-QQij+u/vgskA66azc9dCmx+rev79PzX8uDHpsqSjEFtfF2gBUTRCpvYMh2gw2ghkJabNkPlSUCimsyBEQZd1DA== - "@typescript-eslint/types@5.45.1": version "5.45.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.45.1.tgz#8e1883041cee23f1bb7e1343b0139f97f6a17c14" integrity sha512-HEW3U0E5dLjUT+nk7b4lLbOherS1U4ap+b9pfu2oGsW3oPu7genRaY9dDv3nMczC1rbnRY2W/D7SN05wYoGImg== -"@typescript-eslint/typescript-estree@5.45.0": - version "5.45.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.45.0.tgz#f70a0d646d7f38c0dfd6936a5e171a77f1e5291d" - integrity sha512-maRhLGSzqUpFcZgXxg1qc/+H0bT36lHK4APhp0AEUVrpSwXiRAomm/JGjSG+kNUio5kAa3uekCYu/47cnGn5EQ== - dependencies: - "@typescript-eslint/types" "5.45.0" - "@typescript-eslint/visitor-keys" "5.45.0" - debug "^4.3.4" - globby "^11.1.0" - is-glob "^4.0.3" - semver "^7.3.7" - tsutils "^3.21.0" - "@typescript-eslint/typescript-estree@5.45.1": version "5.45.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.45.1.tgz#b3dc37f0c4f0fe73e09917fc735e6f96eabf9ba4" @@ -1447,14 +1421,6 @@ eslint-utils "^3.0.0" semver "^7.3.7" -"@typescript-eslint/visitor-keys@5.45.0": - version "5.45.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.45.0.tgz#e0d160e9e7fdb7f8da697a5b78e7a14a22a70528" - integrity sha512-jc6Eccbn2RtQPr1s7th6jJWQHBHI6GBVQkCHoJFQ5UreaKm59Vxw+ynQUPPY2u2Amquc+7tmEoC2G52ApsGNNg== - dependencies: - "@typescript-eslint/types" "5.45.0" - eslint-visitor-keys "^3.3.0" - "@typescript-eslint/visitor-keys@5.45.1": version "5.45.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.45.1.tgz#204428430ad6a830d24c5ac87c71366a1cfe1948" From b714e2f2637ae02406df0351e282ff803ec3bbf4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Dec 2022 15:52:32 +0000 Subject: [PATCH 38/39] chore(deps-dev): bump @types/node from 18.11.10 to 18.11.11 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 18.11.10 to 18.11.11. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- packages/service/comment/package.json | 2 +- packages/service/storage-server/package.json | 2 +- packages/starter/nanoservice/package.json | 2 +- yarn.lock | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/service/comment/package.json b/packages/service/comment/package.json index 6cbcd8258..2a111738a 100644 --- a/packages/service/comment/package.json +++ b/packages/service/comment/package.json @@ -63,7 +63,7 @@ "@alwatr/storage-client": "~0.24.1" }, "devDependencies": { - "@types/node": "~18.11.10", + "@types/node": "~18.11.11", "@typescript-eslint/eslint-plugin": "~5.45.1", "@typescript-eslint/parser": "~5.45.1", "eslint": "~8.28.0", diff --git a/packages/service/storage-server/package.json b/packages/service/storage-server/package.json index 3e019a64a..9d489e672 100644 --- a/packages/service/storage-server/package.json +++ b/packages/service/storage-server/package.json @@ -65,7 +65,7 @@ "@alwatr/storage-engine": "~0.24.1" }, "devDependencies": { - "@types/node": "~18.11.10", + "@types/node": "~18.11.11", "@typescript-eslint/eslint-plugin": "~5.45.1", "@typescript-eslint/parser": "~5.45.1", "eslint": "~8.29.0", diff --git a/packages/starter/nanoservice/package.json b/packages/starter/nanoservice/package.json index daeb5c536..182023a75 100644 --- a/packages/starter/nanoservice/package.json +++ b/packages/starter/nanoservice/package.json @@ -57,7 +57,7 @@ "@alwatr/nano-server": "~0.24.1" }, "devDependencies": { - "@types/node": "~18.11.10", + "@types/node": "~18.11.11", "@typescript-eslint/eslint-plugin": "~5.45.1", "@typescript-eslint/parser": "~5.45.1", "eslint": "~8.29.0", diff --git a/yarn.lock b/yarn.lock index 5597b0e44..213c39952 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1274,10 +1274,10 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== -"@types/node@*", "@types/node@^18.7.20", "@types/node@~18.11.10": - version "18.11.10" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.10.tgz#4c64759f3c2343b7e6c4b9caf761c7a3a05cee34" - integrity sha512-juG3RWMBOqcOuXC643OAdSA525V44cVgGV6dUDuiFtss+8Fk5x1hI93Rsld43VeJVIeqlP9I7Fn9/qaVqoEAuQ== +"@types/node@*", "@types/node@^18.7.20", "@types/node@~18.11.11": + version "18.11.11" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.11.tgz#1d455ac0211549a8409d3cdb371cd55cc971e8dc" + integrity sha512-KJ021B1nlQUBLopzZmPBVuGU9un7WJd/W4ya7Ih02B4Uwky5Nja0yGYav2EfYIk0RR2Q9oVhf60S2XR1BCWJ2g== "@types/normalize-package-data@^2.4.0": version "2.4.1" From 03cf3c146f075309527bcf1e762a589696d0ce1d Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Wed, 7 Dec 2022 13:21:52 +0330 Subject: [PATCH 39/39] release: v0.25.0 --- CHANGELOG.md | 20 ++++++++++++++++++++ demo/CHANGELOG.md | 4 ++++ demo/package.json | 4 ++-- lerna.json | 2 +- packages/core/element/CHANGELOG.md | 4 ++++ packages/core/element/package.json | 4 ++-- packages/core/fetch/CHANGELOG.md | 4 ++++ packages/core/fetch/package.json | 4 ++-- packages/core/i18n/CHANGELOG.md | 4 ++++ packages/core/i18n/package.json | 8 ++++---- packages/core/logger/CHANGELOG.md | 6 ++++++ packages/core/logger/package.json | 2 +- packages/core/math/CHANGELOG.md | 6 ++++++ packages/core/math/package.json | 2 +- packages/core/nano-server/CHANGELOG.md | 4 ++++ packages/core/nano-server/package.json | 8 ++++---- packages/core/router/CHANGELOG.md | 4 ++++ packages/core/router/package.json | 6 +++--- packages/core/signal/CHANGELOG.md | 4 ++++ packages/core/signal/package.json | 4 ++-- packages/core/storage-client/CHANGELOG.md | 7 +++++++ packages/core/storage-client/package.json | 8 ++++---- packages/core/storage-engine/CHANGELOG.md | 4 ++++ packages/core/storage-engine/package.json | 6 +++--- packages/core/token/CHANGELOG.md | 4 ++++ packages/core/token/package.json | 6 +++--- packages/lab/zx-example/CHANGELOG.md | 4 ++++ packages/lab/zx-example/package.json | 4 ++-- packages/service/comment/CHANGELOG.md | 10 ++++++++++ packages/service/comment/package.json | 8 ++++---- packages/service/storage-server/CHANGELOG.md | 6 ++++++ packages/service/storage-server/package.json | 8 ++++---- packages/starter/nanoservice/CHANGELOG.md | 6 ++++++ packages/starter/nanoservice/package.json | 6 +++--- packages/ui/font/CHANGELOG.md | 4 ++++ packages/ui/font/package.json | 2 +- packages/ui/icon/CHANGELOG.md | 4 ++++ packages/ui/icon/package.json | 6 +++--- 38 files changed, 158 insertions(+), 49 deletions(-) create mode 100644 packages/service/comment/CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md index dedf5aab2..089dd8033 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,26 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +### Bug Fixes + +- **deps:** typescipt version ([5b6d98c](https://github.com/AliMD/alwatr/commit/5b6d98c82350eef6df30f420e550dd4cf356b974)) +- **math:** UnicodeDigits type issue ([508a9b2](https://github.com/AliMD/alwatr/commit/508a9b22a792284f7b5c54d095d6212d6277dc6b)) +- web-dev-server ([98cbb53](https://github.com/AliMD/alwatr/commit/98cbb53ca98bd8905d76cd2e419b5fb1a20b53f1)) + +### Features + +- **comment:** new types ([13a0fe9](https://github.com/AliMD/alwatr/commit/13a0fe97a1f9b65fafea893a198fdea4310ddd8d)) +- **logger:** log incident in production mode ([c9b6c56](https://github.com/AliMD/alwatr/commit/c9b6c56182750444b1cced3343b02eea6a9f24c5)) +- **service/commenting:** add base nano server ([705d7b9](https://github.com/AliMD/alwatr/commit/705d7b99c2cd7369d496051538f09de35660b2df)) +- **service/commenting:** add route ([542cc52](https://github.com/AliMD/alwatr/commit/542cc529f42a9e524d0a8faa76de51011b12d655)) +- **service/commenting:** get all route ([581cebe](https://github.com/AliMD/alwatr/commit/581cebe78840237619c820f4c45aa06b87672076)) +- **service/commenting:** rename add to put route ([170af3b](https://github.com/AliMD/alwatr/commit/170af3b198347a6cbaa1f0454da9d74e15f43f4e)) +- **service/commenting:** replyId ([5629a01](https://github.com/AliMD/alwatr/commit/5629a013916d479ea6816c76b0db4ff8befcdc7c)) +- **storage-client:** dynamic storage name ([07cf5fb](https://github.com/AliMD/alwatr/commit/07cf5fb2086d1f8ad0f731470a5dfb313038b51c)) +- **storage-client:** dynamic storage name ([2f0ca5b](https://github.com/AliMD/alwatr/commit/2f0ca5b85241c2298efc503e5f14f994a35be484)) + ## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) ### Bug Fixes diff --git a/demo/CHANGELOG.md b/demo/CHANGELOG.md index 1c64d02ee..8ecfaffc3 100644 --- a/demo/CHANGELOG.md +++ b/demo/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +**Note:** Version bump only for package @alwatr/demo + ## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) **Note:** Version bump only for package @alwatr/demo diff --git a/demo/package.json b/demo/package.json index 905afc236..3608ff11d 100644 --- a/demo/package.json +++ b/demo/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/demo", - "version": "0.24.1", + "version": "0.25.0", "main": "index.js", "author": "S. Ali Mihandoost (https://ali.mihandoost.com)", "type": "module", @@ -9,7 +9,7 @@ "MohammadMahdi Zamanian " ], "dependencies": { - "@alwatr/logger": "~0.24.1", + "@alwatr/logger": "^0.25.0", "tslib": "~2.4.1" } } diff --git a/lerna.json b/lerna.json index aec8a29db..5fdbdd034 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.24.1", + "version": "0.25.0", "npmClient": "yarn", "useWorkspaces": true, "package": ["demo", "packages/*/*"], diff --git a/packages/core/element/CHANGELOG.md b/packages/core/element/CHANGELOG.md index 7f92a8640..17c2ad2f5 100644 --- a/packages/core/element/CHANGELOG.md +++ b/packages/core/element/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +**Note:** Version bump only for package @alwatr/element + ## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) **Note:** Version bump only for package @alwatr/element diff --git a/packages/core/element/package.json b/packages/core/element/package.json index 2bfd93bfd..5a423e71a 100644 --- a/packages/core/element/package.json +++ b/packages/core/element/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/element", - "version": "0.24.1", + "version": "0.25.0", "description": "Elegant powerful web component (lit-element) helper mixins written in tiny TypeScript module.", "keywords": [ "element", @@ -33,7 +33,7 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/logger": "~0.24.1", + "@alwatr/logger": "^0.25.0", "lit": "~2.4.1", "tslib": "~2.4.1" } diff --git a/packages/core/fetch/CHANGELOG.md b/packages/core/fetch/CHANGELOG.md index 797eecd1e..562347557 100644 --- a/packages/core/fetch/CHANGELOG.md +++ b/packages/core/fetch/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +**Note:** Version bump only for package @alwatr/fetch + ## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) **Note:** Version bump only for package @alwatr/fetch diff --git a/packages/core/fetch/package.json b/packages/core/fetch/package.json index 59f0c01af..4971cdf63 100644 --- a/packages/core/fetch/package.json +++ b/packages/core/fetch/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/fetch", - "version": "0.24.1", + "version": "0.25.0", "description": "Enhanced fetch API with cache strategy, retry pattern, timeout, helper methods and enhanced types written in tiny TypeScript, ES module.", "keywords": [ "fetch", @@ -34,7 +34,7 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/logger": "~0.24.1", + "@alwatr/logger": "^0.25.0", "tslib": "~2.4.1" } } diff --git a/packages/core/i18n/CHANGELOG.md b/packages/core/i18n/CHANGELOG.md index ef12c847b..5f3daf644 100644 --- a/packages/core/i18n/CHANGELOG.md +++ b/packages/core/i18n/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +**Note:** Version bump only for package @alwatr/i18n + ## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) ### Bug Fixes diff --git a/packages/core/i18n/package.json b/packages/core/i18n/package.json index e87d48d69..981fd949d 100644 --- a/packages/core/i18n/package.json +++ b/packages/core/i18n/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/i18n", - "version": "0.24.1", + "version": "0.25.0", "description": "Elegant powerful translation module (i18n/l10n) with dynamic json storage written in tiny TypeScript, ES module.", "keywords": [ "i18n", @@ -32,9 +32,9 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/fetch": "~0.24.1", - "@alwatr/logger": "~0.24.1", - "@alwatr/signal": "~0.24.1", + "@alwatr/fetch": "^0.25.0", + "@alwatr/logger": "^0.25.0", + "@alwatr/signal": "^0.25.0", "tslib": "~2.4.1" } } diff --git a/packages/core/logger/CHANGELOG.md b/packages/core/logger/CHANGELOG.md index 013839591..7aec4a7f6 100644 --- a/packages/core/logger/CHANGELOG.md +++ b/packages/core/logger/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +### Features + +- **logger:** log incident in production mode ([c9b6c56](https://github.com/AliMD/alwatr/commit/c9b6c56182750444b1cced3343b02eea6a9f24c5)) + ## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) ### Bug Fixes diff --git a/packages/core/logger/package.json b/packages/core/logger/package.json index ab3822dda..eb89df2ee 100644 --- a/packages/core/logger/package.json +++ b/packages/core/logger/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/logger", - "version": "0.24.1", + "version": "0.25.0", "description": "Fancy colorful console debugger with custom scope written in tiny TypeScript, ES module.", "keywords": [ "log", diff --git a/packages/core/math/CHANGELOG.md b/packages/core/math/CHANGELOG.md index d69d7934c..5425f7348 100644 --- a/packages/core/math/CHANGELOG.md +++ b/packages/core/math/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +### Bug Fixes + +- **math:** UnicodeDigits type issue ([508a9b2](https://github.com/AliMD/alwatr/commit/508a9b22a792284f7b5c54d095d6212d6277dc6b)) + ## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) ### Bug Fixes diff --git a/packages/core/math/package.json b/packages/core/math/package.json index ccb0a0d37..f86ae65d8 100644 --- a/packages/core/math/package.json +++ b/packages/core/math/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/math", - "version": "0.24.1", + "version": "0.25.0", "description": "Simple useful Math library written in tiny TypeScript module.", "keywords": [ "math", diff --git a/packages/core/nano-server/CHANGELOG.md b/packages/core/nano-server/CHANGELOG.md index a75d9ef75..70e5ed428 100644 --- a/packages/core/nano-server/CHANGELOG.md +++ b/packages/core/nano-server/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +**Note:** Version bump only for package @alwatr/nano-server + ## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) **Note:** Version bump only for package @alwatr/nano-server diff --git a/packages/core/nano-server/package.json b/packages/core/nano-server/package.json index 2cf24a4c9..ae78250f7 100644 --- a/packages/core/nano-server/package.json +++ b/packages/core/nano-server/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/nano-server", - "version": "0.24.1", + "version": "0.25.0", "description": "Elegant powerful nodejs server for nanoservice use cases, written in tiny TypeScript module.", "keywords": [ "server", @@ -31,9 +31,9 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/fetch": "~0.24.1", - "@alwatr/logger": "~0.24.1", - "@alwatr/math": "~0.24.1", + "@alwatr/fetch": "^0.25.0", + "@alwatr/logger": "^0.25.0", + "@alwatr/math": "^0.25.0", "tslib": "~2.4.1" } } diff --git a/packages/core/router/CHANGELOG.md b/packages/core/router/CHANGELOG.md index 0df8443d3..5904cf73d 100644 --- a/packages/core/router/CHANGELOG.md +++ b/packages/core/router/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +**Note:** Version bump only for package @alwatr/router + ## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) **Note:** Version bump only for package @alwatr/router diff --git a/packages/core/router/package.json b/packages/core/router/package.json index aea3e35ac..a84fef709 100644 --- a/packages/core/router/package.json +++ b/packages/core/router/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/router", - "version": "0.24.1", + "version": "0.25.0", "description": "Elegant powerful router (fundamental advance browser page routing) based on the simplicity of the signals written in tiny TypeScript module.", "keywords": [ "router", @@ -32,8 +32,8 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/logger": "~0.24.1", - "@alwatr/signal": "~0.24.1", + "@alwatr/logger": "^0.25.0", + "@alwatr/signal": "^0.25.0", "tslib": "~2.4.1" } } diff --git a/packages/core/signal/CHANGELOG.md b/packages/core/signal/CHANGELOG.md index c8aaaae8f..52aa9cd1e 100644 --- a/packages/core/signal/CHANGELOG.md +++ b/packages/core/signal/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +**Note:** Version bump only for package @alwatr/signal + ## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) **Note:** Version bump only for package @alwatr/signal diff --git a/packages/core/signal/package.json b/packages/core/signal/package.json index 75a0af99e..6d050ad7b 100644 --- a/packages/core/signal/package.json +++ b/packages/core/signal/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/signal", - "version": "0.24.1", + "version": "0.25.0", "description": "Elegant powerful event system for handle global signals and states written in tiny TypeScript module.", "keywords": [ "signal", @@ -32,7 +32,7 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/logger": "~0.24.1", + "@alwatr/logger": "^0.25.0", "tslib": "~2.4.1" } } diff --git a/packages/core/storage-client/CHANGELOG.md b/packages/core/storage-client/CHANGELOG.md index a185bee53..4bc8a6e4e 100644 --- a/packages/core/storage-client/CHANGELOG.md +++ b/packages/core/storage-client/CHANGELOG.md @@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +### Features + +- **storage-client:** dynamic storage name ([07cf5fb](https://github.com/AliMD/alwatr/commit/07cf5fb2086d1f8ad0f731470a5dfb313038b51c)) +- **storage-client:** dynamic storage name ([2f0ca5b](https://github.com/AliMD/alwatr/commit/2f0ca5b85241c2298efc503e5f14f994a35be484)) + ## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) **Note:** Version bump only for package @alwatr/storage-client diff --git a/packages/core/storage-client/package.json b/packages/core/storage-client/package.json index ba94b45d5..3031a67e3 100644 --- a/packages/core/storage-client/package.json +++ b/packages/core/storage-client/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/storage-client", - "version": "0.24.1", + "version": "0.25.0", "description": "Elegant micro client for storage server written in tiny TypeScript ES module.", "keywords": [ "database", @@ -36,9 +36,9 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/fetch": "~0.24.1", - "@alwatr/logger": "~0.24.1", - "@alwatr/storage-engine": "~0.24.1", + "@alwatr/fetch": "^0.25.0", + "@alwatr/logger": "^0.25.0", + "@alwatr/storage-engine": "^0.25.0", "tslib": "~2.4.1" } } diff --git a/packages/core/storage-engine/CHANGELOG.md b/packages/core/storage-engine/CHANGELOG.md index 604435a23..eaef73b4b 100644 --- a/packages/core/storage-engine/CHANGELOG.md +++ b/packages/core/storage-engine/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +**Note:** Version bump only for package @alwatr/storage-engine + ## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) **Note:** Version bump only for package @alwatr/storage-engine diff --git a/packages/core/storage-engine/package.json b/packages/core/storage-engine/package.json index 1def8e9aa..cd3765bec 100644 --- a/packages/core/storage-engine/package.json +++ b/packages/core/storage-engine/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/storage-engine", - "version": "0.24.1", + "version": "0.25.0", "description": "Elegant micro in-memory json-like storage with disk backed, Faster NoSQL Database written in tiny TypeScript ES module.", "keywords": [ "database", @@ -36,8 +36,8 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/fetch": "~0.24.1", - "@alwatr/logger": "~0.24.1", + "@alwatr/fetch": "^0.25.0", + "@alwatr/logger": "^0.25.0", "exit-hook": "~3.1.2", "tslib": "~2.4.1" } diff --git a/packages/core/token/CHANGELOG.md b/packages/core/token/CHANGELOG.md index 95dfcbec7..169e77bb8 100644 --- a/packages/core/token/CHANGELOG.md +++ b/packages/core/token/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +**Note:** Version bump only for package @alwatr/token + ## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) **Note:** Version bump only for package @alwatr/token diff --git a/packages/core/token/package.json b/packages/core/token/package.json index 4a2fcde6e..bf3d4a8d2 100644 --- a/packages/core/token/package.json +++ b/packages/core/token/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/token", - "version": "0.24.1", + "version": "0.25.0", "description": "Secure authentication HOTP token generator (the HMAC-based One-Time Password algorithm) written in tiny TypeScript module.", "keywords": [ "token", @@ -40,8 +40,8 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/logger": "~0.24.1", - "@alwatr/math": "~0.24.1", + "@alwatr/logger": "^0.25.0", + "@alwatr/math": "^0.25.0", "tslib": "~2.4.1" } } diff --git a/packages/lab/zx-example/CHANGELOG.md b/packages/lab/zx-example/CHANGELOG.md index f9e01166b..d9c1f178b 100644 --- a/packages/lab/zx-example/CHANGELOG.md +++ b/packages/lab/zx-example/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +**Note:** Version bump only for package @alwatr/zx-example + ## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) **Note:** Version bump only for package @alwatr/zx-example diff --git a/packages/lab/zx-example/package.json b/packages/lab/zx-example/package.json index 9de82eee2..8a94d6f10 100644 --- a/packages/lab/zx-example/package.json +++ b/packages/lab/zx-example/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/zx-example", - "version": "0.24.1", + "version": "0.25.0", "description": "Test google zx with typescript in action.", "keywords": [ "zx-example", @@ -34,7 +34,7 @@ "build": "chmod -v +x *.js" }, "dependencies": { - "@alwatr/logger": "~0.24.1", + "@alwatr/logger": "^0.25.0", "tslib": "~2.4.1", "zx": "~7.1.1" } diff --git a/packages/service/comment/CHANGELOG.md b/packages/service/comment/CHANGELOG.md new file mode 100644 index 000000000..498d60070 --- /dev/null +++ b/packages/service/comment/CHANGELOG.md @@ -0,0 +1,10 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +### Bug Fixes + +- **deps:** typescipt version ([5b6d98c](https://github.com/AliMD/alwatr/commit/5b6d98c82350eef6df30f420e550dd4cf356b974)) diff --git a/packages/service/comment/package.json b/packages/service/comment/package.json index 2a111738a..190bd4aa9 100644 --- a/packages/service/comment/package.json +++ b/packages/service/comment/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/comment", - "version": "0.24.1", + "version": "0.25.0", "description": "Alwatr Comment API Microservice, Distributed simple and fast comment nanoservice base on @alwatr/storage-server", "type": "module", "keywords": [ @@ -58,9 +58,9 @@ "watch:ts": "yarn build:ts --watch --preserveWatchOutput" }, "dependencies": { - "@alwatr/logger": "~0.24.1", - "@alwatr/nano-server": "~0.24.1", - "@alwatr/storage-client": "~0.24.1" + "@alwatr/logger": "^0.25.0", + "@alwatr/nano-server": "^0.25.0", + "@alwatr/storage-client": "^0.25.0" }, "devDependencies": { "@types/node": "~18.11.11", diff --git a/packages/service/storage-server/CHANGELOG.md b/packages/service/storage-server/CHANGELOG.md index 94a0ddb03..46652d0e4 100644 --- a/packages/service/storage-server/CHANGELOG.md +++ b/packages/service/storage-server/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +### Bug Fixes + +- **deps:** typescipt version ([5b6d98c](https://github.com/AliMD/alwatr/commit/5b6d98c82350eef6df30f420e550dd4cf356b974)) + ## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) ### Bug Fixes diff --git a/packages/service/storage-server/package.json b/packages/service/storage-server/package.json index 9d489e672..da6e53d0b 100644 --- a/packages/service/storage-server/package.json +++ b/packages/service/storage-server/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/storage-server", - "version": "0.24.1", + "version": "0.25.0", "description": "Alwatr Storage Server, Elegant micro in-memory json-like storage nanoservice with disk backed, Fastest NoSQL Database.", "type": "module", "keywords": [ @@ -60,9 +60,9 @@ "watch:ts": "yarn build:ts --watch --preserveWatchOutput" }, "dependencies": { - "@alwatr/logger": "~0.24.1", - "@alwatr/nano-server": "~0.24.1", - "@alwatr/storage-engine": "~0.24.1" + "@alwatr/logger": "^0.25.0", + "@alwatr/nano-server": "^0.25.0", + "@alwatr/storage-engine": "^0.25.0" }, "devDependencies": { "@types/node": "~18.11.11", diff --git a/packages/starter/nanoservice/CHANGELOG.md b/packages/starter/nanoservice/CHANGELOG.md index 7e9a5bd82..6f3f5b9d1 100644 --- a/packages/starter/nanoservice/CHANGELOG.md +++ b/packages/starter/nanoservice/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +### Bug Fixes + +- **deps:** typescipt version ([5b6d98c](https://github.com/AliMD/alwatr/commit/5b6d98c82350eef6df30f420e550dd4cf356b974)) + ## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) ### Bug Fixes diff --git a/packages/starter/nanoservice/package.json b/packages/starter/nanoservice/package.json index 182023a75..76438ffd4 100644 --- a/packages/starter/nanoservice/package.json +++ b/packages/starter/nanoservice/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/nanoservice-starter", - "version": "0.24.1", + "version": "0.25.0", "description": "Alwatr Microservice/Nanoservice Starter Kit", "type": "module", "keywords": [ @@ -53,8 +53,8 @@ "watch:ts": "yarn build:ts --watch --preserveWatchOutput" }, "dependencies": { - "@alwatr/logger": "~0.24.1", - "@alwatr/nano-server": "~0.24.1" + "@alwatr/logger": "^0.25.0", + "@alwatr/nano-server": "^0.25.0" }, "devDependencies": { "@types/node": "~18.11.11", diff --git a/packages/ui/font/CHANGELOG.md b/packages/ui/font/CHANGELOG.md index 76f335b15..d65ed8c43 100644 --- a/packages/ui/font/CHANGELOG.md +++ b/packages/ui/font/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +**Note:** Version bump only for package @alwatr/font + # [0.24.0](https://github.com/AliMD/alwatr/compare/v0.23.0...v0.24.0) (2022-11-28) **Note:** Version bump only for package @alwatr/font diff --git a/packages/ui/font/package.json b/packages/ui/font/package.json index 9545f126c..349ad9646 100644 --- a/packages/ui/font/package.json +++ b/packages/ui/font/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/font", - "version": "0.24.0", + "version": "0.25.0", "description": "Best practices (The Right Way) of using Persian/Arabic web fonts in the website and webapp.", "keywords": [ "font", diff --git a/packages/ui/icon/CHANGELOG.md b/packages/ui/icon/CHANGELOG.md index a0ef15aea..10871a0c9 100644 --- a/packages/ui/icon/CHANGELOG.md +++ b/packages/ui/icon/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [0.25.0](https://github.com/AliMD/alwatr/compare/v0.24.1...v0.25.0) (2022-12-07) + +**Note:** Version bump only for package @alwatr/icon + ## [0.24.1](https://github.com/AliMD/alwatr/compare/v0.24.0...v0.24.1) (2022-12-01) ### Bug Fixes diff --git a/packages/ui/icon/package.json b/packages/ui/icon/package.json index c56ecb5be..67ebe7a5a 100644 --- a/packages/ui/icon/package.json +++ b/packages/ui/icon/package.json @@ -1,6 +1,6 @@ { "name": "@alwatr/icon", - "version": "0.24.1", + "version": "0.25.0", "description": "Best practices (The Right Way) of using premium designed icons in the website and webapp.", "keywords": [ "icon", @@ -36,8 +36,8 @@ "url": "https://github.com/AliMD/alwatr/issues" }, "dependencies": { - "@alwatr/element": "~0.24.1", - "@alwatr/fetch": "~0.24.1", + "@alwatr/element": "^0.25.0", + "@alwatr/fetch": "^0.25.0", "lit": "~2.4.1", "tslib": "~2.4.1" }