├── notes └── README.md ├── load-test-lbs ├── .gitignore ├── Makefile ├── package.json ├── dist │ └── index.js.map └── package-lock.json ├── net-ninja ├── public │ ├── interfaces │ │ └── HasFormatter.js │ ├── classes │ │ ├── Invoice.js │ │ ├── Payment.js │ │ └── ListTemplate.js │ ├── app.js │ └── index.html └── src │ ├── interfaces │ └── HasFormatter.ts │ ├── classes │ ├── Invoice.ts │ ├── Payment.ts │ └── ListTemplate.ts │ └── app.ts ├── wallet ├── .gitignore ├── nodemon.json ├── src │ ├── interfaces │ │ ├── index.ts │ │ └── response_template.ts │ ├── configs │ │ ├── index.ts │ │ ├── db.ts │ │ └── configs.ts │ ├── middlewares │ │ ├── index.ts │ │ └── auth.ts │ ├── utils │ │ ├── index.ts │ │ ├── password.ts │ │ ├── token.ts │ │ └── response_template.ts │ ├── routers │ │ ├── index.ts │ │ ├── users.ts │ │ ├── income_expense.ts │ │ └── income_expense_type.ts │ ├── controllers │ │ └── index.ts │ └── models │ │ └── index.ts ├── postgres.Dockerfile ├── Makefile ├── dev.Dockerfile ├── .env ├── tsconfig.json ├── README.md ├── .eslintrc.json └── docker-compose.yaml ├── conductor-orchestration-shipping ├── .gitignore ├── node_modules │ ├── mime │ │ ├── .npmignore │ │ ├── cli.js │ │ └── LICENSE │ ├── .bin │ │ └── mime │ ├── qs │ │ ├── .eslintignore │ │ ├── test │ │ │ ├── index.js │ │ │ └── .eslintrc │ │ ├── lib │ │ │ ├── index.js │ │ │ └── formats.js │ │ ├── .editorconfig │ │ └── .eslintrc │ ├── debug │ │ ├── node.js │ │ ├── .coveralls.yml │ │ ├── .npmignore │ │ ├── .travis.yml │ │ ├── .eslintrc │ │ ├── src │ │ │ ├── index.js │ │ │ └── inspector-log.js │ │ ├── component.json │ │ ├── LICENSE │ │ └── Makefile │ ├── cookie-signature │ │ ├── .npmignore │ │ └── History.md │ ├── unpipe │ │ ├── HISTORY.md │ │ └── LICENSE │ ├── setprototypeof │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── LICENSE │ │ ├── test │ │ │ └── index.js │ │ └── README.md │ ├── utils-merge │ │ ├── .npmignore │ │ ├── index.js │ │ └── LICENSE │ ├── mime-db │ │ ├── index.js │ │ └── LICENSE │ ├── inherits │ │ ├── inherits.js │ │ ├── inherits_browser.js │ │ └── LICENSE │ ├── express │ │ ├── index.js │ │ ├── lib │ │ │ └── middleware │ │ │ │ ├── init.js │ │ │ │ └── query.js │ │ └── LICENSE │ ├── encodeurl │ │ ├── HISTORY.md │ │ └── LICENSE │ ├── forwarded │ │ ├── HISTORY.md │ │ └── LICENSE │ ├── depd │ │ ├── lib │ │ │ └── compat │ │ │ │ └── event-listener-count.js │ │ └── LICENSE │ ├── merge-descriptors │ │ ├── HISTORY.md │ │ └── LICENSE │ ├── content-type │ │ ├── HISTORY.md │ │ └── LICENSE │ ├── methods │ │ ├── HISTORY.md │ │ └── LICENSE │ ├── media-typer │ │ ├── HISTORY.md │ │ └── LICENSE │ ├── toidentifier │ │ ├── index.js │ │ └── LICENSE │ ├── iconv-lite │ │ ├── encodings │ │ │ ├── index.js │ │ │ └── tables │ │ │ │ └── gbk-added.json │ │ ├── lib │ │ │ └── index.d.ts │ │ └── LICENSE │ ├── path-to-regexp │ │ ├── History.md │ │ ├── LICENSE │ │ └── Readme.md │ ├── escape-html │ │ ├── Readme.md │ │ └── LICENSE │ ├── vary │ │ ├── HISTORY.md │ │ └── LICENSE │ ├── ms │ │ └── license.md │ ├── ipaddr.js │ │ └── LICENSE │ ├── safe-buffer │ │ └── LICENSE │ ├── etag │ │ └── LICENSE │ ├── send │ │ ├── node_modules │ │ │ └── ms │ │ │ │ └── license.md │ │ └── LICENSE │ ├── range-parser │ │ ├── HISTORY.md │ │ └── LICENSE │ ├── safer-buffer │ │ └── LICENSE │ ├── destroy │ │ └── LICENSE │ ├── ee-first │ │ └── LICENSE │ ├── proxy-addr │ │ └── LICENSE │ ├── array-flatten │ │ └── LICENSE │ ├── content-disposition │ │ ├── LICENSE │ │ └── HISTORY.md │ ├── finalhandler │ │ └── LICENSE │ ├── bytes │ │ └── LICENSE │ ├── accepts │ │ └── LICENSE │ ├── mime-types │ │ └── LICENSE │ ├── on-finished │ │ └── LICENSE │ ├── body-parser │ │ └── LICENSE │ ├── fresh │ │ └── LICENSE │ ├── http-errors │ │ └── LICENSE │ ├── statuses │ │ ├── LICENSE │ │ └── HISTORY.md │ ├── type-is │ │ └── LICENSE │ ├── cookie │ │ └── LICENSE │ ├── parseurl │ │ ├── LICENSE │ │ └── HISTORY.md │ ├── raw-body │ │ └── LICENSE │ ├── negotiator │ │ └── LICENSE │ └── serve-static │ │ └── LICENSE ├── .DS_Store ├── .idea │ ├── .gitignore │ ├── vcs.xml │ ├── modules.xml │ └── conductor-orchestration-shipping.iml ├── index.js └── package.json ├── setup-article-material ├── .gitignore ├── nodemon.json ├── .env ├── Dockerfile ├── Makefile ├── src │ └── index.ts ├── package.json ├── docker-compose.yaml └── .eslintrc.json ├── event-driven-microservices ├── .gitignore ├── auth │ ├── README.md │ ├── .gitignore │ ├── src │ │ ├── routes │ │ │ ├── index.ts │ │ │ └── auth.ts │ │ ├── consumer │ │ │ └── index.ts │ │ ├── publisher │ │ │ ├── index.ts │ │ │ └── publisher.ts │ │ ├── services │ │ │ └── index.ts │ │ ├── repositories │ │ │ └── index.ts │ │ ├── utils │ │ │ ├── index.ts │ │ │ ├── password.ts │ │ │ └── token.ts │ │ ├── configs │ │ │ ├── index.ts │ │ │ ├── logger.ts │ │ │ ├── database.ts │ │ │ └── configs.ts │ │ └── index.ts │ ├── nodemon.json │ ├── manifest │ │ ├── service.yaml │ │ └── deployment.yaml │ ├── Dockerfile │ ├── .eslintrc.json │ └── package.json ├── user │ ├── README.md │ ├── .gitignore │ ├── src │ │ ├── routes │ │ │ └── index.ts │ │ ├── consumer │ │ │ ├── index.ts │ │ │ └── consumer.ts │ │ ├── publisher │ │ │ ├── index.ts │ │ │ └── publisher.ts │ │ ├── services │ │ │ └── index.ts │ │ ├── middlewares │ │ │ ├── index.ts │ │ │ └── auth.ts │ │ ├── repositories │ │ │ └── index.ts │ │ ├── utils │ │ │ ├── index.ts │ │ │ ├── password.ts │ │ │ └── token.ts │ │ ├── configs │ │ │ ├── index.ts │ │ │ ├── logger.ts │ │ │ ├── database.ts │ │ │ └── configs.ts │ │ └── index.ts │ ├── nodemon.json │ ├── manifest │ │ ├── service.yaml │ │ └── deployment.yaml │ ├── Dockerfile │ └── .eslintrc.json └── README.md ├── handbook ├── event-driven-design │ ├── .gitignore │ ├── auth │ │ ├── README.md │ │ ├── .gitignore │ │ ├── src │ │ │ ├── routes │ │ │ │ ├── index.ts │ │ │ │ └── auth.ts │ │ │ ├── consumer │ │ │ │ └── index.ts │ │ │ ├── publisher │ │ │ │ ├── index.ts │ │ │ │ └── publisher.ts │ │ │ ├── services │ │ │ │ └── index.ts │ │ │ ├── repositories │ │ │ │ └── index.ts │ │ │ ├── utils │ │ │ │ ├── index.ts │ │ │ │ ├── password.ts │ │ │ │ └── token.ts │ │ │ ├── configs │ │ │ │ ├── index.ts │ │ │ │ ├── logger.ts │ │ │ │ ├── database.ts │ │ │ │ └── configs.ts │ │ │ └── index.ts │ │ ├── nodemon.json │ │ ├── manifest │ │ │ ├── service.yaml │ │ │ └── deployment.yaml │ │ ├── Dockerfile │ │ └── .eslintrc.json │ ├── user │ │ ├── README.md │ │ ├── .gitignore │ │ ├── src │ │ │ ├── routes │ │ │ │ └── index.ts │ │ │ ├── consumer │ │ │ │ ├── index.ts │ │ │ │ └── consumer.ts │ │ │ ├── publisher │ │ │ │ ├── index.ts │ │ │ │ └── publisher.ts │ │ │ ├── services │ │ │ │ └── index.ts │ │ │ ├── middlewares │ │ │ │ ├── index.ts │ │ │ │ └── auth.ts │ │ │ ├── repositories │ │ │ │ └── index.ts │ │ │ ├── utils │ │ │ │ ├── index.ts │ │ │ │ ├── password.ts │ │ │ │ └── token.ts │ │ │ ├── configs │ │ │ │ ├── index.ts │ │ │ │ ├── logger.ts │ │ │ │ ├── database.ts │ │ │ │ └── configs.ts │ │ │ └── index.ts │ │ ├── nodemon.json │ │ ├── manifest │ │ │ ├── service.yaml │ │ │ └── deployment.yaml │ │ ├── Dockerfile │ │ └── .eslintrc.json │ └── README.md ├── built │ └── basic_type.js ├── src │ └── basic_type.ts └── tsconfig.json ├── event-driven-article-material ├── auth │ ├── .gitignore │ ├── .env-example │ ├── nodemon.json │ ├── src │ │ ├── producer.ts │ │ └── index.ts │ ├── package.json │ └── .eslintrc.json ├── notification │ ├── .gitignore │ ├── .env-example │ ├── nodemon.json │ ├── src │ │ ├── index.ts │ │ └── consumer.ts │ ├── package.json │ └── .eslintrc.json ├── .vscode │ └── settings.json └── images │ ├── image1.jpg │ └── image2.jpg ├── .DS_Store ├── README.md ├── playwright-tutorial ├── .eslintrc.json ├── public │ ├── favicon.ico │ ├── vercel.svg │ ├── thirteen.svg │ └── next.svg ├── next.config.js ├── src │ └── pages │ │ ├── _app.tsx │ │ ├── _document.tsx │ │ └── api │ │ └── hello.ts ├── e2e │ └── example.spec.ts ├── .gitignore ├── tsconfig.json └── package.json └── load-testing ├── src └── index.ts ├── dist ├── index.js └── index.js.map └── package.json /notes/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /load-test-lbs/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /net-ninja/public/interfaces/HasFormatter.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wallet/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | node_modules 3 | build -------------------------------------------------------------------------------- /conductor-orchestration-shipping/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /setup-article-material/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/mime/.npmignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /event-driven-microservices/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build 3 | .env -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/.bin/mime: -------------------------------------------------------------------------------- 1 | ../mime/cli.js -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/qs/.eslintignore: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /handbook/event-driven-design/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build 3 | .env -------------------------------------------------------------------------------- /event-driven-article-material/auth/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build 3 | .env -------------------------------------------------------------------------------- /event-driven-article-material/auth/.env-example: -------------------------------------------------------------------------------- 1 | PORT= 2 | AMQP_URL= 3 | QUEUE_NAME= -------------------------------------------------------------------------------- /load-test-lbs/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | docker run -i loadimpact/k6 run - Response 2 | -------------------------------------------------------------------------------- /event-driven-article-material/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.eol": "\n", 3 | "editor.tabSize": 2, 4 | "editor.formatOnSave": true 5 | } -------------------------------------------------------------------------------- /event-driven-microservices/auth/src/publisher/index.ts: -------------------------------------------------------------------------------- 1 | import createMQPublisher from './publisher' 2 | 3 | export default createMQPublisher 4 | -------------------------------------------------------------------------------- /event-driven-microservices/user/src/publisher/index.ts: -------------------------------------------------------------------------------- 1 | import createMQPublisher from './publisher' 2 | 3 | export default createMQPublisher 4 | -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/src/publisher/index.ts: -------------------------------------------------------------------------------- 1 | import createMQPublisher from './publisher' 2 | 3 | export default createMQPublisher 4 | -------------------------------------------------------------------------------- /handbook/event-driven-design/user/src/publisher/index.ts: -------------------------------------------------------------------------------- 1 | import createMQPublisher from './publisher' 2 | 3 | export default createMQPublisher 4 | -------------------------------------------------------------------------------- /wallet/postgres.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM postgres 2 | WORKDIR /docker-entrypoint-initdb.d 3 | ADD ./sql/script.sql /docker-entrypoint-initdb.d 4 | EXPOSE 5432 -------------------------------------------------------------------------------- /conductor-orchestration-shipping/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agusrichard/typescript-workbook/HEAD/conductor-orchestration-shipping/.DS_Store -------------------------------------------------------------------------------- /event-driven-microservices/auth/nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "watch": ["src"], 3 | "ext": "ts, json", 4 | "exec": "tsc && node ./build/index.js" 5 | } -------------------------------------------------------------------------------- /event-driven-microservices/user/nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "watch": ["src"], 3 | "ext": "ts, json", 4 | "exec": "tsc && node ./build/index.js" 5 | } -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "watch": ["src"], 3 | "ext": "ts, json", 4 | "exec": "tsc && node ./build/index.js" 5 | } -------------------------------------------------------------------------------- /handbook/event-driven-design/user/nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "watch": ["src"], 3 | "ext": "ts, json", 4 | "exec": "tsc && node ./build/index.js" 5 | } -------------------------------------------------------------------------------- /setup-article-material/nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "watch": ["src"], 3 | "ext": "ts, json", 4 | "exec": "tsc && node ./build/index.js" 5 | } 6 | -------------------------------------------------------------------------------- /wallet/Makefile: -------------------------------------------------------------------------------- 1 | up: 2 | docker-compose up 3 | 4 | up-build: 5 | docker-compose up --build 6 | 7 | down: 8 | docker-compose down --remove-orphans 9 | -------------------------------------------------------------------------------- /event-driven-article-material/auth/nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "watch": ["src"], 3 | "ext": "ts, json", 4 | "exec": "npx tsc && node ./build/index.js" 5 | } 6 | -------------------------------------------------------------------------------- /load-testing/dist/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | console.log('Hello World!'); 3 | console.log('Lets load testing with k6'); 4 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /event-driven-article-material/images/image1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agusrichard/typescript-workbook/HEAD/event-driven-article-material/images/image1.jpg -------------------------------------------------------------------------------- /event-driven-article-material/images/image2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agusrichard/typescript-workbook/HEAD/event-driven-article-material/images/image2.jpg -------------------------------------------------------------------------------- /wallet/dev.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node 2 | 3 | WORKDIR /usr/app 4 | COPY package*.json ./ 5 | RUN npm install 6 | COPY . ./ 7 | EXPOSE 3000 8 | CMD npm run dev-server -------------------------------------------------------------------------------- /conductor-orchestration-shipping/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | -------------------------------------------------------------------------------- /event-driven-article-material/notification/nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "watch": ["src"], 3 | "ext": "ts, json", 4 | "exec": "npx tsc && node ./build/index.js" 5 | } 6 | -------------------------------------------------------------------------------- /setup-article-material/.env: -------------------------------------------------------------------------------- 1 | DB_USER=my_db 2 | DB_PASSWORD=my_db 3 | DB_NAME=my_db 4 | DB_PORT=5432 5 | DB_HOST=db 6 | PORT=3000 7 | SECRET_KEY=ThisIsASecretObviously -------------------------------------------------------------------------------- /setup-article-material/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node 2 | 3 | WORKDIR /usr/app 4 | COPY package*.json ./ 5 | RUN npm install 6 | COPY . ./ 7 | EXPOSE 5000 8 | CMD npm run dev -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/qs/test/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('./parse'); 4 | 5 | require('./stringify'); 6 | 7 | require('./utils'); 8 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/setprototypeof/index.d.ts: -------------------------------------------------------------------------------- 1 | declare function setPrototypeOf(o: any, proto: object | null): any; 2 | export = setPrototypeOf; 3 | -------------------------------------------------------------------------------- /wallet/.env: -------------------------------------------------------------------------------- 1 | DB_USER=wallet_db 2 | DB_PASSWORD=wallet_db 3 | DB_NAME=wallet_db 4 | DB_PORT=5432 5 | DB_HOST=192.168.100.17 6 | PORT=3000 7 | SECRET_KEY=ThisIsASecretObviously -------------------------------------------------------------------------------- /playwright-tutorial/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | reactStrictMode: true, 4 | } 5 | 6 | module.exports = nextConfig 7 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/debug/.npmignore: -------------------------------------------------------------------------------- 1 | support 2 | test 3 | examples 4 | example 5 | *.sock 6 | dist 7 | yarn.lock 8 | coverage 9 | bower.json 10 | -------------------------------------------------------------------------------- /handbook/event-driven-design/README.md: -------------------------------------------------------------------------------- 1 | # Event Driven Architecture 2 | With Hexagonal Architecture. 3 | We need to write an article about this. 4 | Even withoutthis, i can do that 5 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/utils-merge/.npmignore: -------------------------------------------------------------------------------- 1 | CONTRIBUTING.md 2 | Makefile 3 | docs/ 4 | examples/ 5 | reports/ 6 | test/ 7 | 8 | .jshintrc 9 | .travis.yml 10 | -------------------------------------------------------------------------------- /event-driven-microservices/auth/src/services/index.ts: -------------------------------------------------------------------------------- 1 | import createUserService, { IUserService } from './user' 2 | 3 | export { 4 | IUserService, 5 | } 6 | 7 | export default createUserService 8 | -------------------------------------------------------------------------------- /event-driven-microservices/user/src/services/index.ts: -------------------------------------------------------------------------------- 1 | import createUserService, { IUserService } from './user' 2 | 3 | export { 4 | IUserService, 5 | } 6 | 7 | export default createUserService 8 | -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/src/services/index.ts: -------------------------------------------------------------------------------- 1 | import createUserService, { IUserService } from './user' 2 | 3 | export { 4 | IUserService, 5 | } 6 | 7 | export default createUserService 8 | -------------------------------------------------------------------------------- /handbook/event-driven-design/user/src/services/index.ts: -------------------------------------------------------------------------------- 1 | import createUserService, { IUserService } from './user' 2 | 3 | export { 4 | IUserService, 5 | } 6 | 7 | export default createUserService 8 | -------------------------------------------------------------------------------- /wallet/src/configs/index.ts: -------------------------------------------------------------------------------- 1 | import initializeDatabase from './db' 2 | import Configs, { ConfigType } from './configs' 3 | 4 | export { 5 | Configs, 6 | ConfigType, 7 | initializeDatabase, 8 | } 9 | -------------------------------------------------------------------------------- /event-driven-microservices/user/src/middlewares/index.ts: -------------------------------------------------------------------------------- 1 | import authMiddleware, { adminOnlyMiddleware } from './auth' 2 | 3 | export { 4 | adminOnlyMiddleware, 5 | } 6 | 7 | export default authMiddleware 8 | -------------------------------------------------------------------------------- /handbook/event-driven-design/user/src/middlewares/index.ts: -------------------------------------------------------------------------------- 1 | import authMiddleware, { adminOnlyMiddleware } from './auth' 2 | 3 | export { 4 | adminOnlyMiddleware, 5 | } 6 | 7 | export default authMiddleware 8 | -------------------------------------------------------------------------------- /setup-article-material/Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | docker-compose build 3 | 4 | up: 5 | docker-compose up 6 | 7 | run: 8 | docker-compose up --build 9 | 10 | down: 11 | docker-compose down --remove-orphans -------------------------------------------------------------------------------- /load-testing/dist/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;AAC3B,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA"} -------------------------------------------------------------------------------- /wallet/src/middlewares/index.ts: -------------------------------------------------------------------------------- 1 | import initializeAuthMiddleware, { AuthMiddleware } from './auth' 2 | 3 | export { 4 | AuthMiddleware, 5 | } 6 | 7 | export default { 8 | initializeAuthMiddleware, 9 | } 10 | -------------------------------------------------------------------------------- /handbook/built/basic_type.js: -------------------------------------------------------------------------------- 1 | var sekar = 'Sekardayu Hana Pradiani'; 2 | var saskia = 'Saskia Nurul Azhima'; 3 | var age = 23; 4 | function printName(name) { 5 | console.log(name.toLowerCase()); 6 | } 7 | printName(sekar); 8 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/mime/cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var mime = require('./mime.js'); 4 | var file = process.argv[2]; 5 | var type = mime.lookup(file); 6 | 7 | process.stdout.write(type + '\n'); 8 | 9 | -------------------------------------------------------------------------------- /event-driven-microservices/auth/src/repositories/index.ts: -------------------------------------------------------------------------------- 1 | import createUserRepository, { IUserRepository, User } from './user' 2 | 3 | export { 4 | User, 5 | IUserRepository, 6 | } 7 | 8 | export default createUserRepository 9 | -------------------------------------------------------------------------------- /event-driven-microservices/user/src/repositories/index.ts: -------------------------------------------------------------------------------- 1 | import createUserRepository, { IUserRepository, User } from './user' 2 | 3 | export { 4 | User, 5 | IUserRepository, 6 | } 7 | 8 | export default createUserRepository 9 | -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/src/repositories/index.ts: -------------------------------------------------------------------------------- 1 | import createUserRepository, { IUserRepository, User } from './user' 2 | 3 | export { 4 | User, 5 | IUserRepository, 6 | } 7 | 8 | export default createUserRepository 9 | -------------------------------------------------------------------------------- /handbook/event-driven-design/user/src/repositories/index.ts: -------------------------------------------------------------------------------- 1 | import createUserRepository, { IUserRepository, User } from './user' 2 | 3 | export { 4 | User, 5 | IUserRepository, 6 | } 7 | 8 | export default createUserRepository 9 | -------------------------------------------------------------------------------- /playwright-tutorial/src/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import '@/styles/globals.css' 2 | import type { AppProps } from 'next/app' 3 | 4 | export default function App({ Component, pageProps }: AppProps) { 5 | return 6 | } 7 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/mime-db/index.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * mime-db 3 | * Copyright(c) 2014 Jonathan Ong 4 | * MIT Licensed 5 | */ 6 | 7 | /** 8 | * Module exports. 9 | */ 10 | 11 | module.exports = require('./db.json') 12 | -------------------------------------------------------------------------------- /handbook/src/basic_type.ts: -------------------------------------------------------------------------------- 1 | const sekar: string = 'Sekardayu Hana Pradiani' 2 | const saskia: string = 'Saskia Nurul Azhima' 3 | const age: number = 23 4 | 5 | function printName(name: string): void { 6 | console.log(name.toLowerCase()) 7 | } 8 | 9 | printName(sekar) -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/debug/.travis.yml: -------------------------------------------------------------------------------- 1 | 2 | language: node_js 3 | node_js: 4 | - "6" 5 | - "5" 6 | - "4" 7 | 8 | install: 9 | - make node_modules 10 | 11 | script: 12 | - make lint 13 | - make test 14 | - make coveralls 15 | -------------------------------------------------------------------------------- /setup-article-material/src/index.ts: -------------------------------------------------------------------------------- 1 | import express from 'express' 2 | 3 | const app = express() 4 | 5 | app.get('/', (req, res) => { 6 | res.send('Hello World!') 7 | }) 8 | 9 | app.listen(5000, () => { 10 | console.log(`Server listening on port ${5000}`) 11 | }) 12 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/inherits/inherits.js: -------------------------------------------------------------------------------- 1 | try { 2 | var util = require('util'); 3 | if (typeof util.inherits !== 'function') throw ''; 4 | module.exports = util.inherits; 5 | } catch (e) { 6 | module.exports = require('./inherits_browser.js'); 7 | } 8 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/debug/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "node": true 5 | }, 6 | "rules": { 7 | "no-console": 0, 8 | "no-empty": [1, { "allowEmptyCatch": true }] 9 | }, 10 | "extends": "eslint:recommended" 11 | } 12 | -------------------------------------------------------------------------------- /event-driven-microservices/auth/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | import { generateToken, verifyToken } from './token' 2 | import { comparePassword, generatePassword } from './password' 3 | 4 | export { 5 | verifyToken, 6 | generateToken, 7 | comparePassword, 8 | generatePassword, 9 | } 10 | -------------------------------------------------------------------------------- /event-driven-microservices/user/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | import { generateToken, verifyToken } from './token' 2 | import { comparePassword, generatePassword } from './password' 3 | 4 | export { 5 | verifyToken, 6 | generateToken, 7 | comparePassword, 8 | generatePassword, 9 | } 10 | -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | import { generateToken, verifyToken } from './token' 2 | import { comparePassword, generatePassword } from './password' 3 | 4 | export { 5 | verifyToken, 6 | generateToken, 7 | comparePassword, 8 | generatePassword, 9 | } 10 | -------------------------------------------------------------------------------- /handbook/event-driven-design/user/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | import { generateToken, verifyToken } from './token' 2 | import { comparePassword, generatePassword } from './password' 3 | 4 | export { 5 | verifyToken, 6 | generateToken, 7 | comparePassword, 8 | generatePassword, 9 | } 10 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const app = express(); 3 | const PORT = 8000; 4 | app.get('/', (req,res) => res.send('Express + TypeScript Server')); 5 | app.listen(PORT, () => { 6 | console.log(`⚡️[server]: Server is running at http://localhost:${PORT}`); 7 | }); -------------------------------------------------------------------------------- /event-driven-microservices/auth/manifest/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: auth-service-service 5 | spec: 6 | selector: 7 | app: auth-service 8 | ports: 9 | - name: http 10 | port: 80 11 | targetPort: 5000 12 | protocol: TCP 13 | type: LoadBalancer -------------------------------------------------------------------------------- /event-driven-microservices/user/manifest/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: user-service-service 5 | spec: 6 | selector: 7 | app: user-service 8 | ports: 9 | - name: http 10 | port: 80 11 | targetPort: 3000 12 | protocol: TCP 13 | type: LoadBalancer -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/manifest/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: auth-service-service 5 | spec: 6 | selector: 7 | app: auth-service 8 | ports: 9 | - name: http 10 | port: 80 11 | targetPort: 5000 12 | protocol: TCP 13 | type: LoadBalancer -------------------------------------------------------------------------------- /handbook/event-driven-design/user/manifest/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: user-service-service 5 | spec: 6 | selector: 7 | app: user-service 8 | ports: 9 | - name: http 10 | port: 80 11 | targetPort: 3000 12 | protocol: TCP 13 | type: LoadBalancer -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/qs/lib/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var stringify = require('./stringify'); 4 | var parse = require('./parse'); 5 | var formats = require('./formats'); 6 | 7 | module.exports = { 8 | formats: formats, 9 | parse: parse, 10 | stringify: stringify 11 | }; 12 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/express/index.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * express 3 | * Copyright(c) 2009-2013 TJ Holowaychuk 4 | * Copyright(c) 2013 Roman Shtylman 5 | * Copyright(c) 2014-2015 Douglas Christopher Wilson 6 | * MIT Licensed 7 | */ 8 | 9 | 'use strict'; 10 | 11 | module.exports = require('./lib/express'); 12 | -------------------------------------------------------------------------------- /playwright-tutorial/src/pages/_document.tsx: -------------------------------------------------------------------------------- 1 | import { Html, Head, Main, NextScript } from 'next/document' 2 | 3 | export default function Document() { 4 | return ( 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | ) 13 | } 14 | -------------------------------------------------------------------------------- /net-ninja/public/classes/Invoice.js: -------------------------------------------------------------------------------- 1 | export class Invoice { 2 | constructor(client, details, amount) { 3 | this.client = client; 4 | this.details = details; 5 | this.amount = amount; 6 | } 7 | format() { 8 | return `${this.client} owes £${this.amount} for ${this.details}`; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /wallet/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | import ResponseTemplate from './response_template' 2 | import { generateToken, verifyToken } from './token' 3 | import { comparePassword, generatePassword } from './password' 4 | 5 | export { 6 | verifyToken, 7 | generateToken, 8 | comparePassword, 9 | generatePassword, 10 | ResponseTemplate, 11 | } 12 | -------------------------------------------------------------------------------- /net-ninja/public/classes/Payment.js: -------------------------------------------------------------------------------- 1 | export class Payment { 2 | constructor(recipient, details, amount) { 3 | this.recipient = recipient; 4 | this.details = details; 5 | this.amount = amount; 6 | } 7 | format() { 8 | return `${this.recipient} is owed £${this.amount} for ${this.details}`; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /wallet/src/routers/index.ts: -------------------------------------------------------------------------------- 1 | import initializeUsersRouter from './users' 2 | import initializeIncomeExpenseRouter from './income_expense' 3 | import initializeIncomeExpenseTypeRouter from './income_expense_type' 4 | 5 | export default { 6 | initializeUsersRouter, 7 | initializeIncomeExpenseRouter, 8 | initializeIncomeExpenseTypeRouter, 9 | } 10 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/debug/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Detect Electron renderer process, which is node, but we should 3 | * treat as a browser. 4 | */ 5 | 6 | if (typeof process !== 'undefined' && process.type === 'renderer') { 7 | module.exports = require('./browser.js'); 8 | } else { 9 | module.exports = require('./node.js'); 10 | } 11 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/encodeurl/HISTORY.md: -------------------------------------------------------------------------------- 1 | 1.0.2 / 2018-01-21 2 | ================== 3 | 4 | * Fix encoding `%` as last character 5 | 6 | 1.0.1 / 2016-06-09 7 | ================== 8 | 9 | * Fix encoding unpaired surrogates at start/end of string 10 | 11 | 1.0.0 / 2016-06-08 12 | ================== 13 | 14 | * Initial release 15 | -------------------------------------------------------------------------------- /event-driven-microservices/auth/src/configs/index.ts: -------------------------------------------------------------------------------- 1 | import createLogger from './logger' 2 | import createMongoDB from './database' 3 | import createConfigs, { ConfigType } from './configs' 4 | 5 | const configs = { 6 | createLogger, 7 | createMongoDB, 8 | createConfigs, 9 | } 10 | 11 | export { 12 | ConfigType, 13 | } 14 | 15 | export default configs 16 | -------------------------------------------------------------------------------- /event-driven-microservices/user/src/configs/index.ts: -------------------------------------------------------------------------------- 1 | import createLogger from './logger' 2 | import createMongoDB from './database' 3 | import createConfigs, { ConfigType } from './configs' 4 | 5 | const configs = { 6 | createLogger, 7 | createMongoDB, 8 | createConfigs, 9 | } 10 | 11 | export { 12 | ConfigType, 13 | } 14 | 15 | export default configs 16 | -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/src/configs/index.ts: -------------------------------------------------------------------------------- 1 | import createLogger from './logger' 2 | import createMongoDB from './database' 3 | import createConfigs, { ConfigType } from './configs' 4 | 5 | const configs = { 6 | createLogger, 7 | createMongoDB, 8 | createConfigs, 9 | } 10 | 11 | export { 12 | ConfigType, 13 | } 14 | 15 | export default configs 16 | -------------------------------------------------------------------------------- /handbook/event-driven-design/user/src/configs/index.ts: -------------------------------------------------------------------------------- 1 | import createLogger from './logger' 2 | import createMongoDB from './database' 3 | import createConfigs, { ConfigType } from './configs' 4 | 5 | const configs = { 6 | createLogger, 7 | createMongoDB, 8 | createConfigs, 9 | } 10 | 11 | export { 12 | ConfigType, 13 | } 14 | 15 | export default configs 16 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /load-testing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "load-testing", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "watch": "npx tsc -w", 9 | "start": "npx tsc && node dist/index.js" 10 | }, 11 | "keywords": [], 12 | "author": "", 13 | "license": "ISC" 14 | } 15 | -------------------------------------------------------------------------------- /wallet/src/configs/db.ts: -------------------------------------------------------------------------------- 1 | import { Pool } from 'pg' 2 | 3 | import { ConfigType } from './configs' 4 | 5 | const initializeDatabase = (configs: ConfigType) => new Pool({ 6 | user: configs.DB_USER, 7 | host: configs.DB_HOST, 8 | database: configs.DB_NAME, 9 | password: configs.DB_PASSWORD, 10 | port: configs.DB_PORT, 11 | }) 12 | 13 | export default initializeDatabase 14 | -------------------------------------------------------------------------------- /load-test-lbs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "load-test-lbs", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "@types/k6": "^0.34.1", 14 | "k6": "^0.0.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "conductor-orchestration-shipping", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.17.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /event-driven-microservices/auth/src/configs/logger.ts: -------------------------------------------------------------------------------- 1 | import fs, { WriteStream } from 'fs' 2 | import path from 'path' 3 | 4 | const createLogger = (dirname: string): WriteStream => { 5 | const logDirectory = path.join(dirname, '..', 'access.log') 6 | const accessLogStream = fs.createWriteStream(logDirectory, { flags: 'a' }) 7 | return accessLogStream 8 | } 9 | 10 | export default createLogger 11 | -------------------------------------------------------------------------------- /event-driven-microservices/user/src/configs/logger.ts: -------------------------------------------------------------------------------- 1 | import fs, { WriteStream } from 'fs' 2 | import path from 'path' 3 | 4 | const createLogger = (dirname: string): WriteStream => { 5 | const logDirectory = path.join(dirname, '..', 'access.log') 6 | const accessLogStream = fs.createWriteStream(logDirectory, { flags: 'a' }) 7 | return accessLogStream 8 | } 9 | 10 | export default createLogger 11 | -------------------------------------------------------------------------------- /playwright-tutorial/src/pages/api/hello.ts: -------------------------------------------------------------------------------- 1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction 2 | import type { NextApiRequest, NextApiResponse } from 'next' 3 | 4 | type Data = { 5 | name: string 6 | } 7 | 8 | export default function handler( 9 | req: NextApiRequest, 10 | res: NextApiResponse 11 | ) { 12 | res.status(200).json({ name: 'John Doe' }) 13 | } 14 | -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/src/configs/logger.ts: -------------------------------------------------------------------------------- 1 | import fs, { WriteStream } from 'fs' 2 | import path from 'path' 3 | 4 | const createLogger = (dirname: string): WriteStream => { 5 | const logDirectory = path.join(dirname, '..', 'access.log') 6 | const accessLogStream = fs.createWriteStream(logDirectory, { flags: 'a' }) 7 | return accessLogStream 8 | } 9 | 10 | export default createLogger 11 | -------------------------------------------------------------------------------- /handbook/event-driven-design/user/src/configs/logger.ts: -------------------------------------------------------------------------------- 1 | import fs, { WriteStream } from 'fs' 2 | import path from 'path' 3 | 4 | const createLogger = (dirname: string): WriteStream => { 5 | const logDirectory = path.join(dirname, '..', 'access.log') 6 | const accessLogStream = fs.createWriteStream(logDirectory, { flags: 'a' }) 7 | return accessLogStream 8 | } 9 | 10 | export default createLogger 11 | -------------------------------------------------------------------------------- /handbook/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs", 5 | "declaration": false, 6 | "noImplicitAny": false, 7 | "removeComments": true, 8 | "noLib": false, 9 | "outDir": "built", 10 | "rootDir": "src" 11 | }, 12 | "include": [ 13 | "**/*" 14 | ], 15 | "exclude": [ 16 | "node_modules", 17 | "**/*.spec.ts" 18 | ] 19 | } -------------------------------------------------------------------------------- /net-ninja/src/classes/Invoice.ts: -------------------------------------------------------------------------------- 1 | import { HasFormatter } from "../interfaces/HasFormatter.js"; 2 | 3 | export class Invoice implements HasFormatter { 4 | 5 | constructor( 6 | readonly client: string, 7 | private details: string, 8 | public amount: number 9 | ) {} 10 | 11 | format() { 12 | return `${this.client} owes £${this.amount} for ${this.details}` 13 | } 14 | } -------------------------------------------------------------------------------- /wallet/src/utils/password.ts: -------------------------------------------------------------------------------- 1 | import bcrypt from 'bcryptjs' 2 | 3 | const generatePassword = async (password: string): Promise => { 4 | return bcrypt.hashSync(password) 5 | } 6 | 7 | const comparePassword = (password: string, hashedPassword: string): Promise => { 8 | return bcrypt.compare(password, hashedPassword) 9 | } 10 | 11 | export { 12 | comparePassword, 13 | generatePassword, 14 | } 15 | -------------------------------------------------------------------------------- /event-driven-microservices/auth/src/utils/password.ts: -------------------------------------------------------------------------------- 1 | import bcrypt from 'bcryptjs' 2 | 3 | const generatePassword = (password: string): string => { 4 | return bcrypt.hashSync(password) 5 | } 6 | 7 | const comparePassword = (password: string, hashedPassword: string): boolean => { 8 | return bcrypt.compareSync(password, hashedPassword) 9 | } 10 | 11 | export { 12 | comparePassword, 13 | generatePassword, 14 | } 15 | -------------------------------------------------------------------------------- /event-driven-microservices/user/src/utils/password.ts: -------------------------------------------------------------------------------- 1 | import bcrypt from 'bcryptjs' 2 | 3 | const generatePassword = (password: string): string => { 4 | return bcrypt.hashSync(password) 5 | } 6 | 7 | const comparePassword = (password: string, hashedPassword: string): boolean => { 8 | return bcrypt.compareSync(password, hashedPassword) 9 | } 10 | 11 | export { 12 | comparePassword, 13 | generatePassword, 14 | } 15 | -------------------------------------------------------------------------------- /net-ninja/src/classes/Payment.ts: -------------------------------------------------------------------------------- 1 | import { HasFormatter } from "../interfaces/HasFormatter.js"; 2 | 3 | export class Payment implements HasFormatter { 4 | 5 | constructor( 6 | readonly recipient: string, 7 | private details: string, 8 | public amount: number 9 | ) {} 10 | 11 | format() { 12 | return `${this.recipient} is owed £${this.amount} for ${this.details}` 13 | } 14 | } -------------------------------------------------------------------------------- /wallet/src/utils/token.ts: -------------------------------------------------------------------------------- 1 | import jwt from 'jsonwebtoken' 2 | 3 | import { Configs } from '../configs' 4 | 5 | const generateToken = (payload: { id: number }) => { 6 | return jwt.sign(payload, Configs.SECRET_KEY, { expiresIn: '12h' }) 7 | } 8 | 9 | const verifyToken = (token: string) => { 10 | return jwt.verify(token, Configs.SECRET_KEY) 11 | } 12 | 13 | export { 14 | verifyToken, 15 | generateToken, 16 | } 17 | -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/src/utils/password.ts: -------------------------------------------------------------------------------- 1 | import bcrypt from 'bcryptjs' 2 | 3 | const generatePassword = (password: string): string => { 4 | return bcrypt.hashSync(password) 5 | } 6 | 7 | const comparePassword = (password: string, hashedPassword: string): boolean => { 8 | return bcrypt.compareSync(password, hashedPassword) 9 | } 10 | 11 | export { 12 | comparePassword, 13 | generatePassword, 14 | } 15 | -------------------------------------------------------------------------------- /handbook/event-driven-design/user/src/utils/password.ts: -------------------------------------------------------------------------------- 1 | import bcrypt from 'bcryptjs' 2 | 3 | const generatePassword = (password: string): string => { 4 | return bcrypt.hashSync(password) 5 | } 6 | 7 | const comparePassword = (password: string, hashedPassword: string): boolean => { 8 | return bcrypt.compareSync(password, hashedPassword) 9 | } 10 | 11 | export { 12 | comparePassword, 13 | generatePassword, 14 | } 15 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/forwarded/HISTORY.md: -------------------------------------------------------------------------------- 1 | 0.1.2 / 2017-09-14 2 | ================== 3 | 4 | * perf: improve header parsing 5 | * perf: reduce overhead when no `X-Forwarded-For` header 6 | 7 | 0.1.1 / 2017-09-10 8 | ================== 9 | 10 | * Fix trimming leading / trailing OWS 11 | * perf: hoist regular expression 12 | 13 | 0.1.0 / 2014-09-21 14 | ================== 15 | 16 | * Initial release 17 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/debug/component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debug", 3 | "repo": "visionmedia/debug", 4 | "description": "small debugging utility", 5 | "version": "2.6.9", 6 | "keywords": [ 7 | "debug", 8 | "log", 9 | "debugger" 10 | ], 11 | "main": "src/browser.js", 12 | "scripts": [ 13 | "src/browser.js", 14 | "src/debug.js" 15 | ], 16 | "dependencies": { 17 | "rauchg/ms.js": "0.7.1" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /event-driven-microservices/user/src/utils/token.ts: -------------------------------------------------------------------------------- 1 | import jwt from 'jsonwebtoken' 2 | 3 | import configs from '../configs' 4 | 5 | const conf = configs.createConfigs() 6 | 7 | const generateToken = (payload: { id: string }) => { 8 | return jwt.sign(payload, conf.SECRET_KEY, { expiresIn: '12h' }) 9 | } 10 | 11 | const verifyToken = (token: string) => { 12 | return jwt.verify(token, conf.SECRET_KEY) 13 | } 14 | 15 | export { 16 | verifyToken, 17 | generateToken, 18 | } 19 | -------------------------------------------------------------------------------- /handbook/event-driven-design/user/src/utils/token.ts: -------------------------------------------------------------------------------- 1 | import jwt from 'jsonwebtoken' 2 | 3 | import configs from '../configs' 4 | 5 | const conf = configs.createConfigs() 6 | 7 | const generateToken = (payload: { id: string }) => { 8 | return jwt.sign(payload, conf.SECRET_KEY, { expiresIn: '12h' }) 9 | } 10 | 11 | const verifyToken = (token: string) => { 12 | return jwt.verify(token, conf.SECRET_KEY) 13 | } 14 | 15 | export { 16 | verifyToken, 17 | generateToken, 18 | } 19 | -------------------------------------------------------------------------------- /event-driven-microservices/auth/src/utils/token.ts: -------------------------------------------------------------------------------- 1 | import jwt from 'jsonwebtoken' 2 | 3 | import configs from '../configs' 4 | 5 | const conf = configs.createConfigs() 6 | 7 | const generateToken = (payload: { id: string, role: number }) => { 8 | return jwt.sign(payload, conf.SECRET_KEY, { expiresIn: '12h' }) 9 | } 10 | 11 | const verifyToken = (token: string) => { 12 | return jwt.verify(token, conf.SECRET_KEY) 13 | } 14 | 15 | export { 16 | verifyToken, 17 | generateToken, 18 | } 19 | -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/src/utils/token.ts: -------------------------------------------------------------------------------- 1 | import jwt from 'jsonwebtoken' 2 | 3 | import configs from '../configs' 4 | 5 | const conf = configs.createConfigs() 6 | 7 | const generateToken = (payload: { id: string, role: number }) => { 8 | return jwt.sign(payload, conf.SECRET_KEY, { expiresIn: '12h' }) 9 | } 10 | 11 | const verifyToken = (token: string) => { 12 | return jwt.verify(token, conf.SECRET_KEY) 13 | } 14 | 15 | export { 16 | verifyToken, 17 | generateToken, 18 | } 19 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/debug/src/inspector-log.js: -------------------------------------------------------------------------------- 1 | module.exports = inspectorLog; 2 | 3 | // black hole 4 | const nullStream = new (require('stream').Writable)(); 5 | nullStream._write = () => {}; 6 | 7 | /** 8 | * Outputs a `console.log()` to the Node.js Inspector console *only*. 9 | */ 10 | function inspectorLog() { 11 | const stdout = console._stdout; 12 | console._stdout = nullStream; 13 | console.log.apply(console, arguments); 14 | console._stdout = stdout; 15 | } 16 | -------------------------------------------------------------------------------- /wallet/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "esModuleInterop": true, 5 | "target": "es6", 6 | "noImplicitAny": true, 7 | "moduleResolution": "node", 8 | "sourceMap": true, 9 | "outDir": "./build", 10 | "baseUrl": ".", 11 | "paths": { 12 | "*": [ 13 | "node_modules/*" 14 | ] 15 | }, 16 | "resolveJsonModule": true 17 | }, 18 | "include": [ 19 | "src/**/*" 20 | ] 21 | } -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/depd/lib/compat/event-listener-count.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * depd 3 | * Copyright(c) 2015 Douglas Christopher Wilson 4 | * MIT Licensed 5 | */ 6 | 7 | 'use strict' 8 | 9 | /** 10 | * Module exports. 11 | * @public 12 | */ 13 | 14 | module.exports = eventListenerCount 15 | 16 | /** 17 | * Get the count of listeners on an event emitter of a specific type. 18 | */ 19 | 20 | function eventListenerCount (emitter, type) { 21 | return emitter.listeners(type).length 22 | } 23 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/merge-descriptors/HISTORY.md: -------------------------------------------------------------------------------- 1 | 1.0.1 / 2016-01-17 2 | ================== 3 | 4 | * perf: enable strict mode 5 | 6 | 1.0.0 / 2015-03-01 7 | ================== 8 | 9 | * Add option to only add new descriptors 10 | * Add simple argument validation 11 | * Add jsdoc to source file 12 | 13 | 0.0.2 / 2013-12-14 14 | ================== 15 | 16 | * Move repository to `component` organization 17 | 18 | 0.0.1 / 2013-10-29 19 | ================== 20 | 21 | * Initial release 22 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/qs/lib/formats.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var replace = String.prototype.replace; 4 | var percentTwenties = /%20/g; 5 | 6 | module.exports = { 7 | 'default': 'RFC3986', 8 | formatters: { 9 | RFC1738: function (value) { 10 | return replace.call(value, percentTwenties, '+'); 11 | }, 12 | RFC3986: function (value) { 13 | return value; 14 | } 15 | }, 16 | RFC1738: 'RFC1738', 17 | RFC3986: 'RFC3986' 18 | }; 19 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/setprototypeof/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | /* eslint no-proto: 0 */ 3 | module.exports = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties) 4 | 5 | function setProtoOf (obj, proto) { 6 | obj.__proto__ = proto 7 | return obj 8 | } 9 | 10 | function mixinProperties (obj, proto) { 11 | for (var prop in proto) { 12 | if (!obj.hasOwnProperty(prop)) { 13 | obj[prop] = proto[prop] 14 | } 15 | } 16 | return obj 17 | } 18 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/utils-merge/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Merge object b with object a. 3 | * 4 | * var a = { foo: 'bar' } 5 | * , b = { bar: 'baz' }; 6 | * 7 | * merge(a, b); 8 | * // => { foo: 'bar', bar: 'baz' } 9 | * 10 | * @param {Object} a 11 | * @param {Object} b 12 | * @return {Object} 13 | * @api public 14 | */ 15 | 16 | exports = module.exports = function(a, b){ 17 | if (a && b) { 18 | for (var key in b) { 19 | a[key] = b[key]; 20 | } 21 | } 22 | return a; 23 | }; 24 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/qs/test/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "array-bracket-newline": 0, 4 | "array-element-newline": 0, 5 | "consistent-return": 2, 6 | "function-paren-newline": 0, 7 | "max-lines": 0, 8 | "max-lines-per-function": 0, 9 | "max-nested-callbacks": [2, 3], 10 | "max-statements": 0, 11 | "no-buffer-constructor": 0, 12 | "no-extend-native": 0, 13 | "no-magic-numbers": 0, 14 | "object-curly-newline": 0, 15 | "sort-keys": 0 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/.idea/conductor-orchestration-shipping.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /wallet/src/controllers/index.ts: -------------------------------------------------------------------------------- 1 | import initializeUsersController, { UsersController } from './users' 2 | import initializeIncomeExpenseTypeController, { IncomeExpenseTypeController } from './income_expense_type' 3 | import initializeIncomeExpenseContoller, { IncomeExpenseController } from './income_expense' 4 | 5 | export { 6 | UsersController, 7 | IncomeExpenseController, 8 | IncomeExpenseTypeController, 9 | } 10 | 11 | export default { 12 | initializeUsersController, 13 | initializeIncomeExpenseContoller, 14 | initializeIncomeExpenseTypeController, 15 | } 16 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/qs/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 4 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | max_line_length = 160 11 | 12 | [test/*] 13 | max_line_length = off 14 | 15 | [*.md] 16 | max_line_length = off 17 | 18 | [*.json] 19 | max_line_length = off 20 | 21 | [Makefile] 22 | max_line_length = off 23 | 24 | [CHANGELOG.md] 25 | indent_style = space 26 | indent_size = 2 27 | 28 | [LICENSE] 29 | indent_size = 2 30 | max_line_length = off 31 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/content-type/HISTORY.md: -------------------------------------------------------------------------------- 1 | 1.0.4 / 2017-09-11 2 | ================== 3 | 4 | * perf: skip parameter parsing when no parameters 5 | 6 | 1.0.3 / 2017-09-10 7 | ================== 8 | 9 | * perf: remove argument reassignment 10 | 11 | 1.0.2 / 2016-05-09 12 | ================== 13 | 14 | * perf: enable strict mode 15 | 16 | 1.0.1 / 2015-02-13 17 | ================== 18 | 19 | * Improve missing `Content-Type` header error message 20 | 21 | 1.0.0 / 2015-02-01 22 | ================== 23 | 24 | * Initial implementation, derived from `media-typer@0.3.0` 25 | -------------------------------------------------------------------------------- /wallet/src/models/index.ts: -------------------------------------------------------------------------------- 1 | import initializeUsersModel, { User, UsersModel } from './users' 2 | import initilizeIncomeExpenseTypeModel, { IncomeExpenseType, IncomeExpenseTypeModel } from './income_expense_type' 3 | import initializeIncomeExpenseModel, { IncomeExpense, IncomeExpenseModel } from './income_expense' 4 | 5 | export { 6 | User, 7 | UsersModel, 8 | IncomeExpenseType, 9 | IncomeExpenseTypeModel, 10 | IncomeExpense, 11 | IncomeExpenseModel, 12 | } 13 | 14 | export default { 15 | initializeUsersModel, 16 | initilizeIncomeExpenseTypeModel, 17 | initializeIncomeExpenseModel, 18 | } 19 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/methods/HISTORY.md: -------------------------------------------------------------------------------- 1 | 1.1.2 / 2016-01-17 2 | ================== 3 | 4 | * perf: enable strict mode 5 | 6 | 1.1.1 / 2014-12-30 7 | ================== 8 | 9 | * Improve `browserify` support 10 | 11 | 1.1.0 / 2014-07-05 12 | ================== 13 | 14 | * Add `CONNECT` method 15 | 16 | 1.0.1 / 2014-06-02 17 | ================== 18 | 19 | * Fix module to work with harmony transform 20 | 21 | 1.0.0 / 2014-05-08 22 | ================== 23 | 24 | * Add `PURGE` method 25 | 26 | 0.1.0 / 2013-10-28 27 | ================== 28 | 29 | * Add `http.METHODS` support 30 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/media-typer/HISTORY.md: -------------------------------------------------------------------------------- 1 | 0.3.0 / 2014-09-07 2 | ================== 3 | 4 | * Support Node.js 0.6 5 | * Throw error when parameter format invalid on parse 6 | 7 | 0.2.0 / 2014-06-18 8 | ================== 9 | 10 | * Add `typer.format()` to format media types 11 | 12 | 0.1.0 / 2014-06-17 13 | ================== 14 | 15 | * Accept `req` as argument to `parse` 16 | * Accept `res` as argument to `parse` 17 | * Parse media type with extra LWS between type and first parameter 18 | 19 | 0.0.0 / 2014-06-13 20 | ================== 21 | 22 | * Initial implementation 23 | -------------------------------------------------------------------------------- /event-driven-microservices/user/src/configs/database.ts: -------------------------------------------------------------------------------- 1 | import { createConnection, Connection } from 'mongoose' 2 | 3 | import { ConfigType } from '../configs' 4 | 5 | function createMongoDB(config: ConfigType): Connection | never { 6 | try { 7 | const uri = `mongodb+srv://${config.DB_USERNAME}:${config.DB_PASSWORD}@${config.DB_HOST}/${config.DB_NAME}?retryWrites=true&w=majority` 8 | console.log('Connecting to MongoDB...') 9 | return createConnection(uri) 10 | } catch (error) { 11 | console.log('Error connecting to database') 12 | throw error 13 | } 14 | } 15 | 16 | export default createMongoDB 17 | -------------------------------------------------------------------------------- /handbook/event-driven-design/user/src/configs/database.ts: -------------------------------------------------------------------------------- 1 | import { createConnection, Connection } from 'mongoose' 2 | 3 | import { ConfigType } from '../configs' 4 | 5 | function createMongoDB(config: ConfigType): Connection | never { 6 | try { 7 | const uri = `mongodb+srv://${config.DB_USERNAME}:${config.DB_PASSWORD}@${config.DB_HOST}/${config.DB_NAME}?retryWrites=true&w=majority` 8 | console.log('Connecting to MongoDB...') 9 | return createConnection(uri) 10 | } catch (error) { 11 | console.log('Error connecting to database') 12 | throw error 13 | } 14 | } 15 | 16 | export default createMongoDB 17 | -------------------------------------------------------------------------------- /playwright-tutorial/e2e/example.spec.ts: -------------------------------------------------------------------------------- 1 | import { test, expect } from '@playwright/test'; 2 | 3 | test('has title', async ({ page }) => { 4 | await page.goto('https://playwright.dev/'); 5 | 6 | // Expect a title "to contain" a substring. 7 | await expect(page).toHaveTitle(/Playwright/); 8 | }); 9 | 10 | test('get started link', async ({ page }) => { 11 | await page.goto('https://playwright.dev/'); 12 | 13 | // Click the get started link. 14 | await page.getByRole('link', { name: 'Get started' }).click(); 15 | 16 | // Expects the URL to contain intro. 17 | await expect(page).toHaveURL(/.*intro/); 18 | }); 19 | -------------------------------------------------------------------------------- /playwright-tutorial/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /playwright-tutorial/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | .idea 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | .pnpm-debug.log* 28 | 29 | # local env files 30 | .env*.local 31 | 32 | # vercel 33 | .vercel 34 | 35 | # typescript 36 | *.tsbuildinfo 37 | next-env.d.ts 38 | /test-results/ 39 | /playwright-report/ 40 | /playwright/.cache/ 41 | -------------------------------------------------------------------------------- /net-ninja/public/classes/ListTemplate.js: -------------------------------------------------------------------------------- 1 | export class ListTemplate { 2 | constructor(container) { 3 | this.container = container; 4 | } 5 | render(item, title, pos) { 6 | const li = document.createElement('li'); 7 | const h4 = document.createElement('h4'); 8 | h4.innerText = title; 9 | li.append(h4); 10 | const p = document.createElement('p'); 11 | p.innerText = item.format(); 12 | li.append(p); 13 | if (pos === 'start') { 14 | this.container.prepend(li); 15 | } 16 | else { 17 | this.container.append(li); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /wallet/src/configs/configs.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv' 2 | 3 | dotenv.config() 4 | 5 | export type ConfigType = { 6 | DB_PORT: number 7 | DB_HOST: string 8 | DB_USER: string 9 | DB_PASSWORD: string 10 | DB_NAME: string, 11 | PORT: number, 12 | SECRET_KEY: string, 13 | } 14 | 15 | const Configs: ConfigType = { 16 | PORT: parseInt(process.env.PORT || '3000', 10), 17 | DB_PORT: parseInt(process.env.DB_PORT, 10), 18 | DB_HOST: process.env.DB_HOST, 19 | DB_USER: process.env.DB_USER, 20 | DB_NAME: process.env.DB_NAME, 21 | DB_PASSWORD: process.env.DB_PASSWORD, 22 | SECRET_KEY: process.env.SECRET_KEY, 23 | } 24 | 25 | export default Configs 26 | -------------------------------------------------------------------------------- /net-ninja/src/classes/ListTemplate.ts: -------------------------------------------------------------------------------- 1 | import { HasFormatter } from '../interfaces/HasFormatter.js' 2 | 3 | export class ListTemplate { 4 | constructor(private container: HTMLUListElement) {} 5 | 6 | render(item: HasFormatter, title: string, pos: 'start' | 'end') { 7 | const li = document.createElement('li') 8 | 9 | const h4 = document.createElement('h4') 10 | h4.innerText = title 11 | li.append(h4) 12 | 13 | const p = document.createElement('p') 14 | p.innerText = item.format() 15 | li.append(p) 16 | 17 | if (pos === 'start') { 18 | this.container.prepend(li) 19 | } else { 20 | this.container.append(li) 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /wallet/src/routers/users.ts: -------------------------------------------------------------------------------- 1 | import { Router } from 'express' 2 | 3 | import { AuthMiddleware } from '../middlewares' 4 | import { UsersController } from '../controllers' 5 | 6 | const initializeUsersRouter = (usersController: UsersController, authMiddleWare: AuthMiddleware): Router => { 7 | const router: Router = Router() 8 | 9 | router.post('/login', usersController.login) 10 | router.post('/register', usersController.register) 11 | router.get('/profile', authMiddleWare.authenticate, usersController.profile) 12 | router.get('/clear', authMiddleWare.authenticate, usersController.clear) 13 | 14 | return router 15 | } 16 | 17 | export default initializeUsersRouter 18 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/toidentifier/index.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * toidentifier 3 | * Copyright(c) 2016 Douglas Christopher Wilson 4 | * MIT Licensed 5 | */ 6 | 7 | /** 8 | * Module exports. 9 | * @public 10 | */ 11 | 12 | module.exports = toIdentifier 13 | 14 | /** 15 | * Trasform the given string into a JavaScript identifier 16 | * 17 | * @param {string} str 18 | * @returns {string} 19 | * @public 20 | */ 21 | 22 | function toIdentifier (str) { 23 | return str 24 | .split(' ') 25 | .map(function (token) { 26 | return token.slice(0, 1).toUpperCase() + token.slice(1) 27 | }) 28 | .join('') 29 | .replace(/[^ _0-9a-z]/gi, '') 30 | } 31 | -------------------------------------------------------------------------------- /event-driven-microservices/auth/src/configs/database.ts: -------------------------------------------------------------------------------- 1 | import { createConnection, Connection } from 'mongoose' 2 | 3 | import { ConfigType } from '../configs' 4 | 5 | function createMongoDB(config: ConfigType): Connection | never { 6 | try { 7 | const uri = `mongodb+srv://${config.DB_USERNAME}:${config.DB_PASSWORD}@${config.DB_HOST}/${config.DB_NAME}?retryWrites=true&w=majority` 8 | console.log('Connecting to MongoDB...') 9 | const result = createConnection(uri) 10 | console.log('Connected to MongoDB...') 11 | return result 12 | } catch (error) { 13 | console.log('Error connecting to database') 14 | throw error 15 | } 16 | } 17 | 18 | export default createMongoDB 19 | -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/src/configs/database.ts: -------------------------------------------------------------------------------- 1 | import { createConnection, Connection } from 'mongoose' 2 | 3 | import { ConfigType } from '../configs' 4 | 5 | function createMongoDB(config: ConfigType): Connection | never { 6 | try { 7 | const uri = `mongodb+srv://${config.DB_USERNAME}:${config.DB_PASSWORD}@${config.DB_HOST}/${config.DB_NAME}?retryWrites=true&w=majority` 8 | console.log('Connecting to MongoDB...') 9 | const result = createConnection(uri) 10 | console.log('Connected to MongoDB...') 11 | return result 12 | } catch (error) { 13 | console.log('Error connecting to database') 14 | throw error 15 | } 16 | } 17 | 18 | export default createMongoDB 19 | -------------------------------------------------------------------------------- /playwright-tutorial/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "noEmit": true, 10 | "esModuleInterop": true, 11 | "module": "esnext", 12 | "moduleResolution": "node", 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "jsx": "preserve", 16 | "incremental": true, 17 | "baseUrl": ".", 18 | "paths": { 19 | "@/*": ["./src/*"] 20 | } 21 | }, 22 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], 23 | "exclude": ["node_modules"] 24 | } 25 | -------------------------------------------------------------------------------- /event-driven-article-material/notification/src/index.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv' 2 | import bodyParser from 'body-parser' 3 | import express, { Request, Response } from 'express' 4 | 5 | import createMQConsumer from './consumer' 6 | 7 | dotenv.config() 8 | 9 | const PORT = parseInt(String(process.env.PORT), 10) || 3000 10 | const AMQP_URL = String(process.env.AMQP_URL) 11 | const QUEUE_NAME = String(process.env.QUEUE_NAME) 12 | 13 | const app = express() 14 | const consumer = createMQConsumer(AMQP_URL, QUEUE_NAME) 15 | 16 | consumer() 17 | app.use(bodyParser.json()) 18 | 19 | app.get('/', (req: Request, res: Response) => { 20 | res.send('Hello World') 21 | }) 22 | 23 | app.listen(PORT, () => { 24 | console.log(`Server is listening on port ${PORT}`) 25 | }) 26 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/qs/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | 4 | "extends": "@ljharb", 5 | 6 | "rules": { 7 | "complexity": 0, 8 | "consistent-return": 1, 9 | "func-name-matching": 0, 10 | "id-length": [2, { "min": 1, "max": 25, "properties": "never" }], 11 | "indent": [2, 4], 12 | "max-lines-per-function": [2, { "max": 150 }], 13 | "max-params": [2, 14], 14 | "max-statements": [2, 52], 15 | "multiline-comment-style": 0, 16 | "no-continue": 1, 17 | "no-magic-numbers": 0, 18 | "no-restricted-syntax": [2, "BreakStatement", "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"], 19 | "operator-linebreak": [2, "before"], 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /setup-article-material/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "setup-article-material", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "build": "tsc", 8 | "dev": "eslint --fix --ext .ts ./src && nodemon", 9 | "lint": "eslint --fix --ext .ts ./src" 10 | }, 11 | "author": "", 12 | "license": "ISC", 13 | "devDependencies": { 14 | "typescript": "^4.4.4" 15 | }, 16 | "dependencies": { 17 | "@types/express": "^4.17.13", 18 | "@typescript-eslint/eslint-plugin": "^5.3.0", 19 | "@typescript-eslint/parser": "^5.3.0", 20 | "eslint": "^7.32.0", 21 | "eslint-config-airbnb-base": "^14.2.1", 22 | "eslint-plugin-import": "^2.25.2", 23 | "express": "^4.17.1", 24 | "nodemon": "^2.0.14" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /wallet/src/routers/income_expense.ts: -------------------------------------------------------------------------------- 1 | import { Router } from 'express' 2 | 3 | import { AuthMiddleware } from '../middlewares' 4 | import { IncomeExpenseController } from '../controllers' 5 | 6 | const initializeIncomeExpenseRouter = (incomeExpenseController: IncomeExpenseController, authMiddleWare: AuthMiddleware): Router => { 7 | const router: Router = Router() 8 | 9 | router.post('', authMiddleWare.authenticate, incomeExpenseController.create) 10 | router.get('', authMiddleWare.authenticate, incomeExpenseController.findByUser) 11 | router.put('', authMiddleWare.authenticate, incomeExpenseController.update) 12 | router.delete('/:id', authMiddleWare.authenticate, incomeExpenseController.delete) 13 | 14 | return router 15 | } 16 | 17 | export default initializeIncomeExpenseRouter 18 | -------------------------------------------------------------------------------- /playwright-tutorial/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "playwright-tutorial", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint", 10 | "test:e2e": "npx playwright test", 11 | "test:show-e2e-report": "npx playwright show-report" 12 | }, 13 | "dependencies": { 14 | "@next/font": "13.1.6", 15 | "@types/node": "18.13.0", 16 | "@types/react": "18.0.28", 17 | "@types/react-dom": "18.0.11", 18 | "eslint": "8.34.0", 19 | "eslint-config-next": "13.1.6", 20 | "next": "13.1.6", 21 | "react": "18.2.0", 22 | "react-dom": "18.2.0", 23 | "typescript": "4.9.5" 24 | }, 25 | "devDependencies": { 26 | "@playwright/test": "^1.30.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/inherits/inherits_browser.js: -------------------------------------------------------------------------------- 1 | if (typeof Object.create === 'function') { 2 | // implementation from standard node.js 'util' module 3 | module.exports = function inherits(ctor, superCtor) { 4 | ctor.super_ = superCtor 5 | ctor.prototype = Object.create(superCtor.prototype, { 6 | constructor: { 7 | value: ctor, 8 | enumerable: false, 9 | writable: true, 10 | configurable: true 11 | } 12 | }); 13 | }; 14 | } else { 15 | // old school shim for old browsers 16 | module.exports = function inherits(ctor, superCtor) { 17 | ctor.super_ = superCtor 18 | var TempCtor = function () {} 19 | TempCtor.prototype = superCtor.prototype 20 | ctor.prototype = new TempCtor() 21 | ctor.prototype.constructor = ctor 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/setprototypeof/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Wes Todd 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 10 | SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 12 | OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 13 | CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /wallet/README.md: -------------------------------------------------------------------------------- 1 | # Wallet 2 | 3 | ## Description 4 | 5 | Wallet is a practice project inspired by financial manager application. Where you can register, sign in, create your own type of income and expense, and write down your income/expense history. So you can manage your own money easily. 6 | 7 | ## Requirements 8 | - Docker must be installed on you local machine. 9 | 10 | ## How to run this app 11 | - Clone this repo (you can remove the rest and take this folder only). 12 | - Make sure you have Docker installed. 13 | - Create an `.env` file with this config for example: 14 | ```text 15 | DB_USER=wallet_db 16 | DB_PASSWORD=wallet_db 17 | DB_NAME=wallet_db 18 | DB_PORT=5432 19 | DB_HOST=db 20 | PORT=3000 21 | SECRET_KEY=ThisIsASecretObviously 22 | ``` 23 | - Run command: 24 | ```shell 25 | make up-build 26 | ``` -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/setprototypeof/test/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | /* eslint-env mocha */ 3 | /* eslint no-proto: 0 */ 4 | var assert = require('assert') 5 | var setPrototypeOf = require('..') 6 | 7 | describe('setProtoOf(obj, proto)', function () { 8 | it('should merge objects', function () { 9 | var obj = { a: 1, b: 2 } 10 | var proto = { b: 3, c: 4 } 11 | var mergeObj = setPrototypeOf(obj, proto) 12 | 13 | if (Object.getPrototypeOf) { 14 | assert.strictEqual(Object.getPrototypeOf(obj), proto) 15 | } else if ({ __proto__: [] } instanceof Array) { 16 | assert.strictEqual(obj.__proto__, proto) 17 | } else { 18 | assert.strictEqual(obj.a, 1) 19 | assert.strictEqual(obj.b, 2) 20 | assert.strictEqual(obj.c, 4) 21 | } 22 | assert.strictEqual(mergeObj, obj) 23 | }) 24 | }) 25 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/inherits/LICENSE: -------------------------------------------------------------------------------- 1 | The ISC License 2 | 3 | Copyright (c) Isaac Z. Schlueter 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 10 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 11 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 12 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 14 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15 | PERFORMANCE OF THIS SOFTWARE. 16 | 17 | -------------------------------------------------------------------------------- /wallet/src/routers/income_expense_type.ts: -------------------------------------------------------------------------------- 1 | import { Router } from 'express' 2 | import { AuthMiddleware } from '../middlewares' 3 | import { IncomeExpenseTypeController } from '../controllers' 4 | 5 | const initializeIncomeExpenseTypeRouter = (incomeExpenseTypeController: IncomeExpenseTypeController, authMiddleWare: AuthMiddleware): Router => { 6 | const router: Router = Router() 7 | 8 | router.post('/create', authMiddleWare.authenticate, incomeExpenseTypeController.create) 9 | router.get('/find-by-user', authMiddleWare.authenticate, incomeExpenseTypeController.findByUser) 10 | router.put('/update', authMiddleWare.authenticate, incomeExpenseTypeController.update) 11 | router.delete('/delete/:id', authMiddleWare.authenticate, incomeExpenseTypeController.delete) 12 | 13 | return router 14 | } 15 | 16 | export default initializeIncomeExpenseTypeRouter 17 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/iconv-lite/encodings/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | // Update this array if you add/rename/remove files in this directory. 4 | // We support Browserify by skipping automatic module discovery and requiring modules directly. 5 | var modules = [ 6 | require("./internal"), 7 | require("./utf16"), 8 | require("./utf7"), 9 | require("./sbcs-codec"), 10 | require("./sbcs-data"), 11 | require("./sbcs-data-generated"), 12 | require("./dbcs-codec"), 13 | require("./dbcs-data"), 14 | ]; 15 | 16 | // Put all encoding/alias/codec definitions to single object and export it. 17 | for (var i = 0; i < modules.length; i++) { 18 | var module = modules[i]; 19 | for (var enc in module) 20 | if (Object.prototype.hasOwnProperty.call(module, enc)) 21 | exports[enc] = module[enc]; 22 | } 23 | -------------------------------------------------------------------------------- /event-driven-microservices/auth/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Build stage 2 | FROM node:16-alpine 3 | WORKDIR /app 4 | COPY package*.json ./ 5 | COPY . . 6 | 7 | ARG DB_USERNAME 8 | ARG DB_PASSWORD 9 | ARG DB_NAME 10 | ARG DB_HOST 11 | ARG PORT 12 | ARG SECRET_KEY 13 | ARG AMQP_URL 14 | ARG AUTH_TO_USER_QUEUE 15 | ARG USER_TO_AUTH_QUEUE 16 | 17 | ENV DB_USERNAME $DB_USERNAME 18 | ENV DB_PASSWORD $DB_PASSWORD 19 | ENV DB_NAME $DB_NAME 20 | ENV DB_HOST $DB_HOST 21 | ENV PORT $PORT 22 | ENV SECRET_KEY $SECRET_KEY 23 | ENV AMQP_URL $AMQP_URL 24 | ENV AUTH_TO_USER_QUEUE $AUTH_TO_USER_QUEUE 25 | ENV USER_TO_AUTH_QUEUE $USER_TO_AUTH_QUEUE 26 | 27 | RUN npm install 28 | RUN npm run build 29 | 30 | ## Run stage 31 | FROM node:16-alpine 32 | 33 | WORKDIR /app 34 | COPY package*.json ./ 35 | RUN npm install --only=production 36 | COPY --from=0 /app/build ./build 37 | EXPOSE 5000 38 | CMD npm start -------------------------------------------------------------------------------- /event-driven-microservices/user/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Build stage 2 | FROM node:16-alpine 3 | WORKDIR /app 4 | COPY package*.json ./ 5 | COPY . . 6 | 7 | ARG DB_USERNAME 8 | ARG DB_PASSWORD 9 | ARG DB_NAME 10 | ARG DB_HOST 11 | ARG PORT 12 | ARG SECRET_KEY 13 | ARG AMQP_URL 14 | ARG AUTH_TO_USER_QUEUE 15 | ARG USER_TO_AUTH_QUEUE 16 | 17 | ENV DB_USERNAME $DB_USERNAME 18 | ENV DB_PASSWORD $DB_PASSWORD 19 | ENV DB_NAME $DB_NAME 20 | ENV DB_HOST $DB_HOST 21 | ENV PORT $PORT 22 | ENV SECRET_KEY $SECRET_KEY 23 | ENV AMQP_URL $AMQP_URL 24 | ENV AUTH_TO_USER_QUEUE $AUTH_TO_USER_QUEUE 25 | ENV USER_TO_AUTH_QUEUE $USER_TO_AUTH_QUEUE 26 | 27 | RUN npm install 28 | RUN npm run build 29 | 30 | ## Run stage 31 | FROM node:16-alpine 32 | 33 | WORKDIR /app 34 | COPY package*.json ./ 35 | RUN npm install --only=production 36 | COPY --from=0 /app/build ./build 37 | EXPOSE 3000 38 | CMD npm start -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Build stage 2 | FROM node:16-alpine 3 | WORKDIR /app 4 | COPY package*.json ./ 5 | COPY . . 6 | 7 | ARG DB_USERNAME 8 | ARG DB_PASSWORD 9 | ARG DB_NAME 10 | ARG DB_HOST 11 | ARG PORT 12 | ARG SECRET_KEY 13 | ARG AMQP_URL 14 | ARG AUTH_TO_USER_QUEUE 15 | ARG USER_TO_AUTH_QUEUE 16 | 17 | ENV DB_USERNAME $DB_USERNAME 18 | ENV DB_PASSWORD $DB_PASSWORD 19 | ENV DB_NAME $DB_NAME 20 | ENV DB_HOST $DB_HOST 21 | ENV PORT $PORT 22 | ENV SECRET_KEY $SECRET_KEY 23 | ENV AMQP_URL $AMQP_URL 24 | ENV AUTH_TO_USER_QUEUE $AUTH_TO_USER_QUEUE 25 | ENV USER_TO_AUTH_QUEUE $USER_TO_AUTH_QUEUE 26 | 27 | RUN npm install 28 | RUN npm run build 29 | 30 | ## Run stage 31 | FROM node:16-alpine 32 | 33 | WORKDIR /app 34 | COPY package*.json ./ 35 | RUN npm install --only=production 36 | COPY --from=0 /app/build ./build 37 | EXPOSE 5000 38 | CMD npm start -------------------------------------------------------------------------------- /handbook/event-driven-design/user/Dockerfile: -------------------------------------------------------------------------------- 1 | ## Build stage 2 | FROM node:16-alpine 3 | WORKDIR /app 4 | COPY package*.json ./ 5 | COPY . . 6 | 7 | ARG DB_USERNAME 8 | ARG DB_PASSWORD 9 | ARG DB_NAME 10 | ARG DB_HOST 11 | ARG PORT 12 | ARG SECRET_KEY 13 | ARG AMQP_URL 14 | ARG AUTH_TO_USER_QUEUE 15 | ARG USER_TO_AUTH_QUEUE 16 | 17 | ENV DB_USERNAME $DB_USERNAME 18 | ENV DB_PASSWORD $DB_PASSWORD 19 | ENV DB_NAME $DB_NAME 20 | ENV DB_HOST $DB_HOST 21 | ENV PORT $PORT 22 | ENV SECRET_KEY $SECRET_KEY 23 | ENV AMQP_URL $AMQP_URL 24 | ENV AUTH_TO_USER_QUEUE $AUTH_TO_USER_QUEUE 25 | ENV USER_TO_AUTH_QUEUE $USER_TO_AUTH_QUEUE 26 | 27 | RUN npm install 28 | RUN npm run build 29 | 30 | ## Run stage 31 | FROM node:16-alpine 32 | 33 | WORKDIR /app 34 | COPY package*.json ./ 35 | RUN npm install --only=production 36 | COPY --from=0 /app/build ./build 37 | EXPOSE 3000 38 | CMD npm start -------------------------------------------------------------------------------- /setup-article-material/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | server: 4 | build: 5 | context: . 6 | dockerfile: Dockerfile 7 | container_name: server 8 | image: server 9 | restart: always 10 | volumes: 11 | - /usr/app/node_modules 12 | - ./src:/usr/app/src 13 | - ./build:/usr/app/build 14 | networks: 15 | - app-network 16 | ports: 17 | - "5000:5000" 18 | db: 19 | image: postgres 20 | ports: 21 | - "5432:5432" 22 | container_name: db 23 | env_file: 24 | - ".env" 25 | environment: 26 | - POSTGRES_USER=${DB_USER} 27 | - POSTGRES_PASSWORD=${DB_PASSWORD} 28 | - POSTGRES_DB=${DB_NAME} 29 | volumes: 30 | - db-volume:/var/lib/postgresql/data 31 | networks: 32 | app-network: 33 | driver: bridge 34 | volumes: 35 | db-volume: 36 | driver: local -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/path-to-regexp/History.md: -------------------------------------------------------------------------------- 1 | 0.1.7 / 2015-07-28 2 | ================== 3 | 4 | * Fixed regression with escaped round brackets and matching groups. 5 | 6 | 0.1.6 / 2015-06-19 7 | ================== 8 | 9 | * Replace `index` feature by outputting all parameters, unnamed and named. 10 | 11 | 0.1.5 / 2015-05-08 12 | ================== 13 | 14 | * Add an index property for position in match result. 15 | 16 | 0.1.4 / 2015-03-05 17 | ================== 18 | 19 | * Add license information 20 | 21 | 0.1.3 / 2014-07-06 22 | ================== 23 | 24 | * Better array support 25 | * Improved support for trailing slash in non-ending mode 26 | 27 | 0.1.0 / 2014-03-06 28 | ================== 29 | 30 | * add options.end 31 | 32 | 0.0.2 / 2013-02-10 33 | ================== 34 | 35 | * Update to match current express 36 | * add .license property to component.json 37 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/cookie-signature/History.md: -------------------------------------------------------------------------------- 1 | 1.0.6 / 2015-02-03 2 | ================== 3 | 4 | * use `npm test` instead of `make test` to run tests 5 | * clearer assertion messages when checking input 6 | 7 | 8 | 1.0.5 / 2014-09-05 9 | ================== 10 | 11 | * add license to package.json 12 | 13 | 1.0.4 / 2014-06-25 14 | ================== 15 | 16 | * corrected avoidance of timing attacks (thanks @tenbits!) 17 | 18 | 1.0.3 / 2014-01-28 19 | ================== 20 | 21 | * [incorrect] fix for timing attacks 22 | 23 | 1.0.2 / 2014-01-28 24 | ================== 25 | 26 | * fix missing repository warning 27 | * fix typo in test 28 | 29 | 1.0.1 / 2013-04-15 30 | ================== 31 | 32 | * Revert "Changed underlying HMAC algo. to sha512." 33 | * Revert "Fix for timing attacks on MAC verification." 34 | 35 | 0.0.1 / 2010-01-03 36 | ================== 37 | 38 | * Initial release 39 | -------------------------------------------------------------------------------- /wallet/src/utils/response_template.ts: -------------------------------------------------------------------------------- 1 | import { Response } from 'express' 2 | 3 | const successResponse = (res: Response, message: string, data?: any): Response> => res.status(200).json({ 4 | data, 5 | message, 6 | success: true, 7 | }) 8 | 9 | const internalServerError = (res: Response): Response> => res.status(500).json({ 10 | success: false, 11 | message: 'Internal server error', 12 | }) 13 | 14 | const badRequestError = (res: Response, message: string): Response> => res.status(400).json({ 15 | message, 16 | success: false, 17 | }) 18 | 19 | const unauthorizedError = (res: Response): Response> => res.status(401).json({ 20 | success: false, 21 | message: 'Unauthorized', 22 | }) 23 | 24 | export default { 25 | successResponse, 26 | badRequestError, 27 | unauthorizedError, 28 | internalServerError, 29 | } 30 | -------------------------------------------------------------------------------- /event-driven-article-material/auth/src/producer.ts: -------------------------------------------------------------------------------- 1 | import amqp, { Connection } from 'amqplib/callback_api' 2 | 3 | const createMQProducer = (amqpUrl: string, queueName: string) => { 4 | console.log('Connecting to RabbitMQ...') 5 | let ch: any 6 | amqp.connect(amqpUrl, (errorConnect: Error, connection: Connection) => { 7 | if (errorConnect) { 8 | console.log('Error connecting to RabbitMQ: ', errorConnect) 9 | return 10 | } 11 | 12 | connection.createChannel((errorChannel, channel) => { 13 | if (errorChannel) { 14 | console.log('Error creating channel: ', errorChannel) 15 | return 16 | } 17 | 18 | ch = channel 19 | console.log('Connected to RabbitMQ') 20 | }) 21 | }) 22 | return (msg: string) => { 23 | console.log('Produce message to RabbitMQ...') 24 | ch.sendToQueue(queueName, Buffer.from(msg)) 25 | } 26 | } 27 | 28 | export default createMQProducer 29 | -------------------------------------------------------------------------------- /event-driven-microservices/auth/manifest/deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: auth-service-deployment 5 | spec: 6 | replicas: 1 7 | selector: 8 | matchLabels: 9 | app: auth-service 10 | template: 11 | metadata: 12 | name: auth-service 13 | labels: 14 | app: auth-service 15 | spec: 16 | containers: 17 | - name: auth-service 18 | image: agusrichard/auth-service 19 | imagePullPolicy: Always 20 | livenessProbe: 21 | httpGet: 22 | path: / 23 | port: 5000 24 | initialDelaySeconds: 30 25 | periodSeconds: 2 26 | resources: 27 | limits: 28 | cpu: "1" 29 | memory: "1Gi" 30 | requests: 31 | cpu: "1" 32 | memory: "1Gi" 33 | envFrom: 34 | - secretRef: 35 | name: auth-service-secret -------------------------------------------------------------------------------- /event-driven-microservices/user/manifest/deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: user-service-deployment 5 | spec: 6 | replicas: 1 7 | selector: 8 | matchLabels: 9 | app: user-service 10 | template: 11 | metadata: 12 | name: user-service 13 | labels: 14 | app: user-service 15 | spec: 16 | containers: 17 | - name: user-service 18 | image: agusrichard/user-service 19 | imagePullPolicy: Always 20 | livenessProbe: 21 | httpGet: 22 | path: / 23 | port: 5000 24 | initialDelaySeconds: 30 25 | periodSeconds: 2 26 | resources: 27 | limits: 28 | cpu: "1" 29 | memory: "1Gi" 30 | requests: 31 | cpu: "1" 32 | memory: "1Gi" 33 | envFrom: 34 | - secretRef: 35 | name: user-service-secret -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/manifest/deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: auth-service-deployment 5 | spec: 6 | replicas: 1 7 | selector: 8 | matchLabels: 9 | app: auth-service 10 | template: 11 | metadata: 12 | name: auth-service 13 | labels: 14 | app: auth-service 15 | spec: 16 | containers: 17 | - name: auth-service 18 | image: agusrichard/auth-service 19 | imagePullPolicy: Always 20 | livenessProbe: 21 | httpGet: 22 | path: / 23 | port: 5000 24 | initialDelaySeconds: 30 25 | periodSeconds: 2 26 | resources: 27 | limits: 28 | cpu: "1" 29 | memory: "1Gi" 30 | requests: 31 | cpu: "1" 32 | memory: "1Gi" 33 | envFrom: 34 | - secretRef: 35 | name: auth-service-secret -------------------------------------------------------------------------------- /handbook/event-driven-design/user/manifest/deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: user-service-deployment 5 | spec: 6 | replicas: 1 7 | selector: 8 | matchLabels: 9 | app: user-service 10 | template: 11 | metadata: 12 | name: user-service 13 | labels: 14 | app: user-service 15 | spec: 16 | containers: 17 | - name: user-service 18 | image: agusrichard/user-service 19 | imagePullPolicy: Always 20 | livenessProbe: 21 | httpGet: 22 | path: / 23 | port: 5000 24 | initialDelaySeconds: 30 25 | periodSeconds: 2 26 | resources: 27 | limits: 28 | cpu: "1" 29 | memory: "1Gi" 30 | requests: 31 | cpu: "1" 32 | memory: "1Gi" 33 | envFrom: 34 | - secretRef: 35 | name: user-service-secret -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/escape-html/Readme.md: -------------------------------------------------------------------------------- 1 | 2 | # escape-html 3 | 4 | Escape string for use in HTML 5 | 6 | ## Example 7 | 8 | ```js 9 | var escape = require('escape-html'); 10 | var html = escape('foo & bar'); 11 | // -> foo & bar 12 | ``` 13 | 14 | ## Benchmark 15 | 16 | ``` 17 | $ npm run-script bench 18 | 19 | > escape-html@1.0.3 bench nodejs-escape-html 20 | > node benchmark/index.js 21 | 22 | 23 | http_parser@1.0 24 | node@0.10.33 25 | v8@3.14.5.9 26 | ares@1.9.0-DEV 27 | uv@0.10.29 28 | zlib@1.2.3 29 | modules@11 30 | openssl@1.0.1j 31 | 32 | 1 test completed. 33 | 2 tests completed. 34 | 3 tests completed. 35 | 36 | no special characters x 19,435,271 ops/sec ±0.85% (187 runs sampled) 37 | single special character x 6,132,421 ops/sec ±0.67% (194 runs sampled) 38 | many special characters x 3,175,826 ops/sec ±0.65% (193 runs sampled) 39 | ``` 40 | 41 | ## License 42 | 43 | MIT -------------------------------------------------------------------------------- /wallet/src/middlewares/auth.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response, NextFunction } from 'express' 2 | 3 | import { ResponseTemplate, verifyToken } from '../utils' 4 | 5 | export interface AuthMiddleware { 6 | authenticate: (req: Request, res: Response, next: NextFunction) => Response> 7 | } 8 | 9 | const initializeAuthMiddleware = (): AuthMiddleware => ({ 10 | authenticate: (req: Request, res: Response, next: NextFunction): Response> => { 11 | try { 12 | const token: string = req.headers.authorization || '' 13 | 14 | if (!token.startsWith('Bearer')) { 15 | return ResponseTemplate.unauthorizedError(res) 16 | } 17 | 18 | res.locals.userData = verifyToken(token.slice(7)) 19 | next() 20 | return null 21 | } catch (error) { 22 | return ResponseTemplate.unauthorizedError(res) 23 | } 24 | }, 25 | }) 26 | 27 | export default initializeAuthMiddleware 28 | -------------------------------------------------------------------------------- /event-driven-article-material/auth/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "event-driven-article-material", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "build": "tsc", 8 | "dev": "eslint --fix --ext .ts ./src && nodemon", 9 | "lint": "eslint --fix --ext .ts ./src" 10 | }, 11 | "keywords": [], 12 | "author": "", 13 | "license": "ISC", 14 | "dependencies": { 15 | "@types/dotenv": "^8.2.0", 16 | "amqplib": "^0.8.0", 17 | "body-parser": "^1.19.2", 18 | "dotenv": "^16.0.0", 19 | "express": "^4.17.3", 20 | "typescript": "^4.6.2" 21 | }, 22 | "devDependencies": { 23 | "@types/amqplib": "^0.8.2", 24 | "@types/express": "^4.17.13", 25 | "@typescript-eslint/eslint-plugin": "^5.15.0", 26 | "@typescript-eslint/parser": "^5.15.0", 27 | "eslint": "^8.11.0", 28 | "eslint-config-airbnb-base": "^15.0.0", 29 | "eslint-plugin-import": "^2.25.4", 30 | "nodemon": "^2.0.20" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /event-driven-article-material/notification/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "notification", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "build": "tsc -b", 8 | "dev": "eslint --fix --ext .ts ./src && nodemon", 9 | "lint": "eslint --fix --ext .ts ./src", 10 | "start": "node ./build/index.js" 11 | }, 12 | "keywords": [], 13 | "author": "", 14 | "license": "ISC", 15 | "dependencies": { 16 | "amqplib": "^0.8.0", 17 | "body-parser": "^1.19.2", 18 | "dotenv": "^16.0.0", 19 | "express": "^4.17.3", 20 | "typescript": "^4.6.2" 21 | }, 22 | "devDependencies": { 23 | "@types/amqplib": "^0.8.2", 24 | "@types/express": "^4.17.13", 25 | "@typescript-eslint/eslint-plugin": "^5.15.0", 26 | "@typescript-eslint/parser": "^5.15.0", 27 | "eslint": "^8.11.0", 28 | "eslint-config-airbnb-base": "^15.0.0", 29 | "eslint-plugin-import": "^2.25.4", 30 | "nodemon": "^2.0.15" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /event-driven-microservices/auth/src/configs/configs.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv' 2 | 3 | dotenv.config() 4 | 5 | export type ConfigType = { 6 | DB_HOST: string 7 | DB_USERNAME: string 8 | DB_PASSWORD: string 9 | DB_NAME: string 10 | PORT: number 11 | SECRET_KEY: string 12 | AMQP_URL: string 13 | AUTH_TO_USER_QUEUE: string 14 | USER_TO_AUTH_QUEUE: string 15 | } 16 | 17 | function createConfigs(): ConfigType { 18 | return { 19 | PORT: parseInt(String(process.env.PORT), 10), 20 | DB_HOST: String(process.env.DB_HOST), 21 | DB_USERNAME: String(process.env.DB_USERNAME), 22 | DB_NAME: String(process.env.DB_NAME), 23 | DB_PASSWORD: String(process.env.DB_PASSWORD), 24 | SECRET_KEY: String(process.env.SECRET_KEY), 25 | AMQP_URL: String(process.env.AMQP_URL), 26 | AUTH_TO_USER_QUEUE: String(process.env.AUTH_TO_USER_QUEUE), 27 | USER_TO_AUTH_QUEUE: String(process.env.USER_TO_AUTH_QUEUE), 28 | } 29 | } 30 | 31 | export default createConfigs 32 | -------------------------------------------------------------------------------- /event-driven-microservices/user/src/configs/configs.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv' 2 | 3 | dotenv.config() 4 | 5 | export type ConfigType = { 6 | DB_HOST: string 7 | DB_USERNAME: string 8 | DB_PASSWORD: string 9 | DB_NAME: string 10 | PORT: number 11 | SECRET_KEY: string 12 | AMQP_URL: string 13 | AUTH_TO_USER_QUEUE: string 14 | USER_TO_AUTH_QUEUE: string 15 | } 16 | 17 | function createConfigs(): ConfigType { 18 | return { 19 | PORT: parseInt(String(process.env.PORT), 10), 20 | DB_HOST: String(process.env.DB_HOST), 21 | DB_USERNAME: String(process.env.DB_USERNAME), 22 | DB_NAME: String(process.env.DB_NAME), 23 | DB_PASSWORD: String(process.env.DB_PASSWORD), 24 | SECRET_KEY: String(process.env.SECRET_KEY), 25 | AMQP_URL: String(process.env.AMQP_URL), 26 | AUTH_TO_USER_QUEUE: String(process.env.AUTH_TO_USER_QUEUE), 27 | USER_TO_AUTH_QUEUE: String(process.env.USER_TO_AUTH_QUEUE), 28 | } 29 | } 30 | 31 | export default createConfigs 32 | -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/src/configs/configs.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv' 2 | 3 | dotenv.config() 4 | 5 | export type ConfigType = { 6 | DB_HOST: string 7 | DB_USERNAME: string 8 | DB_PASSWORD: string 9 | DB_NAME: string 10 | PORT: number 11 | SECRET_KEY: string 12 | AMQP_URL: string 13 | AUTH_TO_USER_QUEUE: string 14 | USER_TO_AUTH_QUEUE: string 15 | } 16 | 17 | function createConfigs(): ConfigType { 18 | return { 19 | PORT: parseInt(String(process.env.PORT), 10), 20 | DB_HOST: String(process.env.DB_HOST), 21 | DB_USERNAME: String(process.env.DB_USERNAME), 22 | DB_NAME: String(process.env.DB_NAME), 23 | DB_PASSWORD: String(process.env.DB_PASSWORD), 24 | SECRET_KEY: String(process.env.SECRET_KEY), 25 | AMQP_URL: String(process.env.AMQP_URL), 26 | AUTH_TO_USER_QUEUE: String(process.env.AUTH_TO_USER_QUEUE), 27 | USER_TO_AUTH_QUEUE: String(process.env.USER_TO_AUTH_QUEUE), 28 | } 29 | } 30 | 31 | export default createConfigs 32 | -------------------------------------------------------------------------------- /handbook/event-driven-design/user/src/configs/configs.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv' 2 | 3 | dotenv.config() 4 | 5 | export type ConfigType = { 6 | DB_HOST: string 7 | DB_USERNAME: string 8 | DB_PASSWORD: string 9 | DB_NAME: string 10 | PORT: number 11 | SECRET_KEY: string 12 | AMQP_URL: string 13 | AUTH_TO_USER_QUEUE: string 14 | USER_TO_AUTH_QUEUE: string 15 | } 16 | 17 | function createConfigs(): ConfigType { 18 | return { 19 | PORT: parseInt(String(process.env.PORT), 10), 20 | DB_HOST: String(process.env.DB_HOST), 21 | DB_USERNAME: String(process.env.DB_USERNAME), 22 | DB_NAME: String(process.env.DB_NAME), 23 | DB_PASSWORD: String(process.env.DB_PASSWORD), 24 | SECRET_KEY: String(process.env.SECRET_KEY), 25 | AMQP_URL: String(process.env.AMQP_URL), 26 | AUTH_TO_USER_QUEUE: String(process.env.AUTH_TO_USER_QUEUE), 27 | USER_TO_AUTH_QUEUE: String(process.env.USER_TO_AUTH_QUEUE), 28 | } 29 | } 30 | 31 | export default createConfigs 32 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/vary/HISTORY.md: -------------------------------------------------------------------------------- 1 | 1.1.2 / 2017-09-23 2 | ================== 3 | 4 | * perf: improve header token parsing speed 5 | 6 | 1.1.1 / 2017-03-20 7 | ================== 8 | 9 | * perf: hoist regular expression 10 | 11 | 1.1.0 / 2015-09-29 12 | ================== 13 | 14 | * Only accept valid field names in the `field` argument 15 | - Ensures the resulting string is a valid HTTP header value 16 | 17 | 1.0.1 / 2015-07-08 18 | ================== 19 | 20 | * Fix setting empty header from empty `field` 21 | * perf: enable strict mode 22 | * perf: remove argument reassignments 23 | 24 | 1.0.0 / 2014-08-10 25 | ================== 26 | 27 | * Accept valid `Vary` header string as `field` 28 | * Add `vary.append` for low-level string manipulation 29 | * Move to `jshttp` orgainzation 30 | 31 | 0.1.0 / 2014-06-05 32 | ================== 33 | 34 | * Support array of fields to set 35 | 36 | 0.0.0 / 2014-06-04 37 | ================== 38 | 39 | * Initial release 40 | -------------------------------------------------------------------------------- /wallet/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es2021": true 5 | }, 6 | "extends": [ 7 | "airbnb-base", 8 | "eslint:recommended", 9 | "plugin:@typescript-eslint/eslint-recommended", 10 | "plugin:@typescript-eslint/recommended" 11 | ], 12 | "parser": "@typescript-eslint/parser", 13 | "parserOptions": { 14 | "ecmaVersion": 12, 15 | "sourceType": "module" 16 | }, 17 | "plugins": [ 18 | "@typescript-eslint" 19 | ], 20 | "rules": { 21 | "semi": [2, "never"], 22 | "import/no-unresolved": "off", 23 | "no-console": "off", 24 | "import/extensions": "off", 25 | "max-len": ["error", { "code": 150 }], 26 | "import/prefer-default-export": "off", 27 | "@typescript-eslint/explicit-module-boundary-types": "off", 28 | "@typescript-eslint/no-explicit-any": "off", 29 | "arrow-body-style": "off", 30 | "camelcase": "off" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /event-driven-microservices/auth/src/publisher/publisher.ts: -------------------------------------------------------------------------------- 1 | import amqp, { Connection } from 'amqplib/callback_api' 2 | 3 | import { ConfigType } from '../configs' 4 | 5 | const createMQPublisher = (config: ConfigType) => { 6 | console.log('Connecting to RabbitMQ...') 7 | let ch: any 8 | const queue = config.AUTH_TO_USER_QUEUE 9 | amqp.connect(config.AMQP_URL, (errorConnect: Error, connection: Connection) => { 10 | if (errorConnect) { 11 | console.log('Error connecting to RabbitMQ: ', errorConnect) 12 | return 13 | } 14 | 15 | connection.createChannel((errorChannel, channel) => { 16 | if (errorChannel) { 17 | console.log('Error creating channel: ', errorChannel) 18 | return 19 | } 20 | 21 | ch = channel 22 | console.log('Connected to RabbitMQ') 23 | }) 24 | }) 25 | return (msg: string) => { 26 | console.log('Publishing message to RabbitMQ...') 27 | ch.sendToQueue(queue, Buffer.from(msg)) 28 | } 29 | } 30 | 31 | export default createMQPublisher 32 | -------------------------------------------------------------------------------- /event-driven-microservices/user/src/publisher/publisher.ts: -------------------------------------------------------------------------------- 1 | import amqp, { Connection } from 'amqplib/callback_api' 2 | 3 | import { ConfigType } from '../configs' 4 | 5 | const createMQPublisher = (config: ConfigType) => { 6 | console.log('Connecting to RabbitMQ...') 7 | let ch: any 8 | const queue = config.USER_TO_AUTH_QUEUE 9 | amqp.connect(config.AMQP_URL, (errorConnect: Error, connection: Connection) => { 10 | if (errorConnect) { 11 | console.log('Error connecting to RabbitMQ: ', errorConnect) 12 | return 13 | } 14 | 15 | connection.createChannel((errorChannel, channel) => { 16 | if (errorChannel) { 17 | console.log('Error creating channel: ', errorChannel) 18 | return 19 | } 20 | 21 | ch = channel 22 | console.log('Connected to RabbitMQ') 23 | }) 24 | }) 25 | return (msg: string) => { 26 | console.log('Publishing message to RabbitMQ...') 27 | ch.sendToQueue(queue, Buffer.from(msg)) 28 | } 29 | } 30 | 31 | export default createMQPublisher 32 | -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/src/publisher/publisher.ts: -------------------------------------------------------------------------------- 1 | import amqp, { Connection } from 'amqplib/callback_api' 2 | 3 | import { ConfigType } from '../configs' 4 | 5 | const createMQPublisher = (config: ConfigType) => { 6 | console.log('Connecting to RabbitMQ...') 7 | let ch: any 8 | const queue = config.AUTH_TO_USER_QUEUE 9 | amqp.connect(config.AMQP_URL, (errorConnect: Error, connection: Connection) => { 10 | if (errorConnect) { 11 | console.log('Error connecting to RabbitMQ: ', errorConnect) 12 | return 13 | } 14 | 15 | connection.createChannel((errorChannel, channel) => { 16 | if (errorChannel) { 17 | console.log('Error creating channel: ', errorChannel) 18 | return 19 | } 20 | 21 | ch = channel 22 | console.log('Connected to RabbitMQ') 23 | }) 24 | }) 25 | return (msg: string) => { 26 | console.log('Publishing message to RabbitMQ...') 27 | ch.sendToQueue(queue, Buffer.from(msg)) 28 | } 29 | } 30 | 31 | export default createMQPublisher 32 | -------------------------------------------------------------------------------- /handbook/event-driven-design/user/src/publisher/publisher.ts: -------------------------------------------------------------------------------- 1 | import amqp, { Connection } from 'amqplib/callback_api' 2 | 3 | import { ConfigType } from '../configs' 4 | 5 | const createMQPublisher = (config: ConfigType) => { 6 | console.log('Connecting to RabbitMQ...') 7 | let ch: any 8 | const queue = config.USER_TO_AUTH_QUEUE 9 | amqp.connect(config.AMQP_URL, (errorConnect: Error, connection: Connection) => { 10 | if (errorConnect) { 11 | console.log('Error connecting to RabbitMQ: ', errorConnect) 12 | return 13 | } 14 | 15 | connection.createChannel((errorChannel, channel) => { 16 | if (errorChannel) { 17 | console.log('Error creating channel: ', errorChannel) 18 | return 19 | } 20 | 21 | ch = channel 22 | console.log('Connected to RabbitMQ') 23 | }) 24 | }) 25 | return (msg: string) => { 26 | console.log('Publishing message to RabbitMQ...') 27 | ch.sendToQueue(queue, Buffer.from(msg)) 28 | } 29 | } 30 | 31 | export default createMQPublisher 32 | -------------------------------------------------------------------------------- /setup-article-material/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es2021": true 5 | }, 6 | "extends": [ 7 | "airbnb-base", 8 | "eslint:recommended", 9 | "plugin:@typescript-eslint/eslint-recommended", 10 | "plugin:@typescript-eslint/recommended" 11 | ], 12 | "parser": "@typescript-eslint/parser", 13 | "parserOptions": { 14 | "ecmaVersion": 12, 15 | "sourceType": "module" 16 | }, 17 | "plugins": [ 18 | "@typescript-eslint" 19 | ], 20 | "rules": { 21 | "semi": [2, "never"], 22 | "import/no-unresolved": "off", 23 | "no-console": "off", 24 | "import/extensions": "off", 25 | "max-len": ["error", { "code": 150 }], 26 | "import/prefer-default-export": "off", 27 | "@typescript-eslint/explicit-module-boundary-types": "off", 28 | "@typescript-eslint/no-explicit-any": "off", 29 | "arrow-body-style": "off", 30 | "camelcase": "off" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /event-driven-article-material/auth/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es2021": true 5 | }, 6 | "extends": [ 7 | "airbnb-base", 8 | "eslint:recommended", 9 | "plugin:@typescript-eslint/eslint-recommended", 10 | "plugin:@typescript-eslint/recommended" 11 | ], 12 | "parser": "@typescript-eslint/parser", 13 | "parserOptions": { 14 | "ecmaVersion": 12, 15 | "sourceType": "module" 16 | }, 17 | "plugins": [ 18 | "@typescript-eslint" 19 | ], 20 | "rules": { 21 | "semi": [2, "never"], 22 | "import/no-unresolved": "off", 23 | "no-console": "off", 24 | "import/extensions": "off", 25 | "max-len": ["error", { "code": 150 }], 26 | "import/prefer-default-export": "off", 27 | "@typescript-eslint/explicit-module-boundary-types": "off", 28 | "@typescript-eslint/no-explicit-any": "off", 29 | "arrow-body-style": "off", 30 | "camelcase": "off" 31 | } 32 | } -------------------------------------------------------------------------------- /wallet/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | wallet-api-server: 5 | build: 6 | context: . 7 | dockerfile: dev.Dockerfile 8 | container_name: wallet-api-server 9 | image: wallet-api-server 10 | restart: unless-stopped 11 | env_file: 12 | - ".env" 13 | volumes: 14 | - /usr/app/node_modules 15 | - ./src:/usr/app/src 16 | - ./build:/usr/app/build 17 | networks: 18 | - app-network 19 | ports: 20 | - "3000:3000" 21 | wallet-db: 22 | build: 23 | context: . 24 | dockerfile: postgres.Dockerfile 25 | ports: 26 | - "5432:5432" 27 | container_name: wallet-db 28 | env_file: 29 | - ".env" 30 | environment: 31 | - POSTGRES_USER=${DB_USER} 32 | - POSTGRES_PASSWORD=${DB_PASSWORD} 33 | - POSTGRES_DB=${DB_NAME} 34 | volumes: 35 | - wallet-db-volume:/var/lib/postgresql/data 36 | networks: 37 | app-network: 38 | driver: bridge 39 | volumes: 40 | wallet-db-volume: 41 | driver: local 42 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/setprototypeof/README.md: -------------------------------------------------------------------------------- 1 | # Polyfill for `Object.setPrototypeOf` 2 | 3 | [![NPM Version](https://img.shields.io/npm/v/setprototypeof.svg)](https://npmjs.org/package/setprototypeof) 4 | [![NPM Downloads](https://img.shields.io/npm/dm/setprototypeof.svg)](https://npmjs.org/package/setprototypeof) 5 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/standard/standard) 6 | 7 | A simple cross platform implementation to set the prototype of an instianted object. Supports all modern browsers and at least back to IE8. 8 | 9 | ## Usage: 10 | 11 | ``` 12 | $ npm install --save setprototypeof 13 | ``` 14 | 15 | ```javascript 16 | var setPrototypeOf = require('setprototypeof') 17 | 18 | var obj = {} 19 | setPrototypeOf(obj, { 20 | foo: function () { 21 | return 'bar' 22 | } 23 | }) 24 | obj.foo() // bar 25 | ``` 26 | 27 | TypeScript is also supported: 28 | 29 | ```typescript 30 | import setPrototypeOf = require('setprototypeof') 31 | ``` 32 | -------------------------------------------------------------------------------- /event-driven-article-material/notification/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es2021": true 5 | }, 6 | "extends": [ 7 | "airbnb-base", 8 | "eslint:recommended", 9 | "plugin:@typescript-eslint/eslint-recommended", 10 | "plugin:@typescript-eslint/recommended" 11 | ], 12 | "parser": "@typescript-eslint/parser", 13 | "parserOptions": { 14 | "ecmaVersion": 12, 15 | "sourceType": "module" 16 | }, 17 | "plugins": [ 18 | "@typescript-eslint" 19 | ], 20 | "rules": { 21 | "semi": [2, "never"], 22 | "import/no-unresolved": "off", 23 | "no-console": "off", 24 | "import/extensions": "off", 25 | "max-len": ["error", { "code": 150 }], 26 | "import/prefer-default-export": "off", 27 | "@typescript-eslint/explicit-module-boundary-types": "off", 28 | "@typescript-eslint/no-explicit-any": "off", 29 | "arrow-body-style": "off", 30 | "camelcase": "off" 31 | } 32 | } -------------------------------------------------------------------------------- /event-driven-microservices/user/src/middlewares/auth.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response, NextFunction } from 'express' 2 | 3 | import { verifyToken } from '../utils' 4 | 5 | const authMiddleware = (req: Request, res: Response, next: NextFunction): void => { 6 | try { 7 | const token: string = req.headers.authorization || '' 8 | 9 | if (!token.startsWith('Bearer')) { 10 | res.json({ 11 | error: 'Invalid token', 12 | }) 13 | return 14 | } 15 | 16 | res.locals.userData = verifyToken(token.slice(7)) 17 | next() 18 | } catch (error) { 19 | res.json({ 20 | error: 'Unauthorized', 21 | }) 22 | } 23 | } 24 | 25 | export const adminOnlyMiddleware = (req: Request, res: Response, next: NextFunction): void => { 26 | try { 27 | const { role } = res.locals.userData 28 | if (role !== 1) { 29 | res.json({ error: 'You are not allowed to do this action' }) 30 | return 31 | } 32 | next() 33 | } catch (error) { 34 | res.json({ error }) 35 | } 36 | } 37 | 38 | export default authMiddleware 39 | -------------------------------------------------------------------------------- /handbook/event-driven-design/user/src/middlewares/auth.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response, NextFunction } from 'express' 2 | 3 | import { verifyToken } from '../utils' 4 | 5 | const authMiddleware = (req: Request, res: Response, next: NextFunction): void => { 6 | try { 7 | const token: string = req.headers.authorization || '' 8 | 9 | if (!token.startsWith('Bearer')) { 10 | res.json({ 11 | error: 'Invalid token', 12 | }) 13 | return 14 | } 15 | 16 | res.locals.userData = verifyToken(token.slice(7)) 17 | next() 18 | } catch (error) { 19 | res.json({ 20 | error: 'Unauthorized', 21 | }) 22 | } 23 | } 24 | 25 | export const adminOnlyMiddleware = (req: Request, res: Response, next: NextFunction): void => { 26 | try { 27 | const { role } = res.locals.userData 28 | if (role !== 1) { 29 | res.json({ error: 'You are not allowed to do this action' }) 30 | return 31 | } 32 | next() 33 | } catch (error) { 34 | res.json({ error }) 35 | } 36 | } 37 | 38 | export default authMiddleware 39 | -------------------------------------------------------------------------------- /net-ninja/public/app.js: -------------------------------------------------------------------------------- 1 | import { Invoice } from './classes/Invoice.js'; 2 | import { Payment } from './classes/Payment.js'; 3 | import { ListTemplate } from './classes/ListTemplate.js'; 4 | const form = document.querySelector('.new-item-form'); 5 | const type = document.querySelector('#type'); 6 | const tofrom = document.querySelector('#tofrom'); 7 | const details = document.querySelector('#details'); 8 | const amount = document.querySelector('#amount'); 9 | const ul = document.querySelector('ul'); 10 | const list = new ListTemplate(ul); 11 | form.addEventListener('submit', (event) => { 12 | event.preventDefault(); 13 | let values; 14 | values = [tofrom.value, details.value, amount.valueAsNumber]; 15 | let doc; 16 | if (type.value === 'invoice') { 17 | doc = new Invoice(...values); 18 | } 19 | else { 20 | doc = new Payment(...values); 21 | } 22 | list.render(doc, type.value, 'start'); 23 | }); 24 | // Tuples 25 | let mixed = ['sekar', 22, true]; 26 | console.log(mixed); 27 | let tup; 28 | tup = ['saskia', 20, true]; 29 | console.log(tup); 30 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/express/lib/middleware/init.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * express 3 | * Copyright(c) 2009-2013 TJ Holowaychuk 4 | * Copyright(c) 2013 Roman Shtylman 5 | * Copyright(c) 2014-2015 Douglas Christopher Wilson 6 | * MIT Licensed 7 | */ 8 | 9 | 'use strict'; 10 | 11 | /** 12 | * Module dependencies. 13 | * @private 14 | */ 15 | 16 | var setPrototypeOf = require('setprototypeof') 17 | 18 | /** 19 | * Initialization middleware, exposing the 20 | * request and response to each other, as well 21 | * as defaulting the X-Powered-By header field. 22 | * 23 | * @param {Function} app 24 | * @return {Function} 25 | * @api private 26 | */ 27 | 28 | exports.init = function(app){ 29 | return function expressInit(req, res, next){ 30 | if (app.enabled('x-powered-by')) res.setHeader('X-Powered-By', 'Express'); 31 | req.res = res; 32 | res.req = req; 33 | req.next = next; 34 | 35 | setPrototypeOf(req, app.request) 36 | setPrototypeOf(res, app.response) 37 | 38 | res.locals = res.locals || Object.create(null); 39 | 40 | next(); 41 | }; 42 | }; 43 | 44 | -------------------------------------------------------------------------------- /event-driven-microservices/user/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es2021": true 5 | }, 6 | "extends": [ 7 | "airbnb-base", 8 | "eslint:recommended", 9 | "plugin:@typescript-eslint/eslint-recommended", 10 | "plugin:@typescript-eslint/recommended" 11 | ], 12 | "parser": "@typescript-eslint/parser", 13 | "parserOptions": { 14 | "ecmaVersion": 12, 15 | "sourceType": "module" 16 | }, 17 | "plugins": [ 18 | "@typescript-eslint" 19 | ], 20 | "rules": { 21 | "semi": [2, "never"], 22 | "import/no-unresolved": "off", 23 | "no-console": "off", 24 | "import/extensions": "off", 25 | "max-len": ["error", { "code": 150 }], 26 | "import/prefer-default-export": "off", 27 | "@typescript-eslint/explicit-module-boundary-types": "off", 28 | "@typescript-eslint/no-explicit-any": "off", 29 | "arrow-body-style": "off", 30 | "camelcase": "off", 31 | "no-param-reassign": "off" 32 | }, 33 | "ignorePatterns": ["/build", "/node_modules"] 34 | } -------------------------------------------------------------------------------- /handbook/event-driven-design/user/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es2021": true 5 | }, 6 | "extends": [ 7 | "airbnb-base", 8 | "eslint:recommended", 9 | "plugin:@typescript-eslint/eslint-recommended", 10 | "plugin:@typescript-eslint/recommended" 11 | ], 12 | "parser": "@typescript-eslint/parser", 13 | "parserOptions": { 14 | "ecmaVersion": 12, 15 | "sourceType": "module" 16 | }, 17 | "plugins": [ 18 | "@typescript-eslint" 19 | ], 20 | "rules": { 21 | "semi": [2, "never"], 22 | "import/no-unresolved": "off", 23 | "no-console": "off", 24 | "import/extensions": "off", 25 | "max-len": ["error", { "code": 150 }], 26 | "import/prefer-default-export": "off", 27 | "@typescript-eslint/explicit-module-boundary-types": "off", 28 | "@typescript-eslint/no-explicit-any": "off", 29 | "arrow-body-style": "off", 30 | "camelcase": "off", 31 | "no-param-reassign": "off" 32 | }, 33 | "ignorePatterns": ["/build", "/node_modules"] 34 | } -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/iconv-lite/lib/index.d.ts: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. 4 | * REQUIREMENT: This definition is dependent on the @types/node definition. 5 | * Install with `npm install @types/node --save-dev` 6 | *--------------------------------------------------------------------------------------------*/ 7 | 8 | declare module 'iconv-lite' { 9 | export function decode(buffer: Buffer, encoding: string, options?: Options): string; 10 | 11 | export function encode(content: string, encoding: string, options?: Options): Buffer; 12 | 13 | export function encodingExists(encoding: string): boolean; 14 | 15 | export function decodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream; 16 | 17 | export function encodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream; 18 | } 19 | 20 | export interface Options { 21 | stripBOM?: boolean; 22 | addBOM?: boolean; 23 | defaultEncoding?: string; 24 | } 25 | -------------------------------------------------------------------------------- /playwright-tutorial/public/thirteen.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/express/lib/middleware/query.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * express 3 | * Copyright(c) 2009-2013 TJ Holowaychuk 4 | * Copyright(c) 2013 Roman Shtylman 5 | * Copyright(c) 2014-2015 Douglas Christopher Wilson 6 | * MIT Licensed 7 | */ 8 | 9 | 'use strict'; 10 | 11 | /** 12 | * Module dependencies. 13 | */ 14 | 15 | var merge = require('utils-merge') 16 | var parseUrl = require('parseurl'); 17 | var qs = require('qs'); 18 | 19 | /** 20 | * @param {Object} options 21 | * @return {Function} 22 | * @api public 23 | */ 24 | 25 | module.exports = function query(options) { 26 | var opts = merge({}, options) 27 | var queryparse = qs.parse; 28 | 29 | if (typeof options === 'function') { 30 | queryparse = options; 31 | opts = undefined; 32 | } 33 | 34 | if (opts !== undefined && opts.allowPrototypes === undefined) { 35 | // back-compat for qs module 36 | opts.allowPrototypes = true; 37 | } 38 | 39 | return function query(req, res, next){ 40 | if (!req.query) { 41 | var val = parseUrl(req).query; 42 | req.query = queryparse(val, opts); 43 | } 44 | 45 | next(); 46 | }; 47 | }; 48 | -------------------------------------------------------------------------------- /event-driven-microservices/auth/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es2021": true 5 | }, 6 | "extends": [ 7 | "airbnb-base", 8 | "eslint:recommended", 9 | "plugin:@typescript-eslint/eslint-recommended", 10 | "plugin:@typescript-eslint/recommended" 11 | ], 12 | "parser": "@typescript-eslint/parser", 13 | "parserOptions": { 14 | "ecmaVersion": 12, 15 | "sourceType": "module" 16 | }, 17 | "plugins": [ 18 | "@typescript-eslint" 19 | ], 20 | "rules": { 21 | "semi": [2, "never"], 22 | "import/no-unresolved": "off", 23 | "no-console": "off", 24 | "import/extensions": "off", 25 | "max-len": ["error", { "code": 150 }], 26 | "import/prefer-default-export": "off", 27 | "@typescript-eslint/explicit-module-boundary-types": "off", 28 | "@typescript-eslint/no-explicit-any": "off", 29 | "arrow-body-style": "off", 30 | "camelcase": "off", 31 | "no-param-reassign": "off", 32 | "no-return-assign": "off" 33 | }, 34 | "ignorePatterns": ["/build", "/node_modules"] 35 | } -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es2021": true 5 | }, 6 | "extends": [ 7 | "airbnb-base", 8 | "eslint:recommended", 9 | "plugin:@typescript-eslint/eslint-recommended", 10 | "plugin:@typescript-eslint/recommended" 11 | ], 12 | "parser": "@typescript-eslint/parser", 13 | "parserOptions": { 14 | "ecmaVersion": 12, 15 | "sourceType": "module" 16 | }, 17 | "plugins": [ 18 | "@typescript-eslint" 19 | ], 20 | "rules": { 21 | "semi": [2, "never"], 22 | "import/no-unresolved": "off", 23 | "no-console": "off", 24 | "import/extensions": "off", 25 | "max-len": ["error", { "code": 150 }], 26 | "import/prefer-default-export": "off", 27 | "@typescript-eslint/explicit-module-boundary-types": "off", 28 | "@typescript-eslint/no-explicit-any": "off", 29 | "arrow-body-style": "off", 30 | "camelcase": "off", 31 | "no-param-reassign": "off", 32 | "no-return-assign": "off" 33 | }, 34 | "ignorePatterns": ["/build", "/node_modules"] 35 | } -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/iconv-lite/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Alexander Shtuchkin 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/ms/license.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Zeit, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/ipaddr.js/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011-2017 whitequark 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/safe-buffer/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Feross Aboukhadijeh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/utils-merge/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2017 Jared Hanson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/debug/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 TJ Holowaychuk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 6 | and associated documentation files (the 'Software'), to deal in the Software without restriction, 7 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 9 | subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial 12 | portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 15 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 17 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 18 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/depd/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014-2017 Douglas Christopher Wilson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/encodeurl/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2016 Douglas Christopher Wilson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/etag/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014-2016 Douglas Christopher Wilson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/mime/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2010 Benjamin Thomas, Robert Kieffer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/send/node_modules/ms/license.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Zeit, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/vary/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014-2017 Douglas Christopher Wilson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/content-type/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2015 Douglas Christopher Wilson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/forwarded/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014-2017 Douglas Christopher Wilson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/media-typer/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 Douglas Christopher Wilson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/range-parser/HISTORY.md: -------------------------------------------------------------------------------- 1 | 1.2.1 / 2019-05-10 2 | ================== 3 | 4 | * Improve error when `str` is not a string 5 | 6 | 1.2.0 / 2016-06-01 7 | ================== 8 | 9 | * Add `combine` option to combine overlapping ranges 10 | 11 | 1.1.0 / 2016-05-13 12 | ================== 13 | 14 | * Fix incorrectly returning -1 when there is at least one valid range 15 | * perf: remove internal function 16 | 17 | 1.0.3 / 2015-10-29 18 | ================== 19 | 20 | * perf: enable strict mode 21 | 22 | 1.0.2 / 2014-09-08 23 | ================== 24 | 25 | * Support Node.js 0.6 26 | 27 | 1.0.1 / 2014-09-07 28 | ================== 29 | 30 | * Move repository to jshttp 31 | 32 | 1.0.0 / 2013-12-11 33 | ================== 34 | 35 | * Add repository to package.json 36 | * Add MIT license 37 | 38 | 0.0.4 / 2012-06-17 39 | ================== 40 | 41 | * Change ret -1 for unsatisfiable and -2 when invalid 42 | 43 | 0.0.3 / 2012-06-17 44 | ================== 45 | 46 | * Fix last-byte-pos default to len - 1 47 | 48 | 0.0.2 / 2012-06-14 49 | ================== 50 | 51 | * Add `.type` 52 | 53 | 0.0.1 / 2012-06-11 54 | ================== 55 | 56 | * Initial release 57 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/safer-buffer/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Nikita Skovoroda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/destroy/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014 Jonathan Ong me@jongleberry.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/ee-first/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014 Jonathan Ong me@jongleberry.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/mime-db/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014 Jonathan Ong me@jongleberry.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/proxy-addr/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014-2016 Douglas Christopher Wilson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /event-driven-microservices/auth/src/index.ts: -------------------------------------------------------------------------------- 1 | import morgan from 'morgan' 2 | import bodyParser from 'body-parser' 3 | import express, { Request, Response } from 'express' 4 | 5 | import configs from './configs' 6 | import createUserService from './services' 7 | import createAuthRouter from './routes' 8 | import createMQConsumer from './consumer' 9 | import createMQPublisher from './publisher' 10 | import createUserRepository from './repositories' 11 | 12 | const app = express() 13 | 14 | const conf = configs.createConfigs() 15 | const conn = configs.createMongoDB(conf) 16 | const logger = configs.createLogger(__dirname) 17 | const userRepo = createUserRepository(conn) 18 | const publisher = createMQPublisher(conf) 19 | const userService = createUserService(userRepo, publisher) 20 | const consumer = createMQConsumer(conf, userService) 21 | const authRouter = createAuthRouter(userService) 22 | 23 | app.use(bodyParser.json()) 24 | app.use(morgan('combined', { stream: logger })) 25 | app.use('/auth', authRouter) 26 | 27 | app.get('/', (req: Request, res: Response) => { 28 | res.send('Hello World!') 29 | }) 30 | 31 | consumer() 32 | 33 | app.listen(conf.PORT, () => { 34 | console.log(`Server is running on port ${conf.PORT}`) 35 | }) 36 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/array-flatten/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/content-disposition/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014-2017 Douglas Christopher Wilson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/path-to-regexp/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/src/index.ts: -------------------------------------------------------------------------------- 1 | import morgan from 'morgan' 2 | import bodyParser from 'body-parser' 3 | import express, { Request, Response } from 'express' 4 | 5 | import configs from './configs' 6 | import createUserService from './services' 7 | import createAuthRouter from './routes' 8 | import createMQConsumer from './consumer' 9 | import createMQPublisher from './publisher' 10 | import createUserRepository from './repositories' 11 | 12 | const app = express() 13 | 14 | const conf = configs.createConfigs() 15 | const conn = configs.createMongoDB(conf) 16 | const logger = configs.createLogger(__dirname) 17 | const userRepo = createUserRepository(conn) 18 | const publisher = createMQPublisher(conf) 19 | const userService = createUserService(userRepo, publisher) 20 | const consumer = createMQConsumer(conf, userService) 21 | const authRouter = createAuthRouter(userService) 22 | 23 | app.use(bodyParser.json()) 24 | app.use(morgan('combined', { stream: logger })) 25 | app.use('/auth', authRouter) 26 | 27 | app.get('/', (req: Request, res: Response) => { 28 | res.send('Hello World!') 29 | }) 30 | 31 | consumer() 32 | 33 | app.listen(conf.PORT, () => { 34 | console.log(`Server is running on port ${conf.PORT}`) 35 | }) 36 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/toidentifier/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Douglas Christopher Wilson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/unpipe/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2015 Douglas Christopher Wilson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/finalhandler/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014-2017 Douglas Christopher Wilson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/send/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2012 TJ Holowaychuk 4 | Copyright (c) 2014-2016 Douglas Christopher Wilson 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | 'Software'), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/content-disposition/HISTORY.md: -------------------------------------------------------------------------------- 1 | 0.5.3 / 2018-12-17 2 | ================== 3 | 4 | * Use `safe-buffer` for improved Buffer API 5 | 6 | 0.5.2 / 2016-12-08 7 | ================== 8 | 9 | * Fix `parse` to accept any linear whitespace character 10 | 11 | 0.5.1 / 2016-01-17 12 | ================== 13 | 14 | * perf: enable strict mode 15 | 16 | 0.5.0 / 2014-10-11 17 | ================== 18 | 19 | * Add `parse` function 20 | 21 | 0.4.0 / 2014-09-21 22 | ================== 23 | 24 | * Expand non-Unicode `filename` to the full ISO-8859-1 charset 25 | 26 | 0.3.0 / 2014-09-20 27 | ================== 28 | 29 | * Add `fallback` option 30 | * Add `type` option 31 | 32 | 0.2.0 / 2014-09-19 33 | ================== 34 | 35 | * Reduce ambiguity of file names with hex escape in buggy browsers 36 | 37 | 0.1.2 / 2014-09-19 38 | ================== 39 | 40 | * Fix periodic invalid Unicode filename header 41 | 42 | 0.1.1 / 2014-09-19 43 | ================== 44 | 45 | * Fix invalid characters appearing in `filename*` parameter 46 | 47 | 0.1.0 / 2014-09-18 48 | ================== 49 | 50 | * Make the `filename` argument optional 51 | 52 | 0.0.0 / 2014-09-18 53 | ================== 54 | 55 | * Initial release 56 | -------------------------------------------------------------------------------- /event-driven-article-material/notification/src/consumer.ts: -------------------------------------------------------------------------------- 1 | import amqp, { Message } from 'amqplib/callback_api' 2 | 3 | const createMQConsumer = (amqpURl: string, queueName: string) => { 4 | console.log('Connecting to RabbitMQ...') 5 | return () => { 6 | amqp.connect(amqpURl, (errConn, conn) => { 7 | if (errConn) { 8 | throw errConn 9 | } 10 | 11 | conn.createChannel((errChan, chan) => { 12 | if (errChan) { 13 | throw errChan 14 | } 15 | 16 | console.log('Connected to RabbitMQ') 17 | chan.assertQueue(queueName, { durable: true }) 18 | chan.consume(queueName, (msg: Message | null) => { 19 | if (msg) { 20 | const parsed = JSON.parse(msg.content.toString()) 21 | switch (parsed.action) { 22 | case 'REGISTER': 23 | console.log('Consuming REGISTER action', parsed.data) 24 | break 25 | case 'LOGIN': 26 | console.log('Consuming LOGIN action', parsed.data) 27 | break 28 | default: 29 | break 30 | } 31 | } 32 | }, { noAck: true }) 33 | }) 34 | }) 35 | } 36 | } 37 | 38 | export default createMQConsumer 39 | -------------------------------------------------------------------------------- /event-driven-microservices/user/src/consumer/consumer.ts: -------------------------------------------------------------------------------- 1 | import amqp, { Message } from 'amqplib/callback_api' 2 | 3 | import { ConfigType } from '../configs' 4 | import { IUserService } from '../services' 5 | 6 | const createMQConsumer = (config: ConfigType, userService: IUserService) => { 7 | console.log('Connecting to RabbitMQ...') 8 | return () => { 9 | amqp.connect(config.AMQP_URL, (errConn, conn) => { 10 | if (errConn) { 11 | throw errConn 12 | } 13 | 14 | conn.createChannel((errChan, chan) => { 15 | if (errChan) { 16 | throw errChan 17 | } 18 | 19 | console.log('Connected to RabbitMQ') 20 | chan.assertQueue(config.AUTH_TO_USER_QUEUE, { durable: true }) 21 | chan.consume(config.AUTH_TO_USER_QUEUE, (msg: Message | null) => { 22 | if (msg) { 23 | const parsed = JSON.parse(msg.content.toString()) 24 | switch (parsed.action) { 25 | case 'CREATE': 26 | userService.createFromAuth(parsed.data) 27 | break 28 | default: 29 | break 30 | } 31 | } 32 | }, { noAck: true }) 33 | }) 34 | }) 35 | } 36 | } 37 | 38 | export default createMQConsumer 39 | -------------------------------------------------------------------------------- /handbook/event-driven-design/user/src/consumer/consumer.ts: -------------------------------------------------------------------------------- 1 | import amqp, { Message } from 'amqplib/callback_api' 2 | 3 | import { ConfigType } from '../configs' 4 | import { IUserService } from '../services' 5 | 6 | const createMQConsumer = (config: ConfigType, userService: IUserService) => { 7 | console.log('Connecting to RabbitMQ...') 8 | return () => { 9 | amqp.connect(config.AMQP_URL, (errConn, conn) => { 10 | if (errConn) { 11 | throw errConn 12 | } 13 | 14 | conn.createChannel((errChan, chan) => { 15 | if (errChan) { 16 | throw errChan 17 | } 18 | 19 | console.log('Connected to RabbitMQ') 20 | chan.assertQueue(config.AUTH_TO_USER_QUEUE, { durable: true }) 21 | chan.consume(config.AUTH_TO_USER_QUEUE, (msg: Message | null) => { 22 | if (msg) { 23 | const parsed = JSON.parse(msg.content.toString()) 24 | switch (parsed.action) { 25 | case 'CREATE': 26 | userService.createFromAuth(parsed.data) 27 | break 28 | default: 29 | break 30 | } 31 | } 32 | }, { noAck: true }) 33 | }) 34 | }) 35 | } 36 | } 37 | 38 | export default createMQConsumer 39 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/iconv-lite/encodings/tables/gbk-added.json: -------------------------------------------------------------------------------- 1 | [ 2 | ["a140","",62], 3 | ["a180","",32], 4 | ["a240","",62], 5 | ["a280","",32], 6 | ["a2ab","",5], 7 | ["a2e3","€"], 8 | ["a2ef",""], 9 | ["a2fd",""], 10 | ["a340","",62], 11 | ["a380","",31," "], 12 | ["a440","",62], 13 | ["a480","",32], 14 | ["a4f4","",10], 15 | ["a540","",62], 16 | ["a580","",32], 17 | ["a5f7","",7], 18 | ["a640","",62], 19 | ["a680","",32], 20 | ["a6b9","",7], 21 | ["a6d9","",6], 22 | ["a6ec",""], 23 | ["a6f3",""], 24 | ["a6f6","",8], 25 | ["a740","",62], 26 | ["a780","",32], 27 | ["a7c2","",14], 28 | ["a7f2","",12], 29 | ["a896","",10], 30 | ["a8bc",""], 31 | ["a8bf","ǹ"], 32 | ["a8c1",""], 33 | ["a8ea","",20], 34 | ["a958",""], 35 | ["a95b",""], 36 | ["a95d",""], 37 | ["a989","〾⿰",11], 38 | ["a997","",12], 39 | ["a9f0","",14], 40 | ["aaa1","",93], 41 | ["aba1","",93], 42 | ["aca1","",93], 43 | ["ada1","",93], 44 | ["aea1","",93], 45 | ["afa1","",93], 46 | ["d7fa","",4], 47 | ["f8a1","",93], 48 | ["f9a1","",93], 49 | ["faa1","",93], 50 | ["fba1","",93], 51 | ["fca1","",93], 52 | ["fda1","",93], 53 | ["fe50","⺁⺄㑳㑇⺈⺋㖞㘚㘎⺌⺗㥮㤘㧏㧟㩳㧐㭎㱮㳠⺧⺪䁖䅟⺮䌷⺳⺶⺷䎱䎬⺻䏝䓖䙡䙌"], 54 | ["fe80","䜣䜩䝼䞍⻊䥇䥺䥽䦂䦃䦅䦆䦟䦛䦷䦶䲣䲟䲠䲡䱷䲢䴓",6,"䶮",93] 55 | ] 56 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/bytes/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2012-2014 TJ Holowaychuk 4 | Copyright (c) 2015 Jed Watson 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | 'Software'), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /load-test-lbs/dist/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,iDAA0B;AAC1B,yBAA0B;AAC1B,sCAAkC;AAElC,IAAM,WAAW,GAAG,IAAI,eAAK,CAAC,QAAQ,CAAC,CAAA;AACvC,IAAM,eAAe,GAAG,IAAI,eAAK,CAAC,YAAY,CAAC,CAAA;AAElC,QAAA,OAAO,GAAG;IACnB,QAAQ,EAAE,KAAK;IACf,GAAG,EAAE,EAAE;CACV,CAAA;AAED;IACI,IAAM,GAAG,GAAG,uCAAuC,CAAA;IAEnD,IAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC;QACrC,QAAQ,EAAE,yBAAyB;QACnC,OAAO,EAAE;YACL,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,EAAE;YACV,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE,EAAE;SACf;KACJ,CAAC,CAAA;IAEF,IAAM,YAAY,GAAG;QACjB,OAAO,EAAE;YACL,cAAc,EAAE,kBAAkB;YAClC,OAAO,EAAE,6BAA6B;YACtC,UAAU,EAAE,sEAAsE;SACrF;KACJ,CAAA;IAED,IAAM,cAAc,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,iBAAiB,EAAE,YAAY,CAAC,CAAA;IACtE,WAAW,CAAC,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAEhD,IAAM,qBAAqB,GAAG,IAAI,CAAC,SAAS,CAAC;QACzC,QAAQ,EAAE,yBAAyB;QACnC,OAAO,EAAE;YACL,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,EAAE;YACV,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE,EAAE;SACf;KACJ,CAAC,CAAA;IAEF,IAAM,gBAAgB,GAAG;QACrB,OAAO,EAAE;YACL,cAAc,EAAE,kBAAkB;YAClC,OAAO,EAAE,6BAA6B;YACtC,UAAU,EAAE,sEAAsE;SACrF;KACJ,CAAA;IAED,IAAM,kBAAkB,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,qBAAqB,EAAE,gBAAgB,CAAC,CAAA;IAClF,eAAe,CAAC,GAAG,CAAC,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IACxD,UAAK,CAAC,GAAG,CAAC,CAAA;AACd,CAAC;AA7CD,4BA6CC"} -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/escape-html/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2012-2013 TJ Holowaychuk 4 | Copyright (c) 2015 Andreas Lubbe 5 | Copyright (c) 2015 Tiancheng "Timothy" Gu 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | 'Software'), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /event-driven-microservices/auth/src/routes/auth.ts: -------------------------------------------------------------------------------- 1 | import { Router, Request, Response } from 'express' 2 | import { User } from '../repositories' 3 | 4 | import { IUserService } from '../services' 5 | 6 | const createAuthRouter = (service: IUserService) => { 7 | const r = Router() 8 | 9 | r.post('/login', async (req: Request, res: Response): Promise => { 10 | try { 11 | const result = await service.login(req.body.email, req.body.password) 12 | res.json({ 13 | success: true, 14 | data: result, 15 | }) 16 | } catch (error: any) { 17 | res.json({ 18 | error: error.message, 19 | }) 20 | } 21 | }) 22 | 23 | r.post('/register', async (req: Request, res: Response): Promise => { 24 | try { 25 | const user: User = { 26 | email: req.body.email, 27 | password: req.body.password, 28 | role: req.body.role, 29 | fullname: req.body.fullname, 30 | } 31 | const result = await service.register(user) 32 | res.json({ 33 | success: true, 34 | data: result, 35 | }) 36 | } catch (error: any) { 37 | res.json({ 38 | error: error.message, 39 | }) 40 | } 41 | }) 42 | 43 | return r 44 | } 45 | 46 | export default createAuthRouter 47 | -------------------------------------------------------------------------------- /handbook/event-driven-design/auth/src/routes/auth.ts: -------------------------------------------------------------------------------- 1 | import { Router, Request, Response } from 'express' 2 | import { User } from '../repositories' 3 | 4 | import { IUserService } from '../services' 5 | 6 | const createAuthRouter = (service: IUserService) => { 7 | const r = Router() 8 | 9 | r.post('/login', async (req: Request, res: Response): Promise => { 10 | try { 11 | const result = await service.login(req.body.email, req.body.password) 12 | res.json({ 13 | success: true, 14 | data: result, 15 | }) 16 | } catch (error: any) { 17 | res.json({ 18 | error: error.message, 19 | }) 20 | } 21 | }) 22 | 23 | r.post('/register', async (req: Request, res: Response): Promise => { 24 | try { 25 | const user: User = { 26 | email: req.body.email, 27 | password: req.body.password, 28 | role: req.body.role, 29 | fullname: req.body.fullname, 30 | } 31 | const result = await service.register(user) 32 | res.json({ 33 | success: true, 34 | data: result, 35 | }) 36 | } catch (error: any) { 37 | res.json({ 38 | error: error.message, 39 | }) 40 | } 41 | }) 42 | 43 | return r 44 | } 45 | 46 | export default createAuthRouter 47 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/accepts/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 Jonathan Ong 4 | Copyright (c) 2015 Douglas Christopher Wilson 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | 'Software'), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/mime-types/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 Jonathan Ong 4 | Copyright (c) 2015 Douglas Christopher Wilson 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | 'Software'), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/on-finished/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2013 Jonathan Ong 4 | Copyright (c) 2014 Douglas Christopher Wilson 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | 'Software'), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/path-to-regexp/Readme.md: -------------------------------------------------------------------------------- 1 | # Path-to-RegExp 2 | 3 | Turn an Express-style path string such as `/user/:name` into a regular expression. 4 | 5 | **Note:** This is a legacy branch. You should upgrade to `1.x`. 6 | 7 | ## Usage 8 | 9 | ```javascript 10 | var pathToRegexp = require('path-to-regexp'); 11 | ``` 12 | 13 | ### pathToRegexp(path, keys, options) 14 | 15 | - **path** A string in the express format, an array of such strings, or a regular expression 16 | - **keys** An array to be populated with the keys present in the url. Once the function completes, this will be an array of strings. 17 | - **options** 18 | - **options.sensitive** Defaults to false, set this to true to make routes case sensitive 19 | - **options.strict** Defaults to false, set this to true to make the trailing slash matter. 20 | - **options.end** Defaults to true, set this to false to only match the prefix of the URL. 21 | 22 | ```javascript 23 | var keys = []; 24 | var exp = pathToRegexp('/foo/:bar', keys); 25 | //keys = ['bar'] 26 | //exp = /^\/foo\/(?:([^\/]+?))\/?$/i 27 | ``` 28 | 29 | ## Live Demo 30 | 31 | You can see a live demo of this library in use at [express-route-tester](http://forbeslindesay.github.com/express-route-tester/). 32 | 33 | ## License 34 | 35 | MIT 36 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/body-parser/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 Jonathan Ong 4 | Copyright (c) 2014-2015 Douglas Christopher Wilson 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | 'Software'), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/fresh/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2012 TJ Holowaychuk 4 | Copyright (c) 2016-2017 Douglas Christopher Wilson 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | 'Software'), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/http-errors/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014 Jonathan Ong me@jongleberry.com 5 | Copyright (c) 2016 Douglas Christopher Wilson doug@somethingdoug.com 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/statuses/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014 Jonathan Ong 5 | Copyright (c) 2016 Douglas Christopher Wilson 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/type-is/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 Jonathan Ong 4 | Copyright (c) 2014-2015 Douglas Christopher Wilson 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | 'Software'), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/cookie/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2012-2014 Roman Shtylman 4 | Copyright (c) 2015 Douglas Christopher Wilson 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | 'Software'), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/merge-descriptors/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2013 Jonathan Ong 4 | Copyright (c) 2015 Douglas Christopher Wilson 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | 'Software'), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/parseurl/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | (The MIT License) 3 | 4 | Copyright (c) 2014 Jonathan Ong 5 | Copyright (c) 2014-2017 Douglas Christopher Wilson 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | 'Software'), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/raw-body/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2014 Jonathan Ong 4 | Copyright (c) 2014-2015 Douglas Christopher Wilson 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/methods/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2013-2014 TJ Holowaychuk 4 | Copyright (c) 2015-2016 Douglas Christopher Wilson 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | 'Software'), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/negotiator/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2012-2014 Federico Romero 4 | Copyright (c) 2012-2014 Isaac Z. Schlueter 5 | Copyright (c) 2014-2015 Douglas Christopher Wilson 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | 'Software'), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/range-parser/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2012-2014 TJ Holowaychuk 4 | Copyright (c) 2015-2016 Douglas Christopher Wilson { 32 | res.send('Hello World!') 33 | }) 34 | 35 | consumer() 36 | 37 | app.listen(conf.PORT, () => { 38 | console.log(`Server is running on port ${conf.PORT}`) 39 | }) 40 | -------------------------------------------------------------------------------- /handbook/event-driven-design/user/src/index.ts: -------------------------------------------------------------------------------- 1 | import morgan from 'morgan' 2 | import bodyParser from 'body-parser' 3 | import express, { Request, Response } from 'express' 4 | 5 | import configs from './configs' 6 | 7 | import authMiddleware from './middlewares' 8 | 9 | import createUserRouter from './routes' 10 | import createMQConsumer from './consumer' 11 | import createUserService from './services' 12 | import createMQPublisher from './publisher' 13 | import createUserRepository from './repositories' 14 | 15 | const app = express() 16 | 17 | const conf = configs.createConfigs() 18 | const conn = configs.createMongoDB(conf) 19 | const logger = configs.createLogger(__dirname) 20 | const userRepo = createUserRepository(conn) 21 | const publisher = createMQPublisher(conf) 22 | const userService = createUserService(userRepo, publisher) 23 | const consumer = createMQConsumer(conf, userService) 24 | const userRouter = createUserRouter(userService) 25 | 26 | app.use(bodyParser.json()) 27 | app.use(authMiddleware) 28 | app.use(morgan('combined', { stream: logger })) 29 | app.use('/user', userRouter) 30 | 31 | app.get('/', (req: Request, res: Response) => { 32 | res.send('Hello World!') 33 | }) 34 | 35 | consumer() 36 | 37 | app.listen(conf.PORT, () => { 38 | console.log(`Server is running on port ${conf.PORT}`) 39 | }) 40 | -------------------------------------------------------------------------------- /net-ninja/src/app.ts: -------------------------------------------------------------------------------- 1 | import { Invoice } from './classes/Invoice.js' 2 | import { Payment } from './classes/Payment.js' 3 | import { HasFormatter } from './interfaces/HasFormatter.js' 4 | import { ListTemplate } from './classes/ListTemplate.js' 5 | 6 | 7 | const form = document.querySelector('.new-item-form') as HTMLFormElement 8 | 9 | const type = document.querySelector('#type') as HTMLSelectElement 10 | const tofrom = document.querySelector('#tofrom') as HTMLInputElement 11 | const details = document.querySelector('#details') as HTMLInputElement 12 | const amount = document.querySelector('#amount') as HTMLInputElement 13 | 14 | const ul = document.querySelector('ul')! 15 | const list = new ListTemplate(ul) 16 | 17 | form.addEventListener('submit', (event: Event) => { 18 | event.preventDefault() 19 | 20 | let values: [string, string, number] 21 | values = [tofrom.value, details.value, amount.valueAsNumber] 22 | 23 | let doc: HasFormatter 24 | if (type.value === 'invoice') { 25 | doc = new Invoice(...values) 26 | } else { 27 | doc = new Payment(...values) 28 | } 29 | 30 | list.render(doc, type.value, 'start') 31 | }) 32 | 33 | 34 | // Tuples 35 | let mixed = ['sekar', 22, true] 36 | console.log(mixed) 37 | 38 | let tup: [string, number, boolean] 39 | tup = ['saskia', 20, true] 40 | console.log(tup) -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/debug/Makefile: -------------------------------------------------------------------------------- 1 | # get Makefile directory name: http://stackoverflow.com/a/5982798/376773 2 | THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) 3 | THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) 4 | 5 | # BIN directory 6 | BIN := $(THIS_DIR)/node_modules/.bin 7 | 8 | # Path 9 | PATH := node_modules/.bin:$(PATH) 10 | SHELL := /bin/bash 11 | 12 | # applications 13 | NODE ?= $(shell which node) 14 | YARN ?= $(shell which yarn) 15 | PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm)) 16 | BROWSERIFY ?= $(NODE) $(BIN)/browserify 17 | 18 | .FORCE: 19 | 20 | install: node_modules 21 | 22 | node_modules: package.json 23 | @NODE_ENV= $(PKG) install 24 | @touch node_modules 25 | 26 | lint: .FORCE 27 | eslint browser.js debug.js index.js node.js 28 | 29 | test-node: .FORCE 30 | istanbul cover node_modules/mocha/bin/_mocha -- test/**.js 31 | 32 | test-browser: .FORCE 33 | mkdir -p dist 34 | 35 | @$(BROWSERIFY) \ 36 | --standalone debug \ 37 | . > dist/debug.js 38 | 39 | karma start --single-run 40 | rimraf dist 41 | 42 | test: .FORCE 43 | concurrently \ 44 | "make test-node" \ 45 | "make test-browser" 46 | 47 | coveralls: 48 | cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js 49 | 50 | .PHONY: all install clean distclean 51 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/serve-static/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2010 Sencha Inc. 4 | Copyright (c) 2011 LearnBoost 5 | Copyright (c) 2011 TJ Holowaychuk 6 | Copyright (c) 2014-2016 Douglas Christopher Wilson 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining 9 | a copy of this software and associated documentation files (the 10 | 'Software'), to deal in the Software without restriction, including 11 | without limitation the rights to use, copy, modify, merge, publish, 12 | distribute, sublicense, and/or sell copies of the Software, and to 13 | permit persons to whom the Software is furnished to do so, subject to 14 | the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be 17 | included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /load-test-lbs/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "load-test-lbs", 3 | "version": "1.0.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "load-test-lbs", 9 | "version": "1.0.0", 10 | "license": "ISC", 11 | "dependencies": { 12 | "@types/k6": "^0.34.1", 13 | "k6": "^0.0.0" 14 | } 15 | }, 16 | "node_modules/@types/k6": { 17 | "version": "0.34.1", 18 | "resolved": "https://registry.npmjs.org/@types/k6/-/k6-0.34.1.tgz", 19 | "integrity": "sha512-bcxeok7rUxSRmzVWOeHqM/G2FxnHLis6RTPdvcjQdYxbiwky0oQRIbUiqsWHzreX4nr00+LF7R3AYE69MTfNvA==" 20 | }, 21 | "node_modules/k6": { 22 | "version": "0.0.0", 23 | "resolved": "https://registry.npmjs.org/k6/-/k6-0.0.0.tgz", 24 | "integrity": "sha1-jJIyAL4KaMV46PWjK+lrHYBlzDs=" 25 | } 26 | }, 27 | "dependencies": { 28 | "@types/k6": { 29 | "version": "0.34.1", 30 | "resolved": "https://registry.npmjs.org/@types/k6/-/k6-0.34.1.tgz", 31 | "integrity": "sha512-bcxeok7rUxSRmzVWOeHqM/G2FxnHLis6RTPdvcjQdYxbiwky0oQRIbUiqsWHzreX4nr00+LF7R3AYE69MTfNvA==" 32 | }, 33 | "k6": { 34 | "version": "0.0.0", 35 | "resolved": "https://registry.npmjs.org/k6/-/k6-0.0.0.tgz", 36 | "integrity": "sha1-jJIyAL4KaMV46PWjK+lrHYBlzDs=" 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /net-ninja/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TypeScript Tutorial 6 | 7 | 8 | 9 | 10 |
11 |

Finance Logger

12 | 13 | 14 |
    15 | 16 |
17 |
18 | 19 |
20 |
21 |
22 | 23 | 27 |
28 |
29 | 30 | 31 |
32 |
33 | 34 | 35 |
36 |
37 | 38 | 39 |
40 | 41 |
42 | 43 | The Net Ninja 44 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/parseurl/HISTORY.md: -------------------------------------------------------------------------------- 1 | 1.3.3 / 2019-04-15 2 | ================== 3 | 4 | * Fix Node.js 0.8 return value inconsistencies 5 | 6 | 1.3.2 / 2017-09-09 7 | ================== 8 | 9 | * perf: reduce overhead for full URLs 10 | * perf: unroll the "fast-path" `RegExp` 11 | 12 | 1.3.1 / 2016-01-17 13 | ================== 14 | 15 | * perf: enable strict mode 16 | 17 | 1.3.0 / 2014-08-09 18 | ================== 19 | 20 | * Add `parseurl.original` for parsing `req.originalUrl` with fallback 21 | * Return `undefined` if `req.url` is `undefined` 22 | 23 | 1.2.0 / 2014-07-21 24 | ================== 25 | 26 | * Cache URLs based on original value 27 | * Remove no-longer-needed URL mis-parse work-around 28 | * Simplify the "fast-path" `RegExp` 29 | 30 | 1.1.3 / 2014-07-08 31 | ================== 32 | 33 | * Fix typo 34 | 35 | 1.1.2 / 2014-07-08 36 | ================== 37 | 38 | * Seriously fix Node.js 0.8 compatibility 39 | 40 | 1.1.1 / 2014-07-08 41 | ================== 42 | 43 | * Fix Node.js 0.8 compatibility 44 | 45 | 1.1.0 / 2014-07-08 46 | ================== 47 | 48 | * Incorporate URL href-only parse fast-path 49 | 50 | 1.0.1 / 2014-03-08 51 | ================== 52 | 53 | * Add missing `require` 54 | 55 | 1.0.0 / 2014-03-08 56 | ================== 57 | 58 | * Genesis from `connect` 59 | -------------------------------------------------------------------------------- /playwright-tutorial/public/next.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/statuses/HISTORY.md: -------------------------------------------------------------------------------- 1 | 1.5.0 / 2018-03-27 2 | ================== 3 | 4 | * Add `103 Early Hints` 5 | 6 | 1.4.0 / 2017-10-20 7 | ================== 8 | 9 | * Add `STATUS_CODES` export 10 | 11 | 1.3.1 / 2016-11-11 12 | ================== 13 | 14 | * Fix return type in JSDoc 15 | 16 | 1.3.0 / 2016-05-17 17 | ================== 18 | 19 | * Add `421 Misdirected Request` 20 | * perf: enable strict mode 21 | 22 | 1.2.1 / 2015-02-01 23 | ================== 24 | 25 | * Fix message for status 451 26 | - `451 Unavailable For Legal Reasons` 27 | 28 | 1.2.0 / 2014-09-28 29 | ================== 30 | 31 | * Add `208 Already Repored` 32 | * Add `226 IM Used` 33 | * Add `306 (Unused)` 34 | * Add `415 Unable For Legal Reasons` 35 | * Add `508 Loop Detected` 36 | 37 | 1.1.1 / 2014-09-24 38 | ================== 39 | 40 | * Add missing 308 to `codes.json` 41 | 42 | 1.1.0 / 2014-09-21 43 | ================== 44 | 45 | * Add `codes.json` for universal support 46 | 47 | 1.0.4 / 2014-08-20 48 | ================== 49 | 50 | * Package cleanup 51 | 52 | 1.0.3 / 2014-06-08 53 | ================== 54 | 55 | * Add 308 to `.redirect` category 56 | 57 | 1.0.2 / 2014-03-13 58 | ================== 59 | 60 | * Add `.retry` category 61 | 62 | 1.0.1 / 2014-03-12 63 | ================== 64 | 65 | * Initial release 66 | -------------------------------------------------------------------------------- /event-driven-article-material/auth/src/index.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv' 2 | import bodyParser from 'body-parser' 3 | import express, { Request, Response } from 'express' 4 | 5 | import createMQProducer from './producer' 6 | 7 | dotenv.config() 8 | 9 | const PORT = parseInt(String(process.env.PORT), 10) || 3000 10 | const AMQP_URL = String(process.env.AMQP_URL) 11 | const QUEUE_NAME = String(process.env.QUEUE_NAME) 12 | 13 | const app = express() 14 | const producer = createMQProducer(AMQP_URL, QUEUE_NAME) 15 | 16 | app.use(bodyParser.json()) 17 | 18 | app.post('/register', (req: Request, res: Response) => { 19 | const { email, password } = req.body 20 | console.log('Registering user...') 21 | const msg = { 22 | action: 'REGISTER', 23 | data: { email, password }, 24 | } 25 | producer(JSON.stringify(msg)) 26 | 27 | return res.send('OK') 28 | }) 29 | 30 | app.post('/login', (req: Request, res: Response) => { 31 | const { email, password } = req.body 32 | console.log('Login user...') 33 | const msg = { 34 | action: 'LOGIN', 35 | data: { email, password }, 36 | } 37 | producer(JSON.stringify(msg)) 38 | 39 | return res.send('OK') 40 | }) 41 | 42 | app.get('/', (req: Request, res: Response) => { 43 | res.send('Hello World') 44 | }) 45 | 46 | app.listen(PORT, () => { 47 | console.log(`Server is listening on port ${PORT}`) 48 | }) 49 | -------------------------------------------------------------------------------- /conductor-orchestration-shipping/node_modules/express/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2009-2014 TJ Holowaychuk 4 | Copyright (c) 2013-2014 Roman Shtylman 5 | Copyright (c) 2014-2015 Douglas Christopher Wilson 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | 'Software'), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /event-driven-microservices/auth/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "auth", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "build": "tsc", 8 | "dev": "eslint --fix --ext .ts ./src && nodemon", 9 | "lint": "eslint --fix --ext .ts ./src", 10 | "start": "node ./build/index.js" 11 | }, 12 | "keywords": [], 13 | "author": "", 14 | "license": "ISC", 15 | "devDependencies": { 16 | "@types/amqplib": "^0.8.2", 17 | "@types/bcryptjs": "^2.4.2", 18 | "@types/express": "^4.17.13", 19 | "@types/jsonwebtoken": "^8.5.8", 20 | "@types/mongoose": "^5.11.97", 21 | "@types/morgan": "^1.9.3", 22 | "@typescript-eslint/eslint-plugin": "^5.10.2", 23 | "@typescript-eslint/parser": "^5.10.2", 24 | "typescript": "^4.5.5" 25 | }, 26 | "dependencies": { 27 | "amqplib": "^0.8.0", 28 | "bcryptjs": "^2.4.3", 29 | "body-parser": "^1.19.1", 30 | "dotenv": "^16.0.0", 31 | "eslint": "^8.8.0", 32 | "eslint-config-airbnb-base": "^15.0.0", 33 | "eslint-plugin-import": "^2.25.4", 34 | "express": "^4.17.2", 35 | "file-stream-rotator": "^0.6.1", 36 | "fs": "^0.0.1-security", 37 | "jsonwebtoken": "^8.5.1", 38 | "mongoose": "^6.2.0", 39 | "mongoose-paginate-v2": "^1.6.1", 40 | "morgan": "^1.10.0", 41 | "nodemon": "^2.0.15", 42 | "path": "^0.12.7" 43 | } 44 | } 45 | --------------------------------------------------------------------------------